@tangle-network/agent-runtime 0.142.3 → 0.143.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 (77) hide show
  1. package/dist/{activation-o7JKmtxi.js → activation-mi8TgSLM.js} +2 -2
  2. package/dist/{activation-o7JKmtxi.js.map → activation-mi8TgSLM.js.map} +1 -1
  3. package/dist/agent.d.ts +2 -2
  4. package/dist/agent.js +3 -3
  5. package/dist/{analyst-loop-GcX0BY75.js → analyst-loop-CvkmfhUB.js} +2 -2
  6. package/dist/{analyst-loop-GcX0BY75.js.map → analyst-loop-CvkmfhUB.js.map} +1 -1
  7. package/dist/analyst-loop.d.ts +1 -1
  8. package/dist/analyst-loop.js +1 -1
  9. package/dist/{authoring-Bm1WlGPv.js → authoring-DuyShLdw.js} +2 -2
  10. package/dist/{authoring-Bm1WlGPv.js.map → authoring-DuyShLdw.js.map} +1 -1
  11. package/dist/{conversation-DXKJHyqB.js → conversation-1hNtDeMM.js} +3 -3
  12. package/dist/{conversation-DXKJHyqB.js.map → conversation-1hNtDeMM.js.map} +1 -1
  13. package/dist/conversation.d.ts +1 -1
  14. package/dist/conversation.js +1 -1
  15. package/dist/durable.d.ts +2 -2
  16. package/dist/durable.js +1 -1
  17. package/dist/{environment-provider-BicwCDK5.d.ts → environment-provider-B8eZ85Ga.d.ts} +3 -3
  18. package/dist/{environment-provider-DCEACNt9.js → environment-provider-DCBJ13VP.js} +2 -2
  19. package/dist/{environment-provider-DCEACNt9.js.map → environment-provider-DCBJ13VP.js.map} +1 -1
  20. package/dist/environment-provider.d.ts +1 -1
  21. package/dist/environment-provider.js +1 -1
  22. package/dist/{graph-DhrLuLOS.js → graph-De_XEsfH.js} +2 -2
  23. package/dist/{graph-DhrLuLOS.js.map → graph-De_XEsfH.js.map} +1 -1
  24. package/dist/{improvement-cycle-lcwlR6E2.js → improvement-cycle-Bi-Tf4QF.js} +5 -5
  25. package/dist/{improvement-cycle-lcwlR6E2.js.map → improvement-cycle-Bi-Tf4QF.js.map} +1 -1
  26. package/dist/{index-Bx3-tqG-.d.ts → index-B8rKtH3U.d.ts} +4 -4
  27. package/dist/{index-D_aH0F4C.d.ts → index-C2caGomG.d.ts} +12 -27
  28. package/dist/{index-CV1xRWy2.d.ts → index-D4sLkOPY.d.ts} +3 -3
  29. package/dist/index.d.ts +9 -9
  30. package/dist/index.js +9 -9
  31. package/dist/intelligence.d.ts +5 -5
  32. package/dist/intelligence.js +4 -4
  33. package/dist/kernel.d.ts +7 -7
  34. package/dist/kernel.js +10 -10
  35. package/dist/{knowledge-C9LlSJAR.js → knowledge-CVE6Wk1i.js} +3 -3
  36. package/dist/{knowledge-C9LlSJAR.js.map → knowledge-CVE6Wk1i.js.map} +1 -1
  37. package/dist/knowledge.d.ts +1 -1
  38. package/dist/knowledge.js +1 -1
  39. package/dist/{loop-runner-bin-CctBy5-X.d.ts → loop-runner-bin-BoHdQqLm.d.ts} +3 -3
  40. package/dist/{loop-runner-bin-DFo6Ss-1.js → loop-runner-bin-DdaI1nLL.js} +4 -4
  41. package/dist/{loop-runner-bin-DFo6Ss-1.js.map → loop-runner-bin-DdaI1nLL.js.map} +1 -1
  42. package/dist/loop-runner-bin.d.ts +1 -1
  43. package/dist/loop-runner-bin.js +1 -1
  44. package/dist/{materialization-CrdcfWXp.js → materialization-P86EciBw.js} +43 -2
  45. package/dist/materialization-P86EciBw.js.map +1 -0
  46. package/dist/mcp/bin.js +3 -3
  47. package/dist/mcp/index.d.ts +5 -5
  48. package/dist/mcp/index.js +4 -4
  49. package/dist/{openai-tools-CSm460sC.js → openai-tools-BiAWKjh6.js} +2 -2
  50. package/dist/{openai-tools-CSm460sC.js.map → openai-tools-BiAWKjh6.js.map} +1 -1
  51. package/dist/{openai-tools-t5-6h5bj.d.ts → openai-tools-z-whdYNC.d.ts} +2 -2
  52. package/dist/primeintellect/index.d.ts +1 -1
  53. package/dist/profiles.d.ts +1 -1
  54. package/dist/{redact-B0gDSTZO.d.ts → redact-DexTuAiX.d.ts} +3 -3
  55. package/dist/{runtime-DQs5xHdt.js → runtime-BnqjbOGX.js} +18 -12
  56. package/dist/{runtime-DQs5xHdt.js.map → runtime-BnqjbOGX.js.map} +1 -1
  57. package/dist/{runtime-htqI3fKL.d.ts → runtime-J6Toky8K.d.ts} +22 -10
  58. package/dist/{sandbox-events-BK-g19wx.js → sandbox-events-COwCWUVB.js} +6 -49
  59. package/dist/sandbox-events-COwCWUVB.js.map +1 -0
  60. package/dist/{stream-agent-turn-Dfy12OjG.d.ts → stream-agent-turn-C1Vs_3B9.d.ts} +6 -3
  61. package/dist/{stream-agent-turn-BMHUIuQS.js → stream-agent-turn-CXRugSGO.js} +55 -14
  62. package/dist/stream-agent-turn-CXRugSGO.js.map +1 -0
  63. package/dist/{structural-rollout-CzZKDkmA.js → structural-rollout-CJgj9YXH.js} +4 -4
  64. package/dist/{structural-rollout-CzZKDkmA.js.map → structural-rollout-CJgj9YXH.js.map} +1 -1
  65. package/dist/{supervise-BEs5MB91.js → supervise-hCgG6ROJ.js} +3 -3
  66. package/dist/{supervise-BEs5MB91.js.map → supervise-hCgG6ROJ.js.map} +1 -1
  67. package/dist/{supervisor-B_0ISTFG.js → supervisor-s8SfZYbW.js} +107 -43
  68. package/dist/supervisor-s8SfZYbW.js.map +1 -0
  69. package/dist/testing.d.ts +2 -2
  70. package/dist/testing.js +11 -11
  71. package/dist/{types-DZrBoBpN.d.ts → types-DeX8ibLc.d.ts} +4 -1
  72. package/dist/{types-_7w24mMg.d.ts → types-Df9vulGc.d.ts} +2 -2
  73. package/package.json +5 -5
  74. package/dist/materialization-CrdcfWXp.js.map +0 -1
  75. package/dist/sandbox-events-BK-g19wx.js.map +0 -1
  76. package/dist/stream-agent-turn-BMHUIuQS.js.map +0 -1
  77. package/dist/supervisor-B_0ISTFG.js.map +0 -1
