@tangle-network/agent-runtime 0.179.0 → 0.181.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.
Files changed (85) hide show
  1. package/dist/{activation-C-FAeybF.js → activation-DQeqgV8K.js} +2 -2
  2. package/dist/{activation-C-FAeybF.js.map → activation-DQeqgV8K.js.map} +1 -1
  3. package/dist/agent.d.ts +2 -2
  4. package/dist/agent.js +3 -3
  5. package/dist/{analyst-loop-Bouu53-l.js → analyst-loop-35qyyDqP.js} +2 -2
  6. package/dist/{analyst-loop-Bouu53-l.js.map → analyst-loop-35qyyDqP.js.map} +1 -1
  7. package/dist/analyst-loop.d.ts +1 -1
  8. package/dist/analyst-loop.js +1 -1
  9. package/dist/{authoring-kLYzRjsB.js → authoring-DN4xp35f.js} +2 -2
  10. package/dist/{authoring-kLYzRjsB.js.map → authoring-DN4xp35f.js.map} +1 -1
  11. package/dist/{conversation-BREx2hi-.js → conversation-Dj-W5J1A.js} +2 -2
  12. package/dist/{conversation-BREx2hi-.js.map → conversation-Dj-W5J1A.js.map} +1 -1
  13. package/dist/conversation.d.ts +1 -1
  14. package/dist/conversation.js +1 -1
  15. package/dist/{coordination-driver-BeLF1j7n.js → coordination-driver-B_mNdx1I.js} +2 -2
  16. package/dist/{coordination-driver-BeLF1j7n.js.map → coordination-driver-B_mNdx1I.js.map} +1 -1
  17. package/dist/durable.d.ts +2 -2
  18. package/dist/durable.js +1 -1
  19. package/dist/{environment-provider-DKyMWQJd.js → environment-provider-B6HqC4mh.js} +2 -2
  20. package/dist/{environment-provider-DKyMWQJd.js.map → environment-provider-B6HqC4mh.js.map} +1 -1
  21. package/dist/{environment-provider-BGCU0IRa.d.ts → environment-provider-CzohJCuk.d.ts} +3 -3
  22. package/dist/environment-provider.d.ts +1 -1
  23. package/dist/environment-provider.js +1 -1
  24. package/dist/{graph-CZFWujWS.js → graph-Ca4JV-Q6.js} +2 -2
  25. package/dist/{graph-CZFWujWS.js.map → graph-Ca4JV-Q6.js.map} +1 -1
  26. package/dist/graph.d.ts +3 -3
  27. package/dist/graph.js +3 -3
  28. package/dist/{improvement-cycle-CADEjVOB.js → improvement-cycle-BEKM4E0T.js} +5 -5
  29. package/dist/{improvement-cycle-CADEjVOB.js.map → improvement-cycle-BEKM4E0T.js.map} +1 -1
  30. package/dist/{index-lu9HFbv5.d.ts → index-C137-hlN.d.ts} +4 -4
  31. package/dist/{index-DNXW665W.d.ts → index-DHSZjuLC.d.ts} +3 -3
  32. package/dist/{index-DhnWuHkN.d.ts → index-DhI31ODk.d.ts} +39 -9
  33. package/dist/index.d.ts +9 -9
  34. package/dist/index.js +9 -9
  35. package/dist/intelligence.d.ts +5 -5
  36. package/dist/intelligence.js +4 -4
  37. package/dist/kernel.d.ts +6 -6
  38. package/dist/kernel.js +11 -11
  39. package/dist/{knowledge-BZvQ7Pca.js → knowledge-DR0ap2Q9.js} +3 -3
  40. package/dist/{knowledge-BZvQ7Pca.js.map → knowledge-DR0ap2Q9.js.map} +1 -1
  41. package/dist/knowledge.d.ts +1 -1
  42. package/dist/knowledge.js +1 -1
  43. package/dist/{loop-runner-bin-BnSUNv5h.d.ts → loop-runner-bin-C7RGEVw0.d.ts} +3 -3
  44. package/dist/{loop-runner-bin-CeMD66qH.js → loop-runner-bin-DcGlGmdV.js} +4 -4
  45. package/dist/{loop-runner-bin-CeMD66qH.js.map → loop-runner-bin-DcGlGmdV.js.map} +1 -1
  46. package/dist/loop-runner-bin.d.ts +1 -1
  47. package/dist/loop-runner-bin.js +1 -1
  48. package/dist/mcp/bin.js +3 -3
  49. package/dist/mcp/index.d.ts +9 -6
  50. package/dist/mcp/index.js +9 -5
  51. package/dist/mcp/index.js.map +1 -1
  52. package/dist/{openai-tools-CQq1fhJ0.js → openai-tools-CalMJdQb.js} +2 -2
  53. package/dist/{openai-tools-CQq1fhJ0.js.map → openai-tools-CalMJdQb.js.map} +1 -1
  54. package/dist/{openai-tools-wkxQ2aEw.d.ts → openai-tools-Cbk5uBUu.d.ts} +2 -2
  55. package/dist/primeintellect/index.d.ts +1 -1
  56. package/dist/profiles.d.ts +2 -2
  57. package/dist/{provision-supervisor-C_o4UH8c.js → provision-supervisor-CZ-V1h03.js} +56 -33
  58. package/dist/provision-supervisor-CZ-V1h03.js.map +1 -0
  59. package/dist/{redact-GpYsFenv.d.ts → redact-pDUP8izr.d.ts} +3 -3
  60. package/dist/{runtime-BblXWn4d.js → runtime-B4sDmaCx.js} +29 -14
  61. package/dist/runtime-B4sDmaCx.js.map +1 -0
  62. package/dist/{runtime-oGfkncdd.d.ts → runtime-DawGtqdw.d.ts} +4 -4
  63. package/dist/{sandbox-events-BVjstFgb.js → sandbox-events-B2cWfjwu.js} +20 -4
  64. package/dist/sandbox-events-B2cWfjwu.js.map +1 -0
  65. package/dist/{stream-agent-turn-CPj9SqVm.js → stream-agent-turn-D-GzjvCl.js} +2 -2
  66. package/dist/{stream-agent-turn-CPj9SqVm.js.map → stream-agent-turn-D-GzjvCl.js.map} +1 -1
  67. package/dist/{stream-agent-turn-esfjghd9.d.ts → stream-agent-turn-DY-y9yW1.d.ts} +3 -3
  68. package/dist/{structural-rollout-D4uIcI7I.js → structural-rollout-BKt0UfUL.js} +3 -3
  69. package/dist/{structural-rollout-D4uIcI7I.js.map → structural-rollout-BKt0UfUL.js.map} +1 -1
  70. package/dist/{substrate-AJoT4HIz.d.ts → substrate-RrmNZoL3.d.ts} +2 -2
  71. package/dist/{supervise-Ckj6Ewdi.js → supervise-DUS8td9n.js} +3 -3
  72. package/dist/{supervise-Ckj6Ewdi.js.map → supervise-DUS8td9n.js.map} +1 -1
  73. package/dist/{supervisor--tj9JsFo.js → supervisor-CC3qqrVo.js} +90 -33
  74. package/dist/supervisor-CC3qqrVo.js.map +1 -0
  75. package/dist/testing.d.ts +2 -2
  76. package/dist/testing.js +12 -12
  77. package/dist/tui/index.d.ts +1 -1
  78. package/dist/tui/index.js +1 -1
  79. package/dist/{types-CPpvwwTx.d.ts → types-B-rWcun_.d.ts} +7 -2
  80. package/dist/{types-DpdfZoQ3.d.ts → types-CrTTgig6.d.ts} +25 -2
  81. package/package.json +1 -1
  82. package/dist/provision-supervisor-C_o4UH8c.js.map +0 -1
  83. package/dist/runtime-BblXWn4d.js.map +0 -1
  84. package/dist/sandbox-events-BVjstFgb.js.map +0 -1
  85. package/dist/supervisor--tj9JsFo.js.map +0 -1
