@tangle-network/agent-runtime 0.348.1 → 0.350.2

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 (130) hide show
  1. package/dist/{activation-BEGalhOL.js → activation-CfJMyzEs.js} +12 -14
  2. package/dist/{activation-BEGalhOL.js.map → activation-CfJMyzEs.js.map} +1 -1
  3. package/dist/{activation-NQZP_mdI.d.ts → activation-DyiHrTlS.d.ts} +2 -24
  4. package/dist/agent.d.ts +8 -12
  5. package/dist/agent.js +9 -12
  6. package/dist/agent.js.map +1 -1
  7. package/dist/{analyst-loop-DZw5QWT9.js → analyst-loop-BZvXCDKy.js} +2 -3
  8. package/dist/{analyst-loop-DZw5QWT9.js.map → analyst-loop-BZvXCDKy.js.map} +1 -1
  9. package/dist/analyst-loop.d.ts +3 -5
  10. package/dist/analyst-loop.js +1 -2
  11. package/dist/{bundle-DKQtOO9d.js → bundle-Ze8pd07a.js} +3 -4
  12. package/dist/{bundle-DKQtOO9d.js.map → bundle-Ze8pd07a.js.map} +1 -1
  13. package/dist/candidate-execution/index.d.ts +13 -33
  14. package/dist/candidate-execution/index.js +16 -18
  15. package/dist/candidate-execution/index.js.map +1 -1
  16. package/dist/{coordination-manager-Bm6leXc6.js → coordination-manager-BkVfWlMz.js} +101 -132
  17. package/dist/coordination-manager-BkVfWlMz.js.map +1 -0
  18. package/dist/{delegate-Cp5-PsaX.js → delegate-DgEie4ad.js} +19 -21
  19. package/dist/delegate-DgEie4ad.js.map +1 -0
  20. package/dist/durable.d.ts +13 -23
  21. package/dist/durable.js +48 -43
  22. package/dist/durable.js.map +1 -1
  23. package/dist/{errors-DodWX-cb.js → errors-wuhGvpE3.js} +2 -3
  24. package/dist/{errors-DodWX-cb.js.map → errors-wuhGvpE3.js.map} +1 -1
  25. package/dist/{graph-CE_pzU31.js → graph-Cx0FhKSE.js} +192 -15
  26. package/dist/graph-Cx0FhKSE.js.map +1 -0
  27. package/dist/{improve-wT11zteg.js → improve-i0HU1-aa.js} +35 -53
  28. package/dist/{improve-wT11zteg.js.map → improve-i0HU1-aa.js.map} +1 -1
  29. package/dist/{improvement-adapter-sIthWkcN.d.ts → improvement-adapter-D5GRU1eY.d.ts} +2 -6
  30. package/dist/index.d.ts +41 -89
  31. package/dist/index.js +43 -61
  32. package/dist/index.js.map +1 -1
  33. package/dist/intelligence.d.ts +39 -59
  34. package/dist/intelligence.js +23 -33
  35. package/dist/intelligence.js.map +1 -1
  36. package/dist/kernel.d.ts +5 -5
  37. package/dist/kernel.js +11 -11
  38. package/dist/{loop-runner-CZzeeJTG.js → loop-runner-BwN9MhdP.js} +5 -6
  39. package/dist/{loop-runner-CZzeeJTG.js.map → loop-runner-BwN9MhdP.js.map} +1 -1
  40. package/dist/{loop-runner-CY5HHhtR.d.ts → loop-runner-DvfOXVx9.d.ts} +3 -5
  41. package/dist/loop-runner-bin.d.ts +5 -8
  42. package/dist/loop-runner-bin.js +2 -3
  43. package/dist/mcp/bin.js +6 -8
  44. package/dist/mcp/bin.js.map +1 -1
  45. package/dist/mcp/index.d.ts +8 -18
  46. package/dist/mcp/index.js +17 -25
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/mcp/memory-bin.js +4 -6
  49. package/dist/mcp/memory-bin.js.map +1 -1
  50. package/dist/{model-policy-CyCUwHed.js → model-policy-GSxWwP-b.js} +11 -13
  51. package/dist/model-policy-GSxWwP-b.js.map +1 -0
  52. package/dist/placement.d.ts +12 -14
  53. package/dist/placement.js +1 -2
  54. package/dist/platform.d.ts +7 -13
  55. package/dist/platform.js +3 -6
  56. package/dist/platform.js.map +1 -1
  57. package/dist/{prepare-TEEHSJwq.js → prepare-DE8TQnLu.js} +49 -69
  58. package/dist/{prepare-TEEHSJwq.js.map → prepare-DE8TQnLu.js.map} +1 -1
  59. package/dist/{profile-6OLpbjvV.js → profile-CAhZDW2T.js} +58 -92
  60. package/dist/profile-CAhZDW2T.js.map +1 -0
  61. package/dist/{profile-materialization-bPm0gGLO.d.ts → profile-materialization-BRY22Oh8.d.ts} +1 -3
  62. package/dist/profiles.d.ts +25 -12
  63. package/dist/profiles.js +52 -11
  64. package/dist/profiles.js.map +1 -1
  65. package/dist/{protected-model-port-DVVh-hEk.d.ts → protected-model-port-IKqhTypD.d.ts} +2 -14
  66. package/dist/{protected-redaction-DFCeo4vg.js → protected-redaction-DilFZch5.js} +2 -3
  67. package/dist/{protected-redaction-DFCeo4vg.js.map → protected-redaction-DilFZch5.js.map} +1 -1
  68. package/dist/{provision-supervisor-CC0HdOHo.js → provision-supervisor-Bde_FF0R.js} +11 -15
  69. package/dist/{provision-supervisor-CC0HdOHo.js.map → provision-supervisor-Bde_FF0R.js.map} +1 -1
  70. package/dist/{record-events-D93DkpAx.js → record-events-B2GUgYdz.js} +12 -14
  71. package/dist/{record-events-D93DkpAx.js.map → record-events-B2GUgYdz.js.map} +1 -1
  72. package/dist/{run-cancellation-CzFhQGMa.js → run-cancellation-BLy_Zz-w.js} +6 -7
  73. package/dist/{run-cancellation-CzFhQGMa.js.map → run-cancellation-BLy_Zz-w.js.map} +1 -1
  74. package/dist/{runtime-B_40dXlF.js → runtime-6Ec9sHRe.js} +833 -215
  75. package/dist/runtime-6Ec9sHRe.js.map +1 -0
  76. package/dist/{runtime-hooks-tXpAarhW.js → runtime-hooks-CsW2pfFk.js} +2 -3
  77. package/dist/{runtime-hooks-tXpAarhW.js.map → runtime-hooks-CsW2pfFk.js.map} +1 -1
  78. package/dist/{runtime-hooks-nsqxSUFL.d.ts → runtime-hooks-ZQqPw-0g.d.ts} +1 -3
  79. package/dist/{sandbox-profile-compat-_fEtHPCj.js → sandbox-profile-compat-BxMQ1VXv.js} +62 -44
  80. package/dist/sandbox-profile-compat-BxMQ1VXv.js.map +1 -0
  81. package/dist/{search-executor-COd2F2wp.js → search-executor-B7g_5Wjl.js} +12 -17
  82. package/dist/search-executor-B7g_5Wjl.js.map +1 -0
  83. package/dist/{server-BGB4R4wQ.js → server-fvEMwGMQ.js} +19 -30
  84. package/dist/{server-BGB4R4wQ.js.map → server-fvEMwGMQ.js.map} +1 -1
  85. package/dist/{structural-rollout-Wl_rCuzM.js → structural-rollout-B86bSixU.js} +69 -70
  86. package/dist/structural-rollout-B86bSixU.js.map +1 -0
  87. package/dist/{substrate-CGDFTSRh.js → substrate-Db2pp6y3.js} +2 -3
  88. package/dist/{substrate-CGDFTSRh.js.map → substrate-Db2pp6y3.js.map} +1 -1
  89. package/dist/{supervise-BUOeThuB.js → supervise-CaeZcgAW.js} +615 -203
  90. package/dist/supervise-CaeZcgAW.js.map +1 -0
  91. package/dist/{supervisor-DDy0aEtR.js → supervisor-C1OePYE-.js} +526 -642
  92. package/dist/supervisor-C1OePYE-.js.map +1 -0
  93. package/dist/{task-queue-0fKkoweu.d.ts → task-queue-kefGy79U.d.ts} +1 -3
  94. package/dist/task-queue.d.ts +1 -1
  95. package/dist/task-queue.js +1 -2
  96. package/dist/testing.d.ts +8 -16
  97. package/dist/testing.js +241 -244
  98. package/dist/testing.js.map +1 -1
  99. package/dist/tool-loop.d.ts +16 -19
  100. package/dist/tool-loop.js +2 -3
  101. package/dist/{tool-server-XV4aJwoQ.js → tool-server-CwuYeW_Z.js} +3 -4
  102. package/dist/{tool-server-XV4aJwoQ.js.map → tool-server-CwuYeW_Z.js.map} +1 -1
  103. package/dist/{top-snapshot-CflmaDgk.js → top-snapshot-ChwpTr7A.js} +4 -5
  104. package/dist/{top-snapshot-CflmaDgk.js.map → top-snapshot-ChwpTr7A.js.map} +1 -1
  105. package/dist/tui/bin.js +7 -9
  106. package/dist/tui/bin.js.map +1 -1
  107. package/dist/tui/index.d.ts +3 -5
  108. package/dist/tui/index.js +2 -2
  109. package/dist/{types-hc4cmSc7.d.ts → types-Fowuwdz2.d.ts} +555 -503
  110. package/dist/{types-Cwrea-bU.d.ts → types-qsqfyQoY.d.ts} +1 -3
  111. package/dist/workspace-store/index.d.ts +12 -22
  112. package/dist/workspace-store/index.js +4 -7
  113. package/dist/workspace-store/index.js.map +1 -1
  114. package/dist/{workspace-streams-BiS4ABah.d.ts → workspace-streams-Dq2Fzk3c.d.ts} +1 -11
  115. package/package.json +25 -25
  116. package/skills/agent-graphs/SKILL.md +19 -4
  117. package/skills/be-ambitious/SKILL.md +46 -0
  118. package/skills/graph-designer/SKILL.md +15 -2
  119. package/skills/profile-authoring/SKILL.md +1 -1
  120. package/dist/coordination-manager-Bm6leXc6.js.map +0 -1
  121. package/dist/delegate-Cp5-PsaX.js.map +0 -1
  122. package/dist/graph-CE_pzU31.js.map +0 -1
  123. package/dist/model-policy-CyCUwHed.js.map +0 -1
  124. package/dist/profile-6OLpbjvV.js.map +0 -1
  125. package/dist/runtime-B_40dXlF.js.map +0 -1
  126. package/dist/sandbox-profile-compat-_fEtHPCj.js.map +0 -1
  127. package/dist/search-executor-COd2F2wp.js.map +0 -1
  128. package/dist/structural-rollout-Wl_rCuzM.js.map +0 -1
  129. package/dist/supervise-BUOeThuB.js.map +0 -1
  130. package/dist/supervisor-DDy0aEtR.js.map +0 -1
