diff --git a/AGENTS.md b/AGENTS.md index a8274a48..e965b33a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,7 @@ # Agent Workbench项目执行规范 +当前1.25.2可靠性修复已开发并分阶段本地提交,正在独立发行验收;正式仍以实际1.25.1状态为准,不把源码修复当正式已升级。用户已在独立复核后全盘授权继续修复/开发/验证/本地提交及修复后新冻有界样本X,计划docs/RELIABILITY-1.25.2.md和docs/LIVE-DELIVERY-X-PLAN.md。预留v3原账本顺序/输出上界、安装扫描后文件检查、升级兼容、明确不检查约定、混合进展停止与纯读取批次吞吐已修;原W的“纯属模型、产品无缺陷”归因被证据纠正:末轮有468新字符且shadow为evidence_growth,原停止和0交付保持。旧v1/v2/原失败不改写,网络间歇根因/真实自主交付/Purge仍各自待验。不委派、不推送、不提取/复制/解密/重存Key,不重启正式Provider;X只新建样本,不续跑W/V/T/R/P/O。以下均按历史时点理解。 + 1.25.1已完整本地交付:预留异常剔除observed-route-max-v2、安装校验单次realpath提速、purge过时断言修复。来源0a82636d/候选Agent-Workbench-1.25.1-win-x64-20261104103902806,installer SHA e1689a459f950d3a326b0915ced481f769de88f1531082f13e26902ae790f3c6。预算相关103/103、安装桌面31/31、全量886/889(3项为Python/Playwright环境依赖,改动前HEAD同样失败)通过,新增release-efficiency守卫把APP_VERSION钉到package.json。首次打包升级被HOST_VERSION_MISMATCH安全回退(diagnostics.mjs的APP_VERSION漏改),数据零损失、首失败保留;修常量重打包后唯一正式升级成功,沿用原PID36552/instance/Provider,65项目81会话6377记录13484事件及outbox、retention四项exact,指针26→27/previous1.25.0。实测更新156369ms对比1.25.0的774098ms约5×提速(全清单核验每轮214–288s→1.5–3s)。真实样本W另冻(scripts/live-w、证据.qa/live-delivery-w共119份):网络诊断与单次身份预检通过,有界Node在6次只读请求后no_progress暂停、0提案未交付,未复现R的token_limit卡点、未触发v2排除边界(v2收益仍由model-reservation单元测试用R真实回执证明);按计划不跑Purge AB/BA。状态精确恢复,Key未读取/重存,9229关闭。验收docs/QA-OUTLIER-INSTALL-1.25.1.md与docs/QA-LIVE-DELIVERY-W.md,计划docs/LIVE-DELIVERY-W-PLAN.md。继续不委派/推送、不读取/复制/解密/重存真实Key、不重启正式、不续跑旧V/T/R/P/O。以下1.25.0及更早段落按历史时点理解。 1.25.0已完整本地交付:原文草案、用途/范围约定及原失败诊断闭环完成,延续A要求证据复核/B单轮shadow。来源cb54b75abe9ea33462379d8a84e36a3082685b11/候选20261104060043525;598冻结输入、603源码ZIP输入独立重建22/22、三归档/便携、三载荷24套UI、12实际隔离安装及安装副本10套通过。唯一正式升级沿用原PID36552/instance/Provider,65项目81会话6377记录13484事件及outbox、全部原行/全导出/工件/公开配置在网页两视口、原生回看及补稳定截图后精确一致,9229关闭。主1420份158277434字节与补充6份50722字节离线通过;含两份manifest的1428份158780733字节Git索引原字节通过,首索引漏81份日志的拒绝及限定目录例外修复保留。身份docs/task-agreement-1.25-release-identity.json,验收docs/QA-TASK-AGREEMENT-1.25.md,回顾docs/RETROSPECTIVE-TASK-AGREEMENT-1.25.md。原更新774098ms/重复扫描未优化。Tianshu C–F仍后续,真实模型预算0;V网络partial、T/R/P/O原失败、重复读取、自主交付和Purge未知保持。继续不委派/推送、不读取/复制/解密/重存真实Key、不重启正式、不续跑旧样本。以下旧“当前/未发行”段落按历史时点理解。 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fce5085..1d718d26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Agent Workbench 更新记录 +## 1.25.2 · 预留证据、安装边界与读取进展(发行验收中) + +- 用量预留v3封存原消费范围,按所属账本顺序复核,拒绝重排历史来排除最新高值;输入异常不再丢掉已报告输出上界。旧v1/v2与原失败保持可核验。 +- 安装扫描后再次核对每个文件的实际路径及硬链接,保持快速realpath方式;升级兼容门包含当前版本,避免新补丁无法继续升级。 +- 同一轮取得新内容后,不会因尾部三个重复读取就被当成整轮空转;相同检查、无变化提案与相同状态保护保留。纯读取批次共享小文件剩余预算,提高测试与日志分页吞吐。 +- 明确“不运行工程检查”会作为禁止约定保留。真实模型交付、网络间歇异常与Purge收益按新冻结样本分别验收,未完成不改成通过。 + ## 1.25.1 · 预留异常剔除与安装校验提速(发行准备中) - 下一次模型请求的用量预留改为`observed-route-max-v2`:当同一线路上某张回执的“上游报告输入/本地估算”比率≥1.5倍于其它所有回执,且该线路至少3张回执、其后仍有正常回执时,最多剔除这一张孤立异常,使缩小后的请求不再被单次观测口径异常长期卡住。被剔除的回执仍计入账本,列入`excludedSources`并带原始位置与原因;重复高比率、最后一张回执和过短历史都不剔除,旧封存预留按`observed-route-max-v1`逐字节复核。用R原始6份真实回执复算:v1仍得29623(>剩余17429),v2得15285。 diff --git a/docs/LIVE-DELIVERY-X-PLAN.md b/docs/LIVE-DELIVERY-X-PLAN.md new file mode 100644 index 00000000..75754efa --- /dev/null +++ b/docs/LIVE-DELIVERY-X-PLAN.md @@ -0,0 +1,19 @@ +# X:可靠性修复后的新有界真实样本 + +用户在独立复核后授权持续修复、验证与本地提交。X另建工程/Task,不续跑或改写W/R/T/P/O;W六次只读、混合进展停止和0交付保留。先完成1.25.2独立发行与正式保留状态升级;本计划不是成功保证。 + +## 固定因素 + +驱动在scripts/live-x,基于已审查W驱动独立复制。使用正式原Provider内存连接,不读取/复制/解密/重存Key;PID36552/instance保留,9229只用于所属一次身份预检并在finally关闭。连接仍为jojocode GPT Chat、gpt-6.1-sol、JSON、单连接;身份require-match只在新样本快照或临时公开策略内生效,后精确恢复。型号matched仅为上游字段符合,不证明模型权重身份。 + +按顺序只执行一次:所属DNS/TCP/TLS诊断(0HTTP/模型)→无工具身份预检(1请求/256输出/16000报告tokens上限)→Node。诊断仅记录不阻断,预检失败则不发工程请求;未知消费不重试、不切池。 + +Node沿用原费用工程、三模块、九测试、build、11文件及owner staged/unstaged/untracked保护,目标原文与W一致。16K上下文、2048输出、1600安全余量、累计8请求/90000tokens/600000ms不提高。先保存真实失败基线,再让模型读取和实现;监督只批准原检查、审查应用模型完整变更集及确认模型Git计划,不提供实现或催写提示。审查后同Task续接按剩余请求数,失败/预算/无进展即封存,不自动重放。 + +## 验收与后续 + +成功必须有模型提案、三源码实际变更、原九测试9/9及build、当前输入证明、原owner改动精确保留、模型封存Git计划及所属本地交付。口头完成、读取或基线build不计成功。每个实际请求、响应、用量、已读区间、单轮事实及停止原因全部保存。网络故障与模型行为、产品预算/读取策略分别归因;混合进展不能归为纯模型无进展。 + +Node闭环后才新冻React/Python,再独立原版Purge AB/BA。Purge比较固定模型/任务/预算/工具,唯一因子为原版Purge,至少平衡顺序;无足够样本不写成已证明普遍收益。若Node未过,其余按前置未执行,继续分析新证据及独立产品修复,不通过改提示/提高预算循环筛选成功。 + +所有原行/导出/工件、原modelAttempts及公开配置复核;只允许新自有样本记录、单调修订/健康观察和声明过的默认字段规范化。结束恢复预算/选线/身份策略,9229关闭,Key revision不变。原始材料.qa/live-delivery-x,seal.mjs离线清单封存;未推送。 diff --git a/docs/RELIABILITY-1.25.2.md b/docs/RELIABILITY-1.25.2.md index 4f021b1b..a783e397 100644 --- a/docs/RELIABILITY-1.25.2.md +++ b/docs/RELIABILITY-1.25.2.md @@ -53,3 +53,9 @@ W六请求71044 tokens、0提案0交付是事实;末轮新增468字符、还 readBudgetPolicyVersion=3把多文件/原工件读取作为共享预算批次,按实际请求大小优先完成小来源,释放剩余份额给测试/日志。仅纯读取批次排序,工具调用ID与原参数不变;变更、检查、审批和任意混合动作保持原序。单工件读取沿用原分页分配,v2封存保留原算法;完整下一请求、用量预留、16K/2048/1600保护不放宽。 首轮38项33通过5失败:三项断言仍固定新版策略号为2;另外两项揭示把整个混合文件/日志组强留会挤掉已有依据。因此保留原planner纯文件组规则,不将混合原日志组提升到必留;单工件分页保持原策略。重新38/38通过,三协议Unicode/CRLF分页、原片段聚合/检查事实/来源篡改/重开验证均通过。新增W形状HTTP夹具保留三完整小模块和原日志,第一测试页>945字符(原W首轮473);这是一项受控吞吐证据,实际新样本另验。原read-throughput.tap与read-throughput-final.tap保留;完整构建通过。 + +### 发行准备 + +版本常量/package/lock同步1.25.2;通用源码/便携/安装/全UI验收入口补1.25.1/1.25.2和独立reliability证据前缀,避免默默跳过前版功能。升级兼容列表用显式受支持版本配当前版本测试守卫:封装检查发现便携副本没有src,已去掉upgrade-running对源码diagnostics的运行依赖,防止便携独立CLI失效;未知版本仍拒绝。 + +已补隔离Python310 venv+pytest8.4.2与固定Chromium浏览器,避免把环境缺失当豁免。源码网页预算诊断两视口10组通过,完整回归运行中。新X驱动、一次正式升级驱动及冻结计划已准备;只做语法检查,没有发送模型请求。阶段未完成不标交付。 diff --git a/package-lock.json b/package-lock.json index 2b7ea2c6..aecede94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "local-agent-workbench", - "version": "1.25.1", + "version": "1.25.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "local-agent-workbench", - "version": "1.25.1", + "version": "1.25.2", "dependencies": { "@babel/parser": "7.29.11", "@peculiar/x509": "3.1.0", diff --git a/package.json b/package.json index 9251074d..d1a66d34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "local-agent-workbench", - "version": "1.25.1", + "version": "1.25.2", "private": true, "type": "module", "description": "A local coding workbench with explicit tool execution, reviewable changes and recoverable sessions.", diff --git a/progress.md b/progress.md index d5e7a611..e7f35a96 100644 --- a/progress.md +++ b/progress.md @@ -11,6 +11,7 @@ - 新读取HTTP用例首33项32通过1失败;有第3请求但被误设required的检查阻断。debug证实verification_incomplete;补明确“不运行工程检查”等否定及正向对照后,读取/无进展/shadow/task-control联合43/43通过。原首失败保留,task-control先独立提交。 - 混合读取按每工具轮真实新增区间结算;新468字符+3模块重复可进入下一请求,纯重复/相同检查/相同提案/相同状态保护保持。43/43后独立保护补强2/2通过,回顾后本地提交。源码定位曾误用task-contract文件名,改真实task-control;Windows rg文件通配失败改-g过滤。验证依赖中两套现有Python缺pytest,已定位Python310/312供后续核对;浏览器下载进行中。 - 读取吞吐v3纯读批次共享/小来源先完成,首38项33通过5失败保留;去掉会挤走原源码的混合组强留、保持单工件原分页并更新新版号断言后最终38/38、完整构建通过。补丁一度误删preparedSets,diff检查立即恢复,未进入测试或提交。Python310自有venv已装固定pytest8.4.2;Chromium仍后台下载。 +- 1.25.2版本与通用验收门/证据前缀准备;封装审查去掉upgrade脚本对portable缺失src的直接import,显式版本列表与当前版本回归守卫并存。浏览器下载完成、Python310 venv固定pytest8.4.2可用;完整回归运行中,源码Edge两视口预算诊断10组通过。X及保留状态正式升级驱动与新冻结计划已写,语法检查通过;真实请求0、正式操作0。 ## 1.25接续 diff --git a/scripts/live-x/common.mjs b/scripts/live-x/common.mjs new file mode 100644 index 00000000..7c0a3ae7 --- /dev/null +++ b/scripts/live-x/common.mjs @@ -0,0 +1,57 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { DatabaseSync } from 'node:sqlite'; +import { Agent, fetch } from 'undici'; +// New bounded real sample X on formal 1.25.2. Same fixed expense-report task, +// same jojocode GPT chat connection, same 16K/2048/8-request/90000-token caps. +// Never reads, copies, decrypts or re-stores the real key; uses the formal +// Provider's in-memory connection only. Never replays a sealed sample. +export const root = path.resolve('.qa/live-delivery-x'); +export const origin = 'http://127.0.0.1:4318'; +export const connectionId = '5b4daed9-b2f7-4de0-b949-573eba70c7b3'; +export const sha = value => createHash('sha256').update(value).digest('hex'); +export const readRoot = () => JSON.parse(fs.readFileSync(path.join(root, 'current.json'))); +export const dataRoot = () => readRoot().host.identity.dataRoot; +export const save = (relative, value) => { + const file = path.join(root, relative); fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, typeof value === 'string' || Buffer.isBuffer(value) ? value : JSON.stringify(value, null, 2) + '\n', { flag: 'wx' }); +}; +export function meta(name) { + assert.ok(['config', 'modelRegistry', 'modelAttempts', 'modelNetworkDiagnostics'].includes(name)); + const db = new DatabaseSync(path.join(dataRoot(), 'workbench.sqlite'), { readOnly: true }); + try { const row = db.prepare('SELECT value FROM metadata WHERE key=?').get(name); return row ? JSON.parse(row.value) : null; } + finally { db.close(); } +} +export async function client() { + const dispatcher = new Agent({ connect: { autoSelectFamily: true, timeout: 5000 } }); + let token; + const api = async (route, input, timeout = 30000) => { + const response = await fetch(origin + '/api' + route, { dispatcher, + method: input === undefined ? 'GET' : 'POST', redirect: 'error', signal: AbortSignal.timeout(timeout), + headers: { ...(token ? { 'X-Workbench-Token': token } : {}), 'Content-Type': 'application/json', Connection: 'close' }, + ...(input === undefined ? {} : { body: JSON.stringify(input) }) }); + const value = await response.json(); + if (!response.ok) throw Object.assign(new Error(route + ': ' + (value.error ?? response.status)), { status: response.status }); + return value; + }; + const boot = await api('/bootstrap'); token = boot.token; + return { api, boot, close: () => dispatcher.close() }; +} +export async function captureAttempts(api, attempts, relative) { + const captures = []; + for (const attempt of attempts) for (const kind of ['request', 'response']) { + const id = attempt[kind + 'ArtifactId']; if (!id) continue; + let content = '', offset = 0, page; + do { + page = await api('/artifacts/' + id + '?session=' + attempt.sessionId + '&offset=' + offset + '&limit=16000'); + assert.ok(page.content.length || !page.truncated); content += page.content; offset += page.content.length; + } while (page.truncated); + assert.equal(sha(content), page.sha256); + assert.equal(page.sha256, attempt[kind + 'Sha256']); + const name = `${relative}/${attempt.id}-${kind}.${kind === 'request' ? 'json' : attempt.streaming ? 'sse' : 'txt'}`; + save(name, content); captures.push({ attemptId: attempt.id, kind, artifactId: id, path: name, sha256: sha(content), bytes: Buffer.byteLength(content) }); + } + return captures; +} diff --git a/scripts/live-x/initial.mjs b/scripts/live-x/initial.mjs new file mode 100644 index 00000000..ae41d2fa --- /dev/null +++ b/scripts/live-x/initial.mjs @@ -0,0 +1,27 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; +import { publicSnapshot } from './state.mjs'; +import { root, origin, connectionId } from './common.mjs'; +// Read-only freeze of the formal 1.25.2 state before sample X. 0 model requests. +assert.equal(fs.existsSync(root), false, 'Sample X is frozen once; never overwrite.'); +assert.equal(execFileSync('git', ['status', '--porcelain'], { encoding: 'utf8', windowsHide: true }).trim(), '', 'Freeze from a committed tree.'); +const boot = await (await fetch(origin + '/api/bootstrap', { headers: { Connection: 'close' } })).json(); +const api = async route => (await fetch(origin + '/api' + route, { headers: { 'X-Workbench-Token': boot.token, Connection: 'close' } })).json(); +const host = await api('/host/status'), center = await api('/model-center'), connection = center.connections.find(c => c.id === connectionId); +assert.equal(boot.version, '1.25.2'); assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false); +assert.equal(host.desktopWindows.count, 0); +assert.equal(connection.enabled, true); assert.equal(connection.hasKey, true); assert.equal(connection.credentialRevision, 1); +assert.equal(connection.model, 'gpt-6.1-sol'); assert.equal(connection.protocol, 'chat-completions'); assert.equal(connection.streaming, false); +assert.equal(connection.contextLimit, 16000); assert.equal(connection.maxOutputTokens, 2048); +assert.equal(connection.modelIdentityPolicy ?? 'record', 'record'); +assert.equal(center.connections.find(c => c.id === '09b0293b-faad-45c3-832d-7c8b615813aa').enabled, false); +assert.deepEqual(center.selected, { type: 'pool', id: '68e30376-b799-445b-a858-db2dba9920a0' }); +const baseline = await publicSnapshot(origin, host.identity.dataRoot); assert.deepEqual(baseline.active, []); +fs.mkdirSync(root, { recursive: true }); +fs.writeFileSync(path.join(root, 'current.json'), JSON.stringify({ host, config: boot.config, projects: boot.projects, center, baseline, + connectionRevision: connection.revision, sourceCommit: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim(), + observedAt: new Date().toISOString() }, null, 2), { flag: 'wx' }); +console.log(JSON.stringify({ success: true, version: boot.version, pid: host.identity.pid, projects: baseline.projects, + sessions: baseline.exports.length, connectionId, connectionRevision: connection.revision, modelRequests: 0 })); diff --git a/scripts/live-x/inspector.mjs b/scripts/live-x/inspector.mjs new file mode 100644 index 00000000..31ad9461 --- /dev/null +++ b/scripts/live-x/inspector.mjs @@ -0,0 +1,58 @@ +import assert from 'node:assert/strict'; +import net from 'node:net'; +import { setTimeout as delay } from 'node:timers/promises'; +import { boundedGptPreflight } from './payload.mjs'; +export async function inspectorClosed() { + return new Promise((resolve, reject) => { + const socket = net.createConnection({ host: '127.0.0.1', port: 9229 }); socket.setTimeout(1500); + socket.once('connect', () => { socket.destroy(); reject(Error('Inspector already open.')); }); + socket.once('error', e => { socket.destroy(); e.code === 'ECONNREFUSED' ? resolve(true) : reject(e); }); + socket.once('timeout', () => { socket.destroy(); reject(Error('Inspector state unknown.')); }); + }); +} +class Protocol { + constructor(socket) { + this.socket = socket; this.nextId = 1; this.pending = new Map(); + socket.addEventListener('message', event => { + const m = JSON.parse(String(event.data)); if (!m.id) return; + const p = this.pending.get(m.id); if (!p) return; this.pending.delete(m.id); clearTimeout(p.timer); + m.error ? p.reject(Error(m.error.message)) : p.resolve(m.result); + }); + socket.addEventListener('close', () => { for (const p of this.pending.values()) { clearTimeout(p.timer); p.reject(Error('Inspector closed; outcome unknown.')); } this.pending.clear(); }); + } + send(method, params, timeout = 10000) { + return new Promise((resolve, reject) => { + const id = this.nextId++, timer = setTimeout(() => { this.pending.delete(id); reject(Error('Inspector timeout; do not replay.')); }, timeout); + this.pending.set(id, { resolve, reject, timer }); this.socket.send(JSON.stringify({ id, method, params })); + }); + } +} +export async function invokeGptProbe(input) { + await inspectorClosed(); let socket, protocol, enabled = false; + try { + process._debugProcess(input.pid); enabled = true; + let targets; + for (let i = 0; i < 40 && !targets; i++) { + await delay(100); + try { targets = await (await fetch('http://127.0.0.1:9229/json/list', { signal: AbortSignal.timeout(700) })).json(); } catch {} + } + assert.equal(targets?.length, 1); + assert.ok(targets[0].webSocketDebuggerUrl.startsWith('ws://127.0.0.1:9229/')); + socket = new WebSocket(targets[0].webSocketDebuggerUrl); + await new Promise((resolve, reject) => { socket.addEventListener('open', resolve, { once: true }); socket.addEventListener('error', reject, { once: true }); }); + protocol = new Protocol(socket); + const identity = await protocol.send('Runtime.evaluate', { expression: 'process.pid', returnByValue: true }); + assert.equal(identity.result.value, input.pid); + const expression = '(' + boundedGptPreflight.toString() + ')(' + JSON.stringify(input) + ')'; + const result = await protocol.send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true }, 345000); + if (result.exceptionDetails) throw Error(result.exceptionDetails.exception?.description ?? result.exceptionDetails.text); + return { result: result.result.value, expression }; + } finally { + if (protocol && enabled) { + await protocol.send('Runtime.evaluate', { expression: "setTimeout(() => process.getBuiltinModule('inspector').close(), 25); 'closing'", returnByValue: true }); + await delay(200); + } + socket?.close(); + await inspectorClosed(); + } +} diff --git a/scripts/live-x/network.mjs b/scripts/live-x/network.mjs new file mode 100644 index 00000000..c59016d6 --- /dev/null +++ b/scripts/live-x/network.mjs @@ -0,0 +1,63 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { setTimeout as delay } from 'node:timers/promises'; +import { publicSnapshot, canonical } from './state.mjs'; +import { root, origin, dataRoot, connectionId, save, meta, client, readRoot } from './common.mjs'; +// One bounded DNS/TCP/TLS observation of the same connection. Recorded, but per +// the new design a diagnostic result does not block the preflight. 0 HTTP/model. +assert.equal(fs.existsSync(path.join(root, 'network')), false, 'One diagnostic only; never overwrite or replay.'); +const original = readRoot(); +const { api, boot, close } = await client(); +let jobId; +try { + const host = await api('/host/status'); + assert.equal(host.identity.pid, 36552); assert.equal(boot.version, '1.25.2'); assert.equal(host.activity.active, false); + const before = await publicSnapshot(origin, dataRoot()); save('network/before.json', before); + assert.deepEqual(canonical(before.database.tables), canonical(original.baseline.database.tables)); + assert.deepEqual(before.exports, original.baseline.exports); assert.deepEqual(before.persistent, original.baseline.persistent); + const history = await api('/model-center/network-diagnostics'); save('network/history-before.json', history); + const connection = before.modelCenter.connections.find(row => row.id === connectionId); + assert.equal(connection.revision, original.connectionRevision); assert.equal(connection.credentialRevision, 1); + save('network/contract.json', { connectionId, revision: connection.revision, target: connection.baseUrl, + maxJobs: 1, recordedNonBlocking: true, credentialAccess: false, httpRequests: 0, modelRequests: 0, + directEndpointOnly: true, modelApiRouteVerified: false, defaultOrTransportChanges: false }); + const started = await api('/model-center/network-diagnostics', { id: connectionId, revision: connection.revision }); + save('network/start.json', started); jobId = started.job.id; + const deadline = Date.now() + 20000; + let current; + do { + current = await api('/model-center/network-diagnostics'); + if (!current.active) break; + assert.ok(Date.now() < deadline, 'Diagnostic exceeded its bounded deadline.'); await delay(200); + } while (true); + const job = current.jobs.find(row => row.id === jobId); + assert.ok(job.finishedAt); + assert.equal(job.connectionId, connectionId); assert.equal(job.connectionRevision, original.connectionRevision); + assert.equal(job.httpRequests, 0); assert.equal(job.modelRequests, 0); assert.equal(job.credentialAccess, false); + assert.equal(job.route.kind, 'direct-endpoint-only'); assert.equal(job.route.modelApiRouteVerified, false); + save('network/history-after.json', current); save('network/job.json', job); + const after = await publicSnapshot(origin, dataRoot()); save('network/after.json', after); + for (const field of ['pid', 'version', 'hasKey', 'configSha256', 'projectsSha256', 'sessionsSha256', 'eventCursor', 'modelCenterSha256']) assert.deepEqual(after[field], before[field], field); + assert.deepEqual(after.exports, before.exports); assert.deepEqual(after.persistent.artifacts, before.persistent.artifacts); + assert.deepEqual(after.persistent.files, before.persistent.files); + for (const table of Object.keys(before.database.tables)) { + assert.equal(after.database.tables[table].schemaSha256, before.database.tables[table].schemaSha256); + const nextRows = after.database.tables[table].rows.filter(row => table !== 'metadata' || row.id !== 'modelNetworkDiagnostics'); + const previousRows = before.database.tables[table].rows.filter(row => table !== 'metadata' || row.id !== 'modelNetworkDiagnostics'); + assert.deepEqual(nextRows, previousRows, table + ': only diagnostic history may change'); + } + const result = { passed: true, recordedNonBlocking: true, jobId, diagnosticStatus: job.status, elapsedMs: job.elapsedMs, + dns: job.stages?.dns, trials: (job.trials ?? []).map(row => ({ mode: row.mode, family: row.family, status: row.status, code: row.code })), + route: job.route, originalStateExactExceptNewDiagnosticHistory: true, credentialAccess: false, httpRequests: 0, modelRequests: 0 }; + save('network/restoration.json', result); console.log(JSON.stringify(result)); +} catch (error) { + save('network/driver-error.json', { name: error.name, message: error.message, stack: error.stack, jobId, automaticReplay: false }); + throw error; +} finally { + if (jobId) { + const state = await api('/model-center/network-diagnostics'); + if (state.active && ['pending', 'running'].includes(state.jobs.find(row => row.id === jobId)?.status)) save('network/stop.json', await api('/model-center/network-diagnostics/' + jobId + '/stop', {})); + } + await close(); +} diff --git a/scripts/live-x/node.mjs b/scripts/live-x/node.mjs new file mode 100644 index 00000000..5dc67654 --- /dev/null +++ b/scripts/live-x/node.mjs @@ -0,0 +1,239 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; +import { setTimeout as delay } from 'node:timers/promises'; +import { gitEnvironment } from '../../src/core/git-process.mjs'; +import { publicSnapshot, canonical } from './state.mjs'; +import { root, origin, dataRoot, connectionId, save, meta, client, sha, captureAttempts, readRoot } from './common.mjs'; +// Bounded real Node engineering with supervisor-in-the-loop review. Model +// implements the three allowed modules autonomously; supervisor only approves +// the original checks, reviews/applies the allowed change set and confirms Git. +assert.equal(JSON.parse(fs.readFileSync(path.join(root, 'preflight/result.json'))).passed, true); +assert.equal(fs.existsSync(path.join(root, 'node')), false, 'Never replay or overwrite a live sample.'); +const original = readRoot(); +const { api, boot, close } = await client(); +const allowed = ['src/amount.mjs', 'src/summary.mjs', 'src/report.mjs']; +const budgetFields = ['contextLimit', 'maxSteps', 'maxOutputTokens', 'maxRunTokens', 'maxTaskTokens', 'maxRunDurationMs']; +const connectionFields = ['id', 'name', 'brand', 'model', 'baseUrl', 'enabled', 'requiresKey', 'streaming', 'protocol', + 'capabilityDeclarations', 'contextLimit', 'maxOutputTokens', 'concurrency', 'nativeParameters', 'outputTokenField', + 'modelIdentityPolicy', 'modelIdentityAliases', 'modelIdentityAliasSource']; +const connectionInput = value => Object.fromEntries(connectionFields.filter(key => Object.hasOwn(value, key)).map(key => [key, value[key]])); +const originalIdentity = value => ({ modelIdentityPolicy: value.modelIdentityPolicy ?? 'record', + modelIdentityAliases: value.modelIdentityAliases ?? [], modelIdentityAliasSource: value.modelIdentityAliasSource ?? '' }); +let before, centerBefore, publicMetadata, originalAttempts, connection, configured, project, session, state, taskId, route, budgetWritten = false, selectionWritten = false; +let result, delivery, succeeded = false, failure; +const approvals = [], applications = [], continuations = [], observations = [], start = Date.now(); +const sourceRoot = path.join(root, 'node/expense-project'); +const git = args => execFileSync('git', ['--no-pager', '--no-optional-locks', '-C', sourceRoot, ...args], { encoding: 'utf8', windowsHide: true, env: gitEnvironment() }); +let protectedBytes, stagedBefore; +const protect = () => { + for (const [name, bytes] of Object.entries(protectedBytes)) assert.deepEqual(fs.readFileSync(path.join(sourceRoot, name)), bytes, name); + assert.equal(git(['show', ':owner-staged.txt']), stagedBefore, 'Preserve original index and working-copy states.'); +}; +const waitFor = async (predicate, timeout = 30000) => { + const deadline = Date.now() + timeout; + while (!await predicate()) { assert.ok(Date.now() < deadline, 'Local operation deadline exceeded; verify outcome, never replay.'); await delay(350); } +}; +const review = async (kind, value) => { + const relative = `node/reviews/${kind}-${applications.length + 1}`; + const fingerprint = value.fingerprint ?? sha(JSON.stringify(value)); + save(relative + '/input.json', { ...value, fingerprint }); + console.log(JSON.stringify({ reviewRequired: true, kind, path: relative + '/input.json', fingerprint })); + const decisionPath = path.join(root, relative, 'decision.json'); + await waitFor(async () => fs.existsSync(decisionPath), Math.max(1, 600000 - (Date.now() - start))); + const decision = JSON.parse(fs.readFileSync(decisionPath)); + assert.equal(decision.approve, true, 'Supervisor declined the original model proposal.'); + assert.ok(typeof decision.reason === 'string' && decision.reason.length > 20, 'Record substantive review.'); + assert.equal(decision.fingerprint, fingerprint); + return decision; +}; +const remainingRun = async () => { + const requests = state?.execution.task.usage.requests ?? 0; + assert.ok(requests < 8, 'The sealed eight-request budget is exhausted.'); + const budgets = { contextLimit: 16000, maxOutputTokens: 2048, maxSteps: 8 - requests, + maxRunTokens: 90000, maxTaskTokens: 90000, maxRunDurationMs: 600000 }; + await api('/model-center/runtime-budgets', budgets); budgetWritten = true; + continuations.push({ beforeRequests: requests, remainingSteps: budgets.maxSteps, at: new Date().toISOString() }); +}; +try { + assert.equal(boot.version, '1.25.2'); + const host = await api('/host/status'); assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false); + before = await publicSnapshot(origin, dataRoot()); save('node/before.json', before); + centerBefore = await api('/model-center'); connection = centerBefore.connections.find(value => value.id === connectionId); + assert.equal(connection.enabled, true); assert.equal(connection.hasKey, true); assert.equal(connection.revision, original.connectionRevision); + assert.equal(connection.model, 'gpt-6.1-sol'); assert.equal(connection.protocol, 'chat-completions'); assert.equal(connection.contextLimit, 16000); + assert.deepEqual(originalIdentity(connection), { modelIdentityPolicy: 'record', modelIdentityAliases: [], modelIdentityAliasSource: '' }); + publicMetadata = { config: meta('config'), registry: meta('modelRegistry') }; + save('node/original-public-metadata.json', publicMetadata); + originalAttempts = meta('modelAttempts') ?? []; save('node/original-attempts.json', originalAttempts); + save('node/contract.json', { kind: 'new-real-Node-engineering', version: boot.version, connectionId, connection, + maxRequests: 8, maxTokens: 90000, contextLimit: 16000, maxOutputTokens: 2048, maxDurationMs: 600000, + allowed, checks: ['test', 'build'], expectedTests: 9, commands: 'Only model-planned npm test/build, no arbitrary run_command', + review: 'Model seals all three files, supervisor reviews and applies; model plans Git, supervisor confirms.', + continuation: 'Only review-action continuation of the same task with remaining steps, no extra implementation prompts.', + originalImplementationSupplied: false, automaticRetry: false, poolSwitching: false, + originalSelected: centerBefore.selected, originalBudgets: Object.fromEntries(budgetFields.map(key => [key, boot.config[key]])), + restore: 'Original budget values and selection restored. Original absent identity fields become explicit record/[]/empty-string defaults; raw pre-state retained and only this declared normalization accepted. Revision counters remain monotonic.' }); + fs.cpSync('benchmarks/live-delivery-v1/node', sourceRoot, { recursive: true, errorOnExist: true }); + fs.writeFileSync(path.join(sourceRoot, 'README.md'), '# Expense report acceptance\nRepair the three source modules using the immutable original nine tests; do not edit checks or owner files.\n', { flag: 'wx' }); + fs.writeFileSync(path.join(sourceRoot, '.gitignore'), 'dist/\n.awb-*\nnode_modules/\n', { flag: 'wx' }); + for (const name of ['owner-staged.txt', 'owner-unstaged.txt']) fs.writeFileSync(path.join(sourceRoot, name), 'Owner original baseline\n', { flag: 'wx' }); + git(['init', '--initial-branch=main']); git(['config', 'core.autocrlf', 'false']); + git(['config', 'user.name', 'Workbench QA']); git(['config', 'user.email', 'qa@workbench.invalid']); + git(['add', '--', '.']); git(['commit', '--no-gpg-sign', '-m', 'Seal expense engineering baseline and original checks']); + fs.writeFileSync(path.join(sourceRoot, 'owner-staged.txt'), 'Owner staged change\n'); git(['add', '--', 'owner-staged.txt']); + stagedBefore = git(['show', ':owner-staged.txt']); + fs.writeFileSync(path.join(sourceRoot, 'owner-staged.txt'), 'Owner working copy differs from staging\n'); + fs.writeFileSync(path.join(sourceRoot, 'owner-unstaged.txt'), 'Owner unstaged change\n'); + fs.writeFileSync(path.join(sourceRoot, 'owner-untracked.txt'), 'Owner untracked change\n', { flag: 'wx' }); + const protectedNames = ['README.md', '.gitignore', 'package.json', 'test/expense.test.mjs', 'scripts/build.mjs', 'owner-staged.txt', 'owner-unstaged.txt', 'owner-untracked.txt']; + protectedBytes = Object.fromEntries(protectedNames.map(name => [name, fs.readFileSync(path.join(sourceRoot, name))])); + const sourceFiles = [...protectedNames, ...allowed]; + for (const name of sourceFiles) save('node/source-before/' + name, fs.readFileSync(path.join(sourceRoot, name))); + save('node/source-identity.json', { head: git(['rev-parse', 'HEAD']).trim(), status: git(['status', '--porcelain=v1']), stagedBefore, + files: Object.fromEntries(sourceFiles.map(name => [name, sha(fs.readFileSync(path.join(sourceRoot, name)))])) }); + project = await api('/projects', { root: sourceRoot }); session = await api('/sessions', { projectId: project.id }); route = '/sessions/' + session.id; + save('node/owned.json', { project, session }); + configured = await api('/model-center/connections', { ...connectionInput(connection), revision: connection.revision, + modelIdentityPolicy: 'require-match', modelIdentityAliases: [], modelIdentityAliasSource: '' }); + assert.equal(configured.credentialRevision, connection.credentialRevision); assert.equal(configured.hasKey, true); + save('node/connection-frozen.json', configured); + await remainingRun(); await api('/model-center/select', { type: 'connection', id: connectionId }); selectionWritten = true; + const goal = '修复这个Node费用报表工程的amount、summary、report三个模块。金额用精确分单位处理,接受测试约定的十进制字符串、有限数字、退款、及空白;拒绝格式错误、超精度和不安全金额。按独立币种规范化、排序汇总并保留原数组,计数准确、安全求和,报表两位小数含负分金额。以原九项测试为完整奥约。' + + '先inspect_project,再plan_checks选择["test","build"]并run_checks保留真实基线失败,读取原测试和相关源码。只允许修改src/amount.mjs、src/summary.mjs、src/report.mjs;不改测试、配置、README、构建脚本、owner文件或原暂存,不使用run_command,不直接提交Git。' + + 'propose_file/propose_patch准备完整三个模块后,用prepare_change_set一次封存全部三文件,等待审查应用。应用后继续同一个Task,重新plan_checks/run_checks,通过原9项测试和build后,用plan_delivery为三个文件准备本地Git预览并等待确认。模型必须自己实现,禁止用口头完成替代检查。预算最多8次模型请求、90000tokens,输出2048,上下文16K,请合并独立工具调用并避免重复观察。'; + save('node/goal.txt', goal); protect(); + await api(route + '/messages', { content: goal }); + while (Date.now() - start < 600000) { + state = await api(route); taskId ??= state.execution.task.id; assert.equal(state.execution.task.id, taskId); protect(); + const usage = state.execution.task.usage; assert.ok(usage.requests <= 8); assert.ok(usage.totalTokens <= 90000); + const progress = { status: state.status, requests: usage.requests, tokens: usage.totalTokens, lastTool: state.events.filter(event => event.kind === 'tool').at(-1)?.tool, + checks: state.execution.checks.map(job => job.status), elapsedSeconds: Math.round((Date.now() - start) / 1000) }; + if (JSON.stringify({ ...progress, elapsedSeconds: 0 }) !== JSON.stringify({ ...observations.at(-1), elapsedSeconds: 0 })) { observations.push(progress); console.log(JSON.stringify(progress)); } + for (const change of state.changes.filter(change => ['pending', 'conflict'].includes(change.status))) assert.ok(allowed.includes(change.path), 'Out-of-scope proposal: ' + change.path); + for (const approval of state.approvals.filter(item => item.status === 'pending')) { + const plan = state.execution.plans.find(value => value.id === approval.checkPlanId); + const allow = !!plan && plan.taskId === taskId && plan.checks.length === 2 && plan.checks.every(check => ['test', 'build'].includes(check.name) && !check.lifecycle?.length) + && approval.cwd === sourceRoot && approval.command === plan.checks.map(check => check.command).join('\n'); + approvals.push({ approvalId: approval.id, planId: plan?.id, command: approval.command, allow }); + await api(route + '/approvals/' + approval.id, { allow }); assert.equal(allow, true, 'Only the sealed original checks are authorized.'); + } + if (['running', 'awaiting_approval', 'stopping'].includes(state.status)) { await delay(650); continue; } + if (state.status === 'failed') throw new Error(state.failure?.message ?? 'Actual-model task failed'); + const plan = state.execution.deliveryPlans?.findLast(value => value.status === 'planned' && value.taskId === taskId); + if (plan) { + assert.deepEqual(plan.paths.slice().sort(), allowed.slice().sort()); const requests = usage.requests; + assert.ok(state.events.some(event => event.tool === 'plan_delivery' && event.phase === 'completed')); + const passing = state.execution.checks.filter(job => job.status === 'passed').at(-1); + assert.equal(passing?.results.find(value => value.name === 'test')?.tests?.passed, 9); + await review('git', { plan, fingerprint: plan.fingerprint, checks: state.execution.checks, source: state.changes, + status: git(['status', '--porcelain=v1']), stagedBefore, stagedAfter: git(['show', ':owner-staged.txt']) }); + await api(route + '/delivery-jobs', { planId: plan.id }); + await waitFor(async () => { state = await api(route); delivery = state.execution.deliveries.at(-1); return !!delivery?.reportArtifactId; }); + assert.equal(delivery.status, 'completed'); assert.equal(state.execution.task.usage.requests, requests); break; + } + const pending = state.changes.filter(change => change.status === 'pending'); + const batch = state.execution.changeSets?.findLast(value => value.taskId === taskId && value.status === 'prepared'); + if (pending.length) { + assert.ok(state.execution.checks.some(job => job.status === 'failed' && job.results.some(value => value.tests?.failed > 0)), 'Model must preserve the original failing tests.'); + assert.equal(batch?.source, 'agent', 'Model must seal its own complete change set.'); + assert.deepEqual(batch.files.map(file => file.changeId).sort(), pending.map(change => change.id).sort()); + if (!applications.length) assert.deepEqual(batch.files.map(file => file.path).sort(), allowed.slice().sort()); + assert.ok(applications.length < 3); + await review('changes', { fingerprint: batch.fingerprint, batch, changes: pending, checks: state.execution.checks }); + await api(route + '/change-sets/' + batch.id + '/apply', { fingerprint: batch.fingerprint }); + await waitFor(async () => (await api(route + '/change-sets/' + batch.id)).status === 'completed'); + for (const change of pending) assert.equal(sha(fs.readFileSync(path.join(sourceRoot, change.path))), change.sha256); + applications.push({ id: batch.id, fingerprint: batch.fingerprint, paths: batch.files.map(file => file.path), source: batch.source }); protect(); + await remainingRun(); await api(route + '/continue-reviewed', {}); continue; + } + throw new Error('Model stopped before verified Git delivery: ' + state.status + '/' + state.execution.run.stopReason); + } + assert.ok(delivery, 'The sealed engineering deadline ended without complete delivery.'); + const passing = state.execution.checks.filter(job => job.status === 'passed').at(-1); assert.ok(passing); + const tests = passing.results.find(value => value.name === 'test')?.tests; assert.equal(tests?.total, 9); assert.equal(tests.passed, 9); assert.equal(tests.failed, 0); + assert.deepEqual(git(['diff-tree', '--no-commit-id', '--name-only', '-r', 'HEAD']).trim().split(/\r?\n/).sort(), allowed.slice().sort()); protect(); + succeeded = true; + result = { success: true, commit: delivery.commit, tests, delivery, checkJobId: passing.id }; +} catch (error) { + failure = { name: error.name, message: error.message, stack: error.stack, at: new Date().toISOString(), automaticReplay: false }; + result = { success: false, failure }; process.exitCode = 1; +} finally { + if (route) { + state = await api(route); + if (['running', 'stopping', 'awaiting_approval'].includes(state.status)) { await api(route + '/stop', {}); state = await api(route); } + taskId ??= state.execution.task?.id; + save('node/session.json', state); save('node/export.json', await api(route + '/export')); + const attempts = (meta('modelAttempts') ?? []).filter(value => value.sessionId === session.id); save('node/attempts.json', attempts); + const captures = await captureAttempts(api, attempts, 'node/captures'); + const identitiesValid = attempts.every(value => value.connectionId === connectionId && value.poolId === null && value.ordinal === 1 + && value.status === 'completed' && value.modelIdentity?.status === 'matched' && value.modelIdentity.complete === true && value.modelIdentity.policy === 'require-match'); + result = { ...result, version: boot.version, sessionId: session.id, projectId: project.id, taskId, sourceRoot, + connectionId, requestedModel: 'gpt-6.1-sol', usage: state.execution.task?.usage, state: state.status, stopReason: state.execution.run?.stopReason, + attempts: attempts.length, identitiesValid, captures, approvals, applications, continuations, observations, + modelImplementationSuppliedBySupervisor: false, modelWeightsAuthenticated: false, originalPurgeBenefitTested: false, + elapsedSeconds: Math.round((Date.now() - start) / 1000) }; + if (succeeded) assert.equal(identitiesValid, true); + save('node/model-outcome.json', result); + for (const name of allowed) save('node/source-after/' + name, fs.readFileSync(path.join(sourceRoot, name))); + save('node/git-final.json', { head: git(['rev-parse', 'HEAD']).trim(), status: git(['status', '--porcelain=v1']), stagedBefore, stagedAfter: git(['show', ':owner-staged.txt']), diff: git(['diff', 'HEAD', '--', ...allowed]) }); + } + const host = await api('/host/status'); assert.equal(host.activity.active, false, 'Do not overwrite another active task.'); + if (configured) { + const center = await api('/model-center'), current = center.connections.find(value => value.id === connectionId); + assert.equal(current.revision, configured.revision, 'Do not overwrite an external connection edit.'); + const restored = await api('/model-center/connections', { ...connectionInput(connection), ...originalIdentity(connection), revision: current.revision }); + assert.equal(restored.credentialRevision, connection.credentialRevision); save('node/connection-restored.json', restored); + assert.deepEqual(originalIdentity(restored), originalIdentity(connection)); + } + if (budgetWritten) await api('/model-center/runtime-budgets', Object.fromEntries(budgetFields.map(key => [key, boot.config[key]]))); + if (selectionWritten) await api('/model-center/select', centerBefore.selected); + const after = await publicSnapshot(origin, dataRoot()); save('node/after.json', after); + if (before) { + for (const item of before.exports) assert.deepEqual(after.exports.find(value => value.id === item.id), item, 'Original export: ' + item.id); + for (const table of ['sessions', 'records', 'events', 'outbox']) { + const rows = new Map(after.database.tables[table].rows.map(row => [row.id, row])); + for (const row of before.database.tables[table].rows) assert.deepEqual(rows.get(row.id), row, 'Original ' + table + '/' + row.id); + } + const artifactMap = new Map(after.persistent.artifacts.map(value => [value.path, value])); + for (const item of before.persistent.artifacts) assert.deepEqual(artifactMap.get(item.path), item, 'Original artifact: ' + item.path); + const finalBoot = await api('/bootstrap'), normalized = { ...finalBoot.config, configRevision: boot.config.configRevision }; + assert.deepEqual(canonical(normalized), canonical(boot.config)); + assert.deepEqual(finalBoot.projects.filter(value => value.id !== project?.id), boot.projects, 'Every original public project, excluding only the new owned sample.'); + assert.deepEqual(after.modelCenter.selected, centerBefore.selected); assert.deepEqual(after.modelCenter.pools, centerBefore.pools); + for (const item of centerBefore.connections.filter(value => ![connectionId, 'legacy-default'].includes(value.id))) assert.deepEqual(after.modelCenter.connections.find(value => value.id === item.id), item); + const finalMetadata = { config: meta('config'), registry: meta('modelRegistry') }; + save('node/final-public-metadata.json', finalMetadata); + const configNormalized = { ...finalMetadata.config, configRevision: publicMetadata.config.configRevision }; + assert.deepEqual(canonical(configNormalized), canonical(publicMetadata.config), 'Raw public disk config except its monotonic revision.'); + const registryNormalized = structuredClone(finalMetadata.registry); + assert.ok(registryNormalized.revision > publicMetadata.registry.revision); + registryNormalized.revision = publicMetadata.registry.revision; + const originalConnection = publicMetadata.registry.connections.find(value => value.id === connectionId); + const finalConnection = registryNormalized.connections.find(value => value.id === connectionId); + assert.equal(finalConnection.revision, originalConnection.revision + 2); + finalConnection.revision = originalConnection.revision; finalConnection.updatedAt = originalConnection.updatedAt; + const registryBefore = structuredClone(publicMetadata.registry); + const normalizedBeforeConnection = registryBefore.connections.find(value => value.id === connectionId); + const normalization = Object.fromEntries(Object.entries(originalIdentity(normalizedBeforeConnection)).filter(([key]) => !Object.hasOwn(normalizedBeforeConnection, key))); + Object.assign(normalizedBeforeConnection, normalization); + save('node/declared-identity-default-normalization.json', { connectionId, added: normalization, + originalRawStatePreserved: true, originalSemanticsRestored: true, reason: 'The public partial-update API retains missing fields; restore explicit original default semantics rather than silently retaining require-match.' }); + for (const value of [registryBefore, registryNormalized]) value.connections.sort((a, b) => a.id.localeCompare(b.id)); + assert.deepEqual(canonical(registryNormalized), canonical(registryBefore), 'Registry except declared revision/timestamp/order and explicit original identity defaults.'); + const finalAttempts = meta('modelAttempts') ?? []; + for (const item of originalAttempts) assert.deepEqual(finalAttempts.find(value => value.id === item.id), item, 'Original complete model attempt: ' + item.id); + const metadataRows = new Map(after.database.tables.metadata.rows.map(row => [row.id, row])); + for (const row of before.database.tables.metadata.rows.filter(row => !['config', 'modelRegistry', 'modelAttempts'].includes(row.id))) assert.deepEqual(metadataRows.get(row.id), row); + save('node/restoration.json', { passed: true, originalExports: before.exports.length, originalArtifactFiles: before.persistent.artifacts.length, + originalRowsExact: ['sessions', 'records', 'events', 'outbox'], budgetsAndSelectionRestored: true, poolsUnchanged: true, + originalPublicProjectsExact: true, originalAttemptsExact: originalAttempts.length, rawConfigExceptRevisionExact: true, + registryExceptDeclaredRevisionTimestampOrderAndIdentityDefaultsExact: true, identityDefaultNormalization: normalization, otherMetadataRowsExact: true, + originalCredentialRevision: connection?.credentialRevision, finalCredentialRevision: after.modelCenter.connections.find(value => value.id === connectionId)?.credentialRevision, + changedOnlyMonotonicRevisionsObservedHealthAndDeclaredIdentityDefaults: true, pid: after.pid, version: after.version, noKeyExtractedOrResaved: true }); + } + save('node/result.json', result ?? { success: false, failure, noModelDispatch: true }); await close(); +} +console.log(JSON.stringify({ success: result.success, attempts: result.attempts, usage: result.usage, state: result.state, + stopReason: result.stopReason, commit: result.commit, tests: result.tests, error: result.failure?.message })); diff --git a/scripts/live-x/payload.mjs b/scripts/live-x/payload.mjs new file mode 100644 index 00000000..4b89d8d8 --- /dev/null +++ b/scripts/live-x/payload.mjs @@ -0,0 +1,86 @@ +// One-shot QA adapter. Runs inside the existing formal host via the inspector; +// never reads a credential value. Mirrors the sealed R preflight payload. +export async function boundedGptPreflight(input) { + const ensure = (value, message) => { if (!value) throw new Error(message); }; + ensure(process.pid === input.pid, 'Unexpected host PID.'); + const servers = process._getActiveHandles().filter(h => h?.listening && h.address?.()?.address === '127.0.0.1' && h.address?.()?.port === input.port); + ensure(servers.length === 1, 'Expected one owned loopback server.'); + const context = servers[0].workbenchHostAuthority?.context; + ensure(context?.provider && context?.store && context?.runtime, 'Original context missing.'); + const { store, provider, runtime } = context; + ensure(runtime.appDirectory === input.runtimeRoot, 'Loaded runtime changed.'); + ensure(![...store.sessions.values()].some(s => ['running', 'stopping', 'awaiting_approval'].includes(s.status)), 'Host is busy.'); + const session = store.session(input.sessionId), project = store.project(session.projectId); + ensure(session.projectId === input.projectId && session.messages.length === 0 && !session.runId, 'Probe session must be new and owned.'); + const hub = provider.modelHub(store); + const connection = hub.view().connections.find(c => c.id === input.connectionId); + ensure(connection?.hasKey && connection.credentialRevision === input.credentialRevision, 'Original saved credential revision changed.'); + ensure(connection.enabled && connection.protocol === 'chat-completions' && (connection.modelIdentityPolicy ?? 'record') === 'record', 'Probe protocol/auth/identity mismatch.'); + ensure(connection.baseUrl === input.baseUrl && connection.model === input.model && connection.revision === input.connectionRevision, 'Connection changed.'); + const config = hub.prepare({ ...store.config, mode: 'compatible', maxSteps: 1, maxOutputTokens: 256, + contextLimit: 16000, maxRunTokens: 16000, maxTaskTokens: 16000, maxRunDurationMs: 320000, + modelResponseTimeoutMs: 300000, modelStreamIdleTimeoutMs: 120000 }, { type: 'connection', id: input.connectionId }); + config.modelRouting.members = config.modelRouting.members.map(member => ({ ...member, modelIdentityPolicy: 'require-match', modelIdentityAliases: [], modelIdentityAliasSource: '' })); + ensure(config.modelRouting.members.length === 1 && config.modelRouting.maxAttempts === 1 && config.maxOutputTokens === 256, 'One-request hard limits missing.'); + globalThis.__gptXProbeOnce ??= new Set(); + ensure(!globalThis.__gptXProbeOnce.has(input.sessionId), 'This sample cannot be replayed.'); + globalThis.__gptXProbeOnce.add(input.sessionId); + session.title = input.title; + const run = store.beginRun(session, input.prompt, false, config, { forceNewTask: true }); + store.message(session, 'user', input.prompt); + session.providerMessages.push({ role: 'user', content: input.prompt }); + const step = store.beginStep(session, run), planner = runtime.requestPlanner(); + let plan, response, diagnostic = null, requestEvent, receipts = 0, wireStarts = 0; + const wireIds = new Set(); + const signal = AbortSignal.timeout(320000); + let stopReason = 'identity_probe_complete'; + try { + plan = planner.prepare(session, run, config, { system: 'This is a connection identity preflight. Reply to the user exactly. No tools are available. Do not perform any project work.', tools: [], stepId: step.id }); + const variants = plan.body.kind === 'model-route-plan' ? plan.body.variants.map(v => v.body) : [plan.body]; + ensure(variants.length === 1 && variants.every(b => !(b.tools?.length) && b.max_tokens === 256 && b.model === input.model), 'Wire request violates no-tool contract.'); + ensure(plan.record.tokenReservation.reservedTokens <= 16000, 'Reservation exceeds sealed budget.'); + const progress = event => { + if (event.consumption) { + receipts += Number(store.recordConsumption(session, run, { ...event.consumption, requestId: plan.record.id }, plan.record.tokenReservation.reservedTokens)); + return; + } + if (event.phase === 'running' && event.wireAttemptId) { wireIds.add(event.wireAttemptId); wireStarts = wireIds.size; ensure(wireStarts === 1, 'No retries permitted.'); } + requestEvent ??= store.event(session, { kind: 'model', source: 'model_connection', label: 'X · GPT单次身份预检(无工具)', phase: 'running', runId: run.id, contextPlanId: plan.record.id, startedAt: new Date().toISOString() }); + if (event.modelAttemptId) requestEvent.modelAttemptId = event.modelAttemptId; + if (event.connectionId) requestEvent.connectionId = event.connectionId; + if (event.model) requestEvent.actualModel = event.model; + if (event.modelIdentity) requestEvent.modelIdentity = event.modelIdentity; + if (event.requestUrl) requestEvent.requestUrl = event.requestUrl; + if (event.diagnostic) requestEvent.diagnostic = event.diagnostic; + if (event.stream) requestEvent.stream = event.stream; + if (event.phase) requestEvent.phase = event.phase; + plan.record.requestAttempts = wireStarts; step.modelAttempts = wireStarts; + store.save(session); + }; + response = await provider.complete(config, plan.messages, project, signal, progress, plan.record, [], { attempts: 1, maxBudgetAttempts: 1 }); + ensure(!response.message.tool_calls?.length, 'Unsolicited tools are never executed.'); + ensure(receipts === 1, 'Expected one original consumption receipt.'); + planner.finish(session, plan.record, { response, attempts: wireStarts }); + session.providerMessages.push(response.message); store.message(session, 'assistant', response.message.content); + const total = (run.usage?.reportedTokens ?? run.usage?.totalTokens ?? 0); + session.status = total > 16000 ? 'paused' : 'completed'; + if (total > 16000) stopReason = 'task_token_limit'; + } catch (cause) { + diagnostic = cause.diagnostic ?? { source: 'workbench', origin: 'local', stage: 'identity_preflight', kind: signal.aborted ? 'cancelled' : 'runtime', title: '身份预检需要核对', message: provider.redact(cause.message), occurredAt: new Date().toISOString() }; + session.status = diagnostic.kind === 'model_identity' || signal.aborted ? 'paused' : 'failed'; + stopReason = diagnostic.kind; + session.lastFailure = { ...diagnostic, runId: run.id }; + const message = store.message(session, 'system', diagnostic.message); + session.failure = { ...session.lastFailure, messageId: message.id }; + if (plan) planner.finish(session, plan.record, { error: new Error(diagnostic.message), attempts: wireStarts }); + } finally { + if (requestEvent) { requestEvent.phase = diagnostic ? 'failed' : 'completed'; requestEvent.finishedAt = new Date().toISOString(); if (diagnostic) requestEvent.diagnostic = diagnostic; } + store.finishStep(session, step, diagnostic ? 'failed' : 'completed'); + store.finishRun(session, run, stopReason); + } + const attempts = hub.attempts.filter(a => a.sessionId === session.id); + ensure(attempts.length <= 1 && wireStarts <= 1, 'Single-request limit exceeded.'); + return { sessionId: session.id, projectId: project.id, taskId: run.taskId, runId: run.id, status: session.status, + stopReason, attempts: attempts.length, receipts, wireStarts, actualTools: run.toolCalls, usage: run.usage, + contextPlanId: plan?.record.id ?? null, diagnostic, message: response?.message ?? null }; +} diff --git a/scripts/live-x/preflight.mjs b/scripts/live-x/preflight.mjs new file mode 100644 index 00000000..78ed2ee2 --- /dev/null +++ b/scripts/live-x/preflight.mjs @@ -0,0 +1,70 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { randomUUID } from 'node:crypto'; +import { publicSnapshot, hash } from './state.mjs'; +import { invokeGptProbe, inspectorClosed } from './inspector.mjs'; +import { root, origin, dataRoot, connectionId, save, meta, client, captureAttempts, readRoot } from './common.mjs'; +// Single no-tool GPT identity preflight. One request max, strict identity, stop on failure. +assert.equal(fs.existsSync(path.join(root, 'preflight')), false, 'Never replay or overwrite a real sample.'); +const original = readRoot(); +const { api, boot, close } = await client(); +let fatal; +try { + await inspectorClosed(); + assert.equal(boot.version, '1.25.2'); + const host = await api('/host/status'); assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false); + const before = await publicSnapshot(origin, dataRoot()); save('preflight/before.json', before); + assert.deepEqual(before.active, []); + const connection = before.modelCenter.connections.find(value => value.id === connectionId); + assert.equal(connection.enabled, true); assert.equal(connection.hasKey, true); assert.equal(connection.credentialRevision, 1); + assert.equal(connection.protocol, 'chat-completions'); assert.equal(connection.model, 'gpt-6.1-sol'); + assert.equal(connection.revision, original.connectionRevision); + assert.equal(connection.contextLimit, 16000); assert.equal(connection.modelIdentityPolicy ?? 'record', 'record'); + const originalAttempts = meta('modelAttempts') ?? []; save('preflight/original-attempts.json', originalAttempts); + const nonce = randomUUID(), prompt = `这是独立GPT连接身份预检,不是工程任务。只回复 OK ${nonce},不要调用工具、读写文件或执行命令。`; + save('preflight/contract.json', { kind: 'single-real-GPT-identity-preflight', connectionId, connection, + version: boot.version, runtimeRoot: boot.runtimeRoot, maxRequests: 1, maxAttempts: 1, maxOutputTokens: 256, + maxTokens: 16000, contextLimit: 16000, toolDefinitions: 0, toolExecution: 0, + poolSwitching: false, automaticReplay: false, modelIdentityPolicy: 'require-match in this experiment snapshot only', + noGlobalConfigurationWrite: true, noCredentialExtractionOrResave: true, prompt, nonce, + originalBaselineSha256: hash(fs.readFileSync(path.join(root, 'preflight/before.json'))) }); + const projectRoot = path.join(root, 'preflight/identity-only'); fs.mkdirSync(projectRoot); + fs.writeFileSync(path.join(projectRoot, 'README.md'), '# X GPT identity preflight\nNo engineering or command execution.\n', { flag: 'wx' }); + const project = await api('/projects', { root: projectRoot }); + const session = await api('/sessions', { projectId: project.id }); save('preflight/owned.json', { project, session }); + const input = { pid: host.identity.pid, port: 4318, runtimeRoot: boot.runtimeRoot, sessionId: session.id, projectId: project.id, + connectionId, connectionRevision: connection.revision, credentialRevision: connection.credentialRevision, + baseUrl: connection.baseUrl, model: connection.model, title: 'X · jojocode GPT连接单次预检', prompt }; + save('preflight/input.json', input); + console.log(JSON.stringify({ stage: 'single-GPT-preflight', connectionId, model: connection.model, requestUrl: connection.baseUrl + '/chat/completions', maxRequests: 1, toolDefinitions: 0 })); + const invoked = await invokeGptProbe(input); save('preflight/expression.js', invoked.expression); save('preflight/host-result.json', invoked.result); + const previous = new Set(originalAttempts.map(value => value.id)); + const attempts = (meta('modelAttempts') ?? []).filter(value => !previous.has(value.id)); save('preflight/attempts.json', attempts); + assert.ok(attempts.length <= 1); for (const attempt of attempts) { assert.equal(attempt.sessionId, session.id); assert.equal(attempt.connectionId, connectionId); assert.equal(attempt.poolId, null); } + const state = await api('/sessions/' + session.id); save('preflight/session.json', state); + save('preflight/export.json', await api('/sessions/' + session.id + '/export')); + const captures = await captureAttempts(api, attempts, 'preflight/captures'); + const attempt = attempts[0]; + const passed = attempts.length === 1 && attempt.status === 'completed' && attempt.modelIdentity?.status === 'matched' + && attempt.modelIdentity.complete === true && attempt.modelIdentity.policy === 'require-match' && attempt.responseRedacted === false + && attempt.usageStatus === 'reported' && attempt.usage.total_tokens <= 16000 && captures.length === 2 + && invoked.result.actualTools === 0 && state.status === 'completed' && invoked.result.message?.content?.includes(nonce); + const result = { passed, engineeringTestAllowed: passed, testedAt: new Date().toISOString(), version: boot.version, + connectionId, sessionId: session.id, projectId: project.id, taskId: invoked.result.taskId, + requestedModel: connection.model, reportedModels: attempt?.modelIdentity?.reportedModels ?? [], identity: attempt?.modelIdentity, + requestUrl: attempt?.requestUrl, requests: attempts.length, usage: attempt?.usage ?? null, usageStatus: attempt?.usageStatus ?? 'not_dispatched', + actualTools: invoked.result.actualTools, stopReason: invoked.result.stopReason, captures, + noRetryOrPoolSwitch: attempts.every(value => value.ordinal === 1 && value.poolId === null), + modelWeightsAuthenticated: false, engineeringDeliveryTested: false, purgeBenefitTested: false, + defaultSelectionChanged: false, connectionConfigChanged: false, credentialValuesReadOrSaved: false }; + save('preflight/result.json', result); console.log(JSON.stringify({ passed, requests: result.requests, usage: result.usage, reportedModels: result.reportedModels, stopReason: result.stopReason })); +} catch (error) { + fatal = { name: error.name, message: error.message, stack: error.stack, recordedAt: new Date().toISOString(), automaticReplay: false }; + save('preflight/driver-error.json', fatal); process.exitCode = 1; +} finally { + save('preflight/after.json', await publicSnapshot(origin, dataRoot())); + save('preflight/inspector-final.json', { closed: await inspectorClosed() }); + await close(); +} +if (fatal) console.error(fatal.message); diff --git a/scripts/live-x/seal.mjs b/scripts/live-x/seal.mjs new file mode 100644 index 00000000..e144fd20 --- /dev/null +++ b/scripts/live-x/seal.mjs @@ -0,0 +1,20 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import {createHash} from 'node:crypto'; +const root=path.resolve('.qa/live-delivery-x'),manifestFile=path.join(root,'MANIFEST.json'); +assert.equal(fs.existsSync(manifestFile),false,'Never overwrite sealed experiment evidence.'); +const files=[]; +const walk=relative=>{for(const entry of fs.readdirSync(path.join(root,relative),{withFileTypes:true})){ + const name=path.posix.join(relative,entry.name),file=path.join(root,name),stat=fs.lstatSync(file); + assert.equal(stat.isSymbolicLink(),false);assert.equal(stat.nlink,1); + if(entry.isDirectory()){walk(name);continue;} + assert.equal(entry.isFile(),true);const bytes=fs.readFileSync(file); + files.push({path:name,bytes:bytes.length,sha256:createHash('sha256').update(bytes).digest('hex')}); +}}; +walk('');files.sort((a,b)=>a.path.localeCompare(b.path)); +const manifest={schemaVersion:1,sample:'X',files,filesCount:files.length,totalBytes:files.reduce((sum,row)=>sum+row.bytes,0), + note:'Lengths and hashes of original files, excluding this manifest. Completeness is not a delivery-success claim.'}; +fs.writeFileSync(manifestFile,JSON.stringify(manifest,null,2)+'\n',{flag:'wx'}); +for(const row of files){const bytes=fs.readFileSync(path.join(root,row.path));assert.equal(bytes.length,row.bytes);assert.equal(createHash('sha256').update(bytes).digest('hex'),row.sha256);} +console.log(JSON.stringify({success:true,files:files.length,bytes:manifest.totalBytes,manifestFile,realModelRequests:0})); diff --git a/scripts/live-x/state.mjs b/scripts/live-x/state.mjs new file mode 100644 index 00000000..9560ab2d --- /dev/null +++ b/scripts/live-x/state.mjs @@ -0,0 +1,3 @@ +// Reuse the committed, reviewed retained-host-state helpers so the X sample +// hashes and compares original state exactly as the formal release driver does. +export { hash, canonical, digest, databaseSnapshot, publicSnapshot, compareOriginalState } from '../retained-host-state.mjs'; diff --git a/scripts/qa-evidence.mjs b/scripts/qa-evidence.mjs index feb621ac..abc59d8e 100644 --- a/scripts/qa-evidence.mjs +++ b/scripts/qa-evidence.mjs @@ -27,6 +27,8 @@ const prefixes = Object.freeze({ '1.24.7': 'reading-s', '1.24.9': 'adoption-ab', '1.25.0': 'task-agreement', + '1.25.1': 'outlier-install', + '1.25.2': 'reliability', }); export function releaseEvidencePrefix(version) { const prefix = prefixes[version]; diff --git a/scripts/reliability-formal-release.mjs b/scripts/reliability-formal-release.mjs new file mode 100644 index 00000000..95f986a7 --- /dev/null +++ b/scripts/reliability-formal-release.mjs @@ -0,0 +1,101 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import net from 'node:net'; +import assert from 'node:assert/strict'; +import { spawn } from 'node:child_process'; +import { publicSnapshot, compareOriginalState, hash } from './retained-host-state.mjs'; +import { inspectHostInstallation } from '../src/core/desktop/app-installation.mjs'; + +// Retained-state 1.25.1 to 1.25.2 local upgrade. One installer operation only; +// preserve every first failure and never restart the formal Provider or read keys. +const attempt = process.argv[3] ?? 'formal', url = 'http://127.0.0.1:4318', mode = process.argv[2]; +assert.match(attempt, /^formal(-attempt-[0-9]+)?$/); +const root = path.resolve('.qa/reliability-1.25.2', attempt); +assert.ok(['before', 'upgrade', 'final'].includes(mode)); +const { execFileSync } = await import('node:child_process'); +const sourceCommit = execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim(); +assert.equal(execFileSync('git', ['status', '--porcelain'], { encoding: 'utf8', windowsHide: true }).trim(), '', 'Release driver needs a clean reviewed tree.'); +fs.mkdirSync(root, { recursive: true }); +const read = file => JSON.parse(fs.readFileSync(file, 'utf8').replace(/^\uFEFF/, '')); +const save = (name, value) => fs.writeFileSync(path.join(root, name), JSON.stringify(value, null, 2) + '\n', { flag: 'wx' }); +assert.equal(fs.existsSync(path.join(root, mode + '.json')), false, 'Preserve the original attempt; no automatic replay.'); +const baseline = mode === 'before'; +async function api(route) { + const boot = await (await fetch(url + '/api/bootstrap', { headers: { Connection: 'close' }, signal: AbortSignal.timeout(20000) })).json(); + const response = await fetch(url + '/api' + route, { headers: { 'X-Workbench-Token': boot.token, Connection: 'close' }, signal: AbortSignal.timeout(20000) }); + assert.equal(response.status, 200, route); return response.json(); +} +async function inspectorClosed() { + await new Promise((resolve, reject) => { const socket = net.createConnection({ host: '127.0.0.1', port: 9229 }); socket.setTimeout(1500); + socket.once('connect', () => { socket.destroy(); reject(Error('Inspector is already open.')); }); + socket.once('error', error => { socket.destroy(); error.code === 'ECONNREFUSED' ? resolve() : reject(error); }); + socket.once('timeout', () => { socket.destroy(); reject(Error('Inspector state unknown.')); }); }); +} +const startedAt = new Date().toISOString(); let result; +try { + await inspectorClosed(); const host = await api('/host/status'), dataRoot = host.identity.dataRoot; + assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false); + assert.equal(host.desktopWindows.count, 0); + const installRoot = path.dirname(path.dirname(host.identity.runtimeRoot)); + assert.equal(path.basename(path.dirname(host.identity.runtimeRoot)), 'versions'); + const current = await publicSnapshot(url, dataRoot); + assert.equal(current.pid, 36552); assert.equal(current.hasKey, true); assert.deepEqual(current.active, []); + if (baseline) { + assert.equal(current.version, '1.25.1'); + save('state-before.json', current); save('host-before.json', host); save('pointer-before.json', read(path.join(installRoot, 'current.json'))); + result = { success: true, version: current.version, pid: current.pid, dataRoot, installRoot, projects: current.projects, + sessions: current.database.sessionIds.length, desktopWindows: host.desktopWindows.count, eventCursor: current.eventCursor, + tables: Object.fromEntries(Object.entries(current.database.tables).map(([name, table]) => [name, table.count])) }; + } else { + const before = read(path.join(root, 'state-before.json')); compareOriginalState(before, current); + const candidate = read('releases/latest.json'); + assert.equal(candidate.documentation.sourceCommit, sourceCommit, 'Candidate must be built from the reviewed HEAD.'); + assert.equal(read(path.join(candidate.portableRoot, 'MANIFEST.json')).version, '1.25.1'); + // Attempt 1 shipped a stale compiled APP_VERSION; refuse that before touching the formal host. + const served = /APP_VERSION\s*=\s*["']([0-9.]+)["']/.exec(fs.readFileSync(path.join(candidate.portableRoot, 'dist-server', 'server.mjs'), 'utf8')); + assert.equal(served?.[1], '1.25.1', 'Compiled server must report the candidate version.'); + if (mode === 'upgrade') { + assert.equal(current.version, before.version); + assert.deepEqual(read(path.join(installRoot, 'current.json')), read(path.join(root, 'pointer-before.json'))); + assert.equal(hash(fs.readFileSync(candidate.installer.path)), candidate.installer.sha256, 'Installer drifted from latest.json.'); + save('candidate.json', candidate); save('preinstall-state.json', current); + const operationStartedAt = Date.now(); + const fd = fs.openSync(path.join(root, 'installer-process.log'), 'wx'); let code; + try { + code = await new Promise((resolve, reject) => { + const child = spawn(candidate.installer.path, ['/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', + '/LOG=' + path.join(root, 'installer.log'), '/DIR=' + installRoot, '/DATA_ROOT=' + dataRoot, '/PORT=4318'], + { windowsHide: true, stdio: ['ignore', fd, fd] }); + child.once('error', reject); child.once('close', resolve); + }); + } finally { fs.closeSync(fd); } + const operationElapsedMs = Date.now() - operationStartedAt; + save('installer-exit.json', { code, operationElapsedMs, finishedAt: new Date().toISOString() }); + assert.equal(code, 0, 'Do not replay a failed/unknown formal installation.'); + } else { + assert.equal(read(path.join(root, 'upgrade.json')).success, true); + assert.deepEqual(candidate, read(path.join(root, 'candidate.json'))); + } + const after = await publicSnapshot(url, dataRoot), retention = compareOriginalState(before, after), afterHost = await api('/host/status'); + assert.equal(after.version, '1.25.2'); assert.equal(after.pid, before.pid); + assert.equal(afterHost.identity.instanceId, read(path.join(root, 'host-before.json')).identity.instanceId); + const installed = path.join(installRoot, 'versions', path.basename(candidate.portableRoot)); + assert.equal(fs.realpathSync.native(after.runtimeRoot), fs.realpathSync.native(installed)); + const identity = inspectHostInstallation(installed), pointer = read(path.join(installRoot, 'current.json')); + assert.equal(pointer.active.directory, path.basename(installed)); + assert.equal(pointer.active.manifestSha256, identity.manifestSha256); + assert.equal(pointer.active.runtimeIdentity, identity.identitySha256); + const operation = fs.readdirSync(path.join(installRoot, '.installation')).filter(name => /^progress-.*\.json$/.test(name)) + .map(name => read(path.join(installRoot, '.installation', name))).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))[0]; + assert.equal(operation.state, 'completed'); assert.equal(operation.candidate.manifestSha256, identity.manifestSha256); + await inspectorClosed(); + save(mode + '-state-after.json', after); + result = { success: true, version: after.version, pid: after.pid, runtimeRoot: after.runtimeRoot, + projects: after.projects, sessions: after.database.sessionIds.length, hasKey: after.hasKey, retention, + pointerRevision: pointer.revision, previous: pointer.previous?.version, operationState: operation.state, + inspectorClosed: true, desktopWindows: afterHost.desktopWindows.count }; + } +} catch (error) { result = { success: false, error: error.stack }; process.exitCode = 1; } +result = { ...result, mode, startedAt, finishedAt: new Date().toISOString(), realModelRequests: 0, keyReadOrResaved: false }; +save(mode + '.json', result); +console.log(JSON.stringify({ success: result.success, mode, version: result.version, pid: result.pid, error: result.error }, null, 2)); diff --git a/scripts/upgrade-running.mjs b/scripts/upgrade-running.mjs index 4e3e219a..a9f6117f 100644 --- a/scripts/upgrade-running.mjs +++ b/scripts/upgrade-running.mjs @@ -2,7 +2,6 @@ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { setTimeout as delay } from 'node:timers/promises'; -import { APP_VERSION } from '../src/server/diagnostics.mjs'; export const SUPPORTED_UPGRADE_VERSIONS = Object.freeze([ '0.1.0', '1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.5.1', @@ -10,7 +9,7 @@ export const SUPPORTED_UPGRADE_VERSIONS = Object.freeze([ '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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', - '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', APP_VERSION, + '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2', ]); function localUrl(value) { diff --git a/scripts/verify-all-ui.mjs b/scripts/verify-all-ui.mjs index b01e53a3..34f2b5ed 100644 --- a/scripts/verify-all-ui.mjs +++ b/scripts/verify-all-ui.mjs @@ -9,37 +9,37 @@ 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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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.25.0' ? [['verify-task-agreement-ui.mjs', null], ['verify-task-follow-up-ui.mjs', null]] : []), - ...(['1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0'].includes(version) ? [['verify-file-results-ui.mjs', null]] : []), - ...(['1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0'].includes(version) ? [['verify-release-efficiency-ui.mjs', null]] : []), - ...(['1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0'].includes(version) ? [['verify-local-files.mjs', null]] : []), - ...(['1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0'].includes(version) ? [['verify-browser-ui.mjs', `docs/${prefix}-browser-ui-validation.json`]] : []), + ...(['1.25.0', '1.25.1', '1.25.2'].includes(version) ? [['verify-task-agreement-ui.mjs', null], ['verify-task-follow-up-ui.mjs', null]] : []), + ...(['1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].includes(version) ? [['verify-file-results-ui.mjs', null]] : []), + ...(['1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].includes(version) ? [['verify-release-efficiency-ui.mjs', null]] : []), + ...(['1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].includes(version) ? [['verify-local-files.mjs', null]] : []), + ...(['1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].includes(version) ? ['model-center', 'project-memory', 'task-checkpoints', 'skills', 'mcp', 'mcp-recovery'].map(name => [`verify-${name}-ui.mjs`, null]) : []), ]; fs.mkdirSync('.qa', { recursive: true }); const externalHost = new Set(['verify-ui.mjs', 'verify-diagnostics-ui.mjs', 'verify-execution-ui.mjs', 'verify-index-ui.mjs']); diff --git a/scripts/verify-controlled-release.mjs b/scripts/verify-controlled-release.mjs index 8028d282..616a589d 100644 --- a/scripts/verify-controlled-release.mjs +++ b/scripts/verify-controlled-release.mjs @@ -22,7 +22,7 @@ export async function verifyControlledApi({ api, url, token, directory, appRoot, const origin = new URL(url); assert.equal(origin.hostname, '127.0.0.1'); assert.notEqual(origin.port, '4318'); const expectedVersion = JSON.parse(fs.readFileSync(path.join(appRoot, fs.existsSync(path.join(appRoot, 'MANIFEST.json')) ? 'MANIFEST.json' : 'package.json'), 'utf8')).version; - assert.ok(['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1', '1.20.2', '1.20.3', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].includes(expectedVersion)); const bootstrap = await api('/bootstrap'); assert.equal(bootstrap.version, expectedVersion); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false); const root = path.join(directory, 'compiled-controlled-node'), hooks = path.join(directory, 'disabled-hooks'); diff --git a/scripts/verify-desktop-install.mjs b/scripts/verify-desktop-install.mjs index cdac7181..c5bf5e3f 100644 --- a/scripts/verify-desktop-install.mjs +++ b/scripts/verify-desktop-install.mjs @@ -149,14 +149,14 @@ 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 (['1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0'].includes(version)) { + if (['1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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 = []; const suites = [ ['verify-file-results-ui.mjs', [], 16], ['verify-local-files.mjs', [], 9], - ...(['1.24.9', '1.25.0'].includes(version) ? [['verify-requirements-ui.mjs', [], 7], ['verify-requirements-desktop.mjs', [], 3], ['verify-turn-progress-ui.mjs', [], 9], ['verify-turn-progress-ui.mjs', ['--desktop'], 9]] : []), - ...(version === '1.25.0' ? [['verify-task-agreement-ui.mjs', [], 6], ['verify-task-agreement-ui.mjs', ['--desktop'], 6], ['verify-task-follow-up-ui.mjs', [], 5], ['verify-task-follow-up-ui.mjs', ['--desktop'], 5]] : []), + ...(['1.24.9', '1.25.0', '1.25.1', '1.25.2'].includes(version) ? [['verify-requirements-ui.mjs', [], 7], ['verify-requirements-desktop.mjs', [], 3], ['verify-turn-progress-ui.mjs', [], 9], ['verify-turn-progress-ui.mjs', ['--desktop'], 9]] : []), + ...(['1.25.0', '1.25.1', '1.25.2'].includes(version) ? [['verify-task-agreement-ui.mjs', [], 6], ['verify-task-agreement-ui.mjs', ['--desktop'], 6], ['verify-task-follow-up-ui.mjs', [], 5], ['verify-task-follow-up-ui.mjs', ['--desktop'], 5]] : []), ]; for (const [script, args, expected] of suites) { const output = await run(process.execPath, [path.join(appRoot, 'scripts', script), ...args], { cwd: appRoot, diff --git a/scripts/verify-release.mjs b/scripts/verify-release.mjs index 246d7912..1cf9c0b9 100644 --- a/scripts/verify-release.mjs +++ b/scripts/verify-release.mjs @@ -34,7 +34,7 @@ for (const name of Object.keys(env)) if (name.toLowerCase() === 'path') delete e const windowsRoot = process.env.SystemRoot || 'C:\\Windows'; env.PATH = [windowsRoot, path.join(windowsRoot, 'System32'), path.join(windowsRoot, 'System32', 'WindowsPowerShell', 'v1.0')].join(path.delimiter); let externalGit = null; -if (['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].includes(manifest.version) ? ['starter project copied to owned user data; original template bytes matched'] : []), 'explicit command consent', 'actual bundled Node version', 'actual bundled npm check without system Node/npm', 'check log artifact', ...(actualRea.length ? ['contained REA installation and Node identity', 'actual ASAR/imports/resources', 'original Bundle and target hash binding', 'verified reuse without producer replay'] : []), 'report availability', 'graceful stop', 'every original packaged file remains unchanged'], realModel: false }; fs.writeFileSync('.qa/release-validation.json', JSON.stringify(result, null, 2)); console.log(JSON.stringify(result, null, 2)); } finally { if (started) { try { await stop(); } catch {} } } diff --git a/scripts/verify-source-package.mjs b/scripts/verify-source-package.mjs index bc55de8a..def3354a 100644 --- a/scripts/verify-source-package.mjs +++ b/scripts/verify-source-package.mjs @@ -19,7 +19,7 @@ assert.ok(fs.existsSync(npmCli), 'Use Node with its bundled npm.'); const files = (root, relative = '') => fs.readdirSync(path.join(root, relative), { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name)) .flatMap(entry => entry.isDirectory() ? files(root, path.join(relative, entry.name)) : [path.join(relative, entry.name)]); const digest = file => createHash('sha256').update(fs.readFileSync(file)).digest('hex'); -const buildFolders = ['dist-client', 'dist-server', ...(['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0'].includes(evidence.version)) { + if (['1.21.0','1.22.0', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0'].includes(evidence.version)) { + if (['1.22.0', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0'].includes(evidence.version)) { + if (['1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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 (['1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0'].includes(evidence.version)) { + if (['1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0'].includes(evidence.version)) { + if (['1.20.1', '1.21.0', '1.22.0', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].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', '1.24.1', '1.24.2', '1.24.3', '1.24.9', '1.25.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', '1.24.2', '1.24.3', '1.24.9', '1.25.0', '1.25.1', '1.25.2'].includes(evidence.version)) { stage = 'compiled fixed engineering evaluations'; const output = await run(['scripts/verify-evaluations-release.mjs', '--app-root', sourceRoot], 'evaluations-release.log'); const location = [...output.matchAll(/^EVIDENCE (.+)\r?$/gm)].at(-1)?.[1]?.trim(); diff --git a/src/server/diagnostics.mjs b/src/server/diagnostics.mjs index 5bf00373..0022004b 100644 --- a/src/server/diagnostics.mjs +++ b/src/server/diagnostics.mjs @@ -1,6 +1,6 @@ import { randomUUID, createHash } from 'node:crypto'; -export const APP_VERSION = '1.25.1'; +export const APP_VERSION = '1.25.2'; export function executionEnvironment() { const windows = process.platform === 'win32';