@tangle-network/agent-runtime 0.349.0 → 0.352.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 (139) hide show
  1. package/dist/{activation-wBipBkCf.d.ts → activation-BidzGkUQ.d.ts} +2 -24
  2. package/dist/{activation-tNGW73Y9.js → activation-C6zNC2kx.js} +12 -14
  3. package/dist/{activation-tNGW73Y9.js.map → activation-C6zNC2kx.js.map} +1 -1
  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-1xaJEgjq.js → bundle-DeDkJbsr.js} +3 -4
  12. package/dist/{bundle-1xaJEgjq.js.map → bundle-DeDkJbsr.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/chat-turn.d.ts +2 -0
  17. package/dist/chat-turn.js +1 -0
  18. package/dist/{coordination-manager-B2Z_MmL9.js → coordination-manager-B7QadgrI.js} +101 -132
  19. package/dist/{coordination-manager-B2Z_MmL9.js.map → coordination-manager-B7QadgrI.js.map} +1 -1
  20. package/dist/{delegate-Dr-63jFl.js → delegate-CoscoyEo.js} +19 -21
  21. package/dist/delegate-CoscoyEo.js.map +1 -0
  22. package/dist/durable.d.ts +16 -149
  23. package/dist/durable.js +57 -980
  24. package/dist/durable.js.map +1 -1
  25. package/dist/{errors-DodWX-cb.js → errors-AzSuGI23.js} +5 -3
  26. package/dist/errors-AzSuGI23.js.map +1 -0
  27. package/dist/execution-handle-Bd2_nUB6.js +167 -0
  28. package/dist/execution-handle-Bd2_nUB6.js.map +1 -0
  29. package/dist/execution-handle-CujvqgCn.d.ts +130 -0
  30. package/dist/{graph-DPejYB3C.js → graph-mojMML8e.js} +192 -14
  31. package/dist/graph-mojMML8e.js.map +1 -0
  32. package/dist/{improve-DwSahPi1.js → improve-Dm5ZE8mr.js} +36 -53
  33. package/dist/{improve-DwSahPi1.js.map → improve-Dm5ZE8mr.js.map} +1 -1
  34. package/dist/{improvement-adapter-sIthWkcN.d.ts → improvement-adapter-D5GRU1eY.d.ts} +2 -6
  35. package/dist/index.d.ts +41 -89
  36. package/dist/index.js +45 -61
  37. package/dist/index.js.map +1 -1
  38. package/dist/intelligence.d.ts +39 -59
  39. package/dist/intelligence.js +24 -33
  40. package/dist/intelligence.js.map +1 -1
  41. package/dist/journal-store-BJPMUydp.js +3925 -0
  42. package/dist/journal-store-BJPMUydp.js.map +1 -0
  43. package/dist/kernel.d.ts +5 -5
  44. package/dist/kernel.js +12 -11
  45. package/dist/{loop-runner-CP6MfO1b.js → loop-runner-5cL_vZi0.js} +5 -6
  46. package/dist/{loop-runner-CP6MfO1b.js.map → loop-runner-5cL_vZi0.js.map} +1 -1
  47. package/dist/{loop-runner-C6pGq-2l.d.ts → loop-runner-DyLD-aNb.d.ts} +3 -5
  48. package/dist/loop-runner-bin.d.ts +5 -8
  49. package/dist/loop-runner-bin.js +2 -3
  50. package/dist/mcp/bin.js +6 -8
  51. package/dist/mcp/bin.js.map +1 -1
  52. package/dist/mcp/index.d.ts +8 -18
  53. package/dist/mcp/index.js +17 -25
  54. package/dist/mcp/index.js.map +1 -1
  55. package/dist/mcp/memory-bin.js +4 -6
  56. package/dist/mcp/memory-bin.js.map +1 -1
  57. package/dist/{model-policy-CyCUwHed.js → model-policy-C-RGAUW4.js} +11 -13
  58. package/dist/{model-policy-CyCUwHed.js.map → model-policy-C-RGAUW4.js.map} +1 -1
  59. package/dist/placement.d.ts +12 -14
  60. package/dist/placement.js +1 -2
  61. package/dist/platform.d.ts +7 -13
  62. package/dist/platform.js +3 -6
  63. package/dist/platform.js.map +1 -1
  64. package/dist/{prepare-B9wWffjO.js → prepare-XWwsOh8O.js} +50 -69
  65. package/dist/{prepare-B9wWffjO.js.map → prepare-XWwsOh8O.js.map} +1 -1
  66. package/dist/{profile-JLJd2wFG.js → profile-C01SQZKa.js} +58 -92
  67. package/dist/profile-C01SQZKa.js.map +1 -0
  68. package/dist/{profile-materialization-bPm0gGLO.d.ts → profile-materialization-BRY22Oh8.d.ts} +1 -3
  69. package/dist/profiles.d.ts +25 -12
  70. package/dist/profiles.js +52 -11
  71. package/dist/profiles.js.map +1 -1
  72. package/dist/{protected-model-port-DVVh-hEk.d.ts → protected-model-port-IKqhTypD.d.ts} +2 -14
  73. package/dist/{protected-redaction-DFCeo4vg.js → protected-redaction-DilFZch5.js} +2 -3
  74. package/dist/{protected-redaction-DFCeo4vg.js.map → protected-redaction-DilFZch5.js.map} +1 -1
  75. package/dist/{provision-supervisor-C4v2vqDo.js → provision-supervisor-D9pO-iPl.js} +11 -15
  76. package/dist/{provision-supervisor-C4v2vqDo.js.map → provision-supervisor-D9pO-iPl.js.map} +1 -1
  77. package/dist/{run-cancellation-CzFhQGMa.js → run-cancellation-CoJRKvih.js} +6 -7
  78. package/dist/{run-cancellation-CzFhQGMa.js.map → run-cancellation-CoJRKvih.js.map} +1 -1
  79. package/dist/{runtime-CsvGCQpl.js → runtime-BJPXHWbc.js} +652 -215
  80. package/dist/runtime-BJPXHWbc.js.map +1 -0
  81. package/dist/{runtime-hooks-tXpAarhW.js → runtime-hooks-CsW2pfFk.js} +2 -3
  82. package/dist/{runtime-hooks-tXpAarhW.js.map → runtime-hooks-CsW2pfFk.js.map} +1 -1
  83. package/dist/{runtime-hooks-nsqxSUFL.d.ts → runtime-hooks-ZQqPw-0g.d.ts} +1 -3
  84. package/dist/{sandbox-profile-compat-DtuJWFrM.js → sandbox-profile-compat-CXjozdWL.js} +52 -653
  85. package/dist/sandbox-profile-compat-CXjozdWL.js.map +1 -0
  86. package/dist/{search-executor-CCb82Umc.js → search-executor-CQEHMXoT.js} +12 -15
  87. package/dist/{search-executor-CCb82Umc.js.map → search-executor-CQEHMXoT.js.map} +1 -1
  88. package/dist/{server-CKPwZU-I.js → server-U9NGgudQ.js} +19 -30
  89. package/dist/{server-CKPwZU-I.js.map → server-U9NGgudQ.js.map} +1 -1
  90. package/dist/{structural-rollout-DylC_fwU.js → structural-rollout-wMSxE7bn.js} +71 -70
  91. package/dist/structural-rollout-wMSxE7bn.js.map +1 -0
  92. package/dist/{substrate-CGDFTSRh.js → substrate-Db2pp6y3.js} +2 -3
  93. package/dist/{substrate-CGDFTSRh.js.map → substrate-Db2pp6y3.js.map} +1 -1
  94. package/dist/{supervise-BGfm2GlY.js → supervise-CNNhX0ab.js} +460 -195
  95. package/dist/supervise-CNNhX0ab.js.map +1 -0
  96. package/dist/supervision-discovery-CewADdEs.js +772 -0
  97. package/dist/supervision-discovery-CewADdEs.js.map +1 -0
  98. package/dist/{supervisor-wS9Ehz_x.js → supervisor-rK5Y8en6.js} +521 -4320
  99. package/dist/supervisor-rK5Y8en6.js.map +1 -0
  100. package/dist/{task-queue-0fKkoweu.d.ts → task-queue-kefGy79U.d.ts} +1 -3
  101. package/dist/task-queue.d.ts +1 -1
  102. package/dist/task-queue.js +1 -2
  103. package/dist/testing.d.ts +7 -15
  104. package/dist/testing.js +241 -244
  105. package/dist/testing.js.map +1 -1
  106. package/dist/tool-loop.d.ts +16 -19
  107. package/dist/tool-loop.js +2 -3
  108. package/dist/{tool-server-XV4aJwoQ.js → tool-server-CZWd_Opp.js} +3 -4
  109. package/dist/{tool-server-XV4aJwoQ.js.map → tool-server-CZWd_Opp.js.map} +1 -1
  110. package/dist/{top-snapshot-CflmaDgk.js → top-snapshot-DcV7VG4m.js} +179 -163
  111. package/dist/top-snapshot-DcV7VG4m.js.map +1 -0
  112. package/dist/tui/bin.js +50 -81
  113. package/dist/tui/bin.js.map +1 -1
  114. package/dist/tui/index.d.ts +27 -58
  115. package/dist/tui/index.js +2 -2
  116. package/dist/{types-C8BGOCBn.d.ts → types-0uzVKtFW.d.ts} +388 -484
  117. package/dist/{types-Cwrea-bU.d.ts → types-qsqfyQoY.d.ts} +1 -3
  118. package/dist/util-ebWMWzY0.js +624 -0
  119. package/dist/util-ebWMWzY0.js.map +1 -0
  120. package/dist/workspace-store/index.d.ts +12 -22
  121. package/dist/workspace-store/index.js +13 -10
  122. package/dist/workspace-store/index.js.map +1 -1
  123. package/dist/{workspace-streams-BiS4ABah.d.ts → workspace-streams-Dq2Fzk3c.d.ts} +1 -11
  124. package/package.json +31 -26
  125. package/skills/agent-graphs/SKILL.md +17 -4
  126. package/skills/be-ambitious/SKILL.md +46 -0
  127. package/skills/graph-designer/SKILL.md +9 -2
  128. package/dist/delegate-Dr-63jFl.js.map +0 -1
  129. package/dist/errors-DodWX-cb.js.map +0 -1
  130. package/dist/graph-DPejYB3C.js.map +0 -1
  131. package/dist/profile-JLJd2wFG.js.map +0 -1
  132. package/dist/record-events-D93DkpAx.js +0 -263
  133. package/dist/record-events-D93DkpAx.js.map +0 -1
  134. package/dist/runtime-CsvGCQpl.js.map +0 -1
  135. package/dist/sandbox-profile-compat-DtuJWFrM.js.map +0 -1
  136. package/dist/structural-rollout-DylC_fwU.js.map +0 -1
  137. package/dist/supervise-BGfm2GlY.js.map +0 -1
  138. package/dist/supervisor-wS9Ehz_x.js.map +0 -1
  139. package/dist/top-snapshot-CflmaDgk.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,15 +1,17 @@
1
- import { Dn as loopEventToOtelSpan, Er as ROUTER_PRICE_SOURCE, Mn as createRuntimeStreamEventCollector, Nn as sanitizeKnowledgeReadinessReport, On as padSpanId, Pn as sanitizeRuntimeStreamEvent, Ti as runtimeFailureCause, Tr as priceTokens, Xi as resolveRedactor, Yi as defaultRedactorIdentityMaterial, bn as buildLoopOtelSpans, da as providerMessageText, jn as createRuntimeEventCollector, kn as padTraceId, wn as createOtelExporter, xi as executableAgentProfileSnapshot } from "./supervisor-wS9Ehz_x.js";
2
- import { a as JudgeError, f as RuntimeRunStateError, i as ConfigError, m as ValidationError, o as NotFoundError, r as BackendTransportError, t as AgentEvalError } from "./errors-DodWX-cb.js";
3
- import { B as InMemoryRuntimeSessionStore, C as optimizerMethod, H as nowIso, I as streamAgentTurn, L as createIterableBackend, R as createSandboxPromptBackend, U as startOrResumeRuntimeSession, V as newRuntimeSession, W as touchSession, z as normalizeBackendStreamEvent } from "./structural-rollout-DylC_fwU.js";
4
- import { L as embeddedCandidateArtifact, N as canonicalCandidateBytes$1, P as canonicalCandidateDigest$1, R as immutableCandidateValue, b as persistCandidateOutputArtifact, l as captureAgentCandidateWorkspace, ot as sleep, z as omitTopLevelDigest } from "./sandbox-profile-compat-DtuJWFrM.js";
5
- import { t as assertExecutableAgentProfile } from "./model-policy-CyCUwHed.js";
6
- import { c as withMethodRuntimeControls, d as commandVerifier, f as addRuntimeUsage, i as assertCandidateValidator, m as isUsageAmount, n as createCommandProfileTrainer, o as parseExecutionRef, p as createRuntimeUsageTotals, r as searchMethod, s as privateValuePaths, t as improve, u as agenticGenerator } from "./improve-DwSahPi1.js";
7
- import { n as defineRuntimeHooks, t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
8
- import { n as createAgentImprovementActivationResult } from "./activation-tNGW73Y9.js";
9
- import { l as sharedBoxLane, o as routerLane, r as dedicatedLane, t as SearchEnvironmentFault, u as subscriptionLane, y as decideSearchImprovement } from "./search-executor-CCb82Umc.js";
10
- import { t as sealAgentCandidateBundle } from "./bundle-1xaJEgjq.js";
11
- import { t as supervise } from "./supervise-BGfm2GlY.js";
12
- import { n as auditLoopRunner } from "./loop-runner-CP6MfO1b.js";
1
+ import { D as runtimeFailureCause, _t as defaultRedactorIdentityMaterial, vt as resolveRedactor } from "./journal-store-BJPMUydp.js";
2
+ import { Cn as createRuntimeStreamEventCollector, Sn as createRuntimeEventCollector, Tn as sanitizeRuntimeStreamEvent, _r as ROUTER_PRICE_SOURCE, bi as providerMessageText, bn as padTraceId, dn as buildLoopOtelSpans, gr as priceTokens, hn as createOtelExporter, pi as executableAgentProfileSnapshot, vn as loopEventToOtelSpan, wn as sanitizeKnowledgeReadinessReport, yn as padSpanId } from "./supervisor-rK5Y8en6.js";
3
+ import { a as JudgeError, f as RuntimeRunStateError, i as ConfigError, m as ValidationError, o as NotFoundError, r as BackendTransportError, t as AgentEvalError } from "./errors-AzSuGI23.js";
4
+ import { B as InMemoryRuntimeSessionStore, C as optimizerMethod, H as nowIso, I as streamAgentTurn, L as createIterableBackend, R as createSandboxPromptBackend, U as startOrResumeRuntimeSession, V as newRuntimeSession, W as touchSession, z as normalizeBackendStreamEvent } from "./structural-rollout-wMSxE7bn.js";
5
+ import { v as sleep } from "./util-ebWMWzY0.js";
6
+ import { t as assertExecutableAgentProfile } from "./model-policy-C-RGAUW4.js";
7
+ import { c as withMethodRuntimeControls, d as commandVerifier, f as addRuntimeUsage, i as assertCandidateValidator, m as isUsageAmount, n as createCommandProfileTrainer, o as parseExecutionRef, p as createRuntimeUsageTotals, r as searchMethod, s as privateValuePaths, t as improve, u as agenticGenerator } from "./improve-Dm5ZE8mr.js";
8
+ import { L as embeddedCandidateArtifact, N as canonicalCandidateBytes$1, P as canonicalCandidateDigest$1, R as immutableCandidateValue, b as persistCandidateOutputArtifact, l as captureAgentCandidateWorkspace, z as omitTopLevelDigest } from "./sandbox-profile-compat-CXjozdWL.js";
9
+ import { n as defineRuntimeHooks, t as composeRuntimeHooks } from "./runtime-hooks-CsW2pfFk.js";
10
+ import { n as createAgentImprovementActivationResult } from "./activation-C6zNC2kx.js";
11
+ import { l as sharedBoxLane, o as routerLane, r as dedicatedLane, t as SearchEnvironmentFault, u as subscriptionLane, y as decideSearchImprovement } from "./search-executor-CQEHMXoT.js";
12
+ import { t as sealAgentCandidateBundle } from "./bundle-DeDkJbsr.js";
13
+ import { t as supervise } from "./supervise-CNNhX0ab.js";
14
+ import { n as auditLoopRunner } from "./loop-runner-5cL_vZi0.js";
13
15
  import { agentCandidateKnowledgeSchema, agentCandidateWorkspaceManifestMaterialSchema, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, sha256DigestSchema } from "@tangle-network/agent-interface";
14
16
  import { FAILURE_CLASSES, acquisitionPlansForKnowledgeGaps, blockingKnowledgeEval, canonicalJson, runAgentControlLoop, scoreKnowledgeReadiness, userQuestionsForKnowledgeGaps } from "@tangle-network/agent-eval";
15
17
  import { z } from "zod";
@@ -20,7 +22,7 @@ import { spawnSync } from "node:child_process";
20
22
  import { realpath } from "node:fs/promises";
21
23
  import { gepaOptimizationMethod, skillOptOptimizationMethod } from "@tangle-network/agent-eval/campaign";
22
24
  import { evaluateKnowledgeBaseReadiness, fromAgentCandidateKnowledgeRef, improveKnowledgeBase, knowledgeImprovementCandidateRef, loadKnowledgeImprovementActivationResult, normalizeKnowledgeStateScope, promoteKnowledgeCandidate, restoreKnowledgeCandidateBaseline, toAgentCandidateKnowledgeRef, withKnowledgeImprovementComparison } from "@tangle-network/agent-knowledge";
23
- //#region src/runtime/profile-execution-backend.ts
25
+ // src/runtime/profile-execution-backend.ts
24
26
  /**
25
27
  * Bind one exact profile and Runtime executor to the stable `AgentExecutionBackend` contract used
26
28
  * by `runAgentTaskStream` and conversations.
@@ -100,8 +102,7 @@ function rebindEvent(event, context) {
100
102
  session: context.session
101
103
  };
102
104
  }
103
- //#endregion
104
- //#region src/conversation/headers.ts
105
+ // src/conversation/headers.ts
105
106
  /**
106
107
  *
107
108
  * Cross-gateway forwarding headers — the wire-level contract that makes
@@ -179,8 +180,7 @@ function pickHeader(headers, name) {
179
180
  return value;
180
181
  }
181
182
  }
182
- //#endregion
183
- //#region src/conversation/call-policy.ts
183
+ // src/conversation/call-policy.ts
184
184
  /** Thrown when the circuit breaker is open for a participant and no retry is allowed yet. */
185
185
  var CircuitOpenError = class extends Error {
186
186
  constructor(participant, retryAfterMs) {
@@ -252,11 +252,13 @@ function makePerAttemptSignal(parentSignal, deadlineMs) {
252
252
  const controller = new AbortController();
253
253
  let deadlineError;
254
254
  const cleanups = [];
255
- if (parentSignal) if (parentSignal.aborted) controller.abort(parentSignal.reason);
256
- else {
257
- const onAbort = () => controller.abort(parentSignal.reason);
258
- parentSignal.addEventListener("abort", onAbort, { once: true });
259
- cleanups.push(() => parentSignal.removeEventListener("abort", onAbort));
255
+ if (parentSignal) {
256
+ if (parentSignal.aborted) controller.abort(parentSignal.reason);
257
+ else {
258
+ const onAbort = () => controller.abort(parentSignal.reason);
259
+ parentSignal.addEventListener("abort", onAbort, { once: true });
260
+ cleanups.push(() => parentSignal.removeEventListener("abort", onAbort));
261
+ }
260
262
  }
261
263
  if (deadlineMs !== void 0) {
262
264
  const ms = deadlineMs;
@@ -286,8 +288,7 @@ function computeBackoff(spec, attempt) {
286
288
  if (typeof spec === "function") return Math.max(0, spec(attempt));
287
289
  return Math.max(0, spec);
288
290
  }
289
- //#endregion
290
- //#region src/conversation/turn-id.ts
291
+ // src/conversation/turn-id.ts
291
292
  /**
292
293
  *
293
294
  * Deterministic turn identifier. Stable across retries of the same logical
@@ -313,8 +314,7 @@ function turnId(runId, index, speaker) {
313
314
  function slugifySpeaker(speaker) {
314
315
  return speaker.normalize("NFKD").replace(/[^\w-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").toLowerCase() || "anon";
315
316
  }
316
- //#endregion
317
- //#region src/conversation/run-conversation.ts
317
+ // src/conversation/run-conversation.ts
318
318
  /** Run a conversation to completion and return its terminal result. */
319
319
  async function runConversation(conversation, options) {
320
320
  let result;
@@ -755,8 +755,7 @@ function passingReadiness(taskId) {
755
755
  reason: "conversation-mode: readiness gating not applied per-turn"
756
756
  };
757
757
  }
758
- //#endregion
759
- //#region src/conversation/conversation-backend.ts
758
+ // src/conversation/conversation-backend.ts
760
759
  /**
761
760
  *
762
761
  * Wrap a `Conversation` so it satisfies `AgentExecutionBackend`. The result is
@@ -881,8 +880,7 @@ function describeHalt(halt) {
881
880
  case "participant_error": return `participant_error[${halt.participant}]: ${halt.message}`;
882
881
  }
883
882
  }
884
- //#endregion
885
- //#region src/conversation/define-conversation.ts
883
+ // src/conversation/define-conversation.ts
886
884
  /**
887
885
  *
888
886
  * Declarative constructor for a multi-agent `Conversation`. Validates inputs
@@ -918,8 +916,7 @@ function normalizePolicy(policy, participantCount) {
918
916
  turnOrder
919
917
  };
920
918
  }
921
- //#endregion
922
- //#region src/conversation/run-persona.ts
919
+ // src/conversation/run-persona.ts
923
920
  /** Adapt one exact profile + Runtime executor into the conversation stream protocol. */
924
921
  function profileRuntimeBackend(profile, factory, counter) {
925
922
  const backend = createProfileExecutionBackend({
@@ -1047,8 +1044,7 @@ function runPersonaDispatch(config) {
1047
1044
  return config.artifactOf(result.transcript, scenario);
1048
1045
  };
1049
1046
  }
1050
- //#endregion
1051
- //#region src/improvement/official-optimizers.ts
1047
+ // src/improvement/official-optimizers.ts
1052
1048
  const defaultMaxFindingsChars = 5e4;
1053
1049
  const pythonClientDocs = "https://github.com/tangle-network/agent-eval/tree/main/clients/python";
1054
1050
  const bridgeInstall = "`python -m pip install \"agent-eval-rpc==0.145.0\"`";
@@ -1104,7 +1100,7 @@ function officialOptimizer(optimizer, options, create) {
1104
1100
  describeArtifact,
1105
1101
  authorizeSensitiveCandidate
1106
1102
  });
1107
- return withMethodRuntimeControls(withDependencyHelp(optimizer, externalEvaluationRef, redactor, redactionPolicyRef, create({
1103
+ const method = withDependencyHelp(optimizer, externalEvaluationRef, redactor, redactionPolicyRef, create({
1108
1104
  ...config,
1109
1105
  objective,
1110
1106
  evaluationId: externalEvaluationRef,
@@ -1119,7 +1115,8 @@ function officialOptimizer(optimizer, options, create) {
1119
1115
  }),
1120
1116
  ...describeScenario ? { describeScenario: (scenario) => redactOptimizerEvidence(label, "scenario descriptor", describeScenario(scenario), redactor) } : {},
1121
1117
  ...describeArtifact ? { describeArtifact: (artifact, scenario) => redactOptimizerEvidence(label, "artifact descriptor", describeArtifact(artifact, scenario), redactor) } : {}
1122
- })), {
1118
+ }));
1119
+ return withMethodRuntimeControls(method, {
1123
1120
  costAttribution: "optimizer-run",
1124
1121
  validateCandidate: (input) => assertSafeOptimizerCandidate(label, input, authorizeSensitiveCandidate)
1125
1122
  });
@@ -1330,8 +1327,7 @@ function isMissingDependency(optimizer, cause) {
1330
1327
  ];
1331
1328
  return [...common, ...specific].some((fragment) => message.includes(fragment));
1332
1329
  }
1333
- //#endregion
1334
- //#region src/improvement/profile-improvement-harness.ts
1330
+ // src/improvement/profile-improvement-harness.ts
1335
1331
  /**
1336
1332
  * Bind one exact profile and executor into a repeatable self-improvement
1337
1333
  * harness. The returned `run` method remains generic over every existing
@@ -1373,8 +1369,7 @@ function createProfileImprovementHarness(options) {
1373
1369
  }
1374
1370
  });
1375
1371
  }
1376
- //#endregion
1377
- //#region src/improvement/reflective-generator.ts
1372
+ // src/improvement/reflective-generator.ts
1378
1373
  /**
1379
1374
  *
1380
1375
  * `reflectiveGenerator` — the cheap, no-sandbox `CandidateGenerator`. It drafts
@@ -1467,8 +1462,7 @@ function applyPatches(edits, cwd) {
1467
1462
  if (result.error) throw result.error;
1468
1463
  if (result.status !== 0) throw new Error(`reflectiveGenerator: patch batch failed: ${result.stderr.trim()}`);
1469
1464
  }
1470
- //#endregion
1471
- //#region src/improvement/reflective-profile-proposer.ts
1465
+ // src/improvement/reflective-profile-proposer.ts
1472
1466
  const OPERATOR = {
1473
1467
  draft: "OPERATOR: draft. Write a substantially different approach from the parent below, not an edit of it.",
1474
1468
  improve: "OPERATOR: improve. Edit the parent below to fix its dominant failure mode; keep what already works.",
@@ -1644,8 +1638,7 @@ function surfaceOf(value, shape, maxChars) {
1644
1638
  function defaultEvidence(parent) {
1645
1639
  return parent.trainCells.map((cell) => `- train unit ${cell.unitId}: score ${cell.score}`);
1646
1640
  }
1647
- //#endregion
1648
- //#region src/knowledge/activation.ts
1641
+ // src/knowledge/activation.ts
1649
1642
  /** Apply or restore one local knowledge candidate through the shared activation contract. */
1650
1643
  function createKnowledgeImprovementActivationExecutor(options) {
1651
1644
  if (!options.identity.trim()) throw new Error("knowledge activation identity is required");
@@ -1820,8 +1813,7 @@ function completionTime(transition, now) {
1820
1813
  const completedAt = (now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
1821
1814
  return Date.parse(completedAt) < Date.parse(transition.attemptedAt) ? transition.attemptedAt : completedAt;
1822
1815
  }
1823
- //#endregion
1824
- //#region src/knowledge/supervised-update.ts
1816
+ // src/knowledge/supervised-update.ts
1825
1817
  /** Build the completion check a supervised KB update uses to stop only when the KB is ready. */
1826
1818
  function knowledgeReadinessDeliverable(options) {
1827
1819
  return {
@@ -1886,8 +1878,7 @@ function formatSupervisedKnowledgeTask(options) {
1886
1878
  options.metadata && Object.keys(options.metadata).length > 0 ? `Metadata:\n${JSON.stringify(options.metadata, null, 2)}` : void 0
1887
1879
  ].filter((section) => Boolean(section)).join("\n\n")}\n\nUpdate files under the knowledge base root only. Stop when the readiness check passes.`;
1888
1880
  }
1889
- //#endregion
1890
- //#region src/knowledge/improvement-job.ts
1881
+ // src/knowledge/improvement-job.ts
1891
1882
  /** Build the default readiness check backed by `@tangle-network/agent-knowledge` validation and scoring. */
1892
1883
  function createAgentKnowledgeReadinessCheck(options) {
1893
1884
  return async (input) => {
@@ -2052,8 +2043,7 @@ function addSpent(target, result) {
2052
2043
  target.usd += spent.usd;
2053
2044
  target.ms += spent.ms;
2054
2045
  }
2055
- //#endregion
2056
- //#region src/model-resolution.ts
2046
+ // src/model-resolution.ts
2057
2047
  /** Default Tangle Router base URL used when no env override is set. */
2058
2048
  const DEFAULT_ROUTER_BASE_URL = "https://router.tangle.tools";
2059
2049
  /** Resolve the router base URL from env, normalised — no trailing `/v1` or `/`. */
@@ -2147,8 +2137,7 @@ async function validateChatModelId(modelId, options = {}) {
2147
2137
  value: cleaned
2148
2138
  };
2149
2139
  }
2150
- //#endregion
2151
- //#region src/readiness.ts
2140
+ // src/readiness.ts
2152
2141
  const DEFAULT_MINIMUM_READINESS_SCORE = .7;
2153
2142
  /**
2154
2143
  * Map a `KnowledgeReadinessReport` to a three-state branch (`ready` / `blocked` / `caveat`) the runtime, route handlers, and UI shells all switch on.
@@ -2191,8 +2180,7 @@ function decideKnowledgeReadiness(report, options = {}) {
2191
2180
  nonBlockingGapIds
2192
2181
  };
2193
2182
  }
2194
- //#endregion
2195
- //#region src/run.ts
2183
+ // src/run.ts
2196
2184
  /**
2197
2185
  *
2198
2186
  * The two top-level entry points:
@@ -2670,8 +2658,7 @@ function toAgentContext(task, knowledge, ctx) {
2670
2658
  abortSignal: ctx.abortSignal
2671
2659
  };
2672
2660
  }
2673
- //#endregion
2674
- //#region src/runtime/isolated-check-result.ts
2661
+ // src/runtime/isolated-check-result.ts
2675
2662
  /** Decode the existing execution contract without widening or reinterpreting its evidence. */
2676
2663
  const isolatedCheckBoxEvidenceSchema = z.object({
2677
2664
  sandboxId: z.string().min(1),
@@ -2711,8 +2698,7 @@ const isolatedCheckResultSchema = z.discriminatedUnion("succeeded", [z.object({
2711
2698
  cleanupDiagnostic: z.string().optional(),
2712
2699
  box: isolatedCheckBoxEvidenceSchema.optional()
2713
2700
  }).strict()]);
2714
- //#endregion
2715
- //#region src/runtime-run.ts
2701
+ // src/runtime-run.ts
2716
2702
  /**
2717
2703
  *
2718
2704
  * Production-run lifecycle: record what the agent did on behalf of a customer,
@@ -2838,8 +2824,7 @@ function mergeMetadata(base, extra) {
2838
2824
  function randomSuffix() {
2839
2825
  return Math.random().toString(36).slice(2, 10);
2840
2826
  }
2841
- //#endregion
2842
- //#region src/sse.ts
2827
+ // src/sse.ts
2843
2828
  /** @stable */
2844
2829
  function encodeServerSentEvent(data, options = {}) {
2845
2830
  const lines = [];
@@ -2874,7 +2859,6 @@ function runtimeStreamServerSentEvent(event, options = {}) {
2874
2859
  function stripNewlines(value) {
2875
2860
  return value.replace(/[\r\n]/g, " ");
2876
2861
  }
2877
- //#endregion
2878
2862
  export { AgentEvalError, BackendTransportError, ConfigError, DEFAULT_ROUTER_BASE_URL, InMemoryRuntimeSessionStore, JudgeError, NotFoundError, ROUTER_PRICE_SOURCE, SearchEnvironmentFault, ValidationError, agenticGenerator, auditLoopRunner, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, cleanModelId, commandVerifier, composeRuntimeHooks, createCommandProfileTrainer, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOtelExporter, createProfileExecutionBackend, createProfileImprovementHarness, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, decideKnowledgeReadiness, decideSearchImprovement, dedicatedLane, defineRuntimeHooks, getModels, improve, isolatedCheckBoxEvidenceSchema, isolatedCheckResultSchema, loopEventToOtelSpan, officialGepa, officialSkillOpt, optimizerMethod, padSpanId, padTraceId, priceTokens, readinessServerSentEvent, reflectiveGenerator, reflectiveProfileProposer, resolveChatModel, resolveRouterBaseUrl, routerLane, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runKnowledgeImprovementJob, runPersonaConversation, runPersonaDispatch, runtimeStreamServerSentEvent, sanitizeKnowledgeReadinessReport, searchMethod, sharedBoxLane, startRuntimeRun, subscriptionLane, validateChatModelId };
2879
2863
 
2880
2864
  //# sourceMappingURL=index.js.map