@tangle-network/agent-runtime 0.247.0 → 0.252.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 (79) hide show
  1. package/dist/{activation-DYqnl8zq.js → activation-BSLatbiJ.js} +34 -4
  2. package/dist/activation-BSLatbiJ.js.map +1 -0
  3. package/dist/{activation-DizpINK3.d.ts → activation-BykUtuec.d.ts} +2 -2
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/bundle-DXrBPEFw.js +17 -0
  7. package/dist/bundle-DXrBPEFw.js.map +1 -0
  8. package/dist/candidate-execution/index.js +4 -4
  9. package/dist/{coordination-driver-BV4AAUns.js → coordination-driver-QxitIuva.js} +162 -17
  10. package/dist/coordination-driver-QxitIuva.js.map +1 -0
  11. package/dist/{delegate-DQAzB5Xv.js → delegate-BB90iDo7.js} +2 -2
  12. package/dist/{delegate-DQAzB5Xv.js.map → delegate-BB90iDo7.js.map} +1 -1
  13. package/dist/durable.d.ts +2 -2
  14. package/dist/durable.js +2 -2
  15. package/dist/{graph-DcBmMLIp.js → graph-yC6wqOIt.js} +3 -3
  16. package/dist/{graph-DcBmMLIp.js.map → graph-yC6wqOIt.js.map} +1 -1
  17. package/dist/{improvement-cycle-B049YmQ8.js → improvement-cycle-on_u94aK.js} +5 -5
  18. package/dist/{improvement-cycle-B049YmQ8.js.map → improvement-cycle-on_u94aK.js.map} +1 -1
  19. package/dist/{index-DLzlXwr6.d.ts → index-DGWG7wSS.d.ts} +20 -9
  20. package/dist/index.d.ts +8 -6
  21. package/dist/index.js +32 -50
  22. package/dist/index.js.map +1 -1
  23. package/dist/intelligence.d.ts +18 -11
  24. package/dist/intelligence.js +93 -38
  25. package/dist/intelligence.js.map +1 -1
  26. package/dist/kernel.d.ts +4 -4
  27. package/dist/kernel.js +9 -9
  28. package/dist/{loop-runner-bin-HbMECmxT.d.ts → loop-runner-bin-CsVNUclF.d.ts} +3 -3
  29. package/dist/{loop-runner-bin-iqq1azfy.js → loop-runner-bin-PL0dItet.js} +3 -3
  30. package/dist/{loop-runner-bin-iqq1azfy.js.map → loop-runner-bin-PL0dItet.js.map} +1 -1
  31. package/dist/loop-runner-bin.d.ts +1 -1
  32. package/dist/loop-runner-bin.js +1 -1
  33. package/dist/mcp/bin.js +3 -3
  34. package/dist/mcp/index.d.ts +5 -5
  35. package/dist/mcp/index.js +4 -4
  36. package/dist/{openai-tools-DvLk_Ddg.d.ts → openai-tools-zrajPyXe.d.ts} +2 -2
  37. package/dist/{prepare-CibQrhfi.js → prepare-RuaAclli.js} +8 -598
  38. package/dist/prepare-RuaAclli.js.map +1 -0
  39. package/dist/profiles.d.ts +2 -2
  40. package/dist/{protected-model-port-Dhdi5mDl.js → protected-model-port-BFhSgMAy.js} +3 -3
  41. package/dist/{protected-model-port-Dhdi5mDl.js.map → protected-model-port-BFhSgMAy.js.map} +1 -1
  42. package/dist/{protected-redaction-Fn1ETfJ-.js → protected-redaction--F3v1oo8.js} +3 -54
  43. package/dist/protected-redaction--F3v1oo8.js.map +1 -0
  44. package/dist/{provision-supervisor-BgQx2Avp.js → provision-supervisor-DsAhgOpn.js} +4 -4
  45. package/dist/{provision-supervisor-BgQx2Avp.js.map → provision-supervisor-DsAhgOpn.js.map} +1 -1
  46. package/dist/{run-layout-hKAJGF4g.js → run-layout-vwd4SwX_.js} +15 -9
  47. package/dist/run-layout-vwd4SwX_.js.map +1 -0
  48. package/dist/{runtime-HpTXhB3g.js → runtime-CMNTa7Rw.js} +11 -10
  49. package/dist/{runtime-HpTXhB3g.js.map → runtime-CMNTa7Rw.js.map} +1 -1
  50. package/dist/{server-OOE7mXrN.js → server-2fL_QElQ.js} +3 -3
  51. package/dist/{server-OOE7mXrN.js.map → server-2fL_QElQ.js.map} +1 -1
  52. package/dist/{stream-agent-turn-CcumM0Bu.d.ts → stream-agent-turn-oeWkjxMi.d.ts} +32 -5
  53. package/dist/{structural-rollout-z1A0okaB.js → structural-rollout-DRD-WnV-.js} +2 -2
  54. package/dist/{structural-rollout-z1A0okaB.js.map → structural-rollout-DRD-WnV-.js.map} +1 -1
  55. package/dist/{substrate-CQ0hfewn.d.ts → substrate-Ctmos75o.d.ts} +2 -2
  56. package/dist/{supervise-DZEOpzRw.js → supervise-BXzkqfTE.js} +25 -8
  57. package/dist/supervise-BXzkqfTE.js.map +1 -0
  58. package/dist/{supervisor-BIBWUFUr.js → supervisor-OJwKAnFd.js} +391 -187
  59. package/dist/supervisor-OJwKAnFd.js.map +1 -0
  60. package/dist/testing.d.ts +2 -2
  61. package/dist/testing.js +14 -14
  62. package/dist/{top-app-d-bmwO7O.js → top-app-VAOrBskv.js} +2 -2
  63. package/dist/{top-app-d-bmwO7O.js.map → top-app-VAOrBskv.js.map} +1 -1
  64. package/dist/tui/bin.js +1 -1
  65. package/dist/tui/index.d.ts +1 -1
  66. package/dist/tui/index.js +2 -2
  67. package/dist/{types-BUhz284C.d.ts → types-BmxS-W-f.d.ts} +22 -11
  68. package/dist/workspace-archive-DQGFwvM6.js +1209 -0
  69. package/dist/workspace-archive-DQGFwvM6.js.map +1 -0
  70. package/package.json +4 -4
  71. package/dist/activation-DYqnl8zq.js.map +0 -1
  72. package/dist/coordination-driver-BV4AAUns.js.map +0 -1
  73. package/dist/prepare-CibQrhfi.js.map +0 -1
  74. package/dist/protected-redaction-Fn1ETfJ-.js.map +0 -1
  75. package/dist/run-layout-hKAJGF4g.js.map +0 -1
  76. package/dist/supervise-DZEOpzRw.js.map +0 -1
  77. package/dist/supervisor-BIBWUFUr.js.map +0 -1
  78. package/dist/workspace-archive-DSRT4Tro.js +0 -572
  79. package/dist/workspace-archive-DSRT4Tro.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, i as ConfigError, l as RetainedInteractiveBindingError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError$1, u as RetainedRunAdmissionError } from "./errors-DodWX-cb.js";
2
2
  import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, l as profileProviderModel, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-BbSCSak0.js";
3
+ import { b as verifyWorkspaceSnapshotArtifacts, i as verifyAgentCandidateWorkspaceArchive } from "./workspace-archive-DQGFwvM6.js";
3
4
  import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
4
5
  import { n as assertNoSymlinkDescendant, r as publishExclusiveDurableFile } from "./durable-file-DWQA4ooo.js";
5
6
  import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentNativeContextContinuationResultSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, AgentTurnInputSchema, AgentTurnResultSchema, CanonicalStreamEventSchema, ContextTransferRequestSchema, InteractionAcknowledgementSchema, InteractionResponseCommandSchema, NativeContextBoundaryProofSchema, NativeContextContinuationRequestSchema, REASONING_EFFORTS, RuntimeEventEnvelopeSchema, TerminalReplayWindowSchema, TerminalSessionRefSchema, WorkspaceRequestSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentNativeContextContinuationResultMatchesRequest, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, agentRunCancellationRequestDigest, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalWorkspaceCwd, exactAgentInteractiveSessionStart, harnessSystemPromptIntents, harnessTypeSchema, nativeContextContinuationTurnDigest, nativeReasoningControl, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema, workspaceCwdPathForBase } from "@tangle-network/agent-interface";
