@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,343 +0,0 @@
1
- /**
2
- * Config file for API Extractor. For more info, please visit: https://api-extractor.com
3
- */
4
- {
5
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
6
- /**
7
- * Optionally specifies another JSON config file that this file extends from. This provides a way for
8
- * standard settings to be shared across multiple projects.
9
- *
10
- * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
11
- * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
12
- * resolved using NodeJS require().
13
- *
14
- * SUPPORTED TOKENS: none
15
- * DEFAULT VALUE: ""
16
- */
17
- // "extends": "./shared/api-extractor-base.json"
18
- // "extends": "my-package/include/api-extractor-base.json"
19
- /**
20
- * Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
21
- * typically contains the tsconfig.json and package.json config files, but the path is user-defined.
22
- *
23
- * The path is resolved relative to the folder of the config file that contains the setting.
24
- *
25
- * The default value for "projectFolder" is the token "<lookup>", which means the folder is determined by traversing
26
- * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder
27
- * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error
28
- * will be reported.
29
- *
30
- * SUPPORTED TOKENS: <lookup>
31
- * DEFAULT VALUE: "<lookup>"
32
- */
33
- "projectFolder": "..",
34
- /**
35
- * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
36
- * analyzes the symbols exported by this module.
37
- *
38
- * The file extension must be ".d.ts" and not ".ts".
39
- *
40
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
41
- * prepend a folder token such as "<projectFolder>".
42
- *
43
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
44
- */
45
- "mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts",
46
- /**
47
- * A list of NPM package names whose exports should be treated as part of this package.
48
- *
49
- * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
50
- * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
51
- * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
52
- * imports library2. To avoid this, we can specify:
53
- *
54
- * "bundledPackages": [ "library2" ],
55
- *
56
- * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
57
- * local files for library1.
58
- */
59
- "bundledPackages": [],
60
- /**
61
- * Determines how the TypeScript compiler engine will be invoked by API Extractor.
62
- */
63
- "compiler": {
64
- /**
65
- * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
66
- *
67
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
68
- * prepend a folder token such as "<projectFolder>".
69
- *
70
- * Note: This setting will be ignored if "overrideTsconfig" is used.
71
- *
72
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
73
- * DEFAULT VALUE: "<projectFolder>/tsconfig.json"
74
- */
75
- // "tsconfigFilePath": "<projectFolder>/tsconfig.json",
76
- /**
77
- * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
78
- * The object must conform to the TypeScript tsconfig schema:
79
- *
80
- * http://json.schemastore.org/tsconfig
81
- *
82
- * If omitted, then the tsconfig.json file will be read from the "projectFolder".
83
- *
84
- * DEFAULT VALUE: no overrideTsconfig section
85
- */
86
- // "overrideTsconfig": {
87
- // . . .
88
- // }
89
- /**
90
- * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
91
- * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
92
- * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
93
- * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
94
- *
95
- * DEFAULT VALUE: false
96
- */
97
- // "skipLibCheck": true,
98
- },
99
- /**
100
- * Configures how the API report file (*.api.md) will be generated.
101
- */
102
- "apiReport": {
103
- /**
104
- * (REQUIRED) Whether to generate an API report.
105
- */
106
- "enabled": true
107
- /**
108
- * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
109
- * a full file path.
110
- *
111
- * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
112
- *
113
- * SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
114
- * DEFAULT VALUE: "<unscopedPackageName>.api.md"
115
- */
116
- // "reportFileName": "<unscopedPackageName>.api.md",
117
- /**
118
- * Specifies the folder where the API report file is written. The file name portion is determined by
119
- * the "reportFileName" setting.
120
- *
121
- * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
122
- * e.g. for an API review.
123
- *
124
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
125
- * prepend a folder token such as "<projectFolder>".
126
- *
127
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
128
- * DEFAULT VALUE: "<projectFolder>/etc/"
129
- */
130
- // "reportFolder": "<projectFolder>/etc/",
131
- /**
132
- * Specifies the folder where the temporary report file is written. The file name portion is determined by
133
- * the "reportFileName" setting.
134
- *
135
- * After the temporary file is written to disk, it is compared with the file in the "reportFolder".
136
- * If they are different, a production build will fail.
137
- *
138
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
139
- * prepend a folder token such as "<projectFolder>".
140
- *
141
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
142
- * DEFAULT VALUE: "<projectFolder>/temp/"
143
- */
144
- // "reportTempFolder": "<projectFolder>/temp/"
145
- },
146
- /**
147
- * Configures how the doc model file (*.api.json) will be generated.
148
- */
149
- "docModel": {
150
- /**
151
- * (REQUIRED) Whether to generate a doc model file.
152
- */
153
- "enabled": true
154
- /**
155
- * The output path for the doc model file. The file extension should be ".api.json".
156
- *
157
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
158
- * prepend a folder token such as "<projectFolder>".
159
- *
160
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
161
- * DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
162
- */
163
- // "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json"
164
- },
165
- /**
166
- * Configures how the .d.ts rollup file will be generated.
167
- */
168
- "dtsRollup": {
169
- /**
170
- * (REQUIRED) Whether to generate the .d.ts rollup file.
171
- */
172
- "enabled": true
173
- /**
174
- * Specifies the output path for a .d.ts rollup file to be generated without any trimming.
175
- * This file will include all declarations that are exported by the main entry point.
176
- *
177
- * If the path is an empty string, then this file will not be written.
178
- *
179
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
180
- * prepend a folder token such as "<projectFolder>".
181
- *
182
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
183
- * DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
184
- */
185
- // "untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
186
- /**
187
- * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
188
- * This file will include only declarations that are marked as "@public" or "@beta".
189
- *
190
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
191
- * prepend a folder token such as "<projectFolder>".
192
- *
193
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
194
- * DEFAULT VALUE: ""
195
- */
196
- // "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
197
- /**
198
- * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
199
- * This file will include only declarations that are marked as "@public".
200
- *
201
- * If the path is an empty string, then this file will not be written.
202
- *
203
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
204
- * prepend a folder token such as "<projectFolder>".
205
- *
206
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
207
- * DEFAULT VALUE: ""
208
- */
209
- // "publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts",
210
- /**
211
- * When a declaration is trimmed, by default it will be replaced by a code comment such as
212
- * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
213
- * declaration completely.
214
- *
215
- * DEFAULT VALUE: false
216
- */
217
- // "omitTrimmingComments": true
218
- },
219
- /**
220
- * Configures how the tsdoc-metadata.json file will be generated.
221
- */
222
- "tsdocMetadata": {
223
- /**
224
- * Whether to generate the tsdoc-metadata.json file.
225
- *
226
- * DEFAULT VALUE: true
227
- */
228
- // "enabled": true,
229
- /**
230
- * Specifies where the TSDoc metadata file should be written.
231
- *
232
- * The path is resolved relative to the folder of the config file that contains the setting; to change this,
233
- * prepend a folder token such as "<projectFolder>".
234
- *
235
- * The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
236
- * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
237
- * falls back to "tsdoc-metadata.json" in the package folder.
238
- *
239
- * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
240
- * DEFAULT VALUE: "<lookup>"
241
- */
242
- // "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
243
- },
244
- /**
245
- * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
246
- * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
247
- * To use the OS's default newline kind, specify "os".
248
- *
249
- * DEFAULT VALUE: "crlf"
250
- */
251
- // "newlineKind": "crlf",
252
- /**
253
- * Configures how API Extractor reports error and warning messages produced during analysis.
254
- *
255
- * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
256
- */
257
- "messages": {
258
- /**
259
- * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
260
- * the input .d.ts files.
261
- *
262
- * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
263
- *
264
- * DEFAULT VALUE: A single "default" entry with logLevel=warning.
265
- */
266
- "compilerMessageReporting": {
267
- /**
268
- * Configures the default routing for messages that don't match an explicit rule in this table.
269
- */
270
- "default": {
271
- /**
272
- * Specifies whether the message should be written to the the tool's output log. Note that
273
- * the "addToApiReportFile" property may supersede this option.
274
- *
275
- * Possible values: "error", "warning", "none"
276
- *
277
- * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
278
- * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
279
- * the "--local" option), the warning is displayed but the build will not fail.
280
- *
281
- * DEFAULT VALUE: "warning"
282
- */
283
- "logLevel": "warning"
284
- /**
285
- * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
286
- * then the message will be written inside that file; otherwise, the message is instead logged according to
287
- * the "logLevel" option.
288
- *
289
- * DEFAULT VALUE: false
290
- */
291
- // "addToApiReportFile": false
292
- }
293
- // "TS2551": {
294
- // "logLevel": "warning",
295
- // "addToApiReportFile": true
296
- // },
297
- //
298
- // . . .
299
- },
300
- /**
301
- * Configures handling of messages reported by API Extractor during its analysis.
302
- *
303
- * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
304
- *
305
- * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
306
- */
307
- "extractorMessageReporting": {
308
- "default": {
309
- "logLevel": "warning"
310
- // "addToApiReportFile": false
311
- },
312
- "ae-unresolved-link": {
313
- "logLevel": "none",
314
- "addToApiReportFile": true
315
- }
316
- // "ae-extra-release-tag": {
317
- // "logLevel": "warning",
318
- // "addToApiReportFile": true
319
- // },
320
- //
321
- // . . .
322
- },
323
- /**
324
- * Configures handling of messages reported by the TSDoc parser when analyzing code comments.
325
- *
326
- * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
327
- *
328
- * DEFAULT VALUE: A single "default" entry with logLevel=warning.
329
- */
330
- "tsdocMessageReporting": {
331
- "default": {
332
- "logLevel": "warning"
333
- // "addToApiReportFile": false
334
- }
335
- // "tsdoc-link-tag-unescaped-text": {
336
- // "logLevel": "warning",
337
- // "addToApiReportFile": true
338
- // },
339
- //
340
- // . . .
341
- }
342
- }
343
- }
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "@fgv/heft-dual-rig/profiles/default/config/jest.config.json",
3
- "coveragePathIgnorePatterns": ["index.js"],
4
- "coverageThreshold": {
5
- "global": {
6
- "branches": 100,
7
- "functions": 100,
8
- "lines": 100,
9
- "statements": 100
10
- }
11
- },
12
- "collectCoverage": true,
13
- "coverageReporters": ["text", "lcov", "html"]
14
- }
package/config/rig.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
3
- "rigPackageName": "@fgv/heft-dual-rig"
4
- }
@@ -1,95 +0,0 @@
1
- /*
2
- * Copyright (c) 2026 Erik Fortune
3
- * SPDX-License-Identifier: MIT
4
- */
5
- /**
6
- * Antagonist torture test — convert/validate round-trip symmetry (target class
7
- * 7): every OPTIONAL field the envelope/edge/provenance shapes carry must
8
- * survive a full on-disk round-trip (serialize → YAML text → parse), not just a
9
- * single `Converter.convert` pass in memory. This exercises the exact path a
10
- * corrupted or field-dropping serializer/parser pair would break, mirroring the
11
- * `aiClientToolConfig`/`annotations` field-drop class named in the brief.
12
- */
13
- import '@fgv/ts-utils-jest';
14
- import { Converters } from '@fgv/ts-utils';
15
- import { BodyConverterRegistry, parseMemoryFile, serializeMemoryFile } from '../../../index';
16
- const kind = 'note';
17
- function registry() {
18
- const reg = BodyConverterRegistry.create().orThrow();
19
- reg.register(kind, Converters.string);
20
- return reg;
21
- }
22
- describe('antagonist — full on-disk round-trip preserves every optional field', () => {
23
- // Wrong impl this catches: a serializer/parser pair where one side silently
24
- // drops an optional field (the exact class of bug the brief calls out for
25
- // `aiClientToolConfig`/`annotations`-shaped converters) — e.g. omitting
26
- // `temporal.invalid_at: null`, an edge's `valid_at`/`invalid_at`/`provenance`,
27
- // a `null` `embeddingRef`, or a provenance extension key, because the author
28
- // forgot to thread it through both the YAML emit AND the envelope Converter.
29
- test('every optional envelope/edge/provenance field set simultaneously survives a full YAML round-trip', () => {
30
- const envelope = {
31
- id: 'doc-1',
32
- entityId: 'doc-1',
33
- kind,
34
- tags: ['t1', 't2'],
35
- links: [
36
- {
37
- type: 'rel',
38
- target: { scope: 'knowledge', id: 'doc-2' },
39
- confidence: 0.42,
40
- provenance: { source: 'agent', by: 'curator', extra: { nested: true } },
41
- valid_at: 111,
42
- invalid_at: null
43
- }
44
- ],
45
- created: 1000,
46
- updated: 2000,
47
- seq: 7,
48
- contentHash: 'abc123',
49
- provenance: {
50
- source: 'host-ingest',
51
- by: 'erik',
52
- model: 'gpt-5',
53
- confidence: 0.87,
54
- derivedFrom: { scope: 'conversations/c1', id: 'turn-3' },
55
- // Opaque extension keys (per IProvenance's `[key: string]: unknown` arm).
56
- sentiment: { score: 0.5 },
57
- epistemic: 'belief'
58
- },
59
- temporal: { valid_at: 500, invalid_at: null },
60
- embeddingRef: null
61
- };
62
- const raw = serializeMemoryFile(envelope, 'the body text').orThrow();
63
- expect(parseMemoryFile(raw, registry())).toSucceedAndSatisfy((record) => {
64
- // Deep-equal the ENTIRE envelope, not field-by-field — a partial assertion
65
- // list is exactly how a single dropped field slips through review.
66
- expect(record.envelope).toEqual(envelope);
67
- expect(record.body).toBe('the body text');
68
- });
69
- });
70
- test('an absent temporal/embeddingRef/edge-optionals round-trips to fully absent (no null-vs-undefined drift)', () => {
71
- const envelope = {
72
- id: 'doc-2',
73
- entityId: 'doc-2',
74
- kind,
75
- tags: [],
76
- links: [{ type: 'rel', target: { scope: 'knowledge', id: 'doc-3' } }],
77
- created: 0,
78
- updated: 0,
79
- seq: 0,
80
- contentHash: '',
81
- provenance: { source: 'agent' }
82
- };
83
- const raw = serializeMemoryFile(envelope, 'body').orThrow();
84
- expect(parseMemoryFile(raw, registry())).toSucceedAndSatisfy((record) => {
85
- expect(record.envelope.temporal).toBeUndefined();
86
- expect(record.envelope.embeddingRef).toBeUndefined();
87
- expect(record.envelope.links[0].confidence).toBeUndefined();
88
- expect(record.envelope.links[0].provenance).toBeUndefined();
89
- expect(record.envelope.links[0].valid_at).toBeUndefined();
90
- expect(record.envelope.links[0].invalid_at).toBeUndefined();
91
- expect(record.envelope).toEqual(envelope);
92
- });
93
- });
94
- });
95
- //# sourceMappingURL=antagonistRoundTrip.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"antagonistRoundTrip.test.js","sourceRoot":"","sources":["../../../../src/test/unit/converters/antagonistRoundTrip.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,qBAAqB,EAGrB,eAAe,EACf,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAExB,MAAM,IAAI,GAAG,MAAiC,CAAC;AAE/C,SAAS,QAAQ;IACf,MAAM,GAAG,GAAG,qBAAqB,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IACrD,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,QAAQ,CAAC,qEAAqE,EAAE,GAAG,EAAE;IACnF,4EAA4E;IAC5E,0EAA0E;IAC1E,wEAAwE;IACxE,+EAA+E;IAC/E,6EAA6E;IAC7E,6EAA6E;IAC7E,IAAI,CAAC,kGAAkG,EAAE,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CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,aAAa,EAAE,CAAC;YAC1D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC;YAC5D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2026 Erik Fortune\n * SPDX-License-Identifier: MIT\n */\n\n/**\n * Antagonist torture test — convert/validate round-trip symmetry (target class\n * 7): every OPTIONAL field the envelope/edge/provenance shapes carry must\n * survive a full on-disk round-trip (serialize → YAML text → parse), not just a\n * single `Converter.convert` pass in memory. This exercises the exact path a\n * corrupted or field-dropping serializer/parser pair would break, mirroring the\n * `aiClientToolConfig`/`annotations` field-drop class named in the brief.\n */\n\nimport '@fgv/ts-utils-jest';\nimport { Converters } from '@fgv/ts-utils';\nimport {\n BodyConverterRegistry,\n IBodyConverterRegistry,\n IMemoryEnvelope,\n parseMemoryFile,\n serializeMemoryFile\n} from '../../../index';\n\nconst kind = 'note' as IMemoryEnvelope['kind'];\n\nfunction registry(): IBodyConverterRegistry {\n const reg = BodyConverterRegistry.create().orThrow();\n reg.register(kind, Converters.string);\n return reg;\n}\n\ndescribe('antagonist — full on-disk round-trip preserves every optional field', () => {\n // Wrong impl this catches: a serializer/parser pair where one side silently\n // drops an optional field (the exact class of bug the brief calls out for\n // `aiClientToolConfig`/`annotations`-shaped converters) — e.g. omitting\n // `temporal.invalid_at: null`, an edge's `valid_at`/`invalid_at`/`provenance`,\n // a `null` `embeddingRef`, or a provenance extension key, because the author\n // forgot to thread it through both the YAML emit AND the envelope Converter.\n test('every optional envelope/edge/provenance field set simultaneously survives a full YAML round-trip', () => {\n const envelope: IMemoryEnvelope = {\n id: 'doc-1' as IMemoryEnvelope['id'],\n entityId: 'doc-1' as IMemoryEnvelope['entityId'],\n kind,\n tags: ['t1', 't2'] as unknown as IMemoryEnvelope['tags'],\n links: [\n {\n type: 'rel' as never,\n target: { scope: 'knowledge', id: 'doc-2' } as never,\n confidence: 0.42,\n provenance: { source: 'agent', by: 'curator', extra: { nested: true } },\n valid_at: 111,\n\n invalid_at: null\n }\n ],\n created: 1000,\n updated: 2000,\n seq: 7,\n contentHash: 'abc123',\n provenance: {\n source: 'host-ingest',\n by: 'erik',\n model: 'gpt-5',\n confidence: 0.87,\n derivedFrom: { scope: 'conversations/c1', id: 'turn-3' } as never,\n // Opaque extension keys (per IProvenance's `[key: string]: unknown` arm).\n sentiment: { score: 0.5 },\n epistemic: 'belief'\n },\n\n temporal: { valid_at: 500, invalid_at: null },\n\n embeddingRef: null\n };\n\n const raw = serializeMemoryFile(envelope, 'the body text').orThrow();\n expect(parseMemoryFile(raw, registry())).toSucceedAndSatisfy((record) => {\n // Deep-equal the ENTIRE envelope, not field-by-field — a partial assertion\n // list is exactly how a single dropped field slips through review.\n expect(record.envelope).toEqual(envelope);\n expect(record.body).toBe('the body text');\n });\n });\n\n test('an absent temporal/embeddingRef/edge-optionals round-trips to fully absent (no null-vs-undefined drift)', () => {\n const envelope: IMemoryEnvelope = {\n id: 'doc-2' as IMemoryEnvelope['id'],\n entityId: 'doc-2' as IMemoryEnvelope['entityId'],\n kind,\n tags: [],\n links: [{ type: 'rel' as never, target: { scope: 'knowledge', id: 'doc-3' } as never }],\n created: 0,\n updated: 0,\n seq: 0,\n contentHash: '',\n provenance: { source: 'agent' }\n };\n const raw = serializeMemoryFile(envelope, 'body').orThrow();\n expect(parseMemoryFile(raw, registry())).toSucceedAndSatisfy((record) => {\n expect(record.envelope.temporal).toBeUndefined();\n expect(record.envelope.embeddingRef).toBeUndefined();\n expect(record.envelope.links[0].confidence).toBeUndefined();\n expect(record.envelope.links[0].provenance).toBeUndefined();\n expect(record.envelope.links[0].valid_at).toBeUndefined();\n expect(record.envelope.links[0].invalid_at).toBeUndefined();\n expect(record.envelope).toEqual(envelope);\n });\n });\n});\n"]}
@@ -1,72 +0,0 @@
1
- /*
2
- * Copyright (c) 2026 Erik Fortune
3
- * SPDX-License-Identifier: MIT
4
- */
5
- import '@fgv/ts-utils-jest';
6
- import { Converters } from '@fgv/ts-utils';
7
- import { JsonSchema } from '@fgv/ts-json-base';
8
- import { BodyConverterRegistry } from '../../../packlets/converters';
9
- const knowledgeKind = 'knowledge';
10
- const profileKind = 'profile';
11
- describe('BodyConverterRegistry', () => {
12
- let registry;
13
- beforeEach(() => {
14
- registry = BodyConverterRegistry.create().orThrow();
15
- });
16
- test('create succeeds', () => {
17
- expect(BodyConverterRegistry.create()).toSucceed();
18
- });
19
- describe('register / has / convert', () => {
20
- test('registers a Converter and converts a matching body', () => {
21
- registry.register(knowledgeKind, Converters.string);
22
- expect(registry.has(knowledgeKind)).toBe(true);
23
- expect(registry.convert(knowledgeKind, 'a knowledge doc')).toSucceedWith('a knowledge doc');
24
- });
25
- test('a registered Converter rejects an invalid body', () => {
26
- registry.register(knowledgeKind, Converters.string);
27
- expect(registry.convert(knowledgeKind, 42)).toFail();
28
- });
29
- test('has returns false for an unregistered kind', () => {
30
- expect(registry.has(knowledgeKind)).toBe(false);
31
- });
32
- test('convert fails for an unregistered kind', () => {
33
- expect(registry.convert(knowledgeKind, 'x')).toFailWith(/no converter registered for kind 'knowledge'/i);
34
- });
35
- test('register replaces a prior registration for the same kind', () => {
36
- registry.register(knowledgeKind, Converters.string);
37
- registry.register(knowledgeKind, Converters.number);
38
- expect(registry.convert(knowledgeKind, 7)).toSucceedWith(7);
39
- expect(registry.convert(knowledgeKind, 'x')).toFail();
40
- });
41
- });
42
- describe('getConverter', () => {
43
- test('returns the registered converter', () => {
44
- registry.register(knowledgeKind, Converters.string);
45
- expect(registry.getConverter(knowledgeKind)).toSucceedAndSatisfy((converter) => {
46
- expect(converter.convert('hello')).toSucceedWith('hello');
47
- });
48
- });
49
- test('fails for an unregistered kind', () => {
50
- expect(registry.getConverter(knowledgeKind)).toFailWith(/no converter registered for kind/i);
51
- });
52
- });
53
- describe('registerSchema', () => {
54
- const profileSchema = JsonSchema.object({
55
- name: JsonSchema.string(),
56
- age: JsonSchema.integer()
57
- });
58
- test('registers a JsonSchema validator and validates a matching body', () => {
59
- registry.registerSchema(profileKind, profileSchema);
60
- expect(registry.has(profileKind)).toBe(true);
61
- expect(registry.convert(profileKind, { name: 'Ada', age: 36 })).toSucceedWith({
62
- name: 'Ada',
63
- age: 36
64
- });
65
- });
66
- test('a registered schema rejects an invalid body', () => {
67
- registry.registerSchema(profileKind, profileSchema);
68
- expect(registry.convert(profileKind, { name: 'Ada' })).toFail();
69
- });
70
- });
71
- });
72
- //# sourceMappingURL=bodyConverterRegistry.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bodyConverterRegistry.test.js","sourceRoot":"","sources":["../../../../src/test/unit/converters/bodyConverterRegistry.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,MAAM,aAAa,GAAS,WAAmB,CAAC;AAChD,MAAM,WAAW,GAAS,SAAiB,CAAC;AAE5C,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAI,QAA+B,CAAC;IAEpC,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,qBAAqB,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;I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I,CAAC,CAAC;YAC7C,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;gBAC5E,IAAI,EAAE,KAAK;gBACX,GAAG,EAAE,EAAE;aACR,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACvD,QAAQ,CAAC,cAAc,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YACpD,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,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 { Converters } from '@fgv/ts-utils';\nimport { JsonSchema } from '@fgv/ts-json-base';\nimport { BodyConverterRegistry } from '../../../packlets/converters';\nimport { Kind } from '../../../packlets/types';\n\nconst knowledgeKind: Kind = 'knowledge' as Kind;\nconst profileKind: Kind = 'profile' as Kind;\n\ndescribe('BodyConverterRegistry', () => {\n let registry: BodyConverterRegistry;\n\n beforeEach(() => {\n registry = BodyConverterRegistry.create().orThrow();\n });\n\n test('create succeeds', () => {\n expect(BodyConverterRegistry.create()).toSucceed();\n });\n\n describe('register / has / convert', () => {\n test('registers a Converter and converts a matching body', () => {\n registry.register(knowledgeKind, Converters.string);\n expect(registry.has(knowledgeKind)).toBe(true);\n expect(registry.convert(knowledgeKind, 'a knowledge doc')).toSucceedWith('a knowledge doc');\n });\n\n test('a registered Converter rejects an invalid body', () => {\n registry.register(knowledgeKind, Converters.string);\n expect(registry.convert(knowledgeKind, 42)).toFail();\n });\n\n test('has returns false for an unregistered kind', () => {\n expect(registry.has(knowledgeKind)).toBe(false);\n });\n\n test('convert fails for an unregistered kind', () => {\n expect(registry.convert(knowledgeKind, 'x')).toFailWith(\n /no converter registered for kind 'knowledge'/i\n );\n });\n\n test('register replaces a prior registration for the same kind', () => {\n registry.register(knowledgeKind, Converters.string);\n registry.register(knowledgeKind, Converters.number);\n expect(registry.convert(knowledgeKind, 7)).toSucceedWith(7);\n expect(registry.convert(knowledgeKind, 'x')).toFail();\n });\n });\n\n describe('getConverter', () => {\n test('returns the registered converter', () => {\n registry.register(knowledgeKind, Converters.string);\n expect(registry.getConverter(knowledgeKind)).toSucceedAndSatisfy((converter) => {\n expect(converter.convert('hello')).toSucceedWith('hello');\n });\n });\n\n test('fails for an unregistered kind', () => {\n expect(registry.getConverter(knowledgeKind)).toFailWith(/no converter registered for kind/i);\n });\n });\n\n describe('registerSchema', () => {\n const profileSchema = JsonSchema.object({\n name: JsonSchema.string(),\n age: JsonSchema.integer()\n });\n\n test('registers a JsonSchema validator and validates a matching body', () => {\n registry.registerSchema(profileKind, profileSchema);\n expect(registry.has(profileKind)).toBe(true);\n expect(registry.convert(profileKind, { name: 'Ada', age: 36 })).toSucceedWith({\n name: 'Ada',\n age: 36\n });\n });\n\n test('a registered schema rejects an invalid body', () => {\n registry.registerSchema(profileKind, profileSchema);\n expect(registry.convert(profileKind, { name: 'Ada' })).toFail();\n });\n });\n});\n"]}