@remnic/core 1.1.0 → 1.1.2

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 (308) hide show
  1. package/dist/access-audit.d.ts +56 -0
  2. package/dist/access-audit.js +9 -0
  3. package/dist/access-cli.js +70 -53
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +16 -9
  6. package/dist/access-http.js +26 -18
  7. package/dist/access-mcp.d.ts +16 -9
  8. package/dist/access-mcp.js +30 -8
  9. package/dist/access-schema.d.ts +124 -33
  10. package/dist/access-schema.js +5 -1
  11. package/dist/{access-service-HmO1Trrx.d.ts → access-service-Br8ZydTK.d.ts} +158 -63
  12. package/dist/access-service.d.ts +13 -6
  13. package/dist/access-service.js +23 -14
  14. package/dist/bootstrap.d.ts +6 -3
  15. package/dist/briefing.d.ts +1 -0
  16. package/dist/briefing.js +8 -6
  17. package/dist/buffer-surprise-report.d.ts +70 -0
  18. package/dist/buffer-surprise-report.js +7 -0
  19. package/dist/buffer-surprise-report.js.map +1 -0
  20. package/dist/buffer-surprise.d.ts +98 -0
  21. package/dist/buffer-surprise.js +11 -0
  22. package/dist/buffer-surprise.js.map +1 -0
  23. package/dist/buffer.d.ts +100 -2
  24. package/dist/buffer.js +1 -1
  25. package/dist/calibration.js +6 -6
  26. package/dist/causal-behavior.js +4 -4
  27. package/dist/causal-chain.js +2 -2
  28. package/dist/causal-consolidation.js +19 -18
  29. package/dist/causal-consolidation.js.map +1 -1
  30. package/dist/causal-retrieval.js +4 -4
  31. package/dist/causal-trajectory.js +1 -1
  32. package/dist/{chunk-QNJMBKFK.js → chunk-2LGMW3DJ.js} +3 -2
  33. package/dist/chunk-2LGMW3DJ.js.map +1 -0
  34. package/dist/{chunk-QDYXG4CS.js → chunk-3FPTCC3Z.js} +4 -3
  35. package/dist/chunk-3FPTCC3Z.js.map +1 -0
  36. package/dist/chunk-3GPTTA4J.js +57 -0
  37. package/dist/chunk-3GPTTA4J.js.map +1 -0
  38. package/dist/{chunk-ITRLGI2T.js → chunk-3OGMS3PE.js} +2 -2
  39. package/dist/{chunk-DEPL3635.js → chunk-3YGHKTBF.js} +1446 -196
  40. package/dist/chunk-3YGHKTBF.js.map +1 -0
  41. package/dist/{chunk-BLKTA7MM.js → chunk-4HQS2HPX.js} +54 -21
  42. package/dist/chunk-4HQS2HPX.js.map +1 -0
  43. package/dist/chunk-54V4BZWP.js +139 -0
  44. package/dist/chunk-54V4BZWP.js.map +1 -0
  45. package/dist/chunk-5JRF2PZA.js +67 -0
  46. package/dist/chunk-5JRF2PZA.js.map +1 -0
  47. package/dist/chunk-64NJRYU2.js +332 -0
  48. package/dist/chunk-64NJRYU2.js.map +1 -0
  49. package/dist/{chunk-OIT5QGG4.js → chunk-6AUUAZEX.js} +72 -2
  50. package/dist/chunk-6AUUAZEX.js.map +1 -0
  51. package/dist/{chunk-3QHL5ABG.js → chunk-6YJHX2DL.js} +191 -10
  52. package/dist/chunk-6YJHX2DL.js.map +1 -0
  53. package/dist/chunk-AJU4PJGY.js +126 -0
  54. package/dist/chunk-AJU4PJGY.js.map +1 -0
  55. package/dist/chunk-ASAITVLA.js +64 -0
  56. package/dist/chunk-ASAITVLA.js.map +1 -0
  57. package/dist/{chunk-44ICJRF3.js → chunk-AYXIPSZO.js} +5 -5
  58. package/dist/{chunk-MBJHSA7F.js → chunk-BECYBZLX.js} +265 -20
  59. package/dist/chunk-BECYBZLX.js.map +1 -0
  60. package/dist/chunk-C4SQJZAF.js +486 -0
  61. package/dist/chunk-C4SQJZAF.js.map +1 -0
  62. package/dist/{chunk-6UJ47TVX.js → chunk-CUPFXL3J.js} +2 -2
  63. package/dist/chunk-DF3RVK3X.js +119 -0
  64. package/dist/chunk-DF3RVK3X.js.map +1 -0
  65. package/dist/{chunk-N42IWANG.js → chunk-DG6YMRDC.js} +3 -3
  66. package/dist/chunk-DGVM5SFL.js +69 -0
  67. package/dist/chunk-DGVM5SFL.js.map +1 -0
  68. package/dist/{chunk-3SV6CQHO.js → chunk-DIXB44VE.js} +102 -66
  69. package/dist/chunk-DIXB44VE.js.map +1 -0
  70. package/dist/chunk-EIR5VLIH.js +90 -0
  71. package/dist/chunk-EIR5VLIH.js.map +1 -0
  72. package/dist/{chunk-GV6NLQ4X.js → chunk-F5VP6YCB.js} +374 -16
  73. package/dist/chunk-F5VP6YCB.js.map +1 -0
  74. package/dist/{chunk-6ZH4TU6I.js → chunk-FAAFWE4G.js} +2 -1
  75. package/dist/chunk-FAAFWE4G.js.map +1 -0
  76. package/dist/{chunk-7WQ6SLIE.js → chunk-FVA6TGI3.js} +2 -2
  77. package/dist/{chunk-PAORGQRI.js → chunk-GA5P7RST.js} +37 -23
  78. package/dist/chunk-GA5P7RST.js.map +1 -0
  79. package/dist/chunk-GDFS42HT.js +206 -0
  80. package/dist/chunk-GDFS42HT.js.map +1 -0
  81. package/dist/chunk-IISBCCWR.js +52 -0
  82. package/dist/chunk-IISBCCWR.js.map +1 -0
  83. package/dist/chunk-JBMSGZEQ.js +441 -0
  84. package/dist/chunk-JBMSGZEQ.js.map +1 -0
  85. package/dist/{chunk-J4IYOZZ5.js → chunk-JXS5PDQ7.js} +3 -1
  86. package/dist/chunk-JXS5PDQ7.js.map +1 -0
  87. package/dist/chunk-KVBLZUKV.js +173 -0
  88. package/dist/chunk-KVBLZUKV.js.map +1 -0
  89. package/dist/{chunk-4LACOVZX.js → chunk-L7IXWRYE.js} +10 -5
  90. package/dist/chunk-L7IXWRYE.js.map +1 -0
  91. package/dist/chunk-LBLXEFWK.js +51 -0
  92. package/dist/chunk-LBLXEFWK.js.map +1 -0
  93. package/dist/{chunk-WBSAYXVI.js → chunk-LOIMBRDE.js} +201 -45
  94. package/dist/chunk-LOIMBRDE.js.map +1 -0
  95. package/dist/{chunk-3WHVNEN7.js → chunk-LTCGGW2D.js} +1 -1
  96. package/dist/chunk-LTCGGW2D.js.map +1 -0
  97. package/dist/{chunk-ZVBB3T7V.js → chunk-NBVAS5MT.js} +25 -23
  98. package/dist/chunk-NBVAS5MT.js.map +1 -0
  99. package/dist/{chunk-UEYA6UC7.js → chunk-NZLQTHS5.js} +25 -2
  100. package/dist/chunk-NZLQTHS5.js.map +1 -0
  101. package/dist/{chunk-NQEVYWX6.js → chunk-OC5OXUQ4.js} +211 -7
  102. package/dist/chunk-OC5OXUQ4.js.map +1 -0
  103. package/dist/{chunk-LK6SGL53.js → chunk-OR64ZGRZ.js} +3 -2
  104. package/dist/chunk-OR64ZGRZ.js.map +1 -0
  105. package/dist/{chunk-SYUK3VLY.js → chunk-PVICZTKG.js} +117 -5
  106. package/dist/chunk-PVICZTKG.js.map +1 -0
  107. package/dist/chunk-PVPWZSSI.js +37 -0
  108. package/dist/chunk-PVPWZSSI.js.map +1 -0
  109. package/dist/{chunk-JL2PU6AI.js → chunk-R2XRID2N.js} +2 -2
  110. package/dist/{chunk-4NRAJUDS.js → chunk-RBBWYEFJ.js} +1 -1
  111. package/dist/chunk-RFYAYKTD.js +146 -0
  112. package/dist/chunk-RFYAYKTD.js.map +1 -0
  113. package/dist/chunk-SOBJ6NEY.js +18 -0
  114. package/dist/chunk-SOBJ6NEY.js.map +1 -0
  115. package/dist/{chunk-JIU55F3X.js → chunk-SPI27QT6.js} +2 -2
  116. package/dist/{chunk-MVTHXUBX.js → chunk-STGWEHYR.js} +479 -20
  117. package/dist/chunk-STGWEHYR.js.map +1 -0
  118. package/dist/{chunk-6LX5ORAS.js → chunk-TMYO7B5P.js} +4 -4
  119. package/dist/chunk-TVVEYCNW.js +65 -0
  120. package/dist/chunk-TVVEYCNW.js.map +1 -0
  121. package/dist/chunk-ULYOGL6R.js +322 -0
  122. package/dist/chunk-ULYOGL6R.js.map +1 -0
  123. package/dist/{chunk-37UIFYWO.js → chunk-UWB5LMWY.js} +108 -9
  124. package/dist/chunk-UWB5LMWY.js.map +1 -0
  125. package/dist/{chunk-47UU5PU2.js → chunk-VBVG2M5G.js} +18 -3
  126. package/dist/chunk-VBVG2M5G.js.map +1 -0
  127. package/dist/{chunk-7ECD5ATE.js → chunk-VDX363PS.js} +2 -2
  128. package/dist/{chunk-O5ETUNBT.js → chunk-VTU2B4VF.js} +7 -3
  129. package/dist/chunk-VTU2B4VF.js.map +1 -0
  130. package/dist/{chunk-MTLYEMJB.js → chunk-WCLICCGB.js} +18 -3
  131. package/dist/chunk-WCLICCGB.js.map +1 -0
  132. package/dist/chunk-X6GF3FX2.js +26 -0
  133. package/dist/chunk-X6GF3FX2.js.map +1 -0
  134. package/dist/{chunk-3QFQGRHO.js → chunk-XMHBH5H6.js} +4 -4
  135. package/dist/{chunk-DHHP2Z4X.js → chunk-XXVWLXSG.js} +2 -2
  136. package/dist/{chunk-XZ2TIKGC.js → chunk-Y7R2XJ5Q.js} +25 -9
  137. package/dist/chunk-Y7R2XJ5Q.js.map +1 -0
  138. package/dist/{chunk-ALXMCZEU.js → chunk-Z2E7VW55.js} +6 -3
  139. package/dist/chunk-Z2E7VW55.js.map +1 -0
  140. package/dist/chunk-ZAIM4TUE.js +488 -0
  141. package/dist/chunk-ZAIM4TUE.js.map +1 -0
  142. package/dist/chunk-ZZTOURJI.js +91 -0
  143. package/dist/chunk-ZZTOURJI.js.map +1 -0
  144. package/dist/{cli-BneVIEvh.d.ts → cli-BkeRaYfk.d.ts} +2 -2
  145. package/dist/cli.d.ts +13 -6
  146. package/dist/cli.js +42 -31
  147. package/dist/config.js +2 -2
  148. package/dist/consolidation-operator.d.ts +41 -0
  149. package/dist/consolidation-operator.js +11 -0
  150. package/dist/consolidation-operator.js.map +1 -0
  151. package/dist/consolidation-provenance-check.d.ts +68 -0
  152. package/dist/consolidation-provenance-check.js +9 -0
  153. package/dist/consolidation-provenance-check.js.map +1 -0
  154. package/dist/consolidation-undo.d.ts +123 -0
  155. package/dist/consolidation-undo.js +426 -0
  156. package/dist/consolidation-undo.js.map +1 -0
  157. package/dist/{contradiction-scan-GR33PONM.js → contradiction-scan-E3GJTI4F.js} +43 -7
  158. package/dist/contradiction-scan-E3GJTI4F.js.map +1 -0
  159. package/dist/cross-namespace-budget.d.ts +133 -0
  160. package/dist/cross-namespace-budget.js +9 -0
  161. package/dist/cross-namespace-budget.js.map +1 -0
  162. package/dist/direct-answer-wiring.js +5 -70
  163. package/dist/direct-answer-wiring.js.map +1 -1
  164. package/dist/embedding-fallback.js +2 -1
  165. package/dist/{engine-5TIQBYZR.js → engine-72LSIWQP.js} +8 -7
  166. package/dist/engine-72LSIWQP.js.map +1 -0
  167. package/dist/entity-retrieval.d.ts +1 -0
  168. package/dist/entity-retrieval.js +7 -6
  169. package/dist/explicit-capture.d.ts +6 -3
  170. package/dist/explicit-capture.js +2 -2
  171. package/dist/extraction-judge-telemetry.d.ts +113 -0
  172. package/dist/extraction-judge-telemetry.js +14 -0
  173. package/dist/extraction-judge-telemetry.js.map +1 -0
  174. package/dist/extraction-judge-training.d.ts +85 -0
  175. package/dist/extraction-judge-training.js +16 -0
  176. package/dist/extraction-judge-training.js.map +1 -0
  177. package/dist/extraction-judge.d.ts +124 -2
  178. package/dist/extraction-judge.js +11 -1
  179. package/dist/extraction.js +10 -9
  180. package/dist/fallback-llm.js +3 -3
  181. package/dist/graph-recall.d.ts +100 -0
  182. package/dist/graph-recall.js +8 -0
  183. package/dist/graph-recall.js.map +1 -0
  184. package/dist/graph-retrieval.d.ts +271 -0
  185. package/dist/graph-retrieval.js +21 -0
  186. package/dist/graph-retrieval.js.map +1 -0
  187. package/dist/importance.js +1 -1
  188. package/dist/index.d.ts +585 -20
  189. package/dist/index.js +542 -344
  190. package/dist/index.js.map +1 -1
  191. package/dist/local-llm.js +2 -2
  192. package/dist/memory-worth-bench.d.ts +51 -0
  193. package/dist/memory-worth-bench.js +131 -0
  194. package/dist/memory-worth-bench.js.map +1 -0
  195. package/dist/memory-worth-filter.d.ts +128 -0
  196. package/dist/memory-worth-filter.js +10 -0
  197. package/dist/memory-worth-filter.js.map +1 -0
  198. package/dist/memory-worth-outcomes.d.ts +118 -0
  199. package/dist/memory-worth-outcomes.js +9 -0
  200. package/dist/memory-worth-outcomes.js.map +1 -0
  201. package/dist/memory-worth.d.ts +102 -0
  202. package/dist/memory-worth.js +7 -0
  203. package/dist/memory-worth.js.map +1 -0
  204. package/dist/operator-toolkit.d.ts +40 -1
  205. package/dist/operator-toolkit.js +25 -16
  206. package/dist/{orchestrator-DRYA6_lW.d.ts → orchestrator-CmJ-NTdJ.d.ts} +233 -8
  207. package/dist/orchestrator.d.ts +6 -3
  208. package/dist/orchestrator.js +54 -44
  209. package/dist/page-versioning.d.ts +12 -1
  210. package/dist/page-versioning.js +5 -3
  211. package/dist/{port-C1GZFv8h.d.ts → port-BADbLZU5.d.ts} +2 -2
  212. package/dist/qmd-recall-cache.d.ts +1 -1
  213. package/dist/qmd.d.ts +5 -3
  214. package/dist/qmd.js +3 -3
  215. package/dist/reasoning-trace-recall.d.ts +90 -0
  216. package/dist/reasoning-trace-recall.js +13 -0
  217. package/dist/reasoning-trace-recall.js.map +1 -0
  218. package/dist/reasoning-trace-types.d.ts +54 -0
  219. package/dist/reasoning-trace-types.js +17 -0
  220. package/dist/reasoning-trace-types.js.map +1 -0
  221. package/dist/recall-audit-anomaly.d.ts +112 -0
  222. package/dist/recall-audit-anomaly.js +11 -0
  223. package/dist/recall-audit-anomaly.js.map +1 -0
  224. package/dist/recall-audit.js +5 -44
  225. package/dist/recall-audit.js.map +1 -1
  226. package/dist/recall-explain-renderer.d.ts +49 -0
  227. package/dist/recall-explain-renderer.js +18 -0
  228. package/dist/recall-explain-renderer.js.map +1 -0
  229. package/dist/recall-state.d.ts +12 -1
  230. package/dist/recall-state.js +1 -1
  231. package/dist/recall-xray-cli.d.ts +40 -0
  232. package/dist/recall-xray-cli.js +11 -0
  233. package/dist/recall-xray-cli.js.map +1 -0
  234. package/dist/recall-xray-renderer.d.ts +44 -0
  235. package/dist/recall-xray-renderer.js +18 -0
  236. package/dist/recall-xray-renderer.js.map +1 -0
  237. package/dist/recall-xray.d.ts +179 -0
  238. package/dist/recall-xray.js +13 -0
  239. package/dist/recall-xray.js.map +1 -0
  240. package/dist/resolve-provider-secret.d.ts +5 -1
  241. package/dist/resolve-provider-secret.js +3 -1
  242. package/dist/resume-bundles.js +6 -6
  243. package/dist/retrieval-agents.d.ts +1 -1
  244. package/dist/retrieval-tiers.d.ts +17 -0
  245. package/dist/retrieval-tiers.js +9 -0
  246. package/dist/retrieval-tiers.js.map +1 -0
  247. package/dist/schemas.d.ts +309 -53
  248. package/dist/schemas.js +1 -1
  249. package/dist/{semantic-consolidation-DrvSYRdB.d.ts → semantic-consolidation-CxJU6MJk.d.ts} +62 -1
  250. package/dist/semantic-consolidation.d.ts +2 -1
  251. package/dist/semantic-consolidation.js +22 -7
  252. package/dist/semantic-rule-promotion.js +7 -6
  253. package/dist/semantic-rule-verifier.js +7 -6
  254. package/dist/storage.d.ts +82 -1
  255. package/dist/storage.js +6 -5
  256. package/dist/summarizer.js +6 -6
  257. package/dist/temporal-supersession.d.ts +1 -0
  258. package/dist/tier-migration.d.ts +2 -1
  259. package/dist/tokens.js +2 -1
  260. package/dist/types.d.ts +276 -2
  261. package/dist/types.js +1 -1
  262. package/dist/verified-recall.js +7 -6
  263. package/package.json +1 -1
  264. package/dist/chunk-37UIFYWO.js.map +0 -1
  265. package/dist/chunk-3QHL5ABG.js.map +0 -1
  266. package/dist/chunk-3SV6CQHO.js.map +0 -1
  267. package/dist/chunk-3WHVNEN7.js.map +0 -1
  268. package/dist/chunk-47UU5PU2.js.map +0 -1
  269. package/dist/chunk-4LACOVZX.js.map +0 -1
  270. package/dist/chunk-6ZH4TU6I.js.map +0 -1
  271. package/dist/chunk-ALXMCZEU.js.map +0 -1
  272. package/dist/chunk-BLKTA7MM.js.map +0 -1
  273. package/dist/chunk-DEPL3635.js.map +0 -1
  274. package/dist/chunk-GV6NLQ4X.js.map +0 -1
  275. package/dist/chunk-J4IYOZZ5.js.map +0 -1
  276. package/dist/chunk-LAYN4LDC.js +0 -267
  277. package/dist/chunk-LAYN4LDC.js.map +0 -1
  278. package/dist/chunk-LK6SGL53.js.map +0 -1
  279. package/dist/chunk-MBJHSA7F.js.map +0 -1
  280. package/dist/chunk-MTLYEMJB.js.map +0 -1
  281. package/dist/chunk-MVTHXUBX.js.map +0 -1
  282. package/dist/chunk-NQEVYWX6.js.map +0 -1
  283. package/dist/chunk-O5ETUNBT.js.map +0 -1
  284. package/dist/chunk-OIT5QGG4.js.map +0 -1
  285. package/dist/chunk-PAORGQRI.js.map +0 -1
  286. package/dist/chunk-QDYXG4CS.js.map +0 -1
  287. package/dist/chunk-QNJMBKFK.js.map +0 -1
  288. package/dist/chunk-SYUK3VLY.js.map +0 -1
  289. package/dist/chunk-UEYA6UC7.js.map +0 -1
  290. package/dist/chunk-UVJFDP7P.js +0 -202
  291. package/dist/chunk-UVJFDP7P.js.map +0 -1
  292. package/dist/chunk-WBSAYXVI.js.map +0 -1
  293. package/dist/chunk-XZ2TIKGC.js.map +0 -1
  294. package/dist/chunk-ZVBB3T7V.js.map +0 -1
  295. package/dist/contradiction-scan-GR33PONM.js.map +0 -1
  296. /package/dist/{engine-5TIQBYZR.js.map → access-audit.js.map} +0 -0
  297. /package/dist/{chunk-ITRLGI2T.js.map → chunk-3OGMS3PE.js.map} +0 -0
  298. /package/dist/{chunk-44ICJRF3.js.map → chunk-AYXIPSZO.js.map} +0 -0
  299. /package/dist/{chunk-6UJ47TVX.js.map → chunk-CUPFXL3J.js.map} +0 -0
  300. /package/dist/{chunk-N42IWANG.js.map → chunk-DG6YMRDC.js.map} +0 -0
  301. /package/dist/{chunk-7WQ6SLIE.js.map → chunk-FVA6TGI3.js.map} +0 -0
  302. /package/dist/{chunk-JL2PU6AI.js.map → chunk-R2XRID2N.js.map} +0 -0
  303. /package/dist/{chunk-4NRAJUDS.js.map → chunk-RBBWYEFJ.js.map} +0 -0
  304. /package/dist/{chunk-JIU55F3X.js.map → chunk-SPI27QT6.js.map} +0 -0
  305. /package/dist/{chunk-6LX5ORAS.js.map → chunk-TMYO7B5P.js.map} +0 -0
  306. /package/dist/{chunk-7ECD5ATE.js.map → chunk-VDX363PS.js.map} +0 -0
  307. /package/dist/{chunk-3QFQGRHO.js.map → chunk-XMHBH5H6.js.map} +0 -0
  308. /package/dist/{chunk-DHHP2Z4X.js.map → chunk-XXVWLXSG.js.map} +0 -0
