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,135 @@
1
+ /**
2
+ * reliabilityExecution — the retry-loop helper invoked by `callLLM`
3
+ * when `Agent.create(...).reliability(config)` is configured.
4
+ *
5
+ * Wraps a single-shot LLM call with rules-based reliability semantics:
6
+ *
7
+ * PreCheck rules → continue / fail-fast
8
+ * ↓
9
+ * provider call → response | error
10
+ * ↓
11
+ * PostDecide rules → ok / retry / retry-other / fallback / fail-fast
12
+ * ↓
13
+ * loop or commit
14
+ *
15
+ * The loop runs in JS within a SINGLE footprintjs stage execution. The
16
+ * trace shows one CallLLM stage that internally retried N times. Richer
17
+ * "every retry as a separate stage" tracing is the v2.11.6+ work via
18
+ * `buildReliabilityGateChart` (which trades streaming support for
19
+ * stage-level granularity).
20
+ *
21
+ * Streaming + reliability semantics — first-chunk arbitration:
22
+ * • Pre-first-chunk failures (connection, headers, breaker-open):
23
+ * full rule set fires (retry / retry-other / fallback / fail-fast).
24
+ * • Post-first-chunk failures (mid-stream): rules can ONLY emit
25
+ * `ok` (commit what we have) or `fail-fast`. Retry / retry-other /
26
+ * fallback are escalated to fail-fast with kind
27
+ * `'mid-stream-not-retryable'`. Matches LangChain's
28
+ * `RunnableWithFallbacks` first-chunk arbitration pattern.
29
+ *
30
+ * On fail-fast: writes `failKind` + `failPayload` to agent scope and
31
+ * calls `$break(reason)`. The agent's main chart catches the break;
32
+ * `Agent.run()` translates it into a typed `ReliabilityFailFastError`
33
+ * at the API boundary (via `TranslateFailFast` stage).
34
+ *
35
+ * Closure-local state (NOT scope):
36
+ * • `attempt` — 1-indexed attempt counter
37
+ * • `providerIdx` — index into the failover list
38
+ * • `breakerStates` — per-provider breaker state (Map)
39
+ * • `attemptsPerProvider` — per-provider counter
40
+ *
41
+ * Why closure-local: this is one footprintjs stage execution. Putting
42
+ * counters into scope would commit them across iterations of the
43
+ * agent's outer ReAct loop, which is not the intent.
44
+ */
45
+ import type { TypedScope } from 'footprintjs';
46
+ import type { LLMProvider, LLMRequest, LLMResponse } from '../../../adapters/types.js';
47
+ import type { ReliabilityConfig, ReliabilityRule, ReliabilityScope } from '../../../reliability/types.js';
48
+ import type { AgentState } from '../types.js';
49
+ /** A single-shot LLM call function. Built once by `callLLM.ts` and
50
+ * passed into this helper; we invoke it once per loop iteration. */
51
+ export type LLMCallFn = (request: LLMRequest, hooks: {
52
+ /** Called the first time a streaming chunk yields content. After
53
+ * this fires, mid-stream errors will escalate retry/fallback to
54
+ * fail-fast. */
55
+ onFirstChunk?: () => void;
56
+ }) => Promise<LLMResponse>;
57
+ /**
58
+ * v2.13 — Output-schema validation hook. Called by the reliability loop
59
+ * AFTER a successful LLM response, BEFORE the response is committed.
60
+ * Throw to signal validation failure — the gate treats the throw as a
61
+ * `'schema-fail'` errorKind and routes via PostDecide rules (which can
62
+ * `retry` with `feedbackForLLM` for Instructor-style schema retry).
63
+ *
64
+ * Sentinel error type — the loop unwraps `ValidationFailure` instances
65
+ * to extract `message` / `path` / `rawOutput` for the
66
+ * `agentfootprint.agent.output_schema_validation_failed` event payload.
67
+ *
68
+ * MUST-FIX #1 from the v2.13 7-panel review: the hook fires ONLY when
69
+ * `response.toolCalls.length === 0` (final-answer turn). Tool-call
70
+ * turns aren't terminal output and validation would be premature.
71
+ * Caller is responsible for the guard; this helper just runs whatever
72
+ * the caller passes.
73
+ */
74
+ export type OutputSchemaValidator = (response: LLMResponse) => void;
75
+ /**
76
+ * Sentinel error class thrown by an `OutputSchemaValidator` to signal
77
+ * a validation failure. Distinct subclass so the reliability loop can
78
+ * `instanceof` check and route to the schema-fail branch instead of
79
+ * treating it as a generic provider error.
80
+ */
81
+ export declare class ValidationFailure extends Error {
82
+ readonly stage: 'json-parse' | 'schema-validate';
83
+ readonly path?: string;
84
+ readonly rawOutput?: string;
85
+ constructor(opts: {
86
+ message: string;
87
+ stage: 'json-parse' | 'schema-validate';
88
+ path?: string;
89
+ rawOutput?: string;
90
+ });
91
+ }
92
+ /** Sentinel kind written to scope on a mid-stream failure that the
93
+ * rules wanted to retry. Surfaces in `ReliabilityFailFastError.kind`. */
94
+ export declare const MID_STREAM_KIND = "mid-stream-not-retryable";
95
+ /**
96
+ * Run the reliability retry loop. Returns the committed `LLMResponse`
97
+ * on success; calls `scope.$break(reason)` and returns `undefined` on
98
+ * fail-fast (caller short-circuits when undefined is returned).
99
+ */
100
+ export declare function executeWithReliability(scope: TypedScope<AgentState>, request: LLMRequest, config: ReliabilityConfig, defaultProvider: LLMProvider, defaultProviderName: string, defaultModel: string, callFn: LLMCallFn,
101
+ /** v2.13 — optional output-schema validator. When supplied, the loop
102
+ * invokes it after every successful LLM call WHERE
103
+ * `response.toolCalls.length === 0` (final-answer turn). Throws of
104
+ * type `ValidationFailure` signal schema-fail and route via
105
+ * PostDecide rules. Caller is responsible for guarding tool-call
106
+ * turns; this helper assumes the validator is already gated. */
107
+ postValidate?: OutputSchemaValidator): Promise<LLMResponse | undefined>;
108
+ /**
109
+ * v2.13 — stuck-loop detection helper. Returns `true` when the last
110
+ * `n` validation errors are IDENTICAL — a hallucinating model that
111
+ * keeps making the same mistake won't make progress on more retries.
112
+ *
113
+ * Default rule template — spread into your `postDecide` to short-circuit
114
+ * stuck loops:
115
+ *
116
+ * ```ts
117
+ * postDecide: [
118
+ * defaultStuckLoopRule, // ← spread first; fail-fast on stuck
119
+ * { when: (s) => s.validationError !== undefined && s.attempt < 3, then: 'retry', ... },
120
+ * ]
121
+ * ```
122
+ *
123
+ * @param scope The reliability scope view passed to rule predicates.
124
+ * @param n How many trailing identical errors trigger detection. Default 2.
125
+ */
126
+ export declare function lastNValidationErrorsMatch(scope: ReliabilityScope, n?: number): boolean;
127
+ /**
128
+ * v2.13 — drop-in PostDecide rule that fail-fasts when the last 2
129
+ * validation errors match. Spread into `postDecide` BEFORE retry
130
+ * rules so it short-circuits before another wasted attempt.
131
+ *
132
+ * The matched-rule kind `'schema-stuck-loop'` surfaces on
133
+ * `ReliabilityFailFastError.kind` for caller branching.
134
+ */
135
+ export declare const defaultStuckLoopRule: ReliabilityRule;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * route — decider that branches the ReAct loop into 'tool-calls' or 'final'.
3
+ *
4
+ * Runs after CallLLM. If the LLM returned tool calls AND we haven't hit
5
+ * `maxIterations`, route to the tool execution branch (which loops back
6
+ * to PromptBuilder). Otherwise route to the final-branch subflow which
7
+ * persists memory writes and breaks the loop.
8
+ *
9
+ * Emits `agentfootprint.agent.route_decided` with the chosen branch +
10
+ * a human-readable rationale (visible in narrative + observability).
11
+ *
12
+ * Pure function — no closure over Agent class state. Imported and
13
+ * passed directly to `addDeciderFunction(...)` in buildAgentChart.
14
+ */
15
+ import type { TypedScope } from 'footprintjs';
16
+ import type { AgentState } from '../types.js';
17
+ export type RouteBranch = 'tool-calls' | 'final';
18
+ export declare const routeDeciderStage: (scope: TypedScope<AgentState>) => RouteBranch;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * seed — initial stage of the agent's chart. Initializes every mutable
3
+ * field of `AgentState` from the consumer's input.
4
+ *
5
+ * Runs once per `agent.run({ input })`. The chart is built once at
6
+ * Agent construction, so seed has access to BOTH:
7
+ *
8
+ * • CHART-BUILD-TIME constants (maxIterations, cachingDisabled,
9
+ * toolSchemas) — passed as direct values to the factory.
10
+ * • PER-RUN MUTABLE state (pendingResumeHistory from
11
+ * resumeOnError(), currentRunContext.runId set per run) —
12
+ * passed as accessor closures over the Agent instance, since
13
+ * these change between consecutive `agent.run()` invocations.
14
+ *
15
+ * The accessor pattern keeps `seed` decoupled from the Agent class
16
+ * while preserving the per-run mutability the resume + identity
17
+ * features need.
18
+ */
19
+ import type { TypedScope } from 'footprintjs';
20
+ import type { LLMMessage, LLMToolSchema } from '../../../adapters/types.js';
21
+ import type { AgentState } from '../types.js';
22
+ export interface SeedStageDeps {
23
+ /** Resolved `clampIterations(opts.maxIterations ?? 10)`. Frozen at
24
+ * chart-build time. */
25
+ readonly maxIterations: number;
26
+ /** Resolved cache kill switch from `Agent.create({ caching: 'off' })`. */
27
+ readonly cachingDisabled: boolean;
28
+ /** Static tool schemas resolved at chart-build time. The tools slot
29
+ * subflow can OVERRIDE this per-iteration via `dynamicToolSchemas`,
30
+ * but seed populates the initial value so iter 1 has it. */
31
+ readonly toolSchemas: readonly LLMToolSchema[];
32
+ /**
33
+ * Read-AND-CLEAR accessor for the resume side-channel. Called exactly
34
+ * once per `agent.run()` from inside seed. If `resumeOnError(checkpoint)`
35
+ * was invoked before `run()`, this returns the checkpointed history
36
+ * and clears the field so the NEXT `run()` starts fresh. Returns
37
+ * `undefined` for the normal (non-resume) path.
38
+ */
39
+ readonly consumePendingResumeHistory: () => readonly LLMMessage[] | undefined;
40
+ /**
41
+ * Accessor for the current run's id, used to default the memory
42
+ * identity when consumer didn't pass `agent.run({ identity })`. Set
43
+ * by RunnerBase on every `agent.run()` call before the chart starts.
44
+ * Returns `undefined` only in degenerate (test) cases.
45
+ */
46
+ readonly getCurrentRunId: () => string | undefined;
47
+ }
48
+ /**
49
+ * Build the seed stage function for an Agent instance. Captures both
50
+ * the chart-build-time constants and the per-run mutable accessors
51
+ * via the deps object.
52
+ */
53
+ export declare function buildSeedStage(deps: SeedStageDeps): (scope: TypedScope<AgentState>) => void;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * toolCalls — pausable handler for executing the LLM-requested tool
3
+ * calls in the agent's ReAct loop.
4
+ *
5
+ * • `execute` iterates `scope.llmLatestToolCalls`, dispatches each
6
+ * tool, appends results to scope.history, and increments
7
+ * `scope.iteration`. If a tool throws `PauseRequest` (via
8
+ * `pauseHere()`), commits partial state and returns the pause
9
+ * payload so footprintjs captures a checkpoint.
10
+ * • `resume` runs after the consumer supplies the human's answer.
11
+ * Treats that answer as the paused tool's result, appends to
12
+ * history, then continues the ReAct iteration loop.
13
+ *
14
+ * Dispatch resolution order:
15
+ * 1. Static registry built at chart-build time (registryByName).
16
+ * 2. External `ToolProvider.list(ctx).find(...)` if a `.toolProvider()`
17
+ * was wired and the tool isn't in the static registry.
18
+ *
19
+ * Permission gate (when `permissionChecker` is configured) runs BEFORE
20
+ * `tool.execute`. Deny → tool not executed; result is a synthetic
21
+ * denial string. Allow / gate_open → execution proceeds.
22
+ *
23
+ * `read_skill` is the auto-attached activation tool — when the LLM
24
+ * calls it with a valid Skill id, the next InjectionEngine pass
25
+ * activates that Skill (lifetime: turn).
26
+ */
27
+ import type { PausableHandler, TypedScope } from 'footprintjs';
28
+ import type { PermissionChecker } from '../../../adapters/types.js';
29
+ import type { ToolProvider } from '../../../tool-providers/types.js';
30
+ import type { CredentialProvider } from '../../../identity/types.js';
31
+ import type { ProviderToolCache } from '../../slots/buildToolsSlot.js';
32
+ import type { Tool } from '../../tools.js';
33
+ import { type ToolArgValidationMode } from '../toolArgsValidation.js';
34
+ import type { AgentState } from '../types.js';
35
+ export interface ToolCallsHandlerDeps {
36
+ /** Map from tool name → Tool instance, built from the augmented
37
+ * registry (static .tool() entries + read_skill if any skills +
38
+ * shared skill tools). The dispatch primary lookup. */
39
+ readonly registryByName: ReadonlyMap<string, Tool>;
40
+ /** Optional external `.toolProvider()` for per-iteration dynamic
41
+ * tools (skill-scoped, multi-tenant, etc.). Consulted only when
42
+ * the static registry doesn't have the tool. */
43
+ readonly externalToolProvider?: ToolProvider;
44
+ /**
45
+ * Cache populated by `buildToolsSlot` after each `provider.list(ctx)`
46
+ * call this iteration. Read here to avoid a second `list()` call
47
+ * (vital for async / network-backed providers). Same closure shared
48
+ * within one chart build.
49
+ */
50
+ readonly providerToolCache?: ProviderToolCache;
51
+ /** Optional permission gate. When present, every tool dispatch
52
+ * awaits `check({capability: 'tool_call', ...})` BEFORE executing.
53
+ * Throwing checkers are treated as deny-by-default. */
54
+ readonly permissionChecker?: PermissionChecker;
55
+ /** Optional credential provider (declare-and-push). When present, a tool's
56
+ * declared `needs` is resolved BEFORE execute and injected as `ctx.credential`;
57
+ * `ctx.credentials` exposes it for the pull escape hatch. */
58
+ readonly credentialProvider?: CredentialProvider;
59
+ /** Tool-args validation mode (#9). Default 'enforce': LLM-produced args
60
+ * are checked against the tool's `inputSchema` BEFORE dispatch; a
61
+ * mismatch rejects the call with a model-visible retry message.
62
+ * 'warn' emits the event but executes anyway; 'off' skips validation. */
63
+ readonly toolArgValidation?: ToolArgValidationMode;
64
+ /**
65
+ * Skill-graph read_skill GATE (`graph.reachableSkills`). When present, a
66
+ * `read_skill('id')` whose `id` is not reachable from the current cursor is
67
+ * REJECTED — the model gets a synthetic re-prompt naming the allowed ids and
68
+ * the cursor/activations stay unchanged, so it can't leave the graph mid-run.
69
+ * Undefined → no gate (plain read_skill agents append as before).
70
+ */
71
+ readonly allowedSkillIds?: (currentSkillId?: string) => readonly string[];
72
+ }
73
+ /**
74
+ * Build the pausable tool-call handler for the agent's chart.
75
+ */
76
+ export declare function buildToolCallsHandler(deps: ToolCallsHandlerDeps): PausableHandler<TypedScope<AgentState>>;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * toolArgsValidation — validate LLM-produced tool args against the tool's
3
+ * declared `inputSchema` BEFORE dispatch (backlog #9).
4
+ *
5
+ * Pattern: pure function module — no state, no events; the toolCalls stage
6
+ * owns when to call it and what to do with the verdict.
7
+ * Role: The model writes tool args as free-form JSON; nothing guaranteed
8
+ * they match the schema the tool advertised. Dispatching garbage
9
+ * surfaced as deep tool stack traces (or worse, silent misbehavior).
10
+ * Validating at the boundary turns a malformed call into a
11
+ * MODEL-VISIBLE structured tool result, so the LLM corrects its
12
+ * args and retries on the next ReAct iteration.
13
+ *
14
+ * ── Honest-subset contract ────────────────────────────────────────────────
15
+ * This is NOT a full JSON Schema implementation. It enforces the core that
16
+ * tool schemas in the wild actually use, and IGNORES everything else
17
+ * (permissive on unknown keywords — a schema using `pattern`/`oneOf`/`$ref`
18
+ * still validates the supported core, never false-rejects on the rest):
19
+ *
20
+ * ENFORCED: `type` (object/array/string/number/integer/boolean/null,
21
+ * union arrays), `required`, `properties` (recursive),
22
+ * `items` (single-schema, recursive), `enum` (primitives),
23
+ * `additionalProperties: false` ONLY when explicitly set.
24
+ * IGNORED: format, pattern, min/max*, oneOf/anyOf/allOf/not, $ref,
25
+ * const, dependencies, …
26
+ *
27
+ * ── Security: never echo VALUES ───────────────────────────────────────────
28
+ * Issues name the PATH, the EXPECTED shape, and the TYPE of what arrived —
29
+ * never the supplied value itself. The message flows into history (LLM),
30
+ * the emit channel, and traces; arg values can carry PII or injection
31
+ * payloads. Enum expectations echo SCHEMA values only (already LLM-visible
32
+ * in the tools block).
33
+ */
34
+ /** When to enforce: 'enforce' rejects before dispatch (default), 'warn'
35
+ * emits the event but executes anyway, 'off' skips validation entirely. */
36
+ export type ToolArgValidationMode = 'enforce' | 'warn' | 'off';
37
+ /** One schema violation. `got` is a TYPE NAME, never a value. */
38
+ export interface ToolArgIssue {
39
+ /** Dot/bracket path from the args root, '' for the root itself. */
40
+ readonly path: string;
41
+ readonly expected: string;
42
+ readonly got: string;
43
+ }
44
+ export interface ToolArgValidationResult {
45
+ readonly ok: boolean;
46
+ readonly issues: readonly ToolArgIssue[];
47
+ }
48
+ /**
49
+ * Validate tool-call args against the tool's `inputSchema`.
50
+ *
51
+ * Total function: a malformed/exotic SCHEMA never throws — anything outside
52
+ * the honest subset is ignored, so the worst a bad schema can do is
53
+ * under-validate (never block a legitimate call).
54
+ */
55
+ export declare function validateToolArgs(args: unknown, inputSchema: Readonly<Record<string, unknown>> | undefined): ToolArgValidationResult;
56
+ /**
57
+ * Render the MODEL-VISIBLE tool result for a rejected call. Names paths,
58
+ * expectations, and received TYPES — never received values. The model
59
+ * already has the full schema in its tools block; pointing at the issues
60
+ * is what makes the retry converge.
61
+ */
62
+ export declare function formatToolArgIssues(toolName: string, issues: readonly ToolArgIssue[]): string;