diff --git a/AGENTS.md b/AGENTS.md index 0259b293..29633a95 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,7 @@ # Agent Workbench项目执行规范 +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。 2026-11-11 用户要求立即开发、提交、验收,当前按 [1.25.13 交付计划](docs/M3-B4B-RELEASE-1.25.13.md) 完成 M3+B4b 正式源码/程序/安装器和实际升级。该授权覆盖下方历史阶段性“不提交/不发行/不查 health”安排,保留旧封存、真实模型/网络/unknown/重复读取/Purge 未验证结论。沿用既有 GitAtlas 普通增量推送授权;不委派、不续跑旧任务、不读取或重存真实 Key。每阶段实际验证后限定提交,源码包不含项目数据,安装另核原数据保持。 diff --git a/docs/M4-LIVE-BASELINE-PLAN.md b/docs/M4-LIVE-BASELINE-PLAN.md new file mode 100644 index 00000000..d088151c --- /dev/null +++ b/docs/M4-LIVE-BASELINE-PLAN.md @@ -0,0 +1,36 @@ +# M4:1.25.13 新真实兼容与自主工程基线 + +2026-11-11 开始。承接已正式验收的 1.25.13,不续跑 AD/AE/AG、X、R/W 或用户工程。当前源码基线 `0054ea282180b20061797b00cf5122ee8baa1df4`;本次驱动提交、正式宿主、连接、参数和工程输入另行冻结。 + +首次公开观察保存在 `.qa/m4-live-baseline-2026-11-11/observation.json`:正式 1.25.13/PID 63892,空闲、unrestricted/passthrough/full,三个累计/步数设置为 0,六条连接均 `hasKey=false`。已请求用户只在模型中心恢复所需连接的凭据,聊天不接收 Key。此观察不能作为后来凭据可用或真实兼容通过的证明。 + +## 阶段与结束标准 + +1. 核对源码、现有正式身份、公开连接与选择,恢复规划记录。无凭据时先完成可运行的新驱动与冻结工程准备,不发真实请求。 +2. 使用新证据目录、新 claim 和自有工程验证驱动。合成服务只验证请求、原件归属、取消、错误、统计和验收机制,固定回答不算模型能力。保留驱动首次失败及后续修正的来源。 +3. 凭据恢复后,在每个请求之前冻结实际可用、用户启用的连接。官方直连和兼容代理单列;保留用户原选择及参数。不读、解密、复制或重存真实 Key。 +4. 每连接分别验目录、文本、工具、流式、身份声明、实际 wire 参数、原错误与 raw usage。每项一个全新会话、一个物理请求,不自动重放失败/unknown。官方 Messages 必填 `max_tokens` 按精确型号及实际参数来源发送;其他协议不主动追加本地输出限额。单次响应或工具返回不代表长期稳定或真实模型权重身份。 +5. 从新的自有 Node 基线开始,模型独立读取、修改、执行原检查并完成限定范围的本地 Git 交付。原测试/配置/owner 文件及原 index 保持,禁止提供实现答案或为过关改变断言。Node 完整成功后依次另冻 React、Python;不拿旧成功代签新版。 +6. 实际缺陷按小阶段修复、相关验证、回顾与限定提交;实验原件封存、复核和普通增量 GitAtlas 推送。只有程序实际变化需要新的独立发行;文档或驱动不触发重打已验收的 1.25.13。 + +## 固定实验规则 + +默认保持开放透传及持久 full 权限,不设置本地 context/output/累计 tokens/步数门槛,不裁剪原任务和历史来制造通过。预检只允许一个物理请求;工程观察窗口十分钟,连续三分钟没有新增读取事实、源码变化或实际检查事实时,只停止本次自有 Task 并记实验观察结束。这是观察设计,不改变产品默认能力;在途未报告用量保留 unknown。 + +工程选线在结果前固定:用户本轮明确恢复为验收对象的可用官方 DeepSeek 连接优先,其后是这些连接中的 Responses、Chat、Messages 代理。当前用户原选择为 Claude 单成员自动池,工程临时单线选择完成后恢复该原选择。必须本连接目录完整并列出型号、文本/工具预检完整且身份 matched,才运行该工程。失败不换线续跑同一个工程。临时选线只在确有必要时使用公开 API,恢复时以修订为前提,保护用户期间的新设置,不覆盖外部变化;不为结果修改连接定义或保存身份策略。 + +用户已回复“恢复了三个模型”。随后公开观察确认为 DeepSeek/deepseek-flash(Chat,revision 20)、apikey-Claude/claude-opus-5-5(Messages,revision 8)、apikey/gpt-6.1-sol(Responses,revision 15),三者 credentialRevision=1、streaming=true、原生参数为空,原选择不变。原无凭据观察保持,新冻结在驱动验证和提交后完成。 + +选择和恢复使 configRevision 单调递增,legacy-default 的公开 revision 跟随该精确增量;逐字段核对后单独列明这一投影变化,不把它称为真实连接被改写,也不忽略其他字段。三条真实连接的定义、凭据存在状态和归属、原池及选择须保持。前两轮隔离驱动的状态/公开投影断言失败保持原件,未改变产品行为或原工程测试。 + +成功必须有实际源码差异、原检查数量和退出状态、实际提交范围及提交字节等于最终文件、owner 字节/index 保持,且所属请求完整、无 unknown。模型声称完成、返回提案、合成通过、终端文字均不能代替实际工具/检查/Git 证据。内置交付报告和终端 Git 事实分别核对。 + +记录新增读取与同 SHA/同范围重复读取、cache read/write/uncached、reported/unknown tokens、时延、错误来源及人工介入。缓存收益、提醒/经验/角色收益均需另冻可比实验;不承诺上游必然命中缓存。 + +## 保留事项 + +历史网络异常、unknown/失败、输出截断、重复读取和 R/W 预留 v2 真机边界保持原结论。默认透传时不恢复旧限额验证旧边界。真实 Mnemo 生产绑定、语义收益、长期与物理 iPhone 验收继续单列。 + +原版 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。 diff --git a/docs/integration/WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.json b/docs/integration/WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.json new file mode 100644 index 00000000..ae526f07 --- /dev/null +++ b/docs/integration/WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.json @@ -0,0 +1,503 @@ +{ + "schemaVersion": 1, + "kind": "workbench-readonly-engineering-source-index", + "generatedAt": "2026-11-11T14:48:16.130Z", + "sourceName": "agent-workbench/ad/node/6be88bee-1995-424a-b15a-2e0e54207d1a/2ff20f93-7a85-4117-9615-b71c976624f8", + "ids": { + "projectId": "674354be-ffb2-4f2f-b2ce-8b2c4960b008", + "sessionId": "af80ce72-1289-4323-8be2-fafbaa210e01", + "taskId": "6be88bee-1995-424a-b15a-2e0e54207d1a", + "runId": "2ff20f93-7a85-4117-9615-b71c976624f8" + }, + "originalVersion": "1.25.8", + "originalDriverCommit": "ed78f02c032f2968e326fb8f696eba1281e0785b", + "purpose": "Read-only acceptance of an existing independent Node task. No incoming restricted delegation or new M4 task is represented.", + "goalPath": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\goal.txt", + "predeclaredPlanPath": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\coordination-readonly-2026-11-11-engineering-ad-r2\\original-predeclared-plan.md", + "originalTaskContract": { + "schemaVersion": 1, + "goal": "请独立修复这个Node费用报表工程,使原九项测试和build通过,并完成本地Git交付。只修改src/amount.mjs、src/summary.mjs、src/report.mjs;按原测试理解金额、币种汇总和报表要求,不修改原测试、package配置、构建脚本、README或owner文件,保留原有暂存/未暂存/未跟踪状态。请自行读取、修改、执行检查并提交,不要只解释方案或口头宣布完成。当前为完全访问权限,可以使用工作台工程工具或终端;不需要等待独立审查,不推送远端。", + "kind": "general", + "checks": "unspecified" + }, + "originalStructuredAcceptance": [], + "originalReportArtifact": { + "id": "21a5483c-77f2-445b-838c-7a0b77d2d897", + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\coordination-readonly-2026-11-11-engineering-ad-r2\\21a5483c-77f2-445b-838c-7a0b77d2d897.json", + "sha256": "e7a67a742bf4d0a0252a3cb92375ae8c23e40949d1279880fc617ba2c20e80a7", + "bytes": 61179, + "status": "in_progress" + }, + "reportMetadata": [ + { + "id": "21a5483c-77f2-445b-838c-7a0b77d2d897", + "sessionId": "af80ce72-1289-4323-8be2-fafbaa210e01", + "projectId": "674354be-ffb2-4f2f-b2ce-8b2c4960b008", + "taskId": "6be88bee-1995-424a-b15a-2e0e54207d1a", + "runId": "2ff20f93-7a85-4117-9615-b71c976624f8", + "kind": "delivery-report", + "mediaType": "application/json", + "sha256": "e7a67a742bf4d0a0252a3cb92375ae8c23e40949d1279880fc617ba2c20e80a7", + "bytes": 61179, + "relative": "e7/e7a67a742bf4d0a0252a3cb92375ae8c23e40949d1279880fc617ba2c20e80a7.blob", + "createdAt": "2026-11-06T04:52:58.386Z", + "status": "stored", + "sharedPath": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\coordination-readonly-2026-11-11-engineering-ad-r2\\21a5483c-77f2-445b-838c-7a0b77d2d897.json", + "originalPath": "C:\\Users\\wangy\\AppData\\Local\\Packages\\OpenAI.Codex_2p2nqsd0c76g0\\LocalCache\\Local\\AgentWorkbench\\artifacts\\e7\\e7a67a742bf4d0a0252a3cb92375ae8c23e40949d1279880fc617ba2c20e80a7.blob", + "copiedBytesExact": true + }, + { + "id": "2de05f2f-4c49-4fbc-83f4-dab28c0b02d2", + "sessionId": "af80ce72-1289-4323-8be2-fafbaa210e01", + "projectId": "674354be-ffb2-4f2f-b2ce-8b2c4960b008", + "taskId": "6be88bee-1995-424a-b15a-2e0e54207d1a", + "runId": "2ff20f93-7a85-4117-9615-b71c976624f8", + "kind": "delivery-report-markdown", + "mediaType": "text/markdown", + "sha256": "bdb282fc27b8826810bf64511e6b0d4304c3b905de17194ea79e966cbc47780a", + "bytes": 9300, + "relative": "bd/bdb282fc27b8826810bf64511e6b0d4304c3b905de17194ea79e966cbc47780a.blob", + "createdAt": "2026-11-06T04:52:58.389Z", + "status": "stored", + "sharedPath": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\coordination-readonly-2026-11-11-engineering-ad-r2\\2de05f2f-4c49-4fbc-83f4-dab28c0b02d2.txt", + "originalPath": "C:\\Users\\wangy\\AppData\\Local\\Packages\\OpenAI.Codex_2p2nqsd0c76g0\\LocalCache\\Local\\AgentWorkbench\\artifacts\\bd\\bdb282fc27b8826810bf64511e6b0d4304c3b905de17194ea79e966cbc47780a.blob", + "copiedBytesExact": true + } + ], + "checkLogMetadata": [], + "engineering": { + "sourceRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\expense-project", + "initialHead": "3a3f545337ac8eee849c2b1b224727019f2824a9", + "commit": "88bb25cbf37739359c991dddac26e296a4d29d18", + "committedPaths": [ + "src/amount.mjs", + "src/report.mjs", + "src/summary.mjs" + ], + "committedCurrent": true, + "actualIndependentChecks": { + "test": { + "status": 0, + "signal": null, + "error": null, + "stats": { + "tests": 9, + "pass": 9, + "fail": 0, + "cancelled": 0, + "skipped": 0, + "todo": 0 + }, + "stdoutSha256": "c3bbf67e62ae04805face4ea745574b8d64a243ac421553271950215c9ba140c", + "stderrSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "build": { + "status": 0, + "signal": null, + "error": null, + "stats": null, + "stdoutSha256": "9307ee4e4f72392dd2f29f26c8e9fd3c8e55353bbe21f93627f260f108be9c2c", + "stderrSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + "ownerBytesAndIndexPreserved": true, + "supervisorContinuations": 0 + }, + "originalOutcome": { + "independentEngineeringSuccess": true, + "sessionStatus": "completed", + "taskStatus": "completed", + "runStatus": "completed", + "terminalGitObserved": true, + "nativeDeliveryRows": 0, + "internalDeliveryReportStatus": "in_progress", + "taskVerification": { + "status": "passed", + "checkJobId": "8b536d95-4a02-4806-af8f-f5955984c17f", + "fingerprint": "150123dd461a2e7ffdda2531208de32b5b25ad6999d93ec388b1783bd05b9cea", + "sourceFingerprint": "312aacaf54d8c95183fb3bfce09090a9be0f565c1ff4a452abc20f65895dcbcd", + "checkedAt": "2026-11-06T04:52:41.161Z" + }, + "productStopReason": null, + "failure": null, + "usage": { + "requests": 11, + "inputTokens": 171841, + "outputTokens": 8713, + "totalTokens": 180554, + "unknownRequests": 0, + "estimatedUnknownTokens": 0 + }, + "missing": [ + { + "artifactId": "841b3dd5-e766-42f3-b372-0afdb7e77c82", + "reason": "Check log descriptor absent from the sealed session artifact preview; independent-final logs remain in the read scope." + }, + { + "artifactId": "e96c4509-32ba-419b-8248-59cc5bb23342", + "reason": "Check log descriptor absent from the sealed session artifact preview; independent-final logs remain in the read scope." + } + ], + "batchNetworkAndClaudeErrors": "Preserved separately in QA-LIVE-VALIDATION-AD.md; the Node subset does not replace the whole-batch outcome." + }, + "readiness": { + "originalTaskAndRunAvailable": true, + "originalReportsCopied": true, + "nativeEngineeringEvidenceV2Envelope": false, + "restrictedDelegationReceiver": "not_established_by_this_source", + "originalKeyLookup": "not_established_by_this_source", + "currentM4Engineering": "not_dispatched_at_source_index_creation", + "allConsumerContractFieldsSatisfied": false, + "gaps": [ + "No producer-native mnemo.engineering-evidence.v2 envelope or receipt is claimed.", + "The original task structured acceptance array is empty; the raw goal, predeclared plan and original tests carry its conditions.", + "Original terminal Git success and internal in_progress report remain distinct." + ] + }, + "readScope": { + "mode": "read-only-existing-evidence", + "allowedFiles": [ + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\goal.txt", + "bytes": 567, + "sha256": "c8dd74010d05bbe7fec2faea7a58a2f8e681c05f05888612a3ab6cd4460b59a5", + "origin": "original-ad-seal", + "originalRelative": "node/goal.txt" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\contract.json", + "bytes": 2965, + "sha256": "0a0acf7eae12b436527f119b14aa0c7c7a6bde320e8c315b248b30c20a2025a4", + "origin": "original-ad-seal", + "originalRelative": "node/contract.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\source-before.json", + "bytes": 1203, + "sha256": "c134c4b3d20eb04a8690af68f9c503ec4f11bddaac6509dcc71cef2b5c0f3595", + "origin": "original-ad-seal", + "originalRelative": "node/source-before.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\result.json", + "bytes": 15501, + "sha256": "086ff018544895884f94ff41d5bbf69e6bf7c07d0b09aef60e04a6f6cba80e64", + "origin": "original-ad-seal", + "originalRelative": "node/result.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\session.json", + "bytes": 774765, + "sha256": "90bf4e9c5182fe9dd35b5c890b69945bb5dda8ded2e264b26d93bf06ceee318d", + "origin": "original-ad-seal", + "originalRelative": "node/session.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\export.json", + "bytes": 839293, + "sha256": "921e3071fb095993a2719df05453d9ac4e3a5d891e949cbccf0280074a3348a6", + "origin": "original-ad-seal", + "originalRelative": "node/export.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\attempts.json", + "bytes": 41598, + "sha256": "8324f8f606b893e15aeb3ed2cca2ce71cbb24945bb412d12b0625130b19b9d60", + "origin": "original-ad-seal", + "originalRelative": "node/attempts.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\git-log.txt", + "bytes": 524, + "sha256": "9b13b3b2c56e2141ee63525deedd580d18ab100f0f528a249cabbfa4c2a0ce5e", + "origin": "original-ad-seal", + "originalRelative": "node/git-log.txt" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\git-status.txt", + "bytes": 65, + "sha256": "07eb775fd33c1ab9ec904570086bbfeef138795cf6811d5ceacc3b4ba211a7d7", + "origin": "original-ad-seal", + "originalRelative": "node/git-status.txt" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\baseline\\test.txt", + "bytes": 10429, + "sha256": "1a1024812314619dca7b682e9848370b9cb8037dc949066c4fedbaca67fc29f9", + "origin": "original-ad-seal", + "originalRelative": "node/baseline/test.txt" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\baseline\\build.txt", + "bytes": 36, + "sha256": "9307ee4e4f72392dd2f29f26c8e9fd3c8e55353bbe21f93627f260f108be9c2c", + "origin": "original-ad-seal", + "originalRelative": "node/baseline/build.txt" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\baseline\\result.json", + "bytes": 651, + "sha256": "abd44c095636f7844af9e97c85c2d9d24f8b667033dfd5bdc4c153803339c93c", + "origin": "original-ad-seal", + "originalRelative": "node/baseline/result.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\independent-final\\test.txt", + "bytes": 1807, + "sha256": "c3bbf67e62ae04805face4ea745574b8d64a243ac421553271950215c9ba140c", + "origin": "original-ad-seal", + "originalRelative": "node/independent-final/test.txt" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\independent-final\\build.txt", + "bytes": 36, + "sha256": "9307ee4e4f72392dd2f29f26c8e9fd3c8e55353bbe21f93627f260f108be9c2c", + "origin": "original-ad-seal", + "originalRelative": "node/independent-final/build.txt" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\independent-final\\result.json", + "bytes": 651, + "sha256": "e8375595788c7ddf6d9c54df07190be07e2f1c6a7df318bdadfffd4a09afef48", + "origin": "original-ad-seal", + "originalRelative": "node/independent-final/result.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\expense-project\\package.json", + "bytes": 188, + "sha256": "6ad63026b2fe9de7513a4f6704c372a86108ee3d018a1f04883dc0a409ea4c24", + "origin": "original-ad-seal", + "originalRelative": "node/expense-project/package.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\expense-project\\test\\expense.test.mjs", + "bytes": 2584, + "sha256": "0bcda551dbaeafad9a6e3df8024492ab67d7c09956f4676c393b78249ab44839", + "origin": "original-ad-seal", + "originalRelative": "node/expense-project/test/expense.test.mjs" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\expense-project\\scripts\\build.mjs", + "bytes": 475, + "sha256": "7279bc7c707c0f3ccbae63b14f0abed248ad3755be14f9e37128124ae9267526", + "origin": "original-ad-seal", + "originalRelative": "node/expense-project/scripts/build.mjs" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\expense-project\\src\\amount.mjs", + "bytes": 1933, + "sha256": "0971180b3bc02b02780fe15d2531164f78020a9184df462a1eac2e4bac7e2d26", + "origin": "original-ad-seal", + "originalRelative": "node/expense-project/src/amount.mjs" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\expense-project\\src\\report.mjs", + "bytes": 1006, + "sha256": "4162d18734b176edc39ebcb05de9324ef28cedf8b31e2887fba5bc5c53d8cb7a", + "origin": "original-ad-seal", + "originalRelative": "node/expense-project/src/report.mjs" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\expense-project\\src\\summary.mjs", + "bytes": 1354, + "sha256": "c9800f24209adf00a9974b4f32c83b636be066529455bc87e6529ebdf03b408a", + "origin": "original-ad-seal", + "originalRelative": "node/expense-project/src/summary.mjs" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\d5da6c54-4537-4203-9077-65dcd10edb8b-request.json", + "bytes": 22361, + "sha256": "8fcc91ffe2fd161412903f5c536f05824d3dee90de209d354548453999a64c16", + "origin": "original-ad-seal", + "originalRelative": "node/captures/d5da6c54-4537-4203-9077-65dcd10edb8b-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\d5da6c54-4537-4203-9077-65dcd10edb8b-response.sse", + "bytes": 8526, + "sha256": "34f781d11363b97babf64cc6df9ab9c25649f3b7763f5d2b638864e84836a8a2", + "origin": "original-ad-seal", + "originalRelative": "node/captures/d5da6c54-4537-4203-9077-65dcd10edb8b-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\e4d9710f-3007-499c-8678-4f1a67d07068-request.json", + "bytes": 28655, + "sha256": "ebaa79474016a1dd0a0be205da079354ba9bc09c1c9891f84edd7ea9c24f46a9", + "origin": "original-ad-seal", + "originalRelative": "node/captures/e4d9710f-3007-499c-8678-4f1a67d07068-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\e4d9710f-3007-499c-8678-4f1a67d07068-response.sse", + "bytes": 20159, + "sha256": "7309b290b096eaf9c3598eb52d63bb7f5f793a59a0ce9c36ce8d2a429ce86bd6", + "origin": "original-ad-seal", + "originalRelative": "node/captures/e4d9710f-3007-499c-8678-4f1a67d07068-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\c21c8b76-ee68-4b33-9ca3-6555014b2b18-request.json", + "bytes": 32752, + "sha256": "21e3f65a8f214e2deccdfbc3f3387487f6d789f8ca0974451aad5b05e18767da", + "origin": "original-ad-seal", + "originalRelative": "node/captures/c21c8b76-ee68-4b33-9ca3-6555014b2b18-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\c21c8b76-ee68-4b33-9ca3-6555014b2b18-response.sse", + "bytes": 1183378, + "sha256": "145b207478e2e0169bba2fd4282788b675554993e2f3b59436efeb829e5259a5", + "origin": "original-ad-seal", + "originalRelative": "node/captures/c21c8b76-ee68-4b33-9ca3-6555014b2b18-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\597a345a-4b39-4f38-a03c-61188ef2b426-request.json", + "bytes": 49167, + "sha256": "2034a2ade9782568a8bc98d8fa2b2511583060483082cd78d92c9684821b5b1a", + "origin": "original-ad-seal", + "originalRelative": "node/captures/597a345a-4b39-4f38-a03c-61188ef2b426-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\597a345a-4b39-4f38-a03c-61188ef2b426-response.sse", + "bytes": 484422, + "sha256": "578b3ccdde9276432362a6174c44d1c4d19e3ef9dd86dc827b113555e96b0edd", + "origin": "original-ad-seal", + "originalRelative": "node/captures/597a345a-4b39-4f38-a03c-61188ef2b426-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\5dfd0750-fc44-41d7-b82f-5e1e31a56d4b-request.json", + "bytes": 59863, + "sha256": "6fade8726b0d7ff235fddb6ebd00677e63744a9c33675138d0773b0f5a18145c", + "origin": "original-ad-seal", + "originalRelative": "node/captures/5dfd0750-fc44-41d7-b82f-5e1e31a56d4b-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\5dfd0750-fc44-41d7-b82f-5e1e31a56d4b-response.sse", + "bytes": 15614, + "sha256": "3a709fce2e840cac4fe800c5cb012fda5ac6685192ca14ce7bd9b659ae530414", + "origin": "original-ad-seal", + "originalRelative": "node/captures/5dfd0750-fc44-41d7-b82f-5e1e31a56d4b-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\b1e39d27-4eee-4664-b3e2-25da202a4b05-request.json", + "bytes": 64525, + "sha256": "91bcca633cc66c676e34578b90d929d17d0663f01d6527f8f4d6ef4009d1e321", + "origin": "original-ad-seal", + "originalRelative": "node/captures/b1e39d27-4eee-4664-b3e2-25da202a4b05-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\b1e39d27-4eee-4664-b3e2-25da202a4b05-response.sse", + "bytes": 18404, + "sha256": "67fcef56b2cd52095382c62f82f5da8b0c6567b9bc753edb1a271fbaecac2264", + "origin": "original-ad-seal", + "originalRelative": "node/captures/b1e39d27-4eee-4664-b3e2-25da202a4b05-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\fab4161c-0390-4f8e-8fb8-6ac3dbe5d3b8-request.json", + "bytes": 66818, + "sha256": "da66bd011c2e6bd7d6b26b271841e9b08029b78588c457d5e6311d2d0729ac9a", + "origin": "original-ad-seal", + "originalRelative": "node/captures/fab4161c-0390-4f8e-8fb8-6ac3dbe5d3b8-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\fab4161c-0390-4f8e-8fb8-6ac3dbe5d3b8-response.sse", + "bytes": 67990, + "sha256": "b72fe7b592f1a38a6b6508d403388c2190d85bd89ea7d78bac05e80c579105b3", + "origin": "original-ad-seal", + "originalRelative": "node/captures/fab4161c-0390-4f8e-8fb8-6ac3dbe5d3b8-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\f1134982-11e9-476f-9f85-c85640acd501-request.json", + "bytes": 68155, + "sha256": "1c09de1e3a594da2080b728498e91793df2bcc63eecac309a8a1e83526727a0b", + "origin": "original-ad-seal", + "originalRelative": "node/captures/f1134982-11e9-476f-9f85-c85640acd501-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\f1134982-11e9-476f-9f85-c85640acd501-response.sse", + "bytes": 144597, + "sha256": "eafa8e79dc8ea65b8792c4055e71807985cde8d3456201493a24667cba8baf98", + "origin": "original-ad-seal", + "originalRelative": "node/captures/f1134982-11e9-476f-9f85-c85640acd501-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\7b49e6a2-0e9c-4390-a8d7-1cbe4b2df083-request.json", + "bytes": 71733, + "sha256": "ca0714d6b248a38c6fb4b9eeffe7c7b87430cf5a4ed67250255967ce8b10de6f", + "origin": "original-ad-seal", + "originalRelative": "node/captures/7b49e6a2-0e9c-4390-a8d7-1cbe4b2df083-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\7b49e6a2-0e9c-4390-a8d7-1cbe4b2df083-response.sse", + "bytes": 242957, + "sha256": "adf70113ae9933bcdfe9bafaf35a8202694a47b19fd3742519a8fe1307c52e76", + "origin": "original-ad-seal", + "originalRelative": "node/captures/7b49e6a2-0e9c-4390-a8d7-1cbe4b2df083-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\68bad6fe-e9dc-4543-ad22-618800c07355-request.json", + "bytes": 77812, + "sha256": "bdecf73374975e083eacb022099aef8771503f50e251a01a10fd33f618fe0a8e", + "origin": "original-ad-seal", + "originalRelative": "node/captures/68bad6fe-e9dc-4543-ad22-618800c07355-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\68bad6fe-e9dc-4543-ad22-618800c07355-response.sse", + "bytes": 126196, + "sha256": "c59ed4d9e469c8f1283ec706c5ae8e80b47675cdedb58abce0e771c0fcf3f886", + "origin": "original-ad-seal", + "originalRelative": "node/captures/68bad6fe-e9dc-4543-ad22-618800c07355-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\edbb488b-1524-4fd3-8196-281abd17840c-request.json", + "bytes": 80815, + "sha256": "75dd798b522033cf410e2f07be95a7d973cd36869a586fd52443a73ee0752189", + "origin": "original-ad-seal", + "originalRelative": "node/captures/edbb488b-1524-4fd3-8196-281abd17840c-request.json" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\node\\captures\\edbb488b-1524-4fd3-8196-281abd17840c-response.sse", + "bytes": 296931, + "sha256": "aa68a4e16b7cae4862ceccf771272d22c9a5f127c158283ba50ccbfb266fe757", + "origin": "original-ad-seal", + "originalRelative": "node/captures/edbb488b-1524-4fd3-8196-281abd17840c-response.sse" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\coordination-readonly-2026-11-11-engineering-ad-r2\\original-predeclared-plan.md", + "bytes": 4745, + "sha256": "815ceae01ac5224d6ab3f3b35e7512024f0d9f50c5743173797be7ae6caffbe1", + "origin": "original-git-blob", + "commit": "ed78f02c032f2968e326fb8f696eba1281e0785b", + "repositoryPath": "docs/LIVE-VALIDATION-AD-PLAN.md" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\coordination-readonly-2026-11-11-engineering-ad-r2\\21a5483c-77f2-445b-838c-7a0b77d2d897.json", + "bytes": 61179, + "sha256": "e7a67a742bf4d0a0252a3cb92375ae8c23e40949d1279880fc617ba2c20e80a7", + "origin": "byte-exact-copy-of-original-owned-artifact", + "artifactId": "21a5483c-77f2-445b-838c-7a0b77d2d897", + "kind": "delivery-report" + }, + { + "path": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\coordination-readonly-2026-11-11-engineering-ad-r2\\2de05f2f-4c49-4fbc-83f4-dab28c0b02d2.txt", + "bytes": 9300, + "sha256": "bdb282fc27b8826810bf64511e6b0d4304c3b905de17194ea79e966cbc47780a", + "origin": "byte-exact-copy-of-original-owned-artifact", + "artifactId": "2de05f2f-4c49-4fbc-83f4-dab28c0b02d2", + "kind": "delivery-report-markdown" + } + ], + "originalManifestPath": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-validation-ad\\FINAL-MANIFEST.json", + "originalManifestSha256": "1c21f6b82bd88c1860b77b783d2556a449a76f0b5e21751ea710ab40f9419440", + "excludes": [ + "Any credential value or credential store", + "Whole formal data directory or SQLite database", + "Other user projects or unrelated sessions", + "Replay, retry, execution, write or native-v2 certification" + ] + }, + "actions": { + "realModelRequests": 0, + "engineeringDispatches": 0, + "gitWrites": 0, + "originalArtifactsChanged": false, + "keysReadOrResaved": false, + "messagesSentToOtherThreads": 0 + } +} diff --git a/docs/integration/WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.md b/docs/integration/WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.md new file mode 100644 index 00000000..2661d196 --- /dev/null +++ b/docs/integration/WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.md @@ -0,0 +1,11 @@ +# Agent Workbench 已封存 Node 工程的只读验收入口 + +本入口响应 2026-11-11 的 W2 既有工程产物核对请求,只提供已结束的 AD 原 Task/Run。它不是新的 M4 实验,也不是 Mnemo 受限入站委托;没有启动、重发模型/工程、执行批准或 Git 写入,没有向源线程发送消息。 + +显式元数据:[WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.json](WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.json)。仅允许读取该文件 `readScope.allowedFiles` 中列出的已有封存文件及原字节副本;每项包含绝对路径、bytes、SHA256 和原来源。原封存根 `.qa/live-validation-ad/` 及正式数据不改写。新副本/索引在 `.qa/coordination-readonly-2026-11-11-engineering-ad-r2/`,首组装失败目录保持,不授予读取整个正式数据目录或凭据的范围。 + +稳定来源名为 `agent-workbench/ad/node/6be88bee-1995-424a-b15a-2e0e54207d1a/2ff20f93-7a85-4117-9615-b71c976624f8`。原 Project `674354be-ffb2-4f2f-b2ce-8b2c4960b008`、Session `af80ce72-1289-4323-8be2-fafbaa210e01`,正式来源是当时的 1.25.8。原需求、调用前 Git 版本的计划、原九项测试、限定三源码、owner/index 保护、实际检查日志、模型请求原文和 Git 记录均由元数据指向原件。 + +原 Node 独立验收成功:11 请求、180554 报告 tokens、0 unknown,原九测试 9/9、build 退出 0,实际限定 Git 提交 `88bb25cbf37739359c991dddac26e296a4d29d18`。这不能覆盖 AD 全批网络/Claude 错误,也不能代签 1.25.13、新 M4、通用智能或 Purge 收益。 + +原 Task 的结构化 `acceptance` 是空数组,原需求/预先计划及测试仍存在。原终端 Git 交付与内置报告 `in_progress`、内置 deliveries 空列表必须分别保留,不能把复制报告重新签成 completed。原检查结果引用的两个日志 ID 不在当时的 session 工件预览中,按缺少原描述符登记,不推断原物理日志丢失;独立最终检查的封存日志仍可读取。未生成或声称 `mnemo.engineering-evidence.v2` 原生包、受限接收、原键查询或消费者完整契约通过。消费者应据原字段登记实际缺件/unknown,不以普通会话或本入口替代受限授权。 diff --git a/docs/m4-driver-validation-2026-11-11.json b/docs/m4-driver-validation-2026-11-11.json new file mode 100644 index 00000000..bc7f4c32 --- /dev/null +++ b/docs/m4-driver-validation-2026-11-11.json @@ -0,0 +1,429 @@ +{ + "schemaVersion": 1, + "verifiedAt": "2026-11-11T14:57:36.924Z", + "finalPass": true, + "finalBoundaryCases": 11, + "finalFixtureModelRequests": 15, + "originalNodeTests": 9, + "originalNodeTestsPassed": 9, + "fixedImplementationSuppliedOnlyToFixture": true, + "realModelRequests": 0, + "installedProgram": { + "version": "1.25.13", + "root": "C:\\Users\\wangy\\AppData\\Local\\Programs\\AgentWorkbench\\versions\\Agent-Workbench-1.25.13-win-x64-20261110190745270", + "serverBundlePath": "C:\\Users\\wangy\\AppData\\Local\\Programs\\AgentWorkbench\\versions\\Agent-Workbench-1.25.13-win-x64-20261110190745270\\dist-server\\server.mjs", + "serverBundleSha256": "35b3d1502da0121d12a2e1ceae9ca96f1d03391cd60d9e4d4d0e501d1d3320b3" + }, + "runs": [ + { + "root": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\m4-driver-a01e6b39-4119-4069-b188-7f66ed83978d", + "resultSha256": "6fa66bb14568e324289b884ca19061f9d481cd80398919e04d311d5b12837f93", + "success": false, + "fixtureRequests": 10, + "engineeringRequests": 0, + "boundaryCases": [ + { + "prefix": "preflight/chat-completions-text", + "protocol": "chat-completions", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/chat-completions-tools", + "protocol": "chat-completions", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/responses-text", + "protocol": "responses", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/responses-tools", + "protocol": "responses", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/anthropic-messages-text", + "protocol": "anthropic-messages", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/anthropic-messages-tools", + "protocol": "anthropic-messages", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/json", + "protocol": "chat-completions", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/streaming-override", + "protocol": "chat-completions", + "scope": "streaming", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/m4-error", + "protocol": "chat-completions", + "scope": "text", + "expected": "error", + "requests": 1, + "passed": true + } + ], + "firstError": "AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:\n+ actual - expected\n\n+ 'interrupted'\n- 'failed'\n\n at runProbe (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/m4-live/verify-driver.mjs:114:19)\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n at async file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/m4-live/verify-driver.mjs:129:5", + "realModelRequests": 0 + }, + { + "root": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\m4-driver-16e746a7-2ba0-41ac-9496-e19fdacd04dc", + "resultSha256": "3e10b15415aa8dfb318be6191dbcc697d06927763bcbed91235df9fad43c28cd", + "success": false, + "fixtureRequests": 15, + "engineeringRequests": 5, + "boundaryCases": [ + { + "prefix": "preflight/chat-completions-text", + "protocol": "chat-completions", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/chat-completions-tools", + "protocol": "chat-completions", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/responses-text", + "protocol": "responses", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/responses-tools", + "protocol": "responses", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/anthropic-messages-text", + "protocol": "anthropic-messages", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/anthropic-messages-tools", + "protocol": "anthropic-messages", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/json", + "protocol": "chat-completions", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/streaming-override", + "protocol": "chat-completions", + "scope": "streaming", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/m4-error", + "protocol": "chat-completions", + "scope": "text", + "expected": "error", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/m4-unknown", + "protocol": "chat-completions", + "scope": "text", + "expected": "unknown", + "requests": 1, + "passed": true + } + ], + "firstError": "AssertionError [ERR_ASSERTION]: {\"failure\":null,\"final\":{\"test\":{\"status\":0,\"signal\":null,\"error\":null,\"stats\":{\"tests\":9,\"pass\":9,\"fail\":0,\"cancelled\":0,\"skipped\":0,\"todo\":0},\"stdoutSha256\":\"0f5fc1b31bd42ae405bf71ef06ef9f352cd2eaf63cf9f8f15fe79009003d3a5c\",\"stderrSha256\":\"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"},\"build\":{\"status\":0,\"signal\":null,\"error\":null,\"stats\":null,\"stdoutSha256\":\"9307ee4e4f72392dd2f29f26c8e9fd3c8e55353bbe21f93627f260f108be9c2c\",\"stderrSha256\":\"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"}},\"cleanupErrors\":[{\"label\":\"verify-config-and-definitions\",\"error\":\"AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:\\n+ actual - expected\\n... Skipped lines\\n\\n [\\n {\\n baseUrl: 'http://127.0.0.1:11434/v1',\\n brand: '自定义',\\n capabilities: {\\n...\\n requiresKey: false,\\n+ revision: 4,\\n- revision: 2,\\n source: 'legacy',\\n streaming: false\\n },\\n {\\n baseUrl: 'http://127.0.0.1:65032/v1',\\n\\n at file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/m4-live/run.mjs:91:12\\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\\n at async guard (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/m4-live/run.mjs:67:83)\\n at async file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/m4-live/run.mjs:87:3\"}],\"requests\":5}\n\nfalse !== true\n\n at file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/m4-live/verify-driver.mjs:139:97\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)", + "realModelRequests": 0 + }, + { + "root": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\m4-driver-490968ae-ff86-4217-8e33-98ce56af5f5d", + "resultSha256": "25af3ee86e1ee9dd0fd97b0d1799fbdcd013f08ddd37aab11a61bd38eb6eaa45", + "success": true, + "fixtureRequests": 15, + "engineeringRequests": 5, + "boundaryCases": [ + { + "prefix": "preflight/chat-completions-text", + "protocol": "chat-completions", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/chat-completions-tools", + "protocol": "chat-completions", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/responses-text", + "protocol": "responses", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/responses-tools", + "protocol": "responses", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/anthropic-messages-text", + "protocol": "anthropic-messages", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/anthropic-messages-tools", + "protocol": "anthropic-messages", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/json", + "protocol": "chat-completions", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/streaming-override", + "protocol": "chat-completions", + "scope": "streaming", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/m4-error", + "protocol": "chat-completions", + "scope": "text", + "expected": "error", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/m4-unknown", + "protocol": "chat-completions", + "scope": "text", + "expected": "unknown", + "requests": 1, + "passed": true + } + ], + "firstError": null, + "realModelRequests": 0 + }, + { + "root": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\m4-driver-40fb93c8-1de0-4590-a611-bc6f51406b60", + "resultSha256": "24c6db8cd81f7831669cb07a85e6005f99714cdd831e10ce23fc2825c400979f", + "success": true, + "fixtureRequests": 15, + "engineeringRequests": 5, + "boundaryCases": [ + { + "prefix": "byte-preservation", + "expected": "exact-invalid-utf8-bytes", + "requests": 0, + "passed": true + }, + { + "prefix": "preflight/chat-completions-text", + "protocol": "chat-completions", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/chat-completions-tools", + "protocol": "chat-completions", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/responses-text", + "protocol": "responses", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/responses-tools", + "protocol": "responses", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/anthropic-messages-text", + "protocol": "anthropic-messages", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/anthropic-messages-tools", + "protocol": "anthropic-messages", + "scope": "tools", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/json", + "protocol": "chat-completions", + "scope": "text", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/streaming-override", + "protocol": "chat-completions", + "scope": "streaming", + "expected": "success", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/m4-error", + "protocol": "chat-completions", + "scope": "text", + "expected": "error", + "requests": 1, + "passed": true + }, + { + "prefix": "preflight/m4-unknown", + "protocol": "chat-completions", + "scope": "text", + "expected": "unknown", + "requests": 1, + "passed": true + } + ], + "firstError": null, + "realModelRequests": 0 + } + ], + "finalSourceFiles": [ + { + "path": "scripts/m4-live/common.mjs", + "bytes": 8155, + "sha256": "df14cc482dcac914ac70d57d7ee8ed4df4be8c06281c2ead49963977b33e0cb3" + }, + { + "path": "scripts/m4-live/compatibility.mjs", + "bytes": 7897, + "sha256": "fac6e3edd6068e7369ce60e311480adf282b95f1a5a61ad3bd4ce3d5babb1ce6" + }, + { + "path": "scripts/m4-live/initial.mjs", + "bytes": 2419, + "sha256": "8e1207dc8d483418efae6ded248ef689857ed300c2db43a413e5b169728dafcd" + }, + { + "path": "scripts/m4-live/inspector.mjs", + "bytes": 3432, + "sha256": "c179f4e0236d5b03d61965e491eb5e4f1de45f881efa2885008c474eb3c36b8b" + }, + { + "path": "scripts/m4-live/payload.mjs", + "bytes": 7371, + "sha256": "914e27ae815fd79f8ed70604297c154b8874cb1a72e5e1ecd11286f19c5b21ff" + }, + { + "path": "scripts/m4-live/project.mjs", + "bytes": 4497, + "sha256": "16264b327e73a82476a5ae8ebada6b96189e0197d8a9f4423a6eb807b9f3f3da" + }, + { + "path": "scripts/m4-live/run.mjs", + "bytes": 11666, + "sha256": "0657f9e7489389f7991f8ba9646bed0d7289e22acbb0afe949b9443ea09a789f" + }, + { + "path": "scripts/m4-live/share-existing-ad.mjs", + "bytes": 8732, + "sha256": "71b0fdbd12dcdbbeae1d274c06d557a407c92ff37ff61d499a53e160aeccf204" + }, + { + "path": "scripts/m4-live/verify-driver.mjs", + "bytes": 15450, + "sha256": "066e7a9277186b9c56203d54e72ea9608a16b1b7833787e8926993c9d31a4af3" + } + ], + "scope": "Final byte-download path and all three protocols, source captures, exact cancel/error status, original Node checks, owner/index, Git and config restoration. First failures retained; no provider capability or autonomous-engineering claim." +} diff --git a/findings.md b/findings.md index 94fa2c87..bd5be2d9 100644 --- a/findings.md +++ b/findings.md @@ -1451,3 +1451,7 @@ New API学习:305正文/201嵌入定义已分别审读;来源清单与逐篇 2026-11-11:正式宽窄四图实看和final后正常恢复新版桌面,后台未重启;选择性782份811582693字节清单611c4c40逐件核对,旧封存清单exact。Mnemo桥默认关闭/单项目/只共享明确来源修订/凭据宿主内存范围不变;真实Mnemo生产绑定和真实模型语义/长期/物理iPhone/Purge收益保持unknown。 2026-11-11 1.25.13正式交付推送完成:验收1e309700及打包修复35a6d6d9已普通增量推送至既有GitAtlas分支,远端与重新fetch逐SHA一致;docs/gitatlas-mnemo-1.25.13-push.json随完成接续另提交并核最终HEAD。正式后台仍63892/1.25.13,新版桌面已恢复;782封存原件保持、0真实模型/Key提取重存,下一M4新真实基线,Mnemo生产绑定与真实收益未知保持。 + +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或扩大授权。 diff --git a/progress.md b/progress.md index c5fc6430..a208527b 100644 --- a/progress.md +++ b/progress.md @@ -2199,3 +2199,13 @@ New API研究阶段一234b76cc已提交;阶段二逐篇305正文/201接口全 2026-11-11 正式网页/实际Electron宽窄四图均实看,final再次原数据exact/9229关闭;新版桌面正常恢复登记PID71480,后台仍63892。782份811582693字节选择性原件清单611c4c40封存后逐件核验、旧M3/B4b清单原字节exact。报告和身份已生成,限定验收提交/普通GitAtlas增量推送收尾。0真实模型/Key提取重存、无原任务续跑;Mnemo默认关闭,真实生产绑定/长期/语义/物理手机/Purge收益unknown保持。 2026-11-11 1.25.13正式交付推送完成:验收1e309700及打包修复35a6d6d9已普通增量推送至既有GitAtlas分支,远端与重新fetch逐SHA一致;docs/gitatlas-mnemo-1.25.13-push.json随完成接续另提交并核最终HEAD。正式后台仍63892/1.25.13,新版桌面已恢复;782封存原件保持、0真实模型/Key提取重存,下一M4新真实基线,Mnemo生产绑定与真实收益未知保持。 + +2026-11-11 M4开始:读取规范/两主计划/官方路线/规划尾部及AD/AE参考;catchup退出0无未同步报告。首次公开API观察保存.qa/m4-live-baseline-2026-11-11/observation.json,正式63892/1.25.13空闲,六连接无凭据;异步请求界面恢复,0真实请求。读取期间猜测的validate.mjs及顶层model-hub/ledger路径不存在,已改用rg文件清单定位,不修改旧驱动或证据。新M4计划已写,阶段2准备进行中。 + +2026-11-11 M4:用户已恢复三模型,公开确认DeepSeek20/Claude8/Responses15及三credentialRevision1;原选择仍Claude单成员池。新驱动改用完整公开账本、Messages精确必填字段和原错误/取消/owner全部index核对。首隔离驱动m4-driver-a01e6b39完成8正常预检及1原HTTP错误,主动取消案例原账本为interrupted/unknown,验证器错误期望failed而退出,0真实模型、Node阶段未执行;保留首原件,仅修准确状态断言后另新根复验。 + +2026-11-11 M4第二隔离驱动m4-driver-16e746a7:10预检/错误/取消通过,固定Node实际5请求/840合成tokens、原9/9/build/限定Git与owner全部index完成,但收尾误把legacy-default公开revision(跟随configRevision,由2到4)要求原值而失败,原结果不改绿。已按准确configRevision增量逐字段核对公开legacy投影,真实连接所有定义仍要求exact;不改产品默认、原检查或模型参数,另新根验证。只读AD索引首组装发现两检查日志描述符未列入旧session预览,改按实际缺项登记,未补读整个数据库;r2两个原报告按SHA原字节复制,46允许文件/2缺项、原in_progress和终端Git保持,0新工程/模型/Git写入或回信。 + +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限定提交后启动真实冻结。 diff --git a/scripts/m4-live/common.mjs b/scripts/m4-live/common.mjs new file mode 100644 index 00000000..620dc253 --- /dev/null +++ b/scripts/m4-live/common.mjs @@ -0,0 +1,119 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { Agent, fetch } from 'undici'; +import { messagesOutputSetting } from '../../src/shared/contracts/model-capacity.mjs'; + +export let root = path.resolve('.qa/m4-live-baseline-2026-11-11'); +export let origin = 'http://127.0.0.1:4318'; +export function configureFixture(options) { + const target = path.resolve(options.root), url = new URL(options.origin); + assert.equal(path.dirname(target), path.resolve('.qa')); + assert.match(path.basename(target), /^m4-driver-[a-f0-9-]{36}$/); + assert.equal(url.hostname, '127.0.0.1'); assert.ok(url.port && url.port !== '4318'); + root = target; origin = url.origin; +} +export const sha = bytes => createHash('sha256').update(bytes).digest('hex'); +export const read = relative => JSON.parse(fs.readFileSync(path.join(root, relative), 'utf8')); +export function save(relative, value) { + const file = path.resolve(root, relative); + assert.ok(file.startsWith(root + path.sep), 'Evidence must stay inside its new root.'); + 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 connectionDefinition(value) { + const { health, status, activeRequests, ...definition } = value; + return definition; +} +export function compareConfig(before, after) { + assert.ok(Number.isInteger(after.configRevision) && after.configRevision >= before.configRevision); + assert.deepEqual({ ...after, configRevision: before.configRevision }, before); + return { originalRevision: before.configRevision, currentRevision: after.configRevision, otherFields: 'exact' }; +} +export function compareConnectionDefinitions(before, after, beforeConfig, afterConfig) { + assert.deepEqual(after.connections.map(value => value.id), before.connections.map(value => value.id)); + const changes = []; + for (let index = 0; index < before.connections.length; index++) { + const original = connectionDefinition(before.connections[index]), current = connectionDefinition(after.connections[index]); + if (original.id === 'legacy-default') { + // The legacy public projection uses configRevision, rather than a saved + // connection revision. Both deliberate select/restore saves advance it. + const expected = original.revision + afterConfig.configRevision - beforeConfig.configRevision; + assert.equal(current.revision, expected, 'Legacy projection tracks the exact declared config revision increment.'); + changes.push({ id: original.id, originalRevision: original.revision, currentRevision: current.revision, reason: 'public-legacy-projection-of-configRevision' }); + current.revision = original.revision; + } + assert.deepEqual(current, original, 'All original connection fields: ' + original.id); + } + return { originalFields: 'exact', declaredPublicProjectionChanges: changes }; +} +export function expectedOutputFields(connection) { + const fields = Object.fromEntries(['max_tokens', 'max_output_tokens', 'max_completion_tokens'] + .filter(key => Object.hasOwn(connection.nativeParameters ?? {}, key)).map(key => [key, connection.nativeParameters[key]])); + if (connection.protocol !== 'anthropic-messages') return { fields, source: Object.keys(fields).length ? 'explicit_native' : 'passthrough_no_local_output_cap' }; + const setting = messagesOutputSetting(connection); + if (setting.value !== undefined) fields.max_tokens = setting.value; + return { fields, source: setting.source, declaration: setting }; +} +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, response: value }); + return value; + }; + const boot = await api('/bootstrap'); token = boot.token; + api.download = async (route, timeout = 30000) => { + const response = await fetch(origin + '/api' + route, { dispatcher, method: 'GET', redirect: 'error', signal: AbortSignal.timeout(timeout), + headers: { 'X-Workbench-Token': token, Connection: 'close' } }); + if (!response.ok) throw Object.assign(new Error(route + ': artifact download HTTP ' + response.status), { status: response.status }); + return Buffer.from(await response.arrayBuffer()); + }; + // The bootstrap authentication token is only kept in this client's closure. + delete boot.token; + return { api, boot, close: () => dispatcher.close() }; +} +export async function sessionAttempts(api, sessionId) { + let cursor, total, snapshot; const rows = [], references = []; + do { + const page = await api('/model-center/attempts?sessionId=' + sessionId + '&limit=50' + (cursor ? '&cursor=' + encodeURIComponent(cursor) : '')); + if (total === undefined) { total = page.total; snapshot = page.snapshotSequence; } + assert.equal(page.total, total); assert.equal(page.snapshotSequence, snapshot); + rows.push(...page.items); references.push(...page.references); cursor = page.nextCursor; + assert.equal(page.hasMore, !!cursor); + } while (cursor); + assert.equal(rows.length, total); assert.equal(new Set(rows.map(value => value.id)).size, total); + // Public pages are newest first. Store experiment receipts in dispatch order. + return { rows: rows.reverse(), references: references.reverse(), total, snapshot }; +} +export async function artifactBytes(api, sessionId, artifact) { + assert.equal(typeof api.download, 'function', 'Original artifacts need the byte-preserving download path.'); + const bytes = await api.download('/artifacts/' + artifact.id + '?session=' + sessionId + '&download=1'); + assert.equal(sha(bytes), artifact.sha256); if (artifact.bytes !== undefined) assert.equal(bytes.length, artifact.bytes); + return bytes; +} +export async function captureSession(api, sessionId, prefix) { + const state = await api('/sessions/' + sessionId), exported = await api('/sessions/' + sessionId + '/export'); + save(prefix + '/session.json', state); save(prefix + '/export.json', exported); + const ledger = await sessionAttempts(api, sessionId); save(prefix + '/attempts.json', ledger.rows); save(prefix + '/ledger-references.json', ledger); + const captures = [], capturedIds = new Set(); + for (const row of ledger.rows) for (const kind of ['request', 'response']) { + const id = row[kind + 'ArtifactId']; if (!id) continue; + const artifact = state.execution.artifacts.find(value => value.id === id) ?? { id, sha256: row[kind + 'Sha256'] }; + const bytes = await artifactBytes(api, sessionId, artifact); + assert.equal(sha(bytes), row[kind + 'Sha256']); + const relative = prefix + '/captures/' + row.id + '-' + kind + (kind === 'request' ? '.json' : row.streaming ? '.sse' : '.txt'); + save(relative, bytes); captures.push({ attemptId: row.id, artifactId: id, kind, path: relative, sha256: sha(bytes), bytes: bytes.length }); capturedIds.add(id); + } + for (const artifact of state.execution.artifacts) { + if (capturedIds.has(artifact.id) || !/^(text\/|application\/(json|x-ndjson))/.test(artifact.mediaType ?? '')) continue; + const bytes = await artifactBytes(api, sessionId, artifact), relative = prefix + '/artifacts/' + artifact.id + (artifact.mediaType === 'application/json' ? '.json' : '.txt'); + save(relative, bytes); captures.push({ artifactId: artifact.id, kind: artifact.kind, path: relative, sha256: sha(bytes), bytes: bytes.length }); + } + save(prefix + '/artifact-sources.json', captures); + return { state, exported, ...ledger, captures }; +} diff --git a/scripts/m4-live/compatibility.mjs b/scripts/m4-live/compatibility.mjs new file mode 100644 index 00000000..1cbad12f --- /dev/null +++ b/scripts/m4-live/compatibility.mjs @@ -0,0 +1,79 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { randomUUID } from 'node:crypto'; +import { setTimeout as delay } from 'node:timers/promises'; +import { root, save, read, client, captureSession, connectionDefinition, expectedOutputFields } from './common.mjs'; +import { invokeProbe, inspectorClosed } from './inspector.mjs'; + +const frozen = read('frozen.json'); assert.equal(fs.existsSync(path.join(root, 'compatibility')), false, 'Never replay a compatibility batch.'); +save('compatibility/claim.json', { id: randomUUID(), at: new Date().toISOString(), scopes: ['text', 'tools'], streaming: 'Separately assessed from each configured streaming request; no redundant real request.', noRetry: true }); +const { api, boot, close } = await client(), results = []; +try { + assert.equal(boot.version, '1.25.13'); await inspectorClosed(); + assert.equal((await api('/host/status')).identity.pid, frozen.host.identity.pid); + for (const connection of frozen.connections) { + const prefix = 'compatibility/' + connection.id; + assert.deepEqual(connectionDefinition((await api('/model-center')).connections.find(value => value.id === connection.id)), connectionDefinition(connection), 'Frozen connection changed.'); + const result = { connectionId: connection.id, name: connection.name, model: connection.model, protocol: connection.protocol, + endpointKind: new URL(connection.baseUrl).hostname === 'api.deepseek.com' ? 'official-deepseek-endpoint' : 'compatible-proxy-endpoint', preflights: [], media: 'not_exercised_in_this_slice' }; + console.log(JSON.stringify({ phase: 'compatibility', connection: connection.name, protocol: connection.protocol })); + let started; + try { + started = await api('/model-center/network-diagnostics', { id: connection.id, revision: connection.revision }); save(prefix + '/network-start.json', started); + const deadline = Date.now() + 30000; let network; + while (true) { + network = (await api('/model-center/network-diagnostics')).jobs.find(value => value.id === started.job.id); + if (network?.finishedAt) break; + if (Date.now() >= deadline) { network = (await api('/model-center/network-diagnostics/' + started.job.id + '/stop', {})).job; result.networkObservationEnded = true; break; } + await delay(250); + } + save(prefix + '/network.json', network); result.network = network.status; + assert.equal(network.httpRequests, 0); assert.equal(network.modelRequests, 0); assert.equal(network.credentialAccess, false); + } catch (error) { + result.network = 'error'; save(prefix + '/network-error.json', { error: error.stack, response: error.response, noRetry: true }); + if (started?.job?.id) save(prefix + '/network-owned-stop.json', await api('/model-center/network-diagnostics/' + started.job.id + '/stop', {})); + } + const requestId = randomUUID(); + try { + const catalog = await api('/model-center/catalog', { id: connection.id, revision: connection.revision, requestId }, 90000); + save(prefix + '/catalog.json', catalog); result.catalog = { complete: catalog.complete, models: catalog.entries.length, selectedListed: catalog.entries.some(value => value.id === connection.model), + evidenceScope: 'Product catalog preview including its supplied source metadata; no invented raw HTTP artifact.' }; + } catch (error) { result.catalog = { complete: false, error: error.message, response: error.response, noRetry: true }; save(prefix + '/catalog-error.json', result.catalog); } + finally { save(prefix + '/catalog-cancel.json', await api('/model-center/catalog/cancel', { id: requestId })); } + const projectRoot = path.join(root, prefix, 'project'); fs.mkdirSync(projectRoot, { recursive: true }); + fs.writeFileSync(path.join(projectRoot, 'README.md'), 'M4 independent compatibility observations only. No engineering implementation.\n', { flag: 'wx' }); + const project = await api('/projects', { root: projectRoot }); result.projectId = project.id; + for (const scope of ['text', 'tools']) { + const session = await api('/sessions', { projectId: project.id }); + const input = { pid: frozen.host.identity.pid, port: 4318, runtimeRoot: boot.runtimeRoot, projectId: project.id, sessionId: session.id, connection, + scope, nonce: randomUUID(), expectedOutput: expectedOutputFields(connection), observationMs: 180000 }; + save(prefix + '/' + scope + '/input.json', input); let invoked; + try { invoked = await invokeProbe(input); save(prefix + '/' + scope + '/invocation.json', invoked); } + catch (error) { save(prefix + '/' + scope + '/invocation-error.json', { error: error.stack, noRetry: true }); } + const captured = await captureSession(api, session.id, prefix + '/' + scope), attempt = captured.rows[0]; + const request = captured.captures.find(value => value.attemptId === attempt?.id && value.kind === 'request'); + const response = captured.captures.find(value => value.attemptId === attempt?.id && value.kind === 'response'); + const body = request ? JSON.parse(fs.readFileSync(path.join(root, request.path), 'utf8')) : null; + const raw = response ? fs.readFileSync(path.join(root, response.path), 'utf8') : ''; + const outputFields = body ? Object.fromEntries(['max_tokens', 'max_output_tokens', 'max_completion_tokens'].filter(key => Object.hasOwn(body, key)).map(key => [key, body[key]])) : null; + const streaming = { requested: body?.stream === true, sseObserved: /^(?:event:|data:)/m.test(raw), complete: attempt?.status === 'completed' && attempt?.modelIdentity?.complete === true }; + const wirePassed = !!body && JSON.stringify(outputFields) === JSON.stringify(input.expectedOutput.fields) && (!body.stream || streaming.sseObserved); + const passed = !!invoked?.result.contentPassed && invoked.result.actualToolsExecuted === 0 && captured.total === 1 && wirePassed + && attempt.status === 'completed' && attempt.modelIdentity?.status === 'matched' && attempt.modelIdentity.complete === true; + const entry = { scope, passed, sessionId: session.id, taskId: invoked?.result.taskId, runId: invoked?.result.runId, identity: attempt?.modelIdentity ?? null, + usage: attempt?.usage ?? null, usageStatus: attempt?.usageStatus ?? 'not_dispatched', status: attempt?.status ?? 'not_dispatched', + diagnostic: invoked?.result.diagnostic ?? null, actualToolsExecuted: invoked?.result.actualToolsExecuted ?? null, requests: captured.total, + streaming, wirePassed, outputFields, expectedOutput: input.expectedOutput, captures: captured.captures }; + save(prefix + '/' + scope + '/result.json', entry); result.preflights.push(entry); + console.log(JSON.stringify({ connection: connection.name, scope, passed, identity: entry.identity?.status, usageStatus: entry.usageStatus, streaming, outputFields, diagnostic: entry.diagnostic?.kind })); + assert.ok(captured.total <= 1); await inspectorClosed(); + } + result.engineeringAllowed = result.catalog.complete && result.catalog.selectedListed && result.preflights.every(value => value.passed && value.usageStatus === 'reported'); + save(prefix + '/result.json', result); results.push(result); + } + const center = await api('/model-center'); + assert.deepEqual(center.selected, frozen.center.selected); assert.deepEqual(center.connections.map(connectionDefinition), frozen.center.connections.map(connectionDefinition)); assert.deepEqual(center.pools, frozen.center.pools); + save('compatibility/result.json', { completed: true, results, requests: results.reduce((sum, row) => sum + row.preflights.reduce((n, value) => n + value.requests, 0), 0), + connectionDefinitionsPoolsSelection: 'exact', healthChangesRetained: true, keysReadOrResaved: false, historicalSamplesReplayed: false }); +} finally { await inspectorClosed(); await close(); } diff --git a/scripts/m4-live/initial.mjs b/scripts/m4-live/initial.mjs new file mode 100644 index 00000000..540d1b6e --- /dev/null +++ b/scripts/m4-live/initial.mjs @@ -0,0 +1,25 @@ +import fs from 'node:fs'; +import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; +import { root, origin, save, client, expectedOutputFields } from './common.mjs'; +import { publicSnapshot } from '../retained-host-state.mjs'; +import { inspectorClosed } from './inspector.mjs'; + +assert.ok(fs.existsSync(root)); assert.equal(fs.existsSync(root + '/frozen.json'), false, 'Freeze this batch once.'); +assert.equal(execFileSync('git', ['status', '--porcelain'], { encoding: 'utf8', windowsHide: true }).trim(), '', 'Commit and verify the new driver before real requests.'); +const { api, boot, close } = await client(); +try { + await inspectorClosed(); const host = await api('/host/status'), center = await api('/model-center'); + assert.equal(boot.version, '1.25.13'); assert.equal(host.activity.active, false); + for (const [key, expected] of Object.entries({ executionMode: 'unrestricted', capacityMode: 'passthrough', approvalMode: 'full', maxSteps: 0, maxRunTokens: 0, maxTaskTokens: 0 })) assert.equal(boot.config[key], expected, key); + const connections = center.connections.filter(value => value.enabled && value.hasKey); assert.ok(connections.length > 0, 'Restore credentials in Model Center before freezing.'); + const priority = connections.slice().sort((a, b) => { + const rank = value => new URL(value.baseUrl).hostname === 'api.deepseek.com' ? 0 : value.protocol === 'responses' ? 1 : value.protocol === 'chat-completions' ? 2 : 3; + return rank(a) - rank(b) || a.id.localeCompare(b.id); + }).map(value => value.id); + const baseline = await publicSnapshot(origin, host.identity.dataRoot); + save('frozen.json', { observedAt: new Date().toISOString(), host, config: boot.config, center, connections, baseline, originalProjects: boot.projects, + engineeringPriority: priority, outputFields: Object.fromEntries(connections.map(value => [value.id, expectedOutputFields(value)])), + driverCommit: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim(), modelRequests: 0, historicalSamplesReplayed: false, keysReadOrResaved: false }); + console.log(JSON.stringify({ frozen: true, version: boot.version, pid: host.identity.pid, connections: connections.map(value => ({ id: value.id, name: value.name, protocol: value.protocol, model: value.model, revision: value.revision })), priority, modelRequests: 0 })); +} finally { await close(); } diff --git a/scripts/m4-live/inspector.mjs b/scripts/m4-live/inspector.mjs new file mode 100644 index 00000000..5e61ac90 --- /dev/null +++ b/scripts/m4-live/inspector.mjs @@ -0,0 +1,56 @@ +import assert from 'node:assert/strict'; +import net from 'node:net'; +import { setTimeout as delay } from 'node:timers/promises'; +import { providerPreflight } 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', error => { socket.destroy(); error.code === 'ECONNREFUSED' ? resolve(true) : reject(error); }); + 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 message = JSON.parse(String(event.data)); if (!message.id) return; + const pending = this.pending.get(message.id); if (!pending) return; + this.pending.delete(message.id); clearTimeout(pending.timer); + message.error ? pending.reject(Error(message.error.message)) : pending.resolve(message.result); + }); + socket.addEventListener('close', () => { for (const pending of this.pending.values()) { clearTimeout(pending.timer); pending.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 invokeProbe(input) { + await inspectorClosed(); let socket, protocol, enabled = false; + try { + process._debugProcess(input.pid); enabled = true; let targets; + for (let index = 0; index < 40 && !targets; index++) { + 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 = '(' + providerPreflight.toString() + ')(' + JSON.stringify(input) + ')'; + const result = await protocol.send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true }, input.observationMs + 30000); + 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/m4-live/payload.mjs b/scripts/m4-live/payload.mjs new file mode 100644 index 00000000..898ffec3 --- /dev/null +++ b/scripts/m4-live/payload.mjs @@ -0,0 +1,66 @@ +// A one-shot compatibility observation in a new owned session. This function +// calls the existing Provider; it never reads or returns any credential value. +export async function providerPreflight(input) { + const ensure = (value, message) => { if (!value) throw Error(message); }; + ensure(process.pid === input.pid, 'Host PID changed.'); + 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 loopback host.'); + const { store, provider, runtime } = servers[0].workbenchHostAuthority.context; + ensure(runtime.appDirectory === input.runtimeRoot, 'Runtime changed.'); ensure(!runtime.active.size, 'Host is busy.'); + const session = store.session(input.sessionId), project = store.project(session.projectId), hub = provider.modelHub(store); + ensure(session.projectId === input.projectId && !session.runId && !session.messages.length, 'Only a fresh owned session may run.'); + const connection = hub.view().connections.find(value => value.id === input.connection.id); + ensure(connection?.enabled && connection.hasKey && connection.revision === input.connection.revision + && connection.credentialRevision === input.connection.credentialRevision && connection.model === input.connection.model + && connection.protocol === input.connection.protocol && connection.baseUrl === input.connection.baseUrl, 'Frozen connection changed.'); + globalThis.__workbenchM4Preflights ??= new Set(); + ensure(!globalThis.__workbenchM4Preflights.has(session.id), 'A preflight cannot be replayed.'); globalThis.__workbenchM4Preflights.add(session.id); + const config = hub.prepare({ ...store.config, mode: 'compatible' }, { type: 'connection', id: connection.id }); + ensure(config.capacityMode === 'passthrough' && config.executionMode === 'unrestricted', 'Keep default passthrough.'); + // A single physical request is this experiment's design, not a saved quota. + config.modelRouting.maxAttempts = 1; + config.modelRouting.members = config.modelRouting.members.map(value => ({ ...value, modelIdentityPolicy: 'require-match', + ...(input.scope === 'streaming' ? { streaming: true } : {}) })); + const tools = input.scope === 'tools' ? [{ type: 'function', function: { name: 'workbench_m4_echo_nonce', description: 'Echo the supplied compatibility nonce. No file or command operation.', + parameters: { type: 'object', properties: { nonce: { type: 'string' } }, required: ['nonce'], additionalProperties: false } } }] : []; + const prompt = input.scope === 'tools' ? 'Call workbench_m4_echo_nonce exactly once with nonce ' + input.nonce + '. No other task.' : 'Reply exactly: OK ' + input.nonce; + const run = store.beginRun(session, prompt, false, config, { forceNewTask: true }), user = store.message(session, 'user', prompt); + run.inputMessage = { id: user.id, providerIndex: 0, origin: 'user' }; session.providerMessages.push({ role: 'user', content: prompt }); + session.status = 'running'; const step = store.beginStep(session, run), planner = runtime.requestPlanner(); + const controller = new AbortController(), timer = setTimeout(() => controller.abort(Error('Predeclared M4 observation ended; do not replay.')), input.observationMs); + let plan, response, diagnostic = null, event, receipts = 0; const wireIds = new Set(); + try { + plan = planner.prepare(session, run, config, { system: 'Connection compatibility preflight only. Follow the user exactly. Do not perform project work.', tools, stepId: step.id }); + const variants = plan.body.kind === 'model-route-plan' ? plan.body.variants.map(value => value.body) : [plan.body]; + ensure(variants.length === 1, 'A frozen preflight must have one route.'); + for (const body of variants) { + const actual = Object.fromEntries(['max_tokens', 'max_output_tokens', 'max_completion_tokens'].filter(key => Object.hasOwn(body, key)).map(key => [key, body[key]])); + ensure(JSON.stringify(actual) === JSON.stringify(input.expectedOutput.fields), 'Output fields must equal explicit settings or the Messages protocol requirement.'); + } + response = await provider.complete(config, plan.messages, project, controller.signal, progress => { + if (progress.consumption) { receipts += Number(store.recordConsumption(session, run, { ...progress.consumption, requestId: plan.record.id }, plan.record.tokenReservation?.reservedTokens ?? plan.record.estimatedInputTokens)); return; } + if (progress.phase === 'running' && progress.wireAttemptId) { wireIds.add(progress.wireAttemptId); ensure(wireIds.size === 1, 'No retry permitted.'); } + event ??= store.event(session, { kind: 'model', source: 'model_connection', label: 'M4 单次兼容预检', phase: 'running', runId: run.id, contextPlanId: plan.record.id, startedAt: new Date().toISOString() }); + for (const key of ['modelAttemptId', 'connectionId', 'modelIdentity', 'requestUrl', 'diagnostic', 'stream', 'phase']) if (progress[key] !== undefined) event[key] = progress[key]; + plan.record.requestAttempts = wireIds.size; step.modelAttempts = wireIds.size; store.save(session); + }, plan.record, tools, { attempts: 1, maxBudgetAttempts: 1 }); + planner.finish(session, plan.record, { response, attempts: wireIds.size }); + // An observed tool call is not executed or inserted as an unpaired call. + if (!response.message.tool_calls?.length) session.providerMessages.push(response.message); + store.message(session, 'assistant', response.message.content || '已收到原工具调用,预检不执行工具。'); session.status = 'completed'; + } catch (cause) { + diagnostic = cause.diagnostic ?? { source: 'workbench', origin: 'local', stage: 'preflight', kind: controller.signal.aborted ? 'observation_stop' : 'runtime', message: provider.redact(cause.message) }; + session.status = 'failed'; session.lastFailure = { ...diagnostic, runId: run.id }; store.message(session, 'system', diagnostic.message); + if (plan) planner.finish(session, plan.record, { error: new Error(diagnostic.message), attempts: wireIds.size }); + } finally { + clearTimeout(timer); if (event) { event.phase = diagnostic ? 'failed' : 'completed'; event.finishedAt = new Date().toISOString(); } + store.finishStep(session, step, diagnostic ? 'failed' : 'completed'); store.finishRun(session, run, diagnostic ? diagnostic.kind : 'm4_compatibility_preflight'); + } + const ledger = hub.ledger.page({ filters: { sessionId: session.id }, limit: 2 }); ensure(ledger.total <= 1 && ledger.items.length === ledger.total, 'Single-request contract violated.'); + const calls = response?.message?.tool_calls ?? []; let contentPassed = false; + try { contentPassed = input.scope === 'tools' ? calls.length === 1 && calls[0].function.name === 'workbench_m4_echo_nonce' + && JSON.parse(calls[0].function.arguments).nonce === input.nonce : !calls.length && response?.message?.content?.trim() === 'OK ' + input.nonce; } catch {} + return { sessionId: session.id, taskId: run.taskId, runId: run.id, scope: input.scope, status: session.status, diagnostic, + attempts: ledger.total, wireStarts: wireIds.size, receipts, actualToolsExecuted: run.toolCalls, contentPassed, + outputFieldsSource: input.expectedOutput.source, savedConfigurationChanged: false, message: response?.message ?? null, usage: run.usage }; +} diff --git a/scripts/m4-live/project.mjs b/scripts/m4-live/project.mjs new file mode 100644 index 00000000..740a6892 --- /dev/null +++ b/scripts/m4-live/project.mjs @@ -0,0 +1,42 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { execFileSync, spawnSync } from 'node:child_process'; +import { gitEnvironment } from '../../src/core/git-process.mjs'; +import { prepareProject as prepareSecondary, python, specs as secondarySpecs } from '../live-ae/project.mjs'; +import { sha } from './common.mjs'; + +// The old project module supplies only preparation/check helpers. It does not +// load an old claim, connection, session, model result or real-batch entry point. +export { python }; +export const specs = { node: { baseline: 'benchmarks/live-delivery-v1/node', allowed: ['src/amount.mjs', 'src/summary.mjs', 'src/report.mjs'], tests: 9 }, ...secondarySpecs }; +export function prepareProject(kind, output, save) { + if (kind !== 'node') return prepareSecondary(kind, output, save); + const spec = specs.node, sourceRoot = path.join(output, 'project'); assert.equal(fs.existsSync(sourceRoot), false); + fs.mkdirSync(output, { recursive: true }); fs.cpSync(spec.baseline, sourceRoot, { recursive: true, errorOnExist: true }); + const git = args => execFileSync('git', ['--no-pager', '--no-optional-locks', '-C', sourceRoot, ...args], { encoding: 'utf8', windowsHide: true, env: gitEnvironment() }); + fs.writeFileSync(path.join(sourceRoot, 'README.md'), '# M4 independent Node baseline\nRepair the three src modules using the original nine tests. Preserve owner bytes and their staging.\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 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 M4 independent Node original baseline']); const initialHead = git(['rev-parse', 'HEAD']).trim(); + fs.writeFileSync(path.join(sourceRoot, 'owner-staged.txt'), 'Owner staged change\n'); git(['add', '--', 'owner-staged.txt']); + fs.writeFileSync(path.join(sourceRoot, 'owner-staged.txt'), 'Owner unstaged over original 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 all = git(['ls-files', '-z']).split('\0').filter(Boolean), protectedNames = all.filter(name => !spec.allowed.includes(name)).concat('owner-untracked.txt'); + const protectedBytes = Object.fromEntries(protectedNames.map(name => [name, fs.readFileSync(path.join(sourceRoot, name))])); + const index = git(['ls-files', '--stage', '--', ...protectedNames]); + const protect = () => { + for (const [name, bytes] of Object.entries(protectedBytes)) assert.deepEqual(fs.readFileSync(path.join(sourceRoot, name)), bytes, 'Protected file: ' + name); + assert.equal(git(['ls-files', '--stage', '--', ...protectedNames]), index, 'All protected original index entries'); + }; + const check = (name, args, prefix) => { + const execution = spawnSync(process.execPath, args, { cwd: sourceRoot, windowsHide: true, encoding: 'utf8', env: gitEnvironment(), maxBuffer: 16 * 1024 * 1024 }); + save(prefix + '/' + name + '.txt', (execution.stdout ?? '') + (execution.stderr ?? '')); + const stats = name === 'test' ? Object.fromEntries(['tests', 'pass', 'fail', 'cancelled', 'skipped', 'todo'].map(key => [key, Number(execution.stdout?.match(new RegExp('^# ' + key + ' (\\d+)$', 'm'))?.[1] ?? NaN)])) : null; + return { status: execution.status, signal: execution.signal, error: execution.error?.message ?? null, stats, stdoutSha256: sha(execution.stdout ?? ''), stderrSha256: sha(execution.stderr ?? '') }; + }; + const checks = prefix => { const result = { test: check('test', ['--test', '--test-reporter=tap', 'test/expense.test.mjs'], prefix), build: check('build', ['scripts/build.mjs'], prefix) }; save(prefix + '/result.json', result); protect(); return result; }; + save('source-before.json', { initialHead, status: git(['status', '--porcelain=v1']), protectedIndex: index, files: Object.fromEntries([...all, 'owner-untracked.txt'].map(name => [name, sha(fs.readFileSync(path.join(sourceRoot, name)))])) }); + return { spec, sourceRoot, git, initialHead, protect, checks }; +} diff --git a/scripts/m4-live/run.mjs b/scripts/m4-live/run.mjs new file mode 100644 index 00000000..ffbbe425 --- /dev/null +++ b/scripts/m4-live/run.mjs @@ -0,0 +1,98 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { randomUUID } from 'node:crypto'; +import { setTimeout as delay } from 'node:timers/promises'; +import { root, save, read, client, sha, captureSession, connectionDefinition, compareConfig, compareConnectionDefinitions } from './common.mjs'; +import { prepareProject, python, specs } from './project.mjs'; +import { verifyLiveReactClient } from '../live-react-client.mjs'; + +const kind = process.argv[2]; assert.ok(Object.hasOwn(specs, kind)); +const frozen = read('frozen.json'), compatibility = read('compatibility/result.json'); +if (kind !== 'node') assert.equal(read((kind === 'react' ? 'node' : 'react') + '/result.json').success, true, 'The previous engineering baseline must fully pass.'); +const connectionId = kind === 'node' ? frozen.engineeringPriority.find(id => compatibility.results.some(value => value.connectionId === id && value.engineeringAllowed)) : read('node/result.json').connectionId; +assert.equal(fs.existsSync(path.join(root, kind)), false, 'Do not replay an engineering sample.'); +if (!connectionId) { save(kind + '/result.json', { success: false, executed: false, reason: 'No connection passed the predeclared compatibility gate.', purgeExecuted: false }); process.exit(0); } +const { api, boot, close } = await client(); let session, route, selected = false, original, own, failure, result, state, selectionRevision; +const observations = [], facts = new Set(), output = path.join(root, kind), store = (file, value) => save(kind + '/' + file, value); +const settle = async () => { + if (!route) return; state = await api(route); + if (['running', 'stopping', 'awaiting_approval'].includes(state.status)) { await api(route + '/stop', {}, 60000); state = await api(route); } + assert.ok(!['running', 'stopping', 'awaiting_approval'].includes(state.status), 'Only a quiescent owned task can be independently checked.'); +}; +try { + const host = await api('/host/status'); assert.equal(host.activity.active, false); assert.equal(host.identity.pid, frozen.host.identity.pid); assert.equal(boot.version, '1.25.13'); + compareConfig(frozen.config, boot.config); const center = await api('/model-center'); assert.deepEqual(center.selected, frozen.center.selected); assert.deepEqual(center.pools, frozen.center.pools); + original = center.connections.find(value => value.id === connectionId); + assert.deepEqual(connectionDefinition(original), connectionDefinition(frozen.connections.find(value => value.id === connectionId))); + store('claim.json', { id: randomUUID(), kind, connection: original, config: boot.config, source: specs[kind].baseline, allowed: specs[kind].allowed, + observationMs: 600000, noNewFactMs: 180000, implementationSupplied: false, supervisorContinuation: false, localTokenCaps: false, identityPolicySaved: false }); + own = prepareProject(kind, output, store); const baseline = own.checks('baseline'); assert.equal(baseline.test.stats.tests, own.spec.tests); assert.ok(baseline.test.stats.fail > 0); assert.equal(baseline.build.status, 0); + const project = await api('/projects', { root: own.sourceRoot }); session = await api('/sessions', { projectId: project.id }); route = '/sessions/' + session.id; store('owned.json', { project, session }); + const selection = await api('/model-center/select', { type: 'connection', id: connectionId }); selected = true; selectionRevision = selection.config.configRevision; + const goals = { + node: '请独立修复这个Node费用报表工程,使原九项测试和build通过,并完成本地Git交付。只修改src/amount.mjs、src/summary.mjs、src/report.mjs;按原测试理解金额、币种汇总和报表要求,不修改原测试、package配置、构建脚本、README或owner文件,保留原有暂存/未暂存/未跟踪状态。请自行读取、修改、执行检查并提交。', + react: '独立完成这个React/TypeScript看板工程README要求,修复状态筛选、去空白搜索、实际统计、按目标任务切换与空态,保留既有样式和布局。只修改src/query.ts、src/summary.ts、src/transition.ts、src/App.tsx。自行读取源码及原九项测试、运行test/typecheck/build并完成仅这四文件的本地Git提交。依赖已按原锁离线准备;不可改原测试、配置、锁、其它源码/样式、README和owner文件,保留原暂存/未暂存/未跟踪状态。', + python: '独立完成这个Python任务报表工程README的规范化、汇总与渲染契约。只修改normalize.py、summary.py、render.py。自行读取源码及原十项测试,运行pytest与源码编译并完成仅这三文件的本地Git提交。现成解释器为 ' + python + ',已装pytest,无需安装依赖。不可改原测试、配置、README和owner文件,保留原暂存/未暂存/未跟踪状态。', + }; + const prompt = goals[kind] + ' 当前为完全访问权限,可用工程工具或终端自动执行,无需独立审查,不要只解释方案或口头完成,不推送远端。'; + store('goal.txt', prompt); await api(route + '/messages', { content: prompt }); const started = Date.now(); let novel = started, signature = ''; + while (true) { + state = await api(route); own.protect(); + for (const event of state.events.filter(value => value.kind === 'tool' && value.phase === 'completed' && ['read_file', 'read_artifact', 'list_files', 'query_code', 'search_files'].includes(value.tool))) { + const key = event.tool + JSON.stringify(event.input) + sha(event.output ?? ''); if (!facts.has(key)) { facts.add(key); novel = Date.now(); } + } + const current = JSON.stringify({ files: own.spec.allowed.map(name => sha(fs.readFileSync(path.join(own.sourceRoot, name)))), checks: state.execution.checks.map(value => ({ status: value.status, source: value.sourceFingerprint })) }); + if (current !== signature) { signature = current; novel = Date.now(); } + const observation = { kind, status: state.status, requests: state.execution.task?.usage.requests, tokens: state.execution.task?.usage.totalTokens, facts: facts.size, + changes: state.changes.length, checks: state.execution.checks.map(value => value.status), lastTool: state.events.filter(value => value.kind === 'tool').at(-1)?.tool }; + if (JSON.stringify(observation) !== JSON.stringify(observations.at(-1))) { observations.push(observation); console.log(JSON.stringify(observation)); } + if (!['running', 'stopping', 'awaiting_approval'].includes(state.status)) break; + if (Date.now() - started > 600000 || Date.now() - novel > 180000) { failure = { reason: 'experiment_observation_ended', elapsedMs: Date.now() - started, noNewFactMs: Date.now() - novel, productBudgetChanged: false }; break; } + await delay(750); + } + await settle(); own.protect(); const final = own.checks('independent-final'); let browser = null; + if (kind === 'react' && Object.values(final).every(value => value.status === 0)) { + try { browser = await verifyLiveReactClient(own.sourceRoot, path.join(output, 'browser')); } catch (error) { browser = { success: false, error: error.stack }; } store('browser/result.json', browser); + } + const commit = own.git(['rev-parse', 'HEAD']).trim(), paths = own.git(['diff', '--name-only', own.initialHead, commit]).trim().split(/\r?\n/).filter(Boolean).sort(); + const committedCurrent = own.spec.allowed.every(name => sha(Buffer.from(own.git(['show', commit + ':' + name]))) === sha(fs.readFileSync(path.join(own.sourceRoot, name)))); + const otherUntracked = own.git(['ls-files', '--others', '--exclude-standard']).trim().split(/\r?\n/).filter(name => name && name !== 'owner-untracked.txt'); + result = { success: !failure && state.status === 'completed' && Object.values(final).every(value => value.status === 0) && final.test.stats.tests === own.spec.tests && final.test.stats.pass === own.spec.tests + && commit !== own.initialHead && JSON.stringify(paths) === JSON.stringify(own.spec.allowed.slice().sort()) && committedCurrent && !otherUntracked.length && (kind !== 'react' || browser?.success === true), + kind, executed: true, sessionId: session.id, projectId: project.id, connectionId, commit, initialHead: own.initialHead, committedPaths: paths, committedCurrent, otherUntracked, + final, browser, failure: failure ?? null, productStopReason: state.execution.run?.stopReason ?? null, ownerBytesAndIndexPreserved: true, supervisorContinuations: 0, localTokenCapsChanged: false }; +} catch (error) { result = { success: false, kind, executed: !!session, failure: { error: error.stack, noRetry: true }, sessionId: session?.id, connectionId }; } +finally { + const errors = [], restoration = {}; const guard = async (label, fn) => { try { await fn(); } catch (error) { errors.push({ label, error: error.stack }); } }; + if (route) { + await guard('settle-owned-task', settle); + await guard('capture-owned-task', async () => { + const captured = await captureSession(api, session.id, kind); + const identitiesPassed = captured.total > 0 && captured.rows.every(value => value.connectionId === connectionId && value.status === 'completed' && value.modelIdentity?.complete && value.modelIdentity.status === 'matched') + && captured.state.execution.task.usage.unknownRequests === 0 && captured.state.execution.task.usage.requests === captured.total; + result = { ...result, success: result.success && identitiesPassed, identitiesPassed, requests: captured.total, usage: captured.state.execution.task.usage, taskId: captured.state.execution.task?.id, + runId: captured.state.execution.run?.id, captures: captured.captures, internalDeliveries: captured.state.execution.deliveries.map(value => ({ id: value.id, status: value.status, commit: value.commit })), + reportArtifacts: captured.state.execution.artifacts.filter(value => /^delivery-report/.test(value.kind)).map(value => ({ id: value.id, kind: value.kind, sha256: value.sha256 })) }; + store('git-status.txt', own.git(['status', '--porcelain=v1'])); store('git-log.txt', own.git(['log', '--format=fuller', '--stat', own.initialHead + '..HEAD'])); + }); + } + await guard('restore-selection', async () => { + if (!selected) return; + const center = await api('/model-center'), now = await api('/bootstrap'); + if (center.selected.type === 'connection' && center.selected.id === connectionId && now.config.configRevision === selectionRevision) { + await api('/model-center/select', frozen.center.selected); restoration.selection = frozen.center.selected; + } else restoration.externalSelectionOrConfigChangePreserved = true; + }); + await guard('verify-config-and-definitions', async () => { + restoration.config = (await api('/bootstrap')).config; + if (!restoration.externalSelectionOrConfigChangePreserved) restoration.configComparison = compareConfig(frozen.config, restoration.config); + const center = await api('/model-center'); + restoration.connectionDefinitions = compareConnectionDefinitions(frozen.center, center, frozen.config, restoration.config); + assert.deepEqual(center.pools, frozen.center.pools); restoration.pools = 'exact'; + }); + restoration.keysReadOrResaved = false; restoration.errors = errors; if (errors.length) result = { ...result, success: false, cleanupErrors: errors }; + store('restoration.json', restoration); store('observations.json', observations); store('result.json', result); await close(); +} +console.log(JSON.stringify({ kind, success: result.success, requests: result.requests, usage: result.usage, commit: result.commit, failure: result.failure, cleanupErrors: result.cleanupErrors })); +if (!result.success) process.exitCode = 1; diff --git a/scripts/m4-live/share-existing-ad.mjs b/scripts/m4-live/share-existing-ad.mjs new file mode 100644 index 00000000..ecdccfd8 --- /dev/null +++ b/scripts/m4-live/share-existing-ad.mjs @@ -0,0 +1,76 @@ +// Build a read-only source index from already sealed AD evidence. No model, +// task, command, approval, retry, Git write or native-v2 envelope is produced. +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; +import { createHash } from 'node:crypto'; + +const repository = process.cwd(), evidence = path.resolve('.qa/live-validation-ad'); +const output = path.resolve('.qa/coordination-readonly-2026-11-11-engineering-ad-r2'); +assert.equal(fs.existsSync(output), false, 'Do not overwrite a source handoff.'); +const sha = bytes => createHash('sha256').update(bytes).digest('hex'); +const parse = file => JSON.parse(fs.readFileSync(path.join(evidence, file), 'utf8')); +const originalManifestBytes = fs.readFileSync(path.join(evidence, 'FINAL-MANIFEST.json')); +const originalManifest = JSON.parse(originalManifestBytes), members = new Map(originalManifest.files.map(value => [value.path, value])); +const result = parse('node/result.json'), state = parse('node/session.json'), frozen = parse('current.json'); +const ids = { projectId: state.projectId, sessionId: state.id, taskId: state.execution.task.id, runId: state.execution.run.id }; +assert.equal(ids.taskId, result.taskId); assert.equal(ids.sessionId, result.sessionId); +assert.equal(state.execution.run.taskId, ids.taskId); +fs.mkdirSync(output); const sources = [], missing = []; +const addSealed = relative => { + const member = members.get(relative); assert.ok(member, 'Original manifest member: ' + relative); + const file = path.join(evidence, relative), bytes = fs.readFileSync(file); + assert.equal(bytes.length, member.bytes); assert.equal(sha(bytes), member.sha256); + sources.push({ path: file, bytes: bytes.length, sha256: sha(bytes), origin: 'original-ad-seal', originalRelative: relative }); +}; +for (const file of ['node/goal.txt', 'node/contract.json', 'node/source-before.json', 'node/result.json', 'node/session.json', 'node/export.json', 'node/attempts.json', 'node/git-log.txt', 'node/git-status.txt', + 'node/baseline/test.txt', 'node/baseline/build.txt', 'node/baseline/result.json', 'node/independent-final/test.txt', 'node/independent-final/build.txt', 'node/independent-final/result.json', + 'node/expense-project/package.json', 'node/expense-project/test/expense.test.mjs', 'node/expense-project/scripts/build.mjs', ...result.committedPaths.map(file => 'node/expense-project/' + file), ...result.captures.map(value => value.path)]) addSealed(file); +const plan = execFileSync('git', ['show', frozen.driverCommit + ':docs/LIVE-VALIDATION-AD-PLAN.md'], { windowsHide: true }); +const planPath = path.join(output, 'original-predeclared-plan.md'); fs.writeFileSync(planPath, plan, { flag: 'wx' }); +sources.push({ path: planPath, bytes: plan.length, sha256: sha(plan), origin: 'original-git-blob', commit: frozen.driverCommit, repositoryPath: 'docs/LIVE-VALIDATION-AD-PLAN.md' }); +const artifactIds = new Set(state.execution.checks.flatMap(value => (value.results ?? []).map(row => row.logArtifactId)).filter(Boolean)); +for (const value of state.execution.artifacts) if (/^delivery-report/.test(value.kind)) artifactIds.add(value.id); +const originalArtifacts = []; +for (const id of artifactIds) { + const artifact = state.execution.artifacts.find(value => value.id === id); + if (!artifact) { missing.push({ artifactId: id, reason: 'Check log descriptor absent from the sealed session artifact preview; independent-final logs remain in the read scope.' }); continue; } + for (const [key, expected] of Object.entries(ids)) assert.equal(artifact[key], expected, 'Artifact ownership: ' + key); + assert.match(artifact.relative, /^[a-f0-9]{2}\/[a-f0-9]{64}\.blob$/); + const originalPath = path.join(frozen.host.identity.dataRoot, 'artifacts', artifact.relative); + if (!fs.existsSync(originalPath)) { missing.push({ artifactId: id, kind: artifact.kind, reason: 'Original artifact file unavailable', expectedSha256: artifact.sha256 }); continue; } + const bytes = fs.readFileSync(originalPath); assert.equal(bytes.length, artifact.bytes); assert.equal(sha(bytes), artifact.sha256); + const target = path.join(output, id + (artifact.mediaType === 'application/json' ? '.json' : '.txt')); + fs.writeFileSync(target, bytes, { flag: 'wx' }); + sources.push({ path: target, bytes: bytes.length, sha256: sha(bytes), origin: 'byte-exact-copy-of-original-owned-artifact', artifactId: id, kind: artifact.kind }); + originalArtifacts.push({ ...artifact, sharedPath: target, originalPath, copiedBytesExact: true }); +} +const report = originalArtifacts.find(value => value.kind === 'delivery-report'); +const reportBody = report ? JSON.parse(fs.readFileSync(report.sharedPath, 'utf8')) : null; +const metadata = { + schemaVersion: 1, kind: 'workbench-readonly-engineering-source-index', generatedAt: new Date().toISOString(), + sourceName: 'agent-workbench/ad/node/' + ids.taskId + '/' + ids.runId, ids, originalVersion: '1.25.8', originalDriverCommit: frozen.driverCommit, + purpose: 'Read-only acceptance of an existing independent Node task. No incoming restricted delegation or new M4 task is represented.', + goalPath: path.join(evidence, 'node/goal.txt'), predeclaredPlanPath: planPath, originalTaskContract: state.execution.task.contract, + originalStructuredAcceptance: state.execution.task.acceptance, + originalReportArtifact: report ? { id: report.id, path: report.sharedPath, sha256: report.sha256, bytes: report.bytes, status: reportBody?.status ?? null } : null, + reportMetadata: originalArtifacts.filter(value => /^delivery-report/.test(value.kind)), checkLogMetadata: originalArtifacts.filter(value => artifactIds.has(value.id) && !/^delivery-report/.test(value.kind)), + engineering: { sourceRoot: result.sourceRoot, initialHead: result.initialHead, commit: result.commit, committedPaths: result.committedPaths, committedCurrent: result.committedCurrent, + actualIndependentChecks: result.final, ownerBytesAndIndexPreserved: result.allOriginalOwnerBytesAndIndexPreserved, supervisorContinuations: result.supervisionContinuations }, + originalOutcome: { independentEngineeringSuccess: result.success, sessionStatus: state.status, taskStatus: state.execution.task.status, runStatus: state.execution.run.status, + terminalGitObserved: true, nativeDeliveryRows: state.execution.deliveries.length, internalDeliveryReportStatus: reportBody?.status ?? 'missing', + taskVerification: state.execution.task.verification, productStopReason: result.productStopReason, failure: result.failure, usage: result.usage, + missing, batchNetworkAndClaudeErrors: 'Preserved separately in QA-LIVE-VALIDATION-AD.md; the Node subset does not replace the whole-batch outcome.' }, + readiness: { originalTaskAndRunAvailable: true, originalReportsCopied: !!report, nativeEngineeringEvidenceV2Envelope: false, restrictedDelegationReceiver: 'not_established_by_this_source', + originalKeyLookup: 'not_established_by_this_source', currentM4Engineering: 'not_dispatched_at_source_index_creation', allConsumerContractFieldsSatisfied: false, + gaps: ['No producer-native mnemo.engineering-evidence.v2 envelope or receipt is claimed.', 'The original task structured acceptance array is empty; the raw goal, predeclared plan and original tests carry its conditions.', 'Original terminal Git success and internal in_progress report remain distinct.'] }, + readScope: { mode: 'read-only-existing-evidence', allowedFiles: sources, originalManifestPath: path.join(evidence, 'FINAL-MANIFEST.json'), originalManifestSha256: sha(originalManifestBytes), + excludes: ['Any credential value or credential store', 'Whole formal data directory or SQLite database', 'Other user projects or unrelated sessions', 'Replay, retry, execution, write or native-v2 certification'] }, + actions: { realModelRequests: 0, engineeringDispatches: 0, gitWrites: 0, originalArtifactsChanged: false, keysReadOrResaved: false, messagesSentToOtherThreads: 0 }, +}; +const metadataPath = path.join(repository, 'docs/integration/WORKBENCH-AD-NODE-READONLY-SOURCE-2026-11-11.json'); +fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2) + '\n', { flag: 'wx' }); +const metadataBytes = fs.readFileSync(metadataPath); +fs.writeFileSync(path.join(output, 'SOURCE-MANIFEST.json'), JSON.stringify({ schemaVersion: 1, metadataPath, metadataSha256: sha(metadataBytes), sources, originalArtifacts, missing }, null, 2) + '\n', { flag: 'wx' }); +console.log(JSON.stringify({ metadataPath, output, sourceName: metadata.sourceName, reportStatus: metadata.originalOutcome.internalDeliveryReportStatus, terminalGit: result.commit, nativeV2Envelope: false, allowedFiles: sources.length, missing: missing.length, realModelRequests: 0 })); diff --git a/scripts/m4-live/verify-driver.mjs b/scripts/m4-live/verify-driver.mjs new file mode 100644 index 00000000..25c6a3d5 --- /dev/null +++ b/scripts/m4-live/verify-driver.mjs @@ -0,0 +1,155 @@ +// Fixed local responses verify the new driver and real tool execution only. +// They are not evidence of a provider's intelligence or autonomous delivery. +import fs from 'node:fs'; +import path from 'node:path'; +import http from 'node:http'; +import assert from 'node:assert/strict'; +import { randomUUID } from 'node:crypto'; +import { fixture, launchWorkbench, completion, call, assertToolPairs } from '../../tests/helpers.mjs'; +import { root, save, client, configureFixture, captureSession, artifactBytes, expectedOutputFields, connectionDefinition } from './common.mjs'; +import { invokeProbe, inspectorClosed } from './inspector.mjs'; + +const output = path.resolve('.qa/m4-driver-' + randomUUID()), disposers = [], t = { after: fn => disposers.push(fn) }; +fs.mkdirSync(output); const f = fixture(t, { modernDefaults: true }); f.store.saveConfig({ approvalMode: 'full', mode: 'compatible' }); +const malformedBytes = Buffer.from([100, 97, 116, 97, 58, 32, 0xff, 10, 10]); +const malformedArtifact = f.store.artifactStore.write(f.session, null, malformedBytes, { kind: 'model-stream-response', mediaType: 'text/event-stream' }); +f.store.core.artifact.set(malformedArtifact.id, malformedArtifact); f.store.save(f.session); f.store.close(); +let host, captureClient, result, engineeringRequests = 0; const requests = [], cases = [], sockets = new Set(); +const files = { + 'src/amount.mjs': `export function amountToCents(input) { + if (!['string','number'].includes(typeof input) || typeof input === 'number' && !Number.isFinite(input)) throw new TypeError('amount'); + const match = String(input).trim().match(/^([+-]?)([0-9]+)(?:\\.([0-9]{1,2}))?$/); + if (!match) throw new TypeError('amount'); + const n = (BigInt(match[2]) * 100n + BigInt((match[3] || '').padEnd(2,'0'))) * (match[1] === '-' ? -1n : 1n); + if (n > BigInt(Number.MAX_SAFE_INTEGER) || n < BigInt(Number.MIN_SAFE_INTEGER)) throw new TypeError('unsafe'); + return n === 0n ? 0 : Number(n); +}\n`, + 'src/summary.mjs': `import {amountToCents} from './amount.mjs'; +export function summarize(rows) { + if (!Array.isArray(rows)) throw new TypeError('rows'); const map = new Map(); + for (const row of rows) { + if (!row || typeof row.currency !== 'string') throw new TypeError('row'); + const currency = row.currency.trim().toUpperCase(); if (!/^[A-Z]{3}$/.test(currency)) throw new TypeError('currency'); + const item = map.get(currency) || {currency,cents:0,count:0}; + const cents = item.cents + amountToCents(row.amount); if (!Number.isSafeInteger(cents)) throw new TypeError('unsafe'); + map.set(currency,{currency,cents,count:item.count+1}); + } + return [...map.values()].sort((a,b)=>a.currency.localeCompare(b.currency)); +}\n`, + 'src/report.mjs': `export function formatReport(rows) {return rows.map(({currency,cents,count})=>currency+' '+(cents<0?'-':'')+Math.floor(Math.abs(cents)/100)+'.'+String(Math.abs(cents)%100).padStart(2,'0')+' ('+count+')').join('\\n');}\n`, +}; +const data = value => 'data: ' + (typeof value === 'string' ? value : JSON.stringify(value)) + '\n\n'; +function streamBody(protocol, model, nonce, tool) { + if (protocol === 'chat-completions') { + const delta = tool ? { tool_calls: [{ index: 0, ...call('call_' + nonce, 'workbench_m4_echo_nonce', { nonce }) }] } : { content: 'OK ' + nonce }; + return data({ model, choices: [{ index: 0, delta, finish_reason: null }] }) + + data({ model, choices: [{ index: 0, delta: {}, finish_reason: tool ? 'tool_calls' : 'stop' }] }) + + data({ model, choices: [], usage: { prompt_tokens: 20, completion_tokens: 5, total_tokens: 25, prompt_tokens_details: { cached_tokens: 4 } } }) + data('[DONE]'); + } + if (protocol === 'responses') { + let sequence = 0; const native = (type, value) => data({ type, sequence_number: sequence++, ...value }); + let bytes = native('response.created', { response: { id: 'resp_' + nonce, model } }), output; + if (tool) { + const item = { type: 'function_call', id: 'fc_' + nonce, call_id: 'call_' + nonce, name: 'workbench_m4_echo_nonce', arguments: '', status: 'in_progress' }; + bytes += native('response.output_item.added', { output_index: 0, item }); + bytes += native('response.function_call_arguments.delta', { item_id: item.id, delta: JSON.stringify({ nonce }) }); + output = [{ ...item, status: 'completed', arguments: JSON.stringify({ nonce }) }]; + bytes += native('response.function_call_arguments.done', { item_id: item.id, arguments: output[0].arguments }); + } else { + bytes += native('response.output_text.delta', { delta: 'OK ' + nonce }); + output = [{ type: 'message', id: 'msg_' + nonce, role: 'assistant', status: 'completed', content: [{ type: 'output_text', text: 'OK ' + nonce }] }]; + } + return bytes + native('response.completed', { response: { id: 'resp_' + nonce, model, status: 'completed', output, usage: { input_tokens: 20, output_tokens: 5, total_tokens: 25, input_tokens_details: { cached_tokens: 4 } } } }); + } + const event = (type, value = {}) => 'event: ' + type + '\n' + data({ type, ...value }); + const initial = { id: 'msg_' + nonce, type: 'message', role: 'assistant', model, content: [], stop_reason: null, stop_sequence: null, usage: { input_tokens: 16, cache_read_input_tokens: 4, cache_creation_input_tokens: 0, output_tokens: 0 } }; + const block = tool ? { type: 'tool_use', id: 'call_' + nonce, name: 'workbench_m4_echo_nonce', input: {} } : { type: 'text', text: '' }; + const delta = tool ? { type: 'input_json_delta', partial_json: JSON.stringify({ nonce }) } : { type: 'text_delta', text: 'OK ' + nonce }; + return event('message_start', { message: initial }) + event('content_block_start', { index: 0, content_block: block }) + + event('content_block_delta', { index: 0, delta }) + event('content_block_stop', { index: 0 }) + + event('message_delta', { delta: { stop_reason: tool ? 'tool_use' : 'end_turn', stop_sequence: null }, usage: { output_tokens: 5 } }) + event('message_stop'); +} +const server = http.createServer(async (request, response) => { + try { + const chunks = []; for await (const chunk of request) chunks.push(chunk); + const body = JSON.parse(Buffer.concat(chunks)); requests.push({ path: request.url, body }); + const protocol = request.url.endsWith('/messages') ? 'anthropic-messages' : request.url.endsWith('/responses') ? 'responses' : 'chat-completions'; + if (protocol === 'anthropic-messages') assert.equal(body.max_tokens, 128000, 'Messages uses the exact official specification, not the old 2048.'); + else assert.ok(['max_tokens', 'max_output_tokens', 'max_completion_tokens'].every(key => !Object.hasOwn(body, key))); + if (body.model === 'm4-error') { response.writeHead(400, { 'Content-Type': 'application/json', 'x-request-id': 'owned-m4-error' }); response.end('{"error":{"message":"owned-m4-original-error","type":"invalid_request_error"}}'); return; } + if (body.model === 'm4-unknown') { response.writeHead(200, { 'Content-Type': 'text/event-stream' }); response.write(data({ model: body.model, choices: [{ index: 0, delta: { content: 'incomplete' }, finish_reason: null }] })); return; } + if (body.model === 'm4-node') { + let answer; engineeringRequests++; + if (engineeringRequests === 1) answer = completion(Object.entries(files).map(([name, content], index) => call('owned-file-' + index, 'propose_file', { path: name, content, reason: 'Fixed local fixture only.' }))); + else if (engineeringRequests === 2) answer = completion([call('owned-plan', 'plan_checks', { names: ['test', 'build'] })]); + else if (engineeringRequests === 3) { + const sessions = await host.api('/sessions'), active = sessions.find(value => value.status === 'running'); assert.ok(active); + const state = await host.api('/sessions/' + active.id), plan = state.execution.plans.at(-1); assert.ok(plan); + answer = completion([call('owned-check', 'run_checks', { plan_id: plan.id })]); + } else if (engineeringRequests === 4) { + answer = completion([call('owned-terminal-git', 'run_command', { command: "git -c core.hooksPath=NUL commit --only --no-gpg-sign -m 'Fixed M4 local driver fixture' -- src/amount.mjs src/summary.mjs src/report.mjs\nif ($LASTEXITCODE -ne 0) { throw 'fixture commit failed' }", reason: 'Verify actual local Git with original owner staging preserved.' })]); + } else answer = completion([], 'Fixed local fixture finished.'); + response.writeHead(200, { 'Content-Type': 'application/json' }); response.end(JSON.stringify({ ...answer, model: body.model })); return; + } + const nonce = JSON.stringify(body.messages ?? body.input).match(/(?:nonce |OK )([a-f0-9-]{36})/)?.[1]; assert.ok(nonce); + const tool = body.tools?.length > 0; + if (body.stream) { response.writeHead(200, { 'Content-Type': 'text/event-stream' }); response.end(streamBody(protocol, body.model, nonce, tool)); } + else { response.writeHead(200, { 'Content-Type': 'application/json' }); response.end(JSON.stringify({ ...completion([], 'OK ' + nonce), model: body.model })); } + } catch (error) { response.writeHead(500, { 'Content-Type': 'application/json' }); response.end(JSON.stringify({ error: { message: error.message } })); } +}); +server.on('connection', socket => { sockets.add(socket); socket.on('close', () => sockets.delete(socket)); }); +await new Promise(resolve => server.listen(0, '127.0.0.1', resolve)); +disposers.push(() => new Promise(resolve => { for (const socket of sockets) socket.destroy(); server.close(resolve); })); +try { + await inspectorClosed(); + const observation = JSON.parse(fs.readFileSync('.qa/m4-live-baseline-2026-11-11/observation.json', 'utf8')); + host = await launchWorkbench(t, f.data, {}, { appRoot: observation.boot.runtimeRoot }); configureFixture({ root: output, origin: host.url }); + captureClient = await client(); disposers.push(() => captureClient.close()); + const downloaded = await artifactBytes(captureClient.api, f.session.id, malformedArtifact); assert.deepEqual(downloaded, malformedBytes); + save('byte-preservation/original.bin', downloaded); save('byte-preservation/metadata.json', malformedArtifact); + cases.push({ prefix: 'byte-preservation', expected: 'exact-invalid-utf8-bytes', requests: 0, passed: true }); + const health = await host.api('/host/status'), beforeSelection = (await host.api('/model-center')).selected; + const runProbe = async (connection, scope, prefix, expected = 'success', observationMs = 30000) => { + const session = await host.api('/sessions', { projectId: f.project.id }), nonce = randomUUID(); + const input = { pid: health.identity.pid, port: Number(new URL(host.url).port), runtimeRoot: host.bootstrap.runtimeRoot, projectId: f.project.id, sessionId: session.id, + connection, nonce, scope, expectedOutput: expectedOutputFields(connection), observationMs }; + save(prefix + '/input.json', input); const invoked = await invokeProbe(input); save(prefix + '/invocation.json', invoked); + const captured = await captureSession(captureClient.api, session.id, prefix), attempt = captured.rows[0]; + assert.equal(captured.total, 1); assert.equal(invoked.result.actualToolsExecuted, 0); assert.equal(invoked.result.wireStarts, 1); + assertToolPairs(captured.exported.session.providerMessages); + if (expected === 'success') { assert.equal(invoked.result.contentPassed, true, JSON.stringify(invoked.result)); assert.equal(attempt.status, 'completed'); assert.equal(attempt.modelIdentity.status, 'matched'); assert.equal(attempt.modelIdentity.complete, true); assert.equal(attempt.usageStatus, 'reported'); } + else { assert.equal(attempt.status, expected === 'unknown' ? 'interrupted' : 'failed'); assert.equal(attempt.usageStatus, 'unknown'); assert.equal(invoked.result.contentPassed, false); } + if (expected === 'error') assert.ok(captured.captures.some(value => value.kind === 'response' && fs.readFileSync(path.join(root, value.path), 'utf8').includes('owned-m4-original-error'))); + assert.deepEqual((await host.api('/model-center')).selected, beforeSelection); + assert.deepEqual(connectionDefinition((await host.api('/model-center')).connections.find(value => value.id === connection.id)), connectionDefinition(connection)); + cases.push({ prefix, protocol: connection.protocol, scope, expected, requests: 1, passed: true }); + }; + const baseUrl = 'http://127.0.0.1:' + server.address().port + '/v1'; + for (const [protocol, model] of [['chat-completions', 'm4-chat'], ['responses', 'm4-responses'], ['anthropic-messages', 'claude-opus-5-5']]) { + const connection = await host.api('/model-center/connections', { name: 'Owned M4 ' + protocol, model, protocol, baseUrl, streaming: true, apiKey: 'owned-m4-fixture-secret' }); + for (const scope of ['text', 'tools']) await runProbe(connection, scope, 'preflight/' + protocol + '-' + scope); + } + const json = await host.api('/model-center/connections', { name: 'Owned M4 JSON', model: 'm4-json', protocol: 'chat-completions', baseUrl, streaming: false, apiKey: 'owned-m4-fixture-secret' }); + await runProbe(json, 'text', 'preflight/json'); await runProbe(json, 'streaming', 'preflight/streaming-override'); + for (const [model, expected] of [['m4-error', 'error'], ['m4-unknown', 'unknown']]) { + const connection = await host.api('/model-center/connections', { name: 'Owned ' + model, model, protocol: 'chat-completions', baseUrl, streaming: true, apiKey: 'owned-m4-fixture-secret' }); + await runProbe(connection, 'text', 'preflight/' + model, expected, expected === 'unknown' ? 750 : 30000); + } + const connection = await host.api('/model-center/connections', { name: 'Owned M4 Node', model: 'm4-node', protocol: 'chat-completions', baseUrl, streaming: false, apiKey: 'owned-m4-fixture-secret' }); + const c = await client(); + try { + const center = await c.api('/model-center'); + save('frozen.json', { fixture: true, host: await c.api('/host/status'), config: c.boot.config, center, connections: [connection], engineeringPriority: [connection.id] }); + } finally { await c.close(); } + save('compatibility/result.json', { fixture: true, results: [{ connectionId: connection.id, engineeringAllowed: true }] }); + const argv = process.argv[2]; process.argv[2] = 'node'; await import('./run.mjs'); process.argv[2] = argv; + const node = JSON.parse(fs.readFileSync(path.join(root, 'node/result.json'), 'utf8')); assert.equal(node.success, true, JSON.stringify({ failure: node.failure, final: node.final, cleanupErrors: node.cleanupErrors, requests: node.requests })); + assert.equal(node.requests, 5); assert.equal(node.final.test.stats.pass, 9); assert.equal(node.ownerBytesAndIndexPreserved, true); assert.equal(node.identitiesPassed, true); + assert.equal(requests.length, 15); result = { success: true, cases, fixtureRequests: requests.length, engineeringRequests, realModelRequests: 0, + installedAppRoot: observation.boot.runtimeRoot, version: host.bootstrap.version, driverRunsOriginalNodeChecksAndGit: true, fixedImplementationOnlyInFixture: true }; +} catch (error) { result = { success: false, error: error.stack, cases, fixtureRequests: requests.length, engineeringRequests, realModelRequests: 0 }; process.exitCode = 1; } +finally { + await inspectorClosed(); for (const dispose of disposers.reverse()) await dispose(); + fs.writeFileSync(path.join(output, 'result.json'), JSON.stringify(result, null, 2) + '\n', { flag: 'wx' }); +} +console.log(JSON.stringify({ output, ...result })); diff --git a/task_plan.md b/task_plan.md index ebb88b98..2384d12c 100644 --- a/task_plan.md +++ b/task_plan.md @@ -1147,3 +1147,9 @@ F收尾:57d075e修正独立编译QA路径,6d09ac8封存差异;202610302320 2026-11-11 阶段4、5工程验收完成:实际Inno11/11、唯一正式Setup0/351789ms、1.25.13原PID63892/instance/102项目/127会话/374原请求/全部原行和5244工件保持,公开新增字段明确核验;两端四图实看/final/9229关闭/新版桌面恢复。当前只剩限定验收提交与既有GitAtlas分支普通增量推送并核SHA;下一M4另冻新真实基线,Mnemo生产绑定与收益不代签。 2026-11-11 1.25.13正式交付推送完成:验收1e309700及打包修复35a6d6d9已普通增量推送至既有GitAtlas分支,远端与重新fetch逐SHA一致;docs/gitatlas-mnemo-1.25.13-push.json随完成接续另提交并核最终HEAD。正式后台仍63892/1.25.13,新版桌面已恢复;782封存原件保持、0真实模型/Key提取重存,下一M4新真实基线,Mnemo生产绑定与真实收益未知保持。 + +## 2026-11-11 M4 新真实兼容与工程基线 + +按 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发行结论保持。