agentfootprint 6.43.0 → 6.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/ai-instructions/setup.sh +0 -0
  2. package/dist/core/RunnerBase.js +7 -0
  3. package/dist/core/RunnerBase.js.map +1 -1
  4. package/dist/core/agent/buildAgentChart.js +2 -1
  5. package/dist/core/agent/buildAgentChart.js.map +1 -1
  6. package/dist/core/agent/buildDynamicAgentChart.js +3 -1
  7. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  8. package/dist/core/agent/stages/pickEntry.js +3 -1
  9. package/dist/core/agent/stages/pickEntry.js.map +1 -1
  10. package/dist/esm/adapters/identity/agentcore.d.ts +100 -0
  11. package/dist/esm/adapters/llm/AnthropicProvider.d.ts +130 -0
  12. package/dist/esm/adapters/llm/BedrockProvider.d.ts +100 -0
  13. package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +41 -0
  14. package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +95 -0
  15. package/dist/esm/adapters/llm/MockProvider.d.ts +153 -0
  16. package/dist/esm/adapters/llm/OpenAIProvider.d.ts +220 -0
  17. package/dist/esm/adapters/llm/createProvider.d.ts +85 -0
  18. package/dist/esm/adapters/memory/agentcore.d.ts +146 -0
  19. package/dist/esm/adapters/memory/bedrockAgentMemory.d.ts +95 -0
  20. package/dist/esm/adapters/memory/redis.d.ts +127 -0
  21. package/dist/esm/adapters/observability/agentcore.d.ts +67 -0
  22. package/dist/esm/adapters/observability/audit.d.ts +254 -0
  23. package/dist/esm/adapters/observability/cloudwatch.d.ts +96 -0
  24. package/dist/esm/adapters/observability/otel.d.ts +237 -0
  25. package/dist/esm/adapters/observability/xray.d.ts +88 -0
  26. package/dist/esm/adapters/types.d.ts +378 -0
  27. package/dist/esm/bridge/eventMeta.d.ts +59 -0
  28. package/dist/esm/cache/CacheDecisionSubflow.d.ts +85 -0
  29. package/dist/esm/cache/CacheGateDecider.d.ts +127 -0
  30. package/dist/esm/cache/applyCachePolicy.d.ts +37 -0
  31. package/dist/esm/cache/cacheRecorder.d.ts +85 -0
  32. package/dist/esm/cache/index.d.ts +33 -0
  33. package/dist/esm/cache/strategies/AnthropicCacheStrategy.d.ts +38 -0
  34. package/dist/esm/cache/strategies/BedrockCacheStrategy.d.ts +33 -0
  35. package/dist/esm/cache/strategies/NoOpCacheStrategy.d.ts +29 -0
  36. package/dist/esm/cache/strategies/OpenAICacheStrategy.d.ts +36 -0
  37. package/dist/esm/cache/strategyRegistry.d.ts +45 -0
  38. package/dist/esm/cache/types.d.ts +243 -0
  39. package/dist/esm/conventions.d.ts +203 -0
  40. package/dist/esm/core/Agent.d.ts +355 -0
  41. package/dist/esm/core/LLMCall.d.ts +139 -0
  42. package/dist/esm/core/RunnerBase.d.ts +267 -0
  43. package/dist/esm/core/RunnerBase.js +7 -0
  44. package/dist/esm/core/RunnerBase.js.map +1 -1
  45. package/dist/esm/core/agent/AgentBuilder.d.ts +565 -0
  46. package/dist/esm/core/agent/buildAgentChart.d.ts +109 -0
  47. package/dist/esm/core/agent/buildAgentChart.js +2 -1
  48. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  49. package/dist/esm/core/agent/buildAgentMessageApiChart.d.ts +40 -0
  50. package/dist/esm/core/agent/buildCacheSubflow.d.ts +35 -0
  51. package/dist/esm/core/agent/buildDynamicAgentChart.d.ts +56 -0
  52. package/dist/esm/core/agent/buildDynamicAgentChart.js +3 -1
  53. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  54. package/dist/esm/core/agent/buildMessageApiChart.d.ts +47 -0
  55. package/dist/esm/core/agent/buildToolRegistry.d.ts +61 -0
  56. package/dist/esm/core/agent/memoryRecallInjections.d.ts +8 -0
  57. package/dist/esm/core/agent/stages/breakFinal.d.ts +22 -0
  58. package/dist/esm/core/agent/stages/callLLM.d.ts +74 -0
  59. package/dist/esm/core/agent/stages/pickEntry.d.ts +19 -0
  60. package/dist/esm/core/agent/stages/pickEntry.js +3 -1
  61. package/dist/esm/core/agent/stages/pickEntry.js.map +1 -1
  62. package/dist/esm/core/agent/stages/prepareFinal.d.ts +19 -0
  63. package/dist/esm/core/agent/stages/reliabilityExecution.d.ts +135 -0
  64. package/dist/esm/core/agent/stages/route.d.ts +18 -0
  65. package/dist/esm/core/agent/stages/seed.d.ts +53 -0
  66. package/dist/esm/core/agent/stages/toolCalls.d.ts +76 -0
  67. package/dist/esm/core/agent/toolArgsValidation.d.ts +62 -0
  68. package/dist/esm/core/agent/types.d.ts +382 -0
  69. package/dist/esm/core/agent/validators.d.ts +52 -0
  70. package/dist/esm/core/cost.d.ts +38 -0
  71. package/dist/esm/core/flowchartAsTool.d.ts +200 -0
  72. package/dist/esm/core/humanizeLLMError.d.ts +23 -0
  73. package/dist/esm/core/outputFallback.d.ts +139 -0
  74. package/dist/esm/core/outputSchema.d.ts +127 -0
  75. package/dist/esm/core/pause.d.ts +74 -0
  76. package/dist/esm/core/runCheckpoint.d.ts +179 -0
  77. package/dist/esm/core/runner.d.ts +203 -0
  78. package/dist/esm/core/slots/buildMessagesSlot.d.ts +40 -0
  79. package/dist/esm/core/slots/buildSystemPromptSlot.d.ts +41 -0
  80. package/dist/esm/core/slots/buildThinkingSubflow.d.ts +40 -0
  81. package/dist/esm/core/slots/buildToolsSlot.d.ts +60 -0
  82. package/dist/esm/core/slots/helpers.d.ts +27 -0
  83. package/dist/esm/core/toolContract.d.ts +43 -0
  84. package/dist/esm/core/tools.d.ts +90 -0
  85. package/dist/esm/core/translator.d.ts +94 -0
  86. package/dist/esm/core-flow/Conditional.d.ts +119 -0
  87. package/dist/esm/core-flow/Loop.d.ts +160 -0
  88. package/dist/esm/core-flow/Parallel.d.ts +360 -0
  89. package/dist/esm/core-flow/Sequence.d.ts +133 -0
  90. package/dist/esm/events/dispatcher.d.ts +134 -0
  91. package/dist/esm/events/payloads.d.ts +761 -0
  92. package/dist/esm/events/registry.d.ts +198 -0
  93. package/dist/esm/events/types.d.ts +70 -0
  94. package/dist/esm/identity/kinds.d.ts +36 -0
  95. package/dist/esm/identity/staticTokens.d.ts +28 -0
  96. package/dist/esm/identity/types.d.ts +113 -0
  97. package/dist/esm/identity/withCredentialRetry.d.ts +64 -0
  98. package/dist/esm/identity.d.ts +31 -0
  99. package/dist/esm/index.d.ts +64 -0
  100. package/dist/esm/index.js +2 -0
  101. package/dist/esm/index.js.map +1 -1
  102. package/dist/esm/injection-engine.d.ts +4 -0
  103. package/dist/esm/lib/canonicalJson.d.ts +56 -0
  104. package/dist/esm/lib/context-bisect/ablation.d.ts +109 -0
  105. package/dist/esm/lib/context-bisect/bisect.d.ts +75 -0
  106. package/dist/esm/lib/context-bisect/cost.d.ts +37 -0
  107. package/dist/esm/lib/context-bisect/index.d.ts +31 -0
  108. package/dist/esm/lib/context-bisect/index.js +3 -0
  109. package/dist/esm/lib/context-bisect/index.js.map +1 -1
  110. package/dist/esm/lib/context-bisect/llmEdgeWeigher.d.ts +124 -0
  111. package/dist/esm/lib/context-bisect/localize.d.ts +152 -0
  112. package/dist/esm/lib/context-bisect/localize.js +2 -0
  113. package/dist/esm/lib/context-bisect/localize.js.map +1 -1
  114. package/dist/esm/lib/context-bisect/loop-recall.d.ts +97 -0
  115. package/dist/esm/lib/context-bisect/missingContext.d.ts +71 -0
  116. package/dist/esm/lib/context-bisect/restoration.d.ts +39 -0
  117. package/dist/esm/lib/context-bisect/toBacktrackTrace.d.ts +138 -0
  118. package/dist/esm/lib/context-bisect/trajectory.d.ts +168 -0
  119. package/dist/esm/lib/context-bisect/types.d.ts +448 -0
  120. package/dist/esm/lib/context-bisect/walk-to-root.d.ts +103 -0
  121. package/dist/esm/lib/influence-core/attributability.d.ts +72 -0
  122. package/dist/esm/lib/influence-core/cache.d.ts +94 -0
  123. package/dist/esm/lib/influence-core/contrastive.d.ts +26 -0
  124. package/dist/esm/lib/influence-core/index.d.ts +34 -0
  125. package/dist/esm/lib/influence-core/margin.d.ts +33 -0
  126. package/dist/esm/lib/influence-core/signals.d.ts +128 -0
  127. package/dist/esm/lib/influence-core/similarity.d.ts +25 -0
  128. package/dist/esm/lib/influence-core/types.d.ts +252 -0
  129. package/dist/esm/lib/injection-engine/SkillRegistry.d.ts +147 -0
  130. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.d.ts +110 -0
  131. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +1 -0
  132. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  133. package/dist/esm/lib/injection-engine/entryScorer.d.ts +93 -0
  134. package/dist/esm/lib/injection-engine/entryScorer.js +172 -0
  135. package/dist/esm/lib/injection-engine/entryScorer.js.map +1 -0
  136. package/dist/esm/lib/injection-engine/evaluator.d.ts +24 -0
  137. package/dist/esm/lib/injection-engine/factories/defineFact.d.ts +60 -0
  138. package/dist/esm/lib/injection-engine/factories/defineInjection.d.ts +41 -0
  139. package/dist/esm/lib/injection-engine/factories/defineInstruction.d.ts +78 -0
  140. package/dist/esm/lib/injection-engine/factories/defineRelevanceHint.d.ts +26 -0
  141. package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +160 -0
  142. package/dist/esm/lib/injection-engine/factories/defineSteering.d.ts +39 -0
  143. package/dist/esm/lib/injection-engine/index.d.ts +22 -0
  144. package/dist/esm/lib/injection-engine/index.js +1 -0
  145. package/dist/esm/lib/injection-engine/index.js.map +1 -1
  146. package/dist/esm/lib/injection-engine/skillContract.d.ts +29 -0
  147. package/dist/esm/lib/injection-engine/skillGraph.d.ts +289 -0
  148. package/dist/esm/lib/injection-engine/skillGraph.js +35 -41
  149. package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
  150. package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +49 -0
  151. package/dist/esm/lib/injection-engine/skillTools.d.ts +72 -0
  152. package/dist/esm/lib/injection-engine/softmax.d.ts +11 -0
  153. package/dist/esm/lib/injection-engine/types.d.ts +229 -0
  154. package/dist/esm/lib/injection-engine/types.js.map +1 -1
  155. package/dist/esm/lib/lazyRequire.d.ts +29 -0
  156. package/dist/esm/lib/mcp/index.d.ts +9 -0
  157. package/dist/esm/lib/mcp/mcpClient.d.ts +46 -0
  158. package/dist/esm/lib/mcp/mockMcpClient.d.ts +65 -0
  159. package/dist/esm/lib/mcp/types.d.ts +133 -0
  160. package/dist/esm/lib/rag/defineRAG.d.ts +139 -0
  161. package/dist/esm/lib/rag/index.d.ts +7 -0
  162. package/dist/esm/lib/rag/indexDocuments.d.ts +105 -0
  163. package/dist/esm/lib/tool-lint/analyze.d.ts +83 -0
  164. package/dist/esm/lib/tool-lint/cli.d.ts +43 -0
  165. package/dist/esm/lib/tool-lint/format.d.ts +18 -0
  166. package/dist/esm/lib/tool-lint/index.d.ts +23 -0
  167. package/dist/esm/lib/tool-lint/rules.d.ts +85 -0
  168. package/dist/esm/lib/tool-lint/types.d.ts +155 -0
  169. package/dist/esm/lib/trace-toolpack/bounded.d.ts +47 -0
  170. package/dist/esm/lib/trace-toolpack/debugPrompt.d.ts +19 -0
  171. package/dist/esm/lib/trace-toolpack/index.d.ts +20 -0
  172. package/dist/esm/lib/trace-toolpack/lazyToolpack.d.ts +35 -0
  173. package/dist/esm/lib/trace-toolpack/selfExplain.d.ts +100 -0
  174. package/dist/esm/lib/trace-toolpack/traceDebugAgent.d.ts +42 -0
  175. package/dist/esm/lib/trace-toolpack/traceToolpack.d.ts +69 -0
  176. package/dist/esm/lib/trace-toolpack/types.d.ts +59 -0
  177. package/dist/esm/llm-providers.d.ts +26 -0
  178. package/dist/esm/locales/index.d.ts +132 -0
  179. package/dist/esm/memory/beats/extractBeats.d.ts +61 -0
  180. package/dist/esm/memory/beats/extractor.d.ts +47 -0
  181. package/dist/esm/memory/beats/formatAsNarrative.d.ts +62 -0
  182. package/dist/esm/memory/beats/heuristicExtractor.d.ts +37 -0
  183. package/dist/esm/memory/beats/index.d.ts +12 -0
  184. package/dist/esm/memory/beats/llmExtractor.d.ts +56 -0
  185. package/dist/esm/memory/beats/types.d.ts +60 -0
  186. package/dist/esm/memory/beats/writeBeats.d.ts +22 -0
  187. package/dist/esm/memory/causal/evidenceRecorder.d.ts +66 -0
  188. package/dist/esm/memory/causal/index.d.ts +6 -0
  189. package/dist/esm/memory/causal/loadSnapshot.d.ts +51 -0
  190. package/dist/esm/memory/causal/snapshotPipeline.d.ts +35 -0
  191. package/dist/esm/memory/causal/types.d.ts +130 -0
  192. package/dist/esm/memory/causal/writeSnapshot.d.ts +73 -0
  193. package/dist/esm/memory/define.d.ts +63 -0
  194. package/dist/esm/memory/define.types.d.ts +276 -0
  195. package/dist/esm/memory/define.types.js +1 -1
  196. package/dist/esm/memory/embedding/cosine.d.ts +18 -0
  197. package/dist/esm/memory/embedding/embedMessages.d.ts +58 -0
  198. package/dist/esm/memory/embedding/index.d.ts +8 -0
  199. package/dist/esm/memory/embedding/loadRelevant.d.ts +51 -0
  200. package/dist/esm/memory/embedding/mockEmbedder.d.ts +22 -0
  201. package/dist/esm/memory/embedding/types.d.ts +46 -0
  202. package/dist/esm/memory/entry/decay.d.ts +36 -0
  203. package/dist/esm/memory/entry/index.d.ts +2 -0
  204. package/dist/esm/memory/entry/types.d.ts +140 -0
  205. package/dist/esm/memory/facts/extractFacts.d.ts +50 -0
  206. package/dist/esm/memory/facts/extractor.d.ts +33 -0
  207. package/dist/esm/memory/facts/formatFacts.d.ts +60 -0
  208. package/dist/esm/memory/facts/index.d.ts +14 -0
  209. package/dist/esm/memory/facts/llmFactExtractor.d.ts +64 -0
  210. package/dist/esm/memory/facts/loadFacts.d.ts +43 -0
  211. package/dist/esm/memory/facts/patternFactExtractor.d.ts +2 -0
  212. package/dist/esm/memory/facts/types.d.ts +68 -0
  213. package/dist/esm/memory/facts/writeFacts.d.ts +19 -0
  214. package/dist/esm/memory/identity/index.d.ts +2 -0
  215. package/dist/esm/memory/identity/types.d.ts +49 -0
  216. package/dist/esm/memory/index.d.ts +19 -0
  217. package/dist/esm/memory/pipeline/auto.d.ts +59 -0
  218. package/dist/esm/memory/pipeline/default.d.ts +49 -0
  219. package/dist/esm/memory/pipeline/ephemeral.d.ts +28 -0
  220. package/dist/esm/memory/pipeline/fact.d.ts +26 -0
  221. package/dist/esm/memory/pipeline/index.d.ts +13 -0
  222. package/dist/esm/memory/pipeline/narrative.d.ts +35 -0
  223. package/dist/esm/memory/pipeline/semantic.d.ts +37 -0
  224. package/dist/esm/memory/pipeline/types.d.ts +31 -0
  225. package/dist/esm/memory/stages/formatDefault.d.ts +64 -0
  226. package/dist/esm/memory/stages/index.d.ts +13 -0
  227. package/dist/esm/memory/stages/loadRecent.d.ts +49 -0
  228. package/dist/esm/memory/stages/pickByBudget.d.ts +63 -0
  229. package/dist/esm/memory/stages/summarize.d.ts +87 -0
  230. package/dist/esm/memory/stages/tokenize.d.ts +43 -0
  231. package/dist/esm/memory/stages/types.d.ts +75 -0
  232. package/dist/esm/memory/stages/writeMessages.d.ts +71 -0
  233. package/dist/esm/memory/store/InMemoryStore.d.ts +62 -0
  234. package/dist/esm/memory/store/index.d.ts +2 -0
  235. package/dist/esm/memory/store/types.d.ts +223 -0
  236. package/dist/esm/memory/wire/index.d.ts +2 -0
  237. package/dist/esm/memory/wire/mountMemoryPipeline.d.ts +108 -0
  238. package/dist/esm/memory-providers.d.ts +37 -0
  239. package/dist/esm/observability/contextError/finders/compareFinders.d.ts +19 -0
  240. package/dist/esm/observability/contextError/finders/index.d.ts +22 -0
  241. package/dist/esm/observability/contextError/finders/rankSuspects.d.ts +2 -0
  242. package/dist/esm/observability/contextError/finders/removeAndRetry.d.ts +11 -0
  243. package/dist/esm/observability/contextError/finders/shrinkToCause.d.ts +11 -0
  244. package/dist/esm/observability/contextError/finders/testManyCombos.d.ts +11 -0
  245. package/dist/esm/observability/contextError/finders/traceSteps.d.ts +2 -0
  246. package/dist/esm/observability/contextError/finders/types.d.ts +88 -0
  247. package/dist/esm/observability-providers.d.ts +46 -0
  248. package/dist/esm/observe.d.ts +62 -0
  249. package/dist/esm/observe.js +7 -1
  250. package/dist/esm/observe.js.map +1 -1
  251. package/dist/esm/patterns/Debate.d.ts +39 -0
  252. package/dist/esm/patterns/MapReduce.d.ts +66 -0
  253. package/dist/esm/patterns/Reflection.d.ts +51 -0
  254. package/dist/esm/patterns/SelfConsistency.d.ts +43 -0
  255. package/dist/esm/patterns/Swarm.d.ts +60 -0
  256. package/dist/esm/patterns/ToT.d.ts +53 -0
  257. package/dist/esm/patterns/index.d.ts +22 -0
  258. package/dist/esm/providers.d.ts +33 -0
  259. package/dist/esm/recorders/core/AgentRecorder.d.ts +15 -0
  260. package/dist/esm/recorders/core/CompositionRecorder.d.ts +17 -0
  261. package/dist/esm/recorders/core/ContextEvaluatedRecorder.d.ts +23 -0
  262. package/dist/esm/recorders/core/ContextRecorder.d.ts +47 -0
  263. package/dist/esm/recorders/core/CostRecorder.d.ts +14 -0
  264. package/dist/esm/recorders/core/EmitBridge.d.ts +30 -0
  265. package/dist/esm/recorders/core/ErrorBridge.d.ts +38 -0
  266. package/dist/esm/recorders/core/EvalRecorder.d.ts +16 -0
  267. package/dist/esm/recorders/core/MemoryRecorder.d.ts +17 -0
  268. package/dist/esm/recorders/core/PermissionRecorder.d.ts +16 -0
  269. package/dist/esm/recorders/core/ReliabilityRecorder.d.ts +24 -0
  270. package/dist/esm/recorders/core/SkillRecorder.d.ts +14 -0
  271. package/dist/esm/recorders/core/StreamRecorder.d.ts +15 -0
  272. package/dist/esm/recorders/core/ToolsRecorder.d.ts +18 -0
  273. package/dist/esm/recorders/core/ValidationRecorder.d.ts +16 -0
  274. package/dist/esm/recorders/core/contextEngineering.d.ts +136 -0
  275. package/dist/esm/recorders/core/typedEmit.d.ts +34 -0
  276. package/dist/esm/recorders/core/types.d.ts +97 -0
  277. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.d.ts +117 -0
  278. package/dist/esm/recorders/observability/BoundaryRecorder.d.ts +546 -0
  279. package/dist/esm/recorders/observability/FlowchartRecorder.d.ts +220 -0
  280. package/dist/esm/recorders/observability/FlowchartRecorder.js +10 -2
  281. package/dist/esm/recorders/observability/FlowchartRecorder.js.map +1 -1
  282. package/dist/esm/recorders/observability/LiveStateRecorder.d.ts +250 -0
  283. package/dist/esm/recorders/observability/LoggingRecorder.d.ts +91 -0
  284. package/dist/esm/recorders/observability/RouteRecorder.d.ts +83 -0
  285. package/dist/esm/recorders/observability/RunStepRecorder.d.ts +231 -0
  286. package/dist/esm/recorders/observability/StatusRecorder.d.ts +36 -0
  287. package/dist/esm/recorders/observability/ToolChoiceRecorder.d.ts +164 -0
  288. package/dist/esm/recorders/observability/ToolLineageRecorder.d.ts +71 -0
  289. package/dist/esm/recorders/observability/commentary/commentaryTemplates.d.ts +105 -0
  290. package/dist/esm/recorders/observability/internal/ActorArrowClassifier.d.ts +25 -0
  291. package/dist/esm/recorders/observability/internal/CandidateAnswerBuffer.d.ts +28 -0
  292. package/dist/esm/recorders/observability/internal/ForkTracker.d.ts +60 -0
  293. package/dist/esm/recorders/observability/internal/RootInferrer.d.ts +51 -0
  294. package/dist/esm/recorders/observability/internal/SequenceSiblingTracker.d.ts +24 -0
  295. package/dist/esm/recorders/observability/localObservability.d.ts +48 -0
  296. package/dist/esm/recorders/observability/localObservability.js +54 -0
  297. package/dist/esm/recorders/observability/localObservability.js.map +1 -0
  298. package/dist/esm/recorders/observability/observeRunId.d.ts +36 -0
  299. package/dist/esm/recorders/observability/status/statusTemplates.d.ts +106 -0
  300. package/dist/esm/recorders/observability/trace.d.ts +119 -0
  301. package/dist/esm/recorders/observability/trace.js +99 -0
  302. package/dist/esm/recorders/observability/trace.js.map +1 -0
  303. package/dist/esm/reliability/CircuitBreaker.d.ts +75 -0
  304. package/dist/esm/reliability/buildReliabilityGateChart.d.ts +53 -0
  305. package/dist/esm/reliability/classifyError.d.ts +28 -0
  306. package/dist/esm/reliability/index.d.ts +35 -0
  307. package/dist/esm/reliability/types.d.ts +327 -0
  308. package/dist/esm/resilience/fallbackProvider.d.ts +33 -0
  309. package/dist/esm/resilience/index.d.ts +21 -0
  310. package/dist/esm/resilience/withCircuitBreaker.d.ts +129 -0
  311. package/dist/esm/resilience/withFallback.d.ts +45 -0
  312. package/dist/esm/resilience/withRetry.d.ts +71 -0
  313. package/dist/esm/security/PermissionPolicy.d.ts +124 -0
  314. package/dist/esm/security/PolicyHaltError.d.ts +72 -0
  315. package/dist/esm/security/extractSequence.d.ts +46 -0
  316. package/dist/esm/security/index.d.ts +44 -0
  317. package/dist/esm/security/thinkingRedaction.d.ts +50 -0
  318. package/dist/esm/status.d.ts +48 -0
  319. package/dist/esm/strategies/attach.d.ts +47 -0
  320. package/dist/esm/strategies/compose.d.ts +48 -0
  321. package/dist/esm/strategies/defaults/chatBubbleLiveStatus.d.ts +36 -0
  322. package/dist/esm/strategies/defaults/consoleObservability.d.ts +42 -0
  323. package/dist/esm/strategies/defaults/inMemorySinkCost.d.ts +50 -0
  324. package/dist/esm/strategies/defaults/index.d.ts +30 -0
  325. package/dist/esm/strategies/defaults/noopLens.d.ts +28 -0
  326. package/dist/esm/strategies/index.d.ts +36 -0
  327. package/dist/esm/strategies/registry.d.ts +70 -0
  328. package/dist/esm/strategies/types.d.ts +303 -0
  329. package/dist/esm/stream.d.ts +82 -0
  330. package/dist/esm/thinking/AnthropicThinkingHandler.d.ts +42 -0
  331. package/dist/esm/thinking/MockThinkingHandler.d.ts +50 -0
  332. package/dist/esm/thinking/OpenAIThinkingHandler.d.ts +37 -0
  333. package/dist/esm/thinking/index.d.ts +51 -0
  334. package/dist/esm/thinking/registry.d.ts +33 -0
  335. package/dist/esm/thinking/types.d.ts +162 -0
  336. package/dist/esm/tool-providers/gatedTools.d.ts +36 -0
  337. package/dist/esm/tool-providers/index.d.ts +41 -0
  338. package/dist/esm/tool-providers/skillScopedTools.d.ts +45 -0
  339. package/dist/esm/tool-providers/staticTools.d.ts +21 -0
  340. package/dist/esm/tool-providers/types.d.ts +138 -0
  341. package/dist/index.js +6 -2
  342. package/dist/index.js.map +1 -1
  343. package/dist/lib/context-bisect/index.js +3 -0
  344. package/dist/lib/context-bisect/index.js.map +1 -1
  345. package/dist/lib/context-bisect/localize.js +2 -0
  346. package/dist/lib/context-bisect/localize.js.map +1 -1
  347. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +1 -0
  348. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  349. package/dist/lib/injection-engine/entryScorer.js +178 -0
  350. package/dist/lib/injection-engine/entryScorer.js.map +1 -0
  351. package/dist/lib/injection-engine/index.js +5 -1
  352. package/dist/lib/injection-engine/index.js.map +1 -1
  353. package/dist/lib/injection-engine/skillGraph.js +35 -41
  354. package/dist/lib/injection-engine/skillGraph.js.map +1 -1
  355. package/dist/lib/injection-engine/types.js.map +1 -1
  356. package/dist/memory/define.types.js +1 -1
  357. package/dist/observe.js +14 -3
  358. package/dist/observe.js.map +1 -1
  359. package/dist/recorders/observability/FlowchartRecorder.js +12 -3
  360. package/dist/recorders/observability/FlowchartRecorder.js.map +1 -1
  361. package/dist/recorders/observability/localObservability.js +58 -0
  362. package/dist/recorders/observability/localObservability.js.map +1 -0
  363. package/dist/recorders/observability/trace.js +105 -0
  364. package/dist/recorders/observability/trace.js.map +1 -0
  365. package/dist/types/core/RunnerBase.d.ts.map +1 -1
  366. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  367. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  368. package/dist/types/core/agent/stages/pickEntry.d.ts.map +1 -1
  369. package/dist/types/core/agent/types.d.ts +8 -4
  370. package/dist/types/core/agent/types.d.ts.map +1 -1
  371. package/dist/types/core/runner.d.ts +12 -0
  372. package/dist/types/core/runner.d.ts.map +1 -1
  373. package/dist/types/index.d.ts +1 -1
  374. package/dist/types/index.d.ts.map +1 -1
  375. package/dist/types/lib/context-bisect/index.d.ts +3 -0
  376. package/dist/types/lib/context-bisect/index.d.ts.map +1 -1
  377. package/dist/types/lib/context-bisect/localize.d.ts +2 -0
  378. package/dist/types/lib/context-bisect/localize.d.ts.map +1 -1
  379. package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
  380. package/dist/types/lib/injection-engine/entryScorer.d.ts +94 -0
  381. package/dist/types/lib/injection-engine/entryScorer.d.ts.map +1 -0
  382. package/dist/types/lib/injection-engine/index.d.ts +1 -0
  383. package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
  384. package/dist/types/lib/injection-engine/skillGraph.d.ts +21 -24
  385. package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
  386. package/dist/types/lib/injection-engine/types.d.ts +9 -4
  387. package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
  388. package/dist/types/memory/define.types.d.ts +1 -1
  389. package/dist/types/observe.d.ts +3 -1
  390. package/dist/types/observe.d.ts.map +1 -1
  391. package/dist/types/recorders/observability/FlowchartRecorder.d.ts +8 -1
  392. package/dist/types/recorders/observability/FlowchartRecorder.d.ts.map +1 -1
  393. package/dist/types/recorders/observability/localObservability.d.ts +49 -0
  394. package/dist/types/recorders/observability/localObservability.d.ts.map +1 -0
  395. package/dist/types/recorders/observability/trace.d.ts +120 -0
  396. package/dist/types/recorders/observability/trace.d.ts.map +1 -0
  397. package/package.json +203 -56
