agentfootprint 6.44.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 (366) hide show
  1. package/ai-instructions/setup.sh +0 -0
  2. package/dist/core/agent/buildAgentChart.js +2 -1
  3. package/dist/core/agent/buildAgentChart.js.map +1 -1
  4. package/dist/core/agent/buildDynamicAgentChart.js +3 -1
  5. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  6. package/dist/core/agent/stages/pickEntry.js +3 -1
  7. package/dist/core/agent/stages/pickEntry.js.map +1 -1
  8. package/dist/esm/adapters/identity/agentcore.d.ts +100 -0
  9. package/dist/esm/adapters/llm/AnthropicProvider.d.ts +130 -0
  10. package/dist/esm/adapters/llm/BedrockProvider.d.ts +100 -0
  11. package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +41 -0
  12. package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +95 -0
  13. package/dist/esm/adapters/llm/MockProvider.d.ts +153 -0
  14. package/dist/esm/adapters/llm/OpenAIProvider.d.ts +220 -0
  15. package/dist/esm/adapters/llm/createProvider.d.ts +85 -0
  16. package/dist/esm/adapters/memory/agentcore.d.ts +146 -0
  17. package/dist/esm/adapters/memory/bedrockAgentMemory.d.ts +95 -0
  18. package/dist/esm/adapters/memory/redis.d.ts +127 -0
  19. package/dist/esm/adapters/observability/agentcore.d.ts +67 -0
  20. package/dist/esm/adapters/observability/audit.d.ts +254 -0
  21. package/dist/esm/adapters/observability/cloudwatch.d.ts +96 -0
  22. package/dist/esm/adapters/observability/otel.d.ts +237 -0
  23. package/dist/esm/adapters/observability/xray.d.ts +88 -0
  24. package/dist/esm/adapters/types.d.ts +378 -0
  25. package/dist/esm/bridge/eventMeta.d.ts +59 -0
  26. package/dist/esm/cache/CacheDecisionSubflow.d.ts +85 -0
  27. package/dist/esm/cache/CacheGateDecider.d.ts +127 -0
  28. package/dist/esm/cache/applyCachePolicy.d.ts +37 -0
  29. package/dist/esm/cache/cacheRecorder.d.ts +85 -0
  30. package/dist/esm/cache/index.d.ts +33 -0
  31. package/dist/esm/cache/strategies/AnthropicCacheStrategy.d.ts +38 -0
  32. package/dist/esm/cache/strategies/BedrockCacheStrategy.d.ts +33 -0
  33. package/dist/esm/cache/strategies/NoOpCacheStrategy.d.ts +29 -0
  34. package/dist/esm/cache/strategies/OpenAICacheStrategy.d.ts +36 -0
  35. package/dist/esm/cache/strategyRegistry.d.ts +45 -0
  36. package/dist/esm/cache/types.d.ts +243 -0
  37. package/dist/esm/conventions.d.ts +203 -0
  38. package/dist/esm/core/Agent.d.ts +355 -0
  39. package/dist/esm/core/LLMCall.d.ts +139 -0
  40. package/dist/esm/core/RunnerBase.d.ts +267 -0
  41. package/dist/esm/core/agent/AgentBuilder.d.ts +565 -0
  42. package/dist/esm/core/agent/buildAgentChart.d.ts +109 -0
  43. package/dist/esm/core/agent/buildAgentChart.js +2 -1
  44. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  45. package/dist/esm/core/agent/buildAgentMessageApiChart.d.ts +40 -0
  46. package/dist/esm/core/agent/buildCacheSubflow.d.ts +35 -0
  47. package/dist/esm/core/agent/buildDynamicAgentChart.d.ts +56 -0
  48. package/dist/esm/core/agent/buildDynamicAgentChart.js +3 -1
  49. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  50. package/dist/esm/core/agent/buildMessageApiChart.d.ts +47 -0
  51. package/dist/esm/core/agent/buildToolRegistry.d.ts +61 -0
  52. package/dist/esm/core/agent/memoryRecallInjections.d.ts +8 -0
  53. package/dist/esm/core/agent/stages/breakFinal.d.ts +22 -0
  54. package/dist/esm/core/agent/stages/callLLM.d.ts +74 -0
  55. package/dist/esm/core/agent/stages/pickEntry.d.ts +19 -0
  56. package/dist/esm/core/agent/stages/pickEntry.js +3 -1
  57. package/dist/esm/core/agent/stages/pickEntry.js.map +1 -1
  58. package/dist/esm/core/agent/stages/prepareFinal.d.ts +19 -0
  59. package/dist/esm/core/agent/stages/reliabilityExecution.d.ts +135 -0
  60. package/dist/esm/core/agent/stages/route.d.ts +18 -0
  61. package/dist/esm/core/agent/stages/seed.d.ts +53 -0
  62. package/dist/esm/core/agent/stages/toolCalls.d.ts +76 -0
  63. package/dist/esm/core/agent/toolArgsValidation.d.ts +62 -0
  64. package/dist/esm/core/agent/types.d.ts +382 -0
  65. package/dist/esm/core/agent/validators.d.ts +52 -0
  66. package/dist/esm/core/cost.d.ts +38 -0
  67. package/dist/esm/core/flowchartAsTool.d.ts +200 -0
  68. package/dist/esm/core/humanizeLLMError.d.ts +23 -0
  69. package/dist/esm/core/outputFallback.d.ts +139 -0
  70. package/dist/esm/core/outputSchema.d.ts +127 -0
  71. package/dist/esm/core/pause.d.ts +74 -0
  72. package/dist/esm/core/runCheckpoint.d.ts +179 -0
  73. package/dist/esm/core/runner.d.ts +203 -0
  74. package/dist/esm/core/slots/buildMessagesSlot.d.ts +40 -0
  75. package/dist/esm/core/slots/buildSystemPromptSlot.d.ts +41 -0
  76. package/dist/esm/core/slots/buildThinkingSubflow.d.ts +40 -0
  77. package/dist/esm/core/slots/buildToolsSlot.d.ts +60 -0
  78. package/dist/esm/core/slots/helpers.d.ts +27 -0
  79. package/dist/esm/core/toolContract.d.ts +43 -0
  80. package/dist/esm/core/tools.d.ts +90 -0
  81. package/dist/esm/core/translator.d.ts +94 -0
  82. package/dist/esm/core-flow/Conditional.d.ts +119 -0
  83. package/dist/esm/core-flow/Loop.d.ts +160 -0
  84. package/dist/esm/core-flow/Parallel.d.ts +360 -0
  85. package/dist/esm/core-flow/Sequence.d.ts +133 -0
  86. package/dist/esm/events/dispatcher.d.ts +134 -0
  87. package/dist/esm/events/payloads.d.ts +761 -0
  88. package/dist/esm/events/registry.d.ts +198 -0
  89. package/dist/esm/events/types.d.ts +70 -0
  90. package/dist/esm/identity/kinds.d.ts +36 -0
  91. package/dist/esm/identity/staticTokens.d.ts +28 -0
  92. package/dist/esm/identity/types.d.ts +113 -0
  93. package/dist/esm/identity/withCredentialRetry.d.ts +64 -0
  94. package/dist/esm/identity.d.ts +31 -0
  95. package/dist/esm/index.d.ts +64 -0
  96. package/dist/esm/index.js +2 -0
  97. package/dist/esm/index.js.map +1 -1
  98. package/dist/esm/injection-engine.d.ts +4 -0
  99. package/dist/esm/lib/canonicalJson.d.ts +56 -0
  100. package/dist/esm/lib/context-bisect/ablation.d.ts +109 -0
  101. package/dist/esm/lib/context-bisect/bisect.d.ts +75 -0
  102. package/dist/esm/lib/context-bisect/cost.d.ts +37 -0
  103. package/dist/esm/lib/context-bisect/index.d.ts +31 -0
  104. package/dist/esm/lib/context-bisect/index.js +3 -0
  105. package/dist/esm/lib/context-bisect/index.js.map +1 -1
  106. package/dist/esm/lib/context-bisect/llmEdgeWeigher.d.ts +124 -0
  107. package/dist/esm/lib/context-bisect/localize.d.ts +152 -0
  108. package/dist/esm/lib/context-bisect/localize.js +2 -0
  109. package/dist/esm/lib/context-bisect/localize.js.map +1 -1
  110. package/dist/esm/lib/context-bisect/loop-recall.d.ts +97 -0
  111. package/dist/esm/lib/context-bisect/missingContext.d.ts +71 -0
  112. package/dist/esm/lib/context-bisect/restoration.d.ts +39 -0
  113. package/dist/esm/lib/context-bisect/toBacktrackTrace.d.ts +138 -0
  114. package/dist/esm/lib/context-bisect/trajectory.d.ts +168 -0
  115. package/dist/esm/lib/context-bisect/types.d.ts +448 -0
  116. package/dist/esm/lib/context-bisect/walk-to-root.d.ts +103 -0
  117. package/dist/esm/lib/influence-core/attributability.d.ts +72 -0
  118. package/dist/esm/lib/influence-core/cache.d.ts +94 -0
  119. package/dist/esm/lib/influence-core/contrastive.d.ts +26 -0
  120. package/dist/esm/lib/influence-core/index.d.ts +34 -0
  121. package/dist/esm/lib/influence-core/margin.d.ts +33 -0
  122. package/dist/esm/lib/influence-core/signals.d.ts +128 -0
  123. package/dist/esm/lib/influence-core/similarity.d.ts +25 -0
  124. package/dist/esm/lib/influence-core/types.d.ts +252 -0
  125. package/dist/esm/lib/injection-engine/SkillRegistry.d.ts +147 -0
  126. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.d.ts +110 -0
  127. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +1 -0
  128. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  129. package/dist/esm/lib/injection-engine/entryScorer.d.ts +93 -0
  130. package/dist/esm/lib/injection-engine/entryScorer.js +172 -0
  131. package/dist/esm/lib/injection-engine/entryScorer.js.map +1 -0
  132. package/dist/esm/lib/injection-engine/evaluator.d.ts +24 -0
  133. package/dist/esm/lib/injection-engine/factories/defineFact.d.ts +60 -0
  134. package/dist/esm/lib/injection-engine/factories/defineInjection.d.ts +41 -0
  135. package/dist/esm/lib/injection-engine/factories/defineInstruction.d.ts +78 -0
  136. package/dist/esm/lib/injection-engine/factories/defineRelevanceHint.d.ts +26 -0
  137. package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +160 -0
  138. package/dist/esm/lib/injection-engine/factories/defineSteering.d.ts +39 -0
  139. package/dist/esm/lib/injection-engine/index.d.ts +22 -0
  140. package/dist/esm/lib/injection-engine/index.js +1 -0
  141. package/dist/esm/lib/injection-engine/index.js.map +1 -1
  142. package/dist/esm/lib/injection-engine/skillContract.d.ts +29 -0
  143. package/dist/esm/lib/injection-engine/skillGraph.d.ts +289 -0
  144. package/dist/esm/lib/injection-engine/skillGraph.js +35 -41
  145. package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
  146. package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +49 -0
  147. package/dist/esm/lib/injection-engine/skillTools.d.ts +72 -0
  148. package/dist/esm/lib/injection-engine/softmax.d.ts +11 -0
  149. package/dist/esm/lib/injection-engine/types.d.ts +229 -0
  150. package/dist/esm/lib/injection-engine/types.js.map +1 -1
  151. package/dist/esm/lib/lazyRequire.d.ts +29 -0
  152. package/dist/esm/lib/mcp/index.d.ts +9 -0
  153. package/dist/esm/lib/mcp/mcpClient.d.ts +46 -0
  154. package/dist/esm/lib/mcp/mockMcpClient.d.ts +65 -0
  155. package/dist/esm/lib/mcp/types.d.ts +133 -0
  156. package/dist/esm/lib/rag/defineRAG.d.ts +139 -0
  157. package/dist/esm/lib/rag/index.d.ts +7 -0
  158. package/dist/esm/lib/rag/indexDocuments.d.ts +105 -0
  159. package/dist/esm/lib/tool-lint/analyze.d.ts +83 -0
  160. package/dist/esm/lib/tool-lint/cli.d.ts +43 -0
  161. package/dist/esm/lib/tool-lint/format.d.ts +18 -0
  162. package/dist/esm/lib/tool-lint/index.d.ts +23 -0
  163. package/dist/esm/lib/tool-lint/rules.d.ts +85 -0
  164. package/dist/esm/lib/tool-lint/types.d.ts +155 -0
  165. package/dist/esm/lib/trace-toolpack/bounded.d.ts +47 -0
  166. package/dist/esm/lib/trace-toolpack/debugPrompt.d.ts +19 -0
  167. package/dist/esm/lib/trace-toolpack/index.d.ts +20 -0
  168. package/dist/esm/lib/trace-toolpack/lazyToolpack.d.ts +35 -0
  169. package/dist/esm/lib/trace-toolpack/selfExplain.d.ts +100 -0
  170. package/dist/esm/lib/trace-toolpack/traceDebugAgent.d.ts +42 -0
  171. package/dist/esm/lib/trace-toolpack/traceToolpack.d.ts +69 -0
  172. package/dist/esm/lib/trace-toolpack/types.d.ts +59 -0
  173. package/dist/esm/llm-providers.d.ts +26 -0
  174. package/dist/esm/locales/index.d.ts +132 -0
  175. package/dist/esm/memory/beats/extractBeats.d.ts +61 -0
  176. package/dist/esm/memory/beats/extractor.d.ts +47 -0
  177. package/dist/esm/memory/beats/formatAsNarrative.d.ts +62 -0
  178. package/dist/esm/memory/beats/heuristicExtractor.d.ts +37 -0
  179. package/dist/esm/memory/beats/index.d.ts +12 -0
  180. package/dist/esm/memory/beats/llmExtractor.d.ts +56 -0
  181. package/dist/esm/memory/beats/types.d.ts +60 -0
  182. package/dist/esm/memory/beats/writeBeats.d.ts +22 -0
  183. package/dist/esm/memory/causal/evidenceRecorder.d.ts +66 -0
  184. package/dist/esm/memory/causal/index.d.ts +6 -0
  185. package/dist/esm/memory/causal/loadSnapshot.d.ts +51 -0
  186. package/dist/esm/memory/causal/snapshotPipeline.d.ts +35 -0
  187. package/dist/esm/memory/causal/types.d.ts +130 -0
  188. package/dist/esm/memory/causal/writeSnapshot.d.ts +73 -0
  189. package/dist/esm/memory/define.d.ts +63 -0
  190. package/dist/esm/memory/define.types.d.ts +276 -0
  191. package/dist/esm/memory/define.types.js +1 -1
  192. package/dist/esm/memory/embedding/cosine.d.ts +18 -0
  193. package/dist/esm/memory/embedding/embedMessages.d.ts +58 -0
  194. package/dist/esm/memory/embedding/index.d.ts +8 -0
  195. package/dist/esm/memory/embedding/loadRelevant.d.ts +51 -0
  196. package/dist/esm/memory/embedding/mockEmbedder.d.ts +22 -0
  197. package/dist/esm/memory/embedding/types.d.ts +46 -0
  198. package/dist/esm/memory/entry/decay.d.ts +36 -0
  199. package/dist/esm/memory/entry/index.d.ts +2 -0
  200. package/dist/esm/memory/entry/types.d.ts +140 -0
  201. package/dist/esm/memory/facts/extractFacts.d.ts +50 -0
  202. package/dist/esm/memory/facts/extractor.d.ts +33 -0
  203. package/dist/esm/memory/facts/formatFacts.d.ts +60 -0
  204. package/dist/esm/memory/facts/index.d.ts +14 -0
  205. package/dist/esm/memory/facts/llmFactExtractor.d.ts +64 -0
  206. package/dist/esm/memory/facts/loadFacts.d.ts +43 -0
  207. package/dist/esm/memory/facts/patternFactExtractor.d.ts +2 -0
  208. package/dist/esm/memory/facts/types.d.ts +68 -0
  209. package/dist/esm/memory/facts/writeFacts.d.ts +19 -0
  210. package/dist/esm/memory/identity/index.d.ts +2 -0
  211. package/dist/esm/memory/identity/types.d.ts +49 -0
  212. package/dist/esm/memory/index.d.ts +19 -0
  213. package/dist/esm/memory/pipeline/auto.d.ts +59 -0
  214. package/dist/esm/memory/pipeline/default.d.ts +49 -0
  215. package/dist/esm/memory/pipeline/ephemeral.d.ts +28 -0
  216. package/dist/esm/memory/pipeline/fact.d.ts +26 -0
  217. package/dist/esm/memory/pipeline/index.d.ts +13 -0
  218. package/dist/esm/memory/pipeline/narrative.d.ts +35 -0
  219. package/dist/esm/memory/pipeline/semantic.d.ts +37 -0
  220. package/dist/esm/memory/pipeline/types.d.ts +31 -0
  221. package/dist/esm/memory/stages/formatDefault.d.ts +64 -0
  222. package/dist/esm/memory/stages/index.d.ts +13 -0
  223. package/dist/esm/memory/stages/loadRecent.d.ts +49 -0
  224. package/dist/esm/memory/stages/pickByBudget.d.ts +63 -0
  225. package/dist/esm/memory/stages/summarize.d.ts +87 -0
  226. package/dist/esm/memory/stages/tokenize.d.ts +43 -0
  227. package/dist/esm/memory/stages/types.d.ts +75 -0
  228. package/dist/esm/memory/stages/writeMessages.d.ts +71 -0
  229. package/dist/esm/memory/store/InMemoryStore.d.ts +62 -0
  230. package/dist/esm/memory/store/index.d.ts +2 -0
  231. package/dist/esm/memory/store/types.d.ts +223 -0
  232. package/dist/esm/memory/wire/index.d.ts +2 -0
  233. package/dist/esm/memory/wire/mountMemoryPipeline.d.ts +108 -0
  234. package/dist/esm/memory-providers.d.ts +37 -0
  235. package/dist/esm/observability/contextError/finders/compareFinders.d.ts +19 -0
  236. package/dist/esm/observability/contextError/finders/index.d.ts +22 -0
  237. package/dist/esm/observability/contextError/finders/rankSuspects.d.ts +2 -0
  238. package/dist/esm/observability/contextError/finders/removeAndRetry.d.ts +11 -0
  239. package/dist/esm/observability/contextError/finders/shrinkToCause.d.ts +11 -0
  240. package/dist/esm/observability/contextError/finders/testManyCombos.d.ts +11 -0
  241. package/dist/esm/observability/contextError/finders/traceSteps.d.ts +2 -0
  242. package/dist/esm/observability/contextError/finders/types.d.ts +88 -0
  243. package/dist/esm/observability-providers.d.ts +46 -0
  244. package/dist/esm/observe.d.ts +62 -0
  245. package/dist/esm/patterns/Debate.d.ts +39 -0
  246. package/dist/esm/patterns/MapReduce.d.ts +66 -0
  247. package/dist/esm/patterns/Reflection.d.ts +51 -0
  248. package/dist/esm/patterns/SelfConsistency.d.ts +43 -0
  249. package/dist/esm/patterns/Swarm.d.ts +60 -0
  250. package/dist/esm/patterns/ToT.d.ts +53 -0
  251. package/dist/esm/patterns/index.d.ts +22 -0
  252. package/dist/esm/providers.d.ts +33 -0
  253. package/dist/esm/recorders/core/AgentRecorder.d.ts +15 -0
  254. package/dist/esm/recorders/core/CompositionRecorder.d.ts +17 -0
  255. package/dist/esm/recorders/core/ContextEvaluatedRecorder.d.ts +23 -0
  256. package/dist/esm/recorders/core/ContextRecorder.d.ts +47 -0
  257. package/dist/esm/recorders/core/CostRecorder.d.ts +14 -0
  258. package/dist/esm/recorders/core/EmitBridge.d.ts +30 -0
  259. package/dist/esm/recorders/core/ErrorBridge.d.ts +38 -0
  260. package/dist/esm/recorders/core/EvalRecorder.d.ts +16 -0
  261. package/dist/esm/recorders/core/MemoryRecorder.d.ts +17 -0
  262. package/dist/esm/recorders/core/PermissionRecorder.d.ts +16 -0
  263. package/dist/esm/recorders/core/ReliabilityRecorder.d.ts +24 -0
  264. package/dist/esm/recorders/core/SkillRecorder.d.ts +14 -0
  265. package/dist/esm/recorders/core/StreamRecorder.d.ts +15 -0
  266. package/dist/esm/recorders/core/ToolsRecorder.d.ts +18 -0
  267. package/dist/esm/recorders/core/ValidationRecorder.d.ts +16 -0
  268. package/dist/esm/recorders/core/contextEngineering.d.ts +136 -0
  269. package/dist/esm/recorders/core/typedEmit.d.ts +34 -0
  270. package/dist/esm/recorders/core/types.d.ts +97 -0
  271. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.d.ts +117 -0
  272. package/dist/esm/recorders/observability/BoundaryRecorder.d.ts +546 -0
  273. package/dist/esm/recorders/observability/FlowchartRecorder.d.ts +220 -0
  274. package/dist/esm/recorders/observability/LiveStateRecorder.d.ts +250 -0
  275. package/dist/esm/recorders/observability/LoggingRecorder.d.ts +91 -0
  276. package/dist/esm/recorders/observability/RouteRecorder.d.ts +83 -0
  277. package/dist/esm/recorders/observability/RunStepRecorder.d.ts +231 -0
  278. package/dist/esm/recorders/observability/StatusRecorder.d.ts +36 -0
  279. package/dist/esm/recorders/observability/ToolChoiceRecorder.d.ts +164 -0
  280. package/dist/esm/recorders/observability/ToolLineageRecorder.d.ts +71 -0
  281. package/dist/esm/recorders/observability/commentary/commentaryTemplates.d.ts +105 -0
  282. package/dist/esm/recorders/observability/internal/ActorArrowClassifier.d.ts +25 -0
  283. package/dist/esm/recorders/observability/internal/CandidateAnswerBuffer.d.ts +28 -0
  284. package/dist/esm/recorders/observability/internal/ForkTracker.d.ts +60 -0
  285. package/dist/esm/recorders/observability/internal/RootInferrer.d.ts +51 -0
  286. package/dist/esm/recorders/observability/internal/SequenceSiblingTracker.d.ts +24 -0
  287. package/dist/esm/recorders/observability/localObservability.d.ts +48 -0
  288. package/dist/esm/recorders/observability/observeRunId.d.ts +36 -0
  289. package/dist/esm/recorders/observability/status/statusTemplates.d.ts +106 -0
  290. package/dist/esm/recorders/observability/trace.d.ts +119 -0
  291. package/dist/esm/reliability/CircuitBreaker.d.ts +75 -0
  292. package/dist/esm/reliability/buildReliabilityGateChart.d.ts +53 -0
  293. package/dist/esm/reliability/classifyError.d.ts +28 -0
  294. package/dist/esm/reliability/index.d.ts +35 -0
  295. package/dist/esm/reliability/types.d.ts +327 -0
  296. package/dist/esm/resilience/fallbackProvider.d.ts +33 -0
  297. package/dist/esm/resilience/index.d.ts +21 -0
  298. package/dist/esm/resilience/withCircuitBreaker.d.ts +129 -0
  299. package/dist/esm/resilience/withFallback.d.ts +45 -0
  300. package/dist/esm/resilience/withRetry.d.ts +71 -0
  301. package/dist/esm/security/PermissionPolicy.d.ts +124 -0
  302. package/dist/esm/security/PolicyHaltError.d.ts +72 -0
  303. package/dist/esm/security/extractSequence.d.ts +46 -0
  304. package/dist/esm/security/index.d.ts +44 -0
  305. package/dist/esm/security/thinkingRedaction.d.ts +50 -0
  306. package/dist/esm/status.d.ts +48 -0
  307. package/dist/esm/strategies/attach.d.ts +47 -0
  308. package/dist/esm/strategies/compose.d.ts +48 -0
  309. package/dist/esm/strategies/defaults/chatBubbleLiveStatus.d.ts +36 -0
  310. package/dist/esm/strategies/defaults/consoleObservability.d.ts +42 -0
  311. package/dist/esm/strategies/defaults/inMemorySinkCost.d.ts +50 -0
  312. package/dist/esm/strategies/defaults/index.d.ts +30 -0
  313. package/dist/esm/strategies/defaults/noopLens.d.ts +28 -0
  314. package/dist/esm/strategies/index.d.ts +36 -0
  315. package/dist/esm/strategies/registry.d.ts +70 -0
  316. package/dist/esm/strategies/types.d.ts +303 -0
  317. package/dist/esm/stream.d.ts +82 -0
  318. package/dist/esm/thinking/AnthropicThinkingHandler.d.ts +42 -0
  319. package/dist/esm/thinking/MockThinkingHandler.d.ts +50 -0
  320. package/dist/esm/thinking/OpenAIThinkingHandler.d.ts +37 -0
  321. package/dist/esm/thinking/index.d.ts +51 -0
  322. package/dist/esm/thinking/registry.d.ts +33 -0
  323. package/dist/esm/thinking/types.d.ts +162 -0
  324. package/dist/esm/tool-providers/gatedTools.d.ts +36 -0
  325. package/dist/esm/tool-providers/index.d.ts +41 -0
  326. package/dist/esm/tool-providers/skillScopedTools.d.ts +45 -0
  327. package/dist/esm/tool-providers/staticTools.d.ts +21 -0
  328. package/dist/esm/tool-providers/types.d.ts +138 -0
  329. package/dist/index.js +6 -2
  330. package/dist/index.js.map +1 -1
  331. package/dist/lib/context-bisect/index.js +3 -0
  332. package/dist/lib/context-bisect/index.js.map +1 -1
  333. package/dist/lib/context-bisect/localize.js +2 -0
  334. package/dist/lib/context-bisect/localize.js.map +1 -1
  335. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +1 -0
  336. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  337. package/dist/lib/injection-engine/entryScorer.js +178 -0
  338. package/dist/lib/injection-engine/entryScorer.js.map +1 -0
  339. package/dist/lib/injection-engine/index.js +5 -1
  340. package/dist/lib/injection-engine/index.js.map +1 -1
  341. package/dist/lib/injection-engine/skillGraph.js +35 -41
  342. package/dist/lib/injection-engine/skillGraph.js.map +1 -1
  343. package/dist/lib/injection-engine/types.js.map +1 -1
  344. package/dist/memory/define.types.js +1 -1
  345. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  346. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  347. package/dist/types/core/agent/stages/pickEntry.d.ts.map +1 -1
  348. package/dist/types/core/agent/types.d.ts +8 -4
  349. package/dist/types/core/agent/types.d.ts.map +1 -1
  350. package/dist/types/index.d.ts +1 -1
  351. package/dist/types/index.d.ts.map +1 -1
  352. package/dist/types/lib/context-bisect/index.d.ts +3 -0
  353. package/dist/types/lib/context-bisect/index.d.ts.map +1 -1
  354. package/dist/types/lib/context-bisect/localize.d.ts +2 -0
  355. package/dist/types/lib/context-bisect/localize.d.ts.map +1 -1
  356. package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
  357. package/dist/types/lib/injection-engine/entryScorer.d.ts +94 -0
  358. package/dist/types/lib/injection-engine/entryScorer.d.ts.map +1 -0
  359. package/dist/types/lib/injection-engine/index.d.ts +1 -0
  360. package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
  361. package/dist/types/lib/injection-engine/skillGraph.d.ts +21 -24
  362. package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
  363. package/dist/types/lib/injection-engine/types.d.ts +9 -4
  364. package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
  365. package/dist/types/memory/define.types.d.ts +1 -1
  366. package/package.json +203 -56