@@ -6289,6 +6290,184 @@ function resolveRedactor(redact) {
6289
6290
  return (value) => defaultRedactor(redact(value));
6290
6291
  }
6291
6292
  //#endregion
6293
+ //#region src/runtime/supervise/abortable.ts
6294
+ /** Provenance of an explicit cancellation, preserved through every abort link. */
6295
+ var RunCancellationReason = class extends Error {
6296
+ source;
6297
+ operationId;
6298
+ constructor(source, reason, operationId) {
6299
+ super(reason);
6300
+ this.source = source;
6301
+ this.operationId = operationId;
6302
+ this.name = "RunCancellationReason";
6303
+ }
6304
+ toString() {
6305
+ return this.message;
6306
+ }
6307
+ };
6308
+ /**
6309
+ * One abort race, and one abort cascade, for the supervision tree.
6310
+ *
6311
+ * Every layer that can be cancelled needs the same three things: the reason a signal
6312
+ * carries, an `AbortError` built from it, and a settle-once race between the work and
6313
+ * the signal. Written per layer, each drifts — a listener stops being removed on one
6314
+ * path, a late resolution overwrites a cancellation that already won, or a cascade
6315
+ * forwards no reason and renames every downstream death to the layer's own fallback.
6316
+ *
6317
+ * The fallback message is the only thing a layer supplies, so the error still names
6318
+ * which layer cancelled.
6319
+ */
6320
+ /**
6321
+ * The reason a signal carries, or `fallback` when it states none.
6322
+ *
6323
+ * A cascade that drops the upstream reason turns every downstream death into its own generic
6324
+ * message: the worker's `down` record then says nothing about WHY, which makes a whole class of
6325
+ * child mortality undiagnosable from the journal alone.
6326
+ */
6327
+ function abortReason(signal, fallback) {
6328
+ const reason = signal.reason;
6329
+ if (reason instanceof RunCancellationReason) return reason;
6330
+ if (typeof reason === "string" && reason.length > 0) return reason;
6331
+ if (reason instanceof Error && reason.name !== "AbortError" && reason.message.length > 0) return reason.message;
6332
+ return fallback;
6333
+ }
6334
+ /** An `AbortError` carrying the signal's own string reason, or `fallback` when it states none. */
6335
+ function abortError(signal, fallback) {
6336
+ const reason = abortReason(signal, fallback);
6337
+ const error = new Error(reason instanceof Error ? reason.message : typeof reason === "string" && reason.length > 0 ? reason : fallback);
6338
+ error.name = "AbortError";
6339
+ return error;
6340
+ }
6341
+ /**
6342
+ * Cascade N abort signals into one downstream abort that fires when ANY of them does, carrying
6343
+ * that signal's own reason ({@link abortReason}). Node-portable: `AbortSignal.any` needs >=20.3
6344
+ * and the package floor is >=20, and it would drop the reason anyway.
6345
+ *
6346
+ * The one cascade every executor uses, so a reason forwarded here reaches every layer below.
6347
+ */
6348
+ function linkAbort(...sources) {
6349
+ const controller = new AbortController();
6350
+ const listeners = [];
6351
+ const release = () => {
6352
+ for (const { source, onAbort } of listeners) source.removeEventListener("abort", onAbort);
6353
+ listeners.length = 0;
6354
+ };
6355
+ const abort = (reason) => {
6356
+ release();
6357
+ controller.abort(reason);
6358
+ };
6359
+ const alreadyAborted = sources.find((source) => source.aborted);
6360
+ if (alreadyAborted !== void 0) {
6361
+ controller.abort(abortReason(alreadyAborted, "aborted by parent scope"));
6362
+ return {
6363
+ signal: controller.signal,
6364
+ abort,
6365
+ release
6366
+ };
6367
+ }
6368
+ for (const source of sources) {
6369
+ const onAbort = () => abort(abortReason(source, "aborted by parent scope"));
6370
+ listeners.push({
6371
+ source,
6372
+ onAbort
6373
+ });
6374
+ source.addEventListener("abort", onAbort, { once: true });
6375
+ }
6376
+ return {
6377
+ signal: controller.signal,
6378
+ abort,
6379
+ release
6380
+ };
6381
+ }
6382
+ /**
6383
+ * Settle `act()` against `signal`. The first outcome wins and the listener is always
6384
+ * removed, so neither a late resolution nor a late abort can settle the promise twice.
6385
+ * The losing promise stays observed, so a late rejection cannot surface as an unhandled
6386
+ * process error.
6387
+ *
6388
+ * The abort rejection is deferred one microtask so a result the action had ALREADY
6389
+ * produced still wins. It does not hand the race to a listener the action registers
6390
+ * from inside `act()`: this function subscribes before it calls `act()`, so its own
6391
+ * abort handler runs first and settles the promise. A caller that must let the action
6392
+ * observe the abort itself has to hold a live promise and await that instead.
6393
+ *
6394
+ * A synchronous throw from `act()` propagates as the rejection, not as an abort.
6395
+ */
6396
+ async function runAbortable(act, signal, fallback) {
6397
+ if (signal.aborted) throw abortError(signal, fallback);
6398
+ return await new Promise((resolve, reject) => {
6399
+ let settled = false;
6400
+ const cleanup = () => signal.removeEventListener("abort", onAbort);
6401
+ const onAbort = () => {
6402
+ queueMicrotask(() => {
6403
+ if (settled) return;
6404
+ settled = true;
6405
+ cleanup();
6406
+ reject(abortError(signal, fallback));
6407
+ });
6408
+ };
6409
+ signal.addEventListener("abort", onAbort, { once: true });
6410
+ let work;
6411
+ try {
6412
+ work = Promise.resolve(act());
6413
+ } catch (error) {
6414
+ cleanup();
6415
+ reject(error);
6416
+ return;
6417
+ }
6418
+ work.then((value) => {
6419
+ if (settled) return;
6420
+ settled = true;
6421
+ cleanup();
6422
+ resolve(value);
6423
+ }, (error) => {
6424
+ if (settled) return;
6425
+ settled = true;
6426
+ cleanup();
6427
+ reject(error);
6428
+ });
6429
+ });
6430
+ }
6431
+ //#endregion
6432
+ //#region src/runtime/provider-workspace-retention.ts
6433
+ /** Validate the executable retention port at the create boundary. */
6434
+ function assertProviderWorkspaceRetentionPort(port, context) {
6435
+ if (!Number.isSafeInteger(port.timeoutMs) || port.timeoutMs <= 0) throw new ValidationError$1(`${context}: workspaceRetention.timeoutMs must be a positive safe integer`);
6436
+ if (port.artifacts === null || typeof port.artifacts?.read !== "function") throw new ValidationError$1(`${context}: workspaceRetention.artifacts.read is required`);
6437
+ if (typeof port.capture !== "function") throw new ValidationError$1(`${context}: workspaceRetention.capture is required`);
6438
+ }
6439
+ /** Capture, require durable refs, and verify every returned manifest/archive byte. */
6440
+ async function captureProviderWorkspaceSnapshot(port, context) {
6441
+ assertProviderWorkspaceRetentionPort(port, "provider workspace retention");
6442
+ const controller = new AbortController();
6443
+ const clearDeadline = armDeadlineTimer(port.timeoutMs, () => controller.abort(/* @__PURE__ */ new Error(`provider workspace retention timed out after ${port.timeoutMs}ms`)), true);
6444
+ try {
6445
+ return await runAbortable(async () => {
6446
+ const result = detachedSnapshot(await port.capture({
6447
+ ...context,
6448
+ signal: controller.signal
6449
+ }), "provider workspace retention snapshot");
6450
+ requireDurableWorkspaceArtifacts(result);
6451
+ const { archive } = await verifyWorkspaceSnapshotArtifacts(result, port.artifacts);
6452
+ await verifyAgentCandidateWorkspaceArchive({
6453
+ role: "candidate",
6454
+ snapshot: result,
6455
+ archive
6456
+ });
6457
+ return result;
6458
+ }, controller.signal, `provider workspace retention timed out after ${port.timeoutMs}ms`);
6459
+ } finally {
6460
+ clearDeadline();
6461
+ }
6462
+ }
6463
+ /** Native checkpoints, embedded bytes, and digest-only values cannot outlive their source. */
6464
+ function requireDurableWorkspaceArtifacts(snapshot) {
6465
+ if (!isDurableArtifact(snapshot.manifest) || !isDurableArtifact(snapshot.archive)) throw new Error("provider workspace retention requires durable manifest and archive artifact references");
6466
+ }
6467
+ function isDurableArtifact(artifact) {
6468
+ return "locator" in artifact;
6469
+ }
6470
+ //#endregion
6292
6471
  //#region src/runtime/interaction-capabilities.ts
