agentfootprint 8.7.0 → 8.9.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 (245) hide show
  1. package/AGENTS.md +12 -4
  2. package/CLAUDE.md +7 -3
  3. package/ai-instructions/claude-code/SKILL.md +1 -1
  4. package/ai-instructions/setup.sh +0 -0
  5. package/bin/agentfootprint-lint-tools.mjs +0 -0
  6. package/dist/adapters/memory/sqliteVector.js +875 -0
  7. package/dist/adapters/memory/sqliteVector.js.map +1 -0
  8. package/dist/core/Agent.js +6 -0
  9. package/dist/core/Agent.js.map +1 -1
  10. package/dist/core/agent/buildAgentChart.js +12 -1
  11. package/dist/core/agent/buildAgentChart.js.map +1 -1
  12. package/dist/core/agent/buildDynamicAgentChart.js +12 -1
  13. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  14. package/dist/core/agent/memoryRecallInjections.js +100 -10
  15. package/dist/core/agent/memoryRecallInjections.js.map +1 -1
  16. package/dist/core/agent/stages/deliver.js.map +1 -1
  17. package/dist/core/slots/buildSystemPromptSlot.js +10 -0
  18. package/dist/core/slots/buildSystemPromptSlot.js.map +1 -1
  19. package/dist/core/slots/helpers.js +12 -10
  20. package/dist/core/slots/helpers.js.map +1 -1
  21. package/dist/embedders/index.js +11 -0
  22. package/dist/embedders/index.js.map +1 -1
  23. package/dist/esm/adapters/memory/sqliteVector.d.ts +251 -0
  24. package/dist/esm/adapters/memory/sqliteVector.js +869 -0
  25. package/dist/esm/adapters/memory/sqliteVector.js.map +1 -0
  26. package/dist/esm/core/Agent.js +6 -0
  27. package/dist/esm/core/Agent.js.map +1 -1
  28. package/dist/esm/core/agent/buildAgentChart.js +13 -2
  29. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  30. package/dist/esm/core/agent/buildDynamicAgentChart.js +13 -2
  31. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  32. package/dist/esm/core/agent/memoryRecallInjections.d.ts +13 -3
  33. package/dist/esm/core/agent/memoryRecallInjections.js +101 -11
  34. package/dist/esm/core/agent/memoryRecallInjections.js.map +1 -1
  35. package/dist/esm/core/agent/stages/deliver.d.ts +6 -3
  36. package/dist/esm/core/agent/stages/deliver.js.map +1 -1
  37. package/dist/esm/core/slots/buildSystemPromptSlot.js +10 -0
  38. package/dist/esm/core/slots/buildSystemPromptSlot.js.map +1 -1
  39. package/dist/esm/core/slots/helpers.d.ts +11 -2
  40. package/dist/esm/core/slots/helpers.js +11 -9
  41. package/dist/esm/core/slots/helpers.js.map +1 -1
  42. package/dist/esm/embedders/index.js +11 -0
  43. package/dist/esm/embedders/index.js.map +1 -1
  44. package/dist/esm/events/payloads.d.ts +63 -0
  45. package/dist/esm/events/registry.d.ts +3 -1
  46. package/dist/esm/events/registry.js +2 -0
  47. package/dist/esm/events/registry.js.map +1 -1
  48. package/dist/esm/hosting/sqliteSessions.d.ts +7 -13
  49. package/dist/esm/hosting/sqliteSessions.js +8 -25
  50. package/dist/esm/hosting/sqliteSessions.js.map +1 -1
  51. package/dist/esm/index.d.ts +2 -1
  52. package/dist/esm/index.js +6 -1
  53. package/dist/esm/index.js.map +1 -1
  54. package/dist/esm/lib/fnv1a.d.ts +16 -0
  55. package/dist/esm/lib/fnv1a.js +24 -0
  56. package/dist/esm/lib/fnv1a.js.map +1 -0
  57. package/dist/esm/lib/injection-engine/types.d.ts +17 -0
  58. package/dist/esm/lib/injection-engine/types.js.map +1 -1
  59. package/dist/esm/lib/rag/defineRAG.d.ts +126 -26
  60. package/dist/esm/lib/rag/defineRAG.js +112 -25
  61. package/dist/esm/lib/rag/defineRAG.js.map +1 -1
  62. package/dist/esm/lib/rag/index.d.ts +1 -1
  63. package/dist/esm/lib/rag/index.js +1 -1
  64. package/dist/esm/lib/rag/index.js.map +1 -1
  65. package/dist/esm/lib/rag/indexDocuments.d.ts +26 -4
  66. package/dist/esm/lib/rag/indexDocuments.js +12 -1
  67. package/dist/esm/lib/rag/indexDocuments.js.map +1 -1
  68. package/dist/esm/lib/sqliteUnavailable.d.ts +55 -0
  69. package/dist/esm/lib/sqliteUnavailable.js +61 -0
  70. package/dist/esm/lib/sqliteUnavailable.js.map +1 -0
  71. package/dist/esm/memory/define.js +38 -2
  72. package/dist/esm/memory/define.js.map +1 -1
  73. package/dist/esm/memory/define.types.d.ts +93 -1
  74. package/dist/esm/memory/define.types.js +18 -0
  75. package/dist/esm/memory/define.types.js.map +1 -1
  76. package/dist/esm/memory/embedding/embedMessages.js +16 -0
  77. package/dist/esm/memory/embedding/embedMessages.js.map +1 -1
  78. package/dist/esm/memory/embedding/emitEmbedding.d.ts +38 -0
  79. package/dist/esm/memory/embedding/emitEmbedding.js +15 -0
  80. package/dist/esm/memory/embedding/emitEmbedding.js.map +1 -0
  81. package/dist/esm/memory/embedding/loadRelevant.d.ts +49 -15
  82. package/dist/esm/memory/embedding/loadRelevant.js +150 -7
  83. package/dist/esm/memory/embedding/loadRelevant.js.map +1 -1
  84. package/dist/esm/memory/embedding/mockEmbedder.js +4 -0
  85. package/dist/esm/memory/embedding/mockEmbedder.js.map +1 -1
  86. package/dist/esm/memory/embedding/types.d.ts +24 -0
  87. package/dist/esm/memory/index.d.ts +2 -1
  88. package/dist/esm/memory/index.js +2 -1
  89. package/dist/esm/memory/index.js.map +1 -1
  90. package/dist/esm/memory/pipeline/semantic.d.ts +15 -0
  91. package/dist/esm/memory/pipeline/semantic.js +3 -1
  92. package/dist/esm/memory/pipeline/semantic.js.map +1 -1
  93. package/dist/esm/memory/retrieval/index.d.ts +10 -0
  94. package/dist/esm/memory/retrieval/index.js +3 -0
  95. package/dist/esm/memory/retrieval/index.js.map +1 -0
  96. package/dist/esm/memory/retrieval/provenance.d.ts +43 -0
  97. package/dist/esm/memory/retrieval/provenance.js +60 -0
  98. package/dist/esm/memory/retrieval/provenance.js.map +1 -0
  99. package/dist/esm/memory/retrieval/topK.d.ts +67 -0
  100. package/dist/esm/memory/retrieval/topK.js +53 -0
  101. package/dist/esm/memory/retrieval/topK.js.map +1 -0
  102. package/dist/esm/memory/retrieval/types.d.ts +189 -0
  103. package/dist/esm/memory/retrieval/types.js +2 -0
  104. package/dist/esm/memory/retrieval/types.js.map +1 -0
  105. package/dist/esm/memory/stages/formatDefault.d.ts +52 -26
  106. package/dist/esm/memory/stages/formatDefault.js +118 -28
  107. package/dist/esm/memory/stages/formatDefault.js.map +1 -1
  108. package/dist/esm/memory/stages/pickByBudget.js +53 -3
  109. package/dist/esm/memory/stages/pickByBudget.js.map +1 -1
  110. package/dist/esm/memory/stages/types.d.ts +15 -0
  111. package/dist/esm/memory/wire/mountMemoryPipeline.d.ts +25 -0
  112. package/dist/esm/memory/wire/mountMemoryPipeline.js +11 -2
  113. package/dist/esm/memory/wire/mountMemoryPipeline.js.map +1 -1
  114. package/dist/esm/memory-providers.d.ts +2 -0
  115. package/dist/esm/memory-providers.js +8 -0
  116. package/dist/esm/memory-providers.js.map +1 -1
  117. package/dist/esm/observe.d.ts +2 -0
  118. package/dist/esm/observe.js +2 -0
  119. package/dist/esm/observe.js.map +1 -1
  120. package/dist/esm/recorders/core/EmbeddingRecorder.d.ts +19 -0
  121. package/dist/esm/recorders/core/EmbeddingRecorder.js +24 -0
  122. package/dist/esm/recorders/core/EmbeddingRecorder.js.map +1 -0
  123. package/dist/events/registry.js +2 -0
  124. package/dist/events/registry.js.map +1 -1
  125. package/dist/hosting/sqliteSessions.js +10 -27
  126. package/dist/hosting/sqliteSessions.js.map +1 -1
  127. package/dist/index.js +8 -1
  128. package/dist/index.js.map +1 -1
  129. package/dist/lib/fnv1a.js +28 -0
  130. package/dist/lib/fnv1a.js.map +1 -0
  131. package/dist/lib/injection-engine/types.js.map +1 -1
  132. package/dist/lib/rag/defineRAG.js +113 -26
  133. package/dist/lib/rag/defineRAG.js.map +1 -1
  134. package/dist/lib/rag/index.js +2 -1
  135. package/dist/lib/rag/index.js.map +1 -1
  136. package/dist/lib/rag/indexDocuments.js +12 -1
  137. package/dist/lib/rag/indexDocuments.js.map +1 -1
  138. package/dist/lib/sqliteUnavailable.js +65 -0
  139. package/dist/lib/sqliteUnavailable.js.map +1 -0
  140. package/dist/memory/define.js +38 -2
  141. package/dist/memory/define.js.map +1 -1
  142. package/dist/memory/define.types.js +21 -1
  143. package/dist/memory/define.types.js.map +1 -1
  144. package/dist/memory/embedding/embedMessages.js +16 -0
  145. package/dist/memory/embedding/embedMessages.js.map +1 -1
  146. package/dist/memory/embedding/emitEmbedding.js +19 -0
  147. package/dist/memory/embedding/emitEmbedding.js.map +1 -0
  148. package/dist/memory/embedding/loadRelevant.js +152 -8
  149. package/dist/memory/embedding/loadRelevant.js.map +1 -1
  150. package/dist/memory/embedding/mockEmbedder.js +4 -0
  151. package/dist/memory/embedding/mockEmbedder.js.map +1 -1
  152. package/dist/memory/index.js +5 -1
  153. package/dist/memory/index.js.map +1 -1
  154. package/dist/memory/pipeline/semantic.js +2 -0
  155. package/dist/memory/pipeline/semantic.js.map +1 -1
  156. package/dist/memory/retrieval/index.js +9 -0
  157. package/dist/memory/retrieval/index.js.map +1 -0
  158. package/dist/memory/retrieval/provenance.js +65 -0
  159. package/dist/memory/retrieval/provenance.js.map +1 -0
  160. package/dist/memory/retrieval/topK.js +57 -0
  161. package/dist/memory/retrieval/topK.js.map +1 -0
  162. package/dist/memory/retrieval/types.js +3 -0
  163. package/dist/memory/retrieval/types.js.map +1 -0
  164. package/dist/memory/stages/formatDefault.js +118 -28
  165. package/dist/memory/stages/formatDefault.js.map +1 -1
  166. package/dist/memory/stages/pickByBudget.js +53 -3
  167. package/dist/memory/stages/pickByBudget.js.map +1 -1
  168. package/dist/memory/wire/mountMemoryPipeline.js +11 -2
  169. package/dist/memory/wire/mountMemoryPipeline.js.map +1 -1
  170. package/dist/memory-providers.js +13 -1
  171. package/dist/memory-providers.js.map +1 -1
  172. package/dist/observe.js +4 -1
  173. package/dist/observe.js.map +1 -1
  174. package/dist/recorders/core/EmbeddingRecorder.js +28 -0
  175. package/dist/recorders/core/EmbeddingRecorder.js.map +1 -0
  176. package/dist/types/adapters/memory/sqliteVector.d.ts +252 -0
  177. package/dist/types/adapters/memory/sqliteVector.d.ts.map +1 -0
  178. package/dist/types/core/Agent.d.ts.map +1 -1
  179. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  180. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  181. package/dist/types/core/agent/memoryRecallInjections.d.ts +13 -3
  182. package/dist/types/core/agent/memoryRecallInjections.d.ts.map +1 -1
  183. package/dist/types/core/agent/stages/deliver.d.ts +6 -3
  184. package/dist/types/core/agent/stages/deliver.d.ts.map +1 -1
  185. package/dist/types/core/slots/buildSystemPromptSlot.d.ts.map +1 -1
  186. package/dist/types/core/slots/helpers.d.ts +11 -2
  187. package/dist/types/core/slots/helpers.d.ts.map +1 -1
  188. package/dist/types/embedders/index.d.ts.map +1 -1
  189. package/dist/types/events/payloads.d.ts +63 -0
  190. package/dist/types/events/payloads.d.ts.map +1 -1
  191. package/dist/types/events/registry.d.ts +3 -1
  192. package/dist/types/events/registry.d.ts.map +1 -1
  193. package/dist/types/hosting/sqliteSessions.d.ts +7 -13
  194. package/dist/types/hosting/sqliteSessions.d.ts.map +1 -1
  195. package/dist/types/index.d.ts +2 -1
  196. package/dist/types/index.d.ts.map +1 -1
  197. package/dist/types/lib/fnv1a.d.ts +17 -0
  198. package/dist/types/lib/fnv1a.d.ts.map +1 -0
  199. package/dist/types/lib/injection-engine/types.d.ts +17 -0
  200. package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
  201. package/dist/types/lib/rag/defineRAG.d.ts +126 -26
  202. package/dist/types/lib/rag/defineRAG.d.ts.map +1 -1
  203. package/dist/types/lib/rag/index.d.ts +1 -1
  204. package/dist/types/lib/rag/index.d.ts.map +1 -1
  205. package/dist/types/lib/rag/indexDocuments.d.ts +26 -4
  206. package/dist/types/lib/rag/indexDocuments.d.ts.map +1 -1
  207. package/dist/types/lib/sqliteUnavailable.d.ts +56 -0
  208. package/dist/types/lib/sqliteUnavailable.d.ts.map +1 -0
  209. package/dist/types/memory/define.d.ts.map +1 -1
  210. package/dist/types/memory/define.types.d.ts +93 -1
  211. package/dist/types/memory/define.types.d.ts.map +1 -1
  212. package/dist/types/memory/embedding/embedMessages.d.ts.map +1 -1
  213. package/dist/types/memory/embedding/emitEmbedding.d.ts +39 -0
  214. package/dist/types/memory/embedding/emitEmbedding.d.ts.map +1 -0
  215. package/dist/types/memory/embedding/loadRelevant.d.ts +49 -15
  216. package/dist/types/memory/embedding/loadRelevant.d.ts.map +1 -1
  217. package/dist/types/memory/embedding/mockEmbedder.d.ts.map +1 -1
  218. package/dist/types/memory/embedding/types.d.ts +24 -0
  219. package/dist/types/memory/embedding/types.d.ts.map +1 -1
  220. package/dist/types/memory/index.d.ts +2 -1
  221. package/dist/types/memory/index.d.ts.map +1 -1
  222. package/dist/types/memory/pipeline/semantic.d.ts +15 -0
  223. package/dist/types/memory/pipeline/semantic.d.ts.map +1 -1
  224. package/dist/types/memory/retrieval/index.d.ts +11 -0
  225. package/dist/types/memory/retrieval/index.d.ts.map +1 -0
  226. package/dist/types/memory/retrieval/provenance.d.ts +44 -0
  227. package/dist/types/memory/retrieval/provenance.d.ts.map +1 -0
  228. package/dist/types/memory/retrieval/topK.d.ts +68 -0
  229. package/dist/types/memory/retrieval/topK.d.ts.map +1 -0
  230. package/dist/types/memory/retrieval/types.d.ts +190 -0
  231. package/dist/types/memory/retrieval/types.d.ts.map +1 -0
  232. package/dist/types/memory/stages/formatDefault.d.ts +52 -26
  233. package/dist/types/memory/stages/formatDefault.d.ts.map +1 -1
  234. package/dist/types/memory/stages/pickByBudget.d.ts.map +1 -1
  235. package/dist/types/memory/stages/types.d.ts +15 -0
  236. package/dist/types/memory/stages/types.d.ts.map +1 -1
  237. package/dist/types/memory/wire/mountMemoryPipeline.d.ts +25 -0
  238. package/dist/types/memory/wire/mountMemoryPipeline.d.ts.map +1 -1
  239. package/dist/types/memory-providers.d.ts +2 -0
  240. package/dist/types/memory-providers.d.ts.map +1 -1
  241. package/dist/types/observe.d.ts +2 -0
  242. package/dist/types/observe.d.ts.map +1 -1
  243. package/dist/types/recorders/core/EmbeddingRecorder.d.ts +20 -0
  244. package/dist/types/recorders/core/EmbeddingRecorder.d.ts.map +1 -0
  245. package/package.json +1 -1