package/dist/index.js CHANGED
@@ -9,14 +9,20 @@ import {
9
9
  resolveConnectorFromToken,
10
10
  revokeToken,
11
11
  saveTokenStore
12
- } from "./chunk-O5ETUNBT.js";
12
+ } from "./chunk-VTU2B4VF.js";
13
13
  import {
14
- resolveCategory
15
- } from "./chunk-OIT5QGG4.js";
14
+ runGraphRecall
15
+ } from "./chunk-DGVM5SFL.js";
16
16
  import {
17
- FILTER_LABELS,
18
- isDirectAnswerEligible
19
- } from "./chunk-Y4FHOFJ2.js";
17
+ DEFAULT_PPR_DAMPING,
18
+ DEFAULT_PPR_ITERATIONS,
19
+ DEFAULT_PPR_TOLERANCE,
20
+ buildGraphFromMemories,
21
+ extractGraphEdges,
22
+ isEdgeType,
23
+ isNodeType,
24
+ queryGraph
25
+ } from "./chunk-64NJRYU2.js";
20
26
  import {
21
27
  clearBulkImportSources,
22
28
  clearTrainingExportAdapters,
@@ -34,53 +40,92 @@ import {
34
40
  runBulkImportCliCommand,
35
41
  runBulkImportPipeline,
36
42
  validateImportTurn
37
- } from "./chunk-WBSAYXVI.js";
38
- import "./chunk-7ECD5ATE.js";
39
- import "./chunk-6LX5ORAS.js";
40
- import "./chunk-3QHL5ABG.js";
43
+ } from "./chunk-LOIMBRDE.js";
44
+ import "./chunk-VDX363PS.js";
45
+ import "./chunk-TMYO7B5P.js";
46
+ import {
47
+ parseXrayBudgetFlag,
48
+ parseXrayCliOptions
49
+ } from "./chunk-PVPWZSSI.js";
50
+ import "./chunk-6YJHX2DL.js";
41
51
  import "./chunk-HL4DB7TO.js";
