@tangle-network/agent-runtime 0.349.0 → 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-tNGW73Y9.js → activation-CfJMyzEs.js} +12 -14
- package/dist/{activation-tNGW73Y9.js.map → activation-CfJMyzEs.js.map} +1 -1
- package/dist/{activation-wBipBkCf.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-1xaJEgjq.js → bundle-Ze8pd07a.js} +3 -4
- package/dist/{bundle-1xaJEgjq.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-B2Z_MmL9.js → coordination-manager-BkVfWlMz.js} +101 -132
- package/dist/{coordination-manager-B2Z_MmL9.js.map → coordination-manager-BkVfWlMz.js.map} +1 -1
- package/dist/{delegate-Dr-63jFl.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-DPejYB3C.js → graph-Cx0FhKSE.js} +191 -14
- package/dist/graph-Cx0FhKSE.js.map +1 -0
- package/dist/{improve-DwSahPi1.js → improve-i0HU1-aa.js} +35 -53
- package/dist/{improve-DwSahPi1.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-CP6MfO1b.js → loop-runner-BwN9MhdP.js} +5 -6
- package/dist/{loop-runner-CP6MfO1b.js.map → loop-runner-BwN9MhdP.js.map} +1 -1
- package/dist/{loop-runner-C6pGq-2l.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-CyCUwHed.js.map → model-policy-GSxWwP-b.js.map} +1 -1
- 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-B9wWffjO.js → prepare-DE8TQnLu.js} +49 -69
- package/dist/{prepare-B9wWffjO.js.map → prepare-DE8TQnLu.js.map} +1 -1
- package/dist/{profile-JLJd2wFG.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-C4v2vqDo.js → provision-supervisor-Bde_FF0R.js} +11 -15
- package/dist/{provision-supervisor-C4v2vqDo.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-CsvGCQpl.js → runtime-6Ec9sHRe.js} +648 -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-DtuJWFrM.js → sandbox-profile-compat-BxMQ1VXv.js} +61 -43
- package/dist/sandbox-profile-compat-BxMQ1VXv.js.map +1 -0
- package/dist/{search-executor-CCb82Umc.js → search-executor-B7g_5Wjl.js} +10 -15
- package/dist/{search-executor-CCb82Umc.js.map → search-executor-B7g_5Wjl.js.map} +1 -1
- package/dist/{server-CKPwZU-I.js → server-fvEMwGMQ.js} +19 -30
- package/dist/{server-CKPwZU-I.js.map → server-fvEMwGMQ.js.map} +1 -1
- package/dist/{structural-rollout-DylC_fwU.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-BGfm2GlY.js → supervise-CaeZcgAW.js} +460 -195
- package/dist/supervise-CaeZcgAW.js.map +1 -0
- package/dist/{supervisor-wS9Ehz_x.js → supervisor-C1OePYE-.js} +511 -626
- 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 +7 -15
- 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-C8BGOCBn.d.ts → types-Fowuwdz2.d.ts} +364 -483
- 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 +17 -4
- package/skills/be-ambitious/SKILL.md +46 -0
- package/skills/graph-designer/SKILL.md +9 -2
- package/dist/delegate-Dr-63jFl.js.map +0 -1
- package/dist/graph-DPejYB3C.js.map +0 -1
- package/dist/profile-JLJd2wFG.js.map +0 -1
- package/dist/runtime-CsvGCQpl.js.map +0 -1
- package/dist/sandbox-profile-compat-DtuJWFrM.js.map +0 -1
- package/dist/structural-rollout-DylC_fwU.js.map +0 -1
- package/dist/supervise-BGfm2GlY.js.map +0 -1
- package/dist/supervisor-wS9Ehz_x.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
|
|
@@ -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,13 +8796,11 @@ 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.
|
|
@@ -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,7 +9738,9 @@ 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.
|
|
@@ -9973,8 +9986,7 @@ function summarizeDriverAttempts(records) {
|
|
|
9973
9986
|
...last?.repromptRefusedBy === void 0 ? {} : { repromptRefusedBy: last.repromptRefusedBy }
|
|
9974
9987
|
};
|
|
9975
9988
|
}
|
|
9976
|
-
|
|
9977
|
-
//#region src/runtime/supervise/node-status.ts
|
|
9989
|
+
// src/runtime/supervise/node-status.ts
|
|
9978
9990
|
/** Which {@link NodeStatus} values mean the node is finished. */
|
|
9979
9991
|
const terminalNodeStatuses = /* @__PURE__ */ new Set([
|
|
9980
9992
|
"done",
|
|
@@ -9997,8 +10009,7 @@ function isTerminalNodeStatus(status) {
|
|
|
9997
10009
|
function isLiveNodeStatus(status) {
|
|
9998
10010
|
return !terminalNodeStatuses.has(status);
|
|
9999
10011
|
}
|
|
10000
|
-
|
|
10001
|
-
//#region src/runtime/supervise/progress.ts
|
|
10012
|
+
// src/runtime/supervise/progress.ts
|
|
10002
10013
|
/**
|
|
10003
10014
|
*
|
|
10004
10015
|
* The LIVE read-model of a still-RUNNING worker — what a driver can see BEFORE the worker settles.
|
|
@@ -10092,8 +10103,7 @@ function readWorkerProgress(scope, executor, now, stallAfterMs = DEFAULT_STALL_A
|
|
|
10092
10103
|
...scope.team ? { team: scope.team } : {}
|
|
10093
10104
|
};
|
|
10094
10105
|
}
|
|
10095
|
-
|
|
10096
|
-
//#region src/runtime/supervise/task-prompt.ts
|
|
10106
|
+
// src/runtime/supervise/task-prompt.ts
|
|
10097
10107
|
/**
|
|
10098
10108
|
*
|
|
10099
10109
|
* The one rule for reading a leaf task as prompt text. A `Scope` task is opaque (`unknown`) and
|
|
@@ -10122,8 +10132,7 @@ function taskToPrompt$1(task) {
|
|
|
10122
10132
|
}
|
|
10123
10133
|
return JSON.stringify(task);
|
|
10124
10134
|
}
|
|
10125
|
-
|
|
10126
|
-
//#region src/runtime/supervise/bridge-session-stream.ts
|
|
10135
|
+
// src/runtime/supervise/bridge-session-stream.ts
|
|
10127
10136
|
/** One resumable cli-bridge session as a streamed turn loop: turn 0 sends the task, each later
|
|
10128
10137
|
* turn fires ONLY when the inbox has a steer/answer to fold, re-calling the SAME `session_id`.
|
|
10129
10138
|
* Mirrors `routerToolsInlineExecutor`'s take→turn→settle loop with a full harness call per turn. */
|
|
@@ -10177,7 +10186,10 @@ async function* streamBridgeSession(args) {
|
|
|
10177
10186
|
});
|
|
10178
10187
|
yield* ledger.settleTurn(activeRun.profileMaterialization?.inference?.observation?.usage, harnessStore, observation, seam.providerModel);
|
|
10179
10188
|
yield { kind: "iteration" };
|
|
10180
|
-
if (!interrupted
|
|
10189
|
+
if (!interrupted) {
|
|
10190
|
+
if (ledger.turn.text) ledger.lastText = ledger.turn.text;
|
|
10191
|
+
ledger.lastFinalOutput = ledger.turn.finalOutput;
|
|
10192
|
+
}
|
|
10181
10193
|
if (interrupted) {
|
|
10182
10194
|
observation.note = `turn ${ledger.turns} interrupted, resuming`;
|
|
10183
10195
|
continue;
|
|
@@ -10189,7 +10201,7 @@ async function* streamBridgeSession(args) {
|
|
|
10189
10201
|
if (inbox.pendingAuthority() === 0) break;
|
|
10190
10202
|
}
|
|
10191
10203
|
observation.note = "settled";
|
|
10192
|
-
args.onArtifact(ledger.artifact(args.sessionId, started));
|
|
10204
|
+
args.onArtifact(ledger.artifact(args.sessionId, started, seam.outputFormat));
|
|
10193
10205
|
}
|
|
10194
10206
|
/** The folded text of the messages this turn took, noted on the activity log; none when empty. */
|
|
10195
10207
|
function foldTurnMessages(turnLease, inbox, observation) {
|
|
@@ -10262,6 +10274,7 @@ async function* streamBridgeTurn(args, turn) {
|
|
|
10262
10274
|
const requestBody = {
|
|
10263
10275
|
model: seam.model,
|
|
10264
10276
|
stream: true,
|
|
10277
|
+
...seam.outputFormat === "json" ? { response_format: { type: "json_object" } } : {},
|
|
10265
10278
|
run_id: activeRun.id,
|
|
10266
10279
|
session_id: args.sessionId,
|
|
10267
10280
|
...seam.cwd ? { cwd: seam.cwd } : {},
|
|
@@ -10371,6 +10384,10 @@ function observeChunkIdentity(chunk, ledger, args) {
|
|
|
10371
10384
|
/** The model output and tool steps a chunk carried, mirrored locally before each is published. */
|
|
10372
10385
|
function* chunkProgress(chunk, ledger, args) {
|
|
10373
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
|
+
}
|
|
10374
10391
|
if (chunk.content) {
|
|
10375
10392
|
ledger.turn.text += chunk.content;
|
|
10376
10393
|
yield {
|
|
@@ -10440,8 +10457,7 @@ function mergeBridgeObservedModel(current, next) {
|
|
|
10440
10457
|
if (merged === void 0) throw new ValidationError$1(`bridgeExecutor: bridge changed response model from ${JSON.stringify(current)} to ${JSON.stringify(next)}`);
|
|
10441
10458
|
return merged;
|
|
10442
10459
|
}
|
|
10443
|
-
|
|
10444
|
-
//#region src/runtime/supervise/peer-mail.ts
|
|
10460
|
+
// src/runtime/supervise/peer-mail.ts
|
|
10445
10461
|
/**
|
|
10446
10462
|
*
|
|
10447
10463
|
* PEER MAIL — the sibling-to-sibling channel, and the ONE place its bounds are enforced.
|
|
@@ -10738,8 +10754,7 @@ function peerMailTools(mailbox, capabilityId) {
|
|
|
10738
10754
|
handler: () => Promise.resolve({ ...mailbox.read(capabilityId) })
|
|
10739
10755
|
}];
|
|
10740
10756
|
}
|
|
10741
|
-
|
|
10742
|
-
//#region src/runtime/supervise/inbox.ts
|
|
10757
|
+
// src/runtime/supervise/inbox.ts
|
|
10743
10758
|
/**
|
|
10744
10759
|
*
|
|
10745
10760
|
* The worker-side receive end of the down-leg: a per-worker inbox an executor exposes as
|
|
@@ -10791,7 +10806,7 @@ function peerMailTools(mailbox, capabilityId) {
|
|
|
10791
10806
|
*/
|
|
10792
10807
|
/** How long an authority message may wait unconsumed before it interrupts the turn in flight.
|
|
10793
10808
|
* Run 18b's queued steers took a median 52.5 min to reach a worker. */
|
|
10794
|
-
const AUTHORITY_PROMOTION_MS =
|
|
10809
|
+
const AUTHORITY_PROMOTION_MS = 9e5;
|
|
10795
10810
|
/** Wire key under which a sender passes its receipt callback beside a steer or answer. */
|
|
10796
10811
|
const INBOX_RECEIPT_KEY = "receipt";
|
|
10797
10812
|
function parseDown(msg) {
|
|
@@ -10971,8 +10986,7 @@ async function* failPendingAfter(inbox, stream) {
|
|
|
10971
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)}`);
|
|
10972
10987
|
}
|
|
10973
10988
|
}
|
|
10974
|
-
|
|
10975
|
-
//#region src/runtime/supervise/worker-lineage.ts
|
|
10989
|
+
// src/runtime/supervise/worker-lineage.ts
|
|
10976
10990
|
/**
|
|
10977
10991
|
* Session lineage handed DOWN to a spawned worker: the `TANGLE_*` ids the operator's `lineage` tool
|
|
10978
10992
|
* (tangle-tools `lineage/`) stamps at every launch, so a supervised tree shows up in the cross-box
|
|
@@ -11105,7 +11119,8 @@ function sortKeys(value) {
|
|
|
11105
11119
|
}
|
|
11106
11120
|
function recordLaunch(env, ids, options) {
|
|
11107
11121
|
try {
|
|
11108
|
-
const
|
|
11122
|
+
const home = env.LINEAGE_HOME || join(homedir(), ".local", "state", "lineage");
|
|
11123
|
+
const dir = join(home, "events");
|
|
11109
11124
|
if (!existsSync(dir)) return;
|
|
11110
11125
|
const host = lineageHost(env);
|
|
11111
11126
|
const common = {
|
|
@@ -11148,8 +11163,7 @@ function recordLaunch(env, ids, options) {
|
|
|
11148
11163
|
});
|
|
11149
11164
|
} catch {}
|
|
11150
11165
|
}
|
|
11151
|
-
|
|
11152
|
-
//#region src/sanitize.ts
|
|
11166
|
+
// src/sanitize.ts
|
|
11153
11167
|
/** Strip PII and large blobs from a `KnowledgeReadinessReport` for safe telemetry emission. @stable */
|
|
11154
11168
|
function sanitizeKnowledgeReadinessReport(report, options = {}) {
|
|
11155
11169
|
return {
|
|
@@ -11528,8 +11542,7 @@ function createRuntimeStreamEventCollector(options = {}) {
|
|
|
11528
11542
|
}
|
|
11529
11543
|
};
|
|
11530
11544
|
}
|
|
11531
|
-
|
|
11532
|
-
//#region src/otel-export.ts
|
|
11545
|
+
// src/otel-export.ts
|
|
11533
11546
|
/**
|
|
11534
11547
|
* OTEL span exporter — streams LoopTraceEvents to an OTLP/HTTP collector.
|
|
11535
11548
|
*
|
|
@@ -12156,7 +12169,6 @@ function buildLoopSpanNodes(events, redact) {
|
|
|
12156
12169
|
flushRound(e.timestamp);
|
|
12157
12170
|
}
|
|
12158
12171
|
currentRoundId = void 0;
|
|
12159
|
-
break;
|
|
12160
12172
|
}
|
|
12161
12173
|
}
|
|
12162
12174
|
flushRound(rootEnd);
|
|
@@ -12228,8 +12240,7 @@ function generateSpanId() {
|
|
|
12228
12240
|
else for (let i = 0; i < 8; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
12229
12241
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
12230
12242
|
}
|
|
12231
|
-
|
|
12232
|
-
//#region src/mcp/trace-propagation.ts
|
|
12243
|
+
// src/mcp/trace-propagation.ts
|
|
12233
12244
|
/**
|
|
12234
12245
|
*
|
|
12235
12246
|
* Trace context propagation across process-spawn boundaries.
|
|
@@ -12368,8 +12379,7 @@ function generateTraceId() {
|
|
|
12368
12379
|
else for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
12369
12380
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
12370
12381
|
}
|
|
12371
|
-
|
|
12372
|
-
//#region src/runtime/supervise/worker-trace.ts
|
|
12382
|
+
// src/runtime/supervise/worker-trace.ts
|
|
12373
12383
|
/**
|
|
12374
12384
|
* Trace context handed DOWN to a spawned worker, so one supervised tree spans machines.
|
|
12375
12385
|
*
|
|
@@ -12505,8 +12515,7 @@ function workerTraceHeaders(ctx) {
|
|
|
12505
12515
|
...env.PARENT_SPAN_ID !== void 0 ? { "x-parent-span-id": env.PARENT_SPAN_ID } : {}
|
|
12506
12516
|
};
|
|
12507
12517
|
}
|
|
12508
|
-
|
|
12509
|
-
//#region src/runtime/supervise/bridge-executor.ts
|
|
12518
|
+
// src/runtime/supervise/bridge-executor.ts
|
|
12510
12519
|
/** Bridge executor lifecycle, steering, materialization, and measured usage. */
|
|
12511
12520
|
/** Resolve the exact bridge wire id from the profile and nowhere else. */
|
|
12512
12521
|
function bridgeProfileModel(profile, context) {
|
|
@@ -12535,6 +12544,7 @@ const bridgeExecutor = (spec, ctx) => {
|
|
|
12535
12544
|
...bridgeTokenLimits.applied.maxTokens !== void 0 ? { maxTokens: bridgeTokenLimits.applied.maxTokens } : {}
|
|
12536
12545
|
};
|
|
12537
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");
|
|
12538
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}`);
|
|
12539
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}`);
|
|
12540
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");
|
|
@@ -12774,8 +12784,7 @@ function scheduleBridgeRunStateRefresh(seam, activeRuns, observation) {
|
|
|
12774
12784
|
}
|
|
12775
12785
|
})();
|
|
12776
12786
|
}
|
|
12777
|
-
|
|
12778
|
-
//#region src/runtime/supervise/bridge-worktree-executor.ts
|
|
12787
|
+
// src/runtime/supervise/bridge-worktree-executor.ts
|
|
12779
12788
|
function bridgeWorktreeExecutor(spec, ctx, seam) {
|
|
12780
12789
|
const bridge = seam.bridge;
|
|
12781
12790
|
if (!bridge) throw new ValidationError$1("cliWorktreeExecutor: bridge transport missing");
|
|
@@ -12829,7 +12838,7 @@ function bridgeWorktreeExecutor(spec, ctx, seam) {
|
|
|
12829
12838
|
model,
|
|
12830
12839
|
testCmd: seam.testCmd ?? null,
|
|
12831
12840
|
typecheckCmd: seam.typecheckCmd ?? null,
|
|
12832
|
-
checkTimeoutMs: seam.checkTimeoutMs ?? seam.harnessTimeoutMs ?? bridge.timeoutMs ??
|
|
12841
|
+
checkTimeoutMs: seam.checkTimeoutMs ?? seam.harnessTimeoutMs ?? bridge.timeoutMs ?? 3e5,
|
|
12833
12842
|
checkOutputCap: seam.checkOutputCap ?? 16e3,
|
|
12834
12843
|
bridgeAcknowledgement: null
|
|
12835
12844
|
}
|
|
@@ -12876,14 +12885,15 @@ function bridgeWorktreeExecutor(spec, ctx, seam) {
|
|
|
12876
12885
|
...bridge.timeoutMs !== void 0 ? { timeoutMs: bridge.timeoutMs } : {},
|
|
12877
12886
|
...bridge.maxReconnects !== void 0 ? { maxReconnects: bridge.maxReconnects } : {}
|
|
12878
12887
|
};
|
|
12879
|
-
|
|
12888
|
+
const bridgeCtx = {
|
|
12880
12889
|
...ctx,
|
|
12881
12890
|
signal: linked,
|
|
12882
12891
|
seams: {
|
|
12883
12892
|
...ctx.seams,
|
|
12884
12893
|
[bridgeSeamKey]: bridgeSeam
|
|
12885
12894
|
}
|
|
12886
|
-
}
|
|
12895
|
+
};
|
|
12896
|
+
inner = bridgeExecutor(spec, bridgeCtx);
|
|
12887
12897
|
for (const msg of pending.splice(0)) inner.deliver?.(msg);
|
|
12888
12898
|
const run = inner.execute(task, linked);
|
|
12889
12899
|
if (isAsyncIterable(run)) {
|
|
@@ -12915,7 +12925,7 @@ function bridgeWorktreeExecutor(spec, ctx, seam) {
|
|
|
12915
12925
|
worktreePath: worktree.path,
|
|
12916
12926
|
...seam.testCmd !== void 0 ? { testCmd: seam.testCmd } : {},
|
|
12917
12927
|
...seam.typecheckCmd !== void 0 ? { typecheckCmd: seam.typecheckCmd } : {},
|
|
12918
|
-
timeoutMs: seam.checkTimeoutMs ?? seam.harnessTimeoutMs ?? bridge.timeoutMs ??
|
|
12928
|
+
timeoutMs: seam.checkTimeoutMs ?? seam.harnessTimeoutMs ?? bridge.timeoutMs ?? 3e5,
|
|
12919
12929
|
cap: seam.checkOutputCap ?? 16e3,
|
|
12920
12930
|
...seam.runCommand ? { runCommand: seam.runCommand } : {},
|
|
12921
12931
|
signal: linked
|
|
@@ -12989,8 +12999,7 @@ function bridgeOutputText(out) {
|
|
|
12989
12999
|
* `AgentProfile` driving claude / codex / opencode / pi / kimi-code on its own worktree. `budgetExempt` like
|
|
12990
13000
|
* the other CLI leaves; the authored systemPrompt + model reach the harness via §1.5.
|
|
12991
13001
|
*/
|
|
12992
|
-
|
|
12993
|
-
//#region src/runtime/supervise/in-place-cli-executor.ts
|
|
13002
|
+
// src/runtime/supervise/in-place-cli-executor.ts
|
|
12994
13003
|
/**
|
|
12995
13004
|
*
|
|
12996
13005
|
* The in-place CLI leaf executor — a supervisor-authored `AgentProfile` driving a local
|
|
@@ -13132,8 +13141,7 @@ function executionTaskPrompt$1(task, configuredPrompt) {
|
|
|
13132
13141
|
if (typeof prompt !== "string" || prompt.length === 0) throw new ValidationError$1("createInPlaceCliExecutor: execute task produced no prompt text");
|
|
13133
13142
|
return prompt;
|
|
13134
13143
|
}
|
|
13135
|
-
|
|
13136
|
-
//#region src/runtime/supervise/runtime-seams.ts
|
|
13144
|
+
// src/runtime/supervise/runtime-seams.ts
|
|
13137
13145
|
const sandboxCaptureOutputSeamKey = "runtime.sandboxCaptureOutput";
|
|
13138
13146
|
const routerSeamKey = "router";
|
|
13139
13147
|
const sandboxSeamKey = "sandbox";
|
|
@@ -13141,8 +13149,7 @@ const cliWorktreeSeamKey = "cli-worktree";
|
|
|
13141
13149
|
const cliInPlaceSeamKey = "cli-in-place";
|
|
13142
13150
|
const providerSeamKey = "provider";
|
|
13143
13151
|
const routerToolsSeamKey = "router-tools";
|
|
13144
|
-
|
|
13145
|
-
//#region src/runtime/supervise/worktree-cli-executor.ts
|
|
13152
|
+
// src/runtime/supervise/worktree-cli-executor.ts
|
|
13146
13153
|
/**
|
|
13147
13154
|
*
|
|
13148
13155
|
* The worktree-CLI leaf executor — a supervisor-authored `AgentProfile` driving a local
|
|
@@ -13323,8 +13330,7 @@ function executionTaskPrompt(task, configuredPrompt) {
|
|
|
13323
13330
|
}
|
|
13324
13331
|
throw new ValidationError$1("createWorktreeCliExecutor: execute task must be JSON-serializable");
|
|
13325
13332
|
}
|
|
13326
|
-
|
|
13327
|
-
//#region src/runtime/supervise/cli-executor-factories.ts
|
|
13333
|
+
// src/runtime/supervise/cli-executor-factories.ts
|
|
13328
13334
|
/** Executor factory for a CLI harness that runs in a git worktree of the caller's checkout. */
|
|
13329
13335
|
const cliWorktreeExecutor = (spec, ctx) => {
|
|
13330
13336
|
const seam = readSeam(ctx, cliWorktreeSeamKey, "cli-worktree");
|
|
@@ -13371,8 +13377,7 @@ const cliInPlaceExecutor = (spec, ctx) => {
|
|
|
13371
13377
|
...ctx.node?.attemptId !== void 0 ? { executionAttemptId: ctx.node.attemptId } : {}
|
|
13372
13378
|
});
|
|
13373
13379
|
};
|
|
13374
|
-
|
|
13375
|
-
//#region src/runtime/provider-placement.ts
|
|
13380
|
+
// src/runtime/provider-placement.ts
|
|
13376
13381
|
const placementMetadataKey = "runtimeProviderPlacement";
|
|
13377
13382
|
/** Select exactly one declaration before any provider effects. Shared defaults carry infrastructure only. */
|
|
13378
13383
|
function selectProviderPlacement(profile, options) {
|
|
@@ -13484,8 +13489,7 @@ function publicCreateOptions(create) {
|
|
|
13484
13489
|
...secrets === void 0 ? {} : { secretNames: Array.isArray(secrets) ? [...secrets].sort() : Object.keys(secrets).sort() }
|
|
13485
13490
|
};
|
|
13486
13491
|
}
|
|
13487
|
-
|
|
13488
|
-
//#region src/runtime/supervise/worker-slots.ts
|
|
13492
|
+
// src/runtime/supervise/worker-slots.ts
|
|
13489
13493
|
/**
|
|
13490
13494
|
* Worker slots: the one bound on how many spawned agents work at the same time.
|
|
13491
13495
|
*
|
|
@@ -14109,8 +14113,7 @@ function requireDurableWorkspaceArtifacts(snapshot) {
|
|
|
14109
14113
|
function isDurableArtifact(artifact) {
|
|
14110
14114
|
return "locator" in artifact;
|
|
14111
14115
|
}
|
|
14112
|
-
|
|
14113
|
-
//#region src/runtime/retained-harness-transcript.ts
|
|
14116
|
+
// src/runtime/retained-harness-transcript.ts
|
|
14114
14117
|
const digest = z.custom((value) => typeof value === "string" && /^sha256:[0-9a-f]{64}$/.test(value));
|
|
14115
14118
|
const count = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
14116
14119
|
const text = z.string().min(1);
|
|
@@ -14168,10 +14171,10 @@ const retainedSchema = z.object({
|
|
|
14168
14171
|
missing: z.array(z.string())
|
|
14169
14172
|
});
|
|
14170
14173
|
const defaults = {
|
|
14171
|
-
maxFileBytes:
|
|
14172
|
-
maxTotalBytes:
|
|
14174
|
+
maxFileBytes: 2097152,
|
|
14175
|
+
maxTotalBytes: 16777216,
|
|
14173
14176
|
maxFiles: 1e3,
|
|
14174
|
-
maxManifestBytes:
|
|
14177
|
+
maxManifestBytes: 16777216
|
|
14175
14178
|
};
|
|
14176
14179
|
/** Validate persisted descriptors before trusting their identity, locators, or inventory. */
|
|
14177
14180
|
function parseRetainedHarnessTranscript(value) {
|
|
@@ -14373,8 +14376,7 @@ async function resolveHarnessTranscriptCapture(capture, options = {}) {
|
|
|
14373
14376
|
skipped
|
|
14374
14377
|
});
|
|
14375
14378
|
}
|
|
14376
|
-
|
|
14377
|
-
//#region src/runtime/harness-transcript.ts
|
|
14379
|
+
// src/runtime/harness-transcript.ts
|
|
14378
14380
|
/**
|
|
14379
14381
|
* Persist a harness transcript receipt beside the supervisor tool trace.
|
|
14380
14382
|
* Provider workspace retention supplies an attributed descriptor whose bytes stay in the
|
|
@@ -14417,8 +14419,8 @@ const DENY = /(^|\/)(auth\.json|\.credentials\.json|credentials|\.netrc|\.env(\.
|
|
|
14417
14419
|
* resume rehydrate a ref, never the files; nothing pays for a transcript until someone opens it.
|
|
14418
14420
|
* The bound is enforced exactly, after each read, so a child settles at or under MAX_TOTAL_BYTES.
|
|
14419
14421
|
*/
|
|
14420
|
-
const MAX_FILE_BYTES =
|
|
14421
|
-
const MAX_TOTAL_BYTES =
|
|
14422
|
+
const MAX_FILE_BYTES = 2097152;
|
|
14423
|
+
const MAX_TOTAL_BYTES = 16777216;
|
|
14422
14424
|
const MAX_FILES = 1e3;
|
|
14423
14425
|
function unavailable$2(reason) {
|
|
14424
14426
|
return Object.freeze({
|
|
@@ -14453,7 +14455,7 @@ function harnessTranscriptUnavailable(reason) {
|
|
|
14453
14455
|
* steps are bounded (the harness stop at 30 s, each native copy by its port's `nativeTimeoutMs`,
|
|
14454
14456
|
* 120 s by default), so this guards only an executor that never answers.
|
|
14455
14457
|
*/
|
|
14456
|
-
const HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS =
|
|
14458
|
+
const HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS = 36e4;
|
|
14457
14459
|
/**
|
|
14458
14460
|
* Wait, bounded, until the executor's transcript is final (`Executor.harnessTranscriptSettled`).
|
|
14459
14461
|
* Never throws: on a timeout or a failure the read that follows reports what was kept.
|
|
@@ -14493,7 +14495,7 @@ const MAX_SUBAGENT_EXPORTS = 32;
|
|
|
14493
14495
|
const SUBAGENT_EXPORT_SECONDS = 120;
|
|
14494
14496
|
/** The script starts no export after SUBAGENT_EXPORT_SECONDS and bounds each one at 30 s, so it
|
|
14495
14497
|
* ends inside this. It is passed to `exec`, because the Sandbox SDK's default is 30 s. */
|
|
14496
|
-
const SUBAGENT_EXPORT_EXEC_MS =
|
|
14498
|
+
const SUBAGENT_EXPORT_EXEC_MS = 18e4;
|
|
14497
14499
|
const SUBAGENT_EXPORT_DIR = "~/.local/share/opencode/export";
|
|
14498
14500
|
/**
|
|
14499
14501
|
* The export, run in the box. For each sidecar record it reads the runtime home and the parent
|
|
@@ -14848,8 +14850,7 @@ function isHarnessTranscriptArtifact(value) {
|
|
|
14848
14850
|
const artifact = value;
|
|
14849
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");
|
|
14850
14852
|
}
|
|
14851
|
-
|
|
14852
|
-
//#region src/runtime/retained-interactive-lifecycle.ts
|
|
14853
|
+
// src/runtime/retained-interactive-lifecycle.ts
|
|
14853
14854
|
const INTERACTIVE_CLEANUP_TIMEOUT_MS = 3e4;
|
|
14854
14855
|
/** Bound on one lookup that asks the provider whether it still holds an environment. */
|
|
14855
14856
|
const ENVIRONMENT_LOOKUP_TIMEOUT_MS = 3e4;
|
|
@@ -14959,8 +14960,7 @@ function disposeInteractiveEnvironment(environment, abortReason) {
|
|
|
14959
14960
|
process.emitWarning(failure, { code: "AGENT_RUNTIME_INTERACTIVE_CLEANUP_FAILED" });
|
|
14960
14961
|
});
|
|
14961
14962
|
}
|
|
14962
|
-
|
|
14963
|
-
//#region src/runtime/interaction-capabilities.ts
|
|
14963
|
+
// src/runtime/interaction-capabilities.ts
|
|
14964
14964
|
/**
|
|
14965
14965
|
* Check one turn's interaction request before the provider can dispatch it.
|
|
14966
14966
|
*
|
|
@@ -14977,8 +14977,7 @@ function assertRequestedInteractionCapabilities(providerName, requested, capabil
|
|
|
14977
14977
|
if (unsupportedKinds.length > 0) throw new Error(`provider "${providerName}" does not support requested interaction kinds: ${unsupportedKinds.join(", ")}`);
|
|
14978
14978
|
if (interactions.replay !== true || interactions.responseIdempotency !== true) throw new Error(`provider "${providerName}" cannot safely dispatch requested interactions without replay and response idempotency`);
|
|
14979
14979
|
}
|
|
14980
|
-
|
|
14981
|
-
//#region src/runtime/retained-context-transfer.ts
|
|
14980
|
+
// src/runtime/retained-context-transfer.ts
|
|
14982
14981
|
/** Validate attachment authority before admission or any provider operation. */
|
|
14983
14982
|
function retainedContextTransferReceipt(options, provider, request) {
|
|
14984
14983
|
if (request === void 0) {
|
|
@@ -15014,8 +15013,7 @@ function assertRetainedContextTransferEnvironment(environment, request, receipt)
|
|
|
15014
15013
|
status: "accepted"
|
|
15015
15014
|
})) throw new Error("provider did not reconstruct the authoritative accepted context transfer receipt");
|
|
15016
15015
|
}
|
|
15017
|
-
|
|
15018
|
-
//#region src/runtime/retained-run-control.ts
|
|
15016
|
+
// src/runtime/retained-run-control.ts
|
|
15019
15017
|
/**
|
|
15020
15018
|
* The control reference one retained handle currently believes in, with every reference it
|
|
15021
15019
|
* has seen. A provider may expose the previous reference while a terminal read catches up;
|
|
@@ -15072,8 +15070,7 @@ var RetainedRunControl = class {
|
|
|
15072
15070
|
}
|
|
15073
15071
|
}
|
|
15074
15072
|
};
|
|
15075
|
-
|
|
15076
|
-
//#region src/runtime/retained-run-events.ts
|
|
15073
|
+
// src/runtime/retained-run-events.ts
|
|
15077
15074
|
/** The runtime's own contract checks inside the stream loop, so the catch can tell a broken
|
|
15078
15075
|
* answer (a verdict) from a read the provider's iterator failed (a wrapper). */
|
|
15079
15076
|
const runtimeChecks = /* @__PURE__ */ new WeakSet();
|
|
@@ -15162,8 +15159,7 @@ async function* retainedRunEvents(session, controlRef, options, now) {
|
|
|
15162
15159
|
function canonicalEvent(source) {
|
|
15163
15160
|
return parseCanonicalTransportEvent(source.type, source.data, source.normalized ?? source.data.normalized, "provider");
|
|
15164
15161
|
}
|
|
15165
|
-
|
|
15166
|
-
//#region src/runtime/retained-run-native-continuation.ts
|
|
15162
|
+
// src/runtime/retained-run-native-continuation.ts
|
|
15167
15163
|
const semanticTurnOf = ({ timeoutMs: _timeoutMs, signal: _signal, ...semanticTurn }) => semanticTurn;
|
|
15168
15164
|
const unsupportedAdmissionControl = (provider) => /* @__PURE__ */ new Error(`provider "${provider}" does not advertise early native continuation admission control`);
|
|
15169
15165
|
const missingContinuationAdmission = () => new RetainedRunProviderContractError("provider accepted a native continuation without an admission reference", { code: "RETAINED_NATIVE_CONTINUATION_ADMISSION_MISSING" });
|
|
@@ -15305,8 +15301,7 @@ function beginNativeContinuation(control, capabilities, request, turn) {
|
|
|
15305
15301
|
result
|
|
15306
15302
|
};
|
|
15307
15303
|
}
|
|
15308
|
-
|
|
15309
|
-
//#region src/runtime/retained-run-handle.ts
|
|
15304
|
+
// src/runtime/retained-run-handle.ts
|
|
15310
15305
|
async function snapshot(control, clock, reason, signal) {
|
|
15311
15306
|
if (signal?.aborted) throw abortError(signal.reason);
|
|
15312
15307
|
control.sync();
|
|
@@ -15453,8 +15448,7 @@ function createRetainedRunHandle(environment, session, initialControlRef, capabi
|
|
|
15453
15448
|
cancel: (options) => cancelRetainedRun(control, clock, options)
|
|
15454
15449
|
};
|
|
15455
15450
|
}
|
|
15456
|
-
|
|
15457
|
-
//#region src/runtime/retained-run-intent.ts
|
|
15451
|
+
// src/runtime/retained-run-intent.ts
|
|
15458
15452
|
/**
|
|
15459
15453
|
* Project environment creation input into public digest material.
|
|
15460
15454
|
*
|
|
@@ -15546,8 +15540,7 @@ function retainedTurnMaterial(input, contextTransfer) {
|
|
|
15546
15540
|
...contextTransfer === void 0 ? {} : { contextTransferRequestDigest: contextTransfer.requestDigest }
|
|
15547
15541
|
};
|
|
15548
15542
|
}
|
|
15549
|
-
|
|
15550
|
-
//#region src/runtime/retained-run-start.ts
|
|
15543
|
+
// src/runtime/retained-run-start.ts
|
|
15551
15544
|
/**
|
|
15552
15545
|
* Mint deterministic dispatch coordinates from the two caller-supplied keys.
|
|
15553
15546
|
* The same `(idempotencyKey, turnId)` pair yields the same coordinates in
|
|
@@ -15556,9 +15549,10 @@ function retainedTurnMaterial(input, contextTransfer) {
|
|
|
15556
15549
|
* keeps provider session identifiers bounded and safe for workspace paths.
|
|
15557
15550
|
*/
|
|
15558
15551
|
function mintRetainedIdentity(idempotencyKey, turnId) {
|
|
15552
|
+
const base = `${encodeURIComponent(idempotencyKey)}:${encodeURIComponent(turnId)}`;
|
|
15559
15553
|
const digest = canonicalCandidateDigest({
|
|
15560
15554
|
kind: "retained-identity.v1",
|
|
15561
|
-
base
|
|
15555
|
+
base
|
|
15562
15556
|
}).slice(7);
|
|
15563
15557
|
return {
|
|
15564
15558
|
sessionId: `retained-session-${digest}`,
|
|
@@ -15926,7 +15920,8 @@ function retainedContextTransfer(value) {
|
|
|
15926
15920
|
return detachedSnapshot(parsed.data, "retained context transfer request");
|
|
15927
15921
|
}
|
|
15928
15922
|
function assertExactRetainedRunIntent(received, expected) {
|
|
15929
|
-
|
|
15923
|
+
const stableReceived = parseRetainedRunIntent(received);
|
|
15924
|
+
if (canonicalCandidateDigest(stableReceived) !== canonicalCandidateDigest(expected)) throw new Error("retained run intent conflicts with replay material");
|
|
15930
15925
|
}
|
|
15931
15926
|
function parseRetainedRunIntent(value) {
|
|
15932
15927
|
const stable = detachedSnapshot(value, "retained run intent");
|
|
@@ -15990,8 +15985,7 @@ function assertRetainedCapabilityRequirements(providerName, capabilities) {
|
|
|
15990
15985
|
const retained = capabilities.retainedControl;
|
|
15991
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`);
|
|
15992
15987
|
}
|
|
15993
|
-
|
|
15994
|
-
//#region src/runtime/retained-native-stop.ts
|
|
15988
|
+
// src/runtime/retained-native-stop.ts
|
|
15995
15989
|
/** One request per run: every caller that stops the same execution replays one provider operation,
|
|
15996
15990
|
* so the operation id and its reason never disagree across a teardown and a release. */
|
|
15997
15991
|
const NATIVE_STOP_REASON = "Runtime stopped the native harness: its execution is no longer observed";
|
|
@@ -16065,8 +16059,7 @@ function describeRetainedNativeStops(stops) {
|
|
|
16065
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`;
|
|
16066
16060
|
}).join("; ");
|
|
16067
16061
|
}
|
|
16068
|
-
|
|
16069
|
-
//#region src/runtime/environment-provider/provider-retention-lifecycle.ts
|
|
16062
|
+
// src/runtime/environment-provider/provider-retention-lifecycle.ts
|
|
16070
16063
|
function createProviderCaptureMirrors(options, createProfile, node, state) {
|
|
16071
16064
|
const nativePort = options.workspaceRetention?.captureNative === void 0 ? void 0 : options.workspaceRetention;
|
|
16072
16065
|
let nativeInFlight;
|
|
@@ -16356,8 +16349,7 @@ function providerWorkspaceCaptureReceipt(args, environment, snapshot, fallbackSe
|
|
|
16356
16349
|
...coverage.incompleteReason === void 0 ? {} : { incompleteReason: coverage.incompleteReason }
|
|
16357
16350
|
});
|
|
16358
16351
|
}
|
|
16359
|
-
|
|
16360
|
-
//#region src/runtime/environment-provider/provider-workspace-capture.ts
|
|
16352
|
+
// src/runtime/environment-provider/provider-workspace-capture.ts
|
|
16361
16353
|
/** Capture the environment's workspace once per generation; later callers share that capture. */
|
|
16362
16354
|
async function captureExecutorWorkspace(scope, next, outcome) {
|
|
16363
16355
|
const { state } = scope;
|
|
@@ -16441,8 +16433,7 @@ function recordCapturedWorkspace(scope, workspaceRetention, next, { snapshot, pr
|
|
|
16441
16433
|
}
|
|
16442
16434
|
if (workspaceRetention.requireCompleteProvenance && !coverageComplete) state.workspacePreservationRequired = true;
|
|
16443
16435
|
}
|
|
16444
|
-
|
|
16445
|
-
//#region src/runtime/environment-provider/provider-environment-teardown.ts
|
|
16436
|
+
// src/runtime/environment-provider/provider-environment-teardown.ts
|
|
16446
16437
|
/** The environment id the latest durable admission names, when creation got that far. */
|
|
16447
16438
|
function admittedEnvironmentId(retention) {
|
|
16448
16439
|
for (const admission of [...retention?.admissions ?? []].reverse()) {
|
|
@@ -16585,8 +16576,7 @@ async function captureBeforeDestroy$1(scope, target, signal) {
|
|
|
16585
16576
|
await awaitAbortable$1(mirrors.captureNative(target, "interrupted", admitted === void 0 ? void 0 : freezeControlRef(admitted)), signal).catch(() => void 0);
|
|
16586
16577
|
}
|
|
16587
16578
|
}
|
|
16588
|
-
|
|
16589
|
-
//#region src/runtime/supervise/workspace-checkpoint.ts
|
|
16579
|
+
// src/runtime/supervise/workspace-checkpoint.ts
|
|
16590
16580
|
/** Workspace-relative path of the marker Runtime writes before every checkpoint. */
|
|
16591
16581
|
const WORKSPACE_CHECKPOINT_MARKER_PATH = ".agent-runtime-checkpoint";
|
|
16592
16582
|
/** Bound on one checkpoint: environment lookup, marker write, and the provider operation. */
|
|
@@ -16595,10 +16585,10 @@ const WORKSPACE_CHECKPOINT_TIMEOUT_MS = 12e4;
|
|
|
16595
16585
|
* A turn's own workspace capture also cuts them short when it starts. A capture cut short keeps
|
|
16596
16586
|
* its checkpoint, and the owner's release, bounded by `RELEASE_CHECKPOINT_CAPTURES_MS`, captures
|
|
16597
16587
|
* it again. */
|
|
16598
|
-
const WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS =
|
|
16588
|
+
const WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS = 12e4;
|
|
16599
16589
|
/** Bound on creating and reconstructing the fork a checkpoint's capture reads: a Sandbox box
|
|
16600
16590
|
* created from a snapshot (19 s). The capture itself is bounded by its port. */
|
|
16601
|
-
const WORKSPACE_CHECKPOINT_FORK_TIMEOUT_MS =
|
|
16591
|
+
const WORKSPACE_CHECKPOINT_FORK_TIMEOUT_MS = 6e5;
|
|
16602
16592
|
/** Write the marker. False when the environment cannot take it, so no restore can be verified. */
|
|
16603
16593
|
async function writeWorkspaceMarker(environment, marker, signal) {
|
|
16604
16594
|
if (typeof environment.write !== "function") return false;
|
|
@@ -16631,8 +16621,7 @@ async function verifyWorkspaceMarker(environment, marker, signal) {
|
|
|
16631
16621
|
};
|
|
16632
16622
|
}
|
|
16633
16623
|
}
|
|
16634
|
-
|
|
16635
|
-
//#region src/runtime/environment-provider/provider-event-projection.ts
|
|
16624
|
+
// src/runtime/environment-provider/provider-event-projection.ts
|
|
16636
16625
|
function sandboxEventFromEnvironmentEvent(event) {
|
|
16637
16626
|
const normalized = event.normalized;
|
|
16638
16627
|
const type = normalized?.type ?? event.type;
|
|
@@ -16933,15 +16922,14 @@ function isNestedUsageType(type) {
|
|
|
16933
16922
|
function stringValue(value) {
|
|
16934
16923
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
16935
16924
|
}
|
|
16936
|
-
|
|
16937
|
-
//#region src/runtime/environment-provider/provider-retained-observation.ts
|
|
16925
|
+
// src/runtime/environment-provider/provider-retained-observation.ts
|
|
16938
16926
|
/**
|
|
16939
16927
|
* How long a retained stream may go without new evidence before the node publishes that it waits
|
|
16940
16928
|
* on its exact result. Silence never ends the turn (ending there failed 18 still-running attempts
|
|
16941
16929
|
* as `terminal-event-lost`); only the exact result or an abort does. The bound on
|
|
16942
16930
|
* a wait that never ends is the Lab keeper's hung-root re-drive after 15 minutes without a write.
|
|
16943
16931
|
*/
|
|
16944
|
-
const RETAINED_AWAITING_RESULT_AFTER_MS =
|
|
16932
|
+
const RETAINED_AWAITING_RESULT_AFTER_MS = 48e4;
|
|
16945
16933
|
const RETAINED_OBSERVATION_BATCH_EVENTS = 1024;
|
|
16946
16934
|
/**
|
|
16947
16935
|
* After its exact result, a stream that still owes its terminal frame keeps reading only while
|
|
@@ -17182,16 +17170,14 @@ var RetainedObservation = class {
|
|
|
17182
17170
|
return !failed;
|
|
17183
17171
|
}
|
|
17184
17172
|
};
|
|
17185
|
-
|
|
17186
|
-
//#region src/runtime/environment-provider/provider-validation-error.ts
|
|
17173
|
+
// src/runtime/environment-provider/provider-validation-error.ts
|
|
17187
17174
|
var ValidationError = class extends Error {
|
|
17188
17175
|
constructor(message, options) {
|
|
17189
17176
|
super(message, options);
|
|
17190
17177
|
this.name = "ValidationError";
|
|
17191
17178
|
}
|
|
17192
17179
|
};
|
|
17193
|
-
|
|
17194
|
-
//#region src/runtime/environment-provider/provider-turn-input.ts
|
|
17180
|
+
// src/runtime/environment-provider/provider-turn-input.ts
|
|
17195
17181
|
/**
|
|
17196
17182
|
* Lower the seam's prompt options onto turn fields, through the one mapper this module already
|
|
17197
17183
|
* uses to raise a sandbox prompt into a provider turn. Reusing it is what keeps the two directions
|
|
@@ -17286,8 +17272,7 @@ function taskToPrompt(task) {
|
|
|
17286
17272
|
}
|
|
17287
17273
|
return JSON.stringify(task);
|
|
17288
17274
|
}
|
|
17289
|
-
|
|
17290
|
-
//#region src/runtime/environment-provider/provider-execution-source.ts
|
|
17275
|
+
// src/runtime/environment-provider/provider-execution-source.ts
|
|
17291
17276
|
/** The environment, turn and identity a retained dispatch creates or replays. */
|
|
17292
17277
|
function retainedDispatchMaterial(args, retention, selectedTurn, signal) {
|
|
17293
17278
|
const priorSession = retention.priorSession;
|
|
@@ -17461,8 +17446,7 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
17461
17446
|
retained: false
|
|
17462
17447
|
};
|
|
17463
17448
|
}
|
|
17464
|
-
|
|
17465
|
-
//#region src/runtime/environment-provider/provider-turn-observer.ts
|
|
17449
|
+
// src/runtime/environment-provider/provider-turn-observer.ts
|
|
17466
17450
|
/** Reads one turn's provider events into archive, text, failures, trace steps, progress and usage. */
|
|
17467
17451
|
var ProviderTurnObserver = class {
|
|
17468
17452
|
args;
|
|
@@ -17518,8 +17502,7 @@ var ProviderTurnObserver = class {
|
|
|
17518
17502
|
}
|
|
17519
17503
|
}
|
|
17520
17504
|
};
|
|
17521
|
-
|
|
17522
|
-
//#region src/runtime/environment-provider/provider-sandbox-adapter.ts
|
|
17505
|
+
// src/runtime/environment-provider/provider-sandbox-adapter.ts
|
|
17523
17506
|
/** Adapt a neutral environment provider to the `SandboxClient` interface used by existing loop paths.
|
|
17524
17507
|
* @experimental */
|
|
17525
17508
|
function providerAsSandboxClient(provider, options = {}) {
|
|
@@ -17944,8 +17927,7 @@ function sessionStatusFromUnknown(status) {
|
|
|
17944
17927
|
if (status === "completed" || status === "cancelled") return status;
|
|
17945
17928
|
return statusFromUnknown(status);
|
|
17946
17929
|
}
|
|
17947
|
-
|
|
17948
|
-
//#region src/runtime/environment-provider/provider-turn-settlement.ts
|
|
17930
|
+
// src/runtime/environment-provider/provider-turn-settlement.ts
|
|
17949
17931
|
/** What the settled turn left behind and what the teardown must still decide about. */
|
|
17950
17932
|
var ProviderTurnSettlement = class {
|
|
17951
17933
|
args;
|
|
@@ -18197,8 +18179,7 @@ var ProviderTurnSettlement = class {
|
|
|
18197
18179
|
} else this.failure = this.failure instanceof Error ? Object.assign(this.failure, { cause: this.failure.cause ?? error }) : this.failure;
|
|
18198
18180
|
}
|
|
18199
18181
|
};
|
|
18200
|
-
|
|
18201
|
-
//#region src/runtime/environment-provider/provider-usage-account.ts
|
|
18182
|
+
// src/runtime/environment-provider/provider-usage-account.ts
|
|
18202
18183
|
/** What one provider invocation has spent, and what of that spend a receipt proves. */
|
|
18203
18184
|
var ProviderUsageAccount = class {
|
|
18204
18185
|
args;
|
|
@@ -18362,8 +18343,7 @@ var ProviderUsageAccount = class {
|
|
|
18362
18343
|
} else if (input > 0 || output > 0 || receipt.tokensKnown === false) this.pendingUnpricedWork = true;
|
|
18363
18344
|
}
|
|
18364
18345
|
};
|
|
18365
|
-
|
|
18366
|
-
//#region src/runtime/environment-provider/provider-invocation.ts
|
|
18346
|
+
// src/runtime/environment-provider/provider-invocation.ts
|
|
18367
18347
|
/** The turn this invocation sends: the task's turn under the provider's defaults and placement rules. */
|
|
18368
18348
|
function invocationTurn(args) {
|
|
18369
18349
|
const linked = args.signal;
|
|
@@ -18400,8 +18380,7 @@ async function* streamProviderExecutor(args) {
|
|
|
18400
18380
|
}
|
|
18401
18381
|
return settlement.end();
|
|
18402
18382
|
}
|
|
18403
|
-
|
|
18404
|
-
//#region src/runtime/environment-provider/provider-execution-loop.ts
|
|
18383
|
+
// src/runtime/environment-provider/provider-execution-loop.ts
|
|
18405
18384
|
/** A new environment now backs this execution; the identity the provider issued is evidence. */
|
|
18406
18385
|
function adoptEnvironment(scope, env) {
|
|
18407
18386
|
const { state, materialization } = scope;
|
|
@@ -18556,8 +18535,7 @@ async function pauseForContinuation(scope, invocation, ended, attempt, refusalsB
|
|
|
18556
18535
|
}
|
|
18557
18536
|
};
|
|
18558
18537
|
}
|
|
18559
|
-
|
|
18560
|
-
//#region src/runtime/environment-provider/provider-executor-state.ts
|
|
18538
|
+
// src/runtime/environment-provider/provider-executor-state.ts
|
|
18561
18539
|
/** Everything one provider executor knows about its environment, capture generation and release. */
|
|
18562
18540
|
var ProviderExecutorState = class {
|
|
18563
18541
|
callerSignal;
|
|
@@ -18636,8 +18614,7 @@ var ProviderExecutorState = class {
|
|
|
18636
18614
|
this.clearWorkspaceCapture();
|
|
18637
18615
|
}
|
|
18638
18616
|
};
|
|
18639
|
-
|
|
18640
|
-
//#region src/runtime/environment-provider/provider-materialization.ts
|
|
18617
|
+
// src/runtime/environment-provider/provider-materialization.ts
|
|
18641
18618
|
function providerMaterialization(provider, createProfile, node, executionId, retention, options, placement) {
|
|
18642
18619
|
const attemptId = node?.attemptId ?? newExecutionAttemptId(executionId);
|
|
18643
18620
|
const providerModel = concreteProfileModel(createProfile);
|
|
@@ -18687,8 +18664,7 @@ function providerMaterialization(provider, createProfile, node, executionId, ret
|
|
|
18687
18664
|
}
|
|
18688
18665
|
};
|
|
18689
18666
|
}
|
|
18690
|
-
|
|
18691
|
-
//#region src/runtime/environment-provider/provider-executor-lifecycle.ts
|
|
18667
|
+
// src/runtime/environment-provider/provider-executor-lifecycle.ts
|
|
18692
18668
|
function createProviderExecutor(provider, profile, ctx, options, placement) {
|
|
18693
18669
|
if (options.workspaceRetention !== void 0) assertProviderWorkspaceRetentionPort(options.workspaceRetention, `providerAsExecutor(${provider.name})`);
|
|
18694
18670
|
const node = ctx.node === void 0 ? void 0 : detachedSnapshot(ctx.node, "provider executor node");
|
|
@@ -18821,8 +18797,7 @@ function heldForContinuation(scope) {
|
|
|
18821
18797
|
* the refusal: a director told the details of a provider failure spent its children probing the
|
|
18822
18798
|
* infrastructure (discovery-lab AGENTS.md). */
|
|
18823
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.";
|
|
18824
|
-
|
|
18825
|
-
//#region src/runtime/environment-provider/provider-executor-admission.ts
|
|
18800
|
+
// src/runtime/environment-provider/provider-executor-admission.ts
|
|
18826
18801
|
/** Adapt an environment provider into an `ExecutorFactory` for `createExecutor`.
|
|
18827
18802
|
*
|
|
18828
18803
|
* `createExecutor({ backend: 'provider', provider })` is the composition most callers want; it
|
|
@@ -18855,8 +18830,7 @@ function placedProviderExecutor(provider, options, identity) {
|
|
|
18855
18830
|
if (options.placements !== void 0) throw new ValidationError("placedProviderExecutor: placements select within one provider");
|
|
18856
18831
|
return (spec, ctx) => createProviderExecutor(provider, spec.profile, ctx, options, identity);
|
|
18857
18832
|
}
|
|
18858
|
-
|
|
18859
|
-
//#region src/runtime/environment-provider/provider-registry.ts
|
|
18833
|
+
// src/runtime/environment-provider/provider-registry.ts
|
|
18860
18834
|
/** Create a registry that resolves provider names to concrete provider instances.
|
|
18861
18835
|
* @experimental */
|
|
18862
18836
|
function createAgentEnvironmentProviderRegistry(providers = []) {
|
|
@@ -18901,8 +18875,7 @@ function resolveAgentEnvironmentProvider(provider, registry) {
|
|
|
18901
18875
|
if (!registry) throw new ValidationError(`agent environment provider "${provider}" requires an AgentEnvironmentProviderRegistry`);
|
|
18902
18876
|
return registry.require(provider);
|
|
18903
18877
|
}
|
|
18904
|
-
|
|
18905
|
-
//#region src/runtime/supervise/cli-process-executor.ts
|
|
18878
|
+
// src/runtime/supervise/cli-process-executor.ts
|
|
18906
18879
|
/**
|
|
18907
18880
|
* Spawns a subprocess (`bin` + `args`). It cannot account tokens, so it is
|
|
18908
18881
|
* `budgetExempt: true`: it remains usable as a direct executor, while budgeted supervision
|
|
@@ -19067,8 +19040,7 @@ function killWithGrace(proc, grace) {
|
|
|
19067
19040
|
}, true);
|
|
19068
19041
|
});
|
|
19069
19042
|
}
|
|
19070
|
-
|
|
19071
|
-
//#region src/runtime/router-http-transport.ts
|
|
19043
|
+
// src/runtime/router-http-transport.ts
|
|
19072
19044
|
/** Router HTTP attempts, response evidence, retries, and request cancellation. */
|
|
19073
19045
|
function routerRequestHeaders(cfg, opts) {
|
|
19074
19046
|
const suppliedCallId = opts?.callId;
|
|
@@ -19262,8 +19234,7 @@ function withRouterRequestTimeout(callerSignal, timeoutMs) {
|
|
|
19262
19234
|
}
|
|
19263
19235
|
};
|
|
19264
19236
|
}
|
|
19265
|
-
|
|
19266
|
-
//#region src/runtime/router-request-body.ts
|
|
19237
|
+
// src/runtime/router-request-body.ts
|
|
19267
19238
|
/** Canonical provider request lowering for buffered and streamed completions. */
|
|
19268
19239
|
/** The OpenAI-shape request body both plain-chat transports send. One builder so the streamed
|
|
19269
19240
|
* completion cannot drift from the buffered one on model, ceilings, seed, or reasoning effort. */
|
|
@@ -19352,8 +19323,7 @@ function providerRequestExtras(extraBody, reservedFields) {
|
|
|
19352
19323
|
for (const field of reservedFields) delete extras[field];
|
|
19353
19324
|
return extras;
|
|
19354
19325
|
}
|
|
19355
|
-
|
|
19356
|
-
//#region src/runtime/router-response.ts
|
|
19326
|
+
// src/runtime/router-response.ts
|
|
19357
19327
|
/** Provider completion fields and measured resource accounting. */
|
|
19358
19328
|
function parseChatResult(json, model, transportAttempts) {
|
|
19359
19329
|
const data = json;
|
|
@@ -19489,8 +19459,7 @@ function bufferedCompletionFields(data, measured) {
|
|
|
19489
19459
|
...typeof data.choices?.[0]?.finish_reason === "string" ? { finishReason: data.choices[0].finish_reason } : {}
|
|
19490
19460
|
};
|
|
19491
19461
|
}
|
|
19492
|
-
|
|
19493
|
-
//#region src/runtime/router-sse-chunks.ts
|
|
19462
|
+
// src/runtime/router-sse-chunks.ts
|
|
19494
19463
|
/** SSE framing and response-body ownership for Router completion chunks. */
|
|
19495
19464
|
/**
|
|
19496
19465
|
* Decode an SSE body into chat-completion chunks. Frames are blank-line separated; `data:` lines
|
|
@@ -19579,8 +19548,7 @@ function parseChunkFrame(frame) {
|
|
|
19579
19548
|
return;
|
|
19580
19549
|
}
|
|
19581
19550
|
}
|
|
19582
|
-
|
|
19583
|
-
//#region src/runtime/router-streamed-completion.ts
|
|
19551
|
+
// src/runtime/router-streamed-completion.ts
|
|
19584
19552
|
/** Stateful assembly of one streamed Router completion. */
|
|
19585
19553
|
/**
|
|
19586
19554
|
* POST `body` with `stream: true` and fold the SSE chunks into one completion. Both streamed
|
|
@@ -19669,8 +19637,7 @@ function idAlreadyOpen(calls, id) {
|
|
|
19669
19637
|
for (const call of calls.values()) if (call.id === id) return true;
|
|
19670
19638
|
return false;
|
|
19671
19639
|
}
|
|
19672
|
-
|
|
19673
|
-
//#region src/runtime/router-client.ts
|
|
19640
|
+
// src/runtime/router-client.ts
|
|
19674
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). */
|
|
19675
19642
|
async function routerChatWithUsage(cfg, messages, opts) {
|
|
19676
19643
|
const url = `${cfg.routerBaseUrl.replace(/\/$/, "")}/chat/completions`;
|
|
@@ -19868,8 +19835,7 @@ function routerBrain(cfg, opts = {}) {
|
|
|
19868
19835
|
};
|
|
19869
19836
|
};
|
|
19870
19837
|
}
|
|
19871
|
-
|
|
19872
|
-
//#region src/runtime/supervise/executor-local-cancellation.ts
|
|
19838
|
+
// src/runtime/supervise/executor-local-cancellation.ts
|
|
19873
19839
|
/**
|
|
19874
19840
|
* The honest answer for a backend with no cancel operation: the local request stopped, and
|
|
19875
19841
|
* nothing about the remote run is known. Never `accepted` — a client that advertises provider
|
|
@@ -19883,8 +19849,7 @@ function localAbortCancellation(detail) {
|
|
|
19883
19849
|
detail
|
|
19884
19850
|
};
|
|
19885
19851
|
}
|
|
19886
|
-
|
|
19887
|
-
//#region src/runtime/supervise/router-executor-request.ts
|
|
19852
|
+
// src/runtime/supervise/router-executor-request.ts
|
|
19888
19853
|
async function runRouterTransport(context, call) {
|
|
19889
19854
|
try {
|
|
19890
19855
|
return await call();
|
|
@@ -19894,7 +19859,8 @@ async function runRouterTransport(context, call) {
|
|
|
19894
19859
|
}
|
|
19895
19860
|
function throwRouterTransportFailure(context, error) {
|
|
19896
19861
|
if (error instanceof ValidationError$1 || error && typeof error === "object" && "name" in error && error.name === "AbortError") throw error;
|
|
19897
|
-
|
|
19862
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19863
|
+
throw new ValidationError$1(`${context}: transport failed: ${message}`);
|
|
19898
19864
|
}
|
|
19899
19865
|
function assertObservedRouterModel(observed, expected, context) {
|
|
19900
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)}`);
|
|
@@ -19934,8 +19900,7 @@ function routerGenerationOptions(profileExecution) {
|
|
|
19934
19900
|
...profileExecution.extraBody ? { extraBody: profileExecution.extraBody } : {}
|
|
19935
19901
|
};
|
|
19936
19902
|
}
|
|
19937
|
-
|
|
19938
|
-
//#region src/runtime/supervise/router-profile-execution.ts
|
|
19903
|
+
// src/runtime/supervise/router-profile-execution.ts
|
|
19939
19904
|
/**
|
|
19940
19905
|
* Materialization contract for one direct Router turn.
|
|
19941
19906
|
*
|
|
@@ -19953,6 +19918,7 @@ const routerTurnProfileMaterialization = defineProfileMaterializationContract({
|
|
|
19953
19918
|
"version",
|
|
19954
19919
|
"tags",
|
|
19955
19920
|
"systemPrompt",
|
|
19921
|
+
"appendSystemPrompt",
|
|
19956
19922
|
"instructions",
|
|
19957
19923
|
"modelDefault",
|
|
19958
19924
|
"modelProvider",
|
|
@@ -20026,7 +19992,11 @@ function exactRouterModel(profile, context) {
|
|
|
20026
19992
|
* channel to carry that warning, so it refuses the value instead of silently running strict.
|
|
20027
19993
|
*/
|
|
20028
19994
|
function renderRouterProfilePrompt(profile) {
|
|
20029
|
-
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);
|
|
20030
20000
|
const resources = profile.resources;
|
|
20031
20001
|
if (!resources) return sections.join("\n");
|
|
20032
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");
|
|
@@ -20053,7 +20023,11 @@ function renderRouterResource(kind, resource) {
|
|
|
20053
20023
|
* The profile prompt is always the immutable first message. Later system-role messages are
|
|
20054
20024
|
* preserved as per-call task context; they cannot replace or precede the profile policy. */
|
|
20055
20025
|
function taskToMessages(task, spec, resolvedSystem) {
|
|
20056
|
-
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");
|
|
20057
20031
|
if (task && typeof task === "object" && Array.isArray(task.messages)) {
|
|
20058
20032
|
const supplied = task.messages.map((value, index) => {
|
|
20059
20033
|
if (!value || typeof value !== "object") throw new ValidationError$1(`routerInlineExecutor: messages[${index}] must be an object`);
|
|
@@ -20075,8 +20049,7 @@ function taskToMessages(task, spec, resolvedSystem) {
|
|
|
20075
20049
|
content: taskToPrompt$1(task)
|
|
20076
20050
|
}];
|
|
20077
20051
|
}
|
|
20078
|
-
|
|
20079
|
-
//#region src/runtime/supervise/router-transcript.ts
|
|
20052
|
+
// src/runtime/supervise/router-transcript.ts
|
|
20080
20053
|
/**
|
|
20081
20054
|
* The conversation of a router-brained agent, kept as it happens.
|
|
20082
20055
|
*
|
|
@@ -20106,7 +20079,7 @@ const ROUTER_TRANSCRIPT_HARNESS = "router";
|
|
|
20106
20079
|
* the message says so with its full length, so a reader never takes a cut message for the whole.
|
|
20107
20080
|
* The settled transcript keeps the full content, within the bounds of `harnessTranscriptFromLines`.
|
|
20108
20081
|
*/
|
|
20109
|
-
const TURN_CONTENT_BYTES =
|
|
20082
|
+
const TURN_CONTENT_BYTES = 262144;
|
|
20110
20083
|
function createRouterTranscript() {
|
|
20111
20084
|
let turnMessages = [];
|
|
20112
20085
|
let started = false;
|
|
@@ -20176,8 +20149,7 @@ function forTurnEvent(message) {
|
|
|
20176
20149
|
contentCut: true
|
|
20177
20150
|
};
|
|
20178
20151
|
}
|
|
20179
|
-
|
|
20180
|
-
//#region src/runtime/supervise/router-inline-executor.ts
|
|
20152
|
+
// src/runtime/supervise/router-inline-executor.ts
|
|
20181
20153
|
const routerInlineExecutor = (spec, ctx) => {
|
|
20182
20154
|
const seam = readSeam(ctx, routerSeamKey, "router/inline");
|
|
20183
20155
|
const model = exactRouterModel(spec.profile, "routerInlineExecutor");
|
|
@@ -20307,8 +20279,7 @@ const routerInlineExecutor = (spec, ctx) => {
|
|
|
20307
20279
|
});
|
|
20308
20280
|
return executor;
|
|
20309
20281
|
};
|
|
20310
|
-
|
|
20311
|
-
//#region src/runtime/code-mode.ts
|
|
20282
|
+
// src/runtime/code-mode.ts
|
|
20312
20283
|
function positiveInteger(value, fallback, name) {
|
|
20313
20284
|
const result = value ?? fallback;
|
|
20314
20285
|
if (!Number.isSafeInteger(result) || result < 1) throw new RangeError(`code mode: ${name} must be a positive safe integer`);
|
|
@@ -20341,7 +20312,7 @@ async function runCodeMode(code, options) {
|
|
|
20341
20312
|
if (!options.callId.trim()) throw new TypeError("code mode: callId is required");
|
|
20342
20313
|
const concurrency = positiveInteger(options.concurrency, 4, "concurrency");
|
|
20343
20314
|
const maxCalls = positiveInteger(options.maxCalls, 1024, "maxCalls");
|
|
20344
|
-
const memoryLimitBytes = positiveInteger(options.memoryLimitBytes,
|
|
20315
|
+
const memoryLimitBytes = positiveInteger(options.memoryLimitBytes, 67108864, "memoryLimitBytes");
|
|
20345
20316
|
const timeoutMs = options.timeoutMs === Infinity ? Infinity : positiveInteger(options.timeoutMs, 3e5, "timeoutMs");
|
|
20346
20317
|
if (timeoutMs !== Infinity && timeoutMs > 2147483647) throw new RangeError("code mode: timeoutMs must be at most 2147483647 or Infinity");
|
|
20347
20318
|
const { CodemodeSandbox, toCodemodeIdentifier } = await import("@earendil-works/pi-codemode");
|
|
@@ -20571,8 +20542,7 @@ function codeModeModelOutput(value) {
|
|
|
20571
20542
|
}] : [])
|
|
20572
20543
|
};
|
|
20573
20544
|
}
|
|
20574
|
-
|
|
20575
|
-
//#region src/runtime/supervise/router-tool-loop.ts
|
|
20545
|
+
// src/runtime/supervise/router-tool-loop.ts
|
|
20576
20546
|
function mergePromptCache(target, cache) {
|
|
20577
20547
|
if (!cache) return;
|
|
20578
20548
|
for (const key of [
|
|
@@ -20929,8 +20899,7 @@ function settleLoop(env, state, actions, started) {
|
|
|
20929
20899
|
spent
|
|
20930
20900
|
};
|
|
20931
20901
|
}
|
|
20932
|
-
|
|
20933
|
-
//#region src/runtime/supervise/router-tools-executor.ts
|
|
20902
|
+
// src/runtime/supervise/router-tools-executor.ts
|
|
20934
20903
|
/** Compose node behavior with host state and ceilings; neither grants new tools. */
|
|
20935
20904
|
function routerCodeModeSettings(profile, host) {
|
|
20936
20905
|
if (profile === false || profile === void 0 && host === void 0) return void 0;
|
|
@@ -21064,8 +21033,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
21064
21033
|
});
|
|
21065
21034
|
return executor;
|
|
21066
21035
|
};
|
|
21067
|
-
|
|
21068
|
-
//#region src/runtime/iteration-events.ts
|
|
21036
|
+
// src/runtime/iteration-events.ts
|
|
21069
21037
|
function emitRunLoopHook(options, event) {
|
|
21070
21038
|
notifyRuntimeHookEvent(options.ctx.hooks, {
|
|
21071
21039
|
id: `${event.runId}:${event.target}:${event.phase}${event.stepIndex === void 0 ? "" : `:${event.stepIndex}`}`,
|
|
@@ -21082,8 +21050,7 @@ async function emitTrace(emitter, event) {
|
|
|
21082
21050
|
if (!emitter) return;
|
|
21083
21051
|
await emitter.emit(event);
|
|
21084
21052
|
}
|
|
21085
|
-
|
|
21086
|
-
//#region src/runtime/iteration-result.ts
|
|
21053
|
+
// src/runtime/iteration-result.ts
|
|
21087
21054
|
function finalize(args) {
|
|
21088
21055
|
let selector;
|
|
21089
21056
|
let winner;
|
|
@@ -21283,8 +21250,7 @@ const TERMINAL_DECISIONS = [
|
|
|
21283
21250
|
function isTerminalDecision(decision) {
|
|
21284
21251
|
return TERMINAL_DECISIONS.includes(decision);
|
|
21285
21252
|
}
|
|
21286
|
-
|
|
21287
|
-
//#region src/runtime/sandbox-evidence-retention.ts
|
|
21253
|
+
// src/runtime/sandbox-evidence-retention.ts
|
|
21288
21254
|
/** A failed capture keeps the live source handle available for an explicit retry. */
|
|
21289
21255
|
var SandboxEvidenceRetentionError = class extends Error {
|
|
21290
21256
|
box;
|
|
@@ -21403,8 +21369,7 @@ var SandboxEvidenceTracker = class {
|
|
|
21403
21369
|
}
|
|
21404
21370
|
}
|
|
21405
21371
|
};
|
|
21406
|
-
|
|
21407
|
-
//#region src/runtime/sandbox-acquire.ts
|
|
21372
|
+
// src/runtime/sandbox-acquire.ts
|
|
21408
21373
|
/**
|
|
21409
21374
|
* HTTP statuses where create should be retried — gateway timeouts
|
|
21410
21375
|
* (502/503/504/522/524) where provisioning may continue server-side, plus
|
|
@@ -21462,7 +21427,7 @@ async function acquireSandbox(client, options, acquire = {}) {
|
|
|
21462
21427
|
acquire.onAcquire?.(found);
|
|
21463
21428
|
return await waitReadyOrDestroy(found, deadline, pollMs, acquire.signal, now, sleep$1, acquire.beforeDelete);
|
|
21464
21429
|
}
|
|
21465
|
-
if (scan <
|
|
21430
|
+
if (scan < 4) await sleep$1(pollMs);
|
|
21466
21431
|
}
|
|
21467
21432
|
attempt += 1;
|
|
21468
21433
|
await sleep$1(Math.min(pollMs * attempt, 15e3));
|
|
@@ -21508,8 +21473,7 @@ function isRetryable(err) {
|
|
|
21508
21473
|
if (/\b(timed out|timeout|gateway|temporarily unavailable|too many requests|ECONNRESET|ETIMEDOUT|EAI_AGAIN)\b/i.test(msg)) return true;
|
|
21509
21474
|
return /provision failed|edge data plane|not reachable|failed to create sandbox/i.test(msg);
|
|
21510
21475
|
}
|
|
21511
|
-
|
|
21512
|
-
//#region src/runtime/sandbox-backend.ts
|
|
21476
|
+
// src/runtime/sandbox-backend.ts
|
|
21513
21477
|
/**
|
|
21514
21478
|
* Harnesses the sandbox accepts as a `backend.type`. `gemini` is a
|
|
21515
21479
|
* `HarnessType` with no sandbox backend, so it is absent here and a profile
|
|
@@ -21582,8 +21546,7 @@ function buildBackendOptions(profile, overrides) {
|
|
|
21582
21546
|
}
|
|
21583
21547
|
};
|
|
21584
21548
|
}
|
|
21585
|
-
|
|
21586
|
-
//#region src/runtime/sandbox-lineage.ts
|
|
21549
|
+
// src/runtime/sandbox-lineage.ts
|
|
21587
21550
|
const TEARDOWN_TIMEOUT_MS$1 = 15e3;
|
|
21588
21551
|
const DEFAULT_FORK_CONCURRENCY = 4;
|
|
21589
21552
|
/**
|
|
@@ -21830,8 +21793,7 @@ async function destroyBounded(box, failOnError = false, beforeDelete) {
|
|
|
21830
21793
|
}
|
|
21831
21794
|
await withTimeout(deleteBoxSafe(box), TEARDOWN_TIMEOUT_MS$1);
|
|
21832
21795
|
}
|
|
21833
|
-
|
|
21834
|
-
//#region src/runtime/iteration-sandboxes.ts
|
|
21796
|
+
// src/runtime/iteration-sandboxes.ts
|
|
21835
21797
|
/**
|
|
21836
21798
|
* Build the lineage when either lineage flag is set. Probes the legacy fork
|
|
21837
21799
|
* capability once per run (live branching is detected on each box).
|
|
@@ -22059,8 +22021,7 @@ async function invokePrepareBox(spec, box, signal, recordMount) {
|
|
|
22059
22021
|
}
|
|
22060
22022
|
/** Shared no-op recorder for box-preparation paths that have no run manifest. */
|
|
22061
22023
|
const noopMountRecorder = () => {};
|
|
22062
|
-
|
|
22063
|
-
//#region src/runtime/iteration-execution.ts
|
|
22024
|
+
// src/runtime/iteration-execution.ts
|
|
22064
22025
|
async function runBatch(args) {
|
|
22065
22026
|
const queue = args.slice.map((task, offset) => ({
|
|
22066
22027
|
task,
|
|
@@ -22257,8 +22218,7 @@ async function executeIteration(args) {
|
|
|
22257
22218
|
}
|
|
22258
22219
|
if (slot.error instanceof ValidationError$1) throw slot.error;
|
|
22259
22220
|
}
|
|
22260
|
-
|
|
22261
|
-
//#region src/runtime/prompt-options.ts
|
|
22221
|
+
// src/runtime/prompt-options.ts
|
|
22262
22222
|
/** Keys the kernel owns on every prompt it sends; a caller value never carries them past here. */
|
|
22263
22223
|
const kernelOwnedPromptKeys = /* @__PURE__ */ new Set(["sessionId", "signal"]);
|
|
22264
22224
|
/**
|
|
@@ -22309,8 +22269,7 @@ function assertBoxlessPromptOptions(options, seam, keys = instrumentPromptKeys)
|
|
|
22309
22269
|
throw new ValidationError$1(`${seam}: promptOptions.${key} cannot apply without a box`);
|
|
22310
22270
|
}
|
|
22311
22271
|
}
|
|
22312
|
-
|
|
22313
|
-
//#region src/runtime/agent-rounds.ts
|
|
22272
|
+
// src/runtime/agent-rounds.ts
|
|
22314
22273
|
const DEFAULT_MAX_ITERATIONS = 10;
|
|
22315
22274
|
const DEFAULT_MAX_CONCURRENCY = 4;
|
|
22316
22275
|
/**
|
|
@@ -22379,8 +22338,10 @@ async function runAgentRounds(options) {
|
|
|
22379
22338
|
});
|
|
22380
22339
|
const controller = new AbortController();
|
|
22381
22340
|
const onOuterAbort = () => controller.abort();
|
|
22382
|
-
if (options.ctx.signal)
|
|
22383
|
-
|
|
22341
|
+
if (options.ctx.signal) {
|
|
22342
|
+
if (options.ctx.signal.aborted) controller.abort();
|
|
22343
|
+
else options.ctx.signal.addEventListener("abort", onOuterAbort, { once: true });
|
|
22344
|
+
}
|
|
22384
22345
|
try {
|
|
22385
22346
|
while (iterations.length < maxIterations) {
|
|
22386
22347
|
if (controller.signal.aborted) throwAbort();
|
|
@@ -22525,8 +22486,7 @@ function resolveAgentRuns(options) {
|
|
|
22525
22486
|
if (options.agentRuns && options.agentRuns.length > 0) return options.agentRuns;
|
|
22526
22487
|
throw new ValidationError$1("runAgentRounds: `agentRun` or non-empty `agentRuns` is required");
|
|
22527
22488
|
}
|
|
22528
|
-
|
|
22529
|
-
//#region src/runtime/supervise/sandbox-session-run.ts
|
|
22489
|
+
// src/runtime/supervise/sandbox-session-run.ts
|
|
22530
22490
|
function newSandboxSessionRun(args) {
|
|
22531
22491
|
const now = args.now ?? Date.now;
|
|
22532
22492
|
return {
|
|
@@ -22712,8 +22672,7 @@ function readFinalText(event) {
|
|
|
22712
22672
|
const alt = data.text;
|
|
22713
22673
|
return typeof alt === "string" ? alt : void 0;
|
|
22714
22674
|
}
|
|
22715
|
-
|
|
22716
|
-
//#region src/runtime/supervise/sandbox-session.ts
|
|
22675
|
+
// src/runtime/supervise/sandbox-session.ts
|
|
22717
22676
|
/** Ceiling on continuation turns (turn 0 is the task, each later turn a folded steer). */
|
|
22718
22677
|
const DEFAULT_SANDBOX_STEERING_MAX_TURNS = 24;
|
|
22719
22678
|
/** One steerable sandbox worker. The returned session is inert until `stream()` is drained. */
|
|
@@ -22959,8 +22918,7 @@ function publishSessionArtifact(run, started) {
|
|
|
22959
22918
|
function isInterruptAbort(err, interrupt, external, owned) {
|
|
22960
22919
|
return (err instanceof DOMException && err.name === "AbortError" || typeof err === "object" && err !== null && err.name === "AbortError") && interrupt.aborted && !external.aborted && !owned.aborted;
|
|
22961
22920
|
}
|
|
22962
|
-
|
|
22963
|
-
//#region src/runtime/supervise/sandbox-leaf-executor.ts
|
|
22921
|
+
// src/runtime/supervise/sandbox-leaf-executor.ts
|
|
22964
22922
|
/**
|
|
22965
22923
|
* COMPOSES `runAgentRounds` as a single-task leaf: one box, a refine driver bounded to
|
|
22966
22924
|
* the seam's `maxIterations` (default 1), the spec's profile as the agent run.
|
|
@@ -23281,8 +23239,7 @@ function singleShotDriver(maxIterations) {
|
|
|
23281
23239
|
}
|
|
23282
23240
|
};
|
|
23283
23241
|
}
|
|
23284
|
-
|
|
23285
|
-
//#region src/runtime/supervise/executor-config.ts
|
|
23242
|
+
// src/runtime/supervise/executor-config.ts
|
|
23286
23243
|
/** Capture one public executor configuration at its call boundary. All data that selects policy,
|
|
23287
23244
|
* model, process, limits, or backend behavior is detached and deeply frozen.
|
|
23288
23245
|
* Explicit service/function fields remain live by reference because they are executable ports,
|
|
@@ -23408,6 +23365,7 @@ function snapshotExecutorConfig(config) {
|
|
|
23408
23365
|
"maxReconnects",
|
|
23409
23366
|
"modelCredential",
|
|
23410
23367
|
"modelSilenceMs",
|
|
23368
|
+
"outputFormat",
|
|
23411
23369
|
"sessionId",
|
|
23412
23370
|
"timeoutMs"
|
|
23413
23371
|
]), "createExecutor bridge config");
|
|
@@ -23607,8 +23565,7 @@ function requiredProviderProfileHarness(spec, seam) {
|
|
|
23607
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}"`);
|
|
23608
23566
|
return harness;
|
|
23609
23567
|
}
|
|
23610
|
-
|
|
23611
|
-
//#region src/runtime/supervise/executor-registry.ts
|
|
23568
|
+
// src/runtime/supervise/executor-registry.ts
|
|
23612
23569
|
/**
|
|
23613
23570
|
* The open resolver/registry. Pre-registers the three built-ins under their
|
|
23614
23571
|
* runtime tags (`'router'`, `'sandbox'`, `'cli'`) and accepts `register(name,
|
|
@@ -23668,8 +23625,7 @@ function createExecutorRegistry() {
|
|
|
23668
23625
|
}
|
|
23669
23626
|
};
|
|
23670
23627
|
}
|
|
23671
|
-
|
|
23672
|
-
//#region src/durable/spawn-journal/event-index.ts
|
|
23628
|
+
// src/durable/spawn-journal/event-index.ts
|
|
23673
23629
|
/**
|
|
23674
23630
|
* A trace root is valid only beside the output it commits to, with a well-formed root, artifact
|
|
23675
23631
|
* reference and leaf count (at least the summary leaf). Records written before trace roots carry
|
|
@@ -23876,8 +23832,7 @@ function outsideCursorNamespace(ev) {
|
|
|
23876
23832
|
function insideCursorNamespace(ev) {
|
|
23877
23833
|
return !outsideKinds.has(ev.kind);
|
|
23878
23834
|
}
|
|
23879
|
-
|
|
23880
|
-
//#region src/durable/jsonl-append.ts
|
|
23835
|
+
// src/durable/jsonl-append.ts
|
|
23881
23836
|
/** Commit JSONL bytes and validate their descriptor under one generation fence. @internal */
|
|
23882
23837
|
function commitJsonLine(path, record, acknowledge) {
|
|
23883
23838
|
const encoded = JSON.stringify(record);
|
|
@@ -23951,8 +23906,7 @@ function readAt(fd, buffer, position) {
|
|
|
23951
23906
|
offset += read;
|
|
23952
23907
|
}
|
|
23953
23908
|
}
|
|
23954
|
-
|
|
23955
|
-
//#region src/durable/jsonl-file.ts
|
|
23909
|
+
// src/durable/jsonl-file.ts
|
|
23956
23910
|
/** Read a fixed file prefix one record at a time, never allocating the whole journal as a string.
|
|
23957
23911
|
* A reader cannot chase concurrent appends forever. Missing files are empty only when requested;
|
|
23958
23912
|
* corruption, short reads, and other I/O errors remain failures. Closing the iterator closes the fd. */
|
|
@@ -24071,7 +24025,7 @@ async function upsertCommittedJsonLine(path, record, key) {
|
|
|
24071
24025
|
allowWhitespaceLines: true
|
|
24072
24026
|
})) if (key(prior) !== id) updated.push(prior);
|
|
24073
24027
|
updated.push(snapshot);
|
|
24074
|
-
const { writeAtomicDurableFile } = await import("./record-events-
|
|
24028
|
+
const { writeAtomicDurableFile } = await import("./record-events-B2GUgYdz.js").then((n) => n.i);
|
|
24075
24029
|
writeAtomicDurableFile(path, `${updated.map((row) => JSON.stringify(row)).join("\n")}\n`, { preserveMode: true });
|
|
24076
24030
|
}
|
|
24077
24031
|
/** Recover a torn tail under the same generation fence as durable publications. @internal */
|
|
@@ -24083,8 +24037,7 @@ async function prepareJsonlAppend(path) {
|
|
|
24083
24037
|
function isNoEntError(error) {
|
|
24084
24038
|
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
24085
24039
|
}
|
|
24086
|
-
|
|
24087
|
-
//#region src/durable/spawn-journal/result-blob-store.ts
|
|
24040
|
+
// src/durable/spawn-journal/result-blob-store.ts
|
|
24088
24041
|
/**
|
|
24089
24042
|
* FS `ResultBlobStore`. One JSON file per artifact under `dir`, named by a
|
|
24090
24043
|
* filesystem-safe encoding of the `outRef` (`sha256:<hex>` → `sha256-<hex>.json`).
|
|
@@ -24153,8 +24106,7 @@ function assertContentAddress(outRef, artifact) {
|
|
|
24153
24106
|
const expected = contentAddress(artifact);
|
|
24154
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)`);
|
|
24155
24108
|
}
|
|
24156
|
-
|
|
24157
|
-
//#region src/durable/in-memory-spawn-stores.ts
|
|
24109
|
+
// src/durable/in-memory-spawn-stores.ts
|
|
24158
24110
|
/** In-process decision and payload retention; no acknowledged state survives process exit. */
|
|
24159
24111
|
/**
|
|
24160
24112
|
* In-memory `ResultBlobStore`. Content-addressed: `put` verifies the supplied
|
|
@@ -24210,8 +24162,7 @@ var InMemorySpawnJournal = class {
|
|
|
24210
24162
|
tree.index.add(event);
|
|
24211
24163
|
}
|
|
24212
24164
|
};
|
|
24213
|
-
|
|
24214
|
-
//#region src/runtime/supervise/tree-key.ts
|
|
24165
|
+
// src/runtime/supervise/tree-key.ts
|
|
24215
24166
|
/** Runtime tag used only for a child that owns another supervised scope. */
|
|
24216
24167
|
const driverRuntime = "driver";
|
|
24217
24168
|
const nestedDriverTreeOwners = /* @__PURE__ */ new WeakSet();
|
|
@@ -24228,8 +24179,7 @@ function attestNestedDriverTreeOwner(owner) {
|
|
|
24228
24179
|
function runtimeOwnedNestedDriverTreeRoot(owner, parentTreeRoot, driverNodeId) {
|
|
24229
24180
|
return nestedDriverTreeOwners.has(owner) ? nestedDriverTreeRoot(parentTreeRoot, driverNodeId) : void 0;
|
|
24230
24181
|
}
|
|
24231
|
-
|
|
24232
|
-
//#region src/durable/spawn-journal/settlement-evidence.ts
|
|
24182
|
+
// src/durable/spawn-journal/settlement-evidence.ts
|
|
24233
24183
|
/** Copy a terminal record's overspend at the journal boundary; absent stays absent. */
|
|
24234
24184
|
function budgetViolationOf(event) {
|
|
24235
24185
|
if (event.budgetViolation === void 0) return {};
|
|
@@ -24261,8 +24211,7 @@ function traceEvidenceFor(event) {
|
|
|
24261
24211
|
reason: "legacy-settlement-without-trace-evidence"
|
|
24262
24212
|
};
|
|
24263
24213
|
}
|
|
24264
|
-
|
|
24265
|
-
//#region src/durable/spawn-journal/tree-view.ts
|
|
24214
|
+
// src/durable/spawn-journal/tree-view.ts
|
|
24266
24215
|
/**
|
|
24267
24216
|
* Materialize a recorded `TreeView` from a journaled event list for inspection. Folds
|
|
24268
24217
|
* `spawned`/`settled`/`cancelled` into a per-node snapshot in `seq` order, then adds each
|
|
@@ -24291,28 +24240,22 @@ function materializeTreeView(events) {
|
|
|
24291
24240
|
spent: zeroSpend()
|
|
24292
24241
|
});
|
|
24293
24242
|
}
|
|
24294
|
-
for (const ev of settlements)
|
|
24243
|
+
for (const ev of settlements) {
|
|
24295
24244
|
const node = requireNode(nodes, ev.id);
|
|
24296
|
-
|
|
24297
|
-
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);
|
|
24298
24248
|
node.providerModel = copyProviderModelEvidence(ev.providerModel);
|
|
24299
24249
|
node.outRef = ev.outRef;
|
|
24300
|
-
node.
|
|
24301
|
-
|
|
24302
|
-
|
|
24303
|
-
|
|
24304
|
-
|
|
24305
|
-
|
|
24306
|
-
} else {
|
|
24307
|
-
const node = requireNode(nodes, ev.id);
|
|
24308
|
-
node.status = "cancelled";
|
|
24309
|
-
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 ?? {
|
|
24310
24256
|
status: "unavailable",
|
|
24311
24257
|
reason: "execution-did-not-start"
|
|
24312
|
-
};
|
|
24313
|
-
if (ev.spent !== void 0) node.spent = cloneSpend(ev.spent);
|
|
24314
|
-
node.providerModel = copyProviderModelEvidence(ev.providerModel);
|
|
24315
|
-
node.outRef = ev.outRef;
|
|
24258
|
+
} : traceEvidenceFor(ev);
|
|
24316
24259
|
node.budgetViolation = budgetViolationOf(ev).budgetViolation;
|
|
24317
24260
|
if (ev.retainedExecution !== void 0) node.retainedExecution = ev.retainedExecution;
|
|
24318
24261
|
if (ev.retainedPendingCause !== void 0) node.retainedPendingCause = ev.retainedPendingCause;
|
|
@@ -24333,7 +24276,10 @@ function materializeTreeView(events) {
|
|
|
24333
24276
|
}
|
|
24334
24277
|
for (const ev of [...events].filter((event) => event.kind === "reconciled").sort((a, b) => a.seq - b.seq)) {
|
|
24335
24278
|
const node = requireNode(nodes, ev.id);
|
|
24336
|
-
if (node.status === "pending")
|
|
24279
|
+
if (node.status === "pending") {
|
|
24280
|
+
node.spent = cloneSpend(ev.spent);
|
|
24281
|
+
node.failure = ev.failure;
|
|
24282
|
+
}
|
|
24337
24283
|
}
|
|
24338
24284
|
for (const ev of events) {
|
|
24339
24285
|
if (ev.kind !== "metered") continue;
|
|
@@ -24358,6 +24304,7 @@ function freezeSnapshot(node) {
|
|
|
24358
24304
|
parent: node.parent,
|
|
24359
24305
|
label: node.label,
|
|
24360
24306
|
status: node.status,
|
|
24307
|
+
...node.failure === void 0 ? {} : { failure: node.failure },
|
|
24361
24308
|
runtime: node.runtime,
|
|
24362
24309
|
budget: node.budget,
|
|
24363
24310
|
ownedTreeRoot: node.ownedTreeRoot,
|
|
@@ -24377,8 +24324,7 @@ function freezeSnapshot(node) {
|
|
|
24377
24324
|
spawnedAt: node.spawnedAt
|
|
24378
24325
|
};
|
|
24379
24326
|
}
|
|
24380
|
-
|
|
24381
|
-
//#region src/durable/spawn-journal/spawn-forest.ts
|
|
24327
|
+
// src/durable/spawn-journal/spawn-forest.ts
|
|
24382
24328
|
/**
|
|
24383
24329
|
* Load every journal tree owned by one recursive supervision run and flatten its nodes/events.
|
|
24384
24330
|
*
|
|
@@ -24479,8 +24425,7 @@ function ownedTreeRootSpawn(spawn) {
|
|
|
24479
24425
|
const { parent: _parent, ownedTreeRoot: _ownedTreeRoot, ...root } = spawn;
|
|
24480
24426
|
return root;
|
|
24481
24427
|
}
|
|
24482
|
-
|
|
24483
|
-
//#region src/runtime/supervise/retained-owner-checkpoint-requests.ts
|
|
24428
|
+
// src/runtime/supervise/retained-owner-checkpoint-requests.ts
|
|
24484
24429
|
/** Reconstruct authority for this source only; a replacement cannot own its snapshots. */
|
|
24485
24430
|
async function checkpointHandle(state, sourceEnvironmentId, signal) {
|
|
24486
24431
|
const cached = state.checkpointHandles?.get(sourceEnvironmentId);
|
|
@@ -24572,8 +24517,7 @@ function pendingCheckpoints(events, state) {
|
|
|
24572
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])] : []));
|
|
24573
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])));
|
|
24574
24519
|
}
|
|
24575
|
-
|
|
24576
|
-
//#region src/runtime/supervise/retained-owner-checkpoint-capture.ts
|
|
24520
|
+
// src/runtime/supervise/retained-owner-checkpoint-capture.ts
|
|
24577
24521
|
/**
|
|
24578
24522
|
* Delete checkpoints, each only after its files are captured into the run's content-addressed
|
|
24579
24523
|
* store; a checkpoint no capture holds is kept, and the cleanup record says why. Only the
|
|
@@ -24840,8 +24784,7 @@ async function settleCaptureForks(state) {
|
|
|
24840
24784
|
}
|
|
24841
24785
|
return unresolved;
|
|
24842
24786
|
}
|
|
24843
|
-
|
|
24844
|
-
//#region src/runtime/supervise/retained-owner-state.ts
|
|
24787
|
+
// src/runtime/supervise/retained-owner-state.ts
|
|
24845
24788
|
const owners = /* @__PURE__ */ new WeakMap();
|
|
24846
24789
|
/** @internal Scope construction carries this private policy to every nested owner scope. */
|
|
24847
24790
|
const retainedOwnerWorkspaceRetentionSeamKey = "runtime.retainedOwnerWorkspaceRetention";
|
|
@@ -24880,8 +24823,7 @@ function bindScopeRetainedOwnerEnvironmentId(scope, liveEnvironmentId) {
|
|
|
24880
24823
|
const state = owners.get(scope);
|
|
24881
24824
|
if (state) state.liveEnvironmentId = liveEnvironmentId;
|
|
24882
24825
|
}
|
|
24883
|
-
|
|
24884
|
-
//#region src/runtime/supervise/retained-owner-checkpoint-rotation.ts
|
|
24826
|
+
// src/runtime/supervise/retained-owner-checkpoint-rotation.ts
|
|
24885
24827
|
/**
|
|
24886
24828
|
* Note that the owner's manager made a coordination call, and checkpoint its workspace when the
|
|
24887
24829
|
* last checkpoint is older than {@link WORKSPACE_CHECKPOINT_MIN_INTERVAL_MS}.
|
|
@@ -24995,8 +24937,7 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
24995
24937
|
* on the same evidence store, and the final capture spent 26.6 of its 32.6 minutes storing its
|
|
24996
24938
|
* archive until the root's budget deadline aborted the rotation.
|
|
24997
24939
|
*/
|
|
24998
|
-
|
|
24999
|
-
//#region src/runtime/supervise/retained-owner-evidence.ts
|
|
24940
|
+
// src/runtime/supervise/retained-owner-evidence.ts
|
|
25000
24941
|
/**
|
|
25001
24942
|
* The workspace evidence of a retained owner's turns: which attempts hold a verified capture
|
|
25002
24943
|
* receipt, recapture before a source is reused, and evidence debt. An accepted turn whose capture
|
|
@@ -25181,7 +25122,7 @@ async function owePendingEvidence(state, events, attempt, environmentId, failure
|
|
|
25181
25122
|
/** How capture retries of owed evidence back off, measured on the run's clock. */
|
|
25182
25123
|
const EVIDENCE_RETRY_BACKOFF_MS = {
|
|
25183
25124
|
initial: 3e4,
|
|
25184
|
-
max:
|
|
25125
|
+
max: 3e5
|
|
25185
25126
|
};
|
|
25186
25127
|
/** How often the retry loop reads the run's clock. Reading it costs no provider call. */
|
|
25187
25128
|
const EVIDENCE_RETRY_TICK_MS = 1e3;
|
|
@@ -25397,8 +25338,7 @@ async function abandonInputAdmittedIntoDebt(state, indebted) {
|
|
|
25397
25338
|
delete state.taskRef;
|
|
25398
25339
|
state.admissions.length = 0;
|
|
25399
25340
|
}
|
|
25400
|
-
|
|
25401
|
-
//#region src/runtime/supervise/retained-owner-environment-recovery.ts
|
|
25341
|
+
// src/runtime/supervise/retained-owner-environment-recovery.ts
|
|
25402
25342
|
/**
|
|
25403
25343
|
* The checkpoint a new environment of this owner starts from: the latest one journaled before
|
|
25404
25344
|
* the invocation's input, taken from an environment the provider has since lost. Only such an
|
|
@@ -25526,8 +25466,7 @@ async function reconcileScopeRetainedOwnerEnvironment(scope) {
|
|
|
25526
25466
|
environmentId
|
|
25527
25467
|
};
|
|
25528
25468
|
}
|
|
25529
|
-
|
|
25530
|
-
//#region src/runtime/supervise/retained-owner-turn-lifecycle.ts
|
|
25469
|
+
// src/runtime/supervise/retained-owner-turn-lifecycle.ts
|
|
25531
25470
|
/** Cut short the captures a checkpoint rotation is running; each keeps its checkpoint. */
|
|
25532
25471
|
function preemptRotationCaptures(state) {
|
|
25533
25472
|
state.rotationCaptures?.abort(/* @__PURE__ */ new Error("the turn's end-of-turn capture goes first; checkpoint kept"));
|
|
@@ -25604,8 +25543,7 @@ async function scopeRetainedOwnerSettled(scope) {
|
|
|
25604
25543
|
await state.releasing?.catch(() => void 0);
|
|
25605
25544
|
await stopOwnerEvidenceRetry(state);
|
|
25606
25545
|
}
|
|
25607
|
-
|
|
25608
|
-
//#region src/runtime/supervise/retained-owner-invocation.ts
|
|
25546
|
+
// src/runtime/supervise/retained-owner-invocation.ts
|
|
25609
25547
|
/** The scope owns these writers; provider adapters receive only the restricted context. */
|
|
25610
25548
|
function registerScopeRetainedOwner(scope, args) {
|
|
25611
25549
|
const events = args.priorEvents.filter((event) => "id" in event && event.id === args.nodeId);
|
|
@@ -25917,8 +25855,7 @@ function consumeScopeRetainedOwnerResult(scope) {
|
|
|
25917
25855
|
if (!state?.acceptedRef) throw new ValidationError$1("retained owner has no accepted result");
|
|
25918
25856
|
state.acceptedConsumed = true;
|
|
25919
25857
|
}
|
|
25920
|
-
|
|
25921
|
-
//#region src/runtime/supervise/retained-owner-release.ts
|
|
25858
|
+
// src/runtime/supervise/retained-owner-release.ts
|
|
25922
25859
|
/** @internal Whether another owner release could still destroy what the last one left. */
|
|
25923
25860
|
function retainedOwnerReleaseRetriable(scope) {
|
|
25924
25861
|
return owners.get(scope)?.releaseRetriable ?? false;
|
|
@@ -25932,7 +25869,7 @@ function retainedOwnerReleaseRetriable(scope) {
|
|
|
25932
25869
|
* settled 98 minutes after its deadline. The release captures that finished there took 67 seconds
|
|
25933
25870
|
* and 7 and 34 minutes, beside live captures of abandoned directors on the same slots.
|
|
25934
25871
|
*/
|
|
25935
|
-
const RELEASE_CHECKPOINT_CAPTURES_MS =
|
|
25872
|
+
const RELEASE_CHECKPOINT_CAPTURES_MS = 9e5;
|
|
25936
25873
|
/**
|
|
25937
25874
|
* Release the owner's environment once no turn of it will run again: at the run's final
|
|
25938
25875
|
* settlement for the root, and when a nested manager's own scope has finished. A second call while
|
|
@@ -26118,8 +26055,7 @@ function unsettledOwnerRuns(events, nodeId, environmentId) {
|
|
|
26118
26055
|
close();
|
|
26119
26056
|
return [...runs.values()];
|
|
26120
26057
|
}
|
|
26121
|
-
|
|
26122
|
-
//#region src/mcp/tools/spawn-resource-paths.ts
|
|
26058
|
+
// src/mcp/tools/spawn-resource-paths.ts
|
|
26123
26059
|
/**
|
|
26124
26060
|
* Inline resources a manager hands a child by PATH instead of by content.
|
|
26125
26061
|
*
|
|
@@ -26162,7 +26098,7 @@ function unsettledOwnerRuns(events, nodeId, environmentId) {
|
|
|
26162
26098
|
* - bytes that are not valid UTF-8 → refused; `content` is a string, so binary data is encoded
|
|
26163
26099
|
* (base64) by the manager first, exactly as it would be for a content resource
|
|
26164
26100
|
*/
|
|
26165
|
-
const SPAWN_RESOURCE_PATH_MAX_BYTES =
|
|
26101
|
+
const SPAWN_RESOURCE_PATH_MAX_BYTES = 4194304;
|
|
26166
26102
|
/** The host-directory reader: a manager whose workspace is a directory this process can open. */
|
|
26167
26103
|
function hostDirectoryReader(root) {
|
|
26168
26104
|
return {
|
|
@@ -26423,8 +26359,7 @@ async function resolveSpawnResourcePaths(profile, source) {
|
|
|
26423
26359
|
resolved
|
|
26424
26360
|
};
|
|
26425
26361
|
}
|
|
26426
|
-
|
|
26427
|
-
//#region src/runtime/supervise/retained-owner-resource-reader.ts
|
|
26362
|
+
// src/runtime/supervise/retained-owner-resource-reader.ts
|
|
26428
26363
|
/**
|
|
26429
26364
|
* The owner's environment as a source of by-path spawn resources.
|
|
26430
26365
|
*
|
|
@@ -26491,8 +26426,7 @@ function scopeRetainedOwnerResourceReader(scope) {
|
|
|
26491
26426
|
}
|
|
26492
26427
|
};
|
|
26493
26428
|
}
|
|
26494
|
-
|
|
26495
|
-
//#region src/runtime/supervise/retained-owner-seat-switch.ts
|
|
26429
|
+
// src/runtime/supervise/retained-owner-seat-switch.ts
|
|
26496
26430
|
/** A committed turn is the seat boundary. Keep its native home for a same-harness provider
|
|
26497
26431
|
* continuation; only a provider/harness change needs a new environment. */
|
|
26498
26432
|
async function prepareScopeRetainedOwnerSeatSwitch(scope, mode) {
|
|
@@ -26547,8 +26481,7 @@ async function retireSeatEnvironment(scope, state) {
|
|
|
26547
26481
|
at: new Date(args.now()).toISOString()
|
|
26548
26482
|
});
|
|
26549
26483
|
}
|
|
26550
|
-
|
|
26551
|
-
//#region src/runtime/supervise/scope-capabilities.ts
|
|
26484
|
+
// src/runtime/supervise/scope-capabilities.ts
|
|
26552
26485
|
/** Runtime-owned provider evidence is written through this private scope capability. */
|
|
26553
26486
|
const runtimeOwnedProviderMeters = /* @__PURE__ */ new WeakMap();
|
|
26554
26487
|
const pauseRecorders = /* @__PURE__ */ new WeakMap();
|
|
@@ -26818,8 +26751,7 @@ function meterRuntimeOwnedAccounting(scope, spend, detail, options) {
|
|
|
26818
26751
|
if (meter === void 0) throw new ValidationError$1("scope: Runtime-owned provider meter is not bound to this scope");
|
|
26819
26752
|
return meter(spend, void 0, detail, true, options?.alreadySpent === true);
|
|
26820
26753
|
}
|
|
26821
|
-
|
|
26822
|
-
//#region src/runtime/supervise/dispatch.ts
|
|
26754
|
+
// src/runtime/supervise/dispatch.ts
|
|
26823
26755
|
/**
|
|
26824
26756
|
*
|
|
26825
26757
|
* `rollingDispatch` — the REFILLING dispatch policy over a `Scope`. It keeps `width` children in
|
|
@@ -26949,8 +26881,7 @@ function queueOf(units, budget) {
|
|
|
26949
26881
|
};
|
|
26950
26882
|
};
|
|
26951
26883
|
}
|
|
26952
|
-
|
|
26953
|
-
//#region src/runtime/supervise/scope-identity.ts
|
|
26884
|
+
// src/runtime/supervise/scope-identity.ts
|
|
26954
26885
|
/** Fail before execution when a reservation policy is malformed. */
|
|
26955
26886
|
function assertRecursiveReservationPolicy(policy) {
|
|
26956
26887
|
if (policy === void 0) return;
|
|
@@ -26998,8 +26929,7 @@ function isAgentSpec(value) {
|
|
|
26998
26929
|
const v = value;
|
|
26999
26930
|
return "profile" in v && "harness" in v;
|
|
27000
26931
|
}
|
|
27001
|
-
|
|
27002
|
-
//#region src/runtime/supervise/scope-observation.ts
|
|
26932
|
+
// src/runtime/supervise/scope-observation.ts
|
|
27003
26933
|
/**
|
|
27004
26934
|
* The direct workers of `parentId` that a resumed journal holds open, and which of them this
|
|
27005
26935
|
* process re-places through a retained recovery. One function, so the root's `root-reentered`
|
|
@@ -27149,6 +27079,7 @@ function makeTreeView(root, children) {
|
|
|
27149
27079
|
parent: root,
|
|
27150
27080
|
label: c.label,
|
|
27151
27081
|
status: c.status,
|
|
27082
|
+
...c.failure === void 0 ? {} : { failure: c.failure },
|
|
27152
27083
|
runtime: c.runtime,
|
|
27153
27084
|
budget: c.budget,
|
|
27154
27085
|
...c.ownedTreeRoot === void 0 ? {} : { ownedTreeRoot: c.ownedTreeRoot },
|
|
@@ -27229,8 +27160,7 @@ async function readInteractiveReadyUntilWorkerEnds(readReady, workerEnded, signa
|
|
|
27229
27160
|
signal.removeEventListener("abort", onAbort);
|
|
27230
27161
|
}
|
|
27231
27162
|
}
|
|
27232
|
-
|
|
27233
|
-
//#region src/runtime/supervise/provider-visible-profile.ts
|
|
27163
|
+
// src/runtime/supervise/provider-visible-profile.ts
|
|
27234
27164
|
/** Runtime-owned coordination is mounted under this MCP alias. */
|
|
27235
27165
|
const coordinationMcpAlias = "agent-runtime-coordination";
|
|
27236
27166
|
/** A profile declares Runtime-owned tools with this provider-neutral prefix. */
|
|
@@ -27263,8 +27193,7 @@ function withoutRuntimeGraph(profile) {
|
|
|
27263
27193
|
const { metadata: _metadata, ...withoutMetadata } = profile;
|
|
27264
27194
|
return withoutMetadata;
|
|
27265
27195
|
}
|
|
27266
|
-
|
|
27267
|
-
//#region src/runtime/supervise/scope-owner-materialization.ts
|
|
27196
|
+
// src/runtime/supervise/scope-owner-materialization.ts
|
|
27268
27197
|
/**
|
|
27269
27198
|
* @internal Record the execution a pending executor started for the current attempt. A bridge
|
|
27270
27199
|
* manager whose turn ends before the bridge acknowledges it then still names its session:
|
|
@@ -27591,8 +27520,7 @@ function bindScopeOwnerMaterialization(scope, args, now) {
|
|
|
27591
27520
|
});
|
|
27592
27521
|
}
|
|
27593
27522
|
}
|
|
27594
|
-
|
|
27595
|
-
//#region src/runtime/supervise/scope-owner-meter.ts
|
|
27523
|
+
// src/runtime/supervise/scope-owner-meter.ts
|
|
27596
27524
|
/** The scope owner's own inference: debited from the shared pool, journaled, and announced. */
|
|
27597
27525
|
var ScopeOwnerMeter = class {
|
|
27598
27526
|
args;
|
|
@@ -27647,8 +27575,7 @@ var ScopeOwnerMeter = class {
|
|
|
27647
27575
|
if (observeError !== void 0) throw observeError;
|
|
27648
27576
|
}
|
|
27649
27577
|
};
|
|
27650
|
-
|
|
27651
|
-
//#region src/runtime/supervise/terminal-record.ts
|
|
27578
|
+
// src/runtime/supervise/terminal-record.ts
|
|
27652
27579
|
/** The settlement fields every writer copies, in the terminal record's key order. The
|
|
27653
27580
|
* `reconciled` record is built from this same spread so it and the terminal record can never
|
|
27654
27581
|
* disagree on a field. */
|
|
@@ -27657,6 +27584,7 @@ function settlementFields(subject, settlement) {
|
|
|
27657
27584
|
spent: subject.spent,
|
|
27658
27585
|
...settlement.infra === void 0 ? {} : { infra: settlement.infra },
|
|
27659
27586
|
reason: settlement.reason,
|
|
27587
|
+
...settlement.failure === void 0 ? {} : { failure: settlement.failure },
|
|
27660
27588
|
...settlement.retainedPendingCause === void 0 ? {} : { retainedPendingCause: settlement.retainedPendingCause },
|
|
27661
27589
|
...settlement.outRef ? { outRef: settlement.outRef } : {},
|
|
27662
27590
|
...settlement.outRef && settlement.traceRoot ? { traceRoot: settlement.traceRoot } : {},
|
|
@@ -27696,6 +27624,7 @@ function terminalDownEvent(subject, settlement, seq, at, retainedExecution) {
|
|
|
27696
27624
|
*/
|
|
27697
27625
|
function settledNodeEvidence(subject, settlement, settledAt) {
|
|
27698
27626
|
return {
|
|
27627
|
+
...settlement.kind === "down" && settlement.failure !== void 0 ? { failure: detachedSnapshot(settlement.failure, "worker failure") } : {},
|
|
27699
27628
|
runtime: subject.runtime,
|
|
27700
27629
|
startedAt: subject.startedAt,
|
|
27701
27630
|
settledAt,
|
|
@@ -27728,8 +27657,7 @@ function releasedChildPayload(subject, settlement, settledAt, releasedAt, retain
|
|
|
27728
27657
|
}, settledAt)
|
|
27729
27658
|
};
|
|
27730
27659
|
}
|
|
27731
|
-
|
|
27732
|
-
//#region src/runtime/supervise/scope-settlement.ts
|
|
27660
|
+
// src/runtime/supervise/scope-settlement.ts
|
|
27733
27661
|
/** Await whichever pending child settles first, returning the child (its `resolved` is set
|
|
27734
27662
|
* by the time this resolves because `runChild`'s `.then` sets it before the promise
|
|
27735
27663
|
* resolves downstream). */
|
|
@@ -27803,6 +27731,8 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
27803
27731
|
const at = new Date(settledAt).toISOString();
|
|
27804
27732
|
if (settlement.metered) await appendSettlementMetering(args.journal, args.root, child.id, settlement.metered, at);
|
|
27805
27733
|
if (settlement.kind === "down") {
|
|
27734
|
+
settlement.failure ??= settlementFailureCause(settlement);
|
|
27735
|
+
child.failure = settlement.failure;
|
|
27806
27736
|
child.status = child.cancellationReason === void 0 ? "failed" : "cancelled";
|
|
27807
27737
|
child.outRef = settlement.outRef;
|
|
27808
27738
|
child.trace = settlement.trace;
|
|
@@ -27860,6 +27790,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
27860
27790
|
seq
|
|
27861
27791
|
};
|
|
27862
27792
|
}
|
|
27793
|
+
child.failure = void 0;
|
|
27863
27794
|
child.status = "done";
|
|
27864
27795
|
child.outRef = settlement.outRef;
|
|
27865
27796
|
child.spent = settlement.spent;
|
|
@@ -27927,8 +27858,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
27927
27858
|
* applied per child). The reservation is reconciled on EVERY path (success, abort, throw)
|
|
27928
27859
|
* so the conserved pool can never leak a reservation.
|
|
27929
27860
|
*/
|
|
27930
|
-
|
|
27931
|
-
//#region src/runtime/supervise/scope-settlement-cursor.ts
|
|
27861
|
+
// src/runtime/supervise/scope-settlement-cursor.ts
|
|
27932
27862
|
/**
|
|
27933
27863
|
* The scope's `next()` cursor: delivers each child's settlement exactly once, stamps the cursor
|
|
27934
27864
|
* `seq`, and tracks the settlement writes still landing so a drain can wait for them.
|
|
@@ -27993,8 +27923,7 @@ var ScopeSettlementCursor = class {
|
|
|
27993
27923
|
}
|
|
27994
27924
|
}
|
|
27995
27925
|
};
|
|
27996
|
-
|
|
27997
|
-
//#region src/runtime/supervise/scope-child-materialization.ts
|
|
27926
|
+
// src/runtime/supervise/scope-child-materialization.ts
|
|
27998
27927
|
/** Publish the execution receipt only after the child spawn is durable. */
|
|
27999
27928
|
function createChildMaterialization({ args, spawnCommitted, identity, spec, executor, deferredOwner, attemptId, id, recovery, live, ordinal, now }) {
|
|
28000
27929
|
let pendingEvidence;
|
|
@@ -28124,8 +28053,7 @@ async function appendNodeMaterialization(args, id, seq, receipt, binding, now) {
|
|
|
28124
28053
|
at
|
|
28125
28054
|
});
|
|
28126
28055
|
}
|
|
28127
|
-
|
|
28128
|
-
//#region src/runtime/supervise/scope-child-retention.ts
|
|
28056
|
+
// src/runtime/supervise/scope-child-retention.ts
|
|
28129
28057
|
/** Own the retained child invocation and its durable writes. */
|
|
28130
28058
|
function createChildRetention({ args, controller, id, ordinal, identity, recovery, opts, now, traceRoots, markRecoveryReady, childDeadlineAtMs, readLive, completeEvidence }) {
|
|
28131
28059
|
const retainedWrites = /* @__PURE__ */ new Set();
|
|
@@ -28277,8 +28205,7 @@ function createChildRetention({ args, controller, id, ordinal, identity, recover
|
|
|
28277
28205
|
function overBudget(budget, spent) {
|
|
28278
28206
|
return chargedTokens(spent.tokens) > budget.maxTokens || spent.iterations > budget.maxIterations || budget.maxUsd !== void 0 && spent.usdKnown !== false && spent.usd > budget.maxUsd;
|
|
28279
28207
|
}
|
|
28280
|
-
|
|
28281
|
-
//#region src/durable/spawn-journal/journal-store.ts
|
|
28208
|
+
// src/durable/spawn-journal/journal-store.ts
|
|
28282
28209
|
/**
|
|
28283
28210
|
* Append every event as one grouped publication where the journal supports it (`appendEvents`),
|
|
28284
28211
|
* preserving legacy per-event appends otherwise — the SQL contexts' fenced head advances once.
|
|
@@ -28438,8 +28365,7 @@ var FileSpawnJournal = class {
|
|
|
28438
28365
|
function journalFileStamp(stat) {
|
|
28439
28366
|
return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;
|
|
28440
28367
|
}
|
|
28441
|
-
|
|
28442
|
-
//#region src/runtime/retained-interactive-handle.ts
|
|
28368
|
+
// src/runtime/retained-interactive-handle.ts
|
|
28443
28369
|
function createRetainedInteractiveRunHandle(environment, inputRef, capabilities, requestedStart) {
|
|
28444
28370
|
const ref = freezeInteractiveRef(inputRef);
|
|
28445
28371
|
const source = environment.interactive(ref);
|
|
@@ -28509,8 +28435,7 @@ function exactTerminal(ref, request, terminal) {
|
|
|
28509
28435
|
function sameInteractiveRef(left, right) {
|
|
28510
28436
|
return canonicalCandidateDigest(left) === canonicalCandidateDigest(right);
|
|
28511
28437
|
}
|
|
28512
|
-
|
|
28513
|
-
//#region src/runtime/retained-interactive.ts
|
|
28438
|
+
// src/runtime/retained-interactive.ts
|
|
28514
28439
|
/**
|
|
28515
28440
|
* Start one retry-safe native coding-agent TUI without dispatching a headless turn.
|
|
28516
28441
|
* The intent admission is durable before provider.create; the environment and
|
|
@@ -28647,12 +28572,13 @@ function interactiveRequest(options, environment, profile, requestedProfileDiges
|
|
|
28647
28572
|
...options.cols === void 0 ? {} : { cols: options.cols },
|
|
28648
28573
|
...options.rows === void 0 ? {} : { rows: options.rows }
|
|
28649
28574
|
};
|
|
28575
|
+
const run = agentInteractiveSessionRunRef({
|
|
28576
|
+
provider: options.provider.name,
|
|
28577
|
+
environmentId: environment.id,
|
|
28578
|
+
...identity
|
|
28579
|
+
}, start);
|
|
28650
28580
|
return exactAgentInteractiveSessionStart({
|
|
28651
|
-
run
|
|
28652
|
-
provider: options.provider.name,
|
|
28653
|
-
environmentId: environment.id,
|
|
28654
|
-
...identity
|
|
28655
|
-
}, start),
|
|
28581
|
+
run,
|
|
28656
28582
|
...start
|
|
28657
28583
|
});
|
|
28658
28584
|
}
|
|
@@ -28774,8 +28700,7 @@ async function destroyUnusedEnvironment(environment, cause) {
|
|
|
28774
28700
|
throw new AggregateError([cause, cleanupError], "interactive environment was invalid and could not be destroyed");
|
|
28775
28701
|
}
|
|
28776
28702
|
}
|
|
28777
|
-
|
|
28778
|
-
//#region src/runtime/supervise/worker-interactive.ts
|
|
28703
|
+
// src/runtime/supervise/worker-interactive.ts
|
|
28779
28704
|
const WORKER_BINDING_SCHEMA_VERSION = 1;
|
|
28780
28705
|
const SPAWN_JOURNAL_FILE = "spawn-journal.jsonl";
|
|
28781
28706
|
/** Directory containing exact per-worker interactive binding records. @stable */
|
|
@@ -28995,8 +28920,7 @@ function isUnsupportedProvider(error) {
|
|
|
28995
28920
|
function isUnavailableReason(value) {
|
|
28996
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";
|
|
28997
28922
|
}
|
|
28998
|
-
|
|
28999
|
-
//#region src/runtime/supervise/interactive-admission.ts
|
|
28923
|
+
// src/runtime/supervise/interactive-admission.ts
|
|
29000
28924
|
/**
|
|
29001
28925
|
* Durable, credential-free admissions for Runtime-owned interactive workers.
|
|
29002
28926
|
*
|
|
@@ -29012,7 +28936,8 @@ function workerInteractiveAdmissionFile(eventDir, workerId, phase) {
|
|
|
29012
28936
|
const dir = workerInteractiveBindingsDir(eventDir);
|
|
29013
28937
|
const id = stableText(workerId, "worker id");
|
|
29014
28938
|
assertNoSymlinkDescendant(eventDir, dir, "interactive admission");
|
|
29015
|
-
|
|
28939
|
+
const stem = canonicalCandidateDigest({ workerId: id }).slice(7).slice(0, 32);
|
|
28940
|
+
return join(dir, `${stem}.${phase}.admission.json`);
|
|
29016
28941
|
}
|
|
29017
28942
|
/**
|
|
29018
28943
|
* Persist one retained-interactive admission without retaining sensitive start material.
|
|
@@ -29223,8 +29148,7 @@ function stableText(value, label) {
|
|
|
29223
29148
|
if (!text) throw new Error(`${label} is empty`);
|
|
29224
29149
|
return text;
|
|
29225
29150
|
}
|
|
29226
|
-
|
|
29227
|
-
//#region src/runtime/supervise/scope-contract.ts
|
|
29151
|
+
// src/runtime/supervise/scope-contract.ts
|
|
29228
29152
|
/**
|
|
29229
29153
|
* The recursion seam key. A `Scope` seeds a value of this on each child's
|
|
29230
29154
|
* `ExecutorContext.seams` so a child whose executor is a DRIVER can mount a NESTED `Scope`
|
|
@@ -29317,8 +29241,7 @@ function isToolSpanValue(value) {
|
|
|
29317
29241
|
return false;
|
|
29318
29242
|
}
|
|
29319
29243
|
}
|
|
29320
|
-
|
|
29321
|
-
//#region src/runtime/supervise/scope-child-attempt.ts
|
|
29244
|
+
// src/runtime/supervise/scope-child-attempt.ts
|
|
29322
29245
|
/**
|
|
29323
29246
|
* One child execution's settle-once state: its output, trace and transcript evidence, its
|
|
29324
29247
|
* teardown, and the single reconciliation of its reservation. Every settle exit of `runChild`
|
|
@@ -29472,8 +29395,7 @@ function assertReportedSpend(spent, context) {
|
|
|
29472
29395
|
const candidate = spent;
|
|
29473
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`);
|
|
29474
29397
|
}
|
|
29475
|
-
|
|
29476
|
-
//#region src/runtime/supervise/scope-execution.ts
|
|
29398
|
+
// src/runtime/supervise/scope-execution.ts
|
|
29477
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) {
|
|
29478
29400
|
if (priorSpent !== void 0) live.spent = detachedSnapshot(priorSpent, "prior committed usage");
|
|
29479
29401
|
const attempt = new ChildExecutionAttempt(live, executor, childAbort, opts, pool, ticket, blobs, now, deadlineAtMs, startedAt);
|
|
@@ -29651,7 +29573,8 @@ function doneRecord(result, spent, trace, harnessTranscript, providerModel, mete
|
|
|
29651
29573
|
function failureRecord(failure, trace, metered, providerModel, harnessTranscript, outRef) {
|
|
29652
29574
|
return {
|
|
29653
29575
|
...downRecord(failure.error, executorFailureInfra(failure), trace, metered, providerModel, void 0, harnessTranscript),
|
|
29654
|
-
outRef
|
|
29576
|
+
outRef,
|
|
29577
|
+
failure: reportedFailureCause(failure)
|
|
29655
29578
|
};
|
|
29656
29579
|
}
|
|
29657
29580
|
/**
|
|
@@ -29787,8 +29710,7 @@ function isAbortError(err) {
|
|
|
29787
29710
|
function isInfraError(err) {
|
|
29788
29711
|
return err instanceof ValidationError$1;
|
|
29789
29712
|
}
|
|
29790
|
-
|
|
29791
|
-
//#region src/durable/spawn-journal/replay.ts
|
|
29713
|
+
// src/durable/spawn-journal/replay.ts
|
|
29792
29714
|
/**
|
|
29793
29715
|
* Re-feed a journaled spawn tree in strict `seq` order, rehydrating each settled
|
|
29794
29716
|
* child's `out` from the blob store by `outRef`, and return the `Settled[]` exactly
|
|
@@ -29835,68 +29757,50 @@ async function replaySpawnTree(journal, blobs, root) {
|
|
|
29835
29757
|
const settled = [];
|
|
29836
29758
|
for (const ev of ordered) {
|
|
29837
29759
|
if (outsideCursorNamespace(ev)) continue;
|
|
29838
|
-
|
|
29839
|
-
|
|
29840
|
-
|
|
29841
|
-
|
|
29842
|
-
|
|
29843
|
-
|
|
29844
|
-
|
|
29845
|
-
|
|
29846
|
-
|
|
29847
|
-
|
|
29848
|
-
|
|
29849
|
-
|
|
29850
|
-
|
|
29851
|
-
|
|
29852
|
-
|
|
29853
|
-
|
|
29854
|
-
|
|
29855
|
-
...settlementTime(ev.at),
|
|
29856
|
-
seq: ev.seq
|
|
29857
|
-
});
|
|
29858
|
-
continue;
|
|
29859
|
-
}
|
|
29860
|
-
if (ev.status === "down") {
|
|
29861
|
-
const trace = traceEvidenceFor(ev);
|
|
29862
|
-
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";
|
|
29863
29777
|
settled.push({
|
|
29778
|
+
...evidence,
|
|
29864
29779
|
kind: "down",
|
|
29865
|
-
handle: handleFor(ev.id, "failed"),
|
|
29866
|
-
reason
|
|
29867
|
-
|
|
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
|
+
}),
|
|
29868
29787
|
...ev.infra === void 0 ? {} : { infra: ev.infra },
|
|
29869
|
-
...ev.providerModel === void 0 ? {} : { providerModel: copyProviderModelEvidence(ev.providerModel) },
|
|
29870
|
-
...budgetViolationOf(ev),
|
|
29871
|
-
trace,
|
|
29872
|
-
...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
|
|
29873
29788
|
...ev.retainedExecution === void 0 ? {} : { retainedExecution: ev.retainedExecution },
|
|
29874
|
-
...ev.retainedPendingCause === void 0 ? {} : { retainedPendingCause: ev.retainedPendingCause }
|
|
29875
|
-
...ev.subtree === void 0 ? {} : { subtree: ev.subtree },
|
|
29876
|
-
...settlementTime(ev.at),
|
|
29877
|
-
seq: ev.seq
|
|
29789
|
+
...ev.retainedPendingCause === void 0 ? {} : { retainedPendingCause: ev.retainedPendingCause }
|
|
29878
29790
|
});
|
|
29879
29791
|
continue;
|
|
29880
29792
|
}
|
|
29881
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`);
|
|
29882
29794
|
const out = await blobs.get(ev.outRef);
|
|
29883
29795
|
if (out === void 0) throw new Error(`replaySpawnTree: blob store has no artifact for outRef '${ev.outRef}' (node '${ev.id}', seq ${ev.seq})`);
|
|
29884
|
-
const trace = traceEvidenceFor(ev);
|
|
29885
|
-
if (trace.status === "available") await workerTraceAnalysisStore(trace, blobs);
|
|
29886
29796
|
settled.push({
|
|
29797
|
+
...evidence,
|
|
29887
29798
|
kind: "done",
|
|
29888
29799
|
handle: handleFor(ev.id, "done"),
|
|
29889
29800
|
out,
|
|
29890
29801
|
outRef: ev.outRef,
|
|
29891
29802
|
verdict: ev.verdict,
|
|
29892
|
-
spent: cloneSpend(ev.spent)
|
|
29893
|
-
...ev.providerModel === void 0 ? {} : { providerModel: copyProviderModelEvidence(ev.providerModel) },
|
|
29894
|
-
...budgetViolationOf(ev),
|
|
29895
|
-
trace,
|
|
29896
|
-
...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
|
|
29897
|
-
...ev.subtree === void 0 ? {} : { subtree: ev.subtree },
|
|
29898
|
-
...settlementTime(ev.at),
|
|
29899
|
-
seq: ev.seq
|
|
29803
|
+
spent: cloneSpend(ev.spent)
|
|
29900
29804
|
});
|
|
29901
29805
|
}
|
|
29902
29806
|
return settled;
|
|
@@ -29925,8 +29829,7 @@ function copyFrozenIdentity(identity) {
|
|
|
29925
29829
|
...correlation === void 0 ? {} : { correlation }
|
|
29926
29830
|
});
|
|
29927
29831
|
}
|
|
29928
|
-
|
|
29929
|
-
//#region src/runtime/supervise/recover-executors.ts
|
|
29832
|
+
// src/runtime/supervise/recover-executors.ts
|
|
29930
29833
|
/** The environment id the node's latest durable admission names — the executor's own rule
|
|
29931
29834
|
* (`admittedEnvironmentId` in environment-provider.ts), read off the journal. */
|
|
29932
29835
|
function journaledEnvironmentId(owned) {
|
|
@@ -29989,6 +29892,7 @@ async function healReleasedSlots(opts, signal, now) {
|
|
|
29989
29892
|
const settlement = {
|
|
29990
29893
|
kind: "down",
|
|
29991
29894
|
reason: floor.reason,
|
|
29895
|
+
...floor.failure === void 0 ? {} : { failure: floor.failure },
|
|
29992
29896
|
...floor.infra === void 0 ? {} : { infra: floor.infra },
|
|
29993
29897
|
trace: floor.trace,
|
|
29994
29898
|
...floor.outRef ? { outRef: floor.outRef } : {},
|
|
@@ -30112,6 +30016,7 @@ async function prepareInterruptedExecutors(opts, events, signal, now, parentId =
|
|
|
30112
30016
|
...result.traceRoot === void 0 ? {} : { traceRoot: result.traceRoot },
|
|
30113
30017
|
...reason === void 0 ? {} : { reason },
|
|
30114
30018
|
...infra === void 0 ? {} : { infra },
|
|
30019
|
+
...fault === void 0 && failure !== void 0 ? { failure: reportedFailureCause(failure) } : {},
|
|
30115
30020
|
spent: result.spent,
|
|
30116
30021
|
...budgetViolation === void 0 ? {} : { budgetViolation },
|
|
30117
30022
|
...result.verdict ? { verdict: result.verdict } : {},
|
|
@@ -30320,8 +30225,7 @@ async function prepareScopeResume(opts, events, signal, now, parentId = opts.run
|
|
|
30320
30225
|
}
|
|
30321
30226
|
};
|
|
30322
30227
|
}
|
|
30323
|
-
|
|
30324
|
-
//#region src/runtime/supervise/scope-nesting.ts
|
|
30228
|
+
// src/runtime/supervise/scope-nesting.ts
|
|
30325
30229
|
function makeNestedScopeSeam(args, workerSlots, childSlot, childNodeId, childBudget, childDeadlineAtMs, deferredOwner) {
|
|
30326
30230
|
const now = args.now ?? Date.now;
|
|
30327
30231
|
const mountScope = (nestedRoot, signal, restored) => {
|
|
@@ -30377,8 +30281,7 @@ function makeNestedScopeSeam(args, workerSlots, childSlot, childNodeId, childBud
|
|
|
30377
30281
|
}
|
|
30378
30282
|
};
|
|
30379
30283
|
}
|
|
30380
|
-
|
|
30381
|
-
//#region src/runtime/supervise/worker-events.ts
|
|
30284
|
+
// src/runtime/supervise/worker-events.ts
|
|
30382
30285
|
const MAX_EVENTS = 256;
|
|
30383
30286
|
const MAX_BYTES = 262144;
|
|
30384
30287
|
/** One worker's already-redacted live output. Accounting stays on Scope's existing usage channel. */
|
|
@@ -30448,8 +30351,7 @@ var WorkerEvents = class {
|
|
|
30448
30351
|
};
|
|
30449
30352
|
}
|
|
30450
30353
|
};
|
|
30451
|
-
|
|
30452
|
-
//#region src/runtime/supervise/scope-child-start.ts
|
|
30354
|
+
// src/runtime/supervise/scope-child-start.ts
|
|
30453
30355
|
/**
|
|
30454
30356
|
* The records one admitted child starts with: its executor context, its handle, its live-child
|
|
30455
30357
|
* row, its spawn journal record and hook, and the settlement chain that closes it. `scope-spawn`
|
|
@@ -30697,15 +30599,16 @@ async function resolveChildSettlement(live, ran, interactiveBindingCommitted, ho
|
|
|
30697
30599
|
};
|
|
30698
30600
|
}
|
|
30699
30601
|
live.resolved = resolution;
|
|
30700
|
-
if (live.held !== void 0)
|
|
30701
|
-
|
|
30702
|
-
|
|
30703
|
-
|
|
30704
|
-
|
|
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
|
+
}
|
|
30705
30609
|
return resolution;
|
|
30706
30610
|
}
|
|
30707
|
-
|
|
30708
|
-
//#region src/runtime/supervise/scope-key-registry.ts
|
|
30611
|
+
// src/runtime/supervise/scope-key-registry.ts
|
|
30709
30612
|
/**
|
|
30710
30613
|
* The semantic-key registry (`SpawnOpts.key`): every keyed assignment's current state, seeded
|
|
30711
30614
|
* from the prior journal on resume and updated live as keyed children spawn and settle. This is
|
|
@@ -30777,8 +30680,7 @@ function resumedKeyState(prior, identity) {
|
|
|
30777
30680
|
identity
|
|
30778
30681
|
};
|
|
30779
30682
|
}
|
|
30780
|
-
|
|
30781
|
-
//#region src/runtime/supervise/scope-spawn.ts
|
|
30683
|
+
// src/runtime/supervise/scope-spawn.ts
|
|
30782
30684
|
/** Own child admission, keyed identity and executor startup. */
|
|
30783
30685
|
function createScopeSpawner(deps) {
|
|
30784
30686
|
const spawner = new ScopeSpawner(deps);
|
|
@@ -31137,8 +31039,7 @@ function prepareOnce(request) {
|
|
|
31137
31039
|
};
|
|
31138
31040
|
return request.prepared;
|
|
31139
31041
|
}
|
|
31140
|
-
|
|
31141
|
-
//#region src/runtime/supervise/scope-teardown.ts
|
|
31042
|
+
// src/runtime/supervise/scope-teardown.ts
|
|
31142
31043
|
/** Release settled child environments and close their retained journal slots. */
|
|
31143
31044
|
function createHeldChildRelease(args, now) {
|
|
31144
31045
|
const heldReleases = /* @__PURE__ */ new Set();
|
|
@@ -31282,8 +31183,7 @@ function bindChildTeardown(scope, args, children, now) {
|
|
|
31282
31183
|
for (const child of open) await closeRetainedSlot(child, "release-unconfirmed", prior);
|
|
31283
31184
|
});
|
|
31284
31185
|
}
|
|
31285
|
-
|
|
31286
|
-
//#region src/runtime/supervise/scope-workers.ts
|
|
31186
|
+
// src/runtime/supervise/scope-workers.ts
|
|
31287
31187
|
/**
|
|
31288
31188
|
* A scope's live children as its driver addresses them: steer, read progress, cancel, read the
|
|
31289
31189
|
* trace and interactive session, and observe the tree and event streams, nested scopes included.
|
|
@@ -31420,8 +31320,7 @@ var ScopeWorkers = class {
|
|
|
31420
31320
|
};
|
|
31421
31321
|
};
|
|
31422
31322
|
};
|
|
31423
|
-
|
|
31424
|
-
//#region src/runtime/supervise/scope-construction.ts
|
|
31323
|
+
// src/runtime/supervise/scope-construction.ts
|
|
31425
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. */
|
|
31426
31325
|
function createScope(args) {
|
|
31427
31326
|
checkInIdleMs(args.deadlineCheckIn);
|
|
@@ -31606,8 +31505,7 @@ async function recoverRetainedChildren(args, children, spawn, next) {
|
|
|
31606
31505
|
throw error;
|
|
31607
31506
|
}
|
|
31608
31507
|
}
|
|
31609
|
-
|
|
31610
|
-
//#region src/runtime/supervise/driver-executor.ts
|
|
31508
|
+
// src/runtime/supervise/driver-executor.ts
|
|
31611
31509
|
/**
|
|
31612
31510
|
* Mark + carry a driver `Agent` so the recursive registry resolves it to the
|
|
31613
31511
|
* driver-executor. The returned agent is SPAWNED (never run directly): its
|
|
@@ -31987,8 +31885,7 @@ function unreportedSpend(total, prior) {
|
|
|
31987
31885
|
...total.boxMinutes === void 0 ? {} : { boxMinutes: Math.max(0, total.boxMinutes - (prior.boxMinutes ?? 0)) }
|
|
31988
31886
|
};
|
|
31989
31887
|
}
|
|
31990
|
-
|
|
31991
|
-
//#region src/runtime/supervise/supervisor-root-handle.ts
|
|
31888
|
+
// src/runtime/supervise/supervisor-root-handle.ts
|
|
31992
31889
|
/** Module-private channel from a minted `RootHandle` to its `RootControl`, so `attach`
|
|
31993
31890
|
* can prove a handle is ours and reach its binding without leaking the control onto the
|
|
31994
31891
|
* frozen `RootHandle` shape. */
|
|
@@ -32050,8 +31947,7 @@ function pushRootSignal(cascadeAbort) {
|
|
|
32050
31947
|
cascadeAbort(new RunCancellationReason("root-signal", msg.reason ?? "root signal: cancel"));
|
|
32051
31948
|
};
|
|
32052
31949
|
}
|
|
32053
|
-
|
|
32054
|
-
//#region src/runtime/supervise/finalizer.ts
|
|
31950
|
+
// src/runtime/supervise/finalizer.ts
|
|
32055
31951
|
/**
|
|
32056
31952
|
* `SupervisorFinalizer` — the pluggable last step of a driver run: how the settled-worker ledger
|
|
32057
31953
|
* becomes the run's output. `bestDelivered` (the default) returns the single highest-scoring
|
|
@@ -32152,8 +32048,7 @@ async function runFinalizer(finalizer, args) {
|
|
|
32152
32048
|
});
|
|
32153
32049
|
return await accepted(candidate) ? candidate : void 0;
|
|
32154
32050
|
}
|
|
32155
|
-
|
|
32156
|
-
//#region src/runtime/supervise/run-parking.ts
|
|
32051
|
+
// src/runtime/supervise/run-parking.ts
|
|
32157
32052
|
/** Read the journal's bounded parking projection. Undefined means no current parking handoff. */
|
|
32158
32053
|
async function readRunParking(runDir) {
|
|
32159
32054
|
let raw;
|
|
@@ -32302,8 +32197,7 @@ function parkingRecordOf(record) {
|
|
|
32302
32197
|
wakeAt: record.wakeAt
|
|
32303
32198
|
};
|
|
32304
32199
|
}
|
|
32305
|
-
|
|
32306
|
-
//#region src/durable/spawn-journal/provider-model-evidence.ts
|
|
32200
|
+
// src/durable/spawn-journal/provider-model-evidence.ts
|
|
32307
32201
|
/**
|
|
32308
32202
|
* Aggregate provider-served model evidence across one recursively owned journal forest.
|
|
32309
32203
|
*
|
|
@@ -32470,8 +32364,7 @@ function servedIdentityParts(model) {
|
|
|
32470
32364
|
snapshot
|
|
32471
32365
|
};
|
|
32472
32366
|
}
|
|
32473
|
-
|
|
32474
|
-
//#region src/runtime/supervise/supervisor-accounting.ts
|
|
32367
|
+
// src/runtime/supervise/supervisor-accounting.ts
|
|
32475
32368
|
/**
|
|
32476
32369
|
* The run's terminal accounting, read off the one journal ledger — the honest per-channel
|
|
32477
32370
|
* sums (input/output/usd/iterations all preserved), the named usage gaps, and the wall-clock
|
|
@@ -32610,8 +32503,7 @@ function unknownChannels(spend) {
|
|
|
32610
32503
|
function isNonEmptySpend(s) {
|
|
32611
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);
|
|
32612
32505
|
}
|
|
32613
|
-
|
|
32614
|
-
//#region src/runtime/supervise/supervisor-child-join.ts
|
|
32506
|
+
// src/runtime/supervise/supervisor-child-join.ts
|
|
32615
32507
|
/**
|
|
32616
32508
|
* Drain the root scope's live set so every still-running/acquiring child is torn down
|
|
32617
32509
|
* before `run` returns — the join barrier. Abort the cascade controller first (so each
|
|
@@ -32733,8 +32625,7 @@ function boundedSettleGrace(graceMs, deadlineAtMs, now) {
|
|
|
32733
32625
|
async function drainCursor(scope) {
|
|
32734
32626
|
for (;;) if (await scope.next() === null) return;
|
|
32735
32627
|
}
|
|
32736
|
-
|
|
32737
|
-
//#region src/runtime/supervise/supervisor-intensity-breaker.ts
|
|
32628
|
+
// src/runtime/supervise/supervisor-intensity-breaker.ts
|
|
32738
32629
|
function createIntensityBreaker(opts, trip) {
|
|
32739
32630
|
const max = opts.maxRestarts;
|
|
32740
32631
|
const within = opts.withinMs;
|
|
@@ -32790,8 +32681,7 @@ function wrapJournalForBreaker(journal, breaker) {
|
|
|
32790
32681
|
}
|
|
32791
32682
|
};
|
|
32792
32683
|
}
|
|
32793
|
-
|
|
32794
|
-
//#region src/runtime/supervise/supervisor-result.ts
|
|
32684
|
+
// src/runtime/supervise/supervisor-result.ts
|
|
32795
32685
|
/**
|
|
32796
32686
|
* Normalize an arbitrary rejection into the serializable triple the result carries. A driver may
|
|
32797
32687
|
* reject with anything (a string, a plain object, a null-prototype value), and the whole point of
|
|
@@ -32841,8 +32731,7 @@ function deadlinePassed(pool, opts) {
|
|
|
32841
32731
|
const deadlineMs = pool.readout().deadlineMs;
|
|
32842
32732
|
return deadlineMs > 0 && (opts.now ?? Date.now)() >= deadlineMs;
|
|
32843
32733
|
}
|
|
32844
|
-
|
|
32845
|
-
//#region src/runtime/supervise/supervisor-root-contract.ts
|
|
32734
|
+
// src/runtime/supervise/supervisor-root-contract.ts
|
|
32846
32735
|
/** A resumed process may continue only the exact root contract first recorded for this run id. Its
|
|
32847
32736
|
* budget is the root's, or the one the run's last budget-carrying `reopened` row recorded. */
|
|
32848
32737
|
function assertResumeContract(events, opts) {
|
|
@@ -32999,8 +32888,7 @@ function rootStartedAtMs(root) {
|
|
|
32999
32888
|
if (!Number.isFinite(startedAt)) throw new RuntimeRunStateError(`supervisor: root event for '${root.id}' has an invalid timestamp '${root.at}'`);
|
|
33000
32889
|
return startedAt;
|
|
33001
32890
|
}
|
|
33002
|
-
|
|
33003
|
-
//#region src/runtime/supervise/run-persistence.ts
|
|
32891
|
+
// src/runtime/supervise/run-persistence.ts
|
|
33004
32892
|
/** One failed store operation revokes this controller's writes, never its retained executions. */
|
|
33005
32893
|
function guardRunPersistence(journal, blobs, interrupt) {
|
|
33006
32894
|
let failure;
|
|
@@ -33044,8 +32932,7 @@ function guardRunPersistence(journal, blobs, interrupt) {
|
|
|
33044
32932
|
}
|
|
33045
32933
|
};
|
|
33046
32934
|
}
|
|
33047
|
-
|
|
33048
|
-
//#region src/runtime/supervise/supervisor-run-intake.ts
|
|
32935
|
+
// src/runtime/supervise/supervisor-run-intake.ts
|
|
33049
32936
|
/** Read every caller-owned field once, then detach and freeze all decision data before the first
|
|
33050
32937
|
* await; stateful collaborators stay live by reference, but later opts mutation cannot redirect the run. */
|
|
33051
32938
|
function admitSupervisorRun(task, opts) {
|
|
@@ -33103,8 +32990,7 @@ function admitSupervisorRun(task, opts) {
|
|
|
33103
32990
|
budgetStopHoldMs
|
|
33104
32991
|
};
|
|
33105
32992
|
}
|
|
33106
|
-
|
|
33107
|
-
//#region src/runtime/supervise/supervisor-run-join.ts
|
|
32993
|
+
// src/runtime/supervise/supervisor-run-join.ts
|
|
33108
32994
|
/**
|
|
33109
32995
|
* Join barrier: tear down every still-live child. Generalizes the kernel's
|
|
33110
32996
|
* `finally{ Promise.allSettled(destroy) }` — a teardown throw is allSettled'd and journaled.
|
|
@@ -33186,8 +33072,7 @@ function unrecoveredRetainedChildren(scope, resumeFrom) {
|
|
|
33186
33072
|
}
|
|
33187
33073
|
return unrecovered;
|
|
33188
33074
|
}
|
|
33189
|
-
|
|
33190
|
-
//#region src/runtime/supervise/supervisor-run-tree.ts
|
|
33075
|
+
// src/runtime/supervise/supervisor-run-tree.ts
|
|
33191
33076
|
async function openRunTree(opts, now) {
|
|
33192
33077
|
const rootAttemptId = newExecutionAttemptId(opts.runId);
|
|
33193
33078
|
const runStartedAtMs = now();
|
|
@@ -33272,8 +33157,7 @@ async function beginRunTree(opts, existing, prior, runStartedAtMs, runStartedAt,
|
|
|
33272
33157
|
runEpochMs: runStartedAtMs
|
|
33273
33158
|
};
|
|
33274
33159
|
}
|
|
33275
|
-
|
|
33276
|
-
//#region src/runtime/supervise/supervisor-run.ts
|
|
33160
|
+
// src/runtime/supervise/supervisor-run.ts
|
|
33277
33161
|
/** The default recursion-depth ceiling. The conserved pool bounds depth (every level draws its
|
|
33278
33162
|
* slice from the one above); this only stops a runaway recursion of tiny slices. */
|
|
33279
33163
|
const DEFAULT_MAX_DEPTH = 16;
|
|
@@ -33356,8 +33240,10 @@ function rootCascade(controller, opts) {
|
|
|
33356
33240
|
const reason = opts.signal ? abortReason(opts.signal, "caller signal aborted") : "caller signal aborted";
|
|
33357
33241
|
cascadeAbort(reason instanceof RunCancellationReason ? reason : new RunCancellationReason("signal", typeof reason === "string" ? reason : "caller signal aborted"));
|
|
33358
33242
|
};
|
|
33359
|
-
if (opts.signal)
|
|
33360
|
-
|
|
33243
|
+
if (opts.signal) {
|
|
33244
|
+
if (opts.signal.aborted) onCallerAbort();
|
|
33245
|
+
else opts.signal.addEventListener("abort", onCallerAbort, { once: true });
|
|
33246
|
+
}
|
|
33361
33247
|
return {
|
|
33362
33248
|
aborted: () => cascadeAborted,
|
|
33363
33249
|
abort: cascadeAbort,
|
|
@@ -33584,7 +33470,6 @@ async function noWinner(settled, rejection) {
|
|
|
33584
33470
|
reason: "no-result-selected"
|
|
33585
33471
|
};
|
|
33586
33472
|
}
|
|
33587
|
-
|
|
33588
|
-
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 };
|
|
33589
33474
|
|
|
33590
|
-
//# sourceMappingURL=supervisor-
|
|
33475
|
+
//# sourceMappingURL=supervisor-C1OePYE-.js.map
|