@@ -0,0 +1,190 @@
1
+ /**
2
+ * retrieval/types — the record a retrieval leaves behind, and the seam
3
+ * that decides which candidates reach the prompt.
4
+ *
5
+ * Pattern: Strategy (the seam) + Value objects (the record).
6
+ * Role: memory/ layer. The law this folder exists to keep is stated
7
+ * once, here, because every stage downstream implements a piece
8
+ * of it: **a retrieval must be able to say what it considered,
9
+ * not only what it used.**
10
+ * Emits: N/A (types only). `loadRelevant` emits
11
+ * `agentfootprint.memory.retrieved` from the record below;
12
+ * `formatDefault` emits `agentfootprint.memory.attached` per
13
+ * admitted chunk.
14
+ *
15
+ * Before 8.8.0 a retrieval computed a cosine score for every candidate
16
+ * and then threw all of them away one line later (`results.map(r =>
17
+ * r.entry)`). The prompt carried the passages; nothing carried the
18
+ * reason. "Why did the agent read this passage" had no answer in the
19
+ * recording, and "why did it NOT read that one" had no answer anywhere —
20
+ * a below-threshold candidate was filtered inside the store and never
21
+ * came back. {@link RetrievalEvidence} is what that answer is made of.
22
+ */
23
+ import type { MemoryEntry } from '../entry/index.js';
24
+ /**
25
+ * Why a candidate did not reach the prompt. Every rejected candidate
26
+ * names one of these — a rejection without a reason is the silence this
27
+ * whole record exists to remove.
28
+ */
29
+ export type RetrievalRejectReason =
30
+ /** Scored below the retriever's `threshold`. The quality floor refused it. */
31
+ 'below-threshold'
32
+ /** Cleared the threshold, but the context-token budget had no room left. */
33
+ | 'over-budget'
34
+ /** Cleared the threshold and the budget, but the picker's `maxEntries` cap was full. */
35
+ | 'over-max-entries';
36
+ /**
37
+ * One candidate the retrieval considered — admitted or not.
38
+ *
39
+ * `rank` is the candidate's position by SCORE (1-based, descending),
40
+ * which is not necessarily the order it appears in the prompt: the
41
+ * budget picker admits by recency (see {@link RetrievalEvidence.selectionOrder}).
42
+ * Recording both is the point — a reader can see that the best-scoring
43
+ * chunk was admitted third, and know that was the picker's doing.
44
+ */
45
+ export interface RetrievedCandidate {
46
+ /** The store entry's id. For an indexed corpus this is the chunk id. */
47
+ readonly id: string;
48
+ /** Similarity as the store reported it. Cosine ([-1, 1]) for every shipped store. */
49
+ readonly score: number;
50
+ /** 1-based position by score, descending, across the whole candidate pool. */
51
+ readonly rank: number;
52
+ /** Did this candidate's text reach the prompt? */
53
+ readonly admitted: boolean;
54
+ /** Present exactly when `admitted` is false. */
55
+ readonly reason?: RetrievalRejectReason;
56
+ /** Source document, when the indexed value carried one in its metadata. */
57
+ readonly docUri?: string;
58
+ /** Page number, when the loader knew one (PDFs). */
59
+ readonly page?: number;
60
+ /** Section heading, when the splitter knew one. */
61
+ readonly heading?: string;
62
+ /**
63
+ * The exact prompt bytes this chunk contributed, set by the formatter
64
+ * for admitted candidates. Joining every admitted candidate's fragment
65
+ * **in {@link promptPosition} order** with `\n\n` reproduces the
66
+ * injected message exactly — which is what lets one retrieval become
67
+ * one `InjectionRecord` PER CHUNK without changing a single byte the
68
+ * model sees.
69
+ */
70
+ readonly promptFragment?: string;
71
+ /**
72
+ * Where this chunk sat in the injected message, 0-based.
73
+ *
74
+ * NOT the same as {@link rank}, and the difference is the honest part:
75
+ * `rank` is how well the chunk scored, `promptPosition` is where the
76
+ * budget picker put it. Under the default recency ordering the
77
+ * best-scoring chunk can land last — which is exactly the kind of thing
78
+ * a lost-in-the-middle investigation needs to be able to see, and which
79
+ * a record that only kept one of the two orders could not show.
80
+ */
81
+ readonly promptPosition?: number;
82
+ }
83
+ /**
84
+ * Everything one retrieval knows about itself. Written to the memory
85
+ * subflow's scope by `loadRelevant`, refined by `pickByBudget` and
86
+ * `formatDefault`, and lifted to the PARENT scope by the read mount so
87
+ * it lands in the root commit log where a slice can reach it.
88
+ */
89
+ export interface RetrievalEvidence {
90
+ /** The retriever's id (`defineRAG({ id })`). Stamped by the read mount. */
91
+ readonly memoryId?: string;
92
+ /**
93
+ * A stable hash of the query text — NOT the text. The query is already
94
+ * in the recording once (as `userMessage`); copying it into a second
95
+ * key would widen the exposure surface for no new information, and any
96
+ * redaction policy the host configured for the first copy would not
97
+ * know about the second.
98
+ */
99
+ readonly queryHash: string;
100
+ /** How many chunks the retriever was willing to admit. */
101
+ readonly k: number;
102
+ /** The quality floor. Absent when the retriever set none. */
103
+ readonly threshold?: number;
104
+ /** The embedder id the query was produced with, when the caller declared one. */
105
+ readonly embedderId?: string;
106
+ /** Length of the query vector. Mixing two lengths in one store is a config bug. */
107
+ readonly dimensions?: number;
108
+ /** How the budget picker ordered the admitted set. See the note on `rank`. */
109
+ readonly selectionOrder: 'recency' | 'relevance';
110
+ /** How many candidates came back from the store. */
111
+ readonly consideredCount: number;
112
+ /** How many reached the prompt. */
113
+ readonly admittedCount: number;
114
+ /** `consideredCount - admittedCount`. */
115
+ readonly rejectedCount: number;
116
+ /**
117
+ * The candidates themselves, best-scoring first.
118
+ *
119
+ * `undefined` means this store could not tell us — see
120
+ * {@link candidatesOmittedReason}. It never means "there were none";
121
+ * that case is `[]` with `consideredCount: 0`.
122
+ */
123
+ readonly candidates?: readonly RetrievedCandidate[];
124
+ /**
125
+ * Whether {@link candidates} is the complete set of candidates that
126
+ * existed, or only as far as the pool we asked for reached.
127
+ *
128
+ * `false` does NOT weaken the admitted set — see the proof in
129
+ * `loadRelevant`. It only means the REJECTED list is a sample: there
130
+ * may be further below-threshold entries we never saw.
131
+ */
132
+ readonly candidatesComplete: boolean;
133
+ /** Present exactly when `candidates` is undefined. */
134
+ readonly candidatesOmittedReason?: string;
135
+ /**
136
+ * The store returned nothing at all for this namespace. Distinct from
137
+ * "everything scored below threshold" (`consideredCount > 0`), and the
138
+ * distinction is the whole diagnosis: an empty namespace almost always
139
+ * means the corpus was indexed somewhere else.
140
+ */
141
+ readonly corpusEmpty: boolean;
142
+ /** The namespace that was searched, as a plain string, for the diagnosis above. */
143
+ readonly namespace?: string;
144
+ }
145
+ /**
146
+ * The retrieval seam: given the candidates a store returned, decide
147
+ * which of them the prompt may have — and say why about each one.
148
+ *
149
+ * A strategy NEVER talks to the store and never embeds anything. It is
150
+ * handed a scored, score-descending pool and returns a verdict per
151
+ * candidate. That narrowness is what makes it composable: a re-ranker or
152
+ * a diversity selector is the same shape with a different body.
153
+ *
154
+ * Shipped: {@link topK}. Deliberately NOT shipped in 8.8.0, and named
155
+ * here so the destination is on record rather than implied — a
156
+ * cross-encoder `rerank(...)` and a maximal-marginal-relevance `mmr(...)`
157
+ * are additional adapters behind this same interface. Neither needs an
158
+ * engine change, a new stage, or a new event; both were left out because
159
+ * a re-ranker without a shipped re-ranking model is a config with nothing
160
+ * to configure.
161
+ */
162
+ export interface RetrievalStrategy {
163
+ /** Stable name — appears in the recording and in refusal messages. */
164
+ readonly name: string;
165
+ /** How many candidates this strategy is willing to admit. */
166
+ readonly k: number;
167
+ /** The quality floor, when the strategy has one. */
168
+ readonly threshold?: number;
169
+ /**
170
+ * How many EXTRA candidates to pull past `k` purely so that rejected
171
+ * ones can be shown. Never affects which candidates are admitted.
172
+ */
173
+ readonly rejectWindow: number;
174
+ /**
175
+ * Rule on a score-descending pool. Return one verdict per input, in
176
+ * the same order. Implementations must not reorder.
177
+ */
178
+ select(pool: readonly ScoredCandidate[]): readonly RetrievalVerdict[];
179
+ }
180
+ /** One store result, as a strategy sees it. */
181
+ export interface ScoredCandidate {
182
+ readonly entry: MemoryEntry<unknown>;
183
+ readonly score: number;
184
+ }
185
+ /** A strategy's ruling on one candidate. */
186
+ export interface RetrievalVerdict {
187
+ readonly admitted: boolean;
188
+ readonly reason?: RetrievalRejectReason;
189
+ }
190
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/memory/retrieval/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH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AgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;CACzC"}
@@ -1,44 +1,64 @@
1
1
  /**
2
2
  * formatDefault — render picked entries into injection-ready messages.
3
3
  *
4
- * Reads from scope: `selected`
5
- * Writes to scope: `formatted` (messages to inject into the LLM prompt)
4
+ * Reads from scope: `selected`, `retrieved`
5
+ * Writes to scope: `formatted` (messages to inject into the LLM prompt),
6
+ * `retrieved` (each admitted chunk's prompt fragment)
6
7
  *
7
8
  * Why a separate stage from the picker?
8
- * Retrieval and presentation are orthogonal concerns (MemGPT-reviewer
9
- * ask). A picker decides WHICH memories survive the budget; a formatter
10
- * decides HOW they appear to the LLM. Consumers can swap either without
11
- * touching the other. In research settings, format variations ("JSON
12
- * envelope" vs "XML tags" vs "natural paragraphs") are worth ablating.
9
+ * Retrieval and presentation are orthogonal concerns. A picker decides
10
+ * WHICH memories survive the budget; a formatter decides HOW they appear
11
+ * to the LLM. Consumers can swap either without touching the other. In
12
+ * research settings, format variations ("JSON envelope" vs "XML tags" vs
13
+ * "natural paragraphs") are worth ablating.
13
14
  *
14
- * Default format:
15
- * One `system` message containing a citation-tagged block per entry:
15
+ * ─── Two flavors, because they are two different claims ────────────────
16
16
  *
17
- * <memory source="turn:5" updated="2026-04-18T06:00:00Z">
18
- * User said: I live in San Francisco.
17
+ * `'memory'` (default, unchanged since 7.20.0) — recall from THIS
18
+ * conversation. Each entry is a turn, so it is rendered with the turn's
19
+ * role and number:
20
+ *
21
+ * Relevant context from prior conversations. Use when it helps answer the current turn.
22
+ *
23
+ * <memory role="user" turn="5" updated="2026-04-18T06:00:00Z">
24
+ * I live in San Francisco.
19
25
  * </memory>
20
26
  *
21
- * Citation tags let the LLM reference sources in its response; the
22
- * Anthropic-reviewer ask ("recall should carry source").
27
+ * `'rag'` (8.8.0) — retrieval from a document corpus. An indexed chunk
28
+ * has no role and no turn; it has a document, a position in it, and a
29
+ * similarity score. Printing `role="unknown" turn="0"` on a page of a
30
+ * PDF, which is what the memory shape did, told the model three things
31
+ * that were not true and withheld the one thing it needed to cite:
32
+ *
33
+ * Relevant passages retrieved from the document corpus. Cite the source id when you use one.
23
34
  *
24
- * Role chosen: `system`. Reasoning: this is NOT the ongoing dialogue,
25
- * it's context we're adding. A `user` role would confuse turn-taking;
26
- * `assistant` would be a false claim. `system` matches the semantic
27
- * of "context injected by the application, not part of the conversation."
35
+ * <source id="refunds.md#3" doc="refunds.md" heading="Refund timing" score="0.81">
36
+ * Refunds are processed within 3 business days of approval.
37
+ * </source>
28
38
  *
29
- * Wrapping: entries are grouped into ONE system message rather than N
30
- * separate messages. One message is easier for LLMs to reason about
31
- * and avoids breaking up the conversational flow.
39
+ * Role chosen (both flavors): `system`. This is NOT the ongoing dialogue,
40
+ * it is context the application is adding. A `user` role would confuse
41
+ * turn-taking; `assistant` would be a false claim.
42
+ *
43
+ * Wrapping: entries are grouped into ONE system message rather than N.
44
+ * One message is easier for a model to reason about — and the record
45
+ * still resolves to one `InjectionRecord` PER chunk, because each chunk's
46
+ * exact bytes are kept on the retrieval record (`promptFragment`) and
47
+ * joining them with `\n\n` reproduces this message exactly.
32
48
  */