@@ -3,10 +3,10 @@ import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBinding
3
3
  import { n as detachedSnapshot } from "./snapshot-CTAf4uuA.js";
4
4
  import { _ as captureWorkerTraceEvidence, a as aggregateProviderModelEvidence, c as loadSpawnForest, d as replaySpawnTree, f as attestNestedDriverTreeOwner, h as runtimeOwnedNestedDriverTreeRoot, l as materializeTreeView, m as nestedDriverTreeRoot, n as FileSpawnJournal, o as closesCursorSlot, p as driverRuntime, u as pendingWaits, x as contentAddress } from "./spawn-journal--N8Ten1q.js";
5
5
  import { _ as unmeteredSpend, a as cloneTokenUsage, b as zeroTokenUsage, d as randomSuffix, f as randomUuid, g as throwIfAborted, h as throwAbort, l as mapWithConcurrency, m as stringifySafe, n as addTokenUsage, o as deleteBoxSafe, p as sleep, r as chargedTokens, s as hasCompleteCacheBreakdown, t as addSpend, u as promptCacheTokenClasses, v as withTimeout, y as zeroSpend } from "./util-D6ZEuBMi.js";
6
- import { c as notifySandboxEventObserver, i as extractLlmCallEvent, l as sandboxEventServedBackend, m as parseCanonicalTransportEvent, p as extractTransportEventIdentity, r as createSandboxToolPartState, s as mapSandboxToolEvent, t as assertSandboxServedModel, u as sandboxProgressEvents } from "./sandbox-events-BVjstFgb.js";
6
+ import { c as notifySandboxEventObserver, i as extractLlmCallEvent, l as sandboxEventServedBackend, m as parseCanonicalTransportEvent, p as extractTransportEventIdentity, r as createSandboxToolPartState, s as mapSandboxToolEvent, t as assertSandboxServedModel, u as sandboxProgressEvents } from "./sandbox-events-B2cWfjwu.js";
7
7
  import { n as executableAgentSpecSnapshot, r as projectSandboxOutcome, t as executableAgentProfileSnapshot } from "./executable-spec-CkGvdPds.js";
