Files
Agent-Workbench/docs/task-control-j-release-evidence/0017-record-task-control-h-startup-observation.mjs
T
2026-11-01 16:35:58 +08:00

17 lines
1.6 KiB
JavaScript

import fs from 'node:fs';
import assert from 'node:assert/strict';
import path from 'node:path';
import { HostController } from '../src/core/desktop/host-controller.mjs';
const dataRoot = path.resolve('.qa/release-069821dd-8083-489f-b10d-f099a5305ce2');
const info = JSON.parse(fs.readFileSync(path.join(dataRoot, 'service-info.json'), 'utf8'));
assert.equal(info.pid, 32408); assert.equal(info.createdAt, '2026-11-01T05:59:07.521Z'); assert.notEqual(info.port, 4318);
const controller = new HostController({ appRoot: info.runtimeRoot, dataRoot, port: info.port, nodePath: process.execPath });
const connected = await controller.connect(); assert.equal(connected.identity.pid, info.pid);
const status = await controller.status(); assert.equal(status.activity.active, false); assert.equal(status.desktopWindows.count, 0);
const stopped = await controller.stop(); assert.equal(stopped.processExited, true);
const result = { success: true, at: new Date().toISOString(), pid: info.pid, originalCreatedAt: info.createdAt,
originalLaunchReceipt: '.qa/task-control-h-portable-result.json', laterAttestation: connected.identity, stopped,
scope: 'After original portable launch failed on health observation, original same child became ready and passed complete proof. Its empty own QA host then stopped through authenticated original instance. Does not pass the original verifier or modify formal host.' };
fs.writeFileSync('.qa/task-control-h-startup-observation.json', JSON.stringify(result, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify({ success: true, pid: info.pid, stopped: stopped.state }));