fix: hand off complete changes and retain verified source context
This commit is contained in:
@@ -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。
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# Agent Workbench 更新记录
|
||||
|
||||
## 1.24.1 · 审查交接与上下文可靠性修复
|
||||
|
||||
- 完整文件批次封存并结算同轮工具后立即进入审查,停止额外模型调用;应用后显式续接原任务。
|
||||
- 优先稳定保留有原工具与SHA来源的小源码,下一页按实际保留量分配空间;保留上下文和累计预算硬限制。
|
||||
- 原生引擎区分上下文窗口不足和剩余预算不足,保留旧失败与原用量。
|
||||
- 原件离线复现、边界回归、实际编译HTTP/审查/检查与两视口验证分别记录,见docs/QA-DELIVERY-RELIABILITY-G.md;真实模型收益未重测。
|
||||
|
||||
## 1.24.0 · 已有成果续接与真实交付(已本地交付)
|
||||
|
||||
- 当前已有文件可经完整读取和SHA核对纳入成果,保存Task/Run、原文件快照、任务要求与显式采用来源。
|
||||
|
||||
@@ -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`。各自要求新输出目录,保留既有失败,不覆盖旧证据。
|
||||
@@ -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."
|
||||
}
|
||||
@@ -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/漏传路由工具的原失败保留,最终补实际路由工具后实现精确复现。
|
||||
|
||||
Generated
+2
-2
@@ -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",
|
||||
|
||||
+1
-1
@@ -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.",
|
||||
|
||||
@@ -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转义误读拒绝,未改变源码。下一不可变打包、独立重建与保留正式状态部署。
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
+20
-20
@@ -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']);
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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.' }));
|
||||
@@ -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(); }
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -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));
|
||||
@@ -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 {} } }
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<string,string>={context_limit:'上下文窗口不足',engine_input_budget:'原生引擎输入或剩余预算不足',token_limit:'本次运行预算不足',task_token_limit:'任务累计预算不足',time_limit:'本次运行时间已用完'};
|
||||
const labels:Record<string,string>={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<Preview>('/sessions/'+session.id+'/resume-preview',{...fields,...(selection?{selection:{type,id}}:{})});setPlan(value);onSession(await api<Session>('/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<Session>('/sessions/'+session.id+'/resume-budget',{planId:plan.id,sha256:plan.sha256}));setOpen(false);}catch(cause){setError((cause as Error).message);}finally{setBusy(false);}}
|
||||
return <aside className="budget-pause" aria-label="任务预算诊断"><h3>{reasons[reason]}</h3>{pause?.requiredInputTokens!==undefined?<><p>完整要求与必需输入估算 <strong>{pause.requiredInputTokens.toLocaleString()}</strong> tokens;当前可用输入 <strong>{pause.inputBudget?.toLocaleString()}</strong>。请求已暂停,原任务和工具结果保留。</p><dl className="budget-facts">{Object.entries(pause.breakdown??{}).map(([key,value])=><div key={key} style={{display:'contents'}}><dt>{labels[key]??key}</dt><dd>{value.toLocaleString()}</dd></div>)}<dt>所选上下文窗口</dt><dd>{pause.contextLimit?.toLocaleString()}</dd><dt>响应预留 / 安全余量</dt><dd>{pause.outputReservation?.toLocaleString()} / {pause.safetyTokens?.toLocaleString()}</dd><dt>运行 / 任务剩余</dt><dd>{pause.runRemainingTokens?.toLocaleString()??'不限'} / {pause.taskRemainingTokens?.toLocaleString()??'不限'}</dd></dl></>:<p>原 Task 已保存。可核对剩余预算和模型容量,再准备同一任务的新 Run;旧记录没有的预算分解不补造。</p>}
|
||||
return <aside className="budget-pause" aria-label="任务预算诊断"><h3>{diagnosis.title}</h3>{pause?.requiredInputTokens!==undefined?<><p>完整要求与必需输入估算 <strong>{pause.requiredInputTokens.toLocaleString()}</strong> tokens;{diagnosis.inputLabel} <strong>{pause.inputBudget?.toLocaleString()}</strong>。请求已暂停,原任务和工具结果保留。</p><dl className="budget-facts">{Object.entries(pause.breakdown??{}).map(([key,value])=><div key={key} style={{display:'contents'}}><dt>{labels[key]??key}</dt><dd>{value.toLocaleString()}</dd></div>)}<dt>所选上下文窗口</dt><dd>{pause.contextLimit?.toLocaleString()}</dd><dt>响应预留 / 安全余量</dt><dd>{pause.outputReservation?.toLocaleString()} / {pause.safetyTokens?.toLocaleString()}</dd><dt>运行 / 任务剩余</dt><dd>{pause.runRemainingTokens?.toLocaleString()??'不限'} / {pause.taskRemainingTokens?.toLocaleString()??'不限'}</dd></dl></>:<p>原 Task 已保存。可核对剩余预算和模型容量,再准备同一任务的新 Run;旧记录没有的预算分解不补造。</p>}
|
||||
{diagnosis.guidance&&<p>{diagnosis.guidance}</p>}
|
||||
{pause?.originalInputTokens!==undefined&&<p>原生完整历史估算 {pause.originalInputTokens.toLocaleString()} tokens。原始输入、历史索引与拒绝正文已保存为任务工件,本次拒绝没有发送模型请求。</p>}
|
||||
{!!pause?.transportReservationTokens&&<p>准备原生任务时另留 {pause.transportReservationTokens.toLocaleString()} tokens 给引擎提示和消息封装;实际原生请求仍单独核对容量。</p>}
|
||||
{!!pause?.imageReservationTokens&&<p>图像使用单独的本地预留,属于容量估算;实际计费与服务报告用量分列。</p>}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { FileResultsPanel } from './FileResultsPanel';
|
||||
const stopReasons: Record<string, string> = { no_progress: '重复读取未推进任务,请核对后继续', context_limit: '完整任务要求超过请求上下文预算', time_limit: '到达运行时间预算', token_limit: '到达本次 token 预算', task_token_limit: '到达任务累计预算', step_limit: '到达工具轮次上限', cancelled: '用户停止', model_error: '模型请求失败', interrupted: '进程中断' };
|
||||
const number = (value: number | undefined) => (value ?? 0).toLocaleString('zh-CN');
|
||||
stopReasons.git_review = 'Git预览已保存,等待审查与确认';
|
||||
stopReasons.change_set_review = '完整文件批次已封存,等待审查与应用';
|
||||
stopReasons.git_review_declined = 'Git预览已撤回,文件和检查记录保留';
|
||||
stopReasons.task_plan_incomplete = '执行计划仍有未核验或失效步骤,请核对后继续';
|
||||
stopReasons.diagnostic_answered = '诊断答复已完成;原任务的目标与交付状态保持';
|
||||
|
||||
@@ -47,6 +47,7 @@ export interface InputAttachment { id:string;name:string;status:string;mediaType
|
||||
export interface BudgetPause { reason:string;requiredInputTokens?:number;contextLimit?:number;inputBudget?:number;outputReservation?:number;safetyTokens?:number;runRemainingTokens?:number|null;taskRemainingTokens?:number|null;imageReservationTokens?:number;breakdown?:Record<string,number> }
|
||||
export interface Run { budgetPause?:BudgetPause }
|
||||
export interface BudgetPause { originalInputTokens?:number;transportReservationTokens?:number }
|
||||
export interface BudgetPause { limitingReason?:string }
|
||||
export interface BudgetPause { modelFailure?:RuntimeFailure }
|
||||
export interface TokenBudgetCounter { maximumTokens:number;reportedTokens:number;unknownRequests:number;estimatedUnknownTokens:number;accountedTokens:number;remainingTokens:number|null;exceededTokens:number }
|
||||
export interface BudgetPause { remainingTokens?:number;tokenReservation?:{schemaVersion:number;reservedTokens:number;routes:{sources:{runId:string;attemptId:string}[]}[]};tokenAccounting?:{schemaVersion:number;singleInFlightResponseMayExceed:boolean;run:TokenBudgetCounter;task:TokenBudgetCounter} }
|
||||
|
||||
@@ -181,6 +181,7 @@ export class RequestPlanner {
|
||||
let omitted = [], reference = null, workingReference = null, latestReference = null;
|
||||
const latestDocument = latestToolDocument(this.store, session, run, groups);
|
||||
const entries = [];
|
||||
let retainedSources = [];
|
||||
const metricsFor = (indices, includeNotice = true, currentEntries = entries, includeLatest = true) => {
|
||||
const missing = groups.filter(group => !indices.has(group.index));
|
||||
const messages = [fixed, ...(missing.length && includeNotice ? [notice({ id: PLACEHOLDER_ID, sha256: PLACEHOLDER_SHA }, missing, descriptions, evidence)] : []),
|
||||
@@ -194,22 +195,25 @@ export class RequestPlanner {
|
||||
const mandatory = metricsFor(selected);
|
||||
if (mandatory.estimatedInputTokens > budget.inputBudget) throw pause(budget, mandatory, breakdown);
|
||||
const observed = workingCandidates(this.store, session, run, groups);
|
||||
// Reserve other small source files before admitting a new result group.
|
||||
// Historical locator pages are optional; they cannot evict actual code.
|
||||
// Admit complete small source observations before optional raw history.
|
||||
// A reservation alone does not keep code in the actual sent request.
|
||||
const newest = groups.at(-1);
|
||||
const newestFiles = new Set((newest?.messages[0].tool_calls ?? []).filter(call => call.function.name === 'read_file').map(call => {
|
||||
try { return JSON.parse(call.function.arguments).path; } catch { return null; }
|
||||
}));
|
||||
const pinned = observed.filter(candidate => candidate.observation.kind === 'file' && candidate.observation.content.length <= 2000
|
||||
&& !newestFiles.has(candidate.observation.path)).slice(0, 12).map(candidate => workingEntry(candidate, candidate.observation.content.length));
|
||||
const retention = Math.min(2048, Math.max(0, metricsFor(selected, true, pinned).estimatedInputTokens - mandatory.estimatedInputTokens));
|
||||
const retentionTarget = budget.inputBudget;
|
||||
for (const candidate of observed.filter(candidate => candidate.observation.kind === 'file' && candidate.observation.content.length <= 2000)) {
|
||||
if (entries.length >= 12) break;
|
||||
const entry = workingEntry(candidate, candidate.observation.content.length);
|
||||
if (metricsFor(selected, true, [...entries, entry]).estimatedInputTokens <= retentionTarget) entries.push(entry);
|
||||
}
|
||||
retainedSources = [...entries];
|
||||
const newestUseful = newest?.messages.every(message => {
|
||||
if (message.role !== 'tool') return true;
|
||||
try { const result = JSON.parse(message.content); return !result.kind?.startsWith('context-') && result.kind !== 'tool-result'; } catch { return true; }
|
||||
});
|
||||
if (newestUseful && !selected.has(newest.index) && newest.contributionTokens <= budget.inputBudget) {
|
||||
selected.add(newest.index);
|
||||
if (metricsFor(selected).estimatedInputTokens + retention > budget.inputBudget) selected.delete(newest.index);
|
||||
const remaining = entries.filter(entry => entry.source.group_index !== newest.index);
|
||||
if (metricsFor(selected, true, remaining).estimatedInputTokens > budget.inputBudget) selected.delete(newest.index);
|
||||
else entries.splice(0, entries.length, ...remaining);
|
||||
}
|
||||
const target = Math.max(budget.targetInputTokens, metricsFor(selected).estimatedInputTokens);
|
||||
const priority = [...new Set(evidence.map(value => value.group_index))].map(index => groups[index]);
|
||||
@@ -220,7 +224,8 @@ export class RequestPlanner {
|
||||
};
|
||||
// A small result in a mixed large group must remain usable. It is a
|
||||
// separate, provenance-checked observation, never a broken tool pair.
|
||||
const candidates = observed.filter(candidate => !selected.has(candidate.source.group_index));
|
||||
const candidates = observed.filter(candidate => !selected.has(candidate.source.group_index)
|
||||
&& !entries.some(entry => entry.source.call_id === candidate.source.call_id));
|
||||
for (const [index, candidate] of candidates.entries()) {
|
||||
if (entries.length >= 12) break;
|
||||
const remaining = target - metricsFor(selected).estimatedInputTokens;
|
||||
@@ -325,9 +330,9 @@ export class RequestPlanner {
|
||||
// The next result replaces the current latest-result feedback. Do not
|
||||
// reserve both views when sizing that result's actual protocol page.
|
||||
nextReadFixedInputTokens: metricsFor(new Set(lastUser ? [lastUser.index] : []), true, [], false).estimatedInputTokens,
|
||||
workingRetentionTokens: Math.min(2048, Math.max(0, metricsFor(new Set(lastUser ? [lastUser.index] : []), true,
|
||||
entries.filter(entry => entry.observation.kind === 'file' && !entry.truncated && entry.total_content_characters <= 2000)).estimatedInputTokens
|
||||
- metricsFor(new Set(lastUser ? [lastUser.index] : []), true, []).estimatedInputTokens)),
|
||||
workingRetentionTokens: Math.max(0, metricsFor(new Set(lastUser ? [lastUser.index] : []), true, retainedSources).estimatedInputTokens
|
||||
- metricsFor(new Set(lastUser ? [lastUser.index] : []), true, []).estimatedInputTokens),
|
||||
workingRetentionPolicyVersion: 1,
|
||||
originalMessages: session.providerMessages.length, retainedMessages: messages.length - 1 - (reference ? 1 : 0) - (workingReference ? 1 : 0) - (latestReference ? 1 : 0) - (memoryReference ? 1 : 0) - (skillReference ? 1 : 0) - (mcpReference ? 1 : 0),
|
||||
archivedGroups: omitted.length, retainedGroups: groups.filter(group => selected.has(group.index)).map(group => group.index),
|
||||
historyIndexArtifactId: reference?.id ?? null, historyIndexSha256: reference?.sha256 ?? null, actualUsage: null,
|
||||
@@ -400,7 +405,8 @@ export function verifyPlanEvidence(store, session, plan, cache = new Map()) {
|
||||
|| (frozen.workingSetSha256 ?? null) !== (plan.workingSetSha256 ?? null)
|
||||
|| (frozen.workingSetEntries ?? 0) !== (plan.workingSetEntries ?? 0)) throw new Error('工作依据与发送前的封存记录不匹配。');
|
||||
if ((frozen.workingSetViewVersion ?? 1) !== (plan.workingSetViewVersion ?? 1)
|
||||
|| (frozen.workingRetentionTokens ?? 0) !== (plan.workingRetentionTokens ?? 0)) throw new Error('工作依据视图或保留预算与封存记录不匹配。');
|
||||
|| (frozen.workingRetentionTokens ?? 0) !== (plan.workingRetentionTokens ?? 0)
|
||||
|| (frozen.workingRetentionPolicyVersion ?? 0) !== (plan.workingRetentionPolicyVersion ?? 0)) throw new Error('工作依据视图或保留预算与封存记录不匹配。');
|
||||
if ((frozen.nextReadFixedInputTokens ?? null) !== (plan.nextReadFixedInputTokens ?? null)) throw new Error('下一工具页的固定预算与封存记录不匹配。');
|
||||
if ((frozen.latestToolsArtifactId ?? null) !== (plan.latestToolsArtifactId ?? null)
|
||||
|| (frozen.latestToolsSha256 ?? null) !== (plan.latestToolsSha256 ?? null)
|
||||
|
||||
@@ -81,7 +81,8 @@ export function workingCandidates(store, session, run, groups) {
|
||||
}
|
||||
// Keep complete small modules/requirements before larger evidence excerpts.
|
||||
// Every selected page still identifies the exact invocation that read it.
|
||||
primary.sort((a, b) => Number(a.observation.content.length > 2000) - Number(b.observation.content.length > 2000));
|
||||
primary.sort((a, b) => Number(a.observation.content.length > 2000) - Number(b.observation.content.length > 2000)
|
||||
|| a.observation.content.length - b.observation.content.length || a.observation.path.localeCompare(b.observation.path));
|
||||
const checks = candidates.filter(candidate => ['check-results', 'command-result'].includes(candidate.observation.kind));
|
||||
const artifacts = candidates.filter(candidate => candidate.observation.kind === 'artifact-page');
|
||||
return [...primary, ...checks, ...artifacts, ...secondary].slice(0, 24);
|
||||
|
||||
@@ -226,7 +226,9 @@ class EngineRunDriver {
|
||||
const rejected=this.store.artifactStore.write(this.session,this.run.record,
|
||||
JSON.parse(this.provider.redact(JSON.stringify({schemaVersion:1,owner,view,body,budget:contextBudget,dispatched:false}))),{kind:'engine-model-rejection'});
|
||||
this.store.core.artifact.set(rejected.id,rejected);(this.job.inputRejections??=[]).push({artifactId:rejected.id,sha256:rejected.sha256,...contextBudget});this.save('input_rejected');
|
||||
const error=new BudgetExceeded('engine_input_budget','原引擎必需目标、最新结果或剩余尝试超出封存预算,未发送模型请求。原输入和容量分项已保存;请核对上下文/预算后显式继续。');
|
||||
const error=new BudgetExceeded('engine_input_budget',contextBudget.limitingReason==='context_limit'
|
||||
?'原引擎必需输入超过上下文窗口可用容量,未发送模型请求。原输入和容量分项已保存;请核对模型容量后显式继续。'
|
||||
:'原引擎输入可容纳于上下文窗口,但下一次请求的用量预留超过剩余预算,未发送模型请求。原输入和容量分项已保存;请核对运行和任务预算后显式继续。');
|
||||
error.contextBudget={...contextBudget,rejectionArtifactId:rejected.id,rejectionSha256:rejected.sha256};throw error;
|
||||
}
|
||||
const selected = config.modelRouting ? { ...config, modelRouting: { ...config.modelRouting, maxAttempts: attempts } } : config;
|
||||
|
||||
@@ -130,6 +130,23 @@ export class ChangeSetManager {
|
||||
for (let index = 0; index < set.files.length; index++) set.files[index].state = observations[index].state;
|
||||
return observations;
|
||||
}
|
||||
async reviewReady(session, id, run) {
|
||||
const set = this.own(session, id, null, { current: true });
|
||||
if (session.runId !== run.id || session.taskId !== run.taskId || set.status !== 'prepared' || set.attemptedAt) return false;
|
||||
const pending = session.changes.filter(change => change.taskId === run.taskId && ['pending', 'conflict'].includes(change.status));
|
||||
if (pending.length !== set.files.length || pending.some(change => change.status !== 'pending'
|
||||
|| !set.files.some(file => file.changeId === change.id))) return false;
|
||||
if ([...this.store.core.tool.values()].some(tool => tool.sessionId === session.id && tool.taskId === run.taskId && tool.requiresVerification)) return false;
|
||||
assertMcpResolved(this.store, session.projectId);
|
||||
assertWorkersResolved(this.store, session.projectId);
|
||||
this.snapshots(session, set, { pending: true });
|
||||
const project = this.store.project(session.projectId);
|
||||
await verifyWorkspaceProject(this.store, project);
|
||||
const inspection = await inspectProject(project);
|
||||
return session.runId === run.id && session.taskId === run.taskId && set.status === 'prepared'
|
||||
&& JSON.stringify(gitBaseline(inspection)) === JSON.stringify(set.baseline)
|
||||
&& this.inspect(session, set).every(value => value.state === 'before');
|
||||
}
|
||||
async prepare(session, changeIds, { source = 'user', collaborationBinding = null } = {}) {
|
||||
if (!Array.isArray(changeIds) || !changeIds.length || changeIds.length > 32 || new Set(changeIds).size !== changeIds.length) throw conflict('变更集需要1到32个不同的提案ID。');
|
||||
this.requireIdle(session, { source });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { randomUUID, createHash } from 'node:crypto';
|
||||
|
||||
export const APP_VERSION = '1.24.0';
|
||||
export const APP_VERSION = '1.24.1';
|
||||
|
||||
export function executionEnvironment() {
|
||||
const windows = process.platform === 'win32';
|
||||
|
||||
@@ -498,6 +498,7 @@ export class Runtime {
|
||||
this.store.save(session); return;
|
||||
}
|
||||
let deliveryReview = null, mcpReview = null;
|
||||
const preparedSets = new Set();
|
||||
for (const call of calls) {
|
||||
let result;
|
||||
if (deliveryReview || mcpReview) {
|
||||
@@ -513,6 +514,7 @@ export class Runtime {
|
||||
else if (signal.aborted) result = { status: 'interrupted', message: '用户停止了任务,这次调用没有执行。' };
|
||||
else result = await this.executeTool(session, call, run);
|
||||
session.providerMessages.push({ role: 'tool', tool_call_id: call.id, content: JSON.stringify(result) });
|
||||
if (call.function.name === 'prepare_change_set' && result.status === 'awaiting_review') preparedSets.add(result.change_set_id);
|
||||
if (call.function.name === 'call_registered_mcp' && result.requires_verification) mcpReview = result.mcp_job_id;
|
||||
if (call.function.name === 'plan_delivery' && result.status === 'awaiting_review') {
|
||||
deliveryReview = this.store.owned('delivery_plan', result.plan_id, session.id);
|
||||
@@ -534,6 +536,22 @@ export class Runtime {
|
||||
this.store.save(session, { type: 'delivery.awaiting_review', detail: { planId: deliveryReview.id } });
|
||||
return;
|
||||
}
|
||||
// Settle the whole model turn first: later proposals can make a sealed
|
||||
// set partial, and later tools may fail or need verification/stop.
|
||||
for (const id of preparedSets) {
|
||||
let ready = false;
|
||||
try { ready = await this.changeSetManager().reviewReady(session, id, run.record); }
|
||||
catch (error) {
|
||||
this.store.event(session, { kind: 'system', source: 'workbench', label: '变更批次交接预检未通过', phase: 'failed',
|
||||
output: this.provider.redact(error.message ?? String(error)) });
|
||||
}
|
||||
signal.throwIfAborted();
|
||||
if (!ready) continue;
|
||||
session.status = 'needs_review'; run.stopReason = 'change_set_review';
|
||||
this.store.message(session, 'system', '当前任务的完整变更批次已封存,同轮工具结果已保存。请审查并应用或撤销批次;等待审查期间不继续请求模型。应用后可显式续接原任务进行检查。');
|
||||
this.store.save(session, { type: 'change_set.awaiting_review', detail: { changeSetId: id } });
|
||||
return;
|
||||
}
|
||||
if (this.store.core.task.get(run.taskId).readProgress?.pause) throw new BudgetExceeded('no_progress',
|
||||
'模型连续重复读取工件或核对相同的工程状态,未推进当前任务。实际结果和原任务已保存,请核对后继续。');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface BudgetPauseSource { reason?: string; limitingReason?: string }
|
||||
export function budgetPausePresentation(pause?: BudgetPauseSource, stopReason?: string): {
|
||||
title: string; inputLabel: string; guidance: string;
|
||||
} | null;
|
||||
@@ -0,0 +1,18 @@
|
||||
const reasons = {
|
||||
context_limit: '上下文窗口不足', engine_input_budget: '原生引擎输入或剩余预算不足',
|
||||
token_limit: '本次运行预算不足', task_token_limit: '任务累计预算不足', time_limit: '本次运行时间已用完',
|
||||
};
|
||||
|
||||
export function budgetPausePresentation(pause, stopReason = '') {
|
||||
const reason = pause?.reason ?? stopReason;
|
||||
if (!reasons[reason]) return null;
|
||||
if (reason === 'engine_input_budget' && pause?.limitingReason === 'remaining_token_budget') return {
|
||||
title: '原生引擎剩余预算不足', inputLabel: '当前窗口可用输入',
|
||||
guidance: '输入可容纳于当前上下文窗口;下一次请求的用量预留超过剩余预算。请核对运行和任务预算。',
|
||||
};
|
||||
if (reason === 'engine_input_budget' && pause?.limitingReason === 'context_limit') return {
|
||||
title: '原生引擎上下文窗口不足', inputLabel: '当前窗口可用输入',
|
||||
guidance: '必需输入超过当前上下文窗口可用容量。请核对模型容量和输入范围。',
|
||||
};
|
||||
return { title: reasons[reason], inputLabel: '当前可用输入', guidance: '' };
|
||||
}
|
||||
@@ -1,5 +1,14 @@
|
||||
# Agent Workbench:核心代理能力研究与产品计划
|
||||
|
||||
## 当前优先 G:修完原件已确认问题
|
||||
|
||||
用户要求先把已总结问题修完;原生窗口回看不阻塞本次源码修复。沿用planning-with-files及product-ui-ux的真实流程验收,不启动子代理。
|
||||
|
||||
1. [complete] E原第7–12请求估算逐项离线重现,小源码保留6/5/5/4/2/2;无真实模型请求或原件改写。完整批次旧回归明确失败,已固定原日志。
|
||||
2. [complete] 完整批次同轮结算后预检并交接审查,部分/失败/冲突/新提案/未知/篡改/停止维持各自语义。实际编译HTTP两请求停审查,显式续接同Task后两项实际Node检查通过,提案不重放。
|
||||
3. [complete] 小源码先进入实际请求,按原来源稳定保留及实际空间分配下一页;第7–12请求均6/6源码、原硬预算保持。原生窗口和累计剩余额度文案已区分,历史未知分项不补造。
|
||||
4. [in_progress] 最终受影响回归、1.24.1编译、正式版本两视口、独立源包重建及保留状态本地升级。开发旧dist/旧文案/版本入口与移动检视区导航失败保持;不把中断混合全轮记最终通过。封存新结果,本地Git提交。
|
||||
|
||||
## 当前接续 D:原版 Purge 生产策略
|
||||
|
||||
接续研究/封存 7b4f7ee / 1408e7a,A/B/C 不重做;独立端口和自有夹具,正式宿主与 Key 不操作。继续沿用 planning-with-files 与 product-ui-ux;本轮不启动子代理。
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { budgetPausePresentation } from '../src/shared/budget-presentation.mjs';
|
||||
|
||||
test('input that fits the engine window but exceeds remaining credit diagnoses the credit limit', () => {
|
||||
const pause = { reason: 'engine_input_budget', limitingReason: 'remaining_token_budget', requiredInputTokens: 27424,
|
||||
inputBudget: 27552, remainingTokens: 28339, tokenReservation: { reservedTokens: 29600 } };
|
||||
const diagnosis = budgetPausePresentation(pause);
|
||||
assert.equal(diagnosis.title, '原生引擎剩余预算不足');
|
||||
assert.match(diagnosis.guidance, /输入可容纳/); assert.match(diagnosis.guidance, /预留超过剩余预算/);
|
||||
assert.ok(pause.requiredInputTokens < pause.inputBudget); assert.ok(pause.tokenReservation.reservedTokens > pause.remainingTokens);
|
||||
});
|
||||
|
||||
test('window overflow and historical pauses retain distinct and honest diagnoses', () => {
|
||||
assert.equal(budgetPausePresentation({ reason: 'engine_input_budget', limitingReason: 'context_limit' }).title, '原生引擎上下文窗口不足');
|
||||
assert.equal(budgetPausePresentation({ reason: 'engine_input_budget' }).title, '原生引擎输入或剩余预算不足');
|
||||
assert.equal(budgetPausePresentation(undefined, 'task_token_limit').title, '任务累计预算不足');
|
||||
assert.equal(budgetPausePresentation(undefined, 'token_limit').title, '本次运行预算不足');
|
||||
assert.equal(budgetPausePresentation(undefined, 'change_set_review'), null);
|
||||
});
|
||||
@@ -67,11 +67,12 @@ test('a compatible model can seal proposals through the real HTTP loop while app
|
||||
assert.equal(session.execution.changeSets[0].files.length, 2); assert.equal(fs.existsSync(path.join(f.projectRoot, 'src')), false);
|
||||
assert.equal(fs.existsSync(path.join(f.projectRoot, 'docs')), false);
|
||||
assert.equal(session.events.find(event => event.tool === 'prepare_change_set').phase, 'completed');
|
||||
assert.equal(count, 2); assert.equal(session.execution.run.stopReason, 'change_set_review');
|
||||
const tools = provider.requests.find(request => request.input?.tools)?.input.tools.map(tool => tool.function.name);
|
||||
assert.ok(tools.includes('prepare_change_set')); assert.ok(!tools.includes('apply_change_set')); assert.ok(!tools.includes('rollback_change_set'));
|
||||
});
|
||||
|
||||
test('a step-limited sealed batch applies and continues the same Task into actual checks without replaying saved tools', { timeout: 60000 }, async t => {
|
||||
test('a sealed batch at the step limit hands off and continues the same Task into actual checks without replaying saved tools', { timeout: 60000 }, async t => {
|
||||
const f = fixture(t);
|
||||
fs.mkdirSync(path.join(f.projectRoot, 'test'));
|
||||
const acceptance = "import test from 'node:test'; import assert from 'node:assert/strict'; import { left } from '../src/left.mjs'; import { right } from '../src/right.mjs';\ntest('left value', () => assert.equal(left, 1)); test('right value', () => assert.equal(right, 2));\n";
|
||||
@@ -95,13 +96,13 @@ test('a step-limited sealed batch applies and continues the same Task into actua
|
||||
await host.api('/config', { mode: 'compatible', baseUrl: model.baseUrl, model: 'batch-continuation-fixture', maxSteps: 2 });
|
||||
await host.api(route + '/messages', { content: '完成原始双模块工程目标并运行测试' });
|
||||
let paused;
|
||||
await until(async () => { paused = await host.api(route); return paused.status === 'paused'; }, 30000);
|
||||
assert.equal(paused.execution.run.stopReason, 'step_limit'); assert.equal(count, 2);
|
||||
await until(async () => { paused = await host.api(route); return paused.status === 'needs_review'; }, 30000);
|
||||
assert.equal(paused.execution.run.stopReason, 'change_set_review'); assert.equal(count, 2);
|
||||
const set = paused.execution.changeSets.at(-1), firstRun = structuredClone(paused.execution.run);
|
||||
assert.equal(set.status, 'prepared'); assert.equal(fs.existsSync(path.join(f.projectRoot, 'src')), false);
|
||||
const savedMessages = (await host.api(route + '/export')).session.providerMessages;
|
||||
const savedResults = savedMessages.filter(message => message.role === 'tool'); assert.equal(savedResults.length, 3);
|
||||
await assert.rejects(host.api(route + '/resume', {}), /变更集/);
|
||||
await assert.rejects(host.api(route + '/resume', {}), { status: 409, message: /请先审查待处理改动/ });
|
||||
await assert.rejects(host.api(route + '/continue-reviewed', {}), { status: 409 });
|
||||
await host.api(route + '/change-sets/' + set.id + '/apply', { fingerprint: set.fingerprint });
|
||||
await until(async () => (await host.api(route)).execution.changeSets.at(-1).status === 'completed', 30000);
|
||||
@@ -116,7 +117,7 @@ test('a step-limited sealed batch applies and continues the same Task into actua
|
||||
assert.equal(completed.execution.task.goal, '完成原始双模块工程目标并运行测试');
|
||||
assert.equal(completed.execution.run.resumeOf, firstRun.id); assert.equal(completed.execution.task.verification.status, 'passed');
|
||||
assert.equal(completed.execution.checks.length, 1); assert.equal(completed.execution.checks[0].results[0].tests.passed, 2);
|
||||
assert.equal(completed.execution.runs.find(run => run.id === firstRun.id).status, 'paused');
|
||||
assert.equal(completed.execution.runs.find(run => run.id === firstRun.id).status, 'needs_review');
|
||||
assert.deepEqual(completed.execution.runs.find(run => run.id === firstRun.id).usage, firstRun.usage);
|
||||
assert.equal(completed.execution.changeSets[0].runId, firstRun.id); assert.equal(count, 5);
|
||||
const exported = (await host.api(route + '/export')).session.providerMessages;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { Runtime } from '../src/server/runtime.mjs';
|
||||
import { Provider } from '../src/server/provider.mjs';
|
||||
import { fixture, call, assertToolPairs } from './helpers.mjs';
|
||||
|
||||
async function exercise(t, mode) {
|
||||
const f = fixture(t), provider = new Provider(), runtime = new Runtime(f.store, provider);
|
||||
f.onCleanup(() => runtime.stopAll());
|
||||
f.store.saveConfig({ maxSteps: 2 });
|
||||
let requests = 0, stopped, stopScheduled = false;
|
||||
provider.complete = async () => {
|
||||
requests++;
|
||||
const calls = requests === 1 ? [
|
||||
call('left', 'propose_file', { path: 'left.mjs', content: 'export const left = 1;\n', reason: 'Left module' }),
|
||||
call('right', 'propose_file', { path: 'right.mjs', content: 'export const right = 2;\n', reason: 'Right module' }),
|
||||
] : [call('seal', 'prepare_change_set', { change_ids: mode === 'failed' ? ['missing']
|
||||
: f.session.changes.slice(0, mode === 'partial' ? 1 : 2).map(change => change.id) }),
|
||||
...(mode === 'new-proposal' ? [call('third', 'propose_file', { path: 'third.mjs', content: 'export const third = 3;\n', reason: 'Later same-turn proposal' })]
|
||||
: [call('after-seal', 'inspect_session', {})]),
|
||||
...(mode === 'later-error' ? [call('bad-read', 'read_file', { path: 'missing.mjs' })] : []),
|
||||
];
|
||||
return { message: { role: 'assistant', content: 'Declared model fixture.', tool_calls: calls }, usage: null };
|
||||
};
|
||||
f.store.on('update', () => {
|
||||
if (mode === 'cancelled' && !stopScheduled && f.session.events.some(event => event.toolCallId === 'seal' && event.phase === 'completed')) {
|
||||
stopScheduled = true; setImmediate(() => { stopped = runtime.stop(f.session.id); });
|
||||
}
|
||||
if (mode === 'conflict' && f.session.events.some(event => event.toolCallId === 'after-seal' && event.phase === 'completed')) {
|
||||
fs.writeFileSync(path.join(f.projectRoot, 'left.mjs'), 'Concurrent owner bytes\n');
|
||||
}
|
||||
if (mode === 'unknown') {
|
||||
const event = f.session.events.find(event => event.toolCallId === 'after-seal' && event.phase === 'completed');
|
||||
if (event) f.store.core.tool.get(event.invocationId).requiresVerification = true;
|
||||
}
|
||||
if (mode === 'tampered') {
|
||||
const set = [...f.store.core.change_set.values()][0];
|
||||
if (set) set.fingerprint = '0'.repeat(64);
|
||||
}
|
||||
});
|
||||
runtime.start(f.session.id, 'Create and review two modules; do not apply them automatically.');
|
||||
await runtime.active.get(f.session.id).promise;
|
||||
if (mode === 'cancelled') { await new Promise(resolve => setImmediate(resolve)); await stopped; }
|
||||
const run = f.store.core.run.get(f.session.runId);
|
||||
assert.equal(requests, 2); assertToolPairs(f.session.providerMessages);
|
||||
assert.equal([...f.store.core.tool.values()].filter(tool => tool.sessionId === f.session.id).length, mode === 'later-error' ? 5 : 4);
|
||||
assert.ok(f.session.changes.every(change => change.status === 'pending'));
|
||||
assert.equal(fs.existsSync(path.join(f.projectRoot, 'right.mjs')), false);
|
||||
if (mode === 'conflict') assert.equal(fs.readFileSync(path.join(f.projectRoot, 'left.mjs'), 'utf8'), 'Concurrent owner bytes\n');
|
||||
else assert.equal(fs.existsSync(path.join(f.projectRoot, 'left.mjs')), false);
|
||||
return { ...f, run };
|
||||
}
|
||||
|
||||
test('complete sealed batch hands off after all tools settle with no next model request', async t => {
|
||||
for (const mode of ['complete', 'later-error']) await t.test(mode, async t => {
|
||||
const f = await exercise(t, mode);
|
||||
assert.equal(f.session.status, 'needs_review'); assert.equal(f.run.stopReason, 'change_set_review');
|
||||
assert.equal(f.session.events.find(event => event.toolCallId === 'after-seal').phase, 'completed');
|
||||
if (mode === 'later-error') assert.equal(f.session.events.find(event => event.toolCallId === 'bad-read').phase, 'failed');
|
||||
});
|
||||
});
|
||||
|
||||
test('partial, changed, failed or cancelled batches cannot claim complete review handoff', async t => {
|
||||
for (const mode of ['partial', 'new-proposal', 'failed', 'conflict', 'cancelled', 'unknown', 'tampered']) await t.test(mode, async t => {
|
||||
const f = await exercise(t, mode);
|
||||
assert.equal(f.session.status, 'paused'); assert.equal(f.run.stopReason, mode === 'cancelled' ? 'cancelled' : 'step_limit');
|
||||
if (mode !== 'failed' && mode !== 'cancelled') assert.equal([...f.store.core.change_set.values()][0].status, 'prepared');
|
||||
});
|
||||
});
|
||||
@@ -95,7 +95,7 @@ test('native input exceeding the context budget is retained and sends no model r
|
||||
const f = fixture(t), context = controlledWorker(f, { sessionFactory: () => new Oversized() }), group = await prepare(f, context);
|
||||
await (await context.manager.start(f.session, group.id, group.fingerprint)).promise;
|
||||
assert.equal(context.requests.length, 0); assert.equal(jobs(f, group)[0].requests.length, 0);
|
||||
assert.equal(f.store.core.task.get(group.children[0].taskId).usage.requests, 0); assert.match(jobs(f, group)[0].error, /预算/);
|
||||
assert.equal(f.store.core.task.get(group.children[0].taskId).usage.requests, 0); assert.match(jobs(f, group)[0].error, /上下文窗口可用容量/);
|
||||
const job=jobs(f,group)[0],rejection=job.inputRejections[0],artifact=f.store.owned('artifact',rejection.artifactId,job.sessionId);
|
||||
const receipt=JSON.parse(f.store.artifactStore.read(artifact));
|
||||
assert.equal(artifact.kind,'engine-model-rejection');assert.equal(artifact.sha256,rejection.sha256);assert.equal(receipt.dispatched,false);
|
||||
|
||||
@@ -228,6 +228,34 @@ test('a later narrow page of the same file revision cannot evict the wider actua
|
||||
verifyPlanEvidence(f.store, f.session, plan.record);
|
||||
});
|
||||
|
||||
test('six small source files stay complete across metadata turns even when mandatory evidence exceeds the soft target', t => {
|
||||
const f = setup(t, { contextLimit: 32000, maxOutputTokens: 2048 });
|
||||
const files = [['src/App.tsx', 1991], ['test/domain.test.mjs', 1715], ['src/transition.ts', 167],
|
||||
['src/query.ts', 142], ['src/types.ts', 82], ['src/summary.ts', 155]].map(([name, size]) => read(name,
|
||||
('// ' + name + '\n').padEnd(size, 'x')));
|
||||
group(f, [...files, huge()]);
|
||||
const system = 'Complete original Task constraints and required permission boundaries. '.repeat(620);
|
||||
const original = structuredClone(f.session.providerMessages);
|
||||
let exceededSoftTarget = false;
|
||||
for (let index = 0; index < 4; index++) {
|
||||
group(f, [{ tool: 'inspect_session', args: {}, result: { session: { status: 'running' },
|
||||
execution: { progress: { completedTools: index + 7 } }, metadata: 'Historical metadata '.repeat(1800) } }]);
|
||||
const prepared = f.planner.prepare(f.session, f.run, f.config, { system, tools: toolDefinitions });
|
||||
const set = setFrom(prepared.messages);
|
||||
for (const file of files) {
|
||||
const entry = set.entries.find(entry => entry.observation.path === file.args.path);
|
||||
assert.equal(entry?.content, file.result.content); assert.equal(entry.truncated, false);
|
||||
}
|
||||
assert.equal(prepared.record.budget.targetInputTokens, 16000);
|
||||
assert.ok(prepared.record.estimatedInputTokens <= prepared.record.budget.inputBudget);
|
||||
assert.ok(prepared.record.workingRetentionTokens > 2048);
|
||||
exceededSoftTarget ||= prepared.record.estimatedInputTokens > 16000;
|
||||
assertToolPairs(prepared.messages); verifyPlanEvidence(f.store, f.session, prepared.record);
|
||||
}
|
||||
assert.ok(exceededSoftTarget, 'The regression must exercise the soft-target boundary.');
|
||||
assert.deepEqual(f.session.providerMessages.slice(0, original.length), original);
|
||||
});
|
||||
|
||||
test('historical read-artifact navigation points to the original artifact and next page, never its result wrapper', t => {
|
||||
const f = setup(t), text = 'An actual saved failure log.\n';
|
||||
const artifact = f.store.artifactStore.write(f.session, f.run, text, { kind: 'check-log' }); f.store.core.artifact.set(artifact.id, artifact);
|
||||
|
||||
Reference in New Issue
Block a user