8
8
  import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-Sw4ywhtL.js";
9
- import { c as linkAbort, i as resolveAgentEnvironmentProvider, l as runAbortable, n as providerAsExecutor, r as providerAsSandboxClient, s as abortError$1 } from "./environment-provider-DKyMWQJd.js";
9
+ import { c as linkAbort, i as resolveAgentEnvironmentProvider, l as runAbortable, n as providerAsExecutor, r as providerAsSandboxClient, s as abortError$1 } from "./environment-provider-B6HqC4mh.js";
10
10
  import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
11
11
  import { n as assertNoSymlinkDescendant, r as publishExclusiveDurableFile } from "./durable-file-g3YdfEh4.js";
12
12
  import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, ContextTransferRequestSchema, InteractionAcknowledgementSchema, InteractionResponseCommandSchema, NativeContextBoundaryProofSchema, NativeContextContinuationRequestSchema, REASONING_EFFORTS, RuntimeEventEnvelopeSchema, TerminalReplayWindowSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentNativeContextContinuationResultMatchesRequest, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, exactAgentInteractiveSessionStart, harnessTypeSchema, nativeContextContinuationTurnDigest, nativeReasoningControl, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema } from "@tangle-network/agent-interface";
@@ -4113,6 +4113,58 @@ function routerBrain(cfg, opts = {}) {
4113
4113
  };
4114
4114
  }
4115
4115
  //#endregion
4116
+ //#region src/runtime/prompt-options.ts
4117
+ /** Keys the kernel owns on every prompt it sends; a caller value never carries them past here. */
4118
+ const kernelOwnedPromptKeys = /* @__PURE__ */ new Set(["sessionId", "signal"]);
4119
+ /**
4120
+ * Validate and normalize a caller's `promptOptions`.
4121
+ *
4122
+ * @param value the raw value from the execution context.
4123
+ * @param where the field path to name in the error, e.g. `'runAgentRounds: ctx.promptOptions'`.
4124
+ * @returns the options minus the kernel-owned keys, or `undefined` when the caller supplied none.
4125
+ * @throws ValidationError when the value is present but is not a plain object.
4126
+ */
4127
+ function readPromptOptions(value, where) {
4128
+ if (value === void 0) return void 0;
4129
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new ValidationError(`${where} must be an object of SDK PromptOptions`);
4130
+ const owned = {};
4131
+ for (const [key, entry] of Object.entries(value)) {
4132
+ if (kernelOwnedPromptKeys.has(key)) continue;
4133
+ owned[key] = entry;
4134
+ }
4135
+ return owned;
4136
+ }
4137
+ const instrumentPromptKeys = ["backend", "model"];
4138
+ /**
4139
+ * Refuse a per-prompt option a boxless `SandboxClient` seam cannot honor.
4140
+ *
4141
+ * These seams present an in-process executor as a box: there is no sandbox to reconfigure, so an
4142
+ * instrument key — `backend` (the harness to run and the credential to run it on) or `model` (the
4143
+ * id to serve the turn) — states an intent the seam can only drop. Dropping it would run the turn
4144
+ * on a different instrument than the caller asked for and report nothing, so it fails here
4145
+ * instead, before the prompt runs.
4146
+ *
4147
+ * Every other key stays accepted and ignored: `timeoutMs` and `context` shape how a box executes
4148
+ * a turn, not which instrument serves it, and an in-process executor answers on its own terms.
4149
+ *
4150
+ * What counts as a valid value is {@link readPromptOptions}, so a boxless seam holds a caller to
4151
+ * the same contract as the kernels: absent is fine, an object is read, anything else throws.
4152
+ *
4153
+ * @param options the per-prompt options the seam received.
4154
+ * @param seam the seam to name in the error, e.g. `'inlineSandboxClient'`.
4155
+ * @param keys the instrument keys this seam cannot honor. A seam that hands its per-prompt
4156
+ * options to a caller-supplied callback passes only the keys the callback cannot act on.
4157
+ * @throws ValidationError when the options are not an object, or carry one of `keys`.
4158
+ */
4159
+ function assertBoxlessPromptOptions(options, seam, keys = instrumentPromptKeys) {
4160
+ const supplied = readPromptOptions(options, `${seam}: promptOptions`);
4161
+ if (supplied === void 0) return;
4162
+ for (const key of keys) {
4163
+ if (supplied[key] === void 0) continue;
4164
+ throw new ValidationError(`${seam}: promptOptions.${key} cannot apply without a box`);
4165
+ }
4166
+ }
4167
+ //#endregion
4116
4168
  //#region src/runtime/sandbox-acquire.ts
