@tangle-network/agent-runtime 0.105.0 → 0.106.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 (218) hide show
  1. package/README.md +2 -2
  2. package/dist/activation-CRjVfOiy.js +203 -0
  3. package/dist/activation-CRjVfOiy.js.map +1 -0
  4. package/dist/activation-DyWB0K6E.d.ts +98 -0
  5. package/dist/agent.d.ts +216 -234
  6. package/dist/agent.js +615 -547
  7. package/dist/agent.js.map +1 -1
  8. package/dist/analyst-loop-DGdtVENg.js +517 -0
  9. package/dist/analyst-loop-DGdtVENg.js.map +1 -0
  10. package/dist/analyst-loop.d.ts +10 -43
  11. package/dist/analyst-loop.js +2 -11
  12. package/dist/backends-CiOCyRHb.js +743 -0
  13. package/dist/backends-CiOCyRHb.js.map +1 -0
  14. package/dist/candidate-execution/index.d.ts +4 -192
  15. package/dist/candidate-execution/index.js +5 -66
  16. package/dist/candidate-execution-DqMbv1rU.js +488 -0
  17. package/dist/candidate-execution-DqMbv1rU.js.map +1 -0
  18. package/dist/coder-yhVWbdWc.js +40 -0
  19. package/dist/coder-yhVWbdWc.js.map +1 -0
  20. package/dist/conversation-BpLQZGPH.js +1265 -0
  21. package/dist/conversation-BpLQZGPH.js.map +1 -0
  22. package/dist/conversation.d.ts +2 -804
  23. package/dist/conversation.js +2 -55
  24. package/dist/environment-provider-CfLUmKmf.js +1168 -0
  25. package/dist/environment-provider-CfLUmKmf.js.map +1 -0
  26. package/dist/environment-provider-IUGU3epE.d.ts +964 -0
  27. package/dist/environment-provider.d.ts +2 -78
  28. package/dist/environment-provider.js +2 -18
  29. package/dist/errors-DEAvWQPy.js +111 -0
  30. package/dist/errors-DEAvWQPy.js.map +1 -0
  31. package/dist/improvement-adapter-Cr5TBSji.d.ts +166 -0
  32. package/dist/improvement-cycle-C095kS_g.js +2624 -0
  33. package/dist/improvement-cycle-C095kS_g.js.map +1 -0
  34. package/dist/index-BGdxAwfO.d.ts +838 -0
  35. package/dist/index-C-FYUuFG.d.ts +193 -0
  36. package/dist/index-CbNM40xG.d.ts +140 -0
  37. package/dist/index-DruSKs3Z.d.ts +7224 -0
  38. package/dist/index-Efjb3nrQ.d.ts +671 -0
  39. package/dist/index.d.ts +14 -1058
  40. package/dist/index.js +2106 -2082
  41. package/dist/index.js.map +1 -1
  42. package/dist/intelligence.d.ts +768 -889
  43. package/dist/intelligence.js +1466 -1367
  44. package/dist/intelligence.js.map +1 -1
  45. package/dist/{kb-gate-CwHO0vz6.d.ts → kb-gate-C8z2juK8.d.ts} +33 -31
  46. package/dist/kb-gate-DpaSwXVx.js +80 -0
  47. package/dist/kb-gate-DpaSwXVx.js.map +1 -0
  48. package/dist/knowledge-Ku-mPP4f.js +433 -0
  49. package/dist/knowledge-Ku-mPP4f.js.map +1 -0
  50. package/dist/knowledge.d.ts +2 -150
  51. package/dist/knowledge.js +2 -40
  52. package/dist/local-harness-Dh8PJ0ot.d.ts +455 -0
  53. package/dist/loop-runner-bin-BXsFEUcf.d.ts +162 -0
  54. package/dist/loop-runner-bin-CRagyuNb.js +268 -0
  55. package/dist/loop-runner-bin-CRagyuNb.js.map +1 -0
  56. package/dist/loop-runner-bin.d.ts +2 -15
  57. package/dist/loop-runner-bin.js +2 -24
  58. package/dist/loops.d.ts +5 -4164
  59. package/dist/loops.js +8 -419
  60. package/dist/mcp/bin.d.ts +1 -1
  61. package/dist/mcp/bin.js +116 -146
  62. package/dist/mcp/bin.js.map +1 -1
  63. package/dist/mcp/index.d.ts +295 -436
  64. package/dist/mcp/index.js +1242 -1177
  65. package/dist/mcp/index.js.map +1 -1
  66. package/dist/mcp/memory-bin.d.ts +1 -1
  67. package/dist/mcp/memory-bin.js +37 -16
  68. package/dist/mcp/memory-bin.js.map +1 -1
  69. package/dist/memory-server-DL6cE2Ag.js +234 -0
  70. package/dist/memory-server-DL6cE2Ag.js.map +1 -0
  71. package/dist/model-resolution-Btd9iIKV.js +98 -0
  72. package/dist/model-resolution-Btd9iIKV.js.map +1 -0
  73. package/dist/openai-tools-B68JaOCx.d.ts +24 -0
  74. package/dist/openai-tools-CKLy1C7M.js +44 -0
  75. package/dist/openai-tools-CKLy1C7M.js.map +1 -0
  76. package/dist/otel-export-D34IQW1C.js +843 -0
  77. package/dist/otel-export-D34IQW1C.js.map +1 -0
  78. package/dist/platform.d.ts +188 -185
  79. package/dist/platform.js +185 -218
  80. package/dist/platform.js.map +1 -1
  81. package/dist/prepare-B53sPV7M.js +4292 -0
  82. package/dist/prepare-B53sPV7M.js.map +1 -0
  83. package/dist/primeintellect/index.d.ts +149 -145
  84. package/dist/primeintellect/index.js +626 -1003
  85. package/dist/primeintellect/index.js.map +1 -1
  86. package/dist/profiles.d.ts +296 -490
  87. package/dist/profiles.js +722 -749
  88. package/dist/profiles.js.map +1 -1
  89. package/dist/protected-model-port-BLPH5VVv.js +722 -0
  90. package/dist/protected-model-port-BLPH5VVv.js.map +1 -0
  91. package/dist/protected-model-port-BP6Z4eau.d.ts +283 -0
  92. package/dist/protected-redaction--F3v1oo8.js +200 -0
  93. package/dist/protected-redaction--F3v1oo8.js.map +1 -0
  94. package/dist/redact-D-u-rrcn.js +82 -0
  95. package/dist/redact-D-u-rrcn.js.map +1 -0
  96. package/dist/redact-kbIOjfjM.d.ts +452 -0
  97. package/dist/researcher-CoVqNhfI.js +433 -0
  98. package/dist/researcher-CoVqNhfI.js.map +1 -0
  99. package/dist/runtime-5zM5XxLr.js +5408 -0
  100. package/dist/runtime-5zM5XxLr.js.map +1 -0
  101. package/dist/sandbox-events-DeI5xX8P.js +316 -0
  102. package/dist/sandbox-events-DeI5xX8P.js.map +1 -0
  103. package/dist/spawn-journal-CwPvKUTa.js +456 -0
  104. package/dist/spawn-journal-CwPvKUTa.js.map +1 -0
  105. package/dist/structural-rollout-IXUEplky.js +1445 -0
  106. package/dist/structural-rollout-IXUEplky.js.map +1 -0
  107. package/dist/substrate-B0TYNrXn.js +27 -0
  108. package/dist/substrate-B0TYNrXn.js.map +1 -0
  109. package/dist/{substrate-Dyiqmd3o.d.ts → substrate-BcnuSHXm.d.ts} +57 -54
  110. package/dist/supervise-BiRutHS9.js +7321 -0
  111. package/dist/supervise-BiRutHS9.js.map +1 -0
  112. package/dist/supervisor-DTKhF-RV.js +3826 -0
  113. package/dist/supervisor-DTKhF-RV.js.map +1 -0
  114. package/dist/testing.d.ts +4 -3
  115. package/dist/testing.js +2478 -2637
  116. package/dist/testing.js.map +1 -1
  117. package/dist/tool-server-RcWgLIsL.js +141 -0
  118. package/dist/tool-server-RcWgLIsL.js.map +1 -0
  119. package/dist/trace-propagation-CJJC7SVB.js +57 -0
  120. package/dist/trace-propagation-CJJC7SVB.js.map +1 -0
  121. package/dist/types-BaIpb0XT.d.ts +492 -0
  122. package/dist/types-BevOjfTY.d.ts +765 -0
  123. package/dist/types-C9j4qg6l.d.ts +500 -0
  124. package/dist/types-Cja5OTGh.d.ts +190 -0
  125. package/dist/util-MVgdwuIS.js +145 -0
  126. package/dist/util-MVgdwuIS.js.map +1 -0
  127. package/dist/workspace-archive-BosQiotA.js +575 -0
  128. package/dist/workspace-archive-BosQiotA.js.map +1 -0
  129. package/package.json +44 -56
  130. package/skills/build-with-agent-runtime/SKILL.md +1 -0
  131. package/dist/activation-Cm-9MMX1.d.ts +0 -69
  132. package/dist/analyst-loop.js.map +0 -1
  133. package/dist/backends-BO4Jqoe2.d.ts +0 -134
  134. package/dist/candidate-execution/index.js.map +0 -1
  135. package/dist/chunk-2KGAN2HM.js +0 -1256
  136. package/dist/chunk-2KGAN2HM.js.map +0 -1
  137. package/dist/chunk-2VZYRB55.js +0 -834
  138. package/dist/chunk-2VZYRB55.js.map +0 -1
  139. package/dist/chunk-3MDZX7YU.js +0 -125
  140. package/dist/chunk-3MDZX7YU.js.map +0 -1
  141. package/dist/chunk-5IBQAPVB.js +0 -29
  142. package/dist/chunk-5IBQAPVB.js.map +0 -1
  143. package/dist/chunk-5QOB7H74.js +0 -387
  144. package/dist/chunk-5QOB7H74.js.map +0 -1
  145. package/dist/chunk-C5RTIBNZ.js +0 -48
  146. package/dist/chunk-C5RTIBNZ.js.map +0 -1
  147. package/dist/chunk-CTRA64LY.js +0 -680
  148. package/dist/chunk-CTRA64LY.js.map +0 -1
  149. package/dist/chunk-DPEUKJRO.js +0 -27
  150. package/dist/chunk-DPEUKJRO.js.map +0 -1
  151. package/dist/chunk-FD2MBMOH.js +0 -494
  152. package/dist/chunk-FD2MBMOH.js.map +0 -1
  153. package/dist/chunk-H5QPIZNX.js +0 -907
  154. package/dist/chunk-H5QPIZNX.js.map +0 -1
  155. package/dist/chunk-HLKC4UYB.js +0 -3514
  156. package/dist/chunk-HLKC4UYB.js.map +0 -1
  157. package/dist/chunk-HNP72PNU.js +0 -192
  158. package/dist/chunk-HNP72PNU.js.map +0 -1
  159. package/dist/chunk-ISPWRSEC.js +0 -408
  160. package/dist/chunk-ISPWRSEC.js.map +0 -1
  161. package/dist/chunk-KRBFHMV6.js +0 -1228
  162. package/dist/chunk-KRBFHMV6.js.map +0 -1
  163. package/dist/chunk-M22PL4GH.js +0 -171
  164. package/dist/chunk-M22PL4GH.js.map +0 -1
  165. package/dist/chunk-NURIQBJQ.js +0 -72
  166. package/dist/chunk-NURIQBJQ.js.map +0 -1
  167. package/dist/chunk-OPVWXJ2H.js +0 -75
  168. package/dist/chunk-OPVWXJ2H.js.map +0 -1
  169. package/dist/chunk-PZZKQVQV.js +0 -52
  170. package/dist/chunk-PZZKQVQV.js.map +0 -1
  171. package/dist/chunk-Q2JSAVQ3.js +0 -671
  172. package/dist/chunk-Q2JSAVQ3.js.map +0 -1
  173. package/dist/chunk-RDOAVVHY.js +0 -699
  174. package/dist/chunk-RDOAVVHY.js.map +0 -1
  175. package/dist/chunk-SGKPNBXE.js +0 -60
  176. package/dist/chunk-SGKPNBXE.js.map +0 -1
  177. package/dist/chunk-SMQXZGLZ.js +0 -351
  178. package/dist/chunk-SMQXZGLZ.js.map +0 -1
  179. package/dist/chunk-UHEZW5BU.js +0 -2918
  180. package/dist/chunk-UHEZW5BU.js.map +0 -1
  181. package/dist/chunk-UPWGXKXB.js +0 -254
  182. package/dist/chunk-UPWGXKXB.js.map +0 -1
  183. package/dist/chunk-VISA6CI3.js +0 -200
  184. package/dist/chunk-VISA6CI3.js.map +0 -1
  185. package/dist/chunk-WMTCUOQL.js +0 -474
  186. package/dist/chunk-WMTCUOQL.js.map +0 -1
  187. package/dist/chunk-WRTOVNN4.js +0 -4728
  188. package/dist/chunk-WRTOVNN4.js.map +0 -1
  189. package/dist/chunk-WSTRQZYQ.js +0 -5576
  190. package/dist/chunk-WSTRQZYQ.js.map +0 -1
  191. package/dist/chunk-XBG2W2VW.js +0 -6434
  192. package/dist/chunk-XBG2W2VW.js.map +0 -1
  193. package/dist/chunk-YEJR7IXO.js +0 -68
  194. package/dist/chunk-YEJR7IXO.js.map +0 -1
  195. package/dist/chunk-YJZA2BIK.js +0 -1338
  196. package/dist/chunk-YJZA2BIK.js.map +0 -1
  197. package/dist/completion-gate-BMy5LGoP.d.ts +0 -256
  198. package/dist/conversation.js.map +0 -1
  199. package/dist/coordination-BZZSVYpZ.d.ts +0 -2570
  200. package/dist/environment-provider.js.map +0 -1
  201. package/dist/improvement-adapter-HAZz-7vK.d.ts +0 -203
  202. package/dist/knowledge.js.map +0 -1
  203. package/dist/local-harness-BDNcl6jI.d.ts +0 -175
  204. package/dist/loop-runner-bin-68aoM9-7.d.ts +0 -199
  205. package/dist/loop-runner-bin.js.map +0 -1
  206. package/dist/loops.js.map +0 -1
  207. package/dist/openai-tools-fnj6SRVg.d.ts +0 -46
  208. package/dist/protected-model-port-B4t-OQjL.d.ts +0 -271
  209. package/dist/redact-BuFjxBUJ.d.ts +0 -481
  210. package/dist/sanitize-DEbPNtyI.d.ts +0 -328
  211. package/dist/structural-rollout-DEh6CEsa.d.ts +0 -446
  212. package/dist/supervise-4_48wwvy.d.ts +0 -379
  213. package/dist/types-BCoemcXU.d.ts +0 -802
  214. package/dist/types-BwoZWq-i.d.ts +0 -510
  215. package/dist/types-Cbp72qyu.d.ts +0 -491
  216. package/dist/types-CmYCMbFT.d.ts +0 -203
  217. package/dist/types-CvNwMzQt.d.ts +0 -957
  218. package/dist/worktree-fanout-DxhAWr5Z.d.ts +0 -999
