import fs from 'node:fs'; import path from 'node:path'; import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import { publicSnapshot } from '../retained-host-state.mjs'; import { batch, routes, sha, client, saveAt } from './common.mjs'; assert.equal(fs.existsSync(batch), false, 'New AA batch only, never replay.'); assert.equal(execFileSync('git', ['status', '--porcelain'], { encoding: 'utf8', windowsHide: true }).trim(), ''); const { api, boot, close } = await client(); try { const host = await api('/host/status'), center = await api('/model-center'); assert.equal(boot.version, '1.25.3'); assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false); assert.equal(host.desktopWindows.count, 0); for (const row of routes) { const c = center.connections.find(c => c.id === row.id); assert.ok(c?.enabled && c.hasKey); assert.equal(c.streaming, true); assert.equal(c.contextLimit, 16000); assert.equal(c.maxOutputTokens, 2048); assert.equal(c.modelIdentityPolicy, 'record'); assert.deepEqual(c.modelIdentityAliases, []); } const candidate = JSON.parse(fs.readFileSync('releases/latest.json')); const manifest = fs.readFileSync(path.join(boot.runtimeRoot, 'MANIFEST.json')); assert.equal(sha(manifest), sha(fs.readFileSync(path.join(candidate.portableRoot, 'MANIFEST.json')))); const identity = JSON.parse(fs.readFileSync('docs/model-catalog-1.25.3-release-identity.json')); assert.equal(sha(manifest), identity.portableManifestSha256); for (const row of JSON.parse(fs.readFileSync('docs/model-catalog-1.25.3-evidence/release-verified/freeze.json')).compiled) { assert.equal(sha(fs.readFileSync(path.join(boot.runtimeRoot, row.path))), row.sha256); } const baseline = await publicSnapshot('http://127.0.0.1:4318', host.identity.dataRoot); const current = { host, config: boot.config, projects: boot.projects, center, baseline, sourceCommit: candidate.documentation.sourceCommit, reviewedHead: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim(), runtimeManifestSha256: sha(manifest), observedAt: new Date().toISOString() }; saveAt(batch, 'current.json', current); const { meta } = await import('./common.mjs'); saveAt(batch, 'original-attempts.json', meta('modelAttempts') ?? []); saveAt(batch, 'original-diagnostics.json', meta('modelNetworkDiagnostics') ?? []); for (const row of routes) { const connection = center.connections.find(c => c.id === row.id); saveAt(path.join(batch, row.key), 'current.json', { ...current, experiment: { ...row, model: connection.model, protocol: connection.protocol }, connectionRevision: connection.revision }); } console.log(JSON.stringify({ success: true, version: boot.version, pid: host.identity.pid, projects: baseline.projects, sessions: baseline.exports.length, routes: routes.map(row => row.key), realModelRequests: 0 })); } finally { await close(); }