@@ -2,10 +2,10 @@ import { f as RuntimeRunStateError, m as ValidationError, r as BackendTransportE
2
2
  import { t as detachedSnapshot } from "./snapshot-cK9K420n.js";
3
3
  import { S as contentAddress, a as aggregateProviderModelEvidence, c as pendingWaits, g as runtimeOwnedNestedDriverTreeRoot, h as nestedDriverTreeRoot, l as replaySpawnTree, m as driverRuntime, o as loadSpawnForest, p as attestNestedDriverTreeOwner, s as materializeTreeView, v as captureWorkerTraceEvidence } from "./spawn-journal-D2HKUImC.js";
4
4
  import { _ as zeroTokenUsage, a as hasCompleteCacheBreakdown, c as promptCacheTokenClasses, d as sleep, f as stringifySafe, g as withTimeout, h as usdEstimatedOf, i as deleteBoxSafe, l as randomSuffix, m as throwIfAborted, n as chargedTokens, p as throwAbort, r as cloneTokenUsage, s as mapWithConcurrency, t as addTokenUsage, u as randomUuid } from "./util-C1bv6yog.js";
5
- import { a as extractLlmCallEvent, c as notifySandboxEventObserver, n as assertSandboxServedModel, t as assertSandboxEventSucceeded } from "./sandbox-events-BK-g19wx.js";
5
+ import { i as extractLlmCallEvent, o as mapSandboxToolEvent, r as createSandboxToolPartState, s as notifySandboxEventObserver, t as assertSandboxServedModel } from "./sandbox-events-COwCWUVB.js";
6
+ import { C as unknownExecutionBindingReceipt, D as projectSandboxOutcome, E as executableAgentSpecSnapshot, S as runtimeOwnedScopeOwnerRuntime, T as executableAgentProfileSnapshot, a as authoredProfileDigest, b as runtimeOwnedExecutorProviderEvidence, c as knownExecutionBindingReceipt, f as recordRuntimeOwnedProviderAttemptStart, g as runtimeOwnedDeferredExecutorRuntime, h as recordRuntimeOwnedProviderModel, l as knownMaterializationReceipt, m as recordRuntimeOwnedProviderIdentityConflict, n as attestRuntimeOwnedExecutor, o as finalizeRuntimeOwnedPendingExecutor, p as recordRuntimeOwnedProviderDispatchNotStarted, r as attestRuntimeOwnedPendingExecutor, t as attestRuntimeOwnedDeferredExecutor, u as newExecutionAttemptId, v as runtimeOwnedExecutorExecutionBinding, w as unknownMaterializationReceipt, x as runtimeOwnedPendingExecutorMaterialization, y as runtimeOwnedExecutorMaterialization } from "./materialization-P86EciBw.js";
6
7
  import { a as concreteProfileModel, l as resolveRouterRetryPolicy, o as profileBridgeWireModel, s as profileModelExecutionSettings, t as assertExecutableAgentProfile, u as agentHarness } from "./model-policy-DgRJIJse.js";
7
- import { C as unknownExecutionBindingReceipt, E as executableAgentSpecSnapshot, S as runtimeOwnedScopeOwnerRuntime, T as executableAgentProfileSnapshot, a as authoredProfileDigest, b as runtimeOwnedExecutorProviderEvidence, c as knownExecutionBindingReceipt, f as recordRuntimeOwnedProviderAttemptStart, g as runtimeOwnedDeferredExecutorRuntime, h as recordRuntimeOwnedProviderModel, l as knownMaterializationReceipt, m as recordRuntimeOwnedProviderIdentityConflict, n as attestRuntimeOwnedExecutor, o as finalizeRuntimeOwnedPendingExecutor, p as recordRuntimeOwnedProviderDispatchNotStarted, r as attestRuntimeOwnedPendingExecutor, t as attestRuntimeOwnedDeferredExecutor, u as newExecutionAttemptId, v as runtimeOwnedExecutorExecutionBinding, w as unknownMaterializationReceipt, x as runtimeOwnedPendingExecutorMaterialization, y as runtimeOwnedExecutorMaterialization } from "./materialization-CrdcfWXp.js";
8
- import { i as resolveAgentEnvironmentProvider, n as providerAsExecutor, r as providerAsSandboxClient } from "./environment-provider-DCEACNt9.js";
8
+ import { i as resolveAgentEnvironmentProvider, n as providerAsExecutor, r as providerAsSandboxClient } from "./environment-provider-DCBJ13VP.js";
9
9
  import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
10
10
  import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentTurnInputSchema, REASONING_EFFORTS, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema } from "@tangle-network/agent-interface";
