@tangle-network/agent-runtime 0.228.0 → 0.231.1

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 (61) hide show
  1. package/dist/{activation-t__E2fFP.js → activation-DVqSBfe1.js} +2 -2
  2. package/dist/{activation-t__E2fFP.js.map → activation-DVqSBfe1.js.map} +1 -1
  3. package/dist/{activation-Dv8TBXAS.d.ts → activation-Dltkq5S8.d.ts} +2 -2
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-r9_4mvgK.js → coordination-driver-CUdEC2Qh.js} +4 -3
  7. package/dist/{coordination-driver-r9_4mvgK.js.map → coordination-driver-CUdEC2Qh.js.map} +1 -1
  8. package/dist/{delegate-OUy-TxtQ.js → delegate-BN0cSSUT.js} +2 -2
  9. package/dist/{delegate-OUy-TxtQ.js.map → delegate-BN0cSSUT.js.map} +1 -1
  10. package/dist/durable.d.ts +2 -2
  11. package/dist/durable.js +2 -2
  12. package/dist/{graph-Bfqckohg.js → graph-D4wgK3ns.js} +3 -3
  13. package/dist/{graph-Bfqckohg.js.map → graph-D4wgK3ns.js.map} +1 -1
  14. package/dist/{improvement-cycle-COOuIQpm.js → improvement-cycle-CjIeWuyB.js} +3 -3
  15. package/dist/{improvement-cycle-COOuIQpm.js.map → improvement-cycle-CjIeWuyB.js.map} +1 -1
  16. package/dist/{index-DAIij88v.d.ts → index-BW6lJXnH.d.ts} +11 -6
  17. package/dist/index.d.ts +6 -6
  18. package/dist/index.js +7 -7
  19. package/dist/intelligence.d.ts +3 -3
  20. package/dist/intelligence.js +3 -3
  21. package/dist/kernel.d.ts +4 -4
  22. package/dist/kernel.js +8 -8
  23. package/dist/{loop-runner-bin-CN1rstwC.d.ts → loop-runner-bin-BcqlGNW-.d.ts} +3 -3
  24. package/dist/{loop-runner-bin-DW_8__PB.js → loop-runner-bin-BodmUPOf.js} +3 -3
  25. package/dist/{loop-runner-bin-DW_8__PB.js.map → loop-runner-bin-BodmUPOf.js.map} +1 -1
  26. package/dist/loop-runner-bin.d.ts +1 -1
  27. package/dist/loop-runner-bin.js +1 -1
  28. package/dist/mcp/bin.js +3 -3
  29. package/dist/mcp/index.d.ts +5 -5
  30. package/dist/mcp/index.js +6 -6
  31. package/dist/mcp/memory-bin.js +1 -1
  32. package/dist/{memory-server-BR310Weg.js → memory-server-Cn8LbAxO.js} +2 -2
  33. package/dist/{memory-server-BR310Weg.js.map → memory-server-Cn8LbAxO.js.map} +1 -1
  34. package/dist/{openai-tools-HhRT1L1W.d.ts → openai-tools-avHT8eq3.d.ts} +2 -2
  35. package/dist/profiles.d.ts +2 -2
  36. package/dist/{provision-supervisor-BVglIjhG.js → provision-supervisor-DyNDlA2I.js} +3 -3
  37. package/dist/{provision-supervisor-BVglIjhG.js.map → provision-supervisor-DyNDlA2I.js.map} +1 -1
  38. package/dist/{runtime-lysnGswg.js → runtime-BxZHapmG.js} +8 -8
  39. package/dist/{runtime-lysnGswg.js.map → runtime-BxZHapmG.js.map} +1 -1
  40. package/dist/{server-BL3RTYqx.js → server-C9pa2tSq.js} +4 -4
  41. package/dist/{server-BL3RTYqx.js.map → server-C9pa2tSq.js.map} +1 -1
  42. package/dist/stream-agent-turn-hiU4vgGX.d.ts +2058 -0
  43. package/dist/{structural-rollout-DGsWDP0f.js → structural-rollout-DQoLyth9.js} +2 -2
  44. package/dist/{structural-rollout-DGsWDP0f.js.map → structural-rollout-DQoLyth9.js.map} +1 -1
  45. package/dist/{substrate-sWW5cDIe.d.ts → substrate-CBo6TWOl.d.ts} +2 -2
  46. package/dist/{supervise-UgmGtrlX.js → supervise-Cl_-IsVc.js} +134 -21
  47. package/dist/supervise-Cl_-IsVc.js.map +1 -0
  48. package/dist/{supervisor-DBnQuTyJ.js → supervisor-DFsXULnE.js} +393 -96
  49. package/dist/supervisor-DFsXULnE.js.map +1 -0
  50. package/dist/testing.d.ts +2 -2
  51. package/dist/testing.js +12 -12
  52. package/dist/{tool-server-BJbCPhoW.js → tool-server-x9NEhvHZ.js} +2 -2
  53. package/dist/tool-server-x9NEhvHZ.js.map +1 -0
  54. package/dist/tui/index.d.ts +1 -1
  55. package/dist/tui/index.js +1 -1
  56. package/dist/{stream-agent-turn-Dy-QleSb.d.ts → types-DBovefLD.d.ts} +4005 -4712
  57. package/package.json +4 -4
  58. package/dist/supervise-UgmGtrlX.js.map +0 -1
  59. package/dist/supervisor-DBnQuTyJ.js.map +0 -1
  60. package/dist/tool-server-BJbCPhoW.js.map +0 -1
  61. package/dist/types-Ba5mJkyd.d.ts +0 -1293
@@ -5754,6 +5754,165 @@ function generateTraceId() {
5754
5754
  return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
5755
5755
  }
5756
5756
  //#endregion
