@remnic/core 9.69.50 → 9.69.52

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 (582) hide show
  1. package/dist/access-admin-ops-surface.d.ts +14 -14
  2. package/dist/access-admin-ops-surface.js +60 -60
  3. package/dist/access-audit.d.ts +1 -0
  4. package/dist/access-audit.js +2 -2
  5. package/dist/access-authorization-probe.d.ts +14 -14
  6. package/dist/access-authorization-probe.js +61 -61
  7. package/dist/access-boundary.d.ts +14 -14
  8. package/dist/access-boundary.js +60 -60
  9. package/dist/access-cli.js +121 -120
  10. package/dist/access-cli.js.map +1 -1
  11. package/dist/access-coding-context-resolution.d.ts +1 -1
  12. package/dist/access-extraction-force-flush.d.ts +14 -14
  13. package/dist/access-extraction-force-flush.js +60 -60
  14. package/dist/access-health-types.d.ts +1 -1
  15. package/dist/access-http-briefing.d.ts +14 -14
  16. package/dist/access-http-briefing.js +61 -61
  17. package/dist/access-http-lcm-compaction.d.ts +14 -14
  18. package/dist/access-http-lifecycle-flush.d.ts +14 -14
  19. package/dist/access-http-offline-stream.d.ts +14 -14
  20. package/dist/access-http-query.d.ts +2 -2
  21. package/dist/access-http-query.js +62 -62
  22. package/dist/access-http.d.ts +15 -15
  23. package/dist/access-http.js +80 -80
  24. package/dist/access-identity-continuity-surface.d.ts +11 -11
  25. package/dist/access-identity-continuity-surface.js +60 -60
  26. package/dist/access-lcm-surface.d.ts +14 -14
  27. package/dist/access-lcm-surface.js +60 -60
  28. package/dist/access-mcp-output-schemas.js +1 -1
  29. package/dist/access-mcp-shared-context-tools.d.ts +14 -14
  30. package/dist/access-mcp.d.ts +14 -14
  31. package/dist/access-mcp.js +71 -71
  32. package/dist/access-memory-search-fanout.d.ts +2 -2
  33. package/dist/{access-namespace-preflight-C1q3XuAc.d.ts → access-namespace-preflight-U9RAdxqZ.d.ts} +1 -1
  34. package/dist/access-namespace-preflight.d.ts +3 -3
  35. package/dist/access-namespace-preflight.js +60 -60
  36. package/dist/access-observe-transcript.d.ts +11 -11
  37. package/dist/access-observe-write-category.d.ts +3 -3
  38. package/dist/access-observe-write-category.js +7 -7
  39. package/dist/access-observe-write-surface.d.ts +14 -14
  40. package/dist/access-observe-write-surface.js +60 -60
  41. package/dist/access-offline-manifest.d.ts +11 -11
  42. package/dist/access-offline-manifest.js +5 -5
  43. package/dist/access-operations-batch.js +62 -62
  44. package/dist/access-operations.d.ts +14 -14
  45. package/dist/access-operations.js +69 -69
  46. package/dist/access-recall-concurrency.d.ts +14 -14
  47. package/dist/access-recall-concurrency.js +60 -60
  48. package/dist/access-recall-response.d.ts +14 -14
  49. package/dist/access-recall-response.js +60 -60
  50. package/dist/access-recall-surface.d.ts +15 -15
  51. package/dist/access-recall-surface.js +60 -60
  52. package/dist/access-schema.d.ts +1 -1
  53. package/dist/access-schema.js +4 -4
  54. package/dist/{access-service-BZaC-RZw.d.ts → access-service-CUNM5RfA.d.ts} +9 -9
  55. package/dist/access-service-helpers.d.ts +14 -14
  56. package/dist/access-service.d.ts +14 -14
  57. package/dist/access-service.js +60 -60
  58. package/dist/access-surface-catalog.d.ts +14 -14
  59. package/dist/access-surface-catalog.js +62 -62
  60. package/dist/access-wearables-meetings-surface.d.ts +4 -4
  61. package/dist/action-confidence.d.ts +1 -1
  62. package/dist/active-memory-bridge.d.ts +1 -1
  63. package/dist/active-recall.d.ts +1 -1
  64. package/dist/active-recall.js +73 -2
  65. package/dist/active-recall.js.map +1 -1
  66. package/dist/activity/digest.d.ts +1 -1
  67. package/dist/ambient-provenance.d.ts +1 -1
  68. package/dist/artifact-search.d.ts +1 -1
  69. package/dist/{auto-sync-DG5KEOF5.js → auto-sync-CWSZDLLW.js} +6 -6
  70. package/dist/background-generation.d.ts +1 -1
  71. package/dist/behavior-learner.d.ts +1 -1
  72. package/dist/behavior-signals.d.ts +1 -1
  73. package/dist/bootstrap.d.ts +11 -11
  74. package/dist/briefing-window.d.ts +2 -2
  75. package/dist/briefing.d.ts +2 -2
  76. package/dist/briefing.js +12 -12
  77. package/dist/buffer-surprise-report.d.ts +1 -1
  78. package/dist/buffer-turn-helpers.d.ts +1 -1
  79. package/dist/buffer.d.ts +2 -2
  80. package/dist/buffer.js +4 -4
  81. package/dist/bulk-import/index.d.ts +3 -3
  82. package/dist/calibration.d.ts +1 -1
  83. package/dist/capabilities.d.ts +1 -1
  84. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  85. package/dist/{catalog-DK2eHhax.d.ts → catalog-BuMyYPUn.d.ts} +1 -1
  86. package/dist/causal-behavior.d.ts +1 -1
  87. package/dist/causal-consolidation.d.ts +1 -1
  88. package/dist/causal-consolidation.js +19 -19
  89. package/dist/causal-trajectory-graph.d.ts +1 -1
  90. package/dist/{chunk-3SI3FFTW.js → chunk-2INZSV27.js} +2 -2
  91. package/dist/{chunk-PMLFPVYJ.js → chunk-2QZJ4P27.js} +2 -2
  92. package/dist/{chunk-3RZB7TYL.js → chunk-2UDAABV6.js} +2 -2
  93. package/dist/{chunk-4PXFLDMJ.js → chunk-35EH6KW4.js} +2 -2
  94. package/dist/{chunk-KOEDSRF5.js → chunk-43IQRLEF.js} +2 -2
  95. package/dist/{chunk-LBLXEFWK.js → chunk-4MN27537.js} +1 -1
  96. package/dist/chunk-4MN27537.js.map +1 -0
  97. package/dist/{chunk-PQWICTRO.js → chunk-4UVJ6EIT.js} +1 -1
  98. package/dist/chunk-4UVJ6EIT.js.map +1 -0
  99. package/dist/{chunk-56C7OO3N.js → chunk-6KCQNFDQ.js} +18 -18
  100. package/dist/chunk-6VITOSPL.js +69 -0
  101. package/dist/chunk-6VITOSPL.js.map +1 -0
  102. package/dist/{chunk-UD6W67JM.js → chunk-72AV2H3R.js} +76 -25
  103. package/dist/chunk-72AV2H3R.js.map +1 -0
  104. package/dist/{chunk-VBRS7Z3O.js → chunk-72N2P44O.js} +5 -5
  105. package/dist/{chunk-ZUNYFDI4.js → chunk-7QVYVSEH.js} +2 -2
  106. package/dist/{chunk-SRMBMMTK.js → chunk-7RKAE6Y4.js} +3 -3
  107. package/dist/{chunk-42BV46XS.js → chunk-AH44WTLJ.js} +2 -2
  108. package/dist/{chunk-TZ44E732.js → chunk-AIVRD66I.js} +2 -2
  109. package/dist/{chunk-AYGWJ2UK.js → chunk-AQWGCHIV.js} +6 -6
  110. package/dist/{chunk-EZV43XBD.js → chunk-AYHNTYVG.js} +2 -2
  111. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  112. package/dist/{chunk-JHUODJRW.js → chunk-D2N3PMAE.js} +2 -2
  113. package/dist/{chunk-7SJCSDQ3.js → chunk-D7VT2LED.js} +2 -2
  114. package/dist/{chunk-TVVEYCNW.js → chunk-DAOMWGO2.js} +2 -2
  115. package/dist/{chunk-OQZYHCWM.js → chunk-DCRK7I5E.js} +72 -71
  116. package/dist/{chunk-OQZYHCWM.js.map → chunk-DCRK7I5E.js.map} +1 -1
  117. package/dist/{chunk-MVMNEU65.js → chunk-DI52XAKG.js} +2 -2
  118. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  119. package/dist/{chunk-EUP4AXIW.js → chunk-DZP2XMZC.js} +2 -2
  120. package/dist/{chunk-PA5EOTRR.js → chunk-EVQ33D3N.js} +4 -4
  121. package/dist/{chunk-E64HBW7M.js → chunk-EW3Y73MN.js} +5 -5
  122. package/dist/{chunk-VSN2DMQK.js → chunk-G2DF5MI7.js} +4 -4
  123. package/dist/{chunk-JIWZVOQM.js → chunk-G7S37WD4.js} +2 -2
  124. package/dist/{chunk-AL7OLBL7.js → chunk-GRX6YH4E.js} +2 -2
  125. package/dist/{chunk-XTMABIFW.js → chunk-HG42J2EX.js} +2 -2
  126. package/dist/{chunk-MQMZO23A.js → chunk-HWT6KRGS.js} +2 -2
  127. package/dist/{chunk-LR7KUQ2W.js → chunk-IEOBAOA6.js} +6 -6
  128. package/dist/{chunk-UDAUULK2.js → chunk-IGEZE6QB.js} +5 -5
  129. package/dist/{chunk-SGHGCFVV.js → chunk-JE334SIA.js} +10 -10
  130. package/dist/{chunk-IC3PM3YO.js → chunk-JE4H2QBO.js} +2 -2
  131. package/dist/{chunk-E73SVGJA.js → chunk-JMZQS6OS.js} +2 -2
  132. package/dist/{chunk-3RABJOGD.js → chunk-KH2D26LQ.js} +5 -5
  133. package/dist/{chunk-3MIZ2EKQ.js → chunk-KQQEZTH6.js} +2 -2
  134. package/dist/{chunk-F5V7KRQS.js → chunk-LIAKZGOY.js} +2 -2
  135. package/dist/{chunk-A7GQBJP5.js → chunk-LVFI5LG7.js} +7 -7
  136. package/dist/{chunk-IST6MBYC.js → chunk-MSTKJI5T.js} +529 -376
  137. package/dist/chunk-MSTKJI5T.js.map +1 -0
  138. package/dist/{chunk-DH536WT2.js → chunk-MWVYHNSU.js} +12 -2
  139. package/dist/chunk-MWVYHNSU.js.map +1 -0
  140. package/dist/{chunk-D7QX26FF.js → chunk-O7OVWKT4.js} +2 -2
  141. package/dist/{chunk-JOP7W24J.js → chunk-PLJ2MQFT.js} +4 -4
  142. package/dist/{chunk-D2XUSZ24.js → chunk-QWQB7TOB.js} +20 -20
  143. package/dist/{chunk-HRCWDO6S.js → chunk-RSMNPYBM.js} +2 -2
  144. package/dist/{chunk-BOTSR5S3.js → chunk-RUUJXAGT.js} +2 -2
  145. package/dist/{chunk-FO6IK4IF.js → chunk-SEQ6DWXD.js} +11 -11
  146. package/dist/{chunk-ZBAQMSEY.js → chunk-SLGD36MM.js} +3 -3
  147. package/dist/{chunk-IYHHCSF6.js → chunk-SOFATSHJ.js} +61 -61
  148. package/dist/{chunk-JG4AP36X.js → chunk-SPFNGHHP.js} +2 -2
  149. package/dist/{chunk-DNO6QWCB.js → chunk-SPWNCGSM.js} +2 -2
  150. package/dist/{chunk-QSP4Y73Q.js → chunk-SVUUOLKM.js} +2 -2
  151. package/dist/{chunk-D6WX5FEF.js → chunk-SZ7IVZGD.js} +2 -2
  152. package/dist/{chunk-2IVHOQRY.js → chunk-TEQQQTQS.js} +5 -5
  153. package/dist/{chunk-UI6R2YUB.js → chunk-TQT4AOPO.js} +4 -4
  154. package/dist/{chunk-3UQIS2GC.js → chunk-TTFJQ5B5.js} +2 -2
  155. package/dist/{chunk-JTPAXDSX.js → chunk-U2SK45U3.js} +2 -2
  156. package/dist/{chunk-4FWNMN5R.js → chunk-U6CMLAP4.js} +5 -5
  157. package/dist/{chunk-6525YIYL.js → chunk-UCH2RWFX.js} +3 -3
  158. package/dist/{chunk-QZDUNK6V.js → chunk-UCY4EHAG.js} +6 -6
  159. package/dist/{chunk-OP5IBPHP.js → chunk-UDJMJNBK.js} +2 -2
  160. package/dist/{chunk-BHI5ILU5.js → chunk-ULQVG6G3.js} +2 -2
  161. package/dist/{chunk-X6B2QWXW.js → chunk-UQTXER7M.js} +2 -2
  162. package/dist/{chunk-OLJYDGGP.js → chunk-UVZBDIJX.js} +214 -4
  163. package/dist/chunk-UVZBDIJX.js.map +1 -0
  164. package/dist/{chunk-QXQCPNKA.js → chunk-V5BU5PVE.js} +7 -7
  165. package/dist/{chunk-IPLYGWQF.js → chunk-VDX2J7OX.js} +6 -6
  166. package/dist/{chunk-XUKUMBP3.js → chunk-VGO57TU7.js} +5 -5
  167. package/dist/{chunk-W6V7JN2E.js → chunk-VUV472VH.js} +12 -12
  168. package/dist/{chunk-ZHXSOMYH.js → chunk-VVX5PZFS.js} +2 -2
  169. package/dist/{chunk-ML5FW2RO.js → chunk-WBW34YCJ.js} +2 -2
  170. package/dist/{chunk-ECLY4NZA.js → chunk-WH7RINGG.js} +10 -4
  171. package/dist/chunk-WH7RINGG.js.map +1 -0
  172. package/dist/{chunk-FDDCZDBI.js → chunk-WN4HFL4K.js} +4 -4
  173. package/dist/{chunk-MECKA6G2.js → chunk-WUJD4CHZ.js} +4 -4
  174. package/dist/{chunk-HS75MCQF.js → chunk-WUUGE7QC.js} +4 -4
  175. package/dist/{chunk-UVEBBXB5.js → chunk-X7WAM3IY.js} +2 -2
  176. package/dist/{chunk-4SDO74N2.js → chunk-XPFJSUOR.js} +5 -5
  177. package/dist/{chunk-PPNFKQ6D.js → chunk-Y4G6LHJW.js} +2 -2
  178. package/dist/{chunk-C3PKRFZ4.js → chunk-Y7LZ5V7N.js} +2 -2
  179. package/dist/{chunk-WVI43D54.js → chunk-YEIKOBOW.js} +15 -2
  180. package/dist/chunk-YEIKOBOW.js.map +1 -0
  181. package/dist/{chunk-AYP2FZFA.js → chunk-YIIW2OH2.js} +2 -2
  182. package/dist/{chunk-YSBYNCCN.js → chunk-YLPCEUXP.js} +3 -3
  183. package/dist/{chunk-RFIJH2OE.js → chunk-YUHGJBQK.js} +2 -2
  184. package/dist/{cli-BHDMJqJS.d.ts → cli-CCc34xV7.d.ts} +5 -5
  185. package/dist/cli.d.ts +16 -16
  186. package/dist/cli.js +98 -98
  187. package/dist/coding/export-okf-codegraph.d.ts +1 -1
  188. package/dist/coding/export-okf-codegraph.js +12 -12
  189. package/dist/coding/pre-action-gate.d.ts +1 -1
  190. package/dist/compounding/engine.d.ts +2 -2
  191. package/dist/compounding/engine.js +11 -11
  192. package/dist/compounding/preference-consolidator.d.ts +1 -1
  193. package/dist/compression-optimizer.d.ts +1 -1
  194. package/dist/config.d.ts +1 -1
  195. package/dist/config.js +73 -2
  196. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  197. package/dist/connectors/codex-materialize-runner.js +15 -15
  198. package/dist/connectors/codex-materialize.d.ts +1 -1
  199. package/dist/connectors/index.d.ts +1 -1
  200. package/dist/connectors/index.js +19 -19
  201. package/dist/consolidation-provenance-check.d.ts +2 -2
  202. package/dist/consolidation-undo.d.ts +2 -2
  203. package/dist/contradiction/index.d.ts +4 -4
  204. package/dist/converge-config.d.ts +1 -1
  205. package/dist/convergence-refresh.d.ts +2 -2
  206. package/dist/convergence-refresh.js +13 -13
  207. package/dist/conversation-index/backend.d.ts +1 -1
  208. package/dist/conversation-index/chunker.d.ts +1 -1
  209. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  210. package/dist/conversation-index/indexer.d.ts +1 -1
  211. package/dist/conversation-index/search.d.ts +1 -1
  212. package/dist/corpus-watermark.d.ts +1 -1
  213. package/dist/corpus-watermark.js +13 -13
  214. package/dist/cross-lingual-recall.d.ts +1 -1
  215. package/dist/day-summary.d.ts +1 -1
  216. package/dist/deep-recall-http-glue.d.ts +14 -14
  217. package/dist/deep-recall-http-glue.js +5 -5
  218. package/dist/deep-recall-mcp-tools.d.ts +14 -14
  219. package/dist/deep-recall-policy-llm.d.ts +2 -2
  220. package/dist/deep-recall-seeds.d.ts +1 -1
  221. package/dist/deep-recall.js +2 -2
  222. package/dist/delinearize.d.ts +1 -1
  223. package/dist/dependency-propagation-config.d.ts +1 -1
  224. package/dist/{dependency-propagation-delivery-BMkR4gmY.d.ts → dependency-propagation-delivery-BrhPjAHQ.d.ts} +1 -1
  225. package/dist/direct-answer-wiring.d.ts +1 -1
  226. package/dist/direct-answer.d.ts +1 -1
  227. package/dist/directory-sidecars.d.ts +28 -2
  228. package/dist/directory-sidecars.js +9 -1
  229. package/dist/embedding-fallback.d.ts +1 -1
  230. package/dist/enrichment/index.d.ts +1 -1
  231. package/dist/entity-origin-fields.d.ts +1 -1
  232. package/dist/entity-retrieval.d.ts +2 -2
  233. package/dist/entity-retrieval.js +11 -11
  234. package/dist/entity-schema.d.ts +1 -1
  235. package/dist/episodic-context.d.ts +1 -1
  236. package/dist/eval-trajectory-contracts.d.ts +1 -1
  237. package/dist/eval-trajectory-store.d.ts +1 -1
  238. package/dist/eval-trajectory.d.ts +1 -1
  239. package/dist/explicit-capture.d.ts +11 -11
  240. package/dist/external-wiki-access.d.ts +14 -14
  241. package/dist/external-wiki-access.js +61 -61
  242. package/dist/external-wiki-collection-registration.d.ts +1 -1
  243. package/dist/external-wiki-collection.d.ts +1 -1
  244. package/dist/external-wiki-mcp-tools.d.ts +14 -14
  245. package/dist/extraction-error-classification.d.ts +1 -1
  246. package/dist/extraction-evidence-class.d.ts +1 -1
  247. package/dist/extraction-faithfulness.d.ts +2 -2
  248. package/dist/extraction-judge-telemetry.d.ts +2 -2
  249. package/dist/extraction-judge-training.d.ts +2 -2
  250. package/dist/extraction-judge.d.ts +2 -2
  251. package/dist/extraction-judge.js +2 -2
  252. package/dist/extraction-liveness.d.ts +1 -1
  253. package/dist/extraction-normalization.d.ts +1 -1
  254. package/dist/extraction-prompt.d.ts +1 -1
  255. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  256. package/dist/extraction-source-grounding.d.ts +1 -1
  257. package/dist/extraction-span-config.d.ts +1 -1
  258. package/dist/extraction-span-materialize.d.ts +1 -1
  259. package/dist/extraction-span-wire.d.ts +1 -1
  260. package/dist/extraction.d.ts +2 -2
  261. package/dist/extraction.js +21 -21
  262. package/dist/fallback-llm-codex-subscription.d.ts +1 -1
  263. package/dist/fallback-llm.d.ts +1 -1
  264. package/dist/{generic-recall-paths-BCRtXU32.d.ts → generic-recall-paths-C0J1Oxb7.d.ts} +1 -1
  265. package/dist/graph-append-error.d.ts +1 -1
  266. package/dist/graph-dashboard-diff.d.ts +1 -1
  267. package/dist/graph-dashboard-key.d.ts +1 -1
  268. package/dist/graph-dashboard-parser.d.ts +1 -1
  269. package/dist/graph-edge-reinforcement.d.ts +1 -1
  270. package/dist/graph-jsonl.d.ts +1 -1
  271. package/dist/graph-path-reconstruction.d.ts +1 -1
  272. package/dist/graph-path-scoring.d.ts +1 -1
  273. package/dist/graph-snapshot.d.ts +1 -1
  274. package/dist/graph.d.ts +1 -1
  275. package/dist/harmonic-retrieval.js +2 -2
  276. package/dist/importance.d.ts +1 -1
  277. package/dist/importers/index.d.ts +1 -1
  278. package/dist/importers/test-utils.d.ts +1 -1
  279. package/dist/in-flight-reads.d.ts +1 -1
  280. package/dist/{index-DMNTW4W6.d.ts → index-B735x-tK.d.ts} +3 -3
  281. package/dist/index.d.ts +28 -26
  282. package/dist/index.js +208 -198
  283. package/dist/intent.d.ts +1 -1
  284. package/dist/lcm/engine.d.ts +1 -1
  285. package/dist/lcm/engine.js +3 -3
  286. package/dist/lcm/index.d.ts +1 -1
  287. package/dist/lcm/index.js +8 -8
  288. package/dist/lcm/tools.d.ts +1 -1
  289. package/dist/lifecycle.d.ts +1 -1
  290. package/dist/live-connectors-runner.d.ts +1 -1
  291. package/dist/{local-llm-BXYC-mbU.d.ts → local-llm-BkkEK9rn.d.ts} +1 -1
  292. package/dist/local-llm-helpers.d.ts +2 -2
  293. package/dist/local-llm.d.ts +2 -2
  294. package/dist/local-model-endpoint.d.ts +1 -1
  295. package/dist/location/index.d.ts +5 -5
  296. package/dist/location/index.js +15 -15
  297. package/dist/maintenance/memory-governance.d.ts +1 -1
  298. package/dist/maintenance/memory-governance.js +11 -11
  299. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  300. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +11 -11
  301. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  302. package/dist/maintenance/rebuild-memory-projection.js +12 -12
  303. package/dist/{maintenance-zJiLsKBY.d.ts → maintenance-CLBIvVxg.d.ts} +3 -3
  304. package/dist/mcp-memory-inspector-app.d.ts +14 -14
  305. package/dist/memory-action-policy.d.ts +1 -1
  306. package/dist/memory-browse-http-glue.d.ts +14 -14
  307. package/dist/memory-browse-mcp-tools.d.ts +14 -14
  308. package/dist/memory-browse-operations.js +61 -61
  309. package/dist/memory-browse.d.ts +1 -1
  310. package/dist/memory-browse.js +5 -5
  311. package/dist/memory-cache.d.ts +1 -1
  312. package/dist/memory-controller.d.ts +1 -1
  313. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  314. package/dist/memory-projection-store.d.ts +1 -1
  315. package/dist/memory-provenance.d.ts +1 -1
  316. package/dist/memory-snapshot.d.ts +1 -1
  317. package/dist/memory-subject-cli.d.ts +14 -14
  318. package/dist/memory-subject.d.ts +14 -14
  319. package/dist/memory-worth-outcomes.d.ts +2 -2
  320. package/dist/models-json.d.ts +1 -1
  321. package/dist/namespaces/migrate.d.ts +3 -3
  322. package/dist/namespaces/migrate.js +12 -12
  323. package/dist/namespaces/principal.d.ts +1 -1
  324. package/dist/namespaces/search.d.ts +1 -1
  325. package/dist/namespaces/search.js +3 -3
  326. package/dist/namespaces/storage.d.ts +3 -3
  327. package/dist/namespaces/storage.js +11 -11
  328. package/dist/native-knowledge.d.ts +1 -1
  329. package/dist/offline-sync-impression-drain.d.ts +1 -1
  330. package/dist/offline-sync-impression-drain.js +3 -3
  331. package/dist/operator-doctor-corpus.d.ts +1 -1
  332. package/dist/operator-doctor-corpus.js +16 -16
  333. package/dist/operator-doctor-replica.d.ts +1 -1
  334. package/dist/operator-toolkit.d.ts +3 -3
  335. package/dist/operator-toolkit.js +40 -40
  336. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  337. package/dist/orchestration/maintenance.d.ts +4 -4
  338. package/dist/orchestration/maintenance.js +22 -22
  339. package/dist/{orchestrator-BTqT3F6X.d.ts → orchestrator-iexgVLow.d.ts} +13 -11
  340. package/dist/orchestrator.d.ts +11 -11
  341. package/dist/orchestrator.js +121 -120
  342. package/dist/patterns-cli.d.ts +1 -1
  343. package/dist/{pipeline-CgO2Sd4O.d.ts → pipeline-DvtDtyo9.d.ts} +1 -1
  344. package/dist/policy-runtime.d.ts +1 -1
  345. package/dist/proactive-contention.d.ts +2 -2
  346. package/dist/provenance.d.ts +1 -1
  347. package/dist/{public-http-Dk1EA9ix.d.ts → public-http-UWVcqMcb.d.ts} +1 -1
  348. package/dist/{qmd-CwxtVz64.d.ts → qmd-CBYBJ6HW.d.ts} +1 -1
  349. package/dist/qmd-preflight.d.ts +2 -2
  350. package/dist/qmd-recall-cache.d.ts +1 -1
  351. package/dist/qmd.d.ts +2 -2
  352. package/dist/recall-audit-anomaly.d.ts +1 -0
  353. package/dist/recall-audit.d.ts +4 -0
  354. package/dist/recall-audit.js +1 -1
  355. package/dist/recall-composition-decision.d.ts +41 -0
  356. package/dist/recall-composition-decision.js +17 -0
  357. package/dist/recall-composition-decision.js.map +1 -0
  358. package/dist/recall-concurrency-config.d.ts +1 -1
  359. package/dist/recall-disclosure-escalation.d.ts +1 -1
  360. package/dist/recall-explain-renderer.d.ts +2 -1
  361. package/dist/recall-explain-renderer.js +3 -3
  362. package/dist/recall-memory-map.d.ts +1 -1
  363. package/dist/recall-navigate-access.d.ts +1 -1
  364. package/dist/recall-navigate-access.js +2 -2
  365. package/dist/recall-navigate-disclosure.d.ts +1 -1
  366. package/dist/recall-navigate-disclosure.js +2 -2
  367. package/dist/recall-navigate.d.ts +1 -1
  368. package/dist/recall-navigate.js +2 -2
  369. package/dist/recall-navigation-http-glue.d.ts +14 -14
  370. package/dist/recall-navigation-mcp-tools.d.ts +14 -14
  371. package/dist/recall-navigation-operations.js +61 -61
  372. package/dist/recall-navigation-renderer.d.ts +2 -1
  373. package/dist/recall-navigation.d.ts +2 -1
  374. package/dist/recall-navigation.js +60 -60
  375. package/dist/recall-planner-llm.d.ts +1 -1
  376. package/dist/recall-state-view-admission.d.ts +2 -2
  377. package/dist/recall-state-view-admission.js +5 -5
  378. package/dist/recall-state-view-anchors.d.ts +1 -1
  379. package/dist/recall-state-view-anchors.js +2 -2
  380. package/dist/recall-state.d.ts +1 -1
  381. package/dist/recall-tag-filter.d.ts +2 -1
  382. package/dist/recall-timings.d.ts +1 -1
  383. package/dist/recall-xray-cli.d.ts +2 -1
  384. package/dist/recall-xray-cli.js +4 -4
  385. package/dist/recall-xray-renderer.d.ts +2 -1
  386. package/dist/recall-xray-renderer.js +3 -3
  387. package/dist/recall-xray.d.ts +10 -1
  388. package/dist/recall-xray.js +2 -2
  389. package/dist/reconcile/cursor.d.ts +1 -1
  390. package/dist/reconcile/manifest.d.ts +1 -1
  391. package/dist/reconcile/manifest.js +1 -1
  392. package/dist/reconcile/plan.d.ts +1 -1
  393. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  394. package/dist/replay/normalizers/claude.d.ts +1 -1
  395. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  396. package/dist/replay/normalizers/shared.d.ts +1 -1
  397. package/dist/replay/runner.d.ts +1 -1
  398. package/dist/replay/types.d.ts +1 -1
  399. package/dist/replica-divergence.d.ts +1 -1
  400. package/dist/replica-peers-config.d.ts +1 -1
  401. package/dist/resolve-auth-token.d.ts +1 -1
  402. package/dist/resume-bundles.js +73 -3
  403. package/dist/retrieval-agents.d.ts +2 -2
  404. package/dist/retrieval-tiers.d.ts +1 -1
  405. package/dist/routing/engine.d.ts +1 -1
  406. package/dist/routing/store.d.ts +1 -1
  407. package/dist/salvage-envelope.d.ts +1 -1
  408. package/dist/{scope-profiles-Bg1rB-Dp.d.ts → scope-profiles-BN1Dgfha.d.ts} +1 -1
  409. package/dist/search/embed-helper.d.ts +1 -1
  410. package/dist/search/factory.d.ts +1 -1
  411. package/dist/search/factory.js +2 -2
  412. package/dist/search/index.d.ts +1 -1
  413. package/dist/search/index.js +4 -4
  414. package/dist/search/lancedb-backend.d.ts +1 -1
  415. package/dist/search/meilisearch-backend.d.ts +1 -1
  416. package/dist/search/noop-backend.d.ts +1 -1
  417. package/dist/search/orama-backend.d.ts +1 -1
  418. package/dist/search/port.d.ts +1 -1
  419. package/dist/search/remote-backend.d.ts +1 -1
  420. package/dist/{semantic-consolidation-DEzRyeyn.d.ts → semantic-consolidation-D--qe0eE.d.ts} +1 -1
  421. package/dist/semantic-consolidation.d.ts +2 -2
  422. package/dist/semantic-consolidation.js +16 -16
  423. package/dist/semantic-rule-promotion.js +11 -11
  424. package/dist/semantic-rule-verifier.d.ts +1 -1
  425. package/dist/semantic-rule-verifier.js +11 -11
  426. package/dist/{service-DGEIDOeD.d.ts → service-VealHeqO.d.ts} +2 -2
  427. package/dist/session-observer-bands.d.ts +1 -1
  428. package/dist/session-observer-state.d.ts +1 -1
  429. package/dist/shared-context/manager.d.ts +1 -1
  430. package/dist/signal.d.ts +1 -1
  431. package/dist/source-agent-qualifier.d.ts +1 -1
  432. package/dist/source-agent-qualifier.js +20 -20
  433. package/dist/standup/build.js +12 -12
  434. package/dist/{storage-DNQWtOSM.d.ts → storage-CMm-3aD3.d.ts} +1 -1
  435. package/dist/storage.d.ts +2 -2
  436. package/dist/storage.js +10 -10
  437. package/dist/subject-config.d.ts +1 -1
  438. package/dist/summarizer.d.ts +1 -1
  439. package/dist/summarizer.js +1 -1
  440. package/dist/summary-snapshot.d.ts +1 -1
  441. package/dist/support-passport/index.d.ts +17 -17
  442. package/dist/support-passport/index.js +63 -63
  443. package/dist/{tagging-CPVwgadt.d.ts → tagging-BjsNFKWz.d.ts} +2 -2
  444. package/dist/temporal-supersession.d.ts +2 -2
  445. package/dist/temporal-timeline-recall.d.ts +1 -1
  446. package/dist/temporal-validity.d.ts +1 -1
  447. package/dist/threading.d.ts +1 -1
  448. package/dist/tier-migration.d.ts +2 -2
  449. package/dist/tier-routing.d.ts +1 -1
  450. package/dist/topics.d.ts +1 -1
  451. package/dist/transcript.d.ts +1 -1
  452. package/dist/transfer/autodetect.js +1 -1
  453. package/dist/transfer/backup.js +2 -2
  454. package/dist/transfer/capsule-export.js +3 -3
  455. package/dist/transfer/capsule-import.js +2 -2
  456. package/dist/transfer/export-okf.d.ts +1 -1
  457. package/dist/transfer/export-okf.js +11 -11
  458. package/dist/trust-score-stage.d.ts +1 -1
  459. package/dist/trust-score.d.ts +1 -1
  460. package/dist/{types-DCB90q3g.d.ts → types-Du6VdoAg.d.ts} +22 -1
  461. package/dist/types.d.ts +1 -1
  462. package/dist/types.js +1 -1
  463. package/dist/utility-runtime.d.ts +1 -1
  464. package/dist/verified-recall.js +11 -11
  465. package/dist/who-knows-cli.d.ts +14 -14
  466. package/dist/who-knows-cli.js +12 -12
  467. package/dist/who-knows.d.ts +14 -14
  468. package/dist/who-knows.js +11 -11
  469. package/dist/write-envelope.d.ts +1 -1
  470. package/package.json +2 -2
  471. package/src/access-mcp-output-schemas.ts +14 -1
  472. package/src/access-recall-response.ts +3 -0
  473. package/src/config.ts +3 -4
  474. package/src/directory-sidecars.test.ts +119 -0
  475. package/src/directory-sidecars.ts +110 -25
  476. package/src/experience/session-experience-recall.test.ts +228 -0
  477. package/src/experience/session-experience-recall.ts +60 -0
  478. package/src/index.ts +1 -0
  479. package/src/lifecycle/seed-graduation-config-types.ts +22 -0
  480. package/src/lifecycle/seed-graduation.test.ts +160 -1
  481. package/src/lifecycle/seed-graduation.ts +7 -9
  482. package/src/orchestration/lifecycle-policy-coordinator.ts +12 -0
  483. package/src/orchestration/recall-entry.ts +16 -2
  484. package/src/orchestration/recall-internal.ts +21 -18
  485. package/src/orchestration/recall-recognition-search.test.ts +290 -0
  486. package/src/orchestration/recall-recognition-search.ts +160 -0
  487. package/src/orchestrator.ts +1 -0
  488. package/src/procedural/procedure-recall.ts +14 -3
  489. package/src/recall-audit.test.ts +34 -0
  490. package/src/recall-audit.ts +4 -0
  491. package/src/recall-composition-decision.test.ts +134 -0
  492. package/src/recall-composition-decision.ts +113 -0
  493. package/src/recall-xray-renderer.test.ts +17 -0
  494. package/src/recall-xray-renderer.ts +10 -0
  495. package/src/recall-xray.test.ts +28 -0
  496. package/src/recall-xray.ts +15 -0
  497. package/src/testing/subjects/recall-recognition-tier.test.ts +106 -0
  498. package/src/types.ts +4 -6
  499. package/dist/chunk-DH536WT2.js.map +0 -1
  500. package/dist/chunk-ECLY4NZA.js.map +0 -1
  501. package/dist/chunk-IST6MBYC.js.map +0 -1
  502. package/dist/chunk-LBLXEFWK.js.map +0 -1
  503. package/dist/chunk-OLJYDGGP.js.map +0 -1
  504. package/dist/chunk-PQWICTRO.js.map +0 -1
  505. package/dist/chunk-UD6W67JM.js.map +0 -1
  506. package/dist/chunk-WVI43D54.js.map +0 -1
  507. /package/dist/{auto-sync-DG5KEOF5.js.map → auto-sync-CWSZDLLW.js.map} +0 -0
  508. /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  509. /package/dist/{chunk-3SI3FFTW.js.map → chunk-2INZSV27.js.map} +0 -0
  510. /package/dist/{chunk-PMLFPVYJ.js.map → chunk-2QZJ4P27.js.map} +0 -0
  511. /package/dist/{chunk-3RZB7TYL.js.map → chunk-2UDAABV6.js.map} +0 -0
  512. /package/dist/{chunk-4PXFLDMJ.js.map → chunk-35EH6KW4.js.map} +0 -0
  513. /package/dist/{chunk-KOEDSRF5.js.map → chunk-43IQRLEF.js.map} +0 -0
  514. /package/dist/{chunk-56C7OO3N.js.map → chunk-6KCQNFDQ.js.map} +0 -0
  515. /package/dist/{chunk-VBRS7Z3O.js.map → chunk-72N2P44O.js.map} +0 -0
  516. /package/dist/{chunk-ZUNYFDI4.js.map → chunk-7QVYVSEH.js.map} +0 -0
  517. /package/dist/{chunk-SRMBMMTK.js.map → chunk-7RKAE6Y4.js.map} +0 -0
  518. /package/dist/{chunk-42BV46XS.js.map → chunk-AH44WTLJ.js.map} +0 -0
  519. /package/dist/{chunk-TZ44E732.js.map → chunk-AIVRD66I.js.map} +0 -0
  520. /package/dist/{chunk-AYGWJ2UK.js.map → chunk-AQWGCHIV.js.map} +0 -0
  521. /package/dist/{chunk-EZV43XBD.js.map → chunk-AYHNTYVG.js.map} +0 -0
  522. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  523. /package/dist/{chunk-JHUODJRW.js.map → chunk-D2N3PMAE.js.map} +0 -0
  524. /package/dist/{chunk-7SJCSDQ3.js.map → chunk-D7VT2LED.js.map} +0 -0
  525. /package/dist/{chunk-TVVEYCNW.js.map → chunk-DAOMWGO2.js.map} +0 -0
  526. /package/dist/{chunk-MVMNEU65.js.map → chunk-DI52XAKG.js.map} +0 -0
  527. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  528. /package/dist/{chunk-EUP4AXIW.js.map → chunk-DZP2XMZC.js.map} +0 -0
  529. /package/dist/{chunk-PA5EOTRR.js.map → chunk-EVQ33D3N.js.map} +0 -0
  530. /package/dist/{chunk-E64HBW7M.js.map → chunk-EW3Y73MN.js.map} +0 -0
  531. /package/dist/{chunk-VSN2DMQK.js.map → chunk-G2DF5MI7.js.map} +0 -0
  532. /package/dist/{chunk-JIWZVOQM.js.map → chunk-G7S37WD4.js.map} +0 -0
  533. /package/dist/{chunk-AL7OLBL7.js.map → chunk-GRX6YH4E.js.map} +0 -0
  534. /package/dist/{chunk-XTMABIFW.js.map → chunk-HG42J2EX.js.map} +0 -0
  535. /package/dist/{chunk-MQMZO23A.js.map → chunk-HWT6KRGS.js.map} +0 -0
  536. /package/dist/{chunk-LR7KUQ2W.js.map → chunk-IEOBAOA6.js.map} +0 -0
  537. /package/dist/{chunk-UDAUULK2.js.map → chunk-IGEZE6QB.js.map} +0 -0
  538. /package/dist/{chunk-SGHGCFVV.js.map → chunk-JE334SIA.js.map} +0 -0
  539. /package/dist/{chunk-IC3PM3YO.js.map → chunk-JE4H2QBO.js.map} +0 -0
  540. /package/dist/{chunk-E73SVGJA.js.map → chunk-JMZQS6OS.js.map} +0 -0
  541. /package/dist/{chunk-3RABJOGD.js.map → chunk-KH2D26LQ.js.map} +0 -0
  542. /package/dist/{chunk-3MIZ2EKQ.js.map → chunk-KQQEZTH6.js.map} +0 -0
  543. /package/dist/{chunk-F5V7KRQS.js.map → chunk-LIAKZGOY.js.map} +0 -0
  544. /package/dist/{chunk-A7GQBJP5.js.map → chunk-LVFI5LG7.js.map} +0 -0
  545. /package/dist/{chunk-D7QX26FF.js.map → chunk-O7OVWKT4.js.map} +0 -0
  546. /package/dist/{chunk-JOP7W24J.js.map → chunk-PLJ2MQFT.js.map} +0 -0
  547. /package/dist/{chunk-D2XUSZ24.js.map → chunk-QWQB7TOB.js.map} +0 -0
  548. /package/dist/{chunk-HRCWDO6S.js.map → chunk-RSMNPYBM.js.map} +0 -0
  549. /package/dist/{chunk-BOTSR5S3.js.map → chunk-RUUJXAGT.js.map} +0 -0
  550. /package/dist/{chunk-FO6IK4IF.js.map → chunk-SEQ6DWXD.js.map} +0 -0
  551. /package/dist/{chunk-ZBAQMSEY.js.map → chunk-SLGD36MM.js.map} +0 -0
  552. /package/dist/{chunk-IYHHCSF6.js.map → chunk-SOFATSHJ.js.map} +0 -0
  553. /package/dist/{chunk-JG4AP36X.js.map → chunk-SPFNGHHP.js.map} +0 -0
  554. /package/dist/{chunk-DNO6QWCB.js.map → chunk-SPWNCGSM.js.map} +0 -0
  555. /package/dist/{chunk-QSP4Y73Q.js.map → chunk-SVUUOLKM.js.map} +0 -0
  556. /package/dist/{chunk-D6WX5FEF.js.map → chunk-SZ7IVZGD.js.map} +0 -0
  557. /package/dist/{chunk-2IVHOQRY.js.map → chunk-TEQQQTQS.js.map} +0 -0
  558. /package/dist/{chunk-UI6R2YUB.js.map → chunk-TQT4AOPO.js.map} +0 -0
  559. /package/dist/{chunk-3UQIS2GC.js.map → chunk-TTFJQ5B5.js.map} +0 -0
  560. /package/dist/{chunk-JTPAXDSX.js.map → chunk-U2SK45U3.js.map} +0 -0
  561. /package/dist/{chunk-4FWNMN5R.js.map → chunk-U6CMLAP4.js.map} +0 -0
  562. /package/dist/{chunk-6525YIYL.js.map → chunk-UCH2RWFX.js.map} +0 -0
  563. /package/dist/{chunk-QZDUNK6V.js.map → chunk-UCY4EHAG.js.map} +0 -0
  564. /package/dist/{chunk-OP5IBPHP.js.map → chunk-UDJMJNBK.js.map} +0 -0
  565. /package/dist/{chunk-BHI5ILU5.js.map → chunk-ULQVG6G3.js.map} +0 -0
  566. /package/dist/{chunk-X6B2QWXW.js.map → chunk-UQTXER7M.js.map} +0 -0
  567. /package/dist/{chunk-QXQCPNKA.js.map → chunk-V5BU5PVE.js.map} +0 -0
  568. /package/dist/{chunk-IPLYGWQF.js.map → chunk-VDX2J7OX.js.map} +0 -0
  569. /package/dist/{chunk-XUKUMBP3.js.map → chunk-VGO57TU7.js.map} +0 -0
  570. /package/dist/{chunk-W6V7JN2E.js.map → chunk-VUV472VH.js.map} +0 -0
  571. /package/dist/{chunk-ZHXSOMYH.js.map → chunk-VVX5PZFS.js.map} +0 -0
  572. /package/dist/{chunk-ML5FW2RO.js.map → chunk-WBW34YCJ.js.map} +0 -0
  573. /package/dist/{chunk-FDDCZDBI.js.map → chunk-WN4HFL4K.js.map} +0 -0
  574. /package/dist/{chunk-MECKA6G2.js.map → chunk-WUJD4CHZ.js.map} +0 -0
  575. /package/dist/{chunk-HS75MCQF.js.map → chunk-WUUGE7QC.js.map} +0 -0
  576. /package/dist/{chunk-UVEBBXB5.js.map → chunk-X7WAM3IY.js.map} +0 -0
  577. /package/dist/{chunk-4SDO74N2.js.map → chunk-XPFJSUOR.js.map} +0 -0
  578. /package/dist/{chunk-PPNFKQ6D.js.map → chunk-Y4G6LHJW.js.map} +0 -0
  579. /package/dist/{chunk-C3PKRFZ4.js.map → chunk-Y7LZ5V7N.js.map} +0 -0
  580. /package/dist/{chunk-AYP2FZFA.js.map → chunk-YIIW2OH2.js.map} +0 -0
  581. /package/dist/{chunk-YSBYNCCN.js.map → chunk-YLPCEUXP.js.map} +0 -0
  582. /package/dist/{chunk-RFIJH2OE.js.map → chunk-YUHGJBQK.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/recall-explain-renderer.ts","../src/recall-xray-renderer.ts"],"sourcesContent":["/**\n * Renderers for RecallTierExplain (issue #518).\n *\n * Pure functions that format a `LastRecallSnapshot` and its\n * optional `tierExplain` field for human text and machine JSON\n * consumption. CLI / HTTP / MCP surfaces consume these — they do\n * not format explain output themselves, so rendering is tested in\n * one place.\n */\n\nimport type { LastRecallSnapshot } from \"./recall-state.js\";\nimport type { RecallTierExplain } from \"./types.js\";\nimport { isRetrievalTier } from \"./retrieval-tiers.js\";\nimport type {\n RecallXraySnapshot,\n RecallFilterTrace,\n RecallXrayResult,\n} from \"./recall-xray.js\";\nimport { renderXrayMarkdown } from \"./recall-xray-renderer.js\";\n\nfunction sanitizeString(v: unknown): string | null {\n return typeof v === \"string\" && v.length > 0 ? v : null;\n}\n\nfunction sanitizeFiniteNumber(v: unknown): number | null {\n return typeof v === \"number\" && Number.isFinite(v) ? v : null;\n}\n\n/**\n * `text` and `json` are the original formats (backwards-compatible\n * since issue #518). `markdown` was added in issue #570 PR 7 and\n * delegates to the shared X-ray renderer so the three observability\n * surfaces stay in lock-step (CLAUDE.md rule 22).\n */\nexport type RecallExplainFormat = \"text\" | \"json\" | \"markdown\";\n\nexport interface RecallExplainJsonPayload {\n hasExplain: boolean;\n snapshotFound: boolean;\n sessionKey: string | null;\n recordedAt: string | null;\n namespace: string | null;\n memoryIds: string[];\n source: string | null;\n sourcesUsed: string[] | null;\n latencyMs: number | null;\n tierExplain: RecallTierExplain | null;\n}\n\nfunction normalizeTierExplain(value: unknown): RecallTierExplain | null {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n const raw = value as Record<string, unknown>;\n const filteredBy = Array.isArray(raw.filteredBy)\n ? raw.filteredBy.filter((x): x is string => typeof x === \"string\")\n : [];\n const sourceAnchors = Array.isArray(raw.sourceAnchors)\n ? raw.sourceAnchors\n .filter(\n (a): a is { path: string; lineRange?: unknown } =>\n !!a && typeof a === \"object\" && typeof (a as { path?: unknown }).path === \"string\",\n )\n .map((a) => {\n const lr = (a as { lineRange?: unknown }).lineRange;\n const lineRange =\n Array.isArray(lr) &&\n lr.length === 2 &&\n Number.isFinite(lr[0]) &&\n Number.isFinite(lr[1])\n ? ([lr[0] as number, lr[1] as number] as [number, number])\n : undefined;\n return lineRange\n ? { path: (a as { path: string }).path, lineRange }\n : { path: (a as { path: string }).path };\n })\n : undefined;\n return {\n tier: isRetrievalTier(raw.tier) ? raw.tier : \"hybrid\",\n tierReason: typeof raw.tierReason === \"string\" ? raw.tierReason : \"\",\n filteredBy,\n candidatesConsidered: sanitizeFiniteNumber(raw.candidatesConsidered) ?? 0,\n latencyMs: sanitizeFiniteNumber(raw.latencyMs) ?? 0,\n ...(sourceAnchors !== undefined ? { sourceAnchors } : {}),\n };\n}\n\nexport function toRecallExplainJson(\n snapshot: LastRecallSnapshot | null,\n): RecallExplainJsonPayload {\n if (!snapshot) {\n return {\n hasExplain: false,\n snapshotFound: false,\n sessionKey: null,\n recordedAt: null,\n namespace: null,\n memoryIds: [],\n source: null,\n sourcesUsed: null,\n latencyMs: null,\n tierExplain: null,\n };\n }\n const normalizedExplain = normalizeTierExplain(snapshot.tierExplain);\n return {\n hasExplain: normalizedExplain !== null,\n snapshotFound: true,\n sessionKey: sanitizeString(snapshot.sessionKey),\n recordedAt: sanitizeString(snapshot.recordedAt),\n namespace: sanitizeString(snapshot.namespace),\n memoryIds: Array.isArray(snapshot.memoryIds)\n ? snapshot.memoryIds.filter((x): x is string => typeof x === \"string\")\n : [],\n source: sanitizeString(snapshot.source),\n sourcesUsed: Array.isArray(snapshot.sourcesUsed)\n ? snapshot.sourcesUsed.filter((x): x is string => typeof x === \"string\")\n : null,\n latencyMs: sanitizeFiniteNumber(snapshot.latencyMs),\n tierExplain: normalizedExplain,\n };\n}\n\n/**\n * Render the shared \"--- tier explain ---\" text block used by both the\n * recall-explain surface and the Recall X-ray surface. Callers provide\n * the normalized `RecallTierExplain` (or `null` for the\n * not-populated/disabled case) so the block stays character-for-character\n * identical across surfaces (CLAUDE.md rule 22). The returned strings do\n * NOT include leading blank lines or headers — callers own that framing.\n */\nexport function renderTierExplainTextLines(\n tierExplain: RecallTierExplain | null,\n): string[] {\n const lines: string[] = [];\n if (!tierExplain) {\n lines.push(\n \"(not populated — direct-answer tier disabled or did not fire)\",\n );\n return lines;\n }\n lines.push(`tier: ${tierExplain.tier}`);\n lines.push(`reason: ${tierExplain.tierReason}`);\n lines.push(`candidates-considered: ${tierExplain.candidatesConsidered}`);\n lines.push(`latency-ms: ${tierExplain.latencyMs}`);\n if (tierExplain.filteredBy.length > 0) {\n lines.push(`filtered-by: ${tierExplain.filteredBy.join(\", \")}`);\n } else {\n lines.push(\"filtered-by: (none)\");\n }\n if (tierExplain.sourceAnchors && tierExplain.sourceAnchors.length > 0) {\n lines.push(\"source-anchors:\");\n for (const anchor of tierExplain.sourceAnchors) {\n const range = anchor.lineRange\n ? `:${anchor.lineRange[0]}-${anchor.lineRange[1]}`\n : \"\";\n lines.push(` - ${anchor.path}${range}`);\n }\n }\n return lines;\n}\n\nexport function toRecallExplainText(\n snapshot: LastRecallSnapshot | null,\n): string {\n const lines: string[] = [\"=== Recall Explain ===\"];\n\n if (!snapshot) {\n lines.push(\"No recall snapshot recorded yet.\");\n return lines.join(\"\\n\");\n }\n\n const sessionKey = sanitizeString(snapshot.sessionKey);\n const recordedAt = sanitizeString(snapshot.recordedAt);\n const namespace = sanitizeString(snapshot.namespace);\n const source = sanitizeString(snapshot.source);\n lines.push(`session: ${sessionKey ?? \"(unknown)\"}`);\n lines.push(`recorded: ${recordedAt ?? \"(unknown)\"}`);\n if (namespace) lines.push(`namespace: ${namespace}`);\n if (source) lines.push(`source: ${source}`);\n const sourcesUsed = Array.isArray(snapshot.sourcesUsed)\n ? snapshot.sourcesUsed.filter((x): x is string => typeof x === \"string\")\n : [];\n if (sourcesUsed.length > 0) {\n lines.push(`sources-used: ${sourcesUsed.join(\", \")}`);\n }\n const latencyMs = sanitizeFiniteNumber(snapshot.latencyMs);\n if (latencyMs !== null) {\n lines.push(`latency-ms: ${latencyMs}`);\n }\n const memoryIds = Array.isArray(snapshot.memoryIds)\n ? snapshot.memoryIds.filter((x): x is string => typeof x === \"string\")\n : [];\n if (memoryIds.length > 0) {\n lines.push(`memories: ${memoryIds.join(\", \")}`);\n }\n\n const ex = normalizeTierExplain(snapshot.tierExplain);\n if (!ex) {\n lines.push(\"\");\n lines.push(\n \"tier-explain: (not populated — direct-answer tier disabled or did not fire)\",\n );\n return lines.join(\"\\n\");\n }\n\n lines.push(\"\");\n lines.push(\"--- tier explain ---\");\n for (const line of renderTierExplainTextLines(ex)) {\n lines.push(line);\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Adapter: convert a `LastRecallSnapshot` into a best-effort\n * `RecallXraySnapshot` so the markdown renderer can produce a\n * consistent, richly-formatted document for callers that have asked\n * for `markdown` format. The LastRecallSnapshot and the X-ray\n * snapshot share session/namespace/memoryIds; additional X-ray-only\n * fields (filters, score decomposition, graph path, audit id) are\n * left empty because the legacy snapshot doesn't carry them. The\n * renderer handles missing fields gracefully.\n */\n/**\n * Strip backticks, pipes, and newlines from a host-provided value so it\n * cannot escape its enclosing markdown code span, break the surrounding\n * table row, or inject extra rows when it lands in\n * `renderXrayMarkdown`. Applied at the adapter boundary because\n * `LastRecallSnapshot` is hydrated from on-disk JSON without schema\n * validation (codex P2 review on #605).\n *\n * Accepts `unknown` so non-string truthy values (numbers, objects,\n * booleans, arrays) coming from a corrupted snapshot are coerced to\n * the empty string rather than crashing on `.replace(...)`. Callers\n * should treat an empty return as \"drop this field.\"\n */\nfunction sanitizeForMarkdownInline(value: unknown): string {\n if (typeof value !== \"string\") return \"\";\n return value.replace(/[`|\\r\\n]/g, \" \").trim();\n}\n\n/**\n * Map the legacy `LastRecallSnapshot.source` field to the\n * `RecallXrayServedBy` union used by the unified x-ray renderer.\n * Mirrors the `mapRecallSourceToXrayServedBy` helper inside\n * `orchestrator.ts` (which is private). Keep the two in sync when a\n * new source lands — unknown values collapse to `\"hybrid\"` to preserve\n * backwards compatibility with older on-disk snapshots.\n */\nfunction mapLegacySourceToServedBy(\n source: unknown,\n): \"hybrid\" | \"recent-scan\" {\n if (source === \"recent_scan\") return \"recent-scan\";\n return \"hybrid\";\n}\n\nexport function toRecallXraySnapshotFromLegacy(\n snapshot: LastRecallSnapshot | null,\n): RecallXraySnapshot | null {\n if (!snapshot) return null;\n const capturedAt = (() => {\n if (typeof snapshot.recordedAt !== \"string\") return 0;\n const ms = Date.parse(snapshot.recordedAt);\n return Number.isFinite(ms) && ms >= 0 ? ms : 0;\n })();\n const memoryIds = Array.isArray(snapshot.memoryIds)\n ? snapshot.memoryIds.filter((x): x is string => typeof x === \"string\")\n : [];\n // Codex P2 + Cursor Medium on #605: every converted result used to\n // be stamped with `servedBy: \"hybrid\"`, misattributing legacy\n // snapshots that came from `recent_scan` (or any future source).\n // Propagate the recorded `source` so markdown `recall-explain`\n // output matches the `served-by=` string the native x-ray capture\n // would emit for the same recall.\n const servedBy = mapLegacySourceToServedBy(snapshot.source);\n const results: RecallXrayResult[] = memoryIds.map((memoryId) => ({\n memoryId,\n path: \"\",\n servedBy,\n scoreDecomposition: { final: 0 },\n admittedBy: [],\n }));\n const filters: RecallFilterTrace[] = [];\n return {\n schemaVersion: \"1\",\n // `LastRecallSnapshot` does not preserve the original query text;\n // synthesize a placeholder so the renderer has a non-empty\n // string to print. `queryHash` + `queryLen` stay in the JSON\n // payload via `toRecallExplainJson` for callers that need them.\n query:\n snapshot.queryHash\n ? `(legacy explain; queryHash=${snapshot.queryHash})`\n : \"(legacy explain)\",\n // `snapshotId` is synthesized here; `sessionKey` is already\n // sanitized before it reaches the ID because we re-use the\n // sanitized string below.\n snapshotId: `legacy-${sanitizeForMarkdownInline(snapshot.sessionKey ?? \"unknown\") || \"unknown\"}-${capturedAt}`,\n capturedAt,\n // Run the raw on-disk value through the same normalizer the text\n // and JSON paths use so the markdown adapter cannot render\n // unvalidated tier-explain payloads (cursor / codex review on\n // #605). A malformed tierExplain is dropped to null, matching the\n // behavior of the non-markdown surfaces.\n tierExplain: normalizeTierExplain(snapshot.tierExplain) ?? null,\n results,\n appliedResultLimit: 0,\n appliedResults: [],\n headroomResults: [],\n filters,\n budget: { chars: 0, used: 0 },\n // Sanitize legacy session metadata at the adapter boundary so a\n // malformed on-disk value (containing backticks, pipes, or\n // newlines) cannot break the enclosing markdown table when\n // `renderXrayMarkdown` prints it in a raw code-span cell (codex P2\n // review on #605).\n ...(snapshot.sessionKey\n ? (() => {\n const clean = sanitizeForMarkdownInline(snapshot.sessionKey);\n return clean ? { sessionKey: clean } : {};\n })()\n : {}),\n ...(snapshot.namespace\n ? (() => {\n const clean = sanitizeForMarkdownInline(snapshot.namespace);\n return clean ? { namespace: clean } : {};\n })()\n : {}),\n };\n}\n\nexport function renderRecallExplain(\n snapshot: LastRecallSnapshot | null,\n format: RecallExplainFormat,\n): string {\n if (format === \"json\") {\n return JSON.stringify(toRecallExplainJson(snapshot), null, 2);\n }\n if (format === \"markdown\") {\n // Delegate to the shared X-ray renderer so CLI / HTTP / MCP\n // markdown output all share one implementation (CLAUDE.md rule\n // 22). The JSON and text paths remain byte-for-byte\n // backwards-compatible with pre-#570 behavior.\n return renderXrayMarkdown(toRecallXraySnapshotFromLegacy(snapshot));\n }\n return toRecallExplainText(snapshot);\n}\n\nexport function parseRecallExplainFormat(value: unknown): RecallExplainFormat {\n if (value === undefined || value === null) return \"text\";\n if (typeof value !== \"string\") {\n throw new Error(\n `--format expects \"text\", \"json\", or \"markdown\", got ${typeof value}`,\n );\n }\n const v = value.trim().toLowerCase();\n if (v === \"text\" || v === \"json\" || v === \"markdown\") return v;\n throw new Error(\n `--format expects \"text\", \"json\", or \"markdown\", got ${JSON.stringify(value)}`,\n );\n}\n","/**\n * Unified Recall X-ray renderer (issue #570, PR 2).\n *\n * Pure functions that format a `RecallXraySnapshot` for human text,\n * GitHub-flavored markdown, and machine JSON consumption. CLI / HTTP\n * / MCP surfaces all call into this module — they do NOT format X-ray\n * output themselves, so rendering is tested in one place (CLAUDE.md\n * rule 22).\n *\n * Scope for PR 2 (this slice):\n * - Pure rendering. No IO, no transport, no capture.\n * - `renderXray(snapshot, format)` with format ∈\n * `{\"json\", \"text\", \"markdown\"}`.\n * - `parseXrayFormat(value)` — input validator that rejects unknown\n * formats with a listed-options error (CLAUDE.md rule 51).\n * - Golden-file-style tests in `recall-xray-renderer.test.ts`.\n */\n\nimport type {\n RecallFilterTrace,\n RecallXrayResult,\n RecallXraySnapshot,\n RecallXrayServedBy,\n} from \"./recall-xray.js\";\nimport { summarizeDisclosureTokens } from \"./recall-xray.js\";\nimport { renderTierExplainTextLines } from \"./recall-explain-renderer.js\";\nimport { summarizeRetrievedMemoryProvenance } from \"./memory-provenance.js\";\n\nexport type RecallXrayFormat = \"json\" | \"text\" | \"markdown\";\n\nexport const RECALL_XRAY_FORMATS: readonly RecallXrayFormat[] = [\n \"json\",\n \"text\",\n \"markdown\",\n] as const;\n\n/**\n * Validate and coerce a user-provided `--format` / `format` argument to\n * `RecallXrayFormat`. Unknown values throw an error listing valid\n * options (CLAUDE.md rule 51). `undefined`/`null` defaults to `\"text\"`.\n */\nexport function parseXrayFormat(value: unknown): RecallXrayFormat {\n if (value === undefined || value === null) return \"text\";\n if (typeof value !== \"string\") {\n throw new Error(\n `--format expects one of ${RECALL_XRAY_FORMATS.join(\", \")}; got ${typeof value}`,\n );\n }\n const v = value.trim().toLowerCase();\n if (v === \"json\" || v === \"text\" || v === \"markdown\") return v;\n throw new Error(\n `--format expects one of ${RECALL_XRAY_FORMATS.join(\", \")}; got ${JSON.stringify(value)}`,\n );\n}\n\n/**\n * Top-level dispatcher. CLI / HTTP / MCP callers should always route\n * through this function so the three formats stay in lock-step.\n */\nexport function renderXray(\n snapshot: RecallXraySnapshot | null,\n format: RecallXrayFormat,\n): string {\n if (format === \"json\") return renderXrayJson(snapshot);\n if (format === \"markdown\") return renderXrayMarkdown(snapshot);\n return renderXrayText(snapshot);\n}\n\n// ─── JSON ─────────────────────────────────────────────────────────────────\n\n/**\n * Deterministic JSON encoding of an X-ray snapshot. Returns a stable\n * v1 envelope when the snapshot is absent so consumers can pattern-match\n * on `snapshotFound` rather than distinguishing `null` vs `{}`.\n */\nexport function renderXrayJson(snapshot: RecallXraySnapshot | null): string {\n if (!snapshot) {\n return JSON.stringify(\n { schemaVersion: \"1\", snapshotFound: false },\n null,\n 2,\n );\n }\n // `snapshotFound` is injected *before* the rest so downstream JSON\n // consumers see it near the top of the document.\n return JSON.stringify(\n { snapshotFound: true, ...snapshot },\n null,\n 2,\n );\n}\n\n// ─── Text ─────────────────────────────────────────────────────────────────\n\nexport function renderXrayText(snapshot: RecallXraySnapshot | null): string {\n const lines: string[] = [\"=== Recall X-ray ===\"];\n if (!snapshot) {\n lines.push(\"No X-ray snapshot captured.\");\n return lines.join(\"\\n\");\n }\n\n lines.push(`query: ${snapshot.query}`);\n lines.push(`snapshot-id: ${snapshot.snapshotId}`);\n lines.push(`captured-at: ${formatCapturedAt(snapshot.capturedAt)}`);\n if (snapshot.sessionKey) lines.push(`session: ${snapshot.sessionKey}`);\n if (snapshot.namespace) lines.push(`namespace: ${snapshot.namespace}`);\n if (snapshot.traceId) lines.push(`trace-id: ${snapshot.traceId}`);\n lines.push(\n `budget: ${snapshot.budget.used} / ${snapshot.budget.chars} chars`,\n );\n\n lines.push(\"\");\n lines.push(\"--- filters ---\");\n if (snapshot.filters.length === 0) {\n lines.push(\"(no filter traces recorded)\");\n } else {\n for (const f of snapshot.filters) {\n lines.push(renderFilterTextLine(f));\n }\n }\n\n lines.push(\"\");\n lines.push(\"--- results ---\");\n if (snapshot.results.length === 0) {\n lines.push(\"(no results admitted)\");\n } else {\n snapshot.results.forEach((result, idx) => {\n for (const line of renderResultTextLines(result, idx + 1)) {\n lines.push(line);\n }\n });\n }\n\n lines.push(\"\");\n lines.push(\"--- tier explain ---\");\n for (const line of renderTierExplainTextLines(snapshot.tierExplain ?? null)) {\n lines.push(line);\n }\n\n return lines.join(\"\\n\");\n}\n\nfunction renderFilterTextLine(f: RecallFilterTrace): string {\n const base = `- ${f.name}: ${f.admitted}/${f.considered} admitted`;\n return f.reason ? `${base} (${f.reason})` : base;\n}\n\nfunction renderResultTextLines(\n result: RecallXrayResult,\n rank: number,\n): string[] {\n const lines: string[] = [];\n lines.push(`[${rank}] ${result.memoryId} — ${servedByLabel(result.servedBy)}`);\n if (result.path) lines.push(` path: ${result.path}`);\n if (result.stateView) lines.push(` state-view: ${result.stateView}`);\n lines.push(` score: ${renderScoreDecomposition(result)}`);\n if (result.provenance) {\n lines.push(\n ` provenance: ${summarizeRetrievedMemoryProvenance(result.provenance)}`,\n );\n lines.push(` retrieval-reason: ${result.provenance.retrievalReason}`);\n if (result.provenance.userContextScopes.length > 0) {\n lines.push(\n ` context-scopes: ${result.provenance.userContextScopes.join(\", \")}`,\n );\n }\n if (\n result.provenance.safety !== \"safe\" ||\n result.provenance.safetyReasons.length > 0\n ) {\n const reasonSuffix =\n result.provenance.safetyReasons.length > 0\n ? ` (${result.provenance.safetyReasons.join(\", \")})`\n : \"\";\n lines.push(` safety: ${result.provenance.safety}${reasonSuffix}`);\n }\n }\n if (result.sourceSpan) {\n const q = truncateForXray(result.sourceSpan.quote, 120);\n lines.push(\n ` source: \"${q}\" (observed ${result.sourceSpan.observedAt}) [${result.sourceSpan.provenance}]`,\n );\n }\n if (result.admittedBy.length > 0) {\n lines.push(` admitted-by: ${result.admittedBy.join(\", \")}`);\n }\n if (result.rejectedBy) {\n lines.push(` rejected-by: ${result.rejectedBy}`);\n }\n if (result.graphPath && result.graphPath.length > 0) {\n lines.push(` graph-path: ${result.graphPath.join(\" -> \")}`);\n // Issue #681 PR 3/3 — surface per-edge confidence inline so\n // operators can attribute floor-pruning / PageRank ranking\n // decisions to specific edges. Skipped when no confidences were\n // recorded (legacy snapshot or single-node path).\n if (\n result.graphEdgeConfidences &&\n result.graphEdgeConfidences.length > 0\n ) {\n lines.push(\n ` edge-confidences: ${result.graphEdgeConfidences\n .map((c) => c.toFixed(2))\n .join(\", \")}`,\n );\n }\n }\n if (result.pathPenaltyApplied !== undefined) {\n lines.push(` path-penalty: ${result.pathPenaltyApplied ? \"yes\" : \"no\"}`);\n }\n if (result.pathNodeIds && result.pathNodeIds.length > 0) {\n lines.push(` path-node-ids: ${result.pathNodeIds.join(\" -> \")}`);\n }\n if (result.auditEntryId) {\n lines.push(` audit-entry: ${result.auditEntryId}`);\n }\n return lines;\n}\n\n// ─── Markdown ─────────────────────────────────────────────────────────────\n\nexport function renderXrayMarkdown(\n snapshot: RecallXraySnapshot | null,\n): string {\n const lines: string[] = [\"# Recall X-ray\"];\n if (!snapshot) {\n lines.push(\"\");\n lines.push(\"_No X-ray snapshot captured._\");\n return lines.join(\"\\n\");\n }\n\n lines.push(\"\");\n lines.push(`**Query:** ${mdInlineCode(snapshot.query)}`);\n lines.push(\"\");\n lines.push(\"| Field | Value |\");\n lines.push(\"| --- | --- |\");\n lines.push(`| Snapshot ID | \\`${snapshot.snapshotId}\\` |`);\n lines.push(`| Captured at | ${formatCapturedAt(snapshot.capturedAt)} |`);\n if (snapshot.sessionKey) {\n lines.push(`| Session | \\`${snapshot.sessionKey}\\` |`);\n }\n if (snapshot.namespace) {\n lines.push(`| Namespace | \\`${snapshot.namespace}\\` |`);\n }\n if (snapshot.traceId) {\n lines.push(`| Trace ID | \\`${snapshot.traceId}\\` |`);\n }\n lines.push(\n `| Budget | ${snapshot.budget.used} / ${snapshot.budget.chars} chars |`,\n );\n\n lines.push(\"\");\n lines.push(\"## Filters\");\n if (snapshot.filters.length === 0) {\n lines.push(\"\");\n lines.push(\"_No filter traces recorded._\");\n } else {\n lines.push(\"\");\n lines.push(\"| Filter | Considered | Admitted | Reason |\");\n lines.push(\"| --- | ---: | ---: | --- |\");\n for (const f of snapshot.filters) {\n const reason = f.reason ? mdEscape(f.reason) : \"\";\n lines.push(`| ${mdEscape(f.name)} | ${f.considered} | ${f.admitted} | ${reason} |`);\n }\n }\n\n lines.push(\"\");\n lines.push(\"## Results\");\n if (snapshot.results.length === 0) {\n lines.push(\"\");\n lines.push(\"_No results admitted._\");\n } else {\n snapshot.results.forEach((result, idx) => {\n for (const line of renderResultMarkdownLines(result, idx + 1)) {\n lines.push(line);\n }\n });\n\n // Per-disclosure token-spend summary (issue #677 PR 3/4). Only\n // emitted when at least one result carries a disclosure level so\n // we don't pollute the snapshot for callers who haven't wired the\n // depth knob through. Counts and tokens default to 0 for buckets\n // with no contributions.\n const summary = summarizeDisclosureTokens(snapshot.results);\n const hasAnyDisclosure =\n summary.chunk.count + summary.section.count + summary.raw.count > 0;\n if (hasAnyDisclosure) {\n lines.push(\"\");\n lines.push(\"### Token spend by disclosure\");\n lines.push(\"\");\n lines.push(\"| Disclosure | Results | Estimated tokens |\");\n lines.push(\"| --- | ---: | ---: |\");\n lines.push(\n `| chunk | ${summary.chunk.count} | ${summary.chunk.estimatedTokens} |`,\n );\n lines.push(\n `| section | ${summary.section.count} | ${summary.section.estimatedTokens} |`,\n );\n lines.push(\n `| raw | ${summary.raw.count} | ${summary.raw.estimatedTokens} |`,\n );\n if (summary.unspecified.count > 0) {\n lines.push(\n `| _(unspecified)_ | ${summary.unspecified.count} | ${summary.unspecified.estimatedTokens} |`,\n );\n }\n }\n }\n\n lines.push(\"\");\n lines.push(\"## Tier Explain\");\n if (!snapshot.tierExplain) {\n lines.push(\"\");\n lines.push(\n \"_Not populated — direct-answer tier disabled or did not fire._\",\n );\n } else {\n const te = snapshot.tierExplain;\n lines.push(\"\");\n lines.push(\"| Field | Value |\");\n lines.push(\"| --- | --- |\");\n lines.push(`| Tier | \\`${te.tier}\\` |`);\n lines.push(`| Reason | ${mdEscape(te.tierReason)} |`);\n lines.push(`| Candidates considered | ${te.candidatesConsidered} |`);\n lines.push(`| Latency (ms) | ${te.latencyMs} |`);\n lines.push(\n `| Filtered by | ${\n te.filteredBy.length > 0\n ? te.filteredBy.map(mdInlineCode).join(\", \")\n : \"_(none)_\"\n } |`,\n );\n if (te.sourceAnchors && te.sourceAnchors.length > 0) {\n lines.push(\"\");\n lines.push(\"**Source anchors:**\");\n for (const anchor of te.sourceAnchors) {\n const range = anchor.lineRange\n ? `:${anchor.lineRange[0]}-${anchor.lineRange[1]}`\n : \"\";\n lines.push(`- \\`${anchor.path}${range}\\``);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\nfunction renderResultMarkdownLines(\n result: RecallXrayResult,\n rank: number,\n): string[] {\n const lines: string[] = [];\n lines.push(\"\");\n lines.push(\n `### ${rank}. \\`${result.memoryId}\\` — ${servedByLabel(result.servedBy)}`,\n );\n if (result.path) {\n lines.push(\"\");\n lines.push(`- **Path:** \\`${result.path}\\``);\n } else {\n lines.push(\"\");\n }\n lines.push(`- **Score:** ${renderScoreDecomposition(result)}`);\n if (result.provenance) {\n lines.push(\n `- **Provenance:** ${mdEscape(summarizeRetrievedMemoryProvenance(result.provenance))}`,\n );\n lines.push(\n `- **Retrieval reason:** ${mdInlineCode(result.provenance.retrievalReason)}`,\n );\n if (result.provenance.userContextScopes.length > 0) {\n lines.push(\n `- **Context scopes:** ${result.provenance.userContextScopes\n .map(mdInlineCode)\n .join(\", \")}`,\n );\n }\n if (\n result.provenance.safety !== \"safe\" ||\n result.provenance.safetyReasons.length > 0\n ) {\n const reasonSuffix =\n result.provenance.safetyReasons.length > 0\n ? ` (${result.provenance.safetyReasons.map(mdInlineCode).join(\", \")})`\n : \"\";\n lines.push(\n `- **Safety:** ${mdInlineCode(result.provenance.safety)}${reasonSuffix}`,\n );\n }\n }\n if (result.sourceSpan) {\n const q = truncateForXray(result.sourceSpan.quote, 120);\n lines.push(\n `- **Source:** \"${mdEscape(q)}\" (${mdInlineCode(result.sourceSpan.observedAt)}) \\u2014 ${result.sourceSpan.provenance}`,\n );\n }\n if (result.admittedBy.length > 0) {\n lines.push(\n `- **Admitted by:** ${result.admittedBy.map(mdInlineCode).join(\", \")}`,\n );\n }\n if (result.stateView) {\n lines.push(`- **State view:** ${mdInlineCode(result.stateView)}`);\n }\n if (result.rejectedBy) {\n lines.push(`- **Rejected by:** ${mdInlineCode(result.rejectedBy)}`);\n }\n if (result.graphPath && result.graphPath.length > 0) {\n lines.push(\n `- **Graph path:** ${result.graphPath\n .map(mdInlineCode)\n .join(\" → \")}`,\n );\n // Issue #681 PR 3/3 — render per-edge confidences as a parallel\n // markdown line so operators can correlate them with the path\n // arrows above. Skipped when no confidences were recorded.\n if (\n result.graphEdgeConfidences &&\n result.graphEdgeConfidences.length > 0\n ) {\n lines.push(\n `- **Edge confidences:** ${result.graphEdgeConfidences\n .map((c) => mdInlineCode(c.toFixed(2)))\n .join(\", \")}`,\n );\n }\n }\n if (result.pathPenaltyApplied !== undefined) {\n lines.push(\n `- **Path penalty applied:** ${mdInlineCode(result.pathPenaltyApplied ? \"yes\" : \"no\")}`,\n );\n }\n if (result.pathNodeIds && result.pathNodeIds.length > 0) {\n lines.push(\n `- **Path node ids:** ${result.pathNodeIds.map(mdInlineCode).join(\" → \")}`,\n );\n }\n if (result.auditEntryId) {\n lines.push(`- **Audit entry:** \\`${result.auditEntryId}\\``);\n }\n if (result.disclosure !== undefined) {\n const tokenLine =\n typeof result.estimatedTokens === \"number\"\n ? ` (~${result.estimatedTokens} tokens)`\n : \"\";\n lines.push(`- **Disclosure:** \\`${result.disclosure}\\`${tokenLine}`);\n } else if (typeof result.estimatedTokens === \"number\") {\n // Disclosure unspecified but tokens recorded — still surface the\n // budget so the operator can attribute spend.\n lines.push(`- **Estimated tokens:** ${result.estimatedTokens}`);\n }\n return lines;\n}\n\n// ─── Shared helpers ───────────────────────────────────────────────────────\n\nfunction servedByLabel(servedBy: RecallXrayServedBy): string {\n return `served-by=${servedBy}`;\n}\n\nfunction renderScoreDecomposition(result: RecallXrayResult): string {\n const parts: string[] = [`final=${formatScore(result.scoreDecomposition.final)}`];\n const s = result.scoreDecomposition;\n if (s.vector !== undefined) parts.push(`vector=${formatScore(s.vector)}`);\n if (s.bm25 !== undefined) parts.push(`bm25=${formatScore(s.bm25)}`);\n if (s.importance !== undefined) {\n parts.push(`importance=${formatScore(s.importance)}`);\n }\n if (s.mmrPenalty !== undefined) {\n parts.push(`mmr_penalty=${formatScore(s.mmrPenalty)}`);\n }\n if (s.tierPrior !== undefined) {\n parts.push(`tier_prior=${formatScore(s.tierPrior)}`);\n }\n if (s.reinforcementBoost !== undefined && s.reinforcementBoost > 0) {\n parts.push(`reinforcement_boost=${formatScore(s.reinforcementBoost)}`);\n }\n return parts.join(\" \");\n}\n\nfunction formatScore(value: number): string {\n // Deterministic 4-decimal formatting keeps golden files stable\n // without printing spurious trailing zeros via toString().\n if (!Number.isFinite(value)) return \"0.0000\";\n return value.toFixed(4);\n}\n\nfunction formatCapturedAt(ts: number): string {\n if (!Number.isFinite(ts) || ts < 0) return \"(unknown)\";\n // `new Date(n).toISOString()` throws a RangeError for finite numbers\n // outside the valid Date range (roughly |n| > 8.64e15). That case\n // can surface when snapshots are corrupted or captured with a\n // custom clock, so coerce it to the same \"(unknown)\" fallback\n // rather than crashing the renderer.\n try {\n return new Date(ts).toISOString();\n } catch {\n return \"(unknown)\";\n }\n}\n\nfunction mdEscape(value: string): string {\n // Pipe is the only character that breaks GFM table rendering; escape\n // backslash first so we do not re-escape the escape character.\n return value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\|/g, \"\\\\|\");\n}\n\n/**\n * Truncate a quote for X-ray display (issue #1575 PR 3). Collapses internal\n * whitespace runs (including newlines/carriage returns) to single spaces so\n * a multi-line source excerpt cannot split what is meant to be a single X-ray\n * row, then caps at `maxChars` on a word boundary with an ellipsis marker.\n * The JSON \\`sourceSpan.quote\\` stays verbatim — this is display-only.\n */\nfunction truncateForXray(text: string, maxChars: number): string {\n const collapsed = text.replace(/\\s+/g, \" \").trim();\n if (collapsed.length <= maxChars) return collapsed;\n const slice = collapsed.slice(0, maxChars);\n const lastSpace = slice.lastIndexOf(\" \");\n const cut = lastSpace > Math.floor(maxChars * 0.5) ? slice.slice(0, lastSpace) : slice;\n return `${cut}\\u2026`;\n}\n\nfunction mdInlineCode(value: string): string {\n if (value.length === 0) return \"``\";\n // Use exactly enough backticks to unambiguously wrap content that\n // itself contains backticks (GFM rule).\n const longestRun = /`+/g;\n let maxLen = 0;\n for (const match of value.matchAll(longestRun)) {\n if (match[0].length > maxLen) maxLen = match[0].length;\n }\n const fence = \"`\".repeat(maxLen + 1);\n const pad = value.startsWith(\"`\") || value.endsWith(\"`\") ? \" \" : \"\";\n return `${fence}${pad}${value}${pad}${fence}`;\n}\n"],"mappings":";;;;;;;;;;;AAoBA,SAAS,eAAe,GAA2B;AACjD,SAAO,OAAO,MAAM,YAAY,EAAE,SAAS,IAAI,IAAI;AACrD;AAEA,SAAS,qBAAqB,GAA2B;AACvD,SAAO,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,IAAI,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AM,GAAG,SAAS,IAAI;AACjF,SAAO,GAAG,GAAG;AACf;AAEA,SAAS,aAAa,OAAuB;AAC3C,MAAI,MAAM,WAAW,EAAG,QAAO;AAG/B,QAAM,aAAa;AACnB,MAAI,SAAS;AACb,aAAW,SAAS,MAAM,SAAS,UAAU,GAAG;AAC9C,QAAI,MAAM,CAAC,EAAE,SAAS,OAAQ,UAAS,MAAM,CAAC,EAAE;AAAA,EAClD;AACA,QAAM,QAAQ,IAAI,OAAO,SAAS,CAAC;AACnC,QAAM,MAAM,MAAM,WAAW,GAAG,KAAK,MAAM,SAAS,GAAG,IAAI,MAAM;AACjE,SAAO,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK;AAC7C;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/recall-xray.ts"],"sourcesContent":["/**\n * Recall X-ray snapshot schema (issue #570, PR 1).\n *\n * The X-ray surface is the unified, per-result attribution document that\n * merges the tier that served each memory, its score decomposition, any\n * graph path, an audit entry id, and the exact filter/eligibility ladder\n * that either admitted or rejected each candidate. This file defines the\n * schema and an in-memory builder + builder-state helper.\n *\n * Scope for PR 1 (this slice):\n * - Types only + pure builder functions (no IO, no rendering).\n * - Orchestrator plumbing captures a snapshot when the caller passes\n * `xrayCapture: true`. No behavior change when the flag is absent.\n * - NO new public surfaces here — CLI/HTTP/MCP land in later slices.\n *\n * The shared renderer lands in PR 2 at `recall-xray-renderer.ts`. Do not\n * fork formatting logic into other surfaces; extend the renderer.\n */\n\nimport { randomUUID } from \"node:crypto\";\n\nimport { normalizeRetrievedMemoryProvenance, type RetrievedMemoryProvenance } from \"./memory-provenance.js\";\nimport { estimateTokenCount } from \"./token-estimate.js\";\nimport type { RecallDisclosure, RecallTierExplain } from \"./types.js\";\nimport type { StateLabel } from \"./recall-state-view.js\";\nimport { isRecallDisclosure } from \"./types.js\";\n\n/**\n * Estimate token cost of a payload for X-ray disclosure accounting.\n */\nexport function estimateRecallTokens(text: string | null | undefined): number {\n if (typeof text !== \"string\" || text.length === 0) return 0;\n return estimateTokenCount(text);\n}\n\n/**\n * Aggregated per-disclosure token spend summary, computed by the\n * renderer from a snapshot's results. Non-negative integers.\n */\nexport interface RecallXrayDisclosureSummary {\n chunk: { count: number; estimatedTokens: number };\n section: { count: number; estimatedTokens: number };\n raw: { count: number; estimatedTokens: number };\n /** Number of results without a recorded disclosure level. */\n unspecified: { count: number; estimatedTokens: number };\n}\n\n/**\n * Which retrieval source produced a given result. This is the X-ray\n * tier ladder called out in issue #570 and is *distinct* from the\n * `RetrievalTier` enum (which describes issue #518's tier-explain\n * block). Keeping the sets separate lets the two observability\n * surfaces evolve without conflating their vocabularies:\n *\n * - `RetrievalTier` — direct-answer eligibility ladder.\n * - `RecallXrayServedBy` — which source materialized each result.\n */\nexport type RecallXrayServedBy =\n | \"direct-answer\"\n | \"hybrid\"\n | \"graph\"\n | \"recent-scan\"\n | \"procedural\"\n | \"review-context\"\n | \"lcm-file-parts\"\n | \"lcm-tool-parts\";\n\nexport const RECALL_XRAY_SERVED_BY_VALUES: readonly RecallXrayServedBy[] = [\n \"direct-answer\",\n \"hybrid\",\n \"graph\",\n \"recent-scan\",\n \"procedural\",\n \"review-context\",\n \"lcm-file-parts\",\n \"lcm-tool-parts\",\n] as const;\n\nexport function isRecallXrayServedBy(\n value: unknown,\n): value is RecallXrayServedBy {\n return (\n typeof value === \"string\" &&\n (RECALL_XRAY_SERVED_BY_VALUES as readonly string[]).includes(value)\n );\n}\n\n/**\n * Score decomposition for a single X-ray result.\n *\n * All fields are optional because different tiers populate different\n * terms: `hybrid` reports vector + bm25 + mmr penalty, `direct-answer`\n * reports importance + tier prior, etc. The only guaranteed field is\n * `final`, which is the post-combination score used for ordering.\n */\nexport interface RecallXrayScoreDecomposition {\n vector?: number;\n bm25?: number;\n importance?: number;\n mmrPenalty?: number;\n tierPrior?: number;\n /** Additive boost from `reinforcement_count` frontmatter (issue #687 PR 3/4). */\n reinforcementBoost?: number;\n final: number;\n}\n\n/**\n * Per-result breakdown inside an X-ray snapshot.\n */\nexport interface RecallXrayResult {\n memoryId: string;\n path: string;\n servedBy: RecallXrayServedBy;\n scoreDecomposition: RecallXrayScoreDecomposition;\n graphPath?: string[];\n /**\n * Issue #681 PR 3/3 — per-edge confidence values aligned with\n * `graphPath`. When present, `graphEdgeConfidences[i]` is the\n * confidence of the edge between `graphPath[i]` and `graphPath[i+1]`,\n * so the array length is one less than `graphPath`. Legacy edges\n * without a recorded confidence render as `1.0`. Operators use this\n * to attribute floor-pruning and PageRank ranking decisions back to\n * specific edges. The renderer drops the line when the array is\n * empty or absent so legacy snapshots round-trip cleanly.\n */\n graphEdgeConfidences?: number[];\n /** Graph activation node ids recorded for path-scoring provenance. */\n pathNodeIds?: string[];\n /** True when a graph path penalty was applied. */\n pathPenaltyApplied?: boolean;\n auditEntryId?: string;\n /** Human-readable list of filters the candidate *passed*. */\n admittedBy: string[];\n /**\n * First filter that *would have* rejected the candidate, or undefined\n * when the candidate was admitted without a rejection trace. When\n * present, `admittedBy` may still contain filters the candidate passed\n * before the rejecting gate; consumers should render both.\n */\n rejectedBy?: string;\n /**\n * Disclosure depth used to render this result's payload (issue #677\n * PR 3/4). Mirrors the per-result disclosure already exposed in the\n * recall response so X-ray consumers can attribute token spend to\n * the depth that produced it.\n */\n disclosure?: RecallDisclosure;\n /**\n * Estimated token cost of the rendered payload at the chosen\n * disclosure depth. Non-negative integer. Computed by callers via\n * `estimateRecallTokens(text)`; the renderer aggregates these into\n * a per-disclosure summary so operators can see where their budget\n * went.\n */\n estimatedTokens?: number;\n /**\n * Free-form tags from the memory's YAML frontmatter (issue #689 PR 3/3).\n * Populated by the X-ray capture path when the caller passes a `tags`\n * filter so per-result tags are available alongside the filter trace\n * in `snapshot.filters`. Also populated without a filter when the\n * orchestrator decorates results via `xrayCapture: true` so all X-ray\n * consumers can inspect memory labels without a separate storage read.\n * Absent (not `[]`) when the frontmatter has no tags or the memory\n * could not be read.\n */\n tags?: string[];\n /**\n * Per-result memory provenance and safety context. Populated by recall\n * capture when the memory frontmatter was already loaded by retrieval.\n */\n provenance?: RetrievedMemoryProvenance;\n /**\n * Claim-level provenance span (issue #1575 PR 3). The first source excerpt\n * backing this memory, surfaced so X-ray consumers can see the literal\n * utterance each fact derives from alongside retrieval provenance. Absent\n * when the memory carries no source spans (legacy or `provenance: \"none\"`).\n */\n sourceSpan?: {\n /** Verbatim quote excerpt (capped at write time by `provenance.maxQuoteChars`). */\n quote: string;\n /** ISO timestamp of the source turn. */\n observedAt: string;\n /** Coarse strength tag from the frontmatter. */\n provenance: \"verified\" | \"unverified\" | \"none\";\n };\n /**\n * Issue #1577 — per-result trust score, band, and components from the\n * unified TrustScore recall stage. Present when `trustScoreEnabled` is on.\n * Quarantined items appear here with `quarantined: true` and a reason so\n * exclusion never looks like \"no result\" (rule 34).\n */\n trust?: {\n score: number;\n band: \"high\" | \"medium\" | \"low\" | \"quarantine\";\n components: Record<string, { value: number; weight: number }>;\n multiplier: number;\n quarantined: boolean;\n quarantineReason?: string;\n };\n /**\n * #1952 — recall state-view label for this result (`current`,\n * `historical`, or `transition`). Present only when state views were\n * active for the recall AND the result was annotated at the inject\n * seam; absent otherwise, so legacy snapshots round-trip unchanged.\n */\n stateView?: StateLabel;\n}\n\n/**\n * Trace entry for a filter the orchestrator evaluated during recall.\n * Captures the name of the filter, how many candidates it saw, and how\n * many it let through. Used by X-ray consumers to render the filter\n * ladder above the per-result breakdown.\n */\nexport interface RecallFilterTrace {\n name: string;\n considered: number;\n admitted: number;\n /** Optional human-readable reason for any rejections. */\n reason?: string;\n}\n\n/**\n * Peer-profile injection annotation (issue #679 completion).\n *\n * When `peerProfileRecallEnabled` is true and a peer is registered for\n * the session, the orchestrator injects a `## Peer Profile` section into\n * the recall context. This annotation records which peer was injected and\n * how many profile fields were included so operators can correlate\n * retrieval quality with peer-context enrichment.\n *\n * `null` means no peer profile was injected (peer not registered, feature\n * disabled, or peer has no profile fields).\n */\nexport interface RecallXrayPeerProfileInjection {\n /** The peer id whose profile was injected. */\n peerId: string;\n /**\n * Number of profile fields included after the `peerProfileRecallMaxFields`\n * cap was applied. Zero means the profile existed but had no fields.\n */\n fieldsInjected: number;\n}\n\n/**\n * The unified X-ray snapshot. CLI, HTTP, and MCP surfaces all render\n * this same shape through the shared renderer (CLAUDE.md rule 22).\n */\nexport interface RecallXraySnapshot {\n /** Stable v1 tag so downstream consumers can version-gate their parsers. */\n schemaVersion: \"1\";\n query: string;\n /** UUID minted per capture; unique across snapshots within a process. */\n snapshotId: string;\n /** Epoch milliseconds the snapshot was captured. */\n capturedAt: number;\n /**\n * Tier-explain block from issue #518, carried verbatim when present.\n * `null` means direct-answer tier did not run (disabled, or another\n * tier served the query).\n */\n tierExplain: RecallTierExplain | null;\n results: RecallXrayResult[];\n appliedResultLimit: number;\n appliedResults: RecallXrayResult[];\n headroomResults: RecallXrayResult[];\n filters: RecallFilterTrace[];\n /**\n * Character budget accounting for the final assembled recall payload.\n * `used` is the rendered-context length; `chars` is the cap. Both are\n * non-negative integers in `[0, 2**31)`.\n */\n budget: { chars: number; used: number };\n /** Optional session-scope fields carried for downstream filtering. */\n sessionKey?: string;\n namespace?: string;\n traceId?: string;\n /**\n * Peer-profile injection metadata (issue #679 completion).\n * Non-null when `peerProfileRecallEnabled` is true and a peer profile\n * was successfully injected into this recall's context. `null` (or\n * absent) means no peer profile was injected.\n */\n peerProfileInjection?: RecallXrayPeerProfileInjection | null;\n}\n\n// ─── Builder ──────────────────────────────────────────────────────────────\n\nexport interface BuildXraySnapshotInput {\n query: string;\n tierExplain?: RecallTierExplain | null;\n results?: RecallXrayResult[];\n appliedResultLimit?: number;\n appliedResults?: RecallXrayResult[];\n headroomResults?: RecallXrayResult[];\n filters?: RecallFilterTrace[];\n budget?: { chars?: number; used?: number };\n sessionKey?: string;\n namespace?: string;\n traceId?: string;\n /** Peer-profile injection metadata (issue #679 completion). */\n peerProfileInjection?: RecallXrayPeerProfileInjection | null;\n /** Optional injected timestamp for deterministic tests. */\n now?: () => number;\n /** Optional injected id generator for deterministic tests. */\n snapshotIdGenerator?: () => string;\n}\n\n/**\n * Build a `RecallXraySnapshot` from explicit input fields. Pure\n * function; safe to call from anywhere. All array/object inputs are\n * shallow-copied so caller mutation after build cannot tear the\n * returned snapshot.\n */\nexport function buildXraySnapshot(\n input: BuildXraySnapshotInput,\n): RecallXraySnapshot {\n const now = input.now ?? Date.now;\n const snapshotIdGenerator = input.snapshotIdGenerator ?? randomUUID;\n\n const results = Array.isArray(input.results)\n ? input.results.map(cloneResult)\n : [];\n const appliedResults = Array.isArray(input.appliedResults)\n ? input.appliedResults.map(cloneResult)\n : [];\n const headroomResults = Array.isArray(input.headroomResults)\n ? input.headroomResults.map(cloneResult)\n : [];\n const filters = Array.isArray(input.filters)\n ? input.filters.map(cloneFilter)\n : [];\n\n const budgetChars = nonNegativeInt(input.budget?.chars);\n const budgetUsed = nonNegativeInt(input.budget?.used);\n\n const tierExplain =\n input.tierExplain && typeof input.tierExplain === \"object\"\n ? cloneTierExplain(input.tierExplain)\n : null;\n\n // Peer-profile injection annotation (issue #679 completion).\n // Deep-copy via structuredClone so the caller can't mutate the snapshot\n // after build. Accept null explicitly (no injection) or a valid object.\n let peerProfileInjection: RecallXrayPeerProfileInjection | null | undefined;\n if (input.peerProfileInjection && typeof input.peerProfileInjection === \"object\") {\n const raw = input.peerProfileInjection;\n const peerId = nonEmptyString(raw.peerId);\n if (peerId !== undefined) {\n peerProfileInjection = {\n peerId,\n fieldsInjected: nonNegativeInt(raw.fieldsInjected),\n };\n }\n } else if (input.peerProfileInjection === null) {\n peerProfileInjection = null;\n }\n\n const out: RecallXraySnapshot = {\n schemaVersion: \"1\",\n query: typeof input.query === \"string\" ? input.query : \"\",\n snapshotId: snapshotIdGenerator(),\n capturedAt: now(),\n tierExplain,\n results,\n appliedResultLimit: nonNegativeInt(input.appliedResultLimit),\n appliedResults,\n headroomResults,\n filters,\n budget: { chars: budgetChars, used: budgetUsed },\n sessionKey: nonEmptyString(input.sessionKey),\n namespace: nonEmptyString(input.namespace),\n traceId: nonEmptyString(input.traceId),\n };\n if (peerProfileInjection !== undefined) {\n out.peerProfileInjection = peerProfileInjection;\n }\n return out;\n}\n\n/**\n * Mutable builder used by the orchestrator to accumulate X-ray fields\n * as recall progresses. Call `build()` to get the finalized\n * immutable-ish snapshot. All inputs are validated at insert time so\n * a malformed entry cannot poison the snapshot later.\n */\nexport class RecallXrayBuilder {\n private readonly query: string;\n private readonly sessionKey: string | undefined;\n private namespace: string | undefined;\n private traceId: string | undefined;\n private tierExplain: RecallTierExplain | null = null;\n private readonly results: RecallXrayResult[] = [];\n private readonly filters: RecallFilterTrace[] = [];\n private budgetChars = 0;\n private budgetUsed = 0;\n private peerProfileInjection: RecallXrayPeerProfileInjection | null | undefined;\n\n constructor(opts: {\n query: string;\n sessionKey?: string;\n namespace?: string;\n traceId?: string;\n }) {\n this.query = typeof opts.query === \"string\" ? opts.query : \"\";\n this.sessionKey = nonEmptyString(opts.sessionKey);\n this.namespace = nonEmptyString(opts.namespace);\n this.traceId = nonEmptyString(opts.traceId);\n }\n\n setNamespace(namespace: string | undefined): void {\n this.namespace = nonEmptyString(namespace);\n }\n\n setTraceId(traceId: string | undefined): void {\n this.traceId = nonEmptyString(traceId);\n }\n\n setTierExplain(tierExplain: RecallTierExplain | null | undefined): void {\n this.tierExplain =\n tierExplain && typeof tierExplain === \"object\"\n ? cloneTierExplain(tierExplain)\n : null;\n }\n\n setBudget(budget: { chars?: number; used?: number }): void {\n this.budgetChars = nonNegativeInt(budget.chars);\n this.budgetUsed = nonNegativeInt(budget.used);\n }\n\n /**\n * Record peer-profile injection metadata for this recall snapshot\n * (issue #679 completion). Pass `null` to explicitly record that no\n * injection happened (feature enabled but no peer / no profile fields).\n */\n setPeerProfileInjection(\n injection: RecallXrayPeerProfileInjection | null,\n ): void {\n this.peerProfileInjection = injection;\n }\n\n recordResult(result: RecallXrayResult): void {\n this.results.push(cloneResult(result));\n }\n\n recordFilter(filter: RecallFilterTrace): void {\n this.filters.push(cloneFilter(filter));\n }\n\n build(opts: {\n now?: () => number;\n snapshotIdGenerator?: () => string;\n } = {}): RecallXraySnapshot {\n return buildXraySnapshot({\n query: this.query,\n tierExplain: this.tierExplain,\n results: this.results,\n filters: this.filters,\n budget: { chars: this.budgetChars, used: this.budgetUsed },\n sessionKey: this.sessionKey,\n namespace: this.namespace,\n traceId: this.traceId,\n peerProfileInjection: this.peerProfileInjection,\n now: opts.now,\n snapshotIdGenerator: opts.snapshotIdGenerator,\n });\n }\n}\n\n// ─── Internals ────────────────────────────────────────────────────────────\n\nfunction cloneResult(result: RecallXrayResult): RecallXrayResult {\n if (!result || typeof result !== \"object\") {\n throw new TypeError(\"RecallXrayResult must be an object\");\n }\n if (!isRecallXrayServedBy(result.servedBy)) {\n throw new TypeError(\n `RecallXrayResult.servedBy must be one of ${RECALL_XRAY_SERVED_BY_VALUES.join(\n \", \",\n )}; got ${JSON.stringify(result.servedBy)}`,\n );\n }\n const memoryId = typeof result.memoryId === \"string\" ? result.memoryId : \"\";\n const path = typeof result.path === \"string\" ? result.path : \"\";\n const admittedBy = Array.isArray(result.admittedBy)\n ? result.admittedBy.filter((x): x is string => typeof x === \"string\")\n : [];\n const graphPath = Array.isArray(result.graphPath)\n ? result.graphPath.filter((x): x is string => typeof x === \"string\")\n : undefined;\n // Issue #681 PR 3/3 — per-edge confidences alongside graph path.\n // Each entry is clamped into [0, 1]; the array is rejected wholesale\n // when alignment cannot be verified so downstream surfaces can rely\n // on `graphEdgeConfidences[i]` describing the edge between\n // `graphPath[i]` and `graphPath[i+1]`.\n //\n // Cursor review (#735): the input array length MUST match\n // `graphPath.length - 1` *before* any per-element filtering. The\n // earlier implementation skipped non-finite entries via `continue`\n // and then length-checked the cleaned array — that would silently\n // shift surviving values to earlier positions. Example: input\n // `[0.5, NaN, 0.7]` for a 3-edge path would collapse to\n // `[0.5, 0.7]`, length-check would pass against `expected = 2`, and\n // the renderer would mis-attribute `0.7` to edge B→C when it really\n // came from edge C→D. Reject on either size mismatch or any\n // non-finite entry so misalignment is impossible.\n let graphEdgeConfidences: number[] | undefined;\n if (Array.isArray(result.graphEdgeConfidences) && graphPath && graphPath.length > 1) {\n const expected = graphPath.length - 1;\n const raw = result.graphEdgeConfidences;\n if (raw.length === expected) {\n const cleaned: number[] = [];\n let allFinite = true;\n for (const value of raw) {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n allFinite = false;\n break;\n }\n cleaned.push(Math.min(1, Math.max(0, value)));\n }\n if (allFinite) {\n graphEdgeConfidences = cleaned;\n }\n }\n }\n const pathNodeIds = Array.isArray(result.pathNodeIds)\n ? result.pathNodeIds.filter((x): x is string => typeof x === \"string\")\n : undefined;\n const pathPenaltyApplied =\n typeof result.pathPenaltyApplied === \"boolean\"\n ? result.pathPenaltyApplied\n : undefined;\n const stateView =\n result.stateView === \"current\" || result.stateView === \"historical\" || result.stateView === \"transition\"\n ? result.stateView\n : undefined;\n const auditEntryId = nonEmptyString(result.auditEntryId);\n const rejectedBy = nonEmptyString(result.rejectedBy);\n const scoreDecomposition = cloneScoreDecomposition(result.scoreDecomposition);\n const out: RecallXrayResult = {\n memoryId,\n path,\n servedBy: result.servedBy,\n scoreDecomposition,\n admittedBy,\n };\n if (graphPath !== undefined) out.graphPath = graphPath;\n if (graphEdgeConfidences !== undefined) {\n out.graphEdgeConfidences = graphEdgeConfidences;\n }\n if (pathNodeIds !== undefined) out.pathNodeIds = pathNodeIds;\n if (pathPenaltyApplied !== undefined) out.pathPenaltyApplied = pathPenaltyApplied;\n if (stateView !== undefined) out.stateView = stateView;\n if (auditEntryId !== undefined) out.auditEntryId = auditEntryId;\n if (rejectedBy !== undefined) out.rejectedBy = rejectedBy;\n // Disclosure + token telemetry (issue #677 PR 3/4). Only attach when\n // present and well-formed; unknown disclosure values are dropped so a\n // bad caller can't poison downstream renderers. Uses the shared\n // `isRecallDisclosure` guard so adding a fourth disclosure level\n // requires touching only `types.ts`.\n if (isRecallDisclosure(result.disclosure)) {\n out.disclosure = result.disclosure;\n }\n if (\n typeof result.estimatedTokens === \"number\" &&\n Number.isFinite(result.estimatedTokens) &&\n result.estimatedTokens >= 0\n ) {\n out.estimatedTokens = Math.floor(result.estimatedTokens);\n }\n // Tags from frontmatter (issue #689 PR 3/3). Normalize identically to\n // the recall-surface path: trim and drop empty strings so consumers can\n // compare tags directly without a secondary normalization step.\n if (Array.isArray(result.tags)) {\n const cleanedTags = result.tags\n .filter((t): t is string => typeof t === \"string\")\n .map((t) => t.trim())\n .filter((t) => t.length > 0);\n if (cleanedTags.length > 0) {\n out.tags = cleanedTags;\n }\n }\n const provenance = normalizeRetrievedMemoryProvenance(result.provenance);\n if (provenance !== undefined) {\n out.provenance = provenance;\n }\n // Claim-level provenance span (#1575 PR 3). Deep-copy the three scalar\n // fields so the snapshot returned by getLastXraySnapshot is independent\n // of the caller's object (matches the structuredClone contract).\n const ss = result.sourceSpan;\n if (\n ss &&\n typeof ss.quote === \"string\" &&\n typeof ss.observedAt === \"string\" &&\n (ss.provenance === \"verified\" ||\n ss.provenance === \"unverified\" ||\n ss.provenance === \"none\")\n ) {\n out.sourceSpan = {\n quote: ss.quote,\n observedAt: ss.observedAt,\n provenance: ss.provenance,\n };\n }\n // Issue #1577 — preserve the trust projection through the clone so\n // getLastXraySnapshot surfaces trust score/band/quarantine reason (review\n // Oqg_o: cloneResult was silently dropping the field). Deep-copy the scalar +\n // record fields so the snapshot is independent of the caller's object,\n // matching the structuredClone contract used for every other field above.\n if (result.trust) {\n const t = result.trust;\n const components: Record<string, { value: number; weight: number }> = {};\n for (const [k, v] of Object.entries(t.components)) {\n components[k] = { value: v.value, weight: v.weight };\n }\n out.trust = {\n score: t.score,\n band: t.band,\n components,\n multiplier: t.multiplier,\n quarantined: t.quarantined,\n ...(t.quarantineReason ? { quarantineReason: t.quarantineReason } : {}),\n };\n }\n return out;\n}\n\n/**\n * Summarize per-disclosure token spend across an X-ray snapshot's\n * results. Pure helper — used by the markdown renderer to print a\n * \"per-disclosure token spend\" line and exposed for tests / surfaces.\n */\nexport function summarizeDisclosureTokens(\n results: ReadonlyArray<Pick<RecallXrayResult, \"disclosure\" | \"estimatedTokens\">>,\n): RecallXrayDisclosureSummary {\n const summary: RecallXrayDisclosureSummary = {\n chunk: { count: 0, estimatedTokens: 0 },\n section: { count: 0, estimatedTokens: 0 },\n raw: { count: 0, estimatedTokens: 0 },\n unspecified: { count: 0, estimatedTokens: 0 },\n };\n for (const result of results) {\n const tokens =\n typeof result.estimatedTokens === \"number\" &&\n Number.isFinite(result.estimatedTokens) &&\n result.estimatedTokens >= 0\n ? Math.floor(result.estimatedTokens)\n : 0;\n const bucket = isRecallDisclosure(result.disclosure)\n ? result.disclosure\n : \"unspecified\";\n summary[bucket].count += 1;\n summary[bucket].estimatedTokens += tokens;\n }\n return summary;\n}\n\nfunction cloneFilter(filter: RecallFilterTrace): RecallFilterTrace {\n if (!filter || typeof filter !== \"object\") {\n throw new TypeError(\"RecallFilterTrace must be an object\");\n }\n const out: RecallFilterTrace = {\n name: typeof filter.name === \"string\" ? filter.name : \"\",\n considered: nonNegativeInt(filter.considered),\n admitted: nonNegativeInt(filter.admitted),\n };\n const reason = nonEmptyString(filter.reason);\n if (reason !== undefined) out.reason = reason;\n return out;\n}\n\nfunction cloneScoreDecomposition(\n value: RecallXrayScoreDecomposition | undefined,\n): RecallXrayScoreDecomposition {\n if (!value || typeof value !== \"object\") {\n return { final: 0 };\n }\n const out: RecallXrayScoreDecomposition = {\n final: finiteNumber(value.final) ?? 0,\n };\n const vector = finiteNumber(value.vector);\n if (vector !== undefined) out.vector = vector;\n const bm25 = finiteNumber(value.bm25);\n if (bm25 !== undefined) out.bm25 = bm25;\n const importance = finiteNumber(value.importance);\n if (importance !== undefined) out.importance = importance;\n const mmrPenalty = finiteNumber(value.mmrPenalty);\n if (mmrPenalty !== undefined) out.mmrPenalty = mmrPenalty;\n const tierPrior = finiteNumber(value.tierPrior);\n if (tierPrior !== undefined) out.tierPrior = tierPrior;\n const reinforcementBoost = finiteNumber(value.reinforcementBoost);\n if (reinforcementBoost !== undefined && reinforcementBoost > 0) {\n out.reinforcementBoost = reinforcementBoost;\n }\n return out;\n}\n\nfunction cloneTierExplain(tierExplain: RecallTierExplain): RecallTierExplain {\n // Use structuredClone so future RecallTierExplain additions do not\n // silently share references through hand-enumerated fields. The\n // payload is JSON-shaped.\n return structuredClone(tierExplain);\n}\n\nfunction nonNegativeInt(value: unknown): number {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return 0;\n if (value <= 0) return 0;\n return Math.floor(value);\n}\n\nfunction finiteNumber(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return value;\n}\n\nfunction nonEmptyString(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (trimmed.length === 0) return undefined;\n return trimmed;\n}\n"],"mappings":";;;;;;;;;;;AAmBA,SAAS,kBAAkB;AAWpB,SAAS,qBAAqB,MAAyC;AAC5E,MAAI,OAAO,SAAS,YAAY,KAAK,WAAW,EAAG,QAAO;AAC1D,SAAO,mBAAmB,IAAI;AAChC;AAkCO,IAAM,+BAA8D;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,qBACd,OAC6B;AAC7B,SACE,OAAO,UAAU,YAChB,6BAAmD,SAAS,KAAK;AAEtE;AAqOO,SAAS,kBACd,OACoB;AACpB,QAAM,MAAM,MAAM,OAAO,KAAK;AAC9B,QAAM,sBAAsB,MAAM,uBAAuB;AAEzD,QAAM,UAAU,MAAM,QAAQ,MAAM,OAAO,IACvC,MAAM,QAAQ,IAAI,WAAW,IAC7B,CAAC;AACL,QAAM,iBAAiB,MAAM,QAAQ,MAAM,cAAc,IACrD,MAAM,eAAe,IAAI,WAAW,IACpC,CAAC;AACL,QAAM,kBAAkB,MAAM,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