@@ -0,0 +1,220 @@
1
+ /**
2
+ * FlowchartRecorder — StepGraph projection over `BoundaryRecorder`.
3
+ *
4
+ * Pattern: Pure projection. `attachFlowchart` wires a `BoundaryRecorder`
5
+ * to the executor + dispatcher; `buildStepGraph` is a fold over
6
+ * `boundary.getEvents()` that produces the renderer-friendly
7
+ * `StepGraph` shape Lens (and any other consumer) renders.
8
+ *
9
+ * ZERO state machine in this file. ZERO event subscription.
10
+ * ZERO name-based filters. Everything that decides "what's a
11
+ * step" lives in BoundaryRecorder via capture-time tags
12
+ * (`actorArrow`, `slotKind`, `primitiveKind`, `isAgentInternal`).
13
+ *
14
+ * Role: Tier 3 observability. Enabled via
15
+ * `runner.enable.flowchart({ onUpdate })`. The handle exposes:
16
+ *
17
+ * handle.getSnapshot() → derived StepGraph (back-compat)
18
+ * handle.boundary → the underlying BoundaryRecorder
19
+ * (Lens reads it directly for richer
20
+ * queries: getSlotBoundaries(),
21
+ * getEventsByType, etc.)
22
+ *
23
+ * Event → StepNode mapping (the entire policy):
24
+ *
25
+ * run.entry → StepNode kind='subflow', primitiveKind='Run'
26
+ * subflow.entry → StepNode kind='subflow' (skipped if isAgentInternal
27
+ * or slotKind set —
28
+ * those are sub-components
29
+ * of the actor arrows)
30
+ * fork.branch → StepNode kind='fork-branch'
31
+ * decision.branch → StepNode kind='decision-branch'
32
+ * llm.start → StepNode kind=actorArrow ('user→llm' | 'tool→llm')
33
+ * tool.start → StepNode kind='llm->tool'
34
+ * llm.end terminal → StepNode kind='llm->user' (delivery marker)
35
+ * loop.iteration → loop-iteration StepEdge
36
+ * context.injected → attached to NEXT user→llm / tool→llm StepNode
37
+ *
38
+ * Result: a one-to-one correspondence between visible scrubbable steps
39
+ * and DomainEvents. Adding a new event type adds one mapping line here
40
+ * (or in the pure projection); no state machine, no merging.
41
+ */
42
+ import type { CombinedRecorder } from 'footprintjs';
43
+ import type { EventDispatcher } from '../../events/dispatcher.js';
44
+ import { BoundaryRecorder, type DomainEvent } from './BoundaryRecorder.js';
45
+ /**
46
+ * One node in the step-level flowchart. Node kind drives rendering
47
+ * (actor icon, color). ReAct steps carry token + tool details; topology
48
+ * nodes (subflow / fork-branch / decision-branch) mirror the footprintjs
49
+ * composition events and exist so composition structure (Loop, Parallel,
50
+ * Conditional, Swarm) stays visible in the graph.
51
+ */
52
+ export interface StepNode {
53
+ readonly id: string;
54
+ readonly kind: 'user->llm' | 'llm->tool' | 'tool->llm' | 'llm->user' | 'subflow' | 'fork-branch' | 'decision-branch';
55
+ readonly label: string;
56
+ readonly startOffsetMs: number;
57
+ readonly endOffsetMs?: number;
58
+ /** LLM step: token usage of the call that bounded this step. */
59
+ readonly tokens?: {
60
+ readonly in: number;
61
+ readonly out: number;
62
+ };
63
+ /** llm->tool / tool->llm: the tool name. */
64
+ readonly toolName?: string;
65
+ /** user->llm / tool->llm: the model that was invoked. */
66
+ readonly llmModel?: string;
67
+ /** Decomposition of the underlying subflowId (rooted under '__root__'). */
68
+ readonly subflowPath: readonly string[];
69
+ /** Context injections attributed to this step (LLM steps only). */
70
+ readonly injections?: readonly ContextInjection[];
71
+ /** 1-based ReAct iteration this step belongs to. Undefined for
72
+ * topology / composition nodes. */
73
+ readonly iterationIndex?: number;
74
+ /** Which slot the step's input updated. ReAct steps only. */
75
+ readonly slotUpdated?: 'system-prompt' | 'messages' | 'tools';
76
+ /** True ONLY for `subflow` StepNodes whose primitiveKind is `'Agent'`.
77
+ * Narrow flag for callers that distinguish ReAct agents from other
78
+ * composition primitives (cost / iteration / token attribution). */
79
+ readonly isAgentBoundary?: boolean;
80
+ /** Primitive kind from the subflow root description prefix
81
+ * (`'Agent'` / `'LLMCall'` / `'Sequence'` / etc.). */
82
+ readonly primitiveKind?: string;
83
+ /** True for `subflow` StepNodes representing any KNOWN primitive
84
+ * (Agent / LLMCall / Sequence / Parallel / Conditional / Loop) —
85
+ * drives Lens's drill-in container treatment. */
86
+ readonly isPrimitiveBoundary?: boolean;
87
+ /** `inputMapper` payload at the subflow's entry. Subflow nodes only. */
88
+ readonly entryPayload?: unknown;
89
+ /** Subflow shared state at exit. Subflow nodes only.
90
+ * Undefined for in-progress / paused subflows. */
91
+ readonly exitPayload?: unknown;
92
+ /** LLM's text content. Set on `llm->tool` (the reasoning emitted with the
93
+ * tool_use blocks) and on `llm->user` (the terminal answer). */
94
+ readonly assistantText?: string;
95
+ /** Tool input arguments the LLM produced. Set on `llm->tool` from the
96
+ * matching `tool.start` event payload. */
97
+ readonly toolArgs?: unknown;
98
+ /** Tool result returned to the LLM. Set on `tool->llm` from the
99
+ * preceding `tool.end` event payload. */
100
+ readonly toolResult?: unknown;
101
+ /** Stable per-execution key — same `runtimeStageId` Trace view uses. */
102
+ readonly runtimeStageId?: string;
103
+ /**
104
+ * Slot boundary payloads composed for THIS LLM step.
105
+ *
106
+ * Set ONLY for `kind === 'user->llm'` and `kind === 'tool->llm'`
107
+ * StepNodes — the moments where context flows INTO the LLM. Each
108
+ * entry carries the slot subflow's `inputMapper` result (entryPayload)
109
+ * and rendered slot output (exitPayload).
110
+ *
111
+ * Attribution: any slot subflow that fired BETWEEN the previous LLM
112
+ * end (or run start) and THIS LLM start is attributed to this call.
113
+ * Done at projection time over `boundary.getEvents()`; no consumer-
114
+ * side correlation required.
115
+ *
116
+ * Lens uses this to make the 3 slot rows inside the LLM card
117
+ * clickable — clicking a slot reveals its entry/exit payloads in
118
+ * the right-pane detail panel without needing direct BoundaryRecorder
119
+ * access.
120
+ */
121
+ readonly slotBoundaries?: {
122
+ readonly systemPrompt?: SlotBoundary;
123
+ readonly messages?: SlotBoundary;
124
+ readonly tools?: SlotBoundary;
125
+ };
126
+ }
127
+ /** One slot's boundary pair attributed to a specific LLM step. */
128
+ export interface SlotBoundary {
129
+ /** runtimeStageId of the slot subflow execution. */
130
+ readonly runtimeStageId: string;
131
+ /** `inputMapper` payload — the data the slot was COMPOSED FROM
132
+ * (RAG hits, skill content, user message, tool result, etc). */
133
+ readonly entryPayload?: unknown;
134
+ /** Subflow shared state at exit — the rendered slot content
135
+ * (system prompt string, messages array, tools array). */
136
+ readonly exitPayload?: unknown;
137
+ }
138
+ /** Consumer-facing context injection (5 axes of context engineering). */
139
+ export interface ContextInjection {
140
+ readonly slot: 'system-prompt' | 'messages' | 'tools';
141
+ readonly asRole?: 'system' | 'user' | 'assistant' | 'tool';
142
+ readonly source: string;
143
+ readonly sourceId?: string;
144
+ readonly contentSummary?: string;
145
+ readonly reason?: string;
146
+ readonly sectionTag?: string;
147
+ readonly upstreamRef?: string;
148
+ readonly retrievalScore?: number;
149
+ readonly rankPosition?: number;
150
+ readonly budgetTokens?: number;
151
+ readonly budgetFraction?: number;
152
+ }
153
+ export interface StepEdge {
154
+ readonly id: string;
155
+ readonly from: string;
156
+ readonly to: string;
157
+ readonly kind: 'next' | 'loop-iteration' | 'fork-branch' | 'decision-branch';
158
+ readonly iteration?: number;
159
+ }
160
+ export interface StepGraph {
161
+ readonly nodes: readonly StepNode[];
162
+ readonly edges: readonly StepEdge[];
163
+ readonly activeNodeId?: string;
164
+ }
165
+ export interface FlowchartOptions {
166
+ /** Called each time the graph changes; fires synchronously on the
167
+ * driving event so the UI updates the moment the structure changes. */
168
+ readonly onUpdate?: (graph: StepGraph) => void;
169
+ }
170
+ export interface FlowchartHandle {
171
+ /** Current step graph (derived from boundary events). Safe during or
172
+ * after a run. */
173
+ readonly getSnapshot: () => StepGraph;
174
+ /** Underlying BoundaryRecorder. Use for richer queries — slot data,
175
+ * full event log, type-narrowed lookups. The single source of truth
176
+ * Lens reads. */
177
+ readonly boundary: BoundaryRecorder;
178
+ /** Detach from executor + dispatcher. Subsequent events ignored. */
179
+ readonly unsubscribe: () => void;
180
+ }
181
+ /**
182
+ * Attach a live FlowchartRecorder to a runner.
183
+ *
184
+ * 1. Creates a `BoundaryRecorder` (the unified domain event log).
185
+ * 2. Attaches it to the executor's FlowRecorder channel via
186
+ * `runnerAttach` — captures run / subflow / fork / decision / loop.
187
+ * 3. Subscribes it to the dispatcher — captures llm.* / tool.* /
188
+ * context.injected.
189
+ * 4. Wires `onUpdate` so the consumer sees a fresh derived StepGraph
190
+ * on every event.
191
+ *
192
+ * @internal Called from `RunnerBase.enable.flowchart`.
193
+ */
194
+ export declare function attachFlowchart(runnerAttach: (recorder: CombinedRecorder) => () => void, dispatcher: EventDispatcher, options?: FlowchartOptions): FlowchartHandle;
195
+ /**
196
+ * Project a `BoundaryRecorder`'s event stream into a `StepGraph`.
197
+ *
198
+ * Pure function — no side effects, no recorder mutation, deterministic.
199
+ * Called on every snapshot request and on every `onUpdate` fire. O(N)
200
+ * over the event stream; consumer-side memoization (e.g., React's
201
+ * `useMemo`) is straightforward when needed.
202
+ *
203
+ * The mapping is local to each event type: see the mapping table in
204
+ * the file header. State carried across the fold:
205
+ * - `iter`: 1-based ReAct iteration counter, incremented on each
206
+ * `llm.start`. ReAct nodes inherit the current value.
207
+ * - `pendingInjections`: context.injected events buffered between
208
+ * LLM calls; flushed onto the next user→llm or tool→llm StepNode.
209
+ * - `prevReActId`: id of the previous ReAct StepNode for `next`-edge
210
+ * wiring within an iteration.
211
+ * - `runStartTs`: wall-clock at run start, for relative offsets.
212
+ */
213
+ export declare function buildStepGraph(boundary: BoundaryRecorder): StepGraph;
214
+ /**
215
+ * Pure events → StepGraph fold. Same projection as `buildStepGraph`, but from a
216
+ * flat `DomainEvent[]` rather than a live `BoundaryRecorder` — so an offline
217
+ * `Trace` (which stores only events) can be rebuilt into a graph for `<Replay>`
218
+ * without re-running the agent. The graph is always derived, never stored.
219
+ */
220
+ export declare function buildStepGraphFromEvents(events: readonly DomainEvent[]): StepGraph;
@@ -0,0 +1,250 @@
1
+ /**
2
+ * LiveStateRecorder — domain trackers built on the footprintjs
3
+ * `BoundaryStateStore<TState>` storage primitive (v4.17.2+).
4
+ *
5
+ * **What this answers:** "Right now, mid-run, what's happening?"
6
+ *
7
+ * - Is an LLM call in flight? What's the partial answer so far?
8
+ * - Is a tool executing? Which tool? What args?
9
+ * - Is the agent in a turn? Which turn index?
10
+ *
11
+ * All reads are O(1) — the trackers maintain incremental state via
12
+ * the framework's bracket-scoped storage primitive. No event-log fold,
13
+ * no walking arrays per render.
14
+ *
15
+ * **Mental model — observers vs. bookkeepers:**
16
+ *
17
+ * `BoundaryStateStore<TState>` (footprintjs) = STORAGE shelf.
18
+ * `EventDispatcher.on(...)` (agentfootprint) = OBSERVER source.
19
+ *
20
+ * Each domain tracker (`LiveLLMTracker`, `LiveToolTracker`,
21
+ * `LiveAgentTurnTracker`) extends the storage shelf AND subscribes
22
+ * to the dispatcher. The composition `LiveStateRecorder` bundles
23
+ * all three so a consumer only attaches once.
24
+ *
25
+ * **Tier 1 (live) only.** Past states are not stored — when a boundary
26
+ * closes, its transient state clears. For time-travel queries, snapshot
27
+ * to a `SequenceStore<TState>` instead. See the BoundaryStateStore
28
+ * JSDoc for the rationale.
29
+ *
30
+ * @example Use the bundled façade — one attach, three live views:
31
+ *
32
+ * ```typescript
33
+ * import { LiveStateRecorder } from 'agentfootprint';
34
+ *
35
+ * const liveState = new LiveStateRecorder();
36
+ * liveState.subscribe(runner);
37
+ *
38
+ * await runner.run({ input });
39
+ *
40
+ * // Read at any moment during the run (e.g., from another async task):
41
+ * liveState.isLLMInFlight(); // true between llm_start ↔ llm_end
42
+ * liveState.getPartialLLM(); // accumulated tokens so far
43
+ * liveState.isToolExecuting(); // true between tool_start ↔ tool_end
44
+ * liveState.isAgentInTurn(); // true between turn_start ↔ turn_end
45
+ *
46
+ * liveState.unsubscribe();
47
+ * ```
48
+ *
49
+ * @example Use a single tracker directly when you only need one slice:
50
+ *
51
+ * ```typescript
52
+ * import { LiveLLMTracker } from 'agentfootprint';
53
+ *
54
+ * const llm = new LiveLLMTracker();
55
+ * llm.subscribe(runner);
56
+ * await runner.run({ input });
57
+ *
58
+ * llm.isInFlight(); // O(1)
59
+ * llm.getLatestPartial(); // most recent active call's partial
60
+ * llm.getActive(rid)?.tokens; // tokens accumulated for one call
61
+ * ```
62
+ */
63
+ import type { Unsubscribe } from '../../events/dispatcher.js';
64
+ import type { AgentfootprintEvent, AgentfootprintEventType } from '../../events/registry.js';
65
+ /** Minimal Runner shape this recorder needs — only the public `on(...)`
66
+ * subscription method, so the same trackers can attach to a real Runner
67
+ * (Agent, etc.) OR to a test mock without exposing the protected
68
+ * internal dispatcher. */
69
+ export interface LiveStateRunnerLike {
70
+ on<K extends AgentfootprintEventType>(type: K, listener: (event: Extract<AgentfootprintEvent, {
71
+ type: K;
72
+ }>) => void): Unsubscribe;
73
+ }
74
+ /** Live transient state of one in-flight LLM call. */
75
+ export interface LLMLiveState {
76
+ /** Accumulated content from `stream.token` events since `llm_start`. */
77
+ readonly partial: string;
78
+ /** Number of tokens received so far. */
79
+ readonly tokens: number;
80
+ /** Iteration index (from the LLMStartPayload). */
81
+ readonly iteration: number;
82
+ /** Provider name (e.g., 'anthropic', 'openai'). */
83
+ readonly provider: string;
84
+ /** Model id. */
85
+ readonly model: string;
86
+ /** Wall-clock ms when llm_start fired. */
87
+ readonly startedAtMs: number;
88
+ }
89
+ /** Live transient state of one in-flight tool call. */
90
+ export interface ToolLiveState {
91
+ readonly toolName: string;
92
+ readonly args: Readonly<Record<string, unknown>>;
93
+ readonly toolCallId: string;
94
+ readonly startedAtMs: number;
95
+ }
96
+ /** Live transient state of one in-flight agent turn. */
97
+ export interface AgentTurnLiveState {
98
+ readonly turnIndex: number;
99
+ readonly userPrompt: string;
100
+ readonly startedAtMs: number;
101
+ }
102
+ /**
103
+ * Tracks the in-flight state of LLM calls. Subscribes to:
104
+ * - `agentfootprint.stream.llm_start` → opens a boundary
105
+ * - `agentfootprint.stream.token` → appends to partial
106
+ * - `agentfootprint.stream.llm_end` → closes the boundary
107
+ *
108
+ * Boundary key: `runtimeStageId` of the call-llm stage. Parallel LLM
109
+ * calls (Parallel composition with multiple branches) get distinct
110
+ * keys and are tracked independently.
111
+ */
112
+ export declare class LiveLLMTracker {
113
+ readonly id = "live-llm";
114
+ /** Composition: bracket-scoped storage primitive. */
115
+ private readonly store;
116
+ /** Wipes the store when a fresh run reuses identical runtimeStageId keys. */
117
+ private readonly runIdGuard;
118
+ private observeRunId;
119
+ /** Subscribe to a runner's dispatcher. Returns an Unsubscribe. */
120
+ subscribe(runner: LiveStateRunnerLike): Unsubscribe;
121
+ /** Reset all transient state. Called by `LiveStateRecorder.clear()`. */
122
+ clear(): void;
123
+ /** True if any LLM call is currently in flight. */
124
+ isInFlight(): boolean;
125
+ /** Same as `store.hasActive` — exposed for parity with the v4 API. */
126
+ get hasActive(): boolean;
127
+ /** Number of currently-active boundaries. */
128
+ get activeCount(): number;
129
+ /** Currently-active boundary state for one runtimeStageId. */
130
+ getActive(runtimeStageId: string): LLMLiveState | undefined;
131
+ /** All currently-active boundaries. */
132
+ getAllActive(): ReadonlyMap<string, LLMLiveState>;
133
+ /** Accumulated partial content of the MOST RECENTLY started active
134
+ * LLM call. Empty string when no call is active. Useful for the
135
+ * classic "Chatbot is responding: …" live commentary line. */
136
+ getLatestPartial(): string;
137
+ }
138
+ /**
139
+ * Tracks in-flight tool calls. Subscribes to:
140
+ * - `agentfootprint.stream.tool_start` → opens a boundary
141
+ * - `agentfootprint.stream.tool_end` → closes the boundary
142
+ *
143
+ * Boundary key: `toolCallId` (more granular than `runtimeStageId` —
144
+ * parallel tools share one calling stage but have distinct toolCallIds).
145
+ */
146
+ export declare class LiveToolTracker {
147
+ readonly id = "live-tool";
148
+ private readonly store;
149
+ private readonly runIdGuard;
150
+ private observeRunId;
151
+ subscribe(runner: LiveStateRunnerLike): Unsubscribe;
152
+ clear(): void;
153
+ /** True if any tool is currently executing. */
154
+ isExecuting(): boolean;
155
+ get hasActive(): boolean;
156
+ get activeCount(): number;
157
+ getActive(toolCallId: string): ToolLiveState | undefined;
158
+ getAllActive(): ReadonlyMap<string, ToolLiveState>;
159
+ /** Names of tools currently executing. Empty when none. */
160
+ getExecutingToolNames(): readonly string[];
161
+ }
162
+ /**
163
+ * Tracks in-flight agent turns. Subscribes to:
164
+ * - `agentfootprint.agent.turn_start` → opens a boundary
165
+ * - `agentfootprint.agent.turn_end` → closes the boundary
166
+ *
167
+ * Boundary key: stringified `turnIndex` from the payload — survives
168
+ * across runner instances because turnIndex resets per-session.
169
+ */
170
+ export declare class LiveAgentTurnTracker {
171
+ readonly id = "live-agent-turn";
172
+ private readonly store;
173
+ private readonly runIdGuard;
174
+ private observeRunId;
175
+ subscribe(runner: LiveStateRunnerLike): Unsubscribe;
176
+ clear(): void;
177
+ /** True if the agent is currently inside a turn. */
178
+ isInTurn(): boolean;
179
+ get hasActive(): boolean;
180
+ get activeCount(): number;
181
+ getActive(turnIndex: string): AgentTurnLiveState | undefined;
182
+ getAllActive(): ReadonlyMap<string, AgentTurnLiveState>;
183
+ /** Index of the most-recently started active turn (-1 if none). */
184
+ getCurrentTurnIndex(): number;
185
+ }
186
+ /**
187
+ * One-stop façade bundling `LiveLLMTracker` + `LiveToolTracker` +
188
+ * `LiveAgentTurnTracker`. Consumers attach this once and get O(1)
189
+ * reads across all three live-state slices.
190
+ *
191
+ * Use the bundled façade unless you ONLY need one slice — using a
192
+ * single tracker directly avoids subscribing to events you don't read.
193
+ *
194
+ * **Lifecycle**: call `subscribe(runner)` to wire all three trackers,
195
+ * then `unsubscribe()` to detach. `clear()` resets all transient state
196
+ * across the three (called automatically by consumers like Lens between
197
+ * runs).
198
+ *
199
+ * **What this is NOT for:**
200
+ * - Time-travel queries (Tier 1 only — live state)
201
+ * - Aggregations (use SequenceStore.aggregate)
202
+ * - Stage-level observation (use Recorder.onStageStart/End)
203
+ *
204
+ * **Composition over inheritance:** the façade does NOT extend
205
+ * `BoundaryStateStore` itself — different boundary kinds need
206
+ * separate active maps to avoid key collisions between LLM and tool
207
+ * boundaries. Each sub-tracker keeps its own state.
208
+ */
209
+ export declare class LiveStateRecorder {
210
+ readonly id = "live-state";
211
+ /** LLM call live state. */
212
+ readonly llm: LiveLLMTracker;
213
+ /** Tool execution live state. */
214
+ readonly tool: LiveToolTracker;
215
+ /** Agent turn live state. */
216
+ readonly turn: LiveAgentTurnTracker;
217
+ /** Active subscription disposer, if `subscribe()` is called. */
218
+ private active;
219
+ constructor();
220
+ /** Subscribe all three trackers to one runner. Idempotent — calling
221
+ * twice on the same recorder unsubscribes the prior subscription
222
+ * first to avoid double-counting.
223
+ *
224
+ * Adds a wildcard `*` listener that observes runId on EVERY event
225
+ * (regardless of which tracker subscribes to it) and calls
226
+ * `clear()` on all three trackers when the runId changes. This
227
+ * closes the gap where a tracker that never saw events in run 1
228
+ * would fail to reset in run 2. */
229
+ subscribe(runner: LiveStateRunnerLike): Unsubscribe;
230
+ /** Detach all three trackers from the current runner. Idempotent. */
231
+ unsubscribe(): void;
232
+ /** Reset transient state across all three trackers. Called by the
233
+ * executor / consumer between runs. */
234
+ clear(): void;
235
+ /** True if any LLM call is currently in flight. */
236
+ isLLMInFlight(): boolean;
237
+ /** Accumulated partial content of the most-recently started LLM call. */
238
+ getPartialLLM(): string;
239
+ /** True if any tool is currently executing. */
240
+ isToolExecuting(): boolean;
241
+ /** Names of tools currently executing. */
242
+ getExecutingToolNames(): readonly string[];
243
+ /** True if the agent is currently inside a turn. */
244
+ isAgentInTurn(): boolean;
245
+ /** Current turn index (-1 if not in a turn). */
246
+ getCurrentTurnIndex(): number;
247
+ }
248
+ /** Convenience factory — same shape as `boundaryRecorder()` /
249
+ * `topologyRecorder()` / `inOutRecorder()` in footprintjs. */
250
+ export declare function liveStateRecorder(): LiveStateRecorder;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * LoggingRecorder — firehose-style structured logging of every event.
3
+ *
4
+ * Pattern: Facade over EventDispatcher's wildcard subscription.
5
+ * Role: Tier 3 observability — the low-level helper behind
6
+ * `attachLogging(dispatcher, {...})` (exported from
7
+ * `agentfootprint/observe`). For the high-level, uniform path use
8
+ * `agent.enable.observability({ strategy: consoleObservability() })`.
9
+ * Developer debugging tool; production typically uses an OTEL
10
+ * recorder instead.
11
+ * Emits: Does NOT emit; READS the dispatcher and writes to the logger.
12
+ *
13
+ * Filtering: consumer picks DOMAINS by name — the same domain segment that
14
+ * appears in event types (`agentfootprint.<domain>.<action>`). No internal
15
+ * tier jargon leaks into the public API.
16
+ */
17
+ import type { EventDispatcher, Unsubscribe } from '../../events/dispatcher.js';
18
+ import type { AgentfootprintEvent } from '../../events/registry.js';
19
+ /**
20
+ * Minimal logger shape — structurally compatible with console, winston,
21
+ * pino, etc. Consumers pass their existing logger.
22
+ */
23
+ export interface LoggingLogger {
24
+ log(message: string, data?: unknown): void;
25
+ }
26
+ /**
27
+ * Domain constants — one per event-registry domain. Use these instead of
28
+ * raw strings for autocomplete, typo protection, and rename safety.
29
+ *
30
+ * Raw strings still work (backed by the same literal union type below).
31
+ *
32
+ * @example
33
+ * attachLogging(dispatcher, { domains: [LoggingDomains.CONTEXT, LoggingDomains.STREAM] });
34
+ * attachLogging(dispatcher, { domains: ['context', 'stream'] }); // equivalent
35
+ */
36
+ export declare const LoggingDomains: {
37
+ /** Context-engineering events (the 3-slot model). THE DEBUG CORE. */
38
+ readonly CONTEXT: "context";
39
+ /** LLM + tool request/response stream. */
40
+ readonly STREAM: "stream";
41
+ /** Composition control flow (Sequence / Parallel / Conditional / Loop). */
42
+ readonly COMPOSITION: "composition";
43
+ /** Agent lifecycle (turn · iteration · route_decided · handoff). */
44
+ readonly AGENT: "agent";
45
+ /** Memory strategy + store operations. */
46
+ readonly MEMORY: "memory";
47
+ /** Tool offered / activated / deactivated. */
48
+ readonly TOOLS: "tools";
49
+ /** Skill activation + deactivation. */
50
+ readonly SKILL: "skill";
51
+ /** Permission checks + gates. */
52
+ readonly PERMISSION: "permission";
53
+ /** Risk / guardrail detections. */
54
+ readonly RISK: "risk";
55
+ /** Provider / tool / skill fallback triggers. */
56
+ readonly FALLBACK: "fallback";
57
+ /** Cost + budget tracking. */
58
+ readonly COST: "cost";
59
+ /** Eval scores + threshold crossings. */
60
+ readonly EVAL: "eval";
61
+ /** Error retries + recoveries. */
62
+ readonly ERROR: "error";
63
+ /** Pause / resume requests. */
64
+ readonly PAUSE: "pause";
65
+ /** Embedding generation. */
66
+ readonly EMBEDDING: "embedding";
67
+ };
68
+ /**
69
+ * Domain name — the middle segment of event types
70
+ * (`agentfootprint.<domain>.<action>`). Consumers already see these in
71
+ * the events they subscribe to; reusing them here avoids teaching a
72
+ * new taxonomy.
73
+ */
74
+ export type LoggingDomain = (typeof LoggingDomains)[keyof typeof LoggingDomains];
75
+ export interface LoggingOptions {
76
+ /** Logger sink. Defaults to console. */
77
+ readonly logger?: LoggingLogger;
78
+ /**
79
+ * Domains to log. Pass `'all'` for firehose (including consumer custom
80
+ * events). Default: `['context', 'stream']` — the core debugging lens
81
+ * (what went into the LLM, what came out).
82
+ */
83
+ readonly domains?: readonly LoggingDomain[] | 'all';
84
+ /** Custom formatter. Default: `[domain.action]`. */
85
+ readonly format?: (event: AgentfootprintEvent) => string;
86
+ }
87
+ /**
88
+ * Attach a logging subscription to the event dispatcher.
89
+ * Returns an Unsubscribe — call to detach.
90
+ */
91
+ export declare function attachLogging(dispatcher: EventDispatcher, options?: LoggingOptions): Unsubscribe;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * routeRecorder — records the skill-graph route a run actually took.
3
+ *
4
+ * A passive observer that reconstructs, hop by hop, which skill the agent was in,
5
+ * where it went next, and WHY — by COMPOSING already-shipped events (no engine
6
+ * change): `agentfootprint.context.evaluated` (its `routing[]` carries via/from/
7
+ * label per active skill-graph injection) + `agentfootprint.skill.rejected` (an
8
+ * out-of-reach read_skill) + `stream.tool_start` (the tool that drove a hop).
9
+ *
10
+ * Also folds in the GREY-AREA GOVERNORS (observability tier): it detects
11
+ * oscillation (A→B→A→B within `pingPongWindow`) and a run of consecutive rejected
12
+ * `read_skill` jumps (`maxRejectedRetries`), reported via `getTrips()`. These LABEL
13
+ * the trace (`onTrip:'stay'` semantics) — the hard "always stops" guarantee remains
14
+ * the agent's iteration cap; a runtime force-stop is a deferred follow-on.
15
+ *
16
+ * Pattern: CombinedRecorder (Convention 1 — single purpose: route evidence). Owns a
17
+ * `SequenceStore<RouteHop>`. Convention 4: resets on a new `runId`.
18
+ * Role: Tier-3 /observe recorder — `Agent.create(...).recorder(routeRecorder())`.
19
+ * Powers the lens, the "Why this skill?" panel, and paper route figures.
20
+ */
21
+ import type { EmitEvent } from 'footprintjs';
22
+ interface RunBoundaryEvent {
23
+ readonly traversalContext?: {
24
+ readonly runId?: string;
25
+ };
26
+ }
27
+ /** How the graph arrived at a skill on a hop. */
28
+ export type RouteOutcome = 'entry' | 'route' | 'stay' | 'rejected';
29
+ /** One hop of the route — the skill the graph was in at one iteration + how. */
30
+ export interface RouteHop {
31
+ /** runtimeStageId of the iteration (the SequenceStore key). */
32
+ readonly runtimeStageId: string;
33
+ readonly iteration: number;
34
+ /** The skill before this hop (undefined at cold start). */
35
+ readonly fromSkill?: string;
36
+ /** The skill after this hop (undefined for a pure rejection). */
37
+ readonly toSkill?: string;
38
+ readonly outcome: RouteOutcome;
39
+ /** A human-readable reason for this hop (see `formatRouteHop`). */
40
+ readonly why: string;
41
+ /** The route edge's caption, when one drove the hop. */
42
+ readonly edgeLabel?: string;
43
+ /** The tool whose result drove the hop (most recent tool_start). */
44
+ readonly lastTool?: string;
45
+ /** Rejection only — the skill the model tried to jump to. */
46
+ readonly requestedSkill?: string;
47
+ /** Rejection only — the reachable set it was bounded to. */
48
+ readonly reachable?: readonly string[];
49
+ }
50
+ /** A governor trip — the route is misbehaving. */
51
+ export type RouteTripKind = 'ping-pong' | 'rejected-cap';
52
+ export interface RouteTrip {
53
+ readonly kind: RouteTripKind;
54
+ readonly iteration: number;
55
+ readonly skills: readonly string[];
56
+ readonly detail: string;
57
+ }
58
+ export interface RouteRecorderOptions {
59
+ readonly id?: string;
60
+ /** Window for oscillation detection (a [X,Y,X,Y] pattern trips). Default 4. */
61
+ readonly pingPongWindow?: number;
62
+ /** Consecutive rejected read_skill jumps before a `rejected-cap` trip. Default 3. */
63
+ readonly maxRejectedRetries?: number;
64
+ }
65
+ export interface RouteRecorderHandle {
66
+ readonly id: string;
67
+ /** The distinct skill sequence the run moved through (the "route"). */
68
+ getPath(): readonly string[];
69
+ /** Every hop, in order. */
70
+ getHops(): readonly RouteHop[];
71
+ /** The rejected read_skill attempts (out-of-reach jumps). */
72
+ getRejections(): readonly RouteHop[];
73
+ /** Governor trips (oscillation / rejected-retry cap). */
74
+ getTrips(): readonly RouteTrip[];
75
+ clear(): void;
76
+ onEmit(event: EmitEvent): void;
77
+ onRunStart(event: RunBoundaryEvent): void;
78
+ }
79
+ /** A human-readable one-line reason for a hop. Exported (pure). */
80
+ export declare function formatRouteHop(hop: RouteHop): string;
81
+ /** Build the route recorder. */
82
+ export declare function routeRecorder(options?: RouteRecorderOptions): RouteRecorderHandle;
83
+ export {};