diff --git a/AGENTS.md b/AGENTS.md index ae5b1553..28d4a65a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,7 @@ # Agent Workbench项目执行规范 +当前优先G:用户要求先修完已总结问题。1.24.1已实现完整变更批次同轮结算后审查交接、必要小源码先保留和原生容量/剩余预算准确诊断;停止、新提案、冲突、未知与篡改不冒充完整交接,应用后仍显式续接。E原第7–12请求离线复现估算完全一致,修复前六文件保留6/5/5/4/2/2,修复后均6/6且原硬预算保持。正式仍1.24.0/PID36552/Provider,当前正在完成1.24.1冻结回归、两视口和发行安装收口,见docs/QA-DELIVERY-RELIABILITY-G.md。新真实模型/Purge收益未重测,旧失败不改写;用户最新优先修复覆盖下方历史“先补原生窗口”的顺序,不以旧Escape暂停阻塞源码工作。 + 当前F固定安装已完成:1.24.0/source c03860d/候选20261102152844546,原PID36552/Provider保持,原42项目/58会话/4953记录/10329事件/2850工件/公开模型中心精确保持,调试端口关闭。独立源码ZIP514输入/22编译完全一致、三归档、实际便携、12组隔离安装及安装副本16组成果/9组文件流程通过;69份/46795742字节证据离线通过。首候选安装管理器漏编译及原60秒QA超时保持失败,见docs/QA-ORIGINAL-PURGE-RELEASE-F.md。正式原生窗口回看被物理Escape停止,未验收;不能宣称本切片全部体验验收完成。先补该项,再按docs/LIVE-DELIVERY-EFFICIENCY-PLAN.md处理原小源码保留抖动和完整批次后的检视空转。不得以新的发行源码重写D/E原编译身份或收益结论。 E实测完成:同源修复载荷、真实claude-opus-5-5/Chat/32K六新例52请求/621486报告tokens/0未知;Python原6/6/编译/审查Git通过,React和四原版AB/BA未交付。两次原版实际apply与11开启/17关闭输入通过核对,不证明收益。889份证据见docs/LIVE-RETEST-E-RESULTS.md;46原会话/2143工件/原表每行与96原尝试保持,公开参数和原池恢复。F现已固定安装:21份执行服务/网页/桌面编译与E保持,一个安装管理器入口补齐已修正脚本的重新编译。不重跑旧失败,不擅自扩大预算,不复制Key。 diff --git a/CHANGELOG.md b/CHANGELOG.md index 026e96cd..41e66c5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Agent Workbench 更新记录 +## 1.24.1 · 审查交接与上下文可靠性修复 + +- 完整文件批次封存并结算同轮工具后立即进入审查,停止额外模型调用;应用后显式续接原任务。 +- 优先稳定保留有原工具与SHA来源的小源码,下一页按实际保留量分配空间;保留上下文和累计预算硬限制。 +- 原生引擎区分上下文窗口不足和剩余预算不足,保留旧失败与原用量。 +- 原件离线复现、边界回归、实际编译HTTP/审查/检查与两视口验证分别记录,见docs/QA-DELIVERY-RELIABILITY-G.md;真实模型收益未重测。 + ## 1.24.0 · 已有成果续接与真实交付(已本地交付) - 当前已有文件可经完整读取和SHA核对纳入成果,保存Task/Run、原文件快照、任务要求与显式采用来源。 diff --git a/docs/QA-DELIVERY-RELIABILITY-G.md b/docs/QA-DELIVERY-RELIABILITY-G.md new file mode 100644 index 00000000..fdb8baec --- /dev/null +++ b/docs/QA-DELIVERY-RELIABILITY-G.md @@ -0,0 +1,33 @@ +# 1.24.1:真实案例确认问题修复 + +本切片先修复E原件中可复现的问题,暂停1.25新增能力。不续跑旧Task,不读取或复制Key,不将声明HTTP夹具当作真实模型交付或Purge收益。 + +## 改动 + +完整`prepare_change_set`成功后,先结算同轮所有工具,再核对当前Task、批次范围、原提案/快照、Git分支和HEAD、实际文件基线以及未知操作。只有覆盖所有待审查修改的完整未变批次进入`needs_review/change_set_review`,立即交还审查,不再调用模型。后续提案使批次不完整、失败封存、外部冲突、待核对操作和用户停止保持各自状态;单个只读工具失败保留原错误,不破坏完整批次的审查交接。文件仍须人工审查应用,应用后显式续接原Task进行实际检查。 + +请求规划先放入有原工具/SHA来源的小源码,再接纳可选历史。按长度和路径稳定排序,下一页实际保留量写入封存计划;不再用2048固定上限代表所有小源码。当前窗口、完整目标/权限/原结果/配对和逐请求剩余预算仍是硬约束,16K软目标允许容纳必要固定成本和已读源码。旧发送视图继续按原版本核对。 + +原生预算诊断按原`limitingReason`区分上下文容量和累计剩余额度。E中27424输入可放入27552可用窗口,但下一次29600预留超过28339剩余额度,应显示“原生引擎剩余预算不足”。缺少历史分项时保持“不足项待核对”,不推断旧记录。 + +## 开发证据与回顾 + +- 审查交接旧回归两例失败,边界五例通过;修改后的初轮9/9。补充未知结果及篡改指纹场景,最终结果另录。 +- 原React第7–12请求使用原system、实际路由工具、历史、32K窗口和逐请求剩余额度离线重建。修复前输入估算逐项等于原件:15714/15873/15905/15779/16000/15999,六文件完整保留6/5/5/4/2/2。修复后六次均6/6,输入15714/16110/16383/16504/16993/16945,全部仍在原27552或21197硬预算内。 +- 上下文初相关42项41通过/1失败:实现误将最新完整工具组也限制到软目标。已恢复“保留源码后,最新完整工具组可在硬预算内保留”的兼容行为,最终request-plan/working-set31/31。旧失败保留。 +- 首编译缺新共享模块声明文件,补齐`.d.mts`后1.24.1构建通过。首HTTP相关使用旧dist,保留2失败;后续只按当前编译验证。 +- 首UI在390px未关闭侧边检视区就点击后方续接按钮,脚本失败保留;按实际导航关闭检视区后继续。该失败不作为产品成功结果。 +- 首全回归为开发混合轮,发现版本入口常量尚为1.24.0(package已1.24.1),已停止该轮,不作为最终完整整轮。另两失败为浏览审批等待和旧`resume`错误文案断言;独立复验浏览原场景通过,`needs_review`正确返回409“请先审查待处理改动”,原断言改核对该明确状态及提示。修正版本入口后重新构建,后续按最终来源验证受影响范围。 +- 受影响15文件原轮131项130通过/1失败,唯一失败为旧断言要求容量错误含“预算”。已明确核对“上下文窗口可用容量”、原拒绝工件和`limitingReason=context_limit`,独立原场景1/1通过;原131轮不改写为全通过。后续18文件冻结回归另录。 +- 已检查发行验证器的版本范围,为1.24.1保留REA、原生SDK、浏览器、受控工程、已有成果、实际安装及历史界面入口,避免新补丁版静默跳过原验收分支。旧证据验证器的固定版本与身份不改。 +- 离线驱动初始化、SQLite保存和遗漏路由工具的开发失败保留;最终从路由variant取完整tools,才得到与原件逐项相同的修复前基线。不得用早期漏工具输出宣称修复收益。 + +## 收口状态 + +最终18文件冻结回归155/155通过,覆盖完整交接/所有边界、当前Task显式续接、实际Node检查、文件快照恢复、分页/源码保留、原生引擎/用量、Chat/Responses协议。1.24.1完整构建通过,12份产品输入在冻结回归与原件离线重放后SHA保持。没有把原131轮或中断混合轮改写成该最终结果。 + +最终1.24.1编译界面10组通过,桌面/390px的批次审查、刷新、整批应用、显式续接与实际Node检查均完成;实际原图已目视核对,两视口预算诊断可读、无横向溢出。额外11组批次界面验收通过,包括实际外部冲突、原字节回退、未知恢复、跨项目迟到响应保护,页面及请求错误均为0。 + +不可变源码独立重建、便携/安装和正式原状态核对正在执行。正式当前仍1.24.0/PID36552/Provider保留;全部会话以新只读快照为准,bootstrap仅显示其中48个,不能把它当作全部58个会话计数。正式原生窗口回看尚待补验。 + +可复用验收入口:`scripts/verify-live-context-retention.mjs`和`scripts/verify-delivery-reliability-ui.mjs`。各自要求新输出目录,保留既有失败,不覆盖旧证据。 diff --git a/docs/delivery-reliability-batch-ui-validation.json b/docs/delivery-reliability-batch-ui-validation.json new file mode 100644 index 00000000..df697091 --- /dev/null +++ b/docs/delivery-reliability-batch-ui-validation.json @@ -0,0 +1,29 @@ +{ + "success": true, + "version": "1.24.1", + "testedAt": "2026-11-02T23:56:19.047Z", + "cases": [ + "Desktop batch scope, per-file diffs, sealed single-write guard and pre-apply bytes", + "Three-file reviewed application preserves exact BOM/CRLF/LF and creates the new file", + "Explicit batch rollback restores exact originals and removes only the reviewed new file", + "A last-file owner conflict blocks the whole batch and shows the real recovery direction", + "Durable partial recovery reads actual hashes and preserves owner content during rollback", + "Changed observation fingerprints reject stale acknowledgement without releasing the project", + "Explicit owner-content acknowledgement ends recovery without claiming successful application", + "Switching projects clears the previous task notification while retaining its durable error and recovery history", + "390px step-limit review, same-task continuation entry, rollback confirmation and keyboard close fit the viewport", + "A delayed preparation response never opens a different project or changes its selected session", + "A failed batch response after its component unmounts cannot display an error in the newly selected project" + ], + "pageErrors": [], + "requestFailures": [], + "screenshots": [ + ".qa/screenshots/delivery-reliability-batch-desktop-review.png", + ".qa/screenshots/delivery-reliability-batch-desktop-conflict.png", + ".qa/screenshots/delivery-reliability-batch-desktop-recovery.png", + ".qa/screenshots/delivery-reliability-batch-mobile-review.png", + ".qa/screenshots/delivery-reliability-batch-mobile-rollback.png" + ], + "projectRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\batch-ui-c32248b4-ae65-4150-aca2-a252ec93daff", + "scope": "Real independent demo host and durable batch states; UI fixtures include actual owner conflict/rollback results. No real model credentials or user project were used." +} diff --git a/findings.md b/findings.md index 517f494e..f4a516b8 100644 --- a/findings.md +++ b/findings.md @@ -954,3 +954,6 @@ C实际渲染回看:1440/390px原截图均显示55,017上游报告、35,000运 C后续审查:首冻结147/147通过后,Responses独立首轮4响应+1unknown/reset,未自动重发,原失败保留;原夹具catch直接destroy且未保存原因。增加只收集error的诊断后新UUID五组通过,不能把未复现断开归因于已知断言。另修正每次重试/切池前的预留核对:45,100已报告/70,000预算时虽尚未超额,剩余24,900已低于校准预留,legacy和池都必须只发一次并保留503。最终425输入重新冻结,首轮147不算新来源149通过。D只读确认原插件默认autoRetry=true/retryMax3/hooksDenyBypass=true;完整原patch另含身份与redteam组件,必须隔离配置/加载闭包,不能直接改正式宿主。 D原版加载实证:31模块闭包还依赖dsh-llm,60包输入不足以代表全部Harness/原生闭包,已追加每场景335个实际JS/JSON加载身份。原插件自动更新/应用可关闭,但仍注册三项宿主操作工具和fullAccess钩子,需外部门控。Windows Node权限对不存在目录需显式通配;Harness启动向祖先查package元数据,JSONL落盘从盘根逐级stat且fsync被权限模型禁用。采用祖先实际stat元数据委托及受认证/真路径/dev/ino/size限制的真实父fsync,不跳过同步;三负例通过。native builtin loader需allow-addons,故仍不是任意插件OS沙箱。最终正常退出0和四全树退出已核对;原两项passedtrue漏退出断言已在报告明确不合格。工具错误会正常触发下一模型轮次,与模型失败重试不同,所有六桥输入均保留,不能隐藏第二轮或计作真实模型请求。 + + +G修复开发:完整批次交接旧回归2例失败、边界5例通过;修改后9/9通过。React原件离线以原system/tools/历史/32K/逐请求剩余额度重建,修复前第7–12次估算全部与原件相同,六文件完整保留为6/5/5/4/2/2;稳定小源码优先后6次均6/6,实际输入15714–16993,仍在原硬预算内,16K软目标未当成硬上限。无需新模型请求,原件保持。QA驱动初始化/SQLite/漏传路由工具的原失败保留,最终补实际路由工具后实现精确复现。 diff --git a/package-lock.json b/package-lock.json index 450e604f..7fbb79f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "local-agent-workbench", - "version": "1.24.0", + "version": "1.24.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "local-agent-workbench", - "version": "1.24.0", + "version": "1.24.1", "dependencies": { "@babel/parser": "7.29.11", "@peculiar/x509": "3.1.0", diff --git a/package.json b/package.json index 7f4dba5d..e112ef85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "local-agent-workbench", - "version": "1.24.0", + "version": "1.24.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 0acd6946..96e8cbd5 100644 --- a/progress.md +++ b/progress.md @@ -1,5 +1,9 @@ # 统一执行进度 +## G 已确认问题修复启动 + +用户明确优先修完已总结的问题。基线876df5f干净;先复现完整审查批次仍running和源码在16K软目标下逐份挤出。沿用既有规划与产品流程验收技能,不开子代理,不读取Key或重放旧实测Task;F正式已固定安装,旧Esc停止不作为当前源码修复的等待条件。首批读取超出输出上限,截断内容不作完整审查,后续缩小范围。 + ## F 固定安装与证据收口 最终候选20261102152844546/source c03860d已实际安装到正式versions目录,替代临时QA处理器,版本仍1.24.0。新源码ZIP提取514输入并离线实际重建,全部22编译与便携一致;D/E的21执行编译不变,修正安装管理器一个入口。三归档、实际便携链路、12组隔离安装及安装副本16组成果/9组文件流程通过。原60秒QA等待超时保持,最终驱动只把受控本机响应客户端期限设300秒、实际42382ms/两认证请求无重试,不修改产品时限。 @@ -1442,3 +1446,8 @@ C实现bb45dab;464份/19,086,976字节/425源码身份/446工件记录封存 D研究接续:实际原版入口/31模块及apply已在独立无Key Harness加载。最终original-purge-load-c6df89e7-8cd3-4e6c-b070-a8e6d02fec05四场景、六模型桥输入、外部工具拒绝、三项broker负例通过;正常原进程退出码0,四全树关闭。观察335模块/场景、338唯一路径;60原包文件与原目录/副本SHA保持。原始错误逐日志/UUID保留,早期两项passed=true因漏正常退出核对已明确不合格,未改原件。Windows JSONL祖先元数据及真实fsync通过有归属代理,不开放根目录读取;allow-addons不是OS沙箱,D生产接入/原生闭包仍待实现,不代表Purge收益。开发中一次rg误传PowerShell参数、两次猜测路径已纠正,未改变产品运行源码。真实请求0,正式宿主未动。 D实现7b4f7ee;496份/17,251,023字节/338观察加载路径/1,340加载记录离线通过;manifest SHA acabdce397139dcd59cbe7f66229a1353d4f95a5ceb7a555977e544b17ea1066。封存预检首次将自己的空输出log误当JSON收据,创建目标前拒绝;排除封存输出并原样保留失败log后完成,未改原模型/过程证据。继续记录生产接入范围,不以此研究驱动直接跑真实Purge收益。 + + +G修复开发:完整批次交接旧回归2例失败、边界5例通过;修改后9/9通过。React原件离线以原system/tools/历史/32K/逐请求剩余额度重建,修复前第7–12次估算全部与原件相同,六文件完整保留为6/5/5/4/2/2;稳定小源码优先后6次均6/6,实际输入15714–16993,仍在原硬预算内,16K软目标未当成硬上限。无需新模型请求,原件保持。QA驱动初始化/SQLite/漏传路由工具的原失败保留,最终补实际路由工具后实现精确复现。 + +G冻结收口:18文件155/155相关回归、最终1.24.1完整构建、10组两视口交接与预算界面、11组批次恢复/冲突/回退通过。桌面交接与1440/390px预算原图目视核对通过。一次只读收据路径误猜为.qa,实际生成于docs,按验证器写入位置定位;未重跑流程。封存验证器在提交前收紧为严格155项。一次补丁因工具JSON转义误读拒绝,未改变源码。下一不可变打包、独立重建与保留正式状态部署。 diff --git a/scripts/qa-evidence.mjs b/scripts/qa-evidence.mjs index 3ac35b8c..281a53d2 100644 --- a/scripts/qa-evidence.mjs +++ b/scripts/qa-evidence.mjs @@ -19,6 +19,7 @@ const prefixes = Object.freeze({ '1.22.1': 'local-files', '1.23.0': 'release-efficiency', '1.24.0': 'existing-results', + '1.24.1': 'delivery-reliability', }); export function releaseEvidencePrefix(version) { const prefix = prefixes[version]; diff --git a/scripts/upgrade-running.mjs b/scripts/upgrade-running.mjs index e9198c91..82a0b802 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', '1.20.1', '1.20.2', '1.20.3', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.2', '1.20.3', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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 452b746b..eaac8023 100644 --- a/scripts/verify-all-ui.mjs +++ b/scripts/verify-all-ui.mjs @@ -9,36 +9,36 @@ 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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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.24.0' ? [['verify-file-results-ui.mjs', null]] : []), - ...(['1.23.0', '1.24.0'].includes(version) ? [['verify-release-efficiency-ui.mjs', null]] : []), - ...(['1.22.1', '1.23.0', '1.24.0'].includes(version) ? [['verify-local-files.mjs', null]] : []), - ...(['1.22.0', '1.22.1', '1.23.0', '1.24.0'].includes(version)?[['verify-embedded-browser.mjs',null]]:[]), - ...(['1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0'].includes(version)?[['verify-environment-ui.mjs',null],['verify-model-fidelity-ui.mjs',null],['verify-model-wait-ui.mjs',null],['verify-task-control-ui.mjs',null]]:[]), - ...(['1.20.0', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0'].includes(version) ? [['verify-evaluations-ui.mjs', null]] : []), - ...(['1.19.0', '1.20.0', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0'].includes(version) ? [['verify-project-cache-ui.mjs', null]] : []), - ...(['1.18.0', '1.19.0', '1.20.0', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0'].includes(version) ? [['verify-vision-ui.mjs', null]] : []), - ...(['1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0'].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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0'].includes(version) ? [['verify-browser-ui.mjs', `docs/${prefix}-browser-ui-validation.json`]] : []), + ...(['1.24.0', '1.24.1'].includes(version) ? [['verify-file-results-ui.mjs', null]] : []), + ...(['1.23.0', '1.24.0', '1.24.1'].includes(version) ? [['verify-release-efficiency-ui.mjs', null]] : []), + ...(['1.22.1', '1.23.0', '1.24.0', '1.24.1'].includes(version) ? [['verify-local-files.mjs', null]] : []), + ...(['1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1'].includes(version)?[['verify-embedded-browser.mjs',null]]:[]), + ...(['1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1'].includes(version)?[['verify-environment-ui.mjs',null],['verify-model-fidelity-ui.mjs',null],['verify-model-wait-ui.mjs',null],['verify-task-control-ui.mjs',null]]:[]), + ...(['1.20.0', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1'].includes(version) ? [['verify-evaluations-ui.mjs', null]] : []), + ...(['1.19.0', '1.20.0', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1'].includes(version) ? [['verify-project-cache-ui.mjs', null]] : []), + ...(['1.18.0', '1.19.0', '1.20.0', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1'].includes(version) ? [['verify-vision-ui.mjs', null]] : []), + ...(['1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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-controlled-release.mjs b/scripts/verify-controlled-release.mjs index ba887c98..6b4cd482 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', '1.20.1', '1.20.2', '1.20.3', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.2', '1.20.3', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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-reliability-evidence.mjs b/scripts/verify-delivery-reliability-evidence.mjs new file mode 100644 index 00000000..69485c77 --- /dev/null +++ b/scripts/verify-delivery-reliability-evidence.mjs @@ -0,0 +1,83 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { requestMetrics } from '../src/shared/contracts/model-request.mjs'; + +if (process.argv.includes('--help')) { + console.log('node scripts/verify-delivery-reliability-evidence.mjs — offline verify sealed G bytes, exact original/fixed context, frozen regression, UI/rebuild/installation receipts and preserved state. No model or host calls.'); + process.exit(0); +} +assert.equal(process.argv.length, 2); +const root = path.resolve('docs/delivery-reliability-g-evidence'); +const hash = bytes => createHash('sha256').update(bytes).digest('hex'); +const read = file => JSON.parse(fs.readFileSync(path.join(root, file), 'utf8')); +const manifestBytes = fs.readFileSync(path.join(root, 'manifest.json')), manifest = JSON.parse(manifestBytes); +assert.equal(manifest.schemaVersion, 1); assert.equal(manifest.version, '1.24.1'); +assert.match(manifest.sourceCommit, /^[a-f0-9]{40}$/); +const paths = new Set(); let bytes = 0; +for (const entry of manifest.entries) { + assert.ok(!paths.has(entry.path)); paths.add(entry.path); + const target = path.resolve(root, entry.path); assert.ok(target.startsWith(root + path.sep)); + const raw = fs.readFileSync(target); assert.equal(raw.length, entry.bytes, entry.path); assert.equal(hash(raw), entry.sha256, entry.path); bytes += raw.length; +} +assert.equal(hash(fs.readFileSync('docs/live-original-purge-e-evidence/manifest.json')), manifest.originalEManifestSha256); +assert.equal(hash(fs.readFileSync('docs/original-purge-release-f-evidence/manifest.json')), manifest.originalFManifestSha256); +const tap = fs.readFileSync(path.join(root, manifest.checks.regression), 'utf8'); +const total = Number(tap.match(/ℹ tests (\d+)/)?.[1]), passed = Number(tap.match(/ℹ pass (\d+)/)?.[1]), failed = Number(tap.match(/ℹ fail (\d+)/)?.[1]); +assert.equal(total, 155); assert.equal(total, passed); assert.equal(failed, 0); +function strings(value, output = [], depth = 0) { + if (depth > 12) return output; + if (typeof value === 'string') { + output.push(value); + for (const text of new Set([value, ...value.split('\n').filter(line => /^\s*[\[{]/.test(line))])) { + try { strings(JSON.parse(text), output, depth + 1); } catch {} + } + } else if (value && typeof value === 'object') for (const item of Object.values(value)) strings(item, output, depth + 1); + return output; +} +const before = read('context/before/result.json'), after = read('context/final/result.json'); +assert.equal(before.manifestSha256, manifest.originalEManifestSha256); assert.equal(after.manifestSha256, before.manifestSha256); +assert.equal(after.realModelRequests, 0); assert.equal(before.realModelRequests, 0); +assert.deepEqual(before.reports.map(report => report.sources.filter(source => source.retained).length), [6, 5, 5, 4, 2, 2]); +for (const [index, report] of after.reports.entries()) { + assert.equal(report.sources.length, 6); assert.ok(report.sources.every(source => source.retained)); + assert.equal(report.inputBudget, before.reports[index].inputBudget); assert.equal(report.softTarget, 16000); + const original = read('context/before/request-' + report.request + '.json'); + const fixed = read('context/final/request-' + report.request + '.json'); + assert.equal(requestMetrics(original.body).estimatedInputTokens, before.reports[index].originalInputTokens); + const metrics = requestMetrics(fixed.body); assert.equal(metrics.estimatedInputTokens, report.inputTokens); assert.ok(metrics.estimatedInputTokens <= report.inputBudget); + assert.equal(metrics.sha256, fixed.plan.requestSha256); + assert.deepEqual(fixed.body.messages[0], original.body.messages[0], 'Complete original fixed goal/context'); + assert.deepEqual(fixed.body.variants.map(route => route.body.tools), original.body.variants.map(route => route.body.tools), 'Original complete tools'); + for (const source of report.sources) { + const raw = fs.readFileSync(path.join('docs/live-original-purge-e-evidence/baselines/react', source.path), 'utf8'); + assert.equal(raw.length, source.characters); assert.ok(strings(fixed.body.messages).includes(raw), source.path); + } +} +for (const key of ['sourceUI', 'portableUI']) { + const ui = read(manifest.checks[key]); assert.equal(ui.success, true); assert.equal(ui.version, manifest.version); + assert.equal(ui.realModelRequests, 0); assert.equal(ui.fixtureRequests, 5); assert.equal(ui.checks.length, 10); assert.deepEqual(ui.errors, []); + for (const file of ui.screenshots) assert.ok(paths.has(path.posix.join(path.posix.dirname(manifest.checks[key]), path.basename(file)))); +} +const release = read(manifest.checks.release), rebuild = read(manifest.checks.rebuild), archives = read(manifest.checks.archives), portable = read(manifest.checks.portable), install = read(manifest.checks.installer); +assert.equal(release.documentation.sourceCommit, manifest.sourceCommit); +assert.equal(rebuild.success, true); assert.equal(rebuild.sourceCommit, manifest.sourceCommit); assert.equal(rebuild.sourceZip.sha256, release.source.sha256); +assert.equal(rebuild.compiled.length, 22); assert.deepEqual(rebuild.mismatches, []); +assert.equal(archives.success, true); assert.equal(archives.version, manifest.version); assert.equal(archives.archives.length, 3); +for (const archive of [release.portable, release.source, release.evidence]) assert.ok(archives.archives.some(record => record.sha256 === archive.sha256)); +assert.equal(portable.success, true); assert.equal(portable.version, manifest.version); assert.equal(portable.realModel, false); +assert.ok(portable.actualRea.length > 0); assert.ok(portable.actualEngine); assert.ok(portable.actualControlled); assert.ok(portable.actualBrowser); +assert.equal(install.success, true); assert.equal(install.version, manifest.version); assert.equal(install.realModelRequests, 0); +assert.equal(install.results.length, 12); assert.ok(install.results.every(result => result.passed)); +for (const key of ['formalInstall', 'formalFinal']) { + const record = read(manifest.checks[key]); assert.equal(record.success, true); assert.equal(record.version, manifest.version); + assert.equal(record.sourceCommit, manifest.sourceCommit); assert.equal(record.pid, 36552); assert.equal(record.hasKey, true); + assert.equal(record.retention.originalRows, 'exact'); assert.equal(record.retention.originalExports, 'exact'); + assert.equal(record.retention.originalArtifactBytes, 'exact'); assert.equal(record.retention.originalModelCenter, 'exact'); + assert.equal(record.operation.state, 'completed'); assert.equal(record.inspectorClosed, true); assert.equal(record.realModelRequests, 0); +} +console.log(JSON.stringify({ success: true, version: manifest.version, sourceCommit: manifest.sourceCommit, + files: paths.size, bytes, manifestSha256: hash(manifestBytes), regression: { total, passed, failed }, + originalRetained: before.reports.map(report => report.sources.filter(source => source.retained).length), fixedRetained: after.reports.map(report => report.sources.filter(source => source.retained).length), + compiledFiles: rebuild.compiled.length, uiGroups: 20, realModelRequests: 0, scope: 'Offline sealed-byte and actual-receipt verification. No new model calls, task execution, or claim of real-model/Purge success.' })); diff --git a/scripts/verify-delivery-reliability-ui.mjs b/scripts/verify-delivery-reliability-ui.mjs new file mode 100644 index 00000000..5c408a48 --- /dev/null +++ b/scripts/verify-delivery-reliability-ui.mjs @@ -0,0 +1,128 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { chromium, expect } from 'playwright/test'; +import { fixture, compatibleFixture, launchWorkbench, call, completion, until, assertToolPairs } from '../tests/helpers.mjs'; + +if (process.argv.includes('--help')) { + console.log('node scripts/verify-delivery-reliability-ui.mjs OUTPUT [APP_ROOT] — declared local HTTP model fixture, actual review/continue/check UI and saved budget cases; no real model. OUTPUT must be new.'); + process.exit(0); +} +assert.ok(process.argv[2], 'Choose a new output directory.'); +const output = path.resolve(process.argv[2]); +assert.ok(!fs.existsSync(output), 'Keep prior evidence; choose a new directory.'); +fs.mkdirSync(output, { recursive: true }); +const appRoot = path.resolve(process.argv[3] ?? '.'); +const cleanups = [], t = { after: fn => cleanups.push(fn) }; +const f = fixture(t), cases = {}; +fs.mkdirSync(path.join(f.projectRoot, 'test')); +fs.writeFileSync(path.join(f.projectRoot, 'package.json'), JSON.stringify({ type: 'module', scripts: { test: 'node --test test/*.test.mjs' } })); +fs.writeFileSync(path.join(f.projectRoot, 'test/values.test.mjs'), "import test from 'node:test';import assert from 'node:assert/strict';import {left} from '../src/left.mjs';import {right} from '../src/right.mjs';test('left',()=>assert.equal(left,1));test('right',()=>assert.equal(right,2));\n"); +for (const [name, limitingReason] of [['remaining', 'remaining_token_budget'], ['window', 'context_limit'], ['legacy', null]]) { + const root = path.join(f.root, name); fs.mkdirSync(root); fs.writeFileSync(path.join(root, 'README.md'), '# Declared saved-budget UI fixture\n'); + const project = f.store.addProject(root), session = f.store.createSession(project.id, '预算诊断 ' + name); + const goal = '保留原任务和已完成工具;按原拒绝分项核对预算。'; + const run = f.store.beginRun(session, goal, false, f.store.config); + run.budgetPause = { schema: 1, reason: 'engine_input_budget', ...(limitingReason ? { limitingReason } : {}), + requiredInputTokens: name === 'window' ? 28000 : 27424, inputBudget: 27552, contextLimit: 32000, + outputReservation: 2048, safetyTokens: 2400, runRemainingTokens: 28339, taskRemainingTokens: 28339, + remainingTokens: 28339, tokenReservation: { schemaVersion: 1, reservedTokens: 29600, routes: [] } }; + session.status = 'paused'; f.store.finishRun(session, run, 'engine_input_budget'); cases[name] = { project, session }; +} +f.store.close(); +let requests = 0, browser, page; +const checks = [], errors = [], screenshots = []; + const mark = name => { checks.push(name); console.log('PASS ' + name); }; +const screenshot = async name => { const file = path.join(output, name + '.png'); await page.screenshot({ path: file, fullPage: true }); screenshots.push(file); }; +try { + const model = await compatibleFixture(t, (_route, input) => { + if (!input?.messages) return { data: [{ id: 'declared-ui-fixture' }] }; + requests++; assertToolPairs(input.messages); + const values = input.messages.filter(message => message.role === 'tool').map(message => JSON.parse(message.content)); + if (requests === 1) return completion([ + call('ui-left', 'propose_file', { path: 'src/left.mjs', content: 'export const left = 1;\n', reason: 'Declared fixture left' }), + call('ui-right', 'propose_file', { path: 'src/right.mjs', content: 'export const right = 2;\n', reason: 'Declared fixture right' }), + ]); + if (requests === 2) return completion([ + call('ui-seal', 'prepare_change_set', { change_ids: values.map(value => value.change_id).filter(Boolean) }), + call('ui-same-turn-inspect', 'inspect_session', {}), + ]); + if (requests === 3) return completion([call('ui-check-plan', 'plan_checks', { names: ['test'] })]); + if (requests === 4) return completion([call('ui-check-run', 'run_checks', { plan_id: values.findLast(value => value.checks && value.fingerprint).id })]); + return completion([], '两份模块已通过实际 Node 测试。'); + }); + const host = await launchWorkbench(t, f.data, {}, { appRoot }); + assert.equal(host.bootstrap.version, JSON.parse(fs.readFileSync(path.join(appRoot, 'package.json'))).version, 'Compiled host and package must agree.'); + await host.api('/config', { mode: 'compatible', baseUrl: model.baseUrl, model: 'declared-ui-fixture', apiKey: 'SYNTHETIC-QA-ONLY', maxSteps: 6 }); + browser = await chromium.launch({ channel: 'msedge', headless: true }); + page = await browser.newPage({ viewport: { width: 1440, height: 1000 } }); + page.on('pageerror', error => errors.push(error.message)); + page.on('requestfailed', request => { if (request.resourceType() !== 'eventsource') errors.push(request.url() + ': ' + request.failure()?.errorText); }); + await page.goto(host.url); await page.waitForLoadState('networkidle'); + async function choose(projectId) { + const selector = page.getByLabel('当前项目', { exact: true }); + if (!await selector.isVisible()) await page.getByRole('button', { name: '展开项目栏', exact: true }).click(); + await selector.selectOption(projectId); + if ((await page.viewportSize()).width <= 940 && await page.locator('.project-sidebar').isVisible()) await page.getByRole('button', { name: '收起项目栏', exact: true }).click(); + } + await choose(f.project.id); + await page.getByLabel('任务内容', { exact: true }).fill('完成双模块工程,并在审查应用后继续实际测试。'); + await page.getByRole('button', { name: '发送任务', exact: true }).click(); + const route = '/sessions/' + f.session.id; + let reviewed; + await until(async () => { reviewed = await host.api(route); return reviewed.status === 'needs_review'; }, 30000); + assert.equal(requests, 2); assert.equal(reviewed.execution.run.stopReason, 'change_set_review'); + assert.equal(reviewed.events.find(event => event.toolCallId === 'ui-same-turn-inspect').phase, 'completed'); + assert.equal(fs.existsSync(path.join(f.projectRoot, 'src')), false); + mark('Actual compiled HTTP model loop settles both tools and hands off after exactly two fixture requests without writing files'); + await page.getByRole('button', { name: '查看任务记录', exact: true }).click(); + await expect(page.getByLabel('任务记录', { exact: true })).toContainText('完整文件批次已封存,等待审查与应用'); + await screenshot('desktop-review-handoff'); + await page.reload(); await page.waitForLoadState('networkidle'); + assert.equal((await host.api(route)).execution.task.id, reviewed.execution.task.id); assert.equal(requests, 2); + mark('Review handoff persists across refresh without another model request'); + await page.setViewportSize({ width: 390, height: 844 }); await choose(f.project.id); + await page.getByRole('button', { name: '查看改动', exact: true }).click(); + await page.getByRole('button', { name: '审查变更集', exact: true }).click(); + const dialog = page.getByRole('dialog', { name: '多文件变更集审查', exact: true }); + await expect(dialog).toContainText('src/left.mjs'); await expect(dialog).toContainText('src/right.mjs'); + await screenshot('mobile-batch-review'); + await dialog.getByRole('button', { name: '确认应用全部 2 项', exact: true }).click(); + await until(async () => (await host.api(route)).execution.changeSets.at(-1).status === 'completed', 30000); + await page.keyboard.press('Escape'); await expect(page.getByRole('button', { name: '继续原任务', exact: true })).toBeVisible(); + await page.getByRole('button', { name: '关闭检视区', exact: true }).click(); + assert.equal(requests, 2); mark('390px reviewed whole-batch application waits for explicit continuation'); + await page.getByRole('button', { name: '继续原任务', exact: true }).click(); + await until(async () => (await host.api(route)).approvals.some(approval => approval.status === 'pending'), 30000); + await screenshot('mobile-check-approval'); + await page.getByRole('button', { name: '确认执行', exact: true }).click(); + let done; + await until(async () => { done = await host.api(route); return done.status === 'completed'; }, 30000); + assert.equal(done.execution.task.id, reviewed.execution.task.id); assert.equal(done.execution.checks[0].results[0].tests.passed, 2); + assert.equal(requests, 5); + assert.equal(done.events.filter(event => ['propose_file', 'prepare_change_set'].includes(event.tool)).length, 3); + mark('Explicit same-Task continuation runs two actual Node assertions and never replays proposals or sealing'); + for (const width of [1440, 390]) { + await page.setViewportSize({ width, height: width === 390 ? 844 : 1000 }); + for (const [name, title] of [['remaining', '原生引擎剩余预算不足'], ['window', '原生引擎上下文窗口不足'], ['legacy', '原生引擎输入或剩余预算不足']]) { + await choose(cases[name].project.id); + await expect(page.locator('.session-item.selected')).toContainText('预算诊断 ' + name); + const panel = page.getByLabel('任务预算诊断', { exact: true }); + await expect(panel.getByRole('heading', { name: title, exact: true })).toBeVisible(); + if (name === 'remaining') { await expect(panel).toContainText('输入可容纳于当前上下文窗口'); await expect(panel).toContainText('29,600'); await expect(panel).toContainText('28,339'); } + assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 2)); + await screenshot(width + '-budget-' + name); + mark(width + 'px ' + name + ' diagnosis renders actual limit, numbers and historical fallback without overflow'); + } + } + assert.deepEqual(errors, []); + const result = { success: true, version: (await host.api('/bootstrap')).version, appRoot, checks, errors, screenshots, + fixtureRequests: requests, realModelRequests: 0, taskId: done.execution.task.id, runs: done.execution.runs.map(run => ({ id: run.id, status: run.status, stopReason: run.stopReason })), + scope: 'Declared local HTTP model fixture with actual engineering tools/checks, persisted review state and seeded diagnostic cases. No real model or user project.', browser: browser.version() }; + fs.writeFileSync(path.join(output, 'result.json'), JSON.stringify(result, null, 2) + '\n', { flag: 'wx' }); + console.log(JSON.stringify({ success: true, checks: checks.length, output })); +} catch (error) { + if (page) await screenshot('failure').catch(() => {}); + fs.writeFileSync(path.join(output, 'result.json'), JSON.stringify({ success: false, checks, errors, screenshots, error: error.stack, requests }, null, 2) + '\n', { flag: 'wx' }); + throw error; +} finally { if (browser) await browser.close(); for (const cleanup of cleanups.reverse()) await cleanup(); } diff --git a/scripts/verify-desktop-install.mjs b/scripts/verify-desktop-install.mjs index e87778c4..88f652a4 100644 --- a/scripts/verify-desktop-install.mjs +++ b/scripts/verify-desktop-install.mjs @@ -149,7 +149,7 @@ try { const beforeRestart = snapshotPersistentData(dataRoot); await controller.stop(); const restarted = (await controller.start()).identity; assert.notEqual(restarted.pid, original.pid); assert.deepEqual(snapshotPersistentData(dataRoot), beforeRestart); await controller.api('/model-center/probe', { method: 'POST', input: { id: connectionId } }); assert.equal(authenticated, 3); record(stage, { originalPid: original.pid, restartedPid: restarted.pid, authenticatedRequests: authenticated }); - if (version === '1.24.0') { + if (['1.24.0', '1.24.1'].includes(version)) { stage = 'actual installed current results and saved HTML user paths'; const pointer = JSON.parse(fs.readFileSync(path.join(installRoot, 'current.json'))); const installedRoot = fs.realpathSync.native(path.join(installRoot, 'versions', pointer.active.directory)), proofs = []; diff --git a/scripts/verify-live-context-retention.mjs b/scripts/verify-live-context-retention.mjs new file mode 100644 index 00000000..2e6fd0c9 --- /dev/null +++ b/scripts/verify-live-context-retention.mjs @@ -0,0 +1,96 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { Store } from '../src/server/store.mjs'; +import { RequestPlanner, historyGroups, verifyPlanEvidence } from '../src/core/context/request-plan.mjs'; + +if (process.argv.includes('--help')) { + console.log('node scripts/verify-live-context-retention.mjs OUTPUT [retained|original] — offline replay of sealed E source/context, no model calls. OUTPUT must be a new directory.'); + process.exit(0); +} +assert.ok(process.argv[2], 'Choose a new output directory.'); +const destination = path.resolve(process.argv[2]); +assert.ok(!fs.existsSync(destination), 'Keep prior evidence; choose a new directory.'); +fs.mkdirSync(destination, { recursive: true }); +const root = path.resolve('docs/live-original-purge-e-evidence'); +const sha = value => createHash('sha256').update(value).digest('hex'); +const read = name => JSON.parse(fs.readFileSync(path.join(root, name))); +const manifest = read('manifest.json'); +for (const entry of manifest.entries) { + const raw = fs.readFileSync(path.join(root, entry.path)); + assert.equal(raw.length, entry.bytes); assert.equal(sha(raw), entry.sha256); +} +const sample = manifest.samples.find(sample => sample.name === 'react'); +const exported = read('owned-exports/' + sample.sessionId + '.json'); +const original = exported.session; +const rows = read('receipts/owned-records.json'); +const originalCore = {}; +for (const row of rows) (originalCore[row.kind] ??= new Map()).set(row.id, JSON.parse(row.payload)); +const artifacts = new Map(manifest.artifacts.map(artifact => [artifact.id, artifact])); +function rawArtifact(id) { return fs.readFileSync(path.join(root, artifacts.get(id).file), 'utf8'); } +const plans = [...originalCore.context_plan.values()].filter(plan => plan.sessionId === sample.sessionId).sort((a, b) => a.requestIndex - b.requestIndex); +const reports = []; +for (const prior of plans.filter(plan => plan.requestIndex >= 7)) { + const store = new Store(path.join(destination, 'request-' + prior.requestIndex)); + try { + for (const [kind, map] of Object.entries(originalCore)) store.core[kind] = structuredClone(map); + const readNew = store.artifactStore.read.bind(store.artifactStore); + store.artifactStore.read = artifact => artifacts.has(artifact.id) ? rawArtifact(artifact.id) : readNew(artifact); + const session = structuredClone(original); + store.sessions.set(session.id, session); + store.save = () => {}; // Scratch planner records only; never persist original sessions. + const project = store.project.bind(store); + store.project = id => id === exported.project.id ? exported.project : project(id); + session.providerMessages = session.providerMessages.slice(0, prior.originalMessages); + session.changes = session.changes.filter(change => change.createdAt <= prior.createdAt); + const run = store.core.run.get(prior.runId), task = store.core.task.get(prior.taskId); + // Restore this request's exact remaining credits, not the final run's usage. + for (const [record, remaining] of [[run, prior.budget.runRemainingTokens], [task, prior.budget.taskRemainingTokens]]) { + record.usage = { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0, estimatedUnknownTokens: 0 }; + record.budget.maxTokens = remaining ?? 0; + } + run.consumption = []; // Context selection only; no fabricated upstream usage. + const request = JSON.parse(rawArtifact(prior.requestArtifactId)); + const wire = request.variants?.[0].body ?? request; + const config = { ...run.model, modelRouting: run.model.routing, streaming: wire.stream, nativeParameters: run.model.nativeParameters ?? {} }; + const planner = new RequestPlanner(store); + const prepared = planner.prepare(session, run, config, { system: request.messages[0].content, tools: wire.tools }); + assert.equal(prepared.record.budget.inputBudget, prior.budget.inputBudget); + assert.ok(prepared.record.estimatedInputTokens <= prepared.record.budget.inputBudget); + verifyPlanEvidence(store, session, prepared.record); + const sources = []; + for (const group of historyGroups(session.providerMessages)) for (const message of group.messages.filter(message => message.role === 'tool')) { + const call = group.messages[0].tool_calls.find(call => call.id === message.tool_call_id); + const value = JSON.parse(message.content); + if (call.function.name === 'read_file' && !value.truncated && value.start_line === 1 && value.end_line === value.total_lines) { + sources.push({ path: value.path, content: value.content }); + } + } + function strings(value, out = []) { + if (typeof value === 'string') { + out.push(value); + for (const line of [value, ...value.split('\n').filter(line => /^[\[{]/.test(line))]) { try { strings(JSON.parse(line), out); } catch {} } + } else if (value && typeof value === 'object') for (const item of Object.values(value)) strings(item, out); + return out; + } + const sent = strings(prepared.messages); + const report = { request: prior.requestIndex, originalInputTokens: prior.estimatedInputTokens, + inputTokens: prepared.record.estimatedInputTokens, inputBudget: prior.budget.inputBudget, + softTarget: prior.budget.targetInputTokens, + sources: [...new Map(sources.map(source => [source.path, source])).values()].map(source => ({ path: source.path, + characters: source.content.length, retained: sent.some(text => text.includes(source.content)) })) }; + reports.push(report); + fs.writeFileSync(path.join(destination, 'request-' + prior.requestIndex + '.json'), JSON.stringify({ report, plan: prepared.record, body: prepared.body }, null, 2), { flag: 'wx' }); + } finally { store.close(); } +} +const result = { schemaVersion: 1, manifestSha256: sha(fs.readFileSync(path.join(root, 'manifest.json'))), + scope: 'Offline context-selection counterfactual using original E system/tools/history/source bytes and remaining credits. No model requests or task execution. Historical outcomes unchanged.', + realModelRequests: 0, reports }; +if (process.argv[3] === 'retained') assert.ok(reports.every(report => report.sources.length === 6 && report.sources.every(source => source.retained))); +if (process.argv[3] === 'original') { + assert.ok(reports.every(report => report.inputTokens === report.originalInputTokens)); + assert.deepEqual(reports.map(report => report.sources.filter(source => source.retained).length), [6, 5, 5, 4, 2, 2]); +} +fs.writeFileSync(path.join(destination, 'result.json'), JSON.stringify(result, null, 2) + '\n', { flag: 'wx' }); +console.log(JSON.stringify(result)); diff --git a/scripts/verify-release.mjs b/scripts/verify-release.mjs index 935a1552..aa2da52b 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', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.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 fb56f45a..e4dc8520 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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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(); @@ -161,7 +161,7 @@ try { assert.equal(actualProjectCache.realModelRequests, 0); assert.deepEqual(actualProjectCache.pageErrors, []); } let actualEnvironment = null, actualEnvironmentEngineering = null; - if (['1.21.0','1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.21.0','1.22.0', '1.23.0', '1.24.0', '1.24.1'].includes(evidence.version)) { stage = 'contained environment approval, stop and recovery UI'; const output = await run(['scripts/verify-environment-ui.mjs', '--app-root', sourceRoot], 'environment-ui.log'); const summary = JSON.parse(output.trim().split(/\r?\n/).findLast(line => line.startsWith('{"success":'))); @@ -179,7 +179,7 @@ try { assert.equal(actualEnvironmentEngineering.pythonTests, 2); assert.equal(actualEnvironmentEngineering.realModelRequests, 0); } let actualEmbeddedBrowser = null; - if (['1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.22.0', '1.23.0', '1.24.0', '1.24.1'].includes(evidence.version)) { stage = 'actual embedded Electron, Vite and original mobile observation'; await run(['scripts/verify-embedded-browser.mjs', '--app-root', sourceRoot], 'embedded-browser.log'); actualEmbeddedBrowser = JSON.parse(fs.readFileSync(path.join(sourceRoot, '.qa/embedded-browser-latest.json'), 'utf8')); @@ -189,7 +189,7 @@ try { assert.equal(actualEmbeddedBrowser.realModelRequests, 0); assert.deepEqual(actualEmbeddedBrowser.errors, []); } let actualReleaseEfficiency = null; - if (['1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.23.0', '1.24.0', '1.24.1'].includes(evidence.version)) { stage = 'actual update status Edge/Electron and basic saved HTML flows'; const proofs = []; for (const script of ['verify-release-efficiency-ui.mjs', 'verify-local-files.mjs']) { @@ -203,7 +203,7 @@ try { actualReleaseEfficiency = proofs; } let actualFileResults = null; - if (evidence.version === '1.24.0') { + if (['1.24.0', '1.24.1'].includes(evidence.version)) { stage = 'current file results Edge, Electron and paired mobile observation'; await run(['scripts/verify-file-results-ui.mjs'], 'file-results-ui.log'); actualFileResults = JSON.parse(fs.readFileSync(path.join(sourceRoot, '.qa/file-results-ui-latest.json'), 'utf8')); @@ -243,14 +243,14 @@ try { for (const key of ['fail', 'cancelled', 'skipped', 'todo']) assert.equal(groupStats[key], 0); } let actualTaskControl = null; - if (['1.20.1', '1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.20.1', '1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.1'].includes(evidence.version)) { 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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.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','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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); @@ -264,7 +264,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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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')); @@ -274,7 +274,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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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')); @@ -284,7 +284,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', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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')); @@ -294,7 +294,7 @@ try { assert.deepEqual(actualCacheEngineering.results.map(value => value.check.results[0].tests.passed), [8, 9, 10]); } let actualEvaluations = null, actualEvaluationEngineering = null; - if (['1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0'].includes(evidence.version)) { + if (['1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.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(); diff --git a/src/client/BudgetPausePanel.tsx b/src/client/BudgetPausePanel.tsx index 1f88f253..6c8a5860 100644 --- a/src/client/BudgetPausePanel.tsx +++ b/src/client/BudgetPausePanel.tsx @@ -4,10 +4,10 @@ import { api } from './api'; import { Modal } from './components'; import type { Config,Session } from './types'; import './input-attachments.css'; +import { budgetPausePresentation } from '../shared/budget-presentation.mjs'; type Fields={contextLimit:number;maxOutputTokens:number;maxRunTokens:number;maxTaskTokens:number;maxSteps:number;maxRunDurationMs:number}; type Preview={id:string;sha256:string;taskId:string;runId:string;config:Fields&{model:string};eligibleConnections:{id:string;name:string;model:string}[];budget:{inputBudget:number;contextLimit:number};completedToolIds:string[];unknownToolIds:string[];attachmentIds:string[];note:string}; -const reasons:Record={context_limit:'上下文窗口不足',engine_input_budget:'原生引擎输入或剩余预算不足',token_limit:'本次运行预算不足',task_token_limit:'任务累计预算不足',time_limit:'本次运行时间已用完'}; const labels:Record={transportAndImageFramingTokens:'请求格式与图片说明',goalAndContextTextTokens:'目标、全部要求及工程上下文',toolDefinitionTokens:'工具定义',historyAndEvidenceTokens:'必需历史及实际依据',imageReservationTokens:'图像本地预留',requestOverheadTokens:'请求格式',fixedInstructionTokens:'完整目标与原生提示',retainedHistoryAndViewTokens:'保留历史与工具结果'}; export function BudgetPausePanel({session,config,onSession,onRecovery}:{session:Session;config:Config;onSession:(value:Session)=>void;onRecovery?:()=>void}){ @@ -16,13 +16,15 @@ export function BudgetPausePanel({session,config,onSession,onRecovery}:{session: maxRunTokens:config.maxRunTokens,maxTaskTokens:session.execution?.task?.budget.maxTokens??config.maxTaskTokens,maxSteps:config.maxSteps,maxRunDurationMs:config.maxRunDurationMs}); const [selection,setSelection]=useState(''),[options,setOptions]=useState<{value:string;name:string}[]>([]); const run=session.execution?.run,pause=run?.budgetPause,reason=pause?.reason??run?.stopReason??''; + const diagnosis=budgetPausePresentation(pause,reason); const controlled=session.execution?.task?.origin==='isolated-worker'||run?.engine==='deepseek-workbench'; const calibrationSources=new Set(pause?.tokenReservation?.routes.flatMap(route=>route.sources.map(source=>source.attemptId))??[]).size; - if(!['paused','failed'].includes(session.status)||!reasons[reason])return null; + if(!['paused','failed'].includes(session.status)||!diagnosis)return null; async function start(){setOpen(true);setError('');setPlan(null);try{const center=await api<{selected:{type:string;id:string};connections:{id:string;name:string;contextLimit:number}[];pools:{id:string;name:string}[]}>('/model-center');setSelection(center.selected.type+':'+center.selected.id);setOptions([...center.connections.map(row=>({value:(row.id==='legacy-default'?'legacy':'connection')+':'+row.id,name:row.name+' · '+row.contextLimit.toLocaleString()+' 上下文'})),...center.pools.map(row=>({value:'pool:'+row.id,name:row.name+' · 按成员最小容量'}))]);}catch(cause){setError((cause as Error).message);}} async function preview(){setBusy(true);setError('');setPlan(null);try{const [type,id]=selection.split(':');const value=await api('/sessions/'+session.id+'/resume-preview',{...fields,...(selection?{selection:{type,id}}:{})});setPlan(value);onSession(await api('/sessions/'+session.id));}catch(cause){setError((cause as Error).message);}finally{setBusy(false);}} async function confirm(){if(!plan)return;setBusy(true);setError('');try{onSession(await api('/sessions/'+session.id+'/resume-budget',{planId:plan.id,sha256:plan.sha256}));setOpen(false);}catch(cause){setError((cause as Error).message);}finally{setBusy(false);}} - return