@tangle-network/agent-runtime 0.133.7 → 0.134.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 (98) hide show
  1. package/dist/{activation-BeFr74qj.js → activation-BaxUkhEf.js} +3 -3
  2. package/dist/{activation-BeFr74qj.js.map → activation-BaxUkhEf.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{analyst-loop-C189F6v8.js → analyst-loop-BKWqQhVI.js} +2 -2
  6. package/dist/{analyst-loop-C189F6v8.js.map → analyst-loop-BKWqQhVI.js.map} +1 -1
  7. package/dist/analyst-loop.js +1 -1
  8. package/dist/{authoring-CxnWFZVk.js → authoring-BlbRLEOS.js} +2 -2
  9. package/dist/{authoring-CxnWFZVk.js.map → authoring-BlbRLEOS.js.map} +1 -1
  10. package/dist/candidate-execution/index.js +4 -4
  11. package/dist/{candidate-execution-_u2HIWeX.js → candidate-execution-CJRP9CcZ.js} +4 -4
  12. package/dist/{candidate-execution-_u2HIWeX.js.map → candidate-execution-CJRP9CcZ.js.map} +1 -1
  13. package/dist/{conversation-kPowfA_A.js → conversation-CrWcNPQg.js} +4 -4
  14. package/dist/{conversation-kPowfA_A.js.map → conversation-CrWcNPQg.js.map} +1 -1
  15. package/dist/conversation.d.ts +1 -1
  16. package/dist/conversation.js +1 -1
  17. package/dist/{environment-provider-DTJA4ZiM.js → environment-provider-CwvY-Zeq.js} +2 -2
  18. package/dist/{environment-provider-DTJA4ZiM.js.map → environment-provider-CwvY-Zeq.js.map} +1 -1
  19. package/dist/{environment-provider-B-w9VYcF.d.ts → environment-provider-qDOhdE9M.d.ts} +2 -2
  20. package/dist/environment-provider.d.ts +1 -1
  21. package/dist/environment-provider.js +1 -1
  22. package/dist/{errors-DRoXIc7E.js → errors-CVIDr7GQ.js} +9 -1
  23. package/dist/errors-CVIDr7GQ.js.map +1 -0
  24. package/dist/{graph-C_rMgoWQ.js → graph-CKNenH2a.js} +4 -4
  25. package/dist/{graph-C_rMgoWQ.js.map → graph-CKNenH2a.js.map} +1 -1
  26. package/dist/{improvement-cycle-BBH8oYiA.js → improvement-cycle-CSBantKB.js} +9 -9
  27. package/dist/{improvement-cycle-BBH8oYiA.js.map → improvement-cycle-CSBantKB.js.map} +1 -1
  28. package/dist/{index-DqJa9jGF.d.ts → index-CgBJtAzI.d.ts} +2 -2
  29. package/dist/{index-DLjXduyp.d.ts → index-Cz4qKBxm.d.ts} +4 -4
  30. package/dist/{index-kMp8g-jT.d.ts → index-De10l_EU.d.ts} +66 -6
  31. package/dist/index.d.ts +7 -7
  32. package/dist/index.js +14 -14
  33. package/dist/intelligence.d.ts +4 -4
  34. package/dist/intelligence.js +6 -6
  35. package/dist/kernel.d.ts +6 -6
  36. package/dist/kernel.js +11 -11
  37. package/dist/{knowledge-DubRihOP.js → knowledge-B2C9t1Z4.js} +7 -7
  38. package/dist/{knowledge-DubRihOP.js.map → knowledge-B2C9t1Z4.js.map} +1 -1
  39. package/dist/knowledge.d.ts +1 -1
  40. package/dist/knowledge.js +1 -1
  41. package/dist/{loop-runner-bin-CMKMWSH6.js → loop-runner-bin-C0ymKYU7.js} +5 -5
  42. package/dist/{loop-runner-bin-CMKMWSH6.js.map → loop-runner-bin-C0ymKYU7.js.map} +1 -1
  43. package/dist/{loop-runner-bin-CC5c39zY.d.ts → loop-runner-bin-D-tgbSPx.d.ts} +3 -3
  44. package/dist/loop-runner-bin.d.ts +1 -1
  45. package/dist/loop-runner-bin.js +1 -1
  46. package/dist/{materialization-D2bdTfkK.js → materialization-BP5zspr2.js} +25 -10
  47. package/dist/materialization-BP5zspr2.js.map +1 -0
  48. package/dist/mcp/bin.js +4 -4
  49. package/dist/mcp/index.d.ts +3 -3
  50. package/dist/mcp/index.js +9 -9
  51. package/dist/mcp/memory-bin.js +1 -1
  52. package/dist/{memory-server-CblxrUKT.js → memory-server-Cdpy7Uu8.js} +3 -3
  53. package/dist/{memory-server-CblxrUKT.js.map → memory-server-Cdpy7Uu8.js.map} +1 -1
  54. package/dist/{model-policy-Bv1DU2fw.js → model-policy-UTTc9Z-A.js} +2 -2
  55. package/dist/{model-policy-Bv1DU2fw.js.map → model-policy-UTTc9Z-A.js.map} +1 -1
  56. package/dist/{openai-tools-DrQwA-X_.js → openai-tools-ClOkPIi0.js} +2 -2
  57. package/dist/{openai-tools-DrQwA-X_.js.map → openai-tools-ClOkPIi0.js.map} +1 -1
  58. package/dist/{prepare-DUbH3GD5.js → prepare-BXEtLOj9.js} +2 -2
  59. package/dist/{prepare-DUbH3GD5.js.map → prepare-BXEtLOj9.js.map} +1 -1
  60. package/dist/primeintellect/index.d.ts +1 -1
  61. package/dist/profiles.js +1 -1
  62. package/dist/{protected-model-port-DP7MS63a.js → protected-model-port-B7PAmTGi.js} +2 -2
  63. package/dist/{protected-model-port-DP7MS63a.js.map → protected-model-port-B7PAmTGi.js.map} +1 -1
  64. package/dist/{redact-BSD-nvTf.d.ts → redact-6UE6pdNi.d.ts} +3 -3
  65. package/dist/{researcher-BiWSFLi6.js → researcher-DBfKdnAz.js} +3 -3
  66. package/dist/{researcher-BiWSFLi6.js.map → researcher-DBfKdnAz.js.map} +1 -1
  67. package/dist/{runtime-VwxvxGN7.js → runtime-Bisfbn3_.js} +102 -25
  68. package/dist/runtime-Bisfbn3_.js.map +1 -0
  69. package/dist/{runtime-D-26vxJt.d.ts → runtime-DlxoqEj2.d.ts} +27 -6
  70. package/dist/{snapshot-DY6VGliG.js → snapshot-BOIprwBk.js} +2 -2
  71. package/dist/{snapshot-DY6VGliG.js.map → snapshot-BOIprwBk.js.map} +1 -1
  72. package/dist/{spawn-journal-BX3-4WDm.js → spawn-journal-B856eA8e.js} +27 -11
  73. package/dist/spawn-journal-B856eA8e.js.map +1 -0
  74. package/dist/{stream-agent-turn-NFWCv1X1.d.ts → stream-agent-turn-CJog3ebs.d.ts} +2 -2
  75. package/dist/{stream-agent-turn-D8YHY0oO.js → stream-agent-turn-CdIcf-bn.js} +4 -4
  76. package/dist/{stream-agent-turn-D8YHY0oO.js.map → stream-agent-turn-CdIcf-bn.js.map} +1 -1
  77. package/dist/{structural-rollout-eAj7HG0m.js → structural-rollout-DKEP5i__.js} +6 -6
  78. package/dist/{structural-rollout-eAj7HG0m.js.map → structural-rollout-DKEP5i__.js.map} +1 -1
  79. package/dist/{supervise-009CRDW1.js → supervise-DhghNvl6.js} +72 -40
  80. package/dist/supervise-DhghNvl6.js.map +1 -0
  81. package/dist/{supervisor-DNX8CXui.js → supervisor-CMlIOkJP.js} +89 -22
  82. package/dist/{supervisor-DNX8CXui.js.map → supervisor-CMlIOkJP.js.map} +1 -1
  83. package/dist/testing.d.ts +2 -2
  84. package/dist/testing.js +12 -12
  85. package/dist/{tool-server-VvSK1K3X.js → tool-server-Dh-NcbHr.js} +2 -2
  86. package/dist/{tool-server-VvSK1K3X.js.map → tool-server-Dh-NcbHr.js.map} +1 -1
  87. package/dist/{types-DJ7k6vHE.d.ts → types-D4BfurNs.d.ts} +9 -2
  88. package/dist/{util-Dr--8wAL.js → util-DD8bRWPL.js} +21 -2
  89. package/dist/util-DD8bRWPL.js.map +1 -0
  90. package/dist/{workspace-archive-WEbaLREb.js → workspace-archive-B5oJu5mZ.js} +2 -2
  91. package/dist/{workspace-archive-WEbaLREb.js.map → workspace-archive-B5oJu5mZ.js.map} +1 -1
  92. package/package.json +1 -1
  93. package/dist/errors-DRoXIc7E.js.map +0 -1
  94. package/dist/materialization-D2bdTfkK.js.map +0 -1
  95. package/dist/runtime-VwxvxGN7.js.map +0 -1
  96. package/dist/spawn-journal-BX3-4WDm.js.map +0 -1
  97. package/dist/supervise-009CRDW1.js.map +0 -1
  98. package/dist/util-Dr--8wAL.js.map +0 -1
@@ -1,11 +1,12 @@
1
- import { f as ValidationError, i as ConfigError, o as NotFoundError, r as BackendTransportError, t as AgentEvalError$1, u as RuntimeRunStateError } from "./errors-DRoXIc7E.js";
2
- import { t as detachedSnapshot } from "./snapshot-DY6VGliG.js";
3
- import { S as contentAddress, b as parseWorkerToolTraceArtifact, d as prepareJsonlAppend, f as writeAllBytes, i as InMemorySpawnJournal, n as FileSpawnJournal, r as InMemoryResultBlobStore, t as FileResultBlobStore, u as parseCommittedJsonLines, x as workerTraceAnalysisStore } from "./spawn-journal-BX3-4WDm.js";
4
- import { a as concreteProfileModel, d as harnessRunsAgent, n as assertModelAllowed, r as assertProfileModelsAllowed, s as profileModelExecutionSettings, t as assertExecutableAgentProfile, u as agentHarness } from "./model-policy-Bv1DU2fw.js";
5
- import { _ as runtimeOwnedExecutorExecutionBinding, b as runtimeOwnedPendingExecutorMaterialization, d as recordRuntimeOwnedDriveHarnessProviderEvidence, g as runtimeOwnedDriveHarnessProviderEvidence, i as attestRuntimeOwnedScopeOwner, s as inheritRuntimeOwnedExecutorAttestation, v as runtimeOwnedExecutorMaterialization, x as runtimeOwnedScopeOwnerRuntime, y as runtimeOwnedExecutorProviderEvidence } from "./materialization-D2bdTfkK.js";
6
- import { A as spendFromUsageEvents, C as freeSlots, D as teardownExecutor, E as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, F as createExecutorRegistry, Gt as fullProfileMaterialization, Ht as assertProfileMaterialization, I as snapshotExecutorConfig, Jt as promptModelProfileMaterialization, Kt as profileMaterializationAxes$1, M as captureReusableExecutorConfig, O as assertValidBudget, P as createExecutor, R as WORKER_TRACE_PROPAGATION, Ut as controlProfileMaterialization, Wt as defineProfileMaterializationContract, Z as createInbox, _t as createOtelExporter, a as pickBestDelivered, at as runBrainLoop, bt as generateSpanId, c as driverChild, d as deriveNodeExecutionIdentity, en as worktreeCliProfileMaterialization, f as meterRuntimeOwnedProviderAttempt, it as routerBrain, j as bindReusableExecutorExecutionId, l as withDriverExecutor, m as scopeOwnerExecutorNodeContext, mt as buildLoopSpanNodes, n as createSupervisor, o as runFinalizer, p as recordScopeOwnerMaterialization, qt as promptControlProfileMaterialization, r as bestDelivered, s as runTree, wt as toOtelAttributes } from "./supervisor-DNX8CXui.js";
1
+ import { f as ValidationError, i as ConfigError, o as NotFoundError, r as BackendTransportError, t as AgentEvalError$1, u as RuntimeRunStateError } from "./errors-CVIDr7GQ.js";
2
+ import { t as detachedSnapshot } from "./snapshot-BOIprwBk.js";
3
+ import { S as contentAddress, b as parseWorkerToolTraceArtifact, d as prepareJsonlAppend, f as writeAllBytes, i as InMemorySpawnJournal, n as FileSpawnJournal, r as InMemoryResultBlobStore, t as FileResultBlobStore, u as parseCommittedJsonLines, x as workerTraceAnalysisStore } from "./spawn-journal-B856eA8e.js";
4
+ import { n as chargedTokens } from "./util-DD8bRWPL.js";
5
+ import { a as concreteProfileModel, d as harnessRunsAgent, n as assertModelAllowed, r as assertProfileModelsAllowed, s as profileModelExecutionSettings, t as assertExecutableAgentProfile, u as agentHarness } from "./model-policy-UTTc9Z-A.js";
6
+ import { S as runtimeOwnedScopeOwnerRuntime, _ as runtimeOwnedDriveHarnessProviderEvidence, b as runtimeOwnedExecutorProviderEvidence, d as recordRuntimeOwnedDriveHarnessProviderEvidence, i as attestRuntimeOwnedScopeOwner, s as inheritRuntimeOwnedExecutorAttestation, v as runtimeOwnedExecutorExecutionBinding, x as runtimeOwnedPendingExecutorMaterialization, y as runtimeOwnedExecutorMaterialization } from "./materialization-BP5zspr2.js";
7
+ import { A as spendFromUsageEvents, C as freeSlots, D as teardownExecutor, E as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, F as createExecutor, Gt as defineProfileMaterializationContract, I as createExecutorRegistry, Jt as promptControlProfileMaterialization, Kt as fullProfileMaterialization, L as snapshotExecutorConfig, M as bridgeStopSignalKey, N as captureReusableExecutorConfig, O as assertValidBudget, Q as createInbox, Tt as toOtelAttributes, Ut as assertProfileMaterialization, Wt as controlProfileMaterialization, Yt as promptModelProfileMaterialization, a as pickBestDelivered, at as routerBrain, c as driverChild, d as deriveNodeExecutionIdentity, f as meterRuntimeOwnedProviderAttempt, ht as buildLoopSpanNodes, j as bindReusableExecutorExecutionId, l as withDriverExecutor, m as scopeOwnerExecutorNodeContext, n as createSupervisor, o as runFinalizer, ot as runBrainLoop, p as recordScopeOwnerMaterialization, qt as profileMaterializationAxes$1, r as bestDelivered, s as runTree, tn as worktreeCliProfileMaterialization, vt as createOtelExporter, xt as generateSpanId, z as WORKER_TRACE_PROPAGATION } from "./supervisor-CMlIOkJP.js";
7
8
  import { t as composeRuntimeHooks } from "./runtime-hooks-C7iJOWm3.js";
8
- import { t as createStdioToolServer } from "./tool-server-VvSK1K3X.js";
9
+ import { t as createStdioToolServer } from "./tool-server-Dh-NcbHr.js";
9
10
  import { n as UI_LENSES } from "./substrate-B0TYNrXn.js";
10
11
  import { argHash, errorStreakDetector, observeAll, repeatedActionDetector } from "@tangle-network/agent-eval";
11
12
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
@@ -1003,11 +1004,17 @@ function createCoordinationTools(opts) {
1003
1004
  const deliverable = opts.deliverable;
1004
1005
  let stopped = false;
1005
1006
  let reason;
1007
+ let stopNotified = false;
1006
1008
  let submitted;
1007
1009
  let questionSeq = 0;
1008
1010
  const ledger = [];
1009
1011
  const questions = [...opts.priorQuestions ?? []];
1010
1012
  const questionPolicy = opts.questionPolicy ?? "auto";
1013
+ const notifyStop = () => {
1014
+ if (stopNotified) return;
1015
+ stopNotified = true;
1016
+ opts.onStop?.(reason);
1017
+ };
1011
1018
  const completedKeys = /* @__PURE__ */ new Set();
1012
1019
  const keyByWorker = /* @__PURE__ */ new Map();
1013
1020
  const profileNameByWorker = /* @__PURE__ */ new Map();
@@ -2144,6 +2151,7 @@ function createCoordinationTools(opts) {
2144
2151
  submitted = Object.freeze({ result });
2145
2152
  stopped = true;
2146
2153
  reason = "result-accepted";
2154
+ notifyStop();
2147
2155
  return {
2148
2156
  accepted: true,
2149
2157
  retained: "this-result",
@@ -2171,6 +2179,7 @@ function createCoordinationTools(opts) {
2171
2179
  stopped = true;
2172
2180
  const r = obj(raw).reason;
2173
2181
  reason = typeof r === "string" ? r : void 0;
2182
+ notifyStop();
2174
2183
  return Promise.resolve({ stopped: true });
2175
2184
  }
2176
2185
  }
@@ -3032,7 +3041,7 @@ function resumeBrief(resume, prior) {
3032
3041
  if (resume.waits.length > 0) lines.push("", "Pending waits RE-ARMED on their original deadlines (they settle through await_event):", ...resume.waits.map((w) => `- ${w.label} (${w.spec.kind})`));
3033
3042
  appendPriorCoordination(lines, prior);
3034
3043
  const spent = resume.priorSpend;
3035
- lines.push("", "Budget the run ALREADY spent before this process (it counts toward the run total):", `- child work: tokens in=${spent.childWork.tokens.input} out=${spent.childWork.tokens.output}, usd=${spent.childWork.usd}, iterations=${spent.childWork.iterations}`, `- driver inference: tokens in=${spent.driverInference.tokens.input} out=${spent.driverInference.tokens.output}, usd=${spent.driverInference.usd}`);
3044
+ lines.push("", "Budget the run ALREADY spent before this process (it counts toward the run total):", `- child work: tokens charged=${chargedTokens(spent.childWork.tokens)} (in=${spent.childWork.tokens.input} out=${spent.childWork.tokens.output}), usd=${spent.childWork.usd}, iterations=${spent.childWork.iterations}`, `- driver inference: tokens charged=${chargedTokens(spent.driverInference.tokens)} (in=${spent.driverInference.tokens.input} out=${spent.driverInference.tokens.output}), usd=${spent.driverInference.usd}`);
3036
3045
  return lines.join("\n");
3037
3046
  }
3038
3047
  function hasPriorCoordination(prior) {
@@ -4850,6 +4859,7 @@ async function serveCoordinationMcp(opts) {
4850
4859
  ...opts.authorizeDownMessage ? { authorizeDownMessage: opts.authorizeDownMessage } : {},
4851
4860
  perWorker: opts.perWorker,
4852
4861
  ...opts.deliverable ? { deliverable: opts.deliverable } : {},
4862
+ ...opts.onStop ? { onStop: opts.onStop } : {},
4853
4863
  ...opts.maxLiveWorkers !== void 0 ? { maxLiveWorkers: opts.maxLiveWorkers } : {},
4854
4864
  awaitTimeoutMs: opts.awaitTimeoutMs ?? 15e3,
4855
4865
  ...opts.analysts ? { analysts: opts.analysts } : {},
@@ -5463,6 +5473,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
5463
5473
  const priorCoordination = deps.loadPriorCoordination ? await deps.loadPriorCoordination() : deps.priorCoordination;
5464
5474
  const nodeTools = resolveTools && context ? await bindSupervisorTools(resolveTools, context, scope.signal) : void 0;
5465
5475
  const onEvent = bindSupervisorNodeObserver(context, observeNodeEvent, deps.onEvent);
5476
+ const stopController = new AbortController();
5466
5477
  const mcp = await serveCoordinationMcp({
5467
5478
  scope,
5468
5479
  blobs: deps.blobs,
@@ -5473,6 +5484,9 @@ function buildSupervisorAgent(profile, deps, testBrain) {
5473
5484
  ...coordination?.port !== void 0 ? { port: coordination.port } : {},
5474
5485
  ...coordination?.allowUnauthenticatedRemote === true ? { allowUnauthenticatedRemote: true } : {},
5475
5486
  ...deps.deliverable ? { deliverable: deps.deliverable } : {},
5487
+ onStop: (reason) => {
5488
+ if (!stopController.signal.aborted) stopController.abort(reason ?? "coordination stop");
5489
+ },
5476
5490
  ...deps.maxLiveWorkers !== void 0 ? { maxLiveWorkers: deps.maxLiveWorkers } : {},
5477
5491
  ...deps.analysts ? { analysts: deps.analysts } : {},
5478
5492
  ...deps.analyzeOnSettle ? { analyzeOnSettle: deps.analyzeOnSettle } : {},
@@ -5495,6 +5509,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
5495
5509
  task,
5496
5510
  scope,
5497
5511
  coordinationMcpUrl: mcp.url,
5512
+ stopSignal: stopController.signal,
5498
5513
  coordinationTools: (nodeTools ?? []).map(({ name, description, inputSchema }) => ({
5499
5514
  name,
5500
5515
  description,
@@ -5502,7 +5517,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
5502
5517
  }))
5503
5518
  });
5504
5519
  } catch (error) {
5505
- if (!mcp.submittedResult()) throw error;
5520
+ if (!mcp.submittedResult() && !mcp.isStopped()) throw error;
5506
5521
  }
5507
5522
  },
5508
5523
  progress: () => ({
@@ -5758,7 +5773,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now) {
5758
5773
  const boundBackend = bindReusableExecutorExecutionId(captureReusableExecutorConfig(backend, "driveHarnessFromBackend"), executionId);
5759
5774
  const baseFactory = createExecutor(boundBackend);
5760
5775
  let activeExecutor;
5761
- const drive = async ({ profile, task, scope, coordinationMcpUrl, coordinationTools }) => {
5776
+ const drive = async ({ profile, task, scope, coordinationMcpUrl, stopSignal, coordinationTools }) => {
5762
5777
  const initialBudget = scope.budget;
5763
5778
  if (!(scope.view.inFlight > 0 || scope.view.waiting > 0) && (initialBudget.tokensLeft <= 0 || initialBudget.iterationsLeft <= 0 || initialBudget.usdCapped && initialBudget.usdLeft <= 0 || initialBudget.deadlineMs > 0 && now() >= initialBudget.deadlineMs)) throw new ValidationError("driveHarnessFromBackend: supervisor budget exhausted");
5764
5779
  const canonicalDriverProfile = agentProfileSchema.parse(profile);
@@ -5781,7 +5796,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now) {
5781
5796
  const executor = baseFactory(spec, {
5782
5797
  signal: scope.signal,
5783
5798
  node: scopeOwnerExecutorNodeContext(scope),
5784
- seams: {}
5799
+ seams: stopSignal === void 0 ? {} : { [bridgeStopSignalKey]: stopSignal }
5785
5800
  });
5786
5801
  activeExecutor = executor;
5787
5802
  let completed = false;
@@ -5794,11 +5809,13 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now) {
5794
5809
  if (attempt === void 0) return providerAttemptEvidence(void 0);
5795
5810
  const observations = Object.freeze([...attempt.observations]);
5796
5811
  const models = Object.freeze([...new Set(observations)]);
5797
- return Object.freeze(attempt.identityConflict === true || observations.length === 0 ? {
5812
+ const providerDispatch = attempt.providerDispatch;
5813
+ return Object.freeze(attempt.identityConflict === true || providerDispatch === "not_started" || providerDispatch !== "not_started" && observations.length === 0 ? {
5798
5814
  status: "unknown",
5799
5815
  attempts: Object.freeze([Object.freeze({
5800
5816
  observations,
5801
- ...attempt.identityConflict === true ? { identityConflict: true } : {}
5817
+ ...attempt.identityConflict === true ? { identityConflict: true } : {},
5818
+ ...providerDispatch === "not_started" ? { providerDispatch } : {}
5802
5819
  })]),
5803
5820
  models,
5804
5821
  reason: attempt.identityConflict === true ? "provider-model-conflict" : "provider-model-missing"
@@ -5831,12 +5848,38 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now) {
5831
5848
  const budget = scope.budget;
5832
5849
  if (budget.tokensLeft <= 0 || budget.usdCapped && budget.usdLeft <= 0 || budget.deadlineMs > 0 && now() >= budget.deadlineMs) throw new ValidationError("driveHarnessFromBackend: supervisor budget exhausted");
5833
5850
  };
5851
+ const pending = runtimeOwnedPendingExecutorMaterialization(executor);
5834
5852
  let failed = false;
5835
5853
  let failure;
5854
+ let ownerMaterializationPublished = false;
5855
+ const ownerDeclaration = (exactDeclaration) => ({
5856
+ ...exactDeclaration,
5857
+ effectiveProfile: canonicalDriverProfile,
5858
+ platformAttachments: { [coordinationMcpAlias]: {
5859
+ kind: "coordination-mcp",
5860
+ transport: "http",
5861
+ tools: stableCoordinationTools
5862
+ } }
5863
+ });
5864
+ const publishMaterialization = async (exactDeclaration, exactBinding) => {
5865
+ await recordScopeOwnerMaterialization(scope, executor.runtime, ownerDeclaration(exactDeclaration), {
5866
+ ...exactBinding,
5867
+ binding: {
5868
+ stableBinding: exactBinding.binding,
5869
+ platformAttachments: { [coordinationMcpAlias]: {
5870
+ transport: "http",
5871
+ url: coordinationMcpUrl
5872
+ } }
5873
+ },
5874
+ descriptor: {
5875
+ ...exactBinding.descriptor,
5876
+ coordination: true
5877
+ }
5878
+ });
5879
+ };
5836
5880
  try {
5837
5881
  const declaration = runtimeOwnedExecutorMaterialization(executor);
5838
5882
  const executionBinding = runtimeOwnedExecutorExecutionBinding(executor);
5839
- const pending = runtimeOwnedPendingExecutorMaterialization(executor);
5840
5883
  const authoredProfileFromDriverExecution = (profile) => {
5841
5884
  const { [coordinationMcpAlias]: _runtimeAttachment, ...authoredMcp } = profile.mcp ?? {};
5842
5885
  const { mcp: _mcp, ...withoutMcp } = profile;
@@ -5845,31 +5888,6 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now) {
5845
5888
  mcp: authoredMcp
5846
5889
  } : withoutMcp);
5847
5890
  };
5848
- const ownerDeclaration = (exactDeclaration) => ({
5849
- ...exactDeclaration,
5850
- effectiveProfile: canonicalDriverProfile,
5851
- platformAttachments: { [coordinationMcpAlias]: {
5852
- kind: "coordination-mcp",
5853
- transport: "http",
5854
- tools: stableCoordinationTools
5855
- } }
5856
- });
5857
- const publishMaterialization = async (exactDeclaration, exactBinding) => {
5858
- await recordScopeOwnerMaterialization(scope, executor.runtime, ownerDeclaration(exactDeclaration), {
5859
- ...exactBinding,
5860
- binding: {
5861
- stableBinding: exactBinding.binding,
5862
- platformAttachments: { [coordinationMcpAlias]: {
5863
- transport: "http",
5864
- url: coordinationMcpUrl
5865
- } }
5866
- },
5867
- descriptor: {
5868
- ...exactBinding.descriptor,
5869
- coordination: true
5870
- }
5871
- });
5872
- };
5873
5891
  if (pending === void 0 && (declaration === void 0 || executionBinding === void 0)) throw new ValidationError(`driveHarnessFromBackend: built-in runtime ${JSON.stringify(executor.runtime)} has no trusted materialization declaration or execution binding`);
5874
5892
  if (pending !== void 0) {
5875
5893
  if (pending.runtime !== executor.runtime || pending.binding.attemptId !== scopeOwnerExecutorNodeContext(scope).attemptId) throw new ValidationError("driveHarnessFromBackend: pending executor did not bind the kernel-minted attempt");
@@ -5915,12 +5933,26 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now) {
5915
5933
  const acknowledgedBinding = runtimeOwnedExecutorExecutionBinding(executor);
5916
5934
  if (acknowledged === void 0 || acknowledgedBinding === void 0) throw new ValidationError("driveHarnessFromBackend: external executor completed without a terminal materialization acknowledgement");
5917
5935
  await publishMaterialization(acknowledged, acknowledgedBinding);
5936
+ ownerMaterializationPublished = true;
5918
5937
  }
5919
5938
  completed = true;
5920
5939
  } catch (error) {
5921
5940
  failed = true;
5922
5941
  failure = error;
5923
5942
  } finally {
5943
+ if (pending !== void 0 && !ownerMaterializationPublished) {
5944
+ const acknowledged = runtimeOwnedExecutorMaterialization(executor);
5945
+ const acknowledgedBinding = runtimeOwnedExecutorExecutionBinding(executor);
5946
+ if (acknowledged !== void 0 && acknowledgedBinding !== void 0) try {
5947
+ await publishMaterialization(acknowledged, acknowledgedBinding);
5948
+ ownerMaterializationPublished = true;
5949
+ } catch (error) {
5950
+ if (!failed) {
5951
+ failed = true;
5952
+ failure = error;
5953
+ }
5954
+ }
5955
+ }
5924
5956
  recordRuntimeOwnedDriveHarnessProviderEvidence(drive, runtimeOwnedExecutorProviderEvidence(executor));
5925
5957
  try {
5926
5958
  await meterPending(failed && started && !terminalAccountingCaptured);
@@ -6525,4 +6557,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
6525
6557
  //#endregion
6526
6558
  export { DELEGATION_TRACE_MAX_BYTES as $, DELEGATION_HISTORY_INPUT_SCHEMA as A, defaultToolDetectors as At, DELEGATE_FEEDBACK_INPUT_SCHEMA as B, createMcpServer as C, plateauLength as Ct, createDelegationStatusHandler as D, createCoordinationTools as Dt, DELEGATION_STATUS_TOOL_NAME as E, canonicalFindingEvent as Et, DELEGATE_UI_AUDIT_INPUT_SCHEMA as F, createSupervisorSpanRecorder as Ft, DELEGATE_INPUT_SCHEMA as G, createDelegateFeedbackHandler as H, DELEGATE_UI_AUDIT_TOOL_NAME as I, gateOnDeliverable as It, validateDelegateArgs as J, DELEGATE_TOOL_NAME as K, createDelegateUiAuditHandler as L, mapExecutorResult as Lt, createDelegationHistoryHandler as M, createFileRunContext as Mt, validateDelegationHistoryArgs as N, createInMemoryRunContext as Nt, validateDelegationStatusArgs as O, normalizeAnalyzeOnSettle as Ot, DELEGATE_UI_AUDIT_DESCRIPTION as P, FileCoordinationLog as Pt, hashIdempotencyInput as Q, validateDelegateUiAuditArgs as R, createInProcessTransport as S, bestSoFar as St, DELEGATION_STATUS_INPUT_SCHEMA as T, DEFAULT_AWAIT_EVENT_TIMEOUT_MS as Tt, validateDelegateFeedbackArgs as U, DELEGATE_FEEDBACK_TOOL_NAME as V, DELEGATE_DESCRIPTION as W, delegate as X, defaultDelegateBudget as Y, DelegationTaskQueue as Z, promptHandle as _, noProgressFor as _t, assertCoordinationBinding as a, DelegationPersistenceError as at, classifyDriverFailure as b, anytimeReport as bt, supervisorAgentWithTestBrain as c, InMemoryDelegationStore as ct, delegatesWorkerBriefPrompt as d, driverAgent as dt, DELEGATION_TRACE_MAX_SPANS as et, dumbContinuationFailPrompt as f, finalizeBestDelivered as ft, naiveContinuationPrompt as g, createProgressTracker as gt, kernelPromptRegistry as h, anyOf as ht, workerFromBackend as i, createDelegationTraceCollector as it, DELEGATION_HISTORY_TOOL_NAME as j, watchTrace as jt, DELEGATION_HISTORY_DESCRIPTION as k, createEventBus as kt, analyzesFindingsReportPrompt as l, InMemoryFeedbackStore as lt, formatPromptHandle as m, allWorkersStalled as mt, supervise as n, capDelegationTrace as nt, resolveSupervisorProfile as o, DelegationStateCorruptError as ot, dumbContinuationPassPrompt as p, allOf as pt, createDelegateHandler as q, superviseWithTestBrain as r, composeLoopTraceEmitters as rt, supervisorAgent as s, FileDelegationStore as st, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, buildDelegationTraceSpans as tt, createPromptRegistry as u, eventToSnapshot as ut, supervisorPolicyPrompt as v, plateau as vt, DELEGATION_STATUS_DESCRIPTION as w, renderAnytimeTable as wt, serveCoordinationMcp as x, areaUnderCurve as xt, DriverAttemptsExhaustedError as y, sampleFromSettled as yt, DELEGATE_FEEDBACK_DESCRIPTION as z };
6527
6559
 
6528
- //# sourceMappingURL=supervise-009CRDW1.js.map
6560
+ //# sourceMappingURL=supervise-DhghNvl6.js.map