@tangle-network/agent-runtime 0.234.0 → 0.235.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 (54) hide show
  1. package/dist/{activation-Cn46_olL.d.ts → activation-Bhtf60o1.d.ts} +2 -2
  2. package/dist/{activation-CpOaRyAq.js → activation-CdEMY3fE.js} +2 -2
  3. package/dist/{activation-CpOaRyAq.js.map → activation-CdEMY3fE.js.map} +1 -1
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-DkFbin3_.js → coordination-driver-BdvDqtr6.js} +2 -2
  7. package/dist/{coordination-driver-DkFbin3_.js.map → coordination-driver-BdvDqtr6.js.map} +1 -1
  8. package/dist/{delegate-WTGSrhP9.js → delegate-CLqwO3XJ.js} +2 -2
  9. package/dist/{delegate-WTGSrhP9.js.map → delegate-CLqwO3XJ.js.map} +1 -1
  10. package/dist/durable.d.ts +4 -2
  11. package/dist/durable.js +4 -2
  12. package/dist/durable.js.map +1 -1
  13. package/dist/{graph-XtkRzpzm.js → graph-_7GsEHCW.js} +3 -3
  14. package/dist/{graph-XtkRzpzm.js.map → graph-_7GsEHCW.js.map} +1 -1
  15. package/dist/{improvement-cycle-DIMrY4Wn.js → improvement-cycle-h7MPWCa8.js} +3 -3
  16. package/dist/{improvement-cycle-DIMrY4Wn.js.map → improvement-cycle-h7MPWCa8.js.map} +1 -1
  17. package/dist/{index-DLOc9m2k.d.ts → index-BjXc69fl.d.ts} +4 -17
  18. package/dist/index.d.ts +6 -6
  19. package/dist/index.js +7 -7
  20. package/dist/intelligence.d.ts +3 -3
  21. package/dist/intelligence.js +3 -3
  22. package/dist/kernel.d.ts +4 -4
  23. package/dist/kernel.js +8 -8
  24. package/dist/{loop-runner-bin-D3vx1A5I.d.ts → loop-runner-bin-D25C7bpo.d.ts} +3 -3
  25. package/dist/{loop-runner-bin-B8YWfVxb.js → loop-runner-bin-nhOzvSwt.js} +3 -3
  26. package/dist/{loop-runner-bin-B8YWfVxb.js.map → loop-runner-bin-nhOzvSwt.js.map} +1 -1
  27. package/dist/loop-runner-bin.d.ts +1 -1
  28. package/dist/loop-runner-bin.js +1 -1
  29. package/dist/mcp/bin.js +3 -3
  30. package/dist/mcp/index.d.ts +5 -5
  31. package/dist/mcp/index.js +4 -4
  32. package/dist/{openai-tools-Dw6nMy2Q.d.ts → openai-tools-C1KOogww.d.ts} +2 -2
  33. package/dist/profiles.d.ts +2 -2
  34. package/dist/{provision-supervisor-DaJybV0q.js → provision-supervisor-Bq_c8ktm.js} +3 -3
  35. package/dist/{provision-supervisor-DaJybV0q.js.map → provision-supervisor-Bq_c8ktm.js.map} +1 -1
  36. package/dist/{runtime-Bp_mBC1J.js → runtime-yyb6Y9E7.js} +8 -8
  37. package/dist/{runtime-Bp_mBC1J.js.map → runtime-yyb6Y9E7.js.map} +1 -1
  38. package/dist/{server-eulZM_6a.js → server-CEhC75Si.js} +3 -3
  39. package/dist/{server-eulZM_6a.js.map → server-CEhC75Si.js.map} +1 -1
  40. package/dist/{stream-agent-turn-B1WIS5nm.d.ts → stream-agent-turn-Bh-WPrfq.d.ts} +2 -2
  41. package/dist/{structural-rollout-mEcjW8yf.js → structural-rollout-CVjwxyUY.js} +2 -2
  42. package/dist/{structural-rollout-mEcjW8yf.js.map → structural-rollout-CVjwxyUY.js.map} +1 -1
  43. package/dist/{substrate-B5F8VTD4.d.ts → substrate-BqKme48t.d.ts} +2 -2
  44. package/dist/{supervise-CI0H54R5.js → supervise-hlZ9YD3l.js} +3 -3
  45. package/dist/{supervise-CI0H54R5.js.map → supervise-hlZ9YD3l.js.map} +1 -1
  46. package/dist/{supervisor-DMX3Ouel.js → supervisor-DWiZ2Wgx.js} +153 -23
  47. package/dist/supervisor-DWiZ2Wgx.js.map +1 -0
  48. package/dist/testing.d.ts +2 -2
  49. package/dist/testing.js +12 -12
  50. package/dist/tui/index.d.ts +1 -1
  51. package/dist/tui/index.js +1 -1
  52. package/dist/{types-DWFoAk65.d.ts → types-DGhYyHOA.d.ts} +65 -2
  53. package/package.json +1 -1
  54. package/dist/supervisor-DMX3Ouel.js.map +0 -1
