@fgv/ts-agent-memory 5.1.0-47 → 5.1.0-49

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 (376) hide show
  1. package/dist/packlets/ingest/orchestrator.js +11 -1
  2. package/dist/packlets/ingest/orchestrator.js.map +1 -1
  3. package/dist/packlets/observe/memoryObservationStore.js +6 -0
  4. package/dist/packlets/observe/memoryObservationStore.js.map +1 -1
  5. package/dist/packlets/observe/observer.js.map +1 -1
  6. package/dist/packlets/retrieve/linkTraversalRetriever.js +1 -1
  7. package/dist/packlets/retrieve/linkTraversalRetriever.js.map +1 -1
  8. package/dist/packlets/retrieve/recencyRetriever.js +1 -1
  9. package/dist/packlets/retrieve/recencyRetriever.js.map +1 -1
  10. package/dist/packlets/retrieve/retriever.js +11 -5
  11. package/dist/packlets/retrieve/retriever.js.map +1 -1
  12. package/dist/packlets/retrieve/structuredFilterRetriever.js +27 -5
  13. package/dist/packlets/retrieve/structuredFilterRetriever.js.map +1 -1
  14. package/dist/packlets/retrieve/tagRetriever.js +1 -1
  15. package/dist/packlets/retrieve/tagRetriever.js.map +1 -1
  16. package/dist/packlets/retrieve/temporalRetrievers.js +1 -1
  17. package/dist/packlets/retrieve/temporalRetrievers.js.map +1 -1
  18. package/dist/packlets/store/fileTreeMemoryStore.js +152 -132
  19. package/dist/packlets/store/fileTreeMemoryStore.js.map +1 -1
  20. package/dist/packlets/store/vectorMaintenance.js +251 -0
  21. package/dist/packlets/store/vectorMaintenance.js.map +1 -0
  22. package/dist/packlets/types/envelope.js.map +1 -1
  23. package/dist/packlets/vector/inMemoryCosineIndex.js +81 -18
  24. package/dist/packlets/vector/inMemoryCosineIndex.js.map +1 -1
  25. package/dist/packlets/vector/inMemoryFragmentCosineIndex.js +7 -0
  26. package/dist/packlets/vector/inMemoryFragmentCosineIndex.js.map +1 -1
  27. package/dist/packlets/vector/vectorIndex.js.map +1 -1
  28. package/dist/ts-agent-memory.d.ts +431 -79
  29. package/lib/packlets/ingest/orchestrator.d.ts.map +1 -1
  30. package/lib/packlets/ingest/orchestrator.js +11 -1
  31. package/lib/packlets/ingest/orchestrator.js.map +1 -1
  32. package/lib/packlets/observe/memoryObservationStore.d.ts.map +1 -1
  33. package/lib/packlets/observe/memoryObservationStore.js +6 -0
  34. package/lib/packlets/observe/memoryObservationStore.js.map +1 -1
  35. package/lib/packlets/observe/observer.d.ts +61 -0
  36. package/lib/packlets/observe/observer.d.ts.map +1 -1
  37. package/lib/packlets/observe/observer.js.map +1 -1
  38. package/lib/packlets/retrieve/linkTraversalRetriever.d.ts +1 -1
  39. package/lib/packlets/retrieve/linkTraversalRetriever.js +1 -1
  40. package/lib/packlets/retrieve/linkTraversalRetriever.js.map +1 -1
  41. package/lib/packlets/retrieve/recencyRetriever.d.ts +1 -1
  42. package/lib/packlets/retrieve/recencyRetriever.js +1 -1
  43. package/lib/packlets/retrieve/recencyRetriever.js.map +1 -1
  44. package/lib/packlets/retrieve/retriever.d.ts +26 -7
  45. package/lib/packlets/retrieve/retriever.d.ts.map +1 -1
  46. package/lib/packlets/retrieve/retriever.js +11 -5
  47. package/lib/packlets/retrieve/retriever.js.map +1 -1
  48. package/lib/packlets/retrieve/structuredFilterRetriever.d.ts +26 -4
  49. package/lib/packlets/retrieve/structuredFilterRetriever.d.ts.map +1 -1
  50. package/lib/packlets/retrieve/structuredFilterRetriever.js +27 -5
  51. package/lib/packlets/retrieve/structuredFilterRetriever.js.map +1 -1
  52. package/lib/packlets/retrieve/tagRetriever.d.ts +1 -1
  53. package/lib/packlets/retrieve/tagRetriever.js +1 -1
  54. package/lib/packlets/retrieve/tagRetriever.js.map +1 -1
  55. package/lib/packlets/retrieve/temporalRetrievers.js +1 -1
  56. package/lib/packlets/retrieve/temporalRetrievers.js.map +1 -1
  57. package/lib/packlets/store/fileTreeMemoryStore.d.ts +135 -59
  58. package/lib/packlets/store/fileTreeMemoryStore.d.ts.map +1 -1
  59. package/lib/packlets/store/fileTreeMemoryStore.js +151 -131
  60. package/lib/packlets/store/fileTreeMemoryStore.js.map +1 -1
  61. package/lib/packlets/store/vectorMaintenance.d.ts +149 -0
  62. package/lib/packlets/store/vectorMaintenance.d.ts.map +1 -0
  63. package/lib/packlets/store/vectorMaintenance.js +255 -0
  64. package/lib/packlets/store/vectorMaintenance.js.map +1 -0
  65. package/lib/packlets/types/envelope.d.ts +11 -0
  66. package/lib/packlets/types/envelope.d.ts.map +1 -1
  67. package/lib/packlets/types/envelope.js.map +1 -1
  68. package/lib/packlets/vector/inMemoryCosineIndex.d.ts +30 -7
  69. package/lib/packlets/vector/inMemoryCosineIndex.d.ts.map +1 -1
  70. package/lib/packlets/vector/inMemoryCosineIndex.js +80 -17
  71. package/lib/packlets/vector/inMemoryCosineIndex.js.map +1 -1
  72. package/lib/packlets/vector/inMemoryFragmentCosineIndex.d.ts +7 -0
  73. package/lib/packlets/vector/inMemoryFragmentCosineIndex.d.ts.map +1 -1
  74. package/lib/packlets/vector/inMemoryFragmentCosineIndex.js +7 -0
  75. package/lib/packlets/vector/inMemoryFragmentCosineIndex.js.map +1 -1
  76. package/lib/packlets/vector/vectorIndex.d.ts +129 -1
  77. package/lib/packlets/vector/vectorIndex.d.ts.map +1 -1
  78. package/lib/packlets/vector/vectorIndex.js.map +1 -1
  79. package/package.json +17 -7
  80. package/.rush/temp/5667e36f1c0cc503a5c20a3ebff76e7b9a702d41.tar.log +0 -468
  81. package/.rush/temp/chunked-rush-logs/ts-agent-memory.build.chunks.jsonl +0 -9
  82. package/.rush/temp/operation/build/all.log +0 -9
  83. package/.rush/temp/operation/build/log-chunks.jsonl +0 -9
  84. package/.rush/temp/operation/build/state.json +0 -3
  85. package/.rush/temp/shrinkwrap-deps.json +0 -689
  86. package/config/api-extractor.json +0 -343
  87. package/config/jest.config.json +0 -14
  88. package/config/rig.json +0 -4
  89. package/dist/test/unit/converters/antagonistRoundTrip.test.js +0 -95
  90. package/dist/test/unit/converters/antagonistRoundTrip.test.js.map +0 -1
  91. package/dist/test/unit/converters/bodyConverterRegistry.test.js +0 -72
  92. package/dist/test/unit/converters/bodyConverterRegistry.test.js.map +0 -1
  93. package/dist/test/unit/converters/envelopeConverter.test.js +0 -313
  94. package/dist/test/unit/converters/envelopeConverter.test.js.map +0 -1
  95. package/dist/test/unit/index/memoryIndex.test.js +0 -214
  96. package/dist/test/unit/index/memoryIndex.test.js.map +0 -1
  97. package/dist/test/unit/ingest/antagonistCycleAndParity.test.js +0 -277
  98. package/dist/test/unit/ingest/antagonistCycleAndParity.test.js.map +0 -1
  99. package/dist/test/unit/ingest/cycleGuard.test.js +0 -81
  100. package/dist/test/unit/ingest/cycleGuard.test.js.map +0 -1
  101. package/dist/test/unit/ingest/dedupScope.test.js +0 -434
  102. package/dist/test/unit/ingest/dedupScope.test.js.map +0 -1
  103. package/dist/test/unit/ingest/orchestrator.test.js +0 -1058
  104. package/dist/test/unit/ingest/orchestrator.test.js.map +0 -1
  105. package/dist/test/unit/observe/memoryObservationStore.test.js +0 -118
  106. package/dist/test/unit/observe/memoryObservationStore.test.js.map +0 -1
  107. package/dist/test/unit/retrieve/fragmentSemanticRetriever.test.js +0 -116
  108. package/dist/test/unit/retrieve/fragmentSemanticRetriever.test.js.map +0 -1
  109. package/dist/test/unit/retrieve/linkTraversalRetriever.test.js +0 -257
  110. package/dist/test/unit/retrieve/linkTraversalRetriever.test.js.map +0 -1
  111. package/dist/test/unit/retrieve/retrievers.test.js +0 -768
  112. package/dist/test/unit/retrieve/retrievers.test.js.map +0 -1
  113. package/dist/test/unit/retrieve/temporalRetrievers.test.js +0 -182
  114. package/dist/test/unit/retrieve/temporalRetrievers.test.js.map +0 -1
  115. package/dist/test/unit/store/antagonistTemporalBoundary.test.js +0 -120
  116. package/dist/test/unit/store/antagonistTemporalBoundary.test.js.map +0 -1
  117. package/dist/test/unit/store/embedOnWrite.test.js +0 -317
  118. package/dist/test/unit/store/embedOnWrite.test.js.map +0 -1
  119. package/dist/test/unit/store/fileTreeMemoryStore.test.js +0 -778
  120. package/dist/test/unit/store/fileTreeMemoryStore.test.js.map +0 -1
  121. package/dist/test/unit/store/fragmentEmbedOnWrite.test.js +0 -255
  122. package/dist/test/unit/store/fragmentEmbedOnWrite.test.js.map +0 -1
  123. package/dist/test/unit/store/indexInjection.test.js +0 -432
  124. package/dist/test/unit/store/indexInjection.test.js.map +0 -1
  125. package/dist/test/unit/store/lenientOpen.test.js +0 -248
  126. package/dist/test/unit/store/lenientOpen.test.js.map +0 -1
  127. package/dist/test/unit/store/listScoped.test.js +0 -109
  128. package/dist/test/unit/store/listScoped.test.js.map +0 -1
  129. package/dist/test/unit/store/observations.test.js +0 -239
  130. package/dist/test/unit/store/observations.test.js.map +0 -1
  131. package/dist/test/unit/store/rankAxis.test.js +0 -254
  132. package/dist/test/unit/store/rankAxis.test.js.map +0 -1
  133. package/dist/test/unit/store/scopeEncoding.test.js +0 -24
  134. package/dist/test/unit/store/scopeEncoding.test.js.map +0 -1
  135. package/dist/test/unit/store/temporalStore.test.js +0 -398
  136. package/dist/test/unit/store/temporalStore.test.js.map +0 -1
  137. package/dist/test/unit/tools/memoryTools.test.js +0 -842
  138. package/dist/test/unit/tools/memoryTools.test.js.map +0 -1
  139. package/dist/test/unit/types/identityCodec.test.js +0 -187
  140. package/dist/test/unit/types/identityCodec.test.js.map +0 -1
  141. package/dist/test/unit/types/ids.test.js +0 -84
  142. package/dist/test/unit/types/ids.test.js.map +0 -1
  143. package/dist/test/unit/types/temporalCodec.test.js +0 -203
  144. package/dist/test/unit/types/temporalCodec.test.js.map +0 -1
  145. package/dist/test/unit/types/temporalPolicy.test.js +0 -83
  146. package/dist/test/unit/types/temporalPolicy.test.js.map +0 -1
  147. package/dist/test/unit/types/writePolicy.test.js +0 -331
  148. package/dist/test/unit/types/writePolicy.test.js.map +0 -1
  149. package/dist/test/unit/vector/fragmentConverters.test.js +0 -58
  150. package/dist/test/unit/vector/fragmentConverters.test.js.map +0 -1
  151. package/dist/test/unit/vector/inMemoryCosineIndex.test.js +0 -252
  152. package/dist/test/unit/vector/inMemoryCosineIndex.test.js.map +0 -1
  153. package/dist/test/unit/vector/inMemoryFragmentCosineIndex.test.js +0 -362
  154. package/dist/test/unit/vector/inMemoryFragmentCosineIndex.test.js.map +0 -1
  155. package/dist/test/unit/vector/vectorIndex.test.js +0 -51
  156. package/dist/test/unit/vector/vectorIndex.test.js.map +0 -1
  157. package/eslint.config.js +0 -15
  158. package/etc/ts-agent-memory.api.md +0 -940
  159. package/lib/test/unit/converters/antagonistRoundTrip.test.d.ts +0 -10
  160. package/lib/test/unit/converters/antagonistRoundTrip.test.d.ts.map +0 -1
  161. package/lib/test/unit/converters/antagonistRoundTrip.test.js +0 -97
  162. package/lib/test/unit/converters/antagonistRoundTrip.test.js.map +0 -1
  163. package/lib/test/unit/converters/bodyConverterRegistry.test.d.ts +0 -2
  164. package/lib/test/unit/converters/bodyConverterRegistry.test.d.ts.map +0 -1
  165. package/lib/test/unit/converters/bodyConverterRegistry.test.js +0 -74
  166. package/lib/test/unit/converters/bodyConverterRegistry.test.js.map +0 -1
  167. package/lib/test/unit/converters/envelopeConverter.test.d.ts +0 -2
  168. package/lib/test/unit/converters/envelopeConverter.test.d.ts.map +0 -1
  169. package/lib/test/unit/converters/envelopeConverter.test.js +0 -315
  170. package/lib/test/unit/converters/envelopeConverter.test.js.map +0 -1
  171. package/lib/test/unit/index/memoryIndex.test.d.ts +0 -2
  172. package/lib/test/unit/index/memoryIndex.test.d.ts.map +0 -1
  173. package/lib/test/unit/index/memoryIndex.test.js +0 -216
  174. package/lib/test/unit/index/memoryIndex.test.js.map +0 -1
  175. package/lib/test/unit/ingest/antagonistCycleAndParity.test.d.ts +0 -9
  176. package/lib/test/unit/ingest/antagonistCycleAndParity.test.d.ts.map +0 -1
  177. package/lib/test/unit/ingest/antagonistCycleAndParity.test.js +0 -279
  178. package/lib/test/unit/ingest/antagonistCycleAndParity.test.js.map +0 -1
  179. package/lib/test/unit/ingest/cycleGuard.test.d.ts +0 -2
  180. package/lib/test/unit/ingest/cycleGuard.test.d.ts.map +0 -1
  181. package/lib/test/unit/ingest/cycleGuard.test.js +0 -83
  182. package/lib/test/unit/ingest/cycleGuard.test.js.map +0 -1
  183. package/lib/test/unit/ingest/dedupScope.test.d.ts +0 -2
  184. package/lib/test/unit/ingest/dedupScope.test.d.ts.map +0 -1
  185. package/lib/test/unit/ingest/dedupScope.test.js +0 -436
  186. package/lib/test/unit/ingest/dedupScope.test.js.map +0 -1
  187. package/lib/test/unit/ingest/orchestrator.test.d.ts +0 -2
  188. package/lib/test/unit/ingest/orchestrator.test.d.ts.map +0 -1
  189. package/lib/test/unit/ingest/orchestrator.test.js +0 -1060
  190. package/lib/test/unit/ingest/orchestrator.test.js.map +0 -1
  191. package/lib/test/unit/observe/memoryObservationStore.test.d.ts +0 -2
  192. package/lib/test/unit/observe/memoryObservationStore.test.d.ts.map +0 -1
  193. package/lib/test/unit/observe/memoryObservationStore.test.js +0 -120
  194. package/lib/test/unit/observe/memoryObservationStore.test.js.map +0 -1
  195. package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.d.ts +0 -2
  196. package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.d.ts.map +0 -1
  197. package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.js +0 -118
  198. package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.js.map +0 -1
  199. package/lib/test/unit/retrieve/linkTraversalRetriever.test.d.ts +0 -2
  200. package/lib/test/unit/retrieve/linkTraversalRetriever.test.d.ts.map +0 -1
  201. package/lib/test/unit/retrieve/linkTraversalRetriever.test.js +0 -259
  202. package/lib/test/unit/retrieve/linkTraversalRetriever.test.js.map +0 -1
  203. package/lib/test/unit/retrieve/retrievers.test.d.ts +0 -2
  204. package/lib/test/unit/retrieve/retrievers.test.d.ts.map +0 -1
  205. package/lib/test/unit/retrieve/retrievers.test.js +0 -770
  206. package/lib/test/unit/retrieve/retrievers.test.js.map +0 -1
  207. package/lib/test/unit/retrieve/temporalRetrievers.test.d.ts +0 -2
  208. package/lib/test/unit/retrieve/temporalRetrievers.test.d.ts.map +0 -1
  209. package/lib/test/unit/retrieve/temporalRetrievers.test.js +0 -184
  210. package/lib/test/unit/retrieve/temporalRetrievers.test.js.map +0 -1
  211. package/lib/test/unit/store/antagonistTemporalBoundary.test.d.ts +0 -9
  212. package/lib/test/unit/store/antagonistTemporalBoundary.test.d.ts.map +0 -1
  213. package/lib/test/unit/store/antagonistTemporalBoundary.test.js +0 -122
  214. package/lib/test/unit/store/antagonistTemporalBoundary.test.js.map +0 -1
  215. package/lib/test/unit/store/embedOnWrite.test.d.ts +0 -2
  216. package/lib/test/unit/store/embedOnWrite.test.d.ts.map +0 -1
  217. package/lib/test/unit/store/embedOnWrite.test.js +0 -319
  218. package/lib/test/unit/store/embedOnWrite.test.js.map +0 -1
  219. package/lib/test/unit/store/fileTreeMemoryStore.test.d.ts +0 -2
  220. package/lib/test/unit/store/fileTreeMemoryStore.test.d.ts.map +0 -1
  221. package/lib/test/unit/store/fileTreeMemoryStore.test.js +0 -780
  222. package/lib/test/unit/store/fileTreeMemoryStore.test.js.map +0 -1
  223. package/lib/test/unit/store/fragmentEmbedOnWrite.test.d.ts +0 -2
  224. package/lib/test/unit/store/fragmentEmbedOnWrite.test.d.ts.map +0 -1
  225. package/lib/test/unit/store/fragmentEmbedOnWrite.test.js +0 -257
  226. package/lib/test/unit/store/fragmentEmbedOnWrite.test.js.map +0 -1
  227. package/lib/test/unit/store/indexInjection.test.d.ts +0 -2
  228. package/lib/test/unit/store/indexInjection.test.d.ts.map +0 -1
  229. package/lib/test/unit/store/indexInjection.test.js +0 -434
  230. package/lib/test/unit/store/indexInjection.test.js.map +0 -1
  231. package/lib/test/unit/store/lenientOpen.test.d.ts +0 -2
  232. package/lib/test/unit/store/lenientOpen.test.d.ts.map +0 -1
  233. package/lib/test/unit/store/lenientOpen.test.js +0 -250
  234. package/lib/test/unit/store/lenientOpen.test.js.map +0 -1
  235. package/lib/test/unit/store/listScoped.test.d.ts +0 -2
  236. package/lib/test/unit/store/listScoped.test.d.ts.map +0 -1
  237. package/lib/test/unit/store/listScoped.test.js +0 -111
  238. package/lib/test/unit/store/listScoped.test.js.map +0 -1
  239. package/lib/test/unit/store/observations.test.d.ts +0 -2
  240. package/lib/test/unit/store/observations.test.d.ts.map +0 -1
  241. package/lib/test/unit/store/observations.test.js +0 -241
  242. package/lib/test/unit/store/observations.test.js.map +0 -1
  243. package/lib/test/unit/store/rankAxis.test.d.ts +0 -2
  244. package/lib/test/unit/store/rankAxis.test.d.ts.map +0 -1
  245. package/lib/test/unit/store/rankAxis.test.js +0 -256
  246. package/lib/test/unit/store/rankAxis.test.js.map +0 -1
  247. package/lib/test/unit/store/scopeEncoding.test.d.ts +0 -2
  248. package/lib/test/unit/store/scopeEncoding.test.d.ts.map +0 -1
  249. package/lib/test/unit/store/scopeEncoding.test.js +0 -26
  250. package/lib/test/unit/store/scopeEncoding.test.js.map +0 -1
  251. package/lib/test/unit/store/temporalStore.test.d.ts +0 -2
  252. package/lib/test/unit/store/temporalStore.test.d.ts.map +0 -1
  253. package/lib/test/unit/store/temporalStore.test.js +0 -400
  254. package/lib/test/unit/store/temporalStore.test.js.map +0 -1
  255. package/lib/test/unit/tools/memoryTools.test.d.ts +0 -2
  256. package/lib/test/unit/tools/memoryTools.test.d.ts.map +0 -1
  257. package/lib/test/unit/tools/memoryTools.test.js +0 -844
  258. package/lib/test/unit/tools/memoryTools.test.js.map +0 -1
  259. package/lib/test/unit/types/identityCodec.test.d.ts +0 -2
  260. package/lib/test/unit/types/identityCodec.test.d.ts.map +0 -1
  261. package/lib/test/unit/types/identityCodec.test.js +0 -189
  262. package/lib/test/unit/types/identityCodec.test.js.map +0 -1
  263. package/lib/test/unit/types/ids.test.d.ts +0 -2
  264. package/lib/test/unit/types/ids.test.d.ts.map +0 -1
  265. package/lib/test/unit/types/ids.test.js +0 -86
  266. package/lib/test/unit/types/ids.test.js.map +0 -1
  267. package/lib/test/unit/types/temporalCodec.test.d.ts +0 -2
  268. package/lib/test/unit/types/temporalCodec.test.d.ts.map +0 -1
  269. package/lib/test/unit/types/temporalCodec.test.js +0 -205
  270. package/lib/test/unit/types/temporalCodec.test.js.map +0 -1
  271. package/lib/test/unit/types/temporalPolicy.test.d.ts +0 -2
  272. package/lib/test/unit/types/temporalPolicy.test.d.ts.map +0 -1
  273. package/lib/test/unit/types/temporalPolicy.test.js +0 -85
  274. package/lib/test/unit/types/temporalPolicy.test.js.map +0 -1
  275. package/lib/test/unit/types/writePolicy.test.d.ts +0 -2
  276. package/lib/test/unit/types/writePolicy.test.d.ts.map +0 -1
  277. package/lib/test/unit/types/writePolicy.test.js +0 -333
  278. package/lib/test/unit/types/writePolicy.test.js.map +0 -1
  279. package/lib/test/unit/vector/fragmentConverters.test.d.ts +0 -2
  280. package/lib/test/unit/vector/fragmentConverters.test.d.ts.map +0 -1
  281. package/lib/test/unit/vector/fragmentConverters.test.js +0 -60
  282. package/lib/test/unit/vector/fragmentConverters.test.js.map +0 -1
  283. package/lib/test/unit/vector/inMemoryCosineIndex.test.d.ts +0 -2
  284. package/lib/test/unit/vector/inMemoryCosineIndex.test.d.ts.map +0 -1
  285. package/lib/test/unit/vector/inMemoryCosineIndex.test.js +0 -254
  286. package/lib/test/unit/vector/inMemoryCosineIndex.test.js.map +0 -1
  287. package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.d.ts +0 -2
  288. package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.d.ts.map +0 -1
  289. package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.js +0 -364
  290. package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.js.map +0 -1
  291. package/lib/test/unit/vector/vectorIndex.test.d.ts +0 -2
  292. package/lib/test/unit/vector/vectorIndex.test.d.ts.map +0 -1
  293. package/lib/test/unit/vector/vectorIndex.test.js +0 -53
  294. package/lib/test/unit/vector/vectorIndex.test.js.map +0 -1
  295. package/rush-logs/ts-agent-memory.build.cache.log +0 -3
  296. package/rush-logs/ts-agent-memory.build.log +0 -9
  297. package/src/index.ts +0 -14
  298. package/src/packlets/converters/bodyConverterRegistry.ts +0 -105
  299. package/src/packlets/converters/envelopeConverter.ts +0 -233
  300. package/src/packlets/converters/index.ts +0 -7
  301. package/src/packlets/index/index.ts +0 -6
  302. package/src/packlets/index/memoryIndex.ts +0 -332
  303. package/src/packlets/ingest/cycleGuard.ts +0 -153
  304. package/src/packlets/ingest/hostStages.ts +0 -111
  305. package/src/packlets/ingest/index.ts +0 -9
  306. package/src/packlets/ingest/model.ts +0 -195
  307. package/src/packlets/ingest/orchestrator.ts +0 -968
  308. package/src/packlets/observe/index.ts +0 -7
  309. package/src/packlets/observe/memoryObservationStore.ts +0 -153
  310. package/src/packlets/observe/observer.ts +0 -119
  311. package/src/packlets/retrieve/fragmentSemanticRetriever.ts +0 -138
  312. package/src/packlets/retrieve/hybridRetriever.ts +0 -194
  313. package/src/packlets/retrieve/index.ts +0 -14
  314. package/src/packlets/retrieve/linkTraversalRetriever.ts +0 -158
  315. package/src/packlets/retrieve/recencyRetriever.ts +0 -54
  316. package/src/packlets/retrieve/retriever.ts +0 -291
  317. package/src/packlets/retrieve/semanticRetriever.ts +0 -152
  318. package/src/packlets/retrieve/structuredFilterRetriever.ts +0 -58
  319. package/src/packlets/retrieve/tagRetriever.ts +0 -58
  320. package/src/packlets/retrieve/temporalRetrievers.ts +0 -210
  321. package/src/packlets/store/fileTreeMemoryStore.ts +0 -1872
  322. package/src/packlets/store/index.ts +0 -7
  323. package/src/packlets/store/scopeEncoding.ts +0 -36
  324. package/src/packlets/tools/index.ts +0 -6
  325. package/src/packlets/tools/memoryTools.ts +0 -706
  326. package/src/packlets/types/envelope.ts +0 -196
  327. package/src/packlets/types/filenameSafety.ts +0 -57
  328. package/src/packlets/types/identityCodec.ts +0 -447
  329. package/src/packlets/types/ids.ts +0 -124
  330. package/src/packlets/types/index.ts +0 -11
  331. package/src/packlets/types/temporal.ts +0 -96
  332. package/src/packlets/types/writePolicy.ts +0 -612
  333. package/src/packlets/vector/fragmentConverters.ts +0 -55
  334. package/src/packlets/vector/inMemoryCosineIndex.ts +0 -196
  335. package/src/packlets/vector/inMemoryFragmentCosineIndex.ts +0 -289
  336. package/src/packlets/vector/index.ts +0 -9
  337. package/src/packlets/vector/vectorIndex.ts +0 -273
  338. package/src/test/unit/converters/antagonistRoundTrip.test.ts +0 -110
  339. package/src/test/unit/converters/bodyConverterRegistry.test.ts +0 -89
  340. package/src/test/unit/converters/envelopeConverter.test.ts +0 -418
  341. package/src/test/unit/index/memoryIndex.test.ts +0 -272
  342. package/src/test/unit/ingest/antagonistCycleAndParity.test.ts +0 -367
  343. package/src/test/unit/ingest/cycleGuard.test.ts +0 -110
  344. package/src/test/unit/ingest/dedupScope.test.ts +0 -542
  345. package/src/test/unit/ingest/orchestrator.test.ts +0 -1355
  346. package/src/test/unit/observe/memoryObservationStore.test.ts +0 -158
  347. package/src/test/unit/retrieve/fragmentSemanticRetriever.test.ts +0 -163
  348. package/src/test/unit/retrieve/linkTraversalRetriever.test.ts +0 -329
  349. package/src/test/unit/retrieve/retrievers.test.ts +0 -1018
  350. package/src/test/unit/retrieve/temporalRetrievers.test.ts +0 -226
  351. package/src/test/unit/store/antagonistTemporalBoundary.test.ts +0 -158
  352. package/src/test/unit/store/embedOnWrite.test.ts +0 -418
  353. package/src/test/unit/store/fileTreeMemoryStore.test.ts +0 -1041
  354. package/src/test/unit/store/fragmentEmbedOnWrite.test.ts +0 -349
  355. package/src/test/unit/store/indexInjection.test.ts +0 -550
  356. package/src/test/unit/store/lenientOpen.test.ts +0 -292
  357. package/src/test/unit/store/listScoped.test.ts +0 -138
  358. package/src/test/unit/store/observations.test.ts +0 -290
  359. package/src/test/unit/store/rankAxis.test.ts +0 -349
  360. package/src/test/unit/store/scopeEncoding.test.ts +0 -37
  361. package/src/test/unit/store/temporalStore.test.ts +0 -469
  362. package/src/test/unit/tools/memoryTools.test.ts +0 -1121
  363. package/src/test/unit/types/identityCodec.test.ts +0 -266
  364. package/src/test/unit/types/ids.test.ts +0 -94
  365. package/src/test/unit/types/temporalCodec.test.ts +0 -259
  366. package/src/test/unit/types/temporalPolicy.test.ts +0 -124
  367. package/src/test/unit/types/writePolicy.test.ts +0 -446
  368. package/src/test/unit/vector/fragmentConverters.test.ts +0 -80
  369. package/src/test/unit/vector/inMemoryCosineIndex.test.ts +0 -318
  370. package/src/test/unit/vector/inMemoryFragmentCosineIndex.test.ts +0 -477
  371. package/src/test/unit/vector/vectorIndex.test.ts +0 -64
  372. package/temp/build/lint/_eslint-5eVG3S6w.json +0 -306
  373. package/temp/build/typescript/ts_8nwakTlr.json +0 -1
  374. package/temp/ts-agent-memory.api.json +0 -21030
  375. package/temp/ts-agent-memory.api.md +0 -940
  376. package/tsconfig.json +0 -8
