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,71 @@
1
+ /**
2
+ * writeMessages — write-side stage that persists new turn messages as
3
+ * `MemoryEntry`s.
4
+ *
5
+ * Reads from scope: `identity`, `turnNumber`, `newMessages`
6
+ * Writes to store: one entry per message, id = `msg-{turnNumber}-{index}`
7
+ *
8
+ * Every written entry carries `source.turn` + `source.identity` so
9
+ * retrieval stages can later show "recalled from turn 5" with correct
10
+ * cross-session provenance. A content-hash signature is also registered
11
+ * via `store.recordSignature` so subsequent `seen()` calls recognize
12
+ * near-duplicate content without loading the full entries.
13
+ *
14
+ * Why a deterministic `id` format?
15
+ * `msg-{turn}-{index}` lets write-then-re-write be idempotent: a stage
16
+ * that re-runs in the same turn (retries, resumable turns) overwrites
17
+ * the same id instead of growing history. For non-turn-scoped writes,
18
+ * pass a custom `idFrom` that produces whatever shape your app needs.
19
+ *
20
+ * PII / redaction:
21
+ * Message content is stored VERBATIM. If your messages contain PII
22
+ * (names, addresses, secrets), redact BEFORE writing — either by
23
+ * mutating `scope.newMessages` upstream or by wrapping the call site
24
+ * with a redaction helper. The storage layer does NOT scrub for you.
25
+ * Pair with footprintjs's `RedactionPolicy` for end-to-end coverage.
26
+ *
27
+ * Extended thinking blocks (Anthropic) / reasoning tokens (OpenAI):
28
+ * Persisting reasoning blocks is expensive — they can be 10-100× the
29
+ * size of the final message. Strip them from `scope.newMessages` before
30
+ * calling this stage UNLESS you plan to recall them (e.g. for debugging
31
+ * replay). A common pattern: write reasoning to `tier: 'cold'` with a
32
+ * short `ttlMs` so they age out quickly.
33
+ */
34
+ import type { TypedScope } from 'footprintjs';
35
+ import type { MemoryStore } from '../store/index.js';
36
+ import type { LLMMessage as Message } from '../../adapters/types.js';
37
+ import type { MemoryState } from './types.js';
38
+ export interface WriteMessagesConfig {
39
+ /** The store to persist to. */
40
+ readonly store: MemoryStore;
41
+ /**
42
+ * Optional id producer — receives (turn, index, message) and returns
43
+ * the `MemoryEntry.id`. Defaults to `msg-{turn}-{index}` which makes
44
+ * re-runs of the same turn idempotent. Override for app-level ids
45
+ * (e.g. use a message's server-side id).
46
+ */
47
+ readonly idFrom?: (turn: number, index: number, message: Message) => string;
48
+ /**
49
+ * Optional signature producer for the recognition set. When present,
50
+ * each message produces a signature that is registered via
51
+ * `store.recordSignature`; `seen()` later returns `true` for the same
52
+ * content. Default: skip (many apps don't need recognition).
53
+ */
54
+ readonly signatureFrom?: (message: Message) => string;
55
+ /**
56
+ * Optional TTL in milliseconds from `Date.now()`. When set, written
57
+ * entries expire this long after they were stored. Useful for
58
+ * compliance retention windows ("delete chat history after 30 days").
59
+ */
60
+ readonly ttlMs?: number;
61
+ /**
62
+ * Optional tier for the entries. Typical pattern:
63
+ * - `'hot'` for the last few turns
64
+ * - `'warm'` for older turns
65
+ * - `'cold'` for archived
66
+ * Stages in Layer 3+ can filter on tier. Omitting leaves entries
67
+ * untiered (read stages still see them; tier-filtered reads skip them).
68
+ */
69
+ readonly tier?: 'hot' | 'warm' | 'cold';
70
+ }
71
+ export declare function writeMessages(config: WriteMessagesConfig): (scope: TypedScope<MemoryState>) => Promise<void>;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * InMemoryStore — reference `MemoryStore` implementation, zero dependencies.
3
+ *
4
+ * Kept deliberately small — ~200 lines. Its job is to validate the
5
+ * interface contract: every stage and pipeline is tested against this
6
+ * adapter, so any bug in the store shape surfaces here first.
7
+ *
8
+ * Internal structure:
9
+ * namespace (string) → Map<entryId, MemoryEntry>
10
+ * + Set<signature> (for seen)
11
+ * + Map<id, usefulnessSum, usefulnessCount> (for feedback)
12
+ *
13
+ * TTL is enforced lazily on read (cheapest; no background sweeper needed).
14
+ * Pagination cursor is a monotonic integer — entries sorted by updatedAt desc.
15
+ */
16
+ import type { MemoryIdentity } from '../identity/index.js';
17
+ import type { MemoryEntry } from '../entry/index.js';
18
+ import type { ListOptions, ListResult, MemoryStore, PutIfVersionResult, ScoredEntry, SearchOptions } from './types.js';
19
+ export declare class InMemoryStore implements MemoryStore {
20
+ /**
21
+ * Top-level namespace → slot. Using `Map` rather than a plain object
22
+ * avoids prototype-pollution surface AND preserves insertion order
23
+ * (needed for deterministic list pagination).
24
+ */
25
+ private readonly namespaces;
26
+ private slot;
27
+ /** True if the entry's TTL has elapsed. Centralized so both `get` and `list` agree. */
28
+ private isExpired;
29
+ get<T = unknown>(identity: MemoryIdentity, id: string): Promise<MemoryEntry<T> | null>;
30
+ put<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>): Promise<void>;
31
+ /**
32
+ * Batched write — resolves the slot once and writes each entry into the
33
+ * same Map. Saves N-1 slot lookups vs. calling `put()` in a loop, and
34
+ * gives network-backed adapters a place to pipeline round-trips.
35
+ */
36
+ putMany<T = unknown>(identity: MemoryIdentity, entries: readonly MemoryEntry<T>[]): Promise<void>;
37
+ putIfVersion<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, expectedVersion: number): Promise<PutIfVersionResult>;
38
+ list<T = unknown>(identity: MemoryIdentity, options?: ListOptions): Promise<ListResult<T>>;
39
+ delete(identity: MemoryIdentity, id: string): Promise<void>;
40
+ seen(identity: MemoryIdentity, signature: string): Promise<boolean>;
41
+ recordSignature(identity: MemoryIdentity, signature: string): Promise<void>;
42
+ feedback(identity: MemoryIdentity, id: string, usefulness: number): Promise<void>;
43
+ getFeedback(identity: MemoryIdentity, id: string): Promise<{
44
+ average: number;
45
+ count: number;
46
+ } | null>;
47
+ forget(identity: MemoryIdentity): Promise<void>;
48
+ /**
49
+ * O(n) linear scan over identity-scoped entries. Fine for dev / tests
50
+ * — for production, plug in a real vector backend (pgvector, Pinecone,
51
+ * Qdrant) that implements the same interface.
52
+ *
53
+ * Semantics per the `MemoryStore.search?` contract:
54
+ * - Entries without `embedding` are skipped (ignored, not errored).
55
+ * - Entries with `embedding.length` mismatching the query are
56
+ * skipped (cosine would throw — silent-skip avoids poisoning top-k).
57
+ * - TTL-expired entries are omitted.
58
+ * - Optional `tiers` / `minScore` / `embedderId` filters applied.
59
+ * - Returns descending by score; ties broken by id for determinism.
60
+ */
61
+ search<T = unknown>(identity: MemoryIdentity, query: readonly number[], options?: SearchOptions): Promise<readonly ScoredEntry<T>[]>;
62
+ }
@@ -0,0 +1,2 @@
1
+ export type { MemoryStore, ListOptions, ListResult, MemoryCursor, PutIfVersionResult, SearchOptions, ScoredEntry, } from './types.js';
2
+ export { InMemoryStore } from './InMemoryStore.js';
@@ -0,0 +1,223 @@
1
+ /**
2
+ * MemoryStore — the I/O boundary.
3
+ *
4
+ * Every storage backend (InMemory, Redis, DynamoDB, Postgres, Bedrock
5
+ * AgentCore) implements this interface. Stages above the store layer never
6
+ * talk to a concrete backend — they invoke these methods and trust the
7
+ * adapter to handle durability, consistency, encryption, pagination, etc.
8
+ *
9
+ * Design principles:
10
+ *
11
+ * 1. **Identity is always the first argument.** Every call takes
12
+ * `MemoryIdentity` so stores enforce tenant / principal isolation at
13
+ * the boundary. A bug passing the wrong identity surfaces as "no data"
14
+ * rather than a cross-tenant leak.
15
+ *
16
+ * 2. **Methods return Promises uniformly.** Even InMemoryStore's sync ops
17
+ * are wrapped — stages can await every call and adapters are free to
18
+ * swap sync ↔ async without breaking callers.
19
+ *
20
+ * 3. **Writes are optimistic-concurrency-aware.** `putIfVersion` is the
21
+ * default for multi-writer correctness; `put` is convenience for "I
22
+ * know I'm the only writer" callers (single-server, tests).
23
+ *
24
+ * 4. **Reads return cursors, not unbounded arrays.** `list` takes
25
+ * `{ cursor?, limit? }` so large namespaces never OOM. Stages iterate
26
+ * as long as they need.
27
+ *
28
+ * 5. **Recognition is separate from recall.** `seen(signature)` is a
29
+ * boolean check — cheaper than `get` when the caller only needs
30
+ * "have we processed this before?" (cognitive-arch reviewer ask).
31
+ *
32
+ * 6. **Feedback flows back.** `feedback(id, usefulness)` lets retrieval
33
+ * stages signal "this entry was actually used / wasn't used" so
34
+ * adapters can drive their own learning / eviction (RAG-theory ask).
35
+ */
36
+ import type { MemoryIdentity } from '../identity/index.js';
37
+ import type { MemoryEntry } from '../entry/index.js';
38
+ /** Pagination cursor — opaque string, adapter-specific encoding. */
39
+ export type MemoryCursor = string;
40
+ /** Options for listing entries in a namespace. */
41
+ export interface ListOptions {
42
+ /** Continuation token from a previous `list` call. Omit for the first page. */
43
+ readonly cursor?: MemoryCursor;
44
+ /** Maximum entries to return in this page. Adapters may cap this lower. */
45
+ readonly limit?: number;
46
+ /** Optional filter — only return entries matching these tiers. */
47
+ readonly tiers?: ReadonlyArray<'hot' | 'warm' | 'cold'>;
48
+ }
49
+ /** Result of a paginated `list` call. */
50
+ export interface ListResult<T = unknown> {
51
+ readonly entries: readonly MemoryEntry<T>[];
52
+ /** Present iff more pages exist. Pass back into `list.cursor` to continue. */
53
+ readonly cursor?: MemoryCursor;
54
+ }
55
+ /** Outcome of a `putIfVersion` attempt. */
56
+ export interface PutIfVersionResult {
57
+ /** True iff the write succeeded. */
58
+ readonly applied: boolean;
59
+ /**
60
+ * When `applied === false`, the current version stored — caller can
61
+ * decide whether to retry, merge, or abort. Absent if the entry did
62
+ * not exist at all.
63
+ */
64
+ readonly currentVersion?: number;
65
+ }
66
+ /** Options for a vector similarity search. */
67
+ export interface SearchOptions {
68
+ /**
69
+ * How many top-scoring entries to return. Default 10. Adapters may
70
+ * cap this lower (Pinecone: 10000, pgvector: user-defined, etc.).
71
+ */
72
+ readonly k?: number;
73
+ /** Filter results by tier (e.g. `['hot']`) before ranking. */
74
+ readonly tiers?: ReadonlyArray<'hot' | 'warm' | 'cold'>;
75
+ /**
76
+ * Drop entries whose similarity score is below this threshold. Useful
77
+ * when "no match" is a valid outcome (vs. always returning the k
78
+ * nearest no matter how far away). Range [-1, 1] for cosine.
79
+ */
80
+ readonly minScore?: number;
81
+ /**
82
+ * Embedder id the query was produced with. When present, adapters MAY
83
+ * skip entries whose `embeddingModel` doesn't match — prevents silent
84
+ * cross-model similarity pollution. Absent = trust caller knows what
85
+ * they're doing.
86
+ */
87
+ readonly embedderId?: string;
88
+ }
89
+ /**
90
+ * A `MemoryEntry` annotated with its similarity score. Returned by
91
+ * `store.search()`. Score semantics are adapter-defined but SHOULD
92
+ * use cosine similarity by default ([-1, 1], higher = closer).
93
+ */
94
+ export interface ScoredEntry<T = unknown> {
95
+ readonly entry: MemoryEntry<T>;
96
+ readonly score: number;
97
+ }
98
+ /**
99
+ * Common surface for all backends. Every method takes `MemoryIdentity`
100
+ * as the scoping argument; stores MUST prefix their internal keys with
101
+ * `identityNamespace(identity)` to prevent cross-tenant access.
102
+ */
103
+ export interface MemoryStore {
104
+ /**
105
+ * Fetch one entry by id within the given identity's namespace.
106
+ * Returns `null` when the entry doesn't exist OR has expired (TTL).
107
+ * Callers should not distinguish — both mean "no data."
108
+ *
109
+ * Side effect: adapters MAY increment `accessCount` and update
110
+ * `lastAccessedAt` when returning the entry (decay signals).
111
+ */
112
+ get<T = unknown>(identity: MemoryIdentity, id: string): Promise<MemoryEntry<T> | null>;
113
+ /**
114
+ * Unconditional write — overwrites any existing entry with the same id.
115
+ * Prefer `putIfVersion` in multi-writer scenarios.
116
+ */
117
+ put<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>): Promise<void>;
118
+ /**
119
+ * Batched unconditional write. Semantically equivalent to N sequential
120
+ * `put()` calls but gives adapters a chance to batch the round-trip.
121
+ *
122
+ * - **InMemoryStore**: no-op optimization — loops internally.
123
+ * - **Redis**: pipelined MSET / MULTI-EXEC.
124
+ * - **DynamoDB**: `BatchWriteItem` (25-entry limit enforced by caller
125
+ * or adapter — adapters MAY chunk).
126
+ * - **Postgres**: multi-row INSERT … ON CONFLICT DO UPDATE.
127
+ *
128
+ * Atomicity is NOT guaranteed across the batch — a partial failure
129
+ * may leave some entries written, some not. Stages that need
130
+ * transactional semantics should use `putIfVersion` per entry with
131
+ * application-level rollback. Most memory flows are append-idempotent
132
+ * (ids are deterministic like `msg-{turn}-{idx}`), so the batch model
133
+ * matches the common case.
134
+ *
135
+ * **Empty batch (`entries.length === 0`): MUST be a no-op.** Callers
136
+ * rely on this to skip a round-trip when there's nothing to persist
137
+ * (e.g., a turn that produced no new messages). Adapters must not
138
+ * reject empty batches — return a resolved Promise immediately.
139
+ *
140
+ * Default implementation for adapters that don't override: sequentially
141
+ * calls `put()` for each entry. Adapters SHOULD override for
142
+ * performance-critical paths.
143
+ */
144
+ putMany<T = unknown>(identity: MemoryIdentity, entries: readonly MemoryEntry<T>[]): Promise<void>;
145
+ /**
146
+ * Optimistic-concurrency write. Writes only if the stored version equals
147
+ * `expectedVersion`, OR if no entry exists at all AND `expectedVersion`
148
+ * is `0` (first-write sentinel).
149
+ *
150
+ * Returns `{ applied: true }` on success, `{ applied: false, currentVersion }`
151
+ * when the caller's assumed version is stale.
152
+ */
153
+ putIfVersion<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, expectedVersion: number): Promise<PutIfVersionResult>;
154
+ /**
155
+ * Page through entries in the identity's namespace. Ordered by adapter's
156
+ * choice (usually most-recently-updated first) — consumers that care
157
+ * about order should filter client-side.
158
+ */
159
+ list<T = unknown>(identity: MemoryIdentity, options?: ListOptions): Promise<ListResult<T>>;
160
+ /** Remove one entry. No-op if the entry doesn't exist. */
161
+ delete(identity: MemoryIdentity, id: string): Promise<void>;
162
+ /**
163
+ * Cheap "have we processed this signature before?" check. Useful for
164
+ * deduplication, idempotent writes, and cognitive-arch-style recognition
165
+ * vs. recall. Signature is an opaque string the caller controls
166
+ * (content hash, canonicalized fact, etc.).
167
+ */
168
+ seen(identity: MemoryIdentity, signature: string): Promise<boolean>;
169
+ /**
170
+ * Write-side of the recognition set — adds a signature so subsequent
171
+ * `seen()` calls return `true`. Stages register signatures as entries
172
+ * are written (content hashes, canonicalized facts). Separate from the
173
+ * entry store: a signature outlives the entry that produced it, so
174
+ * dedup survives garbage collection.
175
+ */
176
+ recordSignature(identity: MemoryIdentity, signature: string): Promise<void>;
177
+ /**
178
+ * Record usefulness feedback for an entry. `usefulness` in `[-1, 1]`:
179
+ * -1 = retrieved but harmful / misleading
180
+ * 0 = retrieved but not used (neutral)
181
+ * 1 = retrieved AND used in the final answer
182
+ *
183
+ * Non-finite values (NaN / ±Infinity) MUST be rejected by adapters —
184
+ * they poison the aggregate. Caller should pass a finite number in
185
+ * `[-1, 1]`; adapters clamp to the valid range for hardening.
186
+ */
187
+ feedback(identity: MemoryIdentity, id: string, usefulness: number): Promise<void>;
188
+ /**
189
+ * Read-side of feedback — aggregated usefulness for an entry. Returns
190
+ * `null` when no feedback has been recorded (distinct from "neutral
191
+ * average of 0" — callers often want to treat the two differently).
192
+ * Retrieval stages consume this to feedback-weight rankings.
193
+ */
194
+ getFeedback(identity: MemoryIdentity, id: string): Promise<{
195
+ average: number;
196
+ count: number;
197
+ } | null>;
198
+ /**
199
+ * GDPR — remove ALL entries for the given identity.
200
+ * Must be implementable in one operation per backend (DELETE WHERE prefix).
201
+ */
202
+ forget(identity: MemoryIdentity): Promise<void>;
203
+ /**
204
+ * Optional — similarity search over entries that carry an
205
+ * `embedding` field. Returns the top-k entries by cosine similarity
206
+ * (descending). Adapters that don't support vector search should
207
+ * OMIT this method; callers feature-detect via `if (store.search)`.
208
+ *
209
+ * Semantics:
210
+ * - Entries with no `embedding` field are ignored (not errored).
211
+ * - Entries with `embedding` of mismatched length are skipped
212
+ * (cosine would throw — silent-skip avoids poisoning the top-k).
213
+ * - TTL-expired entries are omitted (same as `get`/`list`).
214
+ * - Ordering: descending by score. Ties broken by adapter choice.
215
+ *
216
+ * Reference backends:
217
+ * - **InMemoryStore**: O(n) linear scan over identity-scoped entries.
218
+ * Fine for dev / tests. Production needs a real vector DB.
219
+ * - **pgvector**: `ORDER BY embedding <=> query LIMIT k`.
220
+ * - **Pinecone / Qdrant / Weaviate**: native vector query API.
221
+ */
222
+ search?<T = unknown>(identity: MemoryIdentity, query: readonly number[], options?: SearchOptions): Promise<readonly ScoredEntry<T>[]>;
223
+ }
@@ -0,0 +1,2 @@
1
+ export { mountMemoryRead, mountMemoryWrite, mountMemoryPipeline } from './mountMemoryPipeline.js';
2
+ export type { MountMemoryPipelineConfig } from './mountMemoryPipeline.js';
@@ -0,0 +1,108 @@
1
+ /**
2
+ * mountMemoryPipeline — mount a MemoryPipeline's read + write subflows
3
+ * into an arbitrary agent flowchart.
4
+ *
5
+ * Given:
6
+ * - a `FlowChartBuilder<AgentState>` the caller has been assembling,
7
+ * - a `MemoryPipeline { read, write }` (typically from a preset),
8
+ * - identity + turn + budget inputs sourced from agent scope,
9
+ * - mount points (which stage id to insert the read subflow before),
10
+ *
11
+ * returns the builder with:
12
+ * 1. the `read` subflow mounted BEFORE the given anchor stage, with an
13
+ * inputMapper that reads identity/turn/budget from agent scope and
14
+ * an outputMapper that writes `formatted` messages back,
15
+ * 2. the `write` subflow (if present) appended AT THE END, with an
16
+ * inputMapper that reads `newMessages` from agent scope.
17
+ *
18
+ * The agent's existing stages are responsible for:
19
+ * - populating `identity`, `turnNumber`, `contextTokensRemaining`,
20
+ * `newMessages` in scope BEFORE the relevant memory subflow runs,
21
+ * - consuming the injected `formatted` messages (merge into the
22
+ * agent's outgoing LLM prompt).
23
+ *
24
+ * This helper does NOT own any of those concerns — it owns only the
25
+ * mechanical subflow mounting. Consumer-facing API
26
+ * (`AgentBuilder.memoryPipeline()`) is layered on top.
27
+ *
28
+ * Why a standalone helper, not a direct `AgentBuilder` patch?
29
+ * - Lets us test the wire mechanism end-to-end in isolation (Layer 6)
30
+ * without changing the existing AgentRunner path (100+ tests).
31
+ * - The wire is a small, reviewable unit; the AgentBuilder refactor is
32
+ * a larger concern that can ship separately.
33
+ * - Future non-Agent concepts (Swarm, Parallel) can use the same helper
34
+ * — memory isn't tied to Agent conceptually.
35
+ */
36
+ import type { FlowChartBuilder } from 'footprintjs';
37
+ import type { MemoryPipeline } from '../pipeline/types.js';
38
+ /**
39
+ * Keys this helper reads from / writes to on the parent agent scope.
40
+ * Kept as fields on the config so consumers with non-standard field names
41
+ * can override without renaming scope properties.
42
+ */
43
+ export interface MountMemoryPipelineConfig<ParentState> {
44
+ /** The compiled read + write subflows from a pipeline preset. */
45
+ readonly pipeline: MemoryPipeline;
46
+ /**
47
+ * Scope field name the read subflow reads identity from. Default
48
+ * `'identity'` — matches `MemoryState.identity`. Override when the
49
+ * host flowchart uses a different name.
50
+ */
51
+ readonly identityKey?: keyof ParentState & string;
52
+ /** Scope field name for the turn counter. Default `'turnNumber'`. */
53
+ readonly turnNumberKey?: keyof ParentState & string;
54
+ /**
55
+ * Scope field name for the context-tokens-remaining signal.
56
+ * Default `'contextTokensRemaining'`.
57
+ */
58
+ readonly contextTokensKey?: keyof ParentState & string;
59
+ /**
60
+ * Scope field the read subflow writes its `formatted` output to.
61
+ * Default `'memoryInjection'` — agent stages consume this to prepend
62
+ * to the LLM prompt. Distinct from the pipeline's own `formatted`
63
+ * field so there's no ambiguity between subflow-local and parent scope.
64
+ */
65
+ readonly injectionKey?: keyof ParentState & string;
66
+ /**
67
+ * Scope field the write subflow reads messages to persist from.
68
+ * Default `'newMessages'` — populated by the agent at turn end.
69
+ */
70
+ readonly newMessagesKey?: keyof ParentState & string;
71
+ /** Subflow id for the read mount. Default `'sf-memory-read'`. */
72
+ readonly readSubflowId?: string;
73
+ /** Subflow id for the write mount. Default `'sf-memory-write'`. */
74
+ readonly writeSubflowId?: string;
75
+ /**
76
+ * Evidence source for CAUSAL pipelines (the evidence bridge, backlog #5).
77
+ * Called by the write mount's inputMapper at write time; its result lands on
78
+ * `MemoryState.runEvidence` so `writeSnapshot` persists real decisions /
79
+ * tool calls / iterations / duration / token usage instead of zeros. The
80
+ * Agent threads `causalEvidenceRecorder().collect` here automatically when a
81
+ * CAUSAL memory is mounted. Omit for non-causal pipelines.
82
+ */
83
+ readonly evidenceSource?: () => import('../causal/evidenceRecorder.js').RunEvidence;
84
+ }
85
+ /**
86
+ * Mount only the READ subflow. Appends at the current builder tail, so
87
+ * callers typically invoke this BEFORE their LLM-call stage:
88
+ *
89
+ * let b = flowChart('Seed', seedFn, 'seed');
90
+ * b = mountMemoryRead(b, { pipeline });
91
+ * b = b.addFunction('CallLLM', llmStage, 'call-llm'); // reads memoryInjection
92
+ * b = mountMemoryWrite(b, { pipeline }); // persists newMessages
93
+ *
94
+ * Returns the same builder reference (fluent).
95
+ */
96
+ export declare function mountMemoryRead<ParentState>(builder: FlowChartBuilder<ParentState>, config: MountMemoryPipelineConfig<ParentState>): FlowChartBuilder<ParentState>;
97
+ /**
98
+ * Mount only the WRITE subflow. No-op when the pipeline has no `write`
99
+ * (e.g., ephemeral pipelines) — returns the builder unchanged.
100
+ */
101
+ export declare function mountMemoryWrite<ParentState>(builder: FlowChartBuilder<ParentState>, config: MountMemoryPipelineConfig<ParentState>): FlowChartBuilder<ParentState>;
102
+ /**
103
+ * Convenience: mount both read and write subflows back-to-back.
104
+ * Appropriate ONLY when the host flowchart has no stages between memory
105
+ * read and memory write (rare — most agents have the LLM call between).
106
+ * Prefer `mountMemoryRead` + stages + `mountMemoryWrite` for typical agents.
107
+ */
108
+ export declare function mountMemoryPipeline<ParentState>(builder: FlowChartBuilder<ParentState>, config: MountMemoryPipelineConfig<ParentState>): FlowChartBuilder<ParentState>;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * agentfootprint/memory-providers — memory store adapters (canonical subpath).
3
+ *
4
+ * The Block B canonical name. Mirrors the parallel structure shipped in
5
+ * v2.5:
6
+ *
7
+ * agentfootprint/llm-providers ← LLM provider adapters
8
+ * agentfootprint/tool-providers ← tool dispatch + tool sources
9
+ * agentfootprint/memory-providers ← memory store adapters (this file)
10
+ * agentfootprint/security ← cross-cutting authorization
11
+ *
12
+ * One subpath that grows — RedisStore, AgentCoreStore, and future
13
+ * stores (DynamoDB, Postgres, Pinecone, …) all live here. No more
14
+ * adding `agentfootprint/memory-<vendor>` per-adapter subpath each
15
+ * time a new store ships.
16
+ *
17
+ * Per-adapter aliases (`agentfootprint/memory-redis`,
18
+ * `agentfootprint/memory-agentcore`) stay available through the v2.x
19
+ * line — they point at the same files. New code SHOULD import from
20
+ * `agentfootprint/memory-providers`:
21
+ *
22
+ * import { RedisStore, AgentCoreStore } from 'agentfootprint/memory-providers';
23
+ *
24
+ * Pattern: Adapter (GoF) — each store translates the `MemoryStore`
25
+ * interface onto a specific backend (Redis, DynamoDB-style
26
+ * AWS Bedrock AgentCore Memory, etc.).
27
+ * Role: Outer ring (Hexagonal). All store adapters lazy-require
28
+ * their vendor SDKs at construction time, so importing this
29
+ * barrel costs ZERO peer-dep load — only the stores you
30
+ * actually instantiate pull their SDK in.
31
+ *
32
+ * @example
33
+ * import { RedisStore, AgentCoreStore } from 'agentfootprint/memory-providers';
34
+ */
35
+ export { RedisStore, type RedisStoreOptions, type RedisLikeClient, type RedisLikePipeline, } from './adapters/memory/redis.js';
36
+ export { AgentCoreStore, type AgentCoreStoreOptions, type AgentCoreLikeClient, } from './adapters/memory/agentcore.js';
37
+ export { BedrockAgentMemory, type BedrockAgentMemoryOptions, type BedrockAgentMemoryLikeClient, type BedrockAgentSummary, } from './adapters/memory/bedrockAgentMemory.js';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * compareFinders — run several finders on the same case and collect their answers
3
+ * side by side (a leaderboard row per finder). PARAMETRIC: you pass the finders to
4
+ * compare, so nothing is auto-discovered or retained — unused finders stay
5
+ * tree-shakeable.
6
+ */
7
+ import type { Finder, FindInput, FindResult } from './types.js';
8
+ /** One finder's result in a comparison (or the error it threw). */
9
+ export interface CompareRow {
10
+ readonly finder: string;
11
+ readonly result: FindResult | null;
12
+ readonly error?: string;
13
+ }
14
+ /**
15
+ * Run each finder on `input`; a finder that throws (e.g. missing a dep it needs)
16
+ * becomes a row with `result: null` and `error` set, so one finder cannot abort
17
+ * the comparison.
18
+ */
19
+ export declare function compareFinders(finders: readonly Finder[], input: FindInput): Promise<CompareRow[]>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * observability / contextError / finders — pluggable context-bug localization.
3
+ *
4
+ * "Which piece of context made the agent's answer wrong?" Pick a finder and call
5
+ * `find(input)`. Each finder is a thin, self-explaining adapter over the engines in
6
+ * `src/lib/context-bisect` + `src/lib/influence-core`; the academic method + citation
7
+ * live in `meta`, never in the import name.
8
+ *
9
+ * import { rankSuspects } from 'agentfootprint/observability/contextError/finders';
10
+ * const r = await rankSuspects.find(input); // r.lead, r.evidence ('guessed'|'proven')
11
+ *
12
+ * Tree-shakeable: one finder = one file = one named export. Importing one finder does
13
+ * not pull the others (or the heavy ablation path behind removeAndRetry). This barrel
14
+ * is re-export-only — no runtime code, no registry.
15
+ */
16
+ export type { ContextPiece, Evidence, Finder, FinderMeta, FindInput, FindResult, Granularity, ScoredSuspect, StepInput, } from './types.js';
17
+ export { rankSuspects } from './rankSuspects.js';
18
+ export { removeAndRetry } from './removeAndRetry.js';
19
+ export { traceSteps } from './traceSteps.js';
20
+ export { testManyCombos } from './testManyCombos.js';
21
+ export { shrinkToCause } from './shrinkToCause.js';
22
+ export { compareFinders, type CompareRow } from './compareFinders.js';
@@ -0,0 +1,2 @@
1
+ import type { Finder } from './types.js';
2
+ export declare const rankSuspects: Finder;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * removeAndRetry — the thorough finder. Removes each context piece, re-runs the
3
+ * agent, and a piece is the cause iff its removal flips the outcome back. No
4
+ * embedder, no heuristic: pure counterfactual. Exact, but pays one re-run per
5
+ * piece (`checks`), and on multi-loop runs it can over-attribute (several pieces
6
+ * each flip) — narrow with a slice first when that happens.
7
+ *
8
+ * Method: leave-one-out ablation (counterfactual necessity).
9
+ */
10
+ import type { Finder } from './types.js';
11
+ export declare const removeAndRetry: Finder;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * shrinkToCause — keeps cutting the suspect set down until the smallest subset whose
3
+ * removal still fixes the answer. For a single dominant cause it converges in fewer
4
+ * re-runs than leave-one-out (delta-debugging minimization); for co-necessary causes it
5
+ * still returns the minimal recovering set, but may cost more probes than leave-one-out.
6
+ * The returned set is verified to recover by construction.
7
+ *
8
+ * Method: delta-debugging minimization (ddmin) over the removal set that recovers.
9
+ */
10
+ import type { Finder } from './types.js';
11
+ export declare const shrinkToCause: Finder;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * testManyCombos — turns context pieces on and off in many combinations, re-runs each,
3
+ * and learns which pieces drive the wrong answer (a linear-surrogate attribution), then
4
+ * confirms the top candidate with one clean ablation. The sampling one: it estimates an
5
+ * influence weight per piece from counterfactual data rather than ranking by similarity.
6
+ *
7
+ * Method: random-subset ablation + linear-surrogate attribution. Deterministic
8
+ * pseudo-random masking (a reproducible reimplementation of ContextCite's random subsets).
9
+ */
10
+ import type { Finder } from './types.js';
11
+ export declare const testManyCombos: Finder;
@@ -0,0 +1,2 @@
1
+ import type { Finder } from './types.js';
2
+ export declare const traceSteps: Finder;