@tangle-network/agent-runtime 0.337.1 → 0.337.2
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/dist/{activation-BgWVlVu2.js → activation-BDP6Eivv.js} +2 -2
- package/dist/{activation-BgWVlVu2.js.map → activation-BDP6Eivv.js.map} +1 -1
- package/dist/{activation-DMehb166.d.ts → activation-DRHM55Oo.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-Dg9a6qsm.js → coordination-driver-BHkFVqIq.js} +2 -2
- package/dist/{coordination-driver-Dg9a6qsm.js.map → coordination-driver-BHkFVqIq.js.map} +1 -1
- package/dist/{delegate-aC14Cww3.js → delegate-B-T_ZB50.js} +2 -2
- package/dist/{delegate-aC14Cww3.js.map → delegate-B-T_ZB50.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +3 -3
- package/dist/{graph-Cfx711ES.js → graph-C4RFlWAJ.js} +4 -4
- package/dist/{graph-Cfx711ES.js.map → graph-C4RFlWAJ.js.map} +1 -1
- package/dist/{improvement-cycle-DHKcb_YW.js → improvement-cycle-D1I4hQvf.js} +3 -3
- package/dist/{improvement-cycle-DHKcb_YW.js.map → improvement-cycle-D1I4hQvf.js.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +8 -8
- package/dist/{loop-runner-bin-B86AiPBf.d.ts → loop-runner-bin-DOuBIJ2O.d.ts} +2 -2
- package/dist/{loop-runner-bin-BSKBNC38.js → loop-runner-bin-Dv5QvYDH.js} +3 -3
- package/dist/{loop-runner-bin-BSKBNC38.js.map → loop-runner-bin-Dv5QvYDH.js.map} +1 -1
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-DHO2QS1q.d.ts → openai-tools-Oxk4KQrY.d.ts} +2 -2
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-72YFf-i_.js → provision-supervisor-DGegCUH4.js} +3 -3
- package/dist/{provision-supervisor-72YFf-i_.js.map → provision-supervisor-DGegCUH4.js.map} +1 -1
- package/dist/{runtime-qFLOq1R9.js → runtime-BOGpotnH.js} +9 -71
- package/dist/runtime-BOGpotnH.js.map +1 -0
- package/dist/{search-executor-CGxvizHh.js → search-executor-Cm1WZmL-.js} +3 -2
- package/dist/search-executor-Cm1WZmL-.js.map +1 -0
- package/dist/{server-_FldJ9Cl.js → server-hZWM-G8w.js} +3 -3
- package/dist/{server-_FldJ9Cl.js.map → server-hZWM-G8w.js.map} +1 -1
- package/dist/{supervise-H4BTN6uA.js → supervise-CvAKVfue.js} +3 -3
- package/dist/{supervise-H4BTN6uA.js.map → supervise-CvAKVfue.js.map} +1 -1
- package/dist/{supervisor-C27ne4yv.js → supervisor-Rz8AGpYb.js} +151 -65
- package/dist/supervisor-Rz8AGpYb.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-CupCBY-j.d.ts → types-Dl5L4r8Z.d.ts} +20 -8
- package/package.json +3 -3
- package/dist/runtime-qFLOq1R9.js.map +0 -1
- package/dist/search-executor-CGxvizHh.js.map +0 -1
- package/dist/supervisor-C27ne4yv.js.map +0 -1
|
@@ -3385,6 +3385,68 @@ function sandboxProgressEvents(event, state) {
|
|
|
3385
3385
|
}];
|
|
3386
3386
|
return [];
|
|
3387
3387
|
}
|
|
3388
|
+
/**
|
|
3389
|
+
* Collect one turn's events, keeping only the newest snapshot of each streamed text or
|
|
3390
|
+
* reasoning part.
|
|
3391
|
+
*
|
|
3392
|
+
* opencode sends `message.part.updated` once per token, and every frame carries the part's
|
|
3393
|
+
* whole cumulative text, so keeping every frame holds O(L²) bytes per turn: two concurrent
|
|
3394
|
+
* audit workflows took the platform API from 459 MB to an OOM at 1.95 GB in 11 minutes.
|
|
3395
|
+
* A snapshot (a frame whose part carries `text`) whose text extends the previous snapshot
|
|
3396
|
+
* of the same part replaces it and moves to the newest position, which is the rule the
|
|
3397
|
+
* Sandbox SDK's text collectors already apply, so the collected text is unchanged. The kept
|
|
3398
|
+
* frame drops its `delta`, because its text already holds every earlier increment and a
|
|
3399
|
+
* reader that joins `delta ?? part.text` across frames would otherwise read only the last
|
|
3400
|
+
* one. Delta-only frames and every other event are kept as they arrived.
|
|
3401
|
+
*/
|
|
3402
|
+
function createSandboxTurnEventCollector() {
|
|
3403
|
+
const slots = [];
|
|
3404
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
3405
|
+
return {
|
|
3406
|
+
push(event) {
|
|
3407
|
+
const snapshot = partSnapshot(event);
|
|
3408
|
+
if (!snapshot) {
|
|
3409
|
+
slots.push(event);
|
|
3410
|
+
return;
|
|
3411
|
+
}
|
|
3412
|
+
const previous = snapshots.get(snapshot.key);
|
|
3413
|
+
const extends_ = previous !== void 0 && snapshot.text.startsWith(previous.text);
|
|
3414
|
+
if (extends_) slots[previous.at] = void 0;
|
|
3415
|
+
snapshots.set(snapshot.key, {
|
|
3416
|
+
at: slots.length,
|
|
3417
|
+
text: snapshot.text
|
|
3418
|
+
});
|
|
3419
|
+
slots.push(extends_ ? withoutDelta(event) : event);
|
|
3420
|
+
},
|
|
3421
|
+
events() {
|
|
3422
|
+
return slots.filter((event) => event !== void 0);
|
|
3423
|
+
}
|
|
3424
|
+
};
|
|
3425
|
+
}
|
|
3426
|
+
function partSnapshot(event) {
|
|
3427
|
+
if (event?.type !== "message.part.updated") return void 0;
|
|
3428
|
+
const data = asRecord(event.data);
|
|
3429
|
+
const part = asRecord(data?.part) ?? asRecord(asRecord(data?.properties)?.part);
|
|
3430
|
+
if (!part || typeof part.id !== "string") return void 0;
|
|
3431
|
+
if (part.type !== "text" && part.type !== "reasoning" && part.type !== "thinking") return void 0;
|
|
3432
|
+
const text = typeof part.text === "string" ? part.text : typeof part.content === "string" ? part.content : void 0;
|
|
3433
|
+
return text === void 0 ? void 0 : {
|
|
3434
|
+
key: `${part.type}:${part.id}`,
|
|
3435
|
+
text
|
|
3436
|
+
};
|
|
3437
|
+
}
|
|
3438
|
+
function withoutDelta(event) {
|
|
3439
|
+
const data = asRecord(event.data);
|
|
3440
|
+
if (!data || !("delta" in data)) return event;
|
|
3441
|
+
const { delta: _delta, ...rest } = data;
|
|
3442
|
+
return {
|
|
3443
|
+
...event,
|
|
3444
|
+
data: rest
|
|
3445
|
+
};
|
|
3446
|
+
}
|
|
3447
|
+
function asRecord(value) {
|
|
3448
|
+
return value !== null && typeof value === "object" ? value : void 0;
|
|
3449
|
+
}
|
|
3388
3450
|
//#endregion
|
|
3389
3451
|
//#region src/runtime/supervise/trace-root.ts
|
|
3390
3452
|
/**
|
|
@@ -3738,7 +3800,6 @@ function retainedExecutorContext(ctx) {
|
|
|
3738
3800
|
}
|
|
3739
3801
|
const causeMessages = {
|
|
3740
3802
|
unobservable: "retained provider execution requires reconciliation before replacement",
|
|
3741
|
-
"terminal-event-lost": "retained provider stream ended or stalled without a terminal event; exact result requires reconciliation",
|
|
3742
3803
|
"provider-contract": "retained provider response violated its contract; original execution remains unresolved",
|
|
3743
3804
|
"request-rejected": "retained provider execution was refused before it ran; nothing to reconcile",
|
|
3744
3805
|
transport: "retained provider execution lost its transport; status in doubt",
|
|
@@ -3918,10 +3979,6 @@ const retainedFailures = {
|
|
|
3918
3979
|
code: "retained-unobservable",
|
|
3919
3980
|
owner: "provider"
|
|
3920
3981
|
},
|
|
3921
|
-
"terminal-event-lost": {
|
|
3922
|
-
code: "terminal-event-lost",
|
|
3923
|
-
owner: "provider"
|
|
3924
|
-
},
|
|
3925
3982
|
"provider-contract": {
|
|
3926
3983
|
code: "provider-contract",
|
|
3927
3984
|
owner: "provider"
|
|
@@ -13118,9 +13175,15 @@ const NATIVE_STOP_TIMEOUT_MS = 3e4;
|
|
|
13118
13175
|
/** How long the final copy of a stopped harness waits for the provider to record how it ended. */
|
|
13119
13176
|
const NATIVE_SETTLE_WINDOW_MS = 15e3;
|
|
13120
13177
|
const NATIVE_SETTLE_POLL_MS = 1e3;
|
|
13121
|
-
/**
|
|
13122
|
-
|
|
13123
|
-
|
|
13178
|
+
/**
|
|
13179
|
+
* How long a retained stream may go without new evidence before the node publishes that it is
|
|
13180
|
+
* waiting on its exact result. It never ends the turn: silence is a wait, and only the provider's
|
|
13181
|
+
* exact result or an abort with its named cause ends it. Ending here failed 18 attempts as
|
|
13182
|
+
* `terminal-event-lost` over 2026-10-12..20 whose executions were still running. The bound on a
|
|
13183
|
+
* wait that never ends is the Lab keeper's hung-root re-drive, which fires on 15 minutes without a
|
|
13184
|
+
* stream write whether or not it reads this row.
|
|
13185
|
+
*/
|
|
13186
|
+
const RETAINED_AWAITING_RESULT_AFTER_MS = 8 * 6e4;
|
|
13124
13187
|
const RETAINED_OBSERVATION_BATCH_EVENTS = 1024;
|
|
13125
13188
|
/**
|
|
13126
13189
|
* After its exact result, a stream that still owes its terminal frame keeps reading only while its
|
|
@@ -13130,41 +13193,17 @@ const RETAINED_OBSERVATION_BATCH_EVENTS = 1024;
|
|
|
13130
13193
|
* straddles the result is read whole.
|
|
13131
13194
|
*/
|
|
13132
13195
|
const RETAINED_TAIL_FLOW_MS = 100;
|
|
13133
|
-
var RetainedReadTimeoutError = class extends Error {
|
|
13134
|
-
constructor(label, ms) {
|
|
13135
|
-
super(`retained provider ${label} did not settle within ${ms} ms`);
|
|
13136
|
-
this.name = "RetainedReadTimeoutError";
|
|
13137
|
-
}
|
|
13138
|
-
};
|
|
13139
13196
|
/**
|
|
13140
13197
|
* Why the event stream stopped short, as bounded redacted text. A settlement reason is built from
|
|
13141
13198
|
* messages and `cause` links only, never from an AggregateError's members, so a wrapper that
|
|
13142
13199
|
* leaves this out hides which layer lost the stream: a tournament judge on 2026-10-16
|
|
13143
|
-
* (critics-tournament-v1-158ca88e83bf:s1) settled
|
|
13200
|
+
* (critics-tournament-v1-158ca88e83bf:s1) settled as a lost terminal event and its journal could
|
|
13144
13201
|
* not say whether the stream ended, broke, or refused a frame.
|
|
13145
13202
|
*/
|
|
13146
13203
|
function observationFailureText(failure) {
|
|
13147
13204
|
const error = failure.error;
|
|
13148
13205
|
return String(defaultRedactor(error instanceof Error ? error.message : String(error))).slice(0, 2048);
|
|
13149
13206
|
}
|
|
13150
|
-
function retainedWaitBound(value, maximum, name) {
|
|
13151
|
-
if (value === void 0) return maximum;
|
|
13152
|
-
if (!Number.isSafeInteger(value) || value <= 0 || value > maximum) throw new ValidationError(`${name} must be a positive integer at most ${maximum} ms`);
|
|
13153
|
-
return value;
|
|
13154
|
-
}
|
|
13155
|
-
/** Bound a provider read without confusing a lost observer with a cancelled execution. */
|
|
13156
|
-
function awaitRetainedRead(read, ms, label) {
|
|
13157
|
-
return new Promise((resolve, reject) => {
|
|
13158
|
-
const clear = armDeadlineTimer(ms, () => reject(new RetainedReadTimeoutError(label, ms)), true);
|
|
13159
|
-
read.then((value) => {
|
|
13160
|
-
clear();
|
|
13161
|
-
resolve(value);
|
|
13162
|
-
}, (error) => {
|
|
13163
|
-
clear();
|
|
13164
|
-
reject(error);
|
|
13165
|
-
});
|
|
13166
|
-
});
|
|
13167
|
-
}
|
|
13168
13207
|
/** The environment id the latest durable admission names, when creation got that far. */
|
|
13169
13208
|
function admittedEnvironmentId(retention) {
|
|
13170
13209
|
for (const admission of [...retention?.admissions ?? []].reverse()) {
|
|
@@ -13268,6 +13307,16 @@ async function* streamProviderExecutor(args) {
|
|
|
13268
13307
|
try {
|
|
13269
13308
|
const toolParts = createSandboxToolPartState();
|
|
13270
13309
|
for await (const event of source.events) {
|
|
13310
|
+
if ("awaitingResultSince" in event) {
|
|
13311
|
+
yield {
|
|
13312
|
+
kind: "progress",
|
|
13313
|
+
progress: {
|
|
13314
|
+
kind: "awaiting-result",
|
|
13315
|
+
since: event.awaitingResultSince
|
|
13316
|
+
}
|
|
13317
|
+
};
|
|
13318
|
+
continue;
|
|
13319
|
+
}
|
|
13271
13320
|
args.noteProviderEvent();
|
|
13272
13321
|
archive.append(event);
|
|
13273
13322
|
text += textFromEnvironmentEvent(event);
|
|
@@ -13583,8 +13632,6 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13583
13632
|
};
|
|
13584
13633
|
}
|
|
13585
13634
|
const retention = args.retention;
|
|
13586
|
-
const observationIdleMs = retainedWaitBound(args.options.retainedObservationIdleMs, RETAINED_OBSERVATION_IDLE_MS, "retainedObservationIdleMs");
|
|
13587
|
-
const resultWaitMs = retainedWaitBound(args.options.retainedResultWaitMs, RETAINED_RESULT_WAIT_MS, "retainedResultWaitMs");
|
|
13588
13635
|
let admitted = args.recovering;
|
|
13589
13636
|
let executionAdmitted = args.recovering && retention.admissions.some((admission) => admission.phase === "dispatched");
|
|
13590
13637
|
const onAdmission = async (admission) => {
|
|
@@ -13748,6 +13795,11 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13748
13795
|
let sawTerminal = false;
|
|
13749
13796
|
let lastObservedAt = Date.now();
|
|
13750
13797
|
let lastFrameAt;
|
|
13798
|
+
let awaitingPublished = false;
|
|
13799
|
+
const awaitingResult = (since) => {
|
|
13800
|
+
awaitingPublished = true;
|
|
13801
|
+
return { awaitingResultSince: new Date(since).toISOString() };
|
|
13802
|
+
};
|
|
13751
13803
|
const seenEvents = /* @__PURE__ */ new Map();
|
|
13752
13804
|
const drain = async function* (open) {
|
|
13753
13805
|
let iterator;
|
|
@@ -13759,6 +13811,7 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13759
13811
|
observationFailure = { error };
|
|
13760
13812
|
return false;
|
|
13761
13813
|
}
|
|
13814
|
+
let pendingRead;
|
|
13762
13815
|
try {
|
|
13763
13816
|
while (true) {
|
|
13764
13817
|
if (framesAfterResult >= RETAINED_OBSERVATION_BATCH_EVENTS) {
|
|
@@ -13770,9 +13823,8 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13770
13823
|
let wake;
|
|
13771
13824
|
let grace;
|
|
13772
13825
|
let unwatch;
|
|
13826
|
+
let clearQuiet;
|
|
13773
13827
|
try {
|
|
13774
|
-
const remaining = observationIdleMs - (Date.now() - lastObservedAt);
|
|
13775
|
-
if (remaining <= 0) throw new RetainedReadTimeoutError("event stream", observationIdleMs);
|
|
13776
13828
|
const exactWake = new Promise((resolve) => {
|
|
13777
13829
|
wake = setImmediate$1(() => {
|
|
13778
13830
|
const close = () => {
|
|
@@ -13787,14 +13839,27 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13787
13839
|
unwatch = onExactResult(close);
|
|
13788
13840
|
});
|
|
13789
13841
|
});
|
|
13790
|
-
|
|
13842
|
+
pendingRead ??= awaitAbortable$1(Promise.resolve().then(() => iterator.next()), signal).then((value) => ({
|
|
13791
13843
|
kind: "event",
|
|
13792
13844
|
value
|
|
13793
|
-
}))
|
|
13845
|
+
}));
|
|
13846
|
+
const quiet = awaitingPublished ? void 0 : new Promise((resolve) => {
|
|
13847
|
+
clearQuiet = armDeadlineTimer(Math.max(0, RETAINED_AWAITING_RESULT_AFTER_MS - (Date.now() - lastObservedAt)), () => resolve({ kind: "quiet" }));
|
|
13848
|
+
});
|
|
13849
|
+
const observed = await Promise.race([
|
|
13850
|
+
pendingRead,
|
|
13851
|
+
exactWake,
|
|
13852
|
+
...quiet === void 0 ? [] : [quiet]
|
|
13853
|
+
]);
|
|
13854
|
+
if (observed.kind === "quiet") {
|
|
13855
|
+
yield awaitingResult(lastObservedAt);
|
|
13856
|
+
continue;
|
|
13857
|
+
}
|
|
13794
13858
|
if (observed.kind === "exact-result") {
|
|
13795
13859
|
observationFailure ??= { error: /* @__PURE__ */ new Error("retained provider stream remained open after its exact result") };
|
|
13796
13860
|
break;
|
|
13797
13861
|
}
|
|
13862
|
+
pendingRead = void 0;
|
|
13798
13863
|
next = observed.value;
|
|
13799
13864
|
} catch (error) {
|
|
13800
13865
|
if (signal.aborted) throw error;
|
|
@@ -13805,6 +13870,7 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13805
13870
|
if (wake !== void 0) clearImmediate(wake);
|
|
13806
13871
|
if (grace !== void 0) clearTimeout(grace);
|
|
13807
13872
|
unwatch?.();
|
|
13873
|
+
clearQuiet?.();
|
|
13808
13874
|
}
|
|
13809
13875
|
if (next.done) break;
|
|
13810
13876
|
observedFrames += 1;
|
|
@@ -13849,7 +13915,7 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13849
13915
|
if (!(yield* drain(() => session.events({
|
|
13850
13916
|
executionId: handle.controlRef.executionId,
|
|
13851
13917
|
signal
|
|
13852
|
-
}))) && !sawTerminal && lastReplayPosition !== void 0
|
|
13918
|
+
}))) && !sawTerminal && lastReplayPosition !== void 0) {
|
|
13853
13919
|
const firstFailure = observationFailure;
|
|
13854
13920
|
observationFailure = void 0;
|
|
13855
13921
|
if (!(yield* drain(() => session.events({
|
|
@@ -13863,12 +13929,12 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13863
13929
|
throw new RetainedExecutionPendingError(/* @__PURE__ */ new Error(`retained provider observation exceeded ${RETAINED_OBSERVATION_BATCH_EVENTS} frames after its exact result`), "unobservable");
|
|
13864
13930
|
}
|
|
13865
13931
|
if (!sawTerminal && observationFailure === void 0) observationFailure = { error: /* @__PURE__ */ new Error("retained provider stream did not yield a terminal event") };
|
|
13932
|
+
if (!sawTerminal && !exactResultSettled && !awaitingPublished) yield awaitingResult(Date.now());
|
|
13866
13933
|
let result;
|
|
13867
13934
|
try {
|
|
13868
|
-
result = await
|
|
13935
|
+
result = await readExactResult();
|
|
13869
13936
|
} catch (error) {
|
|
13870
13937
|
if (signal.aborted) throw error;
|
|
13871
|
-
if (!sawTerminal && error instanceof RetainedReadTimeoutError) throw new RetainedExecutionPendingError(new AggregateError([observationFailure?.error, error], `retained event stream had no terminal event (${observationFailureText(observationFailure ?? { error: "no observation failure was recorded" })}) and its exact result is unavailable`, { cause: error }), "terminal-event-lost");
|
|
13872
13938
|
if (observationFailure === void 0) throw error;
|
|
13873
13939
|
throw new AggregateError([observationFailure.error, error], `retained event observation failed (${observationFailureText(observationFailure)}) and its exact result could not be reconciled`, { cause: error });
|
|
13874
13940
|
}
|
|
@@ -13935,6 +14001,7 @@ function createInputFromSandboxOptions(options, customMapping) {
|
|
|
13935
14001
|
if (model.model !== void 0 && model.model !== concreteProfileModel(profile ?? {})) unsupported.push("backend.model.model");
|
|
13936
14002
|
}
|
|
13937
14003
|
if (options?.secrets === "all") unsupported.push("secrets=all");
|
|
14004
|
+
if (Array.isArray(options?.secrets) && options.secrets.some((secret) => typeof secret !== "string")) unsupported.push("secrets bindings");
|
|
13938
14005
|
if (unsupported.length > 0) throw new ValidationError(`providerAsSandboxClient: Sandbox create controls require mapCreateOptions: ${unsupported.join(", ")}`);
|
|
13939
14006
|
}
|
|
13940
14007
|
const profile = options?.backend?.profile;
|
|
@@ -13955,7 +14022,7 @@ function createInputFromSandboxOptions(options, customMapping) {
|
|
|
13955
14022
|
...Object.keys(workspace).length > 0 ? { workspace } : {},
|
|
13956
14023
|
...options?.resources ? { resources: options.resources } : {},
|
|
13957
14024
|
...options?.env ? { env: options.env } : {},
|
|
13958
|
-
...Array.isArray(options?.secrets) ? { secrets: options.secrets } : {},
|
|
14025
|
+
...Array.isArray(options?.secrets) ? { secrets: options.secrets.filter((secret) => typeof secret === "string") } : {},
|
|
13959
14026
|
...options?.metadata ? { metadata: options.metadata } : {},
|
|
13960
14027
|
...options?.name ? { name: options.name } : {},
|
|
13961
14028
|
...options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}
|
|
@@ -16700,25 +16767,28 @@ async function executeIteration(args) {
|
|
|
16700
16767
|
parentIndex: args.parentIndex
|
|
16701
16768
|
}
|
|
16702
16769
|
});
|
|
16703
|
-
const
|
|
16704
|
-
slot.events = events;
|
|
16770
|
+
const collector = createSandboxTurnEventCollector();
|
|
16705
16771
|
const requestedModel = concreteProfileModel(spec.profile);
|
|
16706
16772
|
const requested = {
|
|
16707
16773
|
...spec.profile.model?.provider !== void 0 ? { provider: spec.profile.model.provider } : {},
|
|
16708
16774
|
...requestedModel !== void 0 ? { model: requestedModel } : {}
|
|
16709
16775
|
};
|
|
16710
16776
|
const outcomeTracker = createAgentRunOutcomeTracker();
|
|
16711
|
-
|
|
16712
|
-
|
|
16713
|
-
|
|
16714
|
-
|
|
16715
|
-
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
|
|
16721
|
-
|
|
16777
|
+
try {
|
|
16778
|
+
for await (const event of stream) {
|
|
16779
|
+
collector.push(event);
|
|
16780
|
+
if (box !== void 0) args.evidenceTracker?.observe(box, event, source ? args.lineageState?.handles.get(args.item.index)?.sessionId : void 0);
|
|
16781
|
+
outcomeTracker.observe(event);
|
|
16782
|
+
notifySandboxEventObserver(event, args.ctx.onSandboxEvent, {
|
|
16783
|
+
iterationIndex: args.item.index,
|
|
16784
|
+
agentRunName: slot.agentRunName
|
|
16785
|
+
});
|
|
16786
|
+
const llmCall = usageLedger.observe(event, slot.agentRunName);
|
|
16787
|
+
if (llmCall) creditLlmCall(llmCall);
|
|
16788
|
+
assertSandboxServedModel(event, requested);
|
|
16789
|
+
}
|
|
16790
|
+
} finally {
|
|
16791
|
+
slot.events = collector.events();
|
|
16722
16792
|
}
|
|
16723
16793
|
const harnessCall = usageLedger.settleTurn(slot.agentRunName);
|
|
16724
16794
|
if (harnessCall) creditLlmCall(harnessCall);
|
|
@@ -16728,7 +16798,7 @@ async function executeIteration(args) {
|
|
|
16728
16798
|
slot.tokenUsage.tokensKnown = false;
|
|
16729
16799
|
slot.costUsdKnown = false;
|
|
16730
16800
|
}
|
|
16731
|
-
slot.output = args.output.parse(events);
|
|
16801
|
+
slot.output = args.output.parse(slot.events);
|
|
16732
16802
|
const projection = projectSandboxOutcome(outcome);
|
|
16733
16803
|
if (projection.status === "failed") throw new Error(projection.reason);
|
|
16734
16804
|
if (projection.status === "completed" && args.validator) slot.verdict = await args.validator.validate(slot.output, {
|
|
@@ -18431,12 +18501,26 @@ async function* streamDurableBridgeRun(args) {
|
|
|
18431
18501
|
return;
|
|
18432
18502
|
}
|
|
18433
18503
|
if (pendingUpstreamError) throw pendingUpstreamError;
|
|
18434
|
-
if (args.signal.aborted) throw
|
|
18504
|
+
if (args.signal.aborted) throw turnAbortedError(args.signal);
|
|
18435
18505
|
if (reconnects >= args.maxReconnects) throw new ValidationError$1(`bridgeExecutor: run ${args.run.id} ended without terminal acknowledgement after ${reconnects + 1} attempts`);
|
|
18436
18506
|
reconnects += 1;
|
|
18437
18507
|
await reconnectBackoff(reconnects, args.signal);
|
|
18438
18508
|
}
|
|
18439
18509
|
}
|
|
18510
|
+
/**
|
|
18511
|
+
* The turn's abort, carrying the signal's own reason. A bare "turn aborted" let the Lab's
|
|
18512
|
+
* reliability reader file 26.42 agent-hours of turn ceilings, stall settles, operator cancels and
|
|
18513
|
+
* play-check stops as one harness failure; the sandbox path already forwards the reason
|
|
18514
|
+
* (`deriveTurnSignal` in stream-agent-turn.ts). The name stays `AbortError`, which is what every
|
|
18515
|
+
* caller classifies an abort by.
|
|
18516
|
+
*/
|
|
18517
|
+
function turnAbortedError(signal) {
|
|
18518
|
+
const reason = abortReason(signal, "turn aborted");
|
|
18519
|
+
const text = reason instanceof Error ? reason.message : String(reason);
|
|
18520
|
+
const error = new Error(`bridgeExecutor: turn aborted: caused by AbortError: ${text}`, { cause: signal.reason });
|
|
18521
|
+
error.name = "AbortError";
|
|
18522
|
+
return error;
|
|
18523
|
+
}
|
|
18440
18524
|
/** Refuse an old bridge before it can start a paid harness turn. This is intentionally uncached:
|
|
18441
18525
|
* a process may restart behind the same URL, and a remembered capability from the prior process
|
|
18442
18526
|
* is not evidence about the process that will receive the next POST. The terminal receipt remains
|
|
@@ -18554,8 +18638,9 @@ async function bridgeStreamPost(url, args) {
|
|
|
18554
18638
|
});
|
|
18555
18639
|
let response;
|
|
18556
18640
|
const onAbort = () => {
|
|
18557
|
-
|
|
18558
|
-
|
|
18641
|
+
const error = turnAbortedError(args.signal);
|
|
18642
|
+
req.destroy(error);
|
|
18643
|
+
if (response && "destroy" in response && typeof response.destroy === "function") response.destroy(error);
|
|
18559
18644
|
};
|
|
18560
18645
|
if (args.signal.aborted) onAbort();
|
|
18561
18646
|
else args.signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -19700,7 +19785,7 @@ function causeChain(error) {
|
|
|
19700
19785
|
*/
|
|
19701
19786
|
function classifyDriverFailure(error, signal) {
|
|
19702
19787
|
if (signal?.aborted) return "terminal";
|
|
19703
|
-
if (error instanceof RetainedExecutionPendingError &&
|
|
19788
|
+
if (error instanceof RetainedExecutionPendingError && error.pendingCause === "provider-contract") return "terminal";
|
|
19704
19789
|
const admission = retainedAdmissionCause(error);
|
|
19705
19790
|
if (admission !== void 0 && isDispatchNotAdmitted(admission)) return "terminal";
|
|
19706
19791
|
if (admission !== void 0) return classifyDriverFailure(admission, signal);
|
|
@@ -30245,13 +30330,14 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
|
|
|
30245
30330
|
let artifact;
|
|
30246
30331
|
if (isAsyncIterable(ran)) {
|
|
30247
30332
|
live.events.start();
|
|
30248
|
-
const spend = await foldStream(ran, async (running) => {
|
|
30333
|
+
const spend = await foldStream(ran, async (running, event) => {
|
|
30249
30334
|
live.spent = running;
|
|
30250
30335
|
live.lastActivityAt = now();
|
|
30251
30336
|
await journal.appendEvent(journalRoot, {
|
|
30252
30337
|
kind: "progress",
|
|
30253
30338
|
id: live.id,
|
|
30254
30339
|
spend: running,
|
|
30340
|
+
...event.kind === "progress" && event.progress.kind === "awaiting-result" ? { awaitingResult: { since: event.progress.since } } : {},
|
|
30255
30341
|
seq: nextProgressSeq(),
|
|
30256
30342
|
at: new Date(now()).toISOString()
|
|
30257
30343
|
});
|
|
@@ -30647,7 +30733,7 @@ async function foldStream(stream, onProgress, signal, priorSpent, onEvent) {
|
|
|
30647
30733
|
...totals.usdKnown ? {} : { usdKnown: false },
|
|
30648
30734
|
...totals.tokensProvenance === void 0 || totals.tokensProvenance === "stream-receipt" ? {} : { tokensProvenance: totals.tokensProvenance },
|
|
30649
30735
|
ms: 0
|
|
30650
|
-
});
|
|
30736
|
+
}, ev);
|
|
30651
30737
|
}
|
|
30652
30738
|
} catch (error) {
|
|
30653
30739
|
Promise.resolve(iterator.return?.()).catch(() => void 0);
|
|
@@ -32355,6 +32441,6 @@ function isNonEmptySpend(s) {
|
|
|
32355
32441
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false || Object.values(s.resources ?? {}).some((resource) => resource.amount > 0 || !resource.known);
|
|
32356
32442
|
}
|
|
32357
32443
|
//#endregion
|
|
32358
|
-
export { attachWorker as $,
|
|
32444
|
+
export { attachWorker as $, sumSandboxUsage as $i, captureHarnessTranscript as $n, promptOnlyProfileMaterialization as $r, CONTINUATION_FACTS as $t, bindScopeRetainedOwnerEnvironmentId as A, promptFromAgentTurnInput as Aa, readSandboxOutcome as Ai, LEAF_CONTINUATION_TASK as An, sanitizeRuntimeStreamEvent as Ar, createInbox as At, scopeRetainedOwnerResourceReader as B, TRACE_SUMMARY_SCHEMA as Bi, reconnectRetainedRun as Bn, localHarnessExecutable as Br, isTerminalNodeStatus as Bt, recordScopeOwnerMaterialization as C, meterUsageEvent as Ca, runtimeOwnedPendingExecutorMaterialization as Ci, acquireSandbox as Cn, padSpanId as Cr, workerTraceEnv as Ct, settledToIteration as D, defaultRedactor as Da, executableAgentProfileSnapshot as Di, readPromptOptions as Dn, createRuntimeStreamEventCollector as Dr, DEFAULT_STALL_AFTER_MS as Dt, scopeOwnerExecutorNodeContext as E, spendFromUsageTotals as Ea, unknownMaterializationReceipt as Ei, assertBoxlessPromptOptions as En, createRuntimeEventCollector as Er, taskToPrompt as Et, prepareScopeRetainedOwnerTask as F, registerRetainedExecutorPreparation as Fi, createPushTraceSource as Fn, removeWorktree as Fr, createPeerMailbox as Ft, environmentReader as G, createSandboxUsageLedger as Gi, destroyInteractiveEnvironment as Gn, assertProfileMaterialization as Gr, summarizeDriverAttempts as Gt, scopeRetainedOwnerResult as H, canonicalStreamEventFromSandboxEvent as Hi, startRetainedRun as Hn, CodexExecutionDiagnosticError as Hr, HarnessTurnFailedError as Ht, reconcileScopeRetainedOwnerEnvironment as I, retainedExecutorSeamKey as Ii, decodeToolPart as In, DEFAULT_LOCAL_HARNESS as Ir, isPeerMailEnvelope as It, coordinationMcpAlias as J, mapSandboxEvent as Ji, openSlotGroup as Jn, defineProfileMaterializationContract as Jr, SeatChainExhaustedError as Jt, hostDirectoryReader as K, extractLlmCallEvent as Ki, environmentGone as Kn, assertProfileMaterializes as Kr, upstreamUnavailableSignal as Kt, scopeRetainedOwnerContext as L, unavailablePauseMs as Li, sandboxSessionTraceSource as Ln, LOCAL_HARNESSES as Lr, peerMailTools as Lt, consumeScopeRetainedOwnerResult as M, providerMessageText as Ma, awaitAbortable$1 as Mi, providerAsExecutor as Mn, runWorktreeHarness as Mr, DEFAULT_PEER_MAIL_LIMITS as Mt, noteScopeRetainedOwnerCoordination as N, runtimeFailureCause as Ni, providerAsSandboxClient as Nn, captureWorktreeDiff as Nr, PEER_MAIL_WIRE_KEY as Nt, abandonScopeRetainedOwnerInvocation as O, defaultRedactorIdentityMaterial as Oa, executableAgentSpecSnapshot as Oi, routerBrain as On, sanitizeAgentRuntimeEvent as Or, createActivityLog as Ot, prepareScopeRetainedOwnerSeatSwitch as P, settlementFailureCause as Pi, resolveAgentEnvironmentProvider as Pn, createWorktree as Pr, claimsAuthority as Pt, interactiveAdmissionSeamKey as Q, sandboxProgressEvents as Qi, runAbortable as Qn, promptModelProfileMaterialization as Qr, CONTINUATIONS_DIR as Qt, scopeRetainedOwnerJournalRoot as R, unavailableSignalOfFailure as Ri, bridgeRuntimeAttachmentsKey as Rn, harnessInvocation as Rr, peerMailVerbNames as Rt, recordScopeOwnerDriverAttempt as S, createBudgetPool as Sa, runtimeOwnedExecutorProviderEvidence as Si, createSandboxLineage as Sn, loopEventToOtelSpan as Sr, readWorkerTraceContext as St, restoreScopeOwnerAcceptedExecution as T, spendFromUsageEvents as Ta, unknownExecutionBindingReceipt as Ti, captureBeforeDestroy as Tn, toOtelAttributes as Tr, workerTraceSeamKey as Tt, scopeRetainedOwnerTurnEnded as U, createSandboxToolPartState as Ui, startRetainedRunInEnvironment as Un, terminateProcessTreeAndConfirm as Ur, classifyDriverFailure as Ut, scopeRetainedOwnerRestorePoint as V, assertSandboxServedModel as Vi, recoverRetainedRun as Vn, parseCodexTokenUsage as Vr, DriverAttemptsExhaustedError as Vt, SPAWN_RESOURCE_PATH_MAX_BYTES as W, createSandboxTurnEventCollector as Wi, retainedCreateMaterial as Wn, AGENT_PROFILE_MATERIALIZATION_AXES as Wr, runDriverWithRetry as Wt, providerVisibleProfile as X, notifySandboxEventObserver as Xi, abortError as Xn, profileMaterializationAxes$1 as Xr, seatExecutionProfile as Xt, coordinationProfileToolPrefix as Y, mapSandboxToolEvent as Yi, RunCancellationReason as Yn, fullProfileMaterialization as Yr, authoredSeatStages as Yt, runtimeGraphMetadataKey as Z, sandboxEventServedBackend as Zi, linkAbort as Zn, promptControlProfileMaterialization as Zr, subscriptionUsageLimitSignal as Zt, createScope as _, executorFailure as _a, providerAttemptEvidence as _i, TERMINAL_DECISIONS as _n, buildRuntimeEventOtelSpans as _r, DEFAULT_SANDBOX_STEERING_MAX_TURNS as _t, collectDelivered as a, insideCursorNamespace as aa, unsupportedProfileDimensions as ai, createContinuationKeeper as an, createCodeModeTools as ar, queueOf as at, meterRuntimeOwnedProviderAttempt as b, ReservationWaitRefused as ba, runtimeOwnedExecutorExecutionBinding as bi, isTerminalDecision as bn, flatOtelSpan as br, createInPlaceCliExecutor as bt, runTree as c, replaySpawnTree as ca, attestRuntimeOwnedPendingExecutor as ci, failedItems as cn, priceTokens as cr, mapExecutorResult as ct, isDriverSpec as d, isTraceAnalysisStore as da, authoredProfileDigest as di, bridgeAdmissionRefusal as dn, createPropagatingTraceEmitter as dr, cliInPlaceExecutor as dt, decodeHarnessUsage as ea, promptResourceProfileMaterialization as ei, CheckUnavailableError as en, harnessTranscriptArtifact as er, readWorkerInteractiveBinding as et, withDriverExecutor as f, parseWorkerToolTraceArtifact as fa, finalizeRuntimeOwnedPendingExecutor as fi, bridgeModelRouteRefusal as fn, mergeTraceEnv as fr, cliWorktreeExecutor as ft, beginScopeOwnerAttempt as g, detachedSnapshot as ga, newExecutionAttemptId as gi, readCodexRolloutSession as gn, buildLoopSpanNodes as gr, createWorktreeCliExecutor as gt, assertRecursiveReservationPolicy as h, detachedFrozen as ha, knownMaterializationReceipt as hi, harnessUsageIsEmpty as hn, buildLoopOtelSpans as hr, snapshotExecutorConfig as ht, bestDelivered as i, InMemorySpawnJournal as ia, sandboxProfileMaterialization as ii, checkVerdictOf as in, retainHarnessTranscript as ir, freeSlots as it, bindScopeRetainedOwnerProvider as j, promptOptionsFromAgentTurnInput as ja, abortError$1 as ji, createAgentEnvironmentProviderRegistry as jn, runSettledCommand as jr, AUTHORITY_MARKERS as jt, beginScopeRetainedOwnerDrive as k, resolveRedactor as ka, projectSandboxOutcome as ki, runBrainLoop as kn, sanitizeKnowledgeReadinessReport as kr, readWorkerProgress as kt, driverChild as l, WORKER_TOOL_TRACE_SCHEMA_VERSION as la, attestRuntimeOwnedScopeOwner as li, passedItems as ln, routerTokenPrice as lr, bindReusableExecutorExecutionId as lt, SUBTREE_RESULT_LIMIT as m, contentAddress as ma, knownExecutionBindingReceipt as mi, createCodexRolloutStoreReader as mn, traceContextToEnv as mr, createExecutorRegistry as mt, createRootHandle as n, FileSpawnJournal as na, renderUnsupported as ni, admitFinding as nn, readHarnessTranscript as nr, recoverRetainedInteractiveRun as nt, pickBestDelivered as o, loadSpawnForest as oa, validateProfileMaterialization as oi, distillFindings as on, describeCodeModeTools as or, rollingDispatch as ot, DEFAULT_BUDGET_STOP_HOLD_MS as p, workerTraceAnalysisStore as pa, inheritRuntimeOwnedExecutorAttestation as pi, addHarnessUsage as pn, readTraceContextFromEnv as pr, createExecutor as pt, resolveSpawnResourcePaths as q, isSandboxTerminalEvent as qi, createWorkerSlots as qn, controlProfileMaterialization as qr, SeatChain as qt, createSupervisor as r, InMemoryResultBlobStore as ra, sandboxActProfileMaterialization as ri, bestComposite as rn, resolveHarnessTranscriptCapture as rr, startRetainedInteractiveRun as rt, runFinalizer as s, materializeTreeView as sa, worktreeCliProfileMaterialization as si, expandQuestions as sn, runCodeMode as sr, gateOnDeliverable as st, DEFAULT_MAX_DEPTH as t, FileResultBlobStore as ta, renderProfileMaterializationIssues as ti, admitContinuationPolicy as tn, persistHarnessTranscript as tr, reconnectRetainedInteractiveRun as tt, driverExecutorFactory as u, captureWorkerTraceEvidence as ua, authoredAgentIdentity as ui, verdictFromJudgeScore as un, ROUTER_PRICE_SOURCE as ur, captureReusableExecutorConfig as ut, deriveNodeExecutionIdentity as v, errMessage as va, recordRuntimeOwnedDriveHarnessProviderEvidence as vi, createSandboxForSpec as vn, createOpenInferenceFileExporter as vr, createSteerableSandboxSession as vt, recordScopeOwnerPause as w, newUsageTotals as wa, runtimeOwnedScopeOwnerRuntime as wi, SandboxEvidenceRetentionError as wn, padTraceId as wr, workerTraceHeaders as wt, noteScopeOwnerPlannedExecution as x, assertValidBudget as xa, runtimeOwnedExecutorMaterialization as xi, runAgentRounds as xn, generateSpanId as xr, WORKER_TRACE_PROPAGATION as xt, meterRuntimeOwnedAccounting as y, BudgetReconcileFault as ya, runtimeOwnedDriveHarnessProviderEvidence as yi, defaultSelectWinner as yn, createOtelExporter as yr, createRouterTranscript as yt, scopeRetainedOwnerPriorSpend as z, TRACE_ROOT_SCHEMA as zi, bridgeStopSignalKey as zn, harnessSupportsReasoningEffort as zr, isLiveNodeStatus as zt };
|
|
32359
32445
|
|
|
32360
|
-
//# sourceMappingURL=supervisor-
|
|
32446
|
+
//# sourceMappingURL=supervisor-Rz8AGpYb.js.map
|