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,147 @@
1
+ /**
2
+ * SkillRegistry — centralized governance for Skills across one or
3
+ * more Agents.
4
+ *
5
+ * Most apps register Skills directly on the Agent via `.skill(s)`.
6
+ * Once you have multiple Agents that share a common skill catalog
7
+ * (a customer-support pool, a research team, a multi-step workflow
8
+ * where each step uses different overlapping skills), hand-syncing
9
+ * `.skill()` calls per Agent gets fragile.
10
+ *
11
+ * `SkillRegistry` is the answer: register once, attach to many
12
+ * Agents via `.skills(registry)`. Add a Skill to the registry and
13
+ * every consumer Agent picks it up at next build.
14
+ *
15
+ * @example
16
+ * const registry = new SkillRegistry();
17
+ * registry.register(billingSkill);
18
+ * registry.register(refundSkill);
19
+ *
20
+ * const supportAgent = Agent.create({ provider }).skills(registry).build();
21
+ * const escalationAgent = Agent.create({ provider }).skills(registry).build();
22
+ *
23
+ * // Add a new skill — both agents pick it up at next build.
24
+ * registry.register(complianceSkill);
25
+ */
26
+ import type { Injection } from './types.js';
27
+ import { type SkillToolPair } from './skillTools.js';
28
+ import { type SurfaceMode } from './factories/defineSkill.js';
29
+ /**
30
+ * Options for `new SkillRegistry({...})`. All fields are optional;
31
+ * the empty-object form (`new SkillRegistry()`) is the v2.4 surface.
32
+ *
33
+ * @see SkillRegistry.resolveForSkill — applies the cascade
34
+ */
35
+ export interface SkillRegistryOptions {
36
+ /**
37
+ * Registry-level default `surfaceMode`. Applies to skills whose own
38
+ * `surfaceMode` is `'auto'` (the `defineSkill` default). Per-skill
39
+ * `surfaceMode` always wins; this is the fallback BEFORE the global
40
+ * `resolveSurfaceMode(provider, model)` rule.
41
+ *
42
+ * Use case: a registry shared across agents pointed at the same
43
+ * provider can lock surfaceMode here once instead of repeating it
44
+ * on every `defineSkill`.
45
+ */
46
+ readonly surfaceMode?: SurfaceMode;
47
+ /**
48
+ * Provider name used as a hint when resolving `surfaceMode: 'auto'`
49
+ * inside this registry. Most consumers don't set this — runtime code
50
+ * passes the provider name into `resolveForSkill(skill, provider, model)`
51
+ * directly. This field is for cases where the registry is composed
52
+ * far from the agent (test fixtures, design-time inspectors).
53
+ *
54
+ * Match the provider's `name` field — `'anthropic'`, `'openai'`,
55
+ * `'mock'`, etc.
56
+ */
57
+ readonly providerHint?: string;
58
+ }
59
+ export declare class SkillRegistry {
60
+ private readonly skills;
61
+ private readonly opts;
62
+ /**
63
+ * Construct an empty registry. Optional `{ surfaceMode, providerHint }`
64
+ * fields set registry-level defaults; absent both, the registry is a
65
+ * pure container (the v2.4 surface).
66
+ */
67
+ constructor(opts?: SkillRegistryOptions);
68
+ /** Registry-level default `surfaceMode`, or `undefined` if unset. */
69
+ get surfaceMode(): SurfaceMode | undefined;
70
+ /** Registry-level provider hint, or `undefined` if unset. */
71
+ get providerHint(): string | undefined;
72
+ /**
73
+ * Register a skill. Throws if `skill.flavor !== 'skill'` or if a
74
+ * skill with the same id is already registered (use `.replace(...)`
75
+ * to overwrite intentionally).
76
+ */
77
+ register(skill: Injection): this;
78
+ /** Replace an existing skill by id. Throws if id is not registered. */
79
+ replace(id: string, skill: Injection): this;
80
+ /** Remove a skill by id. No-op if not registered. */
81
+ unregister(id: string): this;
82
+ /** Look up by id. Returns undefined if not registered. */
83
+ get(id: string): Injection | undefined;
84
+ /** True iff a skill with the given id is registered. */
85
+ has(id: string): boolean;
86
+ /** All registered skills. Order matches registration order. */
87
+ list(): readonly Injection[];
88
+ /** Number of registered skills. */
89
+ get size(): number;
90
+ /** Drop all registrations. */
91
+ clear(): void;
92
+ /**
93
+ * Materialize the LLM-facing skill discovery tools from the current
94
+ * registry contents. Returns `{ listSkills, readSkill }`:
95
+ *
96
+ * - `list_skills` — no-arg tool the LLM calls to enumerate
97
+ * `{ id, description }` for every registered skill. Lets the
98
+ * LLM discover skills without paying the prompt-token cost of
99
+ * a static catalog in the system prompt.
100
+ *
101
+ * - `read_skill({ id })` — activates the named skill for the
102
+ * NEXT iteration. The Agent's tool-calls subflow inspects this
103
+ * tool call by name and updates `scope.activatedInjectionIds`
104
+ * so the InjectionEngine on iter N+1 includes the skill in the
105
+ * active set (body lands in the system slot; gated tools land
106
+ * in the tools slot).
107
+ *
108
+ * Both entries are `undefined` when the registry is empty — filter
109
+ * before adding to a tool list:
110
+ *
111
+ * const { listSkills, readSkill } = registry.toTools();
112
+ * const tools = [listSkills, readSkill, ...other].filter(Boolean) as Tool[];
113
+ *
114
+ * Composes with `gatedTools` from `agentfootprint/tool-providers`
115
+ * so PermissionPolicy can scope which roles see the skill discovery
116
+ * surface.
117
+ *
118
+ * @returns A `SkillToolPair` (`{ listSkills, readSkill }`).
119
+ */
120
+ toTools(): SkillToolPair;
121
+ /**
122
+ * Resolve the effective `surfaceMode` for a skill, applying the
123
+ * cascade:
124
+ *
125
+ * 1. If the skill's own `metadata.surfaceMode` is concrete
126
+ * (`'system-prompt'` / `'tool-only'` / `'both'`), return it.
127
+ * Per-skill explicit choice always wins.
128
+ * 2. Else if the registry was constructed with a concrete
129
+ * `surfaceMode`, return that.
130
+ * 3. Else delegate to `resolveSurfaceMode(provider, model)` using
131
+ * the explicit `provider` arg (or `this.providerHint` if
132
+ * omitted). Falls back to `'tool-only'` when no provider is
133
+ * known.
134
+ *
135
+ * Forward-compat for Block C / v2.5 per-mode runtime routing: the
136
+ * runtime calls this with the agent's provider + model to decide
137
+ * how to materialize the skill's body into slots.
138
+ *
139
+ * Throws if the skill is not registered (catches typos at the
140
+ * caller site rather than silently resolving against a stranger).
141
+ *
142
+ * @param skillOrId A registered Skill `Injection` OR its `id`.
143
+ * @param provider Provider name override (wins over `providerHint`).
144
+ * @param model Model name for the per-provider attention rule.
145
+ */
146
+ resolveForSkill(skillOrId: Injection | string, provider?: string, model?: string): Exclude<SurfaceMode, 'auto'>;
147
+ }
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Injection Engine — subflow builder.
3
+ *
4
+ * Pattern: Subflow Builder (returns a FlowChart mountable via
5
+ * `addSubFlowChartNext`). Each subflow stands alone.
6
+ * Role: Layer-3 context-engineering primitive. Sits BEFORE the
7
+ * three slot subflows in any primitive (Agent, LLMCall) that
8
+ * uses Injections. Evaluates every Injection's trigger once
9
+ * per iteration.
10
+ *
11
+ * Four small, readable stages (was one monolithic `evaluate`):
12
+ * 1. Gather — snapshot the turn's inputs (iteration, history size,
13
+ * last tool, LLM-activated count). Observability only.
14
+ * 2. Evaluate — run every trigger → `activeInjections` (the REAL output
15
+ * the slot subflows read). Logic is UNCHANGED from the old
16
+ * single stage: `activeInjections` is byte-identical, so the
17
+ * slots are 100% unaffected. (Safety invariant.)
18
+ * 3. Route — partition `activeInjections` into per-slot buckets
19
+ * (`activeByslot`), mirroring how the slots filter. Pure
20
+ * annotation — the slots still do their own filtering.
21
+ * 4. Delta — diff this turn's buckets vs last turn's (`slotDelta`):
22
+ * per slot, what activated / deactivated / stayed. The
23
+ * explainability win ("tools +skill X, system-prompt
24
+ * unchanged"). Reads last turn via `priorActiveByslot`
25
+ * carried by the mount's input/output mappers.
26
+ *
27
+ * Nothing here SKIPS a slot — Route/Delta only annotate. See
28
+ * docs (injection-algorithm blog) + memory agentfootprint_slot_plan_review
29
+ * for why per-turn skip was deferred.
30
+ *
31
+ * Emits: `agentfootprint.context.evaluated` at the Evaluate stage, with
32
+ * aggregate metadata. The per-slot route/delta ride visible stage
33
+ * STATE (`activeByslot` / `slotDelta`) so the lens reads them from
34
+ * the commit log without a new event-type contract.
35
+ *
36
+ * Mount with:
37
+ * builder.addSubFlowChartNext(
38
+ * SUBFLOW_IDS.INJECTION_ENGINE,
39
+ * buildInjectionEngineSubflow({ injections }),
40
+ * 'Injection Engine',
41
+ * {
42
+ * inputMapper: (parent) => ({
43
+ * iteration: parent.iteration,
44
+ * userMessage: parent.userMessage,
45
+ * history: parent.history,
46
+ * lastToolResult: parent.lastToolResult,
47
+ * activatedInjectionIds: parent.activatedInjectionIds ?? [],
48
+ * priorActiveByslot: parent.activeByslot ?? EMPTY_ACTIVE_BY_SLOT,
49
+ * }),
50
+ * outputMapper: (sf) => ({
51
+ * activeInjections: sf.activeInjections,
52
+ * activeByslot: sf.activeByslot, // carried so next turn's Delta can diff
53
+ * }),
54
+ * },
55
+ * )
56
+ */
57
+ import type { FlowChart } from 'footprintjs';
58
+ import { type ActiveInjection, type Injection, type InjectionContext } from './types.js';
59
+ export interface InjectionEngineConfig {
60
+ /**
61
+ * The Injection list. Frozen at build time. To change at runtime,
62
+ * rebuild the agent / chart — the primitive is intentionally
63
+ * declarative.
64
+ */
65
+ readonly injections: readonly Injection[];
66
+ /**
67
+ * The skill-graph CURSOR resolver (`graph.nextSkill`), present only when the
68
+ * agent was built with `.skillGraph()`. The Evaluate stage advances the cursor
69
+ * with the SAME `ctx` the triggers gate on, so trigger ↔ cursor never diverge
70
+ * (the keystone). Absent → `currentSkillId` is never written (no graph routing).
71
+ */
72
+ readonly nextSkill?: (ctx: InjectionContext) => string | undefined;
73
+ }
74
+ /** One routed entry per (active injection × slot it contributes to). */
75
+ export interface RoutedInjection {
76
+ readonly id: string;
77
+ readonly source: ActiveInjection['flavor'];
78
+ readonly reason: string;
79
+ }
80
+ /** Active injections partitioned by the slot they contribute to. */
81
+ export interface ActiveBySlot {
82
+ readonly systemPrompt: readonly RoutedInjection[];
83
+ readonly messages: readonly RoutedInjection[];
84
+ readonly tools: readonly RoutedInjection[];
85
+ }
86
+ /** Per-slot change since last turn. */
87
+ export interface SlotDeltaEntry {
88
+ readonly added: readonly string[];
89
+ readonly removed: readonly string[];
90
+ readonly kept: readonly string[];
91
+ }
92
+ /** Per-slot delta across the whole context. */
93
+ export interface SlotDelta {
94
+ readonly systemPrompt: SlotDeltaEntry;
95
+ readonly messages: SlotDeltaEntry;
96
+ readonly tools: SlotDeltaEntry;
97
+ }
98
+ /** Empty buckets — turn-1 prior, and the safe default for the mappers. */
99
+ export declare const EMPTY_ACTIVE_BY_SLOT: ActiveBySlot;
100
+ /**
101
+ * Build the Injection Engine subflow — Gather → Evaluate → Route → Delta.
102
+ */
103
+ export declare function buildInjectionEngineSubflow(config: InjectionEngineConfig): FlowChart;
104
+ /** Partition active injections by the slot(s) each contributes to. Mirrors
105
+ * the slot subflows' own filters so this view matches what they compose.
106
+ * Pure — exported for unit tests + reuse (e.g. the lens). */
107
+ export declare function routeActiveInjections(active: readonly ActiveInjection[]): ActiveBySlot;
108
+ /** Diff two per-slot snapshots into a per-slot delta. Pure — exported for
109
+ * unit tests + reuse. */
110
+ export declare function diffActiveBySlot(prior: ActiveBySlot, current: ActiveBySlot): SlotDelta;
@@ -101,6 +101,7 @@ function makeEvaluateStage(injections, nextSkill) {
101
101
  activatedInjectionIds: args.activatedInjectionIds ?? [],
102
102
  ...(args.currentSkillId !== undefined && { currentSkillId: args.currentSkillId }),
103
103
  ...(args.entryScores !== undefined && { entryScores: args.entryScores }),
104
+ ...(args.entryScorer !== undefined && { entryScorer: args.entryScorer }),
104
105
  };
105
106
  // KEYSTONE cursor advance — derive the next cursor from the SAME ctx the
106
107
  // route triggers gate on (`nextSkill(ctx) === id`), so the active set and the
@@ -1 +1 @@
1
- {"version":3,"file":"buildInjectionEngineSubflow.js","sourceRoot":"","sources":["../../../../src/lib/injection-engine/buildInjectionEngineSubflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EACL,sBAAsB,GAIvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wBAAwB,EAAqB,MAAM,iBAAiB,CAAC;AAgD9E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAiB;IAChD,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,EAAE;CACV,CAAC;AAuBF;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAA6B;IACvE,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAErC,OAAO,SAAS,CAAuB,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE;QACtE,WAAW,EACT,sFAAsF;KACzF,CAAC;SACC,WAAW,CACV,UAAU,EACV,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,EAC/C,UAAU,EACV,uEAAuE,CACxE;SACA,WAAW,CACV,OAAO,EACP,UAAU,E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,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1D,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;KACvD,CAAC;AACJ,CAAC;AAED;6EAC6E;AAC7E,SAAS,cAAc,CACrB,UAAgC;IAEhC,OAAO,UAAU;SACd,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC;SACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,kBAAkB,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,sEAAsE;AACtE,SAAS,iBAAiB,CAAC,MAA4B;IACrD,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"buildInjectionEngineSubflow.js","sourceRoot":"","sources":["../../../../src/lib/injection-engine/buildInjectionEngineSubflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC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,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,kBAAkB,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,sEAAsE;AACtE,SAAS,iBAAiB,CAAC,MAA4B;IACrD,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * EntryScorer — the pluggable STRATEGY for ranking a skill graph's entry
3
+ * candidates by relevance to the user's message.
4
+ *
5
+ * `skillGraph().entryBy(scorer)` selects a strategy; the agent's PickEntry stage
6
+ * runs it ONCE per turn (off the hot loop) and starts the cursor at the winner.
7
+ * Two built-ins ship:
8
+ * • `keywordScorer()` — no dependency, no model call: word overlap between
9
+ * the message and each skill's `description`. The zero-config way to route.
10
+ * • `embeddingScorer(e)` — semantic: cosine similarity of embeddings (needs an
11
+ * Embedder). `.entryByRelevance(embedder)` is sugar for this.
12
+ * Bring your own by implementing `EntryScorer`.
13
+ *
14
+ * The scorer OWNS both the surfaced `relevance` % AND the `chosen` winner, so the
15
+ * explanation and the decision can never disagree (softmax is order-preserving, so
16
+ * argmax-score == argmax-relevance).
17
+ */
18
+ import type { Embedder } from '../../memory/embedding/types.js';
19
+ /** One entry candidate's relevance to the user's message. */
20
+ export interface EntryScore {
21
+ /** The entry skill id. */
22
+ readonly id: string;
23
+ /** Raw, strategy-specific score — cosine for `embedding`, word-overlap for
24
+ * `keyword`. Higher = more relevant. Not normalized across strategies. */
25
+ readonly score: number;
26
+ /** Softmax share across candidates, 0..1 — the surfaced "Why this skill?" %. */
27
+ readonly relevance: number;
28
+ }
29
+ /** Result of scoring the entries — the picked entry, the full ranking, and which
30
+ * scorer produced it. */
31
+ export interface EntryScoring {
32
+ /** The scorer's `name` (e.g. `'keyword'`, `'embedding'`) — surfaced so a lens /
33
+ * the "Why this skill?" panel can say HOW the entry was chosen. */
34
+ readonly scorer: string;
35
+ /** Winning entry id (highest `score`), or undefined if no candidate. */
36
+ readonly chosen: string | undefined;
37
+ /** Every scored candidate, in declaration order. */
38
+ readonly ranked: readonly EntryScore[];
39
+ }
40
+ /** A candidate the scorer ranks — its id + the text it's matched on (the skill's
41
+ * `description`). */
42
+ export interface EntryCandidate {
43
+ readonly id: string;
44
+ readonly description: string;
45
+ }
46
+ /** What a scorer receives: the user's message + the candidates to rank. */
47
+ export interface EntryScorerInput {
48
+ readonly userMessage: string;
49
+ readonly candidates: readonly EntryCandidate[];
50
+ }
51
+ /**
52
+ * A strategy for ranking entry candidates. Pure given its inputs; may be async (an
53
+ * embedder makes network calls). Runs ONCE per turn off the hot loop, so cost here
54
+ * never touches the ReAct inner loop.
55
+ */
56
+ export interface EntryScorer {
57
+ /** Short, stable name — shown in the lens / "Why this skill?" panel + any
58
+ * strategy picker. */
59
+ readonly name: string;
60
+ score(input: EntryScorerInput, signal?: AbortSignal): Promise<EntryScoring> | EntryScoring;
61
+ }
62
+ /**
63
+ * Shared finisher: raw scores → `EntryScoring`. Softmax turns the (sanitized) raw
64
+ * scores into a `relevance` share (sums to 1); the winner is the argmax with
65
+ * declaration order breaking ties. Because softmax is order-preserving over the
66
+ * sanitized scores, the WINNER is always the argmax `relevance` — the surfaced %
67
+ * and the pick can never disagree.
68
+ *
69
+ * `EntryScorer` is a public, consumer-implementable interface, so a third-party
70
+ * scorer might return `NaN` / `±Infinity`. We sanitize those to `-Infinity` for BOTH
71
+ * the softmax input AND the winner pick, so a non-finite score can never silently win
72
+ * (`NaN > x` is always false — a leading `NaN` would otherwise seed-and-keep a naive
73
+ * reduce) and the softmax stays well-defined. The raw (possibly non-finite) score is
74
+ * still surfaced on `EntryScore.score` for honest debugging.
75
+ */
76
+ export declare function rankEntries(scorerName: string, candidates: readonly EntryCandidate[], rawScores: readonly number[]): EntryScoring;
77
+ /**
78
+ * keywordScorer — rank by word overlap between the message and each description.
79
+ * No embedder, no model call, deterministic. Scores the set-cosine of lowercased
80
+ * word tokens (length-normalized so a long description can't win on sheer size),
81
+ * minus a small stop-word list. The zero-config router: good enough when skill
82
+ * descriptions use the words a user would.
83
+ */
84
+ export declare function keywordScorer(options?: {
85
+ readonly stopWords?: readonly string[];
86
+ }): EntryScorer;
87
+ /**
88
+ * embeddingScorer — rank by SEMANTIC similarity. Embeds the message + each
89
+ * description and cosine-scores them. Needs an `Embedder` (a model call per text);
90
+ * runs once per turn off the hot loop. `.entryByRelevance(embedder)` is sugar for
91
+ * `.entryBy(embeddingScorer(embedder))`.
92
+ */
93
+ export declare function embeddingScorer(embedder: Embedder): EntryScorer;
@@ -0,0 +1,172 @@
1
+ /**
2
+ * EntryScorer — the pluggable STRATEGY for ranking a skill graph's entry
3
+ * candidates by relevance to the user's message.
4
+ *
5
+ * `skillGraph().entryBy(scorer)` selects a strategy; the agent's PickEntry stage
6
+ * runs it ONCE per turn (off the hot loop) and starts the cursor at the winner.
7
+ * Two built-ins ship:
8
+ * • `keywordScorer()` — no dependency, no model call: word overlap between
9
+ * the message and each skill's `description`. The zero-config way to route.
10
+ * • `embeddingScorer(e)` — semantic: cosine similarity of embeddings (needs an
11
+ * Embedder). `.entryByRelevance(embedder)` is sugar for this.
12
+ * Bring your own by implementing `EntryScorer`.
13
+ *
14
+ * The scorer OWNS both the surfaced `relevance` % AND the `chosen` winner, so the
15
+ * explanation and the decision can never disagree (softmax is order-preserving, so
16
+ * argmax-score == argmax-relevance).
17
+ */
18
+ import { cosineSimilarity } from '../../memory/embedding/cosine.js';
19
+ import { softmax } from './softmax.js';
20
+ /**
21
+ * Shared finisher: raw scores → `EntryScoring`. Softmax turns the (sanitized) raw
22
+ * scores into a `relevance` share (sums to 1); the winner is the argmax with
23
+ * declaration order breaking ties. Because softmax is order-preserving over the
24
+ * sanitized scores, the WINNER is always the argmax `relevance` — the surfaced %
25
+ * and the pick can never disagree.
26
+ *
27
+ * `EntryScorer` is a public, consumer-implementable interface, so a third-party
28
+ * scorer might return `NaN` / `±Infinity`. We sanitize those to `-Infinity` for BOTH
29
+ * the softmax input AND the winner pick, so a non-finite score can never silently win
30
+ * (`NaN > x` is always false — a leading `NaN` would otherwise seed-and-keep a naive
31
+ * reduce) and the softmax stays well-defined. The raw (possibly non-finite) score is
32
+ * still surfaced on `EntryScore.score` for honest debugging.
33
+ */
34
+ export function rankEntries(scorerName, candidates, rawScores) {
35
+ if (candidates.length === 0)
36
+ return { scorer: scorerName, chosen: undefined, ranked: [] };
37
+ const safe = rawScores.map((s) => (Number.isFinite(s) ? s : Number.NEGATIVE_INFINITY));
38
+ const relevances = softmax(safe);
39
+ const ranked = candidates.map((c, i) => ({
40
+ id: c.id,
41
+ score: rawScores[i], // the scorer's RAW output (may be non-finite — honest)
42
+ relevance: relevances[i],
43
+ }));
44
+ // argmax over the SANITIZED scores (declaration order breaks ties) — never over the
45
+ // raw scores, so a NaN/Inf can't win. Order-preserving with `relevance`.
46
+ let winner = 0;
47
+ for (let i = 1; i < safe.length; i++)
48
+ if (safe[i] > safe[winner])
49
+ winner = i;
50
+ return { scorer: scorerName, chosen: ranked[winner].id, ranked };
51
+ }
52
+ /**
53
+ * keywordScorer — rank by word overlap between the message and each description.
54
+ * No embedder, no model call, deterministic. Scores the set-cosine of lowercased
55
+ * word tokens (length-normalized so a long description can't win on sheer size),
56
+ * minus a small stop-word list. The zero-config router: good enough when skill
57
+ * descriptions use the words a user would.
58
+ */
59
+ export function keywordScorer(options = {}) {
60
+ const stop = new Set((options.stopWords ?? DEFAULT_STOP_WORDS).map((w) => w.toLowerCase()));
61
+ return {
62
+ name: 'keyword',
63
+ score({ userMessage, candidates }) {
64
+ const q = tokenize(userMessage, stop);
65
+ const scores = candidates.map((c) => setCosine(q, tokenize(c.description, stop)));
66
+ return rankEntries('keyword', candidates, scores);
67
+ },
68
+ };
69
+ }
70
+ /**
71
+ * embeddingScorer — rank by SEMANTIC similarity. Embeds the message + each
72
+ * description and cosine-scores them. Needs an `Embedder` (a model call per text);
73
+ * runs once per turn off the hot loop. `.entryByRelevance(embedder)` is sugar for
74
+ * `.entryBy(embeddingScorer(embedder))`.
75
+ */
76
+ export function embeddingScorer(embedder) {
77
+ return {
78
+ name: 'embedding',
79
+ async score({ userMessage, candidates }, signal) {
80
+ if (candidates.length === 0)
81
+ return { scorer: 'embedding', chosen: undefined, ranked: [] };
82
+ // One embedBatch round-trip when the backend supports it (OpenAI/Voyage/…),
83
+ // else N+1 CONCURRENT embed() calls — never the serial N+1 latency stack.
84
+ const texts = [userMessage, ...candidates.map((c) => c.description)];
85
+ const sig = signal ? { signal } : {};
86
+ const [qVec, ...dVecs] = embedder.embedBatch
87
+ ? await embedder.embedBatch({ texts, ...sig })
88
+ : await Promise.all(texts.map((text) => embedder.embed({ text, ...sig })));
89
+ const scores = dVecs.map((dVec) => cosineSimilarity(qVec, dVec));
90
+ return rankEntries('embedding', candidates, scores);
91
+ },
92
+ };
93
+ }
94
+ /** Small, conservative stop list — fillers a user would never route on. */
95
+ const DEFAULT_STOP_WORDS = [
96
+ 'a',
97
+ 'an',
98
+ 'the',
99
+ 'and',
100
+ 'or',
101
+ 'but',
102
+ 'if',
103
+ 'to',
104
+ 'of',
105
+ 'for',
106
+ 'in',
107
+ 'on',
108
+ 'at',
109
+ 'by',
110
+ 'with',
111
+ 'is',
112
+ 'are',
113
+ 'was',
114
+ 'were',
115
+ 'be',
116
+ 'been',
117
+ 'it',
118
+ 'this',
119
+ 'that',
120
+ 'these',
121
+ 'those',
122
+ 'i',
123
+ 'you',
124
+ 'we',
125
+ 'my',
126
+ 'our',
127
+ 'me',
128
+ 'please',
129
+ 'can',
130
+ 'could',
131
+ 'would',
132
+ 'should',
133
+ 'do',
134
+ 'does',
135
+ 'how',
136
+ 'what',
137
+ 'need',
138
+ 'want',
139
+ ];
140
+ /**
141
+ * Lowercase → split on non-alphanumerics → drop 1-char tokens + stop words →
142
+ * light plural fold → set. The plural fold (drop a single trailing `s` on tokens
143
+ * length ≥ 4) lets `refund` match `refunds` and `payment` match `payments` — the
144
+ * common miss that makes a naive keyword router feel broken. Conservative: short
145
+ * words (`is`, `as`, `bus`) are untouched.
146
+ */
147
+ function tokenize(text, stop) {
148
+ const out = new Set();
149
+ for (const raw of text.toLowerCase().split(/[^a-z0-9]+/)) {
150
+ if (raw.length < 2 || stop.has(raw))
151
+ continue;
152
+ // Fold a single trailing 's' (refunds→refund) but NOT '-ss' (address stays
153
+ // address) — that asymmetry would defeat the matching it's for. ASCII only:
154
+ // non-Latin/accented text is split away by the regex, so the keyword router is
155
+ // effectively English/ASCII (use embeddingScorer for other languages).
156
+ const fold = raw.length >= 4 && raw.endsWith('s') && !raw.endsWith('ss');
157
+ out.add(fold ? raw.slice(0, -1) : raw);
158
+ }
159
+ return out;
160
+ }
161
+ /** |A ∩ B| / sqrt(|A| · |B|) — set cosine, 0..1. Empty either side → 0. */
162
+ function setCosine(a, b) {
163
+ if (a.size === 0 || b.size === 0)
164
+ return 0;
165
+ const [small, large] = a.size <= b.size ? [a, b] : [b, a];
166
+ let shared = 0;
167
+ for (const t of small)
168
+ if (large.has(t))
169
+ shared += 1;
170
+ return shared / Math.sqrt(a.size * b.size);
171
+ }
172
+ //# sourceMappingURL=entryScorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entryScorer.js","sourceRoot":"","sources":["../../../../src/lib/injection-engine/entryScorer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAkDvC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW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AAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC9C,2EAA2E;QAC3E,4EAA4E;QAC5E,+EAA+E;QAC/E,uEAAuE;QACvE,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,2EAA2E;AAC3E,SAAS,SAAS,CAAC,CAAsB,EAAE,CAAsB;IAC/D,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC3C,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,CAAC,CAAC;IACrD,OAAO,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Injection Engine — evaluator.
3
+ *
4
+ * Pattern: Pure function. Stateless.
5
+ * Role: Internal helper. Called once per iteration by the
6
+ * InjectionEngine subflow's compose stage. Slot subflows
7
+ * read the `active` array and filter by their slot target.
8
+ * Emits: N/A. Caller (the subflow) emits
9
+ * `agentfootprint.context.evaluated`.
10
+ *
11
+ * Behavior per trigger kind:
12
+ * • `always` → always active.
13
+ * • `rule` → predicate runs against `ctx`. Errors are
14
+ * caught + reported in `skipped`; never
15
+ * propagate. Run never crashes.
16
+ * • `on-tool-return` → active when `ctx.lastToolResult.toolName`
17
+ * matches `trigger.toolName` (string equal
18
+ * or regex test).
19
+ * • `llm-activated` → active when the Injection's `id` is in
20
+ * `ctx.activatedInjectionIds` (the LLM
21
+ * previously called `viaToolName(<id>)`).
22
+ */
23
+ import type { Injection, InjectionContext, InjectionEvaluation } from './types.js';
24
+ export declare function evaluateInjections(injections: readonly Injection[], ctx: InjectionContext): InjectionEvaluation;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * defineFact — sugar for context-style Injections (data, not behavior).
3
+ *
4
+ * Use for developer-supplied facts the LLM should see in addition to
5
+ * user messages and tool results. Examples: user profile, env info,
6
+ * computed conversation summary, cached config, current time. Distinct
7
+ * from Skills (LLM-activated guidance) and Steering (always-on rules)
8
+ * in INTENT — they share the engine.
9
+ *
10
+ * Produces an `Injection` with:
11
+ * - flavor: `'fact'`
12
+ * - trigger: configurable (default `'always'`)
13
+ * - inject: targets `systemPrompt` OR `messages` (consumer chooses)
14
+ *
15
+ * @example
16
+ * const userProfile = defineFact({
17
+ * id: 'user-profile',
18
+ * data: `Name: ${user.name}, Plan: ${user.plan}, Joined: ${user.joinedAt}`,
19
+ * });
20
+ *
21
+ * const turnTime = defineFact({
22
+ * id: 'turn-time',
23
+ * data: `Current time: ${new Date().toISOString()}`,
24
+ * slot: 'messages',
25
+ * role: 'system',
26
+ * });
27
+ */
28
+ import type { ContextRole } from '../../../events/types.js';
29
+ import type { Injection, InjectionContext } from '../types.js';
30
+ import type { CachePolicy } from '../../../cache/types.js';
31
+ export interface DefineFactOptions {
32
+ readonly id: string;
33
+ readonly description?: string;
34
+ /** The fact (data string) to inject. */
35
+ readonly data: string;
36
+ /**
37
+ * Which slot to land in. Default `'system-prompt'` (most common —
38
+ * facts the model should always have in mind).
39
+ * `'messages'` for facts that should appear inline with the
40
+ * conversation history (use sparingly — increases token cost).
41
+ */
42
+ readonly slot?: 'system-prompt' | 'messages';
43
+ /** When `slot: 'messages'`, the role to use. Default `'system'`. */
44
+ readonly role?: ContextRole;
45
+ /**
46
+ * Trigger control. Defaults to always-on. For conditional facts
47
+ * (e.g., "only show user profile after iteration 3"), pass a
48
+ * predicate via `activeWhen`.
49
+ */
50
+ readonly activeWhen?: (ctx: InjectionContext) => boolean;
51
+ /**
52
+ * Cache policy for this fact injection. Defaults to `'always'` —
53
+ * facts are typically static data the LLM should always have in mind.
54
+ * Override with `'never'` for facts containing volatile content
55
+ * (e.g., a `Current time:` fact); use `{ until }` for time-bounded
56
+ * facts.
57
+ */
58
+ readonly cache?: CachePolicy;
59
+ }
60
+ export declare function defineFact(opts: DefineFactOptions): Injection;