package/dist/index.d.ts CHANGED
@@ -1,1058 +1,14 @@
1
- import { AgentEvalError, AnalystFinding, ConfigError, KnowledgeReadinessReport, RunRecord, ControlEvalResult } from '@tangle-network/agent-eval';
2
- export { AgentEvalError, AgentEvalErrorCode, ConfigError, ControlBudget, ControlDecision, ControlEvalResult, ControlRunResult, ControlStep, DataAcquisitionPlan, JudgeError, KnowledgeReadinessReport, KnowledgeRequirement, NotFoundError, RunRecord, ValidationError } from '@tangle-network/agent-eval';
3
- import { c as createOpenAICompatibleBackend } from './backends-BO4Jqoe2.js';
4
- export { a as createIterableBackend, b as createSandboxPromptBackend } from './backends-BO4Jqoe2.js';
5
- export { AGENT_CANDIDATE_EXECUTION_SUPPORT, AgentCandidateBundleInput, AgentCandidateCodeSource, AgentCandidateCodeSurfaceSource, AgentCandidateProfileSource, AgentCandidateWorkspaceArchiveLimits, BuildAgentCandidateBundleInput, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, CANDIDATE_KNOWLEDGE_ROOT_ENV, CaptureAgentCandidateWorkspaceOptions, CapturedAgentCandidateWorkspace, CreateAgentCandidateWorkspacePortOptions, DisposePreparedAgentCandidateOptions, ExactProcessCandidateExecutorOptions, FileAgentCandidateExecutionClaimStore, FileAgentCandidateExecutionClaimStoreOptions, RecoverExpiredAgentCandidateOptions, buildAgentCandidateBundle, candidateExecutionClaim, candidateKnowledgeExecutionPaths, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, createAgentCandidateWorkspacePort, disposePreparedAgentCandidateExecution, exactProcessProviderAsCandidateExecutor, persistCandidateOutputArtifact, recoverExpiredAgentCandidateExecution, sealAgentCandidateBundle, verifyAgentCandidateBundle } from './candidate-execution/index.js';
6
- export { a as AgentCandidateExecutionAttemptRecord, b as AgentCandidateExecutionAttemptRef, c as AgentCandidateExecutionClaim, d as AgentCandidateExecutionClaimResult, A as AgentCandidateExecutionClaimStore, e as AgentCandidateExecutionCleanupHandles, f as AgentCandidateExecutionFailureClass, g as AgentCandidateExecutionFinishResult, h as AgentCandidateExecutionLease, i as AgentCandidateExecutionPhase, j as AgentCandidateExecutionPhaseResult, k as AgentCandidateExecutionRecoveryEvidence, l as AgentCandidateExecutionStageResult, m as AgentCandidateExecutionTerminalRecord, n as AgentCandidateExecutionTerminalResult, o as AgentCandidateModelGrantActivateInput, q as AgentCandidateModelGrantClient, r as AgentCandidateModelGrantReservation, s as AgentCandidateModelGrantReserveInput, t as AgentCandidateModelGrantSettleInput, u as AgentCandidatePreparationEvidence, v as AgentCandidateRetryRejection, C as CreateProtectedAgentCandidateModelPortOptions, E as ExecutePreparedAgentCandidateOptions, I as InMemoryAgentCandidateExecutionClaimStore, P as PrepareAgentCandidateExecutionOptions, w as applyExactAgentProfileDiff, x as assertCandidateProfileBinding, y as createProtectedAgentCandidateModelPort, z as executePreparedAgentCandidate, B as parseExactAgentProfile, D as parseExactAgentProfileDiff, F as prepareAgentCandidateExecution } from './protected-model-port-B4t-OQjL.js';
7
- export { j as AgentCandidateArtifactPort, a as AgentCandidateBenchmarkGraderPort, k as AgentCandidateContainerPort, e as AgentCandidateExecutionPorts, l as AgentCandidateExecutorFinalCapture, m as AgentCandidateExecutorMemoryCapture, A as AgentCandidateExecutorPort, n as AgentCandidateExecutorProfileFile, o as AgentCandidateExecutorRequest, p as AgentCandidateExecutorStopRequest, q as AgentCandidateExecutorTaskOutcomeCapture, r as AgentCandidateExecutorWorkspaceFile, s as AgentCandidateExecutorWorkspaceInput, t as AgentCandidateMemoryPort, u as AgentCandidateMemoryResetResult, v as AgentCandidateModelLimits, f as AgentCandidateModelPort, b as AgentCandidateOutputArtifactPort, w as AgentCandidateOutputPurpose, h as AgentCandidateProtectedModelActivation, g as AgentCandidateProtectedModelReservation, i as AgentCandidateProtectedModelSettlement, x as AgentCandidateProtectedRunCapture, y as AgentCandidateRepositoryPort, c as AgentCandidateRunFinalization, d as AgentCandidateTaskExecution, z as AgentCandidateVerificationPorts, B as AgentCandidateWorkspacePort, C as CANDIDATE_TRACE_ENV, D as CANDIDATE_TRACE_TAGS, E as CanonicalCandidateDocument, P as PreparedAgentCandidateExecution, F as PreparedAgentCandidateInstruction, G as PreparedAgentCandidateKnowledge, H as PreparedAgentCandidateLaunch, I as PreparedAgentCandidateTrace, R as ResolvedAgentCandidateContainer, V as VerifiedAgentCandidate, J as VerifiedAgentCandidateTaskOutcome } from './types-Cbp72qyu.js';
8
- export { AuthSource, BackendCallPolicy, CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, Conversation, ConversationDriveState, ConversationJournal, ConversationJournalEntry, ConversationParticipant, ConversationPolicy, ConversationResult, ConversationStreamEvent, ConversationTurn, D1DatabaseLike, D1StmtLike, DEFAULT_MAX_DEPTH, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, ForwardHeaderName, HaltContext, HaltPredicate, HaltReason, HaltSignal, InMemoryConversationJournal, PersonaConversationResult, PersonaDriver, PropagatedHeaders, RetryBackoff, RetryableErrorPredicate, RunConversationOptions, RunPersonaConfig, RunPersonaConversationOptions, SqlAdapter, SqlConversationJournal, TurnOrder, buildForwardHeaders, computeBackoff, createConversationBackend, d1ToSqlAdapter, defaultIsRetryable, defineConversation, isDepthExceeded, makePerAttemptSignal, readDepth, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, sleep, slugifySpeaker, turnId } from './conversation.js';
9
- import { V as Verifier, C as CandidateGenerator, c as ImproveMethodOptions, b as ImproveMethodResult, e as ImproveCodeRunOptions, f as ImproveCodeResult, R as Redactor, g as ImproveCandidateValidationInput, h as ImproveMethodFactory, i as ReadonlyAgentProfile } from './redact-BuFjxBUJ.js';
10
- export { A as AGENTIC_PROFILE_RESOURCE_ROOT, j as AgenticGeneratorOptions, k as AgenticGeneratorShotDisposition, l as AgenticGeneratorShotExecution, m as AgenticGeneratorShotReceipt, D as DeepReadonly, n as ImproveCandidateValidator, o as ImproveCodeOptions, p as ImproveCost, q as ImproveLineage, s as ImproveMethodContext, t as ImproveMethodSource, u as ImproveOptimizationRunOptions, I as ImproveOptions, v as ImproveProfileAgent, w as ImproveProfileComponents, x as ImproveProfileSurface, a as ImproveResult, y as ImproveSkillsOptions, z as ImproveSurface, B as ImprovementCandidate, E as ImprovementCodeCandidate, F as ImprovementProfileCandidate, G as VerifyResult, H as agenticGenerator, J as commandVerifier, K as defaultBuildPrompt } from './redact-BuFjxBUJ.js';
11
- import { L as LocalHarness, r as runLocalHarness } from './local-harness-BDNcl6jI.js';
12
- import { T as ToolLoopChat, c as RuntimeTelemetryOptions } from './sanitize-DEbPNtyI.js';
13
- export { d as RuntimeEventCollector, e as RuntimeStreamEventCollector, S as SanitizedKnowledgeReadinessReport, f as createRuntimeEventCollector, g as createRuntimeStreamEventCollector, s as sanitizeAgentRuntimeEvent, h as sanitizeKnowledgeReadinessReport, i as sanitizeRuntimeStreamEvent } from './sanitize-DEbPNtyI.js';
14
- import { Scenario, SelfImproveOptions, MutableSurface } from '@tangle-network/agent-eval/contract';
15
- import { AgentProfile } from '@tangle-network/agent-interface';
16
- export { AgentCandidateBenchmarkGraderIdentity } from '@tangle-network/agent-interface';
17
- import { GepaOptimizationMethodConfig, SkillOptOptimizationMethodConfig } from '@tangle-network/agent-eval/campaign';
18
- import { S as SurfaceImprovementEdit } from './improvement-adapter-HAZz-7vK.js';
19
- import { I as ImprovementProposalSource } from './types-CmYCMbFT.js';
20
- import { S as StructuralRolloutPolicy } from './structural-rollout-DEh6CEsa.js';
21
- export { AgentKnowledgeReadinessCheckOptions, CreateKnowledgeImprovementActivationExecutorOptions, KnowledgeImprovementActivationExecutor, KnowledgeImprovementCandidatePair, KnowledgeImprovementExperimentBundles, KnowledgeImprovementJobMeasurement, KnowledgeImprovementJobResult, KnowledgeReadinessCheck, KnowledgeReadinessCheckInput, KnowledgeReadinessCheckResult, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, RunKnowledgeImprovementJobOptions, SupervisedKnowledgeUpdateInput, SupervisedKnowledgeUpdateOptions, SupervisedKnowledgeUpdateResult, SupervisedKnowledgeUpdater, buildKnowledgeImprovementExperimentBundles, createAgentKnowledgeReadinessCheck, createKnowledgeImprovementActivationExecutor, createSupervisedKnowledgeUpdater, formatSupervisedKnowledgeTask, knowledgeReadinessDeliverable, runKnowledgeImprovementJob, runSupervisedKnowledgeUpdate } from './knowledge.js';
22
- export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, w as worktreeLoopRunner } from './loop-runner-bin-68aoM9-7.js';
23
- export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-fnj6SRVg.js';
24
- export { b1 as EvalRunEvent, b2 as EvalRunGeneration, b3 as EvalRunsExportConfig, b4 as EvalRunsExportResult, b5 as INTELLIGENCE_WIRE_VERSION, b6 as LoopSpanNode, b7 as OtelAttribute, b8 as OtelExportConfig, b9 as OtelExporter, ba as OtelSpan, bb as RuntimeEventOtelOptions, bc as buildLoopOtelSpans, bd as buildLoopSpanNodes, be as buildRuntimeEventOtelSpans, bf as createOtelExporter, bg as exportEvalRuns, bh as loopEventToOtelSpan } from './coordination-BZZSVYpZ.js';
25
- import { K as KnowledgeReadinessDecision, A as AgentBackendInput, c as AgentExecutionBackend, h as RunAgentTaskOptions, i as AgentTaskRunResult, j as RunAgentTaskStreamOptions, R as RuntimeStreamEvent, k as RuntimeSessionStore, l as RuntimeSession } from './types-BwoZWq-i.js';
26
- export { m as AgentAdapter, d as AgentBackendContext, n as AgentKnowledgeProvider, e as AgentRuntimeEvent, o as AgentRuntimeEventSink, p as AgentTaskContext, g as AgentTaskSpec, f as AgentTaskStatus, B as BackendErrorDetail, b as OpenAIChatResponseFormat, O as OpenAIChatTool, a as OpenAIChatToolChoice } from './types-BwoZWq-i.js';
27
- import { R as RuntimeHooks } from './types-BCoemcXU.js';
28
- export { d as RuntimeDecisionEvidenceRef, e as RuntimeDecisionKind, f as RuntimeDecisionPoint, g as RuntimeHookContext, h as RuntimeHookErrorContext, i as RuntimeHookEvent, j as RuntimeHookPhase, k as RuntimeHookTarget, l as RuntimeRunHandle, m as RuntimeRunPersistenceAdapter, n as RuntimeRunRow, o as composeRuntimeHooks, p as defineRuntimeHooks, q as notifyRuntimeDecisionPoint, r as notifyRuntimeHookEvent, s as startRuntimeRun } from './types-BCoemcXU.js';
29
- import '@tangle-network/agent-interface/environment-provider';
30
- import 'node:child_process';
31
- import './worktree-fanout-DxhAWr5Z.js';
32
- import './types-CvNwMzQt.js';
33
- import '@tangle-network/sandbox';
34
- import './completion-gate-BMy5LGoP.js';
35
- import '@tangle-network/agent-profile-materialize';
36
- import '@tangle-network/agent-knowledge';
37
- import './activation-Cm-9MMX1.js';
38
- import './supervise-4_48wwvy.js';
39
- import './kb-gate-CwHO0vz6.js';
40
- import './substrate-Dyiqmd3o.js';
41
- import './environment-provider.js';
42
-
43
- /**
44
- * `handleChatTurn` — framework-neutral chat-turn HTTP orchestrator.
45
- * Owns the NDJSON `ChatStreamEvent` line protocol, the `session.run.*`
46
- * lifecycle vocabulary, and the persist / post-process / trace-flush
47
- * hook order. Returns a `ReadableStream` body the product hands to its
48
- * platform `Response`.
49
- *
50
- * Execution durability is the substrate's concern: `box.streamPrompt`
51
- * auto-reconnects in-call; cross-process reconnect via `X-Execution-ID`
52
- * is the product's job. The producer this engine wraps already speaks
53
- * that protocol — the engine just frames the events.
54
- *
55
- * Hooks (`ChatTurnHooks`):
56
- * - `produce` — build the backend event stream
57
- * - `persistAssistantMessage` — write the assistant turn to the product DB
58
- * - `onTurnComplete?` — post-process (proposals, citations, …)
59
- * - `onEvent?` — per-event side channel (e.g. DO broadcast)
60
- * - `transformFinalText?` — pre-persist transform (e.g. PII redact)
61
- * - `traceFlush?` — handed to waitUntil so OTLP export lands
62
- *
63
- * Framework neutrality: takes already-resolved values (`identity` tuple,
64
- * a `waitUntil`), never a `Request` or a `Context`. The product's thin
65
- * route adapter does auth + parse + access-control, then calls
66
- * `handleChatTurn(...)` and returns `result.body` as its platform `Response`.
67
- */
68
- /** The NDJSON line protocol every product chat client already speaks. */
69
- interface ChatStreamEvent {
70
- type: string;
71
- data?: Record<string, unknown>;
72
- }
73
- /** Identity of a chat turn. `tenantId` is the workspace id for workspace-
74
- * scoped products and the user id for session-scoped products. */
75
- interface ChatTurnIdentity {
76
- tenantId: string;
77
- /** Thread / session id. */
78
- sessionId: string;
79
- userId: string;
80
- /** Monotonic 0-based turn index within the session. */
81
- turnIndex: number;
82
- }
83
- /** The live side of a turn — what the product's `produce` hook returns. */
84
- interface ChatTurnProducer<TEvent extends ChatStreamEvent = ChatStreamEvent> {
85
- /** The turn's event stream. Forwarded verbatim to the caller. */
86
- stream: AsyncGenerator<TEvent, void, unknown>;
87
- /** The turn's final assistant text. Read once, after `stream` drains. */
88
- finalText(): string;
89
- }
90
- interface ChatTurnHooks {
91
- /** Build the backend stream. The engine forwards events verbatim and
92
- * reads `finalText()` once the stream drains. */
93
- produce(): ChatTurnProducer;
94
- /** Persist the assistant message to the product's own store. Called
95
- * once, after drain, with the assembled (transform-applied) text. */
96
- persistAssistantMessage(input: {
97
- identity: ChatTurnIdentity;
98
- finalText: string;
99
- }): Promise<void>;
100
- /** Optional post-processing (proposals, citations, credit metering …).
101
- * Errors are swallowed + logged — post-process must never fail a turn
102
- * that already streamed successfully. */
103
- onTurnComplete?(input: {
104
- identity: ChatTurnIdentity;
105
- finalText: string;
106
- }): Promise<void>;
107
- /** Optional per-event side channel (e.g. DO broadcast). Runs for every
108
- * emitted event, lifecycle envelope included. Errors swallowed — a
109
- * broadcast failure must not break the chat stream. */
110
- onEvent?(event: ChatStreamEvent): void | Promise<void>;
111
- /** Optional pre-persist transform of the final text (e.g. PII
112
- * redaction). Affects only what is persisted; the live stream is
113
- * never altered. */
114
- transformFinalText?(text: string): string | Promise<string>;
115
- /** Optional trace flush — resolves when OTLP export completes. Handed
116
- * to `waitUntil` so the worker isolate stays alive for the POST. */
117
- traceFlush?(): Promise<void>;
118
- }
119
- interface RunChatTurnInput {
120
- identity: ChatTurnIdentity;
121
- hooks: ChatTurnHooks;
122
- /** Worker liveness hook. When omitted, trace flush is awaited inline
123
- * before the stream closes. */
124
- waitUntil?: (p: Promise<unknown>) => void;
125
- /** Structured logger for swallowed hook errors. Defaults to
126
- * `console.error` so failures surface without product wiring. */
127
- log?: (message: string, meta?: Record<string, unknown>) => void;
128
- }
129
- interface ChatTurnResult {
130
- /** NDJSON body — return this as the platform `Response` body. */
131
- body: ReadableStream<Uint8Array>;
132
- /** Content type for the response. */
133
- contentType: 'application/x-ndjson';
134
- }
135
- /**
136
- * Run one chat turn. Returns immediately with a `ReadableStream` body;
137
- * the turn executes as the body is pulled. Never rejects — backend
138
- * failures surface as `error` + `session.run.failed` events.
139
- */
140
- declare function handleChatTurn(input: RunChatTurnInput): ChatTurnResult;
141
-
142
- /**
143
- * Derive a stable executionId from the run identity. The same
144
- * `(projectId, sessionId, turnIndex)` tuple yields the same id — so a
145
- * client retry of the same turn lands on the same substrate execution
146
- * and the orchestrator's buffer replays instead of starting a second
147
- * prompt.
148
- *
149
- * Format is readable, not hashed: operators grepping orchestrator logs
150
- * for `gtm-agent:thread-abc:3` find the run without translating an
151
- * opaque id. Substrate executionIds are not a secrecy boundary.
152
- *
153
- * Wire integration:
154
- * - Sandbox PromptOptions accepts `executionId` and `lastEventId`.
155
- * Products pass this id to make cross-process reconnect land on the
156
- * same substrate execution instead of spawning a duplicate run.
157
- */
158
- declare function deriveExecutionId(input: {
159
- projectId: string;
160
- sessionId: string;
161
- turnIndex: number;
162
- }): string;
163
-
164
- /**
165
- *
166
- * Error taxonomy for `@tangle-network/agent-runtime`.
167
- *
168
- * Public contract: every error this package throws as part of its consumer-
169
- * facing API either extends `AgentEvalError` (re-exported here for ergonomic
170
- * `instanceof` checks at the runtime boundary) or extends one of the
171
- * runtime-specific subclasses below.
172
- *
173
- * Internal invariant guards (`throw new Error('this should never happen')`)
174
- * remain plain `Error` — they are programmer-mistake assertions, not
175
- * consumer-catchable contract failures.
176
- *
177
- * Subclassing strategy: where a runtime-specific failure maps cleanly to an
178
- * agent-eval code (validation, config, not_found), we re-use the agent-eval
179
- * subclass. Runtime-only failure modes (session resume against the wrong
180
- * backend, backend transport errors) get fresh subclasses that still carry an
181
- * `AgentEvalErrorCode` so cross-package handlers can pattern-match without
182
- * importing the runtime.
183
- *
184
- * @stable
185
- */
186
-
187
- /**
188
- *
189
- * A backend transport call (HTTP, gRPC, sidecar IPC) failed with a non-success
190
- * status. Distinct from `JudgeError` (which is structural / unrecoverable)
191
- * because backend failures are sometimes retryable and consumers may want to
192
- * branch on the upstream status code.
193
- *
194
- * @stable
195
- */
196
- declare class BackendTransportError extends AgentEvalError {
197
- readonly backend: string;
198
- readonly status?: number;
199
- /**
200
- * Truncated upstream response body (≤2 KiB) when available. Diagnostic
201
- * only — surfaces in `backend_error.error.body` and `final.error.body`
202
- * so operators can see "free_tier_limit", "invalid_api_key", etc. without
203
- * cracking the log line open.
204
- */
205
- readonly body?: string;
206
- constructor(backend: string, message: string, options?: {
207
- cause?: unknown;
208
- status?: number;
209
- body?: string;
210
- });
211
- }
212
- /**
213
- *
214
- * A runtime-run lifecycle method was called in an order the state machine does
215
- * not allow: `persist()` before `complete()`, `complete()` twice, etc.
216
- *
217
- * @stable
218
- */
219
- declare class RuntimeRunStateError extends AgentEvalError {
220
- constructor(message: string, options?: {
221
- cause?: unknown;
222
- });
223
- }
224
- /**
225
- *
226
- * The dynamic-loop planner returned an unusable topology move — the LLM emitted
227
- * no parseable envelope, an unknown `kind`, or a structurally-invalid move
228
- * (e.g. a fanout with zero tasks). This is a structural failure of the
229
- * agent-authored topology, not a config mistake: the planner ran but its output
230
- * cannot drive the kernel. Carries `validation` so cross-package handlers can
231
- * pattern-match without importing the runtime. Fail loud — never substitute a
232
- * default move, or the loop silently runs a topology nobody chose.
233
- *
234
- * @stable
235
- */
236
- declare class PlannerError extends AgentEvalError {
237
- constructor(message: string, options?: {
238
- cause?: unknown;
239
- });
240
- }
241
-
242
- /**
243
- * Build-prompt starting points for the two buildable artifact types. There is
244
- * NO `toolGenerator`/`mcpGenerator` wrapper — the factory is `agenticGenerator`
245
- * + a verifier (docs/artifact-lifecycle-frontier.md), so a tool or an MCP
246
- * server is built by composing the pieces directly:
247
- *
248
- * // a tool:
249
- * agenticGenerator({ buildPrompt: toolBuildPrompt, verify: commandVerifier('pnpm', ['test']) })
250
- * // an MCP server:
251
- * agenticGenerator({ buildPrompt: mcpBuildPrompt, verify: mcpServeVerifier({ command: 'node', args: ['server.mjs'] }) })
252
- *
253
- * These are the only type-specific bit (the phrasing that points the agent at a
254
- * tool vs. an MCP); the worktree, resume-on-failure loop, and improvement-loop
255
- * wrapper are shared. MCP is the load-bearing target — it is how a harness
256
- * acquires tools; raw tools matter where we control the loader.
257
- */
258
-
259
- type FindingsArg = {
260
- report: unknown;
261
- findings: AnalystFinding[];
262
- };
263
- /** Render findings as the ranked-evidence block every build prompt ends with. */
264
- declare function findingLines(findings: AnalystFinding[]): string[];
265
- /** Build the starting instruction for a coder agent tasked with implementing a new tool. */
266
- declare function toolBuildPrompt(args: FindingsArg): string;
267
- /** Build the starting instruction for a coder agent tasked with implementing a new MCP server. */
268
- declare function mcpBuildPrompt(args: FindingsArg): string;
269
-
270
- /**
271
- * `driverLoopGenerator` — the driver→worker `CandidateGenerator`: the build
272
- * loop run by the ATOM instead of the canned respawn.
273
- *
274
- * `agenticGenerator` steers with three hardcoded conditions picking a canned
275
- * note (`EMPTY_TREE_NOTE` / `failureNote`) and respawns. This generator swaps
276
- * that respawn brain for a real driver: an LLM on the canonical tool-loop seam
277
- * (`runBrainLoop` + `ToolLoopChat` — the exact loop `driverAgent` runs its
278
- * brain on) that AUTHORS each worker instruction, OBSERVES what the session
279
- * actually produced (diff, files, verifier output), RATES it, and DECIDES
280
- * refine / re-scope / decompose — prompted with the senior scientific-method
281
- * doctrine (`buildDriverSystem`).
282
- *
283
- * The worker stays the proven primitive: `runLocalHarness` in the candidate
284
- * worktree, same as `agenticGenerator` — only the brain between sessions
285
- * changes. The worktree machinery (`worktreeBuildCandidate`) and verifiers
286
- * (`commandVerifier` / `mcpServeVerifier`) are reused verbatim.
287
- *
288
- * Completion-oracle invariant (the supervisor doctrine, kept): the driver's
289
- * prose NEVER decides the outcome. After the loop, code re-checks ground
290
- * truth — tree dirty, raw-trace evidence present, verifier green — and only
291
- * that decides `applied`. A driver that claims success over a failing verifier
292
- * produces a discarded candidate, not a shipped one.
293
- *
294
- * @experimental
295
- */
296
-
297
- interface DriverLoopGeneratorOptions {
298
- /** The driver-LLM seam — ONE inference turn over the conversation + tool specs (the canonical
299
- * `ToolLoopChat`, same seam as `driverAgent`): `routerBrain(cfg)` in production, a scripted
300
- * mock in tests. */
301
- brain: ToolLoopChat;
302
- /** Local coding harness the driver's worker sessions run in the worktree. Default `claude`. */
303
- harness?: LocalHarness;
304
- /** Per-worker-session wall-clock timeout (ms). Default = `runLocalHarness` default (5m). */
305
- timeoutMs?: number;
306
- /** Build the driver's task briefing (domain framing + method + findings) — the same senior
307
- * prompt the worker path uses (`toolBuildPrompt` / `mcpBuildPrompt`). The driver reads it and
308
- * folds what each worker needs into its instruction. Default `defaultBuildPrompt`. */
309
- buildPrompt?: (args: {
310
- report: unknown;
311
- findings: AnalystFinding[];
312
- }) => string;
313
- /** Verify the worktree (the intrinsic check). Exposed to the driver as `run_verifier` AND
314
- * re-run by code as the final keep/discard gate. Omitted ⇒ the final gate is dirty-tree only
315
- * (legacy `agenticGenerator` behavior sans verifier). */
316
- verify?: Verifier;
317
- /** Max driver inference turns. Default `max(8, 2 + maxShots * 3)` — room for one
318
- * observe/rate/decide cycle per worker session plus orientation. */
319
- maxTurns?: number;
320
- /** The research seam (adopt-not-build): when set, the driver gets a
321
- * `research{query}` tool + the `researchDriverNote` doctrine, so it can
322
- * discover an EXISTING external MCP instead of building one. Wire a real
323
- * web/search backend here — none is provisioned by default (the build
324
- * harness has no live web access yet; flagged). */
325
- research?: (query: string) => Promise<string>;
326
- /** Test seam — inject the harness runner (defaults to `runLocalHarness`). */
327
- runHarness?: typeof runLocalHarness;
328
- /** Test seam — inject the worktree diff reader (defaults to `git diff` in the worktree). */
329
- readDiff?: (worktreePath: string) => string;
330
- /** Test seam — inject the changed-paths reader (defaults to `git status --porcelain`). */
331
- changedPaths?: (worktreePath: string) => string[];
332
- }
333
- /** Driver→worker `CandidateGenerator`: an LLM driver on the canonical tool-loop authors, observes, rates, and steers coding-harness sessions in the worktree until the verifier passes or the session budget is spent. */
334
- declare function driverLoopGenerator(opts: DriverLoopGeneratorOptions): CandidateGenerator;
335
-
336
- /**
337
- * Typed-findings accessor — the one place `unknown[]` findings become
338
- * `AnalystFinding[]`.
339
- *
340
- * agent-eval's `ProposeContext.findings` is `TFindings[] = unknown[]` on the
341
- * wire: the loop threads whatever the previous `analyzeGeneration` producer (or
342
- * the caller's static seed) returned. Consumers that need the typed envelope
343
- * (`claim`/`severity`/`recommended_action`) were down-casting with a bare
344
- * `as AnalystFinding[]` — a lie at runtime whenever the seed was a raw string
345
- * or an ad-hoc digest, which then rendered `undefined` into build prompts.
346
- *
347
- * `toAnalystFindings` replaces that cast: real findings pass through
348
- * unchanged (structural guard, fail-closed), and non-conforming values are
349
- * LIFTED into a real `AnalystFinding` envelope via `makeFinding` — the most
350
- * actionable text becomes the claim, the original value rides in `metadata.raw`
351
- * — so everything downstream of the accessor handles exactly one shape.
352
- */
353
-
354
- /** Analyst id stamped on findings lifted from untyped seed values. */
355
- declare const LIFTED_FINDING_ANALYST_ID = "lifted-seed";
356
- /** Structural guard for the schema-versioned `AnalystFinding` envelope.
357
- * Strict on the identity fields `makeFinding` always populates — a partial
358
- * look-alike is lifted (re-enveloped), not trusted. */
359
- declare function isAnalystFinding(value: unknown): value is AnalystFinding;
360
- interface ToAnalystFindingsOptions {
361
- /** `analyst_id` stamped on lifted (non-conforming) values.
362
- * Default {@link LIFTED_FINDING_ANALYST_ID}. */
363
- analystId?: string;
364
- /** `area` stamped on lifted values. Default `'seed'`. */
365
- area?: string;
366
- }
367
- /**
368
- * Normalize a mixed `unknown[]` findings array to `AnalystFinding[]`:
369
- * conforming findings pass through by reference; strings and finding-ish
370
- * objects are lifted into envelopes (claim = most actionable text, original
371
- * value under `metadata.raw`); values with no extractable text are dropped.
372
- * Never throws — a malformed seed must not kill a proposal round.
373
- */
374
- declare function toAnalystFindings(findings: readonly unknown[], opts?: ToAnalystFindingsOptions): AnalystFinding[];
375
-
376
- /**
377
- * `improve` runs one complete optimization method against an exact profile
378
- * surface. Runtime extracts and materializes the profile value; agent-eval owns
379
- * optimization, disjoint data partitions, final-test scoring, and uncertainty.
380
- *
381
- * Code is the sole exception. It uses Runtime's isolated git worktrees because
382
- * checkout ownership and cleanup cannot cross a generic optimizer boundary.
383
- *
384
- * @experimental
385
- */
386
-
387
- /**
388
- * Optimize one exact profile surface with a complete method.
389
- */
390
- declare function improve<TScenario extends Scenario, TArtifact>(profile: AgentProfile, opts: ImproveMethodOptions<TScenario, TArtifact>): Promise<ImproveMethodResult>;
391
- /**
392
- * Optimize repository code through Runtime's isolated worktree path.
393
- */
394
- declare function improve<TScenario extends Scenario, TArtifact>(opts: ImproveCodeRunOptions<TScenario, TArtifact>): Promise<ImproveCodeResult<TScenario, TArtifact>>;
395
-
396
- /**
397
- * `mcpServeVerifier` — the intrinsic verifier for a built MCP server: the
398
- * boot-and-probe checker named in docs/artifact-lifecycle-frontier.md. A
399
- * generated MCP server is only a candidate if it actually *serves* — so this
400
- * boots it over stdio (the default local MCP transport) and runs the real
401
- * handshake: `initialize` → `notifications/initialized` → `tools/list`, and
402
- * asserts the server answers with at least `minTools` tools.
403
- *
404
- * The spawn + handshake is the SHARED same-host stdio connection
405
- * (`connectStdioMcp`) — the same code path that later serves the built server
406
- * LIVE to a scored run (`materializeLocalMcp`), so "verified it serves" and
407
- * "served while scored" can never drift apart.
408
- *
409
- * Outcomes follow the `Verifier` contract: a server that fails to start, exits
410
- * early, errors the handshake, times out, or exposes no tools is a FAILED
411
- * candidate (`{ok:false}`, fed back into the next generation shot); a missing
412
- * start binary or spawn fault THROWS (a setup bug, never a silent fallback).
413
- */
414
-
415
- interface McpServeSpec {
416
- /** Command that starts the built MCP server in the worktree (stdio transport). */
417
- command: string;
418
- args?: string[];
419
- /** Extra env for the server process (merged over `process.env`). */
420
- env?: Record<string, string>;
421
- /** Handshake timeout (ms). Default 30s. */
422
- timeoutMs?: number;
423
- /** Minimum tools the server must expose to pass. Default 1. */
424
- minTools?: number;
425
- }
426
- /** Build a `Verifier` that boots a generated MCP server over stdio and checks it exposes tools. */
427
- declare function mcpServeVerifier(spec: McpServeSpec): Verifier;
428
-
429
- /** Runtime context appended to an official optimizer's own configuration. */
430
- interface OfficialOptimizerContextOptions {
431
- /** Context supplied to the optimizer before Runtime appends the profile surface and findings. */
432
- background?: string;
433
- /** Include current trace or analyst findings in the optimizer background. Default true. */
434
- includeFindings?: boolean;
435
- /** Reject oversized serialized findings before starting Python. Default 50,000 characters. */
436
- maxFindingsChars?: number;
437
- /**
438
- * Redact caller-supplied context and descriptors before they leave Runtime.
439
- * The built-in redactor is the default. Pass `false` only for public data
440
- * that has already been reviewed.
441
- */
442
- redact?: Redactor | false;
443
- /** Authorize one exact candidate containing structurally sensitive fields.
444
- * The callback must return true for every accepted baseline and candidate. */
445
- authorizeSensitiveCandidate?: (input: OfficialSensitiveCandidateInput) => boolean;
446
- }
447
- interface OfficialSensitiveCandidateInput extends ImproveCandidateValidationInput {
448
- sensitivePaths: readonly string[];
449
- }
450
- /** Official GEPA configuration plus bounded Runtime findings context. */
451
- type OfficialGepaOptions<TScenario extends {
452
- id: string;
453
- kind: string;
454
- }, TArtifact = unknown> = Omit<GepaOptimizationMethodConfig<TScenario, TArtifact>, 'background' | 'evaluationId'> & OfficialOptimizerContextOptions;
455
- /** Official SkillOpt configuration plus bounded Runtime findings context. */
456
- type OfficialSkillOptOptions<TScenario extends {
457
- id: string;
458
- kind: string;
459
- }, TArtifact = unknown> = Omit<SkillOptOptimizationMethodConfig<TScenario, TArtifact>, 'background' | 'evaluationId'> & OfficialOptimizerContextOptions;
460
- /** Missing optional Python dependencies for an official optimizer. */
461
- declare class OfficialOptimizerUnavailableError extends ConfigError {
462
- readonly optimizer: 'gepa' | 'skillopt';
463
- constructor(optimizer: 'gepa' | 'skillopt', cause: unknown);
464
- }
465
- /**
466
- * Build a complete method backed by GEPA's official Optimize Anything API.
467
- *
468
- * The recipe is passed through unchanged. Use `engine`, `sequential`,
469
- * `adaptive-sequential`, `best-of`, `vote`, or `omni` explicitly.
470
- */
471
- declare function officialGepa<TScenario extends {
472
- id: string;
473
- kind: string;
474
- }, TArtifact = unknown>(options: OfficialGepaOptions<TScenario, TArtifact>): ImproveMethodFactory<TScenario, TArtifact>;
475
- /** Build a complete method backed by Microsoft's official SkillOpt trainer. */
476
- declare function officialSkillOpt<TScenario extends {
477
- id: string;
478
- kind: string;
479
- }, TArtifact = unknown>(options: OfficialSkillOptOptions<TScenario, TArtifact>): ImproveMethodFactory<TScenario, TArtifact>;
480
-
481
- /**
482
- * The senior scientific-method optimizer doctrine — the ONE substantial prompt
483
- * core shared by every builder/author surface (tool build, MCP build, codebase
484
- * improvement, strategy authoring) and by the driver that steers build workers
485
- * (`driverLoopGenerator`).
486
- *
487
- * Seeded from the proven senior prompts rather than invented: GEPA's
488
- * `REFLECTION_SYSTEM` (localize → diagnose → minimal generalizable fix →
489
- * preserve what works), the /evolve loop (one hypothesis with a mechanism and a
490
- * falsifiable prediction; attack the largest measured gap first), /pursue (one
491
- * coherent change set, no partial scaffolding), and the self-improving-loop /
492
- * supervisor doctrine (a keep is decided by a real check, never by the author;
493
- * observe → rate → decide). Generalized from "mutate a prompt string" to
494
- * "build a code surface a held-out measurement will grade".
495
- */
496
- /**
497
- * The shared method block every build/author prompt embeds. Domain framing
498
- * (what a tool/MCP/codebase-edit deliverable looks like) wraps around it; this
499
- * is the process itself.
500
- */
501
- declare const optimizerMethod: string;
502
- /**
503
- * The driver's stance for `driverLoopGenerator` — the build-domain instance of
504
- * the supervisor doctrine (observe → rate → decide; refine / re-scope /
505
- * decompose; the check decides delivery, never the driver's prose).
506
- */
507
- declare const buildDriverSystem: string;
508
- /**
509
- * The driver's ADOPT-not-build doctrine, appended to `buildDriverSystem` when
510
- * a `research` tool is wired into the loop (`DriverLoopGeneratorOptions.
511
- * research`). Kept separate so a driver WITHOUT the tool is never told to
512
- * call a tool it does not have.
513
- */
514
- declare const researchDriverNote: string;
515
- /**
516
- * The senior authoring process for `authorStrategy` — the same method, shaped
517
- * to the strategy contract (author-blind, conserved budget, one module out).
518
- */
519
- declare const strategyAuthorMethod: string;
520
-
521
- /**
522
- *
523
- * `rawTraceDistiller` — the meta-harness `analyzeGeneration` producer.
524
- *
525
- * The default `generationFailureDistiller` (in `improve.ts`) COMPRESSES each
526
- * generation's failing cells into ~1500-char structured findings before the next
527
- * proposal round. That is the ACE-style recipe: a small summary is the proposer's
528
- * whole view of what went wrong. This producer does the opposite — the
529
- * meta-harness recipe (yoonholee.com/meta-harness): it does NOT summarize. It
530
- * points the coding-agent proposer at the generation's RAW run traces already on
531
- * disk under `runDir` — the durable per-cell `spans.jsonl` event logs,
532
- * `cached-result.json` scores, and any artifacts the substrate persisted — and
533
- * instructs the agent to `grep`/`cat`/`ls` them to diagnose the failures itself
534
- * (up to the harness's full context, ~millions of tokens, vs a ~1500-char digest).
535
- *
536
- * It emits `AnalystFinding[]` so it drops into the SAME `opts.analyzeGeneration`
537
- * slot the default distiller uses, and renders through the same
538
- * `agenticGenerator` prompt path (`claim` + `recommended_action`). The findings
539
- * carry ABSOLUTE paths — the coding harness runs with `cwd` = a candidate
540
- * worktree, so a relative `runDir` would be uncattable from there.
541
- *
542
- * Runtime layout it reads (written by agent-eval's optimization loop):
543
- *
544
- * <runDir>/gen-<N>/ ← the generation dir (input.runDir)
545
- * candidate-<i>/ ← one candidate campaign (campaign.runDir)
546
- * <sanitized cellId>/ ← one scenario×rep cell
547
- * spans.jsonl ← the raw trace (event/span log)
548
- * cached-result.json ← the cell's score + artifact ref
549
- * <artifacts…> ← whatever the dispatch wrote
550
- *
551
- * @experimental
552
- */
553
-
554
- interface RawTraceDistillerOptions {
555
- /** Anchor the emitted paths at this run root instead of the generation `runDir`
556
- * the loop passes in. Normally unset — each call points at that generation's
557
- * own directory (`input.runDir`). Pass an absolute path when you construct the
558
- * producer ahead of the loop and want a fixed anchor (e.g. a test fixture). */
559
- runDir?: string;
560
- /** Max candidates to surface trace paths for, worst-scoring first. Default 12. */
561
- maxCandidates?: number;
562
- /** Max failing cells to enumerate per candidate before collapsing the rest into
563
- * an "ls the candidate dir" pointer. Default 8. */
564
- maxCellsPerCandidate?: number;
565
- /** Max concrete file paths to list per cell (the agent can always `ls` the dir
566
- * for the rest). Default 24. */
567
- maxFilesPerCell?: number;
568
- /** Findings to fall back to when the generation had NO failing cells, so a
569
- * clean round never wipes the proposer's steering context. Mirrors the default
570
- * distiller's static-seed fallback. Default: a single instruction finding. */
571
- fallbackFindings?: unknown[];
572
- }
573
- /**
574
- * Build an `analyzeGeneration` producer that feeds the proposer RAW-TRACE
575
- * FILESYSTEM CONTEXT — paths into the prior generation's real run traces plus a
576
- * grep/cat-to-diagnose instruction — instead of a pre-summarized digest.
577
- *
578
- * Drop-in for `analyzeGeneration` on `improve({ surface: 'code' })`:
579
- *
580
- * await improve({
581
- * surface: 'code',
582
- * findings: seedFindings,
583
- * code: { repoRoot },
584
- * runDir: '/abs/run', // MUST be a real path — the traces live here
585
- * analyzeGeneration: rawTraceDistiller(),
586
- * scenarios, judge, agent,
587
- * })
588
- */
589
- declare function rawTraceDistiller<TScenario extends Scenario = Scenario, TArtifact = unknown>(options?: RawTraceDistillerOptions): NonNullable<SelfImproveOptions<TScenario, TArtifact>['analyzeGeneration']>;
590
-
591
- /**
592
- *
593
- * `reflectiveGenerator` — the cheap, no-sandbox `CandidateGenerator`. It drafts
594
- * surface edits via the existing improvement proposer (`proposeFromFindings`,
595
- * one LLM patch per finding) and applies them as ONE coherent improvement into
596
- * the candidate worktree. `maxShots` is ignored — reflection is single-shot by
597
- * construction (the patches are already drafted).
598
- *
599
- * This is the `shots=1, sandbox=off` code-candidate setting.
600
- * `agenticGenerator` supplies the multi-shot verify-in-session setting.
601
- *
602
- * @experimental
603
- */
604
-
605
- interface ReflectiveGeneratorOptions {
606
- improvementProposalSource: ImprovementProposalSource<SurfaceImprovementEdit>;
607
- }
608
- /** Cheap no-sandbox `CandidateGenerator` (the `shots=1` setting): draft surface edits via the improvement adapter and apply them as one coherent candidate. */
609
- declare function reflectiveGenerator(opts: ReflectiveGeneratorOptions): CandidateGenerator;
610
-
611
- /** Serialize and apply Runtime's structural rollout profile coordinate. */
612
-
613
- /** The profile extensions namespace the policy persists under. */
614
- declare const ROLLOUT_POLICY_EXTENSION = "structural-rollout";
615
- /** Parse a serialized policy surface. Returns `undefined` for non-strings,
616
- * malformed JSON, or values outside the policy invariants. Unknown fields are
617
- * dropped; supported optional fields are preserved. */
618
- declare function parseRolloutPolicy(surface: MutableSurface): StructuralRolloutPolicy | undefined;
619
- /** Normalize an untyped policy bag (a parsed surface or a profile extension) into
620
- * a full `StructuralRolloutPolicy`, defaults merged. Returns `undefined` when any
621
- * present dial violates the policy invariants (mirrors `resolvePolicy`: integer
622
- * k ≥ 1, repairRounds ≥ 0, testgen ≥ 0) — a corrupt config must read as "not
623
- * configured", never as a fabricated recipe. */
624
- declare function normalizeRolloutPolicy(raw: unknown): StructuralRolloutPolicy | undefined;
625
- /** Stable serialization with fixed field order. */
626
- declare function serializeRolloutPolicy(policy: StructuralRolloutPolicy): string;
627
- /** Read the persisted policy off the profile. `undefined` when the profile does
628
- * not opt into structural rollout. */
629
- declare function structuralRolloutPolicyFromProfile(profile: ReadonlyAgentProfile): StructuralRolloutPolicy | undefined;
630
- /** Persist a detached policy under the profile extension without mutating the input. */
631
- declare function applyRolloutPolicyToProfile(profile: ReadonlyAgentProfile, policy: StructuralRolloutPolicy): AgentProfile;
632
-
633
- /**
634
- *
635
- * Chat-model resolution + catalog validation — the shared primitive every
636
- * product chat handler needs and was, until now, hand-rolling. Lifts the
637
- * router `/v1/models` fetch, the fail-closed id validation, and the
638
- * precedence resolver out of four near-identical per-repo copies.
639
- *
640
- * Policy-free by design: callers pass their own precedence order
641
- * (`resolveChatModel`) and their own known-good `allowlist`
642
- * (`validateChatModelId`), so each product keeps its resolution policy while
643
- * sharing the catalog fetch, the malformed-id guard, and the fail-closed
644
- * admission rule. No React, no `process.env` assumption — `env` is an
645
- * explicit narrow record so this runs unchanged in Node and in Workers.
646
- *
647
- * @stable
648
- */
649
- /**
650
- * A model entry as returned by the Tangle Router `/v1/models` endpoint.
651
- * Intentionally minimal — only the fields resolution + validation read.
652
- */
653
- interface ModelInfo {
654
- id: string;
655
- name?: string;
656
- description?: string;
657
- /** Provider slug, when the router exposes it (`provider` or `_provider`). */
658
- provider?: string;
659
- _provider?: string;
660
- architecture?: {
661
- modality?: string;
662
- input_modalities?: string[];
663
- output_modalities?: string[];
664
- };
665
- }
666
- /** Env keys the router base URL is resolved from. */
667
- interface RouterEnv {
668
- TANGLE_ROUTER_URL?: string;
669
- TANGLE_ROUTER_BASE_URL?: string;
670
- }
671
- /** Default Tangle Router base URL used when no env override is set. */
672
- declare const DEFAULT_ROUTER_BASE_URL = "https://router.tangle.tools";
673
- /** Resolve the router base URL from env, normalised — no trailing `/v1` or `/`. */
674
- declare function resolveRouterBaseUrl(env?: RouterEnv): string;
675
- /**
676
- * Fetch the model catalog from the router's `/v1/models`. Throws on a non-2xx
677
- * response — callers decide whether to fail open (empty catalog) or closed.
678
- */
679
- declare function getModels(routerBaseUrl?: string): Promise<ModelInfo[]>;
680
- /** Trim a candidate model id; `undefined` for non-strings and blanks. */
681
- declare function cleanModelId(value: unknown): string | undefined;
682
- interface ChatModelCandidate {
683
- /** Stable label for telemetry — e.g. `request`, `workspace`, `env`. */
684
- source: string;
685
- model: string | undefined;
686
- }
687
- interface ResolvedChatModel {
688
- source: string;
689
- model: string;
690
- }
691
- /**
692
- * Resolve a chat model by precedence: the first candidate carrying a
693
- * non-blank model wins, else `fallback`. The caller owns the precedence
694
- * order, so each product keeps its own policy (request → workspace → env,
695
- * etc.) while the first-non-blank logic and the telemetry shape stay shared.
696
- */
697
- declare function resolveChatModel(candidates: ChatModelCandidate[], fallback: ResolvedChatModel): ResolvedChatModel;
698
- type ChatModelValidation = {
699
- succeeded: true;
700
- value: string;
701
- } | {
702
- succeeded: false;
703
- error: string;
704
- };
705
- /**
706
- * Validate a caller-supplied chat-model id. Rejects non-strings, malformed
707
- * ids, and ids absent from both the caller's `allowlist` and the live router
708
- * catalog. Fails closed: when the catalog cannot be fetched, an unverifiable
709
- * id is rejected rather than admitted — a bad model never reaches the agent.
710
- */
711
- declare function validateChatModelId(modelId: unknown, options?: {
712
- /**
713
- * Known-good ids that skip the catalog round trip — e.g. the product's
714
- * default model plus any env-configured ids.
715
- */
716
- allowlist?: string[];
717
- routerBaseUrl?: string;
718
- /** Injectable catalog loader — overridden in tests. */
719
- loadModels?: (routerBaseUrl: string) => Promise<ModelInfo[]>;
720
- }): Promise<ChatModelValidation>;
721
-
722
- /**
723
- *
724
- * Pure readiness-decision helper. Maps a `KnowledgeReadinessReport` from
725
- * `@tangle-network/agent-eval` to a three-state branch (`ready` / `blocked` /
726
- * `caveat`) the runtime, route handlers, and UI shells can all switch on.
727
- *
728
- * Default `minimumScore` of 0.7 mirrors the readiness scoring scale in
729
- * agent-eval; callers tightening or loosening this should keep it consistent
730
- * across all entry points for the same product so the UI / metrics agree on
731
- * what "caveat" means.
732
- *
733
- * @stable
734
- */
735
-
736
- /**
737
- * Map a `KnowledgeReadinessReport` to a three-state branch (`ready` / `blocked` / `caveat`) the runtime, route handlers, and UI shells all switch on.
738
- *
739
- * @stable
740
- */
741
- declare function decideKnowledgeReadiness(report: KnowledgeReadinessReport, options?: {
742
- minimumScore?: number;
743
- }): KnowledgeReadinessDecision;
744
-
745
- /**
746
- * The product-facing backend selector for `runChatThroughRuntime` /
747
- * `runAgentTaskStream`: one call turns a `--backend {router,tcloud,cli-bridge,
748
- * sandbox}` choice into the `AgentExecutionBackend` the chat leg runs on.
749
- *
750
- * It is the `AgentExecutionBackend` sibling of `resolveSandboxClient` (which
751
- * resolves the `SandboxClient` a `runAgentRounds` drives). Both exist for the same
752
- * reason: every in-process eval product hand-rolled the identical
753
- * "`backend-name` → `createOpenAICompatibleBackend`" branch, and the copies
754
- * drift. This is the single generic resolver they share.
755
- *
756
- * - `router` / `tcloud` / `cli-bridge` → OpenAI-compatible chat completions.
757
- * All three speak `POST {baseUrl}/chat/completions` in OpenAI's SSE shape —
758
- * the router (a.k.a. tcloud) IS that endpoint, and cli-bridge fronts a
759
- * harness CLI behind the same protocol at its own `/v1`. They differ only
760
- * in `baseUrl` / `apiKey` and the `kind` label a product wants on its
761
- * traces. cli-bridge REQUIRES `model` in the request body, so it MUST route
762
- * through `createOpenAICompatibleBackend` (which sends it), never a
763
- * transport that drops the field.
764
- * - `sandbox` → the caller's own domain backend. The sandbox variant carries
765
- * product specifics (system prompt, workspace id, in-box D1 executor) that
766
- * do NOT belong in the substrate, so the product passes a `sandboxBackend()`
767
- * seam that this resolver simply invokes.
768
- *
769
- * This resolver is PURE backend selection. Product concerns — credit hard-cuts,
770
- * fetch-capture shims, D1 platform wiring — stay as product-side WRAPPERS
771
- * around the returned backend. The OpenAI-compat passthrough fields (`tools`,
772
- * `toolChoice`, `responseFormat`, `temperature`, `maxTokens`, `fetchImpl`,
773
- * `retry`) are forwarded verbatim so a product can advertise its app tools,
774
- * preserve generation settings, or install a capturing fetch without
775
- * re-opening the branch this consolidation closes.
776
- */
777
-
778
- /** The transport a chat backend runs on. */
779
- type AgentBackendKind = 'router' | 'tcloud' | 'cli-bridge' | 'sandbox';
780
- /**
781
- * OpenAI-compat passthrough forwarded to `createOpenAICompatibleBackend` for
782
- * the `router` / `tcloud` / `cli-bridge` kinds. Mirrors that factory's optional
783
- * inputs so a product keeps its tool advertising / capture-fetch without
784
- * re-implementing the backend branch.
785
- */
786
- type OpenAICompatPassthrough = Pick<Parameters<typeof createOpenAICompatibleBackend>[0], 'tools' | 'toolChoice' | 'responseFormat' | 'temperature' | 'maxTokens' | 'fetchImpl' | 'retry'>;
787
- interface ResolveAgentBackendOptions<TInput extends AgentBackendInput = AgentBackendInput> extends OpenAICompatPassthrough {
788
- /** The chat transport to resolve. */
789
- kind: AgentBackendKind;
790
- /**
791
- * Bearer credential for the OpenAI-compat kinds. Empty string is valid for a
792
- * loopback-anonymous cli-bridge; a `router`/`tcloud` route with an empty key
793
- * is a caller bug the product surfaces before calling in.
794
- */
795
- apiKey: string;
796
- /** Base URL for the OpenAI-compat kinds. cli-bridge's is its `/v1`. */
797
- baseUrl: string;
798
- /** Model id sent on every request. cli-bridge rejects a request without it. */
799
- model: string;
800
- /** `kind` label stamped on the resolved backend + its traces. Defaults to `kind`. */
801
- label?: string;
802
- /**
803
- * `sandbox` kind: the product's own domain backend. Required for that kind —
804
- * the substrate owns no product sandbox shape, so a `sandbox` resolution with
805
- * no seam is a caller bug, not a silent fallback.
806
- */
807
- sandboxBackend?: () => AgentExecutionBackend<TInput>;
808
- }
809
- /**
810
- * Resolve the `AgentExecutionBackend` for the chosen `kind`. Reuse this instead
811
- * of hand-rolling the `createOpenAICompatibleBackend` branch in each product.
812
- */
813
- declare function resolveAgentBackend<TInput extends AgentBackendInput = AgentBackendInput>(opts: ResolveAgentBackendOptions<TInput>): AgentExecutionBackend<TInput>;
814
-
815
- /**
816
- *
817
- * The two top-level entry points:
818
- *
819
- * - `runAgentTask` — single-shot lifecycle for adapter-driven tasks.
820
- * - `runAgentTaskStream` — streaming lifecycle that delegates execution to an
821
- * `AgentExecutionBackend` (model API, sandbox, or custom iterable).
822
- *
823
- * Both gate the run on `KnowledgeReadinessReport` from `agent-eval`, emit the
824
- * same lifecycle event vocabulary (under different shapes — see `types.ts`),
825
- * and route session lifecycle through a pluggable `RuntimeSessionStore`.
826
- *
827
- * @stable
828
- */
829
-
830
- /** Stamp cross-cutting defaults onto adapter-projected RunRecords without
831
- * overriding anything the adapter set explicitly:
832
- * - `scenarioId` — the run's scenario, when the record omits one.
833
- * - `failureClass` — the control layer's failure classification promoted
834
- * onto the canonical cross-agent key, but ONLY when it's a real taxonomy
835
- * class. This is what lets the substrate aggregate failures across every
836
- * agent in one vocabulary instead of per-agent ad-hoc strings. */
837
- declare function applyRunRecordDefaults(records: RunRecord[], scenarioId: string, controlFailureClass: string | undefined): RunRecord[];
838
-
839
- /**
840
- * Single-shot task lifecycle for adapter-driven tasks: readiness-gated, emits the runtime lifecycle event vocabulary, session-store pluggable.
841
- *
842
- * @stable
843
- */
844
- declare function runAgentTask<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(options: RunAgentTaskOptions<TState, TAction, TActionResult, TEval>): Promise<AgentTaskRunResult<TState, TAction, TActionResult, TEval>>;
845
- /**
846
- * Streaming task lifecycle: delegates execution to an `AgentExecutionBackend` (model API, sandbox, or custom iterable) and yields lifecycle events as they happen.
847
- *
848
- * @stable
849
- */
850
- declare function runAgentTaskStream<TInput extends AgentBackendInput = AgentBackendInput>(options: RunAgentTaskStreamOptions<TInput>): AsyncIterable<RuntimeStreamEvent>;
851
-
852
- /**
853
- *
854
- * Session helpers + an in-memory `RuntimeSessionStore` implementation suitable
855
- * for tests, scratch processes, and per-request scratch storage in serverless
856
- * runtimes. Durable stores (D1, postgres, Durable Objects) implement the same
857
- * interface from `./types`.
858
- *
859
- * @stable
860
- */
861
-
862
- /** In-memory `RuntimeSessionStore` for single-process use and tests. @stable */
863
- declare class InMemoryRuntimeSessionStore implements RuntimeSessionStore {
864
- private readonly sessions;
865
- private readonly events;
866
- get(sessionId: string): RuntimeSession | undefined;
867
- put(session: RuntimeSession): void;
868
- appendEvent(sessionId: string, event: RuntimeStreamEvent): void;
869
- listEvents(sessionId: string): RuntimeStreamEvent[];
870
- }
871
-
872
- /**
873
- *
874
- * Server-Sent Events serialization for runtime telemetry streams.
875
- *
876
- * Newline-safe by construction: any newline in `id` or `event` is collapsed to
877
- * a space (browsers terminate fields on newline), and multi-line `data`
878
- * payloads are split into one `data:` line per source line so JSON.stringify
879
- * output transports cleanly.
880
- *
881
- * @stable
882
- */
883
-
884
- /** @stable */
885
- interface ServerSentEventOptions {
886
- event?: string;
887
- id?: string;
888
- retry?: number;
889
- }
890
- /** Serialize a `KnowledgeReadinessReport` as a Server-Sent Event string. @stable */
891
- declare function readinessServerSentEvent(report: KnowledgeReadinessReport, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
892
- /** Serialize a `RuntimeStreamEvent` as a Server-Sent Event string. @stable */
893
- declare function runtimeStreamServerSentEvent(event: RuntimeStreamEvent, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
894
-
895
- /**
896
- * Bounded turn-level tool-dispatch loop.
897
- *
898
- * `runAgentTaskStream` runs ONE model turn; `runAgentRounds` orchestrates DELEGATED
899
- * multi-agent topologies (refine / fanout-vote). Neither is the everyday
900
- * interactive shape: a chat turn where the model may emit tool calls, each is
901
- * executed, the results are folded back, and the turn re-runs until the model
902
- * stops (or a turn cap). Every agent app hand-rolls that loop — this is it,
903
- * as a reusable primitive.
904
- *
905
- * Substrate-neutral by design: the caller supplies `streamTurn` (wrapping
906
- * whatever backend / `runAgentTaskStream` it uses) and `executeToolCall`
907
- * (routing to its executors). This module owns the LOOP; the caller owns the
908
- * model and the executors. `Raw` (streaming variant) is the caller's own
909
- * event type. The only imported contract is the runtime hook type: hooks are
910
- * execution-scoped observers, not part of the agent profile.
911
- */
912
-
913
- interface ToolLoopCall {
914
- toolCallId?: string;
915
- toolName: string;
916
- args: Record<string, unknown>;
917
- }
918
- /** Outcome of one tool dispatch — structurally compatible with a hub/integration
919
- * tool-outcome union, so callers can fold either through the loop. */
920
- type ToolCallOutcome = {
921
- ok: true;
922
- result: unknown;
923
- } | {
924
- ok: false;
925
- code: string;
926
- message: string;
927
- status?: number;
928
- };
929
- /** One OpenAI-shaped tool-call entry carried on an assistant message. */
930
- interface ToolLoopAssistantToolCall {
931
- id: string;
932
- type: 'function';
933
- function: {
934
- name: string;
935
- arguments: string;
936
- };
937
- }
938
- /**
939
- * A message in the running conversation the loop sends to `streamTurn`.
940
- *
941
- * The base `{ role, content }` covers `system` / `user` / plain `assistant`
942
- * turns. Two optional fields carry the OpenAI function-calling contract so a
943
- * strict model (Claude, and any OpenAI-compatible provider that validates tool
944
- * history) reads its own tool use back instead of re-issuing the same call:
945
- *
946
- * - an assistant turn that emitted tool calls carries `tool_calls`, and its
947
- * `content` is `null` when the turn was tool-only;
948
- * - each tool result is its own `{ role: 'tool', tool_call_id, content }`
949
- * message keyed to the call that produced it.
950
- *
951
- * Widening is additive: a `streamTurn` that reads only `role` + `content` still
952
- * works; one that forwards the whole message to an OpenAI-compatible endpoint
953
- * now sends correct tool history.
954
- */
955
- type ToolLoopMessage = {
956
- role: string;
957
- content: string | null;
958
- tool_calls?: ToolLoopAssistantToolCall[];
959
- tool_call_id?: string;
960
- };
961
- type ToolLoopEvent = {
962
- type: 'text';
963
- text: string;
964
- } | {
965
- type: 'tool_call';
966
- call: ToolLoopCall;
967
- } | {
968
- type: 'other';
969
- event: unknown;
970
- };
971
- /** Why the loop stopped. `completed` = model finished naturally; `stuck-loop` =
972
- * ≥3 consecutive identical tool calls (same tool + args); `backstop` = hit the
973
- * runaway-backstop cap (200 by default); `deadline` = wall-clock deadlineMs
974
- * exceeded; `budget` = maxCostUsd exhausted. Non-`completed` stops are infra /
975
- * resource outcomes — eval scoring must distinguish them from capability failure. */
976
- type ToolLoopStopReason = 'completed' | 'stuck-loop' | 'backstop' | 'deadline' | 'budget';
977
- interface ToolLoopResult {
978
- finalText: string;
979
- toolResults: Array<{
980
- call: ToolLoopCall;
981
- label: string;
982
- outcome: ToolCallOutcome;
983
- }>;
984
- turns: number;
985
- stopReason: ToolLoopStopReason;
986
- /** @deprecated Use `stopReason !== 'completed'` instead. */
987
- cappedOut: boolean;
988
- }
989
- interface RunToolLoopOptions {
990
- systemPrompt: string;
991
- userMessage: string;
992
- priorMessages?: ToolLoopMessage[];
993
- streamTurn: (messages: ToolLoopMessage[]) => AsyncIterable<ToolLoopEvent>;
994
- executeToolCall: (call: ToolLoopCall) => Promise<ToolCallOutcome>;
995
- isExecutableTool: (toolName: string) => boolean;
996
- /** Runaway-backstop cap. Default 200 — set far above any legitimate workflow.
997
- * For per-workflow limits, use `maxCostUsd` or `deadlineMs` instead. */
998
- maxToolTurns?: number;
999
- /** Wall-clock deadline in ms since epoch (Date.now()-based). When exceeded the
1000
- * loop stops with stopReason `deadline`. */
1001
- deadlineMs?: number;
1002
- /** Maximum total cost in USD. Requires `costOf` to meter each tool call. */
1003
- maxCostUsd?: number;
1004
- /** Return the USD cost of one outcome. Required for `maxCostUsd` to work. */
1005
- costOf?: (call: ToolLoopCall, outcome: ToolCallOutcome) => number;
1006
- renderResult?: (label: string, outcome: ToolCallOutcome) => string;
1007
- labelFor?: (call: ToolLoopCall) => string;
1008
- runId?: string;
1009
- scenarioId?: string;
1010
- hooks?: RuntimeHooks;
1011
- }
1012
- /** Run the bounded tool loop and return the final text + every executed tool
1013
- * outcome. Awaitable — callers needing to stream events to a UI use
1014
- * {@link streamToolLoop}. */
1015
- declare function runToolLoop(opts: RunToolLoopOptions): Promise<ToolLoopResult>;
1016
- type StreamToolLoopYield<Raw> = {
1017
- kind: 'event';
1018
- event: Raw;
1019
- } | {
1020
- kind: 'tool_result';
1021
- toolName: string;
1022
- toolCallId?: string;
1023
- label: string;
1024
- outcome: ToolCallOutcome;
1025
- } | {
1026
- kind: 'capped';
1027
- pending: number;
1028
- stopReason: Exclude<ToolLoopStopReason, 'completed'>;
1029
- };
1030
- interface StreamToolLoopOptions<Raw> {
1031
- systemPrompt: string;
1032
- userMessage: string;
1033
- priorMessages?: ToolLoopMessage[];
1034
- streamTurn: (messages: ToolLoopMessage[]) => AsyncIterable<Raw>;
1035
- extractText: (event: Raw) => string;
1036
- extractToolCall: (event: Raw) => ToolLoopCall | null;
1037
- isExecutableTool: (toolName: string) => boolean;
1038
- executeToolCall: (call: ToolLoopCall) => Promise<ToolCallOutcome>;
1039
- /** Runaway-backstop cap. Default 200 — set far above any legitimate workflow. */
1040
- maxToolTurns?: number;
1041
- /** Wall-clock deadline in ms since epoch (Date.now()-based). */
1042
- deadlineMs?: number;
1043
- /** Maximum total cost in USD. Requires `costOf` to meter each tool call. */
1044
- maxCostUsd?: number;
1045
- /** Return the USD cost of one outcome. Required for `maxCostUsd` to work. */
1046
- costOf?: (call: ToolLoopCall, outcome: ToolCallOutcome) => number;
1047
- renderResult?: (label: string, outcome: ToolCallOutcome) => string;
1048
- labelFor?: (call: ToolLoopCall) => string;
1049
- runId?: string;
1050
- scenarioId?: string;
1051
- hooks?: RuntimeHooks;
1052
- }
1053
- /** Streaming bounded tool loop: yields each raw turn event (the caller maps +
1054
- * telemetries + re-emits it) and each executed `tool_result`; emits one
1055
- * `capped` if it stops for any non-completed reason with calls still pending. */
1056
- declare function streamToolLoop<Raw>(opts: StreamToolLoopOptions<Raw>): AsyncGenerator<StreamToolLoopYield<Raw>, void, unknown>;
1057
-
1058
- export { AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, AgentTaskRunResult, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, DEFAULT_ROUTER_BASE_URL, type DriverLoopGeneratorOptions, ImproveCandidateValidationInput, ImproveCodeResult, ImproveCodeRunOptions, ImproveMethodFactory, ImproveMethodOptions, ImproveMethodResult, InMemoryRuntimeSessionStore, LIFTED_FINDING_ANALYST_ID, type McpServeSpec, type ModelInfo, type OfficialGepaOptions, type OfficialOptimizerContextOptions, OfficialOptimizerUnavailableError, type OfficialSensitiveCandidateInput, type OfficialSkillOptOptions, PlannerError, ROLLOUT_POLICY_EXTENSION, type RawTraceDistillerOptions, ReadonlyAgentProfile, type ReflectiveGeneratorOptions, type ResolveAgentBackendOptions, type ResolvedChatModel, type RouterEnv, type RunChatTurnInput, type RunToolLoopOptions, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, RuntimeTelemetryOptions, type StreamToolLoopOptions, type StreamToolLoopYield, type ToAnalystFindingsOptions, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, Verifier, applyRolloutPolicyToProfile, applyRunRecordDefaults, buildDriverSystem, cleanModelId, createOpenAICompatibleBackend, decideKnowledgeReadiness, deriveExecutionId, driverLoopGenerator, findingLines, getModels, handleChatTurn, improve, isAnalystFinding, mcpBuildPrompt, mcpServeVerifier, normalizeRolloutPolicy, officialGepa, officialSkillOpt, optimizerMethod, parseRolloutPolicy, rawTraceDistiller, readinessServerSentEvent, reflectiveGenerator, researchDriverNote, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runToolLoop, runtimeStreamServerSentEvent, serializeRolloutPolicy, strategyAuthorMethod, streamToolLoop, structuralRolloutPolicyFromProfile, toAnalystFindings, toolBuildPrompt, validateChatModelId };
1
+ import { _ as RunAgentTaskOptions, a as AgentKnowledgeProvider, b as RuntimeSessionStore, c as AgentTaskContext, d as AgentTaskStatus, f as BackendErrorDetail, g as OpenAIChatToolChoice, h as OpenAIChatTool, i as AgentExecutionBackend, l as AgentTaskRunResult, m as OpenAIChatResponseFormat, n as AgentBackendContext, o as AgentRuntimeEvent, p as KnowledgeReadinessDecision, r as AgentBackendInput, s as AgentRuntimeEventSink, t as AgentAdapter, u as AgentTaskSpec, v as RunAgentTaskStreamOptions, x as RuntimeStreamEvent, y as RuntimeSession } from "./types-C9j4qg6l.js";
2
+ import { A as RuntimeRunCompleteInput, B as RuntimeDecisionPoint, F as RuntimeRunRow, G as RuntimeHookTarget, H as RuntimeHookErrorContext, I as RuntimeRunStatus, J as defineRuntimeHooks, K as RuntimeHooks, L as startRuntimeRun, M as RuntimeRunHandle, N as RuntimeRunOptions, P as RuntimeRunPersistenceAdapter, R as RuntimeDecisionEvidenceRef, U as RuntimeHookEvent, V as RuntimeHookContext, W as RuntimeHookPhase, X as notifyRuntimeHookEvent, Y as notifyRuntimeDecisionPoint, j as RuntimeRunCost, q as composeRuntimeHooks, z as RuntimeDecisionKind } from "./types-BevOjfTY.js";
3
+ import { Bu as RuntimeRunStateError, Fu as BackendTransportError, Iu as ConfigError, Lu as JudgeError, Nu as AgentEvalError, Pu as AgentEvalErrorCode, Ru as NotFoundError, Vu as ValidationError, au as LoopSpanNode, cu as OtelExporter, du as buildLoopOtelSpans, eu as EvalRunEvent, fu as buildLoopSpanNodes, gu as loopEventToOtelSpan, hu as exportEvalRuns, iu as INTELLIGENCE_WIRE_VERSION, lu as OtelSpan, mu as createOtelExporter, nu as EvalRunsExportConfig, ou as OtelAttribute, pc as WorktreeCheckRunner, pu as buildRuntimeEventOtelSpans, ru as EvalRunsExportResult, su as OtelExportConfig, tu as EvalRunGeneration, uu as RuntimeEventOtelOptions, zu as PlannerError } from "./index-DruSKs3Z.js";
4
+ import { A as createRuntimeEventCollector, C as RuntimeEventCollector, D as RuntimeTelemetryOptions, E as RuntimeStreamEventSummary, M as sanitizeAgentRuntimeEvent, N as sanitizeKnowledgeReadinessReport, O as SanitizedKnowledgeReadinessReport, P as sanitizeRuntimeStreamEvent, T as RuntimeStreamEventSink, j as createRuntimeStreamEventCollector, k as SanitizedKnowledgeRequirement, w as RuntimeStreamEventCollector } from "./local-harness-Dh8PJ0ot.js";
5
+ import { C as AgentCandidateCodeSurfaceSource, D as AgentCandidateBundleInput, E as buildAgentCandidateBundle, O as sealAgentCandidateBundle, S as AgentCandidateCodeSource, T as BuildAgentCandidateBundleInput, _ as exactProcessProviderAsCandidateExecutor, a as captureAgentCandidateWorkspace, b as FileAgentCandidateExecutionClaimStore, c as AGENT_CANDIDATE_EXECUTION_SUPPORT, d as recoverExpiredAgentCandidateExecution, f as persistCandidateOutputArtifact, g as ExactProcessCandidateExecutorOptions, h as candidateKnowledgeExecutionPaths, i as CreateAgentCandidateWorkspacePortOptions, l as verifyAgentCandidateBundle, m as CANDIDATE_KNOWLEDGE_ROOT_ENV, n as CaptureAgentCandidateWorkspaceOptions, o as captureAgentCandidateWorkspaceFiles, p as CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, r as CapturedAgentCandidateWorkspace, s as createAgentCandidateWorkspacePort, t as AgentCandidateWorkspaceArchiveLimits, u as RecoverExpiredAgentCandidateOptions, v as DisposePreparedAgentCandidateOptions, w as AgentCandidateProfileSource, x as FileAgentCandidateExecutionClaimStoreOptions, y as disposePreparedAgentCandidateExecution } from "./index-C-FYUuFG.js";
6
+ import { A as AgentCandidateExecutionTerminalRecord, C as AgentCandidateExecutionFailureClass, D as AgentCandidateExecutionPhaseResult, E as AgentCandidateExecutionPhase, F as candidateExecutionClaim, I as AgentCandidatePreparationEvidence, M as AgentCandidateRetryRejection, N as InMemoryAgentCandidateExecutionClaimStore, O as AgentCandidateExecutionRecoveryEvidence, P as InMemoryAgentCandidateExecutionClaimStoreOptions, S as AgentCandidateExecutionCleanupHandles, T as AgentCandidateExecutionLease, _ as AgentCandidateExecutionAttemptRecord, a as AgentCandidateModelGrantSettleInput, b as AgentCandidateExecutionClaimResult, c as applyExactAgentProfileDiff, d as parseExactAgentProfile, f as parseExactAgentProfileDiff, g as executePreparedAgentCandidate, h as ExecutePreparedAgentCandidateOptions, i as AgentCandidateModelGrantReserveInput, j as AgentCandidateExecutionTerminalResult, k as AgentCandidateExecutionStageResult, l as assertCandidateProfileBinding, m as prepareAgentCandidateExecution, n as AgentCandidateModelGrantClient, o as CreateProtectedAgentCandidateModelPortOptions, p as PrepareAgentCandidateExecutionOptions, r as AgentCandidateModelGrantReservation, s as createProtectedAgentCandidateModelPort, t as AgentCandidateModelGrantActivateInput, v as AgentCandidateExecutionAttemptRef, w as AgentCandidateExecutionFinishResult, x as AgentCandidateExecutionClaimStore, y as AgentCandidateExecutionClaim } from "./protected-model-port-BP6Z4eau.js";
7
+ import { A as CANDIDATE_TRACE_ENV, B as VerifiedAgentCandidate, C as AgentCandidateProtectedModelSettlement, D as AgentCandidateTaskExecution, E as AgentCandidateRunFinalization, F as PreparedAgentCandidateInstruction, I as PreparedAgentCandidateKnowledge, L as PreparedAgentCandidateLaunch, M as CanonicalCandidateDocument, N as PersistedTaskOutcomeEvidence, O as AgentCandidateVerificationPorts, P as PreparedAgentCandidateExecution, R as PreparedAgentCandidateTrace, S as AgentCandidateProtectedModelReservation, T as AgentCandidateRepositoryPort, V as VerifiedAgentCandidateTaskOutcome, _ as AgentCandidateModelLimits, a as AgentCandidateExecutionPorts, b as AgentCandidateOutputPurpose, c as AgentCandidateExecutorPort, d as AgentCandidateExecutorStopRequest, f as AgentCandidateExecutorTaskOutcomeCapture, g as AgentCandidateMemoryResetResult, h as AgentCandidateMemoryPort, i as AgentCandidateContainerPort, j as CANDIDATE_TRACE_TAGS, k as AgentCandidateWorkspacePort, l as AgentCandidateExecutorProfileFile, m as AgentCandidateExecutorWorkspaceInput, n as AgentCandidateBenchmarkGraderIdentity, o as AgentCandidateExecutorFinalCapture, p as AgentCandidateExecutorWorkspaceFile, r as AgentCandidateBenchmarkGraderPort, s as AgentCandidateExecutorMemoryCapture, t as AgentCandidateArtifactPort, u as AgentCandidateExecutorRequest, v as AgentCandidateModelPort, w as AgentCandidateProtectedRunCapture, x as AgentCandidateProtectedModelActivation, y as AgentCandidateOutputArtifactPort, z as ResolvedAgentCandidateContainer } from "./types-BaIpb0XT.js";
8
+ import { $ as sleep, A as RunConversationOptions, B as buildForwardHeaders, C as ConversationResult, D as HaltPredicate, E as HaltContext, F as InMemoryConversationJournal, G as CircuitBreakerState, H as readDepth, I as DEFAULT_MAX_DEPTH, J as RetryBackoff, K as CircuitOpenError, L as FORWARD_HEADERS, M as ConversationJournal, N as ConversationJournalEntry, O as HaltReason, P as FileConversationJournal, Q as makePerAttemptSignal, R as ForwardHeaderName, S as ConversationPolicy, T as ConversationTurn, U as BackendCallPolicy, V as isDepthExceeded, W as CircuitBreakerConfig, X as computeBackoff, Y as RetryableErrorPredicate, Z as defaultIsRetryable, _ as createConversationBackend, a as RunPersonaConfig, b as ConversationDriveState, c as runPersonaDispatch, d as D1DatabaseLike, f as D1StmtLike, g as defineConversation, h as d1ToSqlAdapter, i as PersonaDriver, j as TurnOrder, k as HaltSignal, l as runConversation, m as SqlConversationJournal, n as turnId, o as RunPersonaConversationOptions, p as SqlAdapter, q as DeadlineExceededError, r as PersonaConversationResult, s as runPersonaConversation, t as slugifySpeaker, u as runConversationStream, v as AuthSource, w as ConversationStreamEvent, x as ConversationParticipant, y as Conversation, z as PropagatedHeaders } from "./index-Efjb3nrQ.js";
9
+ import { $ as rawTraceDistiller, A as ResolveAgentBackendOptions, At as handleChatTurn, B as getModels, C as readinessServerSentEvent, Ct as deriveExecutionId, D as runAgentTask, Dt as ChatTurnProducer, E as applyRunRecordDefaults, Et as ChatTurnIdentity, F as DEFAULT_ROUTER_BASE_URL, G as applyRolloutPolicyToProfile, H as resolveRouterBaseUrl, I as ModelInfo, J as serializeRolloutPolicy, K as normalizeRolloutPolicy, L as ResolvedChatModel, M as decideKnowledgeReadiness, Mt as createIterableBackend, N as ChatModelCandidate, Nt as createOpenAICompatibleBackend, O as runAgentTaskStream, Ot as ChatTurnResult, P as ChatModelValidation, Pt as createSandboxPromptBackend, Q as RawTraceDistillerOptions, R as RouterEnv, S as ServerSentEventOptions, St as toolBuildPrompt, T as InMemoryRuntimeSessionStore, Tt as ChatTurnHooks, U as validateChatModelId, V as resolveChatModel, W as ROLLOUT_POLICY_EXTENSION, X as ReflectiveGeneratorOptions, Y as structuralRolloutPolicyFromProfile, Z as reflectiveGenerator, _ as ToolLoopMessage, _t as DriverLoopGeneratorOptions, a as ControlStep, at as OfficialOptimizerContextOptions, b as runToolLoop, bt as findingLines, c as KnowledgeRequirement, ct as OfficialSkillOptOptions, d as StreamToolLoopOptions, dt as McpServeSpec, et as buildDriverSystem, f as StreamToolLoopYield, ft as mcpServeVerifier, g as ToolLoopEvent, gt as toAnalystFindings, h as ToolLoopCall, ht as isAnalystFinding, i as ControlRunResult, it as OfficialGepaOptions, j as resolveAgentBackend, jt as BackendRetryPolicy, k as AgentBackendKind, kt as RunChatTurnInput, l as RunRecord, lt as officialGepa, m as ToolLoopAssistantToolCall, mt as ToAnalystFindingsOptions, n as ControlDecision, nt as researchDriverNote, o as DataAcquisitionPlan, ot as OfficialOptimizerUnavailableError, p as ToolCallOutcome, pt as LIFTED_FINDING_ANALYST_ID, q as parseRolloutPolicy, r as ControlEvalResult, rt as strategyAuthorMethod, s as KnowledgeReadinessReport, st as OfficialSensitiveCandidateInput, t as ControlBudget, tt as optimizerMethod, u as RunToolLoopOptions, ut as officialSkillOpt, v as ToolLoopResult, vt as driverLoopGenerator, w as runtimeStreamServerSentEvent, wt as ChatStreamEvent, x as streamToolLoop, xt as mcpBuildPrompt, y as ToolLoopStopReason, yt as BuildPromptFindingsInput, z as cleanModelId } from "./index-BGdxAwfO.js";
10
+ import { A as AGENTIC_PROFILE_RESOURCE_ROOT, B as CandidateGenerator, C as ImproveSkillsOptions, D as ImprovementProfileCandidate, E as ImprovementCodeCandidate, F as Verifier, I as VerifyResult, L as agenticGenerator, M as AgenticGeneratorShotDisposition, N as AgenticGeneratorShotExecution, O as DeepReadonly, P as AgenticGeneratorShotReceipt, R as commandVerifier, S as ImproveResult, T as ImprovementCandidate, _ as ImproveOptimizationRunOptions, a as ImproveCandidateValidationInput, b as ImproveProfileComponents, c as ImproveCodeResult, d as ImproveLineage, f as ImproveMethodContext, g as ImproveMethodSource, h as ImproveMethodResult, i as improve, j as AgenticGeneratorOptions, k as ReadonlyAgentProfile, l as ImproveCodeRunOptions, m as ImproveMethodOptions, o as ImproveCandidateValidator, p as ImproveMethodFactory, s as ImproveCodeOptions, u as ImproveCost, v as ImproveOptions, w as ImproveSurface, x as ImproveProfileSurface, y as ImproveProfileAgent, z as defaultBuildPrompt } from "./redact-kbIOjfjM.js";
11
+ import { C as KnowledgeImprovementActivationExecutor, S as CreateKnowledgeImprovementActivationExecutorOptions, _ as SupervisedKnowledgeUpdater, a as KnowledgeImprovementJobResult, b as knowledgeReadinessDeliverable, c as createAgentKnowledgeReadinessCheck, d as KnowledgeReadinessCheckInput, f as KnowledgeReadinessCheckResult, g as SupervisedKnowledgeUpdateResult, h as SupervisedKnowledgeUpdateOptions, i as KnowledgeImprovementJobMeasurement, l as runKnowledgeImprovementJob, m as SupervisedKnowledgeUpdateInput, n as KnowledgeImprovementCandidatePair, o as RunKnowledgeImprovementJobOptions, p as RESEARCH_SUPERVISOR_SYSTEM_PROMPT, r as KnowledgeImprovementExperimentBundles, s as buildKnowledgeImprovementExperimentBundles, t as AgentKnowledgeReadinessCheckOptions, u as KnowledgeReadinessCheck, v as createSupervisedKnowledgeUpdater, w as createKnowledgeImprovementActivationExecutor, x as runSupervisedKnowledgeUpdate, y as formatSupervisedKnowledgeTask } from "./index-CbNM40xG.js";
12
+ import { _ as researchLoopRunner, a as DELEGATED_LOOP_MODES, c as DelegatedLoopResult, d as ResearchLoopRunnerOptions, f as RunDelegatedLoopOptions, g as isDelegatedLoopMode, h as auditLoopRunner, i as runLoopRunnerCli, l as DelegatedLoopRunner, m as WorktreeLoopRunnerOptions, n as LoopRunnerCliResult, o as DelegatedLoopMode, p as VetoedFact, r as parseLoopRunnerArgv, s as DelegatedLoopRegistry, t as LoopRunnerCliArgs, u as ResearchLoopResult, v as runDelegatedLoop, y as worktreeLoopRunner } from "./loop-runner-bin-BXsFEUcf.js";
13
+ import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "./openai-tools-B68JaOCx.js";
14
+ export { AGENTIC_PROFILE_RESOURCE_ROOT, AGENT_CANDIDATE_EXECUTION_SUPPORT, type AgentAdapter, type AgentBackendContext, type AgentBackendInput, type AgentBackendKind, type AgentCandidateArtifactPort, type AgentCandidateBenchmarkGraderIdentity, type AgentCandidateBenchmarkGraderPort, type AgentCandidateBundleInput, type AgentCandidateCodeSource, type AgentCandidateCodeSurfaceSource, type AgentCandidateContainerPort, type AgentCandidateExecutionAttemptRecord, type AgentCandidateExecutionAttemptRef, type AgentCandidateExecutionClaim, type AgentCandidateExecutionClaimResult, type AgentCandidateExecutionClaimStore, type AgentCandidateExecutionCleanupHandles, type AgentCandidateExecutionFailureClass, type AgentCandidateExecutionFinishResult, type AgentCandidateExecutionLease, type AgentCandidateExecutionPhase, type AgentCandidateExecutionPhaseResult, type AgentCandidateExecutionPorts, type AgentCandidateExecutionRecoveryEvidence, type AgentCandidateExecutionStageResult, type AgentCandidateExecutionTerminalRecord, type AgentCandidateExecutionTerminalResult, type AgentCandidateExecutorFinalCapture, type AgentCandidateExecutorMemoryCapture, type AgentCandidateExecutorPort, type AgentCandidateExecutorProfileFile, type AgentCandidateExecutorRequest, type AgentCandidateExecutorStopRequest, type AgentCandidateExecutorTaskOutcomeCapture, type AgentCandidateExecutorWorkspaceFile, type AgentCandidateExecutorWorkspaceInput, type AgentCandidateMemoryPort, type AgentCandidateMemoryResetResult, type AgentCandidateModelGrantActivateInput, type AgentCandidateModelGrantClient, type AgentCandidateModelGrantReservation, type AgentCandidateModelGrantReserveInput, type AgentCandidateModelGrantSettleInput, type AgentCandidateModelLimits, type AgentCandidateModelPort, type AgentCandidateOutputArtifactPort, type AgentCandidateOutputPurpose, type AgentCandidatePreparationEvidence, type AgentCandidateProfileSource, type AgentCandidateProtectedModelActivation, type AgentCandidateProtectedModelReservation, type AgentCandidateProtectedModelSettlement, type AgentCandidateProtectedRunCapture, type AgentCandidateRepositoryPort, type AgentCandidateRetryRejection, type AgentCandidateRunFinalization, type AgentCandidateTaskExecution, type AgentCandidateVerificationPorts, type AgentCandidateWorkspaceArchiveLimits, type AgentCandidateWorkspacePort, AgentEvalError, type AgentEvalErrorCode, type AgentExecutionBackend, type AgentKnowledgeProvider, type AgentKnowledgeReadinessCheckOptions, type AgentRuntimeEvent, type AgentRuntimeEventSink, type AgentTaskContext, type AgentTaskRunResult, type AgentTaskSpec, type AgentTaskStatus, type AgenticGeneratorOptions, type AgenticGeneratorShotDisposition, type AgenticGeneratorShotExecution, type AgenticGeneratorShotReceipt, type AuthSource, type BackendCallPolicy, type BackendErrorDetail, type BackendRetryPolicy, BackendTransportError, type BuildAgentCandidateBundleInput, type BuildPromptFindingsInput, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, CANDIDATE_KNOWLEDGE_ROOT_ENV, CANDIDATE_TRACE_ENV, CANDIDATE_TRACE_TAGS, type CandidateGenerator, type CanonicalCandidateDocument, type CaptureAgentCandidateWorkspaceOptions, type CapturedAgentCandidateWorkspace, type ChatModelCandidate, type ChatModelValidation, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, ConfigError, type ControlBudget, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlStep, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type CreateAgentCandidateWorkspacePortOptions, type CreateKnowledgeImprovementActivationExecutorOptions, type CreateProtectedAgentCandidateModelPortOptions, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DELEGATED_LOOP_MODES, type DataAcquisitionPlan, DeadlineExceededError, type DeepReadonly, type DelegatedLoopMode, type DelegatedLoopRegistry, type DelegatedLoopResult, type DelegatedLoopRunner, type DisposePreparedAgentCandidateOptions, type DriverLoopGeneratorOptions, type EvalRunEvent, type EvalRunGeneration, type EvalRunsExportConfig, type EvalRunsExportResult, type ExactProcessCandidateExecutorOptions, type ExecutePreparedAgentCandidateOptions, FORWARD_HEADERS, FileAgentCandidateExecutionClaimStore, type FileAgentCandidateExecutionClaimStoreOptions, FileConversationJournal, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, INTELLIGENCE_WIRE_VERSION, type ImproveCandidateValidationInput, type ImproveCandidateValidator, type ImproveCodeOptions, type ImproveCodeResult, type ImproveCodeRunOptions, type ImproveCost, type ImproveLineage, type ImproveMethodContext, type ImproveMethodFactory, type ImproveMethodOptions, type ImproveMethodResult, type ImproveMethodSource, type ImproveOptimizationRunOptions, type ImproveOptions, type ImproveProfileAgent, type ImproveProfileComponents, type ImproveProfileSurface, type ImproveResult, type ImproveSkillsOptions, type ImproveSurface, type ImprovementCandidate, type ImprovementCodeCandidate, type ImprovementProfileCandidate, InMemoryAgentCandidateExecutionClaimStore, type InMemoryAgentCandidateExecutionClaimStoreOptions, InMemoryConversationJournal, InMemoryRuntimeSessionStore, JudgeError, type KnowledgeImprovementActivationExecutor, type KnowledgeImprovementCandidatePair, type KnowledgeImprovementExperimentBundles, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, type KnowledgeReadinessDecision, type KnowledgeReadinessReport, type KnowledgeRequirement, LIFTED_FINDING_ANALYST_ID, type LoopRunnerCliArgs, type LoopRunnerCliResult, type LoopSpanNode, type McpServeSpec, type ModelInfo, NotFoundError, type OfficialGepaOptions, type OfficialOptimizerContextOptions, OfficialOptimizerUnavailableError, type OfficialSensitiveCandidateInput, type OfficialSkillOptOptions, type OpenAIChatResponseFormat, type OpenAIChatTool, type OpenAIChatToolChoice, type OtelAttribute, type OtelExportConfig, type OtelExporter, type OtelSpan, type PersistedTaskOutcomeEvidence, type PersonaConversationResult, type PersonaDriver, PlannerError, type PrepareAgentCandidateExecutionOptions, type PreparedAgentCandidateExecution, type PreparedAgentCandidateInstruction, type PreparedAgentCandidateKnowledge, type PreparedAgentCandidateLaunch, type PreparedAgentCandidateTrace, type PropagatedHeaders, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, ROLLOUT_POLICY_EXTENSION, type RawTraceDistillerOptions, type ReadonlyAgentProfile, type RecoverExpiredAgentCandidateOptions, type ReflectiveGeneratorOptions, type ResearchLoopResult, type ResearchLoopRunnerOptions, type ResolveAgentBackendOptions, type ResolvedAgentCandidateContainer, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunAgentTaskOptions, type RunAgentTaskStreamOptions, type RunChatTurnInput, type RunConversationOptions, type RunDelegatedLoopOptions, type RunKnowledgeImprovementJobOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunRecord, type RunToolLoopOptions, type RuntimeDecisionEvidenceRef, type RuntimeDecisionKind, type RuntimeDecisionPoint, type RuntimeEventCollector, type RuntimeEventOtelOptions, type RuntimeHookContext, type RuntimeHookErrorContext, type RuntimeHookEvent, type RuntimeHookPhase, type RuntimeHookTarget, type RuntimeHooks, type RuntimeRunCompleteInput, type RuntimeRunCost, type RuntimeRunHandle, type RuntimeRunOptions, type RuntimeRunPersistenceAdapter, type RuntimeRunRow, RuntimeRunStateError, type RuntimeRunStatus, type RuntimeSession, type RuntimeSessionStore, type RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeStreamEventSink, type RuntimeStreamEventSummary, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SanitizedKnowledgeRequirement, type ServerSentEventOptions, type SqlAdapter, SqlConversationJournal, type StreamToolLoopOptions, type StreamToolLoopYield, type SupervisedKnowledgeUpdateInput, type SupervisedKnowledgeUpdateOptions, type SupervisedKnowledgeUpdateResult, type SupervisedKnowledgeUpdater, type ToAnalystFindingsOptions, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, type TurnOrder, ValidationError, type VerifiedAgentCandidate, type VerifiedAgentCandidateTaskOutcome, type Verifier, type VerifyResult, type VetoedFact, type WorktreeCheckRunner, type WorktreeLoopRunnerOptions, agenticGenerator, applyExactAgentProfileDiff, applyRolloutPolicyToProfile, applyRunRecordDefaults, assertCandidateProfileBinding, auditLoopRunner, buildAgentCandidateBundle, buildDriverSystem, buildForwardHeaders, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, buildLoopSpanNodes, buildRuntimeEventOtelSpans, candidateExecutionClaim, candidateKnowledgeExecutionPaths, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, cleanModelId, commandVerifier, composeRuntimeHooks, computeBackoff, createAgentCandidateWorkspacePort, createAgentKnowledgeReadinessCheck, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOpenAICompatibleBackend, createOtelExporter, createProtectedAgentCandidateModelPort, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, createSupervisedKnowledgeUpdater, d1ToSqlAdapter, decideKnowledgeReadiness, defaultBuildPrompt, defaultIsRetryable, defineConversation, defineRuntimeHooks, deriveExecutionId, disposePreparedAgentCandidateExecution, driverLoopGenerator, exactProcessProviderAsCandidateExecutor, executePreparedAgentCandidate, exportEvalRuns, findingLines, formatSupervisedKnowledgeTask, getModels, handleChatTurn, improve, isAnalystFinding, isDelegatedLoopMode, isDepthExceeded, knowledgeReadinessDeliverable, loopEventToOtelSpan, makePerAttemptSignal, mcpBuildPrompt, mcpServeVerifier, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, normalizeRolloutPolicy, notifyRuntimeDecisionPoint, notifyRuntimeHookEvent, officialGepa, officialSkillOpt, optimizerMethod, parseExactAgentProfile, parseExactAgentProfileDiff, parseLoopRunnerArgv, parseRolloutPolicy, persistCandidateOutputArtifact, prepareAgentCandidateExecution, rawTraceDistiller, readDepth, readinessServerSentEvent, recoverExpiredAgentCandidateExecution, reflectiveGenerator, researchDriverNote, researchLoopRunner, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runDelegatedLoop, runKnowledgeImprovementJob, runLoopRunnerCli, runPersonaConversation, runPersonaDispatch, runSupervisedKnowledgeUpdate, runToolLoop, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sealAgentCandidateBundle, serializeRolloutPolicy, sleep, slugifySpeaker, startRuntimeRun, strategyAuthorMethod, streamToolLoop, structuralRolloutPolicyFromProfile, toAnalystFindings, toolBuildPrompt, turnId, validateChatModelId, verifyAgentCandidateBundle, worktreeLoopRunner };