Files
Agent-Workbench/docs/reliability-1.25.2-evidence/development/formal-native-launch.mjs.txt
T

21 lines
1.5 KiB
Plaintext

import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { spawn } from 'node:child_process';
const root = '.qa/reliability-1.25.2';
const read = file => JSON.parse(fs.readFileSync(root + '/' + file));
assert.equal(read('formal/upgrade.json').success, true);
const before = read('formal/before.json'), output = path.join(root, 'formal-native');
assert.equal(fs.existsSync(output), false); fs.mkdirSync(output);
const boot = await (await fetch('http://127.0.0.1:4318/api/bootstrap')).json();
const host = await (await fetch('http://127.0.0.1:4318/api/host/status', { headers: { 'X-Workbench-Token': boot.token } })).json();
assert.equal(boot.version, '1.25.2'); assert.equal(host.identity.pid, 36552);
assert.equal(host.activity.active, false); assert.equal(host.desktopWindows.count, 0);
const executable = path.join(before.installRoot, 'AgentWorkbench.exe'), startedAt = new Date().toISOString();
const child = spawn(executable, [], { windowsHide: false, stdio: 'ignore', cwd: before.installRoot });
const pid = child.pid;
const code = await new Promise((resolve, reject) => { child.once('error', reject); child.once('close', resolve); });
const result = { executable, pid, code, startedAt, finishedAt: new Date().toISOString(), scope: 'Launch the attested existing installed native UI for direct Windows review; retained host and Provider must remain unchanged.' };
fs.writeFileSync(path.join(output, 'launch.json'), JSON.stringify(result, null, 2) + '\n', { flag: 'wx' });
assert.equal(code, 0); console.log(JSON.stringify(result));