@@ -1,13 +1,13 @@
1
- import { c as captureRunWriteContext, t as spawnJournalRecordEvents } from "./record-events-D93DkpAx.js";
2
- import { $ as resolveSpawnResourcePaths, Ct as readCommittedJsonLines, Dt as createExecutorRegistry, Ei as settlementFailureCause, Fn as INBOX_RECEIPT_KEY, G as meterRuntimeOwnedAccounting, Hn as createPeerMailbox, Li as detachedFrozen, R as runtimeGraphMetadataKey, S as workerTraceAnalysisStore, Vi as errMessage, Xi as resolveRedactor, Xn as isLiveNodeStatus, Zn as isTerminalNodeStatus, _ as withDriverExecutor, _t as InMemorySpawnJournal, dr as CheckUnavailableError, gt as InMemoryResultBlobStore, k as FileSpawnJournal, qi as assertValidBudget, vt as FileResultBlobStore, x as parseWorkerToolTraceArtifact, xr as failedItems, yr as checkVerdictOf, yt as appendCommittedJsonLine, zi as contentAddress } from "./supervisor-DDy0aEtR.js";
3
- import { C as writeWorkerCancellation, T as writeWorkerSteerAcknowledgement, c as writeRunCancellation, g as readWorkerSteerRequests, h as readWorkerSteerAcknowledgement, i as readRunCancellation, m as readWorkerCancellation, p as readWorkerCancelRequests, r as readRunCancelRequest, t as applyRunCancellation, u as claimWorkerSteerDelivery } from "./run-cancellation-CzFhQGMa.js";
1
+ import { c as captureRunWriteContext, t as spawnJournalRecordEvents } from "./record-events-B2GUgYdz.js";
2
+ import { $ as resolveSpawnResourcePaths, Ct as readCommittedJsonLines, Dt as createExecutorRegistry, Fn as INBOX_RECEIPT_KEY, G as meterRuntimeOwnedAccounting, Hn as createPeerMailbox, Oi as settlementFailureCause, Qi as resolveRedactor, R as runtimeGraphMetadataKey, S as workerTraceAnalysisStore, Ui as errMessage, Vi as contentAddress, Xn as isLiveNodeStatus, Yi as assertValidBudget, Zn as isTerminalNodeStatus, _ as withDriverExecutor, _t as InMemorySpawnJournal, dr as CheckUnavailableError, gt as InMemoryResultBlobStore, k as FileSpawnJournal, vt as FileResultBlobStore, x as parseWorkerToolTraceArtifact, xr as failedItems, yr as checkVerdictOf, yt as appendCommittedJsonLine, zi as detachedFrozen } from "./supervisor-C1OePYE-.js";
3
+ import { C as writeWorkerCancellation, T as writeWorkerSteerAcknowledgement, c as writeRunCancellation, g as readWorkerSteerRequests, h as readWorkerSteerAcknowledgement, i as readRunCancellation, m as readWorkerCancellation, p as readWorkerCancelRequests, r as readRunCancelRequest, t as applyRunCancellation, u as claimWorkerSteerDelivery } from "./run-cancellation-BLy_Zz-w.js";
4
4
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest } from "@tangle-network/agent-interface";
5
5
  import { argHash, errorStreakDetector, observeAll, repeatedActionDetector } from "@tangle-network/agent-eval";