52
+ import "./chunk-ULYOGL6R.js";
42
53
  import "./chunk-ZPKBYX2F.js";
43
54
  import "./chunk-3SLRNYNG.js";
44
55
  import "./chunk-LIRZNNUP.js";
45
56
  import "./chunk-Y4Z4I6WK.js";
57
+ import {
58
+ reportBufferSurpriseDistribution
59
+ } from "./chunk-ASAITVLA.js";
60
+ import {
61
+ DEFAULT_SURPRISE_K,
62
+ computeSurprise
63
+ } from "./chunk-5JRF2PZA.js";
46
64
  import {
47
65
  getMemoryForActiveMemory,
48
66
  recallForActiveMemory
49
67
  } from "./chunk-G4SK7DSQ.js";
50
68
  import "./chunk-6MKAMLQL.js";
51
69
  import {
70
+ DEFAULT_TAXONOMY,
52
71
  Orchestrator,
72
+ branchNamespaceName,
53
73
  buildProcedureRecallSection,
54
74
  decideSemanticDedup,
55
75
  defaultWorkspaceDir,
76
+ describeCodingScope,
77
+ generateResolverDocument,
78
+ getTaxonomyDir,
79
+ getTaxonomyFilePath,
80
+ loadTaxonomy,
56
81
  migrateFromEngram,
82
+ normalizeOriginUrl,
83
+ projectNamespaceName,
84
+ resolveCodingNamespaceOverlay,
85
+ resolveGitContext,
57
86
  rollbackFromEngramMigration,
58
- sanitizeSessionKeyForFilename
59
- } from "./chunk-DEPL3635.js";
60
- import "./chunk-DHHP2Z4X.js";
87
+ sanitizeSessionKeyForFilename,
88
+ saveTaxonomy,
89
+ stableHash,
90
+ validateSlug,
91
+ validateTaxonomy
92
+ } from "./chunk-3YGHKTBF.js";
93
+ import "./chunk-XXVWLXSG.js";
61
94
  import "./chunk-UHGBNIOS.js";
62
95
  import "./chunk-FSFEQI74.js";
63
- import "./chunk-N42IWANG.js";
64
- import "./chunk-ETOW6ACV.js";
65
96
  import "./chunk-W6SL7OFG.js";
66
97
  import "./chunk-Z5AAYHUC.js";
67
98
  import "./chunk-S75M5ZRK.js";
68
99
  import "./chunk-TPB3I2AC.js";
69
100
  import "./chunk-JR4ZC3G4.js";
70
- import "./chunk-KVE7R4CG.js";
71
- import "./chunk-X7XN6YU4.js";
101
+ import "./chunk-DG6YMRDC.js";
102
+ import "./chunk-ETOW6ACV.js";
72
103
  import "./chunk-5NPGSAVB.js";
73
104
  import "./chunk-C7VW7C3F.js";
74
105
  import "./chunk-K4FLSOR5.js";
75
106
  import "./chunk-V3RXWQIE.js";
76
107
  import "./chunk-5IZL4DCV.js";
77
- import "./chunk-YCN4BVDK.js";
108
+ import "./chunk-VBVG2M5G.js";
109
+ import "./chunk-KVBLZUKV.js";
110
+ import "./chunk-X7XN6YU4.js";
111
+ import {
112
+ DEFAULT_REASONING_TRACE_BOOST,
113
+ applyReasoningTraceBoost,
114
+ isReasoningTracePath,
115
+ looksLikeProblemSolvingQuery
116
+ } from "./chunk-ZZTOURJI.js";
78
117
  import "./chunk-YDBIWGNI.js";
79
118
  import "./chunk-7DHTMOND.js";
80
- import "./chunk-47UU5PU2.js";
119
+ import "./chunk-YCN4BVDK.js";
81
120
  import "./chunk-D654IBA6.js";
82
121
  import "./chunk-H63EDPFJ.js";
83
- import "./chunk-YAZNBMNF.js";
122
+ import {
123
+ applyMemoryWorthFilter,
124
+ buildMemoryWorthCounterMap
125
+ } from "./chunk-3GPTTA4J.js";
126
+ import {
127
+ computeMemoryWorth
128
+ } from "./chunk-IISBCCWR.js";
84
129
  import {
85
130
  hasBroadGraphIntent,
86
131
  inferIntentFromText,
@@ -88,45 +133,62 @@ import {
88
133
  isTaskInitiationIntent,
89
134
  planRecallMode
90
135
  } from "./chunk-GGD5W7TB.js";
136
+ import "./chunk-YAZNBMNF.js";
137
+ import "./chunk-AJU4PJGY.js";
138
+ import "./chunk-DF3RVK3X.js";
91
139
  import {
92
140
  clearVerdictCache,
93
141
  createVerdictCache,
142
+ getVerdictKind,
143
+ isDurableVerdict,
144
+ isValidCachedVerdict,
94
145
  judgeFactDurability,
146
+ normalizeCachedVerdict,
95
147
  verdictCacheSize
96
- } from "./chunk-LAYN4LDC.js";
148
+ } from "./chunk-C4SQJZAF.js";
97
149
  import {
98
150
  ExtractionEngine
99
- } from "./chunk-3SV6CQHO.js";
100
- import "./chunk-UEYA6UC7.js";
151
+ } from "./chunk-DIXB44VE.js";
152
+ import "./chunk-NZLQTHS5.js";
153
+ import "./chunk-54V4BZWP.js";
101
154
  import "./chunk-NBNN5GOB.js";
102
155
  import "./chunk-FEMOX5AD.js";
103
- import "./chunk-JL2PU6AI.js";
156
+ import "./chunk-R2XRID2N.js";
157
+ import "./chunk-VEWZZM3H.js";
158
+ import {
159
+ resolveCategory
160
+ } from "./chunk-6AUUAZEX.js";
161
+ import {
162
+ FILTER_LABELS,
163
+ isDirectAnswerEligible
164
+ } from "./chunk-Y4FHOFJ2.js";
165
+ import "./chunk-Z2E7VW55.js";
166
+ import {
167
+ buildEntityRecallSection
168
+ } from "./chunk-FVA6TGI3.js";
104
169
  import {
105
170
  buildExtensionsFooterForSummary,
106
171
  loadDaySummaryPrompt
107
172
  } from "./chunk-GZCUW5IC.js";
108
- import "./chunk-VEWZZM3H.js";
109
- import "./chunk-ALXMCZEU.js";
110
173
  import {
111
- buildEntityRecallSection
112
- } from "./chunk-7WQ6SLIE.js";
113
- import "./chunk-PAORGQRI.js";
114
- import "./chunk-6UJ47TVX.js";
174
+ expandTildePath
175
+ } from "./chunk-GA5P7RST.js";
115
176
  import "./chunk-PYXS46O7.js";
116
177
  import "./chunk-3QKK7QOS.js";
178
+ import "./chunk-CUPFXL3J.js";
117
179
  import "./chunk-JRNQ3RNA.js";
118
- import "./chunk-JIU55F3X.js";
180
+ import "./chunk-SPI27QT6.js";
119
181
  import "./chunk-CULXMQJH.js";
120
182
  import "./chunk-E6K4NIEU.js";
121
183
  import {
122
184
  LanceDbBackend,
123
185
  MeilisearchBackend,
124
186
  OramaBackend
125
- } from "./chunk-ZVBB3T7V.js";
187
+ } from "./chunk-NBVAS5MT.js";
126
188
  import "./chunk-YRMVARQP.js";