4117
4169
  /**
4118
4170
  * HTTP statuses where create should be retried — gateway timeouts
@@ -4417,7 +4469,7 @@ function createSandboxLineage(client, capabilities, options = {}) {
4417
4469
  await assertSessionLive(handle.box, handle.sessionId);
4418
4470
  return promptEvents(streaming, handle.box, prompt, handle.sessionId, signal, promptOptions);
4419
4471
  },
4420
- async fork(parent, prompts, specs, signal) {
4472
+ async fork(parent, prompts, specs, signal, promptOptions) {
4421
4473
  if (prompts.length === 0) throw new ValidationError("SandboxLineage.fork: prompts must be non-empty");
4422
4474
  if (signal.aborted) throwAbort();
4423
4475
  const branched = await branchParent(parent.box, prompts.length, forkConcurrency, signal);
@@ -4438,7 +4490,7 @@ function createSandboxLineage(client, capabilities, options = {}) {
4438
4490
  box,
4439
4491
  sessionId
4440
4492
  },
4441
- events: promptEvents(streaming, box, prompts[i], sessionId, signal)
4493
+ events: promptEvents(streaming, box, prompts[i], sessionId, signal, promptOptions)
4442
4494
  };
4443
4495
  });
4444
4496
  }
@@ -4460,7 +4512,7 @@ function createSandboxLineage(client, capabilities, options = {}) {
4460
4512
  box,
4461
4513
  sessionId
4462
4514
  },
4463
- events: promptEvents(streaming, box, prompt, sessionId, signal)
4515
+ events: promptEvents(streaming, box, prompt, sessionId, signal, promptOptions)
4464
4516
  };
4465
4517
  }
4466
4518
  const box = await acquireFresh(spec, signal);
@@ -4470,7 +4522,7 @@ function createSandboxLineage(client, capabilities, options = {}) {
4470
4522
  box,
4471
4523
  sessionId
4472
4524
  },
4473
- events: promptEvents(streaming, box, prompt, sessionId, signal)
4525
+ events: promptEvents(streaming, box, prompt, sessionId, signal, promptOptions)
4474
4526
  };
4475
4527
  });
4476
4528
  },
@@ -4583,6 +4635,7 @@ async function runAgentRounds(options) {
4583
4635
  if (!Number.isFinite(maxConcurrency) || maxConcurrency <= 0) throw new ValidationError("runAgentRounds: maxConcurrency must be > 0");
4584
4636
  const sandboxStreaming = options.lineage?.streaming ?? "sse";
4585
4637
  if (!options.ctx?.sandboxClient || typeof options.ctx.sandboxClient.create !== "function") throw new ValidationError("runAgentRounds: ctx.sandboxClient.create is required");
4638
+ const promptOptions = readPromptOptions(options.ctx.promptOptions, "runAgentRounds: ctx.promptOptions");
4586
4639
  const now = options.now ?? Date.now;
4587
4640
  const runId = options.runId ?? `loop-${randomSuffix()}`;
4588
4641
  const loopStart = now();
@@ -4598,7 +4651,7 @@ async function runAgentRounds(options) {
4598
4651
  ownedBoxes.push(box);
4599
4652
  options.onWorkerBox?.(box);
4600
4653
  } : void 0;
4601
- const lineageState = await setUpLineage(options, maxConcurrency, recordMount);
4654
+ const lineageState = await setUpLineage(options, maxConcurrency, recordMount, promptOptions);
4602
4655
  emitRunLoopHook(options, {
4603
4656
  target: "agent.run",
4604
4657
  phase: "before",
@@ -4711,7 +4764,8 @@ async function runAgentRounds(options) {
4711
4764
  collectBox,
4712
4765
  lineagePlan,
4713
4766
  lineageState,
4714
- recordMount
4767
+ recordMount,
4768
+ ...promptOptions === void 0 ? {} : { promptOptions }
4715
4769
  });
4716
4770
  if (controller.signal.aborted) throwAbort();
4717
4771
  emitRunLoopHook(options, {
@@ -4760,7 +4814,7 @@ async function runAgentRounds(options) {
4760
4814
  * Rejects the lineage + `onWorkerBox` combination: both claim the same
4761
4815
  * box-ownership channel, and silently honoring one would leak or double-free.
4762
4816
  */
