diff --git a/CHANGELOG.md b/CHANGELOG.md index bd293194..cb350ec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Agent Workbench 更新记录 +## 1.20.1 · 真实案例任务控制修复 + +- 原目标、检查约定与短句续接独立保存。错误诊断使用只读Run,答复结束保留原任务状态;明确修复要求仍正常执行。 +- 审查后继续改为中性系统操作,不再新增通用测试要求。无需测试的文件在审查应用后直接反馈路径,模型文字不替代文件交付或检查通过。 +- 完整终结响应中的空参数只对schema明确允许空对象的工具兼容;必填参数、坏JSON、截断流继续整批拒绝,原流与适配凭据分别保存。 +- 每次真实模型请求按尝试身份去重记账,失败响应的已报告用量不再丢失;unknown单列估算,池内切换与受控引擎避免重复累计。历史漏账不静默重写。 +- 相同已记录源码、命令和环境输入的自动检查返回原日志;用户可明确重跑。交替重复读取、无产出的空续接受到进展保护,合理分页和新输入可继续。 +- 显示任务交付、文件应用、诊断答复与检查的各自状态;启动选择与实际模型路由分开显示。源码、界面与本地发行验收见QA-1.20.1,实际部署以发行身份收据为准。 + ## 1.20.0 · 固定工程评测与受控候选采纳 - 新增工程评测:每批1–3个固定样本,封存已提交来源、需求、验收、明确源码文件、完整原检查和总预算;原版与候选使用同源独立工作区。 diff --git a/docs/QA-1.20.1.md b/docs/QA-1.20.1.md new file mode 100644 index 00000000..87687f0d --- /dev/null +++ b/docs/QA-1.20.1.md @@ -0,0 +1,22 @@ +# 1.20.1 任务控制修复验收 + +本版针对[react-source实际案例](CASE-REACT-SOURCE-2026-11-01.md)的A–F修复;1.21新功能继续暂缓。原用户工程、会话、47条模型尝试、原SSE与历史用量不改写,不重跑原任务或主动调用正式模型。 + +## 已实现 + +1. Task契约保留原目标、显式无需测试及检查要求;“继续完成”保留同Task。历史空目标续接可沿同项目同会话的previousTaskId取回原目标,原记录不删改。 +2. 已识别的运行诊断问句建立只读诊断Run,保存问题、原任务状态和诊断答复。工具声明及派发层同时限制副作用;解释结束不把未交付任务标成完成,明确要求修复仍按执行任务处理。 +3. 审查按钮改“继续原任务”,记录系统来源;无需测试的文件应用后显示实际路径并结束。文字不能替代应交付文件的已应用记录;失败、未知或失效核验不能被答复覆盖为通过。 +4. 空参数适配只在完整响应终结、工具schema明显允许空对象时采用;必填参数、坏JSON、截断流整批拒绝。完整原SSE不变,适配记录独立保存,错误包含工具名与调用ID。 +5. 每次真实请求的消费回调独立于响应派发校验,按attempt身份去重;保留失败响应的已报告用量,超时unknown单列估算。池内切换、受控worker/引擎不会重复核算,未派发能力拒绝不虚构消费。历史漏账不追溯改写。 +6. 同Task相同已记录工程、命令、运行环境输入的自动检查读取原结果/日志,不重复执行或刷新核验;人工确认重跑保留。交替重复读取和连续两轮无产出的空续接受保护;新页、新源码、明确调整可继续。输入身份不声称覆盖任意外部网络/服务状态。 +7. UI分开显示文件应用、诊断答复、工程核验、启动选择与实际模型调用,并保留旧Run审查终态的说明。历史系统追加要求标来源,继续模型上下文不再把旧review-action当新用户要求。 + +## 验收记录 + +- A/B初始专项与runtime/execution回归29/29通过;后续55/55相关回归以及最终意图7/7通过(含跨Run无进展、文件虚假完成、诊断识别)。 +- 模型HTTP/SSE覆盖完整无参适配、必填空参/坏JSON整组拒绝、缺DONE、reasoning超时、失败消费、429池切换和去重;受控引擎实际协议回归通过。失败首轮和纠正原因均保留在本地QA原日志中。 +- 编译与TypeScript通过;独立HTTP实际桌面/390px五组核心流程通过。第一次窄屏截图未打开任务面板,随后补可见断言;一次缩放效应与点击竞态由验收器等待真实窄屏按钮再操作修正,保留失败截图与DOM。 +- 独立源码包完整回归、受影响历史界面、不可变便携包、正式保留状态升级仍需本版最终收据确认。此文档作为冻结候选的实现说明,不据此声称正式部署已完成;最终状态见task-control发行身份与验收证据。 + +真实模型自主推理没有在本轮调用,固定HTTP验证不代表真实模型成功率或成本收益;手机窄屏使用实际Edge视口,本版未重新进行iPhone实机测试。历史1.16实机记录单独保留。 diff --git a/package-lock.json b/package-lock.json index b0345517..0413532f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "local-agent-workbench", - "version": "1.20.0", + "version": "1.20.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "local-agent-workbench", - "version": "1.20.0", + "version": "1.20.1", "dependencies": { "@babel/parser": "7.29.11", "@peculiar/x509": "3.1.0", diff --git a/package.json b/package.json index fa33c89a..f3294ad4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "local-agent-workbench", - "version": "1.20.0", + "version": "1.20.1", "private": true, "type": "module", "description": "A local coding workbench with explicit tool execution, reviewable changes and recoverable sessions.", diff --git a/progress.md b/progress.md index 54383858..26c5eb04 100644 --- a/progress.md +++ b/progress.md @@ -2,6 +2,8 @@ ## 1.20.1 修复实施 +C/D/E已实现:schema受约束空参适配、原流保留、消费回调及去重、同输入自动检查返回原证据、交替重复读取与跨Run空续接保护、文件交付/诊断/核验/实际模型UI。新增55项相关回归和最终意图7项通过;受控引擎原协议与计量回归通过;实际桌面/390px五组通过,相关历史界面继续验证。首轮模型适配测试错误选了倒序账本的最后响应,改为按兼容调用身份定位原attempt;旧审查断言更新为系统Run来源且零新增用户要求。所有原失败TAP/DOM保持;真实模型请求0,正式仍1.20.0。 + A/B已完成首个切片:Task保留原目标与显式无需测试限制;简短续接不创建丢失原目标的新Task;只读诊断Run单独记录答复、保持原任务状态并在执行层拒绝副作用。审查续接改为系统来源、中性动作;无需测试的文件应用后给出路径与完成反馈,工程检查失败不能被最终文字覆盖为完成。专项与runtime/execution相关回归29/29通过,原TAP在.qa/task-control-initial.tap;当前尚未构建发行或改变正式服务。 ## 当前:react-source实际案例审查与计划保留 diff --git a/scripts/qa-evidence.mjs b/scripts/qa-evidence.mjs index c41b46c3..7251c261 100644 --- a/scripts/qa-evidence.mjs +++ b/scripts/qa-evidence.mjs @@ -13,6 +13,7 @@ const prefixes = Object.freeze({ '1.18.0': 'vision-inputs', '1.19.0': 'project-cache', '1.20.0': 'engineering-evals', + '1.20.1': 'task-control', }); export function releaseEvidencePrefix(version) { const prefix = prefixes[version]; diff --git a/scripts/upgrade-running.mjs b/scripts/upgrade-running.mjs index 40bf6478..d5a8279b 100644 --- a/scripts/upgrade-running.mjs +++ b/scripts/upgrade-running.mjs @@ -64,7 +64,7 @@ export async function upgradeRunning({ url, pid, currentRoot, newRoot, handlerRo if (!fs.existsSync(originalScript) || !fs.existsSync(upgradeScript) || !fs.existsSync(path.join(next, 'dist-client', 'index.html'))) throw new Error('Upgrade bundles are incomplete.'); if (!Number.isInteger(pid) || pid < 1 || pid === process.pid) throw new Error('Invalid target process.'); const before = await readUpgradeJson(origin + '/api/bootstrap', 5000, 'Read original Workbench'); - if (!before.token || !['0.1.0', '1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(before.version)) throw new Error('This migration accepts a supported existing Workbench.'); + if (!before.token || !['0.1.0', '1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(before.version)) throw new Error('This migration accepts a supported existing Workbench.'); if (before.sessions.some(session => ['running', 'awaiting_approval', 'stopping'].includes(session.status))) throw new Error('Wait for existing tasks and approvals before upgrading.'); let protocol, socket, enabledHere = false, paused = false; const breakpoints = []; diff --git a/scripts/verify-all-ui.mjs b/scripts/verify-all-ui.mjs index 226da546..ac861468 100644 --- a/scripts/verify-all-ui.mjs +++ b/scripts/verify-all-ui.mjs @@ -9,31 +9,31 @@ import { randomUUID } from 'node:crypto'; if (process.argv.slice(2).some(value => value !== '--help')) throw new Error('Unsupported argument; use --help.'); if (process.argv.includes('--help')) { console.log('node scripts/verify-all-ui.mjs - run serial desktop/390px checks in independent local hosts; use explicit QA Python/Harness/Purge source paths for 1.15.'); process.exit(0); } const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version; -assert.ok(['1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version), 'Review evidence paths when introducing the next release.'); +assert.ok(['1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version), 'Review evidence paths when introducing the next release.'); const prefix = releaseEvidencePrefix(version), resultFile = `.qa/${prefix}-all-ui-validation.json`, results = []; const qaEnvironment = Object.fromEntries(['AGENT_WORKBENCH_TEST_PYTHON', 'AGENT_WORKBENCH_DEEPSEEK_ROOT', 'AGENT_WORKBENCH_PURGE_178_ROOT', 'AGENT_WORKBENCH_PURGE_181_ROOT'] .filter(name => process.env[name]).map(name => [name, process.env[name]])); for (const [name, value] of Object.entries(qaEnvironment)) assert.ok(path.isAbsolute(value) && fs.existsSync(value), 'Use an existing absolute QA runtime/source path: ' + name); const cases = [ - ...(version === '1.20.0' ? [['verify-evaluations-ui.mjs', null]] : []), - ...(['1.19.0', '1.20.0'].includes(version) ? [['verify-project-cache-ui.mjs', null]] : []), - ...(['1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-vision-ui.mjs', null]] : []), - ...(['1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-model-protocols-ui.mjs', null]] : []), - ...(['1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-companion-ui.mjs', null]] : []), - ...(['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-controlled-ui.mjs', null], ['verify-purge-ui.mjs', null]] : []), - ...(['1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-workers-ui.mjs', null]] : []), - ...(['1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-task-plans-ui.mjs', `docs/${prefix}-task-ui-validation.json`]] : []), - ...(['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-browser-ui.mjs', `docs/${prefix}-browser-ui-validation.json`]] : []), + ...(['1.20.0', '1.20.1'].includes(version) ? [['verify-evaluations-ui.mjs', null]] : []), + ...(['1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-project-cache-ui.mjs', null]] : []), + ...(['1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-vision-ui.mjs', null]] : []), + ...(['1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-model-protocols-ui.mjs', null]] : []), + ...(['1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-companion-ui.mjs', null]] : []), + ...(['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-controlled-ui.mjs', null], ['verify-purge-ui.mjs', null]] : []), + ...(['1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-workers-ui.mjs', null]] : []), + ...(['1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-task-plans-ui.mjs', `docs/${prefix}-task-ui-validation.json`]] : []), + ...(['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-browser-ui.mjs', `docs/${prefix}-browser-ui-validation.json`]] : []), ['verify-ui.mjs', '.qa/ui-validation.json'], ['verify-diagnostics-ui.mjs', '.qa/diagnostics-ui-validation.json'], ['verify-execution-ui.mjs', '.qa/execution-ui-validation.json'], ['verify-delivery-ui.mjs', '.qa/delivery-ui-validation.json'], ['verify-index-ui.mjs', '.qa/index-ui-result.json'], ['verify-change-sets-ui.mjs', `docs/${prefix}-batch-ui-validation.json`], ['verify-context-ui.mjs', `.qa/${version === '1.6.0' ? 'workspaces-context' : prefix}-ui-validation.json`], ['verify-workspaces-ui.mjs', `docs/${prefix === 'workspaces' ? prefix : prefix + '-workspaces'}-ui-validation.json`], - ...(['1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-python-ui.mjs', `docs/${prefix}-python-ui-validation.json`]] : []), - ...(['1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-react-delivery.mjs', version === '1.7.0' ? 'docs/react-engine-delivery-validation.json' : `docs/${prefix}-react-delivery-validation.json`]] : []), - ...(['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-research-ui.mjs', `docs/${prefix}-research-ui-validation.json`]] : []), - ...(['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? [['verify-engines-ui.mjs', version === '1.9.0' ? 'docs/engines-ui-validation.json' : `docs/${prefix}-engines-ui-validation.json`]] : []), - ...(['1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(version) ? ['model-center', 'project-memory', 'task-checkpoints', 'skills', 'mcp', 'mcp-recovery'].map(name => [`verify-${name}-ui.mjs`, null]) : []), + ...(['1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-python-ui.mjs', `docs/${prefix}-python-ui-validation.json`]] : []), + ...(['1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-react-delivery.mjs', version === '1.7.0' ? 'docs/react-engine-delivery-validation.json' : `docs/${prefix}-react-delivery-validation.json`]] : []), + ...(['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-research-ui.mjs', `docs/${prefix}-research-ui-validation.json`]] : []), + ...(['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? [['verify-engines-ui.mjs', version === '1.9.0' ? 'docs/engines-ui-validation.json' : `docs/${prefix}-engines-ui-validation.json`]] : []), + ...(['1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(version) ? ['model-center', 'project-memory', 'task-checkpoints', 'skills', 'mcp', 'mcp-recovery'].map(name => [`verify-${name}-ui.mjs`, null]) : []), ]; fs.mkdirSync('.qa', { recursive: true }); const externalHost = new Set(['verify-ui.mjs', 'verify-diagnostics-ui.mjs', 'verify-execution-ui.mjs', 'verify-index-ui.mjs']); diff --git a/scripts/verify-change-sets-ui.mjs b/scripts/verify-change-sets-ui.mjs index 8f4d6131..b03474b7 100644 --- a/scripts/verify-change-sets-ui.mjs +++ b/scripts/verify-change-sets-ui.mjs @@ -105,12 +105,12 @@ try { await expect(page.locator('.toast')).toHaveCount(0); passed.push('Switching projects clears the previous task notification while retaining its durable error and recovery history'); await page.getByRole('button', { name: '审查变更集', exact: true }).click(); await viewport('mobile-review'); await dialog().getByRole('button', { name: '确认应用全部 3 项', exact: true }).click(); await wait(async () => (await current(f)).status === 'completed'); - await page.keyboard.press('Escape'); await expect(page.getByRole('button', { name: '继续检查与交付', exact: true })).toBeVisible(); + await page.keyboard.press('Escape'); await expect(page.getByRole('button', { name: '继续原任务', exact: true })).toBeVisible(); if (!await page.locator('.changes-inspector').isVisible()) await page.getByRole('button', { name: '查看改动', exact: true }).click(); await page.getByRole('button', { name: '审查变更集', exact: true }).click(); await dialog().getByRole('button', { name: '回退本批已写入文件', exact: true }).click(); await viewport('mobile-rollback'); await dialog().getByRole('button', { name: '确认回退本批次', exact: true }).click(); await wait(async () => (await current(f)).status === 'rolled_back'); assertBatchBytes(assert, f, f.b.before); - await page.keyboard.press('Escape'); await expect(dialog()).toHaveCount(0); await expect(page.getByRole('button', { name: '继续检查与交付', exact: true })).toHaveCount(0); + await page.keyboard.press('Escape'); await expect(dialog()).toHaveCount(0); await expect(page.getByRole('button', { name: '继续原任务', exact: true })).toHaveCount(0); passed.push('390px step-limit review, same-task continuation entry, rollback confirmation and keyboard close fit the viewport'); await page.setViewportSize({ width: 1440, height: 1000 }); f = await choose('delayed'); let release, held = false; const gate = new Promise(resolve => { release = resolve; }); diff --git a/scripts/verify-controlled-release.mjs b/scripts/verify-controlled-release.mjs index d3544a47..a83270fc 100644 --- a/scripts/verify-controlled-release.mjs +++ b/scripts/verify-controlled-release.mjs @@ -22,7 +22,7 @@ export async function verifyControlledApi({ api, url, token, directory, appRoot, const origin = new URL(url); assert.equal(origin.hostname, '127.0.0.1'); assert.notEqual(origin.port, '4318'); const expectedVersion = JSON.parse(fs.readFileSync(path.join(appRoot, fs.existsSync(path.join(appRoot, 'MANIFEST.json')) ? 'MANIFEST.json' : 'package.json'), 'utf8')).version; - assert.ok(['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(expectedVersion)); + assert.ok(['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(expectedVersion)); const bootstrap = await api('/bootstrap'); assert.equal(bootstrap.version, expectedVersion); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false); const root = path.join(directory, 'compiled-controlled-node'), hooks = path.join(directory, 'disabled-hooks'); diff --git a/scripts/verify-delivery-ui.mjs b/scripts/verify-delivery-ui.mjs index eb17bd9a..e46a86ff 100644 --- a/scripts/verify-delivery-ui.mjs +++ b/scripts/verify-delivery-ui.mjs @@ -126,7 +126,7 @@ try { await page.locator('.change-list').getByRole('button').filter({ hasText: relative }).click(); await page.getByRole('button', { name: '应用这项改动', exact: true }).click(); } - await waitStatus('completed'); modelMode = 'final'; modelStage = 0; await page.getByRole('button', { name: '继续检查与交付', exact: true }).click(); + await waitStatus('paused'); modelMode = 'final'; modelStage = 0; await page.getByRole('button', { name: '继续原任务', exact: true }).click(); await waitStatus('awaiting_approval'); await page.getByRole('button', { name: '确认执行', exact: true }).click(); await waitStatus('needs_review'); const verified = await state(); assert.equal(verified.execution.task.id, reviewed.execution.task.id); assert.equal(verified.execution.checks.at(-1).status, 'passed'); assert.equal(verified.execution.checks.at(-1).results[0].tests.passed, 14); assert.equal(verified.execution.deliveries.length, 0); @@ -136,7 +136,7 @@ try { await page.locator('.session-select').filter({ hasText: '修复四模块并交付Git报告' }).click(); await expect(task()).toContainText('测试 14/14 通过'); await expect(delivery().getByLabel('等待Git确认')).toBeVisible(); - await expect(page.getByRole('button', { name: '继续检查与交付', exact: true })).toHaveCount(0); + await expect(page.getByRole('button', { name: '继续原任务', exact: true })).toHaveCount(0); await delivery().getByRole('button', { name: '查看待确认预览', exact: true }).click(); await expect(confirm()).toBeVisible(); await expect(confirm()).toContainText('14/14'); await screenshot('delivery-git-review-boundary'); diff --git a/scripts/verify-execution-ui.mjs b/scripts/verify-execution-ui.mjs index 843de271..9c706bcc 100644 --- a/scripts/verify-execution-ui.mjs +++ b/scripts/verify-execution-ui.mjs @@ -121,7 +121,7 @@ try { mode = 'proposal'; await newTask('应用后继续同一个工程任务'); await waitState('needs_review'); const reviewed = await state(); await page.locator('.inspector-tabs').getByRole('button', { name: /改动/ }).click(); await page.getByRole('button', { name: '应用这项改动', exact: true }).click(); - await waitState('completed'); mode = 'checks'; await page.getByRole('button', { name: '继续检查与交付', exact: true }).click(); await waitState('awaiting_approval'); + await waitState('completed'); mode = 'checks'; await page.getByRole('button', { name: '继续原任务', exact: true }).click(); await waitState('awaiting_approval'); await page.getByRole('button', { name: '确认执行', exact: true }).click(); await waitState('completed'); const delivered = await state(); assert.equal(delivered.execution.task.id, reviewed.execution.task.id); assert.equal(delivered.execution.task.goal, '应用后继续同一个工程任务'); assert.equal(delivered.execution.checks.at(-1).status, 'passed'); mark('applied proposals continue the original task into actual engineering verification'); diff --git a/scripts/verify-release.mjs b/scripts/verify-release.mjs index a46a1a5e..2ddf9ed8 100644 --- a/scripts/verify-release.mjs +++ b/scripts/verify-release.mjs @@ -34,7 +34,7 @@ for (const name of Object.keys(env)) if (name.toLowerCase() === 'path') delete e const windowsRoot = process.env.SystemRoot || 'C:\\Windows'; env.PATH = [windowsRoot, path.join(windowsRoot, 'System32'), path.join(windowsRoot, 'System32', 'WindowsPowerShell', 'v1.0')].join(path.delimiter); let externalGit = null; -if (['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(manifest.version)) { +if (['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(manifest.version)) { // The controlled project requires external Git. Preserve its observed binary // directory while keeping system Node/npm unavailable to the packaged host. const binary = fs.realpathSync.native(execFileSync('where.exe', ['git.exe'], { env: gitEnvironment(), encoding: 'utf8', windowsHide: true, timeout: 10000 }).trim().split(/\r?\n/)[0]); @@ -88,7 +88,7 @@ try { console.log((await launch()).trim()); assert.equal(JSON.parse(fs.readFileSync(path.join(data, 'service-info.json'), 'utf8')).pid, firstInfo.pid); const example = bootstrap.projects.find(project => project.id === bootstrap.exampleProjectId); - if (['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(manifest.version)) { + if (['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(manifest.version)) { assert.equal(path.resolve(example.root).toLowerCase(), path.join(data, 'projects', 'starter-project').toLowerCase()); const compareTemplate = relative => { for (const entry of fs.readdirSync(path.join(appRoot, 'examples/starter-project', relative), { withFileTypes: true })) { const next = path.join(relative, entry.name); if (entry.isDirectory()) compareTemplate(next); @@ -114,7 +114,7 @@ try { const checkLog = await api('/artifacts/' + checked.results[0].logArtifactId + '?session=' + session.id); assert.match(checkLog.content, /tests 4/); assert.ok(fs.existsSync(path.join(appRoot, 'runtime/node_modules/npm/bin/npm-cli.js'))); const actualRea = []; - if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(manifest.version)) { + if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(manifest.version)) { const installation = await api('/research/availability'); assert.equal(installation.status, 'available'); assert.equal(installation.version, '6.8.0'); assert.equal(fs.realpathSync.native(installation.packageRoot), fs.realpathSync.native(path.join(appRoot, 'runtime/node_modules/rea-agents'))); assert.equal(fs.realpathSync.native(installation.node.path), fs.realpathSync.native(path.join(appRoot, 'runtime/node.exe'))); @@ -146,7 +146,7 @@ try { console.log('PASS actual contained REA: ASAR, PE imports and PE resources; zero target execution/model requests'); } let actualEngine = null; - if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(manifest.version) && process.argv.includes('--native-engines')) { + if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(manifest.version) && process.argv.includes('--native-engines')) { const installation = await api('/engines/deepseek/availability'); assert.equal(installation.status, 'available', installation.message); assert.equal(fs.realpathSync.native(installation.node.path), fs.realpathSync.native(path.join(appRoot, 'runtime/node.exe'))); const engineRoot = path.join(data, 'engine-project'); fs.mkdirSync(engineRoot); fs.writeFileSync(path.join(engineRoot, 'README.md'), '# Owned portable engine connection\n'); @@ -166,8 +166,8 @@ try { assert.equal((await api('/research')).length, 4); const page = await fetch(url); assert.equal(page.status, 200); assert.match(await page.text(), /Agent Workbench/); - const actualBrowser = ['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(manifest.version) ? await verifyBrowserApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null; - const actualControlled = ['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(manifest.version) ? await verifyControlledApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null; + const actualBrowser = ['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(manifest.version) ? await verifyBrowserApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null; + const actualControlled = ['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(manifest.version) ? await verifyControlledApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null; console.log((await stop()).trim()); started = false; await until(async () => { try { await fetch(url + '/api/health'); return false; } catch { return true; } }); for (const file of manifest.files) { @@ -176,7 +176,7 @@ try { } const result = { success: true, date: new Date().toISOString(), appRoot, version: manifest.version, nodeVersion: manifest.nodeVersion, verifiedFiles: manifest.files.length, url, reusedPid: firstInfo.pid, checks: { jobId, status: checked.status, tests: checked.results[0].tests }, actualRea, actualEngine, actualBrowser, actualControlled, externalGit, - steps: ['manifest hashes', 'bundled Node launch', 'same-service reuse', 'packaged example and static page', ...(['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(manifest.version) ? ['starter project copied to owned user data; original template bytes matched'] : []), 'explicit command consent', 'actual bundled Node version', 'actual bundled npm check without system Node/npm', 'check log artifact', ...(actualRea.length ? ['contained REA installation and Node identity', 'actual ASAR/imports/resources', 'original Bundle and target hash binding', 'verified reuse without producer replay'] : []), 'report availability', 'graceful stop', 'every original packaged file remains unchanged'], realModel: false }; + steps: ['manifest hashes', 'bundled Node launch', 'same-service reuse', 'packaged example and static page', ...(['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(manifest.version) ? ['starter project copied to owned user data; original template bytes matched'] : []), 'explicit command consent', 'actual bundled Node version', 'actual bundled npm check without system Node/npm', 'check log artifact', ...(actualRea.length ? ['contained REA installation and Node identity', 'actual ASAR/imports/resources', 'original Bundle and target hash binding', 'verified reuse without producer replay'] : []), 'report availability', 'graceful stop', 'every original packaged file remains unchanged'], realModel: false }; fs.writeFileSync('.qa/release-validation.json', JSON.stringify(result, null, 2)); console.log(JSON.stringify(result, null, 2)); } finally { if (started) { try { await stop(); } catch {} } } diff --git a/scripts/verify-source-package.mjs b/scripts/verify-source-package.mjs index 47cdcff9..586ec8c0 100644 --- a/scripts/verify-source-package.mjs +++ b/scripts/verify-source-package.mjs @@ -19,7 +19,7 @@ assert.ok(fs.existsSync(npmCli), 'Use Node with its bundled npm.'); const files = (root, relative = '') => fs.readdirSync(path.join(root, relative), { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name)) .flatMap(entry => entry.isDirectory() ? files(root, path.join(relative, entry.name)) : [path.join(relative, entry.name)]); const digest = file => createHash('sha256').update(fs.readFileSync(file)).digest('hex'); -const buildFolders = ['dist-client', 'dist-server', ...(['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version) ? ['dist-desktop'] : [])]; +const buildFolders = ['dist-client', 'dist-server', ...(['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version) ? ['dist-desktop'] : [])]; const expected = Object.fromEntries(buildFolders.flatMap(folder => files(path.join(workspace, folder)).map(relative => [path.join(folder, relative), digest(path.join(workspace, folder, relative))]))); const allowedEnv = /^(path|pathext|systemroot|systemdrive|windir|comspec|temp|tmp|userprofile|homedrive|homepath|home|appdata|localappdata|programfiles(?:\(x86\))?|commonprogramfiles(?:\(x86\))?|lang|lc_all|AGENT_WORKBENCH_TEST_PYTHON|AGENT_WORKBENCH_DEEPSEEK_ROOT|AGENT_WORKBENCH_PURGE_ROOT)$/i; const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => allowedEnv.test(key))); @@ -30,7 +30,7 @@ const directory = path.join(sourceRoot, '.qa', 'package-validation-' + randomUUI fs.mkdirSync(directory, { recursive: true }); const inputFolders = ['src', 'tests', 'scripts', ...['benchmarks', 'public', 'examples', 'research'].filter(folder => fs.existsSync(path.join(sourceRoot, folder)))]; const inputNames = [...inputFolders.flatMap(folder => files(path.join(sourceRoot, folder)).map(relative => path.join(folder, relative))), - 'package.json', 'package-lock.json', 'vite.config.ts', 'tsconfig.json', 'index.html', ...(['1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version) ? ['mobile.html'] : []), ...['.gitattributes', '.gitignore', 'Start-Desktop.cmd', 'Start-Workbench.cmd', 'Stop-Workbench.cmd'].filter(name => fs.existsSync(path.join(sourceRoot, name)))].sort(); + 'package.json', 'package-lock.json', 'vite.config.ts', 'tsconfig.json', 'index.html', ...(['1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version) ? ['mobile.html'] : []), ...['.gitattributes', '.gitignore', 'Start-Desktop.cmd', 'Start-Workbench.cmd', 'Stop-Workbench.cmd'].filter(name => fs.existsSync(path.join(sourceRoot, name)))].sort(); const snapshot = () => inputNames.map(relative => ({ path: relative.replaceAll('\\', '/'), bytes: fs.statSync(path.join(sourceRoot, relative)).size, sha256: digest(path.join(sourceRoot, relative)) })); const inputs = snapshot(); fs.writeFileSync(path.join(directory, 'inputs.json'), JSON.stringify(inputs, null, 2)); let stage = 'environment preflight', python = null; @@ -83,7 +83,7 @@ try { assert.deepEqual(actualFiles.slice().sort(), Object.keys(expected).sort()); for (const [relative, sha256] of Object.entries(expected)) assert.equal(digest(path.join(sourceRoot, relative)), sha256, relative); let actualRea = null; - if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'contained REA'; const reaOutput = await run(['scripts/verify-rea.mjs', '--app-root', sourceRoot, '--contained'], 'rea.log'); actualRea = JSON.parse(reaOutput.trim().split('\n').at(-1)); @@ -91,7 +91,7 @@ try { assert.ok(actualRea.results.every(item => item.rootExited === true)); } let actualEngine = null; - if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version) && process.argv.includes('--native-engines')) { + if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version) && process.argv.includes('--native-engines')) { stage = 'native DeepSeek SDK'; const output = await run(['scripts/verify-engines.mjs'], 'engines.log'); actualEngine = JSON.parse(output.trim().split('\n').at(-1)); @@ -99,7 +99,7 @@ try { assert.equal(actualEngine.modelRequests, 0); assert.equal(actualEngine.rootExited, true); assert.equal(actualEngine.nativeMethods.length, 6); } let actualBrowser = null; - if (['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'contained browser runtime'; const output = await run(['scripts/verify-browser.mjs', '--app-root', sourceRoot, '--contained'], 'browser.log'); actualBrowser = JSON.parse(output.trim().split('\n').at(-1)); @@ -109,7 +109,7 @@ try { assert.equal(actualBrowser.modelRequests, 0); } let actualControlled = null; - if (['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'compiled controlled-engine delivery'; const output = await run(['scripts/verify-controlled-release.mjs', '--app-root', sourceRoot], 'controlled-engine.log'); actualControlled = JSON.parse(output.trim().split('\n').at(-1)); @@ -117,7 +117,7 @@ try { assert.equal(actualControlled.realModelRequests, 0); assert.equal(actualControlled.cases, 4); assert.ok(actualControlled.fixtureModelRequests > 0); } let actualCompanion = null; - if (['1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'contained companion gateway and UI'; const output = await run(['scripts/verify-companion-ui.mjs', '--app-root', sourceRoot], 'companion-ui.log'); const location = [...output.matchAll(/^EVIDENCE (.+)\r?$/gm)].at(-1)?.[1]?.trim(); @@ -128,7 +128,7 @@ try { assert.equal(actualCompanion.passed.length, 7); assert.deepEqual(actualCompanion.errors, []); assert.equal(actualCompanion.realModelRequests, 0); } let actualProtocols = null; - if (['1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'contained model protocols and mobile streams'; const output = await run(['scripts/verify-model-protocols-ui.mjs', '--app-root', sourceRoot], 'model-protocols-ui.log'); const location = [...output.matchAll(/^EVIDENCE (.+)\r?$/gm)].at(-1)?.[1]?.trim(); @@ -139,7 +139,7 @@ try { assert.equal(actualProtocols.passed.length, 5); assert.deepEqual(actualProtocols.pageErrors, []); assert.deepEqual(actualProtocols.requestFailures, []); } let actualVision = null; - if (['1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'contained screenshot inputs and exact Task budget resume'; const output = await run(['scripts/verify-vision-ui.mjs', '--app-root', sourceRoot], 'vision-ui.log'); const location = [...output.matchAll(/^EVIDENCE (.+)\r?$/gm)].at(-1)?.[1]?.trim(); @@ -150,7 +150,7 @@ try { assert.equal(actualVision.passed.length, 5); assert.deepEqual(actualVision.pageErrors, []); assert.equal(actualVision.realModelRequests, 0); } let actualProjectCache = null; - if (['1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'contained source-verified parsing cache controls'; const output = await run(['scripts/verify-project-cache-ui.mjs', '--app-root', sourceRoot], 'project-cache-ui.log'); const location = [...output.matchAll(/^EVIDENCE (.+)\r?$/gm)].at(-1)?.[1]?.trim(); @@ -164,8 +164,15 @@ try { const output = await run(['--test', '--test-concurrency=2', '--test-reporter=tap', ...files(path.join(sourceRoot, 'tests')).filter(file => !file.includes(path.sep) && file.endsWith('.test.mjs')).map(file => path.join('tests', file))], 'tests.tap'); const stats = Object.fromEntries([...output.matchAll(/^# (tests|pass|fail|cancelled|skipped|todo) (\d+)\s*$/gm)].map(match => [match[1], Number(match[2])])); assert.ok(stats.tests > 0); assert.equal(stats.pass, stats.tests); for (const key of ['fail', 'cancelled', 'skipped', 'todo']) assert.equal(stats[key], 0); + let actualTaskControl = null; + if (evidence.version === '1.20.1') { + stage = 'task control desktop and 390px'; + await run(['scripts/verify-task-control-ui.mjs', '--app-root', sourceRoot], 'task-control-ui.log'); + actualTaskControl = JSON.parse(fs.readFileSync(path.join(sourceRoot, '.qa/task-control-ui-validation.json'), 'utf8')); + assert.equal(actualTaskControl.success, true); assert.equal(actualTaskControl.passed.length, 5); assert.equal(actualTaskControl.realModelRequests, 0); + } let actualDesktop = null; - if (['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'actual contained Electron window'; await run(['scripts/verify-desktop-window.mjs'], 'desktop-window.log'); const window = JSON.parse(fs.readFileSync(path.join(sourceRoot, '.qa/desktop-window-latest.json'), 'utf8')); assert.equal(window.success, true); assert.equal(path.resolve(window.appRoot), sourceRoot); assert.equal(window.results.length, 7); @@ -179,7 +186,7 @@ try { actualDesktop = { window, ui, projects, scope: 'Independently rebuilt source and its shipped Electron binary; original window/engine/engineering assertions. Own credentials/HTTP fixtures; Windows native picker and complete host crash/stop have separate actual evidence.' }; } let actualProtocolEngineering = null; - if (['1.17.0', '1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'Responses SSE actual Node React Python engineering'; await run(['scripts/verify-controlled-projects.mjs', '--responses'], 'responses-engineering.log'); const location = JSON.parse(fs.readFileSync(path.join(sourceRoot, '.qa/responses-engineering-location.json'), 'utf8')); @@ -189,7 +196,7 @@ try { assert.deepEqual(actualProtocolEngineering.results.map(value => value.parentCheck.results[0].tests.passed), [8, 9, 10]); } let actualVisionEngineering = null; - if (['1.18.0', '1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.18.0', '1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'screenshot Task Node React Python engineering'; await run(['scripts/verify-vision-projects.mjs'], 'vision-engineering.log'); const location = JSON.parse(fs.readFileSync(path.join(sourceRoot, '.qa/vision-engineering-location.json'), 'utf8')); @@ -199,7 +206,7 @@ try { assert.deepEqual(actualVisionEngineering.results.map(value => value.check.results[0].tests.passed), [8, 9, 10]); } let actualCacheEngineering = null; - if (['1.19.0', '1.20.0'].includes(evidence.version)) { + if (['1.19.0', '1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'cached index original requests and Node React Python engineering'; await run(['scripts/verify-project-cache-projects.mjs'], 'project-cache-engineering.log'); const location = JSON.parse(fs.readFileSync(path.join(sourceRoot, '.qa/project-cache-engineering-location.json'), 'utf8')); @@ -209,7 +216,7 @@ try { assert.deepEqual(actualCacheEngineering.results.map(value => value.check.results[0].tests.passed), [8, 9, 10]); } let actualEvaluations = null, actualEvaluationEngineering = null; - if (evidence.version === '1.20.0') { + if (['1.20.0', '1.20.1'].includes(evidence.version)) { stage = 'compiled fixed engineering evaluations'; const output = await run(['scripts/verify-evaluations-release.mjs', '--app-root', sourceRoot], 'evaluations-release.log'); const location = [...output.matchAll(/^EVIDENCE (.+)\r?$/gm)].at(-1)?.[1]?.trim(); @@ -228,7 +235,7 @@ try { } assert.deepEqual(snapshot(), inputs, 'Source package inputs changed during validation.'); const result = { success: true, version: evidence.version, testedAt: new Date().toISOString(), sourceRoot, directory, nodeVersion: process.version, python, offlineInstall: true, - inputs, inputFiles: inputs.length, logs, buildMatchedFiles: Object.keys(expected).length, buildFiles: Object.entries(expected).map(([path, sha256]) => ({ path: path.replaceAll('\\', '/'), sha256 })), tests: stats, actualRea, actualEngine, actualBrowser, actualControlled, actualDesktop, actualCompanion, actualProtocols, actualProtocolEngineering, actualVision, actualVisionEngineering, actualProjectCache, actualCacheEngineering, actualEvaluations, actualEvaluationEngineering, credentialsHandling: 'Only build/runtime environment paths are inherited; no configured model credentials are used. The controlled-engine stage supplies a declared owned local response fixture.' }; + inputs, inputFiles: inputs.length, logs, buildMatchedFiles: Object.keys(expected).length, buildFiles: Object.entries(expected).map(([path, sha256]) => ({ path: path.replaceAll('\\', '/'), sha256 })), tests: stats, actualTaskControl, actualRea, actualEngine, actualBrowser, actualControlled, actualDesktop, actualCompanion, actualProtocols, actualProtocolEngineering, actualVision, actualVisionEngineering, actualProjectCache, actualCacheEngineering, actualEvaluations, actualEvaluationEngineering, credentialsHandling: 'Only build/runtime environment paths are inherited; no configured model credentials are used. The controlled-engine stage supplies a declared owned local response fixture.' }; save(result); console.log(JSON.stringify({ success: true, version: result.version, sourceRoot, directory, tests: stats, nodeVersion: process.version, python, inputFiles: inputs.length, buildMatchedFiles: result.buildMatchedFiles, rea: !!actualRea?.success, engine: !!actualEngine?.success, browser: !!actualBrowser?.success, controlled: !!actualControlled?.success })); } catch (error) { save({ success: false, version: evidence.version, testedAt: new Date().toISOString(), stage, error: error.message, sourceRoot, directory, nodeVersion: process.version, python, inputs, logs }); diff --git a/scripts/verify-task-control-ui.mjs b/scripts/verify-task-control-ui.mjs new file mode 100644 index 00000000..f12ca30c --- /dev/null +++ b/scripts/verify-task-control-ui.mjs @@ -0,0 +1,111 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import http from 'node:http'; +import assert from 'node:assert/strict'; +import { randomUUID, createHash } from 'node:crypto'; +import { chromium, expect } from 'playwright/test'; +import { fixture, launchWorkbench, call, completion, until } from '../tests/helpers.mjs'; +import { Provider } from '../src/server/provider.mjs'; + +if (process.argv.includes('--help')) { console.log('node scripts/verify-task-control-ui.mjs [--app-root DIR] - isolated fixed HTTP task/review/diagnostic/protocol flows at desktop and 390px; no user project or real model.'); process.exit(0); } +const args = process.argv.slice(2); assert.ok(!args.length || args.length === 2 && args[0] === '--app-root' && path.isAbsolute(args[1])); +const appRoot = fs.realpathSync.native(args[1] ?? process.cwd()); +const directory = path.resolve('.qa', 'task-control-ui-' + randomUUID()); fs.mkdirSync(directory, { recursive: true }); +const disposers = [], t = { after: fn => disposers.push(fn) }, f = fixture(t); +fs.writeFileSync(path.join(f.projectRoot, 'package.json'), JSON.stringify({ name: 'owned-task-control', type: 'module', scripts: { test: 'node --test wrong.test.mjs' } })); +fs.writeFileSync(path.join(f.projectRoot, 'wrong.test.mjs'), "import test from 'node:test'; import assert from 'node:assert/strict'; test('owned failing check',()=>assert.equal(1,2));\n"); +const originalSource = fs.readFileSync(path.join(f.projectRoot, 'wrong.test.mjs')); +let mode = 'html', stage = 0, sessionId = '', page, browser; +const requests = [], passed = [], screenshots = [], pageErrors = []; +const model = http.createServer(async (request, response) => { + try { + const chunks = []; for await (const chunk of request) chunks.push(chunk); + const input = JSON.parse(Buffer.concat(chunks)); requests.push({ mode, input }); + let tools = [], content = '当前结果已说明。', usage = { prompt_tokens: 20, completion_tokens: 10, total_tokens: 30 }; + if (mode === 'html' && stage === 0) tools = [call(randomUUID(), 'inspect_project', ''), call(randomUUID(), 'propose_file', { path: 'bike.html', content: 'SVG 骑行', reason: '按照原要求创建文件' })]; + if (mode === 'checks') { + const plan = input.messages.filter(value => value.role === 'tool').map(value => { try { return JSON.parse(value.content); } catch { return {}; } }).findLast(value => value.checks && value.id); + tools = stage % 2 === 0 ? [call(randomUUID(), 'plan_checks', { names: ['test'] })] : [call(randomUUID(), 'run_checks', { plan_id: plan.id }), call(randomUUID(), 'read_file', { path: 'wrong.test.mjs' })]; + } + if (mode === 'diagnostic') { + assert.ok(!input.tools.some(value => ['propose_file', 'run_command', 'run_checks'].includes(value.function.name))); + if (stage === 0) tools = [call(randomUUID(), 'inspect_session', '')]; + content = '这是原任务的工程检查失败;诊断没有修改源码或重跑检查,原目标仍然保留。'; + } + if (mode === 'invalid') { tools = [call(randomUUID(), 'inspect_project', '{}'), call('required-read-empty', 'read_file', '')]; usage = { prompt_tokens: 307, completion_tokens: 19, total_tokens: 326 }; } + stage++; + response.writeHead(200, { 'Content-Type': 'application/json' }); response.end(JSON.stringify({ ...completion(tools, tools.length ? '' : content), usage })); + } catch (error) { response.writeHead(500, { 'Content-Type': 'application/json' }); response.end(JSON.stringify({ error: { message: error.message } })); } +}); +await new Promise(resolve => model.listen(0, '127.0.0.1', resolve)); +t.after(() => new Promise(resolve => { model.closeAllConnections(); model.close(resolve); })); +const provider = new Provider(), hub = provider.modelHub(f.store); +const connection = hub.upsert({ name: '本地协议验收连接', model: 'owned-actual-model', baseUrl: 'http://127.0.0.1:' + model.address().port + '/v1', requiresKey: false }); +hub.select({ type: 'connection', id: connection.id }); f.store.close(); +const state = () => host.api('/sessions/' + sessionId); +const panel = () => page.getByLabel('任务记录', { exact: true }); +const waitStatus = status => expect.poll(async () => (await state()).status, { timeout: 20000 }).toBe(status); +async function newTask(content) { + if (!await page.getByRole('button', { name: '新建任务', exact: true }).isVisible()) await page.getByRole('button', { name: '展开项目栏' }).click(); + await page.getByRole('button', { name: '新建任务', exact: true }).click(); + await page.getByLabel('任务内容').fill(content); await page.getByRole('button', { name: '发送任务', exact: true }).click(); + await until(async () => { sessionId = (await host.api('/sessions')).find(value => value.title === content)?.id; return !!sessionId; }); +} +async function capture(name) { + const file = path.join(directory, name + '.png'); await page.screenshot({ path: file, fullPage: true }); + fs.writeFileSync(path.join(directory, name + '.html'), await page.content()); + screenshots.push({ path: file, sha256: createHash('sha256').update(fs.readFileSync(file)).digest('hex') }); +} +const mark = value => { passed.push(value); console.log('PASS ' + value); }; +const host = await launchWorkbench(t, f.data, {}, { appRoot, nodePath: fs.existsSync(path.join(appRoot, 'runtime/node.exe')) ? path.join(appRoot, 'runtime/node.exe') : process.execPath }); +try { + browser = await chromium.launch({ channel: 'msedge', headless: true }); + page = await browser.newPage({ viewport: { width: 1440, height: 1000 } }); page.on('pageerror', error => pageErrors.push(error.message)); + await page.goto(host.url); await page.waitForLoadState('networkidle'); await page.getByLabel('当前项目').selectOption(f.project.id); + await newTask('创建 HTML 和 SVG,无需测试'); await waitStatus('needs_review'); + await page.locator('.inspector-tabs').getByRole('button', { name: /改动/ }).click(); + await page.getByRole('button', { name: '应用这项改动', exact: true }).click(); await waitStatus('completed'); + await expect(page.getByRole('button', { name: '继续原任务', exact: true })).toHaveCount(0); + const delivered = await state(); assert.equal(delivered.approvals.length, 0); assert.equal(delivered.execution.checks.length, 0); + await page.getByRole('button', { name: '查看任务记录', exact: true }).click(); + await expect(panel()).toContainText('文件已应用'); await expect(panel()).toContainText('未运行测试'); + await expect(panel()).toContainText('owned-actual-model'); await capture('html-desktop'); mark('HTML applies once, ends without tests or continuation prompt, and shows actual model'); + await page.setViewportSize({ width: 390, height: 844 }); + await expect(page.getByRole('button', { name: '查看文件', exact: true })).toBeVisible(); + await page.getByRole('button', { name: '查看任务记录', exact: true }).click(); + await expect(panel()).toBeVisible(); await expect(panel()).toContainText('文件已应用'); await capture('html-390'); + assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)); mark('390px result and task panel remain usable without horizontal overflow'); + await page.setViewportSize({ width: 1440, height: 1000 }); + mode = 'checks'; stage = 0; await newTask('修复失败测试并交付工程'); await waitStatus('awaiting_approval'); + await page.getByRole('button', { name: '确认执行', exact: true }).click(); await waitStatus('paused'); + const paused = await state(); assert.equal(paused.execution.run.stopReason, 'no_progress'); assert.equal(paused.approvals.length, 1); assert.equal(paused.execution.checks.length, 1); + assert.equal(paused.execution.checks[0].status, 'failed'); assert.deepEqual(fs.readFileSync(path.join(f.projectRoot, 'wrong.test.mjs')), originalSource); + const taskId = paused.taskId, checkId = paused.execution.checks[0].id; + await page.getByRole('button', { name: '查看任务记录', exact: true }).click(); await expect(panel()).toContainText('原工程检查有失败记录'); await capture('checks-desktop'); + mark('one approved real failing check is reused across new plans and the no-progress task pauses'); + mode = 'diagnostic'; stage = 0; + await page.getByLabel('任务内容').fill('前面的错误是怎么回事?'); await page.getByRole('button', { name: '发送任务', exact: true }).click(); + await until(async () => { const value = await state(); return value.execution.run.purpose === 'diagnostic' && !!value.execution.run.finishedAt; }, 15000); + const diagnosed = await state(); assert.equal(diagnosed.taskId, taskId); assert.equal(diagnosed.status, 'paused'); assert.equal(diagnosed.execution.run.status, 'completed'); + assert.equal(diagnosed.execution.checks[0].id, checkId); assert.equal(diagnosed.execution.task.instructions.length, 0); + await expect(panel()).toContainText('只读诊断'); await expect(panel()).toContainText('修复失败测试并交付工程'); await capture('diagnostic-desktop'); + await page.setViewportSize({ width: 390, height: 844 }); + await expect(page.getByRole('button', { name: '查看文件', exact: true })).toBeVisible(); + await page.getByRole('button', { name: '查看任务记录', exact: true }).click(); + await expect(panel()).toBeVisible(); await expect(panel()).toContainText('只读诊断'); await capture('diagnostic-390'); mark('diagnostic answer completes separately and preserves original unfinished task at both widths'); + await page.setViewportSize({ width: 1440, height: 1000 }); + mode = 'invalid'; stage = 0; await newTask('协议失败用量核对'); await waitStatus('failed'); + const failed = await state(); assert.equal(failed.execution.run.toolCalls, 0); assert.equal(failed.execution.run.usage.totalTokens, 326); assert.equal(failed.execution.run.usage.requests, 1); + await expect(page.locator('.failure-card').last()).toContainText('read_file'); + await page.getByRole('button', { name: '查看任务记录', exact: true }).click(); await expect(panel()).toContainText('326 tokens'); await expect(panel()).toContainText('1 次请求尝试'); await capture('protocol-desktop'); + await page.reload(); await page.waitForLoadState('networkidle'); assert.equal((await state()).execution.run.usage.totalTokens, 326); + mark('required empty arguments reject the entire batch and reported usage remains once after reload'); + assert.deepEqual(pageErrors, []); + fs.writeFileSync(path.join(directory, 'sessions.json'), JSON.stringify({ delivered, paused, diagnosed, failed }, null, 2)); + const result = { success: true, version: host.bootstrap.version, appRoot, directory, passed, screenshots, pageErrors, requestCount: requests.length, realModelRequests: 0 }; + fs.writeFileSync(path.join(directory, 'result.json'), JSON.stringify(result, null, 2)); + fs.writeFileSync('.qa/task-control-ui-validation.json', JSON.stringify(result, null, 2)); console.log(JSON.stringify(result)); +} catch (error) { + if (page) await capture('failure').catch(() => {}); + fs.writeFileSync(path.join(directory, 'failure.json'), JSON.stringify({ success: false, mode, stage, passed, screenshots, error: error.stack, pageErrors }, null, 2)); throw error; +} finally { if (browser) await browser.close(); for (const dispose of disposers.reverse()) await dispose(); } diff --git a/scripts/verify-workers-ui.mjs b/scripts/verify-workers-ui.mjs index af8806bd..55b3bc98 100644 --- a/scripts/verify-workers-ui.mjs +++ b/scripts/verify-workers-ui.mjs @@ -8,7 +8,7 @@ import { workerHttp } from '../tests/fixtures/workers-http.mjs'; import { workerDefinition, ownerBytes, applyWorkerProposals, approveWorkerChecks } from '../tests/fixtures/workers-project.mjs'; if (process.argv.includes('--help')) { console.log('node scripts/verify-workers-ui.mjs — owned local fixture, real isolated Git/checks/review, desktop/390px, conflicts, stop, recovery and late source errors'); process.exit(0); } -const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version, prefix = version === '1.20.0' ? 'engineering-evals-workers' : version === '1.19.0' ? 'project-cache-workers' : version === '1.18.0' ? 'vision-inputs-workers' : version === '1.17.0' ? 'model-protocols-workers' : version === '1.16.0' ? 'mobile-companion-workers' : version === '1.15.0' ? 'desktop-host-workers' : version === '1.14.0' ? 'controlled-engine-workers' : version === '1.13.0' ? 'workers' : 'workers-development'; +const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version, prefix = version === '1.20.1' ? 'task-control-workers' : version === '1.20.0' ? 'engineering-evals-workers' : version === '1.19.0' ? 'project-cache-workers' : version === '1.18.0' ? 'vision-inputs-workers' : version === '1.17.0' ? 'model-protocols-workers' : version === '1.16.0' ? 'mobile-companion-workers' : version === '1.15.0' ? 'desktop-host-workers' : version === '1.14.0' ? 'controlled-engine-workers' : version === '1.13.0' ? 'workers' : 'workers-development'; const directory = path.resolve('.qa', 'workers-ui-' + randomUUID()); fs.mkdirSync(directory, { recursive: true }); const disposers = [], t = { after: dispose => disposers.push(dispose) }, f = fixture(t), host = await workerHttp(f); assert.notEqual(new URL(host.url).port, '4318'); diff --git a/src/client/App.tsx b/src/client/App.tsx index b546e093..0fd92eca 100644 --- a/src/client/App.tsx +++ b/src/client/App.tsx @@ -120,6 +120,7 @@ export default function App() { const pending = session?.changes.filter(change => ['pending', 'conflict'].includes(change.status)) || []; const reviewedRun = session?.execution?.run; const canContinueReview = !!session && pending.length === 0 && !isRunning + && !(session.execution?.task?.contract?.checks === 'skip' && session.execution.task.delivery?.status === 'files_applied') && (reviewedRun?.status === 'needs_review' || reviewedRun?.status === 'paused' && reviewedRun.stopReason === 'step_limit') && reviewedRun?.taskId === session.execution?.task?.id && reviewedRun?.stopReason !== 'git_review' @@ -571,7 +572,7 @@ export default function App() { {approval.checkScripts?.filter(check => check.python).map(check =>

Python {check.python!.runtime.version || '执行时核对版本'} · {check.python!.runtime.logicalExecutable || check.python!.runtime.executable || '解释器缺失'}

)}
{approval.cwd}

{approval.shell || '项目终端'} · UTF-8

{approval.browserPlanId ? '按封存步骤操作当前构建,保存页面原结果。' : '确认后以你的系统权限执行。'}

} {pending.length > 0 && !isRunning && } - {canContinueReview && } + {canContinueReview && }