Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(browser): 限定延后验证候选的实际步骤能力
Dashe57029b19457
diff --git a/packages/browser-control-runtime/upstream/MAINTAINING.md b/packages/browser-control-runtime/upstream/MAINTAINING.mdindex 7acc8c8d4d..2757358f37 100644--- a/packages/browser-control-runtime/upstream/MAINTAINING.md+++ b/packages/browser-control-runtime/upstream/MAINTAINING.md@@ -199,7 +199,7 @@ pnpm --filter @cindy/browser-control-runtime test # 契约 + SSRF guard### 配方按使用维护与等待条件(2026-10-23)-- `recipe` 支持 `site + recipeDraft` 内存试跑;`saveRecipe` 通常接受同一 MCP 会话已通过验证的相同内容与 profile。新只读流程可用 `deferValidation:true` 保存 candidate(不能覆盖已有 id),下一次真实任务显式执行且 guard/expect 全部通过后转为 active;状态写入失败保留本次执行成功,不能重放。active 不证明未测参数组合。正常检查不请求模型,不定时后台刷新;失败交给当前任务模型观察、同 id 一轮修订,失败回普通操作。修复预算为会话内状态,MCP 会话重建后重新计数;暂停状态写进配方,跨重启保留。+- `recipe` 支持 `site + recipeDraft` 内存试跑;`saveRecipe` 通常接受同一 MCP 会话已通过验证的相同内容与 profile。声明 read 且仅含 navigate、无 fn 的 wait、extract、requests、responseBody 的新流程可用 `deferValidation:true` 保存 candidate(不能覆盖已有 id),下一次真实任务显式执行且 guard/expect 全部通过后转为 active;交互、任意脚本和 adapter 须当次真实操作验证,不能只信 access 标签。保存、发现、执行旧 candidate 共用 `deferredRecipeIssue` 判据;不承诺远端 GET 没有业务副作用,现有逐次审批仍适用。状态写入失败保留本次执行成功,不能重放。active 不证明未测参数组合。正常检查不请求模型,不定时后台刷新;失败交给当前任务模型观察、同 id 一轮修订,失败回普通操作。修复预算为会话内状态,MCP 会话重建后重新计数;暂停状态写进配方,跨重启保留。- 新保存配方的交互/读取步骤须有完整 URL 和可选唯一可见 CSS 元素/文本 `guard`;末步 `expect` 检查数量、必需顶层字段与业务值。extract 将 guard 与读取合成同一次 evaluate;写动作前独立 guard,不能把它当事务或幂等保证。工具不重放步骤,后置失败须先核对写入是否已成功。- 本地每站 `recipes/<id 的 SHA-256>.json` 支持多个流程,原子替换复用 Desktop 工具;loader 兼容 `recipe.json`、新文件优先。旧配方保留执行兼容,实际失败后暂停;新建/修订必须经过新验证。失败不把候选覆盖到正式配方。跨任务并发修改同一配方仍是最后写入优先,不新增锁/版本管理系统。- `wait.fn` 补丁在 `sync.mjs`:host 只编译函数,页面执行;传真实 function 给 `waitForFunction`,避免函数源码被当 truthy、重复 eval 被 Trusted Types 拦截。timeout 放第三参数。异步 predicate 明确拒绝,避免 Promise 假成功;evaluate 仍支持 async。diff --git a/packages/lizi-mcps/src/browser/browserMcpServer.test.ts b/packages/lizi-mcps/src/browser/browserMcpServer.test.tsindex 71af102555..95fb9c81b4 100644--- a/packages/lizi-mcps/src/browser/browserMcpServer.test.ts+++ b/packages/lizi-mcps/src/browser/browserMcpServer.test.ts@@ -54,10 +54,42 @@ describe('browser experience cache', () => {const draft: Recipe = { id: 'experience-search', access: 'read', match: ['experience.test'], description: 'Search books',inputs: { query: { required: true } }, steps: [{ action: 'evaluate', fn: '() => ({title: "found"})',guard: { url: 'https://experience.test/' }, expect: { requiredFields: ['title'] }, as: 'items' }], output: '{{items}}' };+ const readDraft: Recipe = { ...draft, steps: [{ action: 'extract', extract: { fields: { title: 'h1' } },+ guard: { url: 'https://experience.test/' }, expect: { requiredFields: ['title'] }, as: 'items' }] };+ const extracted = { ok: true, count: 1, records: [{ title: 'found' }] };++ // Review regression, unit/MCP entry: metadata cannot authorize deferred+ // mutations. Old coverage only rejected access=write, not mislabeled steps.+ it.each([+ { action: 'click' as const, selector: '#submit' },+ { action: 'type' as const, selector: '#input', value: 'fake-value' },+ { action: 'select' as const, selector: '#choice', values: ['fake-value'] },+ { action: 'evaluate' as const, fn: "() => fetch('/write', {method:'POST'})" },+ { action: 'wait' as const, fn: "() => { document.querySelector('form').submit(); return true; }" },+ ])('rejects deferred $action capabilities at save, discovery and persisted execution', async step => {+ const unsafe: Recipe = { ...readDraft, id: `unsafe-deferred-${step.action}`,+ steps: [{ ...step, guard: { url: 'https://experience.test/' } }, ...readDraft.steps] };+ let loaded: Recipe | undefined;+ let saves = 0;+ const h = await makeHarness({+ getUserRecipes: async () => ({ version: `unsafe-deferred-${step.action}-${Boolean(loaded)}`,+ recipes: new Map(loaded ? [[loaded.id, loaded]] : []), siteGuides: new Map() }),+ saveUserRecipe: async () => { saves++; return { ok: true }; },+ });+ try {+ expect((await invoke(h, { action: 'saveRecipe', site: 'experience.test', recipeDraft: unsafe, deferValidation: true })).ok).toBe(false);+ expect(saves).toBe(0);+ loaded = { ...unsafe, validation: { site: 'experience.test', state: 'candidate' } };+ expect((await invoke(h, { action: 'siteguide', site: 'experience.test', intent: 'Search' })).recipes).toEqual([]);+ expect((await invoke(h, { action: 'recipe', recipeId: unsafe.id, inputs: { query: 'book' } })).ok).toBe(false);+ expect(h.calls).toHaveLength(0);+ } finally { await h.cleanup(); }+ });// Review regression, unit/MCP entry: omitted and explicit profile names must// refer to the same host identity; changing the default must not widen scope.it.each([true, false])('binds learned recipes to the resolved host profile (deferred=%s)', async deferred => {+ const recipe = deferred ? readDraft : draft;let profile = 'Cindy';let stored: Recipe | undefined;let version = 0;@@ -66,7 +98,7 @@ describe('browser experience cache', () => {getUserRecipes: async () => ({ version: `resolved-profile-${deferred}-${version}`,recipes: new Map(stored ? [[stored.id, stored]] : []), siteGuides: new Map() }),saveUserRecipe: async ({ recipe }) => { stored = recipe; version++; return { ok: true }; },- }, (_req, i) => ({ targetId: 'tab', result: i % 2 === 0 ? true : { title: 'found' } }));+ }, (_req, i) => ({ targetId: 'tab', result: deferred ? { matched: true, value: extracted } : i % 2 === 0 ? true : { title: 'found' } }));try {if (!deferred) {expect((await invoke(h, { action: 'recipe', site: 'experience.test', recipeDraft: draft,@@ -75,7 +107,7 @@ describe('browser experience cache', () => {expect((await invoke(h, { action: 'saveRecipe', site: 'experience.test', recipeDraft: draft })).ok).toBe(false);profile = 'Cindy';}- expect((await invoke(h, { action: 'saveRecipe', site: 'experience.test', recipeDraft: draft,+ expect((await invoke(h, { action: 'saveRecipe', site: 'experience.test', recipeDraft: recipe,profile: 'Cindy', deferValidation: deferred })).ok).toBe(true);expect(stored?.validation?.profile).toBe('Cindy');expect((await invoke(h, { action: 'siteguide', site: 'experience.test', intent: 'Search' })).recipes).toHaveLength(1);@@ -191,6 +223,7 @@ describe('browser experience cache', () => {});it('persists a read candidate without replay and promotes it on a later real invocation', async () => {+ const draft = readDraft;let stored: Recipe | undefined;let version = 0;const deps: Partial<BrowserMcpDeps> = {@@ -205,23 +238,24 @@ describe('browser experience cache', () => {expect((await invoke(h, { action: 'saveRecipe', site: 'experience.test', recipeDraft: draft, deferValidation: true })).ok).toBe(false);expect((await invoke(h, { action: 'saveRecipe', site: 'experience.test', recipeDraft: { ...draft, id: 'write', access: 'write' }, deferValidation: true })).ok).toBe(false);} finally { await h.cleanup(); }- const next = await makeHarness(deps, (_req, i) => ({ result: i === 0 ? true : { title: 'found' } }));+ const next = await makeHarness(deps, () => ({ result: { matched: true, value: extracted } }));try {expect((await invoke(next, { action: 'recipe', recipeId: draft.id, profile: 'other', inputs: { query: 'book' } })).ok).toBe(false);expect((await invoke(next, { action: 'recipe', recipeId: draft.id })).ok).toBe(false);expect(next.calls).toHaveLength(0);- expect((await invoke(next, { action: 'recipe', recipeId: draft.id, inputs: { query: 'book' } })).output).toEqual({ title: 'found' });- expect(next.calls).toHaveLength(2);+ expect((await invoke(next, { action: 'recipe', recipeId: draft.id, inputs: { query: 'book' } })).output).toEqual(extracted);+ expect(next.calls).toHaveLength(1);expect(stored?.validation?.state).toBe('active');} finally { await next.cleanup(); }});it.each(['guard', 'save'] as const)('keeps candidate %s failures honest without replay', async failure => {+ const draft = readDraft;let stored: Recipe = { ...draft, validation: { site: 'experience.test', state: 'candidate', profile: '' } };const h = await makeHarness({getUserRecipes: async () => ({ version: `experience-failure-${failure}`, recipes: new Map([[stored.id, stored]]), siteGuides: new Map() }),saveUserRecipe: async ({ recipe }) => { if (failure === 'save') throw new Error('disk full'); stored = recipe; return { ok: true }; },- }, (_req, i) => ({ result: i === 0 ? failure !== 'guard' : { title: 'found' } }));+ }, () => ({ result: { matched: failure !== 'guard', value: extracted } }));try {const result = await invoke(h, { action: 'recipe', recipeId: draft.id, inputs: { query: 'book' } });if (failure === 'guard') {@@ -233,7 +267,7 @@ describe('browser experience cache', () => {expect(result.ok).toBe(true);expect(result.maintenanceMessage).toContain('保存失败');expect(stored.validation?.state).toBe('candidate');- expect(h.calls).toHaveLength(2);+ expect(h.calls).toHaveLength(1);}} finally { await h.cleanup(); }});diff --git a/packages/lizi-mcps/src/browser/experience.ts b/packages/lizi-mcps/src/browser/experience.tsindex 1286a4d68a..9c1bdbd4cc 100644--- a/packages/lizi-mcps/src/browser/experience.ts+++ b/packages/lizi-mcps/src/browser/experience.ts@@ -1,5 +1,5 @@import { z } from 'zod';-import type { MergedRecipe } from './recipe-loader.js';+import { deferredRecipeIssue, type MergedRecipe } from './recipe-loader.js';/** Persist only execution shape and counters, never URLs, selectors, scripts or values. */export const BrowserExperienceSchema = z.object({@@ -73,6 +73,7 @@ export function suggestRecipes(return [...recipes.values()].filter(({ recipe }) => {if (recipe.validation?.state === 'suspended') return false;+ if (recipe.validation?.state === 'candidate' && deferredRecipeIssue(recipe)) return false;if (recipe.validation?.profile !== undefined && recipe.validation.profile !== profile)return false;return [recipe.validation?.site, ...(recipe.match ?? [])].some((host) => {diff --git a/packages/lizi-mcps/src/browser/prompts/rules/browser-workflow.md b/packages/lizi-mcps/src/browser/prompts/rules/browser-workflow.mdindex c27267d8a5..f68ad2bf14 100644--- a/packages/lizi-mcps/src/browser/prompts/rules/browser-workflow.md+++ b/packages/lizi-mcps/src/browser/prompts/rules/browser-workflow.md@@ -72,7 +72,7 @@4. **要精确字段 / 干净 JSON 才用 `extract`**:snapshot 不够精准(要取某属性、按子选择器拆字段)时,用 `action: "extract"` 一次性提结构化记录(`from` + `multiple` 提列表)。**关键:`fields` 的简写 string 是纯 CSS 选择器(取 textContent);取属性用 `{selector,attr}`,取链接用 `{selector,type:"href"}`——别把属性拼进选择器(`"h3 a@title"` 非法)、别写自然语言。** 不确定选择器就先 scoped snapshot 看结构再写。5. **慎用 screenshot**:只有需要视觉确认(布局 / 图像内容)时才 `action: "screenshot"`;链接要看真实 URL 时 snapshot 带 `urls: true`,元素位置重要时才 `labels: true`。-重复流程才考虑学习:宿主仅留存站点、操作种类和次数,不保留输入、脚本、选择器或业务结果。`learningOpportunity` 只是重复形状提示,不证明业务相同;结合当前成功步骤判断收益。有价值或用户明确要求长期复用时才调用 `recipeHelp` 加载编写手册;偶发任务无需总结,不另起模型。候选可用下一次真实任务验证;正常 guard/expect 只运行代码,失效最多修订一轮,失败回普通操作。写操作不得为测试重放。+重复流程才考虑学习:宿主仅留存站点、操作种类和次数,不保留输入、脚本、选择器或业务结果。`learningOpportunity` 只是重复形状提示,不证明业务相同;结合当前成功步骤判断收益。有价值或用户明确要求长期复用时才调用 `recipeHelp` 加载编写手册;偶发任务无需总结,不另起模型。仅由明确读取步骤组成的新候选可延后到下一次真实任务验证,交互和任意脚本须当次验证,详见 `recipeHelp`;正常 guard/expect 只运行代码,失效最多修订一轮,失败回普通操作。写操作不得为测试重放。大结果返回结构摘要和 `fullResult`,不是完整事实;用 `readResult(resultId,offset,maxChars)` 补读(`nextOffset:null` 表示结束),不猜省略内容或 ref。原文只留当前工具会话最近四份、每份最多 200 万字符;更大结果沿用明确截断,需缩小读取范围。`advisory` 是代码发现的可疑输出,不自动认定业务错误。diff --git a/packages/lizi-mcps/src/browser/prompts/rules/recipe-author.md b/packages/lizi-mcps/src/browser/prompts/rules/recipe-author.mdindex 7c943ca54f..03709426ba 100644--- a/packages/lizi-mcps/src/browser/prompts/rules/recipe-author.md+++ b/packages/lizi-mcps/src/browser/prompts/rules/recipe-author.md@@ -10,7 +10,7 @@4. **抽取**:扒 DOM 字段用 `extract`——**先 scoped `snapshot` 确认选择器在页面上真实存在再写**(别凭空猜选择器、别把属性拼进选择器)。`fields` 的 string 是纯 CSS 选择器(取 textContent),取属性用 `{selector, attr}`,取链接用 `{selector, type:"href"}`。列表用 `from` + `multiple`。5. **交互步**:`click` / `type` / `select` 直接写**稳定 CSS `selector`**(运行时由 act 解析,不写死 snapshot ref,跨会话不腐烂)。`type` 配 `submit: true` 提交表单。6. **验证**:用 `action:"recipe", site, recipeDraft, inputs` 当场试跑。交互和读取步骤须有 `guard:{url,selector?,text?}`:完整 URL 精确匹配,标准 CSS selector 须唯一可见匹配,可选 text 精确匹配(去首尾空格)。URL 应包含账号/项目身份;同 URL 多账号时用页面账号元素校验。最后一步须带 `expect:{minCount?,requiredFields?,equals?}`,用 `as` 和 `output:"{{变量}}"` 返回经过验证的结果。expect 检查每条记录的顶层字段,equals 的字符串可插值。guard/expect 不可 optional。-7. **沉淀**:`action: "saveRecipe"`,传 `site` + `recipeDraft` + 可选 `siteGuideDraft`。通常保存本任务中刚试跑成功的同一份 draft、site 和 profile;不要提供宿主管理的 validation 字段。新只读流程声明 `access:"read"` 后可加 `deferValidation:true`,不重新跑当前任务,先存 candidate,等下一次真实任务显式执行并通过所有 guard/expect 后转为 active。候选不能覆盖已有配方,写流程不能延后验证。每站可保存多个 id。+7. **沉淀**:`action: "saveRecipe"`,传 `site` + `recipeDraft` + 可选 `siteGuideDraft`。通常保存本任务中刚试跑成功的同一份 draft、site 和 profile;不要提供宿主管理的 validation 字段。新流程声明 `access:"read"` 且仅含 `navigate`、无 `fn` 的 `wait`、`extract`、`requests`、`responseBody` 时,可加 `deferValidation:true`,不重新跑当前任务,先存 candidate,等下一次真实任务显式执行并通过所有 guard/expect 后转为 active。交互、`evaluate`、脚本或 adapter 不能凭 read 标签延后验证,须在当次真实操作中验证;不为测试重放写操作。候选不能覆盖已有配方。每站可保存多个 id。验证用少量组合输入覆盖变化的参数、数量和空结果;优先使用下一次真实需求,不穷举、不承诺未测能力。active 仅证明已执行的检查通过,不代表所有输入都测试过。账号/项目的页面身份必须进入 guard,不能仅靠 profile 或站点名称推断登录身份。参数化所有业务值,不保存实际查询、用户资料、密码或令牌;普通记录只用于判断是否重复,不自动上传或转成内置配方。diff --git a/packages/lizi-mcps/src/browser/recipe-loader.ts b/packages/lizi-mcps/src/browser/recipe-loader.tsindex 0167097870..5a3f913eff 100644--- a/packages/lizi-mcps/src/browser/recipe-loader.ts+++ b/packages/lizi-mcps/src/browser/recipe-loader.ts@@ -99,6 +99,18 @@ export const RecipeSchema = z.object({export type Recipe = z.infer<typeof RecipeSchema>;export type RecipeStep = z.infer<typeof RecipeStepSchema>;+/** Deferred candidates can only compose known read primitives, never authored+ * page code or interactive steps. This is a capability check, not a promise+ * about a remote site's GET side effects; normal recipe approval still applies. */+export function deferredRecipeIssue(recipe: Recipe): string | undefined {+ if (recipe.access !== 'read') return '延后验证仅支持声明为 read 的新流程';+ if (recipe.adapter || recipe.steps.some(step => step.fn !== undefined+ || !['navigate', 'wait', 'extract', 'requests', 'responseBody'].includes(step.action))) {+ return '延后验证仅支持 navigate、无 fn 的 wait、extract、requests、responseBody;交互、evaluate 或脚本步骤必须在当次真实操作中验证后再保存,不能为测试重放写操作';+ }+ return undefined;+}+/** SiteGuide is loose, agent-facing knowledge; we validate only the shape we rely on. */export const SiteGuideSchema = z.object({diff --git a/packages/lizi-mcps/src/browser/tools.ts b/packages/lizi-mcps/src/browser/tools.tsindex a52295a207..393dae0dda 100644--- a/packages/lizi-mcps/src/browser/tools.ts+++ b/packages/lizi-mcps/src/browser/tools.ts@@ -27,6 +27,7 @@ import {mergeSiteGuides,RecipeSchema,SiteGuideSchema,+ deferredRecipeIssue,type MergedRecipe,type MergedSiteGuide,type Recipe,@@ -558,7 +559,7 @@ export function registerBrowserTools(registry: BrowserToolRegistry, deps: BrowseinputShape: {action: z.enum(ACTIONS).describe('浏览器操作类型'),intent: z.string().max(120).optional().describe('open/navigate/siteguide: 可选操作意图,用于本地匹配配方;不会自动执行'),- deferValidation: z.boolean().optional().describe('saveRecipe: 将新的只读流程存为候选,下一次真实任务执行时校验;不额外重放当前任务'),+ deferValidation: z.boolean().optional().describe('saveRecipe: 仅明确读取步骤的新流程可存候选,下次真实任务校验;交互和任意脚本须当次验证,不为测试重放写操作'),resultId: z.string().optional().describe('readResult: 大结果返回的 fullResult.id'),offset: z.number().int().nonnegative().optional().describe('readResult: 原始 JSON 字符偏移'),backend: z@@ -811,8 +812,8 @@ export function registerBrowserTools(registry: BrowserToolRegistry, deps: Browseif (!entry) return errorResult('recipe', `unknown recipe: ${args.recipeId}`);if (entry.recipe.validation?.state === 'candidate') {const { validation, ...draft } = entry.recipe;- const issue = draftIssue(draft, validation.site);- if (issue || draft.access !== 'read') return errorResult('recipe', issue ?? '候选必须是只读流程');+ const issue = draftIssue(draft, validation.site) ?? deferredRecipeIssue(draft);+ if (issue) return errorResult('recipe', issue);}const id = entry.recipe.id;const persisted = candidate ? (await recipeRegistry(deps)).get(id)?.recipe : entry.recipe;@@ -1072,7 +1073,8 @@ export function registerBrowserTools(registry: BrowserToolRegistry, deps: Browseif (issue) return errorResult('saveRecipe', issue);const verified = verifiedDrafts.get(parsed.data.id);if (args.deferValidation) {- if (parsed.data.access !== 'read') return errorResult('saveRecipe', '延后验证仅支持声明为 read 的新流程;写操作沿用当次授权和已执行验证');+ const deferredIssue = deferredRecipeIssue(parsed.data);+ if (deferredIssue) return errorResult('saveRecipe', deferredIssue);if ((await recipeRegistry(deps)).has(parsed.data.id)) return errorResult('saveRecipe', '已有配方必须先验证修订,不能被未验证候选覆盖');} else if (!verified || verified.site !== args.site || verified.content !== JSON.stringify(parsed.data) || verified.profile !== (args.profile ?? '')) {return errorResult('saveRecipe', '请先用 action=recipe、site、相同 recipeDraft 试跑并通过校验;不能保存未验证或已改动的配方');diff --git a/scripts/browser-experience-live.mjs b/scripts/browser-experience-live.mjsindex d965b83550..58ae505b7a 100644--- a/scripts/browser-experience-live.mjs+++ b/scripts/browser-experience-live.mjs@@ -219,61 +219,40 @@ try {// A separate public flow has no bundled recipe: observe twice across fresh// MCP instances. Both use the same real host experience file.- const quoteUrl = 'https://quotes.toscrape.com/search.aspx';- const filterUrl = 'https://quotes.toscrape.com/filter.aspx';- // Selectors were observed in the preceding public-site experiment. Check- // the selected values and every quote rather than treating clicks as proof.+ const quoteUrl = 'https://quotes.toscrape.com/page/{{page}}/';+ // Deferred candidates compose known read primitives, not authored JS or+ // form interactions. Selectors were observed on this public listing.const draft = {- id: 'live-quote-search',+ id: 'live-quote-list',access: 'read',match: ['quotes.toscrape.com'],- description: '按作者和标签查询语录',- inputs: { author: { required: true }, tag: { required: true } },+ description: '分页读取公开语录',+ inputs: { page: { required: true } },steps: [{ action: 'navigate', url: quoteUrl },- { action: 'wait', selector: '#author', timeoutMs: 10000 },{- action: 'select',- selector: '#author',- values: ['{{author}}'],- guard: { url: quoteUrl, selector: '#author' },- },- {- action: 'wait',- fn: "() => location.pathname === '/filter.aspx' && document.querySelector('#author')?.value === '{{author|js}}' && [...(document.querySelector('#tag')?.options || [])].some(o=>o.value === '{{tag|js}}')",- timeoutMs: 10000,- },- {- action: 'select',- selector: '#tag',- values: ['{{tag}}'],- guard: { url: filterUrl, selector: '#tag' },- },- {- action: 'click',- selector: "input[name='submit_button']",- guard: { url: filterUrl, selector: "input[name='submit_button']" },- },- { action: 'wait', selector: '.results .quote', timeoutMs: 10000 },- {- action: 'evaluate',- guard: { url: filterUrl, selector: '.results' },- fn: "() => { const author=document.querySelector('#author').value, tag=document.querySelector('#tag').value; const rows=[...document.querySelectorAll('.results .quote')].map(q=>({text:q.querySelector('.content').textContent.trim(),author:q.querySelector('.author').textContent.trim(),tag:q.querySelector('.tag').textContent.trim()})); return {author,tag,rows,matched:author==='{{author|js}}' && tag==='{{tag|js}}' && rows.length>0 && rows.every(r=>r.author===author && r.tag===tag)}; }",+ action: 'extract',+ extract: {+ from: '.quote',+ multiple: true,+ limit: 2,+ fields: { text: '.text', author: '.author' },+ },+ guard: { url: quoteUrl, selector: 'body' },as: 'result',- expect: { equals: { matched: true } },+ expect: { minCount: 2, requiredFields: ['text', 'author'] },},],output: '{{result}}',};for (let i = 0; i < 2; i++) {registry = fresh();- const inputs = i- ? { author: 'J.K. Rowling', tag: 'choices' }- : { author: 'Albert Einstein', tag: 'learning' };+ const inputs = { page: i + 1 };let read;for (const step of draft.steps)read = await call(`observe-${i}`, stepToRequest(step, inputs));- assert.equal(read.result.data.result.matched, true);+ assert.equal(read.result.data.result.records.length, 2);+ assert(read.result.data.result.records.every((row) => row.text && row.author));if (i === 1) assert(read.result.learningOpportunity);}report.checks.repetitionAcrossToolSessions = true;@@ -290,15 +269,15 @@ try {assert.equal(save.result.state, 'candidate');assert.equal(save.runtime.length, 0);registry = fresh();- const newInputs = { author: 'Albert Einstein', tag: 'music' };+ const newInputs = { page: 3 };const use = await call('candidate-real-use', {action: 'recipe',recipeId: draft.id,inputs: newInputs,});assert.equal(use.result.ok, true);- assert.equal(use.result.output.matched, true);- assert.equal(use.result.output.tag, 'music');+ assert.equal(use.result.output.records.length, 2);+ assert(use.result.output.records.every((row) => row.text && row.author));assert.equal((await readRecipes()).get(draft.id).validation.state, 'active');report.checks.candidateSavedWithoutReplayAndPromotedNextSession = true;report.experiences = await store.list('quotes.toscrape.com');@@ -329,7 +308,7 @@ try {assert.equal((await readRecipes()).get(broken.id).validation.state, 'suspended');await call('repair-observe', {action: 'snapshot',- selector: 'form',+ selector: 'body',refs: 'role',compact: true,maxChars: 3000,