4763
- async function setUpLineage(options, maxConcurrency, recordMount) {
4817
+ async function setUpLineage(options, maxConcurrency, recordMount, promptOptions) {
4764
4818
  const lineageOpts = options.lineage;
4765
4819
  if (!lineageOpts || !lineageOpts.sessionContinuity && !lineageOpts.forkFanout) return void 0;
4766
4820
  if (options.onWorkerBox) throw new ValidationError("runAgentRounds: `lineage` and `onWorkerBox` both own worker boxes — pass only one");
@@ -4772,6 +4826,7 @@ async function setUpLineage(options, maxConcurrency, recordMount) {
4772
4826
  recordMount
4773
4827
  }),
4774
4828
  options: lineageOpts,
4829
+ ...promptOptions === void 0 ? {} : { promptOptions },
4775
4830
  handles: /* @__PURE__ */ new Map(),
4776
4831
  canPrune: typeof options.driver.describePlan !== "function"
4777
4832
  };
@@ -4804,7 +4859,7 @@ function planLineageRound(state, specs, slice, parentIndex, signal) {
4804
4859
  };
4805
4860
  if (slice.length === 1 && parent && state.options.sessionContinuity) return [{ async acquire() {
4806
4861
  return {
4807
- events: await lineage.continue(parent, promptFor(0), signal),
4862
+ events: await lineage.continue(parent, promptFor(0), signal, state.promptOptions),
4808
4863
  handle: parent
4809
4864
  };
4810
4865
  } }];
@@ -4813,7 +4868,7 @@ function planLineageRound(state, specs, slice, parentIndex, signal) {
4813
4868
  const childSpecs = slice.map((_, offset) => specAt(offset));
4814
4869
  let forked;
4815
4870
  const ensureForked = () => {
4816
- forked ??= lineage.fork(parent, prompts, childSpecs, signal);
4871
+ forked ??= lineage.fork(parent, prompts, childSpecs, signal, state.promptOptions);
4817
4872
  return forked;
4818
4873
  };
4819
4874
  return slice.map((_, offset) => ({ async acquire() {
@@ -4823,7 +4878,7 @@ function planLineageRound(state, specs, slice, parentIndex, signal) {
4823
4878
  } }));
4824
4879
  }
4825
4880
  return slice.map((_, offset) => ({ async acquire() {
4826
- return lineage.start(specAt(offset), promptFor(offset), signal);
4881
+ return lineage.start(specAt(offset), promptFor(offset), signal, state.promptOptions);
4827
4882
  } }));
4828
4883
  }
4829
4884
  /**
@@ -4917,7 +4972,11 @@ async function executeIteration(args) {
4917
4972
  } else {
4918
4973
  box = await createSandboxForSpec(args.ctx.sandboxClient, spec, args.signal, args.recordMount);
4919
4974
  const prompt = spec.taskToPrompt(args.item.task);
4920
- stream = args.streaming === "poll" ? promptEvents("poll", box, prompt, `${args.runId}-i${args.item.index}`, args.signal) : box.streamPrompt(prompt, { signal: args.signal });
4975
+ const promptOptions = args.promptOptions;
4976
+ stream = args.streaming === "poll" ? promptEvents("poll", box, prompt, `${args.runId}-i${args.item.index}`, args.signal, promptOptions) : box.streamPrompt(prompt, {
4977
+ ...promptOptions ?? {},
4978
+ signal: args.signal
4979
+ });
4921
4980
  }
4922
4981
  const placement = describeSandboxPlacement(args.ctx.sandboxClient, box);
4923
4982
  await emitTrace(args.ctx.traceEmitter, {
@@ -6464,7 +6523,7 @@ function createSteerableSandboxSession(args) {
6464
6523
  ...args.traceEnv && Object.keys(args.traceEnv).length > 0 ? { env: args.traceEnv } : {}
6465
6524
  }
6466
6525
  };
6467
- const promptOptions = readPromptOptions(args.loopCtx);
6526
+ const promptOptions = readPromptOptions(args.loopCtx?.promptOptions, "steerable sandbox worker: loopCtx.promptOptions");
6468
6527
  const requestedModel = concreteProfileModel(args.profile);
6469
6528
  const requested = {
6470
6529
  ...args.profile.model?.provider !== void 0 ? { provider: args.profile.model.provider } : {},
@@ -6710,13 +6769,6 @@ function readFinalText(event) {
6710
6769
  const alt = data.text;
6711
6770
  return typeof alt === "string" ? alt : void 0;
6712
6771
  }
6713
- /** Prompt options the composed loop context already carries (agent profile / cwd), forwarded so
6714
- * a steerable worker runs with the same box configuration as the single-shot path. */
6715
- function readPromptOptions(loopCtx) {
6716
- const opts = loopCtx?.promptOptions;
6717
- if (!opts || typeof opts !== "object") return void 0;
6718
- return opts;
6719
- }
6720
6772
  //#endregion
6721
6773
  //#region src/runtime/supervise/worker-trace.ts
6722
6774
  /**
@@ -10636,7 +10688,7 @@ function boundedChildDeadlineAt(parentDeadlineAtMs, childDeadlineMs, nowMs) {
10636
10688
  * only when no execution deadline exists. The losing promise stays observed. */