@@ -6239,6 +6239,23 @@ function assertRequestedInteractionCapabilities(providerName, requested, capabil
6239
6239
  }
6240
6240
  //#endregion
6241
6241
  //#region src/runtime/retained-run-events.ts
6242
+ /** The runtime's own contract checks inside the stream loop, so the catch can tell a broken
6243
+ * answer (a verdict) from a read the provider's iterator failed (a wrapper). */
6244
+ const runtimeChecks = /* @__PURE__ */ new WeakSet();
6245
+ function contractCheckFailed(message) {
6246
+ const error = new Error(message);
6247
+ runtimeChecks.add(error);
6248
+ throw error;
6249
+ }
6250
+ /** Run one of the runtime's own checks; whatever it throws is a verdict, not a failed read. */
6251
+ function verdict(check) {
6252
+ try {
6253
+ return check();
6254
+ } catch (error) {
6255
+ if (error instanceof Error) runtimeChecks.add(error);
6256
+ throw error;
6257
+ }
6258
+ }
6242
6259
  async function* retainedRunEvents(session, controlRef, options, now) {
6243
6260
  const after = options?.after;
6244
6261
  if (after) {
@@ -6261,24 +6278,24 @@ async function* retainedRunEvents(session, controlRef, options, now) {
6261
6278
  const source = next.value;
6262
6279
  const identity = extractTransportEventIdentity(source);
6263
6280
  const sourceCursor = identity.cursor ?? identity.eventId;
6264
- assertEventBinding(source, controlRef);
6281
+ verdict(() => assertEventBinding(source, controlRef));
6265
6282
  if (sourceCursor === after?.cursor) continue;
6266
6283
  const event = canonicalEvent(source);
6267
6284
  if (!event) continue;
6268
- assertCanonicalEventBinding(controlRef, event);
6285
+ verdict(() => assertCanonicalEventBinding(controlRef, event));
6269
6286
  if (firstAfterEvent && after !== void 0) {
6270
- if (identity.sequence !== void 0 && identity.sequence <= after.sequence) throw new Error("provider replay did not prove that the first event follows the requested cursor");
6287
+ if (identity.sequence !== void 0 && identity.sequence <= after.sequence) contractCheckFailed("provider replay did not prove that the first event follows the requested cursor");
6271
6288
  firstAfterEvent = false;
6272
6289
  }
6273
6290
  const eventId = identity.eventId ?? identity.cursor;
6274
- if (!eventId) throw new Error("replayable canonical event has no stable provider event id or cursor");
6291
+ if (!eventId) contractCheckFailed("replayable canonical event has no stable provider event id or cursor");
6275
6292
  assertStableText(eventId, "provider event id");
6276
- if (seen.has(eventId)) throw new Error(`provider replay repeated event id "${eventId}"`);
6293
+ if (seen.has(eventId)) contractCheckFailed(`provider replay repeated event id "${eventId}"`);
6277
6294
  seen.add(eventId);
6278
6295
  const sequence = identity.sequence ?? nextSequence;
6279
- if (sequence <= lastSequence) throw new Error(`provider event sequence is not monotonic: ${sequence} follows ${lastSequence}`);
6296
+ if (sequence <= lastSequence) contractCheckFailed(`provider event sequence is not monotonic: ${sequence} follows ${lastSequence}`);
6280
6297
  const occurredAt = identity.occurredAt;
6281
- yield RuntimeEventEnvelopeSchema.parse({
6298
+ yield verdict(() => RuntimeEventEnvelopeSchema.parse({
6282
6299
  runId: controlRef.runId,
6283
6300
  eventId,
6284
6301
  sequence,
@@ -6286,7 +6303,7 @@ async function* retainedRunEvents(session, controlRef, options, now) {
6286
6303
  ...occurredAt === void 0 ? {} : { occurredAt },
6287
6304
  receivedAt: new Date(now()).toISOString(),
6288
6305
  event
6289
- });
6306
+ }));
6290
6307
  lastSequence = sequence;
6291
6308
  nextSequence = sequence + 1;
6292
6309
  }
@@ -6298,8 +6315,9 @@ async function* retainedRunEvents(session, controlRef, options, now) {
6298
6315
  throw abortError$2(options.signal.reason);
6299
6316
  }
6300
6317
  if (error instanceof RetainedRunProviderContractError) throw error;
6318
+ const fromProvider = error instanceof Error && !runtimeChecks.has(error);
6301
6319
  throw new RetainedRunProviderContractError(error instanceof Error ? error.message : "provider retained event stream failed", {
6302
- code: "RETAINED_EVENT_STREAM_INVALID",
6320
+ code: fromProvider ? "RETAINED_EVENT_STREAM_READ_FAILED" : "RETAINED_EVENT_STREAM_INVALID",
6303
6321
  cause: error
6304
6322
  });
6305
6323
  } finally {
@@ -7208,11 +7226,102 @@ const retainedExecutorSeamKey = "runtime.retainedExecutor";
7208
7226
  function retainedExecutorContext(ctx) {
7209
7227
  return ctx.seams[retainedExecutorSeamKey];
7210
7228
  }
7211
- /** Local observation stopped; the retained provider execution has no accepted terminal result. */
7229
+ const causeMessages = {
7230
+ unobservable: "retained provider execution requires reconciliation before replacement",
7231
+ "provider-contract": "retained provider execution ended on a provider contract violation; nothing to reconcile",
7232
+ "request-rejected": "retained provider execution was refused before it ran; nothing to reconcile",
7233
+ transport: "retained provider execution lost its transport; status in doubt",
7234
+ "nested-recovery": "retained nested execution requires recovery before replacement"
7235
+ };
7236
+ /** The contract-error codes that wrap a failed READ rather than name a broken answer. */
7237
+ const readFailureCodes = /* @__PURE__ */ new Set(["RETAINED_RESULT_READ_FAILED", "RETAINED_CONTROL_REF_READ_FAILED"]);
7238
+ /** Socket-level failures, by the codes Node and undici assign, plus the Sandbox SDK's own. */
7239
+ const transportCodes = /* @__PURE__ */ new Set([
7240
+ "ECONNRESET",
7241
+ "ECONNREFUSED",
7242
+ "ETIMEDOUT",
7243
+ "ENOTFOUND",
7244
+ "EAI_AGAIN",
7245
+ "EPIPE",
7246
+ "UND_ERR_SOCKET",
7247
+ "UND_ERR_CONNECT_TIMEOUT",
7248
+ "UND_ERR_HEADERS_TIMEOUT",
7249
+ "UND_ERR_BODY_TIMEOUT",
7250
+ "NETWORK_ERROR"
7251
+ ]);
7252
+ function readNumber(value, key) {
7253
+ const read = Reflect.get(value, key);
7254
+ return typeof read === "number" && Number.isFinite(read) ? read : void 0;
7255
+ }
7256
+ function readString(value, key) {
7257
+ const read = Reflect.get(value, key);
7258
+ return typeof read === "string" ? read : void 0;
7259
+ }
7260
+ /**
7261
+ * Walk the cause chain (bounded, cycle-safe) and name the first cause whose structure decides.
7262
+ *
7263
+ * `phase` says whether a 4xx or a client deadline can mean "refused before it ran": only at
7264
+ * admission. After admission the same status means the provider cannot resolve what it
7265
+ * admitted, and the honest name is the refusal.
7266
+ */
7267
+ function classifyRetainedPendingCause(cause, phase = "execution") {
7268
+ const seen = /* @__PURE__ */ new Set();
7269
+ const queue = [{
7270
+ value: cause,
7271
+ phase
7272
+ }];
7273
+ let steps = 0;
7274
+ while (queue.length > 0 && steps < 12) {
7275
+ steps += 1;
7276
+ const { value, phase: at } = queue.shift();
7277
+ if (typeof value !== "object" || value === null || seen.has(value)) continue;
7278
+ seen.add(value);
7279
+ if (value instanceof RetainedExecutionPendingError) return value.pendingCause;
7280
+ const name = readString(value, "name");
7281
+ const code = readString(value, "code");
7282
+ const status = readNumber(value, "status") ?? readNumber(value, "statusCode");
7283
+ if (name === "RetainedRunProviderContractError") {
7284
+ if (code === void 0 || !readFailureCodes.has(code)) return "provider-contract";
7285
+ queue.unshift({
7286
+ value: Reflect.get(value, "cause"),
7287
+ phase: "execution"
7288
+ });
7289
+ continue;
7290
+ }
7291
+ if (name === "ZodError" || Array.isArray(Reflect.get(value, "issues")) || code === "JSON_BOUND_VIOLATION") return at === "admission" ? "request-rejected" : "provider-contract";
7292
+ if (code !== void 0 && transportCodes.has(code)) return "transport";
7293
+ if (name === "NetworkError" || name === "ServerError") return "transport";
7294
+ if (status !== void 0) {
7295
+ if (status >= 500) return "transport";
7296
+ if (at === "admission" && status !== 408) return "request-rejected";
7297
+ return "unobservable";
7298
+ }
7299
+ const errors = Reflect.get(value, "errors");
7300
+ if (Array.isArray(errors)) for (const member of errors) queue.push({
7301
+ value: member,
7302
+ phase: at
7303
+ });
7304
+ queue.push({
7305
+ value: Reflect.get(value, "cause"),
7306
+ phase: at
7307
+ });
7308
+ }
7309
+ return "unobservable";
7310
+ }
7311
+ /**
7312
+ * Local observation stopped; the retained provider execution has no accepted terminal result.
7313
+ *
7314
+ * The message names WHICH of the situations in {@link RetainedPendingCause} this is, and the
7315
+ * `pendingCause` field carries it as a value the settlement records, so a reader never splits
7316
+ * the population on the message's wording. The cause chain is kept for the `caused by` receipt.
7317
+ */
7212
7318
  var RetainedExecutionPendingError = class extends Error {
7213
- constructor(cause) {
7214
- super("retained provider execution requires reconciliation before replacement", { cause });
7319
+ pendingCause;
7320
+ constructor(cause, pendingCause = "execution") {
7321
+ const resolved = pendingCause === "admission" || pendingCause === "execution" ? classifyRetainedPendingCause(cause, pendingCause) : pendingCause;
7322
+ super(causeMessages[resolved], { cause });
7215
7323
  this.name = "RetainedExecutionPendingError";
7324
+ this.pendingCause = resolved;
7216
7325
  }
7217
7326
  };
7218
7327
  const retainedPreparations = /* @__PURE__ */ new WeakMap();
@@ -8193,7 +8302,14 @@ async function providerExecutionSource(args, turn, signal) {
8193
8302
  break;
8194
8303
  }
8195
8304
  if (next.done) break;
8196
- assertEventBinding(next.value, handle.controlRef);
8305
+ try {
8306
+ assertEventBinding(next.value, handle.controlRef);
8307
+ } catch (error) {
8308
+ throw new RetainedRunProviderContractError(error instanceof Error ? error.message : "provider event bound to another run", {
8309
+ code: "RETAINED_EVENT_BINDING_INVALID",
8310
+ cause: error
8311
+ });
8312
+ }
8197
8313
  if (next.value.id !== void 0) lastReplayPosition = next.value.id;
8198
8314
  if (isTerminalEnvironmentEvent(next.value)) sawTerminal = true;
8199
8315
  yield next.value;
@@ -8244,7 +8360,7 @@ async function providerExecutionSource(args, turn, signal) {
8244
8360
  retained: true
8245
8361
  };
8246
8362
  } catch (error) {
8247
- if (admitted) throw new RetainedExecutionPendingError(error);
8363
+ if (admitted) throw new RetainedExecutionPendingError(error, "admission");
8248
8364
  throw error;
8249
8365
  }
8250
8366
  }
@@ -16085,6 +16201,7 @@ async function replaySpawnTree(journal, blobs, root) {
16085
16201
  },
16086
16202
  ...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
16087
16203
  ...ev.retainedExecution === void 0 ? {} : { retainedExecution: ev.retainedExecution },
16204
+ ...ev.retainedPendingCause === void 0 ? {} : { retainedPendingCause: ev.retainedPendingCause },
16088
16205
  ...settlementTime(ev.at),
16089
16206
  seq: ev.seq
16090
16207
  });
