Files
Agent-Workbench/scripts/live-aa/seal.mjs
T
2026-11-05 03:21:49 +08:00

26 lines
2.0 KiB
JavaScript

import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { batch, sha } from './common.mjs';
const destination = path.resolve('docs/live-validation-aa-evidence'); assert.equal(fs.existsSync(destination), false);
assert.equal(JSON.parse(fs.readFileSync(path.join(batch, 'compatibility-summary.json'))).passed, true);
fs.cpSync(batch, destination, { recursive: true, errorOnExist: true });
fs.cpSync('scripts/live-aa', path.join(destination, 'drivers'), { recursive: true, errorOnExist: true });
for (const id of ['5e95f790-38fe-4afc-a834-41e994c48173', '4e646483-343f-4cf6-a906-c32a32fbd80f', '973a49f4-f5e8-432b-bc51-f6eaaefcfc33']) {
fs.cpSync('.qa/aa-driver-check-' + id, path.join(destination, 'driver-fixtures', id), { recursive: true, errorOnExist: true });
}
const files = [];
function walk(relative) {
for (const entry of fs.readdirSync(path.join(destination, relative), { withFileTypes: true })) {
const name = path.posix.join(relative, entry.name), absolute = path.join(destination, name), stat = fs.lstatSync(absolute);
assert.equal(stat.isSymbolicLink(), false); assert.equal(stat.nlink, 1);
if (entry.isDirectory()) { walk(name); continue; }
assert.equal(entry.isFile(), true); const bytes = fs.readFileSync(absolute); files.push({ path: name, bytes: bytes.length, sha256: sha(bytes) });
}
}
walk(''); files.sort((a, b) => a.path.localeCompare(b.path));
const manifest = { schemaVersion: 1, sample: 'AA-1.25.3-provider-compatibility', files, filesCount: files.length,
totalBytes: files.reduce((sum, row) => sum + row.bytes, 0), note: 'Preserves failures and untested engineering/Purge. A complete evidence inventory is not a claim all compatibility tests passed.' };
fs.writeFileSync(path.join(destination, 'MANIFEST.json'), JSON.stringify(manifest, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify({ success: true, directory: destination, files: files.length, bytes: manifest.totalBytes, manifestSha256: sha(fs.readFileSync(path.join(destination, 'MANIFEST.json'))) }));