10637
10689
  async function teardownExecutor(executor, grace, deadlineAtMs, now) {
10638
10690
  const work = Promise.resolve(executor.teardown(grace));
10639
- const requestedWaitMs = grace === "infinity" ? void 0 : grace === "brutalKill" ? TEARDOWN_ACKNOWLEDGEMENT_MS : grace + TEARDOWN_ACKNOWLEDGEMENT_MS;
10691
+ const requestedWaitMs = grace === "infinity" ? void 0 : grace === "brutalKill" ? executor.teardownTimeoutMs ?? TEARDOWN_ACKNOWLEDGEMENT_MS : grace + TEARDOWN_ACKNOWLEDGEMENT_MS;
10640
10692
  const deadlineWaitMs = deadlineAtMs === void 0 ? void 0 : Math.max(0, deadlineAtMs - now()) + TEARDOWN_ACKNOWLEDGEMENT_MS;
10641
10693
  const waitMs = requestedWaitMs === void 0 ? deadlineWaitMs : deadlineWaitMs === void 0 ? requestedWaitMs : Math.min(requestedWaitMs, deadlineWaitMs);
10642
10694
  let receipt;
@@ -11442,25 +11494,30 @@ function createRetainedRunHandle(environment, session, initialControlRef, capabi
11442
11494
  }
11443
11495
  //#endregion
11444
11496
  //#region src/runtime/retained-run-start.ts
11497
+ const MAX_RETAINED_IDENTITY_BYTES = 128;
11445
11498
  /**
11446
11499
  * Mint deterministic dispatch coordinates from the two caller-supplied keys.
11447
11500
  * The same `(idempotencyKey, turnId)` pair yields the same coordinates in
11448
11501
  * every process, so a pre-dispatch admission record always names the exact
11449
- * session and execution the dispatch will request. Format is readable, not
11450
- * hashed, following `deriveExecutionId`: components are URL-encoded so
11451
- * delimiters inside caller keys cannot collapse distinct pairs, and the
11452
- * result stays inside the 256-byte identifier bound.
11502
+ * session and execution the dispatch will request. Short inputs keep a
11503
+ * readable URL-encoded identity. Long inputs use a full SHA-256 digest so
11504
+ * provider storage layers never receive an overlong composite identifier.
11453
11505
  */
11454
11506
  function mintRetainedIdentity(idempotencyKey, turnId) {
11455
11507
  const base = `${encodeURIComponent(idempotencyKey)}:${encodeURIComponent(turnId)}`;
11456
- const sessionId = `retained-session:${base}`;
11457
- const executionId = `retained-execution:${base}`;
11458
- if (executionId.length > 256) throw new RangeError("minted retained identity must not exceed 256 bytes");
11508
+ const digest = canonicalCandidateDigest({
11509
+ kind: "retained-identity.v1",
11510
+ base
11511
+ }).slice(7);
11459
11512
  return {
11460
- sessionId,
11461
- executionId
11513
+ sessionId: boundedRetainedIdentity("retained-session", base, digest),
11514
+ executionId: boundedRetainedIdentity("retained-execution", base, digest)
11462
11515
  };
11463
11516
  }
11517
+ function boundedRetainedIdentity(prefix, base, digest) {
11518
+ const readable = `${prefix}:${base}`;
11519
+ return readable.length <= MAX_RETAINED_IDENTITY_BYTES ? readable : `${prefix}:${digest}`;
11520
+ }
11464
11521
  /**
11465
11522
  * Dispatch one detached, replayable run and return only after exact durable
11466
11523
  * coordinates are confirmed by the provider and persisted by the caller.
@@ -15447,6 +15504,6 @@ function isNonEmptySpend(s) {
15447
15504
  return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false;
15448
15505
  }
15449
15506
  //#endregion
15450
- export { bridgeRuntimeAttachmentsKey as $, buildRuntimeEventOtelSpans as $t, readWorkerInteractiveBinding as A, profileMaterializationAxes$1 as An, isLiveNodeStatus as At, retainedCreateMaterial as B, worktreeCliProfileMaterialization as Bn, probeSandboxCapabilities as Bt, timerAt as C, parseCodexTokenUsage as Cn, DEFAULT_PEER_MAIL_LIMITS as Ct, readWorkerInteractiveAdmissions as D, controlProfileMaterialization as Dn, isPeerMailEnvelope as Dt, interactiveAdmissionSeamKey as E, assertProfileMaterialization as En, createPeerMailbox as Et, startRetainedInteractiveRun as F, renderProfileMaterializationIssues as Fn, createSandboxForSpec as Ft, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as G, observedModelMatchesDeclared as Gt, freeSlots as H, routerBrain as Ht, reconnectRetainedRun as I, renderUnsupported as In, defaultSelectWinner as It, createBudgetPool as J, readTraceContextFromEnv as Jt, teardownExecutor as K, createPropagatingTraceEmitter as Kt, recoverRetainedRun as L, sandboxActProfileMaterialization as Ln, isTerminalDecision as Lt, workerInteractiveBindingsDir as M, promptModelProfileMaterialization as Mn, createInPlaceCliExecutor as Mt, reconnectRetainedInteractiveRun as N, promptOnlyProfileMaterialization as Nn, taskToPrompt as Nt, workerInteractiveAdmissionFile as O, defineProfileMaterializationContract as On, peerMailTools as Ot, recoverRetainedInteractiveRun as P, promptResourceProfileMaterialization as Pn, TERMINAL_DECISIONS as Pt, bridgeModelRouteRefusal as Q, buildLoopSpanNodes as Qt, startRetainedRun as R, unsupportedProfileDimensions as Rn, runAgentRounds as Rt, pollFor as S, localHarnessExecutable as Sn, AUTHORITY_MARKERS as St, waitUntil as T, AGENT_PROFILE_MATERIALIZATION_AXES as Tn, claimsAuthority as Tt, queueOf as U, runBrainLoop as Ut, effectiveConcurrency as V, acquireSandbox as Vt, rollingDispatch as W, canonicalObservedModel as Wt, bindReusableExecutorExecutionId as X, INTELLIGENCE_WIRE_VERSION as Xt, spendFromUsageEvents as Y, traceContextToEnv as Yt, bridgeAdmissionRead as Z, buildLoopOtelSpans as Zt, recordScopeOwnerMaterialization as _, createWorktree as _n, sandboxSessionTraceSource as _t, uncertainSpawnBudgets as a, loopEventToOtelSpan as an, createExecutorRegistry as at, createWaitProbes as b, LOCAL_HARNESSES as bn, readWorkerProgress as bt, pickBestDelivered as c, toOtelAttributes as cn, WORKER_TRACE_PROPAGATION as ct, driverChild as d, sanitizeAgentRuntimeEvent as dn, workerTraceHeaders as dt, createOpenInferenceFileExporter as en, bridgeStopSignalKey as et, withDriverExecutor as f, sanitizeKnowledgeReadinessReport as fn, workerTraceSeamKey as ft, meterRuntimeOwnedProviderAttempt as g, captureWorktreeDiff as gn, decodeToolPart as gt, meterRuntimeOwnedAccounting as h, runWorktreeHarness as hn, createPushTraceSource as ht, sumMeasuredSpendFromEvents as i, generateSpanId as in, createExecutor as it, workerInteractiveBindingFile as j, promptControlProfileMaterialization as jn, isTerminalNodeStatus as jt, attachWorker as k, fullProfileMaterialization as kn, peerMailVerbNames as kt, runFinalizer as l, createRuntimeEventCollector as ln, readWorkerTraceContext as lt, deriveNodeExecutionIdentity as m, runSettledCommand as mn, createSteerableSandboxSession as mt, createSupervisor as n, exportEvalRuns as nn, cliInPlaceExecutor as nt, bestDelivered as o, padSpanId as on, snapshotExecutorConfig as ot, createScope as p, sanitizeRuntimeStreamEvent as pn, DEFAULT_SANDBOX_STEERING_MAX_TURNS as pt, assertValidBudget as q, mergeTraceEnv as qt, maxSeqOf as r, flatOtelSpan as rn, cliWorktreeExecutor as rt, collectDelivered as s, padTraceId as sn, createWorktreeCliExecutor as st, createRootHandle as t, createOtelExporter as tn, captureReusableExecutorConfig as tt, runTree as u, createRuntimeStreamEventCollector as un, workerTraceEnv as ut, scopeOwnerExecutorNodeContext as v, removeWorktree as vn, DEFAULT_STALL_AFTER_MS as vt, validateWaitSpec as w, CodexExecutionDiagnosticError as wn, PEER_MAIL_WIRE_KEY as wt, isWaitOutcome as x, harnessSupportsReasoningEffort as xn, createInbox as xt, settledToIteration as y, DEFAULT_LOCAL_HARNESS as yn, createActivityLog as yt, startRetainedRunInEnvironment as z, validateProfileMaterialization as zn, createSandboxLineage as zt };
15507
+ export { bridgeModelRouteRefusal as $, INTELLIGENCE_WIRE_VERSION as $t, readWorkerInteractiveBinding as A, controlProfileMaterialization as An, peerMailVerbNames as At, retainedCreateMaterial as B, sandboxActProfileMaterialization as Bn, createSandboxLineage as Bt, timerAt as C, LOCAL_HARNESSES as Cn, AUTHORITY_MARKERS as Ct, readWorkerInteractiveAdmissions as D, CodexExecutionDiagnosticError as Dn, createPeerMailbox as Dt, interactiveAdmissionSeamKey as E, parseCodexTokenUsage as En, claimsAuthority as Et, startRetainedInteractiveRun as F, promptModelProfileMaterialization as Fn, TERMINAL_DECISIONS as Ft, rollingDispatch as G, routerBrain as Gt, effectiveConcurrency as H, validateProfileMaterialization as Hn, acquireSandbox as Ht, reconnectRetainedRun as I, promptOnlyProfileMaterialization as In, createSandboxForSpec as It, assertValidBudget as J, observedModelMatchesDeclared as Jt, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as K, runBrainLoop as Kt, recoverRetainedRun as L, promptResourceProfileMaterialization as Ln, defaultSelectWinner as Lt, workerInteractiveBindingsDir as M, fullProfileMaterialization as Mn, isTerminalNodeStatus as Mt, reconnectRetainedInteractiveRun as N, profileMaterializationAxes$1 as Nn, createInPlaceCliExecutor as Nt, workerInteractiveAdmissionFile as O, AGENT_PROFILE_MATERIALIZATION_AXES as On, isPeerMailEnvelope as Ot, recoverRetainedInteractiveRun as P, promptControlProfileMaterialization as Pn, taskToPrompt as Pt, bridgeAdmissionRead as Q, traceContextToEnv as Qt, startRetainedRun as R, renderProfileMaterializationIssues as Rn, isTerminalDecision as Rt, pollFor as S, DEFAULT_LOCAL_HARNESS as Sn, createInbox as St, waitUntil as T, localHarnessExecutable as Tn, PEER_MAIL_WIRE_KEY as Tt, freeSlots as U, worktreeCliProfileMaterialization as Un, assertBoxlessPromptOptions as Ut, destroyInteractiveEnvironment as V, unsupportedProfileDimensions as Vn, probeSandboxCapabilities as Vt, queueOf as W, readPromptOptions as Wt, spendFromUsageEvents as X, mergeTraceEnv as Xt, createBudgetPool as Y, createPropagatingTraceEmitter as Yt, bindReusableExecutorExecutionId as Z, readTraceContextFromEnv as Zt, recordScopeOwnerMaterialization as _, runSettledCommand as _n, decodeToolPart as _t, uncertainSpawnBudgets as a, exportEvalRuns as an, createExecutor as at, createWaitProbes as b, createWorktree as bn, createActivityLog as bt, pickBestDelivered as c, loopEventToOtelSpan as cn, createWorktreeCliExecutor as ct, driverChild as d, toOtelAttributes as dn, workerTraceEnv as dt, buildLoopOtelSpans as en, bridgeRuntimeAttachmentsKey as et, withDriverExecutor as f, createRuntimeEventCollector as fn, workerTraceHeaders as ft, meterRuntimeOwnedProviderAttempt as g, sanitizeRuntimeStreamEvent as gn, createPushTraceSource as gt, meterRuntimeOwnedAccounting as h, sanitizeKnowledgeReadinessReport as hn, createSteerableSandboxSession as ht, sumMeasuredSpendFromEvents as i, createOtelExporter as in, cliWorktreeExecutor as it, workerInteractiveBindingFile as j, defineProfileMaterializationContract as jn, isLiveNodeStatus as jt, attachWorker as k, assertProfileMaterialization as kn, peerMailTools as kt, runFinalizer as l, padSpanId as ln, WORKER_TRACE_PROPAGATION as lt, deriveNodeExecutionIdentity as m, sanitizeAgentRuntimeEvent as mn, DEFAULT_SANDBOX_STEERING_MAX_TURNS as mt, createSupervisor as n, buildRuntimeEventOtelSpans as nn, captureReusableExecutorConfig as nt, bestDelivered as o, flatOtelSpan as on, createExecutorRegistry as ot, createScope as p, createRuntimeStreamEventCollector as pn, workerTraceSeamKey as pt, teardownExecutor as q, canonicalObservedModel as qt, maxSeqOf as r, createOpenInferenceFileExporter as rn, cliInPlaceExecutor as rt, collectDelivered as s, generateSpanId as sn, snapshotExecutorConfig as st, createRootHandle as t, buildLoopSpanNodes as tn, bridgeStopSignalKey as tt, runTree as u, padTraceId as un, readWorkerTraceContext as ut, scopeOwnerExecutorNodeContext as v, runWorktreeHarness as vn, sandboxSessionTraceSource as vt, validateWaitSpec as w, harnessSupportsReasoningEffort as wn, DEFAULT_PEER_MAIL_LIMITS as wt, isWaitOutcome as x, removeWorktree as xn, readWorkerProgress as xt, settledToIteration as y, captureWorktreeDiff as yn, DEFAULT_STALL_AFTER_MS as yt, startRetainedRunInEnvironment as z, renderUnsupported as zn, runAgentRounds as zt };
15451
15508
 
15452
- //# sourceMappingURL=supervisor--tj9JsFo.js.map
15509
+ //# sourceMappingURL=supervisor-CC3qqrVo.js.map