@@ -1,259 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2026 Erik Fortune
4
- * SPDX-License-Identifier: MIT
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- require("@fgv/ts-utils-jest");
8
- const index_1 = require("../../../index");
9
- const DEFAULT_SCOPE = 'experience';
10
- /** A scope-qualified traversal seed (defaults to the fixture's default scope). */
11
- function seed(id, scope = DEFAULT_SCOPE) {
12
- return { scope: scope, id: id };
13
- }
14
- function makeEntry(spec) {
15
- var _a, _b, _c, _d, _e, _f;
16
- const scope = (_a = spec.scope) !== null && _a !== void 0 ? _a : DEFAULT_SCOPE;
17
- const record = {
18
- envelope: index_1.envelopeConverter
19
- .convert(Object.assign(Object.assign({ id: spec.id, entityId: spec.id, kind: (_b = spec.kind) !== null && _b !== void 0 ? _b : 'experience', tags: (_c = spec.tags) !== null && _c !== void 0 ? _c : [],
20
- // A bare link id defaults its target scope to the source record's own
21
- // scope (the same-conversation case); an object carries an explicit scope.
22
- links: ((_d = spec.links) !== null && _d !== void 0 ? _d : []).map((l) => typeof l === 'string'
23
- ? { type: 'rel', target: { scope, id: l } }
24
- : { type: 'rel', target: { scope: l.scope, id: l.id } }), created: 0, updated: (_e = spec.updated) !== null && _e !== void 0 ? _e : 0, seq: (_f = spec.seq) !== null && _f !== void 0 ? _f : 0, contentHash: 'h' }, (spec.rank !== undefined ? { rank: spec.rank } : {})), { provenance: { source: 'agent' } }))
25
- .orThrow(),
26
- body: `body-${spec.id}`
27
- };
28
- return { scope: scope, record };
29
- }
30
- function buildIndex(specs) {
31
- const index = index_1.MemoryIndex.create().orThrow();
32
- index.rebuild(specs.map(makeEntry)).orThrow();
33
- return index;
34
- }
35
- function ids(records) {
36
- return records.map((r) => r.envelope.id);
37
- }
38
- describe('LinkTraversalRetriever', () => {
39
- test('reports the link-traversal capability', () => {
40
- const index = buildIndex([]);
41
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
42
- expect(retriever.capabilities).toEqual({
43
- supportsSemanticRecall: false,
44
- supportsTemporalQuery: false,
45
- supportsLinkTraversal: true
46
- });
47
- });
48
- describe('outbound traversal (linkedFrom)', () => {
49
- test('returns the direct outbound neighbors at the default single hop', async () => {
50
- const index = buildIndex([
51
- { id: 'a', links: ['b', 'c'] },
52
- { id: 'b', updated: 20 },
53
- { id: 'c', updated: 10 }
54
- ]);
55
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
56
- expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {
57
- // Recency-ordered: b (updated 20) before c (updated 10). 'a' (the seed) excluded.
58
- expect(ids(records)).toEqual(['b', 'c']);
59
- });
60
- });
61
- test('stops at the default single hop (does not reach 2-hop neighbors)', async () => {
62
- const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b', links: ['c'] }, { id: 'c' }]);
63
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
64
- expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {
65
- expect(ids(records)).toEqual(['b']);
66
- });
67
- });
68
- test('follows multiple hops when hops is raised', async () => {
69
- const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b', links: ['c'] }, { id: 'c' }]);
70
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
71
- expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 2 })).toSucceedAndSatisfy((records) => {
72
- expect(ids(records).sort()).toEqual(['b', 'c']);
73
- });
74
- });
75
- });
76
- describe('orderBy axis', () => {
77
- function seedIndex() {
78
- // Seed 'a' links to three ranked neighbors. `rank` and `updated` are
79
- // deliberately INVERTED so the rank order (n3,n2,n1) is the exact reverse of
80
- // the recency order (n1,n2,n3) — proving orderBy actually re-sorts.
81
- return buildIndex([
82
- { id: 'a', links: ['n1', 'n3', 'n2'] },
83
- { id: 'n1', rank: 1, updated: 300, seq: 1 },
84
- { id: 'n3', rank: 3, updated: 100, seq: 3 },
85
- { id: 'n2', rank: 2, updated: 200, seq: 2 }
86
- ]);
87
- }
88
- test("orderBy 'rank' orders reached records by rank descending", async () => {
89
- const retriever = index_1.LinkTraversalRetriever.create(seedIndex()).orThrow();
90
- expect(await retriever.retrieve({ linkedFrom: seed('a'), orderBy: 'rank' })).toSucceedAndSatisfy((records) => {
91
- expect(ids(records)).toEqual(['n3', 'n2', 'n1']);
92
- });
93
- });
94
- test('orderBy absent is unchanged recency order', async () => {
95
- const retriever = index_1.LinkTraversalRetriever.create(seedIndex()).orThrow();
96
- expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {
97
- // Recency: most-recently-updated first → n1(300), n2(200), n3(100).
98
- expect(ids(records)).toEqual(['n1', 'n2', 'n3']);
99
- });
100
- });
101
- test("orderBy 'rank' composes with { limit, offset }", async () => {
102
- const retriever = index_1.LinkTraversalRetriever.create(seedIndex()).orThrow();
103
- expect(await retriever.retrieve({ linkedFrom: seed('a'), orderBy: 'rank', limit: 1, offset: 1 })).toSucceedAndSatisfy((records) => {
104
- expect(ids(records)).toEqual(['n2']);
105
- });
106
- });
107
- });
108
- describe('inbound traversal (linkedTo)', () => {
109
- test('returns the records whose edges point at the seed (backlinks)', async () => {
110
- const index = buildIndex([
111
- { id: 'a', links: ['target'], updated: 30 },
112
- { id: 'b', links: ['target'], updated: 10 },
113
- { id: 'target' }
114
- ]);
115
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
116
- expect(await retriever.retrieve({ linkedTo: seed('target') })).toSucceedAndSatisfy((records) => {
117
- expect(ids(records)).toEqual(['a', 'b']);
118
- });
119
- });
120
- test('reaches ONLY the same-scope inbound source when a TARGET stem is reused across scopes', async () => {
121
- // 'shared' exists in scope a and scope b; src-a@a links {a, shared} and
122
- // src-b@b links {b, shared}. Seeding linkedTo {a, shared} must reach ONLY
123
- // src-a — backlinks disambiguate on the target's (scope, id), not a bare id.
124
- const index = buildIndex([
125
- { id: 'src-a', scope: 'a', links: ['shared'], tags: ['src-a'] },
126
- { id: 'src-b', scope: 'b', links: ['shared'], tags: ['src-b'] },
127
- { id: 'shared', scope: 'a' },
128
- { id: 'shared', scope: 'b' }
129
- ]);
130
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
131
- expect(await retriever.retrieve({ linkedTo: seed('shared', 'a') })).toSucceedAndSatisfy((records) => {
132
- expect(records).toHaveLength(1);
133
- expect(records[0].envelope.tags).toEqual(['src-a']);
134
- });
135
- // Symmetric: seeding the b-scope target reaches only src-b.
136
- expect(await retriever.retrieve({ linkedTo: seed('shared', 'b') })).toSucceedAndSatisfy((records) => {
137
- expect(records).toHaveLength(1);
138
- expect(records[0].envelope.tags).toEqual(['src-b']);
139
- });
140
- });
141
- });
142
- describe('cycle safety', () => {
143
- test('terminates on a self-loop and excludes the seed', async () => {
144
- const index = buildIndex([{ id: 'a', links: ['a'] }]);
145
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
146
- expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 5 })).toSucceedAndSatisfy((records) => {
147
- expect(records).toHaveLength(0);
148
- });
149
- });
150
- test('terminates on a multi-hop cycle without revisiting', async () => {
151
- const index = buildIndex([
152
- { id: 'a', links: ['b'] },
153
- { id: 'b', links: ['c'] },
154
- { id: 'c', links: ['a'] }
155
- ]);
156
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
157
- expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 10 })).toSucceedAndSatisfy((records) => {
158
- // a→b→c→a: reaches b and c, then the edge back to the seed is pruned.
159
- expect(ids(records).sort()).toEqual(['b', 'c']);
160
- });
161
- });
162
- });
163
- test('traverses a cross-kind edge (experience derivedFrom a knowledge doc)', async () => {
164
- const index = buildIndex([
165
- {
166
- id: 'turn-5',
167
- scope: 'conversations/conv-1',
168
- kind: 'summarized-turn',
169
- links: [{ id: 'doc-1', scope: 'knowledge' }]
170
- },
171
- { id: 'doc-1', scope: 'knowledge', kind: 'knowledge' }
172
- ]);
173
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
174
- expect(await retriever.retrieve({ linkedFrom: seed('turn-5', 'conversations/conv-1') })).toSucceedAndSatisfy((records) => {
175
- expect(ids(records)).toEqual(['doc-1']);
176
- expect(records[0].envelope.kind).toBe('knowledge');
177
- });
178
- });
179
- describe('post-filtering and bounds', () => {
180
- test('applies the kind pre-filter to the reached records', async () => {
181
- const index = buildIndex([
182
- { id: 'a', links: ['b', 'c'] },
183
- { id: 'b', kind: 'keep' },
184
- { id: 'c', kind: 'drop' }
185
- ]);
186
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
187
- expect(await retriever.retrieve({ linkedFrom: seed('a'), kind: 'keep' })).toSucceedAndSatisfy((records) => {
188
- expect(ids(records)).toEqual(['b']);
189
- });
190
- });
191
- test('applies the limit after ordering', async () => {
192
- const index = buildIndex([
193
- { id: 'a', links: ['b', 'c', 'd'] },
194
- { id: 'b', updated: 30 },
195
- { id: 'c', updated: 20 },
196
- { id: 'd', updated: 10 }
197
- ]);
198
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
199
- expect(await retriever.retrieve({ linkedFrom: seed('a'), limit: 2 })).toSucceedAndSatisfy((records) => {
200
- expect(ids(records)).toEqual(['b', 'c']);
201
- });
202
- });
203
- test('returns empty when the seed is not in the index', async () => {
204
- const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b' }]);
205
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
206
- expect(await retriever.retrieve({ linkedFrom: seed('missing') })).toSucceedWith([]);
207
- });
208
- test('reaches ONLY the same-scope target when an id is reused across scopes', async () => {
209
- // 'seed' (scope a) links a bare 'dup' → the edge target is {scope a, id dup}.
210
- // Two records share the stem 'dup' (scopes a and b); the scoped edge must
211
- // reach ONLY dup@a, never dup@b — the whole point of scope-qualified targets.
212
- const index = buildIndex([
213
- { id: 'seed', scope: 'a', links: ['dup'] },
214
- { id: 'dup', scope: 'a', tags: ['in-a'] },
215
- { id: 'dup', scope: 'b', tags: ['in-b'] }
216
- ]);
217
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
218
- expect(await retriever.retrieve({ linkedFrom: seed('seed', 'a') })).toSucceedAndSatisfy((records) => {
219
- expect(records).toHaveLength(1);
220
- expect(records[0].envelope.tags).toEqual(['in-a']);
221
- });
222
- });
223
- test('an explicit cross-scope edge reaches the other scope', async () => {
224
- // The same fixture, but the edge names dup@b explicitly → traversal follows
225
- // it to the b-scope record, proving explicit scope is honored verbatim.
226
- const index = buildIndex([
227
- { id: 'seed', scope: 'a', links: [{ id: 'dup', scope: 'b' }] },
228
- { id: 'dup', scope: 'a', tags: ['in-a'] },
229
- { id: 'dup', scope: 'b', tags: ['in-b'] }
230
- ]);
231
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
232
- expect(await retriever.retrieve({ linkedFrom: seed('seed', 'a') })).toSucceedAndSatisfy((records) => {
233
- expect(records).toHaveLength(1);
234
- expect(records[0].envelope.tags).toEqual(['in-b']);
235
- });
236
- });
237
- });
238
- describe('loud degradation', () => {
239
- test('fails when no seed (linkedFrom / linkedTo) is supplied', async () => {
240
- const index = buildIndex([{ id: 'a' }]);
241
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
242
- expect(await retriever.retrieve({ hops: 2 })).toFailWith(index_1.LINK_TRAVERSAL_NO_SEED_MESSAGE);
243
- });
244
- });
245
- });
246
- describe('LINK_TRAVERSAL_UNWIRED_MESSAGE constant', () => {
247
- test('has the stable public message non-link retrievers use to degrade loudly', () => {
248
- // The link-traversal retriever supports the axis, so it never emits this
249
- // message; the constant is the shared one the non-link v1 retrievers raise
250
- // (asserted here to keep the public string stable).
251
- expect(index_1.LINK_TRAVERSAL_UNWIRED_MESSAGE).toMatch(/link traversal requires a backlink index/i);
252
- });
253
- test('a link query against the link-capable retriever still succeeds', async () => {
254
- const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b' }]);
255
- const retriever = index_1.LinkTraversalRetriever.create(index).orThrow();
256
- expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceed();
257
- });
258
- });
259
- //# sourceMappingURL=linkTraversalRetriever.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"linkTraversalRetriever.test.js","sourceRoot":"","sources":["../../../../src/test/unit/retrieve/linkTraversalRetriever.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,8BAA4B;AAC5B,0CAYwB;AAExB,MAAM,aAAa,GAAW,YAAY,CAAC;AAgB3C,kFAAkF;AAClF,SAAS,IAAI,CAAC,EAAU,EAAE,QAAgB,aAAa;IACrD,OAAO,EAAE,KAAK,EAAE,KAAuB,EAAE,EAAE,EAAE,EAAc,EAAE,CAAC;AAChE,CAAC;AAED,SAAS,SAAS,CAAC,IAAgB;;IACjC,MAAM,KAAK,GAAW,MAAA,IAAI,CAAC,KAAK,mCAAI,aAAa,CAAC;IAClD,MAAM,MAAM,GAA2B;QACrC,QAAQ,EAAE,yBAAiB;aACxB,OAAO,+BACN,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,QAAQ,EAAE,IAAI,CAAC,EAAE,EACjB,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,mC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;YACxC,MAAM,SAAS,GAAG,8BAAsB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;YACjE,MAAM,CAAC,MAAM,SAAS,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,sCAA8B,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACvD,IAAI,CAAC,yEAAyE,EAAE,GAAG,EAAE;QACnF,yEAAyE;QACzE,2EAA2E;QAC3E,oDAAoD;QACpD,MAAM,CAAC,sCAA8B,CAAC,CAAC,OAAO,CAAC,2CAA2C,CAAC,CAAC;IAC9F,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;QAChF,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACnE,MAAM,SAAS,GAAG,8BAAsB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QACjE,MAAM,CAAC,MAAM,SAAS,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2026 Erik Fortune\n * SPDX-License-Identifier: MIT\n */\n\nimport '@fgv/ts-utils-jest';\nimport {\n IEdgeTarget,\n IIndexedMemoryRecord,\n IMemoryRecord,\n Kind,\n LinkTraversalRetriever,\n LINK_TRAVERSAL_NO_SEED_MESSAGE,\n LINK_TRAVERSAL_UNWIRED_MESSAGE,\n MemoryId,\n MemoryIndex,\n MemoryScopeKey,\n envelopeConverter\n} from '../../../index';\n\nconst DEFAULT_SCOPE: string = 'experience';\n\n/** A link target authored either as a bare id (same-scope) or an explicit `(scope, id)`. */\ntype LinkSpec = string | { readonly id: string; readonly scope: string };\n\ninterface IEntrySpec {\n readonly id: string;\n readonly scope?: string;\n readonly kind?: string;\n readonly tags?: ReadonlyArray<string>;\n readonly updated?: number;\n readonly seq?: number;\n readonly links?: ReadonlyArray<LinkSpec>;\n readonly rank?: number;\n}\n\n/** A scope-qualified traversal seed (defaults to the fixture's default scope). */\nfunction seed(id: string, scope: string = DEFAULT_SCOPE): IEdgeTarget {\n return { scope: scope as MemoryScopeKey, id: id as MemoryId };\n}\n\nfunction makeEntry(spec: IEntrySpec): IIndexedMemoryRecord {\n const scope: string = spec.scope ?? DEFAULT_SCOPE;\n const record: IMemoryRecord<unknown> = {\n envelope: envelopeConverter\n .convert({\n id: spec.id,\n entityId: spec.id,\n kind: spec.kind ?? 'experience',\n tags: spec.tags ?? [],\n // A bare link id defaults its target scope to the source record's own\n // scope (the same-conversation case); an object carries an explicit scope.\n links: (spec.links ?? []).map((l) =>\n typeof l === 'string'\n ? { type: 'rel', target: { scope, id: l } }\n : { type: 'rel', target: { scope: l.scope, id: l.id } }\n ),\n created: 0,\n updated: spec.updated ?? 0,\n seq: spec.seq ?? 0,\n contentHash: 'h',\n ...(spec.rank !== undefined ? { rank: spec.rank } : {}),\n provenance: { source: 'agent' }\n })\n .orThrow(),\n body: `body-${spec.id}`\n };\n return { scope: scope as MemoryScopeKey, record };\n}\n\nfunction buildIndex(specs: ReadonlyArray<IEntrySpec>): MemoryIndex {\n const index = MemoryIndex.create().orThrow();\n index.rebuild(specs.map(makeEntry)).orThrow();\n return index;\n}\n\nfunction ids(records: ReadonlyArray<IMemoryRecord<unknown>>): string[] {\n return records.map((r) => r.envelope.id as string);\n}\n\ndescribe('LinkTraversalRetriever', () => {\n test('reports the link-traversal capability', () => {\n const index = buildIndex([]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(retriever.capabilities).toEqual({\n supportsSemanticRecall: false,\n supportsTemporalQuery: false,\n supportsLinkTraversal: true\n });\n });\n\n describe('outbound traversal (linkedFrom)', () => {\n test('returns the direct outbound neighbors at the default single hop', async () => {\n const index = buildIndex([\n { id: 'a', links: ['b', 'c'] },\n { id: 'b', updated: 20 },\n { id: 'c', updated: 10 }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {\n // Recency-ordered: b (updated 20) before c (updated 10). 'a' (the seed) excluded.\n expect(ids(records)).toEqual(['b', 'c']);\n });\n });\n\n test('stops at the default single hop (does not reach 2-hop neighbors)', async () => {\n const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b', links: ['c'] }, { id: 'c' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['b']);\n });\n });\n\n test('follows multiple hops when hops is raised', async () => {\n const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b', links: ['c'] }, { id: 'c' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 2 })).toSucceedAndSatisfy((records) => {\n expect(ids(records).sort()).toEqual(['b', 'c']);\n });\n });\n });\n\n describe('orderBy axis', () => {\n function seedIndex(): MemoryIndex {\n // Seed 'a' links to three ranked neighbors. `rank` and `updated` are\n // deliberately INVERTED so the rank order (n3,n2,n1) is the exact reverse of\n // the recency order (n1,n2,n3) — proving orderBy actually re-sorts.\n return buildIndex([\n { id: 'a', links: ['n1', 'n3', 'n2'] },\n { id: 'n1', rank: 1, updated: 300, seq: 1 },\n { id: 'n3', rank: 3, updated: 100, seq: 3 },\n { id: 'n2', rank: 2, updated: 200, seq: 2 }\n ]);\n }\n\n test(\"orderBy 'rank' orders reached records by rank descending\", async () => {\n const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), orderBy: 'rank' })).toSucceedAndSatisfy(\n (records) => {\n expect(ids(records)).toEqual(['n3', 'n2', 'n1']);\n }\n );\n });\n\n test('orderBy absent is unchanged recency order', async () => {\n const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceedAndSatisfy((records) => {\n // Recency: most-recently-updated first → n1(300), n2(200), n3(100).\n expect(ids(records)).toEqual(['n1', 'n2', 'n3']);\n });\n });\n\n test(\"orderBy 'rank' composes with { limit, offset }\", async () => {\n const retriever = LinkTraversalRetriever.create(seedIndex()).orThrow();\n expect(\n await retriever.retrieve({ linkedFrom: seed('a'), orderBy: 'rank', limit: 1, offset: 1 })\n ).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['n2']);\n });\n });\n });\n\n describe('inbound traversal (linkedTo)', () => {\n test('returns the records whose edges point at the seed (backlinks)', async () => {\n const index = buildIndex([\n { id: 'a', links: ['target'], updated: 30 },\n { id: 'b', links: ['target'], updated: 10 },\n { id: 'target' }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedTo: seed('target') })).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['a', 'b']);\n });\n });\n\n test('reaches ONLY the same-scope inbound source when a TARGET stem is reused across scopes', async () => {\n // 'shared' exists in scope a and scope b; src-a@a links {a, shared} and\n // src-b@b links {b, shared}. Seeding linkedTo {a, shared} must reach ONLY\n // src-a — backlinks disambiguate on the target's (scope, id), not a bare id.\n const index = buildIndex([\n { id: 'src-a', scope: 'a', links: ['shared'], tags: ['src-a'] },\n { id: 'src-b', scope: 'b', links: ['shared'], tags: ['src-b'] },\n { id: 'shared', scope: 'a' },\n { id: 'shared', scope: 'b' }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedTo: seed('shared', 'a') })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(1);\n expect(records[0].envelope.tags).toEqual(['src-a']);\n });\n // Symmetric: seeding the b-scope target reaches only src-b.\n expect(await retriever.retrieve({ linkedTo: seed('shared', 'b') })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(1);\n expect(records[0].envelope.tags).toEqual(['src-b']);\n });\n });\n });\n\n describe('cycle safety', () => {\n test('terminates on a self-loop and excludes the seed', async () => {\n const index = buildIndex([{ id: 'a', links: ['a'] }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 5 })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(0);\n });\n });\n\n test('terminates on a multi-hop cycle without revisiting', async () => {\n const index = buildIndex([\n { id: 'a', links: ['b'] },\n { id: 'b', links: ['c'] },\n { id: 'c', links: ['a'] }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), hops: 10 })).toSucceedAndSatisfy((records) => {\n // a→b→c→a: reaches b and c, then the edge back to the seed is pruned.\n expect(ids(records).sort()).toEqual(['b', 'c']);\n });\n });\n });\n\n test('traverses a cross-kind edge (experience derivedFrom a knowledge doc)', async () => {\n const index = buildIndex([\n {\n id: 'turn-5',\n scope: 'conversations/conv-1',\n kind: 'summarized-turn',\n links: [{ id: 'doc-1', scope: 'knowledge' }]\n },\n { id: 'doc-1', scope: 'knowledge', kind: 'knowledge' }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(\n await retriever.retrieve({ linkedFrom: seed('turn-5', 'conversations/conv-1') })\n ).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['doc-1']);\n expect(records[0].envelope.kind).toBe('knowledge');\n });\n });\n\n describe('post-filtering and bounds', () => {\n test('applies the kind pre-filter to the reached records', async () => {\n const index = buildIndex([\n { id: 'a', links: ['b', 'c'] },\n { id: 'b', kind: 'keep' },\n { id: 'c', kind: 'drop' }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(\n await retriever.retrieve({ linkedFrom: seed('a'), kind: 'keep' as unknown as Kind })\n ).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['b']);\n });\n });\n\n test('applies the limit after ordering', async () => {\n const index = buildIndex([\n { id: 'a', links: ['b', 'c', 'd'] },\n { id: 'b', updated: 30 },\n { id: 'c', updated: 20 },\n { id: 'd', updated: 10 }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a'), limit: 2 })).toSucceedAndSatisfy((records) => {\n expect(ids(records)).toEqual(['b', 'c']);\n });\n });\n\n test('returns empty when the seed is not in the index', async () => {\n const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('missing') })).toSucceedWith([]);\n });\n\n test('reaches ONLY the same-scope target when an id is reused across scopes', async () => {\n // 'seed' (scope a) links a bare 'dup' → the edge target is {scope a, id dup}.\n // Two records share the stem 'dup' (scopes a and b); the scoped edge must\n // reach ONLY dup@a, never dup@b — the whole point of scope-qualified targets.\n const index = buildIndex([\n { id: 'seed', scope: 'a', links: ['dup'] },\n { id: 'dup', scope: 'a', tags: ['in-a'] },\n { id: 'dup', scope: 'b', tags: ['in-b'] }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('seed', 'a') })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(1);\n expect(records[0].envelope.tags).toEqual(['in-a']);\n });\n });\n\n test('an explicit cross-scope edge reaches the other scope', async () => {\n // The same fixture, but the edge names dup@b explicitly → traversal follows\n // it to the b-scope record, proving explicit scope is honored verbatim.\n const index = buildIndex([\n { id: 'seed', scope: 'a', links: [{ id: 'dup', scope: 'b' }] },\n { id: 'dup', scope: 'a', tags: ['in-a'] },\n { id: 'dup', scope: 'b', tags: ['in-b'] }\n ]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('seed', 'a') })).toSucceedAndSatisfy((records) => {\n expect(records).toHaveLength(1);\n expect(records[0].envelope.tags).toEqual(['in-b']);\n });\n });\n });\n\n describe('loud degradation', () => {\n test('fails when no seed (linkedFrom / linkedTo) is supplied', async () => {\n const index = buildIndex([{ id: 'a' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ hops: 2 })).toFailWith(LINK_TRAVERSAL_NO_SEED_MESSAGE);\n });\n });\n});\n\ndescribe('LINK_TRAVERSAL_UNWIRED_MESSAGE constant', () => {\n test('has the stable public message non-link retrievers use to degrade loudly', () => {\n // The link-traversal retriever supports the axis, so it never emits this\n // message; the constant is the shared one the non-link v1 retrievers raise\n // (asserted here to keep the public string stable).\n expect(LINK_TRAVERSAL_UNWIRED_MESSAGE).toMatch(/link traversal requires a backlink index/i);\n });\n\n test('a link query against the link-capable retriever still succeeds', async () => {\n const index = buildIndex([{ id: 'a', links: ['b'] }, { id: 'b' }]);\n const retriever = LinkTraversalRetriever.create(index).orThrow();\n expect(await retriever.retrieve({ linkedFrom: seed('a') })).toSucceed();\n });\n});\n"]}
@@ -1,2 +0,0 @@
1
- import '@fgv/ts-utils-jest';
2
- //# sourceMappingURL=retrievers.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retrievers.test.d.ts","sourceRoot":"","sources":["../../../../src/test/unit/retrieve/retrievers.test.ts"],"names":[],"mappings":"AAKA,OAAO,oBAAoB,CAAC"}