6293
6472
  /**
6294
6473
  * Check one turn's interaction request before the provider can dispatch it.
@@ -7150,145 +7329,6 @@ function assertRetainedCapabilityRequirements(providerName, capabilities) {
7150
7329
  if (retained?.exactRunIdentity !== true || retained.resultIdentity !== true || retained.eventIdentity !== true || retained.cancellationIdempotency !== true || !capabilities.streaming.detach || !capabilities.streaming.replay || !capabilities.streaming.turnIdempotency) throw new Error(`provider "${providerName}" cannot control a retry-safe retained run`);
7151
7330
  }
7152
7331
  //#endregion
7153
- //#region src/runtime/supervise/abortable.ts
7154
- /** Provenance of an explicit cancellation, preserved through every abort link. */
7155
- var RunCancellationReason = class extends Error {
7156
- source;
7157
- operationId;
7158
- constructor(source, reason, operationId) {
7159
- super(reason);
7160
- this.source = source;
7161
- this.operationId = operationId;
7162
- this.name = "RunCancellationReason";
7163
- }
7164
- toString() {
7165
- return this.message;
7166
- }
7167
- };
7168
- /**
7169
- * One abort race, and one abort cascade, for the supervision tree.
7170
- *
7171
- * Every layer that can be cancelled needs the same three things: the reason a signal
7172
- * carries, an `AbortError` built from it, and a settle-once race between the work and
7173
- * the signal. Written per layer, each drifts — a listener stops being removed on one
7174
- * path, a late resolution overwrites a cancellation that already won, or a cascade
7175
- * forwards no reason and renames every downstream death to the layer's own fallback.
7176
- *
7177
- * The fallback message is the only thing a layer supplies, so the error still names
7178
- * which layer cancelled.
7179
- */
7180
- /**
7181
- * The reason a signal carries, or `fallback` when it states none.
7182
- *
7183
- * A cascade that drops the upstream reason turns every downstream death into its own generic
7184
- * message: the worker's `down` record then says nothing about WHY, which makes a whole class of
7185
- * child mortality undiagnosable from the journal alone.
7186
- */
7187
- function abortReason(signal, fallback) {
7188
- const reason = signal.reason;
7189
- if (reason instanceof RunCancellationReason) return reason;
7190
- if (typeof reason === "string" && reason.length > 0) return reason;
7191
- if (reason instanceof Error && reason.name !== "AbortError" && reason.message.length > 0) return reason.message;
7192
- return fallback;
7193
- }
7194
- /** An `AbortError` carrying the signal's own string reason, or `fallback` when it states none. */
7195
- function abortError(signal, fallback) {
7196
- const reason = abortReason(signal, fallback);
7197
- const error = new Error(reason instanceof Error ? reason.message : typeof reason === "string" && reason.length > 0 ? reason : fallback);
7198
- error.name = "AbortError";
7199
- return error;
7200
- }
7201
- /**
7202
- * Cascade N abort signals into one downstream abort that fires when ANY of them does, carrying
7203
- * that signal's own reason ({@link abortReason}). Node-portable: `AbortSignal.any` needs >=20.3
7204
- * and the package floor is >=20, and it would drop the reason anyway.
7205
- *
7206
- * The one cascade every executor uses, so a reason forwarded here reaches every layer below.
7207
- */
7208
- function linkAbort(...sources) {
7209
- const controller = new AbortController();
7210
- const listeners = [];
7211
- const release = () => {
7212
- for (const { source, onAbort } of listeners) source.removeEventListener("abort", onAbort);
7213
- listeners.length = 0;
7214
- };
7215
- const abort = (reason) => {
7216
- release();
7217
- controller.abort(reason);
7218
- };
7219
- const alreadyAborted = sources.find((source) => source.aborted);
7220
- if (alreadyAborted !== void 0) {
7221
- controller.abort(abortReason(alreadyAborted, "aborted by parent scope"));
7222
- return {
7223
- signal: controller.signal,
7224
- abort,
7225
- release
7226
- };
7227
- }
7228
- for (const source of sources) {
7229
- const onAbort = () => abort(abortReason(source, "aborted by parent scope"));
7230
- listeners.push({
7231
- source,
7232
- onAbort
7233
- });
7234
- source.addEventListener("abort", onAbort, { once: true });
7235
- }
7236
- return {
7237
- signal: controller.signal,
7238
- abort,
7239
- release
7240
- };
7241
- }
7242
- /**
7243
- * Settle `act()` against `signal`. The first outcome wins and the listener is always
7244
- * removed, so neither a late resolution nor a late abort can settle the promise twice.
7245
- * The losing promise stays observed, so a late rejection cannot surface as an unhandled
7246
- * process error.
7247
- *
7248
- * The abort rejection is deferred one microtask so a result the action had ALREADY
7249
- * produced still wins. It does not hand the race to a listener the action registers
7250
- * from inside `act()`: this function subscribes before it calls `act()`, so its own
7251
- * abort handler runs first and settles the promise. A caller that must let the action
7252
- * observe the abort itself has to hold a live promise and await that instead.
7253
- *
7254
- * A synchronous throw from `act()` propagates as the rejection, not as an abort.
7255
- */
7256
- async function runAbortable(act, signal, fallback) {
7257
- if (signal.aborted) throw abortError(signal, fallback);
7258
- return await new Promise((resolve, reject) => {
7259
- let settled = false;
7260
- const cleanup = () => signal.removeEventListener("abort", onAbort);
7261
- const onAbort = () => {
7262
- queueMicrotask(() => {
7263
- if (settled) return;
7264
- settled = true;
7265
- cleanup();
7266
- reject(abortError(signal, fallback));
7267
- });
7268
- };
7269
- signal.addEventListener("abort", onAbort, { once: true });
7270
- let work;
7271
- try {
7272
- work = Promise.resolve(act());
7273
- } catch (error) {
7274
- cleanup();
7275
- reject(error);
7276
- return;
7277
- }
7278
- work.then((value) => {
7279
- if (settled) return;
7280
- settled = true;
7281
- cleanup();
7282
- resolve(value);
7283
- }, (error) => {
7284
- if (settled) return;
7285
- settled = true;
7286
- cleanup();
7287
- reject(error);
7288
- });
7289
- });
7290
- }
7291
- //#endregion
7292
7332
  //#region src/runtime/supervise/cost-estimate.ts
