@remnic/core 10.0.145 → 10.0.147

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 (310) hide show
  1. package/dist/access-admin-ops-surface.js +156 -152
  2. package/dist/access-cli.js +156 -152
  3. package/dist/access-cli.js.map +1 -1
  4. package/dist/access-correlation.d.ts +4 -0
  5. package/dist/access-correlation.d.ts.map +1 -0
  6. package/dist/access-correlation.js +10 -0
  7. package/dist/access-extraction-force-flush-preempt.js +156 -152
  8. package/dist/access-extraction-force-flush.js +156 -152
  9. package/dist/access-http-briefing.js +156 -152
  10. package/dist/access-http-query.js +156 -152
  11. package/dist/access-http.d.ts.map +1 -1
  12. package/dist/access-http.js +156 -152
  13. package/dist/access-identity-continuity-surface.js +156 -152
  14. package/dist/access-lcm-surface.js +156 -152
  15. package/dist/access-mcp.js +156 -152
  16. package/dist/access-observe-write-category.js +11 -11
  17. package/dist/access-observe-write-surface.js +156 -152
  18. package/dist/access-offline-manifest.js +10 -10
  19. package/dist/access-operations-batch.js +156 -152
  20. package/dist/access-operations.js +156 -152
  21. package/dist/access-recall-concurrency.js +156 -152
  22. package/dist/access-recall-response.js +156 -152
  23. package/dist/access-recall-surface.js +156 -152
  24. package/dist/access-schema.js +7 -7
  25. package/dist/access-service.d.ts.map +1 -1
  26. package/dist/access-service.js +156 -152
  27. package/dist/active-memory-bridge.js +2 -2
  28. package/dist/active-recall.js +30 -30
  29. package/dist/adapters/index.js +7 -7
  30. package/dist/adapters/registry.js +3 -3
  31. package/dist/auto-sync-PSZJHHXB.js +2 -2
  32. package/dist/briefing.js +21 -21
  33. package/dist/buffer.js +1 -1
  34. package/dist/calibration.js +3 -3
  35. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  36. package/dist/causal-behavior.js +2 -2
  37. package/dist/causal-chain.js +2 -2
  38. package/dist/causal-consolidation.js +24 -24
  39. package/dist/causal-retrieval.js +2 -2
  40. package/dist/causal-trajectory-graph.js +2 -2
  41. package/dist/causal-trajectory.js +1 -1
  42. package/dist/{chunk-GB442ZFG.js → chunk-2NGTY22Z.js} +5 -5
  43. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  44. package/dist/{chunk-XVZA6VXC.js → chunk-3SL52JKD.js} +4 -4
  45. package/dist/chunk-4IJBNRMZ.js +45 -0
  46. package/dist/chunk-4IJBNRMZ.js.map +1 -0
  47. package/dist/{chunk-GTW6GPQU.js → chunk-4JKIOAOF.js} +6 -6
  48. package/dist/{chunk-WN2DASTS.js → chunk-5BE3FLKL.js} +4 -4
  49. package/dist/{chunk-QFBBSKEU.js → chunk-5BKH4XG5.js} +2 -2
  50. package/dist/chunk-5JD4DXQX.js +91 -0
  51. package/dist/chunk-5JD4DXQX.js.map +1 -0
  52. package/dist/{chunk-FZ6QUOTL.js → chunk-5UYP5IQB.js} +2 -2
  53. package/dist/{chunk-DCLOMXQL.js → chunk-5ZSN2OFB.js} +31 -31
  54. package/dist/{chunk-FBV4QGXT.js → chunk-6S37C5UK.js} +2 -2
  55. package/dist/{chunk-M4IEZGCK.js → chunk-73TPOGS4.js} +6 -6
  56. package/dist/{chunk-MEYPQLXV.js → chunk-7OWV3GVD.js} +2 -2
  57. package/dist/{chunk-XIWRF7TG.js → chunk-7P72BY4F.js} +2 -2
  58. package/dist/{chunk-UWP6PGWN.js → chunk-7QKZOZF4.js} +2 -2
  59. package/dist/{chunk-DBNZYQCL.js → chunk-AHNGWFNG.js} +2 -2
  60. package/dist/{chunk-YIOP7IFD.js → chunk-AO5LKFGO.js} +4 -4
  61. package/dist/{chunk-D3ZISMKY.js → chunk-AWZ5CWSR.js} +10 -10
  62. package/dist/{chunk-63MKTHYT.js → chunk-B5MB2G3H.js} +2 -2
  63. package/dist/{chunk-TYOS62PM.js → chunk-BGSYM3SH.js} +2 -2
  64. package/dist/{chunk-64TIBZPZ.js → chunk-BHZ72ZQ3.js} +2 -2
  65. package/dist/{chunk-G4NKURT4.js → chunk-C6S353AG.js} +30 -1
  66. package/dist/chunk-C6S353AG.js.map +1 -0
  67. package/dist/{chunk-T3M5KJRV.js → chunk-C6Z3H23R.js} +2 -2
  68. package/dist/{chunk-SEIFDQ6U.js → chunk-CA56BOUE.js} +4 -4
  69. package/dist/{chunk-UIFWZMO7.js → chunk-CLVILSBR.js} +7 -7
  70. package/dist/{chunk-GDREJ32D.js → chunk-DOFLNJZD.js} +3 -3
  71. package/dist/{chunk-Z2OKWO35.js → chunk-E6VI7POW.js} +327 -318
  72. package/dist/chunk-E6VI7POW.js.map +1 -0
  73. package/dist/{chunk-SV6OLWPF.js → chunk-EIEANUBO.js} +15 -15
  74. package/dist/{chunk-PJKTFXE2.js → chunk-EMMUQUHF.js} +16 -6
  75. package/dist/chunk-EMMUQUHF.js.map +1 -0
  76. package/dist/{chunk-X2FEUBKD.js → chunk-EYES6ALH.js} +2 -2
  77. package/dist/{chunk-ENPJX3BB.js → chunk-FMFCQRDM.js} +3 -3
  78. package/dist/{chunk-IJVU4ILJ.js → chunk-GCHM5BYL.js} +7 -7
  79. package/dist/{chunk-KCU2ZWBS.js → chunk-GCQIXPWZ.js} +2 -2
  80. package/dist/{chunk-GKL6QYZO.js → chunk-GMO3BGOF.js} +1 -1
  81. package/dist/{chunk-OMPX3KLG.js → chunk-H6OTEBPK.js} +2 -2
  82. package/dist/{chunk-DK3T3Q6A.js → chunk-HADCITEA.js} +8 -8
  83. package/dist/{chunk-QCJ7Q5BM.js → chunk-HIUIJ4AB.js} +2 -2
  84. package/dist/{chunk-F4ZHKDBW.js → chunk-HLWXCDUQ.js} +2 -2
  85. package/dist/{chunk-4RASUAN3.js → chunk-HXFIILGF.js} +4 -4
  86. package/dist/{chunk-CIEEYVUB.js → chunk-IMULTENA.js} +2 -2
  87. package/dist/{chunk-EUL3S3LE.js → chunk-J5WI4QRP.js} +4 -4
  88. package/dist/{chunk-TFHL4WWY.js → chunk-JPVUBL4L.js} +5 -5
  89. package/dist/{chunk-KBMJWNSY.js → chunk-K6RKNQRD.js} +2 -2
  90. package/dist/{chunk-BUKK5SWA.js → chunk-KQAFEZQX.js} +2 -2
  91. package/dist/{chunk-PDVEY4QS.js → chunk-LD7I5AZW.js} +9 -9
  92. package/dist/{chunk-G3ZUQZGM.js → chunk-MBQVWTCS.js} +2 -2
  93. package/dist/{chunk-BKR2YCQ5.js → chunk-MKJBZR7J.js} +2 -2
  94. package/dist/{chunk-ETUMOYGL.js → chunk-NQJAF2Q4.js} +2 -2
  95. package/dist/{chunk-7TDJZV2S.js → chunk-O7CHKXSF.js} +4 -4
  96. package/dist/{chunk-ODHFX5JX.js → chunk-OFFT2B5R.js} +15 -15
  97. package/dist/{chunk-W7K5BP3M.js → chunk-OM5ESBES.js} +2 -2
  98. package/dist/{chunk-5JW2QIFH.js → chunk-ORPYIVT3.js} +3 -3
  99. package/dist/chunk-PXY2B7BG.js +51 -0
  100. package/dist/chunk-PXY2B7BG.js.map +1 -0
  101. package/dist/{chunk-MVTMKFBW.js → chunk-QDY4TSKK.js} +2 -2
  102. package/dist/{chunk-7TY5ZHFA.js → chunk-QGV6JVQ7.js} +2 -2
  103. package/dist/{chunk-4XINO77L.js → chunk-RB7NXZ2E.js} +2 -2
  104. package/dist/{chunk-GQDO6KHO.js → chunk-RQ6HMDA5.js} +2 -2
  105. package/dist/{chunk-E7WMDXAW.js → chunk-RSPPAPFI.js} +2 -2
  106. package/dist/{chunk-LS5VJO5O.js → chunk-SLZJ7HQX.js} +2 -2
  107. package/dist/{chunk-WQUGCOKF.js → chunk-TFA6HPOA.js} +4 -4
  108. package/dist/{chunk-6P7U3HWG.js → chunk-TH6OYP6I.js} +3 -3
  109. package/dist/{chunk-P4YYUDR5.js → chunk-TNACU47L.js} +3 -3
  110. package/dist/{chunk-KYZFW4LW.js → chunk-TQU2RB4B.js} +2 -2
  111. package/dist/{chunk-2UOU6CZZ.js → chunk-TVRUUT7U.js} +2 -2
  112. package/dist/{chunk-IHCXMYSE.js → chunk-U2PSE7MB.js} +2 -2
  113. package/dist/{chunk-D3ZKHLN2.js → chunk-ULLGI6XR.js} +2 -2
  114. package/dist/{chunk-U62EINFH.js → chunk-UMC6F3Y4.js} +3 -3
  115. package/dist/{chunk-FF6N7BXC.js → chunk-UWVMD54T.js} +2 -2
  116. package/dist/{chunk-PCMGMPQZ.js → chunk-X4EF7IG3.js} +4 -4
  117. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  118. package/dist/{chunk-GA3Y7GZR.js → chunk-XCJDDXJX.js} +2 -2
  119. package/dist/{chunk-YGPRFYV6.js → chunk-YCASWFI6.js} +3 -3
  120. package/dist/chunk-YRHBSYQR.js +15 -0
  121. package/dist/chunk-YRHBSYQR.js.map +1 -0
  122. package/dist/{chunk-IBPE3Q5M.js → chunk-Z3GZRG5Z.js} +2 -2
  123. package/dist/{chunk-K3FH3LAQ.js → chunk-ZG4GNPRE.js} +10 -10
  124. package/dist/{chunk-ADBON4FI.js → chunk-ZIXP27JK.js} +10 -10
  125. package/dist/cli.js +156 -152
  126. package/dist/coding/export-okf-codegraph.js +20 -20
  127. package/dist/coding/pre-action-gate.js +2 -2
  128. package/dist/compounding/engine.js +22 -22
  129. package/dist/config.js +30 -30
  130. package/dist/connectors/codex-materialize-runner.js +21 -21
  131. package/dist/connectors/index.js +21 -21
  132. package/dist/contradiction/index.js +7 -7
  133. package/dist/convergence-refresh.js +23 -23
  134. package/dist/conversation-index/backend.js +2 -2
  135. package/dist/corpus-watermark.js +23 -23
  136. package/dist/deep-recall-http-glue.js +8 -8
  137. package/dist/deep-recall.js +2 -2
  138. package/dist/entity-retrieval.js +22 -22
  139. package/dist/explicit-capture.js +156 -152
  140. package/dist/extraction-evidence-class.js +2 -2
  141. package/dist/extraction-source-grounding.js +3 -3
  142. package/dist/extraction-span-materialize.js +2 -2
  143. package/dist/extraction.js +29 -29
  144. package/dist/{graph-edge-decay-OEX5OGMI.js → graph-edge-decay-BC3IO2J4.js} +5 -5
  145. package/dist/graph-jsonl.js +3 -3
  146. package/dist/graph-snapshot.js +3 -3
  147. package/dist/graph.js +4 -4
  148. package/dist/harmonic-retrieval.js +21 -21
  149. package/dist/index.js +265 -261
  150. package/dist/lcm/engine.js +4 -4
  151. package/dist/lcm/index.js +10 -10
  152. package/dist/local-llm.js +2 -2
  153. package/dist/location/index.js +22 -22
  154. package/dist/maintenance/memory-governance.js +21 -21
  155. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +21 -21
  156. package/dist/maintenance/rebuild-memory-projection-runner.js +23 -23
  157. package/dist/maintenance/rebuild-memory-projection.js +22 -22
  158. package/dist/memory-browse.js +1 -1
  159. package/dist/memory-subject.js +1 -1
  160. package/dist/namespaces/migrate.js +22 -22
  161. package/dist/namespaces/search.js +7 -7
  162. package/dist/namespaces/storage.js +21 -21
  163. package/dist/offline-sync-changeset-generations.js +3 -3
  164. package/dist/offline-sync-embedding-generation.js +2 -2
  165. package/dist/offline-sync-snapshot-stream.js +5 -5
  166. package/dist/offline-sync.js +7 -7
  167. package/dist/operator-doctor-corpus.js +24 -24
  168. package/dist/operator-toolkit.js +39 -39
  169. package/dist/orchestration/backlog-scheduler.js +157 -153
  170. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  171. package/dist/orchestration/buffer-drain-runner.js +157 -153
  172. package/dist/orchestration/maintenance.js +32 -32
  173. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  174. package/dist/orchestrator.js +156 -152
  175. package/dist/provenance.js +2 -2
  176. package/dist/recall-attempt-timing.d.ts +18 -0
  177. package/dist/recall-attempt-timing.d.ts.map +1 -0
  178. package/dist/recall-attempt-timing.js +14 -0
  179. package/dist/recall-attempt-timing.js.map +1 -0
  180. package/dist/recall-enrichment-promise.d.ts +22 -0
  181. package/dist/recall-enrichment-promise.d.ts.map +1 -0
  182. package/dist/recall-enrichment-promise.js +10 -0
  183. package/dist/recall-enrichment-promise.js.map +1 -0
  184. package/dist/recall-explain-renderer.js +3 -3
  185. package/dist/recall-navigation.js +156 -152
  186. package/dist/recall-phase2-timing.d.ts +44 -0
  187. package/dist/recall-phase2-timing.d.ts.map +1 -0
  188. package/dist/recall-phase2-timing.js +22 -0
  189. package/dist/recall-phase2-timing.js.map +1 -0
  190. package/dist/recall-timings.d.ts +35 -0
  191. package/dist/recall-timings.d.ts.map +1 -1
  192. package/dist/recall-timings.js +2 -1
  193. package/dist/recall-why-service.js +2 -2
  194. package/dist/recall-xray-cli.js +4 -4
  195. package/dist/recall-xray-renderer.js +3 -3
  196. package/dist/recall-xray.js +2 -2
  197. package/dist/reconcile/manifest.js +3 -3
  198. package/dist/{resolution-A3NAI3YE.js → resolution-TCO63RRC.js} +8 -8
  199. package/dist/resolution-TCO63RRC.js.map +1 -0
  200. package/dist/resume-bundles.js +31 -31
  201. package/dist/salvage-envelope.js +1 -1
  202. package/dist/search/factory.js +6 -6
  203. package/dist/search/index.js +12 -12
  204. package/dist/semantic-consolidation.js +22 -22
  205. package/dist/semantic-rule-promotion.js +21 -21
  206. package/dist/semantic-rule-verifier.js +21 -21
  207. package/dist/source-agent-qualifier.js +23 -23
  208. package/dist/standup/build.js +21 -21
  209. package/dist/storage.js +20 -20
  210. package/dist/subject-config.js +1 -1
  211. package/dist/summarizer.js +4 -4
  212. package/dist/support-passport/index.js +7 -7
  213. package/dist/transfer/backup.js +2 -2
  214. package/dist/transfer/capsule-export.js +2 -2
  215. package/dist/transfer/capsule-import.js +2 -2
  216. package/dist/transfer/export-okf.js +21 -21
  217. package/dist/verified-recall.js +21 -21
  218. package/dist/whitespace.d.ts.map +1 -1
  219. package/dist/whitespace.js +1 -1
  220. package/dist/who-knows-cli.js +22 -22
  221. package/dist/who-knows.js +21 -21
  222. package/dist/write-envelope.js +1 -1
  223. package/package.json +2 -2
  224. package/src/access-correlation.ts +17 -0
  225. package/src/access-http.ts +7 -8
  226. package/src/access-service.ts +3 -1
  227. package/src/orchestration/recall-internal.ts +63 -75
  228. package/src/recall-attempt-timing.ts +78 -0
  229. package/src/recall-enrichment-promise.ts +62 -0
  230. package/src/recall-phase2-timing.ts +146 -0
  231. package/src/recall-timings-access.test.ts +140 -2
  232. package/src/recall-timings-request-contract.test.ts +488 -0
  233. package/src/recall-timings.ts +70 -0
  234. package/src/whitespace.test.ts +48 -0
  235. package/src/whitespace.ts +19 -5
  236. package/dist/chunk-G4NKURT4.js.map +0 -1
  237. package/dist/chunk-PJKTFXE2.js.map +0 -1
  238. package/dist/chunk-Z2OKWO35.js.map +0 -1
  239. /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-correlation.js.map} +0 -0
  240. /package/dist/{graph-edge-decay-OEX5OGMI.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  241. /package/dist/{chunk-GB442ZFG.js.map → chunk-2NGTY22Z.js.map} +0 -0
  242. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  243. /package/dist/{chunk-XVZA6VXC.js.map → chunk-3SL52JKD.js.map} +0 -0
  244. /package/dist/{chunk-GTW6GPQU.js.map → chunk-4JKIOAOF.js.map} +0 -0
  245. /package/dist/{chunk-WN2DASTS.js.map → chunk-5BE3FLKL.js.map} +0 -0
  246. /package/dist/{chunk-QFBBSKEU.js.map → chunk-5BKH4XG5.js.map} +0 -0
  247. /package/dist/{chunk-FZ6QUOTL.js.map → chunk-5UYP5IQB.js.map} +0 -0
  248. /package/dist/{chunk-DCLOMXQL.js.map → chunk-5ZSN2OFB.js.map} +0 -0
  249. /package/dist/{chunk-FBV4QGXT.js.map → chunk-6S37C5UK.js.map} +0 -0
  250. /package/dist/{chunk-M4IEZGCK.js.map → chunk-73TPOGS4.js.map} +0 -0
  251. /package/dist/{chunk-MEYPQLXV.js.map → chunk-7OWV3GVD.js.map} +0 -0
  252. /package/dist/{chunk-XIWRF7TG.js.map → chunk-7P72BY4F.js.map} +0 -0
  253. /package/dist/{chunk-UWP6PGWN.js.map → chunk-7QKZOZF4.js.map} +0 -0
  254. /package/dist/{chunk-DBNZYQCL.js.map → chunk-AHNGWFNG.js.map} +0 -0
  255. /package/dist/{chunk-YIOP7IFD.js.map → chunk-AO5LKFGO.js.map} +0 -0
  256. /package/dist/{chunk-D3ZISMKY.js.map → chunk-AWZ5CWSR.js.map} +0 -0
  257. /package/dist/{chunk-63MKTHYT.js.map → chunk-B5MB2G3H.js.map} +0 -0
  258. /package/dist/{chunk-TYOS62PM.js.map → chunk-BGSYM3SH.js.map} +0 -0
  259. /package/dist/{chunk-64TIBZPZ.js.map → chunk-BHZ72ZQ3.js.map} +0 -0
  260. /package/dist/{chunk-T3M5KJRV.js.map → chunk-C6Z3H23R.js.map} +0 -0
  261. /package/dist/{chunk-SEIFDQ6U.js.map → chunk-CA56BOUE.js.map} +0 -0
  262. /package/dist/{chunk-UIFWZMO7.js.map → chunk-CLVILSBR.js.map} +0 -0
  263. /package/dist/{chunk-GDREJ32D.js.map → chunk-DOFLNJZD.js.map} +0 -0
  264. /package/dist/{chunk-SV6OLWPF.js.map → chunk-EIEANUBO.js.map} +0 -0
  265. /package/dist/{chunk-X2FEUBKD.js.map → chunk-EYES6ALH.js.map} +0 -0
  266. /package/dist/{chunk-ENPJX3BB.js.map → chunk-FMFCQRDM.js.map} +0 -0
  267. /package/dist/{chunk-IJVU4ILJ.js.map → chunk-GCHM5BYL.js.map} +0 -0
  268. /package/dist/{chunk-KCU2ZWBS.js.map → chunk-GCQIXPWZ.js.map} +0 -0
  269. /package/dist/{chunk-GKL6QYZO.js.map → chunk-GMO3BGOF.js.map} +0 -0
  270. /package/dist/{chunk-OMPX3KLG.js.map → chunk-H6OTEBPK.js.map} +0 -0
  271. /package/dist/{chunk-DK3T3Q6A.js.map → chunk-HADCITEA.js.map} +0 -0
  272. /package/dist/{chunk-QCJ7Q5BM.js.map → chunk-HIUIJ4AB.js.map} +0 -0
  273. /package/dist/{chunk-F4ZHKDBW.js.map → chunk-HLWXCDUQ.js.map} +0 -0
  274. /package/dist/{chunk-4RASUAN3.js.map → chunk-HXFIILGF.js.map} +0 -0
  275. /package/dist/{chunk-CIEEYVUB.js.map → chunk-IMULTENA.js.map} +0 -0
  276. /package/dist/{chunk-EUL3S3LE.js.map → chunk-J5WI4QRP.js.map} +0 -0
  277. /package/dist/{chunk-TFHL4WWY.js.map → chunk-JPVUBL4L.js.map} +0 -0
  278. /package/dist/{chunk-KBMJWNSY.js.map → chunk-K6RKNQRD.js.map} +0 -0
  279. /package/dist/{chunk-BUKK5SWA.js.map → chunk-KQAFEZQX.js.map} +0 -0
  280. /package/dist/{chunk-PDVEY4QS.js.map → chunk-LD7I5AZW.js.map} +0 -0
  281. /package/dist/{chunk-G3ZUQZGM.js.map → chunk-MBQVWTCS.js.map} +0 -0
  282. /package/dist/{chunk-BKR2YCQ5.js.map → chunk-MKJBZR7J.js.map} +0 -0
  283. /package/dist/{chunk-ETUMOYGL.js.map → chunk-NQJAF2Q4.js.map} +0 -0
  284. /package/dist/{chunk-7TDJZV2S.js.map → chunk-O7CHKXSF.js.map} +0 -0
  285. /package/dist/{chunk-ODHFX5JX.js.map → chunk-OFFT2B5R.js.map} +0 -0
  286. /package/dist/{chunk-W7K5BP3M.js.map → chunk-OM5ESBES.js.map} +0 -0
  287. /package/dist/{chunk-5JW2QIFH.js.map → chunk-ORPYIVT3.js.map} +0 -0
  288. /package/dist/{chunk-MVTMKFBW.js.map → chunk-QDY4TSKK.js.map} +0 -0
  289. /package/dist/{chunk-7TY5ZHFA.js.map → chunk-QGV6JVQ7.js.map} +0 -0
  290. /package/dist/{chunk-4XINO77L.js.map → chunk-RB7NXZ2E.js.map} +0 -0
  291. /package/dist/{chunk-GQDO6KHO.js.map → chunk-RQ6HMDA5.js.map} +0 -0
  292. /package/dist/{chunk-E7WMDXAW.js.map → chunk-RSPPAPFI.js.map} +0 -0
  293. /package/dist/{chunk-LS5VJO5O.js.map → chunk-SLZJ7HQX.js.map} +0 -0
  294. /package/dist/{chunk-WQUGCOKF.js.map → chunk-TFA6HPOA.js.map} +0 -0
  295. /package/dist/{chunk-6P7U3HWG.js.map → chunk-TH6OYP6I.js.map} +0 -0
  296. /package/dist/{chunk-P4YYUDR5.js.map → chunk-TNACU47L.js.map} +0 -0
  297. /package/dist/{chunk-KYZFW4LW.js.map → chunk-TQU2RB4B.js.map} +0 -0
  298. /package/dist/{chunk-2UOU6CZZ.js.map → chunk-TVRUUT7U.js.map} +0 -0
  299. /package/dist/{chunk-IHCXMYSE.js.map → chunk-U2PSE7MB.js.map} +0 -0
  300. /package/dist/{chunk-D3ZKHLN2.js.map → chunk-ULLGI6XR.js.map} +0 -0
  301. /package/dist/{chunk-U62EINFH.js.map → chunk-UMC6F3Y4.js.map} +0 -0
  302. /package/dist/{chunk-FF6N7BXC.js.map → chunk-UWVMD54T.js.map} +0 -0
  303. /package/dist/{chunk-PCMGMPQZ.js.map → chunk-X4EF7IG3.js.map} +0 -0
  304. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  305. /package/dist/{chunk-GA3Y7GZR.js.map → chunk-XCJDDXJX.js.map} +0 -0
  306. /package/dist/{chunk-YGPRFYV6.js.map → chunk-YCASWFI6.js.map} +0 -0
  307. /package/dist/{chunk-IBPE3Q5M.js.map → chunk-Z3GZRG5Z.js.map} +0 -0
  308. /package/dist/{chunk-K3FH3LAQ.js.map → chunk-ZG4GNPRE.js.map} +0 -0
  309. /package/dist/{chunk-ADBON4FI.js.map → chunk-ZIXP27JK.js.map} +0 -0
  310. /package/dist/{resolution-A3NAI3YE.js.map → graph-edge-decay-BC3IO2J4.js.map} +0 -0
@@ -31,6 +31,9 @@ function makeConfig(memoryDir: string, overrides: Record<string, unknown> = {})
31
31
  });
