Track the fixed PhotoCraft source baseline with the existing native client integration. Use the actual Pi SDK for normal sends, durable session recovery, demand-loaded enterprise rules and checked undoable canvas tools. Retain request identities and never resend unknown inference. Include local packaging and real-call acceptance evidence.
17 lines
1.1 KiB
JavaScript
17 lines
1.1 KiB
JavaScript
import fs from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
import { Native98kBroker, NativeCanvas } from '../src/native-bridge.mjs';
|
|
import { ProjectStore, atomic } from '../src/store.mjs';
|
|
import { DetailPiAgent } from '../src/agent.mjs';
|
|
const config = JSON.parse(await fs.readFile(process.argv[2], 'utf8')), id = process.argv[3];
|
|
if (!id) throw Error('请提供原幂等键;仅查询原请求,不会发起推理');
|
|
const broker = new Native98kBroker(config.broker), info = await broker.info();
|
|
const store = await ProjectStore.open(config.output, { scope: info.accountScope, project: config.broker.project }, config.canvasBinding || config.binding);
|
|
const canvas = await NativeCanvas.connect(config.canvas);
|
|
const host = await DetailPiAgent.open({ store, broker, canvas, protocolMode: config.protocolMode });
|
|
try {
|
|
const result = await host.recover(id, { executeReadOnly: true });
|
|
await atomic(path.join(config.output, 'recovered-original-sse.json'), { id, ...result, checkedAt: new Date().toISOString() });
|
|
console.log(JSON.stringify(result, null, 2));
|
|
} finally { await host.dispose(); canvas.close(); }
|