feat(research): cut over canonical runtime and enforce agent budgets

This commit is contained in:
Boki 2026-10-24 16:47:19 -04:00
parent ab08db82fd
commit bbf0dd4453
103 changed files with 6138 additions and 3112 deletions

View file

@ -1,3 +1,4 @@
import { executeReplayTrace } from '../../apps/stock/orchestrator/src/backtest/native-replay';
import {
nativeWorkerRequestSchema,
type NativeWorkerMessage,
@ -11,13 +12,13 @@ function send(message: NativeWorkerMessage | { invalid: boolean }): Promise<void
process.once('message', async (input: unknown) => {
const request = nativeWorkerRequestSchema.parse(input);
if (request.type !== 'run') {
throw new Error('Legacy fixture only');
if (request.type !== 'runReplayTrace') {
throw new Error('Canonical replay lifecycle fixture only');
}
const { config } = request;
// Fixture controls are run labels, not unsupported production strategy parameters.
const behavior = config.name?.startsWith('fixture:')
? config.name.slice('fixture:'.length)
const behavior = config.matching.risk.ledger.sessionId.startsWith('fixture:')
? config.matching.risk.ledger.sessionId.slice('fixture:'.length)
: undefined;
if (!behavior) {
// The same adapter can recover and run the actual Rust engine after a failed worker.
@ -49,7 +50,7 @@ process.once('message', async (input: unknown) => {
process.exit(0);
return;
case 'result-then-block':
await send({ type: 'result', result: '{}' });
await send({ type: 'result', result: JSON.stringify(executeReplayTrace(request).result) });
while (true) {
Math.sqrt(Math.random());
}