Files
Agent-Workbench/scripts/live-ac/initial.mjs
T

27 lines
2.1 KiB
JavaScript

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 './state.mjs';
import { batch, experiment, connectionId, sha, client, saveAt, meta } from './common.mjs';
// Freeze the AC baseline once on the formally upgraded 1.25.4 host. Never replay.
assert.equal(fs.existsSync(batch), false, 'AC freezes once; 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'), connection = center.connections.find(c => c.id === connectionId);
assert.equal(boot.version, '1.25.4'); assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false); assert.equal(host.desktopWindows.count, 0);
assert.ok(connection.enabled && connection.hasKey); assert.equal(connection.streaming, true);
assert.equal(connection.contextLimit, 16000); assert.equal(connection.maxOutputTokens, 2048);
assert.equal(connection.model, experiment.model); assert.equal(connection.protocol, experiment.protocol);
const current = { host, config: boot.config, projects: boot.projects, center,
baseline: await publicSnapshot('http://127.0.0.1:4318', host.identity.dataRoot),
experiment: { ...experiment, model: connection.model, protocol: connection.protocol }, connectionRevision: connection.revision,
reviewedHead: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim(), observedAt: new Date().toISOString() };
saveAt(batch, 'current.json', current);
saveAt(batch, 'original-attempts.json', meta('modelAttempts') ?? []);
saveAt(batch, 'original-diagnostics.json', meta('modelNetworkDiagnostics') ?? []);
console.log(JSON.stringify({ frozen: true, version: boot.version, pid: host.identity.pid, projects: current.baseline.projects,
sessions: current.baseline.exports.length, route: connection.name, parameters: experiment.parameters, modelRequests: 0 }));
} finally { await close(); }