@tangle-network/agent-runtime 0.348.1 → 0.350.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-BEGalhOL.js → activation-CfJMyzEs.js} +12 -14
- package/dist/{activation-BEGalhOL.js.map → activation-CfJMyzEs.js.map} +1 -1
- package/dist/{activation-NQZP_mdI.d.ts → activation-DyiHrTlS.d.ts} +2 -24
- package/dist/agent.d.ts +8 -12
- package/dist/agent.js +9 -12
- package/dist/agent.js.map +1 -1
- package/dist/{analyst-loop-DZw5QWT9.js → analyst-loop-BZvXCDKy.js} +2 -3
- package/dist/{analyst-loop-DZw5QWT9.js.map → analyst-loop-BZvXCDKy.js.map} +1 -1
- package/dist/analyst-loop.d.ts +3 -5
- package/dist/analyst-loop.js +1 -2
- package/dist/{bundle-DKQtOO9d.js → bundle-Ze8pd07a.js} +3 -4
- package/dist/{bundle-DKQtOO9d.js.map → bundle-Ze8pd07a.js.map} +1 -1
- package/dist/candidate-execution/index.d.ts +13 -33
- package/dist/candidate-execution/index.js +16 -18
- package/dist/candidate-execution/index.js.map +1 -1
- package/dist/{coordination-manager-Bm6leXc6.js → coordination-manager-BkVfWlMz.js} +101 -132
- package/dist/coordination-manager-BkVfWlMz.js.map +1 -0
- package/dist/{delegate-Cp5-PsaX.js → delegate-DgEie4ad.js} +19 -21
- package/dist/delegate-DgEie4ad.js.map +1 -0
- package/dist/durable.d.ts +13 -23
- package/dist/durable.js +48 -43
- package/dist/durable.js.map +1 -1
- package/dist/{errors-DodWX-cb.js → errors-wuhGvpE3.js} +2 -3
- package/dist/{errors-DodWX-cb.js.map → errors-wuhGvpE3.js.map} +1 -1
- package/dist/{graph-CE_pzU31.js → graph-Cx0FhKSE.js} +192 -15
- package/dist/graph-Cx0FhKSE.js.map +1 -0
- package/dist/{improve-wT11zteg.js → improve-i0HU1-aa.js} +35 -53
- package/dist/{improve-wT11zteg.js.map → improve-i0HU1-aa.js.map} +1 -1
- package/dist/{improvement-adapter-sIthWkcN.d.ts → improvement-adapter-D5GRU1eY.d.ts} +2 -6
- package/dist/index.d.ts +41 -89
- package/dist/index.js +43 -61
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +39 -59
- package/dist/intelligence.js +23 -33
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +5 -5
- package/dist/kernel.js +11 -11
- package/dist/{loop-runner-CZzeeJTG.js → loop-runner-BwN9MhdP.js} +5 -6
- package/dist/{loop-runner-CZzeeJTG.js.map → loop-runner-BwN9MhdP.js.map} +1 -1
- package/dist/{loop-runner-CY5HHhtR.d.ts → loop-runner-DvfOXVx9.d.ts} +3 -5
- package/dist/loop-runner-bin.d.ts +5 -8
- package/dist/loop-runner-bin.js +2 -3
- package/dist/mcp/bin.js +6 -8
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +8 -18
- package/dist/mcp/index.js +17 -25
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.js +4 -6
- package/dist/mcp/memory-bin.js.map +1 -1
- package/dist/{model-policy-CyCUwHed.js → model-policy-GSxWwP-b.js} +11 -13
- package/dist/model-policy-GSxWwP-b.js.map +1 -0
- package/dist/placement.d.ts +12 -14
- package/dist/placement.js +1 -2
- package/dist/platform.d.ts +7 -13
- package/dist/platform.js +3 -6
- package/dist/platform.js.map +1 -1
- package/dist/{prepare-TEEHSJwq.js → prepare-DE8TQnLu.js} +49 -69
- package/dist/{prepare-TEEHSJwq.js.map → prepare-DE8TQnLu.js.map} +1 -1
- package/dist/{profile-6OLpbjvV.js → profile-CAhZDW2T.js} +58 -92
- package/dist/profile-CAhZDW2T.js.map +1 -0
- package/dist/{profile-materialization-bPm0gGLO.d.ts → profile-materialization-BRY22Oh8.d.ts} +1 -3
- package/dist/profiles.d.ts +25 -12
- package/dist/profiles.js +52 -11
- package/dist/profiles.js.map +1 -1
- package/dist/{protected-model-port-DVVh-hEk.d.ts → protected-model-port-IKqhTypD.d.ts} +2 -14
- package/dist/{protected-redaction-DFCeo4vg.js → protected-redaction-DilFZch5.js} +2 -3
- package/dist/{protected-redaction-DFCeo4vg.js.map → protected-redaction-DilFZch5.js.map} +1 -1
- package/dist/{provision-supervisor-CC0HdOHo.js → provision-supervisor-Bde_FF0R.js} +11 -15
- package/dist/{provision-supervisor-CC0HdOHo.js.map → provision-supervisor-Bde_FF0R.js.map} +1 -1
- package/dist/{record-events-D93DkpAx.js → record-events-B2GUgYdz.js} +12 -14
- package/dist/{record-events-D93DkpAx.js.map → record-events-B2GUgYdz.js.map} +1 -1
- package/dist/{run-cancellation-CzFhQGMa.js → run-cancellation-BLy_Zz-w.js} +6 -7
- package/dist/{run-cancellation-CzFhQGMa.js.map → run-cancellation-BLy_Zz-w.js.map} +1 -1
- package/dist/{runtime-B_40dXlF.js → runtime-6Ec9sHRe.js} +833 -215
- package/dist/runtime-6Ec9sHRe.js.map +1 -0
- package/dist/{runtime-hooks-tXpAarhW.js → runtime-hooks-CsW2pfFk.js} +2 -3
- package/dist/{runtime-hooks-tXpAarhW.js.map → runtime-hooks-CsW2pfFk.js.map} +1 -1
- package/dist/{runtime-hooks-nsqxSUFL.d.ts → runtime-hooks-ZQqPw-0g.d.ts} +1 -3
- package/dist/{sandbox-profile-compat-_fEtHPCj.js → sandbox-profile-compat-BxMQ1VXv.js} +62 -44
- package/dist/sandbox-profile-compat-BxMQ1VXv.js.map +1 -0
- package/dist/{search-executor-COd2F2wp.js → search-executor-B7g_5Wjl.js} +12 -17
- package/dist/search-executor-B7g_5Wjl.js.map +1 -0
- package/dist/{server-BGB4R4wQ.js → server-fvEMwGMQ.js} +19 -30
- package/dist/{server-BGB4R4wQ.js.map → server-fvEMwGMQ.js.map} +1 -1
- package/dist/{structural-rollout-Wl_rCuzM.js → structural-rollout-B86bSixU.js} +69 -70
- package/dist/structural-rollout-B86bSixU.js.map +1 -0
- package/dist/{substrate-CGDFTSRh.js → substrate-Db2pp6y3.js} +2 -3
- package/dist/{substrate-CGDFTSRh.js.map → substrate-Db2pp6y3.js.map} +1 -1
- package/dist/{supervise-BUOeThuB.js → supervise-CaeZcgAW.js} +615 -203
- package/dist/supervise-CaeZcgAW.js.map +1 -0
- package/dist/{supervisor-DDy0aEtR.js → supervisor-C1OePYE-.js} +526 -642
- package/dist/supervisor-C1OePYE-.js.map +1 -0
- package/dist/{task-queue-0fKkoweu.d.ts → task-queue-kefGy79U.d.ts} +1 -3
- package/dist/task-queue.d.ts +1 -1
- package/dist/task-queue.js +1 -2
- package/dist/testing.d.ts +8 -16
- package/dist/testing.js +241 -244
- package/dist/testing.js.map +1 -1
- package/dist/tool-loop.d.ts +16 -19
- package/dist/tool-loop.js +2 -3
- package/dist/{tool-server-XV4aJwoQ.js → tool-server-CwuYeW_Z.js} +3 -4
- package/dist/{tool-server-XV4aJwoQ.js.map → tool-server-CwuYeW_Z.js.map} +1 -1
- package/dist/{top-snapshot-CflmaDgk.js → top-snapshot-ChwpTr7A.js} +4 -5
- package/dist/{top-snapshot-CflmaDgk.js.map → top-snapshot-ChwpTr7A.js.map} +1 -1
- package/dist/tui/bin.js +7 -9
- package/dist/tui/bin.js.map +1 -1
- package/dist/tui/index.d.ts +3 -5
- package/dist/tui/index.js +2 -2
- package/dist/{types-hc4cmSc7.d.ts → types-Fowuwdz2.d.ts} +555 -503
- package/dist/{types-Cwrea-bU.d.ts → types-qsqfyQoY.d.ts} +1 -3
- package/dist/workspace-store/index.d.ts +12 -22
- package/dist/workspace-store/index.js +4 -7
- package/dist/workspace-store/index.js.map +1 -1
- package/dist/{workspace-streams-BiS4ABah.d.ts → workspace-streams-Dq2Fzk3c.d.ts} +1 -11
- package/package.json +25 -25
- package/skills/agent-graphs/SKILL.md +19 -4
- package/skills/be-ambitious/SKILL.md +46 -0
- package/skills/graph-designer/SKILL.md +15 -2
- package/skills/profile-authoring/SKILL.md +1 -1
- package/dist/coordination-manager-Bm6leXc6.js.map +0 -1
- package/dist/delegate-Cp5-PsaX.js.map +0 -1
- package/dist/graph-CE_pzU31.js.map +0 -1
- package/dist/model-policy-CyCUwHed.js.map +0 -1
- package/dist/profile-6OLpbjvV.js.map +0 -1
- package/dist/runtime-B_40dXlF.js.map +0 -1
- package/dist/sandbox-profile-compat-_fEtHPCj.js.map +0 -1
- package/dist/search-executor-COd2F2wp.js.map +0 -1
- package/dist/structural-rollout-Wl_rCuzM.js.map +0 -1
- package/dist/supervise-BUOeThuB.js.map +0 -1
- package/dist/supervisor-DDy0aEtR.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { a as publishExclusiveDurableFile, c as captureRunWriteContext, l as fenceRunWrite, p as sha256, r as assertNoSymlinkDescendant, s as writeAtomicDurableFile, t as spawnJournalRecordEvents } from "./record-events-
|
|
2
|
-
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, i as ConfigError, l as RetainedInteractiveBindingError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError$1, u as RetainedRunAdmissionError } from "./errors-
|
|
3
|
-
import { $ as
|
|
1
|
+
import { a as publishExclusiveDurableFile, c as captureRunWriteContext, l as fenceRunWrite, p as sha256, r as assertNoSymlinkDescendant, s as writeAtomicDurableFile, t as spawnJournalRecordEvents } from "./record-events-B2GUgYdz.js";
|
|
2
|
+
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, i as ConfigError, l as RetainedInteractiveBindingError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError$1, u as RetainedRunAdmissionError } from "./errors-wuhGvpE3.js";
|
|
3
|
+
import { $ as hasCompleteCacheBreakdown, At as teardownSurfaces, B as sha256Bytes$1, Ct as ROOT_DEADLINE_REASON, Dt as isDeadlineAbortReason, Et as checkInIdleMs, G as addSpend, H as hasControlCharacter, I as deepFreezeCandidate, J as cloneSpend, K as addTokenUsage, M as verifyWorkspaceSnapshotArtifacts, Ot as singleFlightTeardown, Q as fnv1a32Hex, Tt as boundedChildDeadlineAt, U as nativeSystemPrompt, W as abortError, X as deleteBoxSafe, Y as cloneTokenUsage, Z as errorMessage, _t as resourceTelemetry, at as randomUuid, bt as CHILD_DEADLINE_REASON, c as verifyAgentCandidateWorkspaceTree, ct as stringifySafe, dt as unmeteredSpend, et as isAbortError$1, ft as withTimeout, g as verifiedArtifactChunks, gt as assertResources, ht as addResourceSpend, it as randomSuffix, kt as teardownExecutor, lt as throwAbort, mt as zeroTokenUsage, nt as mapWithConcurrency, o as readAgentCandidateWorkspaceArtifactFiles, ot as roundBoxMinutes, pt as zeroSpend, q as chargedTokens, rt as promptCacheTokenClasses, s as verifyAgentCandidateWorkspaceArtifacts, st as sleep, t as assertSandboxProfileCompatibility, tt as isAsyncIterable, ut as throwIfAborted, v as verifyAgentCandidateWorkspaceArchive, vt as withBudgetResources, wt as armDeadlineTimer, yt as ACCEPTED_RESULT_GRACE_MS } from "./sandbox-profile-compat-BxMQ1VXv.js";
|
|
4
4
|
import { runTaskQueue } from "./task-queue.js";
|
|
5
|
-
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, d as assertRouterAutoDeclaration, f as assertRouterAutoResponse, g as observedModelMatchesDeclared, h as observedModelHasSnapshot, l as profileProviderModel, m as mergeObservedModelIdentity, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-
|
|
6
|
-
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-
|
|
5
|
+
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, d as assertRouterAutoDeclaration, f as assertRouterAutoResponse, g as observedModelMatchesDeclared, h as observedModelHasSnapshot, l as profileProviderModel, m as mergeObservedModelIdentity, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-GSxWwP-b.js";
|
|
6
|
+
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-CsW2pfFk.js";
|
|
7
7
|
import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentNativeContextContinuationResultSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, AgentTurnInputSchema, AgentTurnResultSchema, CanonicalStreamEventSchema, ContextTransferReceiptSchema, ContextTransferRequestSchema, InteractionAcknowledgementSchema, InteractionResponseCommandSchema, NativeContextBoundaryProofSchema, NativeContextContinuationRequestSchema, REASONING_EFFORTS, RuntimeEventEnvelopeSchema, TerminalReplayWindowSchema, TerminalSessionRefSchema, agentCandidateArtifactRefSchema, agentCandidateWorkspaceManifestMaterialSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentNativeContextContinuationResultMatchesRequest, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, agentRunCancellationRequestDigest, agentWorkspaceSnapshotRefDigest, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalWorkspaceCwd, contextTransferReceiptMatches, exactAgentInteractiveSessionStart, harnessTypeSchema, nativeContextContinuationTurnDigest, nativeReasoningControl, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema, workspaceCheckpointRequestDigest, workspaceCheckpointResultMatchesRequest, workspaceCleanupAcknowledgementMatches, workspaceCleanupRequestDigest, workspaceForkRequestDigest, workspaceForkResultMatchesRequest } from "@tangle-network/agent-interface";
|
|
8
8
|
import { isToolSpan, toolSpansToTraceAnalysisStore } from "@tangle-network/agent-eval";
|
|
9
9
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
10
10
|
import { SDKError, generateIdempotencyKey, isRecord, withRetry } from "@tangle-network/agent-core";
|
|
11
11
|
import { collectAgentFinalMessageText, collectAgentResponseText } from "@tangle-network/sandbox";
|
|
12
|
-
import { REDACTION_VERSION as REDACTION_VERSION$1, redact } from "@tangle-network/agent-eval/traces";
|
|
13
12
|
import { z } from "zod";
|
|
13
|
+
import { REDACTION_VERSION as REDACTION_VERSION$1, redact } from "@tangle-network/agent-eval/traces";
|
|
14
14
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
15
15
|
import { LedgerCanonicalizationError, canonicalString, jsonDocument, merkleLeafHash, merkleRoot, merkleSalt } from "@tangle-network/agent-eval/ledger-core";
|
|
16
16
|
import { appendFileSync, closeSync, constants, createReadStream, existsSync, fstatSync, fsyncSync, ftruncateSync, mkdirSync, openSync, readFileSync, readSync, statSync, writeSync } from "node:fs";
|
|
17
17
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep, win32 } from "node:path";
|
|
18
18
|
import { spawn } from "node:child_process";
|
|
19
19
|
import { access, chmod, copyFile, mkdir, mkdtemp, open, readFile, readdir, realpath, rm, rmdir, stat, symlink, writeFile } from "node:fs/promises";
|
|
20
|
-
import { applyWorkspacePlan, hashWorkspacePlan, materializeProfile, resolveAgentProfileResources } from "@tangle-network/agent-profile-materialize";
|
|
20
|
+
import { applyWorkspacePlan, assertWorkspacePlanSupported, hashWorkspacePlan, materializeProfile, resolveAgentProfileResources } from "@tangle-network/agent-profile-materialize";
|
|
21
21
|
import { stripVTControlCharacters } from "node:util";
|
|
22
22
|
import { homedir, hostname, tmpdir } from "node:os";
|
|
23
23
|
import { request } from "node:http";
|
|
@@ -26,7 +26,7 @@ import { Readable } from "node:stream";
|
|
|
26
26
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
27
27
|
import { ATTR, deriveHexId, isW3CSpanId, isW3CTraceId } from "@tangle-network/agent-trace-contract";
|
|
28
28
|
import { clearImmediate, setImmediate as setImmediate$1 } from "node:timers";
|
|
29
|
-
|
|
29
|
+
// src/runtime/turn-input.ts
|
|
30
30
|
/**
|
|
31
31
|
* Copy only fields that describe a new provider turn.
|
|
32
32
|
*
|
|
@@ -104,8 +104,7 @@ function promptPartFromInputPart(part) {
|
|
|
104
104
|
url: part.url
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
//#region src/runtime/retained-run-binding.ts
|
|
107
|
+
// src/runtime/retained-run-binding.ts
|
|
109
108
|
function exactSession(environment, controlRef) {
|
|
110
109
|
if (environment.id !== controlRef.environmentId || environment.provider !== controlRef.provider) throw new Error("provider reconstructed a different retained environment");
|
|
111
110
|
if (!environment.session || !controlRef.sessionId) throw new Error("retained run control requires a provider session id");
|
|
@@ -312,13 +311,11 @@ function delay(ms, signal) {
|
|
|
312
311
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
313
312
|
});
|
|
314
313
|
}
|
|
315
|
-
|
|
316
|
-
//#region src/record-value.ts
|
|
314
|
+
// src/record-value.ts
|
|
317
315
|
function recordValue(value) {
|
|
318
316
|
return isRecord(value) ? value : void 0;
|
|
319
317
|
}
|
|
320
|
-
|
|
321
|
-
//#region src/runtime/harness-usage.ts
|
|
318
|
+
// src/runtime/harness-usage.ts
|
|
322
319
|
/**
|
|
323
320
|
* Read and validate one codex `turn.completed` usage record.
|
|
324
321
|
*
|
|
@@ -446,8 +443,7 @@ function describe$1(value) {
|
|
|
446
443
|
if (Array.isArray(value)) return "an array";
|
|
447
444
|
return typeof value;
|
|
448
445
|
}
|
|
449
|
-
|
|
450
|
-
//#region src/runtime/sandbox-events.ts
|
|
446
|
+
// src/runtime/sandbox-events.ts
|
|
451
447
|
/**
|
|
452
448
|
* Forward a sandbox event to an optional observer without letting observer
|
|
453
449
|
* behavior affect the run. The observer receives a defensive copy, synchronous
|
|
@@ -509,7 +505,7 @@ function sandboxEventServedBackend(event) {
|
|
|
509
505
|
/**
|
|
510
506
|
* Fail the execution when the platform reports serving a model other than the exact one asked for.
|
|
511
507
|
*
|
|
512
|
-
* Measured motive (agent-runtime#892, live infrastructure
|
|
508
|
+
* Measured motive (agent-runtime#892, live infrastructure): 6 of 6 boxes whose profile
|
|
513
509
|
* declared `zai-coding-plan/glm-5.2` reported
|
|
514
510
|
* `{"provider":"openai-compat","model":"deepseek/deepseek-v4-flash","source":"environment"}`,
|
|
515
511
|
* while the materialization receipt recorded the declared model as `status: "known"`. Sending
|
|
@@ -1148,8 +1144,7 @@ function withoutDelta(event) {
|
|
|
1148
1144
|
function asRecord(value) {
|
|
1149
1145
|
return value !== null && typeof value === "object" ? value : void 0;
|
|
1150
1146
|
}
|
|
1151
|
-
|
|
1152
|
-
//#region src/runtime/timestamps.ts
|
|
1147
|
+
// src/runtime/timestamps.ts
|
|
1153
1148
|
const validTimestamp = "2026-01-01T00:00:00.000Z";
|
|
1154
1149
|
/** Validate a timestamp with the public runtime envelope contract. */
|
|
1155
1150
|
function assertRuntimeTimestamp(value, label) {
|
|
@@ -1169,8 +1164,7 @@ function assertRuntimeTimestamp(value, label) {
|
|
|
1169
1164
|
throw new Error(`${label} must be a valid ISO timestamp`, { cause: error });
|
|
1170
1165
|
}
|
|
1171
1166
|
}
|
|
1172
|
-
|
|
1173
|
-
//#region src/runtime/sandbox-transport-events.ts
|
|
1167
|
+
// src/runtime/sandbox-transport-events.ts
|
|
1174
1168
|
/** Canonical Sandbox/provider wire-envelope decoding and transport identity. */
|
|
1175
1169
|
const CANONICAL_STREAM_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
1176
1170
|
"child-task",
|
|
@@ -1282,8 +1276,7 @@ function optionalTimestamp(value) {
|
|
|
1282
1276
|
assertRuntimeTimestamp(value, "occurredAt");
|
|
1283
1277
|
return value;
|
|
1284
1278
|
}
|
|
1285
|
-
|
|
1286
|
-
//#region src/runtime/sandbox-executor-output.ts
|
|
1279
|
+
// src/runtime/sandbox-executor-output.ts
|
|
1287
1280
|
/** Streamed and terminal Sandbox executor output, using one tool-part projector. */
|
|
1288
1281
|
/**
|
|
1289
1282
|
* Fresh per-turn {@link SandboxToolPartState} for {@link mapSandboxToolEvent} — an
|
|
@@ -1627,8 +1620,7 @@ function terminalTextFromSandboxEvent(event) {
|
|
|
1627
1620
|
if (typeof value === "string") return value;
|
|
1628
1621
|
}
|
|
1629
1622
|
}
|
|
1630
|
-
|
|
1631
|
-
//#region src/redact.ts
|
|
1623
|
+
// src/redact.ts
|
|
1632
1624
|
/**
|
|
1633
1625
|
* Redaction for values that may leave the Runtime process. The built-in
|
|
1634
1626
|
* redactor is agent-eval's redaction core (`@tangle-network/agent-eval/traces`,
|
|
@@ -1669,8 +1661,7 @@ function resolveRedactor(redact) {
|
|
|
1669
1661
|
if (!redact) return defaultRedactor;
|
|
1670
1662
|
return (value) => defaultRedactor(redact(value));
|
|
1671
1663
|
}
|
|
1672
|
-
|
|
1673
|
-
//#region src/runtime/supervise/spend-validation.ts
|
|
1664
|
+
// src/runtime/supervise/spend-validation.ts
|
|
1674
1665
|
/** Reject malformed ceilings before they can mint capacity through negative reservations. */
|
|
1675
1666
|
function assertValidBudget(budget, label = "budget") {
|
|
1676
1667
|
const safeInteger = (value, field) => {
|
|
@@ -1713,8 +1704,7 @@ function assertValidSpend(spend, label) {
|
|
|
1713
1704
|
if (spend.usdKnown !== false) throw new Error(`${label}.usdEstimated requires ${label}.usdKnown false`);
|
|
1714
1705
|
}
|
|
1715
1706
|
}
|
|
1716
|
-
|
|
1717
|
-
//#region src/runtime/supervise/budget-ledger.ts
|
|
1707
|
+
// src/runtime/supervise/budget-ledger.ts
|
|
1718
1708
|
/**
|
|
1719
1709
|
* The balances of one conserved budget pool, and the arithmetic that moves them. `createBudgetPool`
|
|
1720
1710
|
* (`./budget`) owns tickets, the wait queue and the public contract; this module owns the numbers:
|
|
@@ -1972,8 +1962,7 @@ function ledgerRestore(l, root, restore) {
|
|
|
1972
1962
|
}
|
|
1973
1963
|
}
|
|
1974
1964
|
}
|
|
1975
|
-
|
|
1976
|
-
//#region src/runtime/supervise/usage-metering.ts
|
|
1965
|
+
// src/runtime/supervise/usage-metering.ts
|
|
1977
1966
|
/** Fold a normalized `UsageEvent` array into a `Spend`. Tokens and usd are separate
|
|
1978
1967
|
* channels; iterations come from `'iteration'` events. Pure; `ms` stays zero (the
|
|
1979
1968
|
* pool does not read wall-clock). */
|
|
@@ -2059,8 +2048,7 @@ async function foldUsage(events) {
|
|
|
2059
2048
|
for await (const ev of events) meterUsageEvent(totals, ev);
|
|
2060
2049
|
return spendFromUsageTotals(totals);
|
|
2061
2050
|
}
|
|
2062
|
-
|
|
2063
|
-
//#region src/runtime/supervise/budget.ts
|
|
2051
|
+
// src/runtime/supervise/budget.ts
|
|
2064
2052
|
/**
|
|
2065
2053
|
* The conserved budget reservation pool — the invariant the whole instrument rests on (critique
|
|
2066
2054
|
* M5/B3). One root `Budget` becomes a pool of standard quantities (tokens, usd, iterations) and
|
|
@@ -2336,8 +2324,7 @@ function describeLeakedReservation(leak) {
|
|
|
2336
2324
|
parts.push(`stage ${leak.stage}`);
|
|
2337
2325
|
return parts.join(", ");
|
|
2338
2326
|
}
|
|
2339
|
-
|
|
2340
|
-
//#region src/runtime/supervise/error-message.ts
|
|
2327
|
+
// src/runtime/supervise/error-message.ts
|
|
2341
2328
|
const maxCauseDepth = 4;
|
|
2342
2329
|
const maxMessageLength = 32768;
|
|
2343
2330
|
const maxPartLength = 2048;
|
|
@@ -2413,8 +2400,7 @@ function causeChain(error) {
|
|
|
2413
2400
|
}
|
|
2414
2401
|
return chain;
|
|
2415
2402
|
}
|
|
2416
|
-
|
|
2417
|
-
//#region src/runtime/supervise/credential-refusal.ts
|
|
2403
|
+
// src/runtime/supervise/credential-refusal.ts
|
|
2418
2404
|
/**
|
|
2419
2405
|
* The account owner refused an unsupported credential route before dispatch. This is the
|
|
2420
2406
|
* provider SDK's machine contract, not an HTTP status, class-name guess, or prose match.
|
|
@@ -2452,15 +2438,15 @@ function credentialCommandExit(error) {
|
|
|
2452
2438
|
if (typeof exitCode === "number" && Number.isInteger(exitCode) && exitCode > 0) return exitCode;
|
|
2453
2439
|
} catch {}
|
|
2454
2440
|
}
|
|
2455
|
-
|
|
2456
|
-
//#region src/runtime/json-content-hash.ts
|
|
2441
|
+
// src/runtime/json-content-hash.ts
|
|
2457
2442
|
/**
|
|
2458
2443
|
* Stable hash for the trace payload. Not cryptographic — only used so
|
|
2459
2444
|
* downstream eval pipelines can group iterations whose task / output is the
|
|
2460
2445
|
* same. Bare structural hash; non-JSON values stringify via their `toString`.
|
|
2461
2446
|
*/
|
|
2462
2447
|
function hashJson(value) {
|
|
2463
|
-
|
|
2448
|
+
const str = jsonContentText(value);
|
|
2449
|
+
return fnv1a32Hex(str);
|
|
2464
2450
|
}
|
|
2465
2451
|
/** JSON text with String fallback, including quoted JSON strings and cyclic values. */
|
|
2466
2452
|
function jsonContentText(value) {
|
|
@@ -2472,8 +2458,7 @@ function jsonContentText(value) {
|
|
|
2472
2458
|
}
|
|
2473
2459
|
return str;
|
|
2474
2460
|
}
|
|
2475
|
-
|
|
2476
|
-
//#region src/runtime/supervise/executor-outcome.ts
|
|
2461
|
+
// src/runtime/supervise/executor-outcome.ts
|
|
2477
2462
|
const outcomeSchema = AgentTurnResultSchema.pick({
|
|
2478
2463
|
success: true,
|
|
2479
2464
|
error: true
|
|
@@ -2556,10 +2541,10 @@ function executorFailureInfra(failure) {
|
|
|
2556
2541
|
/** Preserve deterministic result pointers across built-in executors and replay.
|
|
2557
2542
|
* FNV-1a is an identity convention here, not a cryptographic integrity check. */
|
|
2558
2543
|
function contentRef(prefix, value) {
|
|
2559
|
-
|
|
2544
|
+
const str = jsonContentText(value);
|
|
2545
|
+
return `${prefix}:${fnv1a32Hex(str)}`;
|
|
2560
2546
|
}
|
|
2561
|
-
|
|
2562
|
-
//#region src/durable/content-address.ts
|
|
2547
|
+
// src/durable/content-address.ts
|
|
2563
2548
|
/** Stable content address shared by result and trace artifacts. */
|
|
2564
2549
|
function contentAddress(artifact) {
|
|
2565
2550
|
return `sha256:${createHash("sha256").update(stableStringify(artifact), "utf-8").digest("hex")}`;
|
|
@@ -2569,8 +2554,7 @@ function stableStringify(value) {
|
|
|
2569
2554
|
if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
|
|
2570
2555
|
return `{${Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
|
|
2571
2556
|
}
|
|
2572
|
-
|
|
2573
|
-
//#region src/runtime/supervise/snapshot.ts
|
|
2557
|
+
// src/runtime/supervise/snapshot.ts
|
|
2574
2558
|
/** Deeply detach and freeze untrusted data at a runtime decision boundary. The clone prevents the
|
|
2575
2559
|
* caller from mutating it later; the freeze prevents downstream code from mutating the snapshot.
|
|
2576
2560
|
* Strings are immutable, so the snapshot shares the caller's strings instead of copying them. */
|
|
@@ -2655,8 +2639,7 @@ function deepFreeze(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
2655
2639
|
for (const child of Object.values(value)) deepFreeze(child, seen);
|
|
2656
2640
|
return Object.freeze(value);
|
|
2657
2641
|
}
|
|
2658
|
-
|
|
2659
|
-
//#region src/runtime/supervise/trace-root.ts
|
|
2642
|
+
// src/runtime/supervise/trace-root.ts
|
|
2660
2643
|
/**
|
|
2661
2644
|
* Trace roots: one Merkle root over the events a turn archived, so a single event can be proven
|
|
2662
2645
|
* against the hash its journal record carries without reading the rest of the archive.
|
|
@@ -2853,8 +2836,7 @@ function merkleTree() {
|
|
|
2853
2836
|
function storedText(event) {
|
|
2854
2837
|
return JSON.stringify(event) ?? "null";
|
|
2855
2838
|
}
|
|
2856
|
-
|
|
2857
|
-
//#region src/runtime/supervise/upstream-unavailable.ts
|
|
2839
|
+
// src/runtime/supervise/upstream-unavailable.ts
|
|
2858
2840
|
/**
|
|
2859
2841
|
* An upstream that cannot serve NOW: how Runtime recognizes one, and how long an agent waits for it.
|
|
2860
2842
|
*
|
|
@@ -2927,9 +2909,9 @@ function cappedDoublingMs(consecutive, first, ceiling) {
|
|
|
2927
2909
|
return Math.min(Math.max(start, ceiling), start * 2 ** Math.max(0, consecutive - 1));
|
|
2928
2910
|
}
|
|
2929
2911
|
/** The longest hold a refusal's own reset time may ask for: a 5-hour plan window plus a margin. */
|
|
2930
|
-
const MAX_RESET_HOLD_MS =
|
|
2912
|
+
const MAX_RESET_HOLD_MS = 216e5;
|
|
2931
2913
|
/** How often a refusal whose reset is beyond {@link MAX_RESET_HOLD_MS} is probed again. */
|
|
2932
|
-
const FAR_RESET_PROBE_MS =
|
|
2914
|
+
const FAR_RESET_PROBE_MS = 36e5;
|
|
2933
2915
|
/**
|
|
2934
2916
|
* When a refusal says its quota resets, as epoch ms, or `undefined` when it names no usable time.
|
|
2935
2917
|
* The Z.ai Coding Plan's opencode refusal names one in Beijing time with no zone:
|
|
@@ -2959,8 +2941,7 @@ function unavailableResumeAt(text, nowMs) {
|
|
|
2959
2941
|
function jitteredMs(ms, random) {
|
|
2960
2942
|
return ms - Math.floor(ms / 2 * Math.min(1, Math.max(0, random())));
|
|
2961
2943
|
}
|
|
2962
|
-
|
|
2963
|
-
//#region src/runtime/supervise/retained-executor.ts
|
|
2944
|
+
// src/runtime/supervise/retained-executor.ts
|
|
2964
2945
|
/** Scope owns the durable writer; provider executors only publish sanitized admissions. */
|
|
2965
2946
|
const retainedExecutorSeamKey = "runtime.retainedExecutor";
|
|
2966
2947
|
/** @internal A capture may finish after cancellation; its durable citation remains appendable. */
|
|
@@ -3173,10 +3154,39 @@ function registerRetainedExecutorPreparation(factory, prepare) {
|
|
|
3173
3154
|
function prepareRetainedExecutor(factory, input) {
|
|
3174
3155
|
return retainedPreparations.get(factory)?.(input);
|
|
3175
3156
|
}
|
|
3176
|
-
|
|
3177
|
-
//#region src/runtime/failure-cause.ts
|
|
3157
|
+
// src/runtime/failure-cause.ts
|
|
3178
3158
|
const MAX_CAUSE_CHARS = 2048;
|
|
3179
3159
|
const MAX_CHAIN_STEPS = 12;
|
|
3160
|
+
const MACHINE_CODE_PATTERN = /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u;
|
|
3161
|
+
/** @internal Validate Runtime-owned failure values on observation transports. */
|
|
3162
|
+
const runtimeFailureCauseSchema = z.object({
|
|
3163
|
+
code: z.enum([
|
|
3164
|
+
"aborted",
|
|
3165
|
+
"deadline-exceeded",
|
|
3166
|
+
"budget-exhausted",
|
|
3167
|
+
"credential-refused",
|
|
3168
|
+
"request-rejected",
|
|
3169
|
+
"upstream-unavailable",
|
|
3170
|
+
"transport",
|
|
3171
|
+
"provider-contract",
|
|
3172
|
+
"retained-unobservable",
|
|
3173
|
+
"nested-recovery",
|
|
3174
|
+
"platform",
|
|
3175
|
+
"work-failed",
|
|
3176
|
+
"unknown"
|
|
3177
|
+
]),
|
|
3178
|
+
owner: z.enum([
|
|
3179
|
+
"provider",
|
|
3180
|
+
"platform",
|
|
3181
|
+
"runtime",
|
|
3182
|
+
"work",
|
|
3183
|
+
"caller",
|
|
3184
|
+
"unknown"
|
|
3185
|
+
]),
|
|
3186
|
+
cause: z.string().max(MAX_CAUSE_CHARS),
|
|
3187
|
+
/** The upstream or provider machine code the failure carried, when it carried one. */
|
|
3188
|
+
providerCode: z.string().regex(MACHINE_CODE_PATTERN).optional()
|
|
3189
|
+
}).readonly();
|
|
3180
3190
|
const retainedFailures = {
|
|
3181
3191
|
unobservable: {
|
|
3182
3192
|
code: "retained-unobservable",
|
|
@@ -3239,8 +3249,16 @@ function structuralFailure(link) {
|
|
|
3239
3249
|
code: "credential-refused",
|
|
3240
3250
|
owner: "caller"
|
|
3241
3251
|
};
|
|
3242
|
-
const code =
|
|
3252
|
+
const code = upstreamMachineCode(link);
|
|
3243
3253
|
const status = read(link, "status") ?? read(link, "statusCode");
|
|
3254
|
+
if (code === "SEAT_NOT_LOGGED_IN") return {
|
|
3255
|
+
code: "credential-refused",
|
|
3256
|
+
owner: "caller"
|
|
3257
|
+
};
|
|
3258
|
+
if (code === "MODEL_NOT_FOUND") return {
|
|
3259
|
+
code: "request-rejected",
|
|
3260
|
+
owner: "caller"
|
|
3261
|
+
};
|
|
3244
3262
|
if (typeof code === "string" && UNAVAILABLE_CODES.has(code.toLowerCase())) return {
|
|
3245
3263
|
code: "upstream-unavailable",
|
|
3246
3264
|
owner: "platform"
|
|
@@ -3278,7 +3296,10 @@ function structuralFailure(link) {
|
|
|
3278
3296
|
};
|
|
3279
3297
|
}
|
|
3280
3298
|
function machineCode(value) {
|
|
3281
|
-
return typeof value === "string" &&
|
|
3299
|
+
return typeof value === "string" && MACHINE_CODE_PATTERN.test(value) ? value : void 0;
|
|
3300
|
+
}
|
|
3301
|
+
function upstreamMachineCode(link) {
|
|
3302
|
+
return machineCode(read(link, "upstreamCode")) ?? machineCode(read(link, "errorCode")) ?? machineCode(read(link, "code"));
|
|
3282
3303
|
}
|
|
3283
3304
|
/**
|
|
3284
3305
|
* Classify a thrown failure. Pass the caller's signal so a cancellation the caller asked for is
|
|
@@ -3287,11 +3308,11 @@ function machineCode(value) {
|
|
|
3287
3308
|
*/
|
|
3288
3309
|
function runtimeFailureCause(error, context = {}) {
|
|
3289
3310
|
const links = chain(error);
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3311
|
+
const providerCode = [
|
|
3312
|
+
"upstreamCode",
|
|
3313
|
+
"errorCode",
|
|
3314
|
+
"code"
|
|
3315
|
+
].flatMap((field) => links.map((link) => machineCode(read(link, field)))).find((code) => code !== void 0);
|
|
3295
3316
|
const failure = ({ code, owner }) => ({
|
|
3296
3317
|
code,
|
|
3297
3318
|
owner,
|
|
@@ -3326,15 +3347,10 @@ function runtimeFailureCause(error, context = {}) {
|
|
|
3326
3347
|
* a failure with neither does not say who must act, so it is `unknown`, never the work's fault.
|
|
3327
3348
|
*/
|
|
3328
3349
|
function reportedFailureCause(outcome) {
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
...outcome.statusCode === void 0 ? {} : { status: outcome.statusCode }
|
|
3334
|
-
}) ?? UNATTRIBUTED,
|
|
3335
|
-
cause: boundedCause(outcome.error ?? "execution reported a failure"),
|
|
3336
|
-
...providerCode === void 0 ? {} : { providerCode }
|
|
3337
|
-
};
|
|
3350
|
+
return runtimeFailureCause(Object.assign(new Error(outcome.error ?? "execution reported a failure"), {
|
|
3351
|
+
errorCode: outcome.errorCode,
|
|
3352
|
+
statusCode: outcome.statusCode
|
|
3353
|
+
}));
|
|
3338
3354
|
}
|
|
3339
3355
|
/**
|
|
3340
3356
|
* Classify a down settlement from the typed facts Runtime recorded while the cause was still a
|
|
@@ -3349,21 +3365,20 @@ function settlementFailureCause(down) {
|
|
|
3349
3365
|
...retainedFailures[down.retainedPendingCause],
|
|
3350
3366
|
cause
|
|
3351
3367
|
};
|
|
3352
|
-
|
|
3368
|
+
if (down.failure !== void 0 && down.failure.code !== "unknown") return {
|
|
3369
|
+
...down.failure,
|
|
3370
|
+
cause
|
|
3371
|
+
};
|
|
3353
3372
|
return {
|
|
3354
|
-
...down.
|
|
3355
|
-
code: down.failure.code,
|
|
3356
|
-
owner: down.failure.owner
|
|
3357
|
-
} : down.infra === false ? {
|
|
3373
|
+
...down.infra === false ? {
|
|
3358
3374
|
code: "work-failed",
|
|
3359
3375
|
owner: "work"
|
|
3360
3376
|
} : UNATTRIBUTED,
|
|
3361
3377
|
cause,
|
|
3362
|
-
...providerCode === void 0 ? {} : { providerCode }
|
|
3378
|
+
...down.failure?.providerCode === void 0 ? {} : { providerCode: down.failure.providerCode }
|
|
3363
3379
|
};
|
|
3364
3380
|
}
|
|
3365
|
-
|
|
3366
|
-
//#region src/runtime/sandbox-outcome.ts
|
|
3381
|
+
// src/runtime/sandbox-outcome.ts
|
|
3367
3382
|
/** Map the public Sandbox outcome to Runtime's stream and verdict vocabulary. */
|
|
3368
3383
|
function projectSandboxOutcome(outcome) {
|
|
3369
3384
|
if (outcome.status === "success") return {
|
|
@@ -3408,8 +3423,7 @@ function readSandboxOutcome(value) {
|
|
|
3408
3423
|
if (!outcome || typeof outcome !== "object") return void 0;
|
|
3409
3424
|
return outcome;
|
|
3410
3425
|
}
|
|
3411
|
-
|
|
3412
|
-
//#region src/runtime/supervise/executable-spec.ts
|
|
3426
|
+
// src/runtime/supervise/executable-spec.ts
|
|
3413
3427
|
/**
|
|
3414
3428
|
* Parse one untrusted profile into the exact immutable value execution may consume.
|
|
3415
3429
|
*
|
|
@@ -3446,8 +3460,7 @@ function executableAgentSpecSnapshot(raw, context) {
|
|
|
3446
3460
|
...execution === void 0 ? {} : { execution }
|
|
3447
3461
|
});
|
|
3448
3462
|
}
|
|
3449
|
-
|
|
3450
|
-
//#region src/runtime/provider-observation-snapshot.ts
|
|
3463
|
+
// src/runtime/provider-observation-snapshot.ts
|
|
3451
3464
|
/** Detach provider attempt observations into their immutable journal evidence shape. */
|
|
3452
3465
|
function snapshotProviderObservations(attempts) {
|
|
3453
3466
|
return Object.freeze(attempts.map((attempt) => Object.freeze({
|
|
@@ -3456,8 +3469,7 @@ function snapshotProviderObservations(attempts) {
|
|
|
3456
3469
|
...attempt.providerDispatch === "not_started" ? { providerDispatch: "not_started" } : {}
|
|
3457
3470
|
})));
|
|
3458
3471
|
}
|
|
3459
|
-
|
|
3460
|
-
//#region src/runtime/supervise/materialization.ts
|
|
3472
|
+
// src/runtime/supervise/materialization.ts
|
|
3461
3473
|
const runtimeOwnedExecutorMaterializations = /* @__PURE__ */ new WeakMap();
|
|
3462
3474
|
const runtimeOwnedScopeOwners = /* @__PURE__ */ new WeakMap();
|
|
3463
3475
|
const runtimeOwnedExecutorProviderEvidenceState = /* @__PURE__ */ new WeakMap();
|
|
@@ -3833,8 +3845,7 @@ function providerAttemptEvidence(model) {
|
|
|
3833
3845
|
models
|
|
3834
3846
|
});
|
|
3835
3847
|
}
|
|
3836
|
-
|
|
3837
|
-
//#region src/agent/profile-materialization.ts
|
|
3848
|
+
// src/agent/profile-materialization.ts
|
|
3838
3849
|
const KNOWN_AXIS_SET = new Set(AGENT_PROFILE_MATERIALIZATION_AXES);
|
|
3839
3850
|
/**
|
|
3840
3851
|
* Compound AgentProfile properties and the canonical leaves they cover.
|
|
@@ -3855,7 +3866,11 @@ const compoundAxisLeaves = {
|
|
|
3855
3866
|
"version",
|
|
3856
3867
|
"tags"
|
|
3857
3868
|
],
|
|
3858
|
-
prompt: [
|
|
3869
|
+
prompt: [
|
|
3870
|
+
"systemPrompt",
|
|
3871
|
+
"appendSystemPrompt",
|
|
3872
|
+
"instructions"
|
|
3873
|
+
],
|
|
3859
3874
|
model: [
|
|
3860
3875
|
"modelDefault",
|
|
3861
3876
|
"modelSmall",
|
|
@@ -3894,6 +3909,7 @@ const promptModelProfileMaterialization = defineProfileMaterializationContract({
|
|
|
3894
3909
|
axes: [
|
|
3895
3910
|
"name",
|
|
3896
3911
|
"systemPrompt",
|
|
3912
|
+
"appendSystemPrompt",
|
|
3897
3913
|
"instructions",
|
|
3898
3914
|
"modelDefault",
|
|
3899
3915
|
"modelProvider",
|
|
@@ -3920,6 +3936,7 @@ const worktreeCliProfileMaterialization = defineProfileMaterializationContract({
|
|
|
3920
3936
|
axes: [
|
|
3921
3937
|
"name",
|
|
3922
3938
|
"systemPrompt",
|
|
3939
|
+
"appendSystemPrompt",
|
|
3923
3940
|
"instructions",
|
|
3924
3941
|
"modelDefault",
|
|
3925
3942
|
"modelProvider",
|
|
@@ -4052,13 +4069,14 @@ function assertProfileMaterializes(profile, harness, context, skip) {
|
|
|
4052
4069
|
* `failOnError: false` so every dimension comes back on `plan.unsupported` and the caller decides.
|
|
4053
4070
|
*/
|
|
4054
4071
|
function unsupportedProfileDimensions(profile, harness, dimensions, skip) {
|
|
4055
|
-
|
|
4072
|
+
const query = {
|
|
4056
4073
|
...profile,
|
|
4057
4074
|
resources: {
|
|
4058
4075
|
...profile.resources,
|
|
4059
4076
|
failOnError: false
|
|
4060
4077
|
}
|
|
4061
|
-
}
|
|
4078
|
+
};
|
|
4079
|
+
return materializeProfile(query, harness, skip ? { skip: [...skip] } : void 0).unsupported.filter((entry) => dimensions.includes(entry.dimension));
|
|
4062
4080
|
}
|
|
4063
4081
|
/** One clause per dimension the harness cannot execute, carrying the materializer's own reason. */
|
|
4064
4082
|
function renderUnsupported(unsupported) {
|
|
@@ -4126,8 +4144,7 @@ function assertLeafAxis(raw, label) {
|
|
|
4126
4144
|
function isAxisSupported(axis, supported) {
|
|
4127
4145
|
return supported.has(axis);
|
|
4128
4146
|
}
|
|
4129
|
-
|
|
4130
|
-
//#region src/runtime/process-tree.ts
|
|
4147
|
+
// src/runtime/process-tree.ts
|
|
4131
4148
|
const processKillGraceMs = 250;
|
|
4132
4149
|
const processGroupExitConfirmMs = 1e3;
|
|
4133
4150
|
const processGroupExitPollMs = 10;
|
|
@@ -4177,8 +4194,7 @@ function processGroupExists(processGroupId) {
|
|
|
4177
4194
|
return true;
|
|
4178
4195
|
}
|
|
4179
4196
|
}
|
|
4180
|
-
|
|
4181
|
-
//#region src/mcp/codex-execution-policy.ts
|
|
4197
|
+
// src/mcp/codex-execution-policy.ts
|
|
4182
4198
|
const CODEX_EXECUTION_POLICY = {
|
|
4183
4199
|
sessionPersistence: "ephemeral",
|
|
4184
4200
|
userConfig: false,
|
|
@@ -4370,22 +4386,7 @@ function buildHarnessArgs(harness, taskPrompt, options = {}) {
|
|
|
4370
4386
|
}
|
|
4371
4387
|
return args;
|
|
4372
4388
|
}
|
|
4373
|
-
/**
|
|
4374
|
-
* Map a supervisor-authored `AgentProfile` + the per-task prompt onto a concrete harness
|
|
4375
|
-
* `command` + `args` (the §1.5 fix). UNLIKE the prompt-only `HARNESS_INVOCATIONS.buildArgs`
|
|
4376
|
-
* — which drops both the authored model and the system prompt — this threads the FULL
|
|
4377
|
-
* profile payload into argv:
|
|
4378
|
-
*
|
|
4379
|
-
* - `profile.prompt.systemPrompt` → the PROMPT channel: a portable, harness-agnostic
|
|
4380
|
-
* default that prepends the system prompt above the task prompt (`<system>\n\n<task>`),
|
|
4381
|
-
* so the authored standing instructions reach EVERY harness (none of the three CLIs
|
|
4382
|
-
* expose a portable replace-system-prompt flag for a one-shot non-interactive run).
|
|
4383
|
-
* - `profile.prompt.instructions[]` → appended prompt sections in authored order.
|
|
4384
|
-
* - `profile.model.default` → the harness's `-m <model>` selector.
|
|
4385
|
-
*
|
|
4386
|
-
* The task prompt alone is the floor; an empty/absent profile yields exactly the legacy
|
|
4387
|
-
* `buildArgs(taskPrompt)` shape so existing callers are byte-identical.
|
|
4388
|
-
*/
|
|
4389
|
+
/** Task/instruction preamble and model controls; native prompts are applied in the workspace plan. */
|
|
4389
4390
|
function harnessInvocation(harness, profile, taskPrompt, options = {}) {
|
|
4390
4391
|
const invocation = HARNESS_INVOCATIONS[harness];
|
|
4391
4392
|
if (!invocation) throw new Error(`harnessInvocation: unknown harness ${String(harness)}`);
|
|
@@ -4393,14 +4394,9 @@ function harnessInvocation(harness, profile, taskPrompt, options = {}) {
|
|
|
4393
4394
|
if (!harnessProfileModel(harness, profile)) throw new Error("harnessInvocation: codexReproducible requires profile.model.default");
|
|
4394
4395
|
if (profile.model?.reasoningEffort === void 0) throw new Error("harnessInvocation: codexReproducible requires profile.model.reasoningEffort");
|
|
4395
4396
|
}
|
|
4396
|
-
const systemPrompt = profile.prompt?.systemPrompt;
|
|
4397
4397
|
const instructions = profile.prompt?.instructions;
|
|
4398
4398
|
if (instructions !== void 0 && (!Array.isArray(instructions) || instructions.some((instruction) => typeof instruction !== "string"))) throw new Error("harnessInvocation: profile.prompt.instructions must be an array of strings");
|
|
4399
|
-
const composedPrompt = [
|
|
4400
|
-
...typeof systemPrompt === "string" && systemPrompt.trim().length > 0 ? [systemPrompt] : [],
|
|
4401
|
-
...instructions?.filter((instruction) => instruction.trim().length > 0) ?? [],
|
|
4402
|
-
taskPrompt
|
|
4403
|
-
].join("\n\n");
|
|
4399
|
+
const composedPrompt = [...instructions?.filter((instruction) => instruction.trim().length > 0) ?? [], taskPrompt].join("\n\n");
|
|
4404
4400
|
const args = buildHarnessArgs(harness, composedPrompt, options);
|
|
4405
4401
|
const model = harnessProfileModel(harness, profile);
|
|
4406
4402
|
if (model) args.push(...invocation.modelArgs(model));
|
|
@@ -4424,8 +4420,7 @@ function harnessProfileModel(harness, profile) {
|
|
|
4424
4420
|
if (provider !== nativeProvider) throw new Error(`harnessInvocation: ${harness} cannot materialize model provider ${JSON.stringify(provider)}; expected ${nativeProvider}`);
|
|
4425
4421
|
return model;
|
|
4426
4422
|
}
|
|
4427
|
-
|
|
4428
|
-
//#region src/mcp/codex-diagnostics.ts
|
|
4423
|
+
// src/mcp/codex-diagnostics.ts
|
|
4429
4424
|
/** Thrown when reproducible Codex exits without one valid terminal usage event. */
|
|
4430
4425
|
var CodexExecutionDiagnosticError = class extends Error {
|
|
4431
4426
|
reason;
|
|
@@ -4439,7 +4434,7 @@ var CodexExecutionDiagnosticError = class extends Error {
|
|
|
4439
4434
|
}
|
|
4440
4435
|
};
|
|
4441
4436
|
const CODEX_FAILURE_STREAM_MAX_CHARS = 4096;
|
|
4442
|
-
const CODEX_AUTH_MAX_BYTES =
|
|
4437
|
+
const CODEX_AUTH_MAX_BYTES = 1048576;
|
|
4443
4438
|
const CODEX_REDACTED = "<REDACTED_CREDENTIAL>";
|
|
4444
4439
|
const codexSensitiveEnvironmentName = /(TOKEN|KEY|SECRET|PASSWORD|CREDENTIAL|AUTH|COOKIE)/i;
|
|
4445
4440
|
function createCodexExecutionDiagnosticError(opts) {
|
|
@@ -4533,8 +4528,7 @@ function collectStringLeaves(value, output) {
|
|
|
4533
4528
|
}
|
|
4534
4529
|
if (value !== null && typeof value === "object") for (const item of Object.values(value)) collectStringLeaves(item, output);
|
|
4535
4530
|
}
|
|
4536
|
-
|
|
4537
|
-
//#region src/mcp/codex-execution-evidence.ts
|
|
4531
|
+
// src/mcp/codex-execution-evidence.ts
|
|
4538
4532
|
const FORBIDDEN_CODEX_PROMPT_MARKERS = [
|
|
4539
4533
|
"<skills_instructions>",
|
|
4540
4534
|
"# AGENTS.md instructions",
|
|
@@ -4652,7 +4646,27 @@ function assertCodexReproducibleInvocation(command, args) {
|
|
|
4652
4646
|
const tail = args.slice(expectedPrefix.length);
|
|
4653
4647
|
const validModel = tail[0] === "-m" && typeof tail[1] === "string" && tail[1].length > 0 && !tail[1].startsWith("-");
|
|
4654
4648
|
const validReasoning = tail[2] === "-c" && typeof tail[3] === "string" && /^model_reasoning_effort="(?:none|minimal|low|medium|high|xhigh)"$/.test(tail[3]);
|
|
4655
|
-
|
|
4649
|
+
const nativeKeys = /* @__PURE__ */ new Set();
|
|
4650
|
+
const nativeArgs = tail.slice(4);
|
|
4651
|
+
let validNative = nativeArgs.length % 2 === 0;
|
|
4652
|
+
for (let index = 0; index < nativeArgs.length; index += 2) {
|
|
4653
|
+
const config = nativeArgs[index + 1] ?? "";
|
|
4654
|
+
const split = config.indexOf("=");
|
|
4655
|
+
const key = config.slice(0, split);
|
|
4656
|
+
const value = config.slice(split + 1);
|
|
4657
|
+
if (nativeArgs[index] !== "-c" || nativeKeys.has(key)) validNative = false;
|
|
4658
|
+
nativeKeys.add(key);
|
|
4659
|
+
if (key === "model_instructions_file") {
|
|
4660
|
+
if (value !== JSON.stringify(".tangle/system-prompt.md")) validNative = false;
|
|
4661
|
+
} else if (key === "developer_instructions") try {
|
|
4662
|
+
const text = JSON.parse(value);
|
|
4663
|
+
if (typeof text !== "string" || !text.trim()) validNative = false;
|
|
4664
|
+
} catch {
|
|
4665
|
+
validNative = false;
|
|
4666
|
+
}
|
|
4667
|
+
else validNative = false;
|
|
4668
|
+
}
|
|
4669
|
+
if (!hasExactPrefix || tail.length < 4 || !validModel || !validReasoning || !validNative) throw new Error("runLocalHarness: reproducible Codex invocation does not match the required isolated argv");
|
|
4656
4670
|
}
|
|
4657
4671
|
function codexPromptDebugArgs(execArgs, prompt) {
|
|
4658
4672
|
const debugArgs = ["debug", "prompt-input"];
|
|
@@ -4722,8 +4736,10 @@ function runCodexProbe(opts, args) {
|
|
|
4722
4736
|
const onAbort = () => {
|
|
4723
4737
|
terminate("aborted");
|
|
4724
4738
|
};
|
|
4725
|
-
if (opts.signal)
|
|
4726
|
-
|
|
4739
|
+
if (opts.signal) {
|
|
4740
|
+
if (opts.signal.aborted) onAbort();
|
|
4741
|
+
else opts.signal.addEventListener("abort", onAbort, { once: true });
|
|
4742
|
+
}
|
|
4727
4743
|
child.stdout?.on("data", (chunk) => {
|
|
4728
4744
|
stdout += String(chunk);
|
|
4729
4745
|
});
|
|
@@ -4784,8 +4800,7 @@ function redactJsonText(value, text) {
|
|
|
4784
4800
|
if (isRecord(value)) return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redactJsonText(item, text)]));
|
|
4785
4801
|
return value;
|
|
4786
4802
|
}
|
|
4787
|
-
|
|
4788
|
-
//#region src/mcp/codex-native-executable.ts
|
|
4803
|
+
// src/mcp/codex-native-executable.ts
|
|
4789
4804
|
async function resolveCodexNativeExecutable(command, env) {
|
|
4790
4805
|
const candidates = command.includes(sep) || isAbsolute(command) ? [resolve(command)] : (env.PATH ?? "").split(delimiter).filter(Boolean).map((entry) => join(entry, command));
|
|
4791
4806
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -4925,8 +4940,7 @@ function sha256File(path) {
|
|
|
4925
4940
|
stream.on("end", () => resolveDigest(hash.digest("hex")));
|
|
4926
4941
|
});
|
|
4927
4942
|
}
|
|
4928
|
-
|
|
4929
|
-
//#region src/mcp/codex-home-isolation.ts
|
|
4943
|
+
// src/mcp/codex-home-isolation.ts
|
|
4930
4944
|
const CODEX_AUTH_ENV = [
|
|
4931
4945
|
"CODEX_ACCESS_TOKEN",
|
|
4932
4946
|
"CODEX_API_KEY",
|
|
@@ -5114,8 +5128,7 @@ async function normalizeReadDeniedPaths(paths) {
|
|
|
5114
5128
|
}
|
|
5115
5129
|
return [...normalized].sort();
|
|
5116
5130
|
}
|
|
5117
|
-
|
|
5118
|
-
//#region src/mcp/codex-token-usage.ts
|
|
5131
|
+
// src/mcp/codex-token-usage.ts
|
|
5119
5132
|
/**
|
|
5120
5133
|
* Parse and validate the one terminal usage event emitted by `codex exec --json`.
|
|
5121
5134
|
*
|
|
@@ -5147,9 +5160,8 @@ function parseCodexTokenUsage(stdout) {
|
|
|
5147
5160
|
...record.cacheWriteInputTokens === void 0 ? {} : { cacheWriteInputTokens: record.cacheWriteInputTokens }
|
|
5148
5161
|
};
|
|
5149
5162
|
}
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
const DEFAULT_MAX_OUTPUT_BYTES = 64 * 1024 * 1024;
|
|
5163
|
+
// src/mcp/local-harness-process.ts
|
|
5164
|
+
const DEFAULT_MAX_OUTPUT_BYTES = 67108864;
|
|
5153
5165
|
var RollingByteCapture = class {
|
|
5154
5166
|
maxBytes;
|
|
5155
5167
|
chunks = [];
|
|
@@ -5317,8 +5329,10 @@ async function runLocalHarness(options) {
|
|
|
5317
5329
|
aborted = true;
|
|
5318
5330
|
terminate();
|
|
5319
5331
|
};
|
|
5320
|
-
if (options.signal)
|
|
5321
|
-
|
|
5332
|
+
if (options.signal) {
|
|
5333
|
+
if (options.signal.aborted) onAbort();
|
|
5334
|
+
else options.signal.addEventListener("abort", onAbort, { once: true });
|
|
5335
|
+
}
|
|
5322
5336
|
child.stdout?.on("data", (chunk) => {
|
|
5323
5337
|
stdoutCapture.append(chunk);
|
|
5324
5338
|
});
|
|
@@ -5392,8 +5406,7 @@ async function runLocalHarness(options) {
|
|
|
5392
5406
|
await isolated.cleanup();
|
|
5393
5407
|
}
|
|
5394
5408
|
}
|
|
5395
|
-
|
|
5396
|
-
//#region src/mcp/worktree.ts
|
|
5409
|
+
// src/mcp/worktree.ts
|
|
5397
5410
|
/**
|
|
5398
5411
|
*
|
|
5399
5412
|
* Git worktree helpers for the in-process delegation executor. Each
|
|
@@ -5550,8 +5563,7 @@ async function removeWorktree(options) {
|
|
|
5550
5563
|
if (removalError) throw removalError;
|
|
5551
5564
|
if (branchError) throw branchError;
|
|
5552
5565
|
}
|
|
5553
|
-
|
|
5554
|
-
//#region src/mcp/worktree-harness.ts
|
|
5566
|
+
// src/mcp/worktree-harness.ts
|
|
5555
5567
|
/**
|
|
5556
5568
|
*
|
|
5557
5569
|
* The ONE worktree-harness execution core. The physical act — run a supervisor-authored
|
|
@@ -5596,7 +5608,7 @@ async function runWorktreeHarness(opts) {
|
|
|
5596
5608
|
opts.signal?.throwIfAborted();
|
|
5597
5609
|
const runHarness = opts.runHarness ?? runLocalHarness;
|
|
5598
5610
|
const runCommand = opts.runCommand ?? defaultRunCommand;
|
|
5599
|
-
const checkTimeoutMs = opts.checkTimeoutMs ?? opts.harnessTimeoutMs ??
|
|
5611
|
+
const checkTimeoutMs = opts.checkTimeoutMs ?? opts.harnessTimeoutMs ?? 3e5;
|
|
5600
5612
|
const cap = opts.checkOutputCap ?? defaultCheckOutputCap;
|
|
5601
5613
|
assertSupportedWorktreeProfile(opts.profile, opts.harness);
|
|
5602
5614
|
assertSafeProfileResourcePaths(opts.profile);
|
|
@@ -5827,7 +5839,24 @@ function prepareWorktreeProfile(profile, harness) {
|
|
|
5827
5839
|
const workspaceProfile = materializationOnlyProfile(profile);
|
|
5828
5840
|
assertSupportedWorktreeProfile(profile, harness);
|
|
5829
5841
|
assertSafeProfileResourcePaths(profile);
|
|
5830
|
-
const
|
|
5842
|
+
const structural = materializeProfile(harness === "opencode" ? {
|
|
5843
|
+
...workspaceProfile,
|
|
5844
|
+
prompt: {
|
|
5845
|
+
systemPrompt: profile.prompt?.systemPrompt,
|
|
5846
|
+
appendSystemPrompt: profile.prompt?.appendSystemPrompt
|
|
5847
|
+
}
|
|
5848
|
+
} : workspaceProfile, harness, { binds: ["systemPrompt"] });
|
|
5849
|
+
assertWorkspacePlanSupported(structural);
|
|
5850
|
+
const native = harness === "opencode" ? {
|
|
5851
|
+
files: [],
|
|
5852
|
+
flags: []
|
|
5853
|
+
} : nativeSystemPrompt(harness, profile.prompt);
|
|
5854
|
+
for (const file of native.files) if (structural.files.some((existing) => existing.relPath === file.relPath)) throw new Error(`profile conflicts with reserved ${file.relPath}`);
|
|
5855
|
+
const plan = {
|
|
5856
|
+
...structural,
|
|
5857
|
+
files: [...structural.files, ...native.files],
|
|
5858
|
+
flags: [...structural.flags, ...native.flags]
|
|
5859
|
+
};
|
|
5831
5860
|
assertSafeMaterializedPaths(plan);
|
|
5832
5861
|
return {
|
|
5833
5862
|
plan,
|
|
@@ -5988,8 +6017,10 @@ async function runSettledCommand(opts) {
|
|
|
5988
6017
|
terminate().catch(fail);
|
|
5989
6018
|
}, opts.timeoutMs);
|
|
5990
6019
|
const onAbort = () => void terminate().catch(fail);
|
|
5991
|
-
if (opts.signal)
|
|
5992
|
-
|
|
6020
|
+
if (opts.signal) {
|
|
6021
|
+
if (opts.signal.aborted) onAbort();
|
|
6022
|
+
else opts.signal.addEventListener("abort", onAbort, { once: true });
|
|
6023
|
+
}
|
|
5993
6024
|
child.stdout?.on("data", (d) => stdout.push(String(d)));
|
|
5994
6025
|
child.stderr?.on("data", (d) => stderr.push(String(d)));
|
|
5995
6026
|
const finish = (fn) => {
|
|
@@ -6043,8 +6074,7 @@ async function defaultRunCommand(opts) {
|
|
|
6043
6074
|
output: result.stdout + result.stderr
|
|
6044
6075
|
};
|
|
6045
6076
|
}
|
|
6046
|
-
|
|
6047
|
-
//#region src/runtime/supervise/executor-seams.ts
|
|
6077
|
+
// src/runtime/supervise/executor-seams.ts
|
|
6048
6078
|
function assertExactConfigKeys(value, allowed, context) {
|
|
6049
6079
|
const unknown = Object.keys(value).filter((key) => !allowed.has(key));
|
|
6050
6080
|
if (unknown.length > 0) throw new ValidationError$1(`${context}: unknown fields ${unknown.sort().join(", ")}; execution behavior belongs in AgentProfile`);
|
|
@@ -6071,8 +6101,7 @@ function readOptionalMcpAttachments(ctx, key, who) {
|
|
|
6071
6101
|
if (entries === void 0 || entries.length === 0 || entries.some(([, server]) => server === null || typeof server !== "object")) throw new ValidationError$1(`${who} executor: seam ${JSON.stringify(key)} must be a non-empty map of MCP servers`);
|
|
6072
6102
|
return value;
|
|
6073
6103
|
}
|
|
6074
|
-
|
|
6075
|
-
//#region src/runtime/supervise/bridge-config.ts
|
|
6104
|
+
// src/runtime/supervise/bridge-config.ts
|
|
6076
6105
|
const bridgeSeamKey = "bridge";
|
|
6077
6106
|
/** Internal control seam used by Runtime-owned external supervisors. A completion request stops
|
|
6078
6107
|
* the next bridge turn; it must not abort the paid request that is already streaming. */
|
|
@@ -6156,8 +6185,7 @@ async function resolveBridgeModelCredential(credential, context) {
|
|
|
6156
6185
|
baseUrl: resolveProtectedModelBaseUrl(baseUrl, context)
|
|
6157
6186
|
};
|
|
6158
6187
|
}
|
|
6159
|
-
|
|
6160
|
-
//#region src/runtime/supervise/abortable.ts
|
|
6188
|
+
// src/runtime/supervise/abortable.ts
|
|
6161
6189
|
/** Provenance of an explicit cancellation, preserved through every abort link. */
|
|
6162
6190
|
var RunCancellationReason = class extends Error {
|
|
6163
6191
|
source;
|
|
@@ -6297,8 +6325,7 @@ async function runAbortable(act, signal, fallback) {
|
|
|
6297
6325
|
});
|
|
6298
6326
|
});
|
|
6299
6327
|
}
|
|
6300
|
-
|
|
6301
|
-
//#region src/runtime/supervise/trace-source.ts
|
|
6328
|
+
// src/runtime/supervise/trace-source.ts
|
|
6302
6329
|
/** Project a normalized tool step into the canonical agent-eval `ToolSpan`. When the step carries
|
|
6303
6330
|
* real wall-clock (`startedAt`/`endedAt`) the span gets a true duration; otherwise it collapses to
|
|
6304
6331
|
* the single instant `at` (order + counts only — the historical behavior). A step whose source
|
|
@@ -6452,8 +6479,7 @@ function decodeBoxPart(part, harness) {
|
|
|
6452
6479
|
if (!p) return void 0;
|
|
6453
6480
|
return decodeOpencodePart(p) ?? decodeToolPart(part, harness);
|
|
6454
6481
|
}
|
|
6455
|
-
|
|
6456
|
-
//#region src/runtime/supervise/bridge-protocol.ts
|
|
6482
|
+
// src/runtime/supervise/bridge-protocol.ts
|
|
6457
6483
|
/** Decode Bridge stream and materialization receipts without owning transport or executor state. */
|
|
6458
6484
|
const bridgeProfileMaterializationSchema = "cli-bridge.profile-materialization.v2";
|
|
6459
6485
|
/**
|
|
@@ -6717,7 +6743,8 @@ function decodeBridgeToolCalls(raw) {
|
|
|
6717
6743
|
if (!call || typeof call !== "object") continue;
|
|
6718
6744
|
const record = call;
|
|
6719
6745
|
const fn = record.function;
|
|
6720
|
-
const
|
|
6746
|
+
const named = typeof fn?.name === "string" && fn.name.length > 0;
|
|
6747
|
+
const step = decodeOpenAiPart(named ? {
|
|
6721
6748
|
...record,
|
|
6722
6749
|
type: "function"
|
|
6723
6750
|
} : record);
|
|
@@ -6845,6 +6872,7 @@ function parseSseFrame(frame) {
|
|
|
6845
6872
|
error: bridgeUpstreamError(parsed.error, "bridgeExecutor: bridge stream error")
|
|
6846
6873
|
};
|
|
6847
6874
|
const out = {};
|
|
6875
|
+
if (Object.hasOwn(parsed, "final_output")) out.finalOutput = { value: parsed.final_output };
|
|
6848
6876
|
if (parsed.model !== void 0) {
|
|
6849
6877
|
if (typeof parsed.model !== "string" || parsed.model.length === 0) throw new ValidationError$1("bridgeExecutor: bridge response model must be a non-empty string");
|
|
6850
6878
|
out.model = parsed.model;
|
|
@@ -6921,8 +6949,7 @@ function applyBridgeCostReceipt(out, usage) {
|
|
|
6921
6949
|
out.costKnown = false;
|
|
6922
6950
|
if (estimatedCost !== void 0) out.estimatedCost = estimatedCost;
|
|
6923
6951
|
}
|
|
6924
|
-
|
|
6925
|
-
//#region src/runtime/codex-rollout-store.ts
|
|
6952
|
+
// src/runtime/codex-rollout-store.ts
|
|
6926
6953
|
const zeroCounters = {
|
|
6927
6954
|
input: 0,
|
|
6928
6955
|
output: 0,
|
|
@@ -7399,8 +7426,7 @@ function uuidV7TimestampMs(value) {
|
|
|
7399
7426
|
function naturalNumber(value) {
|
|
7400
7427
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : void 0;
|
|
7401
7428
|
}
|
|
7402
|
-
|
|
7403
|
-
//#region src/pricing/router-prices.generated.ts
|
|
7429
|
+
// src/pricing/router-prices.generated.ts
|
|
7404
7430
|
/** The Router catalog file and commit these prices were copied from. */
|
|
7405
7431
|
const ROUTER_PRICE_SOURCE = {
|
|
7406
7432
|
repository: "tangle-network/tangle-router",
|
|
@@ -7823,8 +7849,7 @@ const ROUTER_TOKEN_PRICES = {
|
|
|
7823
7849
|
output: 44e-7
|
|
7824
7850
|
}
|
|
7825
7851
|
};
|
|
7826
|
-
|
|
7827
|
-
//#region src/pricing/router-prices.ts
|
|
7852
|
+
// src/pricing/router-prices.ts
|
|
7828
7853
|
/**
|
|
7829
7854
|
* Model prices from the Router's catalog, the one source of model prices.
|
|
7830
7855
|
*
|
|
@@ -7872,8 +7897,7 @@ function priceTokens(work) {
|
|
|
7872
7897
|
].every(count$1)) return void 0;
|
|
7873
7898
|
return Math.max(0, work.inputTokens - cacheRead - cacheWrite) * price.input + cacheRead * (price.cachedInput ?? price.input) + cacheWrite * (price.cacheWrite ?? price.input) + work.outputTokens * price.output;
|
|
7874
7899
|
}
|
|
7875
|
-
|
|
7876
|
-
//#region src/runtime/supervise/cost-estimate.ts
|
|
7900
|
+
// src/runtime/supervise/cost-estimate.ts
|
|
7877
7901
|
/**
|
|
7878
7902
|
* Pricing for work that arrived without a provider receipt.
|
|
7879
7903
|
*
|
|
@@ -7916,8 +7940,7 @@ function priceUnreceiptedWork(work) {
|
|
|
7916
7940
|
provenance: "catalog-estimate"
|
|
7917
7941
|
};
|
|
7918
7942
|
}
|
|
7919
|
-
|
|
7920
|
-
//#region src/runtime/supervise/bridge-session-ledger.ts
|
|
7943
|
+
// src/runtime/supervise/bridge-session-ledger.ts
|
|
7921
7944
|
function newTurnTally() {
|
|
7922
7945
|
return {
|
|
7923
7946
|
text: "",
|
|
@@ -8009,6 +8032,7 @@ var BridgeSessionLedger = class {
|
|
|
8009
8032
|
turns = 0;
|
|
8010
8033
|
transportAttempts = 0;
|
|
8011
8034
|
lastText = "";
|
|
8035
|
+
lastFinalOutput;
|
|
8012
8036
|
observedModel;
|
|
8013
8037
|
observedSystemFingerprint;
|
|
8014
8038
|
toolCalls = [];
|
|
@@ -8140,7 +8164,7 @@ var BridgeSessionLedger = class {
|
|
|
8140
8164
|
this.usd += priced.usd;
|
|
8141
8165
|
return priced;
|
|
8142
8166
|
}
|
|
8143
|
-
artifact(sessionId, startedAt) {
|
|
8167
|
+
artifact(sessionId, startedAt, outputFormat) {
|
|
8144
8168
|
const spent = {
|
|
8145
8169
|
iterations: this.turns,
|
|
8146
8170
|
tokens: this.tokens,
|
|
@@ -8152,7 +8176,8 @@ var BridgeSessionLedger = class {
|
|
|
8152
8176
|
...this.tokensProvenance === void 0 || this.tokensProvenance === "stream-receipt" ? {} : { tokensProvenance: this.tokensProvenance }
|
|
8153
8177
|
};
|
|
8154
8178
|
const { observedModel, observedSystemFingerprint, promptCache, tokensUnknownReason } = this;
|
|
8155
|
-
|
|
8179
|
+
if (outputFormat === "json" && this.lastFinalOutput === void 0) throw new ValidationError$1("bridgeExecutor: successful graph turn omitted Bridge final_output JSON");
|
|
8180
|
+
const out = outputFormat === "json" ? this.lastFinalOutput.value : {
|
|
8156
8181
|
content: this.lastText,
|
|
8157
8182
|
...observedModel !== void 0 ? { model: observedModel } : {},
|
|
8158
8183
|
...observedSystemFingerprint ? { system_fingerprint: observedSystemFingerprint } : {},
|
|
@@ -8166,15 +8191,14 @@ var BridgeSessionLedger = class {
|
|
|
8166
8191
|
outRef: contentRef("bridge", {
|
|
8167
8192
|
model: observedModel ?? null,
|
|
8168
8193
|
session: sessionId,
|
|
8169
|
-
|
|
8194
|
+
output: out
|
|
8170
8195
|
}),
|
|
8171
8196
|
out,
|
|
8172
8197
|
spent
|
|
8173
8198
|
};
|
|
8174
8199
|
}
|
|
8175
8200
|
};
|
|
8176
|
-
|
|
8177
|
-
//#region src/runtime/supervise/bridge-transport.ts
|
|
8201
|
+
// src/runtime/supervise/bridge-transport.ts
|
|
8178
8202
|
/** Exact Bridge run admission, HTTP transport, ordered reconnect, and acknowledged cancellation. */
|
|
8179
8203
|
const bridgeModelCredentialHeader = "x-cli-bridge-model-credential";
|
|
8180
8204
|
const bridgeModelBaseUrlHeader = "x-cli-bridge-model-base-url";
|
|
@@ -8721,8 +8745,7 @@ function providerDispatchFromErrorBody(body) {
|
|
|
8721
8745
|
if (typeof error !== "object" || error === null) return void 0;
|
|
8722
8746
|
return error.provider_dispatch === "not_started" ? "not_started" : void 0;
|
|
8723
8747
|
}
|
|
8724
|
-
|
|
8725
|
-
//#region src/runtime/supervise/bridge-turn-signals.ts
|
|
8748
|
+
// src/runtime/supervise/bridge-turn-signals.ts
|
|
8726
8749
|
/**
|
|
8727
8750
|
* Why one cli-bridge turn's request is aborted: external teardown or abort, a forceful interrupt
|
|
8728
8751
|
* steer, the turn's own deadline, or model silence. Each turn owns one, and `cleanup` detaches it.
|
|
@@ -8773,18 +8796,16 @@ var BridgeTurnSignals = class {
|
|
|
8773
8796
|
if (this.silenceTimer !== void 0) clearTimeout(this.silenceTimer);
|
|
8774
8797
|
}
|
|
8775
8798
|
};
|
|
8776
|
-
|
|
8777
|
-
//#region src/finite-number.ts
|
|
8799
|
+
// src/finite-number.ts
|
|
8778
8800
|
function isFiniteNumber(value) {
|
|
8779
8801
|
return typeof value === "number" && Number.isFinite(value);
|
|
8780
8802
|
}
|
|
8781
|
-
|
|
8782
|
-
//#region src/runtime/supervise/continuation.ts
|
|
8803
|
+
// src/runtime/supervise/continuation.ts
|
|
8783
8804
|
/**
|
|
8784
8805
|
* The continuation: what a manager with a completion check is told when its turn ends and the
|
|
8785
8806
|
* check is unmet, and the one rule that decides whether it is sent back.
|
|
8786
8807
|
*
|
|
8787
|
-
* Measured on discovery-lab before this module (
|
|
8808
|
+
* Measured on discovery-lab before this module (670 settled runs, 1,596 re-entries):
|
|
8788
8809
|
* 1,565 re-entries followed a failed turn and resent the original task, and 31 carried note text.
|
|
8789
8810
|
* The note Runtime wrote itself held seven fixed lines and no field for the check's verdict. Of 40
|
|
8790
8811
|
* episodes where the director ended on its own and the outside check disagreed, 33 were told
|
|
@@ -9243,30 +9264,7 @@ function createContinuationKeeper(input) {
|
|
|
9243
9264
|
}
|
|
9244
9265
|
};
|
|
9245
9266
|
}
|
|
9246
|
-
|
|
9247
|
-
//#region src/runtime/supervise/completion-gate.ts
|
|
9248
|
-
/**
|
|
9249
|
-
*
|
|
9250
|
-
* The completion-oracle: **settled ⟺ DELIVERED.**
|
|
9251
|
-
*
|
|
9252
|
-
* Foreman's one hard lesson (0/18 self-improvement deliverables) — "done" must mean a check
|
|
9253
|
-
* PASSED, not the agent's say-so. `gateOnDeliverable` wraps an `Executor` so its settlement
|
|
9254
|
-
* is `valid` ONLY when the deliverable check passes. The child still RUNS and settles (its
|
|
9255
|
-
* spend is conserved into the pool either way), but a child that ran WITHOUT delivering
|
|
9256
|
-
* settles `valid:false` — so a keep-best driver never counts it as done, and a gate never
|
|
9257
|
-
* inflates with self-judged wins.
|
|
9258
|
-
*
|
|
9259
|
-
* Dual-purpose by construction:
|
|
9260
|
-
* - product: the agent fleet only advances on real, checked deliverables.
|
|
9261
|
-
* - proof: the gate's `valid` is the honest settle — equal-k comparisons can't be gamed by an
|
|
9262
|
-
* arm that "ran" without producing the artifact.
|
|
9263
|
-
*
|
|
9264
|
-
* The check is a DEPLOYABLE oracle — a test command, a state verifier, the commit0 judge —
|
|
9265
|
-
* read off the child's output, never the model judging itself. A throwing check is
|
|
9266
|
-
* fail-closed (not delivered), never a crash.
|
|
9267
|
-
*
|
|
9268
|
-
* @experimental
|
|
9269
|
-
*/
|
|
9267
|
+
// src/runtime/supervise/completion-gate.ts
|
|
9270
9268
|
/**
|
|
9271
9269
|
* Wrap an `Executor` so its settlement `valid` reflects the deliverable check, not the
|
|
9272
9270
|
* inner verdict. Handles both `execute` shapes (one-shot `Promise<ExecutorResult>` and
|
|
@@ -9279,17 +9277,24 @@ function gateOnDeliverable(inner, deliverable) {
|
|
|
9279
9277
|
/** Build a worker with the same check on durable acceptance and normal completion. @internal */
|
|
9280
9278
|
function gateFactoryOnDeliverable(factory, deliverable) {
|
|
9281
9279
|
return (spec, ctx) => {
|
|
9280
|
+
const profile = detachedSnapshot(spec.profile, "completion check profile");
|
|
9281
|
+
const node = ctx.node === void 0 ? void 0 : detachedSnapshot(ctx.node, "completion check node");
|
|
9282
9282
|
const retention = retainedExecutorContext(ctx);
|
|
9283
|
-
if (retention === void 0) return gateOnDeliverable(factory(spec, ctx), deliverable);
|
|
9284
9283
|
const verdicts = /* @__PURE__ */ new WeakMap();
|
|
9285
9284
|
const check = (result) => {
|
|
9286
9285
|
let verdict = verdicts.get(result);
|
|
9287
9286
|
if (verdict === void 0) {
|
|
9288
|
-
verdict = checkDeliverable(deliverable, result
|
|
9287
|
+
verdict = checkDeliverable(deliverable, result, Object.freeze({
|
|
9288
|
+
profile,
|
|
9289
|
+
node,
|
|
9290
|
+
signal: ctx.signal,
|
|
9291
|
+
originalVerdict: result.verdict === void 0 ? void 0 : detachedSnapshot(result.verdict, "completion check original verdict")
|
|
9292
|
+
}));
|
|
9289
9293
|
verdicts.set(result, verdict);
|
|
9290
9294
|
}
|
|
9291
9295
|
return verdict;
|
|
9292
9296
|
};
|
|
9297
|
+
if (retention === void 0) return wrapCompletionGate(factory(spec, ctx), check);
|
|
9293
9298
|
const checkedRetention = (source) => ({
|
|
9294
9299
|
...source,
|
|
9295
9300
|
onResult: async (result) => source.onResult({
|
|
@@ -9307,10 +9312,10 @@ function gateFactoryOnDeliverable(factory, deliverable) {
|
|
|
9307
9312
|
}), check);
|
|
9308
9313
|
};
|
|
9309
9314
|
}
|
|
9310
|
-
async function checkDeliverable(deliverable, result) {
|
|
9315
|
+
async function checkDeliverable(deliverable, result, context) {
|
|
9311
9316
|
let delivered;
|
|
9312
9317
|
try {
|
|
9313
|
-
delivered = checkVerdictOf(await deliverable.check(result.out)).pass;
|
|
9318
|
+
delivered = checkVerdictOf(await deliverable.check(result.out, context)).pass;
|
|
9314
9319
|
} catch {
|
|
9315
9320
|
delivered = false;
|
|
9316
9321
|
}
|
|
@@ -9363,6 +9368,9 @@ function wrapCompletionGate(inner, check) {
|
|
|
9363
9368
|
runtime: inner.runtime,
|
|
9364
9369
|
...inner.budgetExempt !== void 0 ? { budgetExempt: inner.budgetExempt } : {},
|
|
9365
9370
|
...inner.deliver ? { deliver: (m) => inner.deliver?.(m) } : {},
|
|
9371
|
+
...inner.cancel ? { cancel: (request) => inner.cancel(request) } : {},
|
|
9372
|
+
...inner.interactive ? { interactive: () => inner.interactive() } : {},
|
|
9373
|
+
...inner.interactiveReady ? { interactiveReady: () => inner.interactiveReady() } : {},
|
|
9366
9374
|
...inner.progress ? { progress: () => inner.progress?.() } : {},
|
|
9367
9375
|
...inner.traceSource ? { traceSource: () => inner.traceSource?.() } : {},
|
|
9368
9376
|
...inner.metered ? { metered: () => inner.metered?.() } : {},
|
|
@@ -9401,24 +9409,28 @@ function mapExecutorResult(inner, map) {
|
|
|
9401
9409
|
};
|
|
9402
9410
|
return mapped;
|
|
9403
9411
|
};
|
|
9412
|
+
const mapExecution = (execution, task) => {
|
|
9413
|
+
if (isAsyncIterable(execution)) return (async function* () {
|
|
9414
|
+
for await (const event of execution) yield event;
|
|
9415
|
+
await settle(inner.resultArtifact(), task);
|
|
9416
|
+
})();
|
|
9417
|
+
return (async () => settle(await execution, task))();
|
|
9418
|
+
};
|
|
9404
9419
|
return inheritRuntimeOwnedExecutorAttestation(inner, {
|
|
9405
9420
|
runtime: inner.runtime,
|
|
9406
9421
|
...inner.budgetExempt !== void 0 ? { budgetExempt: inner.budgetExempt } : {},
|
|
9407
9422
|
...inner.deliver ? { deliver: (message) => inner.deliver?.(message) } : {},
|
|
9423
|
+
...inner.cancel ? { cancel: (request) => inner.cancel(request) } : {},
|
|
9424
|
+
...inner.interactive ? { interactive: () => inner.interactive() } : {},
|
|
9425
|
+
...inner.interactiveReady ? { interactiveReady: () => inner.interactiveReady() } : {},
|
|
9408
9426
|
...inner.progress ? { progress: () => inner.progress?.() } : {},
|
|
9409
9427
|
...inner.traceSource ? { traceSource: () => inner.traceSource?.() } : {},
|
|
9410
9428
|
...inner.accounting ? { accounting: () => inner.accounting?.() } : {},
|
|
9411
9429
|
...inner.metered ? { metered: () => inner.metered?.() } : {},
|
|
9412
9430
|
...inner.harnessTranscript ? { harnessTranscript: () => inner.harnessTranscript?.() } : {},
|
|
9413
9431
|
...inner.harnessTranscriptSettled ? { harnessTranscriptSettled: () => inner.harnessTranscriptSettled?.() ?? Promise.resolve() } : {},
|
|
9414
|
-
execute(task, signal)
|
|
9415
|
-
|
|
9416
|
-
if (isAsyncIterable(execution)) return (async function* () {
|
|
9417
|
-
for await (const event of execution) yield event;
|
|
9418
|
-
await settle(inner.resultArtifact(), task);
|
|
9419
|
-
})();
|
|
9420
|
-
return (async () => settle(await execution, task))();
|
|
9421
|
-
},
|
|
9432
|
+
execute: (task, signal) => mapExecution(inner.execute(task, signal), task),
|
|
9433
|
+
...inner.recover ? { recover: (task, signal) => mapExecution(inner.recover(task, signal), task) } : {},
|
|
9422
9434
|
teardown: (grace) => inner.teardown(grace),
|
|
9423
9435
|
...teardownSurfaces(inner),
|
|
9424
9436
|
resultArtifact() {
|
|
@@ -9460,8 +9472,7 @@ function verdictFromJudgeScore(score, threshold) {
|
|
|
9460
9472
|
...review === "" ? {} : { review }
|
|
9461
9473
|
});
|
|
9462
9474
|
}
|
|
9463
|
-
|
|
9464
|
-
//#region src/runtime/supervise/seat-chain.ts
|
|
9475
|
+
// src/runtime/supervise/seat-chain.ts
|
|
9465
9476
|
var SeatChainExhaustedError = class extends Error {
|
|
9466
9477
|
resumeAt;
|
|
9467
9478
|
constructor(resumeAt) {
|
|
@@ -9648,7 +9659,8 @@ function seatExecutionProfile(profile, stage) {
|
|
|
9648
9659
|
model: {
|
|
9649
9660
|
...profile.model,
|
|
9650
9661
|
default: stage.model,
|
|
9651
|
-
provider: stage.provider
|
|
9662
|
+
provider: stage.provider,
|
|
9663
|
+
...stage.reasoningEffort === void 0 ? {} : { reasoningEffort: stage.reasoningEffort }
|
|
9652
9664
|
}
|
|
9653
9665
|
};
|
|
9654
9666
|
}
|
|
@@ -9682,8 +9694,7 @@ function checkedSeatSelection(stage, selected) {
|
|
|
9682
9694
|
if (selected.backend.backend !== "provider") throw new ValidationError$1("selectSeat: selection must use a provider backend");
|
|
9683
9695
|
return selected;
|
|
9684
9696
|
}
|
|
9685
|
-
|
|
9686
|
-
//#region src/runtime/supervise/driver-attempt-evidence.ts
|
|
9697
|
+
// src/runtime/supervise/driver-attempt-evidence.ts
|
|
9687
9698
|
/** Longest cause chain read for a `PartialFailureError`; the failing box's error sits one or two wrappers down. */
|
|
9688
9699
|
const PARTIAL_FAILURE_CAUSE_DEPTH = 6;
|
|
9689
9700
|
/**
|
|
@@ -9727,15 +9738,16 @@ function abandonablePending(error) {
|
|
|
9727
9738
|
const DETERMINISTIC_BRIDGE_CODES = /* @__PURE__ */ new Set([
|
|
9728
9739
|
"parse_error",
|
|
9729
9740
|
"not_configured",
|
|
9730
|
-
"capability_denied"
|
|
9741
|
+
"capability_denied",
|
|
9742
|
+
"MODEL_NOT_FOUND",
|
|
9743
|
+
"SEAT_NOT_LOGGED_IN"
|
|
9731
9744
|
]);
|
|
9732
9745
|
/**
|
|
9733
9746
|
* A driver's harness turn ran to its terminal result, and that result reported failure.
|
|
9734
9747
|
*
|
|
9735
9748
|
* A provider executor reports a failed turn as a returned outcome, not a thrown error, so without
|
|
9736
9749
|
* this error a failed turn reads as a completed drive and never reaches the retry decision.
|
|
9737
|
-
*
|
|
9738
|
-
* a 53-minute turn ended `status code 524`, and another ended `Invalid API key` after a platform
|
|
9750
|
+
* A 53-minute turn ended `status code 524`, and another ended `Invalid API key` after a platform
|
|
9739
9751
|
* key expired mid-turn. A new turn succeeds in both cases.
|
|
9740
9752
|
*
|
|
9741
9753
|
* `errorCode` is the provider's machine code when it reported one. The classifier reads the code
|
|
@@ -9919,7 +9931,7 @@ function retainedAdmissionCause(error) {
|
|
|
9919
9931
|
*
|
|
9920
9932
|
* A provider SDK throws its own error classes, so an environment `create` that the platform
|
|
9921
9933
|
* refused arrives here as neither a `BackendTransportError` nor an `AgentEvalError`, and the
|
|
9922
|
-
* default sends it to `transient`.
|
|
9934
|
+
* default sends it to `transient`. A Tangle Sandbox create refused
|
|
9923
9935
|
* `HTTP 400 {"code":"CONFIG_ERROR"}` for a key whose budget was fully reserved retried 14-22
|
|
9924
9936
|
* times per node while the run showed a durable intent and no other event, so eleven of twelve
|
|
9925
9937
|
* roots sat for 25 minutes with nothing to diagnose. The status was on the error the whole time.
|
|
@@ -9974,8 +9986,7 @@ function summarizeDriverAttempts(records) {
|
|
|
9974
9986
|
...last?.repromptRefusedBy === void 0 ? {} : { repromptRefusedBy: last.repromptRefusedBy }
|
|
9975
9987
|
};
|
|
9976
9988
|
}
|
|
9977
|
-
|
|
9978
|
-
//#region src/runtime/supervise/node-status.ts
|
|
9989
|
+
// src/runtime/supervise/node-status.ts
|
|
9979
9990
|
/** Which {@link NodeStatus} values mean the node is finished. */
|
|
9980
9991
|
const terminalNodeStatuses = /* @__PURE__ */ new Set([
|
|
9981
9992
|
"done",
|
|
@@ -9998,8 +10009,7 @@ function isTerminalNodeStatus(status) {
|
|
|
9998
10009
|
function isLiveNodeStatus(status) {
|
|
9999
10010
|
return !terminalNodeStatuses.has(status);
|
|
10000
10011
|
}
|
|
10001
|
-
|
|
10002
|
-
//#region src/runtime/supervise/progress.ts
|
|
10012
|
+
// src/runtime/supervise/progress.ts
|
|
10003
10013
|
/**
|
|
10004
10014
|
*
|
|
10005
10015
|
* The LIVE read-model of a still-RUNNING worker — what a driver can see BEFORE the worker settles.
|
|
@@ -10093,8 +10103,7 @@ function readWorkerProgress(scope, executor, now, stallAfterMs = DEFAULT_STALL_A
|
|
|
10093
10103
|
...scope.team ? { team: scope.team } : {}
|
|
10094
10104
|
};
|
|
10095
10105
|
}
|
|
10096
|
-
|
|
10097
|
-
//#region src/runtime/supervise/task-prompt.ts
|
|
10106
|
+
// src/runtime/supervise/task-prompt.ts
|
|
10098
10107
|
/**
|
|
10099
10108
|
*
|
|
10100
10109
|
* The one rule for reading a leaf task as prompt text. A `Scope` task is opaque (`unknown`) and
|
|
@@ -10123,8 +10132,7 @@ function taskToPrompt$1(task) {
|
|
|
10123
10132
|
}
|
|
10124
10133
|
return JSON.stringify(task);
|
|
10125
10134
|
}
|
|
10126
|
-
|
|
10127
|
-
//#region src/runtime/supervise/bridge-session-stream.ts
|
|
10135
|
+
// src/runtime/supervise/bridge-session-stream.ts
|
|
10128
10136
|
/** One resumable cli-bridge session as a streamed turn loop: turn 0 sends the task, each later
|
|
10129
10137
|
* turn fires ONLY when the inbox has a steer/answer to fold, re-calling the SAME `session_id`.
|
|
10130
10138
|
* Mirrors `routerToolsInlineExecutor`'s take→turn→settle loop with a full harness call per turn. */
|
|
@@ -10178,7 +10186,10 @@ async function* streamBridgeSession(args) {
|
|
|
10178
10186
|
});
|
|
10179
10187
|
yield* ledger.settleTurn(activeRun.profileMaterialization?.inference?.observation?.usage, harnessStore, observation, seam.providerModel);
|
|
10180
10188
|
yield { kind: "iteration" };
|
|
10181
|
-
if (!interrupted
|
|
10189
|
+
if (!interrupted) {
|
|
10190
|
+
if (ledger.turn.text) ledger.lastText = ledger.turn.text;
|
|
10191
|
+
ledger.lastFinalOutput = ledger.turn.finalOutput;
|
|
10192
|
+
}
|
|
10182
10193
|
if (interrupted) {
|
|
10183
10194
|
observation.note = `turn ${ledger.turns} interrupted, resuming`;
|
|
10184
10195
|
continue;
|
|
@@ -10190,7 +10201,7 @@ async function* streamBridgeSession(args) {
|
|
|
10190
10201
|
if (inbox.pendingAuthority() === 0) break;
|
|
10191
10202
|
}
|
|
10192
10203
|
observation.note = "settled";
|
|
10193
|
-
args.onArtifact(ledger.artifact(args.sessionId, started));
|
|
10204
|
+
args.onArtifact(ledger.artifact(args.sessionId, started, seam.outputFormat));
|
|
10194
10205
|
}
|
|
10195
10206
|
/** The folded text of the messages this turn took, noted on the activity log; none when empty. */
|
|
10196
10207
|
function foldTurnMessages(turnLease, inbox, observation) {
|
|
@@ -10263,6 +10274,7 @@ async function* streamBridgeTurn(args, turn) {
|
|
|
10263
10274
|
const requestBody = {
|
|
10264
10275
|
model: seam.model,
|
|
10265
10276
|
stream: true,
|
|
10277
|
+
...seam.outputFormat === "json" ? { response_format: { type: "json_object" } } : {},
|
|
10266
10278
|
run_id: activeRun.id,
|
|
10267
10279
|
session_id: args.sessionId,
|
|
10268
10280
|
...seam.cwd ? { cwd: seam.cwd } : {},
|
|
@@ -10372,6 +10384,10 @@ function observeChunkIdentity(chunk, ledger, args) {
|
|
|
10372
10384
|
/** The model output and tool steps a chunk carried, mirrored locally before each is published. */
|
|
10373
10385
|
function* chunkProgress(chunk, ledger, args) {
|
|
10374
10386
|
const { observation } = args;
|
|
10387
|
+
if (chunk.finalOutput) {
|
|
10388
|
+
if (ledger.turn.finalOutput !== void 0) throw new ValidationError$1("bridgeExecutor: multiple final_output values in one turn");
|
|
10389
|
+
ledger.turn.finalOutput = chunk.finalOutput;
|
|
10390
|
+
}
|
|
10375
10391
|
if (chunk.content) {
|
|
10376
10392
|
ledger.turn.text += chunk.content;
|
|
10377
10393
|
yield {
|
|
@@ -10441,8 +10457,7 @@ function mergeBridgeObservedModel(current, next) {
|
|
|
10441
10457
|
if (merged === void 0) throw new ValidationError$1(`bridgeExecutor: bridge changed response model from ${JSON.stringify(current)} to ${JSON.stringify(next)}`);
|
|
10442
10458
|
return merged;
|
|
10443
10459
|
}
|
|
10444
|
-
|
|
10445
|
-
//#region src/runtime/supervise/peer-mail.ts
|
|
10460
|
+
// src/runtime/supervise/peer-mail.ts
|
|
10446
10461
|
/**
|
|
10447
10462
|
*
|
|
10448
10463
|
* PEER MAIL — the sibling-to-sibling channel, and the ONE place its bounds are enforced.
|
|
@@ -10739,13 +10754,12 @@ function peerMailTools(mailbox, capabilityId) {
|
|
|
10739
10754
|
handler: () => Promise.resolve({ ...mailbox.read(capabilityId) })
|
|
10740
10755
|
}];
|
|
10741
10756
|
}
|
|
10742
|
-
|
|
10743
|
-
//#region src/runtime/supervise/inbox.ts
|
|
10757
|
+
// src/runtime/supervise/inbox.ts
|
|
10744
10758
|
/**
|
|
10745
10759
|
*
|
|
10746
10760
|
* The worker-side receive end of the down-leg: a per-worker inbox an executor exposes as
|
|
10747
10761
|
* `Executor.deliver`. The driver's `steer_agent` / `answer_question` land here,
|
|
10748
|
-
* and the worker's agent loop takes them at two points
|
|
10762
|
+
* and the worker's agent loop takes them at two points:
|
|
10749
10763
|
*
|
|
10750
10764
|
* - QUEUED (default): the message accumulates and is taken at the next step boundary — folded
|
|
10751
10765
|
* into the conversation before the next think. A worker also takes before it may settle, so it
|
|
@@ -10792,7 +10806,7 @@ function peerMailTools(mailbox, capabilityId) {
|
|
|
10792
10806
|
*/
|
|
10793
10807
|
/** How long an authority message may wait unconsumed before it interrupts the turn in flight.
|
|
10794
10808
|
* Run 18b's queued steers took a median 52.5 min to reach a worker. */
|
|
10795
|
-
const AUTHORITY_PROMOTION_MS =
|
|
10809
|
+
const AUTHORITY_PROMOTION_MS = 9e5;
|
|
10796
10810
|
/** Wire key under which a sender passes its receipt callback beside a steer or answer. */
|
|
10797
10811
|
const INBOX_RECEIPT_KEY = "receipt";
|
|
10798
10812
|
function parseDown(msg) {
|
|
@@ -10972,8 +10986,7 @@ async function* failPendingAfter(inbox, stream) {
|
|
|
10972
10986
|
inbox.failPending(failure === void 0 ? "the recipient settled before a model turn read the message" : `the recipient's run failed before a model turn read the message: ${failure instanceof Error ? failure.message : String(failure)}`);
|
|
10973
10987
|
}
|
|
10974
10988
|
}
|
|
10975
|
-
|
|
10976
|
-
//#region src/runtime/supervise/worker-lineage.ts
|
|
10989
|
+
// src/runtime/supervise/worker-lineage.ts
|
|
10977
10990
|
/**
|
|
10978
10991
|
* Session lineage handed DOWN to a spawned worker: the `TANGLE_*` ids the operator's `lineage` tool
|
|
10979
10992
|
* (tangle-tools `lineage/`) stamps at every launch, so a supervised tree shows up in the cross-box
|
|
@@ -11106,7 +11119,8 @@ function sortKeys(value) {
|
|
|
11106
11119
|
}
|
|
11107
11120
|
function recordLaunch(env, ids, options) {
|
|
11108
11121
|
try {
|
|
11109
|
-
const
|
|
11122
|
+
const home = env.LINEAGE_HOME || join(homedir(), ".local", "state", "lineage");
|
|
11123
|
+
const dir = join(home, "events");
|
|
11110
11124
|
if (!existsSync(dir)) return;
|
|
11111
11125
|
const host = lineageHost(env);
|
|
11112
11126
|
const common = {
|
|
@@ -11149,8 +11163,7 @@ function recordLaunch(env, ids, options) {
|
|
|
11149
11163
|
});
|
|
11150
11164
|
} catch {}
|
|
11151
11165
|
}
|
|
11152
|
-
|
|
11153
|
-
//#region src/sanitize.ts
|
|
11166
|
+
// src/sanitize.ts
|
|
11154
11167
|
/** Strip PII and large blobs from a `KnowledgeReadinessReport` for safe telemetry emission. @stable */
|
|
11155
11168
|
function sanitizeKnowledgeReadinessReport(report, options = {}) {
|
|
11156
11169
|
return {
|
|
@@ -11529,8 +11542,7 @@ function createRuntimeStreamEventCollector(options = {}) {
|
|
|
11529
11542
|
}
|
|
11530
11543
|
};
|
|
11531
11544
|
}
|
|
11532
|
-
|
|
11533
|
-
//#region src/otel-export.ts
|
|
11545
|
+
// src/otel-export.ts
|
|
11534
11546
|
/**
|
|
11535
11547
|
* OTEL span exporter — streams LoopTraceEvents to an OTLP/HTTP collector.
|
|
11536
11548
|
*
|
|
@@ -12157,7 +12169,6 @@ function buildLoopSpanNodes(events, redact) {
|
|
|
12157
12169
|
flushRound(e.timestamp);
|
|
12158
12170
|
}
|
|
12159
12171
|
currentRoundId = void 0;
|
|
12160
|
-
break;
|
|
12161
12172
|
}
|
|
12162
12173
|
}
|
|
12163
12174
|
flushRound(rootEnd);
|
|
@@ -12229,8 +12240,7 @@ function generateSpanId() {
|
|
|
12229
12240
|
else for (let i = 0; i < 8; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
12230
12241
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
12231
12242
|
}
|
|
12232
|
-
|
|
12233
|
-
//#region src/mcp/trace-propagation.ts
|
|
12243
|
+
// src/mcp/trace-propagation.ts
|
|
12234
12244
|
/**
|
|
12235
12245
|
*
|
|
12236
12246
|
* Trace context propagation across process-spawn boundaries.
|
|
@@ -12369,8 +12379,7 @@ function generateTraceId() {
|
|
|
12369
12379
|
else for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
12370
12380
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
12371
12381
|
}
|
|
12372
|
-
|
|
12373
|
-
//#region src/runtime/supervise/worker-trace.ts
|
|
12382
|
+
// src/runtime/supervise/worker-trace.ts
|
|
12374
12383
|
/**
|
|
12375
12384
|
* Trace context handed DOWN to a spawned worker, so one supervised tree spans machines.
|
|
12376
12385
|
*
|
|
@@ -12506,8 +12515,7 @@ function workerTraceHeaders(ctx) {
|
|
|
12506
12515
|
...env.PARENT_SPAN_ID !== void 0 ? { "x-parent-span-id": env.PARENT_SPAN_ID } : {}
|
|
12507
12516
|
};
|
|
12508
12517
|
}
|
|
12509
|
-
|
|
12510
|
-
//#region src/runtime/supervise/bridge-executor.ts
|
|
12518
|
+
// src/runtime/supervise/bridge-executor.ts
|
|
12511
12519
|
/** Bridge executor lifecycle, steering, materialization, and measured usage. */
|
|
12512
12520
|
/** Resolve the exact bridge wire id from the profile and nowhere else. */
|
|
12513
12521
|
function bridgeProfileModel(profile, context) {
|
|
@@ -12536,6 +12544,7 @@ const bridgeExecutor = (spec, ctx) => {
|
|
|
12536
12544
|
...bridgeTokenLimits.applied.maxTokens !== void 0 ? { maxTokens: bridgeTokenLimits.applied.maxTokens } : {}
|
|
12537
12545
|
};
|
|
12538
12546
|
if (!seam.bridgeUrl || !seam.bridgeBearer) throw new ValidationError$1("bridgeExecutor: bridgeUrl + bridgeBearer are required");
|
|
12547
|
+
if (seam.outputFormat !== void 0 && seam.outputFormat !== "json") throw new ValidationError$1("bridgeExecutor: outputFormat must be json when supplied");
|
|
12539
12548
|
if (seam.timeoutMs !== void 0 && (!Number.isSafeInteger(seam.timeoutMs) || seam.timeoutMs < 1 || seam.timeoutMs > 2147483647)) throw new ValidationError$1(`bridgeExecutor: timeoutMs must be an integer from 1 to ${maxBridgeTimeoutMs}`);
|
|
12540
12549
|
if (seam.modelSilenceMs !== void 0 && (!Number.isSafeInteger(seam.modelSilenceMs) || seam.modelSilenceMs < 1 || seam.modelSilenceMs > 2147483647)) throw new ValidationError$1(`bridgeExecutor: modelSilenceMs must be an integer from 1 to ${maxBridgeTimeoutMs}`);
|
|
12541
12550
|
if (seam.maxReconnects !== void 0 && (!Number.isSafeInteger(seam.maxReconnects) || seam.maxReconnects < 0)) throw new ValidationError$1("bridgeExecutor: maxReconnects must be a nonnegative safe integer");
|
|
@@ -12775,8 +12784,7 @@ function scheduleBridgeRunStateRefresh(seam, activeRuns, observation) {
|
|
|
12775
12784
|
}
|
|
12776
12785
|
})();
|
|
12777
12786
|
}
|
|
12778
|
-
|
|
12779
|
-
//#region src/runtime/supervise/bridge-worktree-executor.ts
|
|
12787
|
+
// src/runtime/supervise/bridge-worktree-executor.ts
|
|
12780
12788
|
function bridgeWorktreeExecutor(spec, ctx, seam) {
|
|
12781
12789
|
const bridge = seam.bridge;
|
|
12782
12790
|
if (!bridge) throw new ValidationError$1("cliWorktreeExecutor: bridge transport missing");
|
|
@@ -12830,7 +12838,7 @@ function bridgeWorktreeExecutor(spec, ctx, seam) {
|
|
|
12830
12838
|
model,
|
|
12831
12839
|
testCmd: seam.testCmd ?? null,
|
|
12832
12840
|
typecheckCmd: seam.typecheckCmd ?? null,
|
|
12833
|
-
checkTimeoutMs: seam.checkTimeoutMs ?? seam.harnessTimeoutMs ?? bridge.timeoutMs ??
|
|
12841
|
+
checkTimeoutMs: seam.checkTimeoutMs ?? seam.harnessTimeoutMs ?? bridge.timeoutMs ?? 3e5,
|
|
12834
12842
|
checkOutputCap: seam.checkOutputCap ?? 16e3,
|
|
12835
12843
|
bridgeAcknowledgement: null
|
|
12836
12844
|
}
|
|
@@ -12877,14 +12885,15 @@ function bridgeWorktreeExecutor(spec, ctx, seam) {
|
|
|
12877
12885
|
...bridge.timeoutMs !== void 0 ? { timeoutMs: bridge.timeoutMs } : {},
|
|
12878
12886
|
...bridge.maxReconnects !== void 0 ? { maxReconnects: bridge.maxReconnects } : {}
|
|
12879
12887
|
};
|
|
12880
|
-
|
|
12888
|
+
const bridgeCtx = {
|
|
12881
12889
|
...ctx,
|
|
12882
12890
|
signal: linked,
|
|
12883
12891
|
seams: {
|
|
12884
12892
|
...ctx.seams,
|
|
12885
12893
|
[bridgeSeamKey]: bridgeSeam
|
|
12886
12894
|
}
|
|
12887
|
-
}
|
|
12895
|
+
};
|
|
12896
|
+
inner = bridgeExecutor(spec, bridgeCtx);
|
|
12888
12897
|
for (const msg of pending.splice(0)) inner.deliver?.(msg);
|
|
12889
12898
|
const run = inner.execute(task, linked);
|
|
12890
12899
|
if (isAsyncIterable(run)) {
|
|
@@ -12916,7 +12925,7 @@ function bridgeWorktreeExecutor(spec, ctx, seam) {
|
|
|
12916
12925
|
worktreePath: worktree.path,
|
|
12917
12926
|
...seam.testCmd !== void 0 ? { testCmd: seam.testCmd } : {},
|
|
12918
12927
|
...seam.typecheckCmd !== void 0 ? { typecheckCmd: seam.typecheckCmd } : {},
|
|
12919
|
-
timeoutMs: seam.checkTimeoutMs ?? seam.harnessTimeoutMs ?? bridge.timeoutMs ??
|
|
12928
|
+
timeoutMs: seam.checkTimeoutMs ?? seam.harnessTimeoutMs ?? bridge.timeoutMs ?? 3e5,
|
|
12920
12929
|
cap: seam.checkOutputCap ?? 16e3,
|
|
12921
12930
|
...seam.runCommand ? { runCommand: seam.runCommand } : {},
|
|
12922
12931
|
signal: linked
|
|
@@ -12990,8 +12999,7 @@ function bridgeOutputText(out) {
|
|
|
12990
12999
|
* `AgentProfile` driving claude / codex / opencode / pi / kimi-code on its own worktree. `budgetExempt` like
|
|
12991
13000
|
* the other CLI leaves; the authored systemPrompt + model reach the harness via §1.5.
|
|
12992
13001
|
*/
|
|
12993
|
-
|
|
12994
|
-
//#region src/runtime/supervise/in-place-cli-executor.ts
|
|
13002
|
+
// src/runtime/supervise/in-place-cli-executor.ts
|
|
12995
13003
|
/**
|
|
12996
13004
|
*
|
|
12997
13005
|
* The in-place CLI leaf executor — a supervisor-authored `AgentProfile` driving a local
|
|
@@ -13133,8 +13141,7 @@ function executionTaskPrompt$1(task, configuredPrompt) {
|
|
|
13133
13141
|
if (typeof prompt !== "string" || prompt.length === 0) throw new ValidationError$1("createInPlaceCliExecutor: execute task produced no prompt text");
|
|
13134
13142
|
return prompt;
|
|
13135
13143
|
}
|
|
13136
|
-
|
|
13137
|
-
//#region src/runtime/supervise/runtime-seams.ts
|
|
13144
|
+
// src/runtime/supervise/runtime-seams.ts
|
|
13138
13145
|
const sandboxCaptureOutputSeamKey = "runtime.sandboxCaptureOutput";
|
|
13139
13146
|
const routerSeamKey = "router";
|
|
13140
13147
|
const sandboxSeamKey = "sandbox";
|
|
@@ -13142,8 +13149,7 @@ const cliWorktreeSeamKey = "cli-worktree";
|
|
|
13142
13149
|
const cliInPlaceSeamKey = "cli-in-place";
|
|
13143
13150
|
const providerSeamKey = "provider";
|
|
13144
13151
|
const routerToolsSeamKey = "router-tools";
|
|
13145
|
-
|
|
13146
|
-
//#region src/runtime/supervise/worktree-cli-executor.ts
|
|
13152
|
+
// src/runtime/supervise/worktree-cli-executor.ts
|
|
13147
13153
|
/**
|
|
13148
13154
|
*
|
|
13149
13155
|
* The worktree-CLI leaf executor — a supervisor-authored `AgentProfile` driving a local
|
|
@@ -13324,8 +13330,7 @@ function executionTaskPrompt(task, configuredPrompt) {
|
|
|
13324
13330
|
}
|
|
13325
13331
|
throw new ValidationError$1("createWorktreeCliExecutor: execute task must be JSON-serializable");
|
|
13326
13332
|
}
|
|
13327
|
-
|
|
13328
|
-
//#region src/runtime/supervise/cli-executor-factories.ts
|
|
13333
|
+
// src/runtime/supervise/cli-executor-factories.ts
|
|
13329
13334
|
/** Executor factory for a CLI harness that runs in a git worktree of the caller's checkout. */
|
|
13330
13335
|
const cliWorktreeExecutor = (spec, ctx) => {
|
|
13331
13336
|
const seam = readSeam(ctx, cliWorktreeSeamKey, "cli-worktree");
|
|
@@ -13372,8 +13377,7 @@ const cliInPlaceExecutor = (spec, ctx) => {
|
|
|
13372
13377
|
...ctx.node?.attemptId !== void 0 ? { executionAttemptId: ctx.node.attemptId } : {}
|
|
13373
13378
|
});
|
|
13374
13379
|
};
|
|
13375
|
-
|
|
13376
|
-
//#region src/runtime/provider-placement.ts
|
|
13380
|
+
// src/runtime/provider-placement.ts
|
|
13377
13381
|
const placementMetadataKey = "runtimeProviderPlacement";
|
|
13378
13382
|
/** Select exactly one declaration before any provider effects. Shared defaults carry infrastructure only. */
|
|
13379
13383
|
function selectProviderPlacement(profile, options) {
|
|
@@ -13485,8 +13489,7 @@ function publicCreateOptions(create) {
|
|
|
13485
13489
|
...secrets === void 0 ? {} : { secretNames: Array.isArray(secrets) ? [...secrets].sort() : Object.keys(secrets).sort() }
|
|
13486
13490
|
};
|
|
13487
13491
|
}
|
|
13488
|
-
|
|
13489
|
-
//#region src/runtime/supervise/worker-slots.ts
|
|
13492
|
+
// src/runtime/supervise/worker-slots.ts
|
|
13490
13493
|
/**
|
|
13491
13494
|
* Worker slots: the one bound on how many spawned agents work at the same time.
|
|
13492
13495
|
*
|
|
@@ -14110,8 +14113,7 @@ function requireDurableWorkspaceArtifacts(snapshot) {
|
|
|
14110
14113
|
function isDurableArtifact(artifact) {
|
|
14111
14114
|
return "locator" in artifact;
|
|
14112
14115
|
}
|
|
14113
|
-
|
|
14114
|
-
//#region src/runtime/retained-harness-transcript.ts
|
|
14116
|
+
// src/runtime/retained-harness-transcript.ts
|
|
14115
14117
|
const digest = z.custom((value) => typeof value === "string" && /^sha256:[0-9a-f]{64}$/.test(value));
|
|
14116
14118
|
const count = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
14117
14119
|
const text = z.string().min(1);
|
|
@@ -14169,10 +14171,10 @@ const retainedSchema = z.object({
|
|
|
14169
14171
|
missing: z.array(z.string())
|
|
14170
14172
|
});
|
|
14171
14173
|
const defaults = {
|
|
14172
|
-
maxFileBytes:
|
|
14173
|
-
maxTotalBytes:
|
|
14174
|
+
maxFileBytes: 2097152,
|
|
14175
|
+
maxTotalBytes: 16777216,
|
|
14174
14176
|
maxFiles: 1e3,
|
|
14175
|
-
maxManifestBytes:
|
|
14177
|
+
maxManifestBytes: 16777216
|
|
14176
14178
|
};
|
|
14177
14179
|
/** Validate persisted descriptors before trusting their identity, locators, or inventory. */
|
|
14178
14180
|
function parseRetainedHarnessTranscript(value) {
|
|
@@ -14374,8 +14376,7 @@ async function resolveHarnessTranscriptCapture(capture, options = {}) {
|
|
|
14374
14376
|
skipped
|
|
14375
14377
|
});
|
|
14376
14378
|
}
|
|
14377
|
-
|
|
14378
|
-
//#region src/runtime/harness-transcript.ts
|
|
14379
|
+
// src/runtime/harness-transcript.ts
|
|
14379
14380
|
/**
|
|
14380
14381
|
* Persist a harness transcript receipt beside the supervisor tool trace.
|
|
14381
14382
|
* Provider workspace retention supplies an attributed descriptor whose bytes stay in the
|
|
@@ -14418,8 +14419,8 @@ const DENY = /(^|\/)(auth\.json|\.credentials\.json|credentials|\.netrc|\.env(\.
|
|
|
14418
14419
|
* resume rehydrate a ref, never the files; nothing pays for a transcript until someone opens it.
|
|
14419
14420
|
* The bound is enforced exactly, after each read, so a child settles at or under MAX_TOTAL_BYTES.
|
|
14420
14421
|
*/
|
|
14421
|
-
const MAX_FILE_BYTES =
|
|
14422
|
-
const MAX_TOTAL_BYTES =
|
|
14422
|
+
const MAX_FILE_BYTES = 2097152;
|
|
14423
|
+
const MAX_TOTAL_BYTES = 16777216;
|
|
14423
14424
|
const MAX_FILES = 1e3;
|
|
14424
14425
|
function unavailable$2(reason) {
|
|
14425
14426
|
return Object.freeze({
|
|
@@ -14454,7 +14455,7 @@ function harnessTranscriptUnavailable(reason) {
|
|
|
14454
14455
|
* steps are bounded (the harness stop at 30 s, each native copy by its port's `nativeTimeoutMs`,
|
|
14455
14456
|
* 120 s by default), so this guards only an executor that never answers.
|
|
14456
14457
|
*/
|
|
14457
|
-
const HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS =
|
|
14458
|
+
const HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS = 36e4;
|
|
14458
14459
|
/**
|
|
14459
14460
|
* Wait, bounded, until the executor's transcript is final (`Executor.harnessTranscriptSettled`).
|
|
14460
14461
|
* Never throws: on a timeout or a failure the read that follows reports what was kept.
|
|
@@ -14494,7 +14495,7 @@ const MAX_SUBAGENT_EXPORTS = 32;
|
|
|
14494
14495
|
const SUBAGENT_EXPORT_SECONDS = 120;
|
|
14495
14496
|
/** The script starts no export after SUBAGENT_EXPORT_SECONDS and bounds each one at 30 s, so it
|
|
14496
14497
|
* ends inside this. It is passed to `exec`, because the Sandbox SDK's default is 30 s. */
|
|
14497
|
-
const SUBAGENT_EXPORT_EXEC_MS =
|
|
14498
|
+
const SUBAGENT_EXPORT_EXEC_MS = 18e4;
|
|
14498
14499
|
const SUBAGENT_EXPORT_DIR = "~/.local/share/opencode/export";
|
|
14499
14500
|
/**
|
|
14500
14501
|
* The export, run in the box. For each sidecar record it reads the runtime home and the parent
|
|
@@ -14849,8 +14850,7 @@ function isHarnessTranscriptArtifact(value) {
|
|
|
14849
14850
|
const artifact = value;
|
|
14850
14851
|
return artifact.schemaVersion === 1 && typeof artifact.harness === "string" && Array.isArray(artifact.files) && artifact.files.every((file) => file !== null && typeof file === "object" && typeof file.path === "string" && typeof file.content === "string" && Number.isSafeInteger(file.bytes) && file.bytes >= 0) && Array.isArray(artifact.skipped) && artifact.skipped.every((entry) => entry !== null && typeof entry === "object" && typeof entry.path === "string" && typeof entry.reason === "string");
|
|
14851
14852
|
}
|
|
14852
|
-
|
|
14853
|
-
//#region src/runtime/retained-interactive-lifecycle.ts
|
|
14853
|
+
// src/runtime/retained-interactive-lifecycle.ts
|
|
14854
14854
|
const INTERACTIVE_CLEANUP_TIMEOUT_MS = 3e4;
|
|
14855
14855
|
/** Bound on one lookup that asks the provider whether it still holds an environment. */
|
|
14856
14856
|
const ENVIRONMENT_LOOKUP_TIMEOUT_MS = 3e4;
|
|
@@ -14960,8 +14960,7 @@ function disposeInteractiveEnvironment(environment, abortReason) {
|
|
|
14960
14960
|
process.emitWarning(failure, { code: "AGENT_RUNTIME_INTERACTIVE_CLEANUP_FAILED" });
|
|
14961
14961
|
});
|
|
14962
14962
|
}
|
|
14963
|
-
|
|
14964
|
-
//#region src/runtime/interaction-capabilities.ts
|
|
14963
|
+
// src/runtime/interaction-capabilities.ts
|
|
14965
14964
|
/**
|
|
14966
14965
|
* Check one turn's interaction request before the provider can dispatch it.
|
|
14967
14966
|
*
|
|
@@ -14978,8 +14977,7 @@ function assertRequestedInteractionCapabilities(providerName, requested, capabil
|
|
|
14978
14977
|
if (unsupportedKinds.length > 0) throw new Error(`provider "${providerName}" does not support requested interaction kinds: ${unsupportedKinds.join(", ")}`);
|
|
14979
14978
|
if (interactions.replay !== true || interactions.responseIdempotency !== true) throw new Error(`provider "${providerName}" cannot safely dispatch requested interactions without replay and response idempotency`);
|
|
14980
14979
|
}
|
|
14981
|
-
|
|
14982
|
-
//#region src/runtime/retained-context-transfer.ts
|
|
14980
|
+
// src/runtime/retained-context-transfer.ts
|
|
14983
14981
|
/** Validate attachment authority before admission or any provider operation. */
|
|
14984
14982
|
function retainedContextTransferReceipt(options, provider, request) {
|
|
14985
14983
|
if (request === void 0) {
|
|
@@ -15015,8 +15013,7 @@ function assertRetainedContextTransferEnvironment(environment, request, receipt)
|
|
|
15015
15013
|
status: "accepted"
|
|
15016
15014
|
})) throw new Error("provider did not reconstruct the authoritative accepted context transfer receipt");
|
|
15017
15015
|
}
|
|
15018
|
-
|
|
15019
|
-
//#region src/runtime/retained-run-control.ts
|
|
15016
|
+
// src/runtime/retained-run-control.ts
|
|
15020
15017
|
/**
|
|
15021
15018
|
* The control reference one retained handle currently believes in, with every reference it
|
|
15022
15019
|
* has seen. A provider may expose the previous reference while a terminal read catches up;
|
|
@@ -15073,8 +15070,7 @@ var RetainedRunControl = class {
|
|
|
15073
15070
|
}
|
|
15074
15071
|
}
|
|
15075
15072
|
};
|
|
15076
|
-
|
|
15077
|
-
//#region src/runtime/retained-run-events.ts
|
|
15073
|
+
// src/runtime/retained-run-events.ts
|
|
15078
15074
|
/** The runtime's own contract checks inside the stream loop, so the catch can tell a broken
|
|
15079
15075
|
* answer (a verdict) from a read the provider's iterator failed (a wrapper). */
|
|
15080
15076
|
const runtimeChecks = /* @__PURE__ */ new WeakSet();
|
|
@@ -15163,8 +15159,7 @@ async function* retainedRunEvents(session, controlRef, options, now) {
|
|
|
15163
15159
|
function canonicalEvent(source) {
|
|
15164
15160
|
return parseCanonicalTransportEvent(source.type, source.data, source.normalized ?? source.data.normalized, "provider");
|
|
15165
15161
|
}
|
|
15166
|
-
|
|
15167
|
-
//#region src/runtime/retained-run-native-continuation.ts
|
|
15162
|
+
// src/runtime/retained-run-native-continuation.ts
|
|
15168
15163
|
const semanticTurnOf = ({ timeoutMs: _timeoutMs, signal: _signal, ...semanticTurn }) => semanticTurn;
|
|
15169
15164
|
const unsupportedAdmissionControl = (provider) => /* @__PURE__ */ new Error(`provider "${provider}" does not advertise early native continuation admission control`);
|
|
15170
15165
|
const missingContinuationAdmission = () => new RetainedRunProviderContractError("provider accepted a native continuation without an admission reference", { code: "RETAINED_NATIVE_CONTINUATION_ADMISSION_MISSING" });
|
|
@@ -15306,8 +15301,7 @@ function beginNativeContinuation(control, capabilities, request, turn) {
|
|
|
15306
15301
|
result
|
|
15307
15302
|
};
|
|
15308
15303
|
}
|
|
15309
|
-
|
|
15310
|
-
//#region src/runtime/retained-run-handle.ts
|
|
15304
|
+
// src/runtime/retained-run-handle.ts
|
|
15311
15305
|
async function snapshot(control, clock, reason, signal) {
|
|
15312
15306
|
if (signal?.aborted) throw abortError(signal.reason);
|
|
15313
15307
|
control.sync();
|
|
@@ -15454,8 +15448,7 @@ function createRetainedRunHandle(environment, session, initialControlRef, capabi
|
|
|
15454
15448
|
cancel: (options) => cancelRetainedRun(control, clock, options)
|
|
15455
15449
|
};
|
|
15456
15450
|
}
|
|
15457
|
-
|
|
15458
|
-
//#region src/runtime/retained-run-intent.ts
|
|
15451
|
+
// src/runtime/retained-run-intent.ts
|
|
15459
15452
|
/**
|
|
15460
15453
|
* Project environment creation input into public digest material.
|
|
15461
15454
|
*
|
|
@@ -15547,8 +15540,7 @@ function retainedTurnMaterial(input, contextTransfer) {
|
|
|
15547
15540
|
...contextTransfer === void 0 ? {} : { contextTransferRequestDigest: contextTransfer.requestDigest }
|
|
15548
15541
|
};
|
|
15549
15542
|
}
|
|
15550
|
-
|
|
15551
|
-
//#region src/runtime/retained-run-start.ts
|
|
15543
|
+
// src/runtime/retained-run-start.ts
|
|
15552
15544
|
/**
|
|
15553
15545
|
* Mint deterministic dispatch coordinates from the two caller-supplied keys.
|
|
15554
15546
|
* The same `(idempotencyKey, turnId)` pair yields the same coordinates in
|
|
@@ -15557,9 +15549,10 @@ function retainedTurnMaterial(input, contextTransfer) {
|
|
|
15557
15549
|
* keeps provider session identifiers bounded and safe for workspace paths.
|
|
15558
15550
|
*/
|
|
15559
15551
|
function mintRetainedIdentity(idempotencyKey, turnId) {
|
|
15552
|
+
const base = `${encodeURIComponent(idempotencyKey)}:${encodeURIComponent(turnId)}`;
|
|
15560
15553
|
const digest = canonicalCandidateDigest({
|
|
15561
15554
|
kind: "retained-identity.v1",
|
|
15562
|
-
base
|
|
15555
|
+
base
|
|
15563
15556
|
}).slice(7);
|
|
15564
15557
|
return {
|
|
15565
15558
|
sessionId: `retained-session-${digest}`,
|
|
@@ -15927,7 +15920,8 @@ function retainedContextTransfer(value) {
|
|
|
15927
15920
|
return detachedSnapshot(parsed.data, "retained context transfer request");
|
|
15928
15921
|
}
|
|
15929
15922
|
function assertExactRetainedRunIntent(received, expected) {
|
|
15930
|
-
|
|
15923
|
+
const stableReceived = parseRetainedRunIntent(received);
|
|
15924
|
+
if (canonicalCandidateDigest(stableReceived) !== canonicalCandidateDigest(expected)) throw new Error("retained run intent conflicts with replay material");
|
|
15931
15925
|
}
|
|
15932
15926
|
function parseRetainedRunIntent(value) {
|
|
15933
15927
|
const stable = detachedSnapshot(value, "retained run intent");
|
|
@@ -15991,8 +15985,7 @@ function assertRetainedCapabilityRequirements(providerName, capabilities) {
|
|
|
15991
15985
|
const retained = capabilities.retainedControl;
|
|
15992
15986
|
if (retained?.exactRunIdentity !== true || retained.resultIdentity !== true || retained.eventIdentity !== true || retained.cancellationIdempotency !== true || !capabilities.streaming.detach || !capabilities.streaming.replay || !capabilities.streaming.turnIdempotency) throw new Error(`provider "${providerName}" cannot control a retry-safe retained run`);
|
|
15993
15987
|
}
|
|
15994
|
-
|
|
15995
|
-
//#region src/runtime/retained-native-stop.ts
|
|
15988
|
+
// src/runtime/retained-native-stop.ts
|
|
15996
15989
|
/** One request per run: every caller that stops the same execution replays one provider operation,
|
|
15997
15990
|
* so the operation id and its reason never disagree across a teardown and a release. */
|
|
15998
15991
|
const NATIVE_STOP_REASON = "Runtime stopped the native harness: its execution is no longer observed";
|
|
@@ -16003,7 +15996,7 @@ const STOP_STATUS_POLL_MS = 1e3;
|
|
|
16003
15996
|
*
|
|
16004
15997
|
* A retained execution outlives its local stream by design, so an aborted observer can reconnect.
|
|
16005
15998
|
* Keeping its environment preserves the files; it must not keep the harness running. Measured on
|
|
16006
|
-
* Discovery: after `disco cancel`
|
|
15999
|
+
* Discovery: after `disco cancel` the kept root box ran `claude --print` for two
|
|
16007
16000
|
* more minutes, untraced and charged to the subscription, until an operator stopped the box; on
|
|
16008
16001
|
* 2026-10-03 a cancelled run kept 18 boxes whose `claude` processes ran until an operator stopped
|
|
16009
16002
|
* them. The provider's exact cancellation stops the process; the box and its files stay.
|
|
@@ -16066,8 +16059,7 @@ function describeRetainedNativeStops(stops) {
|
|
|
16066
16059
|
return `native execution ${stop.executionId} stop unconfirmed at ${stop.at} (effect ${stop.effect}${stop.error === void 0 ? "" : `: ${stop.error}`}); it may still be running`;
|
|
16067
16060
|
}).join("; ");
|
|
16068
16061
|
}
|
|
16069
|
-
|
|
16070
|
-
//#region src/runtime/environment-provider/provider-retention-lifecycle.ts
|
|
16062
|
+
// src/runtime/environment-provider/provider-retention-lifecycle.ts
|
|
16071
16063
|
function createProviderCaptureMirrors(options, createProfile, node, state) {
|
|
16072
16064
|
const nativePort = options.workspaceRetention?.captureNative === void 0 ? void 0 : options.workspaceRetention;
|
|
16073
16065
|
let nativeInFlight;
|
|
@@ -16357,8 +16349,7 @@ function providerWorkspaceCaptureReceipt(args, environment, snapshot, fallbackSe
|
|
|
16357
16349
|
...coverage.incompleteReason === void 0 ? {} : { incompleteReason: coverage.incompleteReason }
|
|
16358
16350
|
});
|
|
16359
16351
|
}
|
|
16360
|
-
|
|
16361
|
-
//#region src/runtime/environment-provider/provider-workspace-capture.ts
|
|
16352
|
+
// src/runtime/environment-provider/provider-workspace-capture.ts
|
|
16362
16353
|
/** Capture the environment's workspace once per generation; later callers share that capture. */
|
|
16363
16354
|
async function captureExecutorWorkspace(scope, next, outcome) {
|
|
16364
16355
|
const { state } = scope;
|
|
@@ -16442,8 +16433,7 @@ function recordCapturedWorkspace(scope, workspaceRetention, next, { snapshot, pr
|
|
|
16442
16433
|
}
|
|
16443
16434
|
if (workspaceRetention.requireCompleteProvenance && !coverageComplete) state.workspacePreservationRequired = true;
|
|
16444
16435
|
}
|
|
16445
|
-
|
|
16446
|
-
//#region src/runtime/environment-provider/provider-environment-teardown.ts
|
|
16436
|
+
// src/runtime/environment-provider/provider-environment-teardown.ts
|
|
16447
16437
|
/** The environment id the latest durable admission names, when creation got that far. */
|
|
16448
16438
|
function admittedEnvironmentId(retention) {
|
|
16449
16439
|
for (const admission of [...retention?.admissions ?? []].reverse()) {
|
|
@@ -16586,8 +16576,7 @@ async function captureBeforeDestroy$1(scope, target, signal) {
|
|
|
16586
16576
|
await awaitAbortable$1(mirrors.captureNative(target, "interrupted", admitted === void 0 ? void 0 : freezeControlRef(admitted)), signal).catch(() => void 0);
|
|
16587
16577
|
}
|
|
16588
16578
|
}
|
|
16589
|
-
|
|
16590
|
-
//#region src/runtime/supervise/workspace-checkpoint.ts
|
|
16579
|
+
// src/runtime/supervise/workspace-checkpoint.ts
|
|
16591
16580
|
/** Workspace-relative path of the marker Runtime writes before every checkpoint. */
|
|
16592
16581
|
const WORKSPACE_CHECKPOINT_MARKER_PATH = ".agent-runtime-checkpoint";
|
|
16593
16582
|
/** Bound on one checkpoint: environment lookup, marker write, and the provider operation. */
|
|
@@ -16596,10 +16585,10 @@ const WORKSPACE_CHECKPOINT_TIMEOUT_MS = 12e4;
|
|
|
16596
16585
|
* A turn's own workspace capture also cuts them short when it starts. A capture cut short keeps
|
|
16597
16586
|
* its checkpoint, and the owner's release, bounded by `RELEASE_CHECKPOINT_CAPTURES_MS`, captures
|
|
16598
16587
|
* it again. */
|
|
16599
|
-
const WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS =
|
|
16588
|
+
const WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS = 12e4;
|
|
16600
16589
|
/** Bound on creating and reconstructing the fork a checkpoint's capture reads: a Sandbox box
|
|
16601
|
-
* created from a snapshot (
|
|
16602
|
-
const WORKSPACE_CHECKPOINT_FORK_TIMEOUT_MS =
|
|
16590
|
+
* created from a snapshot (19 s). The capture itself is bounded by its port. */
|
|
16591
|
+
const WORKSPACE_CHECKPOINT_FORK_TIMEOUT_MS = 6e5;
|
|
16603
16592
|
/** Write the marker. False when the environment cannot take it, so no restore can be verified. */
|
|
16604
16593
|
async function writeWorkspaceMarker(environment, marker, signal) {
|
|
16605
16594
|
if (typeof environment.write !== "function") return false;
|
|
@@ -16632,8 +16621,7 @@ async function verifyWorkspaceMarker(environment, marker, signal) {
|
|
|
16632
16621
|
};
|
|
16633
16622
|
}
|
|
16634
16623
|
}
|
|
16635
|
-
|
|
16636
|
-
//#region src/runtime/environment-provider/provider-event-projection.ts
|
|
16624
|
+
// src/runtime/environment-provider/provider-event-projection.ts
|
|
16637
16625
|
function sandboxEventFromEnvironmentEvent(event) {
|
|
16638
16626
|
const normalized = event.normalized;
|
|
16639
16627
|
const type = normalized?.type ?? event.type;
|
|
@@ -16934,15 +16922,14 @@ function isNestedUsageType(type) {
|
|
|
16934
16922
|
function stringValue(value) {
|
|
16935
16923
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
16936
16924
|
}
|
|
16937
|
-
|
|
16938
|
-
//#region src/runtime/environment-provider/provider-retained-observation.ts
|
|
16925
|
+
// src/runtime/environment-provider/provider-retained-observation.ts
|
|
16939
16926
|
/**
|
|
16940
16927
|
* How long a retained stream may go without new evidence before the node publishes that it waits
|
|
16941
16928
|
* on its exact result. Silence never ends the turn (ending there failed 18 still-running attempts
|
|
16942
|
-
* as `terminal-event-lost
|
|
16929
|
+
* as `terminal-event-lost`); only the exact result or an abort does. The bound on
|
|
16943
16930
|
* a wait that never ends is the Lab keeper's hung-root re-drive after 15 minutes without a write.
|
|
16944
16931
|
*/
|
|
16945
|
-
const RETAINED_AWAITING_RESULT_AFTER_MS =
|
|
16932
|
+
const RETAINED_AWAITING_RESULT_AFTER_MS = 48e4;
|
|
16946
16933
|
const RETAINED_OBSERVATION_BATCH_EVENTS = 1024;
|
|
16947
16934
|
/**
|
|
16948
16935
|
* After its exact result, a stream that still owes its terminal frame keeps reading only while
|
|
@@ -16954,7 +16941,7 @@ const RETAINED_TAIL_FLOW_MS = 100;
|
|
|
16954
16941
|
/**
|
|
16955
16942
|
* Why the event stream stopped short, as bounded redacted text. A settlement reason reads messages
|
|
16956
16943
|
* and `cause` links only, never an AggregateError's members, so a wrapper that omits this hides
|
|
16957
|
-
* which layer lost the stream (critics-tournament-v1-158ca88e83bf:s1
|
|
16944
|
+
* which layer lost the stream (critics-tournament-v1-158ca88e83bf:s1).
|
|
16958
16945
|
*/
|
|
16959
16946
|
function observationFailureText(failure) {
|
|
16960
16947
|
const error = failure.error;
|
|
@@ -17183,16 +17170,14 @@ var RetainedObservation = class {
|
|
|
17183
17170
|
return !failed;
|
|
17184
17171
|
}
|
|
17185
17172
|
};
|
|
17186
|
-
|
|
17187
|
-
//#region src/runtime/environment-provider/provider-validation-error.ts
|
|
17173
|
+
// src/runtime/environment-provider/provider-validation-error.ts
|
|
17188
17174
|
var ValidationError = class extends Error {
|
|
17189
17175
|
constructor(message, options) {
|
|
17190
17176
|
super(message, options);
|
|
17191
17177
|
this.name = "ValidationError";
|
|
17192
17178
|
}
|
|
17193
17179
|
};
|
|
17194
|
-
|
|
17195
|
-
//#region src/runtime/environment-provider/provider-turn-input.ts
|
|
17180
|
+
// src/runtime/environment-provider/provider-turn-input.ts
|
|
17196
17181
|
/**
|
|
17197
17182
|
* Lower the seam's prompt options onto turn fields, through the one mapper this module already
|
|
17198
17183
|
* uses to raise a sandbox prompt into a provider turn. Reusing it is what keeps the two directions
|
|
@@ -17287,8 +17272,7 @@ function taskToPrompt(task) {
|
|
|
17287
17272
|
}
|
|
17288
17273
|
return JSON.stringify(task);
|
|
17289
17274
|
}
|
|
17290
|
-
|
|
17291
|
-
//#region src/runtime/environment-provider/provider-execution-source.ts
|
|
17275
|
+
// src/runtime/environment-provider/provider-execution-source.ts
|
|
17292
17276
|
/** The environment, turn and identity a retained dispatch creates or replays. */
|
|
17293
17277
|
function retainedDispatchMaterial(args, retention, selectedTurn, signal) {
|
|
17294
17278
|
const priorSession = retention.priorSession;
|
|
@@ -17462,8 +17446,7 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
17462
17446
|
retained: false
|
|
17463
17447
|
};
|
|
17464
17448
|
}
|
|
17465
|
-
|
|
17466
|
-
//#region src/runtime/environment-provider/provider-turn-observer.ts
|
|
17449
|
+
// src/runtime/environment-provider/provider-turn-observer.ts
|
|
17467
17450
|
/** Reads one turn's provider events into archive, text, failures, trace steps, progress and usage. */
|
|
17468
17451
|
var ProviderTurnObserver = class {
|
|
17469
17452
|
args;
|
|
@@ -17519,8 +17502,7 @@ var ProviderTurnObserver = class {
|
|
|
17519
17502
|
}
|
|
17520
17503
|
}
|
|
17521
17504
|
};
|
|
17522
|
-
|
|
17523
|
-
//#region src/runtime/environment-provider/provider-sandbox-adapter.ts
|
|
17505
|
+
// src/runtime/environment-provider/provider-sandbox-adapter.ts
|
|
17524
17506
|
/** Adapt a neutral environment provider to the `SandboxClient` interface used by existing loop paths.
|
|
17525
17507
|
* @experimental */
|
|
17526
17508
|
function providerAsSandboxClient(provider, options = {}) {
|
|
@@ -17945,8 +17927,7 @@ function sessionStatusFromUnknown(status) {
|
|
|
17945
17927
|
if (status === "completed" || status === "cancelled") return status;
|
|
17946
17928
|
return statusFromUnknown(status);
|
|
17947
17929
|
}
|
|
17948
|
-
|
|
17949
|
-
//#region src/runtime/environment-provider/provider-turn-settlement.ts
|
|
17930
|
+
// src/runtime/environment-provider/provider-turn-settlement.ts
|
|
17950
17931
|
/** What the settled turn left behind and what the teardown must still decide about. */
|
|
17951
17932
|
var ProviderTurnSettlement = class {
|
|
17952
17933
|
args;
|
|
@@ -18084,7 +18065,7 @@ var ProviderTurnSettlement = class {
|
|
|
18084
18065
|
}
|
|
18085
18066
|
/**
|
|
18086
18067
|
* A capture that fails or exceeds its deadline after settlement is a fact about the evidence,
|
|
18087
|
-
* never the turn's outcome. On Runtime 0.295.4
|
|
18068
|
+
* never the turn's outcome. On Runtime 0.295.4 a capture past its 1,200,000 ms
|
|
18088
18069
|
* deadline behind a two-slot queue shared by 34 workers threw an AbortError, the driver
|
|
18089
18070
|
* classified it terminal, and two research roots ended with 13 and 0 children settled. With no
|
|
18090
18071
|
* receipt the source stays preserved and the owner reads a retention failure; the turn is not re-run.
|
|
@@ -18198,8 +18179,7 @@ var ProviderTurnSettlement = class {
|
|
|
18198
18179
|
} else this.failure = this.failure instanceof Error ? Object.assign(this.failure, { cause: this.failure.cause ?? error }) : this.failure;
|
|
18199
18180
|
}
|
|
18200
18181
|
};
|
|
18201
|
-
|
|
18202
|
-
//#region src/runtime/environment-provider/provider-usage-account.ts
|
|
18182
|
+
// src/runtime/environment-provider/provider-usage-account.ts
|
|
18203
18183
|
/** What one provider invocation has spent, and what of that spend a receipt proves. */
|
|
18204
18184
|
var ProviderUsageAccount = class {
|
|
18205
18185
|
args;
|
|
@@ -18363,8 +18343,7 @@ var ProviderUsageAccount = class {
|
|
|
18363
18343
|
} else if (input > 0 || output > 0 || receipt.tokensKnown === false) this.pendingUnpricedWork = true;
|
|
18364
18344
|
}
|
|
18365
18345
|
};
|
|
18366
|
-
|
|
18367
|
-
//#region src/runtime/environment-provider/provider-invocation.ts
|
|
18346
|
+
// src/runtime/environment-provider/provider-invocation.ts
|
|
18368
18347
|
/** The turn this invocation sends: the task's turn under the provider's defaults and placement rules. */
|
|
18369
18348
|
function invocationTurn(args) {
|
|
18370
18349
|
const linked = args.signal;
|
|
@@ -18401,8 +18380,7 @@ async function* streamProviderExecutor(args) {
|
|
|
18401
18380
|
}
|
|
18402
18381
|
return settlement.end();
|
|
18403
18382
|
}
|
|
18404
|
-
|
|
18405
|
-
//#region src/runtime/environment-provider/provider-execution-loop.ts
|
|
18383
|
+
// src/runtime/environment-provider/provider-execution-loop.ts
|
|
18406
18384
|
/** A new environment now backs this execution; the identity the provider issued is evidence. */
|
|
18407
18385
|
function adoptEnvironment(scope, env) {
|
|
18408
18386
|
const { state, materialization } = scope;
|
|
@@ -18557,8 +18535,7 @@ async function pauseForContinuation(scope, invocation, ended, attempt, refusalsB
|
|
|
18557
18535
|
}
|
|
18558
18536
|
};
|
|
18559
18537
|
}
|
|
18560
|
-
|
|
18561
|
-
//#region src/runtime/environment-provider/provider-executor-state.ts
|
|
18538
|
+
// src/runtime/environment-provider/provider-executor-state.ts
|
|
18562
18539
|
/** Everything one provider executor knows about its environment, capture generation and release. */
|
|
18563
18540
|
var ProviderExecutorState = class {
|
|
18564
18541
|
callerSignal;
|
|
@@ -18637,8 +18614,7 @@ var ProviderExecutorState = class {
|
|
|
18637
18614
|
this.clearWorkspaceCapture();
|
|
18638
18615
|
}
|
|
18639
18616
|
};
|
|
18640
|
-
|
|
18641
|
-
//#region src/runtime/environment-provider/provider-materialization.ts
|
|
18617
|
+
// src/runtime/environment-provider/provider-materialization.ts
|
|
18642
18618
|
function providerMaterialization(provider, createProfile, node, executionId, retention, options, placement) {
|
|
18643
18619
|
const attemptId = node?.attemptId ?? newExecutionAttemptId(executionId);
|
|
18644
18620
|
const providerModel = concreteProfileModel(createProfile);
|
|
@@ -18688,8 +18664,7 @@ function providerMaterialization(provider, createProfile, node, executionId, ret
|
|
|
18688
18664
|
}
|
|
18689
18665
|
};
|
|
18690
18666
|
}
|
|
18691
|
-
|
|
18692
|
-
//#region src/runtime/environment-provider/provider-executor-lifecycle.ts
|
|
18667
|
+
// src/runtime/environment-provider/provider-executor-lifecycle.ts
|
|
18693
18668
|
function createProviderExecutor(provider, profile, ctx, options, placement) {
|
|
18694
18669
|
if (options.workspaceRetention !== void 0) assertProviderWorkspaceRetentionPort(options.workspaceRetention, `providerAsExecutor(${provider.name})`);
|
|
18695
18670
|
const node = ctx.node === void 0 ? void 0 : detachedSnapshot(ctx.node, "provider executor node");
|
|
@@ -18820,10 +18795,9 @@ function heldForContinuation(scope) {
|
|
|
18820
18795
|
/** What a leaf is told when it continues after a refused turn. The session carries its
|
|
18821
18796
|
* conversation and the environment its files, so the instruction names neither the provider nor
|
|
18822
18797
|
* the refusal: a director told the details of a provider failure spent its children probing the
|
|
18823
|
-
* infrastructure (discovery-lab AGENTS.md
|
|
18798
|
+
* infrastructure (discovery-lab AGENTS.md). */
|
|
18824
18799
|
const LEAF_CONTINUATION_TASK = "Your previous turn was interrupted before it finished. This is the same task in the same session: your conversation so far and the files in your workspace are where you left them. Continue from where you stopped. Do not start over.";
|
|
18825
|
-
|
|
18826
|
-
//#region src/runtime/environment-provider/provider-executor-admission.ts
|
|
18800
|
+
// src/runtime/environment-provider/provider-executor-admission.ts
|
|
18827
18801
|
/** Adapt an environment provider into an `ExecutorFactory` for `createExecutor`.
|
|
18828
18802
|
*
|
|
18829
18803
|
* `createExecutor({ backend: 'provider', provider })` is the composition most callers want; it
|
|
@@ -18856,8 +18830,7 @@ function placedProviderExecutor(provider, options, identity) {
|
|
|
18856
18830
|
if (options.placements !== void 0) throw new ValidationError("placedProviderExecutor: placements select within one provider");
|
|
18857
18831
|
return (spec, ctx) => createProviderExecutor(provider, spec.profile, ctx, options, identity);
|
|
18858
18832
|
}
|
|
18859
|
-
|
|
18860
|
-
//#region src/runtime/environment-provider/provider-registry.ts
|
|
18833
|
+
// src/runtime/environment-provider/provider-registry.ts
|
|
18861
18834
|
/** Create a registry that resolves provider names to concrete provider instances.
|
|
18862
18835
|
* @experimental */
|
|
18863
18836
|
function createAgentEnvironmentProviderRegistry(providers = []) {
|
|
@@ -18902,8 +18875,7 @@ function resolveAgentEnvironmentProvider(provider, registry) {
|
|
|
18902
18875
|
if (!registry) throw new ValidationError(`agent environment provider "${provider}" requires an AgentEnvironmentProviderRegistry`);
|
|
18903
18876
|
return registry.require(provider);
|
|
18904
18877
|
}
|
|
18905
|
-
|
|
18906
|
-
//#region src/runtime/supervise/cli-process-executor.ts
|
|
18878
|
+
// src/runtime/supervise/cli-process-executor.ts
|
|
18907
18879
|
/**
|
|
18908
18880
|
* Spawns a subprocess (`bin` + `args`). It cannot account tokens, so it is
|
|
18909
18881
|
* `budgetExempt: true`: it remains usable as a direct executor, while budgeted supervision
|
|
@@ -19068,8 +19040,7 @@ function killWithGrace(proc, grace) {
|
|
|
19068
19040
|
}, true);
|
|
19069
19041
|
});
|
|
19070
19042
|
}
|
|
19071
|
-
|
|
19072
|
-
//#region src/runtime/router-http-transport.ts
|
|
19043
|
+
// src/runtime/router-http-transport.ts
|
|
19073
19044
|
/** Router HTTP attempts, response evidence, retries, and request cancellation. */
|
|
19074
19045
|
function routerRequestHeaders(cfg, opts) {
|
|
19075
19046
|
const suppliedCallId = opts?.callId;
|
|
@@ -19263,8 +19234,7 @@ function withRouterRequestTimeout(callerSignal, timeoutMs) {
|
|
|
19263
19234
|
}
|
|
19264
19235
|
};
|
|
19265
19236
|
}
|
|
19266
|
-
|
|
19267
|
-
//#region src/runtime/router-request-body.ts
|
|
19237
|
+
// src/runtime/router-request-body.ts
|
|
19268
19238
|
/** Canonical provider request lowering for buffered and streamed completions. */
|
|
19269
19239
|
/** The OpenAI-shape request body both plain-chat transports send. One builder so the streamed
|
|
19270
19240
|
* completion cannot drift from the buffered one on model, ceilings, seed, or reasoning effort. */
|
|
@@ -19353,8 +19323,7 @@ function providerRequestExtras(extraBody, reservedFields) {
|
|
|
19353
19323
|
for (const field of reservedFields) delete extras[field];
|
|
19354
19324
|
return extras;
|
|
19355
19325
|
}
|
|
19356
|
-
|
|
19357
|
-
//#region src/runtime/router-response.ts
|
|
19326
|
+
// src/runtime/router-response.ts
|
|
19358
19327
|
/** Provider completion fields and measured resource accounting. */
|
|
19359
19328
|
function parseChatResult(json, model, transportAttempts) {
|
|
19360
19329
|
const data = json;
|
|
@@ -19490,8 +19459,7 @@ function bufferedCompletionFields(data, measured) {
|
|
|
19490
19459
|
...typeof data.choices?.[0]?.finish_reason === "string" ? { finishReason: data.choices[0].finish_reason } : {}
|
|
19491
19460
|
};
|
|
19492
19461
|
}
|
|
19493
|
-
|
|
19494
|
-
//#region src/runtime/router-sse-chunks.ts
|
|
19462
|
+
// src/runtime/router-sse-chunks.ts
|
|
19495
19463
|
/** SSE framing and response-body ownership for Router completion chunks. */
|
|
19496
19464
|
/**
|
|
19497
19465
|
* Decode an SSE body into chat-completion chunks. Frames are blank-line separated; `data:` lines
|
|
@@ -19580,8 +19548,7 @@ function parseChunkFrame(frame) {
|
|
|
19580
19548
|
return;
|
|
19581
19549
|
}
|
|
19582
19550
|
}
|
|
19583
|
-
|
|
19584
|
-
//#region src/runtime/router-streamed-completion.ts
|
|
19551
|
+
// src/runtime/router-streamed-completion.ts
|
|
19585
19552
|
/** Stateful assembly of one streamed Router completion. */
|
|
19586
19553
|
/**
|
|
19587
19554
|
* POST `body` with `stream: true` and fold the SSE chunks into one completion. Both streamed
|
|
@@ -19670,8 +19637,7 @@ function idAlreadyOpen(calls, id) {
|
|
|
19670
19637
|
for (const call of calls.values()) if (call.id === id) return true;
|
|
19671
19638
|
return false;
|
|
19672
19639
|
}
|
|
19673
|
-
|
|
19674
|
-
//#region src/runtime/router-client.ts
|
|
19640
|
+
// src/runtime/router-client.ts
|
|
19675
19641
|
/** One OpenAI-compatible chat completion through the Tangle router, returning text + REAL token usage (`undefined` when the provider omits it — never a fabricated 0). */
|
|
19676
19642
|
async function routerChatWithUsage(cfg, messages, opts) {
|
|
19677
19643
|
const url = `${cfg.routerBaseUrl.replace(/\/$/, "")}/chat/completions`;
|
|
@@ -19869,8 +19835,7 @@ function routerBrain(cfg, opts = {}) {
|
|
|
19869
19835
|
};
|
|
19870
19836
|
};
|
|
19871
19837
|
}
|
|
19872
|
-
|
|
19873
|
-
//#region src/runtime/supervise/executor-local-cancellation.ts
|
|
19838
|
+
// src/runtime/supervise/executor-local-cancellation.ts
|
|
19874
19839
|
/**
|
|
19875
19840
|
* The honest answer for a backend with no cancel operation: the local request stopped, and
|
|
19876
19841
|
* nothing about the remote run is known. Never `accepted` — a client that advertises provider
|
|
@@ -19884,8 +19849,7 @@ function localAbortCancellation(detail) {
|
|
|
19884
19849
|
detail
|
|
19885
19850
|
};
|
|
19886
19851
|
}
|
|
19887
|
-
|
|
19888
|
-
//#region src/runtime/supervise/router-executor-request.ts
|
|
19852
|
+
// src/runtime/supervise/router-executor-request.ts
|
|
19889
19853
|
async function runRouterTransport(context, call) {
|
|
19890
19854
|
try {
|
|
19891
19855
|
return await call();
|
|
@@ -19895,7 +19859,8 @@ async function runRouterTransport(context, call) {
|
|
|
19895
19859
|
}
|
|
19896
19860
|
function throwRouterTransportFailure(context, error) {
|
|
19897
19861
|
if (error instanceof ValidationError$1 || error && typeof error === "object" && "name" in error && error.name === "AbortError") throw error;
|
|
19898
|
-
|
|
19862
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19863
|
+
throw new ValidationError$1(`${context}: transport failed: ${message}`);
|
|
19899
19864
|
}
|
|
19900
19865
|
function assertObservedRouterModel(observed, expected, context) {
|
|
19901
19866
|
if (observed !== void 0 && !observedModelMatchesDeclared(observed, expected)) throw new ValidationError$1(`${context}: provider reported model ${JSON.stringify(observed)} but AgentProfile requires ${JSON.stringify(expected)}`);
|
|
@@ -19935,8 +19900,7 @@ function routerGenerationOptions(profileExecution) {
|
|
|
19935
19900
|
...profileExecution.extraBody ? { extraBody: profileExecution.extraBody } : {}
|
|
19936
19901
|
};
|
|
19937
19902
|
}
|
|
19938
|
-
|
|
19939
|
-
//#region src/runtime/supervise/router-profile-execution.ts
|
|
19903
|
+
// src/runtime/supervise/router-profile-execution.ts
|
|
19940
19904
|
/**
|
|
19941
19905
|
* Materialization contract for one direct Router turn.
|
|
19942
19906
|
*
|
|
@@ -19954,6 +19918,7 @@ const routerTurnProfileMaterialization = defineProfileMaterializationContract({
|
|
|
19954
19918
|
"version",
|
|
19955
19919
|
"tags",
|
|
19956
19920
|
"systemPrompt",
|
|
19921
|
+
"appendSystemPrompt",
|
|
19957
19922
|
"instructions",
|
|
19958
19923
|
"modelDefault",
|
|
19959
19924
|
"modelProvider",
|
|
@@ -20027,7 +19992,11 @@ function exactRouterModel(profile, context) {
|
|
|
20027
19992
|
* channel to carry that warning, so it refuses the value instead of silently running strict.
|
|
20028
19993
|
*/
|
|
20029
19994
|
function renderRouterProfilePrompt(profile) {
|
|
20030
|
-
const sections = [
|
|
19995
|
+
const sections = [
|
|
19996
|
+
profile.prompt?.systemPrompt,
|
|
19997
|
+
profile.prompt?.appendSystemPrompt,
|
|
19998
|
+
...profile.prompt?.instructions ?? []
|
|
19999
|
+
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
20031
20000
|
const resources = profile.resources;
|
|
20032
20001
|
if (!resources) return sections.join("\n");
|
|
20033
20002
|
if (resources.failOnError === false) throw new ValidationError$1("routerInlineExecutor: resources.failOnError: false requests a best-effort resource subset; the direct Router executor always fails closed on a resource it cannot inline and reports no skipped resource, so the best-effort policy is refused rather than applied as strict");
|
|
@@ -20054,7 +20023,11 @@ function renderRouterResource(kind, resource) {
|
|
|
20054
20023
|
* The profile prompt is always the immutable first message. Later system-role messages are
|
|
20055
20024
|
* preserved as per-call task context; they cannot replace or precede the profile policy. */
|
|
20056
20025
|
function taskToMessages(task, spec, resolvedSystem) {
|
|
20057
|
-
const system = resolvedSystem ?? [
|
|
20026
|
+
const system = resolvedSystem ?? [
|
|
20027
|
+
spec.profile.prompt?.systemPrompt,
|
|
20028
|
+
spec.profile.prompt?.appendSystemPrompt,
|
|
20029
|
+
...spec.profile.prompt?.instructions ?? []
|
|
20030
|
+
].filter((line) => typeof line === "string" && line.trim().length > 0).join("\n");
|
|
20058
20031
|
if (task && typeof task === "object" && Array.isArray(task.messages)) {
|
|
20059
20032
|
const supplied = task.messages.map((value, index) => {
|
|
20060
20033
|
if (!value || typeof value !== "object") throw new ValidationError$1(`routerInlineExecutor: messages[${index}] must be an object`);
|
|
@@ -20076,15 +20049,14 @@ function taskToMessages(task, spec, resolvedSystem) {
|
|
|
20076
20049
|
content: taskToPrompt$1(task)
|
|
20077
20050
|
}];
|
|
20078
20051
|
}
|
|
20079
|
-
|
|
20080
|
-
//#region src/runtime/supervise/router-transcript.ts
|
|
20052
|
+
// src/runtime/supervise/router-transcript.ts
|
|
20081
20053
|
/**
|
|
20082
20054
|
* The conversation of a router-brained agent, kept as it happens.
|
|
20083
20055
|
*
|
|
20084
20056
|
* A router-brained agent (`harness` omitted or `cli-base`) runs its tool loop in this process, so
|
|
20085
20057
|
* its whole conversation is in the loop's `messages` and nowhere else. Before this, Runtime
|
|
20086
20058
|
* metered each turn's usage and tool-call names and kept nothing the agent said, saw, or asked a
|
|
20087
|
-
* tool to do: a 316-agent tree
|
|
20059
|
+
* tool to do: a 316-agent tree settled with 0 of 316 transcripts, and the 37 agents
|
|
20088
20060
|
* still running when its driver process stopped left no record at all (agent-runtime#1377).
|
|
20089
20061
|
*
|
|
20090
20062
|
* The recorder keeps each message once, in the order the model saw it, and serves two readers:
|
|
@@ -20107,7 +20079,7 @@ const ROUTER_TRANSCRIPT_HARNESS = "router";
|
|
|
20107
20079
|
* the message says so with its full length, so a reader never takes a cut message for the whole.
|
|
20108
20080
|
* The settled transcript keeps the full content, within the bounds of `harnessTranscriptFromLines`.
|
|
20109
20081
|
*/
|
|
20110
|
-
const TURN_CONTENT_BYTES =
|
|
20082
|
+
const TURN_CONTENT_BYTES = 262144;
|
|
20111
20083
|
function createRouterTranscript() {
|
|
20112
20084
|
let turnMessages = [];
|
|
20113
20085
|
let started = false;
|
|
@@ -20177,8 +20149,7 @@ function forTurnEvent(message) {
|
|
|
20177
20149
|
contentCut: true
|
|
20178
20150
|
};
|
|
20179
20151
|
}
|
|
20180
|
-
|
|
20181
|
-
//#region src/runtime/supervise/router-inline-executor.ts
|
|
20152
|
+
// src/runtime/supervise/router-inline-executor.ts
|
|
20182
20153
|
const routerInlineExecutor = (spec, ctx) => {
|
|
20183
20154
|
const seam = readSeam(ctx, routerSeamKey, "router/inline");
|
|
20184
20155
|
const model = exactRouterModel(spec.profile, "routerInlineExecutor");
|
|
@@ -20308,8 +20279,7 @@ const routerInlineExecutor = (spec, ctx) => {
|
|
|
20308
20279
|
});
|
|
20309
20280
|
return executor;
|
|
20310
20281
|
};
|
|
20311
|
-
|
|
20312
|
-
//#region src/runtime/code-mode.ts
|
|
20282
|
+
// src/runtime/code-mode.ts
|
|
20313
20283
|
function positiveInteger(value, fallback, name) {
|
|
20314
20284
|
const result = value ?? fallback;
|
|
20315
20285
|
if (!Number.isSafeInteger(result) || result < 1) throw new RangeError(`code mode: ${name} must be a positive safe integer`);
|
|
@@ -20342,7 +20312,7 @@ async function runCodeMode(code, options) {
|
|
|
20342
20312
|
if (!options.callId.trim()) throw new TypeError("code mode: callId is required");
|
|
20343
20313
|
const concurrency = positiveInteger(options.concurrency, 4, "concurrency");
|
|
20344
20314
|
const maxCalls = positiveInteger(options.maxCalls, 1024, "maxCalls");
|
|
20345
|
-
const memoryLimitBytes = positiveInteger(options.memoryLimitBytes,
|
|
20315
|
+
const memoryLimitBytes = positiveInteger(options.memoryLimitBytes, 67108864, "memoryLimitBytes");
|
|
20346
20316
|
const timeoutMs = options.timeoutMs === Infinity ? Infinity : positiveInteger(options.timeoutMs, 3e5, "timeoutMs");
|
|
20347
20317
|
if (timeoutMs !== Infinity && timeoutMs > 2147483647) throw new RangeError("code mode: timeoutMs must be at most 2147483647 or Infinity");
|
|
20348
20318
|
const { CodemodeSandbox, toCodemodeIdentifier } = await import("@earendil-works/pi-codemode");
|
|
@@ -20572,8 +20542,7 @@ function codeModeModelOutput(value) {
|
|
|
20572
20542
|
}] : [])
|
|
20573
20543
|
};
|
|
20574
20544
|
}
|
|
20575
|
-
|
|
20576
|
-
//#region src/runtime/supervise/router-tool-loop.ts
|
|
20545
|
+
// src/runtime/supervise/router-tool-loop.ts
|
|
20577
20546
|
function mergePromptCache(target, cache) {
|
|
20578
20547
|
if (!cache) return;
|
|
20579
20548
|
for (const key of [
|
|
@@ -20930,8 +20899,7 @@ function settleLoop(env, state, actions, started) {
|
|
|
20930
20899
|
spent
|
|
20931
20900
|
};
|
|
20932
20901
|
}
|
|
20933
|
-
|
|
20934
|
-
//#region src/runtime/supervise/router-tools-executor.ts
|
|
20902
|
+
// src/runtime/supervise/router-tools-executor.ts
|
|
20935
20903
|
/** Compose node behavior with host state and ceilings; neither grants new tools. */
|
|
20936
20904
|
function routerCodeModeSettings(profile, host) {
|
|
20937
20905
|
if (profile === false || profile === void 0 && host === void 0) return void 0;
|
|
@@ -21065,8 +21033,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
21065
21033
|
});
|
|
21066
21034
|
return executor;
|
|
21067
21035
|
};
|
|
21068
|
-
|
|
21069
|
-
//#region src/runtime/iteration-events.ts
|
|
21036
|
+
// src/runtime/iteration-events.ts
|
|
21070
21037
|
function emitRunLoopHook(options, event) {
|
|
21071
21038
|
notifyRuntimeHookEvent(options.ctx.hooks, {
|
|
21072
21039
|
id: `${event.runId}:${event.target}:${event.phase}${event.stepIndex === void 0 ? "" : `:${event.stepIndex}`}`,
|
|
@@ -21083,8 +21050,7 @@ async function emitTrace(emitter, event) {
|
|
|
21083
21050
|
if (!emitter) return;
|
|
21084
21051
|
await emitter.emit(event);
|
|
21085
21052
|
}
|
|
21086
|
-
|
|
21087
|
-
//#region src/runtime/iteration-result.ts
|
|
21053
|
+
// src/runtime/iteration-result.ts
|
|
21088
21054
|
function finalize(args) {
|
|
21089
21055
|
let selector;
|
|
21090
21056
|
let winner;
|
|
@@ -21284,8 +21250,7 @@ const TERMINAL_DECISIONS = [
|
|
|
21284
21250
|
function isTerminalDecision(decision) {
|
|
21285
21251
|
return TERMINAL_DECISIONS.includes(decision);
|
|
21286
21252
|
}
|
|
21287
|
-
|
|
21288
|
-
//#region src/runtime/sandbox-evidence-retention.ts
|
|
21253
|
+
// src/runtime/sandbox-evidence-retention.ts
|
|
21289
21254
|
/** A failed capture keeps the live source handle available for an explicit retry. */
|
|
21290
21255
|
var SandboxEvidenceRetentionError = class extends Error {
|
|
21291
21256
|
box;
|
|
@@ -21404,8 +21369,7 @@ var SandboxEvidenceTracker = class {
|
|
|
21404
21369
|
}
|
|
21405
21370
|
}
|
|
21406
21371
|
};
|
|
21407
|
-
|
|
21408
|
-
//#region src/runtime/sandbox-acquire.ts
|
|
21372
|
+
// src/runtime/sandbox-acquire.ts
|
|
21409
21373
|
/**
|
|
21410
21374
|
* HTTP statuses where create should be retried — gateway timeouts
|
|
21411
21375
|
* (502/503/504/522/524) where provisioning may continue server-side, plus
|
|
@@ -21463,7 +21427,7 @@ async function acquireSandbox(client, options, acquire = {}) {
|
|
|
21463
21427
|
acquire.onAcquire?.(found);
|
|
21464
21428
|
return await waitReadyOrDestroy(found, deadline, pollMs, acquire.signal, now, sleep$1, acquire.beforeDelete);
|
|
21465
21429
|
}
|
|
21466
|
-
if (scan <
|
|
21430
|
+
if (scan < 4) await sleep$1(pollMs);
|
|
21467
21431
|
}
|
|
21468
21432
|
attempt += 1;
|
|
21469
21433
|
await sleep$1(Math.min(pollMs * attempt, 15e3));
|
|
@@ -21509,8 +21473,7 @@ function isRetryable(err) {
|
|
|
21509
21473
|
if (/\b(timed out|timeout|gateway|temporarily unavailable|too many requests|ECONNRESET|ETIMEDOUT|EAI_AGAIN)\b/i.test(msg)) return true;
|
|
21510
21474
|
return /provision failed|edge data plane|not reachable|failed to create sandbox/i.test(msg);
|
|
21511
21475
|
}
|
|
21512
|
-
|
|
21513
|
-
//#region src/runtime/sandbox-backend.ts
|
|
21476
|
+
// src/runtime/sandbox-backend.ts
|
|
21514
21477
|
/**
|
|
21515
21478
|
* Harnesses the sandbox accepts as a `backend.type`. `gemini` is a
|
|
21516
21479
|
* `HarnessType` with no sandbox backend, so it is absent here and a profile
|
|
@@ -21583,8 +21546,7 @@ function buildBackendOptions(profile, overrides) {
|
|
|
21583
21546
|
}
|
|
21584
21547
|
};
|
|
21585
21548
|
}
|
|
21586
|
-
|
|
21587
|
-
//#region src/runtime/sandbox-lineage.ts
|
|
21549
|
+
// src/runtime/sandbox-lineage.ts
|
|
21588
21550
|
const TEARDOWN_TIMEOUT_MS$1 = 15e3;
|
|
21589
21551
|
const DEFAULT_FORK_CONCURRENCY = 4;
|
|
21590
21552
|
/**
|
|
@@ -21831,8 +21793,7 @@ async function destroyBounded(box, failOnError = false, beforeDelete) {
|
|
|
21831
21793
|
}
|
|
21832
21794
|
await withTimeout(deleteBoxSafe(box), TEARDOWN_TIMEOUT_MS$1);
|
|
21833
21795
|
}
|
|
21834
|
-
|
|
21835
|
-
//#region src/runtime/iteration-sandboxes.ts
|
|
21796
|
+
// src/runtime/iteration-sandboxes.ts
|
|
21836
21797
|
/**
|
|
21837
21798
|
* Build the lineage when either lineage flag is set. Probes the legacy fork
|
|
21838
21799
|
* capability once per run (live branching is detected on each box).
|
|
@@ -22060,8 +22021,7 @@ async function invokePrepareBox(spec, box, signal, recordMount) {
|
|
|
22060
22021
|
}
|
|
22061
22022
|
/** Shared no-op recorder for box-preparation paths that have no run manifest. */
|
|
22062
22023
|
const noopMountRecorder = () => {};
|
|
22063
|
-
|
|
22064
|
-
//#region src/runtime/iteration-execution.ts
|
|
22024
|
+
// src/runtime/iteration-execution.ts
|
|
22065
22025
|
async function runBatch(args) {
|
|
22066
22026
|
const queue = args.slice.map((task, offset) => ({
|
|
22067
22027
|
task,
|
|
@@ -22258,8 +22218,7 @@ async function executeIteration(args) {
|
|
|
22258
22218
|
}
|
|
22259
22219
|
if (slot.error instanceof ValidationError$1) throw slot.error;
|
|
22260
22220
|
}
|
|
22261
|
-
|
|
22262
|
-
//#region src/runtime/prompt-options.ts
|
|
22221
|
+
// src/runtime/prompt-options.ts
|
|
22263
22222
|
/** Keys the kernel owns on every prompt it sends; a caller value never carries them past here. */
|
|
22264
22223
|
const kernelOwnedPromptKeys = /* @__PURE__ */ new Set(["sessionId", "signal"]);
|
|
22265
22224
|
/**
|
|
@@ -22310,8 +22269,7 @@ function assertBoxlessPromptOptions(options, seam, keys = instrumentPromptKeys)
|
|
|
22310
22269
|
throw new ValidationError$1(`${seam}: promptOptions.${key} cannot apply without a box`);
|
|
22311
22270
|
}
|
|
22312
22271
|
}
|
|
22313
|
-
|
|
22314
|
-
//#region src/runtime/agent-rounds.ts
|
|
22272
|
+
// src/runtime/agent-rounds.ts
|
|
22315
22273
|
const DEFAULT_MAX_ITERATIONS = 10;
|
|
22316
22274
|
const DEFAULT_MAX_CONCURRENCY = 4;
|
|
22317
22275
|
/**
|
|
@@ -22380,8 +22338,10 @@ async function runAgentRounds(options) {
|
|
|
22380
22338
|
});
|
|
22381
22339
|
const controller = new AbortController();
|
|
22382
22340
|
const onOuterAbort = () => controller.abort();
|
|
22383
|
-
if (options.ctx.signal)
|
|
22384
|
-
|
|
22341
|
+
if (options.ctx.signal) {
|
|
22342
|
+
if (options.ctx.signal.aborted) controller.abort();
|
|
22343
|
+
else options.ctx.signal.addEventListener("abort", onOuterAbort, { once: true });
|
|
22344
|
+
}
|
|
22385
22345
|
try {
|
|
22386
22346
|
while (iterations.length < maxIterations) {
|
|
22387
22347
|
if (controller.signal.aborted) throwAbort();
|
|
@@ -22526,8 +22486,7 @@ function resolveAgentRuns(options) {
|
|
|
22526
22486
|
if (options.agentRuns && options.agentRuns.length > 0) return options.agentRuns;
|
|
22527
22487
|
throw new ValidationError$1("runAgentRounds: `agentRun` or non-empty `agentRuns` is required");
|
|
22528
22488
|
}
|
|
22529
|
-
|
|
22530
|
-
//#region src/runtime/supervise/sandbox-session-run.ts
|
|
22489
|
+
// src/runtime/supervise/sandbox-session-run.ts
|
|
22531
22490
|
function newSandboxSessionRun(args) {
|
|
22532
22491
|
const now = args.now ?? Date.now;
|
|
22533
22492
|
return {
|
|
@@ -22713,8 +22672,7 @@ function readFinalText(event) {
|
|
|
22713
22672
|
const alt = data.text;
|
|
22714
22673
|
return typeof alt === "string" ? alt : void 0;
|
|
22715
22674
|
}
|
|
22716
|
-
|
|
22717
|
-
//#region src/runtime/supervise/sandbox-session.ts
|
|
22675
|
+
// src/runtime/supervise/sandbox-session.ts
|
|
22718
22676
|
/** Ceiling on continuation turns (turn 0 is the task, each later turn a folded steer). */
|
|
22719
22677
|
const DEFAULT_SANDBOX_STEERING_MAX_TURNS = 24;
|
|
22720
22678
|
/** One steerable sandbox worker. The returned session is inert until `stream()` is drained. */
|
|
@@ -22960,8 +22918,7 @@ function publishSessionArtifact(run, started) {
|
|
|
22960
22918
|
function isInterruptAbort(err, interrupt, external, owned) {
|
|
22961
22919
|
return (err instanceof DOMException && err.name === "AbortError" || typeof err === "object" && err !== null && err.name === "AbortError") && interrupt.aborted && !external.aborted && !owned.aborted;
|
|
22962
22920
|
}
|
|
22963
|
-
|
|
22964
|
-
//#region src/runtime/supervise/sandbox-leaf-executor.ts
|
|
22921
|
+
// src/runtime/supervise/sandbox-leaf-executor.ts
|
|
22965
22922
|
/**
|
|
22966
22923
|
* COMPOSES `runAgentRounds` as a single-task leaf: one box, a refine driver bounded to
|
|
22967
22924
|
* the seam's `maxIterations` (default 1), the spec's profile as the agent run.
|
|
@@ -23282,8 +23239,7 @@ function singleShotDriver(maxIterations) {
|
|
|
23282
23239
|
}
|
|
23283
23240
|
};
|
|
23284
23241
|
}
|
|
23285
|
-
|
|
23286
|
-
//#region src/runtime/supervise/executor-config.ts
|
|
23242
|
+
// src/runtime/supervise/executor-config.ts
|
|
23287
23243
|
/** Capture one public executor configuration at its call boundary. All data that selects policy,
|
|
23288
23244
|
* model, process, limits, or backend behavior is detached and deeply frozen.
|
|
23289
23245
|
* Explicit service/function fields remain live by reference because they are executable ports,
|
|
@@ -23409,6 +23365,7 @@ function snapshotExecutorConfig(config) {
|
|
|
23409
23365
|
"maxReconnects",
|
|
23410
23366
|
"modelCredential",
|
|
23411
23367
|
"modelSilenceMs",
|
|
23368
|
+
"outputFormat",
|
|
23412
23369
|
"sessionId",
|
|
23413
23370
|
"timeoutMs"
|
|
23414
23371
|
]), "createExecutor bridge config");
|
|
@@ -23608,8 +23565,7 @@ function requiredProviderProfileHarness(spec, seam) {
|
|
|
23608
23565
|
if (seam.defaults?.backend !== void 0 && seam.defaults.backend !== harness) throw new ValidationError$1(`createExecutor(provider, steering): provider default backend "${seam.defaults.backend}" conflicts with AgentProfile.harness "${harness}"`);
|
|
23609
23566
|
return harness;
|
|
23610
23567
|
}
|
|
23611
|
-
|
|
23612
|
-
//#region src/runtime/supervise/executor-registry.ts
|
|
23568
|
+
// src/runtime/supervise/executor-registry.ts
|
|
23613
23569
|
/**
|
|
23614
23570
|
* The open resolver/registry. Pre-registers the three built-ins under their
|
|
23615
23571
|
* runtime tags (`'router'`, `'sandbox'`, `'cli'`) and accepts `register(name,
|
|
@@ -23669,8 +23625,7 @@ function createExecutorRegistry() {
|
|
|
23669
23625
|
}
|
|
23670
23626
|
};
|
|
23671
23627
|
}
|
|
23672
|
-
|
|
23673
|
-
//#region src/durable/spawn-journal/event-index.ts
|
|
23628
|
+
// src/durable/spawn-journal/event-index.ts
|
|
23674
23629
|
/**
|
|
23675
23630
|
* A trace root is valid only beside the output it commits to, with a well-formed root, artifact
|
|
23676
23631
|
* reference and leaf count (at least the summary leaf). Records written before trace roots carry
|
|
@@ -23877,8 +23832,7 @@ function outsideCursorNamespace(ev) {
|
|
|
23877
23832
|
function insideCursorNamespace(ev) {
|
|
23878
23833
|
return !outsideKinds.has(ev.kind);
|
|
23879
23834
|
}
|
|
23880
|
-
|
|
23881
|
-
//#region src/durable/jsonl-append.ts
|
|
23835
|
+
// src/durable/jsonl-append.ts
|
|
23882
23836
|
/** Commit JSONL bytes and validate their descriptor under one generation fence. @internal */
|
|
23883
23837
|
function commitJsonLine(path, record, acknowledge) {
|
|
23884
23838
|
const encoded = JSON.stringify(record);
|
|
@@ -23952,8 +23906,7 @@ function readAt(fd, buffer, position) {
|
|
|
23952
23906
|
offset += read;
|
|
23953
23907
|
}
|
|
23954
23908
|
}
|
|
23955
|
-
|
|
23956
|
-
//#region src/durable/jsonl-file.ts
|
|
23909
|
+
// src/durable/jsonl-file.ts
|
|
23957
23910
|
/** Read a fixed file prefix one record at a time, never allocating the whole journal as a string.
|
|
23958
23911
|
* A reader cannot chase concurrent appends forever. Missing files are empty only when requested;
|
|
23959
23912
|
* corruption, short reads, and other I/O errors remain failures. Closing the iterator closes the fd. */
|
|
@@ -24072,7 +24025,7 @@ async function upsertCommittedJsonLine(path, record, key) {
|
|
|
24072
24025
|
allowWhitespaceLines: true
|
|
24073
24026
|
})) if (key(prior) !== id) updated.push(prior);
|
|
24074
24027
|
updated.push(snapshot);
|
|
24075
|
-
const { writeAtomicDurableFile } = await import("./record-events-
|
|
24028
|
+
const { writeAtomicDurableFile } = await import("./record-events-B2GUgYdz.js").then((n) => n.i);
|
|
24076
24029
|
writeAtomicDurableFile(path, `${updated.map((row) => JSON.stringify(row)).join("\n")}\n`, { preserveMode: true });
|
|
24077
24030
|
}
|
|
24078
24031
|
/** Recover a torn tail under the same generation fence as durable publications. @internal */
|
|
@@ -24084,8 +24037,7 @@ async function prepareJsonlAppend(path) {
|
|
|
24084
24037
|
function isNoEntError(error) {
|
|
24085
24038
|
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
24086
24039
|
}
|
|
24087
|
-
|
|
24088
|
-
//#region src/durable/spawn-journal/result-blob-store.ts
|
|
24040
|
+
// src/durable/spawn-journal/result-blob-store.ts
|
|
24089
24041
|
/**
|
|
24090
24042
|
* FS `ResultBlobStore`. One JSON file per artifact under `dir`, named by a
|
|
24091
24043
|
* filesystem-safe encoding of the `outRef` (`sha256:<hex>` → `sha256-<hex>.json`).
|
|
@@ -24154,8 +24106,7 @@ function assertContentAddress(outRef, artifact) {
|
|
|
24154
24106
|
const expected = contentAddress(artifact);
|
|
24155
24107
|
if (outRef !== expected) throw new Error(`blob outRef '${outRef}' does not match the artifact content hash '${expected}'; a content-addressed store refuses a mismatched ref (breaks the replay invariant)`);
|
|
24156
24108
|
}
|
|
24157
|
-
|
|
24158
|
-
//#region src/durable/in-memory-spawn-stores.ts
|
|
24109
|
+
// src/durable/in-memory-spawn-stores.ts
|
|
24159
24110
|
/** In-process decision and payload retention; no acknowledged state survives process exit. */
|
|
24160
24111
|
/**
|
|
24161
24112
|
* In-memory `ResultBlobStore`. Content-addressed: `put` verifies the supplied
|
|
@@ -24211,8 +24162,7 @@ var InMemorySpawnJournal = class {
|
|
|
24211
24162
|
tree.index.add(event);
|
|
24212
24163
|
}
|
|
24213
24164
|
};
|
|
24214
|
-
|
|
24215
|
-
//#region src/runtime/supervise/tree-key.ts
|
|
24165
|
+
// src/runtime/supervise/tree-key.ts
|
|
24216
24166
|
/** Runtime tag used only for a child that owns another supervised scope. */
|
|
24217
24167
|
const driverRuntime = "driver";
|
|
24218
24168
|
const nestedDriverTreeOwners = /* @__PURE__ */ new WeakSet();
|
|
@@ -24229,8 +24179,7 @@ function attestNestedDriverTreeOwner(owner) {
|
|
|
24229
24179
|
function runtimeOwnedNestedDriverTreeRoot(owner, parentTreeRoot, driverNodeId) {
|
|
24230
24180
|
return nestedDriverTreeOwners.has(owner) ? nestedDriverTreeRoot(parentTreeRoot, driverNodeId) : void 0;
|
|
24231
24181
|
}
|
|
24232
|
-
|
|
24233
|
-
//#region src/durable/spawn-journal/settlement-evidence.ts
|
|
24182
|
+
// src/durable/spawn-journal/settlement-evidence.ts
|
|
24234
24183
|
/** Copy a terminal record's overspend at the journal boundary; absent stays absent. */
|
|
24235
24184
|
function budgetViolationOf(event) {
|
|
24236
24185
|
if (event.budgetViolation === void 0) return {};
|
|
@@ -24262,8 +24211,7 @@ function traceEvidenceFor(event) {
|
|
|
24262
24211
|
reason: "legacy-settlement-without-trace-evidence"
|
|
24263
24212
|
};
|
|
24264
24213
|
}
|
|
24265
|
-
|
|
24266
|
-
//#region src/durable/spawn-journal/tree-view.ts
|
|
24214
|
+
// src/durable/spawn-journal/tree-view.ts
|
|
24267
24215
|
/**
|
|
24268
24216
|
* Materialize a recorded `TreeView` from a journaled event list for inspection. Folds
|
|
24269
24217
|
* `spawned`/`settled`/`cancelled` into a per-node snapshot in `seq` order, then adds each
|
|
@@ -24292,28 +24240,22 @@ function materializeTreeView(events) {
|
|
|
24292
24240
|
spent: zeroSpend()
|
|
24293
24241
|
});
|
|
24294
24242
|
}
|
|
24295
|
-
for (const ev of settlements)
|
|
24243
|
+
for (const ev of settlements) {
|
|
24296
24244
|
const node = requireNode(nodes, ev.id);
|
|
24297
|
-
|
|
24298
|
-
node.
|
|
24245
|
+
const down = ev.kind === "cancelled" || ev.status === "down";
|
|
24246
|
+
node.status = ev.kind === "cancelled" ? "cancelled" : down ? "failed" : "done";
|
|
24247
|
+
if (ev.spent !== void 0) node.spent = cloneSpend(ev.spent);
|
|
24299
24248
|
node.providerModel = copyProviderModelEvidence(ev.providerModel);
|
|
24300
24249
|
node.outRef = ev.outRef;
|
|
24301
|
-
node.
|
|
24302
|
-
|
|
24303
|
-
|
|
24304
|
-
|
|
24305
|
-
|
|
24306
|
-
|
|
24307
|
-
} else {
|
|
24308
|
-
const node = requireNode(nodes, ev.id);
|
|
24309
|
-
node.status = "cancelled";
|
|
24310
|
-
node.trace = ev.trace ?? {
|
|
24250
|
+
node.failure = down ? ev.failure ?? settlementFailureCause({
|
|
24251
|
+
reason: ev.reason ?? (ev.kind === "settled" ? ev.verdict?.notes : void 0) ?? "child down",
|
|
24252
|
+
infra: ev.infra,
|
|
24253
|
+
retainedPendingCause: ev.retainedPendingCause
|
|
24254
|
+
}) : void 0;
|
|
24255
|
+
node.trace = ev.kind === "cancelled" ? ev.trace ?? {
|
|
24311
24256
|
status: "unavailable",
|
|
24312
24257
|
reason: "execution-did-not-start"
|
|
24313
|
-
};
|
|
24314
|
-
if (ev.spent !== void 0) node.spent = cloneSpend(ev.spent);
|
|
24315
|
-
node.providerModel = copyProviderModelEvidence(ev.providerModel);
|
|
24316
|
-
node.outRef = ev.outRef;
|
|
24258
|
+
} : traceEvidenceFor(ev);
|
|
24317
24259
|
node.budgetViolation = budgetViolationOf(ev).budgetViolation;
|
|
24318
24260
|
if (ev.retainedExecution !== void 0) node.retainedExecution = ev.retainedExecution;
|
|
24319
24261
|
if (ev.retainedPendingCause !== void 0) node.retainedPendingCause = ev.retainedPendingCause;
|
|
@@ -24334,7 +24276,10 @@ function materializeTreeView(events) {
|
|
|
24334
24276
|
}
|
|
24335
24277
|
for (const ev of [...events].filter((event) => event.kind === "reconciled").sort((a, b) => a.seq - b.seq)) {
|
|
24336
24278
|
const node = requireNode(nodes, ev.id);
|
|
24337
|
-
if (node.status === "pending")
|
|
24279
|
+
if (node.status === "pending") {
|
|
24280
|
+
node.spent = cloneSpend(ev.spent);
|
|
24281
|
+
node.failure = ev.failure;
|
|
24282
|
+
}
|
|
24338
24283
|
}
|
|
24339
24284
|
for (const ev of events) {
|
|
24340
24285
|
if (ev.kind !== "metered") continue;
|
|
@@ -24359,6 +24304,7 @@ function freezeSnapshot(node) {
|
|
|
24359
24304
|
parent: node.parent,
|
|
24360
24305
|
label: node.label,
|
|
24361
24306
|
status: node.status,
|
|
24307
|
+
...node.failure === void 0 ? {} : { failure: node.failure },
|
|
24362
24308
|
runtime: node.runtime,
|
|
24363
24309
|
budget: node.budget,
|
|
24364
24310
|
ownedTreeRoot: node.ownedTreeRoot,
|
|
@@ -24378,8 +24324,7 @@ function freezeSnapshot(node) {
|
|
|
24378
24324
|
spawnedAt: node.spawnedAt
|
|
24379
24325
|
};
|
|
24380
24326
|
}
|
|
24381
|
-
|
|
24382
|
-
//#region src/durable/spawn-journal/spawn-forest.ts
|
|
24327
|
+
// src/durable/spawn-journal/spawn-forest.ts
|
|
24383
24328
|
/**
|
|
24384
24329
|
* Load every journal tree owned by one recursive supervision run and flatten its nodes/events.
|
|
24385
24330
|
*
|
|
@@ -24480,8 +24425,7 @@ function ownedTreeRootSpawn(spawn) {
|
|
|
24480
24425
|
const { parent: _parent, ownedTreeRoot: _ownedTreeRoot, ...root } = spawn;
|
|
24481
24426
|
return root;
|
|
24482
24427
|
}
|
|
24483
|
-
|
|
24484
|
-
//#region src/runtime/supervise/retained-owner-checkpoint-requests.ts
|
|
24428
|
+
// src/runtime/supervise/retained-owner-checkpoint-requests.ts
|
|
24485
24429
|
/** Reconstruct authority for this source only; a replacement cannot own its snapshots. */
|
|
24486
24430
|
async function checkpointHandle(state, sourceEnvironmentId, signal) {
|
|
24487
24431
|
const cached = state.checkpointHandles?.get(sourceEnvironmentId);
|
|
@@ -24573,8 +24517,7 @@ function pendingCheckpoints(events, state) {
|
|
|
24573
24517
|
const confirmed = new Set(events.flatMap((event) => event.kind === "workspace-checkpoint-cleanup" && event.id === state.args.nodeId && event.provider === state.provider?.name && event.confirmed ? [JSON.stringify([event.environmentId, event.checkpointId])] : []));
|
|
24574
24518
|
return events.filter((event) => event.kind === "workspace-checkpoint" && event.id === state.args.nodeId && event.provider === state.provider?.name && !confirmed.has(JSON.stringify([event.environmentId, event.checkpoint.checkpointId])));
|
|
24575
24519
|
}
|
|
24576
|
-
|
|
24577
|
-
//#region src/runtime/supervise/retained-owner-checkpoint-capture.ts
|
|
24520
|
+
// src/runtime/supervise/retained-owner-checkpoint-capture.ts
|
|
24578
24521
|
/**
|
|
24579
24522
|
* Delete checkpoints, each only after its files are captured into the run's content-addressed
|
|
24580
24523
|
* store; a checkpoint no capture holds is kept, and the cleanup record says why. Only the
|
|
@@ -24841,8 +24784,7 @@ async function settleCaptureForks(state) {
|
|
|
24841
24784
|
}
|
|
24842
24785
|
return unresolved;
|
|
24843
24786
|
}
|
|
24844
|
-
|
|
24845
|
-
//#region src/runtime/supervise/retained-owner-state.ts
|
|
24787
|
+
// src/runtime/supervise/retained-owner-state.ts
|
|
24846
24788
|
const owners = /* @__PURE__ */ new WeakMap();
|
|
24847
24789
|
/** @internal Scope construction carries this private policy to every nested owner scope. */
|
|
24848
24790
|
const retainedOwnerWorkspaceRetentionSeamKey = "runtime.retainedOwnerWorkspaceRetention";
|
|
@@ -24881,8 +24823,7 @@ function bindScopeRetainedOwnerEnvironmentId(scope, liveEnvironmentId) {
|
|
|
24881
24823
|
const state = owners.get(scope);
|
|
24882
24824
|
if (state) state.liveEnvironmentId = liveEnvironmentId;
|
|
24883
24825
|
}
|
|
24884
|
-
|
|
24885
|
-
//#region src/runtime/supervise/retained-owner-checkpoint-rotation.ts
|
|
24826
|
+
// src/runtime/supervise/retained-owner-checkpoint-rotation.ts
|
|
24886
24827
|
/**
|
|
24887
24828
|
* Note that the owner's manager made a coordination call, and checkpoint its workspace when the
|
|
24888
24829
|
* last checkpoint is older than {@link WORKSPACE_CHECKPOINT_MIN_INTERVAL_MS}.
|
|
@@ -24996,8 +24937,7 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
24996
24937
|
* on the same evidence store, and the final capture spent 26.6 of its 32.6 minutes storing its
|
|
24997
24938
|
* archive until the root's budget deadline aborted the rotation.
|
|
24998
24939
|
*/
|
|
24999
|
-
|
|
25000
|
-
//#region src/runtime/supervise/retained-owner-evidence.ts
|
|
24940
|
+
// src/runtime/supervise/retained-owner-evidence.ts
|
|
25001
24941
|
/**
|
|
25002
24942
|
* The workspace evidence of a retained owner's turns: which attempts hold a verified capture
|
|
25003
24943
|
* receipt, recapture before a source is reused, and evidence debt. An accepted turn whose capture
|
|
@@ -25182,7 +25122,7 @@ async function owePendingEvidence(state, events, attempt, environmentId, failure
|
|
|
25182
25122
|
/** How capture retries of owed evidence back off, measured on the run's clock. */
|
|
25183
25123
|
const EVIDENCE_RETRY_BACKOFF_MS = {
|
|
25184
25124
|
initial: 3e4,
|
|
25185
|
-
max:
|
|
25125
|
+
max: 3e5
|
|
25186
25126
|
};
|
|
25187
25127
|
/** How often the retry loop reads the run's clock. Reading it costs no provider call. */
|
|
25188
25128
|
const EVIDENCE_RETRY_TICK_MS = 1e3;
|
|
@@ -25398,8 +25338,7 @@ async function abandonInputAdmittedIntoDebt(state, indebted) {
|
|
|
25398
25338
|
delete state.taskRef;
|
|
25399
25339
|
state.admissions.length = 0;
|
|
25400
25340
|
}
|
|
25401
|
-
|
|
25402
|
-
//#region src/runtime/supervise/retained-owner-environment-recovery.ts
|
|
25341
|
+
// src/runtime/supervise/retained-owner-environment-recovery.ts
|
|
25403
25342
|
/**
|
|
25404
25343
|
* The checkpoint a new environment of this owner starts from: the latest one journaled before
|
|
25405
25344
|
* the invocation's input, taken from an environment the provider has since lost. Only such an
|
|
@@ -25527,8 +25466,7 @@ async function reconcileScopeRetainedOwnerEnvironment(scope) {
|
|
|
25527
25466
|
environmentId
|
|
25528
25467
|
};
|
|
25529
25468
|
}
|
|
25530
|
-
|
|
25531
|
-
//#region src/runtime/supervise/retained-owner-turn-lifecycle.ts
|
|
25469
|
+
// src/runtime/supervise/retained-owner-turn-lifecycle.ts
|
|
25532
25470
|
/** Cut short the captures a checkpoint rotation is running; each keeps its checkpoint. */
|
|
25533
25471
|
function preemptRotationCaptures(state) {
|
|
25534
25472
|
state.rotationCaptures?.abort(/* @__PURE__ */ new Error("the turn's end-of-turn capture goes first; checkpoint kept"));
|
|
@@ -25605,8 +25543,7 @@ async function scopeRetainedOwnerSettled(scope) {
|
|
|
25605
25543
|
await state.releasing?.catch(() => void 0);
|
|
25606
25544
|
await stopOwnerEvidenceRetry(state);
|
|
25607
25545
|
}
|
|
25608
|
-
|
|
25609
|
-
//#region src/runtime/supervise/retained-owner-invocation.ts
|
|
25546
|
+
// src/runtime/supervise/retained-owner-invocation.ts
|
|
25610
25547
|
/** The scope owns these writers; provider adapters receive only the restricted context. */
|
|
25611
25548
|
function registerScopeRetainedOwner(scope, args) {
|
|
25612
25549
|
const events = args.priorEvents.filter((event) => "id" in event && event.id === args.nodeId);
|
|
@@ -25918,8 +25855,7 @@ function consumeScopeRetainedOwnerResult(scope) {
|
|
|
25918
25855
|
if (!state?.acceptedRef) throw new ValidationError$1("retained owner has no accepted result");
|
|
25919
25856
|
state.acceptedConsumed = true;
|
|
25920
25857
|
}
|
|
25921
|
-
|
|
25922
|
-
//#region src/runtime/supervise/retained-owner-release.ts
|
|
25858
|
+
// src/runtime/supervise/retained-owner-release.ts
|
|
25923
25859
|
/** @internal Whether another owner release could still destroy what the last one left. */
|
|
25924
25860
|
function retainedOwnerReleaseRetriable(scope) {
|
|
25925
25861
|
return owners.get(scope)?.releaseRetriable ?? false;
|
|
@@ -25933,7 +25869,7 @@ function retainedOwnerReleaseRetriable(scope) {
|
|
|
25933
25869
|
* settled 98 minutes after its deadline. The release captures that finished there took 67 seconds
|
|
25934
25870
|
* and 7 and 34 minutes, beside live captures of abandoned directors on the same slots.
|
|
25935
25871
|
*/
|
|
25936
|
-
const RELEASE_CHECKPOINT_CAPTURES_MS =
|
|
25872
|
+
const RELEASE_CHECKPOINT_CAPTURES_MS = 9e5;
|
|
25937
25873
|
/**
|
|
25938
25874
|
* Release the owner's environment once no turn of it will run again: at the run's final
|
|
25939
25875
|
* settlement for the root, and when a nested manager's own scope has finished. A second call while
|
|
@@ -26119,8 +26055,7 @@ function unsettledOwnerRuns(events, nodeId, environmentId) {
|
|
|
26119
26055
|
close();
|
|
26120
26056
|
return [...runs.values()];
|
|
26121
26057
|
}
|
|
26122
|
-
|
|
26123
|
-
//#region src/mcp/tools/spawn-resource-paths.ts
|
|
26058
|
+
// src/mcp/tools/spawn-resource-paths.ts
|
|
26124
26059
|
/**
|
|
26125
26060
|
* Inline resources a manager hands a child by PATH instead of by content.
|
|
26126
26061
|
*
|
|
@@ -26163,7 +26098,7 @@ function unsettledOwnerRuns(events, nodeId, environmentId) {
|
|
|
26163
26098
|
* - bytes that are not valid UTF-8 → refused; `content` is a string, so binary data is encoded
|
|
26164
26099
|
* (base64) by the manager first, exactly as it would be for a content resource
|
|
26165
26100
|
*/
|
|
26166
|
-
const SPAWN_RESOURCE_PATH_MAX_BYTES =
|
|
26101
|
+
const SPAWN_RESOURCE_PATH_MAX_BYTES = 4194304;
|
|
26167
26102
|
/** The host-directory reader: a manager whose workspace is a directory this process can open. */
|
|
26168
26103
|
function hostDirectoryReader(root) {
|
|
26169
26104
|
return {
|
|
@@ -26424,8 +26359,7 @@ async function resolveSpawnResourcePaths(profile, source) {
|
|
|
26424
26359
|
resolved
|
|
26425
26360
|
};
|
|
26426
26361
|
}
|
|
26427
|
-
|
|
26428
|
-
//#region src/runtime/supervise/retained-owner-resource-reader.ts
|
|
26362
|
+
// src/runtime/supervise/retained-owner-resource-reader.ts
|
|
26429
26363
|
/**
|
|
26430
26364
|
* The owner's environment as a source of by-path spawn resources.
|
|
26431
26365
|
*
|
|
@@ -26492,8 +26426,7 @@ function scopeRetainedOwnerResourceReader(scope) {
|
|
|
26492
26426
|
}
|
|
26493
26427
|
};
|
|
26494
26428
|
}
|
|
26495
|
-
|
|
26496
|
-
//#region src/runtime/supervise/retained-owner-seat-switch.ts
|
|
26429
|
+
// src/runtime/supervise/retained-owner-seat-switch.ts
|
|
26497
26430
|
/** A committed turn is the seat boundary. Keep its native home for a same-harness provider
|
|
26498
26431
|
* continuation; only a provider/harness change needs a new environment. */
|
|
26499
26432
|
async function prepareScopeRetainedOwnerSeatSwitch(scope, mode) {
|
|
@@ -26548,8 +26481,7 @@ async function retireSeatEnvironment(scope, state) {
|
|
|
26548
26481
|
at: new Date(args.now()).toISOString()
|
|
26549
26482
|
});
|
|
26550
26483
|
}
|
|
26551
|
-
|
|
26552
|
-
//#region src/runtime/supervise/scope-capabilities.ts
|
|
26484
|
+
// src/runtime/supervise/scope-capabilities.ts
|
|
26553
26485
|
/** Runtime-owned provider evidence is written through this private scope capability. */
|
|
26554
26486
|
const runtimeOwnedProviderMeters = /* @__PURE__ */ new WeakMap();
|
|
26555
26487
|
const pauseRecorders = /* @__PURE__ */ new WeakMap();
|
|
@@ -26759,7 +26691,7 @@ function hasRetriableTeardowns(scope, release) {
|
|
|
26759
26691
|
* A driver's `act` returning does not stop everything that holds its scope: a supervisor tool
|
|
26760
26692
|
* whose handler outran its response fence keeps running detached (`single-flight-tools`
|
|
26761
26693
|
* `background()`) with the coordination verbs still bound, and a verb call reaches `spawn`
|
|
26762
|
-
* in-process — closing the MCP listener does not reach it.
|
|
26694
|
+
* in-process — closing the MCP listener does not reach it. Such a handler
|
|
26763
26695
|
* spawned `distill:all` 309 ms after the barrier had drained and released. The child was
|
|
26764
26696
|
* admitted, took a conserved reservation, built a sandbox, ran 12.4 s of provider work, and
|
|
26765
26697
|
* journaled its settlement 19 s after the run had already written its failure — while the live
|
|
@@ -26819,8 +26751,7 @@ function meterRuntimeOwnedAccounting(scope, spend, detail, options) {
|
|
|
26819
26751
|
if (meter === void 0) throw new ValidationError$1("scope: Runtime-owned provider meter is not bound to this scope");
|
|
26820
26752
|
return meter(spend, void 0, detail, true, options?.alreadySpent === true);
|
|
26821
26753
|
}
|
|
26822
|
-
|
|
26823
|
-
//#region src/runtime/supervise/dispatch.ts
|
|
26754
|
+
// src/runtime/supervise/dispatch.ts
|
|
26824
26755
|
/**
|
|
26825
26756
|
*
|
|
26826
26757
|
* `rollingDispatch` — the REFILLING dispatch policy over a `Scope`. It keeps `width` children in
|
|
@@ -26950,8 +26881,7 @@ function queueOf(units, budget) {
|
|
|
26950
26881
|
};
|
|
26951
26882
|
};
|
|
26952
26883
|
}
|
|
26953
|
-
|
|
26954
|
-
//#region src/runtime/supervise/scope-identity.ts
|
|
26884
|
+
// src/runtime/supervise/scope-identity.ts
|
|
26955
26885
|
/** Fail before execution when a reservation policy is malformed. */
|
|
26956
26886
|
function assertRecursiveReservationPolicy(policy) {
|
|
26957
26887
|
if (policy === void 0) return;
|
|
@@ -26999,8 +26929,7 @@ function isAgentSpec(value) {
|
|
|
26999
26929
|
const v = value;
|
|
27000
26930
|
return "profile" in v && "harness" in v;
|
|
27001
26931
|
}
|
|
27002
|
-
|
|
27003
|
-
//#region src/runtime/supervise/scope-observation.ts
|
|
26932
|
+
// src/runtime/supervise/scope-observation.ts
|
|
27004
26933
|
/**
|
|
27005
26934
|
* The direct workers of `parentId` that a resumed journal holds open, and which of them this
|
|
27006
26935
|
* process re-places through a retained recovery. One function, so the root's `root-reentered`
|
|
@@ -27150,6 +27079,7 @@ function makeTreeView(root, children) {
|
|
|
27150
27079
|
parent: root,
|
|
27151
27080
|
label: c.label,
|
|
27152
27081
|
status: c.status,
|
|
27082
|
+
...c.failure === void 0 ? {} : { failure: c.failure },
|
|
27153
27083
|
runtime: c.runtime,
|
|
27154
27084
|
budget: c.budget,
|
|
27155
27085
|
...c.ownedTreeRoot === void 0 ? {} : { ownedTreeRoot: c.ownedTreeRoot },
|
|
@@ -27230,8 +27160,7 @@ async function readInteractiveReadyUntilWorkerEnds(readReady, workerEnded, signa
|
|
|
27230
27160
|
signal.removeEventListener("abort", onAbort);
|
|
27231
27161
|
}
|
|
27232
27162
|
}
|
|
27233
|
-
|
|
27234
|
-
//#region src/runtime/supervise/provider-visible-profile.ts
|
|
27163
|
+
// src/runtime/supervise/provider-visible-profile.ts
|
|
27235
27164
|
/** Runtime-owned coordination is mounted under this MCP alias. */
|
|
27236
27165
|
const coordinationMcpAlias = "agent-runtime-coordination";
|
|
27237
27166
|
/** A profile declares Runtime-owned tools with this provider-neutral prefix. */
|
|
@@ -27264,8 +27193,7 @@ function withoutRuntimeGraph(profile) {
|
|
|
27264
27193
|
const { metadata: _metadata, ...withoutMetadata } = profile;
|
|
27265
27194
|
return withoutMetadata;
|
|
27266
27195
|
}
|
|
27267
|
-
|
|
27268
|
-
//#region src/runtime/supervise/scope-owner-materialization.ts
|
|
27196
|
+
// src/runtime/supervise/scope-owner-materialization.ts
|
|
27269
27197
|
/**
|
|
27270
27198
|
* @internal Record the execution a pending executor started for the current attempt. A bridge
|
|
27271
27199
|
* manager whose turn ends before the bridge acknowledges it then still names its session:
|
|
@@ -27592,8 +27520,7 @@ function bindScopeOwnerMaterialization(scope, args, now) {
|
|
|
27592
27520
|
});
|
|
27593
27521
|
}
|
|
27594
27522
|
}
|
|
27595
|
-
|
|
27596
|
-
//#region src/runtime/supervise/scope-owner-meter.ts
|
|
27523
|
+
// src/runtime/supervise/scope-owner-meter.ts
|
|
27597
27524
|
/** The scope owner's own inference: debited from the shared pool, journaled, and announced. */
|
|
27598
27525
|
var ScopeOwnerMeter = class {
|
|
27599
27526
|
args;
|
|
@@ -27648,8 +27575,7 @@ var ScopeOwnerMeter = class {
|
|
|
27648
27575
|
if (observeError !== void 0) throw observeError;
|
|
27649
27576
|
}
|
|
27650
27577
|
};
|
|
27651
|
-
|
|
27652
|
-
//#region src/runtime/supervise/terminal-record.ts
|
|
27578
|
+
// src/runtime/supervise/terminal-record.ts
|
|
27653
27579
|
/** The settlement fields every writer copies, in the terminal record's key order. The
|
|
27654
27580
|
* `reconciled` record is built from this same spread so it and the terminal record can never
|
|
27655
27581
|
* disagree on a field. */
|
|
@@ -27658,6 +27584,7 @@ function settlementFields(subject, settlement) {
|
|
|
27658
27584
|
spent: subject.spent,
|
|
27659
27585
|
...settlement.infra === void 0 ? {} : { infra: settlement.infra },
|
|
27660
27586
|
reason: settlement.reason,
|
|
27587
|
+
...settlement.failure === void 0 ? {} : { failure: settlement.failure },
|
|
27661
27588
|
...settlement.retainedPendingCause === void 0 ? {} : { retainedPendingCause: settlement.retainedPendingCause },
|
|
27662
27589
|
...settlement.outRef ? { outRef: settlement.outRef } : {},
|
|
27663
27590
|
...settlement.outRef && settlement.traceRoot ? { traceRoot: settlement.traceRoot } : {},
|
|
@@ -27697,6 +27624,7 @@ function terminalDownEvent(subject, settlement, seq, at, retainedExecution) {
|
|
|
27697
27624
|
*/
|
|
27698
27625
|
function settledNodeEvidence(subject, settlement, settledAt) {
|
|
27699
27626
|
return {
|
|
27627
|
+
...settlement.kind === "down" && settlement.failure !== void 0 ? { failure: detachedSnapshot(settlement.failure, "worker failure") } : {},
|
|
27700
27628
|
runtime: subject.runtime,
|
|
27701
27629
|
startedAt: subject.startedAt,
|
|
27702
27630
|
settledAt,
|
|
@@ -27729,8 +27657,7 @@ function releasedChildPayload(subject, settlement, settledAt, releasedAt, retain
|
|
|
27729
27657
|
}, settledAt)
|
|
27730
27658
|
};
|
|
27731
27659
|
}
|
|
27732
|
-
|
|
27733
|
-
//#region src/runtime/supervise/scope-settlement.ts
|
|
27660
|
+
// src/runtime/supervise/scope-settlement.ts
|
|
27734
27661
|
/** Await whichever pending child settles first, returning the child (its `resolved` is set
|
|
27735
27662
|
* by the time this resolves because `runChild`'s `.then` sets it before the promise
|
|
27736
27663
|
* resolves downstream). */
|
|
@@ -27804,6 +27731,8 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
27804
27731
|
const at = new Date(settledAt).toISOString();
|
|
27805
27732
|
if (settlement.metered) await appendSettlementMetering(args.journal, args.root, child.id, settlement.metered, at);
|
|
27806
27733
|
if (settlement.kind === "down") {
|
|
27734
|
+
settlement.failure ??= settlementFailureCause(settlement);
|
|
27735
|
+
child.failure = settlement.failure;
|
|
27807
27736
|
child.status = child.cancellationReason === void 0 ? "failed" : "cancelled";
|
|
27808
27737
|
child.outRef = settlement.outRef;
|
|
27809
27738
|
child.trace = settlement.trace;
|
|
@@ -27861,6 +27790,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
27861
27790
|
seq
|
|
27862
27791
|
};
|
|
27863
27792
|
}
|
|
27793
|
+
child.failure = void 0;
|
|
27864
27794
|
child.status = "done";
|
|
27865
27795
|
child.outRef = settlement.outRef;
|
|
27866
27796
|
child.spent = settlement.spent;
|
|
@@ -27928,8 +27858,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
27928
27858
|
* applied per child). The reservation is reconciled on EVERY path (success, abort, throw)
|
|
27929
27859
|
* so the conserved pool can never leak a reservation.
|
|
27930
27860
|
*/
|
|
27931
|
-
|
|
27932
|
-
//#region src/runtime/supervise/scope-settlement-cursor.ts
|
|
27861
|
+
// src/runtime/supervise/scope-settlement-cursor.ts
|
|
27933
27862
|
/**
|
|
27934
27863
|
* The scope's `next()` cursor: delivers each child's settlement exactly once, stamps the cursor
|
|
27935
27864
|
* `seq`, and tracks the settlement writes still landing so a drain can wait for them.
|
|
@@ -27994,8 +27923,7 @@ var ScopeSettlementCursor = class {
|
|
|
27994
27923
|
}
|
|
27995
27924
|
}
|
|
27996
27925
|
};
|
|
27997
|
-
|
|
27998
|
-
//#region src/runtime/supervise/scope-child-materialization.ts
|
|
27926
|
+
// src/runtime/supervise/scope-child-materialization.ts
|
|
27999
27927
|
/** Publish the execution receipt only after the child spawn is durable. */
|
|
28000
27928
|
function createChildMaterialization({ args, spawnCommitted, identity, spec, executor, deferredOwner, attemptId, id, recovery, live, ordinal, now }) {
|
|
28001
27929
|
let pendingEvidence;
|
|
@@ -28125,8 +28053,7 @@ async function appendNodeMaterialization(args, id, seq, receipt, binding, now) {
|
|
|
28125
28053
|
at
|
|
28126
28054
|
});
|
|
28127
28055
|
}
|
|
28128
|
-
|
|
28129
|
-
//#region src/runtime/supervise/scope-child-retention.ts
|
|
28056
|
+
// src/runtime/supervise/scope-child-retention.ts
|
|
28130
28057
|
/** Own the retained child invocation and its durable writes. */
|
|
28131
28058
|
function createChildRetention({ args, controller, id, ordinal, identity, recovery, opts, now, traceRoots, markRecoveryReady, childDeadlineAtMs, readLive, completeEvidence }) {
|
|
28132
28059
|
const retainedWrites = /* @__PURE__ */ new Set();
|
|
@@ -28278,8 +28205,7 @@ function createChildRetention({ args, controller, id, ordinal, identity, recover
|
|
|
28278
28205
|
function overBudget(budget, spent) {
|
|
28279
28206
|
return chargedTokens(spent.tokens) > budget.maxTokens || spent.iterations > budget.maxIterations || budget.maxUsd !== void 0 && spent.usdKnown !== false && spent.usd > budget.maxUsd;
|
|
28280
28207
|
}
|
|
28281
|
-
|
|
28282
|
-
//#region src/durable/spawn-journal/journal-store.ts
|
|
28208
|
+
// src/durable/spawn-journal/journal-store.ts
|
|
28283
28209
|
/**
|
|
28284
28210
|
* Append every event as one grouped publication where the journal supports it (`appendEvents`),
|
|
28285
28211
|
* preserving legacy per-event appends otherwise — the SQL contexts' fenced head advances once.
|
|
@@ -28439,8 +28365,7 @@ var FileSpawnJournal = class {
|
|
|
28439
28365
|
function journalFileStamp(stat) {
|
|
28440
28366
|
return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;
|
|
28441
28367
|
}
|
|
28442
|
-
|
|
28443
|
-
//#region src/runtime/retained-interactive-handle.ts
|
|
28368
|
+
// src/runtime/retained-interactive-handle.ts
|
|
28444
28369
|
function createRetainedInteractiveRunHandle(environment, inputRef, capabilities, requestedStart) {
|
|
28445
28370
|
const ref = freezeInteractiveRef(inputRef);
|
|
28446
28371
|
const source = environment.interactive(ref);
|
|
@@ -28510,8 +28435,7 @@ function exactTerminal(ref, request, terminal) {
|
|
|
28510
28435
|
function sameInteractiveRef(left, right) {
|
|
28511
28436
|
return canonicalCandidateDigest(left) === canonicalCandidateDigest(right);
|
|
28512
28437
|
}
|
|
28513
|
-
|
|
28514
|
-
//#region src/runtime/retained-interactive.ts
|
|
28438
|
+
// src/runtime/retained-interactive.ts
|
|
28515
28439
|
/**
|
|
28516
28440
|
* Start one retry-safe native coding-agent TUI without dispatching a headless turn.
|
|
28517
28441
|
* The intent admission is durable before provider.create; the environment and
|
|
@@ -28648,12 +28572,13 @@ function interactiveRequest(options, environment, profile, requestedProfileDiges
|
|
|
28648
28572
|
...options.cols === void 0 ? {} : { cols: options.cols },
|
|
28649
28573
|
...options.rows === void 0 ? {} : { rows: options.rows }
|
|
28650
28574
|
};
|
|
28575
|
+
const run = agentInteractiveSessionRunRef({
|
|
28576
|
+
provider: options.provider.name,
|
|
28577
|
+
environmentId: environment.id,
|
|
28578
|
+
...identity
|
|
28579
|
+
}, start);
|
|
28651
28580
|
return exactAgentInteractiveSessionStart({
|
|
28652
|
-
run
|
|
28653
|
-
provider: options.provider.name,
|
|
28654
|
-
environmentId: environment.id,
|
|
28655
|
-
...identity
|
|
28656
|
-
}, start),
|
|
28581
|
+
run,
|
|
28657
28582
|
...start
|
|
28658
28583
|
});
|
|
28659
28584
|
}
|
|
@@ -28775,8 +28700,7 @@ async function destroyUnusedEnvironment(environment, cause) {
|
|
|
28775
28700
|
throw new AggregateError([cause, cleanupError], "interactive environment was invalid and could not be destroyed");
|
|
28776
28701
|
}
|
|
28777
28702
|
}
|
|
28778
|
-
|
|
28779
|
-
//#region src/runtime/supervise/worker-interactive.ts
|
|
28703
|
+
// src/runtime/supervise/worker-interactive.ts
|
|
28780
28704
|
const WORKER_BINDING_SCHEMA_VERSION = 1;
|
|
28781
28705
|
const SPAWN_JOURNAL_FILE = "spawn-journal.jsonl";
|
|
28782
28706
|
/** Directory containing exact per-worker interactive binding records. @stable */
|
|
@@ -28996,8 +28920,7 @@ function isUnsupportedProvider(error) {
|
|
|
28996
28920
|
function isUnavailableReason(value) {
|
|
28997
28921
|
return value === "unknown-node" || value === "not-live" || value === "executor-exposes-no-interactive-session" || value === "provider-has-no-interactive-contract" || value === "interactive-session-not-started" || value === "interactive-binding-not-found" || value === "interactive-binding-stale" || value === "interactive-provider-not-registered";
|
|
28998
28922
|
}
|
|
28999
|
-
|
|
29000
|
-
//#region src/runtime/supervise/interactive-admission.ts
|
|
28923
|
+
// src/runtime/supervise/interactive-admission.ts
|
|
29001
28924
|
/**
|
|
29002
28925
|
* Durable, credential-free admissions for Runtime-owned interactive workers.
|
|
29003
28926
|
*
|
|
@@ -29013,7 +28936,8 @@ function workerInteractiveAdmissionFile(eventDir, workerId, phase) {
|
|
|
29013
28936
|
const dir = workerInteractiveBindingsDir(eventDir);
|
|
29014
28937
|
const id = stableText(workerId, "worker id");
|
|
29015
28938
|
assertNoSymlinkDescendant(eventDir, dir, "interactive admission");
|
|
29016
|
-
|
|
28939
|
+
const stem = canonicalCandidateDigest({ workerId: id }).slice(7).slice(0, 32);
|
|
28940
|
+
return join(dir, `${stem}.${phase}.admission.json`);
|
|
29017
28941
|
}
|
|
29018
28942
|
/**
|
|
29019
28943
|
* Persist one retained-interactive admission without retaining sensitive start material.
|
|
@@ -29224,8 +29148,7 @@ function stableText(value, label) {
|
|
|
29224
29148
|
if (!text) throw new Error(`${label} is empty`);
|
|
29225
29149
|
return text;
|
|
29226
29150
|
}
|
|
29227
|
-
|
|
29228
|
-
//#region src/runtime/supervise/scope-contract.ts
|
|
29151
|
+
// src/runtime/supervise/scope-contract.ts
|
|
29229
29152
|
/**
|
|
29230
29153
|
* The recursion seam key. A `Scope` seeds a value of this on each child's
|
|
29231
29154
|
* `ExecutorContext.seams` so a child whose executor is a DRIVER can mount a NESTED `Scope`
|
|
@@ -29318,8 +29241,7 @@ function isToolSpanValue(value) {
|
|
|
29318
29241
|
return false;
|
|
29319
29242
|
}
|
|
29320
29243
|
}
|
|
29321
|
-
|
|
29322
|
-
//#region src/runtime/supervise/scope-child-attempt.ts
|
|
29244
|
+
// src/runtime/supervise/scope-child-attempt.ts
|
|
29323
29245
|
/**
|
|
29324
29246
|
* One child execution's settle-once state: its output, trace and transcript evidence, its
|
|
29325
29247
|
* teardown, and the single reconciliation of its reservation. Every settle exit of `runChild`
|
|
@@ -29473,8 +29395,7 @@ function assertReportedSpend(spent, context) {
|
|
|
29473
29395
|
const candidate = spent;
|
|
29474
29396
|
if (typeof candidate !== "object" || candidate === null || typeof candidate.iterations !== "number" || typeof candidate.tokens !== "object" || candidate.tokens === null) throw new ValidationError$1(`${context}: executor settled without a Spend — report what was spent or mark it unknown; a budget-exempt executor reports zero`);
|
|
29475
29397
|
}
|
|
29476
|
-
|
|
29477
|
-
//#region src/runtime/supervise/scope-execution.ts
|
|
29398
|
+
// src/runtime/supervise/scope-execution.ts
|
|
29478
29399
|
async function runChild(live, executor, childAbort, task, opts, pool, ticket, blobs, now, journal, journalRoot, nextProgressSeq, executionReady, executionEvidence, deadlineAtMs, recovering = false, closeRetainedWrites = async () => {}, budgetReady = void 0, slotReady = Promise.resolve(), priorSpent, startedAt) {
|
|
29479
29400
|
if (priorSpent !== void 0) live.spent = detachedSnapshot(priorSpent, "prior committed usage");
|
|
29480
29401
|
const attempt = new ChildExecutionAttempt(live, executor, childAbort, opts, pool, ticket, blobs, now, deadlineAtMs, startedAt);
|
|
@@ -29652,7 +29573,8 @@ function doneRecord(result, spent, trace, harnessTranscript, providerModel, mete
|
|
|
29652
29573
|
function failureRecord(failure, trace, metered, providerModel, harnessTranscript, outRef) {
|
|
29653
29574
|
return {
|
|
29654
29575
|
...downRecord(failure.error, executorFailureInfra(failure), trace, metered, providerModel, void 0, harnessTranscript),
|
|
29655
|
-
outRef
|
|
29576
|
+
outRef,
|
|
29577
|
+
failure: reportedFailureCause(failure)
|
|
29656
29578
|
};
|
|
29657
29579
|
}
|
|
29658
29580
|
/**
|
|
@@ -29788,8 +29710,7 @@ function isAbortError(err) {
|
|
|
29788
29710
|
function isInfraError(err) {
|
|
29789
29711
|
return err instanceof ValidationError$1;
|
|
29790
29712
|
}
|
|
29791
|
-
|
|
29792
|
-
//#region src/durable/spawn-journal/replay.ts
|
|
29713
|
+
// src/durable/spawn-journal/replay.ts
|
|
29793
29714
|
/**
|
|
29794
29715
|
* Re-feed a journaled spawn tree in strict `seq` order, rehydrating each settled
|
|
29795
29716
|
* child's `out` from the blob store by `outRef`, and return the `Settled[]` exactly
|
|
@@ -29836,68 +29757,50 @@ async function replaySpawnTree(journal, blobs, root) {
|
|
|
29836
29757
|
const settled = [];
|
|
29837
29758
|
for (const ev of ordered) {
|
|
29838
29759
|
if (outsideCursorNamespace(ev)) continue;
|
|
29839
|
-
|
|
29840
|
-
|
|
29841
|
-
|
|
29842
|
-
|
|
29843
|
-
|
|
29844
|
-
|
|
29845
|
-
|
|
29846
|
-
|
|
29847
|
-
|
|
29848
|
-
|
|
29849
|
-
|
|
29850
|
-
|
|
29851
|
-
|
|
29852
|
-
|
|
29853
|
-
|
|
29854
|
-
|
|
29855
|
-
|
|
29856
|
-
...settlementTime(ev.at),
|
|
29857
|
-
seq: ev.seq
|
|
29858
|
-
});
|
|
29859
|
-
continue;
|
|
29860
|
-
}
|
|
29861
|
-
if (ev.status === "down") {
|
|
29862
|
-
const trace = traceEvidenceFor(ev);
|
|
29863
|
-
if (trace.status === "available") await workerTraceAnalysisStore(trace, blobs);
|
|
29760
|
+
const trace = ev.kind === "cancelled" ? ev.trace ?? {
|
|
29761
|
+
status: "unavailable",
|
|
29762
|
+
reason: "execution-did-not-start"
|
|
29763
|
+
} : traceEvidenceFor(ev);
|
|
29764
|
+
if (ev.kind === "settled" && trace.status === "available") await workerTraceAnalysisStore(trace, blobs);
|
|
29765
|
+
const evidence = {
|
|
29766
|
+
...ev.outRef === void 0 ? {} : { outRef: ev.outRef },
|
|
29767
|
+
...ev.providerModel === void 0 ? {} : { providerModel: copyProviderModelEvidence(ev.providerModel) },
|
|
29768
|
+
...budgetViolationOf(ev),
|
|
29769
|
+
trace,
|
|
29770
|
+
...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
|
|
29771
|
+
...ev.subtree === void 0 ? {} : { subtree: ev.subtree },
|
|
29772
|
+
...settlementTime(ev.at),
|
|
29773
|
+
seq: ev.seq
|
|
29774
|
+
};
|
|
29775
|
+
if (ev.kind === "cancelled" || ev.status === "down") {
|
|
29776
|
+
const reason = ev.reason ?? (ev.kind === "settled" ? ev.verdict?.notes : void 0) ?? "child down";
|
|
29864
29777
|
settled.push({
|
|
29778
|
+
...evidence,
|
|
29865
29779
|
kind: "down",
|
|
29866
|
-
handle: handleFor(ev.id, "failed"),
|
|
29867
|
-
reason
|
|
29868
|
-
|
|
29780
|
+
handle: handleFor(ev.id, ev.kind === "cancelled" ? "cancelled" : "failed"),
|
|
29781
|
+
reason,
|
|
29782
|
+
failure: ev.failure ?? settlementFailureCause({
|
|
29783
|
+
reason,
|
|
29784
|
+
infra: ev.infra,
|
|
29785
|
+
retainedPendingCause: ev.retainedPendingCause
|
|
29786
|
+
}),
|
|
29869
29787
|
...ev.infra === void 0 ? {} : { infra: ev.infra },
|
|
29870
|
-
...ev.providerModel === void 0 ? {} : { providerModel: copyProviderModelEvidence(ev.providerModel) },
|
|
29871
|
-
...budgetViolationOf(ev),
|
|
29872
|
-
trace,
|
|
29873
|
-
...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
|
|
29874
29788
|
...ev.retainedExecution === void 0 ? {} : { retainedExecution: ev.retainedExecution },
|
|
29875
|
-
...ev.retainedPendingCause === void 0 ? {} : { retainedPendingCause: ev.retainedPendingCause }
|
|
29876
|
-
...ev.subtree === void 0 ? {} : { subtree: ev.subtree },
|
|
29877
|
-
...settlementTime(ev.at),
|
|
29878
|
-
seq: ev.seq
|
|
29789
|
+
...ev.retainedPendingCause === void 0 ? {} : { retainedPendingCause: ev.retainedPendingCause }
|
|
29879
29790
|
});
|
|
29880
29791
|
continue;
|
|
29881
29792
|
}
|
|
29882
29793
|
if (ev.outRef === void 0) throw new Error(`replaySpawnTree: settled-done event for '${ev.id}' (seq ${ev.seq}) has no outRef; cannot rehydrate the result the driver branched on`);
|
|
29883
29794
|
const out = await blobs.get(ev.outRef);
|
|
29884
29795
|
if (out === void 0) throw new Error(`replaySpawnTree: blob store has no artifact for outRef '${ev.outRef}' (node '${ev.id}', seq ${ev.seq})`);
|
|
29885
|
-
const trace = traceEvidenceFor(ev);
|
|
29886
|
-
if (trace.status === "available") await workerTraceAnalysisStore(trace, blobs);
|
|
29887
29796
|
settled.push({
|
|
29797
|
+
...evidence,
|
|
29888
29798
|
kind: "done",
|
|
29889
29799
|
handle: handleFor(ev.id, "done"),
|
|
29890
29800
|
out,
|
|
29891
29801
|
outRef: ev.outRef,
|
|
29892
29802
|
verdict: ev.verdict,
|
|
29893
|
-
spent: cloneSpend(ev.spent)
|
|
29894
|
-
...ev.providerModel === void 0 ? {} : { providerModel: copyProviderModelEvidence(ev.providerModel) },
|
|
29895
|
-
...budgetViolationOf(ev),
|
|
29896
|
-
trace,
|
|
29897
|
-
...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
|
|
29898
|
-
...ev.subtree === void 0 ? {} : { subtree: ev.subtree },
|
|
29899
|
-
...settlementTime(ev.at),
|
|
29900
|
-
seq: ev.seq
|
|
29803
|
+
spent: cloneSpend(ev.spent)
|
|
29901
29804
|
});
|
|
29902
29805
|
}
|
|
29903
29806
|
return settled;
|
|
@@ -29926,8 +29829,7 @@ function copyFrozenIdentity(identity) {
|
|
|
29926
29829
|
...correlation === void 0 ? {} : { correlation }
|
|
29927
29830
|
});
|
|
29928
29831
|
}
|
|
29929
|
-
|
|
29930
|
-
//#region src/runtime/supervise/recover-executors.ts
|
|
29832
|
+
// src/runtime/supervise/recover-executors.ts
|
|
29931
29833
|
/** The environment id the node's latest durable admission names — the executor's own rule
|
|
29932
29834
|
* (`admittedEnvironmentId` in environment-provider.ts), read off the journal. */
|
|
29933
29835
|
function journaledEnvironmentId(owned) {
|
|
@@ -29990,6 +29892,7 @@ async function healReleasedSlots(opts, signal, now) {
|
|
|
29990
29892
|
const settlement = {
|
|
29991
29893
|
kind: "down",
|
|
29992
29894
|
reason: floor.reason,
|
|
29895
|
+
...floor.failure === void 0 ? {} : { failure: floor.failure },
|
|
29993
29896
|
...floor.infra === void 0 ? {} : { infra: floor.infra },
|
|
29994
29897
|
trace: floor.trace,
|
|
29995
29898
|
...floor.outRef ? { outRef: floor.outRef } : {},
|
|
@@ -30113,6 +30016,7 @@ async function prepareInterruptedExecutors(opts, events, signal, now, parentId =
|
|
|
30113
30016
|
...result.traceRoot === void 0 ? {} : { traceRoot: result.traceRoot },
|
|
30114
30017
|
...reason === void 0 ? {} : { reason },
|
|
30115
30018
|
...infra === void 0 ? {} : { infra },
|
|
30019
|
+
...fault === void 0 && failure !== void 0 ? { failure: reportedFailureCause(failure) } : {},
|
|
30116
30020
|
spent: result.spent,
|
|
30117
30021
|
...budgetViolation === void 0 ? {} : { budgetViolation },
|
|
30118
30022
|
...result.verdict ? { verdict: result.verdict } : {},
|
|
@@ -30321,8 +30225,7 @@ async function prepareScopeResume(opts, events, signal, now, parentId = opts.run
|
|
|
30321
30225
|
}
|
|
30322
30226
|
};
|
|
30323
30227
|
}
|
|
30324
|
-
|
|
30325
|
-
//#region src/runtime/supervise/scope-nesting.ts
|
|
30228
|
+
// src/runtime/supervise/scope-nesting.ts
|
|
30326
30229
|
function makeNestedScopeSeam(args, workerSlots, childSlot, childNodeId, childBudget, childDeadlineAtMs, deferredOwner) {
|
|
30327
30230
|
const now = args.now ?? Date.now;
|
|
30328
30231
|
const mountScope = (nestedRoot, signal, restored) => {
|
|
@@ -30378,8 +30281,7 @@ function makeNestedScopeSeam(args, workerSlots, childSlot, childNodeId, childBud
|
|
|
30378
30281
|
}
|
|
30379
30282
|
};
|
|
30380
30283
|
}
|
|
30381
|
-
|
|
30382
|
-
//#region src/runtime/supervise/worker-events.ts
|
|
30284
|
+
// src/runtime/supervise/worker-events.ts
|
|
30383
30285
|
const MAX_EVENTS = 256;
|
|
30384
30286
|
const MAX_BYTES = 262144;
|
|
30385
30287
|
/** One worker's already-redacted live output. Accounting stays on Scope's existing usage channel. */
|
|
@@ -30449,8 +30351,7 @@ var WorkerEvents = class {
|
|
|
30449
30351
|
};
|
|
30450
30352
|
}
|
|
30451
30353
|
};
|
|
30452
|
-
|
|
30453
|
-
//#region src/runtime/supervise/scope-child-start.ts
|
|
30354
|
+
// src/runtime/supervise/scope-child-start.ts
|
|
30454
30355
|
/**
|
|
30455
30356
|
* The records one admitted child starts with: its executor context, its handle, its live-child
|
|
30456
30357
|
* row, its spawn journal record and hook, and the settlement chain that closes it. `scope-spawn`
|
|
@@ -30698,15 +30599,16 @@ async function resolveChildSettlement(live, ran, interactiveBindingCommitted, ho
|
|
|
30698
30599
|
};
|
|
30699
30600
|
}
|
|
30700
30601
|
live.resolved = resolution;
|
|
30701
|
-
if (live.held !== void 0)
|
|
30702
|
-
|
|
30703
|
-
|
|
30704
|
-
|
|
30705
|
-
|
|
30602
|
+
if (live.held !== void 0) {
|
|
30603
|
+
if (resolution.kind === "done") {
|
|
30604
|
+
const timer = setTimeout(() => void releaseHeld(live, "hold-ceiling"), holdMs);
|
|
30605
|
+
timer.unref?.();
|
|
30606
|
+
live.held.clearCeiling = () => clearTimeout(timer);
|
|
30607
|
+
} else await releaseHeld(live, "scope-join");
|
|
30608
|
+
}
|
|
30706
30609
|
return resolution;
|
|
30707
30610
|
}
|
|
30708
|
-
|
|
30709
|
-
//#region src/runtime/supervise/scope-key-registry.ts
|
|
30611
|
+
// src/runtime/supervise/scope-key-registry.ts
|
|
30710
30612
|
/**
|
|
30711
30613
|
* The semantic-key registry (`SpawnOpts.key`): every keyed assignment's current state, seeded
|
|
30712
30614
|
* from the prior journal on resume and updated live as keyed children spawn and settle. This is
|
|
@@ -30778,8 +30680,7 @@ function resumedKeyState(prior, identity) {
|
|
|
30778
30680
|
identity
|
|
30779
30681
|
};
|
|
30780
30682
|
}
|
|
30781
|
-
|
|
30782
|
-
//#region src/runtime/supervise/scope-spawn.ts
|
|
30683
|
+
// src/runtime/supervise/scope-spawn.ts
|
|
30783
30684
|
/** Own child admission, keyed identity and executor startup. */
|
|
30784
30685
|
function createScopeSpawner(deps) {
|
|
30785
30686
|
const spawner = new ScopeSpawner(deps);
|
|
@@ -31138,8 +31039,7 @@ function prepareOnce(request) {
|
|
|
31138
31039
|
};
|
|
31139
31040
|
return request.prepared;
|
|
31140
31041
|
}
|
|
31141
|
-
|
|
31142
|
-
//#region src/runtime/supervise/scope-teardown.ts
|
|
31042
|
+
// src/runtime/supervise/scope-teardown.ts
|
|
31143
31043
|
/** Release settled child environments and close their retained journal slots. */
|
|
31144
31044
|
function createHeldChildRelease(args, now) {
|
|
31145
31045
|
const heldReleases = /* @__PURE__ */ new Set();
|
|
@@ -31283,8 +31183,7 @@ function bindChildTeardown(scope, args, children, now) {
|
|
|
31283
31183
|
for (const child of open) await closeRetainedSlot(child, "release-unconfirmed", prior);
|
|
31284
31184
|
});
|
|
31285
31185
|
}
|
|
31286
|
-
|
|
31287
|
-
//#region src/runtime/supervise/scope-workers.ts
|
|
31186
|
+
// src/runtime/supervise/scope-workers.ts
|
|
31288
31187
|
/**
|
|
31289
31188
|
* A scope's live children as its driver addresses them: steer, read progress, cancel, read the
|
|
31290
31189
|
* trace and interactive session, and observe the tree and event streams, nested scopes included.
|
|
@@ -31421,8 +31320,7 @@ var ScopeWorkers = class {
|
|
|
31421
31320
|
};
|
|
31422
31321
|
};
|
|
31423
31322
|
};
|
|
31424
|
-
|
|
31425
|
-
//#region src/runtime/supervise/scope-construction.ts
|
|
31323
|
+
// src/runtime/supervise/scope-construction.ts
|
|
31426
31324
|
/** Create the reactive `Scope` a driver's `Agent.act` runs inside: spawn children on an atomically reserved conserved budget, settle via the `next()` cursor, journal for replay. */
|
|
31427
31325
|
function createScope(args) {
|
|
31428
31326
|
checkInIdleMs(args.deadlineCheckIn);
|
|
@@ -31607,8 +31505,7 @@ async function recoverRetainedChildren(args, children, spawn, next) {
|
|
|
31607
31505
|
throw error;
|
|
31608
31506
|
}
|
|
31609
31507
|
}
|
|
31610
|
-
|
|
31611
|
-
//#region src/runtime/supervise/driver-executor.ts
|
|
31508
|
+
// src/runtime/supervise/driver-executor.ts
|
|
31612
31509
|
/**
|
|
31613
31510
|
* Mark + carry a driver `Agent` so the recursive registry resolves it to the
|
|
31614
31511
|
* driver-executor. The returned agent is SPAWNED (never run directly): its
|
|
@@ -31988,8 +31885,7 @@ function unreportedSpend(total, prior) {
|
|
|
31988
31885
|
...total.boxMinutes === void 0 ? {} : { boxMinutes: Math.max(0, total.boxMinutes - (prior.boxMinutes ?? 0)) }
|
|
31989
31886
|
};
|
|
31990
31887
|
}
|
|
31991
|
-
|
|
31992
|
-
//#region src/runtime/supervise/supervisor-root-handle.ts
|
|
31888
|
+
// src/runtime/supervise/supervisor-root-handle.ts
|
|
31993
31889
|
/** Module-private channel from a minted `RootHandle` to its `RootControl`, so `attach`
|
|
31994
31890
|
* can prove a handle is ours and reach its binding without leaking the control onto the
|
|
31995
31891
|
* frozen `RootHandle` shape. */
|
|
@@ -32051,8 +31947,7 @@ function pushRootSignal(cascadeAbort) {
|
|
|
32051
31947
|
cascadeAbort(new RunCancellationReason("root-signal", msg.reason ?? "root signal: cancel"));
|
|
32052
31948
|
};
|
|
32053
31949
|
}
|
|
32054
|
-
|
|
32055
|
-
//#region src/runtime/supervise/finalizer.ts
|
|
31950
|
+
// src/runtime/supervise/finalizer.ts
|
|
32056
31951
|
/**
|
|
32057
31952
|
* `SupervisorFinalizer` — the pluggable last step of a driver run: how the settled-worker ledger
|
|
32058
31953
|
* becomes the run's output. `bestDelivered` (the default) returns the single highest-scoring
|
|
@@ -32153,8 +32048,7 @@ async function runFinalizer(finalizer, args) {
|
|
|
32153
32048
|
});
|
|
32154
32049
|
return await accepted(candidate) ? candidate : void 0;
|
|
32155
32050
|
}
|
|
32156
|
-
|
|
32157
|
-
//#region src/runtime/supervise/run-parking.ts
|
|
32051
|
+
// src/runtime/supervise/run-parking.ts
|
|
32158
32052
|
/** Read the journal's bounded parking projection. Undefined means no current parking handoff. */
|
|
32159
32053
|
async function readRunParking(runDir) {
|
|
32160
32054
|
let raw;
|
|
@@ -32303,8 +32197,7 @@ function parkingRecordOf(record) {
|
|
|
32303
32197
|
wakeAt: record.wakeAt
|
|
32304
32198
|
};
|
|
32305
32199
|
}
|
|
32306
|
-
|
|
32307
|
-
//#region src/durable/spawn-journal/provider-model-evidence.ts
|
|
32200
|
+
// src/durable/spawn-journal/provider-model-evidence.ts
|
|
32308
32201
|
/**
|
|
32309
32202
|
* Aggregate provider-served model evidence across one recursively owned journal forest.
|
|
32310
32203
|
*
|
|
@@ -32471,8 +32364,7 @@ function servedIdentityParts(model) {
|
|
|
32471
32364
|
snapshot
|
|
32472
32365
|
};
|
|
32473
32366
|
}
|
|
32474
|
-
|
|
32475
|
-
//#region src/runtime/supervise/supervisor-accounting.ts
|
|
32367
|
+
// src/runtime/supervise/supervisor-accounting.ts
|
|
32476
32368
|
/**
|
|
32477
32369
|
* The run's terminal accounting, read off the one journal ledger — the honest per-channel
|
|
32478
32370
|
* sums (input/output/usd/iterations all preserved), the named usage gaps, and the wall-clock
|
|
@@ -32611,8 +32503,7 @@ function unknownChannels(spend) {
|
|
|
32611
32503
|
function isNonEmptySpend(s) {
|
|
32612
32504
|
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);
|
|
32613
32505
|
}
|
|
32614
|
-
|
|
32615
|
-
//#region src/runtime/supervise/supervisor-child-join.ts
|
|
32506
|
+
// src/runtime/supervise/supervisor-child-join.ts
|
|
32616
32507
|
/**
|
|
32617
32508
|
* Drain the root scope's live set so every still-running/acquiring child is torn down
|
|
32618
32509
|
* before `run` returns — the join barrier. Abort the cascade controller first (so each
|
|
@@ -32734,8 +32625,7 @@ function boundedSettleGrace(graceMs, deadlineAtMs, now) {
|
|
|
32734
32625
|
async function drainCursor(scope) {
|
|
32735
32626
|
for (;;) if (await scope.next() === null) return;
|
|
32736
32627
|
}
|
|
32737
|
-
|
|
32738
|
-
//#region src/runtime/supervise/supervisor-intensity-breaker.ts
|
|
32628
|
+
// src/runtime/supervise/supervisor-intensity-breaker.ts
|
|
32739
32629
|
function createIntensityBreaker(opts, trip) {
|
|
32740
32630
|
const max = opts.maxRestarts;
|
|
32741
32631
|
const within = opts.withinMs;
|
|
@@ -32791,8 +32681,7 @@ function wrapJournalForBreaker(journal, breaker) {
|
|
|
32791
32681
|
}
|
|
32792
32682
|
};
|
|
32793
32683
|
}
|
|
32794
|
-
|
|
32795
|
-
//#region src/runtime/supervise/supervisor-result.ts
|
|
32684
|
+
// src/runtime/supervise/supervisor-result.ts
|
|
32796
32685
|
/**
|
|
32797
32686
|
* Normalize an arbitrary rejection into the serializable triple the result carries. A driver may
|
|
32798
32687
|
* reject with anything (a string, a plain object, a null-prototype value), and the whole point of
|
|
@@ -32842,8 +32731,7 @@ function deadlinePassed(pool, opts) {
|
|
|
32842
32731
|
const deadlineMs = pool.readout().deadlineMs;
|
|
32843
32732
|
return deadlineMs > 0 && (opts.now ?? Date.now)() >= deadlineMs;
|
|
32844
32733
|
}
|
|
32845
|
-
|
|
32846
|
-
//#region src/runtime/supervise/supervisor-root-contract.ts
|
|
32734
|
+
// src/runtime/supervise/supervisor-root-contract.ts
|
|
32847
32735
|
/** A resumed process may continue only the exact root contract first recorded for this run id. Its
|
|
32848
32736
|
* budget is the root's, or the one the run's last budget-carrying `reopened` row recorded. */
|
|
32849
32737
|
function assertResumeContract(events, opts) {
|
|
@@ -32933,7 +32821,7 @@ async function recordRootSegment(opts, events, at, fresh) {
|
|
|
32933
32821
|
}
|
|
32934
32822
|
/**
|
|
32935
32823
|
* Append one `root-reentered` record: this process is supervising a run an earlier process drove.
|
|
32936
|
-
*
|
|
32824
|
+
* After a host reboot the re-entered root ran two
|
|
32937
32825
|
* barren continuations and the run settled `no-result-selected`, with three workers still open in
|
|
32938
32826
|
* the journal and no record that a restart had happened.
|
|
32939
32827
|
*/
|
|
@@ -33000,8 +32888,7 @@ function rootStartedAtMs(root) {
|
|
|
33000
32888
|
if (!Number.isFinite(startedAt)) throw new RuntimeRunStateError(`supervisor: root event for '${root.id}' has an invalid timestamp '${root.at}'`);
|
|
33001
32889
|
return startedAt;
|
|
33002
32890
|
}
|
|
33003
|
-
|
|
33004
|
-
//#region src/runtime/supervise/run-persistence.ts
|
|
32891
|
+
// src/runtime/supervise/run-persistence.ts
|
|
33005
32892
|
/** One failed store operation revokes this controller's writes, never its retained executions. */
|
|
33006
32893
|
function guardRunPersistence(journal, blobs, interrupt) {
|
|
33007
32894
|
let failure;
|
|
@@ -33045,8 +32932,7 @@ function guardRunPersistence(journal, blobs, interrupt) {
|
|
|
33045
32932
|
}
|
|
33046
32933
|
};
|
|
33047
32934
|
}
|
|
33048
|
-
|
|
33049
|
-
//#region src/runtime/supervise/supervisor-run-intake.ts
|
|
32935
|
+
// src/runtime/supervise/supervisor-run-intake.ts
|
|
33050
32936
|
/** Read every caller-owned field once, then detach and freeze all decision data before the first
|
|
33051
32937
|
* await; stateful collaborators stay live by reference, but later opts mutation cannot redirect the run. */
|
|
33052
32938
|
function admitSupervisorRun(task, opts) {
|
|
@@ -33104,8 +32990,7 @@ function admitSupervisorRun(task, opts) {
|
|
|
33104
32990
|
budgetStopHoldMs
|
|
33105
32991
|
};
|
|
33106
32992
|
}
|
|
33107
|
-
|
|
33108
|
-
//#region src/runtime/supervise/supervisor-run-join.ts
|
|
32993
|
+
// src/runtime/supervise/supervisor-run-join.ts
|
|
33109
32994
|
/**
|
|
33110
32995
|
* Join barrier: tear down every still-live child. Generalizes the kernel's
|
|
33111
32996
|
* `finally{ Promise.allSettled(destroy) }` — a teardown throw is allSettled'd and journaled.
|
|
@@ -33132,7 +33017,7 @@ async function joinRunChildren(join, settleGraceMs) {
|
|
|
33132
33017
|
}
|
|
33133
33018
|
/**
|
|
33134
33019
|
* A first teardown that failed or answered late is not the provider's last word, and a run that
|
|
33135
|
-
* settles over it leaves the sandbox running:
|
|
33020
|
+
* settles over it leaves the sandbox running: cancelling 20 Discovery lanes
|
|
33136
33021
|
* left 2 workers running. Ask again until confirmed or out of time.
|
|
33137
33022
|
*/
|
|
33138
33023
|
async function confirmRetriableTeardowns(join, releasing) {
|
|
@@ -33187,8 +33072,7 @@ function unrecoveredRetainedChildren(scope, resumeFrom) {
|
|
|
33187
33072
|
}
|
|
33188
33073
|
return unrecovered;
|
|
33189
33074
|
}
|
|
33190
|
-
|
|
33191
|
-
//#region src/runtime/supervise/supervisor-run-tree.ts
|
|
33075
|
+
// src/runtime/supervise/supervisor-run-tree.ts
|
|
33192
33076
|
async function openRunTree(opts, now) {
|
|
33193
33077
|
const rootAttemptId = newExecutionAttemptId(opts.runId);
|
|
33194
33078
|
const runStartedAtMs = now();
|
|
@@ -33273,8 +33157,7 @@ async function beginRunTree(opts, existing, prior, runStartedAtMs, runStartedAt,
|
|
|
33273
33157
|
runEpochMs: runStartedAtMs
|
|
33274
33158
|
};
|
|
33275
33159
|
}
|
|
33276
|
-
|
|
33277
|
-
//#region src/runtime/supervise/supervisor-run.ts
|
|
33160
|
+
// src/runtime/supervise/supervisor-run.ts
|
|
33278
33161
|
/** The default recursion-depth ceiling. The conserved pool bounds depth (every level draws its
|
|
33279
33162
|
* slice from the one above); this only stops a runaway recursion of tiny slices. */
|
|
33280
33163
|
const DEFAULT_MAX_DEPTH = 16;
|
|
@@ -33357,8 +33240,10 @@ function rootCascade(controller, opts) {
|
|
|
33357
33240
|
const reason = opts.signal ? abortReason(opts.signal, "caller signal aborted") : "caller signal aborted";
|
|
33358
33241
|
cascadeAbort(reason instanceof RunCancellationReason ? reason : new RunCancellationReason("signal", typeof reason === "string" ? reason : "caller signal aborted"));
|
|
33359
33242
|
};
|
|
33360
|
-
if (opts.signal)
|
|
33361
|
-
|
|
33243
|
+
if (opts.signal) {
|
|
33244
|
+
if (opts.signal.aborted) onCallerAbort();
|
|
33245
|
+
else opts.signal.addEventListener("abort", onCallerAbort, { once: true });
|
|
33246
|
+
}
|
|
33362
33247
|
return {
|
|
33363
33248
|
aborted: () => cascadeAborted,
|
|
33364
33249
|
abort: cascadeAbort,
|
|
@@ -33585,7 +33470,6 @@ async function noWinner(settled, rejection) {
|
|
|
33585
33470
|
reason: "no-result-selected"
|
|
33586
33471
|
};
|
|
33587
33472
|
}
|
|
33588
|
-
|
|
33589
|
-
export { resolveSpawnResourcePaths as $, mapSandboxToolEvent as $i, HarnessTurnFailedError as $n, sandboxProfileMaterialization as $r, providerAsSandboxClient as $t, beginScopeOwnerAttempt as A, cappedDoublingMs as Ai, toOtelAttributes as An, readCodexRolloutSession as Ar, createExecutor as At, assertRecursiveReservationPolicy as B, executorFailure as Bi, PEER_MAIL_WIRE_KEY as Bn, LOCAL_HARNESSES as Br, TERMINAL_DECISIONS as Bt, interactiveAdmissionSeamKey as C, projectSandboxOutcome as Ci, createOpenInferenceFileExporter as Cn, bridgeAdmissionRefusal as Cr, readCommittedJsonLines as Ct, recoverRetainedInteractiveRun as D, RetainedExecutionPendingError as Di, loopEventToOtelSpan as Dn, addHarnessUsage as Dr, createExecutorRegistry as Dt, reconnectRetainedInteractiveRun as E, settlementFailureCause as Ei, generateSpanId as En, ROUTER_PRICE_SOURCE as Er, insideCursorNamespace as Et, coordinationMcpAlias as F, TRACE_ROOT_SCHEMA as Fi, INBOX_RECEIPT_KEY as Fn, signalAbortError as Fr, assertBoxlessPromptOptions as Ft, meterRuntimeOwnedAccounting as G, spendFromUsageEvents as Gi, peerMailVerbNames as Gn, controlProfileMaterialization as Gr, runCodeMode as Gt, freeSlots as H, createBudgetPool as Hi, createPeerMailbox as Hn, terminateProcessTreeAndConfirm as Hr, codeModeArguments as Ht, coordinationProfileToolPrefix as I, TRACE_SUMMARY_SCHEMA as Ii, createInbox as In, bridgeRuntimeAttachmentsKey as Ir, readPromptOptions as It, recordScopeOwnerDriverAttempt as J, defaultRedactor as Ji, createActivityLog as Jn, profileMaterializationAxes$1 as Jr, routerBrain as Jt, meterRuntimeOwnedProviderAttempt as K, spendFromUsageTotals as Ki, taskToPrompt$1 as Kn, defineProfileMaterializationContract as Kr, toolResultText as Kt, providerVisibleProfile as L, detachedFrozen as Li, failPendingAfter as Ln, bridgeStopSignalKey as Lr, createSandboxForSpec as Lt, recordScopeOwnerMaterialization as M, unavailablePauseMs as Mi, createRuntimeStreamEventCollector as Mn, RunCancellationReason as Mr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Mt, restoreScopeOwnerAcceptedExecution as N, unavailableResumeAt as Ni, sanitizeKnowledgeReadinessReport as Nn, linkAbort as Nr, createSteerableSandboxSession as Nt, startRetainedInteractiveRun as O, registerRetainedExecutorPreparation as Oi, padSpanId as On, createCodexRolloutStoreReader as Or, bindReusableExecutorExecutionId as Ot, scopeOwnerExecutorNodeContext as P, unavailableSignalOfFailure as Pi, sanitizeRuntimeStreamEvent as Pn, runAbortable as Pr, runAgentRounds as Pt, environmentReader as Q, mapSandboxEvent as Qi, DriverAttemptsExhaustedError as Qn, sandboxActProfileMaterialization as Qr, LEAF_CONTINUATION_TASK as Qt, runtimeGraphMetadataKey as R, detachedSnapshot as Ri, AUTHORITY_MARKERS as Rn, runSettledCommand as Rr, createSandboxLineage as Rt, workerTraceAnalysisStore as S, executableAgentSpecSnapshot as Si, buildRuntimeEventOtelSpans as Sn, isFiniteNumber as Sr, readCommittedJsonFile as St, readWorkerInteractiveBinding as T, runtimeFailureCause as Ti, flatOtelSpan as Tn, priceTokens as Tr, withJsonlFileLock as Tt, queueOf as U, meterUsageEvent as Ui, isPeerMailEnvelope as Un, assertProfileMaterialization as Ur, codeModeModelOutput as Ut, deriveNodeExecutionIdentity as V, errMessage as Vi, claimsAuthority as Vn, harnessInvocation as Vr, defaultSelectWinner as Vt, rollingDispatch as W, newUsageTotals as Wi, peerMailTools as Wn, assertProfileMaterializes as Wr, createCodeModeTools as Wt, prepareScopeRetainedOwnerSeatSwitch as X, resolveRedactor as Xi, isLiveNodeStatus as Xn, promptModelProfileMaterialization as Xr, resolveAgentEnvironmentProvider as Xt, recordScopeOwnerPause as Y, defaultRedactorIdentityMaterial as Yi, readWorkerProgress as Yn, promptControlProfileMaterialization as Yr, createAgentEnvironmentProviderRegistry as Yt, scopeRetainedOwnerResourceReader as Z, createSandboxToolPartState as Zi, isTerminalNodeStatus as Zn, renderUnsupported as Zr, providerAsExecutor as Zt, withDriverExecutor as _, runtimeOwnedPendingExecutorMaterialization as _i, WORKER_TRACE_PROPAGATION as _n, admitContinuationPolicy as _r, InMemorySpawnJournal as _t, assertRunParking as a, notifySandboxEventObserver as aa, authoredProfileDigest as ai, destroyInteractiveEnvironment as an, upstreamUnavailableSignal as ar, beginScopeRetainedOwnerDrive as at, isTraceAnalysisStore as b, unknownMaterializationReceipt as bi, buildLoopOtelSpans as bn, createContinuationKeeper as br, isNoEntError as bt, sleepScopeWait as c, awaitAbortable$1 as ca, knownExecutionBindingReceipt as ci, harnessTranscriptArtifact as cn, authoredSeatStages as cr, scopeRetainedOwnerRestorePoint as ct, runFinalizer as d, providerMessageText as da, providerAttemptEvidence as di, resolveHarnessTranscriptCapture as dn, CheckUnavailableError as dr, bindScopeRetainedOwnerProvider as dt, terminalTextFromSandboxEvent as ea, unsupportedProfileDimensions as ei, reconnectRetainedRun as en, abandonablePending as er, abandonScopeRetainedOwnerInvocation as et, runTree as f, recordRuntimeOwnedDriveHarnessProviderEvidence as fi, retainHarnessTranscript as fn, gateFactoryOnDeliverable as fr, scopeRetainedOwnerContext as ft, isDriverSpec as g, runtimeOwnedExecutorProviderEvidence as gi, createInPlaceCliExecutor as gn, CONTINUATIONS_DIR as gr, InMemoryResultBlobStore as gt, driverExecutorFactory as h, runtimeOwnedExecutorMaterialization as hi, createWorktreeCliExecutor as hn, verdictFromJudgeScore as hr, materializeTreeView as ht, RunParkedError as i, extractLlmCallEvent as ia, authoredAgentIdentity as ii, retainedCreateMaterial as in, undispatchedCredentialExit as ir, scopeRetainedOwnerResult as it, noteScopeOwnerPlannedExecution as j, jitteredMs as ji, createRuntimeEventCollector as jn, createPushTraceSource as jr, snapshotExecutorConfig as jt, FileSpawnJournal as k, retainedExecutorSeamKey as ki, padTraceId as kn, harnessUsageIsEmpty as kr, captureReusableExecutorConfig as kt, withRunParking as l, promptFromAgentTurnInput as la, knownMaterializationReceipt as li, persistHarnessTranscript as ln, seatExecutionProfile as lr, noteScopeRetainedOwnerCoordination as lt, driverChild as m, runtimeOwnedExecutorExecutionBinding as mi, openSlotGroup as mn, mapExecutorResult as mr, loadSpawnForest as mt, createSupervisor as n, createSandboxTurnEventCollector as na, attestRuntimeOwnedPendingExecutor as ni, startRetainedRun as nn, classifyDriverFailure as nr, prepareScopeRetainedOwnerTask as nt, bindScopeParkingDrain as o, sumSandboxUsage as oa, finalizeRuntimeOwnedPendingExecutor as oi, environmentGone as on, SeatChain as or, scopeRetainedOwnerTurnEnded as ot, createRootHandle as p, runtimeOwnedDriveHarnessProviderEvidence as pi, createWorkerSlots as pn, gateOnDeliverable as pr, scopeRetainedOwnerJournalRoot as pt, recordScopeOwnerBarrenPause as q, assertValidBudget as qi, DEFAULT_STALL_AFTER_MS as qn, fullProfileMaterialization as qr, createRouterTranscript as qt, assertResumeLimits as r, createSandboxUsageLedger as ra, attestRuntimeOwnedScopeOwner as ri, startRetainedRunInEnvironment as rn, summarizeDriverAttempts as rr, scopeRetainedOwnerPriorSpend as rt, readRunParking as s, decodeHarnessUsage as sa, inheritRuntimeOwnedExecutorAttestation as si, captureHarnessTranscript as sn, SeatChainExhaustedError as sr, reconcileScopeRetainedOwnerEnvironment as st, DEFAULT_MAX_DEPTH as t, canonicalStreamEventFromSandboxEvent as ta, worktreeCliProfileMaterialization as ti, recoverRetainedRun as tn, causedByPartialFailure as tr, consumeScopeRetainedOwnerResult as tt, bestDelivered as u, promptOptionsFromAgentTurnInput as ua, newExecutionAttemptId as ui, readHarnessTranscript as un, subscriptionUsageLimitSignal as ur, bindScopeRetainedOwnerEnvironmentId as ut, createScope as v, runtimeOwnedScopeOwnerRuntime as vi, createPropagatingTraceEmitter as vn, bestComposite as vr, FileResultBlobStore as vt, attachWorker as w, readSandboxOutcome as wi, createOtelExporter as wn, bridgeModelRouteRefusal as wr, upsertCommittedJsonLine as wt, parseWorkerToolTraceArtifact as x, executableAgentProfileSnapshot as xi, buildLoopSpanNodes as xn, failedItems as xr, prepareJsonlAppend as xt, replaySpawnTree as y, unknownExecutionBindingReceipt as yi, readTraceContextFromEnv as yn, checkVerdictOf as yr, appendCommittedJsonLine as yt, settledToIteration as z, contentAddress as zi, DEFAULT_PEER_MAIL_LIMITS as zn, runWorktreeHarness as zr, acquireSandbox as zt };
|
|
33473
|
+
export { resolveSpawnResourcePaths as $, createSandboxToolPartState as $i, HarnessTurnFailedError as $n, sandboxActProfileMaterialization as $r, providerAsSandboxClient as $t, beginScopeOwnerAttempt as A, registerRetainedExecutorPreparation as Ai, toOtelAttributes as An, readCodexRolloutSession as Ar, createExecutor as At, assertRecursiveReservationPolicy as B, detachedSnapshot as Bi, PEER_MAIL_WIRE_KEY as Bn, runWorktreeHarness as Br, TERMINAL_DECISIONS as Bt, interactiveAdmissionSeamKey as C, executableAgentSpecSnapshot as Ci, createOpenInferenceFileExporter as Cn, bridgeAdmissionRefusal as Cr, readCommittedJsonLines as Ct, recoverRetainedInteractiveRun as D, runtimeFailureCauseSchema as Di, loopEventToOtelSpan as Dn, addHarnessUsage as Dr, createExecutorRegistry as Dt, reconnectRetainedInteractiveRun as E, runtimeFailureCause as Ei, generateSpanId as En, ROUTER_PRICE_SOURCE as Er, insideCursorNamespace as Et, coordinationMcpAlias as F, unavailableResumeAt as Fi, INBOX_RECEIPT_KEY as Fn, signalAbortError as Fr, assertBoxlessPromptOptions as Ft, meterRuntimeOwnedAccounting as G, meterUsageEvent as Gi, peerMailVerbNames as Gn, assertProfileMaterializes as Gr, runCodeMode as Gt, freeSlots as H, executorFailure as Hi, createPeerMailbox as Hn, harnessInvocation as Hr, codeModeArguments as Ht, coordinationProfileToolPrefix as I, unavailableSignalOfFailure as Ii, createInbox as In, bridgeRuntimeAttachmentsKey as Ir, readPromptOptions as It, recordScopeOwnerDriverAttempt as J, spendFromUsageTotals as Ji, createActivityLog as Jn, fullProfileMaterialization as Jr, routerBrain as Jt, meterRuntimeOwnedProviderAttempt as K, newUsageTotals as Ki, taskToPrompt$1 as Kn, controlProfileMaterialization as Kr, toolResultText as Kt, providerVisibleProfile as L, TRACE_ROOT_SCHEMA as Li, failPendingAfter as Ln, bridgeStopSignalKey as Lr, createSandboxForSpec as Lt, recordScopeOwnerMaterialization as M, cappedDoublingMs as Mi, createRuntimeStreamEventCollector as Mn, RunCancellationReason as Mr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Mt, restoreScopeOwnerAcceptedExecution as N, jitteredMs as Ni, sanitizeKnowledgeReadinessReport as Nn, linkAbort as Nr, createSteerableSandboxSession as Nt, startRetainedInteractiveRun as O, settlementFailureCause as Oi, padSpanId as On, createCodexRolloutStoreReader as Or, bindReusableExecutorExecutionId as Ot, scopeOwnerExecutorNodeContext as P, unavailablePauseMs as Pi, sanitizeRuntimeStreamEvent as Pn, runAbortable as Pr, runAgentRounds as Pt, environmentReader as Q, resolveRedactor as Qi, DriverAttemptsExhaustedError as Qn, renderUnsupported as Qr, LEAF_CONTINUATION_TASK as Qt, runtimeGraphMetadataKey as R, TRACE_SUMMARY_SCHEMA as Ri, AUTHORITY_MARKERS as Rn, defaultRunCommand as Rr, createSandboxLineage as Rt, workerTraceAnalysisStore as S, executableAgentProfileSnapshot as Si, buildRuntimeEventOtelSpans as Sn, isFiniteNumber as Sr, readCommittedJsonFile as St, readWorkerInteractiveBinding as T, readSandboxOutcome as Ti, flatOtelSpan as Tn, priceTokens as Tr, withJsonlFileLock as Tt, queueOf as U, errMessage as Ui, isPeerMailEnvelope as Un, terminateProcessTreeAndConfirm as Ur, codeModeModelOutput as Ut, deriveNodeExecutionIdentity as V, contentAddress as Vi, claimsAuthority as Vn, LOCAL_HARNESSES as Vr, defaultSelectWinner as Vt, rollingDispatch as W, createBudgetPool as Wi, peerMailTools as Wn, assertProfileMaterialization as Wr, createCodeModeTools as Wt, prepareScopeRetainedOwnerSeatSwitch as X, defaultRedactor as Xi, isLiveNodeStatus as Xn, promptControlProfileMaterialization as Xr, resolveAgentEnvironmentProvider as Xt, recordScopeOwnerPause as Y, assertValidBudget as Yi, readWorkerProgress as Yn, profileMaterializationAxes$1 as Yr, createAgentEnvironmentProviderRegistry as Yt, scopeRetainedOwnerResourceReader as Z, defaultRedactorIdentityMaterial as Zi, isTerminalNodeStatus as Zn, promptModelProfileMaterialization as Zr, providerAsExecutor as Zt, withDriverExecutor as _, runtimeOwnedExecutorProviderEvidence as _i, WORKER_TRACE_PROPAGATION as _n, admitContinuationPolicy as _r, InMemorySpawnJournal as _t, assertRunParking as a, createSandboxUsageLedger as aa, authoredAgentIdentity as ai, destroyInteractiveEnvironment as an, upstreamUnavailableSignal as ar, beginScopeRetainedOwnerDrive as at, isTraceAnalysisStore as b, unknownExecutionBindingReceipt as bi, buildLoopOtelSpans as bn, createContinuationKeeper as br, isNoEntError as bt, sleepScopeWait as c, sumSandboxUsage as ca, inheritRuntimeOwnedExecutorAttestation as ci, harnessTranscriptArtifact as cn, authoredSeatStages as cr, scopeRetainedOwnerRestorePoint as ct, runFinalizer as d, promptFromAgentTurnInput as da, newExecutionAttemptId as di, resolveHarnessTranscriptCapture as dn, CheckUnavailableError as dr, bindScopeRetainedOwnerProvider as dt, mapSandboxEvent as ea, sandboxProfileMaterialization as ei, reconnectRetainedRun as en, abandonablePending as er, abandonScopeRetainedOwnerInvocation as et, runTree as f, promptOptionsFromAgentTurnInput as fa, providerAttemptEvidence as fi, retainHarnessTranscript as fn, gateFactoryOnDeliverable as fr, scopeRetainedOwnerContext as ft, isDriverSpec as g, runtimeOwnedExecutorMaterialization as gi, createInPlaceCliExecutor as gn, CONTINUATIONS_DIR as gr, InMemoryResultBlobStore as gt, driverExecutorFactory as h, runtimeOwnedExecutorExecutionBinding as hi, createWorktreeCliExecutor as hn, verdictFromJudgeScore as hr, materializeTreeView as ht, RunParkedError as i, createSandboxTurnEventCollector as ia, attestRuntimeOwnedScopeOwner as ii, retainedCreateMaterial as in, undispatchedCredentialExit as ir, scopeRetainedOwnerResult as it, noteScopeOwnerPlannedExecution as j, retainedExecutorSeamKey as ji, createRuntimeEventCollector as jn, createPushTraceSource as jr, snapshotExecutorConfig as jt, FileSpawnJournal as k, RetainedExecutionPendingError as ki, padTraceId as kn, harnessUsageIsEmpty as kr, captureReusableExecutorConfig as kt, withRunParking as l, decodeHarnessUsage as la, knownExecutionBindingReceipt as li, persistHarnessTranscript as ln, seatExecutionProfile as lr, noteScopeRetainedOwnerCoordination as lt, driverChild as m, runtimeOwnedDriveHarnessProviderEvidence as mi, openSlotGroup as mn, mapExecutorResult as mr, loadSpawnForest as mt, createSupervisor as n, terminalTextFromSandboxEvent as na, worktreeCliProfileMaterialization as ni, startRetainedRun as nn, classifyDriverFailure as nr, prepareScopeRetainedOwnerTask as nt, bindScopeParkingDrain as o, extractLlmCallEvent as oa, authoredProfileDigest as oi, environmentGone as on, SeatChain as or, scopeRetainedOwnerTurnEnded as ot, createRootHandle as p, providerMessageText as pa, recordRuntimeOwnedDriveHarnessProviderEvidence as pi, createWorkerSlots as pn, gateOnDeliverable as pr, scopeRetainedOwnerJournalRoot as pt, recordScopeOwnerBarrenPause as q, spendFromUsageEvents as qi, DEFAULT_STALL_AFTER_MS as qn, defineProfileMaterializationContract as qr, createRouterTranscript as qt, assertResumeLimits as r, canonicalStreamEventFromSandboxEvent as ra, attestRuntimeOwnedPendingExecutor as ri, startRetainedRunInEnvironment as rn, summarizeDriverAttempts as rr, scopeRetainedOwnerPriorSpend as rt, readRunParking as s, notifySandboxEventObserver as sa, finalizeRuntimeOwnedPendingExecutor as si, captureHarnessTranscript as sn, SeatChainExhaustedError as sr, reconcileScopeRetainedOwnerEnvironment as st, DEFAULT_MAX_DEPTH as t, mapSandboxToolEvent as ta, unsupportedProfileDimensions as ti, recoverRetainedRun as tn, causedByPartialFailure as tr, consumeScopeRetainedOwnerResult as tt, bestDelivered as u, awaitAbortable$1 as ua, knownMaterializationReceipt as ui, readHarnessTranscript as un, subscriptionUsageLimitSignal as ur, bindScopeRetainedOwnerEnvironmentId as ut, createScope as v, runtimeOwnedPendingExecutorMaterialization as vi, createPropagatingTraceEmitter as vn, bestComposite as vr, FileResultBlobStore as vt, attachWorker as w, projectSandboxOutcome as wi, createOtelExporter as wn, bridgeModelRouteRefusal as wr, upsertCommittedJsonLine as wt, parseWorkerToolTraceArtifact as x, unknownMaterializationReceipt as xi, buildLoopSpanNodes as xn, failedItems as xr, prepareJsonlAppend as xt, replaySpawnTree as y, runtimeOwnedScopeOwnerRuntime as yi, readTraceContextFromEnv as yn, checkVerdictOf as yr, appendCommittedJsonLine as yt, settledToIteration as z, detachedFrozen as zi, DEFAULT_PEER_MAIL_LIMITS as zn, runSettledCommand as zr, acquireSandbox as zt };
|
|
33590
33474
|
|
|
33591
|
-
//# sourceMappingURL=supervisor-
|
|
33475
|
+
//# sourceMappingURL=supervisor-C1OePYE-.js.map
|