32
32
  }
33
33
 
34
+ // Outside HTTP dispatch (direct service calls) the id is a generated fallback, marked "local:" in the same field.
35
+ const REQUEST_ID_PATTERN = /^local:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
36
+
34
37
  test("authenticated recall timings route returns two recalls without user-correlatable inputs", async () => {
35
38
  const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-recall-timings-"));
36
39
  const config = makeConfig(memoryDir);
@@ -48,8 +51,10 @@ test("authenticated recall timings route returns two recalls without user-correl
48
51
  const started = await server.start();
49
52
  const url = `http://${started.host}:${started.port}/engram/v1/recall/timings`;
50
53
  try {
51
- await orchestrator.recall("private first query", "private:first:session");
52
- await orchestrator.recall("private second query", "private:second:session", { mode: "no_recall" });
54
+ // Drive recalls through the service path (HTTP / MCP recall route) so the
55
+ // records carry the attempt contract (requestId + outcome + httpTotalMs).
56
+ await service.recall({ query: "private first query", sessionKey: "private:first:session" });
57
+ await service.recall({ query: "private second query", sessionKey: "private:second:session", mode: "no_recall" });
53
58
 
54
59
  const denied = await fetch(url);
55
60
  assert.equal(denied.status, 401);
@@ -111,6 +116,10 @@ test("authenticated recall timings route returns two recalls without user-correl
111
116
  assert.ok(record.timingsMs.total >= 0);
112
117
  assert.equal(typeof record.recallPlan, "string");
113
118
  assert.equal(typeof record.queryPolicy, "string");
119
+ // Attempt contract (requestId + outcome + monotonic httpTotalMs).
120
+ assert.match(record.requestId, REQUEST_ID_PATTERN);
121
+ assert.equal(record.outcome, "ok");
122
+ assert.ok(Number.isFinite(record.httpTotalMs) && record.httpTotalMs >= 0);
114
123
  assert.equal("query" in record, false);
115
124
  assert.equal("prompt" in record, false);
116
125
  assert.equal("sessionKey" in record, false);
@@ -193,6 +202,11 @@ test("recall timing records expose only the fixed telemetry schema", () => {
193
202
  namespace: "default",
194
203
  recallPlan: "full",
195
204
  queryPolicy: "general/full",
205
+ // Attempt contract defaults for legacy emitters: no id, not an error,
206
+ // no monotonic duration measured.
207
+ requestId: "",
208
+ outcome: "ok",
209
+ httpTotalMs: 0,
196
210
  timingsMs: {
197
211
  total: 7,
198
212
  qmd: 3,
@@ -340,3 +354,127 @@ test("batch context without transport operator fails closed when config names no
340
354
  }) as { result: { count: number } };
341
355
  assert.equal(output.result.count, 0);
342
356
  });
357
+
358
+ test("recall timing record allowlists requestId, outcome, and monotonic httpTotalMs (attempt contract)", () => {
359
+ const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-attempt-fields"));
360
+ recordRecallTiming(config, {
361
+ timestamp: new Date(0).toISOString(),
362
+ namespace: "default",
363
+ total: "42ms",
364
+ recallPlan: "full",
365
+ queryPolicy: "general/full",
366
+ requestId: "attempt-1",
367
+ outcome: "error",
368
+ httpTotalMs: 123.5,
369
+ // Not part of the record contract: dropped by the sanitizer.
370
+ query: "private user text",
371
+ sessionKey: "private:session",
372
+ });
373
+ const record = getRecallTimings(config)[0];
374
+ assert.ok(record);
375
+ assert.equal(record.requestId, "attempt-1");
376
+ assert.equal(record.outcome, "error");
377
+ assert.equal(record.httpTotalMs, 123.5);
378
+ assert.equal("query" in record, false);
379
+ assert.equal("sessionKey" in record, false);
380
+ });
381
+
382
+ test("attempt contract fields fail closed for legacy emitters and bad values", () => {
383
+ const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-attempt-defaults"));
384
+ recordRecallTiming(config, {
385
+ timestamp: new Date(0).toISOString(),
386
+ namespace: "default",
387
+ total: 5,
388
+ recallPlan: "full",
389
+ queryPolicy: "general/full",
390
+ requestId: 42,
391
+ outcome: "bogus",
392
+ httpTotalMs: "12ms",
393
+ });
394
+ recordRecallTiming(config, {
395
+ timestamp: new Date(0).toISOString(),
396
+ namespace: "default",
397
+ total: 6,
398
+ recallPlan: "full",
399
+ queryPolicy: "general/full",
400
+ httpTotalMs: -3,
401
+ });
402
+ const [newest, oldest] = getRecallTimings(config);
403
+ assert.ok(newest && oldest);
404
+ // Direct orchestrator callers (x-ray, daemon hooks) predate the contract:
405
+ // their records carry neutral defaults, never a misleading id or duration.
406
+ assert.equal(newest.requestId, "");
407
+ assert.equal(newest.outcome, "ok");
408
+ assert.equal(newest.httpTotalMs, 0);
409
+ // Parsed and sanitized: non-string requestId drops, unknown outcome fails
410
+ // closed to "ok", "12ms" parses, negative durations floor to 0.
411
+ assert.equal(oldest.requestId, "");
412
+ assert.equal(oldest.outcome, "ok");
413
+ assert.equal(oldest.httpTotalMs, 12);
414
+ });
415
+
416
+ test("service recall records exactly one attempt in finally with contract fields", async () => {
417
+ const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-attempt-ok"));
418
+ const service = new EngramAccessService(new Orchestrator(config));
419
+ await service.recall({ query: "contract probe", sessionKey: "contract:probe:session" });
420
+ const records = getRecallTimings(config);
421
+ // One attempt, one record: the pipeline's per-phase payload folds into the
422
+ // finally-record instead of pushing a second entry.
423
+ assert.equal(records.length, 1);
424
+ const record = records[0]!;
425
+ assert.match(record.requestId, REQUEST_ID_PATTERN);
426
+ assert.equal(record.outcome, "ok");
427
+ assert.ok(Number.isFinite(record.httpTotalMs) && record.httpTotalMs >= 0);
428
+ assert.ok(Number.isFinite(record.timingsMs.total) && record.timingsMs.total >= 0);
429
+ assert.equal(record.recallPlan, "full");
430
+ });
431
+
432
+ test("denied recall attempt still records outcome error in finally", async () => {
433
+ const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-attempt-error"));
434
+ const service = new EngramAccessService(new Orchestrator(config));
435
+ await assert.rejects(
436
+ service.recall({ query: "contract probe", sessionKey: "contract:probe:session", asOf: " " }),
437
+ /asOf/,
438
+ );
439
+ const records = getRecallTimings(config);
440
+ // The attempt failed before the pipeline ran: the finally-record is the
441
+ // only trace, with the error outcome and the monotonic total it measured.
442
+ assert.equal(records.length, 1);
443
+ const record = records[0]!;
444
+ assert.match(record.requestId, REQUEST_ID_PATTERN);
445
+ assert.equal(record.outcome, "error");
446
+ assert.ok(Number.isFinite(record.httpTotalMs) && record.httpTotalMs >= 0);
447
+ });
448
+
449
+ test("phase-2 await fields are allowlisted, enum-bounded, and carry no extra content", () => {
450
+ const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-phase2-sanitizer"));
451
+ recordRecallTiming(config, {
452
+ timestamp: new Date(0).toISOString(),
453
+ namespace: "default",
454
+ total: "9ms",
455
+ recallPlan: "full",
456
+ queryPolicy: "general/full",
457
+ outcome: "aborted",
458
+ phase2HarmonicMs: "7ms",
459
+ phase2HarmonicStatus: "timeout",
460
+ phase2HarmonicTotalMs: "30ms",
461
+ phase2QuestionsMs: "2ms",
462
+ // A status outside the enum, and a total on an await that has none, drop.
463
+ phase2QuestionsStatus: "private user question text",
464
+ phase2QuestionsTotalMs: "5ms",
465
+ // Not part of the contract at all.
466
+ phase2SecretMs: "1ms",
467
+ phase2HarmonicQuery: "private query",
468
+ });
469
+ const record = getRecallTimings(config)[0];
470
+ assert.ok(record);
471
+ assert.equal(record.outcome, "aborted");
472
+ assert.equal(record.phase2HarmonicMs, 7);
473
+ assert.equal(record.phase2HarmonicStatus, "timeout");
474
+ assert.equal(record.phase2HarmonicTotalMs, 30);
475
+ assert.equal(record.phase2QuestionsMs, 2);
476
+ assert.equal("phase2QuestionsStatus" in record, false);
477
+ assert.equal("phase2QuestionsTotalMs" in record, false);
478
+ assert.equal("phase2SecretMs" in record, false);
479
+ assert.equal("phase2HarmonicQuery" in record, false);
480
+ });
@@ -0,0 +1,488 @@
1
+ import assert from "node:assert/strict";
2
+ import { mkdtemp } from "node:fs/promises";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import test, { mock } from "node:test";
6
+ import { z } from "zod";
7
+
8
+ import { currentCorrelationId } from "./access-correlation.js";
9
+ import { recordAbstractionNode } from "./abstraction-nodes.js";
10
+ import { EngramAccessHttpServer } from "./access-http.js";
11
+ import { EngramAccessService } from "./access-service.js";
12
+ import { CompoundingEngine } from "./compounding/engine.js";
13
+ import { parseConfig } from "./config.js";
14
+ import { rebuildMemoryProjection } from "./maintenance/rebuild-memory-projection.js";
15
+ import { Orchestrator } from "./orchestrator.js";
16
+ import {
17
+ PHASE2_AWAIT_STATUSES,
18
+ type Phase2AwaitStatus,
19
+ } from "./recall-phase2-timing.js";
20
+ import { getRecallTimings } from "./recall-timings.js";
21
+ import { StorageManager } from "./storage.js";
22
+ import { cleanupDir, eventually } from "./testing/orchestrator-lite.js";
23
+ import type { MemoryFile, QmdSearchResult } from "./types.js";
24
+ import type { SearchBackend } from "./search/port.js";
25
+
26
+ test.afterEach(() => {
27
+ mock.restoreAll();
28
+ });
29
+
30
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
31
+
32
+ interface ConfigOverrides {
33
+ qmdEnabled?: boolean;
34
+ harmonicRetrievalEnabled?: boolean;
35
+ queryAwareIndexingEnabled?: boolean;
36
+ compoundingEnabled?: boolean;
37
+ recallEnrichmentDeadlineMs?: number;
38
+ recallOuterTimeoutMs?: number;
39
+ }
40
+
41
+ function makeConfig(memoryDir: string, overrides: ConfigOverrides = {}) {
42
+ return parseConfig({
43
+ openaiApiKey: "sk-test",
44
+ memoryDir,
45
+ workspaceDir: path.join(memoryDir, "workspace"),
46
+ qmdEnabled: false,
47
+ embeddingFallbackEnabled: false,
48
+ recallPlannerEnabled: false,
49
+ sharedContextEnabled: false,
50
+ initGateTimeoutMs: 1000,
51
+ ...overrides,
52
+ });
53
+ }
54
+
55
+ /** Complete typed SearchBackend stub (no casts): one settled QMD candidate. */
56
+ function settledQmdBackend(result: QmdSearchResult): SearchBackend {
57
+ return {
58
+ async probe() {
59
+ return true;
60
+ },
61
+ isAvailable() {
62
+ return true;
63
+ },
64
+ debugStatus() {
65
+ return "backend=settled-qmd-stub";
66
+ },
67
+ async search() {
68
+ return [result];
69
+ },
70
+ async searchGlobal() {
71
+ return [];
72
+ },
73
+ async bm25Search() {
74
+ return [];
75
+ },
76
+ async vectorSearch() {
77
+ return [];
78
+ },
79
+ async hybridSearch() {
80
+ return [];
81
+ },
82
+ async update() {},
83
+ async updateCollection() {},
84
+ async embed() {},
85
+ async embedCollection() {},
86
+ async ensureCollection() {
87
+ return "present";
88
+ },
89
+ };
90
+ }
91
+
92
+ interface StartedServer {
93
+ url: string;
94
+ stop: () => Promise<void>;
95
+ }
96
+
97
+ async function startTimingsServer(service: EngramAccessService): Promise<StartedServer> {
98
+ const server = new EngramAccessHttpServer({
99
+ service,
100
+ host: "127.0.0.1",
101
+ port: 0,
102
+ authToken: "secret-token",
103
+ principal: "operator",
104
+ trustPrincipalHeader: true,
105
+ maxBodyBytes: 1024,
106
+ });
107
+ const started = await server.start();
108
+ return { url: `http://${started.host}:${started.port}`, stop: () => server.stop() };
109
+ }
110
+
111
+ interface RecallBody {
112
+ query: string;
113
+ sessionKey: string;
114
+ asOf?: string;
115
+ }
116
+
117
+ function recallRequest(
118
+ server: StartedServer,
119
+ body: RecallBody,
120
+ extraHeaders: Record<string, string> = {},
121
+ signal?: AbortSignal,
122
+ ): Promise<Response> {
123
+ return fetch(`${server.url}/engram/v1/recall`, {
124
+ method: "POST",
125
+ headers: {
126
+ authorization: "Bearer secret-token",
127
+ "content-type": "application/json",
128
+ ...extraHeaders,
129
+ },
130
+ body: JSON.stringify(body),
131
+ signal,
132
+ });
133
+ }
134
+
135
+ function assertPhase2(
136
+ label: string,
137
+ ms: number | undefined,
138
+ status: Phase2AwaitStatus | undefined,
139
+ ): void {
140
+ assert.ok(
141
+ status !== undefined && PHASE2_AWAIT_STATUSES.includes(status),
142
+ `${label} status must be a bounded enum value`,
143
+ );
144
+ assert.ok(
145
+ ms !== undefined && Number.isFinite(ms) && ms >= 0,
146
+ `${label} ms must be a bounded non-negative number`,
147
+ );
148
+ }
149
+
150
+ interface HarmonicHarness {
151
+ qmdMemory: MemoryFile;
152
+ releaseHarmonicRead: () => void;
153
+ harmonicReadCalls: { count: number };
154
+ correlationIdsSeen: string[];
155
+ }
156
+
157
+ /** Park the harmonic source read behind a gate (the house ordering-harness pattern). */
158
+ async function makeHarmonicHarness(memoryDir: string): Promise<HarmonicHarness> {
159
+ const storage = new StorageManager(memoryDir);
160
+ await storage.ensureDirectories();
161
+ const { memory: qmdMemory } = await storage.writeMemory(
162
+ "fact",
163
+ "the atlas qmd sentinel confirms deployment cadence",
164
+ { source: "test" },
165
+ );
166
+ const { memory: harmonicSource } = await storage.writeMemory(
167
+ "fact",
168
+ "atlas harmonic source lookup body",
169
+ { source: "test" },
170
+ );
171
+ await recordAbstractionNode({
172
+ memoryDir,
173
+ node: {
174
+ schemaVersion: 1,
175
+ nodeId: "correlation-under-test",
176
+ recordedAt: new Date().toISOString(),
177
+ sessionKey: "agent:test",
178
+ kind: "topic",
179
+ abstractionLevel: "meso",
180
+ title: "atlas source lookup",
181
+ summary: "atlas source lookup",
182
+ sourceMemoryIds: [harmonicSource.frontmatter.id],
183
+ },
184
+ });
185
+ await rebuildMemoryProjection({ memoryDir, storage, dryRun: false });
186
+
187
+ const harmonicGate = Promise.withResolvers<void>();
188
+ const harmonicReadCalls = { count: 0 };
189
+ const correlationIdsSeen: string[] = [];
190
+ const originalRead = StorageManager.prototype.readMemoryByPath;
191
+ const harmonicSourcePath = path.resolve(harmonicSource.path);
192
+ mock.method(
193
+ StorageManager.prototype,
194
+ "readMemoryByPath",
195
+ function interceptHarmonicSourceRead(
196
+ this: StorageManager,
197
+ filePath: string,
198
+ ): Promise<MemoryFile | null> {
199
+ if (path.resolve(filePath) !== harmonicSourcePath) {
200
+ return originalRead.call(this, filePath);
201
+ }
202
+ harmonicReadCalls.count += 1;
203
+ const seen = currentCorrelationId();
204
+ if (seen !== undefined) correlationIdsSeen.push(seen);
205
+ return harmonicGate.promise.then(() => originalRead.call(this, filePath));
206
+ },
207
+ );
208
+ return {
209
+ qmdMemory,
210
+ releaseHarmonicRead: () => harmonicGate.resolve(),
211
+ harmonicReadCalls,
212
+ correlationIdsSeen,
213
+ };
214
+ }
215
+
216
+ function stubQmd(orchestrator: Orchestrator, harness: HarmonicHarness): void {
217
+ orchestrator.qmd = settledQmdBackend({
218
+ docid: harness.qmdMemory.frontmatter.id,
219
+ path: harness.qmdMemory.path,
220
+ score: 0.9,
221
+ snippet: harness.qmdMemory.content,
222
+ });
223
+ }
224
+
225
+ test("recall timing requestId equals the HTTP x-request-id response header", async () => {
226
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-corr-"));
227
+ const config = makeConfig(memoryDir);
228
+ const server = await startTimingsServer(new EngramAccessService(new Orchestrator(config)));
229
+ try {
230
+ const response = await recallRequest(server, { query: "correlation probe", sessionKey: "corr:probe" });
231
+ assert.equal(response.status, 200);
232
+ const requestIdHeader = response.headers.get("x-request-id");
233
+ assert.ok(requestIdHeader, "recall response must carry x-request-id");
234
+
235
+ const records = getRecallTimings(config);
236
+ // The record's requestId IS the server-generated HTTP correlation id
237
+ // surfaced as x-request-id — not a second, unrelated uuid.
238
+ assert.equal(records[0]?.requestId, requestIdHeader);
239
+ assert.equal(records[0]?.outcome, "ok");
240
+ } finally {
241
+ await server.stop();
242
+ await cleanupDir(memoryDir);
243
+ }
244
+ });
245
+
246
+ test("concurrent recalls never cross request ids", async () => {
247
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-corr-par-"));
248
+ const config = makeConfig(memoryDir);
249
+ const server = await startTimingsServer(new EngramAccessService(new Orchestrator(config)));
250
+ try {
251
+ const responses = await Promise.all(
252
+ ["parallel one", "parallel two", "parallel three"].map((query) =>
253
+ recallRequest(server, { query, sessionKey: "corr:parallel" }),
254
+ ),
255
+ );
256
+ const headerIds = responses.map((response) => response.headers.get("x-request-id"));
257
+ assert.equal(new Set(headerIds).size, headerIds.length, "each request gets its own correlation id");
258
+
259
+ const recordIds = getRecallTimings(config).map((record) => record.requestId);
260
+ for (const id of headerIds) {
261
+ assert.ok(id !== null && recordIds.includes(id), "each request's record carries that request's id");
262
+ }
263
+ } finally {
264
+ await server.stop();
265
+ await cleanupDir(memoryDir);
266
+ }
267
+ });
268
+
269
+ test("client-supplied x-request-id never becomes the record's request id", async () => {
270
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-corr-spoof-"));
271
+ const config = makeConfig(memoryDir);
272
+ const server = await startTimingsServer(new EngramAccessService(new Orchestrator(config)));
273
+ try {
274
+ const response = await recallRequest(
275
+ server,
276
+ { query: "spoof probe", sessionKey: "corr:spoof" },
277
+ { "x-request-id": "client-chosen-id" },
278
+ );
279
+ const serverHeader = response.headers.get("x-request-id");
280
+ assert.notEqual(serverHeader, "client-chosen-id");
281
+
282
+ const records = getRecallTimings(config);
283
+ assert.equal(records[0]?.requestId, serverHeader);
284
+ assert.match(records[0]?.requestId ?? "", UUID_PATTERN);
285
+ } finally {
286
+ await server.stop();
287
+ await cleanupDir(memoryDir);
288
+ }
289
+ });
290
+
291
+ test("HTTP recall rejected as bad input records outcome error under the x-request-id", async () => {
292
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-corr-error-"));
293
+ const config = makeConfig(memoryDir);
294
+ const server = await startTimingsServer(new EngramAccessService(new Orchestrator(config)));
295
+ try {
296
+ const response = await recallRequest(server, {
297
+ query: "bad asOf probe",
298
+ sessionKey: "corr:error",
299
+ asOf: "not-a-timestamp",
300
+ });
301
+ assert.equal(response.status, 400);
302
+ const requestIdHeader = response.headers.get("x-request-id");
303
+ assert.ok(requestIdHeader, "error responses carry x-request-id too");
304
+
305
+ const records = getRecallTimings(config);
306
+ assert.equal(records[0]?.requestId, requestIdHeader);
307
+ assert.equal(records[0]?.outcome, "error");
308
+ } finally {
309
+ await server.stop();
310
+ await cleanupDir(memoryDir);
311
+ }
312
+ });
313
+
314
+ test("aborted HTTP recall records outcome aborted under its own request id", async () => {
315
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-corr-abort-"));
316
+ const config = makeConfig(memoryDir, { qmdEnabled: true, harmonicRetrievalEnabled: true });
317
+ const orchestrator = new Orchestrator(config);
318
+ const harness = await makeHarmonicHarness(memoryDir);
319
+ stubQmd(orchestrator, harness);
320
+ const server = await startTimingsServer(new EngramAccessService(orchestrator));
321
+ try {
322
+ const client = new AbortController();
323
+ const pending = recallRequest(
324
+ server,
325
+ { query: "atlas source lookup", sessionKey: "corr:abort" },
326
+ {},
327
+ client.signal,
328
+ ).catch(() => undefined);
329
+ await eventually(
330
+ async () => (harness.harmonicReadCalls.count > 0 ? true : null),
331
+ "harmonic read reached the parked seam",
332
+ );
333
+ client.abort();
334
+ harness.releaseHarmonicRead();
335
+ await eventually(
336
+ async () => (getRecallTimings(config)[0]?.outcome === "aborted" ? true : null),
337
+ "the aborted attempt records outcome aborted",
338
+ );
339
+ await pending;
340
+
341
+ const records = getRecallTimings(config);
342
+ assert.equal(records.length, 1, "exactly one record for the attempt");
343
+ assert.equal(harness.correlationIdsSeen.length, 1);
344
+ // Same id: the one the HTTP layer minted for this request, observed from
345
+ // inside the request's own async context while the recall was in flight.
346
+ assert.equal(records[0]?.requestId, harness.correlationIdsSeen[0]);
347
+ assert.match(records[0]?.requestId ?? "", UUID_PATTERN);
348
+ } finally {
349
+ harness.releaseHarmonicRead();
350
+ await server.stop();
351
+ await cleanupDir(memoryDir);
352
+ }
353
+ });
354
+
355
+ test("phase-2 await fields are populated, bounded, and skipped for disabled sections", async () => {
356
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-phase2-"));
357
+ const config = makeConfig(memoryDir);
358
+ const service = new EngramAccessService(new Orchestrator(config));
359
+ await service.recall({ query: "phase two probe", sessionKey: "phase2:probe" });
360
+ const record = getRecallTimings(config)[0];
361
+ assert.ok(record);
362
+ assertPhase2("harmonic", record.phase2HarmonicMs, record.phase2HarmonicStatus);
363
+ assertPhase2("graph snapshot", record.phase2GraphSnapshotMs, record.phase2GraphSnapshotStatus);
364
+ assertPhase2("intent snapshot", record.phase2IntentSnapshotMs, record.phase2IntentSnapshotStatus);
365
+ assertPhase2("compression", record.phase2CompressionMs, record.phase2CompressionStatus);
366
+ assertPhase2("compounding", record.phase2CompoundingMs, record.phase2CompoundingStatus);
367
+ assertPhase2("questions", record.phase2QuestionsMs, record.phase2QuestionsStatus);
368
+ assertPhase2("prefilter", record.phase2PrefilterMs, record.phase2PrefilterStatus);
369
+ // Default config disables these sections: 0 ms, skipped, no invented time.
370
+ assert.equal(record.phase2HarmonicStatus, "skipped");
371
+ assert.equal(record.phase2HarmonicMs, 0);
372
+ assert.equal(record.phase2CompressionStatus, "skipped");
373
+ assert.equal(record.phase2CompressionMs, 0);
374
+ assert.equal(record.phase2QuestionsStatus, "skipped");
375
+ assert.equal(record.phase2QuestionsMs, 0);
376
+ assert.equal(record.phase2PrefilterStatus, "skipped");
377
+ assert.equal(record.phase2PrefilterMs, 0);
378
+ // The intent snapshot always runs.
379
+ assert.equal(record.phase2IntentSnapshotStatus, "ok");
380
+ await cleanupDir(memoryDir);
381
+ });
382
+
383
+ test("enrichment timeout records timeout status while recall still succeeds", async () => {
384
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-phase2-timeout-"));
385
+ const config = makeConfig(memoryDir, {
386
+ qmdEnabled: true,
387
+ harmonicRetrievalEnabled: true,
388
+ recallEnrichmentDeadlineMs: 1,
389
+ });
390
+ const orchestrator = new Orchestrator(config);
391
+ const harness = await makeHarmonicHarness(memoryDir);
392
+ stubQmd(orchestrator, harness);
393
+ const service = new EngramAccessService(orchestrator);
394
+ // The recall must still settle (fail-open unchanged) despite the parked read.
395
+ await service.recall({ query: "atlas source lookup", sessionKey: "phase2:timeout" });
396
+ const record = getRecallTimings(config)[0];
397
+ assert.ok(record);
398
+ assert.equal(record.phase2HarmonicStatus, "timeout");
399
+ assertPhase2("harmonic", record.phase2HarmonicMs, record.phase2HarmonicStatus);
400
+ assert.equal(record.outcome, "ok");
401
+ harness.releaseHarmonicRead();
402
+ await cleanupDir(memoryDir);
403
+ });
404
+
405
+ test("failed enrichment records error status while recall still succeeds", async () => {
406
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-phase2-error-"));
407
+ const config = makeConfig(memoryDir, { compoundingEnabled: true });
408
+ const orchestrator = new Orchestrator(config);
409
+ mock.method(CompoundingEngine.prototype, "buildRecallSection", () =>
410
+ Promise.reject(new Error("synthetic compounding failure")));
411
+ const service = new EngramAccessService(orchestrator);
412
+ // Fail-open is unchanged: the recall still resolves; only the status says why.
413
+ await service.recall({ query: "compounding failure probe", sessionKey: "phase2:error" });
414
+ const record = getRecallTimings(config)[0];
415
+ assert.ok(record);
416
+ assert.equal(record.phase2CompoundingStatus, "error");
417
+ assertPhase2("compounding", record.phase2CompoundingMs, record.phase2CompoundingStatus);
418
+ assert.equal(record.outcome, "ok");
419
+ await cleanupDir(memoryDir);
420
+ });
421
+
422
+ test("started-earlier awaits also record total time since their promise was created", async () => {
423
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-phase2-overlap-"));
424
+ const config = makeConfig(memoryDir, {
425
+ qmdEnabled: true,
426
+ harmonicRetrievalEnabled: true,
427
+ queryAwareIndexingEnabled: true,
428
+ });
429
+ const orchestrator = new Orchestrator(config);
430
+ const harness = await makeHarmonicHarness(memoryDir);
431
+ harness.releaseHarmonicRead();
432
+ stubQmd(orchestrator, harness);
433
+ const service = new EngramAccessService(orchestrator);
434
+ await service.recall({ query: "atlas source lookup", sessionKey: "phase2:overlap" });
435
+ const record = getRecallTimings(config)[0];
436
+ assert.ok(record);
437
+ assert.equal(record.phase2HarmonicStatus, "ok");
438
+ assert.ok(record.phase2HarmonicMs !== undefined && record.phase2HarmonicTotalMs !== undefined);
439
+ // Total time since the promise was created covers the await itself: the two
440
+ // overlap, they are not additive.
441
+ assert.ok(record.phase2HarmonicTotalMs >= record.phase2HarmonicMs);
442
+ assert.ok(record.phase2PrefilterMs !== undefined && record.phase2PrefilterTotalMs !== undefined);
443
+ assert.ok(record.phase2PrefilterTotalMs >= record.phase2PrefilterMs);
444
+ await cleanupDir(memoryDir);
445
+ });
446
+
447
+ test("recall response body carries no timing-contract fields", async () => {
448
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-corr-body-"));
449
+ const config = makeConfig(memoryDir);
450
+ const server = await startTimingsServer(new EngramAccessService(new Orchestrator(config)));
451
+ try {
452
+ const response = await recallRequest(server, { query: "body shape probe", sessionKey: "corr:body" });
453
+ assert.equal(response.status, 200);
454
+ const keys = Object.keys(z.object({}).passthrough().parse(await response.json()));
455
+ for (const expected of ["query", "namespace", "context", "count", "memoryIds", "results", "fallbackUsed", "sourcesUsed"]) {
456
+ assert.ok(keys.includes(expected), `recall body must still carry ${expected}`);
457
+ }
458
+ // Timing-contract fields live only in the operator-gated timing record.
459
+ for (const key of keys) {
460
+ assert.doesNotMatch(key, /requestId|outcome|httpTotal|phase2|timingsMs/, `timing field leaked into recall body: ${key}`);
461
+ }
462
+ } finally {
463
+ await server.stop();
464
+ await cleanupDir(memoryDir);
465
+ }
466
+ });
467
+
468
+ test("a recall the outer timeout cuts short records outcome error, not ok", async () => {
469
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-outer-timeout-"));
470
+ const config = makeConfig(memoryDir, {
471
+ qmdEnabled: true,
472
+ harmonicRetrievalEnabled: true,
473
+ recallOuterTimeoutMs: 50,
474
+ });
475
+ const orchestrator = new Orchestrator(config);
476
+ const harness = await makeHarmonicHarness(memoryDir);
477
+ stubQmd(orchestrator, harness);
478
+ const service = new EngramAccessService(orchestrator);
479
+ // The entry coordinator swallows the timeout and returns a degraded context,
480
+ // so the surface call resolves; the record must still say it did not complete.
481
+ await service.recall({ query: "atlas source lookup", sessionKey: "outer:timeout" });
482
+ harness.releaseHarmonicRead();
483
+ const records = getRecallTimings(config);
484
+ assert.equal(records.length, 1);
485
+ assert.equal(records[0]?.outcome, "error");
486
+ assert.equal(records[0]?.phase2HarmonicStatus, undefined, "no phase-2 data from a pipeline that never finished");
487
+ await cleanupDir(memoryDir);
488
+ });