Files
Agent-Workbench/docs/model-protocols-f-release-evidence/109-record-protocol-formal-native.mjs
T
2026-11-01 00:19:52 +08:00

17 lines
1.9 KiB
JavaScript

import fs from 'node:fs';
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import { publicSnapshot, compareOriginalState } from './protocol-f-state.mjs';
import { HostController } from '../src/core/desktop/host-controller.mjs';
const read=file=>JSON.parse(fs.readFileSync(file,'utf8'));
const deployed=read('.qa/protocol-f-formal-verify.json');assert.equal(deployed.success,true);
const current=await publicSnapshot('http://127.0.0.1:4318',deployed.dataRoot),retained=compareOriginalState(read('.qa/protocol-f-formal-before.json'),current);
assert.equal(current.version,'1.17.0');assert.equal(current.pid,36552);assert.equal(current.runtimeRoot,deployed.candidate);
const controller=new HostController({appRoot:deployed.candidate,dataRoot:deployed.dataRoot,port:4318,nodePath:process.execPath});
assert.ok(await controller.connect());const status=await controller.status();assert.equal(status.desktopWindows.count,1);assert.equal(status.activity.active,false);
const observed=read('.qa/protocol-native-after/observed.json');assert.equal(observed.success,true);assert.equal(observed.versionObserved,'1.17.0');
for(const row of observed.files){const bytes=fs.readFileSync(row.path);assert.equal(bytes.length,row.bytes);assert.equal(createHash('sha256').update(bytes).digest('hex'),row.sha256);}
const result={success:true,version:current.version,at:new Date().toISOString(),current,retained,hostPid:36552,currentProviderPreserved:true,desktopWindows:status.desktopWindows,observed,realModelRequests:0,
scope:'Actual formal native window inspected via Windows sky. User project and existing connection observed, no task or configuration changes; all stored rows, session exports and original artifacts remain exact.'};
fs.writeFileSync('.qa/protocol-f-formal-native.json',JSON.stringify(result,null,2)+'\n',{flag:'wx'});console.log(JSON.stringify({success:true,version:current.version,nativeWindows:1,originalStateRetained:true}));