6
6
  import { registry } from "zod";
7
7
  import { randomUUID } from "node:crypto";
8
8
  import { readFileSync } from "node:fs";
9
9
  import { join } from "node:path";
10
- //#region src/runtime/supervise/coordination-log.ts
10
+ // src/runtime/supervise/coordination-log.ts
11
11
  /**
12
12
  * Durable side-log for coordination evidence the spawn journal does not own: questions, analyst
13
13
  * findings, answer decisions, authorized continuation receipts, delivery-attempt markers, and
@@ -117,8 +117,7 @@ async function foldCoordinationRecords(source, runId, ownerId) {
117
117
  records
118
118
  };
119
119
  }
120
- //#endregion
121
- //#region src/runtime/supervise/run-context.ts
120
+ // src/runtime/supervise/run-context.ts
122
121
  /**
123
122
  *
124
123
  * `createInMemoryRunContext` — the one-call bundle of the in-memory stores a
@@ -193,8 +192,7 @@ function createFileRunContext(dir, opts = {}) {
193
192
  coordinationLog: new FileCoordinationLog(`${dir}/coordination-log.jsonl`)
194
193
  };
195
194
  }
196
- //#endregion
197
- //#region src/mcp/tools/coordination-json.ts
195
+ // src/mcp/tools/coordination-json.ts
198
196
  /** Stringify a findings payload for a routed delivery; never throws (a cyclic payload degrades to
199
197
  * its String form rather than killing the settle path). */
200
198
  function safeJsonText(value) {
@@ -205,8 +203,7 @@ function safeJsonText(value) {
205
203
  return String(value);
206
204
  }
207
205
  }
208
- //#endregion
209
- //#region src/mcp/tools/coordination-events.ts
206
+ // src/mcp/tools/coordination-events.ts
210
207
  /** Default and maximum bounds for one {@link CoordinationTools} journal read. The defaults are
211
208
  * sized for a driver turn (a page a model can read and still have room to act on); the maxima
212
209
  * bound what a single tool result may cost even when the caller asks for everything. */
@@ -281,8 +278,7 @@ const wakeEventKinds = [
281
278
  "lead-message",
282
279
  "map"
283
280
  ];