11
11
  import { estimateCost, isModelPriced } from "@tangle-network/agent-eval";
@@ -17,11 +17,13 @@ import { appendFileSync, constants, createReadStream } from "node:fs";
17
17
  import { spawn } from "node:child_process";
18
18
  import { homedir, tmpdir } from "node:os";
19
19
  import { stripVTControlCharacters } from "node:util";
20
+ import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
20
21
  import { request } from "node:http";
21
22
  import { request as request$1 } from "node:https";
22
23
  import { Readable } from "node:stream";
23
24
  import { deriveHexId, isW3CSpanId, isW3CTraceId } from "@tangle-network/agent-trace-contract";
24
25
  import { SDKError, generateIdempotencyKey, withRetry } from "@tangle-network/agent-core";
26
+ import { collectAgentFinalMessageText, collectAgentResponseText } from "@tangle-network/sandbox";
25
27
  //#region src/agent/profile-materialization.ts
26
28
  const KNOWN_AXIS_SET = new Set(AGENT_PROFILE_MATERIALIZATION_AXES);
27
29
  /**
@@ -3936,7 +3938,7 @@ async function acquireSandbox(client, options, acquire = {}) {
3936
3938
  while (now() < deadline) {
3937
3939
  throwIfAborted(acquire.signal);
3938
3940
  try {
3939
- return await waitReadyOrDestroy(await client.create(createOpts), deadline, pollMs, acquire.signal, now, sleep$1);
3941
+ return await waitReadyOrDestroy(await client.create(createOpts, acquire.signal === void 0 ? void 0 : { signal: acquire.signal }), deadline, pollMs, acquire.signal, now, sleep$1);
3940
3942
  } catch (err) {
3941
3943
  throwIfAborted(acquire.signal);
3942
3944
  if (!isRetryable(err)) throw err;
@@ -4117,14 +4119,34 @@ async function* pollPromptEvents(box, prompt, sessionId, signal, promptOptions)
4117
4119
  })).sessionId;
4118
4120
  const result = await box.session(activeSessionId).result();
4119
4121
  if (signal.aborted) throwAbort();
4122
+ const resultData = {
4123
+ finalText: result.response ?? "",
4124
+ success: result.success,
4125
+ ...result.status ? { status: result.status } : {},
4126
+ ...result.error ? { error: result.error } : {},
4127
+ ...result.errorCode ? { errorCode: result.errorCode } : {},
4128
+ ...result.toolInvocations ? { toolInvocations: result.toolInvocations } : {},
4129
+ ...result.approval ? { approval: result.approval } : {},
4130
+ ...result.question ? { question: result.question } : {},
4131
+ ...result.interaction ? { interaction: result.interaction } : {},
4132
+ ...result.plan ? { plan: result.plan } : {},
4133
+ ...result.usage ? { usage: result.usage } : {},
4134
+ ...result.costUsd !== void 0 ? { costUsd: result.costUsd } : {}
4135
+ };
4120
4136
  yield {
4121
4137
  type: "result",
4122
4138
  id: activeSessionId,
4139
+ data: resultData
4140
+ };
4141
+ yield {
4142
+ type: "done",
4143
+ id: activeSessionId,
4123
4144
  data: {
4124
- finalText: result.response ?? "",
4125
- success: result.success,
4126
- ...result.error ? { error: result.error } : {},
4127
- ...result.usage ? { usage: result.usage } : {}
4145
+ ...resultData,
4146
+ outcome: result.status === "awaiting_plan_decision" && result.plan ? {
4147
+ type: "awaiting_plan_decision",
4148
+ plan: result.plan
4149
+ } : { type: "completed" }
4128
4150
  }
4129
4151
  };
4130
4152
  }
@@ -4702,14 +4724,14 @@ async function executeIteration(args) {
4702
4724
  ...requestedModel !== void 0 ? { model: requestedModel } : {}
4703
4725
  };
4704
4726
  let sawLlmCall = false;
4727
+ const outcomeTracker = createAgentRunOutcomeTracker();
4705
4728
  for await (const event of stream) {
4706
4729
  events.push(event);
4730
+ outcomeTracker.observe(event);
4707
4731
  notifySandboxEventObserver(event, args.ctx.onSandboxEvent, {
4708
4732
  iterationIndex: args.item.index,
4709
4733
  agentRunName: slot.agentRunName
4710
4734
  });
4711
- assertSandboxEventSucceeded(event);
4712
- assertSandboxServedModel(event, requested);
4713
4735
  const llmCall = extractLlmCallEvent(event, slot.agentRunName);
4714
4736
  if (llmCall) {
4715
4737
  sawLlmCall = true;
@@ -4728,18 +4750,24 @@ async function executeIteration(args) {
4728
4750
  });
4729
4751
  args.ctx.runHandle?.observe(llmCall);
4730
4752
  }
4753
+ assertSandboxServedModel(event, requested);
4731
4754
  }
4755
+ const outcome = outcomeTracker.finish();
4756
+ slot.sandboxOutcome = outcome;
4732
4757
  if (!sawLlmCall) {
4733
4758
  slot.tokenUsage.tokensKnown = false;
4734
4759
  slot.costUsdKnown = false;
4735
4760
  }
4736
4761
  slot.output = args.output.parse(events);
4737
- if (args.validator) slot.verdict = await args.validator.validate(slot.output, {
4762
+ const projection = projectSandboxOutcome(outcome);
4763
+ if (projection.status === "failed") throw new Error(projection.reason);
4764
+ if (projection.status === "completed" && args.validator) slot.verdict = await args.validator.validate(slot.output, {
4738
4765
  iteration: args.item.index,
4739
4766
  ...box ? { box } : {},
4740
4767
  signal: args.signal,
4741
4768
  traceEmitter: args.ctx.traceEmitter
4742
4769
  });
4770
+ else if (projection.status !== "completed") slot.verdict = projection.verdict;
4743
4771
  } catch (err) {
4744
4772
  slot.error = err instanceof Error ? err : new Error(String(err));
4745
4773
  } finally {
@@ -5110,6 +5138,26 @@ function hashJson(value) {
5110
5138
  return (h >>> 0).toString(16).padStart(8, "0");
5111
5139
  }
5112
5140
  //#endregion
5141
+ //#region src/runtime/sandbox-executor-output.ts
5142
+ /** Project the complete Sandbox event stream into the standard executor result shape. */
5143
+ function sandboxLeafOutputFromEvents(events) {
5144
+ const content = collectAgentFinalMessageText(events) ?? collectAgentResponseText(events) ?? "";
5145
+ const toolCalls = sandboxToolCalls(events);
5146
+ return {
5147
+ events,
5148
+ content,
5149
+ ...toolCalls.length === 0 ? {} : { toolCalls }
5150
+ };
5151
+ }
5152
+ function sandboxToolCalls(events) {
5153
+ const state = createSandboxToolPartState();
5154
+ return events.flatMap((event) => mapSandboxToolEvent(event, state).flatMap((projected) => projected.type === "tool_call" ? [{
5155
+ ...projected.toolCallId === void 0 ? {} : { id: projected.toolCallId },
5156
+ name: projected.toolName,
5157
+ arguments: projected.args ?? {}
5158
+ }] : []));
5159
+ }
5160
+ //#endregion
5113
5161
  //#region src/runtime/supervise/cost-estimate.ts