@@ -16104,6 +16221,7 @@ async function replaySpawnTree(journal, blobs, root) {
16104
16221
  trace,
16105
16222
  ...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
16106
16223
  ...ev.retainedExecution === void 0 ? {} : { retainedExecution: ev.retainedExecution },
16224
+ ...ev.retainedPendingCause === void 0 ? {} : { retainedPendingCause: ev.retainedPendingCause },
16107
16225
  ...settlementTime(ev.at),
16108
16226
  seq: ev.seq
16109
16227
  });
@@ -16206,6 +16324,7 @@ function materializeTreeView(events) {
16206
16324
  node.trace = traceEvidenceFor(ev);
16207
16325
  node.budgetViolation = budgetViolationOf(ev).budgetViolation;
16208
16326
  if (ev.retainedExecution !== void 0) node.retainedExecution = ev.retainedExecution;
16327
+ if (ev.retainedPendingCause !== void 0) node.retainedPendingCause = ev.retainedPendingCause;
16209
16328
  const settledAt = Date.parse(ev.at);
16210
16329
  if (Number.isFinite(settledAt)) node.settledAt = settledAt;
16211
16330
  } else if (ev.kind === "woken") {
@@ -16230,6 +16349,7 @@ function materializeTreeView(events) {
16230
16349
  node.outRef = ev.outRef;
16231
16350
  node.budgetViolation = budgetViolationOf(ev).budgetViolation;
16232
16351
  if (ev.retainedExecution !== void 0) node.retainedExecution = ev.retainedExecution;
16352
+ if (ev.retainedPendingCause !== void 0) node.retainedPendingCause = ev.retainedPendingCause;
16233
16353
  const settledAt = Date.parse(ev.at);
16234
16354
  if (Number.isFinite(settledAt)) node.settledAt = settledAt;
16235
16355
  }
@@ -16336,6 +16456,7 @@ function freezeSnapshot(node) {
16336
16456
  trace: node.trace,
16337
16457
  ...node.budgetViolation === void 0 ? {} : { budgetViolation: node.budgetViolation },
16338
16458
  ...node.retainedExecution === void 0 ? {} : { retainedExecution: node.retainedExecution },
16459
+ ...node.retainedPendingCause === void 0 ? {} : { retainedPendingCause: node.retainedPendingCause },
16339
16460
  settledAt: node.settledAt,
16340
16461
  spawnedAt: node.spawnedAt
16341
16462
  };
@@ -19865,6 +19986,7 @@ function settlementFields(subject, settlement) {
19865
19986
  spent: subject.spent,
19866
19987
  infra: settlement.infra,
19867
19988
  reason: settlement.reason,
19989
+ ...settlement.retainedPendingCause === void 0 ? {} : { retainedPendingCause: settlement.retainedPendingCause },
19868
19990
  ...settlement.outRef ? { outRef: settlement.outRef } : {},
19869
19991
  ...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
19870
19992
  ...subject.budgetViolation ? { budgetViolation: subject.budgetViolation } : {},
@@ -19920,6 +20042,7 @@ function releasedChildPayload(subject, settlement, settledAt, releasedAt) {
19920
20042
  childId: subject.id,
19921
20043
  status: "down",
19922
20044
  retainedExecution: "released",
20045
+ ...settlement.retainedPendingCause === void 0 ? {} : { retainedPendingCause: settlement.retainedPendingCause },
19923
20046
  releasedAt,
19924
20047
  ...settlement.outRef === void 0 ? {} : { outRef: settlement.outRef },
19925
20048
  reason: settlement.reason,
@@ -19998,7 +20121,8 @@ async function healReleasedSlots(opts, signal, now) {
19998
20121
  trace: floor.trace,
19999
20122
  ...floor.outRef ? { outRef: floor.outRef } : {},
20000
20123
  ...floor.providerModel ? { providerModel: floor.providerModel } : {},
20001
- ...floor.harnessTranscript ? { harnessTranscript: floor.harnessTranscript } : {}
20124
+ ...floor.harnessTranscript ? { harnessTranscript: floor.harnessTranscript } : {},
20125
+ ...floor.retainedPendingCause ? { retainedPendingCause: floor.retainedPendingCause } : {}
20002
20126
  };
20003
20127
  await opts.journal.appendEvent(tree.root, terminalDownEvent(subject, settlement, settledSeq, floor.at, "released"));
20004
20128
  healed += 1;
@@ -22126,6 +22250,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
22126
22250
  if (!retainedPending) await args.journal.appendEvent(args.root, terminalDownEvent(child, settlement, seq, at));
22127
22251
  else {
22128
22252
  child.retainedExecution = "pending";
22253
+ child.retainedPendingCause = settlement.retainedPendingCause;
22129
22254
  if (settlement.reconciled !== void 0) await appendReconciledFloor(args.journal, args.root, {
22130
22255
  id: child.id,
22131
22256
  spent: settlement.reconciled,
@@ -22133,7 +22258,10 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
22133
22258
  ...child.cancellationReason === void 0 ? {} : { cancellationReason: child.cancellationReason }
22134
22259
  }, settlement, seq, at);
22135
22260
  }
22136
- const retainedExecution = retainedPending ? { retainedExecution: "pending" } : {};
22261
+ const retainedExecution = retainedPending ? {
22262
+ retainedExecution: "pending",
22263
+ ...settlement.retainedPendingCause === void 0 ? {} : { retainedPendingCause: settlement.retainedPendingCause }
22264
+ } : {};
22137
22265
  notifyRuntimeHookEvent(args.hooks, {
22138
22266
  id: `${child.id}:settled`,
22139
22267
  runId: args.root,
@@ -22498,7 +22626,8 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
22498
22626
  live.budgetViolation = void 0;
22499
22627
  return {
22500
22628
  ...downRecord(errMessage(err), true, trace, executor.metered?.(), void 0, retainedOutputRef, await persistTranscriptOnce()),
22501
- reconciled: live.spent
22629
+ reconciled: live.spent,
22630
+ retainedPendingCause: err instanceof RetainedExecutionPendingError ? err.pendingCause : "unobservable"
22502
22631
  };
22503
22632
  }
22504
22633
  live.executorDone = true;
@@ -22590,7 +22719,8 @@ function makeTreeView(root, children) {
22590
22719
  ...c.trace ? { trace: c.trace } : {},
22591
22720
  ...c.providerModel ? { providerModel: c.providerModel } : {},
22592
22721
  ...c.budgetViolation ? { budgetViolation: c.budgetViolation } : {},
22593
- ...c.retainedExecution ? { retainedExecution: c.retainedExecution } : {}
22722
+ ...c.retainedExecution ? { retainedExecution: c.retainedExecution } : {},
22723
+ ...c.retainedPendingCause ? { retainedPendingCause: c.retainedPendingCause } : {}
22594
22724
  }));
22595
22725
  return {
22596
22726
  root,
@@ -22971,8 +23101,8 @@ const driverExecutorFactory = (rawSpec, ctx) => {
22971
23101
  const prior = await journal.loadTree(nestedRoot) ?? [];
22972
23102
  if (prior.length === 0) await journal.appendEvent(nestedRoot, ownedSpawn);
22973
23103
  else if (contentAddress(prior[0]) !== contentAddress(ownedSpawn)) throw new ValidationError$1("driverExecutor: nested recovery changed its owning parent spawn");
22974
- else if (prior.length !== 1 && !recovering) throw new RetainedExecutionPendingError(new ValidationError$1("driverExecutor: interrupted nested execution requires recovery"));
22975
- if (recovering && (!spec.recoverExecutor || !seam.restore)) throw new RetainedExecutionPendingError(new ValidationError$1("driverExecutor: nested recovery has no original executor reconstruction"));
23104
+ else if (prior.length !== 1 && !recovering) throw new RetainedExecutionPendingError(new ValidationError$1("driverExecutor: interrupted nested execution requires recovery"), "nested-recovery");
23105
+ if (recovering && (!spec.recoverExecutor || !seam.restore)) throw new RetainedExecutionPendingError(new ValidationError$1("driverExecutor: nested recovery has no original executor reconstruction"), "nested-recovery");
22976
23106
  signal.throwIfAborted();
22977
23107
  const controller = new AbortController();
22978
23108
  const onParentAbort = () => controller.abort(signal.reason);
@@ -22984,7 +23114,7 @@ const driverExecutorFactory = (rawSpec, ctx) => {
22984
23114
  } catch (error) {
22985
23115
  controller.abort(error);
22986
23116
  signal.removeEventListener("abort", onParentAbort);
22987
- throw new RetainedExecutionPendingError(error);
23117
+ throw new RetainedExecutionPendingError(error, "nested-recovery");
22988
23118
  }
22989
23119
  active = {
22990
23120
  controller,
@@ -23023,7 +23153,7 @@ const driverExecutorFactory = (rawSpec, ctx) => {
23023
23153
  accounting = partial?.accounting;
23024
23154
  const events = await journal.loadTree(nestedRoot).catch(() => void 0);
23025
23155
  const settledIds = new Set(events?.filter((event) => event.kind === "settled" || event.kind === "cancelled").map((event) => event.id));
23026
- if (events?.some((event) => event.kind === "execution-admitted" && event.id === seam.nodeId || event.kind === "spawned" && event.parent !== void 0 && event.runtime !== "inline" && !settledIds.has(event.id))) throw new RetainedExecutionPendingError(err);
23156
+ if (events?.some((event) => event.kind === "execution-admitted" && event.id === seam.nodeId || event.kind === "spawned" && event.parent !== void 0 && event.runtime !== "inline" && !settledIds.has(event.id))) throw new RetainedExecutionPendingError(err, "nested-recovery");
23027
23157
  if (cleanupError !== void 0) throw cleanupError;
23028
23158
  throw err;
23029
23159
  } finally {
@@ -24434,4 +24564,4 @@ function isNonEmptySpend(s) {
24434
24564
  //#endregion
24435
24565
  export { bindReusableExecutorExecutionId as $, providerMessageText as $i, buildRuntimeEventOtelSpans as $n, providerAttemptEvidence as $r, addHarnessUsage as $t, waitUntil as A, deleteBoxSafe as Ai, RunCancellationReason as An, profileMaterializationAxes$1 as Ar, spendFromUsageTotals as At, attachWorker as B, withTimeout as Bi, defaultRedactorIdentityMaterial as Bn, worktreeCliProfileMaterialization as Br, createInbox as Bt, scopeOwnerExecutorNodeContext as C, notifySandboxEventObserver as Ci, resolveAgentEnvironmentProvider as Cn, parseCodexTokenUsage as Cr, workerTraceAnalysisStore as Ct, pollFor as D, addSpend as Di, sandboxSessionTraceSource as Dn, controlProfileMaterialization as Dr, meterUsageEvent as Dt, isWaitOutcome as E, sumSandboxUsage as Ei, decodeToolPart as En, assertProfileMaterialization as Er, createBudgetPool as Et, scopeRetainedOwnerPriorSpend as F, sleep as Fi, recoverRetainedRun as Fn, renderProfileMaterializationIssues as Fr, workerTraceSeamKey as Ft, recoverRetainedInteractiveRun as G, decodeHarnessUsage as Gi, contentAddress as Gn, attestRuntimeOwnedPendingExecutor as Gr, createPeerMailbox as Gt, workerInteractiveBindingFile as H, addResourceSpend as Hi, captureHarnessTranscript as Hn, parseCommittedJsonLines as Hr, DEFAULT_PEER_MAIL_LIMITS as Ht, scopeRetainedOwnerResult as I, stringifySafe as Ii, startRetainedRun as In, renderUnsupported as Ir, taskToPrompt as It, errMessage as J, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Ji, readTraceContextFromEnv as Jn, finalizeRuntimeOwnedPendingExecutor as Jr, peerMailVerbNames as Jt, startRetainedInteractiveRun as K, abortError$2 as Ki, createPropagatingTraceEmitter as Kn, attestRuntimeOwnedScopeOwner as Kr, isPeerMailEnvelope as Kt, interactiveAdmissionSeamKey as L, throwAbort as Li, startRetainedRunInEnvironment as Ln, sandboxActProfileMaterialization as Lr, DEFAULT_STALL_AFTER_MS as Lt, consumeScopeRetainedOwnerResult as M, isAbortError$2 as Mi, linkAbort as Mn, promptModelProfileMaterialization as Mr, readWorkerTraceContext as Mt, prepareScopeRetainedOwnerTask as N, promptCacheTokenClasses as Ni, runAbortable as Nn, promptOnlyProfileMaterialization as Nr, workerTraceEnv as Nt, timerAt as O, chargedTokens as Oi, registerRetainedExecutorPreparation as On, defineProfileMaterializationContract as Or, newUsageTotals as Ot, scopeRetainedOwnerContext as P, randomSuffix as Pi, reconnectRetainedRun as Pn, promptResourceProfileMaterialization as Pr, workerTraceHeaders as Pt, rollingDispatch as Q, promptOptionsFromAgentTurnInput as Qi, buildLoopSpanNodes as Qn, newExecutionAttemptId as Qr, bridgeModelRouteRefusal as Qt, readWorkerInteractiveAdmissions as R, throwIfAborted as Ri, retainedCreateMaterial as Rn, unsupportedProfileDimensions as Rr, createActivityLog as Rt, restoreScopeOwnerAcceptedExecution as S, mapSandboxToolEvent as Si, providerAsSandboxClient as Sn, localHarnessExecutable as Sr, parseWorkerToolTraceArtifact as St, createWaitProbes as T, sandboxProgressEvents as Ti, createPushTraceSource as Tn, AGENT_PROFILE_MATERIALIZATION_AXES as Tr, assertValidBudget as Tt, workerInteractiveBindingsDir as U, resourceTelemetry as Ui, harnessTranscriptArtifact as Un, prepareJsonlAppend as Ur, PEER_MAIL_WIRE_KEY as Ut, readWorkerInteractiveBinding as V, zeroSpend as Vi, resolveRedactor as Vn, isNoEntError as Vr, AUTHORITY_MARKERS as Vt, reconnectRetainedInteractiveRun as W, withBudgetResources as Wi, persistHarnessTranscript as Wn, writeAllBytes as Wr, claimsAuthority as Wt, freeSlots as X, teardownExecutor as Xi, INTELLIGENCE_WIRE_VERSION as Xn, knownExecutionBindingReceipt as Xr, isTerminalNodeStatus as Xt, effectiveConcurrency as Y, armDeadlineTimer as Yi, traceContextToEnv as Yn, inheritRuntimeOwnedExecutorAttestation as Yr, isLiveNodeStatus as Yt, queueOf as Z, promptFromAgentTurnInput as Zi, buildLoopOtelSpans as Zn, knownMaterializationReceipt as Zr, bridgeAdmissionRefusal as Zt, createScope as _, createSandboxToolPartState as _i, canonicalObservedModelParts as _n, createWorktree as _r, pendingWaits as _t, pickBestDelivered as a, runtimeOwnedPendingExecutorMaterialization as ai, TERMINAL_DECISIONS as an, loopEventToOtelSpan as ar, snapshotExecutorConfig as at, meterRuntimeOwnedProviderAttempt as b, isSandboxTerminalEvent as bi, createAgentEnvironmentProviderRegistry as bn, LOCAL_HARNESSES as br, captureWorkerTraceEvidence as bt, DriverAttemptsExhaustedError as c, unknownMaterializationReceipt as ci, isTerminalDecision as cn, toOtelAttributes as cr, createSteerableSandboxSession as ct, runDriverWithRetry as d, detachedFrozen as di, probeSandboxCapabilities as dn, sanitizeAgentRuntimeEvent as dr, FileSpawnJournal as dt, recordRuntimeOwnedDriveHarnessProviderEvidence as ei, createCodexRolloutStoreReader as en, createOpenInferenceFileExporter as er, captureReusableExecutorConfig as et, driverChild as f, detachedSnapshot as fi, acquireSandbox as fn, sanitizeKnowledgeReadinessReport as fr, InMemoryResultBlobStore as ft, beginScopeOwnerAttempt as g, canonicalStreamEventFromSandboxEvent as gi, runBrainLoop as gn, captureWorktreeDiff as gr, materializeTreeView as gt, withDriverExecutor as h, assertSandboxServedModel as hi, routerBrain as hn, runWorktreeHarness as hr, loadSpawnForest as ht, collectDelivered as i, runtimeOwnedExecutorProviderEvidence as ii, bridgeStopSignalKey as in, generateSpanId as ir, createExecutorRegistry as it, bindScopeRetainedOwnerProvider as j, hasCompleteCacheBreakdown as ji, abortError as jn, promptControlProfileMaterialization as jr, WORKER_TRACE_PROPAGATION as jt, validateWaitSpec as k, cloneSpend as ki, retainedExecutorSeamKey as kn, fullProfileMaterialization as kr, spendFromUsageEvents as kt, classifyDriverFailure as l, executableAgentProfileSnapshot as li, runAgentRounds as ln, createRuntimeEventCollector as lr, createInPlaceCliExecutor as lt, isDriverSpec as m, readSandboxOutcome as mi, readPromptOptions as mn, runSettledCommand as mr, insideCursorNamespace as mt, createSupervisor as n, runtimeOwnedExecutorExecutionBinding as ni, readCodexRolloutSession as nn, exportEvalRuns as nr, cliWorktreeExecutor as nt, runFinalizer as o, runtimeOwnedScopeOwnerRuntime as oi, createSandboxForSpec as on, padSpanId as or, createWorktreeCliExecutor as ot, driverExecutorFactory as p, projectSandboxOutcome as pi, assertBoxlessPromptOptions as pn, sanitizeRuntimeStreamEvent as pr, InMemorySpawnJournal as pt, destroyInteractiveEnvironment as q, awaitAbortable$1 as qi, mergeTraceEnv as qn, authoredProfileDigest as qr, peerMailTools as qt, bestDelivered as r, runtimeOwnedExecutorMaterialization as ri, bridgeRuntimeAttachmentsKey as rn, flatOtelSpan as rr, createExecutor as rt, runTree as s, unknownExecutionBindingReceipt as si, defaultSelectWinner as sn, padTraceId as sr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as st, createRootHandle as t, runtimeOwnedDriveHarnessProviderEvidence as ti, harnessUsageIsEmpty as tn, createOtelExporter as tr, cliInPlaceExecutor as tt, defaultUnmetContractSteer as u, executableAgentSpecSnapshot as ui, createSandboxLineage as un, createRuntimeStreamEventCollector as ur, FileResultBlobStore as ut, deriveNodeExecutionIdentity as v, createSandboxUsageLedger as vi, observedModelMatchesDeclared as vn, removeWorktree as vr, replaySpawnTree as vt, settledToIteration as w, sandboxEventServedBackend as wi, sandboxClientAsProvider as wn, CodexExecutionDiagnosticError as wr, BudgetReconcileFault as wt, recordScopeOwnerMaterialization as x, mapSandboxEvent as xi, providerAsExecutor as xn, harnessSupportsReasoningEffort as xr, isTraceAnalysisStore as xt, meterRuntimeOwnedAccounting as y, extractLlmCallEvent as yi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as yn, DEFAULT_LOCAL_HARNESS as yr, WORKER_TOOL_TRACE_SCHEMA_VERSION as yt, workerInteractiveAdmissionFile as z, unmeteredSpend as zi, defaultRedactor as zn, validateProfileMaterialization as zr, readWorkerProgress as zt };
24436
24566
 
24437
- //# sourceMappingURL=supervisor-DMX3Ouel.js.map
24567
+ //# sourceMappingURL=supervisor-DWiZ2Wgx.js.map