@openprose/reactor-cradle 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +270 -0
- package/dist/assert/index.d.ts +35 -0
- package/dist/assert/index.d.ts.map +1 -0
- package/dist/assert/index.js +398 -0
- package/dist/baselines/cost-thesis/index.d.ts +103 -0
- package/dist/baselines/cost-thesis/index.d.ts.map +1 -0
- package/dist/baselines/cost-thesis/index.js +337 -0
- package/dist/baselines/naive-loop/index.d.ts +46 -0
- package/dist/baselines/naive-loop/index.d.ts.map +1 -0
- package/dist/baselines/naive-loop/index.js +188 -0
- package/dist/baselines/no-memo/index.d.ts +84 -0
- package/dist/baselines/no-memo/index.d.ts.map +1 -0
- package/dist/baselines/no-memo/index.js +226 -0
- package/dist/doubles/clock.d.ts +9 -0
- package/dist/doubles/clock.d.ts.map +1 -0
- package/dist/doubles/clock.js +42 -0
- package/dist/doubles/storage.d.ts +24 -0
- package/dist/doubles/storage.d.ts.map +1 -0
- package/dist/doubles/storage.js +191 -0
- package/dist/eval/index.d.ts +204 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +596 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/policy-author/index.d.ts +103 -0
- package/dist/policy-author/index.d.ts.map +1 -0
- package/dist/policy-author/index.js +358 -0
- package/dist/policy-drift/index.d.ts +64 -0
- package/dist/policy-drift/index.d.ts.map +1 -0
- package/dist/policy-drift/index.js +495 -0
- package/dist/policy-replay/index.d.ts +106 -0
- package/dist/policy-replay/index.d.ts.map +1 -0
- package/dist/policy-replay/index.js +361 -0
- package/dist/provider-parity/index.d.ts +91 -0
- package/dist/provider-parity/index.d.ts.map +1 -0
- package/dist/provider-parity/index.js +439 -0
- package/dist/recompile/index.d.ts +161 -0
- package/dist/recompile/index.d.ts.map +1 -0
- package/dist/recompile/index.js +690 -0
- package/dist/release-candidate/index.d.ts +139 -0
- package/dist/release-candidate/index.d.ts.map +1 -0
- package/dist/release-candidate/index.js +553 -0
- package/dist/release-parity/index.d.ts +80 -0
- package/dist/release-parity/index.d.ts.map +1 -0
- package/dist/release-parity/index.js +1035 -0
- package/dist/replay/model-gateway.d.ts +25 -0
- package/dist/replay/model-gateway.d.ts.map +1 -0
- package/dist/replay/model-gateway.js +166 -0
- package/dist/replay/parity.d.ts +110 -0
- package/dist/replay/parity.d.ts.map +1 -0
- package/dist/replay/parity.js +232 -0
- package/dist/rollback/index.d.ts +106 -0
- package/dist/rollback/index.d.ts.map +1 -0
- package/dist/rollback/index.js +694 -0
- package/dist/scenario/parser.d.ts +11 -0
- package/dist/scenario/parser.d.ts.map +1 -0
- package/dist/scenario/parser.js +490 -0
- package/dist/scenario/runner.d.ts +12 -0
- package/dist/scenario/runner.d.ts.map +1 -0
- package/dist/scenario/runner.js +345 -0
- package/dist/scenario/synthetic-world-adapter.d.ts +4 -0
- package/dist/scenario/synthetic-world-adapter.d.ts.map +1 -0
- package/dist/scenario/synthetic-world-adapter.js +82 -0
- package/dist/scenario/time.d.ts +4 -0
- package/dist/scenario/time.d.ts.map +1 -0
- package/dist/scenario/time.js +45 -0
- package/dist/scenario/types.d.ts +149 -0
- package/dist/scenario/types.d.ts.map +1 -0
- package/dist/scenario/types.js +5 -0
- package/dist/spikes/index.d.ts +10 -0
- package/dist/spikes/index.d.ts.map +1 -0
- package/dist/spikes/index.js +29 -0
- package/dist/spikes/k1-ensemble-spread.d.ts +88 -0
- package/dist/spikes/k1-ensemble-spread.d.ts.map +1 -0
- package/dist/spikes/k1-ensemble-spread.js +396 -0
- package/dist/spikes/k2-policy-author.d.ts +25 -0
- package/dist/spikes/k2-policy-author.d.ts.map +1 -0
- package/dist/spikes/k2-policy-author.js +503 -0
- package/dist/spikes/live-refresh.d.ts +150 -0
- package/dist/spikes/live-refresh.d.ts.map +1 -0
- package/dist/spikes/live-refresh.js +511 -0
- package/dist/world/index.d.ts +2 -0
- package/dist/world/index.d.ts.map +1 -0
- package/dist/world/index.js +17 -0
- package/dist/world/synthetic-world.d.ts +104 -0
- package/dist/world/synthetic-world.d.ts.map +1 -0
- package/dist/world/synthetic-world.js +449 -0
- package/package.json +139 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runScenarioV0 = runScenarioV0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
const time_1 = require("./time");
|
|
6
|
+
const CONTENT_HASH_PATTERN = /^sha256:[a-f0-9]{64}$/;
|
|
7
|
+
function runScenarioV0(input) {
|
|
8
|
+
const initialInstant = (0, time_1.canonicalScenarioInstant)(input.scenario.initial_instant, "scenario.initial_instant");
|
|
9
|
+
const initialEpochMs = (0, time_1.parseScenarioInstantMs)(initialInstant, "scenario.initial_instant");
|
|
10
|
+
initializeClock(input.clock, initialInstant);
|
|
11
|
+
const state = {
|
|
12
|
+
initialEpochMs,
|
|
13
|
+
currentEpochMs: initialEpochMs,
|
|
14
|
+
observations: [],
|
|
15
|
+
trace: [],
|
|
16
|
+
};
|
|
17
|
+
for (const [index, step] of input.scenario.script.entries()) {
|
|
18
|
+
applyStepTime(input.clock, state, step);
|
|
19
|
+
state.trace.push(runStep(input, state, step, index));
|
|
20
|
+
}
|
|
21
|
+
const finalInstant = input.clock.now();
|
|
22
|
+
return {
|
|
23
|
+
scenario_id: input.scenario.id,
|
|
24
|
+
schema: types_1.REACTOR_SCENARIO_SCHEMA_V0,
|
|
25
|
+
v: types_1.REACTOR_SCENARIO_VERSION_V0,
|
|
26
|
+
world_profile: input.scenario.world.profile,
|
|
27
|
+
cassette_path: input.scenario.cassette.path,
|
|
28
|
+
initial_instant: initialInstant,
|
|
29
|
+
final_instant: finalInstant,
|
|
30
|
+
trace: Object.freeze([...state.trace]),
|
|
31
|
+
receipt_log: readReceiptLog(input),
|
|
32
|
+
expected_relationships: input.scenario.expect.relationships,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function runStep(input, state, step, index) {
|
|
36
|
+
const asOf = input.clock.now();
|
|
37
|
+
const worldAdvance = input.world.advanceTo?.({
|
|
38
|
+
scenario_id: input.scenario.id,
|
|
39
|
+
profile: input.scenario.world.profile,
|
|
40
|
+
as_of: asOf,
|
|
41
|
+
});
|
|
42
|
+
const worldReads = [];
|
|
43
|
+
switch (step.kind) {
|
|
44
|
+
case "tick": {
|
|
45
|
+
const reactorIngests = runForecastRecheckTurns(input, state, step, asOf);
|
|
46
|
+
return {
|
|
47
|
+
index,
|
|
48
|
+
step,
|
|
49
|
+
as_of: asOf,
|
|
50
|
+
...(worldAdvance === undefined ? {} : { world_advance: worldAdvance }),
|
|
51
|
+
...reactorTraceFields(reactorIngests),
|
|
52
|
+
world_reads: worldReads,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
case "ingest": {
|
|
56
|
+
const worldEvent = input.world.applyEvent?.({
|
|
57
|
+
scenario_id: input.scenario.id,
|
|
58
|
+
profile: input.scenario.world.profile,
|
|
59
|
+
event: step.event,
|
|
60
|
+
...(step.source_id === undefined ? {} : { source_id: step.source_id }),
|
|
61
|
+
as_of: asOf,
|
|
62
|
+
fields: step.fields,
|
|
63
|
+
});
|
|
64
|
+
if (step.source_id !== undefined) {
|
|
65
|
+
worldReads.push(readWorld(input.world, step.source_id, asOf));
|
|
66
|
+
state.observations.push(...worldReads);
|
|
67
|
+
}
|
|
68
|
+
const reactorIngest = input.reactor?.ingest(createRealInputTurn(input, step, asOf, worldReads));
|
|
69
|
+
if (reactorIngest !== undefined) {
|
|
70
|
+
state.lastReactorIngest = reactorIngest;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
index,
|
|
74
|
+
step,
|
|
75
|
+
as_of: asOf,
|
|
76
|
+
...(worldAdvance === undefined ? {} : { world_advance: worldAdvance }),
|
|
77
|
+
...(worldEvent === undefined ? {} : { world_event: worldEvent }),
|
|
78
|
+
...(reactorIngest === undefined
|
|
79
|
+
? {}
|
|
80
|
+
: {
|
|
81
|
+
reactor_ingest: reactorIngest,
|
|
82
|
+
reactor_ingests: Object.freeze([reactorIngest]),
|
|
83
|
+
}),
|
|
84
|
+
world_reads: Object.freeze([...worldReads]),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
case "read":
|
|
88
|
+
worldReads.push(readWorld(input.world, step.source_id, asOf));
|
|
89
|
+
state.observations.push(...worldReads);
|
|
90
|
+
return {
|
|
91
|
+
index,
|
|
92
|
+
step,
|
|
93
|
+
as_of: asOf,
|
|
94
|
+
...(worldAdvance === undefined ? {} : { world_advance: worldAdvance }),
|
|
95
|
+
world_reads: Object.freeze([...worldReads]),
|
|
96
|
+
};
|
|
97
|
+
case "model": {
|
|
98
|
+
const modelRequest = createModelRequest(input.scenario, step, asOf, state);
|
|
99
|
+
const modelResponse = input.modelGateway.invoke(modelRequest);
|
|
100
|
+
return {
|
|
101
|
+
index,
|
|
102
|
+
step,
|
|
103
|
+
as_of: asOf,
|
|
104
|
+
...(worldAdvance === undefined ? {} : { world_advance: worldAdvance }),
|
|
105
|
+
world_reads: worldReads,
|
|
106
|
+
model_request: modelRequest,
|
|
107
|
+
model_response: modelResponse,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function createRealInputTurn(input, step, asOf, worldReads) {
|
|
113
|
+
const evidence = worldReads.map((observation) => evidenceFromObservation(observation));
|
|
114
|
+
return {
|
|
115
|
+
kind: "real-input",
|
|
116
|
+
scenario_id: input.scenario.id,
|
|
117
|
+
event: step.event,
|
|
118
|
+
as_of: asOf,
|
|
119
|
+
fields: step.fields,
|
|
120
|
+
...(step.source_id === undefined ? {} : { source_id: step.source_id }),
|
|
121
|
+
...(evidence.length === 0 ? {} : { evidence: Object.freeze(evidence) }),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function runForecastRecheckTurns(input, state, step, asOf) {
|
|
125
|
+
if (input.reactor === undefined) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
const recheckKinds = forecastRecheckKindsForTick(state, step, asOf);
|
|
129
|
+
if (recheckKinds.length === 0) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
const results = recheckKinds.map((recheckKind) => input.reactor?.ingest(createForecastRecheckTurn(input, state, asOf, recheckKind)));
|
|
133
|
+
const presentResults = results.filter((result) => result !== undefined);
|
|
134
|
+
const last = presentResults.at(-1);
|
|
135
|
+
if (last !== undefined) {
|
|
136
|
+
state.lastReactorIngest = last;
|
|
137
|
+
}
|
|
138
|
+
return Object.freeze(presentResults);
|
|
139
|
+
}
|
|
140
|
+
function createForecastRecheckTurn(input, state, asOf, recheckKind) {
|
|
141
|
+
const evidence = latestEvidenceFromObservations(input, state.observations);
|
|
142
|
+
return {
|
|
143
|
+
kind: "forecast-recheck",
|
|
144
|
+
recheck_kind: recheckKind,
|
|
145
|
+
scenario_id: input.scenario.id,
|
|
146
|
+
as_of: asOf,
|
|
147
|
+
...(evidence.length === 0 ? {} : { evidence }),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function forecastRecheckKindsForTick(state, step, asOf) {
|
|
151
|
+
const explicit = explicitTickRecheckKind(step);
|
|
152
|
+
if (explicit !== undefined) {
|
|
153
|
+
return [explicit];
|
|
154
|
+
}
|
|
155
|
+
const prior = state.lastReactorIngest;
|
|
156
|
+
if (prior === undefined ||
|
|
157
|
+
prior.next_due_at === undefined ||
|
|
158
|
+
prior.due_rechecks === undefined ||
|
|
159
|
+
prior.due_rechecks.length === 0 ||
|
|
160
|
+
!isAtOrAfter(asOf, prior.next_due_at)) {
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
return uniqueRecheckKinds(prior.due_rechecks);
|
|
164
|
+
}
|
|
165
|
+
function explicitTickRecheckKind(step) {
|
|
166
|
+
if (step.recheck_kind !== undefined) {
|
|
167
|
+
return step.recheck_kind;
|
|
168
|
+
}
|
|
169
|
+
return (readRecheckKindField(step.fields, "recheck_kind") ??
|
|
170
|
+
readRecheckKindField(step.fields, "forecast_recheck"));
|
|
171
|
+
}
|
|
172
|
+
function readRecheckKindField(fields, fieldName) {
|
|
173
|
+
const value = fields[fieldName];
|
|
174
|
+
if (value === undefined) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
if (value === "evidence-age" || value === "plan-age") {
|
|
178
|
+
return value;
|
|
179
|
+
}
|
|
180
|
+
throw new Error(`${fieldName} must be evidence-age or plan-age`);
|
|
181
|
+
}
|
|
182
|
+
function uniqueRecheckKinds(values) {
|
|
183
|
+
const result = [];
|
|
184
|
+
for (const value of values) {
|
|
185
|
+
if (!result.includes(value)) {
|
|
186
|
+
result.push(value);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return Object.freeze(result);
|
|
190
|
+
}
|
|
191
|
+
function isAtOrAfter(asOf, dueAt) {
|
|
192
|
+
const asOfMs = Date.parse(asOf);
|
|
193
|
+
const dueAtMs = Date.parse(dueAt);
|
|
194
|
+
if (!Number.isFinite(asOfMs) || !Number.isFinite(dueAtMs)) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
return asOfMs >= dueAtMs;
|
|
198
|
+
}
|
|
199
|
+
function reactorTraceFields(results) {
|
|
200
|
+
const last = results.at(-1);
|
|
201
|
+
if (last === undefined) {
|
|
202
|
+
return {};
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
reactor_ingest: last,
|
|
206
|
+
reactor_ingests: Object.freeze([...results]),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function latestEvidenceFromObservations(input, observations) {
|
|
210
|
+
const latestBySource = new Map();
|
|
211
|
+
for (const observation of observations) {
|
|
212
|
+
latestBySource.set(observation.source_id, observation);
|
|
213
|
+
}
|
|
214
|
+
const ordered = [];
|
|
215
|
+
for (const source of input.scenario.sources) {
|
|
216
|
+
const observation = latestBySource.get(source.id);
|
|
217
|
+
if (observation !== undefined) {
|
|
218
|
+
ordered.push(observation);
|
|
219
|
+
latestBySource.delete(source.id);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
ordered.push(...Array.from(latestBySource.values()).sort((left, right) => left.source_id.localeCompare(right.source_id)));
|
|
223
|
+
return Object.freeze(ordered.map((observation) => evidenceFromObservation(observation)));
|
|
224
|
+
}
|
|
225
|
+
function evidenceFromObservation(observation) {
|
|
226
|
+
const contentHash = readContentHashFromPayload(observation.payload);
|
|
227
|
+
if (contentHash !== undefined) {
|
|
228
|
+
return {
|
|
229
|
+
source_id: observation.source_id,
|
|
230
|
+
content_hash: contentHash,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
source_id: observation.source_id,
|
|
235
|
+
payload: observation.payload,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function readContentHashFromPayload(payload) {
|
|
239
|
+
if (!isRecord(payload)) {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
const payloadHash = payload["payload_hash"] ?? payload["content_hash"];
|
|
243
|
+
return isContentHash(payloadHash) ? payloadHash : undefined;
|
|
244
|
+
}
|
|
245
|
+
function createModelRequest(scenario, step, asOf, state) {
|
|
246
|
+
return {
|
|
247
|
+
kind: step.request_kind,
|
|
248
|
+
payload: {
|
|
249
|
+
scenario_id: scenario.id,
|
|
250
|
+
world_profile: scenario.world.profile,
|
|
251
|
+
as_of: asOf,
|
|
252
|
+
prompt: step.prompt,
|
|
253
|
+
source_ids: scenario.sources.map((source) => source.id),
|
|
254
|
+
observations: state.observations.map((observation) => ({
|
|
255
|
+
source_id: observation.source_id,
|
|
256
|
+
as_of: observation.as_of,
|
|
257
|
+
payload: observation.payload,
|
|
258
|
+
surprise_count: observation.surprise?.count ?? null,
|
|
259
|
+
surprise_causes: observation.surprise?.causes ?? [],
|
|
260
|
+
})),
|
|
261
|
+
fields: step.fields,
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function readWorld(world, sourceId, asOf) {
|
|
266
|
+
const response = normalizeWorldReadResponse(world.read({
|
|
267
|
+
source_id: sourceId,
|
|
268
|
+
as_of: asOf,
|
|
269
|
+
}));
|
|
270
|
+
return {
|
|
271
|
+
source_id: sourceId,
|
|
272
|
+
as_of: asOf,
|
|
273
|
+
payload: response.payload,
|
|
274
|
+
...(response.surprise === undefined ? {} : { surprise: response.surprise }),
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function normalizeWorldReadResponse(response) {
|
|
278
|
+
if (!isRecord(response)) {
|
|
279
|
+
throw new Error("world.read must return an object");
|
|
280
|
+
}
|
|
281
|
+
if (!Object.hasOwn(response, "payload")) {
|
|
282
|
+
throw new Error("world.read must return a payload field");
|
|
283
|
+
}
|
|
284
|
+
return response;
|
|
285
|
+
}
|
|
286
|
+
function applyStepTime(clock, state, step) {
|
|
287
|
+
if ("at" in step.time) {
|
|
288
|
+
const offsetMs = (0, time_1.parseScenarioDurationMs)(step.time.at, "script at");
|
|
289
|
+
const nextEpochMs = state.initialEpochMs + offsetMs;
|
|
290
|
+
if (nextEpochMs < state.currentEpochMs) {
|
|
291
|
+
throw new Error(`scenario step cannot move time backward to ${step.time.at}`);
|
|
292
|
+
}
|
|
293
|
+
moveClockTo(clock, nextEpochMs);
|
|
294
|
+
state.currentEpochMs = nextEpochMs;
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const elapsedMs = (0, time_1.parseScenarioDurationMs)(step.time.after, "script after");
|
|
298
|
+
advanceClock(clock, elapsedMs);
|
|
299
|
+
state.currentEpochMs += elapsedMs;
|
|
300
|
+
}
|
|
301
|
+
function initializeClock(clock, initialInstant) {
|
|
302
|
+
if (clock.set !== undefined) {
|
|
303
|
+
clock.set(initialInstant);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const now = (0, time_1.canonicalScenarioInstant)(clock.now(), "clock.now");
|
|
307
|
+
if (now !== initialInstant) {
|
|
308
|
+
throw new Error(`scenario clock must start at ${initialInstant}; received ${now}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function moveClockTo(clock, epochMs) {
|
|
312
|
+
const target = new Date(epochMs).toISOString();
|
|
313
|
+
if (clock.set !== undefined) {
|
|
314
|
+
clock.set(target);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const currentEpochMs = (0, time_1.parseScenarioInstantMs)(clock.now(), "clock.now");
|
|
318
|
+
const catchUpMs = epochMs - currentEpochMs;
|
|
319
|
+
if (catchUpMs < 0) {
|
|
320
|
+
throw new Error("scenario clock cannot move backward without set()");
|
|
321
|
+
}
|
|
322
|
+
advanceClock(clock, catchUpMs);
|
|
323
|
+
}
|
|
324
|
+
function advanceClock(clock, elapsedMs) {
|
|
325
|
+
if (clock.advanceMs === undefined) {
|
|
326
|
+
if (elapsedMs === 0) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
throw new Error("scenario clock requires advanceMs() for relative time");
|
|
330
|
+
}
|
|
331
|
+
clock.advanceMs(elapsedMs);
|
|
332
|
+
}
|
|
333
|
+
function readReceiptLog(input) {
|
|
334
|
+
const entries = input.reactor?.receipts() ?? input.storage?.listReceipts() ?? [];
|
|
335
|
+
return {
|
|
336
|
+
entries: Object.freeze([...entries]),
|
|
337
|
+
content_hashes: Object.freeze(entries.map((receipt) => receipt.content_hash)),
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function isRecord(value) {
|
|
341
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
342
|
+
}
|
|
343
|
+
function isContentHash(value) {
|
|
344
|
+
return typeof value === "string" && CONTENT_HASH_PATTERN.test(value);
|
|
345
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SyntheticWorldConnectorV0 } from "../world";
|
|
2
|
+
import type { ScenarioWorldAdapterV0 } from "./types";
|
|
3
|
+
export declare function adaptSyntheticWorldForScenarioV0(world: SyntheticWorldConnectorV0): ScenarioWorldAdapterV0;
|
|
4
|
+
//# sourceMappingURL=synthetic-world-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthetic-world-adapter.d.ts","sourceRoot":"","sources":["../../src/scenario/synthetic-world-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,yBAAyB,EAI1B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAEV,sBAAsB,EAOvB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,yBAAyB,GAC/B,sBAAsB,CA6CxB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adaptSyntheticWorldForScenarioV0 = adaptSyntheticWorldForScenarioV0;
|
|
4
|
+
function adaptSyntheticWorldForScenarioV0(world) {
|
|
5
|
+
return {
|
|
6
|
+
read(request) {
|
|
7
|
+
const response = world.read(request);
|
|
8
|
+
const surprise = readSurpriseFromPayload(response.payload);
|
|
9
|
+
return {
|
|
10
|
+
payload: response.payload,
|
|
11
|
+
...(surprise === undefined ? {} : { surprise }),
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
applyEvent(event) {
|
|
15
|
+
if (event.source_id === undefined) {
|
|
16
|
+
return {
|
|
17
|
+
payload: { event: event.event },
|
|
18
|
+
surprise: zeroScenarioSurprise(event.profile),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const payload = payloadFromScenarioFields(event.fields);
|
|
22
|
+
const record = advanceWorld(world, {
|
|
23
|
+
kind: "source-event",
|
|
24
|
+
as_of: event.as_of,
|
|
25
|
+
source_id: event.source_id,
|
|
26
|
+
event_id: event.event,
|
|
27
|
+
...(payload === undefined ? {} : { payload }),
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
payload: record,
|
|
31
|
+
surprise: convertSyntheticSurprise(record.surprise),
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
advanceTo(input) {
|
|
35
|
+
const record = advanceWorld(world, {
|
|
36
|
+
kind: "time",
|
|
37
|
+
as_of: input.as_of,
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
payload: record,
|
|
41
|
+
surprise: convertSyntheticSurprise(record.surprise),
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function advanceWorld(world, input) {
|
|
47
|
+
return world.advance(input);
|
|
48
|
+
}
|
|
49
|
+
function payloadFromScenarioFields(fields) {
|
|
50
|
+
const entries = Object.entries(fields);
|
|
51
|
+
if (entries.length === 0) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const payload = {};
|
|
55
|
+
for (const [key, value] of entries) {
|
|
56
|
+
payload[key] = value;
|
|
57
|
+
}
|
|
58
|
+
return payload;
|
|
59
|
+
}
|
|
60
|
+
function readSurpriseFromPayload(payload) {
|
|
61
|
+
if (!isRecord(payload) || !isRecord(payload["surprise"])) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
return convertSyntheticSurprise(payload["surprise"]);
|
|
65
|
+
}
|
|
66
|
+
function convertSyntheticSurprise(report) {
|
|
67
|
+
return {
|
|
68
|
+
profile: report.profile,
|
|
69
|
+
count: report.surprise_count,
|
|
70
|
+
causes: report.surprise_events.map((event) => event.kind),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function zeroScenarioSurprise(profile) {
|
|
74
|
+
return {
|
|
75
|
+
profile,
|
|
76
|
+
count: 0,
|
|
77
|
+
causes: [],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function isRecord(value) {
|
|
81
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
82
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function canonicalScenarioInstant(instant: string, label: string): string;
|
|
2
|
+
export declare function parseScenarioInstantMs(instant: string, label: string): number;
|
|
3
|
+
export declare function parseScenarioDurationMs(duration: string, label: string): number;
|
|
4
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/scenario/time.ts"],"names":[],"mappings":"AAYA,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,MAAM,CAgBR;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAgBR"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canonicalScenarioInstant = canonicalScenarioInstant;
|
|
4
|
+
exports.parseScenarioInstantMs = parseScenarioInstantMs;
|
|
5
|
+
exports.parseScenarioDurationMs = parseScenarioDurationMs;
|
|
6
|
+
const ISO_INSTANT_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/;
|
|
7
|
+
const DURATION_PATTERN = /^(\d+)(ms|s|m|h|d)$/;
|
|
8
|
+
const DURATION_UNIT_MS = {
|
|
9
|
+
ms: 1,
|
|
10
|
+
s: 1_000,
|
|
11
|
+
m: 60_000,
|
|
12
|
+
h: 3_600_000,
|
|
13
|
+
d: 86_400_000,
|
|
14
|
+
};
|
|
15
|
+
function canonicalScenarioInstant(instant, label) {
|
|
16
|
+
return new Date(parseScenarioInstantMs(instant, label)).toISOString();
|
|
17
|
+
}
|
|
18
|
+
function parseScenarioInstantMs(instant, label) {
|
|
19
|
+
if (!ISO_INSTANT_PATTERN.test(instant)) {
|
|
20
|
+
throw new RangeError(`${label} must be an ISO-8601 UTC instant`);
|
|
21
|
+
}
|
|
22
|
+
const epochMs = Date.parse(instant);
|
|
23
|
+
if (!Number.isFinite(epochMs)) {
|
|
24
|
+
throw new RangeError(`${label} must be a valid ISO-8601 UTC instant`);
|
|
25
|
+
}
|
|
26
|
+
const canonical = new Date(epochMs).toISOString();
|
|
27
|
+
if (instant !== canonical && instant !== canonical.replace(".000Z", "Z")) {
|
|
28
|
+
throw new RangeError(`${label} must be a valid ISO-8601 UTC instant`);
|
|
29
|
+
}
|
|
30
|
+
return epochMs;
|
|
31
|
+
}
|
|
32
|
+
function parseScenarioDurationMs(duration, label) {
|
|
33
|
+
const match = DURATION_PATTERN.exec(duration);
|
|
34
|
+
if (match === null) {
|
|
35
|
+
throw new RangeError(`${label} must be a duration like 0m, 15m, 6h, or 1d`);
|
|
36
|
+
}
|
|
37
|
+
const amountText = match[1];
|
|
38
|
+
const unit = match[2];
|
|
39
|
+
const amount = Number(amountText);
|
|
40
|
+
const ms = amount * DURATION_UNIT_MS[unit];
|
|
41
|
+
if (!Number.isSafeInteger(ms)) {
|
|
42
|
+
throw new RangeError(`${label} duration is outside safe integer range`);
|
|
43
|
+
}
|
|
44
|
+
return ms;
|
|
45
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { ReceiptRecheckKindV0, ReceiptV0 } from "@openprose/reactor/receipt";
|
|
2
|
+
import type { ReactorConnectorRequestV0, ReactorConnectorResponseV0, ReactorIngestResultV0, ReactorModelGatewayRequestV0, ReactorModelGatewayResponseV0 } from "@openprose/reactor/sdk";
|
|
3
|
+
export declare const REACTOR_SCENARIO_SCHEMA_V0: "openprose.reactor-cradle.scenario";
|
|
4
|
+
export declare const REACTOR_SCENARIO_VERSION_V0: 0;
|
|
5
|
+
export type ScenarioFieldValueV0 = string | number | boolean;
|
|
6
|
+
export type ScenarioFieldsV0 = Readonly<Record<string, ScenarioFieldValueV0>>;
|
|
7
|
+
export type ScenarioWorldProfileV0 = "static" | "periodic-surprise" | "adversarial-silent";
|
|
8
|
+
export interface ReactorScenarioV0 {
|
|
9
|
+
readonly schema: typeof REACTOR_SCENARIO_SCHEMA_V0;
|
|
10
|
+
readonly v: typeof REACTOR_SCENARIO_VERSION_V0;
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly world: ScenarioWorldConfigV0;
|
|
13
|
+
readonly initial_instant: string;
|
|
14
|
+
readonly cassette: ScenarioCassetteReferenceV0;
|
|
15
|
+
readonly sources: readonly ScenarioSourceV0[];
|
|
16
|
+
readonly script: readonly ScenarioScriptStepV0[];
|
|
17
|
+
readonly expect: ScenarioExpectationsV0;
|
|
18
|
+
}
|
|
19
|
+
export interface ScenarioWorldConfigV0 {
|
|
20
|
+
readonly profile: ScenarioWorldProfileV0;
|
|
21
|
+
readonly every_events?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ScenarioCassetteReferenceV0 {
|
|
24
|
+
readonly path: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ScenarioSourceV0 {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly kind?: string;
|
|
29
|
+
readonly fixture_ref?: string;
|
|
30
|
+
readonly fields: ScenarioFieldsV0;
|
|
31
|
+
}
|
|
32
|
+
export type ScenarioStepTimeV0 = {
|
|
33
|
+
readonly at: string;
|
|
34
|
+
} | {
|
|
35
|
+
readonly after: string;
|
|
36
|
+
};
|
|
37
|
+
interface ScenarioScriptStepBaseV0 {
|
|
38
|
+
readonly time: ScenarioStepTimeV0;
|
|
39
|
+
readonly label?: string;
|
|
40
|
+
readonly fields: ScenarioFieldsV0;
|
|
41
|
+
}
|
|
42
|
+
export interface ScenarioIngestStepV0 extends ScenarioScriptStepBaseV0 {
|
|
43
|
+
readonly kind: "ingest";
|
|
44
|
+
readonly event: string;
|
|
45
|
+
readonly source_id?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ScenarioTickStepV0 extends ScenarioScriptStepBaseV0 {
|
|
48
|
+
readonly kind: "tick";
|
|
49
|
+
readonly recheck_kind?: ReceiptRecheckKindV0;
|
|
50
|
+
}
|
|
51
|
+
export interface ScenarioReadStepV0 extends ScenarioScriptStepBaseV0 {
|
|
52
|
+
readonly kind: "read";
|
|
53
|
+
readonly source_id: string;
|
|
54
|
+
}
|
|
55
|
+
export interface ScenarioModelStepV0 extends ScenarioScriptStepBaseV0 {
|
|
56
|
+
readonly kind: "model";
|
|
57
|
+
readonly request_kind: ReactorModelGatewayRequestV0["kind"];
|
|
58
|
+
readonly prompt: string;
|
|
59
|
+
}
|
|
60
|
+
export type ScenarioScriptStepV0 = ScenarioIngestStepV0 | ScenarioTickStepV0 | ScenarioReadStepV0 | ScenarioModelStepV0;
|
|
61
|
+
export interface ScenarioExpectationsV0 {
|
|
62
|
+
readonly relationships: readonly ScenarioExpectedRelationshipV0[];
|
|
63
|
+
}
|
|
64
|
+
export interface ScenarioExpectedRelationshipV0 {
|
|
65
|
+
readonly relationship: string;
|
|
66
|
+
readonly fields: ScenarioFieldsV0;
|
|
67
|
+
}
|
|
68
|
+
export interface ScenarioClockAdapterV0 {
|
|
69
|
+
readonly now: () => string;
|
|
70
|
+
readonly advanceMs?: (ms: number) => void;
|
|
71
|
+
readonly set?: (instant: string) => void;
|
|
72
|
+
}
|
|
73
|
+
export interface ScenarioWorldSurpriseV0 {
|
|
74
|
+
readonly profile: ScenarioWorldProfileV0;
|
|
75
|
+
readonly count: number;
|
|
76
|
+
readonly causes: readonly string[];
|
|
77
|
+
}
|
|
78
|
+
export interface ScenarioWorldReadResponseV0 extends ReactorConnectorResponseV0 {
|
|
79
|
+
readonly surprise?: ScenarioWorldSurpriseV0;
|
|
80
|
+
}
|
|
81
|
+
export interface ScenarioWorldEventInputV0 {
|
|
82
|
+
readonly scenario_id: string;
|
|
83
|
+
readonly profile: ScenarioWorldProfileV0;
|
|
84
|
+
readonly event: string;
|
|
85
|
+
readonly source_id?: string;
|
|
86
|
+
readonly as_of: string;
|
|
87
|
+
readonly fields: ScenarioFieldsV0;
|
|
88
|
+
}
|
|
89
|
+
export interface ScenarioWorldEventResultV0 {
|
|
90
|
+
readonly surprise?: ScenarioWorldSurpriseV0;
|
|
91
|
+
readonly payload?: unknown;
|
|
92
|
+
}
|
|
93
|
+
export interface ScenarioWorldAdvanceInputV0 {
|
|
94
|
+
readonly scenario_id: string;
|
|
95
|
+
readonly profile: ScenarioWorldProfileV0;
|
|
96
|
+
readonly as_of: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ScenarioWorldAdvanceResultV0 {
|
|
99
|
+
readonly surprise?: ScenarioWorldSurpriseV0;
|
|
100
|
+
readonly payload?: unknown;
|
|
101
|
+
}
|
|
102
|
+
export interface ScenarioWorldAdapterV0 {
|
|
103
|
+
readonly read: (request: ReactorConnectorRequestV0) => ScenarioWorldReadResponseV0;
|
|
104
|
+
readonly applyEvent?: (event: ScenarioWorldEventInputV0) => ScenarioWorldEventResultV0;
|
|
105
|
+
readonly advanceTo?: (input: ScenarioWorldAdvanceInputV0) => ScenarioWorldAdvanceResultV0;
|
|
106
|
+
}
|
|
107
|
+
export interface ScenarioRunnerStorageV0 {
|
|
108
|
+
readonly listReceipts: () => readonly ReceiptV0[];
|
|
109
|
+
}
|
|
110
|
+
export interface ScenarioRunnerReactorV0 {
|
|
111
|
+
readonly ingest: (event: unknown) => ReactorIngestResultV0;
|
|
112
|
+
readonly receipts: () => readonly ReceiptV0[];
|
|
113
|
+
}
|
|
114
|
+
export interface ScenarioRunTraceEntryV0 {
|
|
115
|
+
readonly index: number;
|
|
116
|
+
readonly step: ScenarioScriptStepV0;
|
|
117
|
+
readonly as_of: string;
|
|
118
|
+
readonly world_advance?: ScenarioWorldAdvanceResultV0;
|
|
119
|
+
readonly world_event?: ScenarioWorldEventResultV0;
|
|
120
|
+
readonly world_reads: readonly ScenarioWorldObservationV0[];
|
|
121
|
+
readonly model_request?: ReactorModelGatewayRequestV0;
|
|
122
|
+
readonly model_response?: ReactorModelGatewayResponseV0;
|
|
123
|
+
readonly reactor_ingest?: ReactorIngestResultV0;
|
|
124
|
+
readonly reactor_ingests?: readonly ReactorIngestResultV0[];
|
|
125
|
+
}
|
|
126
|
+
export interface ScenarioWorldObservationV0 {
|
|
127
|
+
readonly source_id: string;
|
|
128
|
+
readonly as_of: string;
|
|
129
|
+
readonly payload: unknown;
|
|
130
|
+
readonly surprise?: ScenarioWorldSurpriseV0;
|
|
131
|
+
}
|
|
132
|
+
export interface ScenarioReceiptLogV0 {
|
|
133
|
+
readonly entries: readonly ReceiptV0[];
|
|
134
|
+
readonly content_hashes: readonly string[];
|
|
135
|
+
}
|
|
136
|
+
export interface ScenarioRunReceiptV0 {
|
|
137
|
+
readonly scenario_id: string;
|
|
138
|
+
readonly schema: typeof REACTOR_SCENARIO_SCHEMA_V0;
|
|
139
|
+
readonly v: typeof REACTOR_SCENARIO_VERSION_V0;
|
|
140
|
+
readonly world_profile: ScenarioWorldProfileV0;
|
|
141
|
+
readonly cassette_path: string;
|
|
142
|
+
readonly initial_instant: string;
|
|
143
|
+
readonly final_instant: string;
|
|
144
|
+
readonly trace: readonly ScenarioRunTraceEntryV0[];
|
|
145
|
+
readonly receipt_log: ScenarioReceiptLogV0;
|
|
146
|
+
readonly expected_relationships: readonly ScenarioExpectedRelationshipV0[];
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
149
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scenario/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACV,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,0BAA0B,EACrC,mCAA4C,CAAC;AAC/C,eAAO,MAAM,2BAA2B,EAAG,CAAU,CAAC;AAEtD,MAAM,MAAM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C,QAAQ,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,0BAA0B,CAAC;IACnD,QAAQ,CAAC,CAAC,EAAE,OAAO,2BAA2B,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACnD,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAC3C,QAAQ,CAAC,sBAAsB,EAAE,SAAS,8BAA8B,EAAE,CAAC;CAC5E"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REACTOR_SCENARIO_VERSION_V0 = exports.REACTOR_SCENARIO_SCHEMA_V0 = void 0;
|
|
4
|
+
exports.REACTOR_SCENARIO_SCHEMA_V0 = "openprose.reactor-cradle.scenario";
|
|
5
|
+
exports.REACTOR_SCENARIO_VERSION_V0 = 0;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./k1-ensemble-spread";
|
|
2
|
+
export * from "./k2-policy-author";
|
|
3
|
+
export * from "./live-refresh";
|
|
4
|
+
export declare const REACTOR_CRADLE_SPIKE_PUBLIC_EXPORTS_V0: Readonly<{
|
|
5
|
+
readonly live_refresh: "./spikes/live-refresh";
|
|
6
|
+
readonly k1_ensemble_spread: "./spikes/k1-ensemble-spread";
|
|
7
|
+
readonly k2_policy_author: "./spikes/k2-policy-author";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const REACTOR_CRADLE_SPIKE_INTEGRATION_NOTES_V0: readonly ["K1/K2 spike evaluators are recorded-only by default; normal tests must not invoke live model refresh.", "Live OpenRouter refresh is an explicit opt-in guard path with cap/accounting input and secret redaction."];
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spikes/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAE/B,eAAO,MAAM,sCAAsC;;;;EAIxC,CAAC;AAEZ,eAAO,MAAM,yCAAyC,gOAG3C,CAAC"}
|