@@ -0,0 +1,203 @@
1
+ /**
2
+ * conventions — subflow + stage ID constants (builder↔recorder protocol).
3
+ *
4
+ * Pattern: Single Source of Truth constants (Ward Cunningham's SSOT).
5
+ * Role: Contract between `core/` builders and `recorders/core/` observers.
6
+ * Builders mount subflows with these IDs; recorders pattern-match
7
+ * on the IDs to emit grouped domain events.
8
+ * Emits: N/A (constants only).
9
+ *
10
+ * Rename any ID here → both builders and recorders stay in sync.
11
+ */
12
+ import type { ContextSlot } from './events/types.js';
13
+ /** Subflow IDs — mounted by builders, observed by recorders. */
14
+ export declare const SUBFLOW_IDS: {
15
+ /** Injection Engine subflow. Evaluates every Injection's trigger
16
+ * and writes activeInjections[] for the slot subflows to consume. */
17
+ readonly INJECTION_ENGINE: "sf-injection-engine";
18
+ /** Inner subflow inside LLMCall that wraps the invocation
19
+ * (seed + slots + call-llm + optional thinking + extract-final).
20
+ * Mounted by LLMCall's outer `client` chart. */
21
+ readonly LLM_CALL: "sf-llm-call";
22
+ /** System-prompt slot subflow. Observed by ContextRecorder. */
23
+ readonly SYSTEM_PROMPT: "sf-system-prompt";
24
+ /** Messages slot subflow. */
25
+ readonly MESSAGES: "sf-messages";
26
+ /** Tools slot subflow. */
27
+ readonly TOOLS: "sf-tools";
28
+ /** ReAct router subflow (inside Agent). */
29
+ readonly ROUTE: "sf-route";
30
+ /** Tool-call execution subflow (inside Agent loop). */
31
+ readonly TOOL_CALLS: "sf-tool-calls";
32
+ /** Merge step inside Parallel. */
33
+ readonly MERGE: "sf-merge";
34
+ /** Final-answer composition inside Agent. Mounted via
35
+ * `addSubFlowChartBranch('final', ...)` so the subflow id is the
36
+ * Route decider's branch key — `'final'`, no `sf-` prefix. The
37
+ * decider returns `'final'` as a routing value AND the same string
38
+ * becomes the subflow's id. */
39
+ readonly FINAL: "final";
40
+ /** Cache subflow (v2.14). Wraps the whole per-turn cache machinery —
41
+ * decide markers → CacheGate decider → apply/skip — as ONE collapsible
42
+ * boundary in the chart. Provider-independent decision layer; the
43
+ * attached provider's CacheStrategy turns markers into wire format.
44
+ * UpdateSkillHistory stays OUTSIDE (in the main loop) so the rolling
45
+ * skillHistory window persists across iterations without round-tripping
46
+ * through this subflow. */
47
+ readonly CACHE: "sf-cache";
48
+ /** Cache decision subflow (v2.6). Walks activeInjections, emits
49
+ * agnostic CacheMarker[]. Provider-independent. Standalone building
50
+ * block; the agent now uses the `decideCacheMarkers` stage inside
51
+ * `sf-cache` instead of mounting this directly. */
52
+ readonly CACHE_DECISION: "sf-cache-decision";
53
+ /** Thinking-normalization mount (v2.14). Wraps the consumer's
54
+ * ThinkingHandler.normalize() in a real footprintjs subflow so it
55
+ * has its own runtimeStageId for tracing. The result lands on the
56
+ * parent LLMCall's `thinkingBlocks` payload, so this subflow is
57
+ * pure plumbing from the agent step's POV — never a user-facing
58
+ * step in the StepGraph. */
59
+ readonly THINKING: "sf-thinking";
60
+ };
61
+ export type SubflowId = (typeof SUBFLOW_IDS)[keyof typeof SUBFLOW_IDS];
62
+ /** Stage IDs — plain function stages that builders mount. */
63
+ export declare const STAGE_IDS: {
64
+ readonly SEED: "seed";
65
+ /** Relevance entry router (`entryByRelevance`). A once-per-turn function stage
66
+ * mounted between Initialize and InjectionEngine (off the ReAct loop) that
67
+ * picks the starting skill by embedding similarity → sets `currentSkillId`. */
68
+ readonly PICK_ENTRY: "pick-entry";
69
+ /** Context-assembly selector stage. Runs AFTER InjectionEngine and
70
+ * fans the 3 slot subflows (system-prompt / messages / tools) out in
71
+ * PARALLEL (selector picks all 3 every iteration; failFast so a
72
+ * required slot's throw aborts the turn). They converge before
73
+ * CacheDecision. Shared by buildAgentChart + buildDynamicAgentChart;
74
+ * the flat viz proof chart uses the same id as its root selector. */
75
+ readonly CONTEXT: "context";
76
+ /** Outer "client" stage in LLMCall's wrapped chart. Receives args on
77
+ * the first visit, $break()s on the second (post-loop) visit with
78
+ * the LLM answer as TraversalResult. This is the lens-friendly
79
+ * affordance — the User pill maps to this stage. */
80
+ readonly CLIENT: "client";
81
+ readonly CALL_LLM: "call-llm";
82
+ /** Final-response extraction stage that runs after CallLLM (and
83
+ * optional sf-thinking). For LLMCall this is mostly symmetric with
84
+ * Agent's `sf-final` branch — gives lens a "Final" node and a
85
+ * clear commit boundary marking "we have the answer." */
86
+ readonly EXTRACT_FINAL: "extract-final";
87
+ readonly FINAL: "final";
88
+ readonly FORMAT_MERGE: "format-merge";
89
+ readonly MERGE_LLM: "merge-llm";
90
+ readonly EXTRACT_MERGE: "extract-merge";
91
+ /** Updates the rolling skill-history window before CacheGate
92
+ * evaluates skill-churn (v2.6). */
93
+ readonly UPDATE_SKILL_HISTORY: "update-skill-history";
94
+ /** CacheGate decider stage — routes to apply-markers / no-markers
95
+ * based on kill switch / hit rate / skill churn (v2.6). */
96
+ readonly CACHE_GATE: "cache-gate";
97
+ /** CacheGate branch (routing key) when markers SHOULD be applied
98
+ * this iteration. Pass-through stage; markers stay in scope. (v2.6) */
99
+ readonly APPLY_MARKERS: "apply-markers";
100
+ /** CacheGate branch (routing key) when markers should be SKIPPED
101
+ * this iteration. Stage clears scope.cacheMarkers. (v2.6) */
102
+ readonly SKIP_CACHING: "no-markers";
103
+ /** BuildLLMRequest stage — calls strategy.prepareRequest to apply
104
+ * markers to the wire request (v2.6). */
105
+ readonly BUILD_LLM_REQUEST: "build-llm-request";
106
+ };
107
+ export type StageId = (typeof STAGE_IDS)[keyof typeof STAGE_IDS];
108
+ /** True when a subflow id corresponds to one of the 3 context slots. */
109
+ export declare function isSlotSubflow(id: string): id is typeof SUBFLOW_IDS.SYSTEM_PROMPT | typeof SUBFLOW_IDS.MESSAGES | typeof SUBFLOW_IDS.TOOLS;
110
+ /** Map a slot subflow id to its ContextSlot type. Undefined for non-slot ids. */
111
+ export declare function slotFromSubflowId(id: string): ContextSlot | undefined;
112
+ /**
113
+ * Resolve the context slot a scope write belongs to FROM THE WRITE'S OWN
114
+ * `runtimeStageId` — not from a "currently-open slot" stack.
115
+ *
116
+ * Why: once the 3 slot subflows run in PARALLEL (selector fan-out), their
117
+ * entry/write/exit events INTERLEAVE — a stack top is unreliable, so a write
118
+ * inside `sf-messages` could be attributed to (or dropped against)
119
+ * `sf-tools`. The write's `runtimeStageId` (`[subflowPath/]stageId#index`)
120
+ * always encodes which slot subflow enclosed it; we scan the path segments
121
+ * innermost-first for a slot id. Matches the sequential result exactly
122
+ * (the write is still inside its own slot), so it is behavior-preserving.
123
+ */
124
+ export declare function slotFromRuntimeStageId(runtimeStageId: string): ContextSlot | undefined;
125
+ /** True when an id is any of the library's known subflow IDs. */
126
+ export declare function isKnownSubflow(id: string): id is SubflowId;
127
+ /** True when an id is any of the library's known stage IDs. */
128
+ export declare function isKnownStage(id: string): id is StageId;
129
+ /**
130
+ * Semantic role of a stage, used by renderers to decide visual emphasis.
131
+ *
132
+ * The agent's chart mixes a handful of stages users actually care about
133
+ * (the HEROES — what context was built, what the model decided, what it did)
134
+ * with mechanism stages (PLUMBING). This is the ONE place that says which is
135
+ * which; renderers stay generic and style purely off this role (e.g. heroes
136
+ * prominent, plumbing muted). Keeping it here — the semantic owner — avoids
137
+ * the "name-based filter list duplicated across renderers" anti-pattern.
138
+ *
139
+ * - `hero-slot` — a context slot (system-prompt / messages / tools)
140
+ * - `hero-llm` — the LLM invocation
141
+ * - `hero-action` — tool execution (the agent's actions)
142
+ * - `plumbing` — mechanism (injection engine, cache, route, thinking, …)
143
+ * - `boundary` — neutral chart boundaries (Initialize root, Final) +
144
+ * anything unrecognised (rendered normally, never muted)
145
+ */
146
+ export type StageRole = 'hero-slot' | 'hero-llm' | 'hero-action' | 'plumbing' | 'boundary';
147
+ /**
148
+ * Classify a stage id into its {@link StageRole}. Accepts a path-qualified id
149
+ * (`sf-llm-call/call-llm`) — only the LOCAL segment matters, so it works at
150
+ * any nesting depth. Built entirely from the id constants above, so adding a
151
+ * stage to the chart only requires listing it here.
152
+ */
153
+ export declare function stageRole(id: string): StageRole;
154
+ /**
155
+ * A {@link Milestone}'s kind — the domain vocabulary for "meaningful step you'd
156
+ * scrub to" in the agent's run.
157
+ */
158
+ export type MilestoneKind = 'iteration' | 'slot' | 'llm-turn' | 'tool-call' | 'decision';
159
+ /**
160
+ * A time-travel milestone: a domain-declared scrub stop. Conceptually each
161
+ * milestone marks the boundary of a COLLECTION of commits (the commits that
162
+ * belong to that step) — so the Lens slider can step stage-by-stage
163
+ * (iteration → llm-turn → tool-call → …) instead of stopping only on
164
+ * structural subflow boundaries. The renderer iterates whatever the domain
165
+ * classifies; it never hardcodes agent vocabulary.
166
+ */
167
+ export interface Milestone {
168
+ readonly kind: MilestoneKind;
169
+ /** Human-readable base label ("LLM turn"); the renderer may add an ordinal. */
170
+ readonly label: string;
171
+ }
172
+ /**
173
+ * Classify a stage id into a {@link Milestone}, or `null` when the stage is NOT
174
+ * a milestone boundary (its commits fold into the surrounding milestone's
175
+ * collection). This is the DOMAIN's declaration of which steps are scrub-worthy;
176
+ * the Lens consumes it to build the time-travel slider (see
177
+ * agentfootprint-lens `cursorPositionsAtDrill`).
178
+ *
179
+ * Mirrors {@link stageRole}: accepts a runtimeStageId (`call-llm#17`), a
180
+ * path-qualified id (`sf-llm-call/call-llm`), or a bare local id — only the
181
+ * LOCAL stage segment matters, so it works at any nesting depth and for both
182
+ * commit ids and subflow-group ids.
183
+ */
184
+ export declare function milestoneFor(id: string): Milestone | null;
185
+ /**
186
+ * Scope-key convention for context injections.
187
+ *
188
+ * Each slot subflow writes its injections to a well-known scope key.
189
+ * ContextRecorder observes writes to these keys to emit context.injected
190
+ * events. Builders that mount slot subflows MUST write injections to the
191
+ * corresponding key; this is the data-level contract between builder and
192
+ * recorder.
193
+ */
194
+ export declare const INJECTION_KEYS: {
195
+ readonly SYSTEM_PROMPT: "systemPromptInjections";
196
+ readonly MESSAGES: "messagesInjections";
197
+ readonly TOOLS: "toolsInjections";
198
+ };
199
+ export type InjectionKey = (typeof INJECTION_KEYS)[keyof typeof INJECTION_KEYS];
200
+ /** Map a slot to its injection scope key. */
201
+ export declare function injectionKeyForSlot(slot: 'system-prompt' | 'messages' | 'tools'): InjectionKey;
202
+ /** True when a scope key is any of the known injection keys. */
203
+ export declare function isInjectionKey(key: string): key is InjectionKey;
@@ -0,0 +1,355 @@
1
+ /**
2
+ * Agent — ReAct primitive (LLM + tools + iteration loop).
3
+ *
4
+ * Pattern: Builder (GoF) → produces a Runner backed by a footprintjs FlowChart.
5
+ * Role: Layer-5 primitive (core/). Assembles the 3-slot context
6
+ * pipeline + callLLM + route decider + tool-calls subflow +
7
+ * loopTo. Composition nestable anywhere that accepts a Runner.
8
+ * Emits: Via internal recorders:
9
+ * agentfootprint.agent.turn_start / turn_end
10
+ * agentfootprint.agent.iteration_start / iteration_end
11
+ * agentfootprint.agent.route_decided
12
+ * agentfootprint.stream.llm_start / llm_end
13
+ * agentfootprint.stream.tool_start / tool_end
14
+ * agentfootprint.context.* (via ContextRecorder)
15
+ */
16
+ import { type CombinedNarrativeEntry, type FlowchartCheckpoint, type ObserverDrainResult, type RunOptions, type RuntimeSnapshot } from 'footprintjs';
17
+ import type { CachePolicy, CacheStrategy } from '../cache/types.js';
18
+ import type { ReliabilityConfig } from '../reliability/types.js';
19
+ import { type RunnerPauseOutcome } from './pause.js';
20
+ import type { MemoryDefinition } from '../memory/define.types.js';
21
+ import type { Injection, InjectionContext } from '../lib/injection-engine/types.js';
22
+ import type { EntryScoring } from '../lib/injection-engine/skillGraph.js';
23
+ import { type ResolvedOutputFallback } from './outputFallback.js';
24
+ import { type AgentRunCheckpoint } from './runCheckpoint.js';
25
+ import { type OutputSchemaParser } from './outputSchema.js';
26
+ import { RunnerBase } from './RunnerBase.js';
27
+ import type { ToolRegistryEntry } from './tools.js';
28
+ import type { ToolProvider } from '../tool-providers/types.js';
29
+ import type { AgentInput, AgentOptions, AgentOutput, ObserverDeliveryOptions } from './agent/types.js';
30
+ import { AgentBuilder } from './agent/AgentBuilder.js';
31
+ import type { ThinkingHandler } from '../thinking/types.js';
32
+ export { AgentBuilder };
33
+ export type { AgentInput, AgentOptions, AgentOutput, ObserverDeliveryOptions };
34
+ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
35
+ readonly name: string;
36
+ readonly id: string;
37
+ private readonly provider;
38
+ private readonly model;
39
+ private readonly temperature?;
40
+ private readonly maxTokens?;
41
+ private readonly maxIterations;
42
+ private readonly systemPromptValue;
43
+ /**
44
+ * Cache policy for the base system prompt (set via
45
+ * `.system(text, { cache })`). Default `'always'` — base prompt is
46
+ * stable per-turn, ideal cache anchor. CacheDecision subflow reads
47
+ * this when computing the SystemPrompt slot's cache markers.
48
+ */
49
+ private readonly systemPromptCachePolicy;
50
+ /**
51
+ * Global cache kill switch from `Agent.create({ caching: 'off' })`.
52
+ * Threaded into agent scope at seed-time as `scope.cachingDisabled`;
53
+ * read by the CacheGate decider every iteration (highest-priority rule).
54
+ */
55
+ private readonly cachingDisabledValue;
56
+ /**
57
+ * Provider-specific CacheStrategy. Auto-resolved from
58
+ * `getDefaultCacheStrategy(provider.name)` at agent build time
59
+ * unless the consumer explicitly passes one via builder option.
60
+ * Phase 7+ implementations (Anthropic, OpenAI, Bedrock) register
61
+ * themselves in the strategyRegistry on import.
62
+ */
63
+ private readonly cacheStrategy;
64
+ private readonly registry;
65
+ /**
66
+ * The Injection list — Skills, Steering, Instructions, Facts (and
67
+ * RAG, Memory). Evaluated each iteration by the
68
+ * InjectionEngine subflow; active set is filtered by slot subflows.
69
+ */
70
+ private readonly injections;
71
+ /** Skill-graph cursor resolver (`graph.nextSkill`), set when built via
72
+ * `.skillGraph(graph)`. Plumbed into the Injection Engine so route triggers
73
+ * are `from`-gated against the persisted `currentSkillId`. */
74
+ private readonly skillGraphNextSkill?;
75
+ /** Skill-graph reachable-set resolver (`graph.reachableSkills`), set when built
76
+ * via `.skillGraph(graph)`. Plumbed into the tool-calls handler so `read_skill`
77
+ * is gated to in-graph jumps. Undefined → gate off. */
78
+ private readonly skillGraphReachable?;
79
+ /** Skill-graph relevance entry scorer (`graph.scoreEntries`), set when built via
80
+ * `.skillGraph(graph)` with `.entryByRelevance()`. Drives the PickEntry stage.
81
+ * Undefined → no relevance entry routing (cold-start entry as before). */
82
+ private readonly skillGraphScoreEntries?;
83
+ private readonly pricingTable?;
84
+ private readonly costBudget?;
85
+ private readonly permissionChecker?;
86
+ private readonly toolArgValidation?;
87
+ /** Snapshot read-tracking policy (#18/#14) — forwarded to the internal
88
+ * executor. Agent default is `'summary'` (cheap markers), NOT
89
+ * footprintjs's `'full'`. See AgentOptions.readTracking. */
90
+ private readonly readTracking;
91
+ /** Commit-log value encoding (#13c-B) — forwarded to the internal
92
+ * executor. Agent default is `'delta'` (append/delete verbs; growing
93
+ * arrays like `history` record only their tails — lossless, linear
94
+ * retained memory), NOT footprintjs's `'full'`. See
95
+ * AgentOptions.commitValues. */
96
+ private readonly commitValues;
97
+ private readonly credentialProvider?;
98
+ /** Evidence bridge (#5) — present iff a CAUSAL memory is mounted. */
99
+ private readonly causalEvidence?;
100
+ /** Observer delivery tier (RFC-001 Block 10). `'inline'` (default) is
101
+ * byte-identical to pre-10 releases; `'deferred'` routes the bridge
102
+ * recorders + consumer attachments through footprintjs's bounded
103
+ * capture queue. See AgentOptions.observerDelivery. */
104
+ private readonly observerDelivery;
105
+ /** Queue dials forwarded on every deferred attach (first attach
106
+ * configures the executor's single dispatcher). */
107
+ private readonly observerDeliveryOptions?;
108
+ /**
109
+ * Voice config — shared by viewers (Lens, ChatThinkKit, CLI tail).
110
+ * `appName` is the active actor in narration ("Chatbot called…").
111
+ * `commentaryTemplates` drives Lens's third-person panel.
112
+ * `thinkingTemplates` drives chat-bubble first-person status.
113
+ * Defaults to bundled English; consumer overrides via builder.
114
+ */
115
+ readonly appName: string;
116
+ readonly commentaryTemplates: Readonly<Record<string, string>>;
117
+ readonly thinkingTemplates: Readonly<Record<string, string>>;
118
+ private currentRunContext;
119
+ /**
120
+ * Memory subsystems registered via `.memory()`. Each definition mounts
121
+ * its `read` subflow before the InjectionEngine on every turn; per-id
122
+ * scope keys (`memoryInjectionKey(id)`) keep multi-memory layering
123
+ * collision-free.
124
+ */
125
+ private readonly memories;
126
+ /**
127
+ * Optional terminal contract. Set via the builder's `.outputSchema()`.
128
+ * When present, `agent.runTyped()` parses + validates the final
129
+ * answer against this parser. `agent.run()` keeps returning the
130
+ * raw string; consumers opt into typed mode explicitly.
131
+ */
132
+ private readonly outputSchemaParser?;
133
+ /**
134
+ * Optional 3-tier degradation for output-schema validation
135
+ * failures. Set via the builder's `.outputFallback({...})`. When
136
+ * present, `parseOutput()` and `runTyped()` fall through:
137
+ * primary → fallback → canned (in order; canned guarantees no-throw).
138
+ */
139
+ private readonly outputFallbackCfg?;
140
+ /** Side-channel for `resumeOnError(...)` — when set, the seed
141
+ * function restores `scope.history` from this instead of starting
142
+ * fresh. Cleared on first read so subsequent runs start clean. */
143
+ private pendingResumeHistory?;
144
+ /**
145
+ * Optional `ToolProvider` set via the builder's `.toolProvider()`.
146
+ * When present, the Tools slot subflow consults it per iteration
147
+ * (Block A5 follow-up) — the provider's tools land alongside any
148
+ * tools registered statically via `.tool()` / `.tools()`. The
149
+ * tool-call dispatcher also consults it for per-iteration execute
150
+ * lookup so dynamic chains (`gatedTools`, `skillScopedTools`)
151
+ * dispatch correctly when their visible-set changes mid-turn.
152
+ */
153
+ private readonly externalToolProvider?;
154
+ /**
155
+ * Optional rules-based reliability config (v2.11.5+). Set via the
156
+ * builder's `.reliability({...})`. When present, every CallLLM
157
+ * execution is wrapped in a retry/fallback/fail-fast loop driven
158
+ * by `preCheck` and `postDecide` rules. Consumed by `buildCallLLMStage`.
159
+ */
160
+ private readonly reliabilityConfig?;
161
+ /**
162
+ * Resolved ThinkingHandler (v2.14+). Auto-wired by `provider.name`
163
+ * via `findThinkingHandler` UNLESS the builder explicitly set one
164
+ * (or `null` to opt out). When undefined, the NormalizeThinking
165
+ * sub-subflow is NOT mounted at chart build time — zero overhead
166
+ * for non-thinking agents.
167
+ */
168
+ private readonly thinkingHandler?;
169
+ /**
170
+ * v2.14+ — request-side thinking budget. When set, every LLMRequest
171
+ * carries `thinking: { budget }`. AnthropicProvider translates to the
172
+ * wire format. Undefined = no thinking activation (default behavior).
173
+ */
174
+ private readonly thinkingBudget?;
175
+ /** Threaded to footprintjs `flowChart()` so every node the Agent
176
+ * builder creates is observed by these recorders at build time. Set
177
+ * from `opts.structureRecorders`; undefined when consumer didn't
178
+ * attach any. */
179
+ private readonly structureRecorders?;
180
+ /** Per-COMPOSITION translator (L1b). Set from `opts.groupTranslator`;
181
+ * undefined when consumer didn't attach one. */
182
+ private readonly agentGroupTranslator?;
183
+ /** ReAct loop mode — 'dynamic' (default, re-engineer all slots each turn,
184
+ * flat chart), 'classic' (engineer context once, loop→Messages only, flat
185
+ * chart), or 'dynamic-grouped' (dynamic semantics + LLM turn wrapped in an
186
+ * sf-llm-call subflow for richer Lens grouping). Set from `opts.reactMode`.
187
+ * See AgentOptions. */
188
+ private readonly reactMode;
189
+ constructor(opts: AgentOptions, systemPromptValue: string, registry: readonly ToolRegistryEntry[], voice: {
190
+ readonly appName: string;
191
+ readonly commentaryTemplates: Readonly<Record<string, string>>;
192
+ readonly thinkingTemplates: Readonly<Record<string, string>>;
193
+ }, injections?: readonly Injection[], memories?: readonly MemoryDefinition[], outputSchemaParser?: OutputSchemaParser<unknown>, toolProvider?: ToolProvider, systemPromptCachePolicy?: CachePolicy, cachingDisabled?: boolean, cacheStrategy?: CacheStrategy, outputFallbackCfg?: ResolvedOutputFallback<unknown>, reliabilityConfig?: ReliabilityConfig, thinkingHandlerValue?: ThinkingHandler | null, thinkingBudgetValue?: number, skillGraphNextSkill?: (ctx: InjectionContext) => string | undefined, skillGraphReachable?: (currentSkillId?: string) => readonly string[], skillGraphScoreEntries?: (ctx: InjectionContext, signal?: AbortSignal) => Promise<EntryScoring>);
194
+ static create(opts: AgentOptions): AgentBuilder;
195
+ /**
196
+ * Cache policy for the base system prompt. Read by the CacheDecision
197
+ * subflow (v2.6 Phase 4) to know how to treat the SystemPrompt slot's
198
+ * cache markers. Exposed as a method (not direct field access) so
199
+ * the Agent's encapsulation boundary stays clean.
200
+ */
201
+ getSystemPromptCachePolicy(): CachePolicy;
202
+ /**
203
+ * The footprintjs `RuntimeSnapshot` from the most recent `run()` /
204
+ * `resume()`. Feeds Lens's Trace tab (ExplainableShell `runtimeSnapshot`
205
+ * prop) so consumers can scrub the execution timeline post-run without
206
+ * threading a recorder through the call site.
207
+ *
208
+ * Returns `undefined` before the first run completes. Returns the
209
+ * snapshot of the most recent run on every call after — including
210
+ * across multiple turns of the same Agent instance.
211
+ */
212
+ getLastSnapshot(): RuntimeSnapshot | undefined;
213
+ /**
214
+ * Structured narrative entries from the most recent run. Pairs with
215
+ * `getLastSnapshot()` for ExplainableShell's `narrativeEntries` prop.
216
+ * Empty array (not `undefined`) when no run has completed — matches
217
+ * the prop's expected shape so consumers can wire it directly without
218
+ * a defensive guard.
219
+ */
220
+ getLastNarrativeEntries(): readonly CombinedNarrativeEntry[];
221
+ /**
222
+ * The FlowChart compiled for the most recent run (or a freshly-built
223
+ * one if no run has happened yet). Feeds ExplainableShell's `spec`
224
+ * prop. Returning the cached chart matters: the spec must match what
225
+ * `getLastSnapshot()` traced, otherwise the Trace view's stage tree
226
+ * desyncs from the snapshot's runtime tree.
227
+ */
228
+ protected getGroupTranslator(): import('./translator.js').GroupTranslator | undefined;
229
+ /** Agent has no nested-runner members (tools are function executors,
230
+ * not Runner instances). Slot ids + tool names live in `extra` so
231
+ * Lens can render an Agent card with slot rows + a tool list without
232
+ * inspecting `buildTimeStructure`.
233
+ *
234
+ * Memories are NOT included as members — they're an internal
235
+ * mechanism, not a composition-level concept. Consumers who need
236
+ * memory visibility should listen for `agentfootprint.memory.*`
237
+ * events at runtime. */
238
+ protected buildUIGroupMetadata(): import('./translator.js').GroupMetadata;
239
+ /**
240
+ * Parse + validate a raw agent answer against the agent's
241
+ * `outputSchema` parser. Throws `OutputSchemaError` on JSON parse
242
+ * or schema validation failure (the rawOutput is preserved on the
243
+ * error for triage). Throws a plain `Error` if the agent has no
244
+ * outputSchema set.
245
+ *
246
+ * Use this when you need to keep `agent.run()` returning the raw
247
+ * string for logging/observability and validate at a different
248
+ * layer; otherwise prefer `agent.runTyped()`.
249
+ */
250
+ parseOutput<T = unknown>(raw: string): T;
251
+ /**
252
+ * Async sister of `parseOutput()`. When the agent is configured
253
+ * with `.outputFallback({...})`, this is the version that engages
254
+ * the 3-tier degradation chain on validation failure (the sync
255
+ * `parseOutput` always throws on failure for back-compat).
256
+ *
257
+ * Without `outputFallback`, behaves identically to `parseOutput`
258
+ * — returns sync-style on the happy path, throws OutputSchemaError
259
+ * on validation failure.
260
+ */
261
+ parseOutputAsync<T = unknown>(raw: string): Promise<T>;
262
+ /**
263
+ * Run the agent and return the schema-validated typed output.
264
+ * Convenience over `parseOutputAsync(await agent.run({...}))`.
265
+ *
266
+ * Throws `OutputSchemaError` on parse / validation failure UNLESS
267
+ * `.outputFallback({...})` is configured, in which case the
268
+ * 3-tier degradation chain (primary → fallback → canned) engages.
269
+ *
270
+ * Throws if the agent has no outputSchema set or if the run
271
+ * pauses (use `run()` directly when pauses are expected).
272
+ */
273
+ runTyped<T = unknown>(input: AgentInput, options?: RunOptions): Promise<T>;
274
+ run(input: AgentInput, options?: RunOptions): Promise<AgentOutput | RunnerPauseOutcome>;
275
+ /**
276
+ * Resume an agent run from a checkpoint produced by a prior
277
+ * `RunCheckpointError`. Unlike `agent.resume()` (which takes a
278
+ * `FlowchartCheckpoint` from an intentional pause), this takes
279
+ * an `AgentRunCheckpoint` (conversation-history snapshot) and
280
+ * replays the agent run with that history restored.
281
+ *
282
+ * The next iteration retries the call that originally failed —
283
+ * with the latest provider state (circuit breaker may have
284
+ * closed, vendor may have recovered, etc.).
285
+ *
286
+ * **Resume = REPLAY from the last completed iteration boundary,
287
+ * not exact-state restore.** Only the conversation history is
288
+ * restored; everything else re-seeds fresh:
289
+ *
290
+ * - **Tool re-execution / idempotency**: tool side effects from
291
+ * the FAILED iteration are not in the checkpoint. The model
292
+ * re-decides from the restored history and may re-issue those
293
+ * tool calls — they WILL execute again (there is no built-in
294
+ * toolCallId dedup). Mutating tools (payments, emails, DB
295
+ * writes) must be idempotent — key on stable call content, not
296
+ * `ctx.toolCallId` (a re-issued call gets a new id).
297
+ * - **Fresh `runId`**: the resumed run's events carry a new
298
+ * `runId`; use `checkpoint.runId` to correlate back to the
299
+ * failing run.
300
+ * - **Iteration counter + budget reset**: the resumed run starts
301
+ * at iteration 1 with a full `maxIterations` budget
302
+ * (`checkpoint.lastCompletedIteration` is diagnostic only).
303
+ * Token/cost accumulators also restart at zero.
304
+ *
305
+ * @example
306
+ * ```ts
307
+ * try {
308
+ * const result = await agent.run({ message: 'long task' });
309
+ * } catch (err) {
310
+ * if (err instanceof RunCheckpointError) {
311
+ * await checkpointStore.put(sessionId, err.checkpoint);
312
+ * // hours / restart later:
313
+ * const checkpoint = await checkpointStore.get(sessionId);
314
+ * const result = await agent.resumeOnError(checkpoint);
315
+ * }
316
+ * }
317
+ * ```
318
+ */
319
+ resumeOnError(checkpoint: AgentRunCheckpoint | unknown, options?: RunOptions): Promise<AgentOutput | RunnerPauseOutcome>;
320
+ /**
321
+ * Install a per-run checkpoint tracker. Listens for the agent's
322
+ * own iteration_end events on `this.dispatcher` and snapshots the
323
+ * conversation history into the tracker. Returns a stop function.
324
+ *
325
+ * @internal
326
+ */
327
+ private installCheckpointTracker;
328
+ resume(checkpoint: FlowchartCheckpoint, input?: unknown, options?: RunOptions): Promise<AgentOutput | RunnerPauseOutcome>;
329
+ private createExecutor;
330
+ /**
331
+ * Flush the deferred-observer backlog of the most recent run's executor,
332
+ * then await async listener completions under a deadline (RFC-001 §11 —
333
+ * the serverless / graceful-shutdown pattern). Resolves immediately with
334
+ * zeros before the first run or when `observerDelivery` is `'inline'`
335
+ * and no recorder opted into `'deferred'` itself.
336
+ *
337
+ * `pending === 0` means a full drain; non-zero honestly reports
338
+ * continuations still outstanding at the deadline — never silent loss.
339
+ *
340
+ * @example Lambda-style handler
341
+ * ```ts
342
+ * export const handler = async (event) => {
343
+ * const reply = await agent.run({ message: event.message });
344
+ * // settle "one beat behind" observer work BEFORE the freeze:
345
+ * await agent.drainObservers({ timeoutMs: 5_000 });
346
+ * return reply;
347
+ * };
348
+ * ```
349
+ */
350
+ drainObservers(opts?: {
351
+ timeoutMs?: number;
352
+ }): Promise<ObserverDrainResult>;
353
+ private finalizeResult;
354
+ private buildChart;
355
+ }