Files
Agent-Workbench/docs/project-cache-f-release-evidence/0137-write-cache-acceptance.mjs
T
2026-11-01 09:31:00 +08:00

18 lines
2.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import { execFileSync } from 'node:child_process';
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
const identityFile = 'docs/project-cache-release-identity.json', identity = JSON.parse(fs.readFileSync(identityFile, 'utf8'));
assert.equal(identity.success, true); assert.equal(identity.version, '1.19.0');
assert.equal(execFileSync('git', ['status', '--porcelain'], { encoding: 'utf8', windowsHide: true }).trim(), '');
const commit = execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim();
const root = path.join('releases', path.basename(identity.release.portableRoot)), markdown = root + '-ACCEPTANCE.md', json = root + '-ACCEPTANCE.json';
for (const file of [markdown, json]) assert.equal(fs.existsSync(file), false);
const artifacts = ['installer', 'portable', 'source'].map(kind => { const row = identity.release[kind], bytes = fs.readFileSync(row.path); assert.equal(hash(bytes), row.sha256); assert.equal(bytes.length, row.bytes); return { kind, filename: path.basename(row.path), bytes: row.bytes, sha256: row.sha256 }; });
const text = '# Agent Workbench 1.19.0 本地发行验收\n\n来源核对的有界持久解析缓存、开关/清除和工程诊断已完整本地交付。590/590独立源码、27类203组历史UI、新缓存7组界面/9节点工程、原生与随包运行、同载荷安装及保留原PID36552/Provider/全部数据升级通过。\n\n跨实例Node/React有局部实测收益,冷/热/失效的来源闭合有额外开销,Python无稳定收益;不能据此宣称全面加速、token节省或真实推理能力提升。本轮真实模型请求0;真实视觉工程/Purge收益及新增iPhone流程继续单列待验。\n\n安装器/ZIP保持不可变,包内说明为构建时快照。最终见[验收](../docs/QA-1.19.md)、[回顾](../docs/RETROSPECTIVE-1.19.md)、[身份](../docs/project-cache-release-identity.json)及[下一阶段](../docs/PLAN-1.20.md)。\n\n本地Git:`' + commit + '`;产品/QA输入来源:`' + identity.codeCommit + '`。\n\n| 工件 | 字节 | SHA-256 |\n| --- | ---: | --- |\n' + artifacts.map(row => '| ' + row.filename + ' | ' + row.bytes + ' | `' + row.sha256 + '` |').join('\n') + '\n';
fs.writeFileSync(markdown, text, { flag: 'wx' });
fs.writeFileSync(json, JSON.stringify({ success: true, at: new Date().toISOString(), localGitCommit: commit, identityPath: identityFile, identitySha256: hash(fs.readFileSync(identityFile)), artifacts, notes: { path: markdown, sha256: hash(Buffer.from(text)) }, identity, scope: 'Detached final acceptance; immutable executable and archives remain exact.' }, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify({ success: true, commit, markdown, json }));