test: freeze bounded real delivery R plan and drivers
This commit is contained in:
@@ -218,3 +218,5 @@ docs/network-q-offline.txt binary
|
||||
docs/network-q-git-index.txt binary
|
||||
docs/network-q-release-identity.json -text
|
||||
docs/network-q-index-first-diff.txt binary
|
||||
|
||||
docs/live-delivery-r-contract/** -text -whitespace
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# R:诊断后的单次真实身份预检与 Node 交付
|
||||
|
||||
继承 Q 的完整发行验收。正式产品为 1.24.6/source54dbe3d6,原进程 PID36552 与 Provider 保持;本轮新建自有样本,不续跑 P/O/J/E/H 失败。生产凭据仅由原 Provider 使用,不提取、复制、解密或重存值。
|
||||
|
||||
## 冻结范围
|
||||
|
||||
目标为已启用 jojocode/5b4daed9-b2f7-4de0-b949-573eba70c7b3,连接修订5/凭据修订1、gpt-6.1-sol、Chat 非流式 JSON、https://jojocode.com/v1,16K 上下文和2048输出。保留默认高性能池68e30376及旧09b停用状态,不自动切换连接。配置变化则发送前停止,不覆盖外部修改。
|
||||
|
||||
| 阶段 | 硬限制 | 判断依据 |
|
||||
| --- | --- | --- |
|
||||
| 所属网络诊断 | 1个job、最多12秒、零HTTP/模型请求/凭据访问 | DNS/TCP/TLS原结果、地址族与代理范围;只观察直连端点 |
|
||||
| 独立身份预检 | 1请求/1尝试、256输出、16000总tokens、0工具、无重试/切池 | 原请求/响应、完整matched身份、原报告用量;strict仅实验快照 |
|
||||
| 新Node工程,仅预检通过后 | 最多8请求/90000tokens/600000ms、16K/2048、仅三源码 | 原九测试/test/build、完整修改审查、同Task显式续接、模型计划Git及实际提交 |
|
||||
|
||||
Node 使用 benchmarks/live-delivery-v1/node 原九测试,仅允许 src/amount.mjs、src/summary.mjs、src/report.mjs。测试、构建脚本和配置不修改;设置并验证已有暂存、不同工作副本、未暂存和未跟踪所有者文件。监督只核对完整模型提案并应用、批准模型计划的原 test/build、确认模型计划的Git,不能代替实现或追加实现提示。审查续接仍使用同Task和原剩余请求,不重置预算。
|
||||
|
||||
旧数据基线包括每表原行摘要、全部原会话导出摘要、工件字节摘要和公开模型配置/原尝试。诊断新增一条所属历史;预检/Node新增的自有项目、会话、记录、事件、尝试和工件分别列明。Node临时严格身份、预算和固定选择在结束后按原语义恢复,修订保持单调,连接健康变化按实际结果记录。任何失败、未知用量或驱动错误保留原件,不重复请求补成绩。
|
||||
|
||||
## 退出和后续
|
||||
|
||||
诊断不认证API路线、Key权限、权重或交付能力;预检也不证明工程通过。Node失败时先保存和分析,不扩大预算或连续新开题。只有Node真实闭环通过后再另做React/Python,原版Purge收益另立同源/同题/同预算AB/BA,不把早停当节省。发现实际产品缺陷才进入新的修复/发行切片,不能为了实测制造版本。最终回顾、证据离线核验与本地Git,不推送。
|
||||
|
||||
实验驱动在调用前以原字节文本冻结到 docs/live-delivery-r-contract/drivers;原 .qa 文件不覆盖历史 P/O 驱动。固定计划和驱动完成范围审查后先本地提交,再运行诊断/真实请求。
|
||||
@@ -0,0 +1,62 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { DatabaseSync } from 'node:sqlite';
|
||||
import { snapshotPersistentData } from '../src/core/desktop/install-manager.mjs';
|
||||
export const hash = bytes => createHash('sha256').update(bytes).digest('hex');
|
||||
export const canonical = value => Array.isArray(value) ? value.map(canonical) : value && typeof value === 'object' ? Object.fromEntries(Object.keys(value).sort().map(key => [key, canonical(value[key])])) : value;
|
||||
export const digest = value => hash(JSON.stringify(canonical(value)));
|
||||
export function databaseSnapshot(dataRoot) {
|
||||
const database = new DatabaseSync(path.join(dataRoot, 'workbench.sqlite'), { readOnly: true }); database.exec('BEGIN');
|
||||
try {
|
||||
assert.equal(database.prepare('PRAGMA quick_check').get().quick_check, 'ok');
|
||||
const tables = {};
|
||||
for (const { name, sql } of database.prepare("SELECT name,sql FROM sqlite_schema WHERE type='table' ORDER BY name").all()) {
|
||||
assert.match(name, /^[a-z_]+$/);
|
||||
const rows = database.prepare('SELECT * FROM "' + name + '" ORDER BY rowid').all().filter(row => !(name === 'metadata' && row.key === 'runtimeOwner'));
|
||||
tables[name] = { count: rows.length, schemaSha256: hash(sql), sha256: digest(rows), rows: rows.map((row, index) => ({ id: row.id ?? row.key ?? row.seq ?? index, ...(row.kind ? { kind: row.kind } : {}), sha256: digest(row) })) };
|
||||
}
|
||||
const sessionIds = database.prepare('SELECT id FROM sessions ORDER BY id').all().map(row => row.id);
|
||||
const owner = database.prepare("SELECT value FROM metadata WHERE key='runtimeOwner'").get();
|
||||
return { tables, sessionIds, ownerSha256: owner ? digest(owner) : null, scope: 'Every original table schema and row field hashed, excluding only runtimeOwner lifecycle metadata. No row payload or credential is returned.' };
|
||||
} finally { database.exec('ROLLBACK'); database.close(); }
|
||||
}
|
||||
export async function publicSnapshot(url, dataRoot) {
|
||||
const healthResponse = await fetch(url + '/api/health', { headers: { Connection: 'close' }, signal: AbortSignal.timeout(20000) }); assert.equal(healthResponse.status, 200);
|
||||
const health = await healthResponse.json(), bootResponse = await fetch(url + '/api/bootstrap', { headers: { Connection: 'close' }, signal: AbortSignal.timeout(20000) }); assert.equal(bootResponse.status, 200);
|
||||
const bootstrap = await bootResponse.json(); const token = bootstrap.token;
|
||||
const api = async route => { const response = await fetch(url + '/api' + route, { headers: { 'X-Workbench-Token': token, Connection: 'close' }, signal: AbortSignal.timeout(20000) }); assert.ok(response.ok, route + ': HTTP ' + response.status); return response.json(); };
|
||||
const database = databaseSnapshot(dataRoot), exports = [];
|
||||
for (const id of database.sessionIds) {
|
||||
const report = await api('/sessions/' + id + '/export');
|
||||
exports.push({ id, project: digest(report.project), session: digest(report.session), execution: digest(report.execution) });
|
||||
}
|
||||
const center = await api('/model-center');
|
||||
// This is the documented public model-center view; Provider's private map and
|
||||
// API key are never accessed. Only this public object is retained for schema-aware comparison.
|
||||
const modelCenter = structuredClone(center);
|
||||
return { observedAt: new Date().toISOString(), version: health.version, pid: health.pid, runtimeRoot: bootstrap.runtimeRoot,
|
||||
configSha256: digest(bootstrap.config), projectsSha256: digest(bootstrap.projects), sessionsSha256: digest(bootstrap.sessions), modelCenterSha256: digest(modelCenter), modelCenter,
|
||||
projects: bootstrap.projects.length, visibleSessions: bootstrap.sessions.length, hasKey: !!bootstrap.config.hasKey,
|
||||
active: bootstrap.sessions.filter(value => ['running', 'awaiting_approval', 'stopping'].includes(value.status)).map(value => ({ id: value.id, status: value.status })),
|
||||
storage: bootstrap.storage, eventCursor: bootstrap.eventCursor, database, exports, persistent: snapshotPersistentData(dataRoot),
|
||||
scope: 'Read-only public state, every original session export digest, original table/row/schema hashes and every original artifact byte hash. No credential extraction, model probe, execution or mutation.' };
|
||||
}
|
||||
export function compareOriginalState(before, after, { modelCenterSchemaChange = false } = {}) {
|
||||
for (const field of ['pid', 'hasKey', 'configSha256', 'projectsSha256', 'sessionsSha256', 'eventCursor']) assert.deepEqual(after[field], before[field], field);
|
||||
assert.deepEqual(canonical(after.database.tables), canonical(before.database.tables), 'All original table schemas and every persistent row');
|
||||
assert.deepEqual(after.database.sessionIds, before.database.sessionIds); assert.deepEqual(after.exports, before.exports);
|
||||
assert.deepEqual(after.persistent, before.persistent, 'Every original artifact byte, persistent row and public disk config');
|
||||
if (modelCenterSchemaChange) {
|
||||
const original = structuredClone(before.modelCenter), next = structuredClone(after.modelCenter);
|
||||
// 1.15 changes only the public explanatory text about optional DPAPI storage.
|
||||
// Existing IDs, routes, revisions, credentials-present bits and all original attempts remain exact.
|
||||
assert.match(next.storage.restart, /临时凭据.*已明确本机加密保存/);
|
||||
next.storage.restart = original.storage.restart;
|
||||
assert.deepEqual(next, original, 'Original public model center, except versioned storage explanation');
|
||||
return { modelCenterChange: { path: '/storage/restart', original: before.modelCenter.storage.restart, actual: after.modelCenter.storage.restart }, originalRows: 'exact', originalExports: 'exact', originalArtifactBytes: 'exact' };
|
||||
}
|
||||
assert.equal(after.modelCenterSha256, before.modelCenterSha256);
|
||||
return { originalRows: 'exact', originalExports: 'exact', originalArtifactBytes: 'exact', originalModelCenter: 'exact' };
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
const target = path.resolve('docs/live-delivery-r-contract'); assert.equal(fs.existsSync(target), false);
|
||||
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
|
||||
const sourceFiles = ['prepare-live-delivery-r.mjs', 'freeze-live-delivery-r.mjs', 'live-delivery-r-initial.mjs', 'live-delivery-r-common.mjs',
|
||||
'live-delivery-r-payload.mjs', 'live-delivery-r-inspector.mjs', 'live-delivery-r-preflight.mjs', 'live-delivery-r-preflight-audit.mjs',
|
||||
'live-delivery-r-node.mjs', 'live-delivery-r-network.mjs', 'desktop-f-state.mjs'];
|
||||
const files = [];
|
||||
for (const name of sourceFiles) {
|
||||
const bytes = fs.readFileSync(path.join('.qa', name)), relative = 'drivers/' + name + '.txt';
|
||||
fs.mkdirSync(path.join(target, 'drivers'), { recursive: true });
|
||||
fs.writeFileSync(path.join(target, relative), bytes, { flag: 'wx' });
|
||||
files.push({ path: relative, bytes: bytes.length, sha256: sha(bytes) });
|
||||
}
|
||||
const initialBytes = fs.readFileSync('.qa/live-delivery-r/current.json');
|
||||
const initial = JSON.parse(initialBytes);
|
||||
const modelAttempts = initial.baseline.database.tables.metadata.rows.find(row => row.id === 'modelAttempts');
|
||||
const release = JSON.parse(fs.readFileSync('docs/network-q-release-identity.json'));
|
||||
const manifest = { schemaVersion: 1, kind: 'bounded-live-delivery-r-contract', frozenAt: new Date().toISOString(),
|
||||
sourceBaseCommit: initial.sourceCommit, branch: execFileSync('git', ['branch', '--show-current'], { encoding: 'utf8' }).trim(),
|
||||
planSha256: sha(fs.readFileSync('docs/LIVE-DELIVERY-R-PLAN.md')), originalBaselineSha256: sha(initialBytes),
|
||||
releaseVersion: release.version, releaseSourceCommit: release.sourceCommit,
|
||||
releaseIdentitySha256: sha(fs.readFileSync('docs/network-q-release-identity.json')),
|
||||
host: { pid: initial.host.identity.pid, runtimeRoot: initial.host.identity.runtimeRoot, runtimeIdentity: initial.host.identity.runtimeIdentity },
|
||||
originalProjects: initial.baseline.projects, originalSessions: initial.baseline.exports.length,
|
||||
originalArtifacts: initial.baseline.persistent.artifacts.length, originalAttemptsRow: modelAttempts,
|
||||
dependencySources: ['src/core/git-process.mjs', 'src/core/desktop/install-manager.mjs', 'benchmarks/live-delivery-v1/node/src/amount.mjs',
|
||||
'benchmarks/live-delivery-v1/node/src/summary.mjs', 'benchmarks/live-delivery-v1/node/src/report.mjs', 'benchmarks/live-delivery-v1/node/test/expense.test.mjs',
|
||||
'benchmarks/live-delivery-v1/node/package.json', 'benchmarks/live-delivery-v1/node/scripts/build.mjs']
|
||||
.map(name => ({ path: name, sha256: sha(fs.readFileSync(name)) })),
|
||||
previousDriverHashes: ['initial', 'common', 'payload', 'inspector', 'preflight', 'preflight-audit', 'node']
|
||||
.map(name => ({ path: '.qa/live-delivery-p-' + name + '.mjs', sha256: sha(fs.readFileSync('.qa/live-delivery-p-' + name + '.mjs')) })),
|
||||
maxNetworkJobs: 1, maxPreflightRequests: 1, maxNodeRequests: 8, maxNodeTokens: 90000,
|
||||
contextLimit: 16000, maxOutputTokens: 2048, modelRequestsAtFreeze: 0, noKeyValuesReadOrSaved: true,
|
||||
files: files.sort((a,b) => a.path.localeCompare(b.path)) };
|
||||
fs.writeFileSync(path.join(target, 'manifest.json'), JSON.stringify(manifest, null, 2) + '\n', { flag: 'wx' });
|
||||
console.log(JSON.stringify({ frozen: true, drivers: files.length, projects: manifest.originalProjects, sessions: manifest.originalSessions,
|
||||
artifacts: manifest.originalArtifacts, manifestSha256: sha(fs.readFileSync(path.join(target, 'manifest.json'))), modelRequests: 0 }));
|
||||
@@ -0,0 +1,53 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { DatabaseSync } from 'node:sqlite';
|
||||
import { Agent, fetch } from 'undici';
|
||||
export const root = path.resolve('.qa/live-delivery-r');
|
||||
export const original = JSON.parse(fs.readFileSync(path.join(root, 'current.json')));
|
||||
export const origin = 'http://127.0.0.1:4318';
|
||||
export const dataRoot = original.host.identity.dataRoot;
|
||||
export const connectionId = '5b4daed9-b2f7-4de0-b949-573eba70c7b3';
|
||||
export const sha = value => createHash('sha256').update(value).digest('hex');
|
||||
export const save = (relative, value) => {
|
||||
const file = path.join(root, relative); fs.mkdirSync(path.dirname(file), { recursive: true });
|
||||
fs.writeFileSync(file, typeof value === 'string' || Buffer.isBuffer(value) ? value : JSON.stringify(value, null, 2) + '\n', { flag: 'wx' });
|
||||
};
|
||||
export function meta(name) {
|
||||
assert.ok(['config', 'modelRegistry', 'modelAttempts', 'modelNetworkDiagnostics'].includes(name));
|
||||
const db = new DatabaseSync(path.join(dataRoot, 'workbench.sqlite'), { readOnly: true });
|
||||
try { return JSON.parse(db.prepare('SELECT value FROM metadata WHERE key=?').get(name).value); }
|
||||
finally { db.close(); }
|
||||
}
|
||||
export async function client() {
|
||||
const dispatcher = new Agent({ connect: { autoSelectFamily: true, timeout: 5000 } });
|
||||
let token;
|
||||
const api = async (route, input, timeout = 30000) => {
|
||||
const response = await fetch(origin + '/api' + route, { dispatcher,
|
||||
method: input === undefined ? 'GET' : 'POST', redirect: 'error', signal: AbortSignal.timeout(timeout),
|
||||
headers: { ...(token ? { 'X-Workbench-Token': token } : {}), 'Content-Type': 'application/json', Connection: 'close' },
|
||||
...(input === undefined ? {} : { body: JSON.stringify(input) }) });
|
||||
const value = await response.json();
|
||||
if (!response.ok) throw Object.assign(new Error(route + ': ' + (value.error ?? response.status)), { status: response.status });
|
||||
return value;
|
||||
};
|
||||
const boot = await api('/bootstrap'); token = boot.token;
|
||||
return { api, boot, close: () => dispatcher.close() };
|
||||
}
|
||||
export async function captureAttempts(api, attempts, relative) {
|
||||
const captures = [];
|
||||
for (const attempt of attempts) for (const kind of ['request', 'response']) {
|
||||
const id = attempt[kind + 'ArtifactId']; if (!id) continue;
|
||||
let content = '', offset = 0, page;
|
||||
do {
|
||||
page = await api('/artifacts/' + id + '?session=' + attempt.sessionId + '&offset=' + offset + '&limit=16000');
|
||||
assert.ok(page.content.length || !page.truncated); content += page.content; offset += page.content.length;
|
||||
} while (page.truncated);
|
||||
assert.equal(sha(content), page.sha256);
|
||||
assert.equal(page.sha256, attempt[kind + 'Sha256']);
|
||||
const name = `${relative}/${attempt.id}-${kind}.${kind === 'request' ? 'json' : attempt.streaming ? 'sse' : 'txt'}`;
|
||||
save(name, content); captures.push({ attemptId: attempt.id, kind, artifactId: id, path: name, sha256: sha(content), bytes: Buffer.byteLength(content) });
|
||||
}
|
||||
return captures;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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 './desktop-f-state.mjs';
|
||||
const root = path.resolve('.qa/live-delivery-r'); assert.equal(fs.existsSync(root), false);
|
||||
const origin = 'http://127.0.0.1:4318', boot = await (await fetch(origin + '/api/bootstrap', { headers: { Connection: 'close' } })).json();
|
||||
const api = async route => (await fetch(origin + '/api' + route, { headers: { 'X-Workbench-Token': boot.token, Connection: 'close' } })).json();
|
||||
const host = await api('/host/status'), center = await api('/model-center'), connection = center.connections.find(c => c.id === '5b4daed9-b2f7-4de0-b949-573eba70c7b3');
|
||||
assert.equal(boot.version, '1.24.6'); assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false);
|
||||
assert.equal(connection.enabled, true); assert.equal(connection.hasKey, true); assert.equal(connection.credentialRevision, 1); assert.equal(connection.revision, 5);
|
||||
assert.equal(connection.model, 'gpt-6.1-sol'); assert.equal(connection.protocol, 'chat-completions'); assert.equal(connection.streaming, false);
|
||||
assert.equal(connection.contextLimit, 16000); assert.equal(connection.maxOutputTokens, 2048);
|
||||
assert.equal(center.connections.find(c => c.id === '09b0293b-faad-45c3-832d-7c8b615813aa').enabled, false);
|
||||
const baseline = await publicSnapshot(origin, host.identity.dataRoot); assert.deepEqual(baseline.active, []);
|
||||
assert.deepEqual(center.selected, { type: 'pool', id: '68e30376-b799-445b-a858-db2dba9920a0' });
|
||||
fs.mkdirSync(root);
|
||||
fs.writeFileSync(path.join(root, 'current.json'), JSON.stringify({ host, config: boot.config, projects: boot.projects, center, baseline,
|
||||
sourceCommit: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim(), observedAt: new Date().toISOString() }, null, 2), { flag: 'wx' });
|
||||
console.log(JSON.stringify({ success: true, version: boot.version, pid: host.identity.pid, projects: baseline.projects, sessions: baseline.exports.length,
|
||||
connectionId: connection.id, contextLimit: connection.contextLimit, modelRequests: 0 }));
|
||||
@@ -0,0 +1,58 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import net from 'node:net';
|
||||
import { setTimeout as delay } from 'node:timers/promises';
|
||||
import { boundedGptPreflight } from './live-delivery-r-payload.mjs';
|
||||
export async function inspectorClosed() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const socket = net.createConnection({ host: '127.0.0.1', port: 9229 }); socket.setTimeout(1500);
|
||||
socket.once('connect', () => { socket.destroy(); reject(Error('Inspector already open.')); });
|
||||
socket.once('error', e => { socket.destroy(); e.code === 'ECONNREFUSED' ? resolve(true) : reject(e); });
|
||||
socket.once('timeout', () => { socket.destroy(); reject(Error('Inspector state unknown.')); });
|
||||
});
|
||||
}
|
||||
class Protocol {
|
||||
constructor(socket) {
|
||||
this.socket = socket; this.nextId = 1; this.pending = new Map();
|
||||
socket.addEventListener('message', event => {
|
||||
const m = JSON.parse(String(event.data)); if (!m.id) return;
|
||||
const p = this.pending.get(m.id); if (!p) return; this.pending.delete(m.id); clearTimeout(p.timer);
|
||||
m.error ? p.reject(Error(m.error.message)) : p.resolve(m.result);
|
||||
});
|
||||
socket.addEventListener('close', () => { for (const p of this.pending.values()) { clearTimeout(p.timer); p.reject(Error('Inspector closed; outcome unknown.')); } this.pending.clear(); });
|
||||
}
|
||||
send(method, params, timeout = 10000) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const id = this.nextId++, timer = setTimeout(() => { this.pending.delete(id); reject(Error('Inspector timeout; do not replay.')); }, timeout);
|
||||
this.pending.set(id, { resolve, reject, timer }); this.socket.send(JSON.stringify({ id, method, params }));
|
||||
});
|
||||
}
|
||||
}
|
||||
export async function invokeGptProbe(input) {
|
||||
await inspectorClosed(); let socket, protocol, enabled = false;
|
||||
try {
|
||||
process._debugProcess(input.pid); enabled = true;
|
||||
let targets;
|
||||
for (let i = 0; i < 40 && !targets; i++) {
|
||||
await delay(100);
|
||||
try { targets = await (await fetch('http://127.0.0.1:9229/json/list', { signal: AbortSignal.timeout(700) })).json(); } catch {}
|
||||
}
|
||||
assert.equal(targets?.length, 1);
|
||||
assert.ok(targets[0].webSocketDebuggerUrl.startsWith('ws://127.0.0.1:9229/'));
|
||||
socket = new WebSocket(targets[0].webSocketDebuggerUrl);
|
||||
await new Promise((resolve, reject) => { socket.addEventListener('open', resolve, { once: true }); socket.addEventListener('error', reject, { once: true }); });
|
||||
protocol = new Protocol(socket);
|
||||
const identity = await protocol.send('Runtime.evaluate', { expression: 'process.pid', returnByValue: true });
|
||||
assert.equal(identity.result.value, input.pid);
|
||||
const expression = '(' + boundedGptPreflight.toString() + ')(' + JSON.stringify(input) + ')';
|
||||
const result = await protocol.send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true }, 345000);
|
||||
if (result.exceptionDetails) throw Error(result.exceptionDetails.exception?.description ?? result.exceptionDetails.text);
|
||||
return { result: result.result.value, expression };
|
||||
} finally {
|
||||
if (protocol && enabled) {
|
||||
await protocol.send('Runtime.evaluate', { expression: "setTimeout(() => process.getBuiltinModule('inspector').close(), 25); 'closing'", returnByValue: true });
|
||||
await delay(200);
|
||||
}
|
||||
socket?.close();
|
||||
await inspectorClosed();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import assert from 'node:assert/strict';
|
||||
import { setTimeout as delay } from 'node:timers/promises';
|
||||
import { publicSnapshot, canonical } from './desktop-f-state.mjs';
|
||||
import { root, origin, dataRoot, original, connectionId, save, meta, client } from './live-delivery-r-common.mjs';
|
||||
assert.equal(fs.existsSync(path.join(root, 'network')), false, 'One diagnostic only; never overwrite or replay.');
|
||||
const { api, boot, close } = await client();
|
||||
let jobId;
|
||||
try {
|
||||
const host = await api('/host/status');
|
||||
assert.equal(host.identity.pid, 36552); assert.equal(boot.version, '1.24.6'); assert.equal(host.activity.active, false);
|
||||
const before = await publicSnapshot(origin, dataRoot); save('network/before.json', before);
|
||||
assert.deepEqual(canonical(before.database.tables), canonical(original.baseline.database.tables));
|
||||
assert.deepEqual(before.exports, original.baseline.exports); assert.deepEqual(before.persistent, original.baseline.persistent);
|
||||
const history = await api('/model-center/network-diagnostics'); save('network/history-before.json', history);
|
||||
assert.equal(history.active, 0); assert.equal(history.jobs.length, 0);
|
||||
const connection = before.modelCenter.connections.find(row => row.id === connectionId);
|
||||
assert.equal(connection.revision, 5); assert.equal(connection.credentialRevision, 1);
|
||||
save('network/contract.json', { connectionId, revision: connection.revision, target: connection.baseUrl,
|
||||
maxJobs: 1, budgetMs: 12000, credentialAccess: false, httpRequests: 0, modelRequests: 0,
|
||||
directEndpointOnly: true, modelApiRouteVerified: false, defaultOrTransportChanges: false });
|
||||
const started = await api('/model-center/network-diagnostics', { id: connectionId, revision: connection.revision });
|
||||
save('network/start.json', started); jobId = started.job.id;
|
||||
const deadline = Date.now() + 20000;
|
||||
let current;
|
||||
do {
|
||||
current = await api('/model-center/network-diagnostics');
|
||||
if (!current.active) break;
|
||||
assert.ok(Date.now() < deadline, 'Diagnostic exceeded its bounded deadline.'); await delay(200);
|
||||
} while (true);
|
||||
const job = current.jobs.find(row => row.id === jobId);
|
||||
assert.equal(current.jobs.length, 1); assert.equal(current.active, 0); assert.ok(job.finishedAt);
|
||||
assert.equal(job.connectionId, connectionId); assert.equal(job.connectionRevision, 5);
|
||||
assert.equal(job.httpRequests, 0); assert.equal(job.modelRequests, 0); assert.equal(job.credentialAccess, false);
|
||||
assert.equal(job.route.kind, 'direct-endpoint-only'); assert.equal(job.route.modelApiRouteVerified, false);
|
||||
save('network/history-after.json', current); save('network/job.json', job);
|
||||
const after = await publicSnapshot(origin, dataRoot); save('network/after.json', after);
|
||||
for (const field of ['pid', 'version', 'hasKey', 'configSha256', 'projectsSha256', 'sessionsSha256', 'eventCursor', 'modelCenterSha256']) assert.deepEqual(after[field], before[field], field);
|
||||
assert.deepEqual(after.exports, before.exports); assert.deepEqual(after.persistent.artifacts, before.persistent.artifacts);
|
||||
assert.deepEqual(after.persistent.files, before.persistent.files);
|
||||
for (const table of Object.keys(before.database.tables)) {
|
||||
assert.equal(after.database.tables[table].schemaSha256, before.database.tables[table].schemaSha256);
|
||||
const nextRows = after.database.tables[table].rows.filter(row => table !== 'metadata' || row.id !== 'modelNetworkDiagnostics');
|
||||
const previousRows = before.database.tables[table].rows.filter(row => table !== 'metadata' || row.id !== 'modelNetworkDiagnostics');
|
||||
assert.deepEqual(nextRows, previousRows, table + ': only diagnostic history may change');
|
||||
}
|
||||
assert.equal(after.database.tables.metadata.count - before.database.tables.metadata.count, 1);
|
||||
assert.deepEqual(meta('modelNetworkDiagnostics').map(row => row.id), [jobId]);
|
||||
const result = { passed: true, jobId, diagnosticStatus: job.status, elapsedMs: job.elapsedMs,
|
||||
dns: job.stages.dns, trials: job.trials.map(row => ({ mode: row.mode, family: row.family, status: row.status, code: row.code })),
|
||||
route: job.route, originalStateExactExceptNewDiagnosticHistory: true, credentialAccess: false, httpRequests: 0, modelRequests: 0 };
|
||||
save('network/restoration.json', result); console.log(JSON.stringify(result));
|
||||
} catch (error) {
|
||||
save('network/driver-error.json', { name: error.name, message: error.message, stack: error.stack, jobId, automaticReplay: false });
|
||||
throw error;
|
||||
} finally {
|
||||
if (jobId) {
|
||||
const state = await api('/model-center/network-diagnostics');
|
||||
if (state.active && ['pending', 'running'].includes(state.jobs.find(row => row.id === jobId)?.status)) save('network/stop.json', await api('/model-center/network-diagnostics/' + jobId + '/stop', {}));
|
||||
}
|
||||
await close();
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import assert from 'node:assert/strict';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { setTimeout as delay } from 'node:timers/promises';
|
||||
import { gitEnvironment } from '../src/core/git-process.mjs';
|
||||
import { publicSnapshot, canonical } from './desktop-f-state.mjs';
|
||||
import { root, origin, dataRoot, connectionId, save, meta, client, sha, captureAttempts } from './live-delivery-r-common.mjs';
|
||||
|
||||
assert.equal(JSON.parse(fs.readFileSync(path.join(root, 'preflight/result.json'))).passed, true);
|
||||
assert.equal(fs.existsSync(path.join(root, 'node')), false, 'Never replay or overwrite a live sample.');
|
||||
const { api, boot, close } = await client();
|
||||
const allowed = ['src/amount.mjs', 'src/summary.mjs', 'src/report.mjs'];
|
||||
const budgetFields = ['contextLimit', 'maxSteps', 'maxOutputTokens', 'maxRunTokens', 'maxTaskTokens', 'maxRunDurationMs'];
|
||||
const connectionFields = ['id', 'name', 'brand', 'model', 'baseUrl', 'enabled', 'requiresKey', 'streaming', 'protocol',
|
||||
'capabilityDeclarations', 'contextLimit', 'maxOutputTokens', 'concurrency', 'nativeParameters', 'outputTokenField',
|
||||
'modelIdentityPolicy', 'modelIdentityAliases', 'modelIdentityAliasSource'];
|
||||
const connectionInput = value => Object.fromEntries(connectionFields.filter(key => Object.hasOwn(value, key)).map(key => [key, value[key]]));
|
||||
const originalIdentity = value => ({ modelIdentityPolicy: value.modelIdentityPolicy ?? 'record',
|
||||
modelIdentityAliases: value.modelIdentityAliases ?? [], modelIdentityAliasSource: value.modelIdentityAliasSource ?? '' });
|
||||
let before, centerBefore, publicMetadata, originalAttempts, connection, configured, project, session, state, taskId, route, budgetWritten = false, selectionWritten = false;
|
||||
let result, delivery, succeeded = false, failure;
|
||||
const approvals = [], applications = [], continuations = [], observations = [], start = Date.now();
|
||||
const sourceRoot = path.join(root, 'node/expense-project');
|
||||
const git = args => execFileSync('git', ['--no-pager', '--no-optional-locks', '-C', sourceRoot, ...args], { encoding: 'utf8', windowsHide: true, env: gitEnvironment() });
|
||||
let protectedBytes, stagedBefore;
|
||||
const protect = () => {
|
||||
for (const [name, bytes] of Object.entries(protectedBytes)) assert.deepEqual(fs.readFileSync(path.join(sourceRoot, name)), bytes, name);
|
||||
assert.equal(git(['show', ':owner-staged.txt']), stagedBefore, 'Preserve original index and working-copy states.');
|
||||
};
|
||||
const waitFor = async (predicate, timeout = 30000) => {
|
||||
const deadline = Date.now() + timeout;
|
||||
while (!await predicate()) { assert.ok(Date.now() < deadline, 'Local operation deadline exceeded; verify outcome, never replay.'); await delay(350); }
|
||||
};
|
||||
const review = async (kind, value) => {
|
||||
const relative = `node/reviews/${kind}-${applications.length + 1}`;
|
||||
const fingerprint = value.fingerprint ?? sha(JSON.stringify(value));
|
||||
save(relative + '/input.json', { ...value, fingerprint });
|
||||
console.log(JSON.stringify({ reviewRequired: true, kind, path: relative + '/input.json', fingerprint }));
|
||||
const decisionPath = path.join(root, relative, 'decision.json');
|
||||
await waitFor(async () => fs.existsSync(decisionPath), Math.max(1, 600000 - (Date.now() - start)));
|
||||
const decision = JSON.parse(fs.readFileSync(decisionPath));
|
||||
assert.equal(decision.approve, true, 'Supervisor declined the original model proposal.');
|
||||
assert.ok(typeof decision.reason === 'string' && decision.reason.length > 20, 'Record substantive review.');
|
||||
assert.equal(decision.fingerprint, fingerprint);
|
||||
return decision;
|
||||
};
|
||||
const remainingRun = async () => {
|
||||
const requests = state?.execution.task.usage.requests ?? 0;
|
||||
assert.ok(requests < 8, 'The sealed eight-request budget is exhausted.');
|
||||
const budgets = { contextLimit: 16000, maxOutputTokens: 2048, maxSteps: 8 - requests,
|
||||
maxRunTokens: 90000, maxTaskTokens: 90000, maxRunDurationMs: 600000 };
|
||||
await api('/model-center/runtime-budgets', budgets); budgetWritten = true;
|
||||
continuations.push({ beforeRequests: requests, remainingSteps: budgets.maxSteps, at: new Date().toISOString() });
|
||||
};
|
||||
try {
|
||||
assert.equal(boot.version, '1.24.6');
|
||||
const host = await api('/host/status'); assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false);
|
||||
before = await publicSnapshot(origin, dataRoot); save('node/before.json', before);
|
||||
centerBefore = await api('/model-center'); connection = centerBefore.connections.find(value => value.id === connectionId);
|
||||
assert.equal(connection.enabled, true); assert.equal(connection.hasKey, true); assert.equal(connection.revision, 5);
|
||||
assert.equal(connection.model, 'gpt-6.1-sol'); assert.equal(connection.protocol, 'chat-completions'); assert.equal(connection.contextLimit, 16000);
|
||||
assert.deepEqual(originalIdentity(connection), { modelIdentityPolicy: 'record', modelIdentityAliases: [], modelIdentityAliasSource: '' });
|
||||
publicMetadata = { config: meta('config'), registry: meta('modelRegistry') };
|
||||
save('node/original-public-metadata.json', publicMetadata);
|
||||
originalAttempts = meta('modelAttempts'); save('node/original-attempts.json', originalAttempts);
|
||||
save('node/contract.json', { kind: 'new-real-Node-engineering', version: boot.version, connectionId, connection,
|
||||
maxRequests: 8, maxTokens: 90000, contextLimit: 16000, maxOutputTokens: 2048, maxDurationMs: 600000,
|
||||
allowed, checks: ['test', 'build'], expectedTests: 9, commands: 'Only model-planned npm test/build, no arbitrary run_command',
|
||||
review: 'Model seals all three files, supervisor reviews and applies; model plans Git, supervisor confirms.',
|
||||
continuation: 'Only review-action continuation of the same task with remaining steps, no extra implementation prompts.',
|
||||
originalImplementationSupplied: false, automaticRetry: false, poolSwitching: false,
|
||||
originalSelected: centerBefore.selected, originalBudgets: Object.fromEntries(budgetFields.map(key => [key, boot.config[key]])),
|
||||
restore: 'Original budget values and selection restored. Original absent identity fields become explicit record/[]/empty-string defaults; raw pre-state retained and only this declared normalization accepted. Revision counters remain monotonic.' });
|
||||
fs.cpSync('benchmarks/live-delivery-v1/node', sourceRoot, { recursive: true, errorOnExist: true });
|
||||
fs.writeFileSync(path.join(sourceRoot, 'README.md'), '# Expense report acceptance\nRepair the three source modules using the immutable original nine tests; do not edit checks or owner files.\n', { flag: 'wx' });
|
||||
fs.writeFileSync(path.join(sourceRoot, '.gitignore'), 'dist/\n.awb-*\nnode_modules/\n', { flag: 'wx' });
|
||||
for (const name of ['owner-staged.txt', 'owner-unstaged.txt']) fs.writeFileSync(path.join(sourceRoot, name), 'Owner original baseline\n', { flag: 'wx' });
|
||||
git(['init', '--initial-branch=main']); git(['config', 'core.autocrlf', 'false']);
|
||||
git(['config', 'user.name', 'Workbench QA']); git(['config', 'user.email', 'qa@workbench.invalid']);
|
||||
git(['add', '--', '.']); git(['commit', '--no-gpg-sign', '-m', 'Seal expense engineering baseline and original checks']);
|
||||
fs.writeFileSync(path.join(sourceRoot, 'owner-staged.txt'), 'Owner staged change\n'); git(['add', '--', 'owner-staged.txt']);
|
||||
stagedBefore = git(['show', ':owner-staged.txt']);
|
||||
fs.writeFileSync(path.join(sourceRoot, 'owner-staged.txt'), 'Owner working copy differs from staging\n');
|
||||
fs.writeFileSync(path.join(sourceRoot, 'owner-unstaged.txt'), 'Owner unstaged change\n');
|
||||
fs.writeFileSync(path.join(sourceRoot, 'owner-untracked.txt'), 'Owner untracked change\n', { flag: 'wx' });
|
||||
const protectedNames = ['README.md', '.gitignore', 'package.json', 'test/expense.test.mjs', 'scripts/build.mjs', 'owner-staged.txt', 'owner-unstaged.txt', 'owner-untracked.txt'];
|
||||
protectedBytes = Object.fromEntries(protectedNames.map(name => [name, fs.readFileSync(path.join(sourceRoot, name))]));
|
||||
const sourceFiles = [...protectedNames, ...allowed];
|
||||
for (const name of sourceFiles) save('node/source-before/' + name, fs.readFileSync(path.join(sourceRoot, name)));
|
||||
save('node/source-identity.json', { head: git(['rev-parse', 'HEAD']).trim(), status: git(['status', '--porcelain=v1']), stagedBefore,
|
||||
files: Object.fromEntries(sourceFiles.map(name => [name, sha(fs.readFileSync(path.join(sourceRoot, name)))])) });
|
||||
project = await api('/projects', { root: sourceRoot }); session = await api('/sessions', { projectId: project.id }); route = '/sessions/' + session.id;
|
||||
save('node/owned.json', { project, session });
|
||||
configured = await api('/model-center/connections', { ...connectionInput(connection), revision: connection.revision,
|
||||
modelIdentityPolicy: 'require-match', modelIdentityAliases: [], modelIdentityAliasSource: '' });
|
||||
assert.equal(configured.credentialRevision, connection.credentialRevision); assert.equal(configured.hasKey, true);
|
||||
save('node/connection-frozen.json', configured);
|
||||
await remainingRun(); await api('/model-center/select', { type: 'connection', id: connectionId }); selectionWritten = true;
|
||||
const goal = '修复这个Node费用报表工程的amount、summary、report三个模块。金额用精确分单位处理,接受测试约定的十进制字符串/有限数字、退款、0及空白;拒绝格式错误、超精度和不安全金额。按独立币种规范化/排序汇总并保留原数组,计数准确、安全求和,报表两位小数含负分金额。以原九项测试为完整契约。'
|
||||
+ '先inspect_project,再plan_checks选择["test","build"]并run_checks保留真实基线失败,读取原测试和相关源码。只允许修改src/amount.mjs、src/summary.mjs、src/report.mjs;不改测试、配置、README、构建脚本、owner文件或原暂存,不使用run_command,不直接提交Git。'
|
||||
+ 'propose_file/propose_patch准备完整三个模块后,用prepare_change_set一次封存全部三文件,等待审查应用。应用后继续同一个Task,重新plan_checks/run_checks,通过原9项测试和build后,用plan_delivery为三个文件准备本地Git预览并等待确认。模型必须自己实现,禁止用口头完成替代检查。预算最多8次模型请求、90000tokens,输出2048,上下文16K,请合并独立工具调用并避免重复观察。';
|
||||
save('node/goal.txt', goal); protect();
|
||||
await api(route + '/messages', { content: goal });
|
||||
while (Date.now() - start < 600000) {
|
||||
state = await api(route); taskId ??= state.execution.task.id; assert.equal(state.execution.task.id, taskId); protect();
|
||||
const usage = state.execution.task.usage; assert.ok(usage.requests <= 8); assert.ok(usage.totalTokens <= 90000);
|
||||
const progress = { status: state.status, requests: usage.requests, tokens: usage.totalTokens, lastTool: state.events.filter(event => event.kind === 'tool').at(-1)?.tool,
|
||||
checks: state.execution.checks.map(job => job.status), elapsedSeconds: Math.round((Date.now() - start) / 1000) };
|
||||
if (JSON.stringify({ ...progress, elapsedSeconds: 0 }) !== JSON.stringify({ ...observations.at(-1), elapsedSeconds: 0 })) { observations.push(progress); console.log(JSON.stringify(progress)); }
|
||||
for (const change of state.changes.filter(change => ['pending', 'conflict'].includes(change.status))) assert.ok(allowed.includes(change.path), 'Out-of-scope proposal: ' + change.path);
|
||||
for (const approval of state.approvals.filter(item => item.status === 'pending')) {
|
||||
const plan = state.execution.plans.find(value => value.id === approval.checkPlanId);
|
||||
const allow = !!plan && plan.taskId === taskId && plan.checks.length === 2 && plan.checks.every(check => ['test', 'build'].includes(check.name) && !check.lifecycle?.length)
|
||||
&& approval.cwd === sourceRoot && approval.command === plan.checks.map(check => check.command).join('\n');
|
||||
approvals.push({ approvalId: approval.id, planId: plan?.id, command: approval.command, allow });
|
||||
await api(route + '/approvals/' + approval.id, { allow }); assert.equal(allow, true, 'Only the sealed original checks are authorized.');
|
||||
}
|
||||
if (['running', 'awaiting_approval', 'stopping'].includes(state.status)) { await delay(650); continue; }
|
||||
if (state.status === 'failed') throw new Error(state.failure?.message ?? 'Actual-model task failed');
|
||||
const plan = state.execution.deliveryPlans?.findLast(value => value.status === 'planned' && value.taskId === taskId);
|
||||
if (plan) {
|
||||
assert.deepEqual(plan.paths.slice().sort(), allowed.slice().sort()); const requests = usage.requests;
|
||||
assert.ok(state.events.some(event => event.tool === 'plan_delivery' && event.phase === 'completed'));
|
||||
const passing = state.execution.checks.filter(job => job.status === 'passed').at(-1);
|
||||
assert.equal(passing?.results.find(value => value.name === 'test')?.tests?.passed, 9);
|
||||
await review('git', { plan, fingerprint: plan.fingerprint, checks: state.execution.checks, source: state.changes,
|
||||
status: git(['status', '--porcelain=v1']), stagedBefore, stagedAfter: git(['show', ':owner-staged.txt']) });
|
||||
await api(route + '/delivery-jobs', { planId: plan.id });
|
||||
await waitFor(async () => { state = await api(route); delivery = state.execution.deliveries.at(-1); return !!delivery?.reportArtifactId; });
|
||||
assert.equal(delivery.status, 'completed'); assert.equal(state.execution.task.usage.requests, requests); break;
|
||||
}
|
||||
const pending = state.changes.filter(change => change.status === 'pending');
|
||||
const batch = state.execution.changeSets?.findLast(value => value.taskId === taskId && value.status === 'prepared');
|
||||
if (pending.length) {
|
||||
assert.ok(state.execution.checks.some(job => job.status === 'failed' && job.results.some(value => value.tests?.failed > 0)), 'Model must preserve the original failing tests.');
|
||||
assert.equal(batch?.source, 'agent', 'Model must seal its own complete change set.');
|
||||
assert.deepEqual(batch.files.map(file => file.changeId).sort(), pending.map(change => change.id).sort());
|
||||
if (!applications.length) assert.deepEqual(batch.files.map(file => file.path).sort(), allowed.slice().sort());
|
||||
assert.ok(applications.length < 3);
|
||||
await review('changes', { fingerprint: batch.fingerprint, batch, changes: pending, checks: state.execution.checks });
|
||||
await api(route + '/change-sets/' + batch.id + '/apply', { fingerprint: batch.fingerprint });
|
||||
await waitFor(async () => (await api(route + '/change-sets/' + batch.id)).status === 'completed');
|
||||
for (const change of pending) assert.equal(sha(fs.readFileSync(path.join(sourceRoot, change.path))), change.sha256);
|
||||
applications.push({ id: batch.id, fingerprint: batch.fingerprint, paths: batch.files.map(file => file.path), source: batch.source }); protect();
|
||||
await remainingRun(); await api(route + '/continue-reviewed', {}); continue;
|
||||
}
|
||||
throw new Error('Model stopped before verified Git delivery: ' + state.status + '/' + state.execution.run.stopReason);
|
||||
}
|
||||
assert.ok(delivery, 'The sealed engineering deadline ended without complete delivery.');
|
||||
const passing = state.execution.checks.filter(job => job.status === 'passed').at(-1); assert.ok(passing);
|
||||
const tests = passing.results.find(value => value.name === 'test')?.tests; assert.equal(tests?.total, 9); assert.equal(tests.passed, 9); assert.equal(tests.failed, 0);
|
||||
assert.deepEqual(git(['diff-tree', '--no-commit-id', '--name-only', '-r', 'HEAD']).trim().split(/\r?\n/).sort(), allowed.slice().sort()); protect();
|
||||
succeeded = true;
|
||||
result = { success: true, commit: delivery.commit, tests, delivery, checkJobId: passing.id };
|
||||
} catch (error) {
|
||||
failure = { name: error.name, message: error.message, stack: error.stack, at: new Date().toISOString(), automaticReplay: false };
|
||||
result = { success: false, failure }; process.exitCode = 1;
|
||||
} finally {
|
||||
if (route) {
|
||||
state = await api(route);
|
||||
if (['running', 'stopping', 'awaiting_approval'].includes(state.status)) { await api(route + '/stop', {}); state = await api(route); }
|
||||
taskId ??= state.execution.task?.id;
|
||||
save('node/session.json', state); save('node/export.json', await api(route + '/export'));
|
||||
const attempts = meta('modelAttempts').filter(value => value.sessionId === session.id); save('node/attempts.json', attempts);
|
||||
const captures = await captureAttempts(api, attempts, 'node/captures');
|
||||
const identitiesValid = attempts.every(value => value.connectionId === connectionId && value.poolId === null && value.ordinal === 1
|
||||
&& value.status === 'completed' && value.modelIdentity?.status === 'matched' && value.modelIdentity.complete === true && value.modelIdentity.policy === 'require-match');
|
||||
result = { ...result, version: boot.version, sessionId: session.id, projectId: project.id, taskId, sourceRoot,
|
||||
connectionId, requestedModel: 'gpt-6.1-sol', usage: state.execution.task?.usage, state: state.status, stopReason: state.execution.run?.stopReason,
|
||||
attempts: attempts.length, identitiesValid, captures, approvals, applications, continuations, observations,
|
||||
modelImplementationSuppliedBySupervisor: false, modelWeightsAuthenticated: false, originalPurgeBenefitTested: false,
|
||||
elapsedSeconds: Math.round((Date.now() - start) / 1000) };
|
||||
if (succeeded) assert.equal(identitiesValid, true);
|
||||
save('node/model-outcome.json', result);
|
||||
for (const name of allowed) save('node/source-after/' + name, fs.readFileSync(path.join(sourceRoot, name)));
|
||||
save('node/git-final.json', { head: git(['rev-parse', 'HEAD']).trim(), status: git(['status', '--porcelain=v1']), stagedBefore, stagedAfter: git(['show', ':owner-staged.txt']), diff: git(['diff', 'HEAD', '--', ...allowed]) });
|
||||
}
|
||||
const host = await api('/host/status'); assert.equal(host.activity.active, false, 'Do not overwrite another active task.');
|
||||
if (configured) {
|
||||
const center = await api('/model-center'), current = center.connections.find(value => value.id === connectionId);
|
||||
assert.equal(current.revision, configured.revision, 'Do not overwrite an external connection edit.');
|
||||
const restored = await api('/model-center/connections', { ...connectionInput(connection), ...originalIdentity(connection), revision: current.revision });
|
||||
assert.equal(restored.credentialRevision, connection.credentialRevision); save('node/connection-restored.json', restored);
|
||||
assert.deepEqual(originalIdentity(restored), originalIdentity(connection));
|
||||
}
|
||||
if (budgetWritten) await api('/model-center/runtime-budgets', Object.fromEntries(budgetFields.map(key => [key, boot.config[key]])));
|
||||
if (selectionWritten) await api('/model-center/select', centerBefore.selected);
|
||||
const after = await publicSnapshot(origin, dataRoot); save('node/after.json', after);
|
||||
if (before) {
|
||||
for (const item of before.exports) assert.deepEqual(after.exports.find(value => value.id === item.id), item, 'Original export: ' + item.id);
|
||||
for (const table of ['sessions', 'records', 'events', 'outbox']) {
|
||||
const rows = new Map(after.database.tables[table].rows.map(row => [row.id, row]));
|
||||
for (const row of before.database.tables[table].rows) assert.deepEqual(rows.get(row.id), row, 'Original ' + table + '/' + row.id);
|
||||
}
|
||||
const artifactMap = new Map(after.persistent.artifacts.map(value => [value.path, value]));
|
||||
for (const item of before.persistent.artifacts) assert.deepEqual(artifactMap.get(item.path), item, 'Original artifact: ' + item.path);
|
||||
const finalBoot = await api('/bootstrap'), normalized = { ...finalBoot.config, configRevision: boot.config.configRevision };
|
||||
assert.deepEqual(canonical(normalized), canonical(boot.config));
|
||||
assert.deepEqual(finalBoot.projects.filter(value => value.id !== project?.id), boot.projects, 'Every original public project, excluding only the new owned sample.');
|
||||
assert.deepEqual(after.modelCenter.selected, centerBefore.selected); assert.deepEqual(after.modelCenter.pools, centerBefore.pools);
|
||||
for (const item of centerBefore.connections.filter(value => ![connectionId, 'legacy-default'].includes(value.id))) assert.deepEqual(after.modelCenter.connections.find(value => value.id === item.id), item);
|
||||
const finalMetadata = { config: meta('config'), registry: meta('modelRegistry') };
|
||||
save('node/final-public-metadata.json', finalMetadata);
|
||||
const configNormalized = { ...finalMetadata.config, configRevision: publicMetadata.config.configRevision };
|
||||
assert.deepEqual(canonical(configNormalized), canonical(publicMetadata.config), 'Raw public disk config except its monotonic revision.');
|
||||
const registryNormalized = structuredClone(finalMetadata.registry);
|
||||
assert.ok(registryNormalized.revision > publicMetadata.registry.revision);
|
||||
registryNormalized.revision = publicMetadata.registry.revision;
|
||||
const originalConnection = publicMetadata.registry.connections.find(value => value.id === connectionId);
|
||||
const finalConnection = registryNormalized.connections.find(value => value.id === connectionId);
|
||||
assert.equal(finalConnection.revision, originalConnection.revision + 2);
|
||||
finalConnection.revision = originalConnection.revision; finalConnection.updatedAt = originalConnection.updatedAt;
|
||||
const registryBefore = structuredClone(publicMetadata.registry);
|
||||
const normalizedBeforeConnection = registryBefore.connections.find(value => value.id === connectionId);
|
||||
const normalization = Object.fromEntries(Object.entries(originalIdentity(normalizedBeforeConnection)).filter(([key]) => !Object.hasOwn(normalizedBeforeConnection, key)));
|
||||
Object.assign(normalizedBeforeConnection, normalization);
|
||||
save('node/declared-identity-default-normalization.json', { connectionId, added: normalization,
|
||||
originalRawStatePreserved: true, originalSemanticsRestored: true, reason: 'The public partial-update API retains missing fields; restore explicit original default semantics rather than silently retaining require-match.' });
|
||||
for (const value of [registryBefore, registryNormalized]) value.connections.sort((a, b) => a.id.localeCompare(b.id));
|
||||
assert.deepEqual(canonical(registryNormalized), canonical(registryBefore), 'Registry except declared revision/timestamp/order and explicit original identity defaults.');
|
||||
const finalAttempts = meta('modelAttempts');
|
||||
for (const item of originalAttempts) assert.deepEqual(finalAttempts.find(value => value.id === item.id), item, 'Original complete model attempt: ' + item.id);
|
||||
const metadataRows = new Map(after.database.tables.metadata.rows.map(row => [row.id, row]));
|
||||
for (const row of before.database.tables.metadata.rows.filter(row => !['config', 'modelRegistry', 'modelAttempts'].includes(row.id))) assert.deepEqual(metadataRows.get(row.id), row);
|
||||
save('node/restoration.json', { passed: true, originalExports: before.exports.length, originalArtifactFiles: before.persistent.artifacts.length,
|
||||
originalRowsExact: ['sessions', 'records', 'events', 'outbox'], budgetsAndSelectionRestored: true, poolsUnchanged: true,
|
||||
originalPublicProjectsExact: true, originalAttemptsExact: originalAttempts.length, rawConfigExceptRevisionExact: true,
|
||||
registryExceptDeclaredRevisionTimestampOrderAndIdentityDefaultsExact: true, identityDefaultNormalization: normalization, otherMetadataRowsExact: true,
|
||||
originalCredentialRevision: connection?.credentialRevision, finalCredentialRevision: after.modelCenter.connections.find(value => value.id === connectionId)?.credentialRevision,
|
||||
changedOnlyMonotonicRevisionsObservedHealthAndDeclaredIdentityDefaults: true, pid: after.pid, version: after.version, noKeyExtractedOrResaved: true });
|
||||
}
|
||||
save('node/result.json', result ?? { success: false, failure, noModelDispatch: true }); await close();
|
||||
}
|
||||
console.log(JSON.stringify({ success: result.success, attempts: result.attempts, usage: result.usage, state: result.state,
|
||||
stopReason: result.stopReason, commit: result.commit, tests: result.tests, error: result.failure?.message }));
|
||||
@@ -0,0 +1,85 @@
|
||||
// One-shot QA adapter. Runs inside the existing host; never reads a credential.
|
||||
export async function boundedGptPreflight(input) {
|
||||
const ensure = (value, message) => { if (!value) throw new Error(message); };
|
||||
ensure(process.pid === input.pid, 'Unexpected host PID.');
|
||||
const servers = process._getActiveHandles().filter(h => h?.listening && h.address?.()?.address === '127.0.0.1' && h.address?.()?.port === input.port);
|
||||
ensure(servers.length === 1, 'Expected one owned loopback server.');
|
||||
const context = servers[0].workbenchHostAuthority?.context;
|
||||
ensure(context?.provider && context?.store && context?.runtime, 'Original context missing.');
|
||||
const { store, provider, runtime } = context;
|
||||
ensure(runtime.appDirectory === input.runtimeRoot, 'Loaded runtime changed.');
|
||||
ensure(![...store.sessions.values()].some(s => ['running', 'stopping', 'awaiting_approval'].includes(s.status)), 'Host is busy.');
|
||||
const session = store.session(input.sessionId), project = store.project(session.projectId);
|
||||
ensure(session.projectId === input.projectId && session.messages.length === 0 && !session.runId, 'Probe session must be new and owned.');
|
||||
const hub = provider.modelHub(store);
|
||||
const connection = hub.view().connections.find(c => c.id === input.connectionId);
|
||||
ensure(connection?.hasKey && connection.credentialRevision === input.credentialRevision, 'Original saved credential revision changed.');
|
||||
ensure(connection.enabled && connection.protocol === 'chat-completions' && (connection.modelIdentityPolicy ?? 'record') === 'record', 'Probe protocol/auth/identity mismatch.');
|
||||
ensure(connection.baseUrl === input.baseUrl && connection.model === input.model && connection.revision === input.connectionRevision, 'Connection changed.');
|
||||
const config = hub.prepare({ ...store.config, mode: 'compatible', maxSteps: 1, maxOutputTokens: 256,
|
||||
contextLimit: 16000, maxRunTokens: 16000, maxTaskTokens: 16000, maxRunDurationMs: 320000,
|
||||
modelResponseTimeoutMs: 300000, modelStreamIdleTimeoutMs: 120000 }, { type: 'connection', id: input.connectionId });
|
||||
config.modelRouting.members = config.modelRouting.members.map(member => ({ ...member, modelIdentityPolicy: 'require-match', modelIdentityAliases: [], modelIdentityAliasSource: '' }));
|
||||
ensure(config.modelRouting.members.length === 1 && config.modelRouting.maxAttempts === 1 && config.maxOutputTokens === 256, 'One-request hard limits missing.');
|
||||
globalThis.__gptRProbeOnce ??= new Set();
|
||||
ensure(!globalThis.__gptRProbeOnce.has(input.sessionId), 'This sample cannot be replayed.');
|
||||
globalThis.__gptRProbeOnce.add(input.sessionId);
|
||||
session.title = input.title;
|
||||
const run = store.beginRun(session, input.prompt, false, config, { forceNewTask: true });
|
||||
store.message(session, 'user', input.prompt);
|
||||
session.providerMessages.push({ role: 'user', content: input.prompt });
|
||||
const step = store.beginStep(session, run), planner = runtime.requestPlanner();
|
||||
let plan, response, diagnostic = null, requestEvent, receipts = 0, wireStarts = 0;
|
||||
const wireIds = new Set();
|
||||
const signal = AbortSignal.timeout(320000);
|
||||
let stopReason = 'identity_probe_complete';
|
||||
try {
|
||||
plan = planner.prepare(session, run, config, { system: 'This is a connection identity preflight. Reply to the user exactly. No tools are available. Do not perform any project work.', tools: [], stepId: step.id });
|
||||
const variants = plan.body.kind === 'model-route-plan' ? plan.body.variants.map(v => v.body) : [plan.body];
|
||||
ensure(variants.length === 1 && variants.every(b => !(b.tools?.length) && b.max_tokens === 256 && b.model === input.model), 'Wire request violates no-tool contract.');
|
||||
ensure(plan.record.tokenReservation.reservedTokens <= 16000, 'Reservation exceeds sealed budget.');
|
||||
const progress = event => {
|
||||
if (event.consumption) {
|
||||
receipts += Number(store.recordConsumption(session, run, { ...event.consumption, requestId: plan.record.id }, plan.record.tokenReservation.reservedTokens));
|
||||
return;
|
||||
}
|
||||
if (event.phase === 'running' && event.wireAttemptId) { wireIds.add(event.wireAttemptId); wireStarts = wireIds.size; ensure(wireStarts === 1, 'No retries permitted.'); }
|
||||
requestEvent ??= store.event(session, { kind: 'model', source: 'model_connection', label: 'R · GPT单次身份预检(无工具)', phase: 'running', runId: run.id, contextPlanId: plan.record.id, startedAt: new Date().toISOString() });
|
||||
if (event.modelAttemptId) requestEvent.modelAttemptId = event.modelAttemptId;
|
||||
if (event.connectionId) requestEvent.connectionId = event.connectionId;
|
||||
if (event.model) requestEvent.actualModel = event.model;
|
||||
if (event.modelIdentity) requestEvent.modelIdentity = event.modelIdentity;
|
||||
if (event.requestUrl) requestEvent.requestUrl = event.requestUrl;
|
||||
if (event.diagnostic) requestEvent.diagnostic = event.diagnostic;
|
||||
if (event.stream) requestEvent.stream = event.stream;
|
||||
if (event.phase) requestEvent.phase = event.phase;
|
||||
plan.record.requestAttempts = wireStarts; step.modelAttempts = wireStarts;
|
||||
store.save(session);
|
||||
};
|
||||
response = await provider.complete(config, plan.messages, project, signal, progress, plan.record, [], { attempts: 1, maxBudgetAttempts: 1 });
|
||||
ensure(!response.message.tool_calls?.length, 'Unsolicited tools are never executed.');
|
||||
ensure(receipts === 1, 'Expected one original consumption receipt.');
|
||||
planner.finish(session, plan.record, { response, attempts: wireStarts });
|
||||
session.providerMessages.push(response.message); store.message(session, 'assistant', response.message.content);
|
||||
const total = (run.usage?.reportedTokens ?? run.usage?.totalTokens ?? 0);
|
||||
session.status = total > 16000 ? 'paused' : 'completed';
|
||||
if (total > 16000) stopReason = 'task_token_limit';
|
||||
} catch (cause) {
|
||||
diagnostic = cause.diagnostic ?? { source: 'workbench', origin: 'local', stage: 'identity_preflight', kind: signal.aborted ? 'cancelled' : 'runtime', title: '身份预检需要核对', message: provider.redact(cause.message), occurredAt: new Date().toISOString() };
|
||||
session.status = diagnostic.kind === 'model_identity' || signal.aborted ? 'paused' : 'failed';
|
||||
stopReason = diagnostic.kind;
|
||||
session.lastFailure = { ...diagnostic, runId: run.id };
|
||||
const message = store.message(session, 'system', diagnostic.message);
|
||||
session.failure = { ...session.lastFailure, messageId: message.id };
|
||||
if (plan) planner.finish(session, plan.record, { error: new Error(diagnostic.message), attempts: wireStarts });
|
||||
} finally {
|
||||
if (requestEvent) { requestEvent.phase = diagnostic ? 'failed' : 'completed'; requestEvent.finishedAt = new Date().toISOString(); if (diagnostic) requestEvent.diagnostic = diagnostic; }
|
||||
store.finishStep(session, step, diagnostic ? 'failed' : 'completed');
|
||||
store.finishRun(session, run, stopReason);
|
||||
}
|
||||
const attempts = hub.attempts.filter(a => a.sessionId === session.id);
|
||||
ensure(attempts.length <= 1 && wireStarts <= 1, 'Single-request limit exceeded.');
|
||||
return { sessionId: session.id, projectId: project.id, taskId: run.taskId, runId: run.id, status: session.status,
|
||||
stopReason, attempts: attempts.length, receipts, wireStarts, actualTools: run.toolCalls, usage: run.usage,
|
||||
contextPlanId: plan?.record.id ?? null, diagnostic, message: response?.message ?? null };
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import assert from 'node:assert/strict';
|
||||
import { root, save, original, client, meta, connectionId } from './live-delivery-r-common.mjs';
|
||||
import { inspectorClosed } from './live-delivery-r-inspector.mjs';
|
||||
const read = name => JSON.parse(fs.readFileSync(path.join(root, name)));
|
||||
const before = read('preflight/before.json'), after = read('preflight/after.json');
|
||||
const owned = read('preflight/owned.json'), outcome = read('preflight/result.json');
|
||||
assert.equal(outcome.passed, true);
|
||||
assert.equal(after.pid, before.pid); assert.equal(after.pid, 36552); assert.equal(after.version, '1.24.6');
|
||||
assert.equal(after.configSha256, before.configSha256); assert.deepEqual(after.active, []);
|
||||
for (const item of before.exports) assert.deepEqual(after.exports.find(value => value.id === item.id), item);
|
||||
const tables = ['sessions', 'records', 'events', 'outbox'];
|
||||
for (const table of tables) {
|
||||
assert.equal(after.database.tables[table].schemaSha256, before.database.tables[table].schemaSha256);
|
||||
const rows = new Map(after.database.tables[table].rows.map(row => [row.id, row]));
|
||||
for (const row of before.database.tables[table].rows) assert.deepEqual(rows.get(row.id), row, table + '/' + row.id);
|
||||
}
|
||||
const rows = new Map(after.database.tables.metadata.rows.map(row => [row.id, row]));
|
||||
for (const row of before.database.tables.metadata.rows.filter(row => row.id !== 'modelAttempts')) assert.deepEqual(rows.get(row.id), row, row.id);
|
||||
const artifacts = new Map(after.persistent.artifacts.map(row => [row.path, row]));
|
||||
for (const row of before.persistent.artifacts) assert.deepEqual(artifacts.get(row.path), row);
|
||||
assert.deepEqual(after.modelCenter.selected, before.modelCenter.selected); assert.deepEqual(after.modelCenter.pools, before.modelCenter.pools);
|
||||
for (const item of before.modelCenter.connections) {
|
||||
const next = after.modelCenter.connections.find(row => row.id === item.id);
|
||||
if (item.id === connectionId) { const health = next.health; assert.ok(health); assert.deepEqual({ ...next, health: item.health }, item); }
|
||||
else assert.deepEqual(next, item);
|
||||
}
|
||||
for (const item of read('preflight/original-attempts.json')) assert.deepEqual(meta('modelAttempts').find(row => row.id === item.id), item);
|
||||
const { boot, close } = await client();
|
||||
try {
|
||||
assert.deepEqual(boot.config, original.config);
|
||||
assert.deepEqual(boot.projects.filter(row => row.id !== owned.project.id), original.projects);
|
||||
const closed = await inspectorClosed();
|
||||
const result = { passed: true, pid: after.pid, version: after.version, originalExports: before.exports.length,
|
||||
originalArtifacts: before.persistent.artifacts.length, originalRowsExact: tables, otherMetadataExceptAppendedAttemptsExact: true,
|
||||
originalPublicProjectsExact: true, originalConfigRegistryAndPoolExact: true, observedConnectionHealthChange: true,
|
||||
inspectorClosed: closed, noKeyReadOrResaved: true, ownedProjectId: owned.project.id, ownedSessionId: owned.session.id };
|
||||
save('preflight/restoration.json', result); console.log(JSON.stringify(result));
|
||||
} finally { await close(); }
|
||||
@@ -0,0 +1,68 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import assert from 'node:assert/strict';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { publicSnapshot, hash } from './desktop-f-state.mjs';
|
||||
import { invokeGptProbe, inspectorClosed } from './live-delivery-r-inspector.mjs';
|
||||
import { root, origin, dataRoot, connectionId, save, meta, client, captureAttempts } from './live-delivery-r-common.mjs';
|
||||
|
||||
assert.equal(fs.existsSync(path.join(root, 'preflight')), false, 'Never replay or overwrite a real sample.');
|
||||
const { api, boot, close } = await client();
|
||||
let fatal;
|
||||
try {
|
||||
await inspectorClosed();
|
||||
assert.equal(boot.version, '1.24.6');
|
||||
const host = await api('/host/status'); assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false);
|
||||
const before = await publicSnapshot(origin, dataRoot); save('preflight/before.json', before);
|
||||
assert.deepEqual(before.active, []);
|
||||
const connection = before.modelCenter.connections.find(value => value.id === connectionId);
|
||||
assert.equal(connection.enabled, true); assert.equal(connection.hasKey, true); assert.equal(connection.credentialRevision, 1);
|
||||
assert.equal(connection.protocol, 'chat-completions'); assert.equal(connection.model, 'gpt-6.1-sol'); assert.equal(connection.revision, 5);
|
||||
assert.equal(connection.contextLimit, 16000); assert.equal(connection.modelIdentityPolicy ?? 'record', 'record');
|
||||
const originalAttempts = meta('modelAttempts'); save('preflight/original-attempts.json', originalAttempts);
|
||||
const nonce = randomUUID(), prompt = `这是独立GPT连接身份预检,不是工程任务。只回复 OK ${nonce},不要调用工具、读写文件或执行命令。`;
|
||||
save('preflight/contract.json', { kind: 'single-real-GPT-identity-preflight', connectionId, connection,
|
||||
version: boot.version, runtimeRoot: boot.runtimeRoot, maxRequests: 1, maxAttempts: 1, maxOutputTokens: 256,
|
||||
maxTokens: 16000, contextLimit: 16000, toolDefinitions: 0, toolExecution: 0,
|
||||
poolSwitching: false, automaticReplay: false, modelIdentityPolicy: 'require-match in this experiment snapshot only',
|
||||
noGlobalConfigurationWrite: true, noCredentialExtractionOrResave: true, prompt, nonce,
|
||||
originalBaselineSha256: hash(fs.readFileSync(path.join(root, 'preflight/before.json'))) });
|
||||
const projectRoot = path.join(root, 'preflight/identity-only'); fs.mkdirSync(projectRoot);
|
||||
fs.writeFileSync(path.join(projectRoot, 'README.md'), '# R GPT identity preflight\nNo engineering or command execution.\n', { flag: 'wx' });
|
||||
const project = await api('/projects', { root: projectRoot });
|
||||
const session = await api('/sessions', { projectId: project.id }); save('preflight/owned.json', { project, session });
|
||||
const input = { pid: host.identity.pid, port: 4318, runtimeRoot: boot.runtimeRoot, sessionId: session.id, projectId: project.id,
|
||||
connectionId, connectionRevision: connection.revision, credentialRevision: connection.credentialRevision,
|
||||
baseUrl: connection.baseUrl, model: connection.model, title: 'R · jojocode GPT连接单次预检', prompt };
|
||||
save('preflight/input.json', input);
|
||||
console.log(JSON.stringify({ stage: 'single-GPT-preflight', connectionId, model: connection.model, requestUrl: connection.baseUrl + '/chat/completions', maxRequests: 1, toolDefinitions: 0 }));
|
||||
const invoked = await invokeGptProbe(input); save('preflight/expression.js', invoked.expression); save('preflight/host-result.json', invoked.result);
|
||||
const previous = new Set(originalAttempts.map(value => value.id));
|
||||
const attempts = meta('modelAttempts').filter(value => !previous.has(value.id)); save('preflight/attempts.json', attempts);
|
||||
assert.ok(attempts.length <= 1); for (const attempt of attempts) { assert.equal(attempt.sessionId, session.id); assert.equal(attempt.connectionId, connectionId); assert.equal(attempt.poolId, null); }
|
||||
const state = await api('/sessions/' + session.id); save('preflight/session.json', state);
|
||||
save('preflight/export.json', await api('/sessions/' + session.id + '/export'));
|
||||
const captures = await captureAttempts(api, attempts, 'preflight/captures');
|
||||
const attempt = attempts[0];
|
||||
const passed = attempts.length === 1 && attempt.status === 'completed' && attempt.modelIdentity?.status === 'matched'
|
||||
&& attempt.modelIdentity.complete === true && attempt.modelIdentity.policy === 'require-match' && attempt.responseRedacted === false
|
||||
&& attempt.usageStatus === 'reported' && attempt.usage.total_tokens <= 16000 && captures.length === 2
|
||||
&& invoked.result.actualTools === 0 && state.status === 'completed' && invoked.result.message?.content?.includes(nonce);
|
||||
const result = { passed, engineeringTestAllowed: passed, testedAt: new Date().toISOString(), version: boot.version,
|
||||
connectionId, sessionId: session.id, projectId: project.id, taskId: invoked.result.taskId,
|
||||
requestedModel: connection.model, reportedModels: attempt?.modelIdentity?.reportedModels ?? [], identity: attempt?.modelIdentity,
|
||||
requestUrl: attempt?.requestUrl, requests: attempts.length, usage: attempt?.usage ?? null, usageStatus: attempt?.usageStatus ?? 'not_dispatched',
|
||||
actualTools: invoked.result.actualTools, stopReason: invoked.result.stopReason, captures,
|
||||
noRetryOrPoolSwitch: attempts.every(value => value.ordinal === 1 && value.poolId === null),
|
||||
modelWeightsAuthenticated: false, engineeringDeliveryTested: false, purgeBenefitTested: false,
|
||||
defaultSelectionChanged: false, connectionConfigChanged: false, credentialValuesReadOrSaved: false };
|
||||
save('preflight/result.json', result); console.log(JSON.stringify({ passed, requests: result.requests, usage: result.usage, reportedModels: result.reportedModels, stopReason: result.stopReason }));
|
||||
} catch (error) {
|
||||
fatal = { name: error.name, message: error.message, stack: error.stack, recordedAt: new Date().toISOString(), automaticReplay: false };
|
||||
save('preflight/driver-error.json', fatal); process.exitCode = 1;
|
||||
} finally {
|
||||
save('preflight/after.json', await publicSnapshot(origin, dataRoot));
|
||||
save('preflight/inspector-final.json', { closed: await inspectorClosed() });
|
||||
await close();
|
||||
}
|
||||
if (fatal) console.error(fatal.message);
|
||||
@@ -0,0 +1,15 @@
|
||||
import fs from 'node:fs';
|
||||
import assert from 'node:assert/strict';
|
||||
const once = (value, from, to) => { assert.equal(value.split(from).length, 2, from); return value.replace(from, to); };
|
||||
const names = ['initial', 'common', 'payload', 'inspector', 'preflight', 'preflight-audit', 'node'];
|
||||
for (const name of names) {
|
||||
let value = fs.readFileSync('.qa/live-delivery-p-' + name + '.mjs', 'utf8')
|
||||
.replaceAll('live-delivery-p', 'live-delivery-r').replaceAll('__gptPProbeOnce', '__gptRProbeOnce')
|
||||
.replaceAll('1.24.5', '1.24.6').replaceAll('P GPT', 'R GPT').replaceAll('P · ', 'R · ');
|
||||
if (['initial', 'preflight', 'node'].includes(name)) value = once(value, 'assert.equal(connection.revision, 3);', 'assert.equal(connection.revision, 5);');
|
||||
if (name === 'initial') value = once(value, 'fs.mkdirSync(root);',
|
||||
"assert.deepEqual(center.selected, { type: 'pool', id: '68e30376-b799-445b-a858-db2dba9920a0' });\nfs.mkdirSync(root);");
|
||||
if (name === 'common') value = once(value, "['config', 'modelRegistry', 'modelAttempts']", "['config', 'modelRegistry', 'modelAttempts', 'modelNetworkDiagnostics']");
|
||||
fs.writeFileSync('.qa/live-delivery-r-' + name + '.mjs', value, { flag: 'wx' });
|
||||
}
|
||||
console.log(JSON.stringify({ prepared: names, modelRequests: 0, previousDriversUnchanged: true }));
|
||||
@@ -0,0 +1,153 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"kind": "bounded-live-delivery-r-contract",
|
||||
"frozenAt": "2026-11-03T16:00:29.525Z",
|
||||
"sourceBaseCommit": "8cf152e3ab574ba25f9c48564494a7b3e029cb18",
|
||||
"branch": "test/live-delivery-r",
|
||||
"planSha256": "dfba801d07a9be81f68af43cdf5662575fb5e8af501f39d24678e75b1393c7d3",
|
||||
"originalBaselineSha256": "93f7bd556b1c85ade21124477ba6bdd592e48e0bdc4d126ebfff5f2c4ff7130a",
|
||||
"releaseVersion": "1.24.6",
|
||||
"releaseSourceCommit": "54dbe3d6fc7b068e37010222a09cff244975b2c0",
|
||||
"releaseIdentitySha256": "75ebae8ef9811f2306298e223167f93632d8f9d2bc99d3de86f27647381525be",
|
||||
"host": {
|
||||
"pid": 36552,
|
||||
"runtimeRoot": "C:\\Users\\wangy\\AppData\\Local\\Programs\\AgentWorkbench\\versions\\Agent-Workbench-1.24.6-win-x64-20261103151145294",
|
||||
"runtimeIdentity": "2c662dee28c0c61b57e2f77dbb546667af7b6938aaf848e5a6facde973cad2e1"
|
||||
},
|
||||
"originalProjects": 61,
|
||||
"originalSessions": 77,
|
||||
"originalArtifacts": 3610,
|
||||
"originalAttemptsRow": {
|
||||
"id": "modelAttempts",
|
||||
"sha256": "ff16d081e79d5e6903a3618403b314de9efe81fdb9f4323db50746d8459f0642"
|
||||
},
|
||||
"dependencySources": [
|
||||
{
|
||||
"path": "src/core/git-process.mjs",
|
||||
"sha256": "80547ec8928610ac4df5a05c5aef12d1aab0dca9e7b1def2773fc745f5adf5f5"
|
||||
},
|
||||
{
|
||||
"path": "src/core/desktop/install-manager.mjs",
|
||||
"sha256": "91c216537666f690122071a5b53b7c8b3beba4ea549acd1534edca24390d9635"
|
||||
},
|
||||
{
|
||||
"path": "benchmarks/live-delivery-v1/node/src/amount.mjs",
|
||||
"sha256": "84cb647328ec52dad27d288f3a6127ff3e1ad87274ae2d227ad44daa49cbb2ed"
|
||||
},
|
||||
{
|
||||
"path": "benchmarks/live-delivery-v1/node/src/summary.mjs",
|
||||
"sha256": "48829850c11ca0cd0ab5e86bbac69a0c5f90297292168c1ba6dc338e2eae6ee7"
|
||||
},
|
||||
{
|
||||
"path": "benchmarks/live-delivery-v1/node/src/report.mjs",
|
||||
"sha256": "ba0a014e6e9df710d66e255a3a6f970f4e1c8af48accc81f33627029dcded7c0"
|
||||
},
|
||||
{
|
||||
"path": "benchmarks/live-delivery-v1/node/test/expense.test.mjs",
|
||||
"sha256": "0bcda551dbaeafad9a6e3df8024492ab67d7c09956f4676c393b78249ab44839"
|
||||
},
|
||||
{
|
||||
"path": "benchmarks/live-delivery-v1/node/package.json",
|
||||
"sha256": "6ad63026b2fe9de7513a4f6704c372a86108ee3d018a1f04883dc0a409ea4c24"
|
||||
},
|
||||
{
|
||||
"path": "benchmarks/live-delivery-v1/node/scripts/build.mjs",
|
||||
"sha256": "7279bc7c707c0f3ccbae63b14f0abed248ad3755be14f9e37128124ae9267526"
|
||||
}
|
||||
],
|
||||
"previousDriverHashes": [
|
||||
{
|
||||
"path": ".qa/live-delivery-p-initial.mjs",
|
||||
"sha256": "fa69d5dcfe74524fe84ed896b85ab16c7561480f56bd159b5fbc93d6bdd6fc62"
|
||||
},
|
||||
{
|
||||
"path": ".qa/live-delivery-p-common.mjs",
|
||||
"sha256": "653ddc37c32aabfa68ee675f661085e4fa8ec7e9bcd6498a5182b17024c63611"
|
||||
},
|
||||
{
|
||||
"path": ".qa/live-delivery-p-payload.mjs",
|
||||
"sha256": "17dc662692bd95a37d07c6b573c38d464fa834aaaa1d0ac2d7b7f4b52900f26f"
|
||||
},
|
||||
{
|
||||
"path": ".qa/live-delivery-p-inspector.mjs",
|
||||
"sha256": "7735cebbdb4302de5199b754f4ddcb6517e9e9f6b49905602b6d80393d021c54"
|
||||
},
|
||||
{
|
||||
"path": ".qa/live-delivery-p-preflight.mjs",
|
||||
"sha256": "429d39fae981eb8211c02d971bafe56c7ba7b69e3011f310ddf308ea26ea067c"
|
||||
},
|
||||
{
|
||||
"path": ".qa/live-delivery-p-preflight-audit.mjs",
|
||||
"sha256": "f1c5b27519f0f3ad821650780de840bf0fb23df662ccc57fe8686f78cd187269"
|
||||
},
|
||||
{
|
||||
"path": ".qa/live-delivery-p-node.mjs",
|
||||
"sha256": "85bd84617ac2be7e7bdfcc98cc75dea529048a5634d573d69cc7c5ed4f9bcda4"
|
||||
}
|
||||
],
|
||||
"maxNetworkJobs": 1,
|
||||
"maxPreflightRequests": 1,
|
||||
"maxNodeRequests": 8,
|
||||
"maxNodeTokens": 90000,
|
||||
"contextLimit": 16000,
|
||||
"maxOutputTokens": 2048,
|
||||
"modelRequestsAtFreeze": 0,
|
||||
"noKeyValuesReadOrSaved": true,
|
||||
"files": [
|
||||
{
|
||||
"path": "drivers/desktop-f-state.mjs.txt",
|
||||
"bytes": 5932,
|
||||
"sha256": "6cf41ebd2ce55fe6fe3175948e9b964fac99975aca3132420a83b1d122e08b0b"
|
||||
},
|
||||
{
|
||||
"path": "drivers/freeze-live-delivery-r.mjs.txt",
|
||||
"bytes": 3654,
|
||||
"sha256": "486503874a89ef20504ef0038a95558475fbc081d8c4b0ad4986a054608fed7d"
|
||||
},
|
||||
{
|
||||
"path": "drivers/live-delivery-r-common.mjs.txt",
|
||||
"bytes": 3084,
|
||||
"sha256": "c8ccf89f552ac69668e964a47c56be5e38276e9f239c3729c93de58220e9ed39"
|
||||
},
|
||||
{
|
||||
"path": "drivers/live-delivery-r-initial.mjs.txt",
|
||||
"bytes": 2150,
|
||||
"sha256": "c77932a3284de2cf43a85a95b95756867da74dfc5f16f36e642c968a39916a74"
|
||||
},
|
||||
{
|
||||
"path": "drivers/live-delivery-r-inspector.mjs.txt",
|
||||
"bytes": 3329,
|
||||
"sha256": "3306efc0651cae2a887ab944a6faed83332b2103a0aa3bf7cc56683c0c5abfe0"
|
||||
},
|
||||
{
|
||||
"path": "drivers/live-delivery-r-network.mjs.txt",
|
||||
"bytes": 4799,
|
||||
"sha256": "518c38942629eed0ac671bbe9541e968ef6b8713a59acb62a91d979dfb8232a7"
|
||||
},
|
||||
{
|
||||
"path": "drivers/live-delivery-r-node.mjs.txt",
|
||||
"bytes": 23935,
|
||||
"sha256": "014d153e0253182ace91105d19d1b2c78786aaa6de3f9630d97d242da84c1e86"
|
||||
},
|
||||
{
|
||||
"path": "drivers/live-delivery-r-payload.mjs.txt",
|
||||
"bytes": 7367,
|
||||
"sha256": "fb2b5a6818cb229512823002aa090b95641cc404a6423190e1cb7194c34ecbd9"
|
||||
},
|
||||
{
|
||||
"path": "drivers/live-delivery-r-preflight-audit.mjs.txt",
|
||||
"bytes": 3090,
|
||||
"sha256": "938f92e7a2f5af357a54680ecd4a14f0e1c8798c1fc6f1b0a8f4561166e47f7e"
|
||||
},
|
||||
{
|
||||
"path": "drivers/live-delivery-r-preflight.mjs.txt",
|
||||
"bytes": 6152,
|
||||
"sha256": "ed1192b71fbc1af6554cb76117fa1330b5d05345a5db1b784c6a551b1c6bf8f8"
|
||||
},
|
||||
{
|
||||
"path": "drivers/prepare-live-delivery-r.mjs.txt",
|
||||
"bytes": 1299,
|
||||
"sha256": "3109c4c992a82b1caad84ae0b949c1cdd04d2a9a327db4c12aef1ed5be6edab0"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
# 汇总发现
|
||||
|
||||
## R:接续连接诊断后的真实验收边界
|
||||
|
||||
本轮新基线确认1.24.6/原PID36552、61项目77会话/3610工件,目标jojocode修订5/凭据1、16K/2048、Chat JSON,当前高性能默认池和旧09b停用均匹配。11份驱动及依赖SHA、原始基线SHA/运行时身份/预算计划已冻结到live-delivery-r-contract,尚无远程诊断或模型请求。审查时已把诊断后的persistent比较限定为应保持的原工件/公开文件;数据库允许的唯一诊断metadata变化另核对,避免把合法新历史当成数据损坏。
|
||||
|
||||
Q 的诊断、发行及完整原状态核对已封存,当前 Git 8cf152e3 干净,建立 test/live-delivery-r。下一步是真实单次身份预检和新 Node 闭环,原九测试和16K/2048、8请求/90000tokens保持。诊断只观察所属端点的DNS/TCP/TLS,不认证API稳定性或模型工程能力;原 P/O 失败不重跑。当前尚无 R 远程诊断或模型请求,先保存新原状态及驱动契约。正式运行身份与最新数据计数待本轮基线核对,不照搬Q计数。
|
||||
|
||||
## Q:所属连接诊断的实现边界
|
||||
|
||||
已比较卡片内展开与独立诊断分类两种结构:卡片内嵌会把DNS/多路径/历史挤入每条连接,选择沿用模型中心分类页,连接条目提供直达按钮;主区域展示所选连接的DNS和三种地址族路径,旁边保留近期历史,窄屏顺序折叠。界面不增加全屏仪表盘。核心实现记录有界元数据,获取历史不创建新元数据;停止等待所属socket真正关闭,宿主停止/升级门禁包含活动诊断,重启仅标记中断而不重放。
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# 统一执行进度
|
||||
|
||||
## R:新的有界预检与工程交付
|
||||
|
||||
完成新原状态基线61项目/77会话/3610工件与正式1.24.6/原PID36552核对;新驱动语法通过,11份原字节及依赖/预算契约冻结,manifest b19caea4c7fbabb4b3f7ab967963017acc69ef3973d946c2acd5b52e65e266b6。尚未发送诊断或真实模型请求。准备先本地Git保存计划/驱动,再执行唯一所属诊断。
|
||||
|
||||
用户要求继续全量推进并回顾总结。接续8cf152e3,建立test/live-delivery-r,沿用planning-with-files,不委派。先冻结新基线/脚本/预算,随后一次所属诊断与单次严格GPT预检,通过后才做新Node。正式1.24.6/PID36552/Provider与Key、高性能池、旧09b停用状态保持。原始失败/未知用量保留,不扩大预算、重试切池或重跑旧Task;Node后才React/Python及独立原版Purge。准备只读路径/Windows通配与规划补丁锚点错误均无模型或执行副作用,已按真实文件修正。
|
||||
|
||||
## Q:模型连接诊断已交付
|
||||
|
||||
最终1.24.6/source54dbe3d6/候选20261103151145294已正式本地升级,原PID36552/Provider及61项目77会话/所有原行/导出/工件和公开模型配置在网页与原生回看后再次精确保持。560源码ZIP输入独立重建22/22;5份未跟踪例示dist已用ZIP原脚本复现逐SHA一致,未改写包。三归档/便携、12实际安装和16+9文件流程、新UI三载荷各9组通过。438份/89228582字节封存与离线核对通过;含清单439份/89355230字节在Git索引逐SHA一致。首diff对原编译空白/源码副本末行的提示已保留,只限定证据目录关闭风格检查,原件未改写;本地Git收尾。正式启动器首报无窗口,随后一次窗口清单已找到实际新版本;没有再次启动。实际升级677755ms,后续单列性能审查。真实模型请求0,Node/React/Python/Purge继续独立验收。
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# Agent Workbench:核心代理能力研究与产品计划
|
||||
|
||||
## 当前 R:连接诊断后的新真实模型交付验收
|
||||
|
||||
接续 Q 的 8cf152e3;正式产品保持 1.24.6/source54dbe3d6、原 PID36552/Provider。沿用 planning-with-files,不委派、不重启、不提取/复制/重存 Key、不推送。固定启用 jojocode/5b4daed9(GPT/Chat JSON、16K/2048、连接修订5/凭据1),高性能默认池和旧09b停用状态保留;P/O 原失败不续跑。本轮先冻结脚本和契约,再发送新的有界请求,不以不断开样本掩盖失败。
|
||||
|
||||
1. [complete] 新基线61项目/77会话/3610原工件、全部原行/导出摘要、公开配置/连接/池及正式1.24.6/原PID36552已记录;11驱动原字节/依赖源码/预算契约冻结,语法核对通过,调用前先本地提交。
|
||||
2. [pending] 仅一次所属 DNS/TCP/TLS 诊断,保存完整范围与结果;零 HTTP/凭据读取,不把直连观察当作 API/代理路线验证,不强制 IPv4 或关闭证书。
|
||||
3. [pending] 新单次严格身份预检:固定连接,最多1请求/1尝试、256输出、16000总tokens、零工具/重试/切池;严格策略仅实验快照,核对原始请求/响应/用量与原状态。
|
||||
4. [pending] 预检通过才做新 Node:原九测试/test/build、仅三源码文件;16K/2048、最多8请求/90000tokens/600000ms。监督只审查完整批次/审批原命令/确认Git,不给实现;仅同Task审查续接,消耗剩余预算,失败不追加提示或扩大预算。
|
||||
5. [pending] 独立核对恢复、原记录/导出/工件、每次请求身份与用量;分析实际失败/缺陷,必要修复另立切片,不重写失败;封存证据/离线核验、回顾/计划与本地Git。
|
||||
|
||||
Node 通过后才另做 React/Python,原版 Purge 收益保持独立 AB/BA;1.25其余能力与更新性能保持后续计划。本轮没有实际产品修复时不制造新发行。准备期间只读路径猜测及Windows rg通配参数失败已改按实际 .mjs 路径查询;首规划补丁因 findings 标题锚点不符被整体拒绝,确认无部分写入后修正,没有模型副作用。
|
||||
|
||||
## 已完成 Q:模型中心的有界连接诊断
|
||||
|
||||
接续dca6cbdb,用户要求全量推进并回顾。使用planning-with-files、product-ui-ux和frontend-design,不委派。开发无Key/无HTTP的所属连接DNS/TCP/TLS诊断;保留原请求、真实能力与健康结论。正式1.24.5/PID36552/Provider及原凭据、用户池不重启/改写,实验使用隔离宿主。
|
||||
|
||||
Reference in New Issue
Block a user