import fs from 'node:fs'; import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import { purgeEvidence, root, save, client, publicMetadata } from '../live-ad/common.mjs'; import { publicSnapshot } from '../retained-host-state.mjs'; import { inspectorClosed } from '../live-ad/inspector.mjs'; import { resolveControlledInstallation } from '../../src/core/engines/controlled-installation.mjs'; import { resolveOriginalPurgeSource } from '../../src/core/engines/purge-strategy.mjs'; import { order, allowed, goal, purgePrompt, observations } from './contract.mjs'; const ae = JSON.parse(fs.readFileSync('.qa/live-engineering-ae/summary.json')); assert.ok(ae.samples.length === 2 && ae.samples.every(row => row.success)); const fixturePath = process.argv[2]; assert.ok(fixturePath, 'The completed open native fixture result is required.'); const fixture = JSON.parse(fs.readFileSync(fixturePath)); assert.equal(fixture.success, true); assert.equal(fixture.realModelRequests, 0); assert.equal(fixture.completeSamples, 4); assert.equal(fixture.originalStateAuditPassed, true); assert.equal(fixture.actualBatchDriverExecuted, true); purgeEvidence(); assert.equal(fs.existsSync(root), false, 'Never refreeze AF after observing any real result.'); const git = args => execFileSync('git', args, { encoding: 'utf8', windowsHide: true }); const workingChanges = { tracked: git(['diff', '--name-only', 'HEAD', '-z']).split('\0').filter(Boolean), untracked: git(['ls-files', '--others', '--exclude-standard', '-z']).split('\0').filter(Boolean) }; for (const name of [...workingChanges.tracked, ...workingChanges.untracked]) assert.ok(['src/client/', 'docs/orven/', 'output/'].some(prefix => name.startsWith(prefix)), 'An uncommitted effective input may affect AF: ' + name); // Concurrent client-only design work does not enter the installed Node engine, // this driver or the isolated benchmark. Preserve it and record paths only. 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.8'); assert.equal(host.activity.active, false); assert.equal(host.desktopWindows.count, 0); for (const [key, value] of Object.entries({ executionMode: 'unrestricted', approvalMode: 'full', capacityMode: 'passthrough', historyPolicy: 'preserve', maxSteps: 0, maxRunTokens: 0, maxTaskTokens: 0, maxRunDurationMs: 0 })) assert.equal(boot.config[key], value); const connection = center.connections.find(row => row.id === '1a7a55a9-29f2-4b9f-8ea2-5a55afd7eacd'); assert.equal(connection.enabled, true); assert.equal(connection.hasKey, true); assert.equal(connection.model, 'deepseek-flash'); assert.equal(connection.credentialRevision, 1); assert.deepEqual(connection.nativeParameters, {}); const installation = resolveControlledInstallation(process.cwd()), source = resolveOriginalPurgeSource(process.cwd(), undefined, installation); assert.equal(installation.controlledStatus, 'available'); assert.equal(source.status, 'available'); const baseline = await publicSnapshot('http://127.0.0.1:4318', host.identity.dataRoot); save('current.json', { host, config: boot.config, center, connection, originalProjects: boot.projects, originalPublicMetadata: publicMetadata(host.identity.dataRoot), baseline, installation, source, order, allowed, goal, purgePrompt, observations, fixturePath, fixture, workingChanges, driverCommit: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim() }); console.log(JSON.stringify({ frozen: true, requests: 0, driverCommit: JSON.parse(fs.readFileSync(root + '/current.json')).driverCommit, version: boot.version, pid: host.identity.pid, projects: baseline.projects, sessions: baseline.database.sessionIds.length, connectionRevision: connection.revision, harnessSha256: installation.controlledSha256, purgeSha256: source.sourceSha256 })); } finally { await close(); }