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

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 (341) 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/store/fileTreeMemoryStore.js +52 -131
  7. package/dist/packlets/store/fileTreeMemoryStore.js.map +1 -1
  8. package/dist/packlets/store/vectorMaintenance.js +251 -0
  9. package/dist/packlets/store/vectorMaintenance.js.map +1 -0
  10. package/dist/packlets/vector/inMemoryCosineIndex.js +81 -18
  11. package/dist/packlets/vector/inMemoryCosineIndex.js.map +1 -1
  12. package/dist/packlets/vector/inMemoryFragmentCosineIndex.js +7 -0
  13. package/dist/packlets/vector/inMemoryFragmentCosineIndex.js.map +1 -1
  14. package/dist/packlets/vector/vectorIndex.js.map +1 -1
  15. package/dist/ts-agent-memory.d.ts +297 -66
  16. package/lib/packlets/ingest/orchestrator.d.ts.map +1 -1
  17. package/lib/packlets/ingest/orchestrator.js +11 -1
  18. package/lib/packlets/ingest/orchestrator.js.map +1 -1
  19. package/lib/packlets/observe/memoryObservationStore.d.ts.map +1 -1
  20. package/lib/packlets/observe/memoryObservationStore.js +6 -0
  21. package/lib/packlets/observe/memoryObservationStore.js.map +1 -1
  22. package/lib/packlets/observe/observer.d.ts +61 -0
  23. package/lib/packlets/observe/observer.d.ts.map +1 -1
  24. package/lib/packlets/observe/observer.js.map +1 -1
  25. package/lib/packlets/store/fileTreeMemoryStore.d.ts +66 -59
  26. package/lib/packlets/store/fileTreeMemoryStore.d.ts.map +1 -1
  27. package/lib/packlets/store/fileTreeMemoryStore.js +52 -131
  28. package/lib/packlets/store/fileTreeMemoryStore.js.map +1 -1
  29. package/lib/packlets/store/vectorMaintenance.d.ts +149 -0
  30. package/lib/packlets/store/vectorMaintenance.d.ts.map +1 -0
  31. package/lib/packlets/store/vectorMaintenance.js +255 -0
  32. package/lib/packlets/store/vectorMaintenance.js.map +1 -0
  33. package/lib/packlets/vector/inMemoryCosineIndex.d.ts +30 -7
  34. package/lib/packlets/vector/inMemoryCosineIndex.d.ts.map +1 -1
  35. package/lib/packlets/vector/inMemoryCosineIndex.js +80 -17
  36. package/lib/packlets/vector/inMemoryCosineIndex.js.map +1 -1
  37. package/lib/packlets/vector/inMemoryFragmentCosineIndex.d.ts +7 -0
  38. package/lib/packlets/vector/inMemoryFragmentCosineIndex.d.ts.map +1 -1
  39. package/lib/packlets/vector/inMemoryFragmentCosineIndex.js +7 -0
  40. package/lib/packlets/vector/inMemoryFragmentCosineIndex.js.map +1 -1
  41. package/lib/packlets/vector/vectorIndex.d.ts +129 -1
  42. package/lib/packlets/vector/vectorIndex.d.ts.map +1 -1
  43. package/lib/packlets/vector/vectorIndex.js.map +1 -1
  44. package/package.json +17 -7
  45. package/.rush/temp/5667e36f1c0cc503a5c20a3ebff76e7b9a702d41.tar.log +0 -468
  46. package/.rush/temp/chunked-rush-logs/ts-agent-memory.build.chunks.jsonl +0 -9
  47. package/.rush/temp/operation/build/all.log +0 -9
  48. package/.rush/temp/operation/build/log-chunks.jsonl +0 -9
  49. package/.rush/temp/operation/build/state.json +0 -3
  50. package/.rush/temp/shrinkwrap-deps.json +0 -689
  51. package/config/api-extractor.json +0 -343
  52. package/config/jest.config.json +0 -14
  53. package/config/rig.json +0 -4
  54. package/dist/test/unit/converters/antagonistRoundTrip.test.js +0 -95
  55. package/dist/test/unit/converters/antagonistRoundTrip.test.js.map +0 -1
  56. package/dist/test/unit/converters/bodyConverterRegistry.test.js +0 -72
  57. package/dist/test/unit/converters/bodyConverterRegistry.test.js.map +0 -1
  58. package/dist/test/unit/converters/envelopeConverter.test.js +0 -313
  59. package/dist/test/unit/converters/envelopeConverter.test.js.map +0 -1
  60. package/dist/test/unit/index/memoryIndex.test.js +0 -214
  61. package/dist/test/unit/index/memoryIndex.test.js.map +0 -1
  62. package/dist/test/unit/ingest/antagonistCycleAndParity.test.js +0 -277
  63. package/dist/test/unit/ingest/antagonistCycleAndParity.test.js.map +0 -1
  64. package/dist/test/unit/ingest/cycleGuard.test.js +0 -81
  65. package/dist/test/unit/ingest/cycleGuard.test.js.map +0 -1
  66. package/dist/test/unit/ingest/dedupScope.test.js +0 -434
  67. package/dist/test/unit/ingest/dedupScope.test.js.map +0 -1
  68. package/dist/test/unit/ingest/orchestrator.test.js +0 -1058
  69. package/dist/test/unit/ingest/orchestrator.test.js.map +0 -1
  70. package/dist/test/unit/observe/memoryObservationStore.test.js +0 -118
  71. package/dist/test/unit/observe/memoryObservationStore.test.js.map +0 -1
  72. package/dist/test/unit/retrieve/fragmentSemanticRetriever.test.js +0 -116
  73. package/dist/test/unit/retrieve/fragmentSemanticRetriever.test.js.map +0 -1
  74. package/dist/test/unit/retrieve/linkTraversalRetriever.test.js +0 -257
  75. package/dist/test/unit/retrieve/linkTraversalRetriever.test.js.map +0 -1
  76. package/dist/test/unit/retrieve/retrievers.test.js +0 -768
  77. package/dist/test/unit/retrieve/retrievers.test.js.map +0 -1
  78. package/dist/test/unit/retrieve/temporalRetrievers.test.js +0 -182
  79. package/dist/test/unit/retrieve/temporalRetrievers.test.js.map +0 -1
  80. package/dist/test/unit/store/antagonistTemporalBoundary.test.js +0 -120
  81. package/dist/test/unit/store/antagonistTemporalBoundary.test.js.map +0 -1
  82. package/dist/test/unit/store/embedOnWrite.test.js +0 -317
  83. package/dist/test/unit/store/embedOnWrite.test.js.map +0 -1
  84. package/dist/test/unit/store/fileTreeMemoryStore.test.js +0 -778
  85. package/dist/test/unit/store/fileTreeMemoryStore.test.js.map +0 -1
  86. package/dist/test/unit/store/fragmentEmbedOnWrite.test.js +0 -255
  87. package/dist/test/unit/store/fragmentEmbedOnWrite.test.js.map +0 -1
  88. package/dist/test/unit/store/indexInjection.test.js +0 -432
  89. package/dist/test/unit/store/indexInjection.test.js.map +0 -1
  90. package/dist/test/unit/store/lenientOpen.test.js +0 -248
  91. package/dist/test/unit/store/lenientOpen.test.js.map +0 -1
  92. package/dist/test/unit/store/listScoped.test.js +0 -109
  93. package/dist/test/unit/store/listScoped.test.js.map +0 -1
  94. package/dist/test/unit/store/observations.test.js +0 -239
  95. package/dist/test/unit/store/observations.test.js.map +0 -1
  96. package/dist/test/unit/store/rankAxis.test.js +0 -254
  97. package/dist/test/unit/store/rankAxis.test.js.map +0 -1
  98. package/dist/test/unit/store/scopeEncoding.test.js +0 -24
  99. package/dist/test/unit/store/scopeEncoding.test.js.map +0 -1
  100. package/dist/test/unit/store/temporalStore.test.js +0 -398
  101. package/dist/test/unit/store/temporalStore.test.js.map +0 -1
  102. package/dist/test/unit/tools/memoryTools.test.js +0 -842
  103. package/dist/test/unit/tools/memoryTools.test.js.map +0 -1
  104. package/dist/test/unit/types/identityCodec.test.js +0 -187
  105. package/dist/test/unit/types/identityCodec.test.js.map +0 -1
  106. package/dist/test/unit/types/ids.test.js +0 -84
  107. package/dist/test/unit/types/ids.test.js.map +0 -1
  108. package/dist/test/unit/types/temporalCodec.test.js +0 -203
  109. package/dist/test/unit/types/temporalCodec.test.js.map +0 -1
  110. package/dist/test/unit/types/temporalPolicy.test.js +0 -83
  111. package/dist/test/unit/types/temporalPolicy.test.js.map +0 -1
  112. package/dist/test/unit/types/writePolicy.test.js +0 -331
  113. package/dist/test/unit/types/writePolicy.test.js.map +0 -1
  114. package/dist/test/unit/vector/fragmentConverters.test.js +0 -58
  115. package/dist/test/unit/vector/fragmentConverters.test.js.map +0 -1
  116. package/dist/test/unit/vector/inMemoryCosineIndex.test.js +0 -252
  117. package/dist/test/unit/vector/inMemoryCosineIndex.test.js.map +0 -1
  118. package/dist/test/unit/vector/inMemoryFragmentCosineIndex.test.js +0 -362
  119. package/dist/test/unit/vector/inMemoryFragmentCosineIndex.test.js.map +0 -1
  120. package/dist/test/unit/vector/vectorIndex.test.js +0 -51
  121. package/dist/test/unit/vector/vectorIndex.test.js.map +0 -1
  122. package/eslint.config.js +0 -15
  123. package/etc/ts-agent-memory.api.md +0 -940
  124. package/lib/test/unit/converters/antagonistRoundTrip.test.d.ts +0 -10
  125. package/lib/test/unit/converters/antagonistRoundTrip.test.d.ts.map +0 -1
  126. package/lib/test/unit/converters/antagonistRoundTrip.test.js +0 -97
  127. package/lib/test/unit/converters/antagonistRoundTrip.test.js.map +0 -1
  128. package/lib/test/unit/converters/bodyConverterRegistry.test.d.ts +0 -2
  129. package/lib/test/unit/converters/bodyConverterRegistry.test.d.ts.map +0 -1
  130. package/lib/test/unit/converters/bodyConverterRegistry.test.js +0 -74
  131. package/lib/test/unit/converters/bodyConverterRegistry.test.js.map +0 -1
  132. package/lib/test/unit/converters/envelopeConverter.test.d.ts +0 -2
  133. package/lib/test/unit/converters/envelopeConverter.test.d.ts.map +0 -1
  134. package/lib/test/unit/converters/envelopeConverter.test.js +0 -315
  135. package/lib/test/unit/converters/envelopeConverter.test.js.map +0 -1
  136. package/lib/test/unit/index/memoryIndex.test.d.ts +0 -2
  137. package/lib/test/unit/index/memoryIndex.test.d.ts.map +0 -1
  138. package/lib/test/unit/index/memoryIndex.test.js +0 -216
  139. package/lib/test/unit/index/memoryIndex.test.js.map +0 -1
  140. package/lib/test/unit/ingest/antagonistCycleAndParity.test.d.ts +0 -9
  141. package/lib/test/unit/ingest/antagonistCycleAndParity.test.d.ts.map +0 -1
  142. package/lib/test/unit/ingest/antagonistCycleAndParity.test.js +0 -279
  143. package/lib/test/unit/ingest/antagonistCycleAndParity.test.js.map +0 -1
  144. package/lib/test/unit/ingest/cycleGuard.test.d.ts +0 -2
  145. package/lib/test/unit/ingest/cycleGuard.test.d.ts.map +0 -1
  146. package/lib/test/unit/ingest/cycleGuard.test.js +0 -83
  147. package/lib/test/unit/ingest/cycleGuard.test.js.map +0 -1
  148. package/lib/test/unit/ingest/dedupScope.test.d.ts +0 -2
  149. package/lib/test/unit/ingest/dedupScope.test.d.ts.map +0 -1
  150. package/lib/test/unit/ingest/dedupScope.test.js +0 -436
  151. package/lib/test/unit/ingest/dedupScope.test.js.map +0 -1
  152. package/lib/test/unit/ingest/orchestrator.test.d.ts +0 -2
  153. package/lib/test/unit/ingest/orchestrator.test.d.ts.map +0 -1
  154. package/lib/test/unit/ingest/orchestrator.test.js +0 -1060
  155. package/lib/test/unit/ingest/orchestrator.test.js.map +0 -1
  156. package/lib/test/unit/observe/memoryObservationStore.test.d.ts +0 -2
  157. package/lib/test/unit/observe/memoryObservationStore.test.d.ts.map +0 -1
  158. package/lib/test/unit/observe/memoryObservationStore.test.js +0 -120
  159. package/lib/test/unit/observe/memoryObservationStore.test.js.map +0 -1
  160. package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.d.ts +0 -2
  161. package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.d.ts.map +0 -1
  162. package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.js +0 -118
  163. package/lib/test/unit/retrieve/fragmentSemanticRetriever.test.js.map +0 -1
  164. package/lib/test/unit/retrieve/linkTraversalRetriever.test.d.ts +0 -2
  165. package/lib/test/unit/retrieve/linkTraversalRetriever.test.d.ts.map +0 -1
  166. package/lib/test/unit/retrieve/linkTraversalRetriever.test.js +0 -259
  167. package/lib/test/unit/retrieve/linkTraversalRetriever.test.js.map +0 -1
  168. package/lib/test/unit/retrieve/retrievers.test.d.ts +0 -2
  169. package/lib/test/unit/retrieve/retrievers.test.d.ts.map +0 -1
  170. package/lib/test/unit/retrieve/retrievers.test.js +0 -770
  171. package/lib/test/unit/retrieve/retrievers.test.js.map +0 -1
  172. package/lib/test/unit/retrieve/temporalRetrievers.test.d.ts +0 -2
  173. package/lib/test/unit/retrieve/temporalRetrievers.test.d.ts.map +0 -1
  174. package/lib/test/unit/retrieve/temporalRetrievers.test.js +0 -184
  175. package/lib/test/unit/retrieve/temporalRetrievers.test.js.map +0 -1
  176. package/lib/test/unit/store/antagonistTemporalBoundary.test.d.ts +0 -9
  177. package/lib/test/unit/store/antagonistTemporalBoundary.test.d.ts.map +0 -1
  178. package/lib/test/unit/store/antagonistTemporalBoundary.test.js +0 -122
  179. package/lib/test/unit/store/antagonistTemporalBoundary.test.js.map +0 -1
  180. package/lib/test/unit/store/embedOnWrite.test.d.ts +0 -2
  181. package/lib/test/unit/store/embedOnWrite.test.d.ts.map +0 -1
  182. package/lib/test/unit/store/embedOnWrite.test.js +0 -319
  183. package/lib/test/unit/store/embedOnWrite.test.js.map +0 -1
  184. package/lib/test/unit/store/fileTreeMemoryStore.test.d.ts +0 -2
  185. package/lib/test/unit/store/fileTreeMemoryStore.test.d.ts.map +0 -1
  186. package/lib/test/unit/store/fileTreeMemoryStore.test.js +0 -780
  187. package/lib/test/unit/store/fileTreeMemoryStore.test.js.map +0 -1
  188. package/lib/test/unit/store/fragmentEmbedOnWrite.test.d.ts +0 -2
  189. package/lib/test/unit/store/fragmentEmbedOnWrite.test.d.ts.map +0 -1
  190. package/lib/test/unit/store/fragmentEmbedOnWrite.test.js +0 -257
  191. package/lib/test/unit/store/fragmentEmbedOnWrite.test.js.map +0 -1
  192. package/lib/test/unit/store/indexInjection.test.d.ts +0 -2
  193. package/lib/test/unit/store/indexInjection.test.d.ts.map +0 -1
  194. package/lib/test/unit/store/indexInjection.test.js +0 -434
  195. package/lib/test/unit/store/indexInjection.test.js.map +0 -1
  196. package/lib/test/unit/store/lenientOpen.test.d.ts +0 -2
  197. package/lib/test/unit/store/lenientOpen.test.d.ts.map +0 -1
  198. package/lib/test/unit/store/lenientOpen.test.js +0 -250
  199. package/lib/test/unit/store/lenientOpen.test.js.map +0 -1
  200. package/lib/test/unit/store/listScoped.test.d.ts +0 -2
  201. package/lib/test/unit/store/listScoped.test.d.ts.map +0 -1
  202. package/lib/test/unit/store/listScoped.test.js +0 -111
  203. package/lib/test/unit/store/listScoped.test.js.map +0 -1
  204. package/lib/test/unit/store/observations.test.d.ts +0 -2
  205. package/lib/test/unit/store/observations.test.d.ts.map +0 -1
  206. package/lib/test/unit/store/observations.test.js +0 -241
  207. package/lib/test/unit/store/observations.test.js.map +0 -1
  208. package/lib/test/unit/store/rankAxis.test.d.ts +0 -2
  209. package/lib/test/unit/store/rankAxis.test.d.ts.map +0 -1
  210. package/lib/test/unit/store/rankAxis.test.js +0 -256
  211. package/lib/test/unit/store/rankAxis.test.js.map +0 -1
  212. package/lib/test/unit/store/scopeEncoding.test.d.ts +0 -2
  213. package/lib/test/unit/store/scopeEncoding.test.d.ts.map +0 -1
  214. package/lib/test/unit/store/scopeEncoding.test.js +0 -26
  215. package/lib/test/unit/store/scopeEncoding.test.js.map +0 -1
  216. package/lib/test/unit/store/temporalStore.test.d.ts +0 -2
  217. package/lib/test/unit/store/temporalStore.test.d.ts.map +0 -1
  218. package/lib/test/unit/store/temporalStore.test.js +0 -400
  219. package/lib/test/unit/store/temporalStore.test.js.map +0 -1
  220. package/lib/test/unit/tools/memoryTools.test.d.ts +0 -2
  221. package/lib/test/unit/tools/memoryTools.test.d.ts.map +0 -1
  222. package/lib/test/unit/tools/memoryTools.test.js +0 -844
  223. package/lib/test/unit/tools/memoryTools.test.js.map +0 -1
  224. package/lib/test/unit/types/identityCodec.test.d.ts +0 -2
  225. package/lib/test/unit/types/identityCodec.test.d.ts.map +0 -1
  226. package/lib/test/unit/types/identityCodec.test.js +0 -189
  227. package/lib/test/unit/types/identityCodec.test.js.map +0 -1
  228. package/lib/test/unit/types/ids.test.d.ts +0 -2
  229. package/lib/test/unit/types/ids.test.d.ts.map +0 -1
  230. package/lib/test/unit/types/ids.test.js +0 -86
  231. package/lib/test/unit/types/ids.test.js.map +0 -1
  232. package/lib/test/unit/types/temporalCodec.test.d.ts +0 -2
  233. package/lib/test/unit/types/temporalCodec.test.d.ts.map +0 -1
  234. package/lib/test/unit/types/temporalCodec.test.js +0 -205
  235. package/lib/test/unit/types/temporalCodec.test.js.map +0 -1
  236. package/lib/test/unit/types/temporalPolicy.test.d.ts +0 -2
  237. package/lib/test/unit/types/temporalPolicy.test.d.ts.map +0 -1
  238. package/lib/test/unit/types/temporalPolicy.test.js +0 -85
  239. package/lib/test/unit/types/temporalPolicy.test.js.map +0 -1
  240. package/lib/test/unit/types/writePolicy.test.d.ts +0 -2
  241. package/lib/test/unit/types/writePolicy.test.d.ts.map +0 -1
  242. package/lib/test/unit/types/writePolicy.test.js +0 -333
  243. package/lib/test/unit/types/writePolicy.test.js.map +0 -1
  244. package/lib/test/unit/vector/fragmentConverters.test.d.ts +0 -2
  245. package/lib/test/unit/vector/fragmentConverters.test.d.ts.map +0 -1
  246. package/lib/test/unit/vector/fragmentConverters.test.js +0 -60
  247. package/lib/test/unit/vector/fragmentConverters.test.js.map +0 -1
  248. package/lib/test/unit/vector/inMemoryCosineIndex.test.d.ts +0 -2
  249. package/lib/test/unit/vector/inMemoryCosineIndex.test.d.ts.map +0 -1
  250. package/lib/test/unit/vector/inMemoryCosineIndex.test.js +0 -254
  251. package/lib/test/unit/vector/inMemoryCosineIndex.test.js.map +0 -1
  252. package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.d.ts +0 -2
  253. package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.d.ts.map +0 -1
  254. package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.js +0 -364
  255. package/lib/test/unit/vector/inMemoryFragmentCosineIndex.test.js.map +0 -1
  256. package/lib/test/unit/vector/vectorIndex.test.d.ts +0 -2
  257. package/lib/test/unit/vector/vectorIndex.test.d.ts.map +0 -1
  258. package/lib/test/unit/vector/vectorIndex.test.js +0 -53
  259. package/lib/test/unit/vector/vectorIndex.test.js.map +0 -1
  260. package/rush-logs/ts-agent-memory.build.cache.log +0 -3
  261. package/rush-logs/ts-agent-memory.build.log +0 -9
  262. package/src/index.ts +0 -14
  263. package/src/packlets/converters/bodyConverterRegistry.ts +0 -105
  264. package/src/packlets/converters/envelopeConverter.ts +0 -233
  265. package/src/packlets/converters/index.ts +0 -7
  266. package/src/packlets/index/index.ts +0 -6
  267. package/src/packlets/index/memoryIndex.ts +0 -332
  268. package/src/packlets/ingest/cycleGuard.ts +0 -153
  269. package/src/packlets/ingest/hostStages.ts +0 -111
  270. package/src/packlets/ingest/index.ts +0 -9
  271. package/src/packlets/ingest/model.ts +0 -195
  272. package/src/packlets/ingest/orchestrator.ts +0 -968
  273. package/src/packlets/observe/index.ts +0 -7
  274. package/src/packlets/observe/memoryObservationStore.ts +0 -153
  275. package/src/packlets/observe/observer.ts +0 -119
  276. package/src/packlets/retrieve/fragmentSemanticRetriever.ts +0 -138
  277. package/src/packlets/retrieve/hybridRetriever.ts +0 -194
  278. package/src/packlets/retrieve/index.ts +0 -14
  279. package/src/packlets/retrieve/linkTraversalRetriever.ts +0 -158
  280. package/src/packlets/retrieve/recencyRetriever.ts +0 -54
  281. package/src/packlets/retrieve/retriever.ts +0 -291
  282. package/src/packlets/retrieve/semanticRetriever.ts +0 -152
  283. package/src/packlets/retrieve/structuredFilterRetriever.ts +0 -58
  284. package/src/packlets/retrieve/tagRetriever.ts +0 -58
  285. package/src/packlets/retrieve/temporalRetrievers.ts +0 -210
  286. package/src/packlets/store/fileTreeMemoryStore.ts +0 -1872
  287. package/src/packlets/store/index.ts +0 -7
  288. package/src/packlets/store/scopeEncoding.ts +0 -36
  289. package/src/packlets/tools/index.ts +0 -6
  290. package/src/packlets/tools/memoryTools.ts +0 -706
  291. package/src/packlets/types/envelope.ts +0 -196
  292. package/src/packlets/types/filenameSafety.ts +0 -57
  293. package/src/packlets/types/identityCodec.ts +0 -447
  294. package/src/packlets/types/ids.ts +0 -124
  295. package/src/packlets/types/index.ts +0 -11
  296. package/src/packlets/types/temporal.ts +0 -96
  297. package/src/packlets/types/writePolicy.ts +0 -612
  298. package/src/packlets/vector/fragmentConverters.ts +0 -55
  299. package/src/packlets/vector/inMemoryCosineIndex.ts +0 -196
  300. package/src/packlets/vector/inMemoryFragmentCosineIndex.ts +0 -289
  301. package/src/packlets/vector/index.ts +0 -9
  302. package/src/packlets/vector/vectorIndex.ts +0 -273
  303. package/src/test/unit/converters/antagonistRoundTrip.test.ts +0 -110
  304. package/src/test/unit/converters/bodyConverterRegistry.test.ts +0 -89
  305. package/src/test/unit/converters/envelopeConverter.test.ts +0 -418
  306. package/src/test/unit/index/memoryIndex.test.ts +0 -272
  307. package/src/test/unit/ingest/antagonistCycleAndParity.test.ts +0 -367
  308. package/src/test/unit/ingest/cycleGuard.test.ts +0 -110
  309. package/src/test/unit/ingest/dedupScope.test.ts +0 -542
  310. package/src/test/unit/ingest/orchestrator.test.ts +0 -1355
  311. package/src/test/unit/observe/memoryObservationStore.test.ts +0 -158
  312. package/src/test/unit/retrieve/fragmentSemanticRetriever.test.ts +0 -163
  313. package/src/test/unit/retrieve/linkTraversalRetriever.test.ts +0 -329
  314. package/src/test/unit/retrieve/retrievers.test.ts +0 -1018
  315. package/src/test/unit/retrieve/temporalRetrievers.test.ts +0 -226
  316. package/src/test/unit/store/antagonistTemporalBoundary.test.ts +0 -158
  317. package/src/test/unit/store/embedOnWrite.test.ts +0 -418
  318. package/src/test/unit/store/fileTreeMemoryStore.test.ts +0 -1041
  319. package/src/test/unit/store/fragmentEmbedOnWrite.test.ts +0 -349
  320. package/src/test/unit/store/indexInjection.test.ts +0 -550
  321. package/src/test/unit/store/lenientOpen.test.ts +0 -292
  322. package/src/test/unit/store/listScoped.test.ts +0 -138
  323. package/src/test/unit/store/observations.test.ts +0 -290
  324. package/src/test/unit/store/rankAxis.test.ts +0 -349
  325. package/src/test/unit/store/scopeEncoding.test.ts +0 -37
  326. package/src/test/unit/store/temporalStore.test.ts +0 -469
  327. package/src/test/unit/tools/memoryTools.test.ts +0 -1121
  328. package/src/test/unit/types/identityCodec.test.ts +0 -266
  329. package/src/test/unit/types/ids.test.ts +0 -94
  330. package/src/test/unit/types/temporalCodec.test.ts +0 -259
  331. package/src/test/unit/types/temporalPolicy.test.ts +0 -124
  332. package/src/test/unit/types/writePolicy.test.ts +0 -446
  333. package/src/test/unit/vector/fragmentConverters.test.ts +0 -80
  334. package/src/test/unit/vector/inMemoryCosineIndex.test.ts +0 -318
  335. package/src/test/unit/vector/inMemoryFragmentCosineIndex.test.ts +0 -477
  336. package/src/test/unit/vector/vectorIndex.test.ts +0 -64
  337. package/temp/build/lint/_eslint-5eVG3S6w.json +0 -306
  338. package/temp/build/typescript/ts_8nwakTlr.json +0 -1
  339. package/temp/ts-agent-memory.api.json +0 -21030
  340. package/temp/ts-agent-memory.api.md +0 -940
  341. 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,mCAAI,YAAY,EAC/B,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,mCAAI,EAAE;YACrB,sEAAsE;YACtE,2EAA2E;YAC3E,KAAK,EAAE,CAAC,MAAA,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC,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E,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"}