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,124 @@
1
+ /**
2
+ * PermissionPolicy — data-driven role-based authorization for tool dispatch.
3
+ *
4
+ * Closes Neo gap #2 (of 8). Permissions are CROSS-CUTTING — they're not
5
+ * context engineering, they're a guard ON context-engineering operations
6
+ * (tool dispatch, skill activation, memory writes, output emission).
7
+ * That's why this lives in `agentfootprint/security`, parallel to the
8
+ * provider subpaths.
9
+ *
10
+ * Two surfaces, one primitive:
11
+ * 1. `PermissionPolicy.fromRoles({...}, activeRole)` — declarative,
12
+ * data-driven, auditable. Production governance.
13
+ * 2. The PermissionPolicy instance satisfies BOTH:
14
+ * - `PermissionChecker` interface (async check; consumed by Agent
15
+ * constructor's `permissionChecker` field)
16
+ * - sync `isAllowed(toolId)` method (consumed by `gatedTools(...)`
17
+ * from `agentfootprint/tool-providers`)
18
+ *
19
+ * Pattern: Strategy (GoF) for the role-allowlist policy + Adapter
20
+ * (matches `PermissionChecker` interface so it composes with
21
+ * existing v2.4 Agent constructor).
22
+ *
23
+ * Role: Layer-3 cross-cutting guard. Not Injection. Not provider.
24
+ * Lives in its own subpath (`agentfootprint/security`).
25
+ *
26
+ * @example Read-only role for a support agent
27
+ * const policy = PermissionPolicy.fromRoles(
28
+ * {
29
+ * readonly: ['lookup_order', 'get_status', 'list_skills', 'read_skill'],
30
+ * support: ['lookup_order', 'get_status', 'process_refund', 'list_skills', 'read_skill'],
31
+ * },
32
+ * 'readonly',
33
+ * );
34
+ *
35
+ * policy.isAllowed('lookup_order'); // → true
36
+ * policy.isAllowed('process_refund'); // → false (not in readonly role)
37
+ *
38
+ * // As a tool-dispatch gate (composes with gatedTools)
39
+ * const provider = gatedTools(staticTools(allTools), (name) => policy.isAllowed(name));
40
+ *
41
+ * // As an Agent permissionChecker (the v2.4 surface)
42
+ * const agent = Agent.create({ provider, model, permissionChecker: policy }).build();
43
+ *
44
+ * @example Per-identity role switching at runtime
45
+ * const policy = PermissionPolicy.fromRoles({
46
+ * readonly: [...],
47
+ * admin: [...],
48
+ * }, 'readonly');
49
+ *
50
+ * const adminPolicy = policy.withActiveRole('admin');
51
+ * // Same allowlist data; different active role.
52
+ */
53
+ import type { PermissionChecker, PermissionRequest, PermissionDecision } from '../adapters/types.js';
54
+ /**
55
+ * Map of role name → list of tool ids that role is allowed to invoke.
56
+ * The shape consumers extend over time as new tools / roles arrive.
57
+ */
58
+ export type RoleAllowlist = Readonly<Record<string, readonly string[]>>;
59
+ export interface PermissionPolicyOptions {
60
+ /**
61
+ * The role allowlist. Each role maps to the tool ids it can invoke.
62
+ * Tool ids match the `name` field of `Tool.schema.name` exactly.
63
+ */
64
+ readonly roles: RoleAllowlist;
65
+ /**
66
+ * Which role is active for this policy instance. Calls to
67
+ * `.isAllowed(toolId)` check against this role's allowlist.
68
+ * Use `.withActiveRole(name)` to derive a sibling policy with a
69
+ * different active role.
70
+ */
71
+ readonly activeRole: string;
72
+ }
73
+ /**
74
+ * Data-driven role-based permission policy. Satisfies the v2.4
75
+ * `PermissionChecker` interface AND exposes a sync `isAllowed` method
76
+ * for use with `gatedTools` from `agentfootprint/tool-providers`.
77
+ */
78
+ export declare class PermissionPolicy implements PermissionChecker {
79
+ private readonly opts;
80
+ readonly name = "PermissionPolicy";
81
+ private constructor();
82
+ /**
83
+ * Factory: build a role-based policy from a role → tool-ids map and
84
+ * the role active for this instance.
85
+ *
86
+ * Throws if `activeRole` isn't a key in `roles` — fail loud at
87
+ * config time, not at first denied call.
88
+ */
89
+ static fromRoles(roles: RoleAllowlist, activeRole: string): PermissionPolicy;
90
+ /**
91
+ * Sync allowlist check. Use as a predicate with `gatedTools`:
92
+ *
93
+ * gatedTools(staticTools(allTools), (toolId) => policy.isAllowed(toolId))
94
+ *
95
+ * Returns true iff `toolId` is in the active role's allowlist.
96
+ * Closes-fail by design: missing role membership = denied.
97
+ */
98
+ isAllowed(toolId: string): boolean;
99
+ /**
100
+ * Async check matching the `PermissionChecker` interface — consumed
101
+ * by `Agent.create({ permissionChecker })`. Wraps `isAllowed` with
102
+ * the structured `PermissionDecision` envelope (allow / deny + a
103
+ * `policyRuleId` so observability can trace which role decided).
104
+ *
105
+ * Today the policy only checks the tool name (request.target).
106
+ * Future work: also gate by capability ('memory_write', etc.) when
107
+ * the role allowlist is widened to capability-by-id.
108
+ */
109
+ check(request: PermissionRequest): Promise<PermissionDecision>;
110
+ /**
111
+ * Derive a sibling policy with a different active role. Same role
112
+ * map; different active role. Useful for per-identity routing
113
+ * (one policy instance per request, varying active role per caller).
114
+ *
115
+ * Returns a NEW PermissionPolicy — original is unchanged.
116
+ */
117
+ withActiveRole(activeRole: string): PermissionPolicy;
118
+ /** The role name currently active. Useful for observability. */
119
+ get activeRole(): string;
120
+ /** All defined role names. Stable order = registration order. */
121
+ get roles(): readonly string[];
122
+ /** All tool ids allowed under the current active role. */
123
+ allowedToolIds(): readonly string[];
124
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * PolicyHaltError — typed error thrown by `Agent.run()` when a
3
+ * `PermissionChecker.check()` returns `{ result: 'halt', ... }`.
4
+ *
5
+ * Pattern: Typed Error (parallel to `ReliabilityFailFastError`).
6
+ * Role: Surface layer for sequence governance / security halts —
7
+ * terminates the run cleanly with full forensic context so
8
+ * callers can route alerts (PagerDuty / Slack / dashboard)
9
+ * based on the rule that fired.
10
+ * Emits: N/A (this file DEFINES the error class; the corresponding
11
+ * observability event `agentfootprint.permission.halt` fires
12
+ * from the toolCalls handler at the moment the halt resolves).
13
+ *
14
+ * Strict ordering on halt — the framework guarantees:
15
+ * 1. Synthetic `tool_result` (with `tellLLM` content) appended to
16
+ * `scope.history` so the Anthropic / OpenAI tool_use ↔ tool_result
17
+ * pairing protocol is satisfied.
18
+ * 2. `agentfootprint.permission.halt` event emitted.
19
+ * 3. Stage commits (commitLog has the entry; runtimeStageId is
20
+ * complete).
21
+ * 4. THEN this error is thrown by `Agent.run()`.
22
+ *
23
+ * @example
24
+ * try {
25
+ * await agent.run({ message: 'help me with order #42' });
26
+ * } catch (e) {
27
+ * if (e instanceof PolicyHaltError) {
28
+ * console.log(`HALT: rule='${e.reason}' iteration=${e.iteration}`);
29
+ * console.log(`Sequence: ${e.sequence.map(c => c.name).join(' → ')}`);
30
+ * if (e.reason.startsWith('security:')) {
31
+ * await pagerDuty.notify(e);
32
+ * }
33
+ * } else {
34
+ * throw e;
35
+ * }
36
+ * }
37
+ */
38
+ import type { LLMMessage, ToolCallEntry, ToolResultContent } from '../adapters/types.js';
39
+ export interface PolicyHaltContext {
40
+ /** Telemetry tag from the matched rule. Stable across versions. */
41
+ readonly reason: string;
42
+ /** Content delivered to the LLM as the synthetic tool_result. */
43
+ readonly tellLLM?: ToolResultContent;
44
+ /** Sequence of tool calls dispatched this run, including the proposed
45
+ * call that triggered the halt (which did NOT execute). */
46
+ readonly sequence: readonly ToolCallEntry[];
47
+ /** ReAct iteration the halt fired on. */
48
+ readonly iteration: number;
49
+ /** Conversation history at halt time, including the synthetic tool_result. */
50
+ readonly history: readonly LLMMessage[];
51
+ /** The proposed tool call that triggered the halt (not executed). */
52
+ readonly proposed: {
53
+ readonly name: string;
54
+ readonly args: unknown;
55
+ };
56
+ /** Identifier of the PermissionChecker that returned `'halt'`. */
57
+ readonly checkerId?: string;
58
+ }
59
+ export declare class PolicyHaltError extends Error {
60
+ readonly code: "ERR_POLICY_HALT";
61
+ readonly reason: string;
62
+ readonly tellLLM?: ToolResultContent;
63
+ readonly sequence: readonly ToolCallEntry[];
64
+ readonly iteration: number;
65
+ readonly history: readonly LLMMessage[];
66
+ readonly proposed: {
67
+ readonly name: string;
68
+ readonly args: unknown;
69
+ };
70
+ readonly checkerId?: string;
71
+ constructor(ctx: PolicyHaltContext);
72
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * extractSequence — derive the in-flight tool-call sequence from
3
+ * `scope.history` for `PermissionChecker.check()`.
4
+ *
5
+ * Pattern: Pure function over conversation history.
6
+ * Role: Single source of truth — sequence is reconstructed on
7
+ * demand from `LLMMessage[]` instead of maintained as
8
+ * parallel state in scope. Survives `agent.resumeOnError`
9
+ * correctly because the history IS the durable artifact.
10
+ * Emits: N/A (pure compute).
11
+ *
12
+ * The sequence reads the assistant turns' `toolCalls` blocks in order.
13
+ * Calls that were denied at the gate (synthetic tool_results in history
14
+ * but no `tool.execute()` invocation) are NOT included — the sequence
15
+ * reflects what actually dispatched, not what was attempted.
16
+ *
17
+ * Detection of "did this call dispatch?" — we look at the matching
18
+ * `tool` message and check its content. Synthetic deny messages match
19
+ * a known prefix; everything else is a real dispatch. This pairs the
20
+ * sender (assistant.toolCalls[i].id) with the receiver (tool.toolCallId).
21
+ */
22
+ import type { LLMMessage, ToolCallEntry } from '../adapters/types.js';
23
+ /** Prefix the framework writes on synthetic deny tool_results. Used to
24
+ * distinguish "denied but in history" from "actually dispatched". */
25
+ export declare const SYNTHETIC_DENY_PREFIX = "[permission denied:";
26
+ export interface ExtractSequenceOptions {
27
+ /**
28
+ * Resolver: tool name → providerId. When the tool was registered via
29
+ * `staticTools(...)` / `.tool(...)`, returns `'local'` (or the resolver's
30
+ * choice). When registered via a `discoveryProvider`, returns the
31
+ * provider's `id`. Lets policies match cross-hub patterns.
32
+ */
33
+ readonly resolveProviderId?: (toolName: string) => string | undefined;
34
+ }
35
+ /**
36
+ * Walk `history` in order, collect each dispatched tool call into the
37
+ * sequence. Only calls that produced a non-denied tool_result are
38
+ * included.
39
+ *
40
+ * @param history Conversation history at check time.
41
+ * @param iteration Current ReAct iteration (used to tag the proposed
42
+ * call's iteration if you append it).
43
+ * @param options Optional resolver for `providerId`.
44
+ * @returns The dispatched-call sequence, in chronological order.
45
+ */
46
+ export declare function extractSequence(history: readonly LLMMessage[], iteration: number, options?: ExtractSequenceOptions): ToolCallEntry[];
@@ -0,0 +1,44 @@
1
+ /**
2
+ * agentfootprint/security — cross-cutting authorization + governance.
3
+ *
4
+ * Permissions are NOT context engineering — they're a guard ON
5
+ * context-engineering operations (tool dispatch, skill activation,
6
+ * memory writes, output emission). That's why this lives in its own
7
+ * subpath, parallel to `agentfootprint/tool-providers` and the
8
+ * `agentfootprint/memory-*` and `agentfootprint/providers` subpaths.
9
+ *
10
+ * Today's surface is small and data-driven on purpose: one role
11
+ * allowlist primitive that satisfies BOTH the v2.4 `PermissionChecker`
12
+ * interface AND a sync `isAllowed(toolId)` predicate for use with
13
+ * `gatedTools` from `agentfootprint/tool-providers`.
14
+ *
15
+ * Future additions (capability gating, gate_open flows, audit logs)
16
+ * land here without expanding the public root barrel.
17
+ *
18
+ * @example
19
+ * import { PermissionPolicy } from 'agentfootprint/security';
20
+ * import { gatedTools, staticTools } from 'agentfootprint/tool-providers';
21
+ *
22
+ * const policy = PermissionPolicy.fromRoles(
23
+ * {
24
+ * readonly: ['lookup', 'list_skills', 'read_skill'],
25
+ * admin: ['lookup', 'list_skills', 'read_skill', 'write', 'delete'],
26
+ * },
27
+ * 'readonly',
28
+ * );
29
+ *
30
+ * const provider = gatedTools(
31
+ * staticTools(allTools),
32
+ * (name) => policy.isAllowed(name),
33
+ * );
34
+ *
35
+ * const agent = Agent.create({ provider, model, permissionChecker: policy }).build();
36
+ */
37
+ export { PermissionPolicy } from './PermissionPolicy.js';
38
+ export type { RoleAllowlist, PermissionPolicyOptions } from './PermissionPolicy.js';
39
+ export { PolicyHaltError } from './PolicyHaltError.js';
40
+ export type { PolicyHaltContext } from './PolicyHaltError.js';
41
+ export { extractSequence, SYNTHETIC_DENY_PREFIX } from './extractSequence.js';
42
+ export type { ExtractSequenceOptions } from './extractSequence.js';
43
+ export { redactThinkingBlocks, REDACTED_PLACEHOLDER } from './thinkingRedaction.js';
44
+ export type { PermissionChecker, PermissionRequest, PermissionDecision, ToolCallEntry, ToolResultContent, } from '../adapters/types.js';
@@ -0,0 +1,50 @@
1
+ /**
2
+ * thinkingRedaction — content scrubbing for ThinkingBlock[] before
3
+ * persistence + audit-log adapters fire.
4
+ *
5
+ * Pattern: Pure function. Same shape as the v2.4 RedactionPolicy.scope-
6
+ * patterns / emit-patterns helpers — regex match + replace.
7
+ *
8
+ * Mental model — TWO-LAYER persistence:
9
+ * - LLMMessage.thinkingBlocks IS persisted to scope.history (required
10
+ * for Anthropic signature round-trip).
11
+ * - Audit-log adapters (CloudWatch, Datadog OTel, etc.) read from
12
+ * scope.history. Sensitive reasoning (PII in chain-of-thought,
13
+ * internal IDs the model worked through) lands there too.
14
+ * - This helper scrubs content patterns BEFORE the assistant message
15
+ * pushes to scope.history, so the audit-log surface only sees
16
+ * redacted content while the LLM still sees the unredacted reasoning
17
+ * for round-trip integrity.
18
+ *
19
+ * The signature field is NEVER touched by redaction — Anthropic's
20
+ * server-side signature is bound to the original content; modifying
21
+ * content here would invalidate the signature. Resolution: signature
22
+ * survives byte-exact, content gets scrubbed. This means the Anthropic
23
+ * API will reject the next turn IF the consumer wired thinkingPatterns
24
+ * AND uses Anthropic with extended-thinking-plus-tools. Document.
25
+ *
26
+ * Recommended use:
27
+ * - DON'T wire thinkingPatterns when using Anthropic extended thinking
28
+ * + tool calls (signature breaks).
29
+ * - DO wire thinkingPatterns when using OpenAI o1/o3 (no signature,
30
+ * no round-trip requirement) or for offline log scrubbing.
31
+ * - For Anthropic + sensitive reasoning, prefer audit-log-side
32
+ * redaction (filter in your CloudWatch / Datadog adapter rather
33
+ * than the framework's persistence point).
34
+ */
35
+ import type { ThinkingBlock } from '../thinking/types.js';
36
+ /** Sentinel string used in place of redacted content. */
37
+ export declare const REDACTED_PLACEHOLDER = "[REDACTED]";
38
+ /**
39
+ * Return a copy of `blocks` with each block's `content` field scrubbed
40
+ * by every pattern in `patterns`. Returns the input array unchanged
41
+ * when `patterns` is undefined, empty, or no block content matches.
42
+ *
43
+ * Signature + summary + providerMeta fields are preserved BYTE-EXACT
44
+ * — only `content` is touched.
45
+ *
46
+ * Anthropic signature warning: scrubbing content invalidates the
47
+ * Anthropic server-side signature. Round-trip will fail with HTTP 400
48
+ * on the next turn. Document this in the consumer recipe.
49
+ */
50
+ export declare function redactThinkingBlocks(blocks: readonly ThinkingBlock[], patterns: readonly RegExp[] | undefined): readonly ThinkingBlock[];
@@ -0,0 +1,48 @@
1
+ /**
2
+ * agentfootprint/status — chat-bubble status surface.
3
+ *
4
+ * Pattern: pure projection. `selectStatus` walks the typed
5
+ * event log forward, tracking active pause / tool / LLM state,
6
+ * and returns the CURRENT thinking state (or null when the
7
+ * bubble should hide).
8
+ * Role: Outer ring. Consumers (Lens, custom chat UIs, embedded
9
+ * widgets) call this to drive a "what is the agent doing
10
+ * right now?" indicator. Output feeds `renderStatusLine`
11
+ * which resolves a template + variables to a final string.
12
+ *
13
+ * Why a subpath:
14
+ * - Consistent with `agentfootprint/observe` and
15
+ * `agentfootprint/locales` — every observability surface gets its
16
+ * own entry point.
17
+ * - Self-documenting at the import line: `from 'agentfootprint/status'`
18
+ * vs an opaque main-export grab.
19
+ * - Future home for extended-thinking primitives (Anthropic
20
+ * `thinking_delta` / `redacted_thinking` blocks). Adding them here
21
+ * is non-breaking; consumers already importing from
22
+ * `agentfootprint/status` get the new state surface for free.
23
+ *
24
+ * Back-compat: every export here is also re-exported from the main
25
+ * `agentfootprint` entry. Migrating consumers is mechanical (rewrite
26
+ * the import path); both paths work.
27
+ *
28
+ * State machine (4 states + null):
29
+ *
30
+ * ┌──────────┐ llm.start, no tools yet
31
+ * ────┤ idle ├────────────────────────────► "Thinking…"
32
+ * └──────────┘
33
+ *
34
+ * ┌──────────┐ stream.token chunks accumulate
35
+ * ────┤streaming ├────────────────────────────► "{{partial}}"
36
+ * └──────────┘
37
+ *
38
+ * ┌──────────┐ tool.start, no tool.end yet
39
+ * ────┤ tool ├────────────────────────────► "Working on `weather`…"
40
+ * └──────────┘ (or per-tool override)
41
+ *
42
+ * ┌──────────┐ pause.request, no resume yet
43
+ * ────┤ paused ├────────────────────────────► "Waiting on you: …"
44
+ * └──────────┘
45
+ *
46
+ * (null) run done / between calls → bubble hidden
47
+ */
48
+ export { defaultStatusTemplates, selectStatus, renderStatusLine, type StatusState, type StatusKind, type StatusTemplates, type StatusContext, } from './recorders/observability/status/statusTemplates.js';
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Wire each grouped strategy to its data source on the dispatcher /
3
+ * recorder substrate. These are the 4 `enable.*` facades' actual
4
+ * implementations; `RunnerBase.enable` calls them with the right
5
+ * dispatcher / attach handle.
6
+ *
7
+ * Pattern: every facade follows the same shape:
8
+ *
9
+ * 1. Resolve strategy (consumer-supplied OR default)
10
+ * 2. Run `strategy.validate?()` — early-fail on misconfig (New Relic
11
+ * panel review)
12
+ * 3. Set up subscription / projection
13
+ * 4. Apply per-strategy event-type filter (`relevantEventTypes`)
14
+ * 5. Apply per-call sample rate
15
+ * 6. Wrap calls in try/catch — route errors to `_onError` (passive
16
+ * recorder rule: never throw to caller)
17
+ * 7. Return Unsubscribe (or handle for lens)
18
+ */
19
+ import type { EventDispatcher, Unsubscribe } from '../events/dispatcher.js';
20
+ import type { ObservabilityStrategy, CostStrategy, LiveStatusStrategy, CommonStrategyOptions, ObservabilityTier } from './types.js';
21
+ import { type StatusTemplates } from '../recorders/observability/status/statusTemplates.js';
22
+ export interface ObservabilityEnableOptions extends CommonStrategyOptions {
23
+ /** Cost-of-on knob. `'minimal'` → only error + lifecycle events.
24
+ * `'standard'` → most domains. `'firehose'` → every event including
25
+ * per-token streams. Default `'standard'`. */
26
+ readonly tier?: ObservabilityTier;
27
+ readonly strategy?: ObservabilityStrategy;
28
+ }
29
+ export declare function attachObservabilityStrategy(dispatcher: EventDispatcher, opts?: ObservabilityEnableOptions): Unsubscribe;
30
+ export interface CostEnableOptions extends CommonStrategyOptions {
31
+ readonly strategy?: CostStrategy;
32
+ }
33
+ /**
34
+ * Subscribe to `agentfootprint.cost.tick` events, project payload into
35
+ * the canonical `CostTick` shape, hand to strategy.
36
+ */
37
+ export declare function attachCostStrategy(dispatcher: EventDispatcher, opts?: CostEnableOptions): Unsubscribe;
38
+ export interface LiveStatusEnableOptions extends CommonStrategyOptions {
39
+ readonly strategy: LiveStatusStrategy;
40
+ /** Override the bundled English thinking templates with locale /
41
+ * per-tool / per-skill overrides. Same shape as
42
+ * `agent.thinkingTemplates(...)`. */
43
+ readonly templates?: StatusTemplates;
44
+ /** App name woven into `{{appName}}` template var. */
45
+ readonly appName?: string;
46
+ }
47
+ export declare function attachLiveStatusStrategy(dispatcher: EventDispatcher, opts: LiveStatusEnableOptions): Unsubscribe;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * `compose([...])` — fan-out combinator.
3
+ *
4
+ * Pattern: Composite. Same shape as React's children array, RxJS's
5
+ * `merge`, OTel's `MultiSpanProcessor`. Pass an array of
6
+ * strategies; get back a single strategy that fan-outs each
7
+ * call to every child.
8
+ *
9
+ * Use when:
10
+ * - Multi-vendor pipelines (`compose([datadog(), otel(), console()])`)
11
+ * - Test instrumentation alongside production sink
12
+ * (`compose([inMemorySink(), stripeBilling()])`) so test assertions
13
+ * can read ticks while production also ships
14
+ * - Tier-staging — local dev mirrors what production sees
15
+ *
16
+ * Per-child error isolation: if one child's `exportEvent` throws, the
17
+ * other children still receive the event. The throwing child's
18
+ * `_onError` is called (if present); otherwise the error is logged
19
+ * via `console.warn` once. One bad sink never breaks the chain.
20
+ *
21
+ * Capabilities are OR-ed across children — if any child supports a
22
+ * capability, the composite reports it as supported. The dispatcher
23
+ * uses this to decide whether to bother building event objects at all.
24
+ *
25
+ * Idempotent operations:
26
+ * - `flush()` — calls every child's `flush()` (sync or async)
27
+ * concurrently, awaits all
28
+ * - `stop()` — calls every child's `stop()` once, in order; failures
29
+ * in one child don't block the others
30
+ */
31
+ import type { ObservabilityStrategy, CostStrategy, LiveStatusStrategy, LensStrategy } from './types.js';
32
+ /**
33
+ * Compose multiple ObservabilityStrategies into a single fan-out.
34
+ *
35
+ * @example
36
+ * const all = composeObservability([
37
+ * consoleObservability(),
38
+ * cloudwatchObservability({ logGroupName: '/agent/prod' }),
39
+ * otelObservability({ serviceName: 'my-agent-prod' }),
40
+ * ]);
41
+ */
42
+ export declare function composeObservability(children: readonly ObservabilityStrategy[]): ObservabilityStrategy;
43
+ /** Compose CostStrategies. */
44
+ export declare function composeCost(children: readonly CostStrategy[]): CostStrategy;
45
+ /** Compose LiveStatusStrategies. */
46
+ export declare function composeLiveStatus(children: readonly LiveStatusStrategy[]): LiveStatusStrategy;
47
+ /** Compose LensStrategies. */
48
+ export declare function composeLens(children: readonly LensStrategy[]): LensStrategy;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `chatBubbleLiveStatus()` — default LiveStatusStrategy.
3
+ *
4
+ * Pattern: Strategy. Adapter for a consumer-supplied callback.
5
+ * Role: The "every chat UI" sink. Wraps a `(line: string) => void`
6
+ * callback so the consumer just hands us the function their
7
+ * chat-bubble component needs and we drive it on every
8
+ * rendered status update.
9
+ *
10
+ * Use when:
11
+ * - Building a chat UI (Neo, Lens, embedded widget) where the
12
+ * consumer owns rendering but not state derivation
13
+ * - Tier-1 of compose chains (`compose([chatBubble(setLine), stdout()])`
14
+ * so dev console mirrors what the user sees)
15
+ *
16
+ * The callback runs on EVERY status transition. Consumer can debounce
17
+ * / coalesce per their needs (we don't impose UI policy).
18
+ */
19
+ import type { LiveStatusStrategy } from '../types.js';
20
+ export interface ChatBubbleLiveStatusOptions {
21
+ /**
22
+ * Required — called per status update with the rendered line.
23
+ * Pass `setStatus` from your React component, or any function
24
+ * whose job is "show this line in the chat bubble."
25
+ *
26
+ * NOTE: this is INTENTIONALLY the only callback. If you need access
27
+ * to the underlying `StatusState` (for color-per-state, animation
28
+ * triggers, etc.), build your own `LiveStatusStrategy` directly OR
29
+ * use `compose([chatBubbleLiveStatus({onLine}), customStrategy])`.
30
+ * We don't surface `StatusState` here because it's an INTERNAL
31
+ * shape — exposing it would couple consumer UIs to changes in the
32
+ * state machine.
33
+ */
34
+ readonly onLine: (line: string) => void;
35
+ }
36
+ export declare function chatBubbleLiveStatus(opts: ChatBubbleLiveStatusOptions): LiveStatusStrategy;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `consoleObservability()` — default ObservabilityStrategy.
3
+ *
4
+ * Pattern: Strategy. Adapter for `globalThis.console`. Used when no
5
+ * vendor-specific strategy is configured (zero-config dev
6
+ * experience). Same role as `NoOpCacheStrategy` is for the
7
+ * cache layer.
8
+ * Role: Tier-1 fallback — print every event to the console with a
9
+ * one-line type+payload summary. Vendor-neutral, dependency-
10
+ * free, works in browser + Node + Deno + Bun.
11
+ *
12
+ * Use when:
13
+ * - Local development (`agent.enable.observability()` with no opts)
14
+ * - CI logs ("what events fired during this test?")
15
+ * - Tier-1 of compose chains (`compose([console(), datadog()])`)
16
+ *
17
+ * Don't use when: production. Console output is unstructured + can't
18
+ * be queried; switch to a vendor strategy (Datadog, OTel, CloudWatch).
19
+ */
20
+ import type { AgentfootprintEvent } from '../../events/registry.js';
21
+ import type { ObservabilityStrategy } from '../types.js';
22
+ export interface ConsoleObservabilityOptions {
23
+ /**
24
+ * Where to write. Defaults to `globalThis.console`. Override for
25
+ * tests or to wrap with a custom sink (browser DevTools' grouped
26
+ * console, a Node.js stream, etc.).
27
+ */
28
+ readonly logger?: {
29
+ log(...args: unknown[]): void;
30
+ };
31
+ /**
32
+ * Custom line formatter. Receives the typed event; returns the line.
33
+ * Defaults to `[type] payload-as-JSON`. Override to colorize, filter
34
+ * fields, or pretty-print.
35
+ */
36
+ readonly format?: (event: AgentfootprintEvent) => string;
37
+ }
38
+ /**
39
+ * Factory. Returns a fresh ObservabilityStrategy each call so multiple
40
+ * agents in the same process get independent instances.
41
+ */
42
+ export declare function consoleObservability(opts?: ConsoleObservabilityOptions): ObservabilityStrategy;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * `inMemorySinkCost()` — default CostStrategy.
3
+ *
4
+ * Pattern: Strategy. In-process accumulator. Same role as InMemoryStore
5
+ * for memory-providers.
6
+ * Role: Tier-1 fallback — accumulate cost ticks in a process-local
7
+ * array. Consumer reads via `getTicks()` or hooks `onRecord`
8
+ * for streaming. Vendor-free.
9
+ *
10
+ * Use when:
11
+ * - Tests / CI ("what cost did this run accrue?")
12
+ * - Local dev before billing integration
13
+ * - Tier-1 of compose chains (`compose([inMemorySink(), stripeBilling()])`
14
+ * so test assertions can read ticks while production also ships)
15
+ *
16
+ * Don't use when: process is long-running with high cost-tick volume —
17
+ * the buffer grows unbounded. Add a `maxTicks` cap (drops oldest) or
18
+ * pair with a streaming strategy (`stripeBilling`, `webhook`).
19
+ */
20
+ import type { CostStrategy, CostTick } from '../types.js';
21
+ export interface InMemorySinkCostOptions {
22
+ /**
23
+ * Optional streaming hook called per tick. Useful for piping the
24
+ * accumulator into a custom sink without writing a full strategy.
25
+ */
26
+ readonly onRecord?: (tick: CostTick) => void;
27
+ /**
28
+ * Maximum ticks to retain in the buffer. When exceeded, the OLDEST
29
+ * tick is dropped (FIFO). Default `Infinity` — no cap.
30
+ */
31
+ readonly maxTicks?: number;
32
+ }
33
+ /**
34
+ * Extended interface — the in-memory sink also exposes the buffer
35
+ * for read-back. Strategies aren't required to do this; this one
36
+ * does because that IS its purpose (accumulate for inspection).
37
+ */
38
+ export interface InMemorySinkCostStrategy extends CostStrategy {
39
+ /** Snapshot of the buffered ticks. O(n) per call — for cheap
40
+ * polling use `getTicksCount()` + `getTicksSince(idx)`. */
41
+ readonly getTicks: () => readonly CostTick[];
42
+ /** Cheap O(1) read for "did anything new arrive?" polling. */
43
+ readonly getTicksCount: () => number;
44
+ /** Incremental read — returns ticks WITH index >= `idx`. Lets a
45
+ * dashboard poll cheaply by tracking its last-seen index. */
46
+ readonly getTicksSince: (idx: number) => readonly CostTick[];
47
+ /** Drop all buffered ticks. */
48
+ readonly clear: () => void;
49
+ }
50
+ export declare function inMemorySinkCost(opts?: InMemorySinkCostOptions): InMemorySinkCostStrategy;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Default strategies — the four "shipped in core" sinks.
3
+ *
4
+ * `consoleObservability` — print events to console
5
+ * `inMemorySinkCost` — accumulate cost ticks in a process-local buffer
6
+ * `chatBubbleLiveStatus` — call a consumer-supplied line callback
7
+ * `noopLens` — drop graph updates (zero-arg fallback)
8
+ *
9
+ * Vendor strategies (datadog, otel, agentcore, cloudwatch, …) ship as
10
+ * separate subpaths with peer-dep on the vendor SDK. See
11
+ * `docs/inspiration/strategy-everywhere.md` for the AWS-first roadmap.
12
+ *
13
+ * ─────────────────────────────────────────────────────────────────
14
+ * Why defaults skip `validate()`:
15
+ *
16
+ * The optional `BaseStrategy.validate()` hook is the right place for
17
+ * runtime config checks (API keys, endpoint reachability, peer-dep
18
+ * presence). Defaults skip it by design — their inputs are TypeScript-
19
+ * checked at construction, and they don't talk to a remote vendor that
20
+ * might be misconfigured.
21
+ *
22
+ * Vendor strategies that DO talk to a remote (datadog, agentcore,
23
+ * cloudwatch) MUST implement `validate()` per the New Relic panel
24
+ * review — early-fail-with-useful-message beats silent zero-emission.
25
+ * ─────────────────────────────────────────────────────────────────
26
+ */
27
+ export { consoleObservability, type ConsoleObservabilityOptions } from './consoleObservability.js';
28
+ export { inMemorySinkCost, type InMemorySinkCostOptions, type InMemorySinkCostStrategy, } from './inMemorySinkCost.js';
29
+ export { chatBubbleLiveStatus, type ChatBubbleLiveStatusOptions } from './chatBubbleLiveStatus.js';
30
+ export { noopLens, type NoopLensOptions } from './noopLens.js';