Files
Agent-Workbench/docs/vision-inputs-f-release-evidence/0140-write-vision-acceptance.mjs
T
2026-11-01 02:12:50 +08:00

23 lines
2.9 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 identity = JSON.parse(fs.readFileSync('docs/vision-inputs-release-identity.json'));
assert.equal(identity.success, true); assert.equal(identity.version, '1.18.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 base = path.join('releases', path.basename(identity.release.portableRoot));
const markdown = base + '-ACCEPTANCE.md', json = base + '-ACCEPTANCE.json';
for (const file of [markdown, json]) assert.equal(fs.existsSync(file), false);
const artifacts = ['installer','portable','source'].map(kind => {
const item = identity.release[kind], bytes = fs.readFileSync(item.path);
assert.equal(hash(bytes), item.sha256); assert.equal(bytes.length, item.bytes);
return {kind, filename:path.basename(item.path), bytes:item.bytes, sha256:item.sha256};
});
const text = '# Agent Workbench 1.18.0 本地发行验收\n\n工程PNG/JPEG截图、实际视觉选路及预算诊断/同Task续接已完整本地交付。576/576独立源码、26类196组历史UI、三类截图工程、原生窗口/工程、同载荷安装及保留原PID36552/Provider/全部数据升级通过。\n\n本轮验收发起0真实模型请求;安装期间已有工作台新增的一次原1.17调用已单独保留,不计为1.18视觉验收。固定回答只证明协议与真实工具执行。真实模型视觉工程/Purge收益及新增iPhone流程实机仍单列待验。手机新增范围为observe权限下的图片读取/SHA/下载;正式网关关闭,无QA证书/设备迁入。\n\n原安装器/ZIP保持不可变,包内说明为构建时快照。最终记录见[验收](../docs/QA-1.18.md)、[回顾](../docs/RETROSPECTIVE-1.18.md)、[身份](../docs/vision-inputs-release-identity.json)及[下一阶段](../docs/PLAN-1.19.md)。\n\n本地Git:`' + commit + '`;产品/QA输入来源:`' + identity.codeCommit + '`。\n\n| 工件 | 字节 | SHA-256 |\n| --- | ---: | --- |\n' + artifacts.map(x => '| ' + x.filename + ' | ' + x.bytes + ' | `' + x.sha256 + '` |').join('\n') + '\n';
fs.writeFileSync(markdown, text, {flag:'wx'});
fs.writeFileSync(json, JSON.stringify({success:true,at:new Date().toISOString(),localGitCommit:commit,identityPath:'docs/vision-inputs-release-identity.json',identitySha256:hash(fs.readFileSync('docs/vision-inputs-release-identity.json')),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}));