7293
7333
  /**
7294
7334
  * Pricing for work that arrived without a provider receipt.
@@ -7886,6 +7926,7 @@ function providerAsExecutor(provider, options = {}) {
7886
7926
  };
7887
7927
  }
7888
7928
  function createProviderExecutor(provider, profile, ctx, options, placement) {
7929
+ if (options.workspaceRetention !== void 0) assertProviderWorkspaceRetentionPort(options.workspaceRetention, `providerAsExecutor(${provider.name})`);
7889
7930
  const controller = new AbortController();
7890
7931
  const node = ctx.node === void 0 ? void 0 : detachedSnapshot(ctx.node, "provider executor node");
7891
7932
  let environment;
@@ -7895,10 +7936,132 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7895
7936
  let harnessTranscript = harnessTranscriptUnavailable("execution-never-started");
7896
7937
  const retention = retainedExecutorContext(ctx);
7897
7938
  let destroyed = false;
7939
+ let workspaceEnvironmentId;
7940
+ let workspaceSnapshot;
7941
+ let workspacePublishedSnapshot;
7942
+ let workspaceCaptureFailure;
7943
+ let workspaceCapturePromise;
7944
+ let workspaceCleanupPromise;
7945
+ let retainedReleasePromise;
7946
+ let workspaceOutcome;
7947
+ let workspacePreservationRequired = false;
7948
+ let workspaceRunActive = false;
7898
7949
  const runtime = options.runtime ?? provider.name;
7899
7950
  const createProfile = options.profileForCreate?.(profile) ?? profile;
7900
7951
  if (placement && canonicalAgentProfileDigest(createProfile) !== canonicalAgentProfileDigest(profile)) throw new ValidationError("provider placement: profileForCreate cannot change the selected profile");
7901
7952
  const executionId = retention?.executionId ?? node?.nodeId ?? `provider-run-${randomUUID()}`;
7953
+ const resetWorkspaceState = (next) => {
7954
+ if (workspaceEnvironmentId === next.id) return;
7955
+ workspaceEnvironmentId = next.id;
7956
+ workspaceSnapshot = void 0;
7957
+ workspacePublishedSnapshot = void 0;
7958
+ workspaceCaptureFailure = void 0;
7959
+ workspaceCapturePromise = void 0;
7960
+ workspaceCleanupPromise = void 0;
7961
+ retainedReleasePromise = void 0;
7962
+ workspaceOutcome = void 0;
7963
+ workspacePreservationRequired = false;
7964
+ destroyed = false;
7965
+ };
7966
+ const beginWorkspaceExecution = () => {
7967
+ if (workspaceRunActive) throw new ValidationError(`providerAsExecutor(${provider.name}): executor is already running`);
7968
+ if (options.workspaceRetention !== void 0) {
7969
+ if (workspacePreservationRequired) throw new ValidationError(`providerAsExecutor(${provider.name}): a prior failed execution has no retrievable workspace receipt; source remains preserved and this executor cannot be reused`);
7970
+ if (environment !== void 0 && !destroyed) throw new ValidationError(`providerAsExecutor(${provider.name}): the prior workspace environment is still live; teardown must release it before this executor can be reused`);
7971
+ }
7972
+ if (runtimeOwnedExecutorMaterialization(executor) !== void 0) throw new ValidationError(`providerAsExecutor(${provider.name}): this executor has already materialized; create a new executor for another run`);
7973
+ if (environment !== void 0 && destroyed) {
7974
+ environment = void 0;
7975
+ workspaceEnvironmentId = void 0;
7976
+ }
7977
+ workspaceRunActive = true;
7978
+ workspaceSnapshot = void 0;
7979
+ workspacePublishedSnapshot = void 0;
7980
+ workspaceCaptureFailure = void 0;
7981
+ workspaceCapturePromise = void 0;
7982
+ workspaceCleanupPromise = void 0;
7983
+ retainedReleasePromise = void 0;
7984
+ workspaceOutcome = void 0;
7985
+ workspacePreservationRequired = false;
7986
+ destroyed = false;
7987
+ };
7988
+ const captureWorkspace = async (next, outcome) => {
7989
+ const workspaceRetention = options.workspaceRetention;
7990
+ if (workspaceRetention === void 0) return void 0;
7991
+ resetWorkspaceState(next);
7992
+ if (workspaceSnapshot !== void 0) return workspaceSnapshot;
7993
+ if (workspaceCapturePromise === void 0) {
7994
+ workspaceOutcome = outcome;
7995
+ workspaceCapturePromise = captureProviderWorkspaceSnapshot(workspaceRetention, {
7996
+ environment: next,
7997
+ executionId,
7998
+ profile: createProfile,
7999
+ ...outcome === void 0 ? {} : { outcome }
8000
+ }).then((snapshot) => {
8001
+ workspaceSnapshot = snapshot;
8002
+ return snapshot;
8003
+ }).catch((error) => {
8004
+ workspaceCaptureFailure = error;
8005
+ throw error;
8006
+ });
8007
+ }
8008
+ return await workspaceCapturePromise;
8009
+ };
8010
+ const workspaceFailureDetail = () => {
8011
+ const reason = workspaceCaptureFailure instanceof Error ? workspaceCaptureFailure.message : String(workspaceCaptureFailure ?? "capture was not accepted");
8012
+ return `providerAsExecutor(${provider.name}): workspace retention failed — ${reason}; source environment preserved`;
8013
+ };
8014
+ const destroyEnvironment = async (cleanupSignal) => {
8015
+ if (workspaceCleanupPromise !== void 0) return await workspaceCleanupPromise;
8016
+ const cleanupPromise = (async () => {
8017
+ const target = environment;
8018
+ if (target === void 0) return { destroyed: true };
8019
+ if (workspacePreservationRequired) return {
8020
+ destroyed: false,
8021
+ detail: "provider workspace retention: source preserved because execution failed before a retrievable settled workspace receipt existed"
8022
+ };
8023
+ if (options.workspaceRetention !== void 0) try {
8024
+ const currentSnapshot = await captureWorkspace(target, workspaceOutcome);
8025
+ if (workspacePublishedSnapshot !== void 0 && currentSnapshot !== void 0 && currentSnapshot.digest !== workspacePublishedSnapshot.digest) {
8026
+ workspacePreservationRequired = true;
8027
+ return {
8028
+ destroyed: false,
8029
+ detail: "provider workspace retention: live workspace changed after the published receipt; source preserved"
8030
+ };
8031
+ }
8032
+ } catch {
8033
+ return {
8034
+ destroyed: false,
8035
+ detail: workspaceFailureDetail()
8036
+ };
8037
+ }
8038
+ if (destroyed) return { destroyed: true };
8039
+ try {
8040
+ await awaitAbortable$1(Promise.resolve(target.destroy?.()), cleanupSignal);
8041
+ destroyed = true;
8042
+ return { destroyed: true };
8043
+ } catch (error) {
8044
+ return {
8045
+ destroyed: false,
8046
+ detail: `providerAsExecutor(${provider.name}): environment.destroy() failed — ${error instanceof Error ? error.message : String(error)}`
8047
+ };
8048
+ }
8049
+ })();
8050
+ let cleanupReference;
8051
+ cleanupReference = cleanupPromise.then((result) => {
8052
+ if (!result.destroyed && workspaceCleanupPromise === cleanupReference && !workspacePreservationRequired && workspaceCaptureFailure === void 0) {
8053
+ if (options.workspaceRetention !== void 0) {
8054
+ workspaceSnapshot = void 0;
8055
+ workspaceCapturePromise = void 0;
8056
+ workspaceOutcome = void 0;
8057
+ }
8058
+ workspaceCleanupPromise = void 0;
8059
+ }
8060
+ return result;
8061
+ });
8062
+ workspaceCleanupPromise = cleanupReference;
8063
+ return await cleanupReference;
8064
+ };
7902
8065
  const attemptId = node?.attemptId ?? newExecutionAttemptId(executionId);
7903
8066
  const trace = createPushTraceSource({ runId: executionId });
7904
8067
  const providerModel = concreteProfileModel(createProfile);
@@ -7947,6 +8110,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7947
8110
  };
7948
8111
  let executor;
7949
8112
  const run = async function* (task, signal, recovering = false) {
8113
+ beginWorkspaceExecution();
7950
8114
  const linked = linkAbort(ctx.signal, signal, controller.signal);
7951
8115
  try {
7952
8116
  yield* streamProviderExecutor({
@@ -7969,6 +8133,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7969
8133
  },
7970
8134
  onEnvironment: (env) => {
7971
8135
  environment = env;
8136
+ resetWorkspaceState(env);
7972
8137
  if (harnessTranscript.status === "unavailable" && harnessTranscript.reason === "execution-never-started") harnessTranscript = harnessTranscriptUnavailable("capture-did-not-run");
7973
8138
  finalizeRuntimeOwnedPendingExecutor(executor, {
7974
8139
  ...plannedDeclaration,
@@ -7984,12 +8149,18 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7984
8149
  onHarnessTranscript: (next) => {
7985
8150
  harnessTranscript = next;
7986
8151
  },
7987
- onDestroyed: () => {
7988
- destroyed = true;
7989
- }
8152
+ onUnsettledFailure: () => {
8153
+ workspacePreservationRequired = true;
8154
+ },
8155
+ onPublishedSnapshot: (snapshot) => {
8156
+ workspacePublishedSnapshot = snapshot;
8157
+ },
8158
+ captureWorkspace,
8159
+ destroyEnvironment
7990
8160
  });
7991
8161
  } finally {
7992
8162
  linked.release();
8163
+ workspaceRunActive = false;
7993
8164
  }
7994
8165
  };
7995
8166
  executor = {
@@ -8024,21 +8195,15 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
8024
8195
  },
8025
8196
  async teardown(_grace) {
8026
8197
  controller.abort();
8198
+ if (options.workspaceRetention !== void 0 && workspaceRunActive) return {
8199
+ destroyed: false,
8200
+ detail: "provider workspace retention: source preserved while the execution is still active"
8201
+ };
8027
8202
  if (pending) return {
8028
8203
  destroyed: false,
8029
8204
  detail: "retained execution requires reconciliation"
8030
8205
  };
8031
- if (destroyed || environment === void 0) return { destroyed: true };
8032
- try {
8033
- await environment.destroy?.();
8034
- destroyed = true;
8035
- return { destroyed: true };
8036
- } catch (error) {
8037
- return {
8038
- destroyed: false,
8039
- detail: `providerAsExecutor(${provider.name}): environment.destroy() failed — ${error instanceof Error ? error.message : String(error)}`
8040
- };
8041
- }
8206
+ return await destroyEnvironment();
8042
8207
  },
8043
8208
  async releaseRetained(signal) {
8044
8209
  controller.abort();
@@ -8051,19 +8216,37 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
8051
8216
  destroyed,
8052
8217
  ...detail === void 0 ? {} : { detail }
8053
8218
  });
8054
- try {
8055
- const target = environment ?? (provider.get === void 0 ? void 0 : await awaitAbortable$1(provider.get(environmentId), signal));
8056
- if (target === void 0) return [receipt(false, `providerAsExecutor(${provider.name}): no environment handle and the provider exposes no get()`)];
8057
- if (target !== null) {
8219
+ if (options.workspaceRetention !== void 0 && workspaceRunActive) return [receipt(false, "provider workspace retention: source preserved while execution is still active")];
8220
+ if (retainedReleasePromise !== void 0) return await retainedReleasePromise;
8221
+ const releasePromise = (async () => {
8222
+ try {
8223
+ const target = environment ?? (provider.get === void 0 ? void 0 : await awaitAbortable$1(provider.get(environmentId), signal));
8224
+ if (target === void 0) return [receipt(false, `providerAsExecutor(${provider.name}): no environment handle and the provider exposes no get()`)];
8225
+ if (target === null) {
8226
+ pending = false;
8227
+ destroyed = true;
8228
+ return [receipt(true)];
8229
+ }
8058
8230
  if (target.destroy === void 0) return [receipt(false, `providerAsExecutor(${provider.name}): environment exposes no destroy()`)];
8059
- await awaitAbortable$1(target.destroy(), signal);
8231
+ if (environment === void 0) {
8232
+ environment = target;
8233
+ resetWorkspaceState(target);
8234
+ }
8235
+ const result = await destroyEnvironment(signal);
8236
+ if (!result.destroyed) return [receipt(false, result.detail)];
8237
+ pending = false;
8238
+ return [receipt(true)];
8239
+ } catch (error) {
8240
+ return [receipt(false, `providerAsExecutor(${provider.name}): environment.destroy() failed — ${error instanceof Error ? error.message : String(error)}`)];
8060
8241
  }
8061
- pending = false;
8062
- destroyed = true;
8063
- return [receipt(true)];
8064
- } catch (error) {
8065
- return [receipt(false, `providerAsExecutor(${provider.name}): environment.destroy() failed — ${error instanceof Error ? error.message : String(error)}`)];
8066
- }
8242
+ })();
8243
+ let releaseReference;
8244
+ releaseReference = releasePromise.then((receipts) => {
8245
+ if (retainedReleasePromise === releaseReference && !receipts.every((receipt) => receipt.destroyed) && !workspacePreservationRequired && workspaceCaptureFailure === void 0) retainedReleasePromise = void 0;
8246
+ return receipts;
8247
+ });
8248
+ retainedReleasePromise = releaseReference;
8249
+ return await releaseReference;
8067
8250
  },
8068
8251
  resultArtifact() {
8069
8252
  if (!artifact) throw new ValidationError(`providerAsExecutor(${provider.name}): resultArtifact() read before stream drained`);
@@ -8117,12 +8300,12 @@ async function* streamProviderExecutor(args) {
8117
8300
  let usd = 0;
8118
8301
  let text = "";
8119
8302
  let terminal = false;
8303
+ const failures = createProviderFailureLedger();
8120
8304
  let settled;
8121
8305
  let failure;
8122
8306
  let failed = false;
8123
8307
  try {
8124
8308
  const toolParts = createSandboxToolPartState();
8125
- const failures = createProviderFailureLedger();
8126
8309
  for await (const event of source.events) {
8127
8310
  archive.append(event);
8128
8311
  text += textFromEnvironmentEvent(event);
@@ -8189,14 +8372,20 @@ async function* streamProviderExecutor(args) {
8189
8372
  box: environmentAsSandboxInstance(environment, { requireTerminalEvent: args.options.requireTerminalEvent ?? true }),
8190
8373
  signal: linked
8191
8374
  });
8375
+ const retainedWorkspace = await args.captureWorkspace(environment, outcome);
8376
+ args.onPublishedSnapshot(retainedWorkspace);
8377
+ const settledResult = {
8378
+ ...result,
8379
+ ...retainedWorkspace === void 0 ? {} : { workspaceSnapshot: retainedWorkspace }
8380
+ };
8192
8381
  settled = {
8193
8382
  ...result.outcome?.status === "failed" ? { outcome: {
8194
8383
  success: false,
8195
8384
  ...result.outcome.error ? { error: result.outcome.error } : {},
8196
8385
  ...result.outcome.errorCode ? { errorCode: result.outcome.errorCode } : {}
8197
8386
  } } : {},
8198
- outRef: contentRef$1(`provider:${args.provider.name}`, result),
8199
- out: result,
8387
+ outRef: contentRef$1(`provider:${args.provider.name}`, settledResult),
8388
+ out: settledResult,
8200
8389
  ...verdict ? { verdict } : {},
8201
8390
  spent
8202
8391
  };
@@ -8206,24 +8395,37 @@ async function* streamProviderExecutor(args) {
8206
8395
  } catch (error) {
8207
8396
  failure = source.retained ? new RetainedExecutionPendingError(error) : error;
8208
8397
  failed = true;
8398
+ if (args.options.workspaceRetention !== void 0) args.onUnsettledFailure();
8399
+ const failureOutcome = failures.finish() ?? {
8400
+ success: false,
8401
+ status: "failed",
8402
+ error: error instanceof Error ? error.message : String(error),
8403
+ ...linked.aborted ? { errorCode: "cancelled" } : {}
8404
+ };
8405
+ try {
8406
+ await args.captureWorkspace(environment, failureOutcome);
8407
+ } catch (captureError) {
8408
+ failure = captureError instanceof Error ? Object.assign(captureError, { cause: captureError.cause ?? failure }) : captureError;
8409
+ }
8209
8410
  args.onHarnessTranscript(await captureHarnessTranscript(environment, args.profile.harness, linked));
8210
8411
  } finally {
8211
- if ((!source.retained || settled !== void 0 && !failed) && !(source.retained && args.retention?.preserveEnvironment) && (args.options.destroyOnSettle ?? true)) try {
8212
- await environment.destroy?.();
8213
- args.onDestroyed();
8214
- } catch (error) {
8215
- if (settled !== void 0) args.onArtifact({
8216
- ...settled,
8217
- teardown: {
8218
- failed: true,
8219
- error: error instanceof Error ? error.message : String(error),
8220
- at: (/* @__PURE__ */ new Date()).toISOString()
8221
- }
8222
- });
8223
- else if (!failed) {
8224
- failure = error;
8225
- failed = true;
8226
- } else failure = failure instanceof Error ? Object.assign(failure, { cause: failure.cause ?? error }) : failure;
8412
+ if ((!source.retained || settled !== void 0 && !failed) && !(source.retained && args.retention?.preserveEnvironment) && (args.options.destroyOnSettle ?? true)) {
8413
+ const cleanup = await args.destroyEnvironment();
8414
+ if (!cleanup.destroyed) {
8415
+ const error = new Error(cleanup.detail ?? "provider environment teardown was not confirmed");
8416
+ if (settled !== void 0) args.onArtifact({
8417
+ ...settled,
8418
+ teardown: {
8419
+ failed: true,
8420
+ error: error.message,
8421
+ at: (/* @__PURE__ */ new Date()).toISOString()
8422
+ }
8423
+ });
8424
+ else if (!failed) {
8425
+ failure = error;
8426
+ failed = true;
8427
+ } else failure = failure instanceof Error ? Object.assign(failure, { cause: failure.cause ?? error }) : failure;
8428
+ }
8227
8429
  }