5757
+ //#region src/runtime/native-session-evidence.ts
5758
+ /**
5759
+ * Read a sandbox child's own harness transcript out of its environment before the
5760
+ * environment is destroyed, and persist it beside the tool-span `trace` receipt.
5761
+ *
5762
+ * Why this exists: Runtime destroys a child's environment at teardown and nothing read
5763
+ * those files first, so a child's Claude Code / Codex / OpenCode session never reached a
5764
+ * run record. The settled `trace` receipt covers the supervisor's own tool spans only —
5765
+ * `toolName`, `args`, `status`, `callId`, with `startedAt === endedAt` — so it carries no
5766
+ * assistant text, no reasoning, and no tool results, and `status: 'available'` never meant
5767
+ * the transcript survived. See tangle-network/agent-runtime#1214.
5768
+ *
5769
+ * The port already has what this needs: `AgentEnvironment.read?(path, { signal })`
5770
+ * returns a file's content as a string. Two constraints shape the design:
5771
+ *
5772
+ * - `read` is OPTIONAL and, on the Tangle provider, gated behind
5773
+ * `capabilities.workspace.read && box.read`. An environment without it is reported as
5774
+ * `unsupported` rather than silently producing an empty artifact — the whole point of
5775
+ * #1214 is that a receipt must not claim coverage it does not have.
5776
+ * - `read` takes one path and gives no directory listing, so enumeration goes through
5777
+ * `exec`. An environment with `read` but no `exec` cannot be enumerated and is also
5778
+ * reported, not guessed at.
5779
+ *
5780
+ * Storage is NOT this module's business. The executor returns the artifact inside the result
5781
+ * it already settles with, and supervise puts that under the child's `outRef` in its own
5782
+ * `ResultBlobStore`. No destroy site learns about storage, and replay rehydrates it for free.
5783
+ *
5784
+ * Credentials are excluded by construction: enumeration lists only the transcript globs
5785
+ * for the harness, and any path matching DENY is dropped even if a producer moved a
5786
+ * credential file inside a session directory. The helper never reads `auth.json`,
5787
+ * `.credentials.json`, `credentials`, or a dotenv file.
5788
+ */
5789
+ /** Where each harness keeps the session files that hold the conversation. */
5790
+ const HARNESS_ROOTS = Object.freeze({
5791
+ "claude-code": Object.freeze([
5792
+ ".claude/projects",
5793
+ ".claude/history.jsonl",
5794
+ ".claude/todos"
5795
+ ]),
5796
+ codex: Object.freeze([".codex/sessions", ".codex/history.jsonl"]),
5797
+ opencode: Object.freeze([".local/share/opencode/storage", ".local/share/opencode/log"]),
5798
+ pi: Object.freeze([".pi/agent/sessions"])
5799
+ });
5800
+ /**
5801
+ * Never read, whatever a producer put inside a session tree.
5802
+ *
5803
+ * Case-insensitive and broader than the obvious names: `.netrc`, `*.key`, `*.p12`/`*.pfx`
5804
+ * and an uppercase `ID_RSA` all slipped an earlier lowercase-only pattern.
5805
+ */
5806
+ const DENY = /(^|\/)(auth\.json|\.credentials\.json|credentials|\.netrc|\.env(\..*)?|secrets?(\.|$)|.*\.(pem|key|p12|pfx)|id_[a-z0-9_]+)$/iu;
5807
+ /**
5808
+ * Bounds per file and in total. These are deliberately modest: the artifact rides inside the
5809
+ * settled result that supervise blobs under one `outRef`, so an unbounded transcript would
5810
+ * bloat every replay of that child, not just the capture.
5811
+ */
5812
+ const MAX_FILE_BYTES = 2 * 1024 * 1024;
5813
+ const MAX_TOTAL_BYTES = 16 * 1024 * 1024;
5814
+ const MAX_FILES = 1e3;
5815
+ function unavailable$2(reason) {
5816
+ return Object.freeze({
5817
+ status: "unavailable",
5818
+ reason
5819
+ });
5820
+ }
5821
+ /**
5822
+ * Enumerate candidate transcript paths inside the environment.
5823
+ *
5824
+ * `find` is given the roots and prints one path per line. A missing root is not an error:
5825
+ * a child that never used a harness has no directory for it.
5826
+ */
5827
+ async function enumerate(environment, roots, signal) {
5828
+ if (!environment.exec) return void 0;
5829
+ const command = `find ${roots.map((r) => `"$HOME/${r}"`).join(" ")} -type f -size -${Math.floor(MAX_FILE_BYTES / 1024)}k 2>/dev/null | head -${MAX_FILES}`;
5830
+ try {
5831
+ return ((await environment.exec(command, signal ? { signal } : void 0)).stdout ?? "").split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
5832
+ } catch {
5833
+ return;
5834
+ }
5835
+ }
5836
+ /**
5837
+ * Read the harness transcript out of one LIVE environment.
5838
+ *
5839
+ * Call this before the environment is destroyed — on the settled path that means before the
5840
+ * result is built, since the `finally` that destroys runs after. It never throws: a teardown
5841
+ * must not fail because evidence could not be collected, and every failure mode is a named
5842
+ * `reason` the settled receipt carries instead of an empty artifact that reads as coverage.
5843
+ */
5844
+ async function captureNativeSessionEvidence(environment, harness, signal) {
5845
+ if (!environment?.read) return unavailable$2("unsupported-environment");
5846
+ if (harness === void 0) return unavailable$2("unknown-harness");
5847
+ const roots = HARNESS_ROOTS[harness];
5848
+ if (!roots) return unavailable$2("unknown-harness");
5849
+ const paths = await enumerate(environment, roots, signal);
5850
+ if (paths === void 0) return unavailable$2("enumeration-failed");
5851
+ if (paths.length === 0) return unavailable$2("no-transcript");
5852
+ const files = [];
5853
+ const skipped = [];
5854
+ let total = 0;
5855
+ for (const path of paths) {
5856
+ if (signal?.aborted) {
5857
+ skipped.push({
5858
+ path,
5859
+ reason: "aborted"
5860
+ });
5861
+ continue;
5862
+ }
5863
+ if (DENY.test(path)) {
5864
+ skipped.push({
5865
+ path,
5866
+ reason: "denied-credential-shaped-path"
5867
+ });
5868
+ continue;
5869
+ }
5870
+ if (total >= MAX_TOTAL_BYTES) {
5871
+ skipped.push({
5872
+ path,
5873
+ reason: "total-byte-budget-exhausted"
5874
+ });
5875
+ continue;
5876
+ }
5877
+ try {
5878
+ const content = await environment.read(path, signal ? { signal } : void 0);
5879
+ const bytes = Buffer.byteLength(content, "utf8");
5880
+ if (bytes > MAX_FILE_BYTES) {
5881
+ skipped.push({
5882
+ path,
5883
+ reason: "file-exceeds-byte-bound"
5884
+ });
5885
+ continue;
5886
+ }
5887
+ files.push(Object.freeze({
5888
+ path,
5889
+ bytes,
5890
+ content
5891
+ }));
5892
+ total += bytes;
5893
+ } catch {
5894
+ skipped.push({
5895
+ path,
5896
+ reason: "read-failed"
5897
+ });
5898
+ }
5899
+ }
5900
+ if (files.length === 0) return unavailable$2("no-transcript");
5901
+ const artifact = Object.freeze({
5902
+ schemaVersion: 1,
5903
+ harness,
5904
+ files: Object.freeze(files),
5905
+ skipped: Object.freeze(skipped)
5906
+ });
5907
+ return Object.freeze({
5908
+ status: "available",
5909
+ artifact,
5910
+ fileCount: files.length,
5911
+ totalBytes: total,
5912
+ skippedCount: skipped.length
5913
+ });
5914
+ }
5915
+ //#endregion
5757
5916
  //#region src/runtime/provider-placement.ts
5758
5917
  const placementMetadataKey = "runtimeProviderPlacement";
5759
5918
  /** Select exactly one declaration before any provider effects. Shared defaults carry infrastructure only. */
