@tangle-network/agent-runtime 0.262.0 → 0.264.0
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-CozZXBTg.d.ts → activation-Bx4kfVU3.d.ts} +2 -2
- package/dist/{activation-C0AoYRgS.js → activation-DHFdvps3.js} +2 -2
- package/dist/{activation-C0AoYRgS.js.map → activation-DHFdvps3.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-COGC8FK2.js → coordination-driver-Bz-H17bC.js} +2 -2
- package/dist/{coordination-driver-COGC8FK2.js.map → coordination-driver-Bz-H17bC.js.map} +1 -1
- package/dist/{delegate-BC7Au73v.js → delegate-CwbWhX5W.js} +2 -2
- package/dist/{delegate-BC7Au73v.js.map → delegate-CwbWhX5W.js.map} +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +2 -2
- package/dist/{graph-DgODOGWN.js → graph-5NrpTg0h.js} +3 -3
- package/dist/{graph-DgODOGWN.js.map → graph-5NrpTg0h.js.map} +1 -1
- package/dist/{improvement-cycle-DirqO-fX.js → improvement-cycle-WRWcFyuO.js} +3 -3
- package/dist/{improvement-cycle-DirqO-fX.js.map → improvement-cycle-WRWcFyuO.js.map} +1 -1
- package/dist/{index-B8tXCisZ.d.ts → index-9wXpbjbX.d.ts} +6 -4
- package/dist/index.d.ts +6 -6
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +3 -3
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-C9P1ELVv.js → loop-runner-bin-DC1Lm0nM.js} +3 -3
- package/dist/{loop-runner-bin-C9P1ELVv.js.map → loop-runner-bin-DC1Lm0nM.js.map} +1 -1
- package/dist/{loop-runner-bin-BaZd1XIm.d.ts → loop-runner-bin-DPewOZMn.d.ts} +3 -3
- 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 +5 -5
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-CHwN_S24.d.ts → openai-tools-ByTMUJcD.d.ts} +2 -2
- package/dist/profiles.d.ts +2 -2
- package/dist/{provision-supervisor-9FMwo-Es.js → provision-supervisor-BZ6_uBGR.js} +3 -3
- package/dist/{provision-supervisor-9FMwo-Es.js.map → provision-supervisor-BZ6_uBGR.js.map} +1 -1
- package/dist/{runtime-BXWVW51r.js → runtime-CUZC75EX.js} +8 -8
- package/dist/{runtime-BXWVW51r.js.map → runtime-CUZC75EX.js.map} +1 -1
- package/dist/{server-6g6KFwUC.js → server-KpdpN627.js} +3 -3
- package/dist/{server-6g6KFwUC.js.map → server-KpdpN627.js.map} +1 -1
- package/dist/{stream-agent-turn-u28hoxuR.d.ts → stream-agent-turn-D1zelVx6.d.ts} +2 -2
- package/dist/{structural-rollout-WEfWpjub.js → structural-rollout-D17I5CwF.js} +2 -2
- package/dist/{structural-rollout-WEfWpjub.js.map → structural-rollout-D17I5CwF.js.map} +1 -1
- package/dist/{substrate-BeQiXkpa.d.ts → substrate-qQphD9f0.d.ts} +2 -2
- package/dist/{supervise-BeAI8-On.js → supervise-_DTVHXPC.js} +18 -4
- package/dist/supervise-_DTVHXPC.js.map +1 -0
- package/dist/{supervisor-BGGvnXvV.js → supervisor-C26k7X5-.js} +184 -22
- package/dist/supervisor-C26k7X5-.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-CP3iQ8Ji.d.ts → types-BV14WTyW.d.ts} +81 -10
- package/package.json +2 -2
- package/dist/supervise-BeAI8-On.js.map +0 -1
- package/dist/supervisor-BGGvnXvV.js.map +0 -1
|
@@ -241,7 +241,7 @@ function exactContinuedControlRef(candidate, initial) {
|
|
|
241
241
|
return controlRef;
|
|
242
242
|
}
|
|
243
243
|
function assertInteractionBinding(controlRef, command) {
|
|
244
|
-
if (command.binding.runId !== controlRef.runId || command.binding.
|
|
244
|
+
if (command.binding.runId !== controlRef.runId || command.binding.environmentId !== controlRef.environmentId || command.binding.sessionId !== controlRef.sessionId || command.binding.executionId !== controlRef.executionId) throw new Error("interaction response command does not target this retained run");
|
|
245
245
|
}
|
|
246
246
|
function assertBoundaryBinding(controlRef, proof) {
|
|
247
247
|
if (proof.runId !== controlRef.runId || proof.provider !== controlRef.provider || proof.environmentId !== controlRef.environmentId || proof.sessionId !== controlRef.sessionId || proof.executionId !== controlRef.executionId || proof.requestDigest !== controlRef.requestDigest) throw new Error("native context proof does not identify this retained run");
|
|
@@ -355,11 +355,11 @@ function assertEventBinding(source, controlRef) {
|
|
|
355
355
|
if (checkSessionId && value.sessionId !== void 0 && value.sessionId !== controlRef.sessionId) throw new Error("provider returned an event for another retained session");
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
/** Validate the
|
|
358
|
+
/** Validate the retained coordinates. The nested provider names the inner adapter. */
|
|
359
359
|
function assertCanonicalEventBinding(controlRef, event) {
|
|
360
360
|
if (event.type !== "interaction") return;
|
|
361
361
|
const binding = event.request.binding;
|
|
362
|
-
if (binding.runId !== controlRef.runId || binding.
|
|
362
|
+
if (binding.runId !== controlRef.runId || binding.environmentId !== controlRef.environmentId || binding.sessionId !== controlRef.sessionId || binding.executionId !== controlRef.executionId || binding.interactionId !== event.request.id) throw new Error("provider returned an interaction for another retained execution");
|
|
363
363
|
}
|
|
364
364
|
function isRecord$3(value) {
|
|
365
365
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -9539,7 +9539,7 @@ function assertSandboxStatusBinding(status, controlRef) {
|
|
|
9539
9539
|
}
|
|
9540
9540
|
function assertInteractionCommandScope(command, controlRef) {
|
|
9541
9541
|
if (controlRef === void 0) return;
|
|
9542
|
-
if (command.binding.runId !== controlRef.runId || command.binding.
|
|
9542
|
+
if (command.binding.runId !== controlRef.runId || command.binding.environmentId !== controlRef.environmentId || command.binding.sessionId !== controlRef.sessionId || command.binding.executionId !== controlRef.executionId) throw new ValidationError("interaction response targeted a different execution");
|
|
9543
9543
|
}
|
|
9544
9544
|
function assertCancellationScope(request, controlRef) {
|
|
9545
9545
|
if (controlRef === void 0) throw new ValidationError("durable cancellation requires an exact wrapper run control reference");
|
|
@@ -13870,6 +13870,7 @@ function executorFailureReason(result) {
|
|
|
13870
13870
|
const PLATFORM_FAILURE_CODES = new Set([
|
|
13871
13871
|
"QUOTA_EXCEEDED",
|
|
13872
13872
|
"provider_quota_exceeded",
|
|
13873
|
+
"provider_quota_exhausted",
|
|
13873
13874
|
"buffer.overflow",
|
|
13874
13875
|
"TIMEOUT",
|
|
13875
13876
|
"ECONNRESET",
|
|
@@ -13893,7 +13894,7 @@ const PLATFORM_FAILURE_MESSAGES = [
|
|
|
13893
13894
|
/exceeds its JSON bound/u,
|
|
13894
13895
|
/No provider served model/u,
|
|
13895
13896
|
/Invalid API key/u,
|
|
13896
|
-
/provider_quota_exceeded|QUOTA_EXCEEDED|rate limit/iu,
|
|
13897
|
+
/provider_quota_exceeded|provider_quota_exhausted|QUOTA_EXCEEDED|rate limit/iu,
|
|
13897
13898
|
/is at its box cap/u,
|
|
13898
13899
|
/could not materialize the seat credential/u,
|
|
13899
13900
|
/OpenCode exited while a model step was still in progress/u,
|
|
@@ -16882,6 +16883,7 @@ const outsideKinds = /* @__PURE__ */ new Set([
|
|
|
16882
16883
|
"teardown-confirmed",
|
|
16883
16884
|
"environment-teardown",
|
|
16884
16885
|
"trace-unpropagated",
|
|
16886
|
+
"paused",
|
|
16885
16887
|
"node-inputs-resolved",
|
|
16886
16888
|
"edge-verdict",
|
|
16887
16889
|
"join-state"
|
|
@@ -16952,6 +16954,7 @@ async function replaySpawnTree(journal, blobs, root) {
|
|
|
16952
16954
|
if (ev.kind === "teardown-pending" || ev.kind === "teardown-confirmed") continue;
|
|
16953
16955
|
if (ev.kind === "environment-teardown") continue;
|
|
16954
16956
|
if (ev.kind === "trace-unpropagated") continue;
|
|
16957
|
+
if (ev.kind === "paused") continue;
|
|
16955
16958
|
if (ev.kind === "node-inputs-resolved") continue;
|
|
16956
16959
|
if (ev.kind === "edge-verdict") continue;
|
|
16957
16960
|
if (ev.kind === "join-state") continue;
|
|
@@ -22114,6 +22117,7 @@ function defaultSleep$1(ms, signal) {
|
|
|
22114
22117
|
*/
|
|
22115
22118
|
/** Runtime-owned provider evidence is written through this private scope capability. */
|
|
22116
22119
|
const runtimeOwnedProviderMeters = /* @__PURE__ */ new WeakMap();
|
|
22120
|
+
const pauseRecorders = /* @__PURE__ */ new WeakMap();
|
|
22117
22121
|
const recoveryStarters = /* @__PURE__ */ new WeakMap();
|
|
22118
22122
|
const retainedReleasers = /* @__PURE__ */ new WeakMap();
|
|
22119
22123
|
const teardownRetriers = /* @__PURE__ */ new WeakMap();
|
|
@@ -23249,6 +23253,16 @@ function createScope(args) {
|
|
|
23249
23253
|
admissionClosed = true;
|
|
23250
23254
|
});
|
|
23251
23255
|
runtimeOwnedProviderMeters.set(scope, async (spend, providerModel, detail, accountingOnly) => meterInternal(spend, detail, providerModel, accountingOnly));
|
|
23256
|
+
let pauseSeq = 0;
|
|
23257
|
+
pauseRecorders.set(scope, async (pause) => {
|
|
23258
|
+
await args.journal.appendEvent(args.root, {
|
|
23259
|
+
kind: "paused",
|
|
23260
|
+
id: args.parentId,
|
|
23261
|
+
...pause,
|
|
23262
|
+
seq: pauseSeq++,
|
|
23263
|
+
at: new Date(now()).toISOString()
|
|
23264
|
+
});
|
|
23265
|
+
});
|
|
23252
23266
|
if (args.ownerMaterialization !== void 0) {
|
|
23253
23267
|
const authoredProfile = args.ownerMaterialization.authoredProfile === void 0 ? void 0 : detachedSnapshot(args.ownerMaterialization.authoredProfile, "scope owner authored profile");
|
|
23254
23268
|
ownerMaterializationStates.set(scope, {
|
|
@@ -23406,6 +23420,15 @@ function meterRuntimeOwnedProviderAttempt(scope, spend, providerModel, detail) {
|
|
|
23406
23420
|
if (meter === void 0) throw new ValidationError$1("scope: Runtime-owned provider meter is not bound to this scope");
|
|
23407
23421
|
return meter(spend, providerModel, detail);
|
|
23408
23422
|
}
|
|
23423
|
+
/**
|
|
23424
|
+
* @internal Journal that this scope's owner paused on an unavailable upstream. The pause is the
|
|
23425
|
+
* owner's, so it is recorded against the owner node, beside its `metered` turns.
|
|
23426
|
+
*/
|
|
23427
|
+
function recordScopeOwnerPause(scope, pause) {
|
|
23428
|
+
const record = pauseRecorders.get(scope);
|
|
23429
|
+
if (record === void 0) throw new ValidationError$1("scope: pause recorder is not bound to this scope");
|
|
23430
|
+
return record(pause);
|
|
23431
|
+
}
|
|
23409
23432
|
/** @internal Meter Runtime-owned accounting that does not represent provider execution. */
|
|
23410
23433
|
function meterRuntimeOwnedAccounting(scope, spend, detail) {
|
|
23411
23434
|
const meter = runtimeOwnedProviderMeters.get(scope);
|
|
@@ -24489,6 +24512,7 @@ function driverChild(profile, driver, journal, execution, acceptedSubmission, re
|
|
|
24489
24512
|
const name = profile.name ?? driver.name;
|
|
24490
24513
|
const traceSource = driver.traceSource;
|
|
24491
24514
|
const progress = driver.progress;
|
|
24515
|
+
const harnessTranscript = driver.harnessTranscript?.bind(driver);
|
|
24492
24516
|
const spec = executableAgentSpecSnapshot({
|
|
24493
24517
|
profile,
|
|
24494
24518
|
harness: null,
|
|
@@ -24499,7 +24523,8 @@ function driverChild(profile, driver, journal, execution, acceptedSubmission, re
|
|
|
24499
24523
|
...acceptedSubmission ? { acceptedSubmission } : {},
|
|
24500
24524
|
...recoverExecutor ? { recoverExecutor } : {},
|
|
24501
24525
|
...traceSource ? { traceSource } : {},
|
|
24502
|
-
...progress ? { progress } : {}
|
|
24526
|
+
...progress ? { progress } : {},
|
|
24527
|
+
...harnessTranscript ? { harnessTranscript } : {}
|
|
24503
24528
|
}, "driverChild");
|
|
24504
24529
|
const deliver = driver.deliver?.bind(driver);
|
|
24505
24530
|
return {
|
|
@@ -24564,6 +24589,7 @@ const driverExecutorFactory = (rawSpec, ctx) => {
|
|
|
24564
24589
|
runtime: driverRuntime,
|
|
24565
24590
|
...spec.traceSource ? { traceSource: spec.traceSource } : {},
|
|
24566
24591
|
...spec.progress ? { progress: spec.progress } : {},
|
|
24592
|
+
...spec.harnessTranscript ? { harnessTranscript: spec.harnessTranscript } : {},
|
|
24567
24593
|
...deliver ? { deliver(message) {
|
|
24568
24594
|
return deliver(message) !== false;
|
|
24569
24595
|
} } : {},
|
|
@@ -24844,7 +24870,8 @@ function unreportedSpend(total, prior) {
|
|
|
24844
24870
|
* Nothing here restarts children or replays work — it re-enters the driver, and the bridge backend
|
|
24845
24871
|
* reattaches the harness session because the execution id is bound durably per node.
|
|
24846
24872
|
*
|
|
24847
|
-
* Two classifications decide everything, and both are conservative
|
|
24873
|
+
* Two classifications decide everything a failure means, and both are conservative (a third, for
|
|
24874
|
+
* an upstream out of capacity, is described below):
|
|
24848
24875
|
*
|
|
24849
24876
|
* - TERMINAL failures are Runtime's own refusals: a `ValidationError`/`ConfigError` guard, an
|
|
24850
24877
|
* exhausted budget, an abort, a client-side transport status (401/404/422). Runtime meant them,
|
|
@@ -24892,6 +24919,16 @@ function unreportedSpend(total, prior) {
|
|
|
24892
24919
|
* read only the count cap, budget, and deadline, so a director with `repromptOnUnmet: 100` or
|
|
24893
24920
|
* `'until-complete'` that delivered nothing was re-prompted until the budget or deadline ended it;
|
|
24894
24921
|
* the old prompt-owned loop logged 896 of 1,011 rounds with no progress.
|
|
24922
|
+
*
|
|
24923
|
+
* A THIRD CLASS sits between the two: the upstream said "not now". A model provider's exhausted
|
|
24924
|
+
* quota, a rate limit, or an overloaded service (HTTP 429, 503, 529, or the router's own codes for
|
|
24925
|
+
* them) is not an accident in the driver and not a decision by Runtime; the same request succeeds
|
|
24926
|
+
* when capacity returns. Such a failure PAUSES the driver and re-enters it. A pause consumes neither
|
|
24927
|
+
* `maxAttempts` nor the barren streak, so only the deadline, the budget, and cancellation bound it.
|
|
24928
|
+
* Measured 2026-09-24 on play anomaly-referee-v3d: during the router's flash quota outage four of
|
|
24929
|
+
* five lead lanes ended `driver-failed` between minutes 101 and 118, after 12 to 13 attempts, while
|
|
24930
|
+
* the router answered some turns in between (one lead spent 1.7M and 3.3M input tokens on two of
|
|
24931
|
+
* them) and each run's budget and 8-hour deadline were almost untouched.
|
|
24895
24932
|
*/
|
|
24896
24933
|
/**
|
|
24897
24934
|
* The instruction a completed-but-undelivered drive is re-entered with when the caller supplies no
|
|
@@ -24917,6 +24954,8 @@ const DEFAULT_MAX_ATTEMPTS = 8;
|
|
|
24917
24954
|
const DEFAULT_MAX_BARREN_REPROMPTS = 2;
|
|
24918
24955
|
const DEFAULT_INITIAL_BACKOFF_MS = 2e3;
|
|
24919
24956
|
const DEFAULT_MAX_BACKOFF_MS = 3e4;
|
|
24957
|
+
const DEFAULT_UNAVAILABLE_PAUSE_MS = 15e3;
|
|
24958
|
+
const DEFAULT_MAX_UNAVAILABLE_PAUSE_MS = 3e5;
|
|
24920
24959
|
/**
|
|
24921
24960
|
* Bridge error classes the bridge itself never retries: a request that fails identically on
|
|
24922
24961
|
* every attempt, mapped below 5xx on its HTTP path (`parse_error` 400, the other two 501). On the
|
|
@@ -24952,25 +24991,93 @@ var HarnessTurnFailedError = class extends Error {
|
|
|
24952
24991
|
}
|
|
24953
24992
|
};
|
|
24954
24993
|
/**
|
|
24955
|
-
*
|
|
24956
|
-
*
|
|
24957
|
-
*
|
|
24958
|
-
*
|
|
24994
|
+
* Machine codes that say the upstream cannot serve now rather than that the request is wrong.
|
|
24995
|
+
* Each is a code an upstream publishes, not prose: the router's
|
|
24996
|
+
* (`lib/model-substitution.ts`, `lib/upstream-error-triage.ts`) and the OpenAI- and Anthropic-shaped
|
|
24997
|
+
* error types a relayed body carries.
|
|
24998
|
+
*/
|
|
24999
|
+
const UNAVAILABLE_CODES = /* @__PURE__ */ new Set([
|
|
25000
|
+
"provider_quota_exhausted",
|
|
25001
|
+
"provider_quota_exceeded",
|
|
25002
|
+
"provider_rate_limit",
|
|
25003
|
+
"upstream_unavailable",
|
|
25004
|
+
"provider_key_invalid",
|
|
25005
|
+
"rate_limit_exceeded",
|
|
25006
|
+
"rate_limit_error",
|
|
25007
|
+
"overloaded_error"
|
|
25008
|
+
]);
|
|
25009
|
+
/** 429 Too Many Requests, 503 Service Unavailable, and 529, which Anthropic uses for overload. */
|
|
25010
|
+
const UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([
|
|
25011
|
+
429,
|
|
25012
|
+
503,
|
|
25013
|
+
529
|
|
25014
|
+
]);
|
|
25015
|
+
/**
|
|
25016
|
+
* A harness that flattens the router's JSON body into its own failure text leaves the router's
|
|
25017
|
+
* code in that text: `opencode execution failed: No provider served model "..."
|
|
25018
|
+
* (provider_quota_exhausted)`. The code is matched as a whole token, and a status only in the
|
|
25019
|
+
* `status code <n>` framing a harness prints, so prose that merely mentions a quota does not match.
|
|
25020
|
+
*/
|
|
25021
|
+
function unavailableSignalInText(text) {
|
|
25022
|
+
for (const token of text.toLowerCase().matchAll(/[a-z_]+/gu)) if (UNAVAILABLE_CODES.has(token[0])) return token[0];
|
|
25023
|
+
const status = text.match(/\bstatus code (\d{3})\b/u)?.[1];
|
|
25024
|
+
return status !== void 0 && UNAVAILABLE_STATUSES.has(Number(status)) ? `http-${status}` : void 0;
|
|
25025
|
+
}
|
|
25026
|
+
/**
|
|
25027
|
+
* The code or status that marks `error` as an upstream capacity refusal, or `undefined`.
|
|
25028
|
+
*
|
|
25029
|
+
* A structured field is read first: a turn outcome's `errorCode`, a transport error's
|
|
25030
|
+
* `upstreamCode` and `status`, a provider SDK error's `status`. The failure text is read only when
|
|
25031
|
+
* no structured field decided, because a harness CLI reports the router's refusal as text.
|
|
25032
|
+
*/
|
|
25033
|
+
function upstreamUnavailableSignal(error) {
|
|
25034
|
+
if (!(error instanceof Error)) return void 0;
|
|
25035
|
+
if (error instanceof HarnessTurnFailedError) {
|
|
25036
|
+
const code = error.errorCode?.toLowerCase();
|
|
25037
|
+
if (code !== void 0 && UNAVAILABLE_CODES.has(code)) return code;
|
|
25038
|
+
return unavailableSignalInText(error.message);
|
|
25039
|
+
}
|
|
25040
|
+
if (error instanceof BackendTransportError) {
|
|
25041
|
+
const code = error.upstreamCode?.toLowerCase();
|
|
25042
|
+
if (code !== void 0 && UNAVAILABLE_CODES.has(code)) return code;
|
|
25043
|
+
if (error.status !== void 0) return UNAVAILABLE_STATUSES.has(error.status) ? `http-${error.status}` : void 0;
|
|
25044
|
+
return unavailableSignalInText(errorProperty(error, "message") ?? "");
|
|
25045
|
+
}
|
|
25046
|
+
if (error instanceof AgentEvalError$1) return void 0;
|
|
25047
|
+
const status = errorHttpStatus(error);
|
|
25048
|
+
if (status !== void 0) return UNAVAILABLE_STATUSES.has(status) ? `http-${status}` : void 0;
|
|
25049
|
+
return unavailableSignalInText(errorProperty(error, "message") ?? "");
|
|
25050
|
+
}
|
|
25051
|
+
/** True when the upstream refused for capacity and the same request will succeed later. */
|
|
25052
|
+
function isUpstreamUnavailable(error) {
|
|
25053
|
+
return upstreamUnavailableSignal(error) !== void 0;
|
|
25054
|
+
}
|
|
25055
|
+
/**
|
|
25056
|
+
* Classify one driver failure. Runtime's own typed refusals are decisions and stay terminal; an
|
|
25057
|
+
* upstream capacity refusal is `unavailable`; anything else foreign is an accident and is
|
|
25058
|
+
* retryable. A `BackendTransportError` is split by status because the taxonomy already promises
|
|
25059
|
+
* consumers may branch on it: a 5xx/408 is the upstream having a bad moment, a 429/503/529 is the
|
|
25060
|
+
* upstream out of capacity, and a 401/404/422 is a request that will fail identically forever. The
|
|
24959
25061
|
* bridge's own never-retry classes are terminal whether or not a status rides with them.
|
|
24960
25062
|
*/
|
|
24961
25063
|
function classifyDriverFailure(error, signal) {
|
|
24962
25064
|
if (signal?.aborted) return "terminal";
|
|
24963
25065
|
if (error instanceof Error && errorProperty(error, "name") === "AbortError") return "terminal";
|
|
24964
|
-
if (error instanceof HarnessTurnFailedError)
|
|
25066
|
+
if (error instanceof HarnessTurnFailedError) {
|
|
25067
|
+
if (error.errorCode !== void 0 && DETERMINISTIC_BRIDGE_CODES.has(error.errorCode)) return "terminal";
|
|
25068
|
+
return isUpstreamUnavailable(error) ? "unavailable" : "transient";
|
|
25069
|
+
}
|
|
24965
25070
|
if (error instanceof BackendTransportError) {
|
|
24966
25071
|
if (error.upstreamCode !== void 0 && DETERMINISTIC_BRIDGE_CODES.has(error.upstreamCode)) return "terminal";
|
|
25072
|
+
if (isUpstreamUnavailable(error)) return "unavailable";
|
|
24967
25073
|
const status = error.status;
|
|
24968
25074
|
if (status === void 0) return "transient";
|
|
24969
|
-
if (status === 408 || status
|
|
25075
|
+
if (status === 408 || status >= 500) return "transient";
|
|
24970
25076
|
return "terminal";
|
|
24971
25077
|
}
|
|
24972
25078
|
if (error instanceof ValidationError$1 || error instanceof ConfigError || error instanceof RuntimeRunStateError) return "terminal";
|
|
24973
25079
|
if (error instanceof AgentEvalError$1) return "terminal";
|
|
25080
|
+
if (isUpstreamUnavailable(error)) return "unavailable";
|
|
24974
25081
|
return foreignHttpStatusVerdict(error) ?? "transient";
|
|
24975
25082
|
}
|
|
24976
25083
|
/**
|
|
@@ -24983,15 +25090,16 @@ function classifyDriverFailure(error, signal) {
|
|
|
24983
25090
|
* times per node while the run showed a durable intent and no other event, so eleven of twelve
|
|
24984
25091
|
* roots sat for 25 minutes with nothing to diagnose. The status was on the error the whole time.
|
|
24985
25092
|
*
|
|
24986
|
-
* Reading it applies the same rule the transport branch already promises consumers: 408
|
|
24987
|
-
*
|
|
24988
|
-
*
|
|
25093
|
+
* Reading it applies the same rule the transport branch already promises consumers: 408 and 5xx
|
|
25094
|
+
* are the upstream having a bad moment, and any other 4xx is a request that will fail identically
|
|
25095
|
+
* forever. The capacity statuses were answered before this point. Anything without a plain numeric
|
|
25096
|
+
* status keeps the historical default.
|
|
24989
25097
|
*/
|
|
24990
25098
|
function foreignHttpStatusVerdict(error) {
|
|
24991
25099
|
if (!(error instanceof Error)) return void 0;
|
|
24992
25100
|
const status = errorHttpStatus(error);
|
|
24993
25101
|
if (status === void 0 || status < 400) return void 0;
|
|
24994
|
-
if (status === 408 || status
|
|
25102
|
+
if (status === 408 || status >= 500) return "transient";
|
|
24995
25103
|
return "terminal";
|
|
24996
25104
|
}
|
|
24997
25105
|
/** The budget's own verdict on whether another attempt may run at all. */
|
|
@@ -25028,7 +25136,9 @@ var DriverAttemptsExhaustedError = class extends RuntimeRunStateError {
|
|
|
25028
25136
|
const last = attempts[attempts.length - 1];
|
|
25029
25137
|
const causeText = cause instanceof Error ? `${errorProperty(cause, "name")}: ${errMessage(cause)}` : errMessage(cause);
|
|
25030
25138
|
const firstFailure = attempts.find((attempt) => attempt.error !== void 0)?.error;
|
|
25031
|
-
|
|
25139
|
+
const pauses = attempts.filter((attempt) => attempt.classification === "unavailable");
|
|
25140
|
+
const pausedMs = pauses.reduce((sum, attempt) => sum + (attempt.retryInMs ?? 0), 0);
|
|
25141
|
+
super(`supervisor driver failed after ${attempts.length} attempt(s) — stopped by ${stop}; ` + (pauses.length === 0 ? "" : `${pauses.length} attempt(s) met an unavailable upstream and paused ${Math.round(pausedMs / 1e3)} s in total; `) + (firstFailure !== void 0 && firstFailure !== last?.error ? `first failure: ${errorText(firstFailure)}; ` : "") + `last cause: ${causeText}` + (last?.classification ? ` (classified ${last.classification})` : ""), { cause });
|
|
25032
25142
|
this.attempts = Object.freeze([...attempts]);
|
|
25033
25143
|
this.stop = stop;
|
|
25034
25144
|
}
|
|
@@ -25039,10 +25149,13 @@ function summarizeDriverAttempts(records) {
|
|
|
25039
25149
|
for (const record of records) if (record.madeProgress) barren = 0;
|
|
25040
25150
|
else if (record.error === void 0 && record.reentry !== void 0 && record.contract === "unmet") barren += 1;
|
|
25041
25151
|
const last = records.at(-1);
|
|
25152
|
+
const refused = records.filter((record) => record.classification === "unavailable");
|
|
25042
25153
|
return {
|
|
25043
25154
|
attempts: records.length,
|
|
25044
25155
|
reprompts: records.filter((record) => record.reprompted === true).length,
|
|
25045
|
-
failureRetries: records.filter((record) => record.error !== void 0 && record.retryInMs !== void 0).length,
|
|
25156
|
+
failureRetries: records.filter((record) => record.error !== void 0 && record.retryInMs !== void 0 && record.classification !== "unavailable").length,
|
|
25157
|
+
unavailablePauses: refused.filter((record) => record.retryInMs !== void 0).length,
|
|
25158
|
+
unavailableMs: refused.reduce((sum, record) => sum + (record.madeProgress ? 0 : record.durationMs) + (record.retryInMs ?? 0), 0),
|
|
25046
25159
|
barrenReentries: barren,
|
|
25047
25160
|
ended: last?.stop ?? "unrecorded",
|
|
25048
25161
|
...last?.repromptRefusedBy === void 0 ? {} : { repromptRefusedBy: last.repromptRefusedBy }
|
|
@@ -25069,6 +25182,8 @@ async function runDriverWithRetry(run) {
|
|
|
25069
25182
|
const maxAttempts = Math.max(1, policy.maxAttempts ?? DEFAULT_MAX_ATTEMPTS);
|
|
25070
25183
|
const initialBackoff = Math.max(0, policy.initialBackoffMs ?? DEFAULT_INITIAL_BACKOFF_MS);
|
|
25071
25184
|
const maxBackoff = Math.max(initialBackoff, policy.maxBackoffMs ?? DEFAULT_MAX_BACKOFF_MS);
|
|
25185
|
+
const unavailablePause = Math.max(0, policy.unavailablePauseMs ?? DEFAULT_UNAVAILABLE_PAUSE_MS);
|
|
25186
|
+
const maxUnavailablePause = Math.max(unavailablePause, policy.maxUnavailablePauseMs ?? DEFAULT_MAX_UNAVAILABLE_PAUSE_MS);
|
|
25072
25187
|
const maxReprompts = run.reprompt?.maxReprompts ?? 0;
|
|
25073
25188
|
if (maxReprompts === "until-complete") {
|
|
25074
25189
|
const deadline = run.budget().deadlineMs;
|
|
@@ -25079,6 +25194,8 @@ async function runDriverWithRetry(run) {
|
|
|
25079
25194
|
let consecutiveBarren = 0;
|
|
25080
25195
|
let barrenReentries = 0;
|
|
25081
25196
|
let failures = 0;
|
|
25197
|
+
let consecutivePauses = 0;
|
|
25198
|
+
let pauses = 0;
|
|
25082
25199
|
let reprompts = 0;
|
|
25083
25200
|
let reentry;
|
|
25084
25201
|
const emit = async (record) => {
|
|
@@ -25130,10 +25247,54 @@ async function runDriverWithRetry(run) {
|
|
|
25130
25247
|
try {
|
|
25131
25248
|
await run.drive(attempt, reentry);
|
|
25132
25249
|
} catch (error) {
|
|
25133
|
-
failures += 1;
|
|
25134
25250
|
const durationMs = now() - startedAt;
|
|
25135
25251
|
const classification = classifyDriverFailure(error, run.signal);
|
|
25136
25252
|
const progressed = madeProgress(before, run.progress());
|
|
25253
|
+
if (classification === "unavailable") {
|
|
25254
|
+
if (progressed) barrenReentries = 0;
|
|
25255
|
+
const stop = (() => {
|
|
25256
|
+
if (!retryEnabled) return "retry-disabled";
|
|
25257
|
+
if (run.signal.aborted) return "aborted";
|
|
25258
|
+
return budgetStop(run.budget(), now());
|
|
25259
|
+
})();
|
|
25260
|
+
const unavailableSignal = upstreamUnavailableSignal(error) ?? "unavailable";
|
|
25261
|
+
if (stop !== void 0) {
|
|
25262
|
+
await emit({
|
|
25263
|
+
attempt,
|
|
25264
|
+
durationMs,
|
|
25265
|
+
error: errMessage(error),
|
|
25266
|
+
classification,
|
|
25267
|
+
madeProgress: progressed,
|
|
25268
|
+
unavailableSignal,
|
|
25269
|
+
stop
|
|
25270
|
+
});
|
|
25271
|
+
throw new DriverAttemptsExhaustedError(error, attempts, stop);
|
|
25272
|
+
}
|
|
25273
|
+
pauses += 1;
|
|
25274
|
+
consecutivePauses = progressed ? 1 : consecutivePauses + 1;
|
|
25275
|
+
const pause = Math.min(maxUnavailablePause, unavailablePause * 2 ** Math.max(0, consecutivePauses - 1));
|
|
25276
|
+
await emit({
|
|
25277
|
+
attempt,
|
|
25278
|
+
durationMs,
|
|
25279
|
+
error: errMessage(error),
|
|
25280
|
+
classification,
|
|
25281
|
+
madeProgress: progressed,
|
|
25282
|
+
unavailableSignal,
|
|
25283
|
+
retryInMs: pause
|
|
25284
|
+
});
|
|
25285
|
+
reentry = {
|
|
25286
|
+
reason: "upstream-unavailable",
|
|
25287
|
+
signal: unavailableSignal,
|
|
25288
|
+
pause: pauses
|
|
25289
|
+
};
|
|
25290
|
+
await sleep(pause, run.signal);
|
|
25291
|
+
if (run.signal.aborted) throw new DriverAttemptsExhaustedError(error, attempts, "aborted");
|
|
25292
|
+
const afterPause = budgetStop(run.budget(), now());
|
|
25293
|
+
if (afterPause) throw new DriverAttemptsExhaustedError(error, attempts, afterPause);
|
|
25294
|
+
continue;
|
|
25295
|
+
}
|
|
25296
|
+
consecutivePauses = 0;
|
|
25297
|
+
failures += 1;
|
|
25137
25298
|
const stop = (() => {
|
|
25138
25299
|
if (classification === "terminal") return "terminal-error";
|
|
25139
25300
|
if (!retryEnabled) return "retry-disabled";
|
|
@@ -25178,6 +25339,7 @@ async function runDriverWithRetry(run) {
|
|
|
25178
25339
|
continue;
|
|
25179
25340
|
}
|
|
25180
25341
|
consecutiveBarren = 0;
|
|
25342
|
+
consecutivePauses = 0;
|
|
25181
25343
|
const durationMs = now() - startedAt;
|
|
25182
25344
|
const after = run.progress();
|
|
25183
25345
|
const progressed = madeProgress(before, after);
|
|
@@ -26249,6 +26411,6 @@ function isNonEmptySpend(s) {
|
|
|
26249
26411
|
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);
|
|
26250
26412
|
}
|
|
26251
26413
|
//#endregion
|
|
26252
|
-
export {
|
|
26414
|
+
export { attachWorker as $, stringifySafe as $i, runAbortable as $n, sandboxActProfileMaterialization as $r, AUTHORITY_MARKERS as $t, settledToIteration as A, projectSandboxOutcome as Ai, canonicalObservedModelParts as An, runWorktreeHarness as Ar, replaySpawnTree as At, prepareScopeRetainedOwnerTask as B, notifySandboxEventObserver as Bi, sandboxSessionTraceSource as Bn, terminateProcessTreeAndConfirm as Br, newUsageTotals as Bt, deriveNodeExecutionIdentity as C, runtimeOwnedScopeOwnerRuntime as Ci, createSandboxLineage as Cn, toOtelAttributes as Cr, FileSpawnJournal as Ct, recordScopeOwnerPause as D, executableAgentSpecSnapshot as Di, readPromptOptions as Dn, sanitizeKnowledgeReadinessReport as Dr, loadSpawnForest as Dt, recordScopeOwnerMaterialization as E, executableAgentProfileSnapshot as Ei, assertBoxlessPromptOptions as En, sanitizeAgentRuntimeEvent as Er, insideCursorNamespace as Et, validateWaitSpec as F, createSandboxUsageLedger as Fi, providerAsSandboxClient as Fn, LOCAL_HARNESSES as Fr, workerTraceAnalysisStore as Ft, scopeRetainedOwnerResult as G, chargedTokens as Gi, startRetainedRun as Gn, fullProfileMaterialization as Gr, workerTraceEnv as Gt, scopeRetainedOwnerContext as H, sandboxProgressEvents as Hi, retainedExecutorSeamKey as Hn, assertProfileMaterialization as Hr, spendFromUsageTotals as Ht, waitUntil as I, extractLlmCallEvent as Ii, resolveAgentEnvironmentProvider as In, harnessSupportsReasoningEffort as Ir, BudgetReconcileFault as It, hostDirectoryReader as J, hasCompleteCacheBreakdown as Ji, destroyInteractiveEnvironment as Jn, promptModelProfileMaterialization as Jr, taskToPrompt as Jt, SPAWN_RESOURCE_PATH_MAX_BYTES as K, cloneSpend as Ki, startRetainedRunInEnvironment as Kn, profileMaterializationAxes$1 as Kr, workerTraceHeaders as Kt, bindScopeRetainedOwnerEnvironmentId as L, isSandboxTerminalEvent as Li, sandboxClientAsProvider as Ln, localHarnessExecutable as Lr, assertValidBudget as Lt, isWaitOutcome as M, assertSandboxServedModel as Mi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as Mn, createWorktree as Mr, captureWorkerTraceEvidence as Mt, pollFor as N, canonicalStreamEventFromSandboxEvent as Ni, createAgentEnvironmentProviderRegistry as Nn, removeWorktree as Nr, isTraceAnalysisStore as Nt, restoreScopeOwnerAcceptedExecution as O, detachedFrozen as Oi, routerBrain as On, sanitizeRuntimeStreamEvent as Or, materializeTreeView as Ot, timerAt as P, createSandboxToolPartState as Pi, providerAsExecutor as Pn, DEFAULT_LOCAL_HARNESS as Pr, parseWorkerToolTraceArtifact as Pt, workerInteractiveAdmissionFile as Q, sleep as Qi, linkAbort as Qn, renderUnsupported as Qr, createInbox as Qt, bindScopeRetainedOwnerProvider as R, mapSandboxEvent as Ri, createPushTraceSource as Rn, parseCodexTokenUsage as Rr, createBudgetPool as Rt, createScope as S, runtimeOwnedPendingExecutorMaterialization as Si, runAgentRounds as Sn, padTraceId as Sr, FileResultBlobStore as St, meterRuntimeOwnedProviderAttempt as T, unknownMaterializationReceipt as Ti, acquireSandbox as Tn, createRuntimeStreamEventCollector as Tr, InMemorySpawnJournal as Tt, scopeRetainedOwnerPriorSpend as U, sumSandboxUsage as Ui, reconnectRetainedRun as Un, controlProfileMaterialization as Ur, WORKER_TRACE_PROPAGATION as Ut, reconcileScopeRetainedOwnerEnvironment as V, sandboxEventServedBackend as Vi, registerRetainedExecutorPreparation as Vn, AGENT_PROFILE_MATERIALIZATION_AXES as Vr, spendFromUsageEvents as Vt, scopeRetainedOwnerResourceReader as W, addSpend as Wi, recoverRetainedRun as Wn, defineProfileMaterializationContract as Wr, readWorkerTraceContext as Wt, interactiveAdmissionSeamKey as X, promptCacheTokenClasses as Xi, RunCancellationReason as Xn, promptResourceProfileMaterialization as Xr, createActivityLog as Xt, resolveSpawnResourcePaths as Y, isAbortError$2 as Yi, environmentGone as Yn, promptOnlyProfileMaterialization as Yr, DEFAULT_STALL_AFTER_MS as Yt, readWorkerInteractiveAdmissions as Z, randomSuffix as Zi, abortError as Zn, renderProfileMaterializationIssues as Zr, readWorkerProgress as Zt, driverExecutorFactory as _, providerMessageText as _a, recordRuntimeOwnedDriveHarnessProviderEvidence as _i, bridgeStopSignalKey as _n, exportEvalRuns as _r, snapshotExecutorConfig as _t, pickBestDelivered as a, addResourceSpend as aa, prepareJsonlAppend as ai, peerMailTools as an, persistHarnessTranscript as ar, startRetainedInteractiveRun as at, assertRecursiveReservationPolicy as b, runtimeOwnedExecutorMaterialization as bi, defaultSelectWinner as bn, loopEventToOtelSpan as br, createSteerableSandboxSession as bt, DEFAULT_MAX_BARREN_REPROMPTS as c, decodeHarnessUsage as ca, attestRuntimeOwnedPendingExecutor as ci, isTerminalNodeStatus as cn, mergeTraceEnv as cr, freeSlots as ct, classifyDriverFailure as d, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as da, finalizeRuntimeOwnedPendingExecutor as di, bridgeModelRouteRefusal as dn, INTELLIGENCE_WIRE_VERSION as dr, bindReusableExecutorExecutionId as dt, throwAbort as ea, unsupportedProfileDimensions as ei, DEFAULT_PEER_MAIL_LIMITS as en, defaultRedactor as er, readWorkerInteractiveBinding as et, defaultUnmetContractSteer as f, armDeadlineTimer as fa, inheritRuntimeOwnedExecutorAttestation as fi, addHarnessUsage as fn, buildLoopOtelSpans as fr, captureReusableExecutorConfig as ft, driverChild as g, promptOptionsFromAgentTurnInput as ga, providerAttemptEvidence as gi, bridgeRuntimeAttachmentsKey as gn, createOtelExporter as gr, createExecutorRegistry as gt, upstreamUnavailableSignal as h, promptFromAgentTurnInput as ha, newExecutionAttemptId as hi, readCodexRolloutSession as hn, createOpenInferenceFileExporter as hr, createExecutor as ht, collectDelivered as i, zeroSpend as ia, parseCommittedJsonLines as ii, isPeerMailEnvelope as in, harnessTranscriptArtifact as ir, recoverRetainedInteractiveRun as it, createWaitProbes as j, readSandboxOutcome as ji, observedModelMatchesDeclared as jn, captureWorktreeDiff as jr, WORKER_TOOL_TRACE_SCHEMA_VERSION as jt, scopeOwnerExecutorNodeContext as k, detachedSnapshot as ki, runBrainLoop as kn, runSettledCommand as kr, pendingWaits as kt, DriverAttemptsExhaustedError as l, abortError$2 as la, attestRuntimeOwnedScopeOwner as li, executorFailure as ln, readTraceContextFromEnv as lr, queueOf as lt, summarizeDriverAttempts as m, teardownSurfaces as ma, knownMaterializationReceipt as mi, harnessUsageIsEmpty as mn, buildRuntimeEventOtelSpans as mr, cliWorktreeExecutor as mt, createSupervisor as n, unmeteredSpend as na, worktreeCliProfileMaterialization as ni, claimsAuthority as nn, resolveRedactor as nr, workerInteractiveBindingsDir as nt, runFinalizer as o, resourceTelemetry as oa, readCommittedJsonLines as oi, peerMailVerbNames as on, contentAddress as or, errMessage as ot, runDriverWithRetry as p, teardownExecutor as pa, knownExecutionBindingReceipt as pi, createCodexRolloutStoreReader as pn, buildLoopSpanNodes as pr, cliInPlaceExecutor as pt, environmentReader as q, deleteBoxSafe as qi, retainedCreateMaterial as qn, promptControlProfileMaterialization as qr, workerTraceSeamKey as qt, bestDelivered as r, withTimeout as ra, isNoEntError as ri, createPeerMailbox as rn, captureHarnessTranscript as rr, reconnectRetainedInteractiveRun as rt, runTree as s, withBudgetResources as sa, writeAllBytes as si, isLiveNodeStatus as sn, createPropagatingTraceEmitter as sr, effectiveConcurrency as st, createRootHandle as t, throwIfAborted as ta, validateProfileMaterialization as ti, PEER_MAIL_WIRE_KEY as tn, defaultRedactorIdentityMaterial as tr, workerInteractiveBindingFile as tt, HarnessTurnFailedError as u, awaitAbortable$1 as ua, authoredProfileDigest as ui, bridgeAdmissionRefusal as un, traceContextToEnv as ur, rollingDispatch as ut, isDriverSpec as v, runtimeOwnedDriveHarnessProviderEvidence as vi, TERMINAL_DECISIONS as vn, flatOtelSpan as vr, createWorktreeCliExecutor as vt, meterRuntimeOwnedAccounting as w, unknownExecutionBindingReceipt as wi, probeSandboxCapabilities as wn, createRuntimeEventCollector as wr, InMemoryResultBlobStore as wt, beginScopeOwnerAttempt as x, runtimeOwnedExecutorProviderEvidence as xi, isTerminalDecision as xn, padSpanId as xr, createInPlaceCliExecutor as xt, withDriverExecutor as y, runtimeOwnedExecutorExecutionBinding as yi, createSandboxForSpec as yn, generateSpanId as yr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as yt, consumeScopeRetainedOwnerResult as z, mapSandboxToolEvent as zi, decodeToolPart as zn, CodexExecutionDiagnosticError as zr, meterUsageEvent as zt };
|
|
26253
26415
|
|
|
26254
|
-
//# sourceMappingURL=supervisor-
|
|
26416
|
+
//# sourceMappingURL=supervisor-C26k7X5-.js.map
|