127
189
  import {
128
190
  QmdClient
129
- } from "./chunk-BLKTA7MM.js";
191
+ } from "./chunk-4HQS2HPX.js";
130
192
  import {
131
193
  LEGACY_PLUGIN_ID,
132
194
  PLUGIN_ID,
@@ -135,21 +197,29 @@ import {
135
197
  import "./chunk-EABGC2TL.js";
136
198
  import "./chunk-LOBRX7VD.js";
137
199
  import "./chunk-HMDCOMYU.js";
138
- import "./chunk-J4IYOZZ5.js";
139
- import "./chunk-LK6SGL53.js";
200
+ import "./chunk-JXS5PDQ7.js";
201
+ import {
202
+ launchProcessSync
203
+ } from "./chunk-OR64ZGRZ.js";
140
204
  import "./chunk-7SEAZFFB.js";
141
205
  import "./chunk-K6WK37A6.js";
206
+ import {
207
+ coerceInstallExtension,
208
+ parseConfig
209
+ } from "./chunk-BECYBZLX.js";
210
+ import "./chunk-Z5LAYHGJ.js";
211
+ import "./chunk-C6QPK5GG.js";
212
+ import "./chunk-C2EFFULQ.js";
142
213
  import {
143
214
  CODEX_THREAD_KEY_PREFIX
144
215
  } from "./chunk-3PG3H5TD.js";
145
216
  import "./chunk-FYIYMQ5N.js";
146
217
  import "./chunk-2NMMFZ5T.js";
218
+ import "./chunk-KVE7R4CG.js";
219
+ import "./chunk-4WMCPJWX.js";
147
220
  import {
148
- coerceInstallExtension,
149
- parseConfig
150
- } from "./chunk-MBJHSA7F.js";
151
- import "./chunk-Z5LAYHGJ.js";
152
- import "./chunk-C6QPK5GG.js";
221
+ SmartBuffer
222
+ } from "./chunk-JBMSGZEQ.js";
153
223
  import {
154
224
  MATERIALIZE_VERSION,
155
225
  SENTINEL_FILE,
@@ -159,7 +229,7 @@ import {
159
229
  materializeForNamespace,
160
230
  runCodexMaterialize,
161
231
  runPostConsolidationMaterialize
162
- } from "./chunk-SYUK3VLY.js";
232
+ } from "./chunk-PVICZTKG.js";
163
233
  import {
164
234
  REMNIC_EXTENSIONS_TOTAL_TOKEN_LIMIT,
165
235
  discoverMemoryExtensions,
@@ -169,68 +239,72 @@ import {
169
239
  } from "./chunk-EJI5XIBB.js";
170
240
  import {
171
241
  FallbackLlmClient
172
- } from "./chunk-44ICJRF3.js";
173
- import "./chunk-XZ2TIKGC.js";
174
- import "./chunk-Y27UJK6V.js";
242
+ } from "./chunk-AYXIPSZO.js";
243
+ import "./chunk-Y7R2XJ5Q.js";
175
244
  import "./chunk-ODWDQNRE.js";
245
+ import "./chunk-Y27UJK6V.js";
176
246
  import "./chunk-UZB5KHKX.js";
177
- import "./chunk-C2EFFULQ.js";
178
- import "./chunk-4WMCPJWX.js";
179
247
  import "./chunk-6HZ6AO2P.js";
180
248
  import "./chunk-JWPLJLDU.js";
181
249
  import {
182
250
  BootstrapEngine
183
251
  } from "./chunk-N53K2EXC.js";
184
- import "./chunk-URB2WSKZ.js";
185
- import "./chunk-UVJFDP7P.js";
186
252
  import "./chunk-XYIK4LF6.js";
253
+ import "./chunk-URB2WSKZ.js";
187
254
  import "./chunk-PVGDJXVK.js";
188
255
  import "./chunk-NGAVDO7E.js";
189
256
  import {
190
257
  EngramAccessHttpServer
191
- } from "./chunk-37UIFYWO.js";
258
+ } from "./chunk-UWB5LMWY.js";
192
259
  import {
193
260
  EngramMcpServer
194
- } from "./chunk-NQEVYWX6.js";
261
+ } from "./chunk-OC5OXUQ4.js";
195
262
  import {
196
263
  buildCitationGuidance,
197
264
  formatOaiMemCitation,
198
265
  parseOaiMemCitation,
199
266
  sanitizeNoteForCitation
200
267
  } from "./chunk-IQT3XTKW.js";
201
- import "./chunk-MARWOCVP.js";
202
- import {
203
- formatZodError,
204
- memoryStoreRequestSchema,
205
- observeRequestSchema,
206
- recallRequestSchema,
207
- suggestionSubmitRequestSchema,
208
- validateRequest
209
- } from "./chunk-MTLYEMJB.js";
210
268
  import {
211
269
  EngramAccessInputError,
212
- EngramAccessService
213
- } from "./chunk-MVTHXUBX.js";
214
- import "./chunk-ITRLGI2T.js";
270
+ EngramAccessService,
271
+ computeProcedureStats,
272
+ formatProcedureStatsText
273
+ } from "./chunk-STGWEHYR.js";
274
+ import {
275
+ RECALL_XRAY_FORMATS,
276
+ parseXrayFormat,
277
+ renderXray,
278
+ renderXrayJson,
279
+ renderXrayMarkdown,
280
+ renderXrayText
281
+ } from "./chunk-ZAIM4TUE.js";
282
+ import "./chunk-SOBJ6NEY.js";
283
+ import "./chunk-3OGMS3PE.js";
215
284
  import {
216
285
  isTrustZoneName
217
286
  } from "./chunk-EQINRHYR.js";
218
- import "./chunk-QDYXG4CS.js";
219
- import "./chunk-QNJMBKFK.js";
287
+ import {
288
+ memoryWorthOutcomeEligibleCategories,
289
+ recordMemoryOutcome
290
+ } from "./chunk-EIR5VLIH.js";
220
291
  import "./chunk-EEQLFRUM.js";
221
292
  import {
222
293
  buildProcedureMarkdownBody,
223
294
  parseProcedureStepsFromBody
224
295
  } from "./chunk-QDW3E4RD.js";
225
- import "./chunk-4NRAJUDS.js";
296
+ import "./chunk-3FPTCC3Z.js";
297
+ import "./chunk-2LGMW3DJ.js";
298
+ import {
299
+ CrossNamespaceBudget,
300
+ DEFAULT_CROSS_NAMESPACE_BUDGET
301
+ } from "./chunk-GDFS42HT.js";
302
+ import "./chunk-RBBWYEFJ.js";
226
303
  import "./chunk-DT5TVLJE.js";
227
304
  import {
228
305
  resolvePrincipal
229
306
  } from "./chunk-N5AKDXAI.js";
230
307
  import "./chunk-TBBDFYXW.js";