@@ -6459,7 +6618,14 @@ async function startRetainedRun(options) {
6459
6618
  assertRequestedInteractionCapabilities(options.provider.name, options.turn.interactions, providerCapabilities);
6460
6619
  options.environment.signal?.throwIfAborted();
6461
6620
  options.turn.signal?.throwIfAborted();
6462
- const environment = await options.provider.create({
6621
+ let environment;
6622
+ if (options.existingEnvironmentId !== void 0) {
6623
+ assertStableText(options.existingEnvironmentId, "retained environment id");
6624
+ const existing = await options.provider.get(options.existingEnvironmentId);
6625
+ if (!existing || existing.id !== options.existingEnvironmentId || existing.provider !== options.provider.name) throw new Error("retained provider environment is unavailable or has another identity");
6626
+ await assertRetainedEnvironmentOwnership(options.provider, existing.id, options.environment.idempotencyKey);
6627
+ environment = existing;
6628
+ } else environment = await options.provider.create({
6463
6629
  ...options.environment,
6464
6630
  metadata: retainedEnvironmentMetadata(options.environment.metadata, options.environment.idempotencyKey)
6465
6631
  });
@@ -6468,6 +6634,7 @@ async function startRetainedRun(options) {
6468
6634
  capabilities = retainedCapabilitiesForEnvironment(options.provider.name, providerCapabilities, environment);
6469
6635
  assertRequestedInteractionCapabilities(options.provider.name, options.turn.interactions, capabilities);
6470
6636
  } catch (error) {
6637
+ if (options.existingEnvironmentId !== void 0) throw error;
6471
6638
  try {
6472
6639
  await environment.destroy?.();
6473
6640
  } catch (cleanupError) {
@@ -6476,6 +6643,7 @@ async function startRetainedRun(options) {
6476
6643
  throw error;
6477
6644
  }
6478
6645
  if (!environment.dispatch || !environment.session) {
6646
+ if (options.existingEnvironmentId !== void 0) throw new Error(`provider "${options.provider.name}" does not expose detached session control`);
6479
6647
  try {
6480
6648
  await environment.destroy?.();
6481
6649
  } catch (cleanupError) {
@@ -6493,7 +6661,8 @@ async function startRetainedRun(options) {
6493
6661
  identity,
6494
6662
  onAdmission: options.onAdmission,
6495
6663
  capabilities,
6496
- now: options.now
6664
+ now: options.now,
6665
+ preserveEnvironment: options.existingEnvironmentId !== void 0
6497
6666
  });
6498
6667
  }
6499
6668
  /**
@@ -6534,7 +6703,8 @@ async function startRetainedRunInEnvironment(options) {
6534
6703
  identity,
6535
6704
  onAdmission: options.onAdmission,
6536
6705
  capabilities,
6537
- now: options.now
6706
+ now: options.now,
6707
+ preserveEnvironment: true
6538
6708
  });
6539
6709
  }
6540
6710
  async function assertRetainedEnvironmentOwnership(provider, environmentId, idempotencyKey) {
@@ -6555,7 +6725,7 @@ async function dispatchRetainedRun(options) {
6555
6725
  executionId: identity.executionId
6556
6726
  });
6557
6727
  const destroyIfCreated = async (cause) => {
6558
- if (environment.creation !== "created") throw cause;
6728
+ if (options.preserveEnvironment || environment.creation !== "created") throw cause;
6559
6729
  try {
6560
6730
  await environment.destroy?.();
6561
6731
  } catch (cleanupError) {
@@ -6692,6 +6862,7 @@ function retainedRunIntent(options, identity, contextTransfer) {
6692
6862
  kind: "retained-run-intent.v1",
6693
6863
  provider: options.provider.name,
6694
6864
  idempotencyKey: options.environment.idempotencyKey,
6865
+ ...options.existingEnvironmentId === void 0 ? {} : { existingEnvironmentId: options.existingEnvironmentId },
6695
6866
  turnId: options.turn.turnId,
6696
6867
  sessionId: identity.sessionId,
6697
6868
  executionId: identity.executionId,
@@ -7386,7 +7557,8 @@ function providerAsExecutor(provider, options = {}) {
7386
7557
  };
7387
7558
  }
7388
7559
  function createProviderExecutor(provider, profile, ctx, options, placement) {
7389
- const controller = linkAbort(ctx.signal);
7560
+ const controller = new AbortController();
7561
+ const node = ctx.node === void 0 ? void 0 : detachedSnapshot(ctx.node, "provider executor node");
7390
7562
  let environment;
7391
7563
  let artifact;
7392
7564
  let retained;
@@ -7396,8 +7568,8 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7396
7568
  const runtime = options.runtime ?? provider.name;
7397
7569
  const createProfile = options.profileForCreate?.(profile) ?? profile;
7398
7570
  if (placement && canonicalAgentProfileDigest(createProfile) !== canonicalAgentProfileDigest(profile)) throw new ValidationError("provider placement: profileForCreate cannot change the selected profile");
7399
- const executionId = retention?.executionId ?? ctx.node?.nodeId ?? `provider-run-${randomUUID()}`;
7400
- const attemptId = ctx.node?.attemptId ?? newExecutionAttemptId(executionId);
7571
+ const executionId = retention?.executionId ?? node?.nodeId ?? `provider-run-${randomUUID()}`;
7572
+ const attemptId = node?.attemptId ?? newExecutionAttemptId(executionId);
7401
7573
  const trace = createPushTraceSource({ runId: executionId });
7402
7574
  const providerModel = concreteProfileModel(createProfile);
7403
7575
  const tokenLimits = enforceTokenLimits(profileModelExecutionSettings(createProfile, `providerAsExecutor(${provider.name})`).tokenLimits, "provider", `providerAsExecutor(${provider.name})`);
@@ -7419,7 +7591,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7419
7591
  plan: {
7420
7592
  kind: "agent-environment",
7421
7593
  provider: provider.name,
7422
- destroyOnSettle: options.destroyOnSettle ?? true,
7594
+ destroyOnSettle: retention?.preserveEnvironment ? false : options.destroyOnSettle ?? true,
7423
7595
  requireTerminalEvent: options.requireTerminalEvent ?? true,
7424
7596
  tokenLimits,
7425
7597
  ...placement ? { placement } : {}
@@ -7444,42 +7616,47 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7444
7616
  }
7445
7617
  };
7446
7618
  let executor;
7447
- const run = (task, signal, recovering = false) => {
7448
- return streamProviderExecutor({
7449
- provider,
7450
- profile,
7451
- createProfile,
7452
- task,
7453
- signal,
7454
- controller,
7455
- options,
7456
- retention,
7457
- executionId,
7458
- trace,
7459
- recovering,
7460
- onRetained: (handle) => {
7461
- retained = handle;
7462
- },
7463
- onPending: (value) => {
7464
- pending = value;
7465
- },
7466
- onEnvironment: (env) => {
7467
- environment = env;
7468
- finalizeRuntimeOwnedPendingExecutor(executor, {
7469
- ...plannedDeclaration,
7470
- execution: {
7471
- kind: "environment",
7472
- id: env.id
7473
- }
7474
- }, plannedBinding);
7475
- },
7476
- onArtifact: (next) => {
7477
- artifact = next;
7478
- },
7479
- onDestroyed: () => {
7480
- destroyed = true;
7481
- }
7482
- });
7619
+ const run = async function* (task, signal, recovering = false) {
7620
+ const linked = linkAbort(ctx.signal, signal, controller.signal);
7621
+ try {
7622
+ yield* streamProviderExecutor({
7623
+ provider,
7624
+ profile,
7625
+ createProfile,
7626
+ task,
7627
+ signal: linked.signal,
7628
+ ...node === void 0 ? {} : { node },
7629
+ options,
7630
+ retention,
7631
+ executionId,
7632
+ trace,
7633
+ recovering,
7634
+ onRetained: (handle) => {
7635
+ retained = handle;
7636
+ },
7637
+ onPending: (value) => {
7638
+ pending = value;
7639
+ },
7640
+ onEnvironment: (env) => {
7641
+ environment = env;
7642
+ finalizeRuntimeOwnedPendingExecutor(executor, {
7643
+ ...plannedDeclaration,
7644
+ execution: {
7645
+ kind: "environment",
7646
+ id: env.id
7647
+ }
7648
+ }, plannedBinding);
7649
+ },
7650
+ onArtifact: (next) => {
7651
+ artifact = next;
7652
+ },
7653
+ onDestroyed: () => {
7654
+ destroyed = true;
7655
+ }
7656
+ });
7657
+ } finally {
7658
+ linked.release();
7659
+ }
7483
7660
  };
7484
7661
  executor = {
7485
7662
  runtime,
@@ -7571,7 +7748,7 @@ function admittedEnvironmentId(retention) {
7571
7748
  }
7572
7749
  async function* streamProviderExecutor(args) {
7573
7750
  const started = Date.now();
7574
- const linked = linkAbort(args.signal, args.controller.signal).signal;
7751
+ const linked = args.signal;
7575
7752
  const defaultTurn = taskToTurnInput(args.task, linked);
7576
7753
  let turn = providerTurnWithDefaults(providerTurnDefaults(args.options.promptOptions, `providerAsExecutor(${args.provider.name})`), args.options.taskToTurn?.(args.task, args.profile, defaultTurn) ?? defaultTurn, linked);
7577
7754
  if (args.options.defaults?.metadata?.runtimeProviderPlacement !== void 0) {
@@ -7655,8 +7832,10 @@ async function* streamProviderExecutor(args) {
7655
7832
  }
7656
7833
  if ((args.options.requireTerminalEvent ?? true) && !terminal) throw new ValidationError(`providerAsExecutor(${args.provider.name}): stream ended without a terminal result/done/status event`);
7657
7834
  yield { kind: "iteration" };
7835
+ const nativeSession = await captureNativeSessionEvidence(environment, args.profile.harness, linked);
7658
7836
  const result = {
7659
7837
  ...resultFromEvents(archive.events(), text),
7838
+ nativeSession,
7660
7839
  ...archive.superseded > 0 ? { supersededPartUpdates: archive.superseded } : {},
7661
7840
  ...explicitFailure ? { outcome: outcomeTracker.finish() } : {}
7662
7841
  };
@@ -7671,6 +7850,7 @@ async function* streamProviderExecutor(args) {
7671
7850
  };
7672
7851
  const verdict = await args.options.validator?.validate(result, {
7673
7852
  iteration: 0,
7853
+ ...args.node === void 0 ? {} : { node: args.node },
7674
7854
  box: environmentAsSandboxInstance(environment, { requireTerminalEvent: args.options.requireTerminalEvent ?? true }),
7675
7855
  signal: linked
7676
7856
  });
@@ -7691,7 +7871,7 @@ async function* streamProviderExecutor(args) {
7691
7871
  failure = source.retained ? new RetainedExecutionPendingError(error) : error;
7692
7872
  failed = true;
7693
7873
  } finally {
7694
- if ((!source.retained || settled !== void 0 && !failed) && (args.options.destroyOnSettle ?? true)) try {
7874
+ if ((!source.retained || settled !== void 0 && !failed) && !(source.retained && args.retention?.preserveEnvironment) && (args.options.destroyOnSettle ?? true)) try {
7695
7875
  await environment.destroy?.();
7696
7876
  args.onDestroyed();
7697
7877
  } catch (error) {
@@ -7782,16 +7962,26 @@ async function providerExecutionSource(args, turn, signal) {
7782
7962
  admitted = true;
7783
7963
  args.onPending(true);
7784
7964
  };
7965
+ const priorSession = retention.priorSession;
7966
+ const environmentKey = priorSession?.idempotencyKey ?? `runtime:${args.executionId}`;
7967
+ const turnId = `${args.executionId}:turn:0`;
7785
7968
  const material = {
7786
7969
  environment: {
7787
7970
  ...args.options.defaults,
7788
7971
  profile: args.createProfile,
7789
- idempotencyKey: `runtime:${args.executionId}`,
7972
+ idempotencyKey: environmentKey,
7790
7973
  signal
7791
7974
  },
7792
7975
  turn: {
7793
7976
  ...turn,
7794
- turnId: `${args.executionId}:turn:0`
7977
+ turnId
7978
+ },
7979
+ ...priorSession === void 0 ? {} : {
7980
+ existingEnvironmentId: priorSession.environmentId,
7981
+ identity: {
7982
+ sessionId: priorSession.sessionId,
7983
+ executionId: mintRetainedIdentity(environmentKey, turnId).executionId
7984
+ }
7795
7985
  }
7796
7986
  };
7797
7987
  try {
@@ -7812,7 +8002,12 @@ async function providerExecutionSource(args, turn, signal) {
7812
8002
  if (!reconnected) throw new Error("retained provider environment is unavailable");
7813
8003
  handle = reconnected;
7814
8004
  } else if (args.recovering && environmentAdmission?.phase === "environment") {
7815
- let recovered = await recoverRetainedRun({
8005
+ let recovered = material.existingEnvironmentId !== void 0 && intent?.phase === "intent" ? await recoverRetainedRun({
8006
+ provider: args.provider,
8007
+ admission: intent,
8008
+ replay: material,
8009
+ onAdmission
8010
+ }) : await recoverRetainedRun({
7816
8011
  provider: args.provider,
7817
8012
  environmentId: environmentAdmission.environmentId,
7818
8013
  sessionId: environmentAdmission.sessionId,
@@ -7855,34 +8050,53 @@ async function providerExecutionSource(args, turn, signal) {
7855
8050
  if (!environment) throw new Error("retained provider environment is unavailable");
7856
8051
  const session = exactSession(environment, handle.controlRef).session;
7857
8052
  async function* events() {
7858
- let iterator;
7859
8053
  let observationFailure;
7860
- try {
7861
- iterator = session.events({
7862
- executionId: handle.controlRef.executionId,
7863
- signal
7864
- })[Symbol.asyncIterator]();
7865
- } catch (error) {
7866
- if (signal.aborted) throw error;
7867
- observationFailure = { error };
7868
- }
7869
- try {
7870
- while (iterator !== void 0) {
7871
- let next;
7872
- try {
7873
- next = await awaitAbortable$1(Promise.resolve().then(() => iterator.next()), signal);
7874
- } catch (error) {
7875
- if (signal.aborted) throw error;
7876
- observationFailure = { error };
7877
- break;
8054
+ let lastReplayPosition;
8055
+ let sawTerminal = false;
8056
+ const drain = async function* (open) {
8057
+ let iterator;
8058
+ let failed = false;
8059
+ try {
8060
+ iterator = open()[Symbol.asyncIterator]();
8061
+ } catch (error) {
8062
+ if (signal.aborted) throw error;
8063
+ observationFailure = { error };
8064
+ return false;
8065
+ }
8066
+ try {
8067
+ while (true) {
8068
+ let next;
8069
+ try {
8070
+ next = await awaitAbortable$1(Promise.resolve().then(() => iterator.next()), signal);
8071
+ } catch (error) {
8072
+ if (signal.aborted) throw error;
8073
+ observationFailure = { error };
8074
+ failed = true;
8075
+ break;
8076
+ }
8077
+ if (next.done) break;
8078
+ assertEventBinding(next.value, handle.controlRef);
8079
+ if (next.value.id !== void 0) lastReplayPosition = next.value.id;
8080
+ if (isTerminalEnvironmentEvent(next.value)) sawTerminal = true;
8081
+ yield next.value;
7878
8082
  }
7879
- if (next.done) break;
7880
- assertEventBinding(next.value, handle.controlRef);
7881
- yield next.value;
8083
+ } finally {
8084
+ if (signal.aborted || failed) Promise.resolve().then(() => iterator?.return?.()).catch(() => void 0);
8085
+ else await iterator?.return?.();
7882
8086
  }
7883
- } finally {
7884
- if (signal.aborted || observationFailure !== void 0) Promise.resolve().then(() => iterator?.return?.()).catch(() => void 0);
7885
- else await iterator?.return?.();
8087
+ return !failed;
8088
+ };
8089
+ if (!(yield* drain(() => session.events({
8090
+ executionId: handle.controlRef.executionId,
8091
+ signal
8092
+ }))) && !sawTerminal && lastReplayPosition !== void 0) {
8093
+ const firstFailure = observationFailure;
8094
+ observationFailure = void 0;
8095
+ if (!(yield* drain(() => session.events({
8096
+ executionId: handle.controlRef.executionId,
8097
+ since: lastReplayPosition,
8098
+ signal
8099
+ })))) observationFailure = firstFailure;
7886
8100
  }
7887
8101
  let result;
7888
8102
  try {
@@ -19713,8 +19927,13 @@ function registerScopeRetainedOwner(scope, args) {
19713
19927
  const taskEvent = [...events].reverse().find((event) => event.kind === "execution-input");
19714
19928
  const start = taskEvent === void 0 ? 0 : events.indexOf(taskEvent);
19715
19929
  const attempt = events.slice(start);
19930
+ const beforeInput = taskEvent === void 0 ? [] : events.slice(0, start);
19931
+ const priorInput = [...beforeInput].reverse().find((event) => event.kind === "execution-input");
19932
+ const priorAttempt = priorInput === void 0 ? [] : beforeInput.slice(beforeInput.indexOf(priorInput));
19716
19933
  const admissions = attempt.flatMap((event) => event.kind === "execution-admitted" ? [event.admission] : []);
19717
19934
  const acceptedRef = [...attempt].reverse().find((event) => event.kind === "execution-result");
19935
+ const priorResult = [...priorAttempt].reverse().find((event) => event.kind === "execution-result");
19936
+ const priorSession = priorResult?.kind === "execution-result" ? priorAttempt.slice(0, priorAttempt.indexOf(priorResult)).reverse().flatMap((event) => event.kind === "execution-admitted" && event.admission.phase === "environment" ? [event.admission] : [])[0] : void 0;
19718
19937
  let sequence = Math.max(0, ...events.map((event) => "seq" in event ? event.seq : 0));
19719
19938
  const state = {
19720
19939
  args,
@@ -19725,11 +19944,16 @@ function registerScopeRetainedOwner(scope, args) {
19725
19944
  inputSequence: taskEvent.seq
19726
19945
  } : {},
19727
19946
  ...acceptedRef?.kind === "execution-result" ? { acceptedRef } : {},
19947
+ ...priorSession ? { priorSession } : {},
19728
19948
  context: {
19729
19949
  get executionId() {
19730
19950
  if (state.inputSequence === void 0) throw new ValidationError$1("retained owner input was not committed");
19731
19951
  return `${args.nodeId}:input:${state.inputSequence}`;
19732
19952
  },
19953
+ get priorSession() {
19954
+ return state.priorSession;
19955
+ },
19956
+ preserveEnvironment: true,
19733
19957
  admissions,
19734
19958
  onAdmission: async (admission) => {
19735
19959
  scope.signal.throwIfAborted();
@@ -19777,6 +20001,56 @@ function registerScopeRetainedOwner(scope, args) {
19777
20001
  function scopeRetainedOwnerContext(scope) {
19778
20002
  return owners.get(scope)?.context;
19779
20003
  }
20004
+ /** Bind cleanup before replay can return an already accepted owner result. */
20005
+ function bindScopeRetainedOwnerProvider(scope, provider) {
20006
+ const state = owners.get(scope);
20007
+ if (state) state.provider = provider;
20008
+ }
20009
+ /** The existing scope settlement barrier releases the owner's environment after all its turns. */
20010
+ async function releaseScopeRetainedOwnerEnvironment(scope) {
20011
+ const state = owners.get(scope);
20012
+ if (!state?.provider) return [];
20013
+ const { provider, args } = state;
20014
+ const events = await args.journal.loadTree(args.rootId) ?? [];
20015
+ const released = new Set(events.flatMap((event) => event.kind === "environment-teardown" && event.id === args.nodeId && event.provider === provider.name && event.destroyed ? [event.environmentId] : []));
20016
+ const environments = new Set(events.flatMap((event) => event.id === args.nodeId && event.kind === "execution-admitted" && event.admission.phase === "environment" ? [event.admission.environmentId] : []));
20017
+ let unconfirmed = false;
20018
+ for (const environmentId of environments) {
20019
+ if (released.has(environmentId)) continue;
20020
+ let destroyed = false;
20021
+ let detail;
20022
+ try {
20023
+ await runAbortable(async () => {
20024
+ if (!provider.get) throw new Error("provider cannot reconstruct the retained environment");
20025
+ const environment = await provider.get(environmentId);
20026
+ if (environment === null) return;
20027
+ if (environment.id !== environmentId || environment.provider !== provider.name) throw new Error("provider returned another retained environment");
20028
+ if (!environment.destroy) throw new Error("provider cannot destroy the retained environment");
20029
+ await environment.destroy();
20030
+ }, AbortSignal.timeout(3e4), "retained owner cleanup timed out");
20031
+ destroyed = true;
20032
+ } catch {
20033
+ detail = "retained owner environment cleanup was not confirmed";
20034
+ unconfirmed = true;
20035
+ }
20036
+ await args.journal.appendEvent(args.rootId, {
20037
+ kind: "environment-teardown",
20038
+ id: args.nodeId,
20039
+ provider: provider.name,
20040
+ environmentId,
20041
+ destroyed,
20042
+ ...detail === void 0 ? {} : { detail },
20043
+ seq: state.nextSequence(),
20044
+ at: new Date(args.now()).toISOString()
20045
+ });
20046
+ }
20047
+ return unconfirmed ? [{
20048
+ id: args.nodeId,
20049
+ label: "scope owner",
20050
+ runtime: provider.name,
20051
+ status: "done"
20052
+ }] : [];
20053
+ }
19780
20054
  /** Resume the original backend prompt; rebuilt coordination observations cannot replace it. */
19781
20055
  async function prepareScopeRetainedOwnerTask(scope, task) {
19782
20056
  const state = owners.get(scope);
@@ -19794,6 +20068,8 @@ async function prepareScopeRetainedOwnerTask(scope, task) {
19794
20068
  if (accepted?.kind === "execution-result") state.acceptedRef = accepted;
19795
20069
  }
19796
20070
  if (state.prepared && state.acceptedRef && state.acceptedConsumed) {
20071
+ const currentEnvironment = [...state.admissions].reverse().find((admission) => admission.phase === "environment");
20072
+ if (currentEnvironment?.phase === "environment") state.priorSession = currentEnvironment;
19797
20073
  delete state.inputSequence;
19798
20074
  delete state.taskRef;
19799
20075
  delete state.acceptedRef;
@@ -20085,6 +20361,8 @@ async function startScopeRecoveries(scope) {
20085
20361
  async function releaseRetainedEnvironments(scope) {
20086
20362
  const release = retainedReleasers.get(scope);
20087
20363
  if (release) await release();
20364
+ const ownerUnconfirmed = await releaseScopeRetainedOwnerEnvironment(scope);
20365
+ return [...scope.workerCapacity.unconfirmed, ...ownerUnconfirmed];
20088
20366
  }
20089
20367
  /**
20090
20368
  * @internal Close this scope to NEW children. Idempotent, synchronous, and irreversible.
@@ -20388,6 +20666,7 @@ function createScope(args) {
20388
20666
  rootId: args.root,
20389
20667
  parentId: args.parentId,
20390
20668
  nodeId: id,
20669
+ depth: args.depth + 1,
20391
20670
  attemptId,
20392
20671
  ...identity ? { identity } : {}
20393
20672
  },
@@ -21060,6 +21339,7 @@ function createScope(args) {
21060
21339
  journal: args.journal,
21061
21340
  root: args.ownerMaterialization.journalRoot ?? args.root,
21062
21341
  nodeId: args.ownerMaterialization.nodeId ?? args.parentId,
21342
+ depth: args.depth,
21063
21343
  runtime: args.ownerMaterialization.runtime,
21064
21344
  attemptId: args.ownerMaterialization.attemptId,
21065
21345
  ...authoredProfile === void 0 ? {} : { authoredProfile },
@@ -21245,6 +21525,7 @@ function scopeOwnerExecutorNodeContext(scope) {
21245
21525
  rootId: state.root,
21246
21526
  parentId: state.nodeId,
21247
21527
  nodeId: state.nodeId,
21528
+ depth: state.depth,
21248
21529
  attemptId: state.attemptId
21249
21530
  });
21250
21531
  }
@@ -22373,8 +22654,7 @@ const driverExecutorFactory = (rawSpec, ctx) => {
22373
22654
  },
22374
22655
  async releaseRetained() {
22375
22656
  if (nestedScopeHeld === void 0) return [];
22376
- await releaseRetainedEnvironments(nestedScopeHeld);
22377
- unconfirmedDescendants = nestedScopeHeld.workerCapacity.unconfirmed.map((node) => node.id);
22657
+ unconfirmedDescendants = (await releaseRetainedEnvironments(nestedScopeHeld)).map((node) => node.id);
22378
22658
  return [];
22379
22659
  },
22380
22660
  resultArtifact() {
@@ -22914,29 +23194,49 @@ const collectDelivered = (ctx) => {
22914
23194
  * Run a finalizer over a settled-worker ledger under the delivered-only invariant: filter the
22915
23195
  * ledger to structurally delivered children, materialize their outputs, and hand the finalizer a
22916
23196
  * blob reader that throws on any ref outside that set. This is the one call site both driver arms
22917
- * (the in-process tool-loop and the MCP-mounted harness) finalize through.
23197
+ * (the in-process tool-loop and the MCP-mounted harness) finalize through. When a parent declares
23198
+ * a deliverable, its candidate must also pass that check: children may have narrower assignments.
23199
+ * The default selects the highest-scoring child that passes the parent's check; custom finalizers
23200
+ * assemble their candidate before the check. A rejection leaves the parent incomplete; a thrown
23201
+ * oracle surfaces a validation error. Neither changes child validity.
22918
23202
  */
22919
23203
  async function runFinalizer(finalizer, args) {
22920
23204
  const deliveredRows = args.settled.filter((w) => w.status === "done" && w.valid === true);
22921
23205
  const deliveredRefs = /* @__PURE__ */ new Set();
22922
23206
  for (const w of deliveredRows) if (w.outRef !== void 0) deliveredRefs.add(w.outRef);
22923
- return finalizer({
22924
- delivered: await Promise.all(deliveredRows.map(async (w) => ({
22925
- id: w.id,
22926
- ...w.score !== void 0 ? { score: w.score } : {},
22927
- ...w.outRef !== void 0 ? {
22928
- outRef: w.outRef,
22929
- out: await args.blobs.get(w.outRef)
22930
- } : {}
22931
- }))),
23207
+ const delivered = await Promise.all(deliveredRows.map(async (w) => ({
23208
+ id: w.id,
23209
+ ...w.score !== void 0 ? { score: w.score } : {},
23210
+ ...w.outRef !== void 0 ? {
23211
+ outRef: w.outRef,
23212
+ out: await args.blobs.get(w.outRef)
23213
+ } : {}
23214
+ })));
23215
+ const guardedBlobs = { get: (outRef) => {
23216
+ if (!deliveredRefs.has(outRef)) throw new ValidationError$1(`finalizer: outRef '${outRef}' is not a DELIVERED child's result — a finalizer may only operate on outputs that settled done and passed their completion oracle`);
23217
+ return args.blobs.get(outRef);
23218
+ } };
23219
+ const accepted = async (candidate) => {
23220
+ if (candidate === void 0) return false;
23221
+ if (args.deliverable === void 0) return true;
23222
+ try {
23223
+ return await args.deliverable.check(candidate) === true;
23224
+ } catch (error) {
23225
+ throw new ValidationError$1(`finalizer: parent completion check threw: ${error instanceof Error ? error.message : String(error)}`);
23226
+ }
23227
+ };
23228
+ if (finalizer === bestDelivered && args.deliverable !== void 0) {
23229
+ for (const output of [...delivered].sort((a, b) => (b.score ?? 0) - (a.score ?? 0))) if (await accepted(output.out)) return output.out;
23230
+ return;
23231
+ }
23232
+ const candidate = await finalizer({
23233
+ delivered,
22932
23234
  allSettled: args.settled,
22933
23235
  tree: args.tree,
22934
- blobs: { get: (outRef) => {
22935
- if (!deliveredRefs.has(outRef)) throw new ValidationError$1(`finalizer: outRef '${outRef}' is not a DELIVERED child's result — a finalizer may only operate on outputs that settled done and passed their completion oracle`);
22936
- return args.blobs.get(outRef);
22937
- } },
23236
+ blobs: guardedBlobs,
22938
23237
  budget: args.budget
22939
23238
  });
23239
+ return await accepted(candidate) ? candidate : void 0;
22940
23240
  }
22941
23241
  //#endregion
22942
23242
  //#region src/runtime/supervise/supervisor.ts
@@ -23294,10 +23594,7 @@ function createSupervisor() {
23294
23594
  const settleGraceMs = !controller.signal.aborted ? boundedSettleGrace(opts.childSettleGraceMs, rootDeadlineAtMs, now) : 0;
23295
23595
  try {
23296
23596
  teardownUnconfirmed = await drainLiveChildren(openScope, controller, settleGraceMs);
23297
- if (retainedAtSettlement === "release") {
23298
- await releaseRetainedEnvironments(openScope);
23299
- teardownUnconfirmed = openScope.workerCapacity.unconfirmed;
23300
- }
23597
+ if (retainedAtSettlement === "release") teardownUnconfirmed = await releaseRetainedEnvironments(openScope);
23301
23598
  for (const node of teardownUnconfirmed) await opts.journal.appendEvent(opts.runId, {
23302
23599
  kind: "teardown-unconfirmed",
23303
23600
  id: node.id,
@@ -23689,6 +23986,6 @@ function isNonEmptySpend(s) {
23689
23986
  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);
23690
23987
  }
23691
23988
  //#endregion
23692
- export { cliInPlaceExecutor as $, generateSpanId as $n, runtimeOwnedExecutorProviderEvidence as $r, createCodexRolloutStoreReader as $t, waitUntil as A, sleep as Ai, abortError as An, renderProfileMaterializationIssues as Ar, WORKER_TRACE_PROPAGATION as At, readWorkerInteractiveBinding as B, decodeHarnessUsage as Bi, resolveRedactor as Bn, attestRuntimeOwnedPendingExecutor as Br, AUTHORITY_MARKERS as Bt, scopeOwnerExecutorNodeContext as C, chargedTokens as Ci, sandboxClientAsProvider as Cn, defineProfileMaterializationContract as Cr, BudgetReconcileFault as Ct, pollFor as D, isAbortError$2 as Di, registerRetainedExecutorPreparation as Dn, promptModelProfileMaterialization as Dr, newUsageTotals as Dt, isWaitOutcome as E, hasCompleteCacheBreakdown as Ei, sandboxSessionTraceSource as En, promptControlProfileMaterialization as Er, meterUsageEvent as Et, scopeRetainedOwnerResult as F, withTimeout as Fi, startRetainedRun as Fn, worktreeCliProfileMaterialization as Fr, taskToPrompt as Ft, startRetainedInteractiveRun as G, teardownExecutor as Gi, INTELLIGENCE_WIRE_VERSION as Gn, knownExecutionBindingReceipt as Gr, isPeerMailEnvelope as Gt, workerInteractiveBindingsDir as H, awaitAbortable$1 as Hi, mergeTraceEnv as Hn, authoredProfileDigest as Hr, PEER_MAIL_WIRE_KEY as Ht, interactiveAdmissionSeamKey as I, zeroSpend as Ii, startRetainedRunInEnvironment as In, isNoEntError as Ir, DEFAULT_STALL_AFTER_MS as It, freeSlots as J, providerMessageText as Ji, buildRuntimeEventOtelSpans as Jn, providerAttemptEvidence as Jr, isLiveNodeStatus as Jt, destroyInteractiveEnvironment as K, promptFromAgentTurnInput as Ki, buildLoopOtelSpans as Kn, knownMaterializationReceipt as Kr, peerMailTools as Kt, readWorkerInteractiveAdmissions as L, addResourceSpend as Li, retainedCreateMaterial as Ln, parseCommittedJsonLines as Lr, createActivityLog as Lt, prepareScopeRetainedOwnerTask as M, throwAbort as Mi, runAbortable as Mn, sandboxActProfileMaterialization as Mr, workerTraceEnv as Mt, scopeRetainedOwnerContext as N, throwIfAborted as Ni, reconnectRetainedRun as Nn, unsupportedProfileDimensions as Nr, workerTraceHeaders as Nt, timerAt as O, promptCacheTokenClasses as Oi, retainedExecutorSeamKey as On, promptOnlyProfileMaterialization as Or, spendFromUsageEvents as Ot, scopeRetainedOwnerPriorSpend as P, unmeteredSpend as Pi, recoverRetainedRun as Pn, validateProfileMaterialization as Pr, workerTraceSeamKey as Pt, captureReusableExecutorConfig as Q, flatOtelSpan as Qn, runtimeOwnedExecutorMaterialization as Qr, addHarnessUsage as Qt, workerInteractiveAdmissionFile as R, resourceTelemetry as Ri, defaultRedactor as Rn, prepareJsonlAppend as Rr, readWorkerProgress as Rt, restoreScopeOwnerAcceptedExecution as S, addSpend as Si, resolveAgentEnvironmentProvider as Sn, controlProfileMaterialization as Sr, contentAddress as St, createWaitProbes as T, deleteBoxSafe as Ti, decodeToolPart as Tn, profileMaterializationAxes$1 as Tr, createBudgetPool as Tt, reconnectRetainedInteractiveRun as U, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Ui, readTraceContextFromEnv as Un, finalizeRuntimeOwnedPendingExecutor as Ur, claimsAuthority as Ut, workerInteractiveBindingFile as V, abortError$2 as Vi, createPropagatingTraceEmitter as Vn, attestRuntimeOwnedScopeOwner as Vr, DEFAULT_PEER_MAIL_LIMITS as Vt, recoverRetainedInteractiveRun as W, armDeadlineTimer as Wi, traceContextToEnv as Wn, inheritRuntimeOwnedExecutorAttestation as Wr, createPeerMailbox as Wt, rollingDispatch as X, createOtelExporter as Xn, runtimeOwnedDriveHarnessProviderEvidence as Xr, bridgeAdmissionRefusal as Xt, queueOf as Y, createOpenInferenceFileExporter as Yn, recordRuntimeOwnedDriveHarnessProviderEvidence as Yr, isTerminalNodeStatus as Yt, bindReusableExecutorExecutionId as Z, exportEvalRuns as Zn, runtimeOwnedExecutorExecutionBinding as Zr, bridgeModelRouteRefusal as Zt, createScope as _, mapSandboxToolEvent as _i, observedModelMatchesDeclared as _n, localHarnessExecutable as _r, WORKER_TOOL_TRACE_SCHEMA_VERSION as _t, pickBestDelivered as a, executableAgentSpecSnapshot as ai, createSandboxForSpec as an, createRuntimeStreamEventCollector as ar, DEFAULT_SANDBOX_STEERING_MAX_TURNS as at, meterRuntimeOwnedProviderAttempt as b, sandboxProgressEvents as bi, providerAsExecutor as bn, AGENT_PROFILE_MATERIALIZATION_AXES as br, parseWorkerToolTraceArtifact as bt, DriverAttemptsExhaustedError as c, projectSandboxOutcome as ci, runAgentRounds as cn, sanitizeRuntimeStreamEvent as cr, FileResultBlobStore as ct, runDriverWithRetry as d, canonicalStreamEventFromSandboxEvent as di, acquireSandbox as dn, captureWorktreeDiff as dr, InMemorySpawnJournal as dt, runtimeOwnedPendingExecutorMaterialization as ei, harnessUsageIsEmpty as en, loopEventToOtelSpan as er, cliWorktreeExecutor as et, driverChild as f, createSandboxToolPartState as fi, assertBoxlessPromptOptions as fn, createWorktree as fr, insideCursorNamespace as ft, beginScopeOwnerAttempt as g, mapSandboxEvent as gi, canonicalObservedModelParts as gn, harnessSupportsReasoningEffort as gr, replaySpawnTree as gt, withDriverExecutor as h, isSandboxTerminalEvent as hi, runBrainLoop as hn, LOCAL_HARNESSES as hr, pendingWaits as ht, collectDelivered as i, executableAgentProfileSnapshot as ii, TERMINAL_DECISIONS as in, createRuntimeEventCollector as ir, createWorktreeCliExecutor as it, consumeScopeRetainedOwnerResult as j, stringifySafe as ji, linkAbort as jn, renderUnsupported as jr, readWorkerTraceContext as jt, validateWaitSpec as k, randomSuffix as ki, RunCancellationReason as kn, promptResourceProfileMaterialization as kr, spendFromUsageTotals as kt, classifyDriverFailure as l, readSandboxOutcome as li, createSandboxLineage as ln, runSettledCommand as lr, FileSpawnJournal as lt, isDriverSpec as m, extractLlmCallEvent as mi, routerBrain as mn, DEFAULT_LOCAL_HARNESS as mr, materializeTreeView as mt, createSupervisor as n, unknownExecutionBindingReceipt as ni, bridgeRuntimeAttachmentsKey as nn, padTraceId as nr, createExecutorRegistry as nt, runFinalizer as o, detachedFrozen as oi, defaultSelectWinner as on, sanitizeAgentRuntimeEvent as or, createSteerableSandboxSession as ot, driverExecutorFactory as p, createSandboxUsageLedger as pi, readPromptOptions as pn, removeWorktree as pr, loadSpawnForest as pt, effectiveConcurrency as q, promptOptionsFromAgentTurnInput as qi, buildLoopSpanNodes as qn, newExecutionAttemptId as qr, peerMailVerbNames as qt, bestDelivered as r, unknownMaterializationReceipt as ri, bridgeStopSignalKey as rn, toOtelAttributes as rr, snapshotExecutorConfig as rt, runTree as s, detachedSnapshot as si, isTerminalDecision as sn, sanitizeKnowledgeReadinessReport as sr, createInPlaceCliExecutor as st, createRootHandle as t, runtimeOwnedScopeOwnerRuntime as ti, readCodexRolloutSession as tn, padSpanId as tr, createExecutor as tt, defaultUnmetContractSteer as u, assertSandboxServedModel as ui, probeSandboxCapabilities as un, runWorktreeHarness as ur, InMemoryResultBlobStore as ut, deriveNodeExecutionIdentity as v, notifySandboxEventObserver as vi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as vn, parseCodexTokenUsage as vr, captureWorkerTraceEvidence as vt, settledToIteration as w, cloneSpend as wi, createPushTraceSource as wn, fullProfileMaterialization as wr, assertValidBudget as wt, recordScopeOwnerMaterialization as x, sumSandboxUsage as xi, providerAsSandboxClient as xn, assertProfileMaterialization as xr, workerTraceAnalysisStore as xt, meterRuntimeOwnedAccounting as y, sandboxEventServedBackend as yi, createAgentEnvironmentProviderRegistry as yn, CodexExecutionDiagnosticError as yr, isTraceAnalysisStore as yt, attachWorker as z, withBudgetResources as zi, defaultRedactorIdentityMaterial as zn, writeAllBytes as zr, createInbox as zt };
23989
+ export { captureReusableExecutorConfig as $, flatOtelSpan as $n, runtimeOwnedExecutorMaterialization as $r, addHarnessUsage as $t, waitUntil as A, randomSuffix as Ai, RunCancellationReason as An, promptResourceProfileMaterialization as Ar, spendFromUsageTotals as At, attachWorker as B, withBudgetResources as Bi, defaultRedactorIdentityMaterial as Bn, writeAllBytes as Br, createInbox as Bt, scopeOwnerExecutorNodeContext as C, addSpend as Ci, resolveAgentEnvironmentProvider as Cn, controlProfileMaterialization as Cr, contentAddress as Ct, pollFor as D, hasCompleteCacheBreakdown as Di, sandboxSessionTraceSource as Dn, promptControlProfileMaterialization as Dr, meterUsageEvent as Dt, isWaitOutcome as E, deleteBoxSafe as Ei, decodeToolPart as En, profileMaterializationAxes$1 as Er, createBudgetPool as Et, scopeRetainedOwnerPriorSpend as F, unmeteredSpend as Fi, recoverRetainedRun as Fn, validateProfileMaterialization as Fr, workerTraceSeamKey as Ft, recoverRetainedInteractiveRun as G, armDeadlineTimer as Gi, traceContextToEnv as Gn, inheritRuntimeOwnedExecutorAttestation as Gr, createPeerMailbox as Gt, workerInteractiveBindingFile as H, abortError$2 as Hi, createPropagatingTraceEmitter as Hn, attestRuntimeOwnedScopeOwner as Hr, DEFAULT_PEER_MAIL_LIMITS as Ht, scopeRetainedOwnerResult as I, withTimeout as Ii, startRetainedRun as In, worktreeCliProfileMaterialization as Ir, taskToPrompt as It, effectiveConcurrency as J, promptOptionsFromAgentTurnInput as Ji, buildLoopSpanNodes as Jn, newExecutionAttemptId as Jr, peerMailVerbNames as Jt, startRetainedInteractiveRun as K, teardownExecutor as Ki, INTELLIGENCE_WIRE_VERSION as Kn, knownExecutionBindingReceipt as Kr, isPeerMailEnvelope as Kt, interactiveAdmissionSeamKey as L, zeroSpend as Li, startRetainedRunInEnvironment as Ln, isNoEntError as Lr, DEFAULT_STALL_AFTER_MS as Lt, consumeScopeRetainedOwnerResult as M, stringifySafe as Mi, linkAbort as Mn, renderUnsupported as Mr, readWorkerTraceContext as Mt, prepareScopeRetainedOwnerTask as N, throwAbort as Ni, runAbortable as Nn, sandboxActProfileMaterialization as Nr, workerTraceEnv as Nt, timerAt as O, isAbortError$2 as Oi, registerRetainedExecutorPreparation as On, promptModelProfileMaterialization as Or, newUsageTotals as Ot, scopeRetainedOwnerContext as P, throwIfAborted as Pi, reconnectRetainedRun as Pn, unsupportedProfileDimensions as Pr, workerTraceHeaders as Pt, bindReusableExecutorExecutionId as Q, exportEvalRuns as Qn, runtimeOwnedExecutorExecutionBinding as Qr, bridgeModelRouteRefusal as Qt, readWorkerInteractiveAdmissions as R, addResourceSpend as Ri, retainedCreateMaterial as Rn, parseCommittedJsonLines as Rr, createActivityLog as Rt, restoreScopeOwnerAcceptedExecution as S, sumSandboxUsage as Si, providerAsSandboxClient as Sn, assertProfileMaterialization as Sr, workerTraceAnalysisStore as St, createWaitProbes as T, cloneSpend as Ti, createPushTraceSource as Tn, fullProfileMaterialization as Tr, assertValidBudget as Tt, workerInteractiveBindingsDir as U, awaitAbortable$1 as Ui, mergeTraceEnv as Un, authoredProfileDigest as Ur, PEER_MAIL_WIRE_KEY as Ut, readWorkerInteractiveBinding as V, decodeHarnessUsage as Vi, resolveRedactor as Vn, attestRuntimeOwnedPendingExecutor as Vr, AUTHORITY_MARKERS as Vt, reconnectRetainedInteractiveRun as W, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Wi, readTraceContextFromEnv as Wn, finalizeRuntimeOwnedPendingExecutor as Wr, claimsAuthority as Wt, queueOf as X, createOpenInferenceFileExporter as Xn, recordRuntimeOwnedDriveHarnessProviderEvidence as Xr, isTerminalNodeStatus as Xt, freeSlots as Y, providerMessageText as Yi, buildRuntimeEventOtelSpans as Yn, providerAttemptEvidence as Yr, isLiveNodeStatus as Yt, rollingDispatch as Z, createOtelExporter as Zn, runtimeOwnedDriveHarnessProviderEvidence as Zr, bridgeAdmissionRefusal as Zt, createScope as _, mapSandboxEvent as _i, canonicalObservedModelParts as _n, harnessSupportsReasoningEffort as _r, replaySpawnTree as _t, pickBestDelivered as a, executableAgentProfileSnapshot as ai, TERMINAL_DECISIONS as an, createRuntimeEventCollector as ar, createWorktreeCliExecutor as at, meterRuntimeOwnedProviderAttempt as b, sandboxEventServedBackend as bi, createAgentEnvironmentProviderRegistry as bn, CodexExecutionDiagnosticError as br, isTraceAnalysisStore as bt, DriverAttemptsExhaustedError as c, detachedSnapshot as ci, isTerminalDecision as cn, sanitizeKnowledgeReadinessReport as cr, createInPlaceCliExecutor as ct, runDriverWithRetry as d, assertSandboxServedModel as di, probeSandboxCapabilities as dn, runWorktreeHarness as dr, InMemoryResultBlobStore as dt, runtimeOwnedExecutorProviderEvidence as ei, createCodexRolloutStoreReader as en, generateSpanId as er, cliInPlaceExecutor as et, driverChild as f, canonicalStreamEventFromSandboxEvent as fi, acquireSandbox as fn, captureWorktreeDiff as fr, InMemorySpawnJournal as ft, beginScopeOwnerAttempt as g, isSandboxTerminalEvent as gi, runBrainLoop as gn, LOCAL_HARNESSES as gr, pendingWaits as gt, withDriverExecutor as h, extractLlmCallEvent as hi, routerBrain as hn, DEFAULT_LOCAL_HARNESS as hr, materializeTreeView as ht, collectDelivered as i, unknownMaterializationReceipt as ii, bridgeStopSignalKey as in, toOtelAttributes as ir, snapshotExecutorConfig as it, bindScopeRetainedOwnerProvider as j, sleep as ji, abortError as jn, renderProfileMaterializationIssues as jr, WORKER_TRACE_PROPAGATION as jt, validateWaitSpec as k, promptCacheTokenClasses as ki, retainedExecutorSeamKey as kn, promptOnlyProfileMaterialization as kr, spendFromUsageEvents as kt, classifyDriverFailure as l, projectSandboxOutcome as li, runAgentRounds as ln, sanitizeRuntimeStreamEvent as lr, FileResultBlobStore as lt, isDriverSpec as m, createSandboxUsageLedger as mi, readPromptOptions as mn, removeWorktree as mr, loadSpawnForest as mt, createSupervisor as n, runtimeOwnedScopeOwnerRuntime as ni, readCodexRolloutSession as nn, padSpanId as nr, createExecutor as nt, runFinalizer as o, executableAgentSpecSnapshot as oi, createSandboxForSpec as on, createRuntimeStreamEventCollector as or, DEFAULT_SANDBOX_STEERING_MAX_TURNS as ot, driverExecutorFactory as p, createSandboxToolPartState as pi, assertBoxlessPromptOptions as pn, createWorktree as pr, insideCursorNamespace as pt, destroyInteractiveEnvironment as q, promptFromAgentTurnInput as qi, buildLoopOtelSpans as qn, knownMaterializationReceipt as qr, peerMailTools as qt, bestDelivered as r, unknownExecutionBindingReceipt as ri, bridgeRuntimeAttachmentsKey as rn, padTraceId as rr, createExecutorRegistry as rt, runTree as s, detachedFrozen as si, defaultSelectWinner as sn, sanitizeAgentRuntimeEvent as sr, createSteerableSandboxSession as st, createRootHandle as t, runtimeOwnedPendingExecutorMaterialization as ti, harnessUsageIsEmpty as tn, loopEventToOtelSpan as tr, cliWorktreeExecutor as tt, defaultUnmetContractSteer as u, readSandboxOutcome as ui, createSandboxLineage as un, runSettledCommand as ur, FileSpawnJournal as ut, deriveNodeExecutionIdentity as v, mapSandboxToolEvent as vi, observedModelMatchesDeclared as vn, localHarnessExecutable as vr, WORKER_TOOL_TRACE_SCHEMA_VERSION as vt, settledToIteration as w, chargedTokens as wi, sandboxClientAsProvider as wn, defineProfileMaterializationContract as wr, BudgetReconcileFault as wt, recordScopeOwnerMaterialization as x, sandboxProgressEvents as xi, providerAsExecutor as xn, AGENT_PROFILE_MATERIALIZATION_AXES as xr, parseWorkerToolTraceArtifact as xt, meterRuntimeOwnedAccounting as y, notifySandboxEventObserver as yi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as yn, parseCodexTokenUsage as yr, captureWorkerTraceEvidence as yt, workerInteractiveAdmissionFile as z, resourceTelemetry as zi, defaultRedactor as zn, prepareJsonlAppend as zr, readWorkerProgress as zt };
23693
23990
 
23694
- //# sourceMappingURL=supervisor-DBnQuTyJ.js.map
23991
+ //# sourceMappingURL=supervisor-DFsXULnE.js.map