33
49
  import type { TypedScope } from 'footprintjs';
34
50
  import type { MemoryEntry } from '../entry/index.js';
35
51
  import type { LLMMessage as Message } from '../../adapters/types.js';
36
52
  import type { MemoryState } from './types.js';
53
+ import type { RetrievedCandidate } from '../retrieval/types.js';
54
+ /** Which claim the injected block is making about its entries. */
55
+ export type MemoryFormatFlavor = 'memory' | 'rag';
37
56
  export interface FormatDefaultConfig {
38
57
  /**
39
58
  * Header prepended to the injected message. Explains to the LLM what
40
59
  * follows and what it's for. Override if your app has specific phrasing
41
- * guidance ("long-term memory" vs "user preferences", etc.).
60
+ * guidance ("long-term memory" vs "user preferences", etc.). Defaults
61
+ * per `flavor`.
42
62
  */
43
63
  readonly header?: string;
44
64
  /**
@@ -48,12 +68,18 @@ export interface FormatDefaultConfig {
48
68
  */
49
69
  readonly footer?: string;
50
70
  /**
51
- * Custom per-entry renderer. Receives the entry; returns the block
52
- * string (without outer tags — the default wrapper adds those). Use
53
- * for app-specific formatting: custom source attributions, hiding
54
- * tier info, etc.
71
+ * Which rendering the entries get. Default `'memory'` — conversation
72
+ * recall, byte-identical to every release before 8.8.0. `defineRAG`
73
+ * sets `'rag'`.
74
+ */
75
+ readonly flavor?: MemoryFormatFlavor;
76
+ /**
77
+ * Custom per-entry renderer. Receives the entry (and, for retrieval
78
+ * pipelines, its candidate record); returns the block string. Use for
79
+ * app-specific formatting: custom source attributions, hiding tier
80
+ * info, etc. Overrides `flavor`.
55
81
  */
56
- readonly renderEntry?: (entry: MemoryEntry<Message>) => string;
82
+ readonly renderEntry?: (entry: MemoryEntry<Message>, candidate?: RetrievedCandidate) => string;
57
83
  /**
58
84
  * When `true`, inject even if `selected` is empty (emits only header
59
85
  * and footer). Usually NOT desired — an empty memory block is noise.
@@ -1 +1 @@
1
- {"version":3,"file":"formatDefault.d.ts","sourceRoot":"","sources":["../../../../src/memory/stages/formatDefault.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,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AAG,QAAQ,IAAI,CAAC,CAiG7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"pickByBudget.d.ts","sourceRoot":"","sources":["../../../../src/memory/stages/pickByBudget.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAA+C,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAE/F;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,CAC9C,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,KACzB,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAEzB,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC;IAEpC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AA2ED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC9D,MAAM,GAAE,kBAAuB,GAC9B,eAAe,CAAC,CAAC,CAAC,CAgCpB"}
1
+ {"version":3,"file":"pickByBudget.d.ts","sourceRoot":"","sources":["../../../../src/memory/stages/pickByBudget.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAA+C,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAE/F;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,CAC9C,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,KACzB,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAEzB,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC;IAEpC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAwID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC9D,MAAM,GAAE,kBAAuB,GAC9B,eAAe,CAAC,CAAC,CAAC,CAgCpB"}
@@ -57,6 +57,21 @@ export interface MemoryState {
57
57
  * messages array (typically as `system` messages before the user turn).
58
58
  */
59
59
  formatted: Message[];
60
+ /**
61
+ * Retrieval record (8.8.0) — what the search considered, what it
62
+ * admitted, and why about each candidate.
63
+ *
64
+ * Written by `loadRelevant`, refined by `pickByBudget` (budget
65
+ * rejections) and `formatDefault` (the prompt bytes each admitted chunk
66
+ * contributed), and lifted to the PARENT scope by `mountMemoryRead` so
67
+ * it reaches the root commit log — a subflow's own scope never does,
68
+ * which is why a slice could not previously see past the mount.
69
+ *
70
+ * Absent for pipelines that do no retrieval (recency load, fact
71
+ * extraction). Absence means "this pipeline does not rank", never
72
+ * "this pipeline ranked and found nothing".
73
+ */
74
+ retrieved?: import('../retrieval/types.js').RetrievalEvidence;
60
75
  /**
61
76
  * Write-side input: messages to persist at the end of this turn. The
62
77
  * wire layer populates from the agent's final message state;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/memory/stages/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;A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,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAExC;;;;OAIG;IACH,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;IAE/B;;;;;OAKG;IACH,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;IAEjC;;;;OAIG;IACH,SAAS,EAAE,OAAO,EAAE,CAAC;IAErB;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,EAAE,OAAO,uBAAuB,EAAE,iBAAiB,CAAC;IAE9D;;;;OAIG;IACH,WAAW,EAAE,OAAO,EAAE,CAAC;IAEvB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,+BAA+B,EAAE,WAAW,CAAC;IAElE,+EAA+E;IAC/E,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
@@ -72,6 +72,31 @@ export interface MountMemoryPipelineConfig<ParentState> {
72
72
  readonly readSubflowId?: string;
73
73
  /** Subflow id for the write mount. Default `'sf-memory-write'`. */
74
74
  readonly writeSubflowId?: string;
75
+ /**
76
+ * Read and write under THIS namespace instead of whatever the parent
77
+ * scope's identity key holds (8.8.0).
78
+ *
79
+ * A conversation memory wants the run's identity — that is how each
80
+ * conversation remembers its own turns. A shared document corpus does
81
+ * not: it belongs to the application, not to a conversation, and
82
+ * scoping it per run is what made `defineRAG`'s documented example
83
+ * retrieve nothing at all. `MemoryDefinition.corpus` feeds this.
84
+ */
85
+ readonly identityOverride?: import('../identity/index.js').MemoryIdentity;
86
+ /**
87
+ * Scope field the read subflow writes its retrieval record to (8.8.0).
88
+ *
89
+ * The record has to be lifted OUT of the subflow to be worth anything:
90
+ * a subflow's own scope never reaches the root commit log, which is why
91
+ * a backward slice from the answer used to bottom out at "the memory
92
+ * mount wrote it" with no way to ask which passage. Lifted here, the
93
+ * per-chunk ids and scores are ordinary root state, and `sliceForKey`
94
+ * / `backtrack` / `who_wrote` reach them like any other value.
95
+ *
96
+ * Omitted → nothing is lifted, and pipelines that do no retrieval are
97
+ * unaffected (they never write the record in the first place).
98
+ */
99
+ readonly evidenceKey?: keyof ParentState & string;
75
100
  /**
76
101
  * Evidence source for CAUSAL pipelines (the evidence bridge, backlog #5).
77
102
  * Called by the write mount's inputMapper at write time; its result lands on
@@ -1 +1 @@
1
- {"version":3,"file":"mountMemoryPipeline.d.ts","sourceRoot":"","sources":["../../../../src/memory/wire/mountMemoryPipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,yBAAyB,CAAC,WAAW;IACpD,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,CAAC;IAElD,qEAAqE;IACrE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,CAAC;IAEvD;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,CAAC;IAEnD;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,CAAC;IAErD,iEAAiE;IACjE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEhC,mEAAmE;IACnE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;;;;;OAOG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,OAAO,+BAA+B,EAAE,WAAW,CAAC;CACrF;AAoBD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe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H,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,CAAC;IAErD,iEAAiE;IACjE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEhC,mEAAmE;IACnE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,sBAAsB,EAAE,cAAc,CAAC;IAE1E;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,CAAC;IAElD;;;;;;;OAOG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,OAAO,+BAA+B,EAAE,WAAW,CAAC;CACrF;AAoBD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,WAAW,EACzC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,EACtC,MAAM,EAAE,yBAAyB,CAAC,WAAW,CAAC,GAC7C,gBAAgB,CAAC,WAAW,CAAC,CAoC/B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAC1C,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,EACtC,MAAM,EAAE,yBAAyB,CAAC,WAAW,CAAC,GAC7C,gBAAgB,CAAC,WAAW,CAAC,CAyB/B;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAC7C,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,EACtC,MAAM,EAAE,yBAAyB,CAAC,WAAW,CAAC,GAC7C,gBAAgB,CAAC,WAAW,CAAC,CAE/B"}
@@ -38,5 +38,7 @@
38
38
  */
39
39
  export { RedisStore, type RedisStoreOptions, type RedisLikeClient, type RedisLikePipeline, } from './adapters/memory/redis.js';
40
40
  export { AgentCoreStore, UnreadableMemoryEntryError, type AgentCoreStoreOptions, type AgentCoreLikeClient, type AgentCoreEvent, type AgentCoreMemoryRecord, } from './adapters/memory/agentcore.js';
41
+ export { sqliteVectorStore, UnreadableIndexFileError, EmbedderMismatchError, type SqliteVectorStore, type SqliteVectorStoreOptions, type SqliteVectorDatabaseLike, type SqliteVectorStatementLike, type SqliteVectorModuleLike, } from './adapters/memory/sqliteVector.js';
42
+ export { SqliteUnavailableError } from './lib/sqliteUnavailable.js';
41
43
  export { BedrockAgentMemory, type BedrockAgentMemoryOptions, type BedrockAgentMemoryLikeClient, type BedrockAgentSummary, } from './adapters/memory/bedrockAgentMemory.js';
42
44
  //# sourceMappingURL=memory-providers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-providers.d.ts","sourceRoot":"","sources":["../../src/memory-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAKH,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,gCAAgC,CAAC;AAIxC,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,GACzB,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"memory-providers.d.ts","sourceRoot":"","sources":["../../src/memory-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAKH,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,GAC5B,MAAM,mCAAmC,CAAC;AAI3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAIpE,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,GACzB,MAAM,yCAAyC,CAAC"}
@@ -22,6 +22,7 @@
22
22
  * • CostRecorder — token/USD spend
23
23
  * • EvalRecorder — eval scores from `runner.emit('eval.*', ...)`
24
24
  * • MemoryRecorder — memory injections + writes
25
+ * • EmbeddingRecorder — embedding cost, index-time vs query-time
25
26
  * • PermissionRecorder — permission decisions + denials
26
27
  * • SkillRecorder — skill activations
27
28
  * • LoggingRecorder — structured log lines per event
@@ -46,6 +47,7 @@ export { toolsRecorder, type ToolsRecorderOptions } from './recorders/core/Tools
46
47
  export { contextEvaluatedRecorder, type ContextEvaluatedRecorderOptions, } from './recorders/core/ContextEvaluatedRecorder.js';
47
48
  export { evalRecorder, type EvalRecorderOptions } from './recorders/core/EvalRecorder.js';
48
49
  export { memoryRecorder, type MemoryRecorderOptions } from './recorders/core/MemoryRecorder.js';
50
+ export { embeddingRecorder, type EmbeddingRecorderOptions, } from './recorders/core/EmbeddingRecorder.js';
49
51
  export { permissionRecorder, type PermissionRecorderOptions, } from './recorders/core/PermissionRecorder.js';
50
52
  export { skillRecorder, type SkillRecorderOptions } from './recorders/core/SkillRecorder.js';
51
53
  export { resilienceRecorder, type ResilienceRecorderOptions, } from './recorders/core/ResilienceRecorder.js';
@@ -1 +1 @@
1
- {"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../../src/observe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;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CAAC;AAG1D,OAAO,EACL,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,WAAW,GACjB,MAAM,yDAAyD,CAAC;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAQ1D,cAAc,YAAY,CAAC;AAK3B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,aAAa,EACb,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,4CAA4C,CAAC;AAKpD,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,WAAW,GACZ,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,WAAW,EACX,UAAU,GACX,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * EmbeddingRecorder — forwards `agentfootprint.embedding.*` emits to the dispatcher.
3
+ *
4
+ * Pattern: Factory over EmitBridge.
5
+ * Role: Bridges the embedding domain — the two-phase cost model. Without a
6
+ * bridge an emit never reaches `agent.on(...)` no matter how correctly
7
+ * it is fired, which is the shape this domain was in until 8.9.0: it
8
+ * had a payload type, a registry entry and a `DomainWildcard` arm, and
9
+ * no way for the event to arrive.
10
+ * Emits: agentfootprint.embedding.generated
11
+ *
12
+ * Always-on and zero-cost: an agent with no memory pipeline embeds nothing and
13
+ * this bridge sees nothing.
14
+ */
15
+ import { EmitBridge, type EmitBridgeOptions } from './EmitBridge.js';
16
+ export type EmbeddingRecorderOptions = Omit<EmitBridgeOptions, 'id' | 'prefix'> & {
17
+ readonly id?: string;
18
+ };
19
+ export declare function embeddingRecorder(options: EmbeddingRecorderOptions): EmitBridge;
20
+ //# sourceMappingURL=EmbeddingRecorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbeddingRecorder.d.ts","sourceRoot":"","sources":["../../../../src/recorders/core/EmbeddingRecorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG;IAChF,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,UAAU,CAO/E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentfootprint",
3
- "version": "8.7.0",
3
+ "version": "8.9.0",
4
4
  "description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",