5114
5162
  /**
5115
5163
  * Pricing for work that arrived without a provider receipt.
@@ -5870,6 +5918,7 @@ function createSteerableSandboxSession(args) {
5870
5918
  lastText: "",
5871
5919
  seenToolCalls: /* @__PURE__ */ new Set(),
5872
5920
  artifact: void 0,
5921
+ latestOutcome: void 0,
5873
5922
  teardown: void 0,
5874
5923
  note: "starting"
5875
5924
  };
@@ -5958,6 +6007,7 @@ function createSteerableSandboxSession(args) {
5958
6007
  };
5959
6008
  let events;
5960
6009
  let sawLlmCall = false;
6010
+ const outcomeTracker = createAgentRunOutcomeTracker();
5961
6011
  try {
5962
6012
  if (!handle) {
5963
6013
  const opened = await lineage.start(spec, prompt, turnController.signal, promptOptions);
@@ -5965,36 +6015,38 @@ function createSteerableSandboxSession(args) {
5965
6015
  events = opened.events;
5966
6016
  } else events = await lineage.continue(handle, prompt, turnController.signal, promptOptions);
5967
6017
  for await (const event of events) {
6018
+ outcomeTracker.observe(event);
5968
6019
  recordEvent(event);
5969
- assertSandboxEventSucceeded(event);
5970
- assertSandboxServedModel(event, requested);
5971
6020
  const call = extractLlmCallEvent(event, spec.name ?? String(args.harness));
5972
- if (!call) continue;
5973
- sawLlmCall = true;
5974
- const callTokensKnown = call.tokensKnown !== false && typeof call.tokensIn === "number" && typeof call.tokensOut === "number";
5975
- if (!callTokensKnown) tokensKnown = false;
5976
- const input = call.tokensIn ?? 0;
5977
- const output = call.tokensOut ?? 0;
5978
- if (input || output || !callTokensKnown) {
5979
- const usage = {
5980
- kind: "tokens",
5981
- input,
5982
- output,
5983
- ...callTokensKnown ? {} : { tokensKnown: false },
5984
- ...promptCacheTokenClasses(call.tokensIn, call.promptCache)
5985
- };
5986
- addTokenUsage(tokens, usage);
5987
- yield usage;
5988
- }
5989
- if (typeof call.costUsd === "number" && call.costUsd > 0) {
5990
- usd += call.costUsd;
5991
- yield {
5992
- kind: "cost",
5993
- usd: call.costUsd,
5994
- usdKnown: false
5995
- };
6021
+ if (call) {
6022
+ sawLlmCall = true;
6023
+ const callTokensKnown = call.tokensKnown !== false && typeof call.tokensIn === "number" && typeof call.tokensOut === "number";
6024
+ if (!callTokensKnown) tokensKnown = false;
6025
+ const input = call.tokensIn ?? 0;
6026
+ const output = call.tokensOut ?? 0;
6027
+ if (input || output || !callTokensKnown) {
6028
+ const usage = {
6029
+ kind: "tokens",
6030
+ input,
6031
+ output,
6032
+ ...callTokensKnown ? {} : { tokensKnown: false },
6033
+ ...promptCacheTokenClasses(call.tokensIn, call.promptCache)
6034
+ };
6035
+ addTokenUsage(tokens, usage);
6036
+ yield usage;
6037
+ }
6038
+ if (typeof call.costUsd === "number" && call.costUsd > 0) {
6039
+ usd += call.costUsd;
6040
+ yield {
6041
+ kind: "cost",
6042
+ usd: call.costUsd,
6043
+ usdKnown: false
6044
+ };
6045
+ }
5996
6046
  }
6047
+ assertSandboxServedModel(event, requested);
5997
6048
  }
6049
+ state.latestOutcome = outcomeTracker.finish();
5998
6050
  } catch (e) {
5999
6051
  cleanup();
6000
6052
  if (isInterruptAbort(e, interruptSig, signal, args.controller.signal)) {
@@ -6048,14 +6100,17 @@ function createSteerableSandboxSession(args) {
6048
6100
  const out = {
6049
6101
  content: state.lastText,
6050
6102
  turns: state.turns,
6051
- toolCalls: activity.read().filter((n) => n.kind === "tool").map((n) => n.label)
6103
+ toolCalls: activity.read().filter((n) => n.kind === "tool").map((n) => n.label),
6104
+ ...state.latestOutcome ? { outcome: state.latestOutcome } : {}
6052
6105
  };
6106
+ const verdict = state.latestOutcome ? projectSandboxOutcome(state.latestOutcome).verdict : void 0;
6053
6107
  state.artifact = {
6054
6108
  outRef: args.contentRef("sandbox-steerable", {
6055
6109
  harness: args.harness,
6056
6110
  out
6057
6111
  }),
6058
6112
  out,
6113
+ ...verdict ? { verdict } : {},
6059
6114
  spent
6060
6115
  };
6061
6116
  }
@@ -7217,7 +7272,7 @@ const sandboxExecutor = (spec, ctx) => {
7217
7272
  }, sandboxMaterialization, sandboxBinding);
7218
7273
  }
7219
7274
  const output = { parse(events) {
7220
- return { events };
7275
+ return sandboxLeafOutputFromEvents(events);
7221
7276
  } };
7222
7277
  const driver = singleShotDriver(maxIterations);
7223
7278
  return attestRuntimeOwnedExecutor({
@@ -7289,12 +7344,21 @@ async function* streamSandboxLeaf(args) {
7289
7344
  const result = await runAgentRounds(loopOptions);
7290
7345
  const failure = failedRound(result);
7291
7346
  if (failure) throw failure;
7292
- const out = result.winner?.output ?? { events: [] };
7293
- const verdict = result.winner?.verdict ?? leafVerdict(result);
7347
+ const winningIteration = result.winner ? result.iterations.find((iteration) => iteration.index === result.winner?.iterationIndex) : result.iterations.at(-1);
7348
+ const out = winningIteration?.output ?? sandboxLeafOutputFromEvents(winningIteration?.events ?? []);
7349
+ const sandboxOutcome = winningIteration?.sandboxOutcome;
7350
+ const outWithOutcome = {
7351
+ ...out,
7352
+ ...sandboxOutcome ? { outcome: sandboxOutcome } : {}
7353
+ };
7354
+ const verdict = sandboxOutcome && !sandboxOutcome.success ? {
7355
+ valid: false,
7356
+ score: 0
7357
+ } : result.winner?.verdict ?? leafVerdict(result);
7294
7358
  const tokensKnown = result.tokenUsage.tokensKnown !== false;
7295
7359
  const usdKnown = result.costUsdKnown !== false;
7296
7360
  const outWithUsage = {
7297
- ...out,
7361
+ ...outWithOutcome,
7298
7362
  ...result.estimatedCostUsd !== void 0 ? { estimatedCostUsd: result.estimatedCostUsd } : {},
7299
7363
  ...result.promptCache ? { promptCache: result.promptCache } : {}
7300
7364
  };
@@ -13045,4 +13109,4 @@ function isNonEmptySpend(s) {
13045
13109
  //#endregion
13046
13110
  export { createInbox as $, AGENT_PROFILE_MATERIALIZATION_AXES as $t, createBudgetPool as A, exportEvalRuns as At, WORKER_TRACE_PROPAGATION as B, sanitizeKnowledgeReadinessReport as Bt, effectiveConcurrency as C, traceContextToEnv as Ct, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as D, buildRuntimeEventOtelSpans as Dt, rollingDispatch as E, buildLoopSpanNodes as Et, cliWorktreeExecutor as F, padTraceId as Ft, DEFAULT_SANDBOX_STEERING_MAX_TURNS as G, createWorktree as Gt, workerTraceEnv as H, runSettledCommand as Ht, createExecutor as I, toOtelAttributes as It, decodeToolPart as J, LOCAL_HARNESSES as Jt, createSteerableSandboxSession as K, removeWorktree as Kt, createExecutorRegistry as L, createRuntimeEventCollector as Lt, bindReusableExecutorExecutionId as M, generateSpanId as Mt, bridgeStopSignalKey as N, loopEventToOtelSpan as Nt, teardownExecutor as O, createOpenInferenceFileExporter as Ot, captureReusableExecutorConfig as P, padSpanId as Pt, readWorkerProgress as Q, CodexExecutionDiagnosticError as Qt, snapshotExecutorConfig as R, createRuntimeStreamEventCollector as Rt, waitUntil as S, readTraceContextFromEnv as St, queueOf as T, buildLoopOtelSpans as Tt, workerTraceHeaders as U, runWorktreeHarness as Ut, readWorkerTraceContext as V, sanitizeRuntimeStreamEvent as Vt, workerTraceSeamKey as W, captureWorktreeDiff as Wt, DEFAULT_STALL_AFTER_MS as X, localHarnessExecutable as Xt, sandboxSessionTraceSource as Y, harnessSupportsReasoningEffort as Yt, createActivityLog as Z, parseCodexTokenUsage as Zt, createWaitProbes as _, runBrainLoop as _t, pickBestDelivered as a, promptControlProfileMaterialization as an, isPeerMailEnvelope as at, timerAt as b, createPropagatingTraceEmitter as bt, driverChild as c, promptResourceProfileMaterialization as cn, TERMINAL_DECISIONS as ct, deriveNodeExecutionIdentity as d, validateProfileMaterialization as dn, isTerminalDecision as dt, assertProfileMaterialization as en, AUTHORITY_MARKERS as et, meterRuntimeOwnedAccounting as f, worktreeCliProfileMaterialization as fn, runAgentRounds as ft, settledToIteration as g, routerBrain as gt, scopeOwnerExecutorNodeContext as h, acquireSandbox as ht, collectDelivered as i, profileMaterializationAxes$1 as in, createPeerMailbox as it, spendFromUsageEvents as j, flatOtelSpan as jt, assertValidBudget as k, createOtelExporter as kt, withDriverExecutor as l, renderProfileMaterializationIssues as ln, createSandboxForSpec as lt, recordScopeOwnerMaterialization as m, probeSandboxCapabilities as mt, createSupervisor as n, defineProfileMaterializationContract as nn, PEER_MAIL_WIRE_KEY as nt, runFinalizer as o, promptModelProfileMaterialization as on, peerMailTools as ot, meterRuntimeOwnedProviderAttempt as p, createSandboxLineage as pt, createPushTraceSource as q, DEFAULT_LOCAL_HARNESS as qt, bestDelivered as r, fullProfileMaterialization as rn, claimsAuthority as rt, runTree as s, promptOnlyProfileMaterialization as sn, peerMailVerbNames as st, createRootHandle as t, controlProfileMaterialization as tn, DEFAULT_PEER_MAIL_LIMITS as tt, createScope as u, sandboxActProfileMaterialization as un, defaultSelectWinner as ut, isWaitOutcome as v, canonicalObservedModel as vt, freeSlots as w, INTELLIGENCE_WIRE_VERSION as wt, validateWaitSpec as x, mergeTraceEnv as xt, pollFor as y, observedModelMatchesDeclared as yt, createWorktreeCliExecutor as z, sanitizeAgentRuntimeEvent as zt };
13047
13111
 
13048
- //# sourceMappingURL=supervisor-B_0ISTFG.js.map
13112
+ //# sourceMappingURL=supervisor-s8SfZYbW.js.map