231
- import "./chunk-DGXUHMOV.js";
232
- import "./chunk-LPSF4OQH.js";
233
- import "./chunk-XKECPATV.js";
234
308
  import {
235
309
  BRIEFING_FORMAT_ALLOWED,
236
310
  FileCalendarSource,
@@ -243,11 +317,11 @@ import {
243
317
  renderBriefingMarkdown,
244
318
  resolveBriefingSaveDir,
245
319
  validateBriefingFormat
246
- } from "./chunk-4LACOVZX.js";
320
+ } from "./chunk-L7IXWRYE.js";
247
321
  import {
248
322
  StorageManager
249
- } from "./chunk-GV6NLQ4X.js";
250
- import "./chunk-3WHVNEN7.js";
323
+ } from "./chunk-F5VP6YCB.js";
324
+ import "./chunk-LTCGGW2D.js";
251
325
  import {
252
326
  CITATION_UNKNOWN,
253
327
  DEFAULT_CITATION_FORMAT,
@@ -259,25 +333,198 @@ import {
259
333
  parseCitation,
260
334
  stripCitation
261
335
  } from "./chunk-4KAN3GZ3.js";
262
- import {
263
- createVersion,
264
- diffVersions,
265
- getVersion,
266
- listVersions,
267
- revertToVersion
268
- } from "./chunk-6ZH4TU6I.js";
269
- import "./chunk-SCU65EZI.js";
270
- import "./chunk-BOUYNNYD.js";
271
336
  import "./chunk-6PFRXT4K.js";
272
337
  import "./chunk-TP4FZJIZ.js";
338
+ import "./chunk-SCU65EZI.js";
339
+ import "./chunk-BOUYNNYD.js";
273
340
  import "./chunk-DM2T26WE.js";
274
341
  import "./chunk-QSVPYQPG.js";
275
342
  import "./chunk-M62O4P4T.js";
276
343
  import "./chunk-4DJQYKMN.js";
344
+ import "./chunk-X6GF3FX2.js";
345
+ import {
346
+ createVersion,
347
+ diffVersions,
348
+ getVersion,
349
+ listVersions,
350
+ revertToVersion
351
+ } from "./chunk-FAAFWE4G.js";
352
+ import {
353
+ mergeEnv,
354
+ readEnvVar,
355
+ resolveHomeDir
356
+ } from "./chunk-MARWOCVP.js";
277
357
  import {
278
358
  initLogger,
279
359
  log
280
360
  } from "./chunk-2ODBA7MQ.js";
361
+ import "./chunk-DGXUHMOV.js";
362
+ import "./chunk-LPSF4OQH.js";
363
+ import {
364
+ AccessAuditAdapter
365
+ } from "./chunk-TVVEYCNW.js";
366
+ import {
367
+ DEFAULT_ANOMALY_DETECTOR_CONFIG,
368
+ detectRecallAnomalies,
369
+ normalizeQueryText
370
+ } from "./chunk-RFYAYKTD.js";
371
+ import "./chunk-LBLXEFWK.js";
372
+ import "./chunk-XKECPATV.js";
373
+ import {
374
+ formatZodError,
375
+ memoryStoreRequestSchema,
376
+ observeRequestSchema,
377
+ recallRequestSchema,
378
+ suggestionSubmitRequestSchema,
379
+ validateRequest
380
+ } from "./chunk-WCLICCGB.js";
381
+
382
+ // src/coding/review-context.ts
383
+ var REVIEW_KEYWORD_PATTERNS = [
384
+ /\breview\b/i,
385
+ /\bdiff\b/i,
386
+ /\bwhat changed\b/i,
387
+ /\blook at this pr\b/i,
388
+ /\bwhat('?s|\s+is)\s+in\s+this\s+(pr|patch|diff|change)\b/i,
389
+ /\bcode review\b/i
390
+ ];
391
+ function isReviewPrompt(prompt) {
392
+ if (typeof prompt !== "string") return false;
393
+ const trimmed = prompt.trim();
394
+ if (!trimmed) return false;
395
+ return REVIEW_KEYWORD_PATTERNS.some((re) => re.test(trimmed));
396
+ }
397
+ function parseTouchedFiles(diff) {
398
+ if (typeof diff !== "string" || !diff.trim()) return [];
399
+ const touched = /* @__PURE__ */ new Set();
400
+ const lines = diff.split(/\r?\n/);
401
+ for (const line of lines) {
402
+ const gitPrefix = line.match(/^diff --git\s+/);
403
+ if (gitPrefix) {
404
+ const rest = line.slice(gitPrefix[0].length);
405
+ const paths = splitDiffGitPaths(rest);
406
+ if (paths) {
407
+ for (const raw of paths) {
408
+ const stripped = stripDiffPathPrefix(raw);
409
+ if (stripped && stripped !== "/dev/null") touched.add(stripped);
410
+ }
411
+ }
412
+ continue;
413
+ }
414
+ const headerPrefix = line.match(/^(?:---|\+\+\+)[ \t]+/);
415
+ if (headerPrefix) {
416
+ const tail = line.slice(headerPrefix[0].length).replace(/[ \t]+$/, "");
417
+ const raw = extractSingleDiffPathToken(tail);
418
+ if (raw) {
419
+ const stripped = stripDiffPathPrefix(raw);
420
+ if (stripped && stripped !== "/dev/null") touched.add(stripped);
421
+ }
422
+ }
423
+ }
424
+ return Array.from(touched).sort();
425
+ }
426
+ function extractSingleDiffPathToken(tail) {
427
+ if (tail.length === 0) return null;
428
+ if (tail[0] === '"') {
429
+ let j2 = 1;
430
+ while (j2 < tail.length) {
431
+ if (tail[j2] === "\\" && j2 + 1 < tail.length) {
432
+ j2 += 2;
433
+ continue;
434
+ }
435
+ if (tail[j2] === '"') break;
436
+ j2 += 1;
437
+ }
438
+ if (j2 >= tail.length) return null;
439
+ return tail.slice(0, j2 + 1);
440
+ }
441
+ let j = 0;
442
+ while (j < tail.length && tail[j] !== " " && tail[j] !== " ") j += 1;
443
+ return tail.slice(0, j);
444
+ }
445
+ function splitDiffGitPaths(rest) {
446
+ const tokens = [];
447
+ let i = 0;
448
+ while (i < rest.length && tokens.length < 2) {
449
+ while (i < rest.length && (rest[i] === " " || rest[i] === " ")) i += 1;
450
+ if (i >= rest.length) break;
451
+ if (rest[i] === '"') {
452
+ let j = i + 1;
453
+ while (j < rest.length) {
454
+ if (rest[j] === "\\" && j + 1 < rest.length) {
455
+ j += 2;
456
+ continue;
457
+ }
458
+ if (rest[j] === '"') break;
459
+ j += 1;
460
+ }
461
+ if (j >= rest.length) return null;
462
+ tokens.push(rest.slice(i, j + 1));
463
+ i = j + 1;
464
+ } else {
465
+ let j = i;
466
+ while (j < rest.length && rest[j] !== " " && rest[j] !== " ") j += 1;
467
+ tokens.push(rest.slice(i, j));
468
+ i = j;
469
+ }
470
+ }
471
+ if (tokens.length !== 2) return null;
472
+ return [tokens[0], tokens[1]];
473
+ }
474
+ function stripDiffPathPrefix(raw) {
475
+ let s = raw;
476
+ if (s.length >= 2 && s[0] === '"' && s[s.length - 1] === '"') {
477
+ s = s.slice(1, -1);
478
+ s = s.replace(/\\(["\\])/g, "$1");
479
+ }
480
+ s = s.replace(/\\/g, "/");
481
+ if (s.startsWith("a/") || s.startsWith("b/")) s = s.slice(2);
482
+ return s;
483
+ }
484
+ var BOOST_PER_MATCH = 0.5;
485
+ var MAX_BOOST = 1;
486
+ function countPathHits(entityRefs, touchedFiles) {
487
+ if (!entityRefs || entityRefs.length === 0) return 0;
488
+ if (touchedFiles.length === 0) return 0;
489
+ let hits = 0;
490
+ for (const ref of entityRefs) {
491
+ if (typeof ref !== "string" || !ref) continue;
492
+ const lowered = ref.toLowerCase();
493
+ for (const file of touchedFiles) {
494
+ const flower = file.toLowerCase();
495
+ if (lowered === flower) {
496
+ hits += 1;
497
+ break;
498
+ }
499
+ if (lowered.includes(flower) || flower.includes(lowered)) {
500
+ hits += 1;
501
+ break;
502
+ }
503
+ }
504
+ }
505
+ return hits;
506
+ }
507
+ function rankReviewCandidates(candidates, touchedFiles) {
508
+ const annotated = candidates.map((c) => {
509
+ const hits = countPathHits(c.entityRefs, touchedFiles);
510
+ const boost = Math.min(MAX_BOOST, hits * BOOST_PER_MATCH);
511
+ return { ...c, boost };
512
+ });
513
+ annotated.sort((a, b) => {
514
+ const adjA = a.score + a.boost;
515
+ const adjB = b.score + b.boost;
516
+ if (adjA !== adjB) return adjB - adjA;
517
+ if (a.id < b.id) return -1;
518
+ if (a.id > b.id) return 1;
519
+ return 0;
520
+ });
521
+ return annotated;
522
+ }
523
+ function packReviewContext(input) {
524
+ const touchedFiles = parseTouchedFiles(input.diff);
525
+ const rankedRecall = rankReviewCandidates(input.candidates, touchedFiles);
526
+ return { touchedFiles, rankedRecall };
527
+ }
281
528
 
282
529
  // src/binary-lifecycle/types.ts
283
530
  var DEFAULT_SCAN_PATTERNS = [
@@ -690,7 +937,8 @@ var CATEGORY_DIR_MAP = {
690
937
  rule: "rules",
691
938
  skill: "skills",
692
939
  relationship: "relationships",
693
- procedure: "procedures"
940
+ procedure: "procedures",
941
+ reasoning_trace: "reasoning-traces"
694
942
  };
695
943
  var ALL_CATEGORY_DIRS = [
696
944
  "facts",
@@ -2193,7 +2441,6 @@ function hashContent3(content) {
2193
2441
  import fs8 from "fs";
2194
2442
  import path13 from "path";
2195
2443
  import os from "os";
2196
- import { spawnSync } from "child_process";
2197
2444
  import { createRequire } from "module";
2198
2445
  import { fileURLToPath } from "url";
2199
2446
 
@@ -2742,7 +2989,8 @@ var BUILTIN_CONNECTORS = [
2742
2989
  ];
2743
2990
  var REGISTRY_DIR_NAME = ".engram-connectors";
2744
2991
  function getRegistryPath() {
2745
- const configDir = process.env.XDG_CONFIG_HOME ? path13.join(process.env.XDG_CONFIG_HOME, "engram") : path13.join(process.env.HOME ?? "~", ".config", "engram");
2992
+ const xdgConfigHome = readEnvVar("XDG_CONFIG_HOME");
2993
+ const configDir = xdgConfigHome ? path13.join(xdgConfigHome, "engram") : path13.join(resolveHomeDir(), ".config", "engram");
2746
2994
  return path13.join(configDir, REGISTRY_DIR_NAME, "registry.json");
2747
2995
  }
2748
2996
  function loadRegistry() {
@@ -3481,7 +3729,7 @@ function sanitizeHermesProfile(profile) {
3481
3729
  }
3482
3730
  function hermesConfigPath(profile) {
3483
3731
  const safeProfile = sanitizeHermesProfile(profile);
3484
- const profilesRoot = path13.resolve(process.env.HOME ?? os.homedir(), ".hermes", "profiles");
3732
+ const profilesRoot = path13.resolve(resolveHomeDir(), ".hermes", "profiles");
3485
3733
  const cfgPath = path13.resolve(profilesRoot, safeProfile, "config.yaml");
3486
3734
  const rel = path13.relative(profilesRoot, cfgPath);
3487
3735
  if (rel.startsWith("..") || path13.isAbsolute(rel)) {
@@ -3679,13 +3927,14 @@ function checkDaemonHealth(host, port, authToken) {
3679
3927
  const bareHost = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
3680
3928
  const script = [
3681
3929
  "const http = require('http');",
3930
+ "const env = process['env'];",
3682
3931
  "const headers = {};",
3683
- "if (process.env.REMNIC_HEALTH_TOKEN) {",
3684
- " headers['authorization'] = 'Bearer ' + process.env.REMNIC_HEALTH_TOKEN;",
3932
+ "if (env.REMNIC_HEALTH_TOKEN) {",
3933
+ " headers['authorization'] = 'Bearer ' + env.REMNIC_HEALTH_TOKEN;",
3685
3934
  "}",
3686
3935
  "const req = http.get({",
3687
- " host: process.env.REMNIC_HEALTH_HOST,",
3688
- " port: parseInt(process.env.REMNIC_HEALTH_PORT, 10),",
3936
+ " host: env.REMNIC_HEALTH_HOST,",
3937
+ " port: parseInt(env.REMNIC_HEALTH_PORT, 10),",
3689
3938
  " path: '/engram/v1/health',",
3690
3939
  " headers,",
3691
3940
  " timeout: 3000,",
@@ -3693,16 +3942,16 @@ function checkDaemonHealth(host, port, authToken) {
3693
3942
  "req.on('error', () => process.exit(1));",
3694
3943
  "req.on('timeout', () => { req.destroy(); process.exit(1); });"
3695
3944
  ].join("\n");
3696
- const env = {
3697
- ...process.env,
3945
+ const env = mergeEnv({
3698
3946
  REMNIC_HEALTH_HOST: bareHost,
3699
3947
  REMNIC_HEALTH_PORT: String(safePort)
3700
- };
3948
+ });
3701
3949
  if (authToken) {
3702
3950
  env.REMNIC_HEALTH_TOKEN = authToken;
3703
3951
  }
3704
- const spawnOpts = { timeout: 4e3, env };
3705
- const result = spawnSync(process.execPath, ["-e", script], spawnOpts);
3952
+ const processPath = process.execPath;
3953
+ const launchOptions = { timeout: 4e3, env };
3954
+ const result = launchProcessSync(processPath, ["-e", script], launchOptions);
3706
3955
  if (result.status === HEALTH_EXIT_OK) {
3707
3956
  return true;
3708
3957
  }
@@ -3710,11 +3959,11 @@ function checkDaemonHealth(host, port, authToken) {
3710
3959
  console.error(
3711
3960
  "[remnic/connectors] health probe got 401 \u2014 retrying after token cache TTL..."
3712
3961
  );
3713
- spawnSync(process.execPath, ["-e", "setTimeout(() => {}, 6000)"], {
3962
+ launchProcessSync(processPath, ["-e", "setTimeout(() => {}, 6000)"], {
3714
3963
  timeout: 7e3,
3715
3964
  env: {}
3716
3965
  });
3717
- const retry = spawnSync(process.execPath, ["-e", script], spawnOpts);
3966
+ const retry = launchProcessSync(processPath, ["-e", script], launchOptions);
3718
3967
  return retry.status === HEALTH_EXIT_OK;
3719
3968
  }
3720
3969
  return false;
@@ -3780,11 +4029,11 @@ function resolveCodexHome(override) {
3780
4029
  if (override && typeof override === "string" && override.trim().length > 0) {
3781
4030
  return path13.resolve(override.trim());
3782
4031
  }
3783
- const envHome = process.env.CODEX_HOME;
4032
+ const envHome = readEnvVar("CODEX_HOME");
3784
4033
  if (envHome && envHome.trim().length > 0) {
3785
4034
  return path13.resolve(envHome.trim());
3786
4035
  }
3787
- const home = process.env.HOME ?? process.env.USERPROFILE ?? "~";
4036
+ const home = readEnvVar("HOME") || readEnvVar("USERPROFILE") || resolveHomeDir();
3788
4037
  return path13.resolve(home, ".codex");
3789
4038
  }
3790
4039
  function resolveCodexMemoryExtensionPaths(codexHomeOverride) {
@@ -3998,17 +4247,18 @@ function removeCodexMemoryExtension(options = {}) {
3998
4247
  return { ...paths, removed };
3999
4248
  }
4000
4249
  function getConnectorsDir() {
4001
- const configDir = process.env.XDG_CONFIG_HOME ? path13.join(process.env.XDG_CONFIG_HOME, "engram") : path13.join(process.env.HOME ?? "~", ".config", "engram");
4250
+ const xdgConfigHome = readEnvVar("XDG_CONFIG_HOME");
4251
+ const configDir = xdgConfigHome ? path13.join(xdgConfigHome, "engram") : path13.join(resolveHomeDir(), ".config", "engram");
4002
4252
  return path13.join(configDir, REGISTRY_DIR_NAME, "connectors");
4003
4253
  }
4004
4254
  var WECLONE_PROXY_CONFIG_DIRNAME = ".remnic";
4005
4255
  var WECLONE_PROXY_CONFIG_FILENAME = "weclone.json";
4006
4256
  function resolveWeCloneProxyConfigPath() {
4007
- const override = process.env.REMNIC_HOME ?? process.env.ENGRAM_HOME;
4257
+ const override = readEnvVar("REMNIC_HOME") ?? readEnvVar("ENGRAM_HOME");
4008
4258
  if (override && override.length > 0) {
4009
4259
  return path13.resolve(override, "connectors", WECLONE_PROXY_CONFIG_FILENAME);
4010
4260
  }
4011
- const envHome = process.env.HOME;
4261
+ const envHome = readEnvVar("HOME");
4012
4262
  const home = envHome && envHome.length > 0 ? envHome : os.homedir();
4013
4263
  return path13.resolve(
4014
4264
  home,
@@ -4145,7 +4395,7 @@ import path14 from "path";
4145
4395
  import crypto6 from "crypto";
4146
4396
  var MANIFEST_VERSION = 1;
4147
4397
  function getSpacesDir(baseDir) {
4148
- const homeDir = baseDir ?? process.env.HOME ?? "~";
4398
+ const homeDir = baseDir ?? resolveHomeDir();
4149
4399
  return path14.join(homeDir, ".config", "engram", "spaces");
4150
4400
  }
4151
4401
  function getManifestPath(baseDir) {
@@ -4172,10 +4422,10 @@ function saveManifest(manifest, baseDir) {
4172
4422
  fs9.writeFileSync(manifestPath2, JSON.stringify(manifest, null, 2) + "\n");
4173
4423
  }
4174
4424
  function createPersonalSpace(baseDir, memoryDirOverride) {
4175
- const homeDir = baseDir ?? process.env.HOME ?? "~";
4425
+ const homeDir = baseDir ?? resolveHomeDir();
4176
4426
  const standalonePath = path14.join(homeDir, ".engram", "memory");
4177
4427
  const openclawPath = path14.join(homeDir, ".openclaw", "workspace", "memory", "local");
4178
- const memoryDir = memoryDirOverride ?? process.env.ENGRAM_MEMORY_DIR ?? (fs9.existsSync(standalonePath) ? standalonePath : fs9.existsSync(openclawPath) ? openclawPath : standalonePath);
4428
+ const memoryDir = memoryDirOverride ?? readEnvVar("ENGRAM_MEMORY_DIR") ?? (fs9.existsSync(standalonePath) ? standalonePath : fs9.existsSync(openclawPath) ? openclawPath : standalonePath);
4179
4429
  const now = (/* @__PURE__ */ new Date()).toISOString();
4180
4430
  return {
4181
4431
  id: "personal",
@@ -4185,7 +4435,7 @@ function createPersonalSpace(baseDir, memoryDirOverride) {
4185
4435
  memoryDir,
4186
4436
  createdAt: now,
4187
4437
  updatedAt: now,
4188
- owner: process.env.USER
4438
+ owner: readEnvVar("USER")
4189
4439
  };
4190
4440
  }
4191
4441
  function listSpaces(baseDir) {
@@ -4221,7 +4471,7 @@ function createSpace(options) {
4221
4471
  memoryDir,
4222
4472
  createdAt: now,
4223
4473
  updatedAt: now,
4224
- owner: process.env.USER,
4474
+ owner: readEnvVar("USER"),
4225
4475
  parentSpaceId: options.parentSpaceId
4226
4476
  };
4227
4477
  fs9.mkdirSync(memoryDir, { recursive: true });
@@ -4605,13 +4855,12 @@ var CodexMemoryExtensionPublisher = class {
4605
4855
  readPathTemplate: true
4606
4856
  };
4607
4857
  async resolveExtensionRoot(env) {
4608
- const e = env ?? process.env;
4609
- const codexHome = e.CODEX_HOME?.trim() || path15.join(e.HOME ?? os2.homedir(), ".codex");
4858
+ const codexHome = env === void 0 ? readEnvVar("CODEX_HOME")?.trim() || path15.join(resolveHomeDir(), ".codex") : env.CODEX_HOME?.trim() || path15.join(env.HOME ?? env.USERPROFILE ?? os2.homedir(), ".codex");
4610
4859
  return path15.join(codexHome, "memories_extensions", REMNIC_EXTENSION_DIR_NAME2);
4611
4860
  }
4612
4861
  async isHostAvailable() {
4613
4862
  try {
4614
- const home = process.env.CODEX_HOME?.trim() || path15.join(process.env.HOME ?? os2.homedir(), ".codex");
4863
+ const home = readEnvVar("CODEX_HOME")?.trim() || path15.join(resolveHomeDir(), ".codex");
4615
4864
  return fs10.existsSync(home);
4616
4865
  } catch {
4617
4866
  return false;
@@ -4777,237 +5026,6 @@ function publisherForConnector(connectorId) {
4777
5026
  return publisherFor(hostIdForConnector(connectorId));
4778
5027
  }
4779
5028
 
4780
- // src/taxonomy/default-taxonomy.ts
4781
- var DEFAULT_TAXONOMY = {
4782
- version: 1,
4783
- categories: [
4784
- {
4785
- id: "corrections",
4786
- name: "Corrections",
4787
- description: "Corrections to previously stored information",
4788
- filingRules: ["Any update that supersedes a prior fact"],
4789
- priority: 10,
4790
- memoryCategories: ["correction"]
4791
- },
4792
- {
4793
- id: "principles",
4794
- name: "Principles",
4795
- description: "Rules, guidelines, and recurring patterns",
4796
- filingRules: ["A guiding principle, rule, or skill"],
4797
- priority: 20,
4798
- memoryCategories: ["principle", "rule", "skill"]
4799
- },
4800
- {
4801
- id: "procedures",
4802
- name: "Procedures",
4803
- description: "Ordered multi-step workflows the user repeats",
4804
- filingRules: ["A repeatable sequence of steps or commands for a task"],
4805
- priority: 25,
4806
- memoryCategories: ["procedure"]
4807
- },
4808
- {
4809
- id: "entities",
4810
- name: "Entities",
4811
- description: "People, organizations, places, projects",
4812
- filingRules: ["Named entity with attributes"],
4813
- priority: 30,
4814
- memoryCategories: ["entity", "relationship"]
4815
- },
4816
- {
4817
- id: "decisions",
4818
- name: "Decisions",
4819
- description: "Choices made and their rationale",
4820
- filingRules: ["A decision or commitment with reasoning"],
4821
- priority: 35,
4822
- memoryCategories: ["decision", "commitment"]
4823
- },
4824
- {
4825
- id: "preferences",
4826
- name: "Preferences",
4827
- description: "User likes, dislikes, and style choices",
4828
- filingRules: ["Anything expressing a preference or taste"],
4829
- priority: 40,
4830
- memoryCategories: ["preference"]
4831
- },
4832
- {
4833
- id: "facts",
4834
- name: "Facts",
4835
- description: "Objective statements about the world",
4836
- filingRules: ["Any factual claim or piece of information"],
4837
- priority: 50,
4838
- memoryCategories: ["fact"]
4839
- },
4840
- {
4841
- id: "moments",
4842
- name: "Moments",
4843
- description: "Significant events or experiences",
4844
- filingRules: ["A specific event worth remembering"],
4845
- priority: 60,
4846
- memoryCategories: ["moment"]
4847
- }
4848
- ]
4849
- };
4850
-
4851
- // src/taxonomy/resolver-doc-generator.ts
4852
- function generateResolverDocument(taxonomy) {
4853
- const sorted = [...taxonomy.categories].sort((a, b) => {
4854
- if (a.priority !== b.priority) return a.priority - b.priority;
4855
- return a.id.localeCompare(b.id);
4856
- });
4857
- const lines = [
4858
- "# Memory Filing Resolver",
4859
- "",
4860
- "Given a new piece of knowledge, follow this tree to determine where it belongs.",
4861
- ""
4862
- ];
4863
- let step = 1;
4864
- for (const cat of sorted) {
4865
- lines.push(`## Step ${step}: ${cat.description}?`);
4866
- lines.push("");
4867
- for (const rule of cat.filingRules) {
4868
- lines.push(`- ${rule}`);
4869
- }
4870
- lines.push("");
4871
- lines.push(
4872
- `> YES: File under **${cat.id}/** (priority ${cat.priority})`
4873
- );
4874
- lines.push("");
4875
- step++;
4876
- }
4877
- lines.push("## Tie-breaking");
4878
- lines.push("");
4879
- lines.push(
4880
- "If a fact could go in multiple categories, file under the one with the **lowest priority number**."
4881
- );
4882
- lines.push("");
4883
- lines.push(`---`);
4884
- lines.push(`*Generated from taxonomy v${taxonomy.version}*`);
4885
- lines.push("");
4886
- return lines.join("\n");
4887
- }
4888
-
4889
- // src/taxonomy/taxonomy-loader.ts
4890
- import { readFile, mkdir, writeFile } from "fs/promises";
4891
- import path16 from "path";
4892
- var TAXONOMY_DIR = ".taxonomy";
4893
- var TAXONOMY_FILE = "taxonomy.json";
4894
- var MAX_SLUG_LENGTH = 32;
4895
- var SLUG_RE = /^[a-z][a-z0-9-]*$/;
4896
- function validateSlug(slug) {
4897
- if (slug.length === 0) {
4898
- throw new Error("Taxonomy category ID must not be empty");
4899
- }
4900
- if (slug.length > MAX_SLUG_LENGTH) {
4901
- throw new Error(
4902
- `Taxonomy category ID "${slug}" exceeds ${MAX_SLUG_LENGTH} characters`
4903
- );
4904
- }
4905
- if (!SLUG_RE.test(slug)) {
4906
- throw new Error(
4907
- `Taxonomy category ID "${slug}" is invalid: must be lowercase letters, digits, and hyphens, starting with a letter`
4908
- );
4909
- }
4910
- }
4911
- function validateTaxonomy(taxonomy) {
4912
- if (typeof taxonomy.version !== "number" || taxonomy.version < 1) {
4913
- throw new Error("Taxonomy version must be a positive integer");
4914
- }
4915
- if (!Array.isArray(taxonomy.categories)) {
4916
- throw new Error("Taxonomy categories must be an array");
4917
- }
4918
- const seenIds = /* @__PURE__ */ new Set();
4919
- for (const cat of taxonomy.categories) {
4920
- validateSlug(cat.id);
4921
- if (seenIds.has(cat.id)) {
4922
- throw new Error(`Duplicate taxonomy category ID: "${cat.id}"`);
4923
- }
4924
- seenIds.add(cat.id);
4925
- if (typeof cat.name !== "string" || cat.name.trim().length === 0) {
4926
- throw new Error(`Taxonomy category "${cat.id}" must have a non-empty name`);
4927
- }
4928
- if (typeof cat.description !== "string" || cat.description.trim().length === 0) {
4929
- throw new Error(`Taxonomy category "${cat.id}" must have a non-empty description`);
4930
- }
4931
- if (!Array.isArray(cat.filingRules)) {
4932
- throw new Error(`Taxonomy category "${cat.id}" filingRules must be an array`);
4933
- }
4934
- if (typeof cat.priority !== "number" || !Number.isFinite(cat.priority)) {
4935
- throw new Error(`Taxonomy category "${cat.id}" must have a finite numeric priority`);
4936
- }
4937
- if (!Array.isArray(cat.memoryCategories)) {
4938
- throw new Error(`Taxonomy category "${cat.id}" memoryCategories must be an array`);
4939
- }
4940
- if (cat.parentId !== void 0) {
4941
- if (typeof cat.parentId !== "string") {
4942
- throw new Error(`Taxonomy category "${cat.id}" parentId must be a string if set`);
4943
- }
4944
- }
4945
- }
4946
- for (const cat of taxonomy.categories) {
4947
- if (cat.parentId !== void 0 && !seenIds.has(cat.parentId)) {
4948
- throw new Error(
4949
- `Taxonomy category "${cat.id}" references unknown parentId "${cat.parentId}"`
4950
- );
4951
- }
4952
- }
4953
- }
4954
- async function loadTaxonomy(memoryDir) {
4955
- const taxonomyPath = path16.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
4956
- let raw;
4957
- try {
4958
- raw = await readFile(taxonomyPath, "utf-8");
4959
- } catch (err) {
4960
- if (err instanceof Error && err.code === "ENOENT") {
4961
- return structuredClone(DEFAULT_TAXONOMY);
4962
- }
4963
- throw err;
4964
- }
4965
- const parsed = JSON.parse(raw);
4966
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
4967
- throw new Error("taxonomy.json must be a JSON object");
4968
- }
4969
- const obj = parsed;
4970
- const userVersion = typeof obj.version === "number" ? obj.version : DEFAULT_TAXONOMY.version;
4971
- const userCategories = Array.isArray(obj.categories) ? obj.categories : [];
4972
- const userIdCounts = /* @__PURE__ */ new Map();
4973
- for (const cat of userCategories) {
4974
- const id = typeof cat.id === "string" ? cat.id : String(cat.id);
4975
- userIdCounts.set(id, (userIdCounts.get(id) ?? 0) + 1);
4976
- }
4977
- const duplicateIds = [...userIdCounts.entries()].filter(([, count]) => count > 1).map(([id]) => id);
4978
- if (duplicateIds.length > 0) {
4979
- throw new Error(
4980
- `Duplicate category IDs in taxonomy.json: ${duplicateIds.map((id) => `"${id}"`).join(", ")}`
4981
- );
4982
- }
4983
- const mergedMap = /* @__PURE__ */ new Map();
4984
- for (const cat of DEFAULT_TAXONOMY.categories) {
4985
- mergedMap.set(cat.id, { ...cat });
4986
- }
4987
- for (const cat of userCategories) {
4988
- mergedMap.set(cat.id, cat);
4989
- }
4990
- const merged = {
4991
- version: userVersion,
4992
- categories: [...mergedMap.values()]
4993
- };
4994
- validateTaxonomy(merged);
4995
- return merged;
4996
- }
4997
- async function saveTaxonomy(memoryDir, taxonomy) {
4998
- validateTaxonomy(taxonomy);
4999
- const dir = path16.join(memoryDir, TAXONOMY_DIR);
5000
- await mkdir(dir, { recursive: true });
5001
- const filePath = path16.join(dir, TAXONOMY_FILE);
5002
- await writeFile(filePath, JSON.stringify(taxonomy, null, 2) + "\n", "utf-8");
5003
- }
5004
- function getTaxonomyDir(memoryDir) {
5005
- return path16.join(memoryDir, TAXONOMY_DIR);
5006
- }
5007
- function getTaxonomyFilePath(memoryDir) {
5008
- return path16.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
5009
- }
5010
-
5011
5029
  // src/enrichment/types.ts
5012
5030
  function defaultEnrichmentPipelineConfig() {
5013
5031
  return {
@@ -5233,22 +5251,22 @@ async function runEnrichmentPipeline(entities, registry, config, log2) {
5233
5251
  }
5234
5252
 
5235
5253
  // src/enrichment/audit.ts
5236
- import { mkdir as mkdir2, readFile as readFile2, appendFile } from "fs/promises";
5254
+ import { mkdir, readFile, appendFile } from "fs/promises";
5237
5255
  import { existsSync as existsSync2 } from "fs";
5238
- import path17 from "path";
5256
+ import path16 from "path";
5239
5257
  var AUDIT_FILENAME = "enrichment-audit.jsonl";
5240
5258
  function auditFilePath(auditDir) {
5241
- return path17.join(auditDir, AUDIT_FILENAME);
5259
+ return path16.join(auditDir, AUDIT_FILENAME);
5242
5260
  }
5243
5261
  async function appendAuditEntry(auditDir, entry) {
5244
- await mkdir2(auditDir, { recursive: true });
5262
+ await mkdir(auditDir, { recursive: true });
5245
5263
  const line = JSON.stringify(entry) + "\n";
5246
5264
  await appendFile(auditFilePath(auditDir), line, "utf-8");
5247
5265
  }
5248
5266
  async function readAuditLog(auditDir, since) {
5249
5267
  const filePath = auditFilePath(auditDir);
5250
5268
  if (!existsSync2(filePath)) return [];
5251
- const raw = await readFile2(filePath, "utf-8");
5269
+ const raw = await readFile(filePath, "utf-8");
5252
5270
  const entries = [];
5253
5271
  for (const line of raw.split("\n")) {
5254
5272
  const trimmed = line.trim();
@@ -5265,17 +5283,147 @@ async function readAuditLog(auditDir, since) {
5265
5283
  }
5266
5284
  return entries;
5267
5285
  }
5286
+
5287
+ // src/importers/base.ts
5288
+ var DEFAULT_IMPORT_BATCH_SIZE = 25;
5289
+ var MIN_IMPORT_BATCH_SIZE = 1;
5290
+ var MAX_IMPORT_BATCH_SIZE = 500;
5291
+ function validateImportBatchSize(value) {
5292
+ if (value === void 0) return DEFAULT_IMPORT_BATCH_SIZE;
5293
+ if (typeof value !== "number" || !Number.isFinite(value)) {
5294
+ throw new Error(
5295
+ `batchSize must be a finite number, received ${String(value)}`
5296
+ );
5297
+ }
5298
+ if (!Number.isInteger(value)) {
5299
+ throw new Error(`batchSize must be an integer, received ${value}`);
5300
+ }
5301
+ if (value < MIN_IMPORT_BATCH_SIZE || value > MAX_IMPORT_BATCH_SIZE) {
5302
+ throw new Error(
5303
+ `batchSize must be between ${MIN_IMPORT_BATCH_SIZE} and ${MAX_IMPORT_BATCH_SIZE}, received ${value}`
5304
+ );
5305
+ }
5306
+ return value;
5307
+ }
5308
+ function validateImportRateLimit(value) {
5309
+ if (value === void 0) return void 0;
5310
+ if (typeof value !== "number" || !Number.isFinite(value)) {
5311
+ throw new Error(
5312
+ `rateLimit must be a finite number (requests per second), received ${String(value)}`
5313
+ );
5314
+ }
5315
+ if (value <= 0) {
5316
+ throw new Error(
5317
+ `rateLimit must be greater than 0 (requests per second), received ${value}`
5318
+ );
5319
+ }
5320
+ return value;
5321
+ }
5322
+ function importedMemoryToTurn(memory) {
5323
+ const timestamp = typeof memory.sourceTimestamp === "string" && memory.sourceTimestamp.length > 0 ? memory.sourceTimestamp : memory.importedAt ?? (/* @__PURE__ */ new Date()).toISOString();
5324
+ return {
5325
+ role: "user",
5326
+ content: memory.content,
5327
+ timestamp,
5328
+ participantName: memory.sourceLabel,
5329
+ ...memory.sourceId !== void 0 ? { participantId: memory.sourceId } : {}
5330
+ };
5331
+ }
5332
+ async function runImporter(adapter, input, target, options = {}) {
5333
+ const batchSize = validateImportBatchSize(options.batchSize);
5334
+ validateImportRateLimit(options.rateLimit);
5335
+ const importedAt = (/* @__PURE__ */ new Date()).toISOString();
5336
+ const dryRun = options.dryRun === true;
5337
+ const onProgress = options.onProgress;
5338
+ onProgress?.({ processed: 0, total: 0, phase: "parse" });
5339
+ const parseOptions = {
5340
+ ...options.rateLimit !== void 0 ? { rateLimit: options.rateLimit } : {},
5341
+ ...options.parseOptions ?? {}
5342
+ };
5343
+ const parsed = await adapter.parse(input, parseOptions);
5344
+ onProgress?.({ processed: 0, total: 0, phase: "transform" });
5345
+ const memoriesRaw = await adapter.transform(parsed, options.transformOptions);
5346
+ if (!Array.isArray(memoriesRaw)) {
5347
+ throw new Error(
5348
+ `Importer '${adapter.name}' transform() returned a non-array. Adapters must produce ImportedMemory[].`
5349
+ );
5350
+ }
5351
+ const memories = memoriesRaw.map((memory) => {
5352
+ const sourceLabel = typeof memory.sourceLabel === "string" && memory.sourceLabel.length > 0 ? memory.sourceLabel : adapter.sourceLabel;
5353
+ return {
5354
+ ...memory,
5355
+ sourceLabel,
5356
+ importedAt: memory.importedAt ?? importedAt
5357
+ };
5358
+ });
5359
+ if (dryRun) {
5360
+ onProgress?.({
5361
+ processed: memories.length,
5362
+ total: memories.length,
5363
+ phase: "dry-run"
5364
+ });
5365
+ return {
5366
+ adapter: adapter.name,
5367
+ sourceLabel: adapter.sourceLabel,
5368
+ memoriesPlanned: memories.length,
5369
+ memoriesWritten: 0,
5370
+ batchesProcessed: 0,
5371
+ dryRun: true,
5372
+ importedAt
5373
+ };
5374
+ }
5375
+ let batchesProcessed = 0;
5376
+ let memoriesWritten = 0;
5377
+ for (let i = 0; i < memories.length; i += batchSize) {
5378
+ const batch = memories.slice(i, i + batchSize);
5379
+ const result = await adapter.writeTo(target, batch, options);
5380
+ memoriesWritten += result.memoriesIngested;
5381
+ batchesProcessed += 1;
5382
+ onProgress?.({
5383
+ processed: Math.min(i + batch.length, memories.length),
5384
+ total: memories.length,
5385
+ phase: "write"
5386
+ });
5387
+ }
5388
+ return {
5389
+ adapter: adapter.name,
5390
+ sourceLabel: adapter.sourceLabel,
5391
+ memoriesPlanned: memories.length,
5392
+ memoriesWritten,
5393
+ batchesProcessed,
5394
+ dryRun: false,
5395
+ importedAt
5396
+ };
5397
+ }
5398
+ async function defaultWriteMemoriesToOrchestrator(target, memories) {
5399
+ if (memories.length === 0) {
5400
+ return { memoriesIngested: 0 };
5401
+ }
5402
+ const turns = memories.map(importedMemoryToTurn);
5403
+ await target.ingestBulkImportBatch(turns);
5404
+ return { memoriesIngested: memories.length };
5405
+ }
5268
5406
  export {
5407
+ AccessAuditAdapter,
5269
5408
  BRIEFING_FORMAT_ALLOWED,
5270
5409
  BootstrapEngine,
5271
5410
  CITATION_UNKNOWN,
5272
5411
  CODEX_THREAD_KEY_PREFIX,
5273
5412
  ClaudeCodeMemoryExtensionPublisher,
5274
5413
  CodexMemoryExtensionPublisher,
5414
+ CrossNamespaceBudget,
5415
+ DEFAULT_ANOMALY_DETECTOR_CONFIG,
5275
5416
  DEFAULT_CITATION_FORMAT,
5417
+ DEFAULT_CROSS_NAMESPACE_BUDGET,
5276
5418
  DEFAULT_GRACE_PERIOD_DAYS,
5419
+ DEFAULT_IMPORT_BATCH_SIZE,
5277
5420
  DEFAULT_MAX_BINARY_SIZE_BYTES,
5421
+ DEFAULT_PPR_DAMPING,
5422
+ DEFAULT_PPR_ITERATIONS,
5423
+ DEFAULT_PPR_TOLERANCE,
5424
+ DEFAULT_REASONING_TRACE_BOOST,
5278
5425
  DEFAULT_SCAN_PATTERNS,
5426
+ DEFAULT_SURPRISE_K,
5279
5427
  DEFAULT_TAXONOMY,
5280
5428
  FILTER_LABELS as DIRECT_ANSWER_FILTER_LABELS,
5281
5429
  EngramAccessHttpServer,
@@ -5300,22 +5448,29 @@ export {
5300
5448
  PLUGIN_ID,
5301
5449
  PUBLISHERS,
5302
5450
  QmdClient,
5451
+ RECALL_XRAY_FORMATS,
5303
5452
  REMNIC_CITATION_FORMAT,
5304
5453
  REMNIC_EXTENSIONS_TOTAL_TOKEN_LIMIT,
5305
5454
  REMNIC_MCP_TOOL_INVENTORY,
5306
5455
  REMNIC_RECALL_DECISION_RULES,
5307
5456
  REMNIC_SEMANTIC_OVERVIEW,
5308
5457
  SENTINEL_FILE,
5458
+ SmartBuffer,
5309
5459
  StorageManager,
5310
5460
  WebSearchProvider,
5311
5461
  appendAuditEntry,
5462
+ applyMemoryWorthFilter,
5463
+ applyReasoningTraceBoost,
5312
5464
  attachCitation,
5465
+ branchNamespaceName,
5313
5466
  briefingFilename,
5314
5467
  buildBriefing,
5315
5468
  buildCitationGuidance,
5316
5469
  buildEntityRecallSection,
5317
5470
  buildExtensionsBlockForConsolidation,
5318
5471
  buildExtensionsFooterForSummary,
5472
+ buildGraphFromMemories,
5473
+ buildMemoryWorthCounterMap,
5319
5474
  buildProcedureMarkdownBody,
5320
5475
  buildProcedureRecallSection,
5321
5476
  checkMarketplaceManifest,
@@ -5323,6 +5478,9 @@ export {
5323
5478
  clearTrainingExportAdapters,
5324
5479
  clearVerdictCache,
5325
5480
  coerceInstallExtension,
5481
+ computeMemoryWorth,
5482
+ computeProcedureStats,
5483
+ computeSurprise,
5326
5484
  convertMemoriesToRecords,
5327
5485
  createBackend,
5328
5486
  createSpace,
@@ -5332,14 +5490,19 @@ export {
5332
5490
  decideSemanticDedup,
5333
5491
  defaultEnrichmentPipelineConfig,
5334
5492
  defaultWorkspaceDir,
5493
+ defaultWriteMemoriesToOrchestrator,
5335
5494
  deleteSpace,
5336
5495
  deriveSessionId,
5496
+ describeCodingScope,
5337
5497
  describeMemoriesDir,
5498
+ detectRecallAnomalies,
5338
5499
  diffVersions,
5339
5500
  discoverMemoryExtensions,
5340
5501
  doctorConnector,
5341
5502
  emptyManifest,
5342
5503
  ensureSentinel,
5504
+ expandTildePath,
5505
+ extractGraphEdges,
5343
5506
  findContradictions,
5344
5507
  findDuplicates,
5345
5508
  focusMatchesEntity,
@@ -5347,6 +5510,7 @@ export {
5347
5510
  formatBatchTranscript,
5348
5511
  formatCitation,
5349
5512
  formatOaiMemCitation,
5513
+ formatProcedureStatsText,
5350
5514
  formatZodError,
5351
5515
  generateContextTree,
5352
5516
  generateMarketplaceManifest,
@@ -5363,19 +5527,27 @@ export {
5363
5527
  getTaxonomyDir,
5364
5528
  getTaxonomyFilePath,
5365
5529
  getTrainingExportAdapter,
5530
+ getVerdictKind,
5366
5531
  getVersion,
5367
5532
  hasBroadGraphIntent,
5368
5533
  hasCitation,
5369
5534
  hostIdForConnector,
5535
+ importedMemoryToTurn,
5370
5536
  inferIntentFromText,
5371
5537
  initLogger,
5372
5538
  installConnector,
5373
5539
  installFromMarketplace,
5374
5540
  intentCompatibilityScore,
5375
5541
  isDirectAnswerEligible,
5542
+ isDurableVerdict,
5543
+ isEdgeType,
5376
5544
  isImportRole,
5545
+ isNodeType,
5546
+ isReasoningTracePath,
5547
+ isReviewPrompt,
5377
5548
  isTaskInitiationIntent,
5378
5549
  isTrustZoneName,
5550
+ isValidCachedVerdict,
5379
5551
  judgeFactDurability,
5380
5552
  listBulkImportSources,
5381
5553
  listConnectors,
@@ -5390,15 +5562,21 @@ export {
5390
5562
  loadTaxonomy,
5391
5563
  loadTokenStore,
5392
5564
  log,
5565
+ looksLikeProblemSolvingQuery,
5393
5566
  manifestDir,
5394
5567
  manifestPath,
5395
5568
  matchesPatterns,
5396
5569
  materializeForNamespace,
5397
5570
  memoryStoreRequestSchema,
5571
+ memoryWorthOutcomeEligibleCategories,
5398
5572
  mergeSpaces,
5399
5573
  migrateFromEngram,
5574
+ normalizeCachedVerdict,
5575
+ normalizeOriginUrl,
5576
+ normalizeQueryText,
5400
5577
  observeRequestSchema,
5401
5578
  onboard,
5579
+ packReviewContext,
5402
5580
  parseAllCitations,
5403
5581
  parseBriefingFocus,
5404
5582
  parseBriefingWindow,
@@ -5408,17 +5586,25 @@ export {
5408
5586
  parseOaiMemCitation,
5409
5587
  parseProcedureStepsFromBody,
5410
5588
  parseStrictCliDate,
5589
+ parseTouchedFiles,
5590
+ parseXrayBudgetFlag,
5591
+ parseXrayCliOptions,
5592
+ parseXrayFormat,
5411
5593
  performReview,
5412
5594
  planRecallMode,
5595
+ projectNamespaceName,
5413
5596
  promoteSpace,
5414
5597
  publisherFor,
5415
5598
  publisherForConnector,
5416
5599
  pullFromSpace,
5417
5600
  pushToSpace,
5601
+ queryGraph,
5602
+ rankReviewCandidates,
5418
5603
  readAuditLog,
5419
5604
  readManifest,
5420
5605
  recallForActiveMemory,
5421
5606
  recallRequestSchema,
5607
+ recordMemoryOutcome,
5422
5608
  registerBulkImportSource,
5423
5609
  registerPublisher,
5424
5610
  registerTrainingExportAdapter,
@@ -5426,10 +5612,17 @@ export {
5426
5612
  renderBriefingMarkdown,
5427
5613
  renderExtensionsBlock,
5428
5614
  renderExtensionsFooter,
5615
+ renderXray,
5616
+ renderXrayJson,
5617
+ renderXrayMarkdown,
5618
+ renderXrayText,
5619
+ reportBufferSurpriseDistribution,
5429
5620
  resolveBriefingSaveDir,
5430
5621
  resolveCategory,
5622
+ resolveCodingNamespaceOverlay,
5431
5623
  resolveConnectorFromToken,
5432
5624
  resolveExtensionsRoot,
5625
+ resolveGitContext,
5433
5626
  resolvePrincipal,
5434
5627
  resolveRemnicPluginEntry,
5435
5628
  revertToVersion,
@@ -5440,6 +5633,8 @@ export {
5440
5633
  runBulkImportPipeline,
5441
5634
  runCodexMaterialize,
5442
5635
  runEnrichmentPipeline,
5636
+ runGraphRecall,
5637
+ runImporter,
5443
5638
  runPostConsolidationMaterialize,
5444
5639
  sanitizeNoteForCitation,
5445
5640
  sanitizeSessionKeyForFilename,
@@ -5449,11 +5644,14 @@ export {
5449
5644
  saveTokenStore,
5450
5645
  scanForBinaries,
5451
5646
  shareSpace,
5647
+ stableHash,
5452
5648
  stripCitation,
5453
5649
  suggestionSubmitRequestSchema,
5454
5650
  switchSpace,
5455
5651
  syncChanges,
5456
5652
  validateBriefingFormat,
5653
+ validateImportBatchSize,
5654
+ validateImportRateLimit,
5457
5655
  validateImportTurn,
5458
5656
  validateMarketplaceManifest,
5459
5657
  validateRequest,