8228
8430
  }
8229
8431
  if (failed) throw failure;
@@ -18690,7 +18892,7 @@ function snapshotExecutorConfig(config) {
18690
18892
  });
18691
18893
  }
18692
18894
  case "provider": {
18693
- const { provider, registry, profileForCreate, taskToTurn, validator, ...decisionData } = config;
18895
+ const { provider, registry, profileForCreate, taskToTurn, validator, workspaceRetention, ...decisionData } = config;
18694
18896
  const snapshot = detachedSnapshot(decisionData, "createExecutor provider config");
18695
18897
  const resolvedProvider = resolveAgentEnvironmentProvider(provider, registry);
18696
18898
  return Object.freeze({
@@ -18698,7 +18900,8 @@ function snapshotExecutorConfig(config) {
18698
18900
  provider: resolvedProvider,
18699
18901
  ...profileForCreate === void 0 ? {} : { profileForCreate },
18700
18902
  ...taskToTurn === void 0 ? {} : { taskToTurn },
18701
- ...validator === void 0 ? {} : { validator }
18903
+ ...validator === void 0 ? {} : { validator },
18904
+ ...workspaceRetention === void 0 ? {} : { workspaceRetention }
18702
18905
  });
18703
18906
  }
18704
18907
  case "sandbox": {
@@ -18831,6 +19034,7 @@ function createExecutor(config) {
18831
19034
  const originalSeam = readSeam(seamed, providerSeamKey, "provider");
18832
19035
  const selected = originalSeam.steering ? selectProviderPlacement(spec.profile, originalSeam) : void 0;
18833
19036
  const providerSeam = selected?.options ?? originalSeam;
19037
+ if (providerSeam.steering && providerSeam.workspaceRetention !== void 0) throw new ValidationError$1("createExecutor(provider, steering): workspaceRetention cannot be used with steering because the session-owned environment has no single-shot preservation barrier");
18834
19038
  const provider = resolveAgentEnvironmentProvider(providerSeam.provider, providerSeam.registry);
18835
19039
  if (providerSeam.steering) {
18836
19040
  if (providerSeam.taskToTurn) throw new ValidationError$1("createExecutor(provider, steering): taskToTurn is not representable by the text-only steerable session");
@@ -25222,6 +25426,6 @@ function isNonEmptySpend(s) {
25222
25426
  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);
25223
25427
  }
25224
25428
  //#endregion
25225
- export { startRetainedInteractiveRun as $, withBudgetResources as $i, contentAddress as $n, writeAllBytes as $r, isPeerMailEnvelope as $t, validateWaitSpec as A, mapSandboxEvent as Ai, providerAsSandboxClient as An, localHarnessExecutable as Ar, workerTraceAnalysisStore as At, SPAWN_RESOURCE_PATH_MAX_BYTES as B, hasCompleteCacheBreakdown as Bi, linkAbort as Bn, promptControlProfileMaterialization as Br, workerTraceEnv as Bt, restoreScopeOwnerAcceptedExecution as C, readSandboxOutcome as Ci, routerBrain as Cn, runWorktreeHarness as Cr, materializeTreeView as Ct, isWaitOutcome as D, createSandboxUsageLedger as Di, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as Dn, DEFAULT_LOCAL_HARNESS as Dr, captureWorkerTraceEvidence as Dt, createWaitProbes as E, createSandboxToolPartState as Ei, observedModelMatchesDeclared as En, removeWorktree as Er, WORKER_TOOL_TRACE_SCHEMA_VERSION as Et, prepareScopeRetainedOwnerTask as F, sumSandboxUsage as Fi, sandboxSessionTraceSource as Fn, assertProfileMaterialization as Fr, newUsageTotals as Ft, readWorkerInteractiveAdmissions as G, stringifySafe as Gi, startRetainedRunInEnvironment as Gn, renderUnsupported as Gr, createActivityLog as Gt, hostDirectoryReader as H, promptCacheTokenClasses as Hi, reconnectRetainedRun as Hn, promptOnlyProfileMaterialization as Hr, workerTraceSeamKey as Ht, scopeRetainedOwnerContext as I, addSpend as Ii, registerRetainedExecutorPreparation as In, controlProfileMaterialization as Ir, spendFromUsageEvents as It, readWorkerInteractiveBinding as J, unmeteredSpend as Ji, defaultRedactorIdentityMaterial as Jn, validateProfileMaterialization as Jr, AUTHORITY_MARKERS as Jt, workerInteractiveAdmissionFile as K, throwAbort as Ki, retainedCreateMaterial as Kn, sandboxActProfileMaterialization as Kr, readWorkerProgress as Kt, scopeRetainedOwnerPriorSpend as L, chargedTokens as Li, retainedExecutorSeamKey as Ln, defineProfileMaterializationContract as Lr, spendFromUsageTotals as Lt, bindScopeRetainedOwnerEnvironmentId as M, notifySandboxEventObserver as Mi, sandboxClientAsProvider as Mn, CodexExecutionDiagnosticError as Mr, assertValidBudget as Mt, bindScopeRetainedOwnerProvider as N, sandboxEventServedBackend as Ni, createPushTraceSource as Nn, terminateProcessTreeAndConfirm as Nr, createBudgetPool as Nt, pollFor as O, extractLlmCallEvent as Oi, createAgentEnvironmentProviderRegistry as On, LOCAL_HARNESSES as Or, isTraceAnalysisStore as Ot, consumeScopeRetainedOwnerResult as P, sandboxProgressEvents as Pi, decodeToolPart as Pn, AGENT_PROFILE_MATERIALIZATION_AXES as Pr, meterUsageEvent as Pt, recoverRetainedInteractiveRun as Q, resourceTelemetry as Qi, persistHarnessTranscript as Qn, readCommittedJsonLines as Qr, createPeerMailbox as Qt, scopeRetainedOwnerResourceReader as R, cloneSpend as Ri, RunCancellationReason as Rn, fullProfileMaterialization as Rr, WORKER_TRACE_PROPAGATION as Rt, recordScopeOwnerMaterialization as S, projectSandboxOutcome as Si, readPromptOptions as Sn, runSettledCommand as Sr, loadSpawnForest as St, settledToIteration as T, canonicalStreamEventFromSandboxEvent as Ti, canonicalObservedModelParts as Tn, createWorktree as Tr, replaySpawnTree as Tt, resolveSpawnResourcePaths as U, randomSuffix as Ui, recoverRetainedRun as Un, promptResourceProfileMaterialization as Ur, taskToPrompt as Ut, environmentReader as V, isAbortError$2 as Vi, runAbortable as Vn, promptModelProfileMaterialization as Vr, workerTraceHeaders as Vt, interactiveAdmissionSeamKey as W, sleep as Wi, startRetainedRun as Wn, renderProfileMaterializationIssues as Wr, DEFAULT_STALL_AFTER_MS as Wt, workerInteractiveBindingsDir as X, zeroSpend as Xi, captureHarnessTranscript as Xn, isNoEntError as Xr, PEER_MAIL_WIRE_KEY as Xt, workerInteractiveBindingFile as Y, withTimeout as Yi, resolveRedactor as Yn, worktreeCliProfileMaterialization as Yr, DEFAULT_PEER_MAIL_LIMITS as Yt, reconnectRetainedInteractiveRun as Z, addResourceSpend as Zi, harnessTranscriptArtifact as Zn, prepareJsonlAppend as Zr, claimsAuthority as Zt, beginScopeOwnerAttempt as _, unknownMaterializationReceipt as _i, runAgentRounds as _n, createRuntimeEventCollector as _r, FileResultBlobStore as _t, pickBestDelivered as a, teardownExecutor as aa, knownExecutionBindingReceipt as ai, bridgeAdmissionRefusal as an, buildLoopOtelSpans as ar, rollingDispatch as at, meterRuntimeOwnedAccounting as b, detachedFrozen as bi, acquireSandbox as bn, sanitizeKnowledgeReadinessReport as br, InMemorySpawnJournal as bt, DriverAttemptsExhaustedError as c, providerMessageText as ca, providerAttemptEvidence as ci, createCodexRolloutStoreReader as cn, createOpenInferenceFileExporter as cr, cliInPlaceExecutor as ct, defaultUnmetContractSteer as d, runtimeOwnedExecutorExecutionBinding as di, bridgeRuntimeAttachmentsKey as dn, flatOtelSpan as dr, createExecutorRegistry as dt, decodeHarnessUsage as ea, attestRuntimeOwnedPendingExecutor as ei, peerMailTools as en, createPropagatingTraceEmitter as er, destroyInteractiveEnvironment as et, runDriverWithRetry as f, runtimeOwnedExecutorMaterialization as fi, bridgeStopSignalKey as fn, generateSpanId as fr, snapshotExecutorConfig as ft, withDriverExecutor as g, unknownExecutionBindingReceipt as gi, isTerminalDecision as gn, toOtelAttributes as gr, createInPlaceCliExecutor as gt, isDriverSpec as h, runtimeOwnedScopeOwnerRuntime as hi, defaultSelectWinner as hn, padTraceId as hr, createSteerableSandboxSession as ht, collectDelivered as i, armDeadlineTimer as ia, inheritRuntimeOwnedExecutorAttestation as ii, executorFailure as in, INTELLIGENCE_WIRE_VERSION as ir, queueOf as it, waitUntil as j, mapSandboxToolEvent as ji, resolveAgentEnvironmentProvider as jn, parseCodexTokenUsage as jr, BudgetReconcileFault as jt, timerAt as k, isSandboxTerminalEvent as ki, providerAsExecutor as kn, harnessSupportsReasoningEffort as kr, parseWorkerToolTraceArtifact as kt, HarnessTurnFailedError as l, recordRuntimeOwnedDriveHarnessProviderEvidence as li, harnessUsageIsEmpty as ln, createOtelExporter as lr, cliWorktreeExecutor as lt, driverExecutorFactory as m, runtimeOwnedPendingExecutorMaterialization as mi, createSandboxForSpec as mn, padSpanId as mr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as mt, createSupervisor as n, awaitAbortable$1 as na, authoredProfileDigest as ni, isLiveNodeStatus as nn, readTraceContextFromEnv as nr, effectiveConcurrency as nt, runFinalizer as o, promptFromAgentTurnInput as oa, knownMaterializationReceipt as oi, bridgeModelRouteRefusal as on, buildLoopSpanNodes as or, bindReusableExecutorExecutionId as ot, driverChild as p, runtimeOwnedExecutorProviderEvidence as pi, TERMINAL_DECISIONS as pn, loopEventToOtelSpan as pr, createWorktreeCliExecutor as pt, attachWorker as q, throwIfAborted as qi, defaultRedactor as qn, unsupportedProfileDimensions as qr, createInbox as qt, bestDelivered as r, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as ra, finalizeRuntimeOwnedPendingExecutor as ri, isTerminalNodeStatus as rn, traceContextToEnv as rr, freeSlots as rt, runTree as s, promptOptionsFromAgentTurnInput as sa, newExecutionAttemptId as si, addHarnessUsage as sn, buildRuntimeEventOtelSpans as sr, captureReusableExecutorConfig as st, createRootHandle as t, abortError$2 as ta, attestRuntimeOwnedScopeOwner as ti, peerMailVerbNames as tn, mergeTraceEnv as tr, errMessage as tt, classifyDriverFailure as u, runtimeOwnedDriveHarnessProviderEvidence as ui, readCodexRolloutSession as un, exportEvalRuns as ur, createExecutor as ut, createScope as v, executableAgentProfileSnapshot as vi, createSandboxLineage as vn, createRuntimeStreamEventCollector as vr, FileSpawnJournal as vt, scopeOwnerExecutorNodeContext as w, assertSandboxServedModel as wi, runBrainLoop as wn, captureWorktreeDiff as wr, pendingWaits as wt, meterRuntimeOwnedProviderAttempt as x, detachedSnapshot as xi, assertBoxlessPromptOptions as xn, sanitizeRuntimeStreamEvent as xr, insideCursorNamespace as xt, deriveNodeExecutionIdentity as y, executableAgentSpecSnapshot as yi, probeSandboxCapabilities as yn, sanitizeAgentRuntimeEvent as yr, InMemoryResultBlobStore as yt, scopeRetainedOwnerResult as z, deleteBoxSafe as zi, abortError as zn, profileMaterializationAxes$1 as zr, readWorkerTraceContext as zt };
25429
+ export { startRetainedInteractiveRun as $, withBudgetResources as $i, contentAddress as $n, writeAllBytes as $r, isPeerMailEnvelope as $t, validateWaitSpec as A, mapSandboxEvent as Ai, providerAsSandboxClient as An, localHarnessExecutable as Ar, workerTraceAnalysisStore as At, SPAWN_RESOURCE_PATH_MAX_BYTES as B, hasCompleteCacheBreakdown as Bi, startRetainedRun as Bn, promptControlProfileMaterialization as Br, workerTraceEnv as Bt, restoreScopeOwnerAcceptedExecution as C, readSandboxOutcome as Ci, routerBrain as Cn, runWorktreeHarness as Cr, materializeTreeView as Ct, isWaitOutcome as D, createSandboxUsageLedger as Di, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as Dn, DEFAULT_LOCAL_HARNESS as Dr, captureWorkerTraceEvidence as Dt, createWaitProbes as E, createSandboxToolPartState as Ei, observedModelMatchesDeclared as En, removeWorktree as Er, WORKER_TOOL_TRACE_SCHEMA_VERSION as Et, prepareScopeRetainedOwnerTask as F, sumSandboxUsage as Fi, sandboxSessionTraceSource as Fn, assertProfileMaterialization as Fr, newUsageTotals as Ft, readWorkerInteractiveAdmissions as G, stringifySafe as Gi, linkAbort as Gn, renderUnsupported as Gr, createActivityLog as Gt, hostDirectoryReader as H, promptCacheTokenClasses as Hi, retainedCreateMaterial as Hn, promptOnlyProfileMaterialization as Hr, workerTraceSeamKey as Ht, scopeRetainedOwnerContext as I, addSpend as Ii, registerRetainedExecutorPreparation as In, controlProfileMaterialization as Ir, spendFromUsageEvents as It, readWorkerInteractiveBinding as J, unmeteredSpend as Ji, defaultRedactorIdentityMaterial as Jn, validateProfileMaterialization as Jr, AUTHORITY_MARKERS as Jt, workerInteractiveAdmissionFile as K, throwAbort as Ki, runAbortable as Kn, sandboxActProfileMaterialization as Kr, readWorkerProgress as Kt, scopeRetainedOwnerPriorSpend as L, chargedTokens as Li, retainedExecutorSeamKey as Ln, defineProfileMaterializationContract as Lr, spendFromUsageTotals as Lt, bindScopeRetainedOwnerEnvironmentId as M, notifySandboxEventObserver as Mi, sandboxClientAsProvider as Mn, CodexExecutionDiagnosticError as Mr, assertValidBudget as Mt, bindScopeRetainedOwnerProvider as N, sandboxEventServedBackend as Ni, createPushTraceSource as Nn, terminateProcessTreeAndConfirm as Nr, createBudgetPool as Nt, pollFor as O, extractLlmCallEvent as Oi, createAgentEnvironmentProviderRegistry as On, LOCAL_HARNESSES as Or, isTraceAnalysisStore as Ot, consumeScopeRetainedOwnerResult as P, sandboxProgressEvents as Pi, decodeToolPart as Pn, AGENT_PROFILE_MATERIALIZATION_AXES as Pr, meterUsageEvent as Pt, recoverRetainedInteractiveRun as Q, resourceTelemetry as Qi, persistHarnessTranscript as Qn, readCommittedJsonLines as Qr, createPeerMailbox as Qt, scopeRetainedOwnerResourceReader as R, cloneSpend as Ri, reconnectRetainedRun as Rn, fullProfileMaterialization as Rr, WORKER_TRACE_PROPAGATION as Rt, recordScopeOwnerMaterialization as S, projectSandboxOutcome as Si, readPromptOptions as Sn, runSettledCommand as Sr, loadSpawnForest as St, settledToIteration as T, canonicalStreamEventFromSandboxEvent as Ti, canonicalObservedModelParts as Tn, createWorktree as Tr, replaySpawnTree as Tt, resolveSpawnResourcePaths as U, randomSuffix as Ui, RunCancellationReason as Un, promptResourceProfileMaterialization as Ur, taskToPrompt as Ut, environmentReader as V, isAbortError$2 as Vi, startRetainedRunInEnvironment as Vn, promptModelProfileMaterialization as Vr, workerTraceHeaders as Vt, interactiveAdmissionSeamKey as W, sleep as Wi, abortError as Wn, renderProfileMaterializationIssues as Wr, DEFAULT_STALL_AFTER_MS as Wt, workerInteractiveBindingsDir as X, zeroSpend as Xi, captureHarnessTranscript as Xn, isNoEntError as Xr, PEER_MAIL_WIRE_KEY as Xt, workerInteractiveBindingFile as Y, withTimeout as Yi, resolveRedactor as Yn, worktreeCliProfileMaterialization as Yr, DEFAULT_PEER_MAIL_LIMITS as Yt, reconnectRetainedInteractiveRun as Z, addResourceSpend as Zi, harnessTranscriptArtifact as Zn, prepareJsonlAppend as Zr, claimsAuthority as Zt, beginScopeOwnerAttempt as _, unknownMaterializationReceipt as _i, runAgentRounds as _n, createRuntimeEventCollector as _r, FileResultBlobStore as _t, pickBestDelivered as a, teardownExecutor as aa, knownExecutionBindingReceipt as ai, bridgeAdmissionRefusal as an, buildLoopOtelSpans as ar, rollingDispatch as at, meterRuntimeOwnedAccounting as b, detachedFrozen as bi, acquireSandbox as bn, sanitizeKnowledgeReadinessReport as br, InMemorySpawnJournal as bt, DriverAttemptsExhaustedError as c, providerMessageText as ca, providerAttemptEvidence as ci, createCodexRolloutStoreReader as cn, createOpenInferenceFileExporter as cr, cliInPlaceExecutor as ct, defaultUnmetContractSteer as d, runtimeOwnedExecutorExecutionBinding as di, bridgeRuntimeAttachmentsKey as dn, flatOtelSpan as dr, createExecutorRegistry as dt, decodeHarnessUsage as ea, attestRuntimeOwnedPendingExecutor as ei, peerMailTools as en, createPropagatingTraceEmitter as er, destroyInteractiveEnvironment as et, runDriverWithRetry as f, runtimeOwnedExecutorMaterialization as fi, bridgeStopSignalKey as fn, generateSpanId as fr, snapshotExecutorConfig as ft, withDriverExecutor as g, unknownExecutionBindingReceipt as gi, isTerminalDecision as gn, toOtelAttributes as gr, createInPlaceCliExecutor as gt, isDriverSpec as h, runtimeOwnedScopeOwnerRuntime as hi, defaultSelectWinner as hn, padTraceId as hr, createSteerableSandboxSession as ht, collectDelivered as i, armDeadlineTimer as ia, inheritRuntimeOwnedExecutorAttestation as ii, executorFailure as in, INTELLIGENCE_WIRE_VERSION as ir, queueOf as it, waitUntil as j, mapSandboxToolEvent as ji, resolveAgentEnvironmentProvider as jn, parseCodexTokenUsage as jr, BudgetReconcileFault as jt, timerAt as k, isSandboxTerminalEvent as ki, providerAsExecutor as kn, harnessSupportsReasoningEffort as kr, parseWorkerToolTraceArtifact as kt, HarnessTurnFailedError as l, recordRuntimeOwnedDriveHarnessProviderEvidence as li, harnessUsageIsEmpty as ln, createOtelExporter as lr, cliWorktreeExecutor as lt, driverExecutorFactory as m, runtimeOwnedPendingExecutorMaterialization as mi, createSandboxForSpec as mn, padSpanId as mr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as mt, createSupervisor as n, awaitAbortable$1 as na, authoredProfileDigest as ni, isLiveNodeStatus as nn, readTraceContextFromEnv as nr, effectiveConcurrency as nt, runFinalizer as o, promptFromAgentTurnInput as oa, knownMaterializationReceipt as oi, bridgeModelRouteRefusal as on, buildLoopSpanNodes as or, bindReusableExecutorExecutionId as ot, driverChild as p, runtimeOwnedExecutorProviderEvidence as pi, TERMINAL_DECISIONS as pn, loopEventToOtelSpan as pr, createWorktreeCliExecutor as pt, attachWorker as q, throwIfAborted as qi, defaultRedactor as qn, unsupportedProfileDimensions as qr, createInbox as qt, bestDelivered as r, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as ra, finalizeRuntimeOwnedPendingExecutor as ri, isTerminalNodeStatus as rn, traceContextToEnv as rr, freeSlots as rt, runTree as s, promptOptionsFromAgentTurnInput as sa, newExecutionAttemptId as si, addHarnessUsage as sn, buildRuntimeEventOtelSpans as sr, captureReusableExecutorConfig as st, createRootHandle as t, abortError$2 as ta, attestRuntimeOwnedScopeOwner as ti, peerMailVerbNames as tn, mergeTraceEnv as tr, errMessage as tt, classifyDriverFailure as u, runtimeOwnedDriveHarnessProviderEvidence as ui, readCodexRolloutSession as un, exportEvalRuns as ur, createExecutor as ut, createScope as v, executableAgentProfileSnapshot as vi, createSandboxLineage as vn, createRuntimeStreamEventCollector as vr, FileSpawnJournal as vt, scopeOwnerExecutorNodeContext as w, assertSandboxServedModel as wi, runBrainLoop as wn, captureWorktreeDiff as wr, pendingWaits as wt, meterRuntimeOwnedProviderAttempt as x, detachedSnapshot as xi, assertBoxlessPromptOptions as xn, sanitizeRuntimeStreamEvent as xr, insideCursorNamespace as xt, deriveNodeExecutionIdentity as y, executableAgentSpecSnapshot as yi, probeSandboxCapabilities as yn, sanitizeAgentRuntimeEvent as yr, InMemoryResultBlobStore as yt, scopeRetainedOwnerResult as z, deleteBoxSafe as zi, recoverRetainedRun as zn, profileMaterializationAxes$1 as zr, readWorkerTraceContext as zt };
25226
25430
 
25227
- //# sourceMappingURL=supervisor-BIBWUFUr.js.map
25431
+ //# sourceMappingURL=supervisor-OJwKAnFd.js.map