@tangle-network/agent-runtime 0.338.0 → 0.340.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{activation-kbkAuSmY.js → activation-D2PVljaw.js} +5 -18
- package/dist/{activation-kbkAuSmY.js.map → activation-D2PVljaw.js.map} +1 -1
- package/dist/{activation-CsbNax2X.d.ts → activation-DGDl4wwI.d.ts} +4 -24
- package/dist/agent.d.ts +4 -18
- package/dist/agent.js +3 -21
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +2 -2
- package/dist/{bundle-DM60AI2B.js → bundle-DNUq-OPW.js} +2 -2
- package/dist/{bundle-DM60AI2B.js.map → bundle-DNUq-OPW.js.map} +1 -1
- package/dist/candidate-execution/index.d.ts +4 -101
- package/dist/candidate-execution/index.js +10 -395
- package/dist/candidate-execution/index.js.map +1 -1
- package/dist/{delegate-Se1YZKMb.js → delegate-CtJIS-tp.js} +2 -2
- package/dist/{delegate-Se1YZKMb.js.map → delegate-CtJIS-tp.js.map} +1 -1
- package/dist/{driver-control-acknowledgers-T2a1Ouay.js → driver-control-acknowledgers-MTrs8HAF.js} +15 -11
- package/dist/driver-control-acknowledgers-MTrs8HAF.js.map +1 -0
- package/dist/{durable-file-B_eJr6Mb.js → durable-file-gNI9ILAn.js} +1 -3
- package/dist/durable-file-gNI9ILAn.js.map +1 -0
- package/dist/durable.d.ts +3 -35
- package/dist/durable.js +10 -10
- package/dist/durable.js.map +1 -1
- package/dist/{graph-CY0wH838.js → graph-DfWqp_1e.js} +4 -4
- package/dist/graph-DfWqp_1e.js.map +1 -0
- package/dist/{graph-registry-By0tUj4S.js → graph-registry-BnO64cn8.js} +3 -3
- package/dist/{graph-registry-By0tUj4S.js.map → graph-registry-BnO64cn8.js.map} +1 -1
- package/dist/{improve-CWGBT13K.js → improve-CKRVQqzt.js} +8 -35
- package/dist/improve-CKRVQqzt.js.map +1 -0
- package/dist/{improvement-adapter-D5gwwoXQ.d.ts → improvement-adapter-sIthWkcN.d.ts} +3 -21
- package/dist/index.d.ts +10 -215
- package/dist/index.js +91 -302
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +11 -143
- package/dist/intelligence.js +7 -81
- package/dist/intelligence.js.map +1 -1
- package/dist/{jsonl-file-DBv31uPi.js → jsonl-file-C9Kde_0Z.js} +2 -2
- package/dist/{jsonl-file-DBv31uPi.js.map → jsonl-file-C9Kde_0Z.js.map} +1 -1
- package/dist/kernel.d.ts +4 -3
- package/dist/kernel.js +12 -14
- package/dist/loop-runner-C4EWEcXf.d.ts +32 -0
- package/dist/loop-runner-DNWbTcVm.js +59 -0
- package/dist/loop-runner-DNWbTcVm.js.map +1 -0
- package/dist/loop-runner-bin.d.ts +32 -2
- package/dist/loop-runner-bin.js +93 -1
- package/dist/loop-runner-bin.js.map +1 -0
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +99 -418
- package/dist/mcp/index.js +121 -203
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.js +231 -1
- package/dist/mcp/memory-bin.js.map +1 -1
- package/dist/model-policy-CyCUwHed.js.map +1 -1
- package/dist/placement.d.ts +2 -33
- package/dist/placement.js +1 -35
- package/dist/placement.js.map +1 -1
- package/dist/platform.d.ts +188 -1
- package/dist/platform.js +129 -1
- package/dist/platform.js.map +1 -1
- package/dist/{prepare-Bt0IouPq.js → prepare-FzJoS68l.js} +8 -160
- package/dist/prepare-FzJoS68l.js.map +1 -0
- package/dist/{profile-Do-5xO_D.js → profile-DToH0XEs.js} +2 -2
- package/dist/profile-DToH0XEs.js.map +1 -0
- package/dist/profile-materialization-bPm0gGLO.d.ts +49 -0
- package/dist/profiles.d.ts +2 -2
- package/dist/profiles.js +3 -40
- package/dist/profiles.js.map +1 -1
- package/dist/{protected-model-port-DGxQ8_YM.d.ts → protected-model-port-DVVh-hEk.d.ts} +3 -33
- package/dist/protected-redaction-DFCeo4vg.js.map +1 -1
- package/dist/{provision-supervisor-0jMufp4h.js → provision-supervisor-DqvWXmAE.js} +6 -6
- package/dist/{provision-supervisor-0jMufp4h.js.map → provision-supervisor-DqvWXmAE.js.map} +1 -1
- package/dist/{run-cancellation-BoW5Sg9Y.js → run-cancellation-C9oL62sW.js} +3 -7
- package/dist/{run-cancellation-BoW5Sg9Y.js.map → run-cancellation-C9oL62sW.js.map} +1 -1
- package/dist/{runtime-D37zRSs7.js → runtime-C55Zgo1R.js} +2531 -2889
- package/dist/runtime-C55Zgo1R.js.map +1 -0
- package/dist/{runtime-hooks-Bj6wJHlH.d.ts → runtime-hooks-nsqxSUFL.d.ts} +2 -6
- package/dist/{sandbox-profile-compat-xSoVtdWw.js → sandbox-profile-compat-DRr3JwDx.js} +2 -4
- package/dist/sandbox-profile-compat-DRr3JwDx.js.map +1 -0
- package/dist/{search-executor-DmgUm5p7.js → search-executor-ChOlRBgg.js} +3 -3
- package/dist/search-executor-ChOlRBgg.js.map +1 -0
- package/dist/{server-DQHJszfk.js → server-DkVBSN_S.js} +362 -67
- package/dist/server-DkVBSN_S.js.map +1 -0
- package/dist/{structural-rollout-DAvIE8mw.js → structural-rollout-C1LEk_zq.js} +80 -80
- package/dist/structural-rollout-C1LEk_zq.js.map +1 -0
- package/dist/{substrate-B0TYNrXn.js → substrate-CGDFTSRh.js} +2 -9
- package/dist/substrate-CGDFTSRh.js.map +1 -0
- package/dist/{supervise-WuPAwfPh.js → supervise-CaUAxZZP.js} +92 -75
- package/dist/supervise-CaUAxZZP.js.map +1 -0
- package/dist/{supervisor-CPG1I9UN.js → supervisor-VXuN2OHT.js} +205 -319
- package/dist/supervisor-VXuN2OHT.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +13 -13
- package/dist/testing.js.map +1 -1
- package/dist/tool-loop.d.ts +1 -1
- package/dist/{tool-server-Dqer2M4_.js → tool-server-XV4aJwoQ.js} +2 -2
- package/dist/tool-server-XV4aJwoQ.js.map +1 -0
- package/dist/top-snapshot-CbZE1JsU.js +502 -0
- package/dist/top-snapshot-CbZE1JsU.js.map +1 -0
- package/dist/tui/bin.js +711 -1
- package/dist/tui/bin.js.map +1 -1
- package/dist/tui/index.d.ts +2 -70
- package/dist/tui/index.js +3 -3
- package/dist/{types-zWfqDjeL.d.ts → types-Cwrea-bU.d.ts} +2 -17
- package/dist/{types-CrNWif8-.d.ts → types-DZ6L0Bv3.d.ts} +765 -2152
- package/dist/workspace-store/index.d.ts +1 -107
- package/dist/workspace-store/index.js +1 -415
- package/dist/workspace-store/index.js.map +1 -1
- package/dist/{workspace-streams-BZZds1Fw.d.ts → workspace-streams-BiS4ABah.d.ts} +3 -18
- package/package.json +1 -1
- package/skills/agent-graphs/references/authoring.md +3 -2
- package/dist/coder-yhVWbdWc.js +0 -40
- package/dist/coder-yhVWbdWc.js.map +0 -1
- package/dist/delegation-status-CF4D0NZ_.js +0 -358
- package/dist/delegation-status-CF4D0NZ_.js.map +0 -1
- package/dist/driver-control-acknowledgers-T2a1Ouay.js.map +0 -1
- package/dist/durable-file-B_eJr6Mb.js.map +0 -1
- package/dist/graph-CY0wH838.js.map +0 -1
- package/dist/improve-CWGBT13K.js.map +0 -1
- package/dist/integrations-6xttbPi9.d.ts +0 -190
- package/dist/integrations-dFi-ALk7.js +0 -132
- package/dist/integrations-dFi-ALk7.js.map +0 -1
- package/dist/kb-gate-C8z2juK8.d.ts +0 -80
- package/dist/kb-gate-DpaSwXVx.js +0 -80
- package/dist/kb-gate-DpaSwXVx.js.map +0 -1
- package/dist/loop-runner-bin-CFnrAHpl.d.ts +0 -164
- package/dist/loop-runner-bin-CdPlhy9g.js +0 -246
- package/dist/loop-runner-bin-CdPlhy9g.js.map +0 -1
- package/dist/memory-server-DXQ8IxGR.js +0 -234
- package/dist/memory-server-DXQ8IxGR.js.map +0 -1
- package/dist/openai-tools-DoQ32vpe.js +0 -44
- package/dist/openai-tools-DoQ32vpe.js.map +0 -1
- package/dist/openai-tools-zh2I_uD7.d.ts +0 -24
- package/dist/prepare-Bt0IouPq.js.map +0 -1
- package/dist/profile-Do-5xO_D.js.map +0 -1
- package/dist/profile-materialization-BnoEf1co.d.ts +0 -96
- package/dist/runtime-D37zRSs7.js.map +0 -1
- package/dist/sandbox-profile-compat-xSoVtdWw.js.map +0 -1
- package/dist/search-executor-DmgUm5p7.js.map +0 -1
- package/dist/server-DQHJszfk.js.map +0 -1
- package/dist/structural-rollout-DAvIE8mw.js.map +0 -1
- package/dist/substrate-B0TYNrXn.js.map +0 -1
- package/dist/supervise-WuPAwfPh.js.map +0 -1
- package/dist/supervisor-CPG1I9UN.js.map +0 -1
- package/dist/tool-server-Dqer2M4_.js.map +0 -1
- package/dist/top-app-C55Wa7uy.js +0 -1214
- package/dist/top-app-C55Wa7uy.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { i as publishExclusiveDurableFile, n as assertNoSymlinkDescendant } from "./durable-file-
|
|
1
|
+
import { i as publishExclusiveDurableFile, n as assertNoSymlinkDescendant } from "./durable-file-gNI9ILAn.js";
|
|
2
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-DodWX-cb.js";
|
|
3
3
|
import { n as recordValue, t as isRecord } from "./record-value-B6bwJxLa.js";
|
|
4
|
-
import { $ as
|
|
4
|
+
import { $ as isAbortError$1, A as verifyWorkspaceSnapshotArtifacts, B as sha256Bytes$1, Ct as armDeadlineTimer, Dt as singleFlightTeardown, Et as isDeadlineAbortReason, G as addTokenUsage, H as hasControlCharacter, I as deepFreezeCandidate, J as cloneTokenUsage, K as chargedTokens, M as verifiedArtifactChunks, Ot as teardownExecutor, Q as hasCompleteCacheBreakdown, St as ROOT_DEADLINE_REASON, Tt as checkInIdleMs, U as abortError, W as addSpend, X as errorMessage, Y as deleteBoxSafe, Z as fnv1a32Hex, _t as withBudgetResources, at as roundBoxMinutes, c as verifyAgentCandidateWorkspaceTree, ct as throwAbort, dt as withTimeout, et as isAsyncIterable$1, ft as zeroSpend, g as verifyAgentCandidateWorkspaceArchive, gt as resourceTelemetry, ht as assertResources, it as randomUuid, kt as teardownSurfaces, lt as throwIfAborted, mt as addResourceSpend, nt as promptCacheTokenClasses, o as readAgentCandidateWorkspaceArtifactFiles, ot as sleep, pt as zeroTokenUsage, q as cloneSpend, rt as randomSuffix, s as verifyAgentCandidateWorkspaceArtifacts, st as stringifySafe, t as assertSandboxProfileCompatibility, tt as mapWithConcurrency, ut as unmeteredSpend, vt as ACCEPTED_RESULT_GRACE_MS, wt as boundedChildDeadlineAt, yt as CHILD_DEADLINE_REASON } from "./sandbox-profile-compat-DRr3JwDx.js";
|
|
5
5
|
import { runTaskQueue } from "./task-queue.js";
|
|
6
6
|
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-CyCUwHed.js";
|
|
7
7
|
import { t as sha256 } from "./content-digest-sBTLujlK.js";
|
|
8
8
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
9
|
-
import { a as readCommittedJsonLines, n as isNoEntError, t as appendCommittedJsonLine } from "./jsonl-file-
|
|
9
|
+
import { a as readCommittedJsonLines, n as isNoEntError, t as appendCommittedJsonLine } from "./jsonl-file-C9Kde_0Z.js";
|
|
10
10
|
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";
|
|
11
11
|
import { isToolSpan, toolSpansToTraceAnalysisStore } from "@tangle-network/agent-eval";
|
|
12
12
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
@@ -2886,6 +2886,8 @@ function cappedDoublingMs(consecutive, first, ceiling) {
|
|
|
2886
2886
|
const start = Math.max(0, first);
|
|
2887
2887
|
return Math.min(Math.max(start, ceiling), start * 2 ** Math.max(0, consecutive - 1));
|
|
2888
2888
|
}
|
|
2889
|
+
/** The longest hold a refusal's own reset time may ask for: a 5-hour plan window plus a margin. */
|
|
2890
|
+
const MAX_RESET_HOLD_MS = 360 * 6e4;
|
|
2889
2891
|
/** How often a refusal whose reset is beyond {@link MAX_RESET_HOLD_MS} is probed again. */
|
|
2890
2892
|
const FAR_RESET_PROBE_MS = 60 * 6e4;
|
|
2891
2893
|
/**
|
|
@@ -2907,7 +2909,7 @@ function unavailableResumeAt(text, nowMs) {
|
|
|
2907
2909
|
if (zone === void 0) return void 0;
|
|
2908
2910
|
const at = Date.parse(`${match[1]}T${match[2]}${zone.length === 5 ? `${zone.slice(0, 3)}:${zone.slice(3)}` : zone}`);
|
|
2909
2911
|
if (!Number.isFinite(at) || at <= nowMs) return void 0;
|
|
2910
|
-
return at - nowMs >
|
|
2912
|
+
return at - nowMs > MAX_RESET_HOLD_MS ? nowMs + FAR_RESET_PROBE_MS : at;
|
|
2911
2913
|
}
|
|
2912
2914
|
/**
|
|
2913
2915
|
* Spread a wait over `[ms / 2, ms]`. Every driver a Platform restart cut off fails within the same
|
|
@@ -3937,18 +3939,11 @@ const sandboxActProfileMaterialization = defineProfileMaterializationContract({
|
|
|
3937
3939
|
name: "createSandboxAct",
|
|
3938
3940
|
axes: sandboxProfileMaterialization.axes
|
|
3939
3941
|
});
|
|
3940
|
-
|
|
3941
|
-
const promptOnlyProfileMaterialization = defineProfileMaterializationContract({
|
|
3942
|
+
defineProfileMaterializationContract({
|
|
3942
3943
|
name: "prompt-only-message",
|
|
3943
3944
|
axes: ["systemPrompt", "instructions"]
|
|
3944
3945
|
});
|
|
3945
|
-
|
|
3946
|
-
* Materialization contract for a run path that injects prompt text plus inline resources.
|
|
3947
|
-
*
|
|
3948
|
-
* `resourceFailOnError` is absent: it is a resolution POLICY the attaching path would have to
|
|
3949
|
-
* enforce, and inlining resource content does not carry it.
|
|
3950
|
-
*/
|
|
3951
|
-
const promptResourceProfileMaterialization = defineProfileMaterializationContract({
|
|
3946
|
+
defineProfileMaterializationContract({
|
|
3952
3947
|
name: "prompt-resource-attachment",
|
|
3953
3948
|
axes: [
|
|
3954
3949
|
"systemPrompt",
|
|
@@ -4289,15 +4284,6 @@ const HARNESS_INVOCATIONS = {
|
|
|
4289
4284
|
/** Every local harness, in table order — the one list `AGENT_RUNTIME_LOCAL_HARNESSES` and any
|
|
4290
4285
|
* other harness enumeration reads, so adding a row above is the only edit a new harness needs. */
|
|
4291
4286
|
const LOCAL_HARNESSES = Object.keys(HARNESS_INVOCATIONS);
|
|
4292
|
-
/** The harness a caller gets when it expresses no preference. A composition-root default, not a
|
|
4293
|
-
* capability claim: one constant so the several entry points cannot drift apart. */
|
|
4294
|
-
const DEFAULT_LOCAL_HARNESS = "claude-code";
|
|
4295
|
-
/** The CLI binary a harness id runs. The two are NOT the same string (`claude-code` runs `claude`),
|
|
4296
|
-
* so anything spawning a harness — a version probe, a login check — reads it from here rather than
|
|
4297
|
-
* passing the harness id as a command. */
|
|
4298
|
-
function localHarnessExecutable(harness) {
|
|
4299
|
-
return HARNESS_INVOCATIONS[harness].command;
|
|
4300
|
-
}
|
|
4301
4287
|
/**
|
|
4302
4288
|
* Whether the harness's native control can express this reasoning effort. Admission checks read
|
|
4303
4289
|
* this so a profile the invocation would later refuse is rejected BEFORE any workspace state is
|
|
@@ -6388,62 +6374,6 @@ function createPushTraceSource(opts = {}) {
|
|
|
6388
6374
|
}
|
|
6389
6375
|
};
|
|
6390
6376
|
}
|
|
6391
|
-
/** A source backed by harness message PARTS (sandbox session, cli-bridge). `collect` reads the full
|
|
6392
|
-
* part list and decodes the tool calls; `subscribe`, when given, streams parts live for online
|
|
6393
|
-
* detection. The caller supplies how to get parts (e.g. `box.session(id).messages()` flat-mapped to
|
|
6394
|
-
* parts) — keeping this module free of any substrate SDK. */
|
|
6395
|
-
function createPartsTraceSource(opts) {
|
|
6396
|
-
const runId = opts.runId ?? `parts-${runSeq++}`;
|
|
6397
|
-
const now = opts.now ?? Date.now;
|
|
6398
|
-
const decode = opts.decode ?? ((part) => decodeToolPart(part, opts.harness));
|
|
6399
|
-
const subs = /* @__PURE__ */ new Set();
|
|
6400
|
-
const seenLive = /* @__PURE__ */ new Set();
|
|
6401
|
-
let liveSeq = 0;
|
|
6402
|
-
let unsub;
|
|
6403
|
-
const startLive = () => {
|
|
6404
|
-
if (unsub || !opts.subscribeParts) return;
|
|
6405
|
-
unsub = opts.subscribeParts((part) => {
|
|
6406
|
-
const step = decode(part);
|
|
6407
|
-
if (!step) return;
|
|
6408
|
-
if (step.callId) {
|
|
6409
|
-
if (seenLive.has(step.callId)) return;
|
|
6410
|
-
seenLive.add(step.callId);
|
|
6411
|
-
}
|
|
6412
|
-
const span = toToolSpan(step, runId, liveSeq++, now());
|
|
6413
|
-
for (const fn of subs) try {
|
|
6414
|
-
fn(span);
|
|
6415
|
-
} catch {}
|
|
6416
|
-
});
|
|
6417
|
-
};
|
|
6418
|
-
return {
|
|
6419
|
-
onSpan(handler) {
|
|
6420
|
-
subs.add(handler);
|
|
6421
|
-
startLive();
|
|
6422
|
-
return () => {
|
|
6423
|
-
subs.delete(handler);
|
|
6424
|
-
if (subs.size === 0 && unsub) {
|
|
6425
|
-
unsub();
|
|
6426
|
-
unsub = void 0;
|
|
6427
|
-
}
|
|
6428
|
-
};
|
|
6429
|
-
},
|
|
6430
|
-
async collect() {
|
|
6431
|
-
const parts = await opts.collectParts();
|
|
6432
|
-
const spans = [];
|
|
6433
|
-
const seen = /* @__PURE__ */ new Set();
|
|
6434
|
-
for (const part of parts) {
|
|
6435
|
-
const step = decode(part);
|
|
6436
|
-
if (!step) continue;
|
|
6437
|
-
if (step.callId) {
|
|
6438
|
-
if (seen.has(step.callId)) continue;
|
|
6439
|
-
seen.add(step.callId);
|
|
6440
|
-
}
|
|
6441
|
-
spans.push(toToolSpan(step, runId, spans.length, now()));
|
|
6442
|
-
}
|
|
6443
|
-
return spans;
|
|
6444
|
-
}
|
|
6445
|
-
};
|
|
6446
|
-
}
|
|
6447
6377
|
/**
|
|
6448
6378
|
* Decode one part a BOX published. A box publishes every harness's tool calls in the canonical
|
|
6449
6379
|
* `ToolPart` shape (the sandbox normalizes them), so that decoder runs first for any harness; the
|
|
@@ -6456,23 +6386,6 @@ function decodeBoxPart(part, harness) {
|
|
|
6456
6386
|
if (!p) return void 0;
|
|
6457
6387
|
return decodeOpencodePart(p) ?? decodeToolPart(part, harness);
|
|
6458
6388
|
}
|
|
6459
|
-
/** The SANDBOX / fleet trace source: read a box session's message parts and decode the harness's tool
|
|
6460
|
-
* calls into spans. `collect` (settle) is the solid path — `box.messages({sessionId})` → parts → spans;
|
|
6461
|
-
* black-box harnesses aren't mid-step interruptible, so online steering is the owned-loop's job and a
|
|
6462
|
-
* live `subscribe` is opt-in (pass `subscribeParts` from `streamPrompt` when the harness streams parts). */
|
|
6463
|
-
function sandboxSessionTraceSource(box, sessionId, opts = {}) {
|
|
6464
|
-
const decode = (part) => decodeBoxPart(part, opts.harness);
|
|
6465
|
-
return createPartsTraceSource({
|
|
6466
|
-
collectParts: async () => {
|
|
6467
|
-
return (await box.messages({ sessionId })).flatMap((m) => m.parts ? [...m.parts] : []);
|
|
6468
|
-
},
|
|
6469
|
-
...opts.harness ? { harness: opts.harness } : {},
|
|
6470
|
-
decode,
|
|
6471
|
-
...opts.subscribeParts ? { subscribeParts: opts.subscribeParts } : {},
|
|
6472
|
-
runId: opts.runId ?? `box-${sessionId}`,
|
|
6473
|
-
...opts.now ? { now: opts.now } : {}
|
|
6474
|
-
});
|
|
6475
|
-
}
|
|
6476
6389
|
//#endregion
|
|
6477
6390
|
//#region src/runtime/supervise/bridge-protocol.ts
|
|
6478
6391
|
/** Decode Bridge stream and materialization receipts without owning transport or executor state. */
|
|
@@ -8512,7 +8425,8 @@ function isFiniteNumber(value) {
|
|
|
8512
8425
|
* and ranks versions. A check that could not run gives no verdict ({@link CheckUnavailableError}),
|
|
8513
8426
|
* and the loop pauses instead of blaming the director.
|
|
8514
8427
|
* - ONE RESEND RULE. {@link ContinuationPolicy} is required for a manager with a check. It holds a
|
|
8515
|
-
* deadline and `maxBarren`, the re-entered turns in a row that may end without progress
|
|
8428
|
+
* deadline and `maxBarren`, the re-entered turns in a row that may end without progress before
|
|
8429
|
+
* each further continuation waits a barren pause. There
|
|
8516
8430
|
* is no re-prompt count and no default: a retry default in source is a research decision.
|
|
8517
8431
|
* - ONE NOTE. {@link composeContinuationNote} writes it. Runtime owns the facts and their order;
|
|
8518
8432
|
* the {@link ContinuationProfile} owns every instruction word, so an optimizer can change the
|
|
@@ -11553,7 +11467,7 @@ function toOpenInferenceLine(span) {
|
|
|
11553
11467
|
* `maxQueueSize`. Every span ends in exactly one of `written` or `dropped`: a non-2xx response, a
|
|
11554
11468
|
* network error, a timeout, an OTLP `partialSuccess.rejectedSpans` count and a full queue each count
|
|
11555
11469
|
* as drops and set `lastError`. Nothing here throws into the caller's run; `flush()` reports the
|
|
11556
|
-
* loss, the same rule
|
|
11470
|
+
* loss, the same rule `createOpenInferenceFileExporter` follows.
|
|
11557
11471
|
*/
|
|
11558
11472
|
function createOtelExporter(config) {
|
|
11559
11473
|
const resolvedEndpoint = config?.endpoint ?? (typeof process !== "undefined" ? process.env.OTEL_EXPORTER_OTLP_ENDPOINT : void 0);
|
|
@@ -13264,172 +13178,6 @@ const cliInPlaceExecutor = (spec, ctx) => {
|
|
|
13264
13178
|
});
|
|
13265
13179
|
};
|
|
13266
13180
|
//#endregion
|
|
13267
|
-
//#region src/runtime/supervise/cli-process-executor.ts
|
|
13268
|
-
/**
|
|
13269
|
-
* Spawns a subprocess (`bin` + `args`). It cannot account tokens, so it is
|
|
13270
|
-
* `budgetExempt: true`: it remains usable as a direct executor, while budgeted supervision
|
|
13271
|
-
* refuses it before process execution because the CLI exposes no usage receipt. teardown is SIGTERM → SIGKILL
|
|
13272
|
-
* with a grace window. Streaming: yields one `iteration` event on clean exit.
|
|
13273
|
-
*
|
|
13274
|
-
* Its terminal spend is `unmeteredSpend`, NOT a zero: an unmetered runtime that reports a plain
|
|
13275
|
-
* `0` is indistinguishable from one that measured zero, and every ceiling downstream then reads
|
|
13276
|
-
* as enforced while enforcing nothing.
|
|
13277
|
-
*/
|
|
13278
|
-
const cliExecutor = (spec, ctx) => {
|
|
13279
|
-
const seam = readSeam(ctx, "cli", "cli");
|
|
13280
|
-
if (!seam.bin) throw new ValidationError$1("cliExecutor: CliSeam.bin required");
|
|
13281
|
-
const traceEnv = {
|
|
13282
|
-
...workerLineage({
|
|
13283
|
-
harness: seam.bin,
|
|
13284
|
-
nodeId: ctx.node?.nodeId,
|
|
13285
|
-
label: spec.profile.name,
|
|
13286
|
-
local: true
|
|
13287
|
-
}).env,
|
|
13288
|
-
...workerTraceEnv(ctx)
|
|
13289
|
-
};
|
|
13290
|
-
const controller = linkAbort(ctx.signal);
|
|
13291
|
-
let proc;
|
|
13292
|
-
let artifact;
|
|
13293
|
-
const executionId = ctx.node?.nodeId ?? `cli-process-${randomUUID()}`;
|
|
13294
|
-
const attemptId = ctx.node?.attemptId ?? newExecutionAttemptId(executionId);
|
|
13295
|
-
return attestRuntimeOwnedExecutor({
|
|
13296
|
-
runtime: "cli",
|
|
13297
|
-
budgetExempt: true,
|
|
13298
|
-
execute(task, signal) {
|
|
13299
|
-
return streamCliLeaf({
|
|
13300
|
-
task,
|
|
13301
|
-
signal,
|
|
13302
|
-
traceEnv,
|
|
13303
|
-
seam,
|
|
13304
|
-
controller,
|
|
13305
|
-
onProc: (p) => {
|
|
13306
|
-
proc = p;
|
|
13307
|
-
},
|
|
13308
|
-
onArtifact: (a) => {
|
|
13309
|
-
artifact = a;
|
|
13310
|
-
}
|
|
13311
|
-
});
|
|
13312
|
-
},
|
|
13313
|
-
async teardown(grace) {
|
|
13314
|
-
if (!proc) {
|
|
13315
|
-
controller.abort();
|
|
13316
|
-
return { destroyed: true };
|
|
13317
|
-
}
|
|
13318
|
-
const receipt = await killWithGrace(proc, grace);
|
|
13319
|
-
controller.abort();
|
|
13320
|
-
return receipt;
|
|
13321
|
-
},
|
|
13322
|
-
resultArtifact() {
|
|
13323
|
-
if (!artifact) throw new ValidationError$1("cliExecutor: resultArtifact() read before stream drained");
|
|
13324
|
-
return artifact;
|
|
13325
|
-
}
|
|
13326
|
-
}, {
|
|
13327
|
-
effectiveProfile: spec.profile,
|
|
13328
|
-
backend: "cli",
|
|
13329
|
-
model: {
|
|
13330
|
-
status: "unknown",
|
|
13331
|
-
reason: "raw subprocess has no model identity contract"
|
|
13332
|
-
},
|
|
13333
|
-
execution: {
|
|
13334
|
-
kind: "process-attempt",
|
|
13335
|
-
id: executionId
|
|
13336
|
-
},
|
|
13337
|
-
materializer: "raw-cli-stdin",
|
|
13338
|
-
plan: {
|
|
13339
|
-
kind: "raw-cli-process",
|
|
13340
|
-
bin: seam.bin,
|
|
13341
|
-
args: seam.args ?? [],
|
|
13342
|
-
cwd: seam.cwd ?? null,
|
|
13343
|
-
envOverrides: seam.env ?? {},
|
|
13344
|
-
ambientEnvironment: "inherited"
|
|
13345
|
-
}
|
|
13346
|
-
}, {
|
|
13347
|
-
attemptId,
|
|
13348
|
-
binding: {
|
|
13349
|
-
executionId,
|
|
13350
|
-
bin: seam.bin,
|
|
13351
|
-
cwd: seam.cwd ?? null
|
|
13352
|
-
},
|
|
13353
|
-
descriptor: {
|
|
13354
|
-
kind: "cli-process",
|
|
13355
|
-
transport: "process",
|
|
13356
|
-
backend: "cli"
|
|
13357
|
-
}
|
|
13358
|
-
});
|
|
13359
|
-
};
|
|
13360
|
-
async function* streamCliLeaf(args) {
|
|
13361
|
-
const started = Date.now();
|
|
13362
|
-
const prompt = taskToPrompt$1(args.task);
|
|
13363
|
-
const proc = spawn(args.seam.bin, args.seam.args ?? [], {
|
|
13364
|
-
...args.seam.cwd ? { cwd: args.seam.cwd } : {},
|
|
13365
|
-
env: mergeTraceEnv(process.env, args.traceEnv, args.seam.env),
|
|
13366
|
-
stdio: [
|
|
13367
|
-
"pipe",
|
|
13368
|
-
"pipe",
|
|
13369
|
-
"pipe"
|
|
13370
|
-
]
|
|
13371
|
-
});
|
|
13372
|
-
args.onProc(proc);
|
|
13373
|
-
const onAbort = () => killWithGrace(proc, "brutalKill");
|
|
13374
|
-
if (args.signal.aborted || args.controller.signal.aborted) onAbort();
|
|
13375
|
-
else {
|
|
13376
|
-
args.signal.addEventListener("abort", onAbort, { once: true });
|
|
13377
|
-
args.controller.signal.addEventListener("abort", onAbort, { once: true });
|
|
13378
|
-
}
|
|
13379
|
-
let deliveryError;
|
|
13380
|
-
if (proc.stdin) {
|
|
13381
|
-
proc.stdin.on("error", (error) => {
|
|
13382
|
-
if (error.code !== "EPIPE") deliveryError ??= error;
|
|
13383
|
-
});
|
|
13384
|
-
proc.stdin.write(prompt);
|
|
13385
|
-
proc.stdin.end();
|
|
13386
|
-
}
|
|
13387
|
-
const chunks = [];
|
|
13388
|
-
const errChunks = [];
|
|
13389
|
-
if (proc.stdout) proc.stdout.on("data", (d) => chunks.push(d.toString("utf8")));
|
|
13390
|
-
if (proc.stderr) proc.stderr.on("data", (d) => errChunks.push(d.toString("utf8")));
|
|
13391
|
-
const exit = await new Promise((resolve) => {
|
|
13392
|
-
proc.once("error", (err) => resolve({
|
|
13393
|
-
code: null,
|
|
13394
|
-
error: err
|
|
13395
|
-
}));
|
|
13396
|
-
proc.once("close", (code) => resolve({ code }));
|
|
13397
|
-
});
|
|
13398
|
-
args.signal.removeEventListener("abort", onAbort);
|
|
13399
|
-
args.controller.signal.removeEventListener("abort", onAbort);
|
|
13400
|
-
if (exit.error) throw new ValidationError$1(`cliExecutor: spawn failed: ${exit.error.message}`, { cause: exit.error });
|
|
13401
|
-
if (exit.code !== 0) throw new ValidationError$1(`cliExecutor: ${args.seam.bin} exited ${exit.code}: ${errChunks.join("").slice(0, 200)}`);
|
|
13402
|
-
if (deliveryError) throw new ValidationError$1(`cliExecutor: could not deliver the task to ${args.seam.bin}: ${deliveryError.message}`, { cause: deliveryError });
|
|
13403
|
-
const out = { content: chunks.join("") };
|
|
13404
|
-
args.onArtifact({
|
|
13405
|
-
outRef: contentRef("cli", out),
|
|
13406
|
-
out,
|
|
13407
|
-
spent: unmeteredSpend(Date.now() - started)
|
|
13408
|
-
});
|
|
13409
|
-
yield { kind: "iteration" };
|
|
13410
|
-
}
|
|
13411
|
-
/** SIGTERM, then SIGKILL after `grace` ms (`'brutalKill'` = immediate SIGKILL,
|
|
13412
|
-
* `'infinity'` = await clean exit, never escalate). */
|
|
13413
|
-
function killWithGrace(proc, grace) {
|
|
13414
|
-
if (proc.pid === void 0 || proc.exitCode !== null || proc.signalCode !== null) return Promise.resolve({ destroyed: true });
|
|
13415
|
-
return new Promise((resolve) => {
|
|
13416
|
-
let clearTimer;
|
|
13417
|
-
proc.once("close", () => {
|
|
13418
|
-
clearTimer?.();
|
|
13419
|
-
resolve({ destroyed: true });
|
|
13420
|
-
});
|
|
13421
|
-
if (grace === "brutalKill") {
|
|
13422
|
-
proc.kill("SIGKILL");
|
|
13423
|
-
return;
|
|
13424
|
-
}
|
|
13425
|
-
proc.kill("SIGTERM");
|
|
13426
|
-
if (grace === "infinity") return;
|
|
13427
|
-
clearTimer = armDeadlineTimer(grace, () => {
|
|
13428
|
-
if (proc.exitCode === null && proc.signalCode === null) proc.kill("SIGKILL");
|
|
13429
|
-
}, true);
|
|
13430
|
-
});
|
|
13431
|
-
}
|
|
13432
|
-
//#endregion
|
|
13433
13181
|
//#region src/runtime/provider-placement.ts
|
|
13434
13182
|
const placementMetadataKey = "runtimeProviderPlacement";
|
|
13435
13183
|
/** Select exactly one declaration before any provider effects. Shared defaults carry infrastructure only. */
|
|
@@ -14505,6 +14253,8 @@ function normalizeWorkerSlotBound(value) {
|
|
|
14505
14253
|
if (!Number.isSafeInteger(value)) throw new ValidationError$1(`workerSlots must be a positive safe integer, or 0 or less for no bound, got ${String(value)}`);
|
|
14506
14254
|
return value;
|
|
14507
14255
|
}
|
|
14256
|
+
/** Default {@link ProviderWorkspaceRetentionPort.nativeTimeoutMs}. */
|
|
14257
|
+
const DEFAULT_NATIVE_CAPTURE_TIMEOUT_MS = 12e4;
|
|
14508
14258
|
/** At most this many stage entries are kept from a port, each a finite, non-negative number. */
|
|
14509
14259
|
const MAX_CAPTURE_STAGES = 16;
|
|
14510
14260
|
function captureStages(value) {
|
|
@@ -14744,7 +14494,7 @@ async function captureProviderWorkspaceSnapshot(port, context, scope = "environm
|
|
|
14744
14494
|
async function captureWithinSlot(port, context, scope, onGranted, parent) {
|
|
14745
14495
|
const native = scope === "native";
|
|
14746
14496
|
if (native && port.captureNative === void 0) throw new ValidationError$1("provider workspace retention: the port has no captureNative");
|
|
14747
|
-
const timeoutMs = native ? port.nativeTimeoutMs ??
|
|
14497
|
+
const timeoutMs = native ? port.nativeTimeoutMs ?? DEFAULT_NATIVE_CAPTURE_TIMEOUT_MS : port.timeoutMs;
|
|
14748
14498
|
const controlRef = context.controlRef === void 0 ? void 0 : AgentExactRunControlRefSchema.parse(context.controlRef);
|
|
14749
14499
|
if (controlRef !== void 0 && (controlRef.environmentId !== context.environment.id || controlRef.provider !== context.environment.provider || context.providerSessionId != null && controlRef.sessionId !== context.providerSessionId)) throw new Error("provider workspace retention control reference names another environment or session");
|
|
14750
14500
|
const controller = new AbortController();
|
|
@@ -18667,6 +18417,172 @@ function resolveAgentEnvironmentProvider(provider, registry) {
|
|
|
18667
18417
|
return registry.require(provider);
|
|
18668
18418
|
}
|
|
18669
18419
|
//#endregion
|
|
18420
|
+
//#region src/runtime/supervise/cli-process-executor.ts
|
|
18421
|
+
/**
|
|
18422
|
+
* Spawns a subprocess (`bin` + `args`). It cannot account tokens, so it is
|
|
18423
|
+
* `budgetExempt: true`: it remains usable as a direct executor, while budgeted supervision
|
|
18424
|
+
* refuses it before process execution because the CLI exposes no usage receipt. teardown is SIGTERM → SIGKILL
|
|
18425
|
+
* with a grace window. Streaming: yields one `iteration` event on clean exit.
|
|
18426
|
+
*
|
|
18427
|
+
* Its terminal spend is `unmeteredSpend`, NOT a zero: an unmetered runtime that reports a plain
|
|
18428
|
+
* `0` is indistinguishable from one that measured zero, and every ceiling downstream then reads
|
|
18429
|
+
* as enforced while enforcing nothing.
|
|
18430
|
+
*/
|
|
18431
|
+
const cliExecutor = (spec, ctx) => {
|
|
18432
|
+
const seam = readSeam(ctx, "cli", "cli");
|
|
18433
|
+
if (!seam.bin) throw new ValidationError$1("cliExecutor: CliSeam.bin required");
|
|
18434
|
+
const traceEnv = {
|
|
18435
|
+
...workerLineage({
|
|
18436
|
+
harness: seam.bin,
|
|
18437
|
+
nodeId: ctx.node?.nodeId,
|
|
18438
|
+
label: spec.profile.name,
|
|
18439
|
+
local: true
|
|
18440
|
+
}).env,
|
|
18441
|
+
...workerTraceEnv(ctx)
|
|
18442
|
+
};
|
|
18443
|
+
const controller = linkAbort(ctx.signal);
|
|
18444
|
+
let proc;
|
|
18445
|
+
let artifact;
|
|
18446
|
+
const executionId = ctx.node?.nodeId ?? `cli-process-${randomUUID()}`;
|
|
18447
|
+
const attemptId = ctx.node?.attemptId ?? newExecutionAttemptId(executionId);
|
|
18448
|
+
return attestRuntimeOwnedExecutor({
|
|
18449
|
+
runtime: "cli",
|
|
18450
|
+
budgetExempt: true,
|
|
18451
|
+
execute(task, signal) {
|
|
18452
|
+
return streamCliLeaf({
|
|
18453
|
+
task,
|
|
18454
|
+
signal,
|
|
18455
|
+
traceEnv,
|
|
18456
|
+
seam,
|
|
18457
|
+
controller,
|
|
18458
|
+
onProc: (p) => {
|
|
18459
|
+
proc = p;
|
|
18460
|
+
},
|
|
18461
|
+
onArtifact: (a) => {
|
|
18462
|
+
artifact = a;
|
|
18463
|
+
}
|
|
18464
|
+
});
|
|
18465
|
+
},
|
|
18466
|
+
async teardown(grace) {
|
|
18467
|
+
if (!proc) {
|
|
18468
|
+
controller.abort();
|
|
18469
|
+
return { destroyed: true };
|
|
18470
|
+
}
|
|
18471
|
+
const receipt = await killWithGrace(proc, grace);
|
|
18472
|
+
controller.abort();
|
|
18473
|
+
return receipt;
|
|
18474
|
+
},
|
|
18475
|
+
resultArtifact() {
|
|
18476
|
+
if (!artifact) throw new ValidationError$1("cliExecutor: resultArtifact() read before stream drained");
|
|
18477
|
+
return artifact;
|
|
18478
|
+
}
|
|
18479
|
+
}, {
|
|
18480
|
+
effectiveProfile: spec.profile,
|
|
18481
|
+
backend: "cli",
|
|
18482
|
+
model: {
|
|
18483
|
+
status: "unknown",
|
|
18484
|
+
reason: "raw subprocess has no model identity contract"
|
|
18485
|
+
},
|
|
18486
|
+
execution: {
|
|
18487
|
+
kind: "process-attempt",
|
|
18488
|
+
id: executionId
|
|
18489
|
+
},
|
|
18490
|
+
materializer: "raw-cli-stdin",
|
|
18491
|
+
plan: {
|
|
18492
|
+
kind: "raw-cli-process",
|
|
18493
|
+
bin: seam.bin,
|
|
18494
|
+
args: seam.args ?? [],
|
|
18495
|
+
cwd: seam.cwd ?? null,
|
|
18496
|
+
envOverrides: seam.env ?? {},
|
|
18497
|
+
ambientEnvironment: "inherited"
|
|
18498
|
+
}
|
|
18499
|
+
}, {
|
|
18500
|
+
attemptId,
|
|
18501
|
+
binding: {
|
|
18502
|
+
executionId,
|
|
18503
|
+
bin: seam.bin,
|
|
18504
|
+
cwd: seam.cwd ?? null
|
|
18505
|
+
},
|
|
18506
|
+
descriptor: {
|
|
18507
|
+
kind: "cli-process",
|
|
18508
|
+
transport: "process",
|
|
18509
|
+
backend: "cli"
|
|
18510
|
+
}
|
|
18511
|
+
});
|
|
18512
|
+
};
|
|
18513
|
+
async function* streamCliLeaf(args) {
|
|
18514
|
+
const started = Date.now();
|
|
18515
|
+
const prompt = taskToPrompt$1(args.task);
|
|
18516
|
+
const proc = spawn(args.seam.bin, args.seam.args ?? [], {
|
|
18517
|
+
...args.seam.cwd ? { cwd: args.seam.cwd } : {},
|
|
18518
|
+
env: mergeTraceEnv(process.env, args.traceEnv, args.seam.env),
|
|
18519
|
+
stdio: [
|
|
18520
|
+
"pipe",
|
|
18521
|
+
"pipe",
|
|
18522
|
+
"pipe"
|
|
18523
|
+
]
|
|
18524
|
+
});
|
|
18525
|
+
args.onProc(proc);
|
|
18526
|
+
const onAbort = () => killWithGrace(proc, "brutalKill");
|
|
18527
|
+
if (args.signal.aborted || args.controller.signal.aborted) onAbort();
|
|
18528
|
+
else {
|
|
18529
|
+
args.signal.addEventListener("abort", onAbort, { once: true });
|
|
18530
|
+
args.controller.signal.addEventListener("abort", onAbort, { once: true });
|
|
18531
|
+
}
|
|
18532
|
+
let deliveryError;
|
|
18533
|
+
if (proc.stdin) {
|
|
18534
|
+
proc.stdin.on("error", (error) => {
|
|
18535
|
+
if (error.code !== "EPIPE") deliveryError ??= error;
|
|
18536
|
+
});
|
|
18537
|
+
proc.stdin.write(prompt);
|
|
18538
|
+
proc.stdin.end();
|
|
18539
|
+
}
|
|
18540
|
+
const chunks = [];
|
|
18541
|
+
const errChunks = [];
|
|
18542
|
+
if (proc.stdout) proc.stdout.on("data", (d) => chunks.push(d.toString("utf8")));
|
|
18543
|
+
if (proc.stderr) proc.stderr.on("data", (d) => errChunks.push(d.toString("utf8")));
|
|
18544
|
+
const exit = await new Promise((resolve) => {
|
|
18545
|
+
proc.once("error", (err) => resolve({
|
|
18546
|
+
code: null,
|
|
18547
|
+
error: err
|
|
18548
|
+
}));
|
|
18549
|
+
proc.once("close", (code) => resolve({ code }));
|
|
18550
|
+
});
|
|
18551
|
+
args.signal.removeEventListener("abort", onAbort);
|
|
18552
|
+
args.controller.signal.removeEventListener("abort", onAbort);
|
|
18553
|
+
if (exit.error) throw new ValidationError$1(`cliExecutor: spawn failed: ${exit.error.message}`, { cause: exit.error });
|
|
18554
|
+
if (exit.code !== 0) throw new ValidationError$1(`cliExecutor: ${args.seam.bin} exited ${exit.code}: ${errChunks.join("").slice(0, 200)}`);
|
|
18555
|
+
if (deliveryError) throw new ValidationError$1(`cliExecutor: could not deliver the task to ${args.seam.bin}: ${deliveryError.message}`, { cause: deliveryError });
|
|
18556
|
+
const out = { content: chunks.join("") };
|
|
18557
|
+
args.onArtifact({
|
|
18558
|
+
outRef: contentRef("cli", out),
|
|
18559
|
+
out,
|
|
18560
|
+
spent: unmeteredSpend(Date.now() - started)
|
|
18561
|
+
});
|
|
18562
|
+
yield { kind: "iteration" };
|
|
18563
|
+
}
|
|
18564
|
+
/** SIGTERM, then SIGKILL after `grace` ms (`'brutalKill'` = immediate SIGKILL,
|
|
18565
|
+
* `'infinity'` = await clean exit, never escalate). */
|
|
18566
|
+
function killWithGrace(proc, grace) {
|
|
18567
|
+
if (proc.pid === void 0 || proc.exitCode !== null || proc.signalCode !== null) return Promise.resolve({ destroyed: true });
|
|
18568
|
+
return new Promise((resolve) => {
|
|
18569
|
+
let clearTimer;
|
|
18570
|
+
proc.once("close", () => {
|
|
18571
|
+
clearTimer?.();
|
|
18572
|
+
resolve({ destroyed: true });
|
|
18573
|
+
});
|
|
18574
|
+
if (grace === "brutalKill") {
|
|
18575
|
+
proc.kill("SIGKILL");
|
|
18576
|
+
return;
|
|
18577
|
+
}
|
|
18578
|
+
proc.kill("SIGTERM");
|
|
18579
|
+
if (grace === "infinity") return;
|
|
18580
|
+
clearTimer = armDeadlineTimer(grace, () => {
|
|
18581
|
+
if (proc.exitCode === null && proc.signalCode === null) proc.kill("SIGKILL");
|
|
18582
|
+
}, true);
|
|
18583
|
+
});
|
|
18584
|
+
}
|
|
18585
|
+
//#endregion
|
|
18670
18586
|
//#region src/runtime/router-http-transport.ts
|
|
18671
18587
|
/** Router HTTP attempts, response evidence, retries, and request cancellation. */
|
|
18672
18588
|
function routerRequestHeaders(cfg, opts) {
|
|
@@ -19766,7 +19682,7 @@ function forTurnEvent(message) {
|
|
|
19766
19682
|
const content = message.content;
|
|
19767
19683
|
if (typeof content !== "string") return message;
|
|
19768
19684
|
const bytes = Buffer.byteLength(content);
|
|
19769
|
-
if (bytes <=
|
|
19685
|
+
if (bytes <= TURN_CONTENT_BYTES) return message;
|
|
19770
19686
|
return {
|
|
19771
19687
|
...message,
|
|
19772
19688
|
content: Buffer.from(content).subarray(0, TURN_CONTENT_BYTES).toString("utf8"),
|
|
@@ -23343,6 +23259,7 @@ const outsideKinds = /* @__PURE__ */ new Set([
|
|
|
23343
23259
|
"root-segment",
|
|
23344
23260
|
"root-reentered",
|
|
23345
23261
|
"paused",
|
|
23262
|
+
"barren-pause",
|
|
23346
23263
|
"driver-attempt",
|
|
23347
23264
|
"node-inputs-resolved",
|
|
23348
23265
|
"edge-verdict",
|
|
@@ -25444,6 +25361,7 @@ async function retireSeatEnvironment(scope, state) {
|
|
|
25444
25361
|
/** Runtime-owned provider evidence is written through this private scope capability. */
|
|
25445
25362
|
const runtimeOwnedProviderMeters = /* @__PURE__ */ new WeakMap();
|
|
25446
25363
|
const pauseRecorders = /* @__PURE__ */ new WeakMap();
|
|
25364
|
+
const barrenPauseRecorders = /* @__PURE__ */ new WeakMap();
|
|
25447
25365
|
const driverAttemptRecorders = /* @__PURE__ */ new WeakMap();
|
|
25448
25366
|
const recoveryStarters = /* @__PURE__ */ new WeakMap();
|
|
25449
25367
|
const retainedReleasers = /* @__PURE__ */ new WeakMap();
|
|
@@ -25468,8 +25386,6 @@ const admissionSeals = /* @__PURE__ */ new WeakMap();
|
|
|
25468
25386
|
const subtreeReaders = /* @__PURE__ */ new WeakMap();
|
|
25469
25387
|
/** Each scope's reader of its live team, for the progress its owner's lead reads mid-flight. */
|
|
25470
25388
|
const liveTeamReaders = /* @__PURE__ */ new WeakMap();
|
|
25471
|
-
/** How many of a manager's direct children its summary lists; the counts always cover all. */
|
|
25472
|
-
const SUBTREE_RESULT_LIMIT = 8;
|
|
25473
25389
|
/** @internal The bounded account of the children a scope spawned and everything below them.
|
|
25474
25390
|
* `undefined` when the scope spawned no worker. */
|
|
25475
25391
|
function subtreeSummaryOf(scope) {
|
|
@@ -25514,9 +25430,6 @@ function unconfirmedTeardownOf(child, releasing) {
|
|
|
25514
25430
|
...child.teardownDetail === void 0 ? {} : { detail: child.teardownDetail }
|
|
25515
25431
|
});
|
|
25516
25432
|
}
|
|
25517
|
-
/** Ten minutes: a manager that is alive decides within a turn or two; one that crashed, or a host
|
|
25518
|
-
* that restarted, must not leave a paid environment running until a retire pass finds it. */
|
|
25519
|
-
const DEFAULT_BUDGET_STOP_HOLD_MS = 6e5;
|
|
25520
25433
|
/**
|
|
25521
25434
|
* @internal Release every environment this scope's settled children still hold after a budget
|
|
25522
25435
|
* stop, at the join barrier: no later spawn of this scope can continue them. Each release journals
|
|
@@ -25689,6 +25602,15 @@ function recordScopeOwnerPause(scope, pause) {
|
|
|
25689
25602
|
if (record === void 0) throw new ValidationError$1("scope: pause recorder is not bound to this scope");
|
|
25690
25603
|
return record(pause);
|
|
25691
25604
|
}
|
|
25605
|
+
/**
|
|
25606
|
+
* @internal Journal that this scope's owner paused before a continuation because its barren
|
|
25607
|
+
* streak reached `continuation.maxBarren`. Recorded against the owner node.
|
|
25608
|
+
*/
|
|
25609
|
+
function recordScopeOwnerBarrenPause(scope, pause) {
|
|
25610
|
+
const record = barrenPauseRecorders.get(scope);
|
|
25611
|
+
if (record === void 0) throw new ValidationError$1("scope: barren pause recorder is not bound to this scope");
|
|
25612
|
+
return record(pause);
|
|
25613
|
+
}
|
|
25692
25614
|
/** @internal Persist the owner's driver outcome even after its scope has been aborted. */
|
|
25693
25615
|
function recordScopeOwnerDriverAttempt(scope, attempt) {
|
|
25694
25616
|
const record = driverAttemptRecorders.get(scope);
|
|
@@ -27969,20 +27891,6 @@ function overBudget(budget, spent) {
|
|
|
27969
27891
|
* here so the scope and the driver-executor agree on the seam without a circular import.
|
|
27970
27892
|
*/
|
|
27971
27893
|
const nestedScopeSeamKey = "nested-scope";
|
|
27972
|
-
//#endregion
|
|
27973
|
-
//#region src/runtime/supervise/trace-evidence.ts
|
|
27974
|
-
/**
|
|
27975
|
-
* Durable structured tool evidence for supervised workers.
|
|
27976
|
-
*
|
|
27977
|
-
* The executor-owned `TraceSource` is collected before teardown, snapshotted into the shared
|
|
27978
|
-
* content-addressed blob store, and only then referenced by a settlement. Analysis reconstructs
|
|
27979
|
-
* agent-eval's bounded `TraceAnalysisStore` from those exact bytes. Worker output is never accepted
|
|
27980
|
-
* as a substitute for tool evidence.
|
|
27981
|
-
*
|
|
27982
|
-
* @experimental
|
|
27983
|
-
*/
|
|
27984
|
-
/** Schema version for content-addressed worker tool-trace artifacts. */
|
|
27985
|
-
const WORKER_TOOL_TRACE_SCHEMA_VERSION = 1;
|
|
27986
27894
|
/** Structural guard for the official bounded trace-analysis read contract. */
|
|
27987
27895
|
function isTraceAnalysisStore(value) {
|
|
27988
27896
|
if (value === null || typeof value !== "object") return false;
|
|
@@ -30089,6 +29997,17 @@ function createScope(args) {
|
|
|
30089
29997
|
at: new Date(now()).toISOString()
|
|
30090
29998
|
});
|
|
30091
29999
|
});
|
|
30000
|
+
let barrenPauseSeq;
|
|
30001
|
+
barrenPauseRecorders.set(scope, async (pause) => {
|
|
30002
|
+
if (barrenPauseSeq === void 0) barrenPauseSeq = (await args.journal.loadTree(args.root) ?? []).filter((event) => event.kind === "barren-pause" && event.id === args.parentId).length;
|
|
30003
|
+
await args.journal.appendEvent(args.root, {
|
|
30004
|
+
kind: "barren-pause",
|
|
30005
|
+
id: args.parentId,
|
|
30006
|
+
...pause,
|
|
30007
|
+
seq: barrenPauseSeq++,
|
|
30008
|
+
at: new Date(now()).toISOString()
|
|
30009
|
+
});
|
|
30010
|
+
});
|
|
30092
30011
|
bindScopeOwnerMaterialization(scope, args, now);
|
|
30093
30012
|
if (args.resumeFrom?.recoveries?.length) recoveryStarters.set(scope, async () => {
|
|
30094
30013
|
const adopted = [];
|
|
@@ -30629,27 +30548,6 @@ function pickBestDelivered(delivered) {
|
|
|
30629
30548
|
* delivered (or the best delivered child carries no artifact). */
|
|
30630
30549
|
const bestDelivered = (ctx) => pickBestDelivered(ctx.delivered)?.out;
|
|
30631
30550
|
/**
|
|
30632
|
-
* Every verified distinct output, highest score first — the shape for competing hypotheses, a
|
|
30633
|
-
* Pareto front, or a recorded evaluator split (three judges 2:1 → both outputs survive, with
|
|
30634
|
-
* provenance, instead of the minority report being erased). Distinct by `outRef` (content
|
|
30635
|
-
* address), so identical outputs collapse to one entry. `undefined` when nothing delivered —
|
|
30636
|
-
* an empty collection is a no-winner, not a winner wrapping `[]`.
|
|
30637
|
-
*/
|
|
30638
|
-
const collectDelivered = (ctx) => {
|
|
30639
|
-
const seen = /* @__PURE__ */ new Set();
|
|
30640
|
-
const distinct = [...ctx.delivered].sort((a, b) => (b.score ?? 0) - (a.score ?? 0)).filter((w) => {
|
|
30641
|
-
if (w.outRef === void 0 || seen.has(w.outRef)) return false;
|
|
30642
|
-
seen.add(w.outRef);
|
|
30643
|
-
return true;
|
|
30644
|
-
}).map((w) => ({
|
|
30645
|
-
id: w.id,
|
|
30646
|
-
score: w.score,
|
|
30647
|
-
outRef: w.outRef,
|
|
30648
|
-
out: w.out
|
|
30649
|
-
}));
|
|
30650
|
-
return distinct.length > 0 ? distinct : void 0;
|
|
30651
|
-
};
|
|
30652
|
-
/**
|
|
30653
30551
|
* Run a finalizer over a settled-worker ledger under the delivered-only invariant: filter the
|
|
30654
30552
|
* ledger to structurally delivered children, materialize their outputs, and hand the finalizer a
|
|
30655
30553
|
* blob reader that throws on any ref outside that set. This is the one call site both driver arms
|
|
@@ -30698,18 +30596,6 @@ async function runFinalizer(finalizer, args) {
|
|
|
30698
30596
|
});
|
|
30699
30597
|
return await accepted(candidate) ? candidate : void 0;
|
|
30700
30598
|
}
|
|
30701
|
-
/** Keep-best finalize under the completion-oracle: return the highest-scoring DELIVERED child's
|
|
30702
|
-
* output (settled `done` AND `valid` — its deliverable check passed). Returns undefined when no
|
|
30703
|
-
* child delivered — an honest "the driver produced nothing", never a high-scoring result that
|
|
30704
|
-
* ran without passing its check (Foreman's 0/18 lesson). `valid` is the single delivery signal,
|
|
30705
|
-
* matching `defaultSelectWinner`'s valid-first rule; the oracle just doesn't fall back to an
|
|
30706
|
-
* unchecked best-effort. The same argmax as the `bestDelivered` finalizer (`pickBestDelivered`);
|
|
30707
|
-
* this direct form serves callers that hold a bare ledger + blob store. */
|
|
30708
|
-
async function finalizeBestDelivered(settled, blobs) {
|
|
30709
|
-
const best = pickBestDelivered(settled.filter((w) => w.status === "done" && w.valid === true));
|
|
30710
|
-
if (best === void 0) return void 0;
|
|
30711
|
-
return best.outRef ? await blobs.get(best.outRef) : void 0;
|
|
30712
|
-
}
|
|
30713
30599
|
//#endregion
|
|
30714
30600
|
//#region src/runtime/supervise/run-persistence.ts
|
|
30715
30601
|
/** One failed store operation revokes this controller's writes, never its retained executions. */
|
|
@@ -31835,6 +31721,6 @@ function createSupervisor() {
|
|
|
31835
31721
|
};
|
|
31836
31722
|
}
|
|
31837
31723
|
//#endregion
|
|
31838
|
-
export {
|
|
31724
|
+
export { noteScopeRetainedOwnerCoordination as $, CONTINUATIONS_DIR as $n, runtimeOwnedExecutorProviderEvidence as $r, createWorktreeCliExecutor as $t, providerVisibleProfile as A, assertValidBudget as Ai, taskToPrompt$1 as An, fullProfileMaterialization as Ar, toolResultText as At, recordScopeOwnerBarrenPause as B, createSandboxUsageLedger as Bi, classifyDriverFailure as Bn, attestRuntimeOwnedScopeOwner as Br, startRetainedRun as Bt, beginScopeOwnerAttempt as C, executorFailure as Ci, DEFAULT_PEER_MAIL_LIMITS as Cn, LOCAL_HARNESSES as Cr, acquireSandbox as Ct, scopeOwnerExecutorNodeContext as D, newUsageTotals as Di, isPeerMailEnvelope as Dn, assertProfileMaterializes as Dr, codeModeModelOutput as Dt, restoreScopeOwnerAcceptedExecution as E, meterUsageEvent as Ei, createPeerMailbox as En, assertProfileMaterialization as Er, codeModeArguments as Et, freeSlots as F, mapSandboxEvent as Fi, isTerminalNodeStatus as Fn, sandboxActProfileMaterialization as Fr, providerAsExecutor as Ft, consumeScopeRetainedOwnerResult as G, awaitAbortable$1 as Gi, SeatChainExhaustedError as Gn, knownExecutionBindingReceipt as Gr, createWorkerSlots as Gt, recordScopeOwnerPause as H, notifySandboxEventObserver as Hi, undispatchedCredentialExit as Hn, authoredProfileDigest as Hr, retainedCreateMaterial as Ht, queueOf as I, mapSandboxToolEvent as Ii, DriverAttemptsExhaustedError as In, sandboxProfileMaterialization as Ir, LEAF_CONTINUATION_TASK as It, scopeRetainedOwnerResult as J, providerMessageText as Ji, subscriptionUsageLimitSignal as Jn, providerAttemptEvidence as Jr, harnessTranscriptArtifact as Jt, prepareScopeRetainedOwnerTask as K, promptFromAgentTurnInput as Ki, authoredSeatStages as Kn, knownMaterializationReceipt as Kr, openSlotGroup as Kt, rollingDispatch as L, terminalTextFromSandboxEvent as Li, HarnessTurnFailedError as Ln, unsupportedProfileDimensions as Lr, providerAsSandboxClient as Lt, settledToIteration as M, defaultRedactorIdentityMaterial as Mi, createActivityLog as Mn, promptControlProfileMaterialization as Mr, routerBrain as Mt, assertRecursiveReservationPolicy as N, resolveRedactor as Ni, readWorkerProgress as Nn, promptModelProfileMaterialization as Nr, createAgentEnvironmentProviderRegistry as Nt, coordinationMcpAlias as O, spendFromUsageEvents as Oi, peerMailTools as On, controlProfileMaterialization as Or, createCodeModeTools as Ot, deriveNodeExecutionIdentity as P, createSandboxToolPartState as Pi, isLiveNodeStatus as Pn, renderUnsupported as Pr, resolveAgentEnvironmentProvider as Pt, scopeRetainedOwnerRestorePoint as Q, verdictFromJudgeScore as Qn, runtimeOwnedExecutorMaterialization as Qr, retainHarnessTranscript as Qt, meterRuntimeOwnedAccounting as R, canonicalStreamEventFromSandboxEvent as Ri, abandonablePending as Rn, worktreeCliProfileMaterialization as Rr, reconnectRetainedRun as Rt, FileSpawnJournal as S, contentAddress as Si, AUTHORITY_MARKERS as Sn, runWorktreeHarness as Sr, createSandboxLineage as St, recordScopeOwnerMaterialization as T, createBudgetPool as Ti, claimsAuthority as Tn, terminateProcessTreeAndConfirm as Tr, defaultSelectWinner as Tt, prepareScopeRetainedOwnerSeatSwitch as U, sumSandboxUsage as Ui, upstreamUnavailableSignal as Un, finalizeRuntimeOwnedPendingExecutor as Ur, destroyInteractiveEnvironment as Ut, recordScopeOwnerDriverAttempt as V, extractLlmCallEvent as Vi, summarizeDriverAttempts as Vn, authoredAgentIdentity as Vr, startRetainedRunInEnvironment as Vt, abandonScopeRetainedOwnerInvocation as W, decodeHarnessUsage as Wi, SeatChain as Wn, inheritRuntimeOwnedExecutorAttestation as Wr, environmentGone as Wt, scopeRetainedOwnerTurnEnded as X, gateOnDeliverable as Xn, runtimeOwnedDriveHarnessProviderEvidence as Xr, readHarnessTranscript as Xt, beginScopeRetainedOwnerDrive as Y, CheckUnavailableError as Yn, recordRuntimeOwnedDriveHarnessProviderEvidence as Yr, persistHarnessTranscript as Yt, reconcileScopeRetainedOwnerEnvironment as Z, mapExecutorResult as Zn, runtimeOwnedExecutorExecutionBinding as Zr, resolveHarnessTranscriptCapture as Zt, attachWorker as _, unavailableSignalOfFailure as _i, sanitizeKnowledgeReadinessReport as _n, runAbortable as _r, createSteerableSandboxSession as _t, runTree as a, executableAgentSpecSnapshot as ai, buildLoopSpanNodes as an, isFiniteNumber as ar, loadSpawnForest as at, recoverRetainedInteractiveRun as b, detachedFrozen as bi, createInbox as bn, bridgeStopSignalKey as br, readPromptOptions as bt, driverExecutorFactory as c, runtimeFailureCause as ci, createOtelExporter as cn, bridgeAdmissionRefusal as cr, InMemorySpawnJournal as ct, createScope as d, registerRetainedExecutorPreparation as di, loopEventToOtelSpan as dn, createCodexRolloutStoreReader as dr, createExecutorRegistry as dt, runtimeOwnedPendingExecutorMaterialization as ei, createInPlaceCliExecutor as en, admitContinuationPolicy as er, bindScopeRetainedOwnerEnvironmentId as et, replaySpawnTree as f, retainedExecutorSeamKey as fi, padSpanId as fn, harnessUsageIsEmpty as fr, bindReusableExecutorExecutionId as ft, interactiveAdmissionSeamKey as g, unavailableResumeAt as gi, createRuntimeStreamEventCollector as gn, linkAbort as gr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as gt, workerTraceAnalysisStore as h, unavailablePauseMs as hi, createRuntimeEventCollector as hn, RunCancellationReason as hr, snapshotExecutorConfig as ht, runFinalizer as i, executableAgentProfileSnapshot as ii, buildLoopOtelSpans as in, failedItems as ir, scopeRetainedOwnerJournalRoot as it, runtimeGraphMetadataKey as j, defaultRedactor as ji, DEFAULT_STALL_AFTER_MS as jn, profileMaterializationAxes$1 as jr, createRouterTranscript as jt, coordinationProfileToolPrefix as k, spendFromUsageTotals as ki, peerMailVerbNames as kn, defineProfileMaterializationContract as kr, runCodeMode as kt, isDriverSpec as l, settlementFailureCause as li, flatOtelSpan as ln, bridgeModelRouteRefusal as lr, FileResultBlobStore as lt, parseWorkerToolTraceArtifact as m, jitteredMs as mi, toOtelAttributes as mn, createPushTraceSource as mr, createExecutor as mt, createSupervisor as n, unknownExecutionBindingReceipt as ni, createPropagatingTraceEmitter as nn, checkVerdictOf as nr, owners as nt, createRootHandle as o, projectSandboxOutcome as oi, buildRuntimeEventOtelSpans as on, priceTokens as or, materializeTreeView as ot, isTraceAnalysisStore as p, cappedDoublingMs as pi, padTraceId as pn, readCodexRolloutSession as pr, captureReusableExecutorConfig as pt, scopeRetainedOwnerPriorSpend as q, promptOptionsFromAgentTurnInput as qi, seatExecutionProfile as qn, newExecutionAttemptId as qr, captureHarnessTranscript as qt, bestDelivered as r, unknownMaterializationReceipt as ri, readTraceContextFromEnv as rn, createContinuationKeeper as rr, scopeRetainedOwnerContext as rt, driverChild as s, readSandboxOutcome as si, createOpenInferenceFileExporter as sn, ROUTER_PRICE_SOURCE as sr, InMemoryResultBlobStore as st, DEFAULT_MAX_DEPTH as t, runtimeOwnedScopeOwnerRuntime as ti, WORKER_TRACE_PROPAGATION as tn, bestComposite as tr, bindScopeRetainedOwnerProvider as tt, withDriverExecutor as u, RetainedExecutionPendingError as ui, generateSpanId as un, addHarnessUsage as ur, insideCursorNamespace as ut, readWorkerInteractiveBinding as v, TRACE_ROOT_SCHEMA as vi, sanitizeRuntimeStreamEvent as vn, signalAbortError as vr, runAgentRounds as vt, noteScopeOwnerPlannedExecution as w, errMessage as wi, PEER_MAIL_WIRE_KEY as wn, harnessInvocation as wr, TERMINAL_DECISIONS as wt, startRetainedInteractiveRun as x, detachedSnapshot as xi, failPendingAfter as xn, runSettledCommand as xr, createSandboxForSpec as xt, reconnectRetainedInteractiveRun as y, TRACE_SUMMARY_SCHEMA as yi, INBOX_RECEIPT_KEY as yn, bridgeRuntimeAttachmentsKey as yr, assertBoxlessPromptOptions as yt, meterRuntimeOwnedProviderAttempt as z, createSandboxTurnEventCollector as zi, causedByPartialFailure as zn, attestRuntimeOwnedPendingExecutor as zr, recoverRetainedRun as zt };
|
|
31839
31725
|
|
|
31840
|
-
//# sourceMappingURL=supervisor-
|
|
31726
|
+
//# sourceMappingURL=supervisor-VXuN2OHT.js.map
|