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,140 @@
1
+ import type { MemoryIdentity } from '../identity/index.js';
2
+ /**
3
+ * MemoryEntry — a single stored item with decay-, version-, and source-aware
4
+ * metadata.
5
+ *
6
+ * Entry shape is generic over `T` so stores can hold messages, facts,
7
+ * narrative traces, or anything else JSON-serializable. The metadata fields
8
+ * around `value` are what make entries first-class objects instead of raw
9
+ * blobs:
10
+ *
11
+ * - `version` — optimistic concurrency (`putIfVersion`) + migration
12
+ * - `tier` — MemGPT-style hot/warm/cold classification
13
+ * - `source` — provenance — "where did this memory come from?"
14
+ * - `lastAccessedAt` / `accessCount` — decay signals
15
+ * - `ttl` — absolute expiry at the storage layer
16
+ * - `embeddingModel`— compatibility check for semantic search
17
+ *
18
+ * Entries are **immutable in spirit** — a "mutation" is a new entry with the
19
+ * same `id` and an incremented `version`. Storage adapters may implement
20
+ * this as an in-place update or an append-only log, but the library treats
21
+ * entries as values.
22
+ *
23
+ * NOTE: `readonly` modifiers are a TypeScript compile-time hint only. At
24
+ * runtime, nothing prevents a consumer from mutating an entry they received.
25
+ * The library's internal code never mutates entries; adapters that wish to
26
+ * enforce this at runtime may `Object.freeze(entry)` before returning.
27
+ */
28
+ export interface MemoryEntry<T = unknown> {
29
+ /** Stable id within the identity namespace. */
30
+ readonly id: string;
31
+ /** The actual stored payload. JSON-serializable. */
32
+ readonly value: T;
33
+ /**
34
+ * Free-form metadata — tags, labels, user-supplied annotations. Kept
35
+ * separate from the decay / version fields so those stay typed.
36
+ */
37
+ readonly metadata?: Record<string, unknown>;
38
+ /**
39
+ * Monotonic version number. Stores use this for `putIfVersion` optimistic
40
+ * concurrency — write only if the entry is still at the version the
41
+ * writer expected. Defaults to 1 on first write; callers increment.
42
+ */
43
+ readonly version: number;
44
+ /** Unix ms. */
45
+ readonly createdAt: number;
46
+ /** Unix ms. Equal to createdAt on first write. */
47
+ readonly updatedAt: number;
48
+ /** Unix ms. Updated by `store.get` / retrieval stages. Decay input. */
49
+ readonly lastAccessedAt: number;
50
+ /** Number of times this entry has been read. Decay input. */
51
+ readonly accessCount: number;
52
+ /**
53
+ * Optional absolute expiry (unix ms). Storage adapters MUST refuse to
54
+ * return entries past their ttl. Implementations: InMemory filters on
55
+ * read, Redis uses native EXPIRE, DynamoDB uses TTL attribute.
56
+ */
57
+ readonly ttl?: number;
58
+ /**
59
+ * Optional decay policy applied at retrieval time. When present, stages
60
+ * that rank entries (picker, reranker) decrease relevance for entries
61
+ * whose `lastAccessedAt` is far in the past. See `decay.ts`.
62
+ */
63
+ readonly decayPolicy?: DecayPolicy;
64
+ /**
65
+ * Tier classification — enables MemGPT-style page-in/page-out policies.
66
+ * Stages can filter by tier (e.g. "load hot entries first, consult cold
67
+ * only under pressure"). Omitting the field means "untiered."
68
+ */
69
+ readonly tier?: 'hot' | 'warm' | 'cold';
70
+ /**
71
+ * Provenance — which turn / runtime stage / message produced this entry.
72
+ * Lets retrieval cite sources ("remembered from turn 5") and lets
73
+ * `causalChain` cross session boundaries.
74
+ */
75
+ readonly source?: MemorySource;
76
+ /**
77
+ * Optional dense vector embedding of this entry's value. Populated
78
+ * by semantic-memory pipelines (see `embedMessages` / `embedBeats`
79
+ * stages) when an `Embedder` is configured. Stores that support
80
+ * vector search index on this field; stores that don't ignore it.
81
+ *
82
+ * Vector length MUST match the configured embedder's `dimensions`.
83
+ * Mixing embedders of different sizes within the same identity
84
+ * namespace will break cosine similarity — `store.search()` uses
85
+ * `cosineSimilarity()` which throws on length mismatch.
86
+ */
87
+ readonly embedding?: readonly number[];
88
+ /**
89
+ * Identifier of the embedder that produced `embedding`. Search
90
+ * stages compare this against the active embedder's id before
91
+ * trusting distance scores — prevents silent retrieval corruption
92
+ * when an embedding model is swapped but old entries are still
93
+ * indexed with the previous vector space.
94
+ */
95
+ readonly embeddingModel?: string;
96
+ }
97
+ /**
98
+ * Where a memory entry came from. The library populates this automatically
99
+ * when entries are written from inside a memory stage (writeMessages,
100
+ * extractFacts, etc.); consumers can populate it when writing programmatically.
101
+ *
102
+ * When searching across sessions ("did we learn this in a previous session?"),
103
+ * `identity` + `turn` + `runtimeStageId` form a globally-unique causal coordinate
104
+ * — you can replay exactly what the agent was doing when the entry was born.
105
+ */
106
+ export interface MemorySource {
107
+ /** Run-local turn counter. */
108
+ readonly turn?: number;
109
+ /** footprintjs runtime stage id (`stageId#executionIndex`). */
110
+ readonly runtimeStageId?: string;
111
+ /** Originating message id, if the entry came from a conversation turn. */
112
+ readonly messageId?: string;
113
+ /**
114
+ * Cross-session provenance — the `MemoryIdentity` that produced this entry.
115
+ * Lets retrieval stages show "remembered from session X, user Y, turn 5"
116
+ * instead of anonymous citation. Storage adapters MUST preserve this field
117
+ * verbatim on every read/write.
118
+ */
119
+ readonly identity?: MemoryIdentity;
120
+ }
121
+ /**
122
+ * Natural-forgetting policy. Decay applies at retrieval time: the entry's
123
+ * stored value is never mutated; only its computed "relevance" is adjusted.
124
+ *
125
+ * Consumers choose half-life + access boost to match their domain:
126
+ * - Fast-moving (news, tickets) — halfLifeMs ≈ 1 day, accessBoost ≈ 1.5
127
+ * - Stable (user profile, facts)— halfLifeMs ≈ 30 days, accessBoost ≈ 1.1
128
+ */
129
+ export interface DecayPolicy {
130
+ /**
131
+ * How long for relevance to halve when never accessed. Milliseconds.
132
+ */
133
+ readonly halfLifeMs: number;
134
+ /**
135
+ * Multiplier applied per access (clamped to a reasonable ceiling inside
136
+ * `applyDecay`). Values > 1.0 boost frequently-used entries; values in
137
+ * (0, 1.0) would *reduce* relevance with use (rarely desired).
138
+ */
139
+ readonly accessBoost: number;
140
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * extractFacts — write-side stage that distills `scope.newMessages` into
3
+ * `Fact`s via a pluggable `FactExtractor`.
4
+ *
5
+ * Reads from scope: `newMessages`, `turnNumber`, optional `loadedFacts`
6
+ * Writes to scope: `newFacts` (MemoryEntry<Fact>[], ready for writeFacts)
7
+ *
8
+ * The extractor is called ONCE per turn on the turn's new messages. If
9
+ * `scope.loadedFacts` is populated (the write subflow ran `loadFacts`
10
+ * first), existing facts are passed to the extractor so LLM-based
11
+ * extractors can update rather than duplicate.
12
+ *
13
+ * **Stable ids**: each produced entry gets id `fact:${fact.key}`. When
14
+ * the same key is written again in a future turn, the storage layer
15
+ * overwrites in place — no duplicate accumulation. This is the core
16
+ * property that makes facts different from beats (append-only) and
17
+ * messages (append-only).
18
+ *
19
+ * Empty-extraction behavior: `newFacts = []`. Downstream `writeFacts`
20
+ * short-circuits on empty — no store round-trip.
21
+ */
22
+ import type { TypedScope } from 'footprintjs';
23
+ import type { MemoryEntry } from '../entry/index.js';
24
+ import type { MemoryState } from '../stages/index.js';
25
+ import type { FactExtractor } from './extractor.js';
26
+ import type { Fact } from './types.js';
27
+ export interface ExtractFactsConfig {
28
+ /** The extractor to call. See `patternFactExtractor` / `llmFactExtractor`. */
29
+ readonly extractor: FactExtractor;
30
+ /**
31
+ * Optional tier for the persisted facts. Typical pattern: `'hot'` for
32
+ * current identity / preferences, `'warm'` for older commitments.
33
+ * Omit for no tier.
34
+ */
35
+ readonly tier?: 'hot' | 'warm' | 'cold';
36
+ /**
37
+ * Optional TTL in ms from `Date.now()` applied to persisted fact
38
+ * entries. Useful for facts that should decay (task statuses,
39
+ * short-term preferences). Identity facts typically have no TTL.
40
+ */
41
+ readonly ttlMs?: number;
42
+ }
43
+ /** State added to `MemoryState` by the fact pipeline stages. */
44
+ export interface FactPipelineState extends MemoryState {
45
+ /** Produced by `extractFacts`, consumed by `writeFacts`. */
46
+ newFacts?: readonly MemoryEntry<Fact>[];
47
+ /** Produced by `loadFacts`, consumed by `formatFacts` and `extractFacts`. */
48
+ loadedFacts?: readonly MemoryEntry<Fact>[];
49
+ }
50
+ export declare function extractFacts(config: ExtractFactsConfig): (scope: TypedScope<FactPipelineState>) => Promise<void>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * FactExtractor — interface for distilling stable claims out of a turn.
3
+ *
4
+ * Complements `BeatExtractor`: a beat summarizes what happened, a
5
+ * fact captures what's *currently true*. Different extractors produce
6
+ * different levels of structure (pattern-based for quick identity /
7
+ * contact info; LLM-based for rich open-ended extraction).
8
+ *
9
+ * Built-in extractors:
10
+ * - `patternFactExtractor()` — zero-dep regex heuristics for
11
+ * common identity / location / contact patterns.
12
+ * - `llmFactExtractor({ provider })` — one LLM call per turn for
13
+ * open-ended extraction. Opt-in.
14
+ */
15
+ import type { LLMMessage as Message } from '../../adapters/types.js';
16
+ import type { Fact } from './types.js';
17
+ export interface FactExtractArgs {
18
+ /** New-turn messages. */
19
+ readonly messages: readonly Message[];
20
+ /** Current turn number. Useful for extractors that want it in a source tag. */
21
+ readonly turnNumber: number;
22
+ /**
23
+ * Facts already in the store (if caller has a cheap way to fetch).
24
+ * Passed to extractors that merge / dedupe at extraction time.
25
+ * May be empty even when facts exist — not every pipeline pre-loads.
26
+ */
27
+ readonly existing?: readonly Fact[];
28
+ /** Optional abort signal for LLM-based extractors. */
29
+ readonly signal?: AbortSignal;
30
+ }
31
+ export interface FactExtractor {
32
+ extract(args: FactExtractArgs): Promise<readonly Fact[]>;
33
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * formatFacts — render loaded `Fact` entries into a single system
3
+ * message for prompt injection.
4
+ *
5
+ * Reads from scope: `loadedFacts`
6
+ * Writes to scope: `formatted` (Message[] — one system message, or empty)
7
+ *
8
+ * Facts are tiny and semantically distinct from beats/messages, so they
9
+ * render as a compact key/value block rather than a narrative paragraph
10
+ * or per-entry `<memory>` tags. The default shape:
11
+ *
12
+ * Known facts about the user:
13
+ *
14
+ * - user.name: Alice
15
+ * - user.email: alice@example.com
16
+ * - user.preferences.color: blue
17
+ *
18
+ * Why one block, not one message per fact?
19
+ * LLMs parse key/value lists efficiently; splitting would waste
20
+ * tokens on per-message system overhead and break up the list's
21
+ * visual grouping.
22
+ *
23
+ * Why NOT run facts through `pickByBudget`?
24
+ * Facts are typically 10-50 items, each a handful of tokens. Picking
25
+ * subsets is rarely useful — the user either knows your name or
26
+ * they don't. Consumers who *do* want budget-based fact pruning can
27
+ * copy-paste this stage and wrap it with a picker.
28
+ */
29
+ import type { TypedScope } from 'footprintjs';
30
+ import type { MemoryEntry } from '../entry/index.js';
31
+ import type { Fact } from './types.js';
32
+ import type { FactPipelineState } from './extractFacts.js';
33
+ export interface FormatFactsConfig {
34
+ /**
35
+ * Header prepended to the injected message. Explains to the LLM what
36
+ * follows and what it's for. Override if your app has specific
37
+ * phrasing guidance.
38
+ */
39
+ readonly header?: string;
40
+ /** Footer appended after the fact list. Empty by default. */
41
+ readonly footer?: string;
42
+ /**
43
+ * When `true`, appends `(conf 0.xx)` after each fact's value. Off by
44
+ * default — confidence is usually noise for the LLM and only useful
45
+ * in audit / debug flows.
46
+ */
47
+ readonly showConfidence?: boolean;
48
+ /**
49
+ * Custom per-fact renderer. Receives the entry; returns the block
50
+ * string (without the leading `- ` bullet). Use for app-specific
51
+ * formatting: custom attribution, hiding category info, etc.
52
+ */
53
+ readonly renderFact?: (entry: MemoryEntry<Fact>) => string;
54
+ /**
55
+ * Inject the message even when `loadedFacts` is empty. Usually
56
+ * undesired — an empty list is noise. Off by default.
57
+ */
58
+ readonly emitWhenEmpty?: boolean;
59
+ }
60
+ export declare function formatFacts(config?: FormatFactsConfig): (scope: TypedScope<FactPipelineState>) => Promise<void>;
@@ -0,0 +1,14 @@
1
+ export type { Fact } from './types.js';
2
+ export { factId, isFactId, isFact, asConfidence } from './types.js';
3
+ export type { FactExtractor, FactExtractArgs } from './extractor.js';
4
+ export { patternFactExtractor } from './patternFactExtractor.js';
5
+ export { llmFactExtractor } from './llmFactExtractor.js';
6
+ export type { LLMFactExtractorConfig } from './llmFactExtractor.js';
7
+ export { extractFacts } from './extractFacts.js';
8
+ export type { ExtractFactsConfig, FactPipelineState } from './extractFacts.js';
9
+ export { writeFacts } from './writeFacts.js';
10
+ export type { WriteFactsConfig } from './writeFacts.js';
11
+ export { loadFacts } from './loadFacts.js';
12
+ export type { LoadFactsConfig } from './loadFacts.js';
13
+ export { formatFacts } from './formatFacts.js';
14
+ export type { FormatFactsConfig } from './formatFacts.js';
@@ -0,0 +1,64 @@
1
+ /**
2
+ * llmFactExtractor — LLM-backed fact extractor.
3
+ *
4
+ * Uses an LLMProvider (typically a cheap model like Claude Haiku or
5
+ * GPT-4o-mini) to pull stable, timeless claims out of a conversation
6
+ * turn. Complements `patternFactExtractor` — regex catches the obvious
7
+ * self-disclosures, the LLM catches the open-ended ones.
8
+ *
9
+ * The extractor asks the LLM for a JSON response in this shape:
10
+ *
11
+ * ```json
12
+ * {
13
+ * "facts": [
14
+ * {
15
+ * "key": "user.name",
16
+ * "value": "Alice",
17
+ * "confidence": 0.95,
18
+ * "category": "identity",
19
+ * "refs": ["msg-1-0"]
20
+ * }
21
+ * ]
22
+ * }
23
+ * ```
24
+ *
25
+ * The extractor parses, clamps confidence via `asConfidence()`, dedups
26
+ * by `key` (last occurrence wins, matching `patternFactExtractor`),
27
+ * and returns the facts. Malformed responses fall back to `[]` — a bad
28
+ * extraction should not break the agent turn.
29
+ *
30
+ * Usage:
31
+ * ```ts
32
+ * import { anthropic } from 'agentfootprint';
33
+ * import { llmFactExtractor, factPipeline, InMemoryStore } from 'agentfootprint/memory';
34
+ *
35
+ * const pipeline = factPipeline({
36
+ * store: new InMemoryStore(),
37
+ * extractor: llmFactExtractor({ provider: yourLLMProvider }),
38
+ * });
39
+ * ```
40
+ */
41
+ import type { LLMProvider } from '../../adapters/types.js';
42
+ import type { FactExtractor } from './extractor.js';
43
+ export interface LLMFactExtractorConfig {
44
+ /** The provider used for extraction. Typically a cheap/fast model. */
45
+ readonly provider: LLMProvider;
46
+ /**
47
+ * Override the system prompt. Defaults to a one-paragraph instruction
48
+ * that elicits the JSON shape described in the module docs.
49
+ */
50
+ readonly systemPrompt?: string;
51
+ /**
52
+ * Dev-mode logger invoked when the LLM response fails to parse.
53
+ * Defaults to `console.warn` — production consumers can route the
54
+ * signal to their telemetry pipeline.
55
+ */
56
+ readonly onParseError?: (error: unknown, rawContent: string) => void;
57
+ /**
58
+ * Include up to this many existing facts in the user prompt so the
59
+ * model can update / refine rather than duplicate. Set to `0` to
60
+ * skip — cheaper but loses update awareness. Default `16`.
61
+ */
62
+ readonly includeExistingLimit?: number;
63
+ }
64
+ export declare function llmFactExtractor(config: LLMFactExtractorConfig): FactExtractor;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * loadFacts — read-side stage that loads stored `Fact` entries into
3
+ * `scope.loadedFacts`.
4
+ *
5
+ * Reads from scope: `identity`
6
+ * Writes to scope: `loadedFacts` (appends — does not replace)
7
+ *
8
+ * Unlike `loadRecent` (which returns ALL entries and lets downstream
9
+ * stages filter), `loadFacts` queries the store and keeps only entries
10
+ * whose id matches the `fact:` prefix. Facts are typically few dozen
11
+ * at most per identity — a linear scan after a bounded `list` call is
12
+ * cheap.
13
+ *
14
+ * Why append, not replace?
15
+ * Same contract as `loadRecent` — pipelines may combine multiple
16
+ * load stages (e.g. facts + recent messages + beats). Appending lets
17
+ * each contribute without coordination.
18
+ *
19
+ * Note: this stage writes `loadedFacts` (a separate field from
20
+ * `loaded`) because fact entries have a different payload type
21
+ * (`MemoryEntry<Fact>`) than message entries (`MemoryEntry<Message>`).
22
+ * Keeping them separate prevents format stages from misrouting entries.
23
+ */
24
+ import type { TypedScope } from 'footprintjs';
25
+ import type { MemoryStore } from '../store/index.js';
26
+ import type { FactPipelineState } from './extractFacts.js';
27
+ export interface LoadFactsConfig {
28
+ /** The store to read from. */
29
+ readonly store: MemoryStore;
30
+ /**
31
+ * Upper bound on the `list` call's page size. Adapters may cap this
32
+ * lower. Defaults to 100 — enough for typical identity/preference
33
+ * inventories. Fact pipelines that accumulate task statuses or
34
+ * commitments should raise this.
35
+ */
36
+ readonly limit?: number;
37
+ /**
38
+ * Optional tier filter. When set, only loads facts tagged with one
39
+ * of these tiers. Matches the `loadRecent` / `loadRelevant` API.
40
+ */
41
+ readonly tiers?: ReadonlyArray<'hot' | 'warm' | 'cold'>;
42
+ }
43
+ export declare function loadFacts(config: LoadFactsConfig): (scope: TypedScope<FactPipelineState>) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { FactExtractor } from './extractor.js';
2
+ export declare function patternFactExtractor(): FactExtractor;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Facts — stable, timeless claims about the user or world.
3
+ *
4
+ * Unlike beats (which summarize what happened in a turn) and messages
5
+ * (which are the raw conversation), facts capture *what's currently
6
+ * true*:
7
+ * - Identity: "user.name" = "Alice"
8
+ * - Preferences: "user.favorite_color" = "blue"
9
+ * - Commitments: "task.ORD-123.status" = "refunded"
10
+ *
11
+ * Facts dedupe by `key`. The storage layer uses stable ids of the form
12
+ * `fact:${key}`, so a second write to the same key overwrites the
13
+ * first. This is the difference from beats/messages (which are
14
+ * append-only log entries).
15
+ */
16
+ /**
17
+ * A single fact — a key/value claim with optional confidence +
18
+ * category metadata.
19
+ *
20
+ * **Key convention**: dotted path for nested taxonomies
21
+ * (`user.name`, `user.preferences.color`, `task.ORD-123.status`).
22
+ * The library doesn't enforce any structure — extractors define their
23
+ * own key namespaces.
24
+ */
25
+ export interface Fact<V = unknown> {
26
+ /** Stable key — used to dedupe. */
27
+ readonly key: string;
28
+ /** The claimed value. JSON-serializable. */
29
+ readonly value: V;
30
+ /**
31
+ * Extractor's confidence in `[0, 1]`. Used by `pickByBudget` to
32
+ * prefer high-confidence facts when the budget is tight. Optional
33
+ * — extractors that can't estimate confidence may omit it, in
34
+ * which case consumers default to a neutral 0.5.
35
+ */
36
+ readonly confidence?: number;
37
+ /**
38
+ * Optional taxonomy tag — free-form string like `"identity"`,
39
+ * `"preference"`, `"commitment"`, `"fact"`. Useful for filtering
40
+ * recall by category.
41
+ */
42
+ readonly category?: string;
43
+ /**
44
+ * Ids of the source messages this fact was extracted from. Mirrors
45
+ * `NarrativeBeat.refs` — consumers answer "why does the agent think
46
+ * `user.name` is Alice?" by walking back to the raw message text.
47
+ * Optional because some extractors (pattern-based, aggregate) can't
48
+ * reliably trace a fact to a specific message. LLM-based extractors
49
+ * should populate it.
50
+ */
51
+ readonly refs?: readonly string[];
52
+ }
53
+ /** Build the stable `MemoryStore` id for a fact with the given key. */
54
+ export declare function factId(key: string): string;
55
+ /** True iff the string is a fact id (starts with the `fact:` prefix). */
56
+ export declare function isFactId(id: string): boolean;
57
+ /**
58
+ * Duck-typed guard — true iff `value` has the shape of a `Fact`.
59
+ * Used by pipelines that handle mixed-payload stores (facts +
60
+ * beats + raw messages) to route entries correctly.
61
+ */
62
+ export declare function isFact(value: unknown): value is Fact;
63
+ /**
64
+ * Clamp a value to `[0, 1]`; non-finite → 0.5 (neutral). Matches the
65
+ * `asImportance` convention in the beats layer so pickers can treat
66
+ * `confidence` and `importance` the same way.
67
+ */
68
+ export declare function asConfidence(value: unknown): number;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * writeFacts — persist extracted facts to the memory store.
3
+ *
4
+ * Reads from scope: `newFacts`, `identity`
5
+ * Writes to store: MemoryEntry<Fact> per fact via `store.putMany`
6
+ *
7
+ * Ids are `fact:${key}` (set by `extractFacts` via `factId`). Because
8
+ * `putMany` overwrites on id collision, a second turn writing the same
9
+ * key REPLACES the prior entry. This is the contract for facts — they
10
+ * dedup by key, unlike beats and messages which are append-only.
11
+ */
12
+ import type { TypedScope } from 'footprintjs';
13
+ import type { MemoryStore } from '../store/index.js';
14
+ import type { FactPipelineState } from './extractFacts.js';
15
+ export interface WriteFactsConfig {
16
+ /** The store to persist to. Typically the same store as the pipeline's read side. */
17
+ readonly store: MemoryStore;
18
+ }
19
+ export declare function writeFacts(config: WriteFactsConfig): (scope: TypedScope<FactPipelineState>) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ export type { MemoryIdentity } from './types.js';
2
+ export { identityNamespace } from './types.js';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * MemoryIdentity — hierarchical scoping for everything memory-related.
3
+ *
4
+ * The library enforces isolation at every storage call: no cross-tenant
5
+ * reads, no cross-principal writes, period. Enterprise deploys (Azure Entra,
6
+ * AWS SSO, etc.) surface tenant + principal from the incoming request;
7
+ * simpler deploys just use `conversationId`.
8
+ *
9
+ * Why three fields instead of one "key"?
10
+ * - `tenant` — organization / workspace / account boundary
11
+ * - `principal` — user / service-account identity within the tenant
12
+ * - `conversationId` — a single thread / session for that principal
13
+ *
14
+ * Storage adapters prefix namespaces with the full identity tuple. A bug in
15
+ * a multi-tenant app that passes the wrong `tenant` can't accidentally read
16
+ * another customer's memory — the tuple mismatch surfaces as "no data"
17
+ * rather than a silent leak.
18
+ *
19
+ * Fields after `conversationId` are reserved for future expansion (agent id,
20
+ * role, etc.) without breaking existing stores.
21
+ */
22
+ export interface MemoryIdentity {
23
+ /**
24
+ * Optional organization / workspace / account boundary. Omit for
25
+ * single-tenant deploys. Storage adapters MUST refuse cross-tenant reads
26
+ * when this field is set.
27
+ */
28
+ readonly tenant?: string;
29
+ /**
30
+ * Optional user / service-account identity within the tenant. Isolates
31
+ * memory per end-user inside a shared tenant.
32
+ */
33
+ readonly principal?: string;
34
+ /**
35
+ * Required — the conversation / session / thread id. Stable across
36
+ * multiple `agent.run()` calls so history accumulates correctly.
37
+ */
38
+ readonly conversationId: string;
39
+ }
40
+ /**
41
+ * Encode a MemoryIdentity as a deterministic storage namespace. Used by
42
+ * storage adapters that need a single string key (Redis, localStorage,
43
+ * filesystem paths). Format is stable across library versions — adapters
44
+ * can safely use it for long-lived keys.
45
+ *
46
+ * Empty `tenant` / `principal` collapse to `_` so the format has a constant
47
+ * shape (easy to parse, easy to list by prefix).
48
+ */
49
+ export declare function identityNamespace(identity: MemoryIdentity): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Memory subsystem — narrative beats, fact extraction, embedding-based
3
+ * retrieval, and pipelines that compose them.
4
+ *
5
+ * Re-exported from agentfootprint's main entry. See individual module
6
+ * READMEs for usage.
7
+ */
8
+ export * from './beats/index.js';
9
+ export * from './causal/index.js';
10
+ export * from './embedding/index.js';
11
+ export * from './entry/index.js';
12
+ export * from './facts/index.js';
13
+ export * from './identity/index.js';
14
+ export * from './pipeline/index.js';
15
+ export * from './stages/index.js';
16
+ export * from './store/index.js';
17
+ export * from './wire/index.js';
18
+ export { MEMORY_TYPES, MEMORY_STRATEGIES, MEMORY_TIMING, SNAPSHOT_PROJECTIONS, MEMORY_INJECTION_KEY_PREFIX, isMemoryType, isMemoryStrategyKind, isMemoryTiming, isSnapshotProjection, memoryInjectionKey, isMemoryInjectionKey, type MemoryType, type MemoryStrategyKind, type MemoryTiming, type SnapshotProjection, type Strategy, type WindowStrategy, type BudgetStrategy, type SummarizeStrategy, type TopKStrategy, type ExtractStrategy, type DecayStrategy, type HybridStrategy, type MemoryDefinition, type DefineMemoryOptions, type DefineEpisodicOptions, type DefineSemanticOptions, type DefineNarrativeOptions, type DefineCausalOptions, type MemoryRedactionPolicy, } from './define.types.js';
19
+ export { defineMemory } from './define.js';
@@ -0,0 +1,59 @@
1
+ import type { LLMProvider } from '../../adapters/types.js';
2
+ import type { MemoryStore } from '../store/index.js';
3
+ import type { MemoryEntry } from '../entry/index.js';
4
+ import type { MemoryPipeline } from './types.js';
5
+ import { type FactPipelineState, type FactExtractor } from '../facts/index.js';
6
+ import { type NarrativeBeat, type BeatExtractor, type ExtractBeatsState } from '../beats/index.js';
7
+ export interface AutoPipelineConfig {
8
+ /** The store both extractors share. */
9
+ readonly store: MemoryStore;
10
+ /**
11
+ * When present, upgrades both fact AND beat extraction to LLM-backed
12
+ * variants. Typically a cheap/fast model like Claude Haiku. Omit to
13
+ * use the free heuristic + regex defaults.
14
+ */
15
+ readonly provider?: LLMProvider;
16
+ /**
17
+ * Override the fact extractor explicitly. Takes precedence over
18
+ * `provider`. Use when you want facts via LLM but beats via heuristic,
19
+ * or vice-versa.
20
+ */
21
+ readonly factExtractor?: FactExtractor;
22
+ /**
23
+ * Override the beat extractor explicitly. Takes precedence over
24
+ * `provider`.
25
+ */
26
+ readonly beatExtractor?: BeatExtractor;
27
+ /**
28
+ * Upper bound on the `store.list` page size during read. Large enough
29
+ * to fit typical identity+history; raise for long-lived agents with
30
+ * dozens of fact categories and hundreds of beats. Default `200`.
31
+ */
32
+ readonly loadLimit?: number;
33
+ /** Tier filter for read. */
34
+ readonly tiers?: ReadonlyArray<'hot' | 'warm' | 'cold'>;
35
+ /** Tier to tag newly written entries (both facts and beats). */
36
+ readonly writeTier?: 'hot' | 'warm' | 'cold';
37
+ /** TTL in ms applied to newly written entries. */
38
+ readonly writeTtlMs?: number;
39
+ /** Header for the facts block in the injected system message. */
40
+ readonly factsHeader?: string;
41
+ /** Lead-in phrase for the narrative paragraph. Default `"From earlier: "`. */
42
+ readonly narrativeLeadIn?: string;
43
+ /**
44
+ * When `true`, appends `(conf 0.xx)` after each fact. Off by default
45
+ * — confidence is noise for the LLM in typical flows.
46
+ */
47
+ readonly showConfidence?: boolean;
48
+ /**
49
+ * When `true`, appends `(refs: msg-x-y, ...)` after each beat line.
50
+ * Off by default.
51
+ */
52
+ readonly showRefs?: boolean;
53
+ }
54
+ /** State used by the auto pipeline's subflows. */
55
+ export interface AutoPipelineState extends FactPipelineState, ExtractBeatsState {
56
+ /** Beats loaded from the store during auto-READ. */
57
+ loadedBeats?: readonly MemoryEntry<NarrativeBeat>[];
58
+ }
59
+ export declare function autoPipeline(config: AutoPipelineConfig): MemoryPipeline;