284
- //#endregion
285
- //#region src/mcp/tools/coordination-analysts.ts
281
+ // src/mcp/tools/coordination-analysts.ts
286
282
  /**
287
283
  * The trace-tool sets a DEFINED analyst may ask for — the exact group names agent-eval's
288
284
  * `buildTraceToolsForGroup` accepts, restated here so the `define_analyst` JSON Schema can
@@ -402,15 +398,17 @@ function parseAuthoredAnalystDefinition(raw) {
402
398
  message: `must be one of ${analystToolGroupNames.join(", ")}`
403
399
  });
404
400
  let model;
405
- if (o.model !== void 0) if (typeof o.model !== "string" || o.model.trim().length === 0) issues.push({
406
- path: "model",
407
- message: "must be a non-empty string when present"
408
- });
409
- else if (o.model.length > bounds.maxModelChars) issues.push({
410
- path: "model",
411
- message: `must be at most ${bounds.maxModelChars} characters`
412
- });
413
- else model = o.model.trim();
401
+ if (o.model !== void 0) {
402
+ if (typeof o.model !== "string" || o.model.trim().length === 0) issues.push({
403
+ path: "model",
404
+ message: "must be a non-empty string when present"
405
+ });
406
+ else if (o.model.length > bounds.maxModelChars) issues.push({
407
+ path: "model",
408
+ message: `must be at most ${bounds.maxModelChars} characters`
409
+ });
410
+ else model = o.model.trim();
411
+ }
414
412
  const clampedLimit = (field, max, source) => {
415
413
  const value = source[field];
416
414
  if (value === void 0) return void 0;
@@ -424,33 +422,35 @@ function parseAuthoredAnalystDefinition(raw) {
424
422
  return Math.min(value, max);
425
423
  };
426
424
  let limits;
427
- if (o.limits !== void 0) if (!o.limits || typeof o.limits !== "object" || Array.isArray(o.limits)) issues.push({
428
- path: "limits",
429
- message: "must be an object"
430
- });
431
- else {
432
- const source = o.limits;
433
- const knownLimits = /* @__PURE__ */ new Set([
434
- "maxIterations",
435
- "maxLlmCalls",
436
- "maxToolCalls",
437
- "maxOutputChars"
438
- ]);
439
- for (const key of Object.keys(source)) if (!knownLimits.has(key)) issues.push({
440
- path: `limits.${key}`,
441
- message: `is not an investigation limit (accepted: ${[...knownLimits].join(", ")})`
425
+ if (o.limits !== void 0) {
426
+ if (!o.limits || typeof o.limits !== "object" || Array.isArray(o.limits)) issues.push({
427
+ path: "limits",
428
+ message: "must be an object"
442
429
  });
443
- const maxIterations = clampedLimit("maxIterations", bounds.maxIterations, source);
444
- const maxLlmCalls = clampedLimit("maxLlmCalls", bounds.maxLlmCalls, source);
445
- const maxToolCalls = clampedLimit("maxToolCalls", bounds.maxToolCalls, source);
446
- const maxOutputChars = clampedLimit("maxOutputChars", bounds.maxOutputChars, source);
447
- const present = {
448
- ...maxIterations === void 0 ? {} : { maxIterations },
449
- ...maxLlmCalls === void 0 ? {} : { maxLlmCalls },
450
- ...maxToolCalls === void 0 ? {} : { maxToolCalls },
451
- ...maxOutputChars === void 0 ? {} : { maxOutputChars }
452
- };
453
- if (Object.keys(present).length > 0) limits = present;
430
+ else {
431
+ const source = o.limits;
432
+ const knownLimits = /* @__PURE__ */ new Set([
433
+ "maxIterations",
434
+ "maxLlmCalls",
435
+ "maxToolCalls",
436
+ "maxOutputChars"
437
+ ]);
438
+ for (const key of Object.keys(source)) if (!knownLimits.has(key)) issues.push({
439
+ path: `limits.${key}`,
440
+ message: `is not an investigation limit (accepted: ${[...knownLimits].join(", ")})`
441
+ });
442
+ const maxIterations = clampedLimit("maxIterations", bounds.maxIterations, source);
443
+ const maxLlmCalls = clampedLimit("maxLlmCalls", bounds.maxLlmCalls, source);
444
+ const maxToolCalls = clampedLimit("maxToolCalls", bounds.maxToolCalls, source);
445
+ const maxOutputChars = clampedLimit("maxOutputChars", bounds.maxOutputChars, source);
446
+ const present = {
447
+ ...maxIterations === void 0 ? {} : { maxIterations },
448
+ ...maxLlmCalls === void 0 ? {} : { maxLlmCalls },
449
+ ...maxToolCalls === void 0 ? {} : { maxToolCalls },
450
+ ...maxOutputChars === void 0 ? {} : { maxOutputChars }
451
+ };
452
+ if (Object.keys(present).length > 0) limits = present;
453
+ }
454
454
  }
455
455
  let minimumEvidenceCitations;
456
456
  if (o.minimumEvidenceCitations !== void 0) {
@@ -497,8 +497,7 @@ function normalizeAnalyzeOnSettle(entry) {
497
497
  if (route.statuses !== void 0 && (!Array.isArray(route.statuses) || route.statuses.length === 0 || route.statuses.some((status) => status !== "done" && status !== "down"))) throw new TypeError("analyzeOnSettle.statuses must contain done or down");
498
498
  return route;
499
499
  }
500
- //#endregion
501
- //#region src/mcp/tools/coordination-budget.ts
500
+ // src/mcp/tools/coordination-budget.ts
502
501
  /** Each channel spent beyond its budget, as spent of budget: `tokens 235,857 of 42,000` or
503
502
  * `deadline 3,857 s of 2,400 s`. */
504
503
  function budgetOverspendText(violation) {
@@ -602,8 +601,7 @@ const BUDGET_FIELD = {
602
601
  iterations: "maxIterations",
603
602
  usd: "maxUsd"
604
603
  };
605
- //#endregion
606
- //#region src/runtime/supervise/driver-control-acknowledgers.ts
604
+ // src/runtime/supervise/driver-control-acknowledgers.ts
607
605
  /** The journal file `createFileRunContext` writes inside the run directory. The acknowledger
608
606
  * reads it as EVIDENCE for the terminated-descendants set — the nested trees of a cancelled
609
607
  * lead journal their terminal records there before the lead settles into this scope. */
@@ -973,8 +971,7 @@ function terminatedDescendants(dir, nodeId, sinceIso) {
973
971
  function isDirectChildNodeId(owner, ref) {
974
972
  return ref.startsWith(`${owner.ownerId}:s`) && /^s\d+$/.test(ref.slice(owner.ownerId.length + 1));
975
973
  }
976
- //#endregion
977
- //#region src/runtime/supervise/event-bus.ts
974
+ // src/runtime/supervise/event-bus.ts
978
975
  /** Create the child→parent coordination bus: one typed pipe for settled outputs, questions, and analyst findings, with a priority-ordered pull queue and a pass-through subscribe lane.
979
976
  * @experimental In-process queue; durability is a transport swap that does not exist yet. */
980
977
  function createEventBus(now = Date.now) {
@@ -1061,8 +1058,7 @@ function createEventBus(now = Date.now) {
1061
1058
  }
1062
1059
  };
1063
1060
  }
1064
- //#endregion
1065
- //#region src/mcp/tools/coordination-analysis.ts
1061
+ // src/mcp/tools/coordination-analysis.ts
1066
1062
  function createCoordinationAnalysis(deps) {
1067
1063
  const { opts } = deps;
1068
1064
  const analysisRoutes = (opts.analyzeOnSettle ?? []).map(normalizeAnalyzeOnSettle);
@@ -1151,7 +1147,8 @@ async function readTraceSpans(opts, worker) {
1151
1147
  spanCount: 0
1152
1148
  };
1153
1149
  try {
1154
- const artifact = parseWorkerToolTraceArtifact(await opts.blobs.get(worker.trace.traceRef), worker.trace.traceRef);
1150
+ const raw = await opts.blobs.get(worker.trace.traceRef);
1151
+ const artifact = parseWorkerToolTraceArtifact(raw, worker.trace.traceRef);
1155
1152
  return {
1156
1153
  spansText: safeJsonText(artifact.spans),
1157
1154
  spanCount: artifact.spans.length
@@ -1467,8 +1464,7 @@ async function recordManagerAnalysisFailure(state, error) {
1467
1464
  });
1468
1465
  }
1469
1466
  }
1470
- //#endregion
1471
- //#region src/mcp/tools/coordination-input.ts
1467
+ // src/mcp/tools/coordination-input.ts
1472
1468
  const urgencyPriority = (u) => u === "blocks-run" ? 20 : u === "blocks-step" ? 10 : 0;
1473
1469
  const str = (v, field) => {
1474
1470
  if (typeof v !== "string" || v.length === 0) throw new Error(`coordination tools: "${field}" must be a non-empty string`);
@@ -1491,14 +1487,12 @@ const parseContinuity = (v) => {
1491
1487
  if (v === "fresh" || v === "resume") return v;
1492
1488
  throw new Error("coordination tools: \"continuity\" must be \"fresh\" or \"resume\"");
1493
1489
  };
1494
- //#endregion
1495
- //#region src/mcp/tools/coordination-worker-argument.ts
1490
+ // src/mcp/tools/coordination-worker-argument.ts
1496
1491
  const idArg = {
1497
1492
  type: "string",
1498
1493
  description: "The workerId returned by spawn_worker."
1499
1494
  };
1500
- //#endregion
1501
- //#region src/mcp/tools/coordination-analyst-tools.ts
1495
+ // src/mcp/tools/coordination-analyst-tools.ts
1502
1496
  function mountAnalystsTools({ opts, tools, ledger, nodeForWorker, analystMenu, analystRunContext, defineAnalyst }) {
1503
1497
  if (opts.analysts) {
1504
1498
  tools.push({
@@ -1646,8 +1640,7 @@ function mountAnalystsTools({ opts, tools, ledger, nodeForWorker, analystMenu, a
1646
1640
  });
1647
1641
  }
1648
1642
  }
1649
- //#endregion
1650
- //#region src/mcp/tools/coordination-tool-timeout.ts
1643
+ // src/mcp/tools/coordination-tool-timeout.ts
1651
1644
  async function runWithin(work, ms, message) {
1652
1645
  let timer;
1653
1646
  const timeout = new Promise((_, reject) => {
@@ -1660,8 +1653,7 @@ async function runWithin(work, ms, message) {
1660
1653
  if (timer) clearTimeout(timer);
1661
1654
  }
1662
1655
  }
1663
- //#endregion
1664
- //#region src/mcp/tools/coordination-audit-tools.ts
1656
+ // src/mcp/tools/coordination-audit-tools.ts
1665
1657
  function createAuditTools({ opts, tools, blockedReports, readJournal }) {
1666
1658
  return [{
1667
1659
  name: "report_blocked",
@@ -1800,8 +1792,7 @@ const unprobeableVerbs = /* @__PURE__ */ new Set([
1800
1792
  "report_blocked"
1801
1793
  ]);
1802
1794
  const REPORT_BLOCKED_PROBE_MS = 6e4;
1803
- //#endregion
1804
- //#region src/mcp/tools/coordination-down-messages.ts
1795
+ // src/mcp/tools/coordination-down-messages.ts
1805
1796
  function createDownMessages({ opts, bus, lifetime }) {
1806
1797
  async function sendDown(type, down, questionIdOrAnalyst) {
1807
1798
  await bus.publish(type === "answer" ? {
@@ -1938,8 +1929,7 @@ function createDownMessages({ opts, bus, lifetime }) {
1938
1929
  steerWorker
1939
1930
  };
1940
1931
  }
1941
- //#endregion
1942
- //#region src/mcp/tools/coordination-graph-tools.ts
1932
+ // src/mcp/tools/coordination-graph-tools.ts
1943
1933
  function mountGraphsTools({ opts, tools, admitSpawn }) {
1944
1934
  if (opts.graphs) {
1945
1935
  const graphs = opts.graphs;
@@ -2015,8 +2005,7 @@ function mountGraphsTools({ opts, tools, admitSpawn }) {
2015
2005
  });
2016
2006
  }
2017
2007
  }
2018
- //#endregion
2019
- //#region src/mcp/tools/coordination-journal-reader.ts
2008
+ // src/mcp/tools/coordination-journal-reader.ts
2020
2009
  function createJournalReader({ opts, bus }) {
2021
2010
  let journalReadTo = 0;
2022
2011
  const redactJournalEvent = resolveRedactor(opts.redactJournal);
@@ -2131,8 +2120,7 @@ function createJournalReader({ opts, bus }) {
2131
2120
  readTo: () => journalReadTo
2132
2121
  };
2133
2122
  }
2134
- //#endregion
2135
- //#region src/mcp/tools/coordination-lead-intake.ts
2123
+ // src/mcp/tools/coordination-lead-intake.ts
2136
2124
  /**
2137
2125
  * What reaches a manager from outside its tools: lead messages from its parent, and the outcomes
2138
2126
  * of tool calls that outlived their response fence. Both are open work until they are delivered.
@@ -2216,8 +2204,7 @@ function leadMessageOf(message) {
2216
2204
  interrupt
2217
2205
  };
2218
2206
  }
2219
- //#endregion
2220
- //#region src/mcp/tools/coordination-event-projection.ts
2207
+ // src/mcp/tools/coordination-event-projection.ts
2221
2208
  const eventWorker = (event) => event.type === "settled" ? event.worker.id : event.type === "finding" ? event.finding.fromWorker : event.type === "question" ? event.question.from : event.type === "map" ? event.map.sourceWorker : void 0;
2222
2209
  const projectEvent = (ev) => {
2223
2210
  if (ev.type === "settled") {
@@ -2300,8 +2287,7 @@ const projectEvent = (ev) => {
2300
2287
  ...ev.down
2301
2288
  };
2302
2289
  };
2303
- //#endregion
2304
- //#region src/mcp/tools/coordination-manager-reentry.ts
2290
+ // src/mcp/tools/coordination-manager-reentry.ts
2305
2291
  function managerReentryState({ opts, ledger, deliveries, priorJournal, bus, journal, openWork, driverAttempt, lastRejection }) {
2306
2292
  const { unqueued, queued } = openWork();
2307
2293
  const deliveredSettled = new Set(deliveries.flatMap((delivery) => delivery.record.event.type === "settled" ? [delivery.record.event.worker.id] : []));
@@ -2343,8 +2329,7 @@ function managerReentryState({ opts, ledger, deliveries, priorJournal, bus, jour
2343
2329
  ...lastRejection === void 0 ? {} : { lastRejection }
2344
2330
  });
2345
2331
  }
2346
- //#endregion
2347
- //#region src/mcp/tools/coordination-manager-state.ts
2332
+ // src/mcp/tools/coordination-manager-state.ts
2348
2333
  function createManagerState(opts) {
2349
2334
  const priorSubmission = opts.deliverable === void 0 ? void 0 : opts.priorJournal?.find((record) => record.event.type === "submission");
2350
2335
  return {
@@ -2408,8 +2393,7 @@ async function acknowledgeDeliveries({ opts, bus, state, leadReceipts }, targets
2408
2393
  for (const delivery of fresh) delivery.acknowledged = true;
2409
2394
  return seqs;
2410
2395
  }
2411
- //#endregion
2412
- //#region src/mcp/tools/coordination-manager-waiting.ts
2396
+ // src/mcp/tools/coordination-manager-waiting.ts
2413
2397
  function createManagerWaiting(env) {
2414
2398
  return {
2415
2399
  ensureDrain: ensureDrain.bind(null, env),
@@ -2580,8 +2564,7 @@ async function awaitSettlement(env, workerIds, signal) {
2580
2564
  })])) && settledIds().length === 0) return [];
2581
2565
  }
2582
2566
  }
2583
- //#endregion
2584
- //#region src/mcp/tools/coordination-runtime-spawn.ts
2567
+ // src/mcp/tools/coordination-runtime-spawn.ts
2585
2568
  /**
2586
2569
  * Admit one keyed runtime spawn. A key whose prior worker is in doubt (started in a dead process
2587
2570
  * with no terminal receipt) is re-admitted once under `<key>#2`, the replacement key the
@@ -2607,8 +2590,7 @@ async function admitRuntimeSpawn(admitSpawn, input) {
2607
2590
  }
2608
2591
  return { inDoubt: true };
2609
2592
  }
2610
- //#endregion
2611
- //#region src/mcp/tools/coordination-map-routing.ts
2593
+ // src/mcp/tools/coordination-map-routing.ts
2612
2594
  function createMapRouting(deps) {
2613
2595
  const state = {
2614
2596
  ...deps,
@@ -2929,8 +2911,7 @@ function resolveJsonPointer(document, pointer) {
2929
2911
  value
2930
2912
  };
2931
2913
  }
2932
- //#endregion
2933
- //#region src/mcp/tools/coordination-question-ledger.ts
2914
+ // src/mcp/tools/coordination-question-ledger.ts
2934
2915
  function createQuestionLedger({ opts, bus }) {
2935
2916
  let questionSeq = 0;
2936
2917
  const questions = [...opts.priorQuestions ?? []];
@@ -3054,8 +3035,7 @@ function createQuestionLedger({ opts, bus }) {
3054
3035
  blockingQuestionsForStop
3055
3036
  };
3056
3037
  }
3057
- //#endregion
3058
- //#region src/mcp/tools/coordination-messages.ts
3038
+ // src/mcp/tools/coordination-messages.ts
3059
3039
  /**
3060
3040
  * Why one parent→child delivery did not land, in the words the MANAGER needs.
3061
3041
  *
@@ -3072,14 +3052,12 @@ const downMessageRefusalReasons = Object.freeze({
3072
3052
  "scope-stopped": "this manager’s scope has stopped, so no further message may be sent from it",
3073
3053
  "runtime-error": "the executor threw while accepting the message; the worker may or may not have received it"
3074
3054
  });
3075
- //#endregion
3076
- //#region src/mcp/tools/coordination-questions.ts
3055
+ // src/mcp/tools/coordination-questions.ts
3077
3056
  /** Where a question this driver cannot answer goes next. `answer_question` accepts these and
3078
3057
  * nothing else, so the decision type states them and nothing else. */
3079
3058
  const questionEscalationTargets = ["parent", "user"];
3080
3059
  const isQuestionEscalationTarget = (value) => questionEscalationTargets.includes(value);
3081
- //#endregion
3082
- //#region src/mcp/tools/coordination-question-tools.ts
3060
+ // src/mcp/tools/coordination-question-tools.ts
3083
3061
  function createQuestionTools({ questionLedger, messages }) {
3084
3062
  return [
3085
3063
  {
@@ -3234,8 +3212,7 @@ function createQuestionTools({ questionLedger, messages }) {
3234
3212
  }
3235
3213
  ];
3236
3214
  }
3237
- //#endregion
3238
- //#region src/mcp/tools/coordination-completion-refusal.ts
3215
+ // src/mcp/tools/coordination-completion-refusal.ts
3239
3216
  /**
3240
3217
  * The refusal a failed check reading returns to `submit_result`: the verdict as a located fact,
3241
3218
  * the FAIL lines unless the check's tests must stay hidden, and how many times the manager has
@@ -3256,8 +3233,7 @@ function refusalText(verdict, deliverable, read) {
3256
3233
  ...lines.length > shown.length ? [`${lines.length - shown.length} more failure lines.`] : []
3257
3234
  ].join("\n");
3258
3235
  }
3259
- //#endregion
3260
- //#region src/mcp/tools/coordination-result-tools.ts
3236
+ // src/mcp/tools/coordination-result-tools.ts
3261
3237
  /**
3262
3238
  * The tools that end a manager: `submit_result` when it has an independent check, otherwise
3263
3239
  * `stop`, then `read_continuation` when the run keeps continuation notes.
@@ -3441,8 +3417,7 @@ function readContinuationTool(opts) {
3441
3417
  }
3442
3418
  };
3443
3419
  }
3444
- //#endregion
3445
- //#region src/mcp/tools/coordination-route-routing.ts
3420
+ // src/mcp/tools/coordination-route-routing.ts
3446
3421
  /**
3447
3422
  * The flow scheduler of one manager: entry and route spawns are runtime spawns, like map items.
3448
3423
  * It has two call sites. `start` spawns every entry when the manager's coordination opens, before
@@ -3888,8 +3863,7 @@ function gateDecision(answer, choices) {
3888
3863
  };
3889
3864
  return `${shown} — expected { kind: 'choose', choice, by } or { kind: 'stop', reason, by }`;
3890
3865
  }
3891
- //#endregion
3892
- //#region src/mcp/tools/coordination-settlement-drain.ts
3866
+ // src/mcp/tools/coordination-settlement-drain.ts
3893
3867
  function createSettlementDrain({ opts, ledger, unwatchWorker, bus, analysis, maps, routes, workerRouteNames, projectSettled }) {
3894
3868
  const hooked = /* @__PURE__ */ new Set();
3895
3869
  const commitSettled = (w) => {
@@ -4027,8 +4001,7 @@ function createSettlementDrain({ opts, ledger, unwatchWorker, bus, analysis, map
4027
4001
  isBusy: () => pendingSettlement !== void 0 || flushing > 0
4028
4002
  };
4029
4003
  }
4030
- //#endregion
4031
- //#region src/mcp/tools/coordination-budget-override.ts
4004
+ // src/mcp/tools/coordination-budget-override.ts
4032
4005
  const mergeBudget = (base, raw) => {
4033
4006
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new Error("coordination tools: \"budget\" must be an object");
4034
4007
  const o = raw;
@@ -4058,8 +4031,7 @@ const mergeBudget = (base, raw) => {
4058
4031
  assertValidBudget(merged, "coordination tools: budget");
4059
4032
  return merged;
4060
4033
  };
4061
- //#endregion
4062
- //#region src/mcp/tools/coordination-model-attribution.ts
4034
+ // src/mcp/tools/coordination-model-attribution.ts
4063
4035
  /**
4064
4036
  * The substitution and the sentence a manager reads beside it. A manager that reports which model
4065
4037
  * did the work must read `modelSubstitution.ran`, never the model it asked for.
@@ -4070,8 +4042,7 @@ function modelSubstitutionReport(substitution) {
4070
4042
  modelWarning: `spawn authorization ran this worker on ${substitution.ran}, not the ${substitution.requested} you authored; attribute its work to ${substitution.ran}`
4071
4043
  };
4072
4044
  }
4073
- //#endregion
4074
- //#region src/mcp/tools/coordination-spawn-admission.ts
4045
+ // src/mcp/tools/coordination-spawn-admission.ts
4075
4046
  function createSpawnAdmission(deps) {
4076
4047
  const state = {
4077
4048
  ...deps,
@@ -4314,8 +4285,7 @@ function nextUnkeyedAssignmentOrdinal(scope) {
4314
4285
  if (!Number.isSafeInteger(next)) throw new Error("coordination: durable assignment ordinal space is exhausted");
4315
4286
  return next;
4316
4287
  }
4317
- //#endregion
4318
- //#region src/runtime/supervise/detector-monitor.ts
4288
+ // src/runtime/supervise/detector-monitor.ts
4319
4289
  /**
4320
4290
  *
4321
4291
  * The ONLINE analyst: watch a `TraceSource` and fold each tool span through agent-eval's published
@@ -4356,14 +4326,14 @@ function watchTrace(source, opts = {}) {
4356
4326
  for (const s of signals) opts.onSignal?.(s, span);
4357
4327
  });
4358
4328
  }
4359
- //#endregion
4360
- //#region src/mcp/tools/coordination-worker-observation.ts
4329
+ // src/mcp/tools/coordination-worker-observation.ts
4361
4330
  function createWorkerObservation({ opts, ledger, flushedAnalystRuns, bus, deadlineNoticeDelivered, leadPublishing }) {
4362
4331
  const liveWorkerCount = () => opts.scope.view.nodes.filter((n) => isLiveNodeStatus(n.status)).length;
4363
4332
  const queuedWorkerCount = () => opts.scope.view.nodes.filter((n) => n.status === "queued").length;
4364
4333
  const projectNodeEvidence = (node, resumed = false) => ({
4365
4334
  id: node.id,
4366
4335
  status: node.status,
4336
+ ...node.failure === void 0 ? {} : { failure: node.failure },
4367
4337
  ...node.assignmentId === void 0 ? {} : { assignmentId: node.assignmentId },
4368
4338
  ...node.identity === void 0 ? {} : { identity: node.identity },
4369
4339
  ...node.modelSubstitution === void 0 ? {} : modelSubstitutionReport(node.modelSubstitution),
@@ -4488,8 +4458,7 @@ function createWorkerObservation({ opts, ledger, flushedAnalystRuns, bus, deadli
4488
4458
  unwatchWorker
4489
4459
  };
4490
4460
  }
4491
- //#endregion
4492
- //#region src/mcp/tools/coordination-worker-settlement.ts
4461
+ // src/mcp/tools/coordination-worker-settlement.ts
4493
4462
  function createWorkerSettlement({ opts, nodeForWorker }) {
4494
4463
  const descendantOutRefs = new Set(opts.sourceEvidenceRefs ?? []);
4495
4464
  const projectSettled = (settled, resumed = false) => {
@@ -4543,8 +4512,7 @@ function createWorkerSettlement({ opts, nodeForWorker }) {
4543
4512
  projectSettled
4544
4513
  };
4545
4514
  }
4546
- //#endregion
4547
- //#region src/mcp/tools/coordination-profile-schema.ts
4515
+ // src/mcp/tools/coordination-profile-schema.ts
4548
4516
  /**
4549
4517
  * Strip zod's object-KEY CODEC artifact from a derived JSON Schema, at every depth.
4550
4518
  *
@@ -4604,7 +4572,7 @@ const spawnProfileFields = [
4604
4572
  },
4605
4573
  {
4606
4574
  name: "prompt",
4607
- description: "The child's standing instructions: `systemPrompt` (who it is and how it works) and `instructions` (durable rules). This is the role; the separate `task` argument carries what to do right now. A child with no systemPrompt has no role — always set one."
4575
+ description: "The child's standing instructions: `appendSystemPrompt` (who it is and how it works; preserves native defaults) and `instructions` (durable rules). This is the role; the separate `task` argument carries what to do right now. Give each child instructions or appendSystemPrompt; systemPrompt explicitly replaces native defaults."
4608
4576
  },
4609
4577
  {
4610
4578
  name: "tools",
@@ -4702,12 +4670,15 @@ let spawnProfileArgCache;
4702
4670
  * keeps the conversion total: the canonical schema contains transforms with no JSON Schema form,
4703
4671
  * and zod's default is to throw on them, which would leave the tool with no published shape. */
4704
4672
  function spawnProfileArg() {
4705
- if (!spawnProfileArgCache) spawnProfileArgCache = detachedFrozen(deriveSpawnProfileArg(agentProfileSchema.toJSONSchema({
4706
- metadata: registry(),
4707
- io: "input",
4708
- target: "draft-07",
4709
- unrepresentable: "any"
4710
- }).properties));
4673
+ if (!spawnProfileArgCache) {
4674
+ const canonical = agentProfileSchema.toJSONSchema({
4675
+ metadata: registry(),
4676
+ io: "input",
4677
+ target: "draft-07",
4678
+ unrepresentable: "any"
4679
+ });
4680
+ spawnProfileArgCache = detachedFrozen(deriveSpawnProfileArg(canonical.properties));
4681
+ }
4711
4682
  return spawnProfileArgCache;
4712
4683
  }
4713
4684
  /** `spawn_worker`'s `profile` argument when the run has a profiles table: one of the table's names,
@@ -4737,8 +4708,7 @@ function profileTableRefusal(table, profile) {
4737
4708
  if (typeof name !== "string" || !table.has(name)) return void 0;
4738
4709
  return `profile.name ${JSON.stringify(name)} is a profiles-table entry: pass profile: ${JSON.stringify(name)} to run that exact profile, or give the profile you wrote another name`;
4739
4710
  }
4740
- //#endregion
4741
- //#region src/mcp/tools/worker-output.ts
4711
+ // src/mcp/tools/worker-output.ts
4742
4712
  const WORKER_OUTPUT_PAGE_CHARS = 16384;
4743
4713
  function workerOutputReadOptions(raw) {
4744
4714
  const offset = raw.outputOffset ?? 0;
@@ -4841,8 +4811,7 @@ function createWorkerOutputReader(blobs) {
4841
4811
  }
4842
4812
  };
4843
4813
  }
4844
- //#endregion
4845
- //#region src/mcp/tools/coordination-worker-tools.ts
4814
+ // src/mcp/tools/coordination-worker-tools.ts
4846
4815
  function createWorkerTools(ctx) {
4847
4816
  return [
4848
4817
  spawnWorkerTool(ctx),
@@ -5048,6 +5017,7 @@ function observeTree({ opts, redactJournalEvent }) {
5048
5017
  parent: node.parent,
5049
5018
  label: node.label,
5050
5019
  status: node.status,
5020
+ ...node.failure === void 0 ? {} : { failure: node.failure },
5051
5021
  runtime: node.runtime,
5052
5022
  spawnedAt: node.spawnedAt,
5053
5023
  settledAt: node.settledAt
@@ -5065,6 +5035,7 @@ function observeEvents({ opts, redactJournalEvent }, args, eventCursor) {
5065
5035
  label: node.label,
5066
5036
  status: node.status,
5067
5037
  runtime: node.runtime,
5038
+ ...node.failure === void 0 ? {} : { failure: node.failure },
5068
5039
  events: opts.scope.observeEvents?.(id, eventCursor) ?? {
5069
5040
  status: "unavailable",
5070
5041
  reason: "not-captured"
@@ -5199,8 +5170,7 @@ function cancelWorkerTool({ opts, spawn, workers }) {
5199
5170
  }
5200
5171
  };
5201
5172
  }
5202
- //#endregion
5203
- //#region src/mcp/tools/coordination-manager.ts
5173
+ // src/mcp/tools/coordination-manager.ts
5204
5174
  /** Build the driver's MCP tools over a live scope. */
5205
5175
  function createCoordinationTools(opts) {
5206
5176
  return createCoordinationToolsForManager(opts);
@@ -5610,7 +5580,6 @@ function createResumeReplay({ opts, bus, ledger, analysis, projectSettled }) {
5610
5580
  return readyInFlight;
5611
5581
  };
5612
5582
  }
5613
- //#endregion
5614
- export { createEventBus as a, budgetOverspendText as c, safeJsonText as d, createFileRunContext as f, foldCoordinationRecords as g, FileCoordinationLog as h, watchTrace as i, normalizeAnalyzeOnSettle as l, withRunContext as m, createCoordinationToolsForManager as n, createCancelAcknowledger as o, createInMemoryRunContext as p, defaultToolDetectors as r, createSteerAcknowledger as s, createCoordinationTools as t, coordinationVerbNames as u };
5583
+ export { FileCoordinationLog as _, downMessageRefusalReasons as a, createCancelAcknowledger as c, normalizeAnalyzeOnSettle as d, coordinationVerbNames as f, withRunContext as g, createInMemoryRunContext as h, watchTrace as i, createSteerAcknowledger as l, createFileRunContext as m, createCoordinationToolsForManager as n, resolveJsonPointer as o, safeJsonText as p, defaultToolDetectors as r, createEventBus as s, createCoordinationTools as t, budgetOverspendText as u, foldCoordinationRecords as v };
5615
5584
 
5616
- //# sourceMappingURL=coordination-manager-Bm6leXc6.js.map
5585
+ //# sourceMappingURL=coordination-manager-BkVfWlMz.js.map