test(m4): verify live protocols and autonomous Node delivery

This commit is contained in:
Agent Workbench Dev
2026-11-11 23:29:52 +08:00
parent 7152d654e3
commit b8eca3b5a9
12 changed files with 2610 additions and 1 deletions
+2
View File
@@ -1,5 +1,7 @@
# Agent Workbench项目执行规范
2026-11-11 M4真实兼容与新Node阶段完成:正式1.25.13/63892未重启。三线六次真实预检/1227报告tokens/0unknown,DeepSeek官方Chat和GPT代理Responses完整matched;Claude Messages代理两次自报gpt-6.1-sol且目录未列claude-opus-5-5,必填max_tokens=128000已发送但真实Claude身份未验。DeepSeek新Node自主十请求180463tokens/0unknown、原9/9/build/三源码限定Git3cd994ff、owner全部index保持;内置delivery和最终报告已completed,七不同文件读取/零同字节范围重复、122112cacheRead仅算观察。原53527行/127导出/5244工件和377旧请求exact,config124→126/registry176→178及前插/诊断/序列明确重算;外部“你好”一新会话/一请求单列,两个审计失败保持,见[阶段验收](docs/QA-M4-COMPATIBILITY-NODE.md)和[机器记录](docs/m4-compatibility-node-2026-11-11.json)。下一独立React,完整成功后Python,再另冻Purge;旧异常/Mnemo生产与语义/物理手机/长期/真实预留边界/Purge收益unknown保持。不读真实Key、不委派、不续旧样本;阶段限定提交与既有普通增量GitAtlas推送授权有效。下方M4的0真实请求为阶段2原时点。
2026-11-11 当前进入M4:正式1.25.13/63892已重新公开核对为空闲、unrestricted/passthrough/full。用户在模型中心恢复DeepSeek官方、Claude Messages代理及GPT Responses代理,原无凭据观察保留;新M4计划和驱动在docs/M4-LIVE-BASELINE-PLAN.md。最后隔离驱动11边界及固定Node5请求、原9/9/build/限定Git与owner全部index、原字节下载和恢复通过,前两断言失败/第三原通过保持,见docs/m4-driver-validation-2026-11-11.json。当前0真实请求,先限定提交后另冻真实兼容/工程,不改1.25.13或续旧样本。AD现成任务只读来源在docs/integration/WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.json;46允许文件/原报告in_progress、终端Git、两个原日志描述符缺项及非原生v2保持,不向源线程回信。不读真实Key、不委派,既有普通增量GitAtlas推送授权保持。
2026-11-11 1.25.13 已正式交付:产品 e306f40c、发行来源35a6d6d9;1399输入/30编译独立clean npm ci重建exact,186相关/4打包、实际Inno11/11、F跨版/兼容恢复7/7、Mnemo合成后端24/24与安装副本网页/Electron各4组/10图、基础文件9/9通过。唯一正式Setup351789ms成功,保留原PID63892/instance/Provider与Key存在状态;102项目/127会话/8741记录/22085事件及outbox/5244工件、374旧请求精确迁移,原字段/全部原字节保持;仅新增公开规格/契约/账本字段与两项MCP导出字段逐项核验。正式两端1280/390四图实看、final复核和9229关闭通过,新版桌面已正常恢复。见[验收](docs/QA-MNEMO-RELEASE-1.25.13.md)、[机器身份](docs/mnemo-1.25.13-release-identity.json)。782份811582693字节选择性证据清单611c4c40封存,首失败/旧封存保持。源码/打包修复/验收1e309700已普通增量推送并与远端及fetch逐SHA一致,见[回执](docs/gitatlas-mnemo-1.25.13-push.json);完成接续与回执另提交并再次核对;下方“尚未发行”按旧时点理解。Mnemo入口工具箱→项目记忆→Mnemo项目记忆桥,默认关闭;本次凭据只存宿主内存、重启需重新授权,真实生产绑定/语义收益/物理iPhone/Purge收益未验。下一M4另冻新真实兼容/工程基线,不续旧任务、不读真实Key,不因本次合成通过改写历史异常或收益unknown。
+3 -1
View File
@@ -33,4 +33,6 @@
原版 Purge AB-off/AB-on/BA-on/BA-off 必须在当前目标线路有完整可比工程成功基线后另冻插件/宿主/输入/身份。旧 AG 三次网络失败和唯一 ba-off 成功不改写。前置不足则不执行,收益继续 unknown。
当前阶段:1、2 已完成。最终隔离 m4-driver-40fb93c8 在 1.25.13 正式处理器的隔离宿主上通过 11 边界及固定模型 Node 的五请求实际执行、原九测试/build/限定 Git 与 owner 全部 index,见 [机器记录](m4-driver-validation-2026-11-11.json)。前三根原件及两次失败保持;原件捕获现为 download=1 逐原字节核对。当前 0 真实请求,先限定提交,再冻结并推进 3–6。
阶段2原时点:最终隔离 m4-driver-40fb93c8 在 1.25.13 正式处理器的隔离宿主上通过 11 边界及固定模型 Node 的五请求实际执行、原九测试/build/限定 Git 与 owner 全部 index,见 [机器记录](m4-driver-validation-2026-11-11.json)。前三根原件及两次失败保持;原件捕获现为 download=1 逐原字节核对。当时 0 真实请求,随后以 `7152d654` 限定提交并另冻正式原状态。
当前阶段:3、4及5的Node已完成,见[阶段验收](QA-M4-COMPATIBILITY-NODE.md)。三线六次新预检/1227报告tokens/0unknown;Claude两项身份mismatch且目录缺项,不进入工程。DeepSeek新Node十请求180463tokens/0unknown,原9/9/build/限定Git及内置交付completed通过。原127导出/5244工件/53527行保持;外部一新“你好”会话/一请求单列,每行和原件明确SHA核对,原两次审计失败保留。阶段限定提交后继续独立React、完整成功后Python;Purge收益仍须另冻,不改1.25.13或续旧实验。
+2
View File
@@ -1,5 +1,7 @@
# 1.25 计划:任务要求与交付复核
2026-11-11 M4真实兼容与Node阶段已验收:三线六预检/1227tokens,DeepSeek官方与GPT Responses代理通过;Claude代理请求claude-opus-5-5却自报gpt-6.1-sol,目录也未列选定型号,失败不改签。DeepSeek新Node自主十请求180463tokens/0unknown、原9/9/build/三源码Git与内置completed通过。原127会话/5244工件及每行保持,外部新增一会话/一请求和两审计失败单列,见[验收](QA-M4-COMPATIBILITY-NODE.md)。下一独立React、Python,Purge另冻可比实验;真实语义/缓存因果/重复读普遍改善与历史未知继续保留,未重打或重启1.25.13。
2026-11-11 当前:M3+B4b已正式交付1.25.13/source35a6d6d9,独立1399输入/30编译、186相关/4打包、实际安装11/11/跨版7/7及Mnemo后端24/24/两端各4组通过。唯一正式Setup351789ms、原PID63892/全部原行/127导出原字段/5244工件保持,正式四图和final核对通过;[验收](QA-MNEMO-RELEASE-1.25.13.md)、[身份](mnemo-1.25.13-release-identity.json)。源码/验收1e309700已普通增量推送且远端/fetch逐SHA一致,见[回执](gitatlas-mnemo-1.25.13-push.json);下一M4新真实基线;真实Mnemo生产绑定/语义及Purge收益未验证,历史异常完整保留。下方未提交/未发行按旧时点理解。
2026-11-08接续:M3隔离迁移/恢复源码后,默认关闭的B4b Mnemo单项目记忆桥已完成25项原生工程证据、最后相关104/104、916输入/30编译及网页/实际Electron/伴随HTTPS验收,见[报告](QA-B4B-MNEMO-NATIVE.md)。M3+B4b仍为未提交工作树,统一发行和正式升级未做;真实模型、长期、重复读/R-W边界及Purge收益unknown保持,历史异常不改写。下一M3最终产品commit/版本/源码程序包/InnoSetup及独立安装验收,下方当前顺序按历史时点理解。
+44
View File
@@ -0,0 +1,44 @@
# M4 真实兼容与 Node 工程阶段验收
2026-11-11,正式 1.25.13/PID 63892,冻结驱动提交 `7152d654`。本阶段真实兼容六次请求、新 Node 工程十次请求,共 181690 报告 tokens、0 unknown。Node 自主交付通过;Claude 代理的真实型号一致性未通过。React、Python 和 Purge 尚未由本阶段验证。
机器记录:[m4-compatibility-node-2026-11-11.json](m4-compatibility-node-2026-11-11.json)。新原件根 `.qa/m4-live-baseline-2026-11-11/`,原无凭据观察、四轮隔离驱动和全部历史样本保持。
## 真实供应商兼容
用户在模型中心恢复三个凭据后,公开确认 DeepSeek 官方 Chat、Claude 代理 Messages、GPT 代理 Responses;三条连接均保持原定义、streaming=true、空原生参数及 credentialRevision=1。每连接一次目录预览、文本/工具各一次新会话请求;三个 DNS/TLS 诊断均通过,诊断自身 0 HTTP/模型请求、无凭据访问。目录未应用。
| 连接与协议 | 目录 | 文本/工具 | 实际请求输出字段 |
| --- | --- | --- | --- |
| DeepSeek 官方,deepseek-flash,Chat | 完整 2 型号,选定型号在内 | 两项完整、matched,97/430 tokens | 无主动输出限额 |
| apikey-Claude,claude-opus-5-5,Messages | 完整 11 型号,选定型号不在内 | 两项完整,但都自报 gpt-6.1-sol,193/266 tokens | 官方必填 max_tokens=128000 |
| apikey,gpt-6.1-sol,Responses | 完整 11 型号,选定型号在内 | 两项完整、matched,78/163 tokens | 无主动输出限额 |
六响应均实际收到完整 SSE 和报告 usage,工具预检只观察原调用、0 工具执行。Claude 原来的 missing max_tokens 未复现,但身份 mismatch 和目录缺项保留,不能据此宣称真实 Claude 兼容通过。没有改型号、改返回身份或自动重试。相同型号标识也不认证上游模型权重;媒体和长期稳定性未在本切片测试。
## 新 Node 自主交付
按预声明优先级选择通过全部预检的 DeepSeek 官方连接,独立复制原 `benchmarks/live-delivery-v1/node`,保留原九项测试、构建和配置。模型自行读取七个不同文件、修改三源码、执行检查并完成限定 Git;没有人工批准、监督续接或实现答案。
- Project `9bc42831-29a8-4a4d-8638-24366d7cc10d`,Session `cc136ea3-8407-4f69-8e94-69157553ebcd`。
- Task `8249fea9-3613-4830-b016-53446019c476`,Run `64fbbda1-036b-4e2a-bd04-174504e31e53`。
- 十请求全部 completed/matched,input 171023、output 9440、total 180463,0 unknown;实际执行 84451ms。
- 独立原九测试 9/9、build 退出 0;只提交 `src/amount.mjs`、`src/summary.mjs`、`src/report.mjs`,提交字节等于最终文件。
- Git `3cd994ff22c1658cbe4c26a7e317ce6b7b314745`;owner 全部原字节、原暂存和未跟踪状态保持,全部保护文件 index 未变。
- 内置 delivery `1d2a6e2a-46ea-4217-b0a9-d8f717bfe36d` 为 completed、同一 Git;三份原 JSON 报告及对应 Markdown 分别保留,前两份任务仍 running,最后任务 completed,不覆盖早报告或旧 AD 的 in_progress。
十份原请求均未主动添加输出限额;工具 schema 及原前缀证据按请求保存。上游报告 cacheRead 122112、uncached 48911、reasoning 6113;cacheWrite 十请求均 unknown,不能写成 0。七次 read_file 中同 SHA/同范围重复读取为 0。本次单样本只能证明这些观察,缓存因果收益和普遍重复读取改善继续未验。
## 原状态与首次审计失败
首次审计发现批次期间另一条“你好”新会话,未在 M4 声明范围内,严格归属检查停止。只读封存其显式 ID、每行 SHA、七工件、原请求/响应和导出;一请求 4301 报告 tokens、0 unknown、身份 mismatch,单列外部新增,不归入 M4 请求或交付。不推断操作人,不续跑其任务。
第二次审计误查询不存在的 `model_attempts.project_id`,退出;按真实 schema 改为既有 sessions 关系查询。两次失败结果和各自 after 快照保持,未修改产品或数据库。第三次只读审计 `audits/node-2e02c1a0-cda2-4863-a962-8e6b54771bfc` 通过。
原 102 项目、127 会话、377 请求、5244 工件及 53527 原行/字段和 schema 核对通过。项目前插位置 +4、configRevision 124→126、registry 176→178、三已知网络诊断追加和两序列按明确增量重算原 SHA;其他原字段、全部原导出和工件字节 exact。新增为 M4 四项目/七会话/十六请求,另上述外部一会话/一请求;合计新增 782 事件及 outbox、196 records、17 model_attempts、118 工件,归属逐项核对。
原 PID/instance、空闲、9229 关闭通过;原选择恢复 Claude 单成员池,全部连接定义和原池保持。凭据行只比较 SHA,未读取、解密、复制或重存 Key。产品源码、正式发行和服务未重启。
## 回顾与下一阶段
新的真实 Node 成功与内置 Git/结束报告一致,说明 1.25.13 的此工程链路已实际闭环。审计新增识别和真实数据库列修正仅属于本批驱动,失败原件继续可核对。提交此阶段后另开 React,再按完整成功前置开 Python。原网络异常、unknown、输出截断、R/W v2 真机边界、Mnemo 生产语义、物理 iPhone、长期与 Purge 收益保持原结论;Purge 必须另冻可比基线及插件/宿主来源。
+2
View File
@@ -1,5 +1,7 @@
# Tianshu 研究后的 Agent Workbench 采用计划
2026-11-11 M4已完成真实兼容和新Node:六预检1227tokens/0unknown,DeepSeek官方和GPT Responses代理通过,Claude代理身份mismatch/目录缺项原证据保持。DeepSeek自主Node十请求180463tokens/原9/9/build/限定Git及内置最终交付通过,原127导出/5244工件/53527行与全部旧事实核对;外部一“你好”会话/一请求和两审计失败分别保存。见[阶段验收](QA-M4-COMPATIBILITY-NODE.md)。下一独立React、成功后Python,再按插件/宿主和可比成功基线另冻Purge;缓存/重复读普遍收益、Mnemo生产语义及历史unknown仍未验。1.25.13未重启或重新发行,下方“下一M4”为先前时点。
2026-11-11 当前:M3+B4b已正式交付1.25.13/source35a6d6d9,独立1399输入/30编译、186相关/4打包、实际Inno11/11/F跨版7/7及Mnemo24后端/两端工程路径通过。唯一正式Setup成功,原PID63892/102项目/127会话/5244工件及旧历史保持,正式四图和final核对通过;见[验收](QA-MNEMO-RELEASE-1.25.13.md)。源码/验收1e309700已普通增量推送且远端/fetch逐SHA一致,见[回执](gitatlas-mnemo-1.25.13-push.json);下一M4另冻新真实基线,不续旧实验;Mnemo生产绑定/真实语义/重复读/R-W边界/Purge收益unknown保持。下方未提交/未发行为原时点。
2026-11-08接续:M3隔离迁移/恢复实现后,B4b默认关闭的Mnemo单项目记忆桥已完成原生工程验收,25项证据、最后相关104/104、916输入/30编译及两端/伴随HTTPS见[验收](QA-B4B-MNEMO-NATIVE.md)。M3+B4b仍未提交或统一发行,本轮未正式操作、真实模型或Purge验证;原失败和历史未知保持。下一M3最终产品身份/源码程序包/InnoSetup及独立安装验收。下方最新/下一均按其历史时点理解。
File diff suppressed because it is too large Load Diff
+2
View File
@@ -1455,3 +1455,5 @@ New API学习:305正文/201嵌入定义已分别审读;来源清单与逐篇
2026-11-11 M4:首次公开API核对正式1.25.13/63892仍空闲,权限/透传/累计0保持;六启用连接当前都hasKey=false,不能套用旧发行时“凭据保留”作为当前可请求证明。已留新observation原件并异步请求界面恢复。旧AD驱动固定1.25.8、旧metadata账本、未允许Messages官方必填输出字段,需要新驱动,不能直接续旧claim或改旧报告。原基线9/9、React9、Python10仅用作未改输入,不拿历史成功代签当前模型。
2026-11-11 M4:恢复三连接后,Claude官方必填max_tokens在隔离真实wire为128000;Chat/Responses默认无主动上限。新版公开账本取消状态为interrupted,legacy-default revision只是configRevision投影,原字段必须精确核对后单列增量。捕获原件应使用现有download=1原字节接口,JSON字符分页会无法保存非法UTF8;最终边界与工程驱动通过且自有宿主正常关闭,0真实模型。AD只读原报告e7a67a74/bdb282fc逐SHA复制,46文件和两个旧描述符缺项、结构化acceptance空数组/in_progress/终端Git分列,未生成原生v2或扩大授权。
2026-11-11 M4真实阶段:Claude必填max_tokens=128000已真实发送,missing-field未复现;上游文本/工具都自报gpt-6.1-sol,完整目录11型号未列claude-opus-5-5,因此不能说真实Claude兼容通过。DeepSeek Node自主三文件/9测试/build/Git和内置最终报告闭环,七不同文件读取无同SHA范围重复;cacheRead122112、uncached48911、reasoning6113,cacheWrite十请求unknown,不将单样本观察升级为因果收益。外部新你好会话不是M4请求;53527原行和127原导出/5244原工件核对,model_attempts的项目归属来自sessions关系,无project_id列,驱动误查原失败保持。
+2
View File
@@ -2209,3 +2209,5 @@ New API研究阶段一234b76cc已提交;阶段二逐篇305正文/201接口全
2026-11-11 M4第三隔离驱动m4-driver-490968ae完整通过:10预检边界、5固定模型工程请求/840合成tokens,原9/9/build/限定Git和owner全部index、准确legacy公开修订恢复通过,正式1.25.13处理器的隔离宿主已正常关闭。随后复核原件捕获发现JSON字符分页不能保存非法UTF8原字节,驱动改用现有download=1原字节通路,追加非法UTF8夹具并验证最终捕获路径;不改产品解析或协议实现,前三原根保持。
2026-11-11 M4最终驱动m4-driver-40fb93c8:11边界(含非法UTF8原字节)和Node固定模型5请求/840合成tokens通过;原9/9/build/限定Gitdb0840a3、owner全部index和真实配置恢复通过,三协议/原错误/中断unknown原件完整。docs/m4-driver-validation-2026-11-11.json逐四根结果SHA/最终9脚本/正式server bundle记录,0真实模型,未重打包或正式重启。只读来源r2已生成46允许文件/两原报告/两个日志描述符缺项,不补签v2、原in_progress或旧失败。阶段2限定提交后启动真实冻结。
2026-11-11 M4真实兼容六新请求完成,三DNS/TLS诊断通过且零HTTP/模型请求;两协议passed/matched,Claude两mismatch和目录缺项保留。新Node十请求180463tokens/0unknown,84451ms、原9/9/build/三源码Git3cd994ff22c1658cbe4c26a7e317ce6b7b314745,owner全部原index保持;内置delivery1d2a6e2a completed及最后原报告completed,三早晚报告分别捕获。首审计node-4e580c59遇外部你好一会话/一请求而失败;显式只读记录其ID/每行SHA/七工件/4301tokens/mismatch后,第二node-e3388cf2因不存在的ledger.project_id失败,未改数据。按实际sessions关系修驱动,第三node-2e02c1a0完整原53527行/127导出/5244工件/377请求和公开配置、选择恢复通过,config124→126/registry176→178等已声明增量准确重算,9229关闭。阶段文档生成;未修改产品源码或重启1.25.13,下一独立React。
+138
View File
@@ -0,0 +1,138 @@
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { randomUUID } from 'node:crypto';
import { DatabaseSync } from 'node:sqlite';
import { publicSnapshot, digest } from '../retained-host-state.mjs';
import { root, origin, read, save, client, sha, compareConfig, compareConnectionDefinitions } from './common.mjs';
import { inspectorClosed } from './inspector.mjs';
const stage = process.argv[2]; assert.ok(['node', 'react', 'python', 'final'].includes(stage));
const prefix = 'audits/' + stage + '-' + randomUUID(), frozen = read('frozen.json'), compatibility = read('compatibility/result.json');
const engineering = ['node', 'react', 'python'].filter(kind => fs.existsSync(path.join(root, kind, 'result.json'))).map(kind => ({ kind, ...read(kind + '/result.json') }));
const sessionIds = new Set(compatibility.results.flatMap(value => value.preflights.map(row => row.sessionId)).concat(engineering.map(value => value.sessionId).filter(Boolean)));
const projectIds = new Set(compatibility.results.map(value => value.projectId).concat(engineering.map(value => value.projectId).filter(Boolean)));
const external = fs.existsSync(path.join(root, 'external-observations/declared.json')) ? read('external-observations/declared.json').sources.map(source => {
assert.match(source.path, /^external-observations\/[a-f0-9-]{36}\/index\.json$/);
assert.equal(sha(fs.readFileSync(path.join(root, source.path))), source.sha256);
const value = read(source.path); assert.equal(value.m4Engineering, false); assert.equal(value.requestsReplayed, false);
assert.equal(sessionIds.has(value.sessionId), false); assert.equal(frozen.baseline.database.sessionIds.includes(value.sessionId), false);
assert.ok(frozen.originalProjects.some(project => project.id === value.projectId)); return value;
}) : [];
const allSessionIds = new Set([...sessionIds, ...external.map(value => value.sessionId)]);
assert.equal(allSessionIds.size, sessionIds.size + external.length, 'No duplicate declared external sessions.');
const sessionProjects = new Map(compatibility.results.flatMap(value => value.preflights.map(row => [row.sessionId, value.projectId]))
.concat(engineering.filter(value => value.sessionId).map(value => [value.sessionId, value.projectId]), external.map(value => [value.sessionId, value.projectId])));
const diagnosticIds = new Set(compatibility.results.map(value => read('compatibility/' + value.connectionId + '/network-start.json').job.id));
const expectedRequests = compatibility.requests + engineering.reduce((sum, value) => sum + (value.requests ?? 0), 0);
const externalRequests = external.reduce((sum, value) => sum + value.requests, 0), databaseRequests = expectedRequests + externalRequests;
const { api, boot, close } = await client(); let result;
try {
await inspectorClosed(); const host = await api('/host/status'); assert.equal(host.activity.active, false);
assert.equal(host.identity.pid, frozen.host.identity.pid); assert.equal(host.identity.instanceId, frozen.host.identity.instanceId); assert.equal(boot.version, '1.25.13');
const after = await publicSnapshot(origin, host.identity.dataRoot); save(prefix + '/after.json', after); const before = frozen.baseline;
assert.deepEqual(new Set(boot.projects.filter(value => !frozen.originalProjects.some(old => old.id === value.id)).map(value => value.id)), projectIds);
assert.deepEqual(boot.projects.filter(value => !projectIds.has(value.id)), frozen.originalProjects);
assert.deepEqual(after.database.sessionIds.filter(id => !before.database.sessionIds.includes(id)).sort(), [...allSessionIds].sort());
const configComparison = compareConfig(frozen.config, boot.config), configDelta = boot.config.configRevision - frozen.config.configRevision;
assert.equal(configDelta, engineering.filter(value => value.executed).length * 2, 'Exactly one select and restore per new engineering sample.');
const definitions = compareConnectionDefinitions(frozen.center, after.modelCenter, frozen.config, boot.config);
assert.deepEqual(after.modelCenter.selected, frozen.center.selected); assert.deepEqual(after.modelCenter.pools, frozen.center.pools);
const exportMap = new Map(after.exports.map(value => [value.id, value])), artifactMap = new Map(after.persistent.artifacts.map(value => [value.path, value]));
for (const original of before.exports) assert.deepEqual(exportMap.get(original.id), original, 'Original session export: ' + original.id);
for (const original of before.persistent.artifacts) assert.deepEqual(artifactMap.get(original.path), original, 'Original artifact byte: ' + original.path);
for (const value of external) {
assert.deepEqual(exportMap.get(value.sessionId), value.exports, 'Explicit external session export: ' + value.sessionId);
for (const artifact of value.artifacts) assert.deepEqual(artifactMap.get(artifact.path), { path: artifact.path, bytes: artifact.bytes, sha256: artifact.sha256 }, 'Explicit external artifact byte: ' + artifact.path);
}
const db = new DatabaseSync(path.join(host.identity.dataRoot, 'workbench.sqlite'), { readOnly: true }); const addedRows = {}, metadataChanges = [], sequenceChanges = []; let checkedOriginalRows = 0;
try {
assert.deepEqual(Object.keys(after.database.tables), Object.keys(before.database.tables));
for (const [table, originalTable] of Object.entries(before.database.tables)) {
const currentTable = after.database.tables[table]; assert.equal(currentTable.schemaSha256, originalTable.schemaSha256); addedRows[table] = currentTable.count - originalTable.count;
const originals = new Set(originalTable.rows.map(value => (value.kind ?? '') + ':' + value.id)), currentRows = new Map(currentTable.rows.map(value => [(value.kind ?? '') + ':' + value.id, value]));
for (const value of external) if (value.tables[table]) {
assert.equal(value.tables[table].schemaSha256, originalTable.schemaSha256);
for (const row of value.tables[table].rows) {
assert.equal(originals.has((row.kind ?? '') + ':' + row.id), false, 'External observation cannot replace an original row.');
assert.deepEqual(currentRows.get((row.kind ?? '') + ':' + row.id), row, 'Every explicitly recorded external row: ' + table + ':' + row.id);
}
}
for (const original of originalTable.rows) {
if (table === 'projects') {
const current = db.prepare('SELECT * FROM projects WHERE id=?').get(original.id); assert.ok(current);
assert.equal(digest({ ...current, position: current.position - projectIds.size }), original.sha256, 'Original project fields and declared front insertion positions.');
} else if (table === 'sqlite_sequence') {
const sequences = db.prepare('SELECT * FROM sqlite_sequence').all();
const current = sequences.find(value => digest({ ...value, seq: original.id }) === original.sha256); assert.ok(current, 'Original sequence authority.');
const increment = current.name === 'events' ? after.eventCursor - before.eventCursor : current.name === 'model_attempts' ? databaseRequests : NaN;
assert.ok(Number.isSafeInteger(increment)); assert.equal(current.seq, original.id + increment);
sequenceChanges.push({ name: current.name, original: original.id, current: current.seq, increment });
} else if (table === 'metadata' && ['config', 'modelRegistry', 'modelNetworkDiagnostics'].includes(original.id)) {
const current = db.prepare('SELECT * FROM metadata WHERE key=?').get(original.id), value = JSON.parse(current.value); let normalized;
if (original.id === 'config') { assert.equal(value.configRevision, boot.config.configRevision); normalized = { ...value, configRevision: frozen.config.configRevision }; }
else if (original.id === 'modelRegistry') {
assert.equal(value.revision, frozen.center.revision + configDelta); assert.deepEqual(value.selected, frozen.center.selected);
normalized = { ...value, revision: frozen.center.revision };
} else {
assert.ok(Array.isArray(value)); const additions = value.filter(row => diagnosticIds.has(row.id)); assert.equal(additions.length, diagnosticIds.size);
normalized = value.filter(row => !diagnosticIds.has(row.id));
}
assert.equal(digest({ ...current, value: JSON.stringify(normalized) }), original.sha256, 'Original public metadata bytes after the declared increment: ' + original.id);
metadataChanges.push({ key: original.id, originalRowSha256: original.sha256, currentRowSha256: digest(current), originalRestoredByDeclaredIncrement: true });
} else {
const current = currentRows.get((original.kind ?? '') + ':' + original.id); assert.ok(current, table + ': missing original ' + original.id);
assert.equal(current.sha256, original.sha256, table + ': changed original ' + original.id);
}
checkedOriginalRows++;
}
if (['events', 'records', 'sessions'].includes(table)) {
const columns = table === 'records' ? 'id,kind,session_id,project_id' : table === 'events' ? 'id,session_id,project_id' : 'id,project_id';
for (const row of db.prepare('SELECT ' + columns + ' FROM ' + table).all()) if (!originals.has((row.kind ?? '') + ':' + row.id)) {
const sessionId = table === 'sessions' ? row.id : row.session_id;
assert.ok(allSessionIds.has(sessionId), 'Every new ' + table + ' needs a declared session.'); assert.equal(row.project_id, sessionProjects.get(sessionId));
const observation = external.find(value => value.sessionId === sessionId);
if (observation) assert.ok(observation.tables[table].rows.some(value => value.id === row.id && (value.kind ?? '') === (row.kind ?? '')), 'External rows must match their explicit immutable list.');
}
} else if (table === 'outbox') {
for (const row of db.prepare('SELECT outbox.seq,events.session_id FROM outbox JOIN events USING(seq) WHERE outbox.seq>?').all(before.eventCursor)) {
assert.ok(allSessionIds.has(row.session_id));
const observation = external.find(value => value.sessionId === row.session_id);
if (observation) assert.ok(observation.tables.outbox.rows.some(value => value.id === row.seq), 'Explicit external outbox sequence.');
}
} else if (table === 'model_attempts') {
assert.equal(addedRows[table], databaseRequests);
// The ledger stores session_id; its project authority is the existing
// sessions relation, not a nonexistent model_attempts.project_id field.
for (const row of db.prepare('SELECT model_attempts.id,model_attempts.session_id,sessions.project_id FROM model_attempts LEFT JOIN sessions ON sessions.id=model_attempts.session_id').all()) if (!originals.has(':' + row.id)) {
assert.ok(allSessionIds.has(row.session_id)); assert.equal(row.project_id, sessionProjects.get(row.session_id));
const observation = external.find(value => value.sessionId === row.session_id);
if (observation) assert.ok(observation.tables.model_attempts.rows.some(value => value.id === row.id), 'Explicit external request ID.');
}
} else if (['metadata', 'sqlite_sequence'].includes(table)) assert.equal(addedRows[table], 0);
}
const references = new Map(db.prepare("SELECT payload FROM records WHERE kind='artifact'").all().map(row => { const value = JSON.parse(row.payload); return [value.relative, value]; }));
const originals = new Set(before.persistent.artifacts.map(value => value.path));
for (const artifact of after.persistent.artifacts) if (!originals.has(artifact.path)) {
const reference = references.get(artifact.path); assert.ok(reference && allSessionIds.has(reference.sessionId) && reference.projectId === sessionProjects.get(reference.sessionId), 'New original artifact must be owned or explicitly recorded externally.');
assert.equal(reference.sha256, artifact.sha256); assert.equal(reference.bytes, artifact.bytes);
}
} finally { db.close(); }
for (const original of before.persistent.files) {
const current = after.persistent.files.find(value => value.path === original.path); assert.ok(current);
if (original.path === 'config.json' && current.sha256 !== original.sha256) {
const value = JSON.parse(fs.readFileSync(path.join(host.identity.dataRoot, original.path), 'utf8'));
assert.equal(sha(JSON.stringify({ ...value, configRevision: frozen.config.configRevision }, null, 2)), original.sha256, 'Original config file bytes after the exact config revision increment.');
} else assert.equal(current.sha256, original.sha256, 'Original persistent file: ' + original.path);
}
result = { success: true, stage, version: boot.version, pid: host.identity.pid, instanceId: host.identity.instanceId, originalProjects: frozen.originalProjects.length,
originalSessions: before.database.sessionIds.length, originalModelRequests: before.database.tables.model_attempts.count, originalArtifacts: before.persistent.artifacts.length,
addedProjects: projectIds.size, addedSessions: sessionIds.size, addedRows, newArtifacts: after.persistent.artifacts.length - before.persistent.artifacts.length, checkedOriginalRows,
originalSessionExports: 'exact', originalArtifactBytes: 'exact', originalRows: 'exact with explicitly hashed project-position/public-metadata/sequence increments',
configComparison, definitions, metadataChanges, sequenceChanges, batchModelRequests: expectedRequests, externalModelRequests: externalRequests,
externalObservations: external.map(value => ({ sessionId: value.sessionId, projectId: value.projectId, requests: value.requests, tables: Object.fromEntries(Object.entries(value.tables).map(([table, source]) => [table, source.count])), artifacts: value.artifacts.length, scope: value.scope })),
originalCredentialRow: 'exact SHA; never decrypted or copied',
engineering: engineering.map(value => ({ kind: value.kind, success: value.success, executed: value.executed })), inspectorClosed: true, keysReadOrResaved: false, historicalSamplesReplayed: false, purgeExecuted: false };
} catch (error) { result = { success: false, stage, error: error.stack, keysReadOrResaved: false, noMutationOrRetry: true }; process.exitCode = 1; }
finally { save(prefix + '/result.json', result); await close(); }
console.log(JSON.stringify({ prefix, ...result }));
+50
View File
@@ -0,0 +1,50 @@
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { DatabaseSync } from 'node:sqlite';
import { digest } from '../retained-host-state.mjs';
import { root, read, save, client, sha, captureSession } from './common.mjs';
// Explicitly record the independently discovered greeting; do not automatically
// accept every new session, repeat its request, or add it to engineering results.
const sessionId = '8f896f90-50f2-4d07-8da0-3b98832c6df5';
const attemptId = '821c6dc9-7e52-4e41-a1d9-36b4de3ecbdb';
const prefix = 'external-observations/' + sessionId, frozen = read('frozen.json');
assert.equal(fs.existsSync(path.join(root, prefix)), false, 'Do not overwrite an external observation.');
assert.equal(frozen.baseline.database.sessionIds.includes(sessionId), false);
const { api, close } = await client();
try {
const host = await api('/host/status');
assert.equal(host.identity.pid, frozen.host.identity.pid); assert.equal(host.activity.active, false);
const captured = await captureSession(api, sessionId, prefix), state = captured.state;
assert.ok(frozen.originalProjects.some(value => value.id === state.projectId));
assert.equal(state.status, 'completed'); assert.equal(state.execution.run.resumeOf, null);
assert.deepEqual(state.messages.filter(value => value.role === 'user').map(value => value.content), ['你好']);
assert.equal(state.changes.length, 0); assert.equal(state.execution.deliveries.length, 0);
assert.equal(state.events.filter(value => value.kind === 'tool').length, 0);
assert.deepEqual(captured.rows.map(value => value.id), [attemptId]);
const db = new DatabaseSync(path.join(host.identity.dataRoot, 'workbench.sqlite'), { readOnly: true }), tables = {};
db.exec('BEGIN');
try {
for (const table of ['sessions', 'events', 'records', 'model_attempts', 'outbox']) {
const rows = table === 'outbox'
? db.prepare('SELECT outbox.* FROM outbox JOIN events USING(seq) WHERE events.session_id=? ORDER BY outbox.seq').all(sessionId)
: db.prepare('SELECT * FROM ' + table + ' WHERE ' + (table === 'sessions' ? 'id' : 'session_id') + '=? ORDER BY rowid').all(sessionId);
const sql = db.prepare("SELECT sql FROM sqlite_schema WHERE type='table' AND name=?").get(table).sql;
assert.equal(sha(sql), frozen.baseline.database.tables[table].schemaSha256);
tables[table] = { count: rows.length, schemaSha256: sha(sql), rows: rows.map(row => ({ id: row.id ?? row.seq, ...(row.kind ? { kind: row.kind } : {}), sha256: digest(row) })) };
}
} finally { db.exec('ROLLBACK'); db.close(); }
const index = { schemaVersion: 1, observedAt: new Date().toISOString(), sessionId, projectId: state.projectId,
taskId: state.execution.task.id, runId: state.execution.run.id, title: state.title, scope: 'Independent new greeting in an existing project; attribution to a person is not asserted.',
m4Engineering: false, requests: captured.total, usage: state.execution.task.usage,
attempts: captured.rows.map(value => ({ id: value.id, status: value.status, usageStatus: value.usageStatus, modelIdentity: value.modelIdentity, requestSha256: value.requestSha256, responseSha256: value.responseSha256 })),
exports: { id: sessionId, project: digest(captured.exported.project), session: digest(captured.exported.session), execution: digest(captured.exported.execution) },
artifacts: state.execution.artifacts.map(value => ({ id: value.id, path: value.relative, bytes: value.bytes, sha256: value.sha256 })),
tables, captures: captured.captures, resumedHistoricalTask: false, toolCalls: 0, changes: 0, deliveries: 0,
keysReadOrResaved: false, requestsReplayed: false, productOrProjectMutation: false };
const relative = prefix + '/index.json'; save(relative, index);
save('external-observations/declared.json', { schemaVersion: 1, sources: [{ path: relative, sha256: sha(fs.readFileSync(path.join(root, relative))) }] });
console.log(JSON.stringify({ sessionId, projectId: state.projectId, requests: index.requests, totalTokens: index.usage.totalTokens,
tableCounts: Object.fromEntries(Object.entries(tables).map(([key, value]) => [key, value.count])), artifacts: index.artifacts.length, modelIdentity: index.attempts[0].modelIdentity.status, scope: index.scope }));
} finally { await close(); }
+96
View File
@@ -0,0 +1,96 @@
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { root, read, save, sha } from './common.mjs';
const stage = process.argv[2], auditPrefix = process.argv[3];
assert.ok(['node', 'react', 'python', 'final'].includes(stage));
assert.match(auditPrefix ?? '', new RegExp('^audits/' + stage + '-[a-f0-9-]{36}$'));
const audit = read(auditPrefix + '/result.json'); assert.equal(audit.success, true);
const source = relative => {
const bytes = fs.readFileSync(path.join(root, relative));
return { path: relative, bytes: bytes.length, sha256: sha(bytes) };
};
const compatibility = read('compatibility/result.json');
const compatibilitySummary = {
requests: compatibility.requests, unknownRequests: compatibility.results.flatMap(value => value.preflights).filter(value => value.usageStatus !== 'reported').length,
reportedTotalTokens: compatibility.results.flatMap(value => value.preflights).reduce((sum, value) => sum + (value.usage?.total_tokens ?? 0), 0),
source: source('compatibility/result.json'),
connections: compatibility.results.map(value => ({ connectionId: value.connectionId, name: value.name, model: value.model, protocol: value.protocol,
endpointKind: value.endpointKind, network: value.network, catalog: value.catalog, engineeringAllowed: value.engineeringAllowed,
sources: ['network.json', 'catalog.json', 'result.json'].filter(file => fs.existsSync(path.join(root, 'compatibility', value.connectionId, file)))
.map(file => source('compatibility/' + value.connectionId + '/' + file)),
preflights: value.preflights.map(row => ({ scope: row.scope, passed: row.passed, sessionId: row.sessionId, taskId: row.taskId, runId: row.runId,
identity: row.identity, status: row.status, usageStatus: row.usageStatus, usage: row.usage, actualToolsExecuted: row.actualToolsExecuted,
streaming: row.streaming, wirePassed: row.wirePassed, outputFields: row.outputFields, expectedOutput: row.expectedOutput,
sources: row.captures.map(capture => ({ ...capture, ...source(capture.path) })) })) })),
};
const engineering = [];
for (const kind of ['node', 'react', 'python']) {
if (!fs.existsSync(path.join(root, kind, 'result.json'))) continue;
const result = read(kind + '/result.json');
if (!result.executed) { engineering.push({ kind, result, source: source(kind + '/result.json') }); continue; }
const session = read(kind + '/session.json'), attempts = read(kind + '/attempts.json');
const metrics = {};
for (const key of ['input', 'output', 'total', 'cacheRead', 'cacheWrite', 'uncached', 'reasoning']) {
const values = attempts.map(value => value.usage?.tokenAccounting?.metrics?.[key]);
const known = values.filter(value => Number.isSafeInteger(value?.tokens) && ['reported', 'derived'].includes(value.status));
metrics[key] = { knownSumTokens: known.length ? known.reduce((sum, value) => sum + value.tokens, 0) : null,
knownRequests: known.length, unknownRequests: values.length - known.length,
statuses: [...new Set(values.map(value => value?.status ?? 'unknown'))] };
}
const reads = [], seenReads = new Set();
for (const event of session.events.filter(value => value.kind === 'tool' && value.phase === 'completed' && value.tool === 'read_file')) {
let output; try { output = JSON.parse(event.output); } catch { output = null; }
const row = { eventId: event.id, path: output?.path ?? event.input?.path, startLine: output?.start_line ?? null, endLine: output?.end_line ?? null,
fileSha256: output?.sha256 ?? null, outputSha256: sha(event.output ?? ''), parsed: output !== null };
const key = JSON.stringify([row.path, row.startLine, row.endLine, row.fileSha256 ?? row.outputSha256]);
row.sameByteRangePreviouslyRead = seenReads.has(key); seenReads.add(key); reads.push(row);
}
const completedTools = session.events.filter(value => value.kind === 'tool' && value.phase === 'completed');
const wire = attempts.map(value => {
const capture = result.captures.find(item => item.attemptId === value.id && item.kind === 'request');
assert.ok(capture); const body = read(capture.path);
return { attemptId: value.id, model: body.model, streaming: body.stream === true,
outputFields: Object.fromEntries(['max_tokens', 'max_output_tokens', 'max_completion_tokens'].filter(key => Object.hasOwn(body, key)).map(key => [key, body[key]])),
nativeReasoning: Object.fromEntries(['thinking', 'reasoning', 'reasoning_effort'].filter(key => Object.hasOwn(body, key)).map(key => [key, body[key]])),
toolsCount: body.tools?.length ?? 0, toolsSchemaSha256: sha(JSON.stringify(body.tools ?? [])), source: source(capture.path) };
});
const reports = result.reportArtifacts.filter(value => value.kind === 'delivery-report').map(value => {
const file = result.captures.find(capture => capture.artifactId === value.id).path, report = read(file);
return { artifactId: value.id, status: report.status, taskStatus: report.task?.status, lifecycle: report.lifecycle,
deliveries: report.deliveries?.map(item => ({ id: item.id, status: item.status, commit: item.commit })), source: source(file) };
});
engineering.push({ kind, success: result.success, executed: result.executed, projectId: result.projectId, sessionId: result.sessionId,
taskId: result.taskId, runId: result.runId, connectionId: result.connectionId, requests: result.requests, usage: result.usage,
startedAt: session.execution.run.startedAt, finishedAt: session.execution.run.finishedAt,
elapsedMs: Date.parse(session.execution.run.finishedAt) - Date.parse(session.execution.run.startedAt),
stopReason: result.productStopReason, failure: result.failure, identitiesPassed: result.identitiesPassed,
commit: result.commit, initialHead: result.initialHead, committedPaths: result.committedPaths, committedCurrent: result.committedCurrent,
otherUntracked: result.otherUntracked, final: result.final, browser: result.browser,
ownerBytesAndIndexPreserved: result.ownerBytesAndIndexPreserved, supervisorContinuations: result.supervisorContinuations,
localTokenCapsChanged: result.localTokenCapsChanged, internalDeliveries: result.internalDeliveries, reports,
accounting: metrics, reads: { calls: reads.length, distinctByteRanges: seenReads.size, repeatedSameByteRanges: reads.filter(value => value.sameByteRangePreviouslyRead).length, observations: reads },
tools: Object.fromEntries([...new Set(completedTools.map(value => value.tool))].map(tool => [tool, completedTools.filter(value => value.tool === tool).length])),
wire, toolsSchemaVariants: [...new Set(wire.map(value => value.toolsSchemaSha256))],
sources: ['claim.json', 'goal.txt', 'source-before.json', 'result.json', 'session.json', 'export.json', 'attempts.json', 'restoration.json', 'git-status.txt', 'git-log.txt']
.map(file => source(kind + '/' + file)), captures: result.captures.map(value => ({ ...value, ...source(value.path) })) });
}
const auditHistory = fs.readdirSync(path.join(root, 'audits')).filter(name => fs.existsSync(path.join(root, 'audits', name, 'result.json')))
.map(name => { const file = 'audits/' + name + '/result.json', value = read(file); return { stage: value.stage, success: value.success, error: value.error ?? null, source: source(file) }; });
const summary = { schemaVersion: 1, stage, generatedAt: new Date().toISOString(), evidenceRoot: path.relative(process.cwd(), root).replaceAll('\\', '/'),
frozen: source('frozen.json'), compatibility: compatibilitySummary, engineering,
requests: compatibilitySummary.requests + engineering.reduce((sum, value) => sum + (value.requests ?? 0), 0),
reportedTotalTokens: compatibilitySummary.reportedTotalTokens + engineering.reduce((sum, value) => sum + (value.usage?.totalTokens ?? 0), 0),
unknownRequests: compatibilitySummary.unknownRequests + engineering.reduce((sum, value) => sum + (value.usage?.unknownRequests ?? 0), 0),
audit: { ...audit, source: source(auditPrefix + '/result.json'), after: source(auditPrefix + '/after.json') }, auditHistory,
drivers: fs.readdirSync(path.resolve('scripts/m4-live')).filter(name => name.endsWith('.mjs')).sort().map(name => { const file = 'scripts/m4-live/' + name, bytes = fs.readFileSync(file); return { path: file, bytes: bytes.length, sha256: sha(bytes) }; }),
keysReadOrResaved: false, historicalSamplesReplayed: false, productSourceChanged: false, releaseOrRestart: false, purgeExecuted: false,
unverified: ['Real Claude identity on the configured proxy', 'Long-term provider reliability', 'Real Mnemo production binding and semantic benefit',
'Physical iPhone', 'General repeated-read improvement', 'R/W v2 live exclusion boundary', 'Causal cache benefit', 'Purge benefit'] };
save(stage + '-summary.json', summary);
const name = stage === 'node' ? 'compatibility-node' : stage;
const file = path.resolve('docs/m4-' + name + '-2026-11-11.json');
fs.writeFileSync(file, JSON.stringify(summary, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify({ file, stage, requests: summary.requests, reportedTotalTokens: summary.reportedTotalTokens, unknownRequests: summary.unknownRequests,
engineering: engineering.map(value => ({ kind: value.kind, success: value.success, requests: value.requests, elapsedMs: value.elapsedMs, cacheRead: value.accounting?.cacheRead, reads: value.reads?.calls, repeated: value.reads?.repeatedSameByteRanges })), audit: audit.success }));
+2
View File
@@ -1153,3 +1153,5 @@ F收尾:57d075e修正独立编译QA路径,6d09ac8封存差异;202610302320
按 docs/M4-LIVE-BASELINE-PLAN.md 推进。源码0054ea28干净、领先远端两条已完成只读协调记录;catchup正常结束。首次正式公开观察1.25.13/63892、空闲/unrestricted/passthrough/full,六连接hasKey=false,已异步请求只在模型中心恢复凭据。阶段1完成,阶段2新驱动/工程准备进行中;真实预检/工程等待可用凭据,不读真实Key、不续旧样本、不委派。后续逐阶段验证/回顾/限定提交/普通增量推送,Purge前置和历史unknown保持。
2026-11-11 M4阶段2完成:用户三凭据已在界面恢复;最终m4-driver-40fb93c8在正式1.25.13处理器的隔离宿主上11边界+固定Node实际5请求通过,原9/9/build/限定Git、owner全部index和配置恢复通过。两首断言失败及第三通过原件保持,新增非法UTF8原字节验证通过,机器记录docs/m4-driver-validation-2026-11-11.json。当前限定驱动/计划/只读来源提交,再一次冻结正式原状态、三连接/协议/参数与工程新输入并执行真实M4;0真实请求和既有1.25.13发行结论保持。
2026-11-11 M4阶段3/4与Node完成:7152d654后一次冻结正式身份/三线/原53527行。六真实兼容请求1227tokens/0unknown;DeepSeek和Responses通过,Claude两mismatch及目录缺项保持。新Node自主十请求180463tokens、原9/9/build/限定Git3cd994ff及内置最终completed通过。原状态第三只读审计通过,外部一你好会话/一请求4301tokens单列,前两审计失败保持。阶段验收与机器记录已生成,核对后限定提交;下一独立React、成功后Python,最后封存与普通增量推送。