@remnic/core 9.69.22 → 9.69.24

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 (772) hide show
  1. package/dist/abstraction-nodes.js +3 -2
  2. package/dist/access-admin-ops-surface.d.ts +14 -12
  3. package/dist/access-admin-ops-surface.js +94 -91
  4. package/dist/access-authorization-probe.d.ts +14 -12
  5. package/dist/access-authorization-probe.js +95 -92
  6. package/dist/access-boundary.d.ts +14 -12
  7. package/dist/access-boundary.js +94 -91
  8. package/dist/access-citation-namespace.js +3 -3
  9. package/dist/access-cli.js +200 -195
  10. package/dist/access-cli.js.map +1 -1
  11. package/dist/access-coding-context-resolution.d.ts +2 -1
  12. package/dist/access-extraction-force-flush.d.ts +14 -12
  13. package/dist/access-extraction-force-flush.js +94 -91
  14. package/dist/access-health-types.d.ts +2 -1
  15. package/dist/access-http-briefing.d.ts +156 -0
  16. package/dist/access-http-briefing.js +233 -0
  17. package/dist/access-http-lcm-compaction.d.ts +14 -12
  18. package/dist/access-http-lifecycle-flush.d.ts +14 -12
  19. package/dist/access-http-offline-stream.d.ts +14 -12
  20. package/dist/access-http-query.d.ts +3 -2
  21. package/dist/access-http-query.js +96 -93
  22. package/dist/access-http.d.ts +15 -13
  23. package/dist/access-http.js +119 -114
  24. package/dist/access-identity-continuity-surface.d.ts +12 -10
  25. package/dist/access-identity-continuity-surface.js +94 -91
  26. package/dist/access-lcm-surface.d.ts +14 -12
  27. package/dist/access-lcm-surface.js +94 -91
  28. package/dist/access-mcp.d.ts +14 -12
  29. package/dist/access-mcp.js +105 -101
  30. package/dist/access-memory-search-fanout.d.ts +3 -2
  31. package/dist/{access-namespace-preflight-BMHhxoL9.d.ts → access-namespace-preflight-BsvmyENS.d.ts} +1 -1
  32. package/dist/access-namespace-preflight.d.ts +4 -3
  33. package/dist/access-namespace-preflight.js +94 -91
  34. package/dist/access-observe-transcript.d.ts +12 -10
  35. package/dist/access-observe-write-surface.d.ts +14 -12
  36. package/dist/access-observe-write-surface.js +94 -91
  37. package/dist/access-offline-manifest.d.ts +12 -10
  38. package/dist/access-offline-manifest.js +15 -15
  39. package/dist/access-operations-batch.js +99 -95
  40. package/dist/access-operations.d.ts +14 -12
  41. package/dist/access-operations.js +104 -100
  42. package/dist/access-recall-concurrency.d.ts +14 -12
  43. package/dist/access-recall-concurrency.js +94 -91
  44. package/dist/access-recall-response.d.ts +14 -12
  45. package/dist/access-recall-response.js +94 -91
  46. package/dist/access-recall-surface.d.ts +14 -12
  47. package/dist/access-recall-surface.js +94 -91
  48. package/dist/access-schema.js +8 -7
  49. package/dist/{access-service-BlsNXFwx.d.ts → access-service-DWdY9Mlk.d.ts} +7 -7
  50. package/dist/access-service-helpers.d.ts +14 -12
  51. package/dist/access-service.d.ts +14 -12
  52. package/dist/access-service.js +94 -91
  53. package/dist/access-surface-catalog.d.ts +14 -12
  54. package/dist/access-surface-catalog.js +97 -93
  55. package/dist/access-surface-catalog.js.map +1 -1
  56. package/dist/access-wearables-meetings-surface.d.ts +4 -3
  57. package/dist/action-confidence.d.ts +2 -1
  58. package/dist/active-memory-bridge.d.ts +2 -1
  59. package/dist/active-recall.d.ts +2 -1
  60. package/dist/active-recall.js +16 -13
  61. package/dist/active-recall.js.map +1 -1
  62. package/dist/adapters/index.js +7 -7
  63. package/dist/adapters/registry.js +3 -3
  64. package/dist/ambient-provenance.d.ts +2 -1
  65. package/dist/artifact-search.d.ts +2 -1
  66. package/dist/{auto-sync-GRUJFD2F.js → auto-sync-WNGG2GC2.js} +9 -9
  67. package/dist/behavior-learner.d.ts +2 -1
  68. package/dist/behavior-signals.d.ts +2 -1
  69. package/dist/bootstrap.d.ts +12 -10
  70. package/dist/briefing-window.d.ts +3 -2
  71. package/dist/briefing.d.ts +3 -2
  72. package/dist/briefing.js +36 -36
  73. package/dist/buffer-surprise-report.d.ts +2 -1
  74. package/dist/buffer-turn-helpers.d.ts +2 -1
  75. package/dist/buffer.d.ts +3 -2
  76. package/dist/buffer.js +13 -13
  77. package/dist/bulk-import/index.d.ts +4 -3
  78. package/dist/calibration.d.ts +2 -1
  79. package/dist/calibration.js +2 -1
  80. package/dist/calibration.js.map +1 -1
  81. package/dist/capabilities.d.ts +2 -1
  82. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  83. package/dist/{capsule-merge-SEHERWWP.js → capsule-merge-IPG4IOFP.js} +5 -5
  84. package/dist/{catalog-C1qHsGew.d.ts → catalog-CDZLyiXL.d.ts} +1 -1
  85. package/dist/causal-behavior.d.ts +2 -1
  86. package/dist/causal-behavior.js +4 -3
  87. package/dist/causal-behavior.js.map +1 -1
  88. package/dist/causal-chain.js +4 -3
  89. package/dist/causal-consolidation.d.ts +2 -1
  90. package/dist/causal-consolidation.js +42 -42
  91. package/dist/causal-retrieval.js +4 -3
  92. package/dist/causal-retrieval.js.map +1 -1
  93. package/dist/causal-trajectory-graph.d.ts +5 -2
  94. package/dist/causal-trajectory-graph.js +6 -2
  95. package/dist/causal-trajectory-graph.js.map +1 -1
  96. package/dist/causal-trajectory.js +3 -2
  97. package/dist/{chunk-KTVSPFCQ.js → chunk-22FVR2KE.js} +2 -2
  98. package/dist/{chunk-7Y5V3LAP.js → chunk-27QVNSQ3.js} +2 -2
  99. package/dist/{chunk-R7LY4YKF.js → chunk-2EKJDQZB.js} +2 -2
  100. package/dist/{chunk-FCATYKQA.js → chunk-2IOHTUP3.js} +263 -13
  101. package/dist/chunk-2IOHTUP3.js.map +1 -0
  102. package/dist/{chunk-HOUST5UX.js → chunk-2ITE4C2Z.js} +2 -2
  103. package/dist/{chunk-JOYC4RYC.js → chunk-2JVJ7UHC.js} +2 -2
  104. package/dist/{chunk-X2NFFBTO.js → chunk-2L5FSNPC.js} +7 -7
  105. package/dist/{chunk-DUAJKRR2.js → chunk-2SGLMP2E.js} +2 -2
  106. package/dist/{chunk-6FUMA6AA.js → chunk-2Z4GS5E6.js} +2 -2
  107. package/dist/{chunk-G6MXN2G5.js → chunk-37KUQPX4.js} +6 -6
  108. package/dist/{chunk-DDQQY2E3.js → chunk-3BTFBQLO.js} +7 -7
  109. package/dist/chunk-3BTFBQLO.js.map +1 -0
  110. package/dist/{chunk-UR6PBX2J.js → chunk-3K7V3HE6.js} +35 -60
  111. package/dist/chunk-3K7V3HE6.js.map +1 -0
  112. package/dist/{chunk-WKAXBXVA.js → chunk-3QQTXYZ6.js} +2 -2
  113. package/dist/{chunk-DJUKBGAD.js → chunk-46EST7JO.js} +5 -5
  114. package/dist/chunk-46EST7JO.js.map +1 -0
  115. package/dist/{chunk-4ZWCQJNM.js → chunk-46WM6JX2.js} +5 -5
  116. package/dist/{chunk-CASWJ2HM.js → chunk-46ZPIGWI.js} +3 -3
  117. package/dist/{chunk-HTIIXNJQ.js → chunk-4FIH6MPS.js} +6 -3
  118. package/dist/chunk-4FIH6MPS.js.map +1 -0
  119. package/dist/{chunk-MCA2X4WH.js → chunk-4IHBN6WU.js} +2 -2
  120. package/dist/{chunk-W7IGLX4G.js → chunk-4O6WRBGE.js} +7 -7
  121. package/dist/chunk-4O6WRBGE.js.map +1 -0
  122. package/dist/{chunk-FB7LAJQM.js → chunk-4TKJGOCJ.js} +2 -2
  123. package/dist/{chunk-H7BZBSP6.js → chunk-52II7PB6.js} +4 -4
  124. package/dist/{chunk-N4Y5T6VD.js → chunk-54WHLA65.js} +4 -4
  125. package/dist/chunk-56Y6EKZN.js +24 -0
  126. package/dist/chunk-56Y6EKZN.js.map +1 -0
  127. package/dist/{chunk-YVLENSNS.js → chunk-5ATKSPEQ.js} +2 -2
  128. package/dist/{chunk-OLT3YTDH.js → chunk-5FAGCOZD.js} +37 -24
  129. package/dist/chunk-5FAGCOZD.js.map +1 -0
  130. package/dist/{chunk-ZVZHG7AI.js → chunk-5UBH37SL.js} +3 -3
  131. package/dist/{chunk-N3WZU76A.js → chunk-66OJSCI6.js} +2 -2
  132. package/dist/{chunk-D35XLYQ7.js → chunk-6CVNSDCZ.js} +11 -11
  133. package/dist/{chunk-KA2HZCMG.js → chunk-6NXSYYGP.js} +2 -2
  134. package/dist/{chunk-2HIJHXB3.js → chunk-6WHJ2EAB.js} +2 -2
  135. package/dist/{chunk-ZZM476NV.js → chunk-6XL73HQ4.js} +4 -4
  136. package/dist/{chunk-EJ5RKUXW.js → chunk-AQ7SYDVO.js} +2 -2
  137. package/dist/{chunk-2Z3DG5CQ.js → chunk-B3O3IRZN.js} +2 -2
  138. package/dist/{chunk-P77QX3ID.js → chunk-B6O2YLUR.js} +21 -20
  139. package/dist/chunk-B6O2YLUR.js.map +1 -0
  140. package/dist/{chunk-RACZB5HT.js → chunk-BD7JTBYP.js} +4 -4
  141. package/dist/{chunk-I762GW7V.js → chunk-BLJWYCNO.js} +5 -5
  142. package/dist/{chunk-ACPCA4NO.js → chunk-BMWN7B3Y.js} +6 -6
  143. package/dist/chunk-BMWN7B3Y.js.map +1 -0
  144. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  145. package/dist/{chunk-KK66P5GQ.js → chunk-C553ZTLF.js} +46 -48
  146. package/dist/chunk-C553ZTLF.js.map +1 -0
  147. package/dist/{chunk-GCASGYIO.js → chunk-C7HJ3NEI.js} +2 -2
  148. package/dist/{chunk-C24UZSFW.js → chunk-CEH2AFXG.js} +6 -6
  149. package/dist/{chunk-WVGXCBOC.js → chunk-D5F7TKMH.js} +2 -2
  150. package/dist/chunk-DGS34QSY.js +141 -0
  151. package/dist/chunk-DGS34QSY.js.map +1 -0
  152. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  153. package/dist/{chunk-2OXIPF3A.js → chunk-DZD3WGCD.js} +4 -4
  154. package/dist/{chunk-UMEOXLIZ.js → chunk-E2P7TZTF.js} +5 -5
  155. package/dist/{chunk-6FC3IZ26.js → chunk-EBA5DA77.js} +2 -2
  156. package/dist/{chunk-N7JK2RKG.js → chunk-EOQ6FSQP.js} +2 -2
  157. package/dist/chunk-EUT2WCWS.js +54 -0
  158. package/dist/chunk-EUT2WCWS.js.map +1 -0
  159. package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
  160. package/dist/{chunk-XDMI5VKE.js → chunk-FVOP3NT7.js} +2 -2
  161. package/dist/{chunk-NRLELHAY.js → chunk-G7NYVKD6.js} +2 -2
  162. package/dist/{chunk-B3W7GWQB.js → chunk-GHTSNGBZ.js} +2 -2
  163. package/dist/chunk-GKCXTSFF.js +17 -0
  164. package/dist/chunk-GKCXTSFF.js.map +1 -0
  165. package/dist/{chunk-LUDBXTBJ.js → chunk-H272ZPQ3.js} +5 -5
  166. package/dist/{chunk-SN4JXNLL.js → chunk-H3TKENU4.js} +2 -2
  167. package/dist/{chunk-4HYNMLT6.js → chunk-H4SEGIZY.js} +2 -2
  168. package/dist/{chunk-ACZN5ZXD.js → chunk-H54VWRPS.js} +13 -13
  169. package/dist/{chunk-HTP6XRUI.js → chunk-HM7RHKS4.js} +2 -2
  170. package/dist/{chunk-Z3SQEEB6.js → chunk-HWLIMQE2.js} +2 -2
  171. package/dist/{chunk-NQFCLAYT.js → chunk-ICKJ52PE.js} +99 -322
  172. package/dist/chunk-ICKJ52PE.js.map +1 -0
  173. package/dist/{chunk-2QSZNTDO.js → chunk-JBPKEARU.js} +7 -7
  174. package/dist/{chunk-DK6GMO6D.js → chunk-JEC4DVM3.js} +16 -16
  175. package/dist/chunk-JEC4DVM3.js.map +1 -0
  176. package/dist/{chunk-ET2CNMLD.js → chunk-JN72EPOE.js} +2 -2
  177. package/dist/{chunk-U62OK7BB.js → chunk-JPKK466T.js} +188 -21
  178. package/dist/chunk-JPKK466T.js.map +1 -0
  179. package/dist/{chunk-JCCWJHOP.js → chunk-JYZSRNR7.js} +2 -2
  180. package/dist/{chunk-7D6HXODY.js → chunk-K7724CH2.js} +2 -2
  181. package/dist/{chunk-X33MJFD2.js → chunk-KAXCYM66.js} +3 -3
  182. package/dist/{chunk-7RRUHJPG.js → chunk-KB2G2I6Q.js} +3 -3
  183. package/dist/{chunk-ZXBTTMGZ.js → chunk-KEF46KL2.js} +5 -5
  184. package/dist/{chunk-5UZXUTVO.js → chunk-KNA3BXXL.js} +6 -2
  185. package/dist/chunk-KNA3BXXL.js.map +1 -0
  186. package/dist/{chunk-UWTDARPF.js → chunk-KTWG7CNY.js} +6 -6
  187. package/dist/{chunk-XQYTSZW3.js → chunk-L7Z57SID.js} +6 -6
  188. package/dist/{chunk-JMAG7WZ7.js → chunk-LO4UKPKX.js} +3 -3
  189. package/dist/{chunk-LDWIPYJ6.js → chunk-LS2FHUML.js} +3 -3
  190. package/dist/{chunk-GDB4J2H3.js → chunk-MPC7TYTZ.js} +2 -2
  191. package/dist/{chunk-2GF27PGH.js → chunk-MRPOZBJC.js} +3 -3
  192. package/dist/{chunk-BR3OOQZQ.js → chunk-MWN6QEI2.js} +2 -2
  193. package/dist/{chunk-NZGO2GKL.js → chunk-MY5EDR46.js} +4 -4
  194. package/dist/{chunk-LCMUZDBZ.js → chunk-N3ZOP7KC.js} +3 -3
  195. package/dist/{chunk-TVW4C7PV.js → chunk-NB3LRY4T.js} +6 -6
  196. package/dist/{chunk-QJCWK2A7.js → chunk-ND6IQGSZ.js} +2 -2
  197. package/dist/{chunk-NOB2T2FC.js → chunk-NHLLKEKK.js} +2 -2
  198. package/dist/{chunk-7GSSHAXC.js → chunk-NLYVH66G.js} +6 -6
  199. package/dist/chunk-NLYVH66G.js.map +1 -0
  200. package/dist/{chunk-EJIWBTVM.js → chunk-O6ZNNVSP.js} +2 -2
  201. package/dist/{chunk-AG46P24C.js → chunk-OB3XMWX5.js} +4 -4
  202. package/dist/{chunk-NYRB7BKY.js → chunk-OEYZXDQI.js} +6 -6
  203. package/dist/chunk-OEYZXDQI.js.map +1 -0
  204. package/dist/{chunk-46QMN7I7.js → chunk-PAZY2ZKP.js} +6 -6
  205. package/dist/{chunk-EF4JUM55.js → chunk-PX4UMA5Z.js} +2 -2
  206. package/dist/chunk-QLK3SL7Q.js +242 -0
  207. package/dist/chunk-QLK3SL7Q.js.map +1 -0
  208. package/dist/{chunk-GGYDJJBO.js → chunk-QOOBICJF.js} +5 -5
  209. package/dist/chunk-QOOBICJF.js.map +1 -0
  210. package/dist/{chunk-NNZFPYYX.js → chunk-R7QY5ZVB.js} +2 -2
  211. package/dist/{chunk-RO2X2EYM.js → chunk-R7RTXEYG.js} +2 -2
  212. package/dist/{chunk-3LJPSRAN.js → chunk-RBCQVOVJ.js} +3 -3
  213. package/dist/{chunk-N4F7ZSSG.js → chunk-RC5DXXWC.js} +2 -2
  214. package/dist/{chunk-VLAQV4HT.js → chunk-RJYJ7KR7.js} +1636 -611
  215. package/dist/chunk-RJYJ7KR7.js.map +1 -0
  216. package/dist/{chunk-5CF2R4NS.js → chunk-RKBLRTNT.js} +2 -2
  217. package/dist/{chunk-5QZR2RA3.js → chunk-ROBHL3GL.js} +2 -2
  218. package/dist/{chunk-D5ZNOKR7.js → chunk-S7T2TY65.js} +3 -3
  219. package/dist/{chunk-C2JCVZWX.js → chunk-SCXURCVT.js} +25 -13
  220. package/dist/chunk-SCXURCVT.js.map +1 -0
  221. package/dist/{chunk-3LADWWMA.js → chunk-SJDQ5RSN.js} +3 -3
  222. package/dist/{chunk-45XVII3J.js → chunk-SMWTZLHE.js} +99 -89
  223. package/dist/{chunk-45XVII3J.js.map → chunk-SMWTZLHE.js.map} +1 -1
  224. package/dist/{chunk-XOQGUGJL.js → chunk-SO7SV523.js} +1 -1
  225. package/dist/{chunk-XOQGUGJL.js.map → chunk-SO7SV523.js.map} +1 -1
  226. package/dist/{chunk-CHWUICVY.js → chunk-SV4Z2S67.js} +4 -4
  227. package/dist/{chunk-JHP45LO5.js → chunk-SVXJLDDC.js} +9 -7
  228. package/dist/{chunk-JHP45LO5.js.map → chunk-SVXJLDDC.js.map} +1 -1
  229. package/dist/{chunk-SEF4IOFE.js → chunk-SWIKABKI.js} +2 -2
  230. package/dist/{chunk-JRRQ747T.js → chunk-TBXAY2SS.js} +13 -13
  231. package/dist/{chunk-J6A3CX5N.js → chunk-TG3FAM2S.js} +33 -8
  232. package/dist/{chunk-J6A3CX5N.js.map → chunk-TG3FAM2S.js.map} +1 -1
  233. package/dist/{chunk-XZBXINXZ.js → chunk-TNSCIPBQ.js} +4 -4
  234. package/dist/{chunk-S37NN23M.js → chunk-TVEONGBU.js} +2 -2
  235. package/dist/{chunk-5RPMTFB6.js → chunk-TWF35IC6.js} +3 -3
  236. package/dist/{chunk-BZTJEILZ.js → chunk-U6N5IBVY.js} +2 -2
  237. package/dist/{chunk-7TUB6JWA.js → chunk-UCKYTA2T.js} +3 -3
  238. package/dist/{chunk-PPOT6SPR.js → chunk-UNNPNBR2.js} +11 -11
  239. package/dist/{chunk-KQAFEZQX.js → chunk-VDX2J7OX.js} +2 -2
  240. package/dist/{chunk-J2R275FN.js → chunk-VVX5PZFS.js} +4 -4
  241. package/dist/{chunk-ME35HVDJ.js → chunk-VYCOJKSX.js} +2 -2
  242. package/dist/{chunk-F5UWQ4LX.js → chunk-W24T5YMW.js} +2 -2
  243. package/dist/{chunk-HDQUQBPW.js → chunk-W3K3HITK.js} +2 -2
  244. package/dist/{chunk-GDASG7NC.js → chunk-W4F3C7N7.js} +2 -2
  245. package/dist/{chunk-LFK623SF.js → chunk-WJHGDE7X.js} +5 -5
  246. package/dist/{chunk-DP4EBV7C.js → chunk-WMLEPWMO.js} +16 -16
  247. package/dist/chunk-WMLEPWMO.js.map +1 -0
  248. package/dist/{chunk-3Q6RD76J.js → chunk-WQZZDN5M.js} +5 -5
  249. package/dist/{chunk-ZJWDWPX6.js → chunk-X5K5TAQZ.js} +4 -4
  250. package/dist/{chunk-ZL3XX5LW.js → chunk-XM24CDZX.js} +3 -3
  251. package/dist/{chunk-JTWZKNUH.js → chunk-XOVKXJEP.js} +3 -3
  252. package/dist/{chunk-OGTKQ5MJ.js → chunk-XSGUMQQQ.js} +62 -50
  253. package/dist/chunk-XSGUMQQQ.js.map +1 -0
  254. package/dist/{chunk-X5YYSAZX.js → chunk-XUE46UYW.js} +3 -3
  255. package/dist/{chunk-DJORULH3.js → chunk-YRLHEEQT.js} +2 -2
  256. package/dist/{chunk-TA7UZZMW.js → chunk-Z3O53WZR.js} +2 -2
  257. package/dist/{chunk-4LG4CPOC.js → chunk-Z6COGHHN.js} +2 -2
  258. package/dist/{chunk-RE3H6Y2X.js → chunk-ZIW5JVRM.js} +2 -2
  259. package/dist/{cli-BNtvR-nU.d.ts → cli-DD0P-lu8.d.ts} +6 -6
  260. package/dist/cli.d.ts +16 -14
  261. package/dist/cli.js +154 -149
  262. package/dist/coding/export-okf-codegraph.d.ts +2 -1
  263. package/dist/coding/export-okf-codegraph.js +37 -37
  264. package/dist/coding/pre-action-gate.d.ts +2 -1
  265. package/dist/coding/pre-action-gate.js +4 -3
  266. package/dist/commitment-ledger.js +3 -2
  267. package/dist/compounding/engine.d.ts +3 -2
  268. package/dist/compounding/engine.js +37 -37
  269. package/dist/compounding/preference-consolidator.d.ts +2 -1
  270. package/dist/compression-optimizer.d.ts +2 -1
  271. package/dist/config.d.ts +2 -1
  272. package/dist/config.js +16 -13
  273. package/dist/connectors/codex-materialize-runner.d.ts +2 -1
  274. package/dist/connectors/codex-materialize-runner.js +38 -38
  275. package/dist/connectors/codex-materialize.d.ts +2 -1
  276. package/dist/connectors/codex-materialize.js +4 -4
  277. package/dist/connectors/index.d.ts +2 -1
  278. package/dist/connectors/index.js +38 -38
  279. package/dist/consolidation-provenance-check.d.ts +3 -2
  280. package/dist/consolidation-provenance-check.js +4 -4
  281. package/dist/consolidation-undo.d.ts +3 -2
  282. package/dist/consolidation-undo.js +3 -3
  283. package/dist/contradiction/index.d.ts +4 -3
  284. package/dist/contradiction/index.js +9 -9
  285. package/dist/converge-config.d.ts +2 -1
  286. package/dist/convergence-refresh.d.ts +3 -2
  287. package/dist/convergence-refresh.js +38 -38
  288. package/dist/conversation-index/backend.d.ts +2 -1
  289. package/dist/conversation-index/chunker.d.ts +2 -1
  290. package/dist/conversation-index/faiss-adapter.d.ts +2 -1
  291. package/dist/conversation-index/indexer.d.ts +2 -1
  292. package/dist/conversation-index/search.d.ts +2 -1
  293. package/dist/corpus-watermark.d.ts +2 -1
  294. package/dist/corpus-watermark.js +38 -38
  295. package/dist/cross-lingual-recall.d.ts +2 -1
  296. package/dist/cue-anchors.js +4 -3
  297. package/dist/dashboard-runtime.js +2 -2
  298. package/dist/day-summary.d.ts +2 -1
  299. package/dist/deep-recall-http-glue.d.ts +14 -12
  300. package/dist/deep-recall-http-glue.js +9 -8
  301. package/dist/deep-recall-mcp-tools.d.ts +14 -12
  302. package/dist/deep-recall-policy-llm.d.ts +2 -1
  303. package/dist/deep-recall-seeds.d.ts +2 -1
  304. package/dist/deep-recall.js +2 -2
  305. package/dist/delinearize.d.ts +2 -1
  306. package/dist/dependency-propagation-config.d.ts +2 -1
  307. package/dist/{dependency-propagation-delivery-DjpUlhLi.d.ts → dependency-propagation-delivery-CQPCu0o5.d.ts} +1 -1
  308. package/dist/direct-answer-wiring.d.ts +2 -1
  309. package/dist/direct-answer.d.ts +2 -1
  310. package/dist/embedding-fallback.d.ts +2 -1
  311. package/dist/enrichment/index.d.ts +2 -1
  312. package/dist/entity-origin-fields.d.ts +2 -1
  313. package/dist/entity-retrieval.d.ts +3 -2
  314. package/dist/entity-retrieval.js +36 -36
  315. package/dist/entity-schema.d.ts +2 -1
  316. package/dist/episodic-context.d.ts +2 -1
  317. package/dist/eval-trajectory-contracts.d.ts +2 -1
  318. package/dist/eval-trajectory-store.d.ts +2 -1
  319. package/dist/eval-trajectory-store.js +4 -3
  320. package/dist/eval-trajectory.d.ts +2 -1
  321. package/dist/eval-trajectory.js +4 -3
  322. package/dist/evals.js +3 -2
  323. package/dist/event-order-recall.js +2 -2
  324. package/dist/explicit-capture.d.ts +12 -10
  325. package/dist/explicit-capture.js +10 -10
  326. package/dist/external-wiki-access.d.ts +14 -12
  327. package/dist/external-wiki-access.js +95 -92
  328. package/dist/external-wiki-collection-registration.d.ts +2 -1
  329. package/dist/external-wiki-collection.d.ts +2 -1
  330. package/dist/external-wiki-mcp-tools.d.ts +14 -12
  331. package/dist/extraction-error-classification.d.ts +2 -1
  332. package/dist/extraction-faithfulness.d.ts +2 -1
  333. package/dist/extraction-judge-telemetry.d.ts +2 -1
  334. package/dist/extraction-judge-training.d.ts +2 -1
  335. package/dist/extraction-judge.d.ts +2 -1
  336. package/dist/extraction-liveness.d.ts +2 -1
  337. package/dist/extraction-normalization.d.ts +2 -1
  338. package/dist/extraction-prompt.d.ts +2 -1
  339. package/dist/extraction-source-grounding-rules.d.ts +2 -1
  340. package/dist/extraction-source-grounding.d.ts +2 -1
  341. package/dist/extraction.d.ts +2 -1
  342. package/dist/extraction.js +43 -43
  343. package/dist/fallback-llm.d.ts +2 -1
  344. package/dist/{first-start-migration-KHIMCBIC.js → first-start-migration-RC345GPL.js} +6 -5
  345. package/dist/{first-start-migration-KHIMCBIC.js.map → first-start-migration-RC345GPL.js.map} +1 -1
  346. package/dist/{forget-2AE4MDK3.js → forget-SZ2BXDGF.js} +3 -3
  347. package/dist/{graph-444E-DrF.d.ts → graph-DRkl22KE.d.ts} +10 -12
  348. package/dist/graph-append-error.d.ts +40 -0
  349. package/dist/graph-append-error.js +8 -0
  350. package/dist/graph-dashboard-diff.d.ts +5 -2
  351. package/dist/graph-dashboard-key.d.ts +5 -2
  352. package/dist/graph-dashboard-parser.d.ts +5 -2
  353. package/dist/{graph-edge-decay-DGTBFALQ.js → graph-edge-decay-MKIRZ762.js} +10 -4
  354. package/dist/graph-edge-decay-MKIRZ762.js.map +1 -0
  355. package/dist/graph-edge-reinforcement.d.ts +5 -2
  356. package/dist/graph-jsonl.d.ts +82 -0
  357. package/dist/graph-jsonl.js +23 -0
  358. package/dist/graph-jsonl.js.map +1 -0
  359. package/dist/graph-path-reconstruction.d.ts +5 -2
  360. package/dist/graph-path-scoring.d.ts +5 -2
  361. package/dist/graph-snapshot.d.ts +5 -2
  362. package/dist/graph-snapshot.js +7 -3
  363. package/dist/graph-write-lock.d.ts +84 -0
  364. package/dist/graph-write-lock.js +15 -0
  365. package/dist/graph-write-lock.js.map +1 -0
  366. package/dist/graph.d.ts +5 -2
  367. package/dist/graph.js +10 -3
  368. package/dist/harmonic-construction.js +5 -4
  369. package/dist/harmonic-retrieval.js +5 -4
  370. package/dist/importance.d.ts +2 -1
  371. package/dist/importers/index.d.ts +2 -1
  372. package/dist/in-flight-reads.d.ts +2 -1
  373. package/dist/{index-CsUrdMyL.d.ts → index-C9VXenR8.d.ts} +2 -2
  374. package/dist/index.d.ts +39 -25
  375. package/dist/index.js +291 -284
  376. package/dist/intent.d.ts +2 -1
  377. package/dist/json-store.js +2 -1
  378. package/dist/lcm/engine.d.ts +2 -1
  379. package/dist/lcm/engine.js +3 -3
  380. package/dist/lcm/index.d.ts +2 -1
  381. package/dist/lcm/index.js +6 -6
  382. package/dist/lcm/tools.d.ts +2 -1
  383. package/dist/lifecycle.d.ts +2 -1
  384. package/dist/live-connectors-runner.d.ts +2 -1
  385. package/dist/live-connectors-runner.js +3 -2
  386. package/dist/local-llm.d.ts +2 -1
  387. package/dist/local-model-endpoint.d.ts +2 -1
  388. package/dist/location/index.d.ts +4 -3
  389. package/dist/location/index.js +39 -39
  390. package/dist/maintenance/memory-governance.d.ts +2 -1
  391. package/dist/maintenance/memory-governance.js +36 -36
  392. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
  393. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +36 -36
  394. package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
  395. package/dist/maintenance/rebuild-memory-projection.js +37 -37
  396. package/dist/{maintenance-D1GRGLTE.d.ts → maintenance-C14sorKa.d.ts} +3 -3
  397. package/dist/mcp-memory-inspector-app.d.ts +14 -12
  398. package/dist/memory-action-policy.d.ts +2 -1
  399. package/dist/memory-cache.d.ts +2 -1
  400. package/dist/memory-controller.d.ts +2 -1
  401. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  402. package/dist/memory-projection-mutations.js +3 -3
  403. package/dist/memory-projection-store.d.ts +2 -1
  404. package/dist/memory-provenance.d.ts +2 -1
  405. package/dist/memory-snapshot.d.ts +2 -1
  406. package/dist/memory-subject-cli.d.ts +14 -12
  407. package/dist/memory-subject.d.ts +14 -12
  408. package/dist/memory-subject.js +5 -5
  409. package/dist/memory-worth-outcomes.d.ts +3 -2
  410. package/dist/models-json.d.ts +2 -1
  411. package/dist/namespaces/migrate.d.ts +4 -3
  412. package/dist/namespaces/migrate.js +37 -37
  413. package/dist/namespaces/principal.d.ts +2 -1
  414. package/dist/namespaces/search.d.ts +2 -1
  415. package/dist/namespaces/search.js +11 -11
  416. package/dist/namespaces/storage.d.ts +4 -3
  417. package/dist/namespaces/storage.js +36 -36
  418. package/dist/native-knowledge.d.ts +2 -1
  419. package/dist/objective-state-writers.js +4 -3
  420. package/dist/objective-state.js +3 -2
  421. package/dist/offline-sync-file-io.js +4 -3
  422. package/dist/offline-sync-impression-drain.d.ts +2 -1
  423. package/dist/offline-sync-impression-drain.js +7 -7
  424. package/dist/offline-sync.js +5 -4
  425. package/dist/operator-doctor-corpus.d.ts +2 -1
  426. package/dist/operator-doctor-corpus.js +39 -39
  427. package/dist/operator-doctor-replica.d.ts +2 -1
  428. package/dist/operator-toolkit.d.ts +6 -4
  429. package/dist/operator-toolkit.js +61 -58
  430. package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
  431. package/dist/orchestration/maintenance.d.ts +5 -4
  432. package/dist/orchestration/maintenance.js +46 -46
  433. package/dist/{orchestrator-DeqaPGT5.d.ts → orchestrator-DgyvFfPR.d.ts} +9 -9
  434. package/dist/orchestrator.d.ts +12 -10
  435. package/dist/orchestrator.js +201 -196
  436. package/dist/page-versioning.d.ts +73 -4
  437. package/dist/page-versioning.js +11 -3
  438. package/dist/patterns-cli.d.ts +2 -1
  439. package/dist/{pipeline-umUzU0D1.d.ts → pipeline-DRUwHb1X.d.ts} +1 -1
  440. package/dist/policy-runtime.d.ts +2 -1
  441. package/dist/proactive-contention.d.ts +2 -1
  442. package/dist/provenance.d.ts +2 -1
  443. package/dist/{public-http-Bevrjll9.d.ts → public-http-C4i8Opxc.d.ts} +1 -1
  444. package/dist/{purge-OP6BEDFY.js → purge-TZKRE6ZQ.js} +5 -5
  445. package/dist/purge-TZKRE6ZQ.js.map +1 -0
  446. package/dist/{qmd-BasT78PP.d.ts → qmd-BVWlg1YS.d.ts} +1 -1
  447. package/dist/qmd-preflight.d.ts +3 -2
  448. package/dist/qmd-recall-cache.d.ts +2 -1
  449. package/dist/qmd.d.ts +3 -2
  450. package/dist/qmd.js +4 -4
  451. package/dist/recall-concurrency-config.d.ts +2 -1
  452. package/dist/recall-disclosure-escalation.d.ts +2 -1
  453. package/dist/recall-explain-renderer.d.ts +2 -1
  454. package/dist/recall-explain-renderer.js +3 -3
  455. package/dist/recall-memory-map.d.ts +2 -1
  456. package/dist/recall-navigate-access.d.ts +2 -1
  457. package/dist/recall-navigate-access.js +2 -2
  458. package/dist/recall-navigate-disclosure.d.ts +2 -1
  459. package/dist/recall-navigate-disclosure.js +1 -1
  460. package/dist/recall-navigate.d.ts +2 -1
  461. package/dist/recall-navigate.js +2 -2
  462. package/dist/recall-planner-llm.d.ts +2 -1
  463. package/dist/recall-state.d.ts +2 -1
  464. package/dist/recall-state.js +3 -3
  465. package/dist/recall-tag-filter.d.ts +2 -1
  466. package/dist/recall-timings.d.ts +2 -1
  467. package/dist/recall-xray-cli.d.ts +2 -1
  468. package/dist/recall-xray-cli.js +4 -4
  469. package/dist/recall-xray-renderer.d.ts +2 -1
  470. package/dist/recall-xray-renderer.js +3 -3
  471. package/dist/recall-xray.d.ts +2 -1
  472. package/dist/recall-xray.js +2 -2
  473. package/dist/reconcile/cursor.d.ts +2 -1
  474. package/dist/reconcile/manifest.d.ts +2 -1
  475. package/dist/reconcile/manifest.js +7 -7
  476. package/dist/reconcile/plan.d.ts +2 -1
  477. package/dist/replay/normalizers/chatgpt.d.ts +2 -1
  478. package/dist/replay/normalizers/claude.d.ts +2 -1
  479. package/dist/replay/normalizers/openclaw.d.ts +2 -1
  480. package/dist/replay/normalizers/shared.d.ts +2 -1
  481. package/dist/replay/runner.d.ts +2 -1
  482. package/dist/replay/types.d.ts +2 -1
  483. package/dist/replica-divergence.d.ts +2 -1
  484. package/dist/replica-peers-config.d.ts +2 -1
  485. package/dist/{resolution-4DLI3IOR.js → resolution-VKATP2HT.js} +10 -10
  486. package/dist/resolution-VKATP2HT.js.map +1 -0
  487. package/dist/resolve-auth-token.d.ts +2 -1
  488. package/dist/resume-bundles.js +21 -18
  489. package/dist/retrieval-agents.d.ts +3 -2
  490. package/dist/retrieval-tiers.d.ts +2 -1
  491. package/dist/routing/engine.d.ts +2 -1
  492. package/dist/routing/store.d.ts +2 -1
  493. package/dist/salvage-envelope.d.ts +2 -1
  494. package/dist/salvage-envelope.js +7 -7
  495. package/dist/{scope-profiles-DXYzyOXW.d.ts → scope-profiles-Vl00B1KU.d.ts} +1 -1
  496. package/dist/search/document-scanner.js +3 -3
  497. package/dist/search/embed-helper.d.ts +2 -1
  498. package/dist/search/factory.d.ts +2 -1
  499. package/dist/search/factory.js +10 -10
  500. package/dist/search/index.d.ts +2 -1
  501. package/dist/search/index.js +16 -16
  502. package/dist/search/lancedb-backend.d.ts +2 -1
  503. package/dist/search/lancedb-backend.js +4 -4
  504. package/dist/search/meilisearch-backend.d.ts +2 -1
  505. package/dist/search/meilisearch-backend.js +4 -4
  506. package/dist/search/noop-backend.d.ts +2 -1
  507. package/dist/search/orama-backend.d.ts +2 -1
  508. package/dist/search/orama-backend.js +4 -4
  509. package/dist/search/port.d.ts +2 -1
  510. package/dist/search/remote-backend.d.ts +2 -1
  511. package/dist/secure-store/index.js +3 -3
  512. package/dist/{semantic-consolidation-CqDeaY0U.d.ts → semantic-consolidation-BC9-GFuT.d.ts} +1 -1
  513. package/dist/semantic-consolidation.d.ts +3 -2
  514. package/dist/semantic-consolidation.js +39 -39
  515. package/dist/semantic-merge-config.d.ts +17 -0
  516. package/dist/semantic-merge-config.js +1 -0
  517. package/dist/semantic-merge-config.js.map +1 -0
  518. package/dist/semantic-rule-promotion.js +36 -36
  519. package/dist/semantic-rule-verifier.d.ts +2 -1
  520. package/dist/semantic-rule-verifier.js +36 -36
  521. package/dist/{service-BKD-DVYZ.d.ts → service-BOy6dHfc.d.ts} +2 -2
  522. package/dist/session-observer-bands.d.ts +2 -1
  523. package/dist/session-observer-state.d.ts +2 -1
  524. package/dist/shared-context/manager.d.ts +2 -1
  525. package/dist/signal.d.ts +2 -1
  526. package/dist/source-agent-qualifier.d.ts +2 -1
  527. package/dist/source-agent-qualifier.js +42 -42
  528. package/dist/source-attribution.d.ts +18 -6
  529. package/dist/source-attribution.js +3 -1
  530. package/dist/standup/build.js +36 -36
  531. package/dist/{storage-BcFd1lN_.d.ts → storage-BLJRnFi6.d.ts} +15 -8
  532. package/dist/storage.d.ts +3 -2
  533. package/dist/storage.js +35 -35
  534. package/dist/subject-config.d.ts +2 -1
  535. package/dist/subject-config.js +6 -6
  536. package/dist/summarizer.d.ts +2 -1
  537. package/dist/summary-snapshot.d.ts +2 -1
  538. package/dist/support-passport/index.d.ts +17 -15
  539. package/dist/support-passport/index.js +97 -94
  540. package/dist/temporal-supersession.d.ts +3 -2
  541. package/dist/temporal-timeline-recall.d.ts +2 -1
  542. package/dist/temporal-validity.d.ts +2 -1
  543. package/dist/threading.d.ts +2 -1
  544. package/dist/tier-migration.d.ts +3 -2
  545. package/dist/tier-routing.d.ts +2 -1
  546. package/dist/{tier-stats-2TOW3QNL.js → tier-stats-KA6OZX2C.js} +6 -5
  547. package/dist/{tier-stats-2TOW3QNL.js.map → tier-stats-KA6OZX2C.js.map} +1 -1
  548. package/dist/topics.d.ts +2 -1
  549. package/dist/transcript.d.ts +2 -1
  550. package/dist/transfer/backup.js +2 -2
  551. package/dist/transfer/capsule-export.js +2 -2
  552. package/dist/transfer/capsule-import.js +6 -6
  553. package/dist/transfer/export-okf.d.ts +2 -1
  554. package/dist/transfer/export-okf.js +37 -37
  555. package/dist/trust-score-stage.d.ts +2 -1
  556. package/dist/trust-score.d.ts +2 -1
  557. package/dist/trust-zones.js +3 -2
  558. package/dist/{types-BRg3tMyp.d.ts → types-YY-eKKU7.d.ts} +3 -0
  559. package/dist/types.d.ts +2 -1
  560. package/dist/types.js +1 -1
  561. package/dist/utility-learner.js +4 -3
  562. package/dist/utility-runtime.d.ts +2 -1
  563. package/dist/utility-runtime.js +5 -4
  564. package/dist/utility-telemetry.js +3 -2
  565. package/dist/verified-recall.js +36 -36
  566. package/dist/who-knows-cli.d.ts +14 -12
  567. package/dist/who-knows-cli.js +37 -37
  568. package/dist/who-knows.d.ts +14 -12
  569. package/dist/who-knows.js +36 -36
  570. package/dist/work/board.js +3 -3
  571. package/dist/work/storage.js +2 -2
  572. package/dist/work-product-ledger.js +3 -2
  573. package/dist/write-envelope.d.ts +2 -1
  574. package/dist/write-envelope.js +6 -6
  575. package/package.json +2 -2
  576. package/src/abstraction-nodes.ts +1 -4
  577. package/src/access-http-briefing.ts +35 -0
  578. package/src/access-http.test.ts +76 -0
  579. package/src/access-http.ts +20 -23
  580. package/src/access-surface-catalog.test.ts +9 -0
  581. package/src/access-surface-catalog.ts +1 -0
  582. package/src/binary-lifecycle/backend.ts +2 -1
  583. package/src/config.ts +2 -0
  584. package/src/connectors/live/github.ts +10 -17
  585. package/src/connectors/live/gmail.ts +8 -19
  586. package/src/connectors/live/google-drive.ts +6 -13
  587. package/src/connectors/live/notion.ts +11 -21
  588. package/src/cue-anchors.ts +1 -6
  589. package/src/dedup/connector-scope.ts +39 -0
  590. package/src/dedup/merge-content.test.ts +21 -0
  591. package/src/dedup/merge-content.ts +21 -7
  592. package/src/dedup/merge-judge.ts +146 -0
  593. package/src/dedup/merge.test.ts +3542 -0
  594. package/src/dedup/merge.ts +384 -0
  595. package/src/dedup/novelty-gate.ts +12 -10
  596. package/src/dedup/semantic.ts +7 -9
  597. package/src/graph-append-error.ts +28 -0
  598. package/src/graph-jsonl.ts +267 -0
  599. package/src/graph-write-lock.test.ts +228 -0
  600. package/src/graph-write-lock.ts +132 -0
  601. package/src/graph.ts +49 -45
  602. package/src/harmonic-construction.test.ts +329 -0
  603. package/src/json-store.ts +17 -20
  604. package/src/live-connectors-runner.ts +2 -1
  605. package/src/location/store.ts +1 -4
  606. package/src/maintenance/graph-edge-decay.ts +24 -13
  607. package/src/maintenance/purge.ts +2 -5
  608. package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +3 -6
  609. package/src/maintenance/rebuild-memory-projection.ts +2 -5
  610. package/src/namespaces/catalog.ts +1 -9
  611. package/src/offline-sync-file-io.test.ts +39 -0
  612. package/src/offline-sync-file-io.ts +3 -7
  613. package/src/orchestration/contradiction-localization.integration.test.ts +35 -0
  614. package/src/orchestration/extraction-anchor-snapshot.ts +6 -1
  615. package/src/orchestration/extraction-persist-deps.ts +2 -1
  616. package/src/orchestration/extraction-persist-profile-promotion.test.ts +456 -0
  617. package/src/orchestration/extraction-persist-promotion.test.ts +534 -0
  618. package/src/orchestration/extraction-persist-promotion.ts +387 -1
  619. package/src/orchestration/extraction-persist.ts +95 -94
  620. package/src/orchestration/harmonic-construction-persist.test.ts +69 -0
  621. package/src/orchestration/harmonic-construction-persist.ts +55 -0
  622. package/src/orchestration/persistence-index.ts +35 -7
  623. package/src/orchestration/semantic-merge-commit-effects.ts +354 -0
  624. package/src/orchestration/semantic-merge-persist.ts +1095 -0
  625. package/src/orchestration/semantic-merge-promotion-payload.ts +161 -0
  626. package/src/orchestrator.ts +2 -2
  627. package/src/page-versioning.ts +396 -22
  628. package/src/procedural/procedure-miner.ts +1 -9
  629. package/src/search/document-scanner.ts +3 -6
  630. package/src/semantic-merge-config.ts +16 -0
  631. package/src/semantic-rule-promotion.ts +1 -4
  632. package/src/source-attribution-roundtrip.test.ts +21 -0
  633. package/src/source-attribution.ts +57 -17
  634. package/src/storage-contract/versioning.test.ts +500 -1
  635. package/src/storage.ts +30 -30
  636. package/src/testing/subjects/graph-edge-decay.test.ts +163 -0
  637. package/src/testing/subjects/semantic-merge-lifecycle.test.ts +1175 -0
  638. package/src/types.ts +2 -0
  639. package/src/utils/errno.test.ts +31 -0
  640. package/src/utils/errno.ts +5 -0
  641. package/src/wearables/index.ts +1 -0
  642. package/src/wearables/registry.ts +23 -0
  643. package/dist/chunk-5UZXUTVO.js.map +0 -1
  644. package/dist/chunk-7GSSHAXC.js.map +0 -1
  645. package/dist/chunk-ACPCA4NO.js.map +0 -1
  646. package/dist/chunk-C2JCVZWX.js.map +0 -1
  647. package/dist/chunk-DDQQY2E3.js.map +0 -1
  648. package/dist/chunk-DJUKBGAD.js.map +0 -1
  649. package/dist/chunk-DK6GMO6D.js.map +0 -1
  650. package/dist/chunk-DP4EBV7C.js.map +0 -1
  651. package/dist/chunk-FCATYKQA.js.map +0 -1
  652. package/dist/chunk-GGYDJJBO.js.map +0 -1
  653. package/dist/chunk-HTIIXNJQ.js.map +0 -1
  654. package/dist/chunk-KK66P5GQ.js.map +0 -1
  655. package/dist/chunk-NQFCLAYT.js.map +0 -1
  656. package/dist/chunk-NYRB7BKY.js.map +0 -1
  657. package/dist/chunk-OGTKQ5MJ.js.map +0 -1
  658. package/dist/chunk-OLT3YTDH.js.map +0 -1
  659. package/dist/chunk-P77QX3ID.js.map +0 -1
  660. package/dist/chunk-U62OK7BB.js.map +0 -1
  661. package/dist/chunk-UR6PBX2J.js.map +0 -1
  662. package/dist/chunk-VLAQV4HT.js.map +0 -1
  663. package/dist/chunk-W7IGLX4G.js.map +0 -1
  664. package/dist/purge-OP6BEDFY.js.map +0 -1
  665. /package/dist/{capsule-crypto-7FJQINUR.js.map → access-http-briefing.js.map} +0 -0
  666. /package/dist/{auto-sync-GRUJFD2F.js.map → auto-sync-WNGG2GC2.js.map} +0 -0
  667. /package/dist/{graph-edge-decay-DGTBFALQ.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  668. /package/dist/{capsule-merge-SEHERWWP.js.map → capsule-merge-IPG4IOFP.js.map} +0 -0
  669. /package/dist/{chunk-KTVSPFCQ.js.map → chunk-22FVR2KE.js.map} +0 -0
  670. /package/dist/{chunk-7Y5V3LAP.js.map → chunk-27QVNSQ3.js.map} +0 -0
  671. /package/dist/{chunk-R7LY4YKF.js.map → chunk-2EKJDQZB.js.map} +0 -0
  672. /package/dist/{chunk-HOUST5UX.js.map → chunk-2ITE4C2Z.js.map} +0 -0
  673. /package/dist/{chunk-JOYC4RYC.js.map → chunk-2JVJ7UHC.js.map} +0 -0
  674. /package/dist/{chunk-X2NFFBTO.js.map → chunk-2L5FSNPC.js.map} +0 -0
  675. /package/dist/{chunk-DUAJKRR2.js.map → chunk-2SGLMP2E.js.map} +0 -0
  676. /package/dist/{chunk-6FUMA6AA.js.map → chunk-2Z4GS5E6.js.map} +0 -0
  677. /package/dist/{chunk-G6MXN2G5.js.map → chunk-37KUQPX4.js.map} +0 -0
  678. /package/dist/{chunk-WKAXBXVA.js.map → chunk-3QQTXYZ6.js.map} +0 -0
  679. /package/dist/{chunk-4ZWCQJNM.js.map → chunk-46WM6JX2.js.map} +0 -0
  680. /package/dist/{chunk-CASWJ2HM.js.map → chunk-46ZPIGWI.js.map} +0 -0
  681. /package/dist/{chunk-MCA2X4WH.js.map → chunk-4IHBN6WU.js.map} +0 -0
  682. /package/dist/{chunk-FB7LAJQM.js.map → chunk-4TKJGOCJ.js.map} +0 -0
  683. /package/dist/{chunk-H7BZBSP6.js.map → chunk-52II7PB6.js.map} +0 -0
  684. /package/dist/{chunk-N4Y5T6VD.js.map → chunk-54WHLA65.js.map} +0 -0
  685. /package/dist/{chunk-YVLENSNS.js.map → chunk-5ATKSPEQ.js.map} +0 -0
  686. /package/dist/{chunk-ZVZHG7AI.js.map → chunk-5UBH37SL.js.map} +0 -0
  687. /package/dist/{chunk-N3WZU76A.js.map → chunk-66OJSCI6.js.map} +0 -0
  688. /package/dist/{chunk-D35XLYQ7.js.map → chunk-6CVNSDCZ.js.map} +0 -0
  689. /package/dist/{chunk-KA2HZCMG.js.map → chunk-6NXSYYGP.js.map} +0 -0
  690. /package/dist/{chunk-2HIJHXB3.js.map → chunk-6WHJ2EAB.js.map} +0 -0
  691. /package/dist/{chunk-ZZM476NV.js.map → chunk-6XL73HQ4.js.map} +0 -0
  692. /package/dist/{chunk-EJ5RKUXW.js.map → chunk-AQ7SYDVO.js.map} +0 -0
  693. /package/dist/{chunk-2Z3DG5CQ.js.map → chunk-B3O3IRZN.js.map} +0 -0
  694. /package/dist/{chunk-RACZB5HT.js.map → chunk-BD7JTBYP.js.map} +0 -0
  695. /package/dist/{chunk-I762GW7V.js.map → chunk-BLJWYCNO.js.map} +0 -0
  696. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  697. /package/dist/{chunk-GCASGYIO.js.map → chunk-C7HJ3NEI.js.map} +0 -0
  698. /package/dist/{chunk-C24UZSFW.js.map → chunk-CEH2AFXG.js.map} +0 -0
  699. /package/dist/{chunk-WVGXCBOC.js.map → chunk-D5F7TKMH.js.map} +0 -0
  700. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  701. /package/dist/{chunk-2OXIPF3A.js.map → chunk-DZD3WGCD.js.map} +0 -0
  702. /package/dist/{chunk-UMEOXLIZ.js.map → chunk-E2P7TZTF.js.map} +0 -0
  703. /package/dist/{chunk-6FC3IZ26.js.map → chunk-EBA5DA77.js.map} +0 -0
  704. /package/dist/{chunk-N7JK2RKG.js.map → chunk-EOQ6FSQP.js.map} +0 -0
  705. /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
  706. /package/dist/{chunk-XDMI5VKE.js.map → chunk-FVOP3NT7.js.map} +0 -0
  707. /package/dist/{chunk-NRLELHAY.js.map → chunk-G7NYVKD6.js.map} +0 -0
  708. /package/dist/{chunk-B3W7GWQB.js.map → chunk-GHTSNGBZ.js.map} +0 -0
  709. /package/dist/{chunk-LUDBXTBJ.js.map → chunk-H272ZPQ3.js.map} +0 -0
  710. /package/dist/{chunk-SN4JXNLL.js.map → chunk-H3TKENU4.js.map} +0 -0
  711. /package/dist/{chunk-4HYNMLT6.js.map → chunk-H4SEGIZY.js.map} +0 -0
  712. /package/dist/{chunk-ACZN5ZXD.js.map → chunk-H54VWRPS.js.map} +0 -0
  713. /package/dist/{chunk-HTP6XRUI.js.map → chunk-HM7RHKS4.js.map} +0 -0
  714. /package/dist/{chunk-Z3SQEEB6.js.map → chunk-HWLIMQE2.js.map} +0 -0
  715. /package/dist/{chunk-2QSZNTDO.js.map → chunk-JBPKEARU.js.map} +0 -0
  716. /package/dist/{chunk-ET2CNMLD.js.map → chunk-JN72EPOE.js.map} +0 -0
  717. /package/dist/{chunk-JCCWJHOP.js.map → chunk-JYZSRNR7.js.map} +0 -0
  718. /package/dist/{chunk-7D6HXODY.js.map → chunk-K7724CH2.js.map} +0 -0
  719. /package/dist/{chunk-X33MJFD2.js.map → chunk-KAXCYM66.js.map} +0 -0
  720. /package/dist/{chunk-7RRUHJPG.js.map → chunk-KB2G2I6Q.js.map} +0 -0
  721. /package/dist/{chunk-ZXBTTMGZ.js.map → chunk-KEF46KL2.js.map} +0 -0
  722. /package/dist/{chunk-UWTDARPF.js.map → chunk-KTWG7CNY.js.map} +0 -0
  723. /package/dist/{chunk-XQYTSZW3.js.map → chunk-L7Z57SID.js.map} +0 -0
  724. /package/dist/{chunk-JMAG7WZ7.js.map → chunk-LO4UKPKX.js.map} +0 -0
  725. /package/dist/{chunk-LDWIPYJ6.js.map → chunk-LS2FHUML.js.map} +0 -0
  726. /package/dist/{chunk-GDB4J2H3.js.map → chunk-MPC7TYTZ.js.map} +0 -0
  727. /package/dist/{chunk-2GF27PGH.js.map → chunk-MRPOZBJC.js.map} +0 -0
  728. /package/dist/{chunk-BR3OOQZQ.js.map → chunk-MWN6QEI2.js.map} +0 -0
  729. /package/dist/{chunk-NZGO2GKL.js.map → chunk-MY5EDR46.js.map} +0 -0
  730. /package/dist/{chunk-LCMUZDBZ.js.map → chunk-N3ZOP7KC.js.map} +0 -0
  731. /package/dist/{chunk-TVW4C7PV.js.map → chunk-NB3LRY4T.js.map} +0 -0
  732. /package/dist/{chunk-QJCWK2A7.js.map → chunk-ND6IQGSZ.js.map} +0 -0
  733. /package/dist/{chunk-NOB2T2FC.js.map → chunk-NHLLKEKK.js.map} +0 -0
  734. /package/dist/{chunk-EJIWBTVM.js.map → chunk-O6ZNNVSP.js.map} +0 -0
  735. /package/dist/{chunk-AG46P24C.js.map → chunk-OB3XMWX5.js.map} +0 -0
  736. /package/dist/{chunk-46QMN7I7.js.map → chunk-PAZY2ZKP.js.map} +0 -0
  737. /package/dist/{chunk-EF4JUM55.js.map → chunk-PX4UMA5Z.js.map} +0 -0
  738. /package/dist/{chunk-NNZFPYYX.js.map → chunk-R7QY5ZVB.js.map} +0 -0
  739. /package/dist/{chunk-RO2X2EYM.js.map → chunk-R7RTXEYG.js.map} +0 -0
  740. /package/dist/{chunk-3LJPSRAN.js.map → chunk-RBCQVOVJ.js.map} +0 -0
  741. /package/dist/{chunk-N4F7ZSSG.js.map → chunk-RC5DXXWC.js.map} +0 -0
  742. /package/dist/{chunk-5CF2R4NS.js.map → chunk-RKBLRTNT.js.map} +0 -0
  743. /package/dist/{chunk-5QZR2RA3.js.map → chunk-ROBHL3GL.js.map} +0 -0
  744. /package/dist/{chunk-D5ZNOKR7.js.map → chunk-S7T2TY65.js.map} +0 -0
  745. /package/dist/{chunk-3LADWWMA.js.map → chunk-SJDQ5RSN.js.map} +0 -0
  746. /package/dist/{chunk-CHWUICVY.js.map → chunk-SV4Z2S67.js.map} +0 -0
  747. /package/dist/{chunk-SEF4IOFE.js.map → chunk-SWIKABKI.js.map} +0 -0
  748. /package/dist/{chunk-JRRQ747T.js.map → chunk-TBXAY2SS.js.map} +0 -0
  749. /package/dist/{chunk-XZBXINXZ.js.map → chunk-TNSCIPBQ.js.map} +0 -0
  750. /package/dist/{chunk-S37NN23M.js.map → chunk-TVEONGBU.js.map} +0 -0
  751. /package/dist/{chunk-5RPMTFB6.js.map → chunk-TWF35IC6.js.map} +0 -0
  752. /package/dist/{chunk-BZTJEILZ.js.map → chunk-U6N5IBVY.js.map} +0 -0
  753. /package/dist/{chunk-7TUB6JWA.js.map → chunk-UCKYTA2T.js.map} +0 -0
  754. /package/dist/{chunk-PPOT6SPR.js.map → chunk-UNNPNBR2.js.map} +0 -0
  755. /package/dist/{chunk-KQAFEZQX.js.map → chunk-VDX2J7OX.js.map} +0 -0
  756. /package/dist/{chunk-J2R275FN.js.map → chunk-VVX5PZFS.js.map} +0 -0
  757. /package/dist/{chunk-ME35HVDJ.js.map → chunk-VYCOJKSX.js.map} +0 -0
  758. /package/dist/{chunk-F5UWQ4LX.js.map → chunk-W24T5YMW.js.map} +0 -0
  759. /package/dist/{chunk-HDQUQBPW.js.map → chunk-W3K3HITK.js.map} +0 -0
  760. /package/dist/{chunk-GDASG7NC.js.map → chunk-W4F3C7N7.js.map} +0 -0
  761. /package/dist/{chunk-LFK623SF.js.map → chunk-WJHGDE7X.js.map} +0 -0
  762. /package/dist/{chunk-3Q6RD76J.js.map → chunk-WQZZDN5M.js.map} +0 -0
  763. /package/dist/{chunk-ZJWDWPX6.js.map → chunk-X5K5TAQZ.js.map} +0 -0
  764. /package/dist/{chunk-ZL3XX5LW.js.map → chunk-XM24CDZX.js.map} +0 -0
  765. /package/dist/{chunk-JTWZKNUH.js.map → chunk-XOVKXJEP.js.map} +0 -0
  766. /package/dist/{chunk-X5YYSAZX.js.map → chunk-XUE46UYW.js.map} +0 -0
  767. /package/dist/{chunk-DJORULH3.js.map → chunk-YRLHEEQT.js.map} +0 -0
  768. /package/dist/{chunk-TA7UZZMW.js.map → chunk-Z3O53WZR.js.map} +0 -0
  769. /package/dist/{chunk-4LG4CPOC.js.map → chunk-Z6COGHHN.js.map} +0 -0
  770. /package/dist/{chunk-RE3H6Y2X.js.map → chunk-ZIW5JVRM.js.map} +0 -0
  771. /package/dist/{forget-2AE4MDK3.js.map → forget-SZ2BXDGF.js.map} +0 -0
  772. /package/dist/{resolution-4DLI3IOR.js.map → graph-append-error.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readUtilityLearningSnapshot
3
- } from "./chunk-HDQUQBPW.js";
3
+ } from "./chunk-W3K3HITK.js";
4
4
  import {
5
5
  clamp01
6
6
  } from "./chunk-TBBDFYXW.js";
@@ -65,4 +65,4 @@ export {
65
65
  applyUtilityRankingRuntimeDelta,
66
66
  applyUtilityPromotionRuntimePolicy
67
67
  };
68
- //# sourceMappingURL=chunk-SEF4IOFE.js.map
68
+ //# sourceMappingURL=chunk-SWIKABKI.js.map
@@ -1,15 +1,6 @@
1
1
  import {
2
2
  warnProjectionFallback
3
3
  } from "./chunk-ZA53AZND.js";
4
- import {
5
- MEMORY_LIFECYCLE_LEDGER_APPEND_LOCK_MAX_WAIT_MS,
6
- MEMORY_LIFECYCLE_LEDGER_LOCK_STALE_MS,
7
- compareMemoryLifecycleEvents,
8
- isFrontmatterDerivedLifecycleEventType,
9
- memoryLifecycleEventProjectionIdentity,
10
- memoryLifecycleLedgerLockPath,
11
- sortMemoryLifecycleEvents
12
- } from "./chunk-7RJUVTVF.js";
13
4
  import {
14
5
  getMemoryProjectionPath,
15
6
  openProjectionReadonly,
@@ -23,7 +14,16 @@ import {
23
14
  import {
24
15
  ensureContainedSpillDir,
25
16
  listContainedSpillFiles
26
- } from "./chunk-GCASGYIO.js";
17
+ } from "./chunk-C7HJ3NEI.js";
18
+ import {
19
+ MEMORY_LIFECYCLE_LEDGER_APPEND_LOCK_MAX_WAIT_MS,
20
+ MEMORY_LIFECYCLE_LEDGER_LOCK_STALE_MS,
21
+ compareMemoryLifecycleEvents,
22
+ isFrontmatterDerivedLifecycleEventType,
23
+ memoryLifecycleEventProjectionIdentity,
24
+ memoryLifecycleLedgerLockPath,
25
+ sortMemoryLifecycleEvents
26
+ } from "./chunk-7RJUVTVF.js";
27
27
  import {
28
28
  withHeldFileLock
29
29
  } from "./chunk-FFAZ2XFU.js";
@@ -31,10 +31,10 @@ import {
31
31
  MAGIC_HEADER_SIZE,
32
32
  SecureStoreLockedError,
33
33
  isEncryptedFile
34
- } from "./chunk-ET2CNMLD.js";
34
+ } from "./chunk-JN72EPOE.js";
35
35
  import {
36
36
  isErrnoCode
37
- } from "./chunk-5UZXUTVO.js";
37
+ } from "./chunk-KNA3BXXL.js";
38
38
 
39
39
  // src/maintenance/projection-support.ts
40
40
  import path from "path";
@@ -753,4 +753,4 @@ export {
753
753
  drainPendingLifecycleLedgerForSync,
754
754
  drainPendingLifecycleForSyncOrThrow
755
755
  };
756
- //# sourceMappingURL=chunk-JRRQ747T.js.map
756
+ //# sourceMappingURL=chunk-TBXAY2SS.js.map
@@ -113,6 +113,30 @@ function hasCitationForTemplate(text, template) {
113
113
  }
114
114
  return matcher.test(text);
115
115
  }
116
+ function lastCitationMarkerForTemplate(text, template = DEFAULT_CITATION_FORMAT) {
117
+ if (typeof text !== "string" || text.length === 0) return null;
118
+ let matcher;
119
+ if (template === DEFAULT_CITATION_FORMAT) {
120
+ matcher = defaultCitationMatcher();
121
+ } else if (!PLACEHOLDER_REGEX.test(template)) {
122
+ PLACEHOLDER_REGEX.lastIndex = 0;
123
+ return text.includes(template) ? template : null;
124
+ } else {
125
+ PLACEHOLDER_REGEX.lastIndex = 0;
126
+ matcher = templateMatcher(template);
127
+ }
128
+ if (!matcher) return null;
129
+ const global = new RegExp(
130
+ matcher.source,
131
+ matcher.flags.includes("g") ? matcher.flags : matcher.flags + "g"
132
+ );
133
+ let last = null;
134
+ for (let match = global.exec(text); match !== null; match = global.exec(text)) {
135
+ last = match[0];
136
+ if (match[0].length === 0) global.lastIndex++;
137
+ }
138
+ return last;
139
+ }
116
140
  function attachCitation(text, ctx, template = DEFAULT_CITATION_FORMAT) {
117
141
  if (typeof text !== "string") return text;
118
142
  if (hasCitationForTemplate(text, template)) return text;
@@ -187,10 +211,10 @@ function stripCitation(text) {
187
211
  }
188
212
  function stripCitationForTemplate(text, template) {
189
213
  if (typeof text !== "string" || text.length === 0) return text;
190
- if (hasCitation(text)) return stripCitation(text);
191
- if (!hasCitationForTemplate(text, template)) return text;
214
+ const afterDefault = hasCitation(text) ? stripCitation(text) : text;
215
+ if (!hasCitationForTemplate(afterDefault, template)) return afterDefault;
192
216
  const matcher = templateMatcher(template);
193
- if (!matcher) return stripCitation(text);
217
+ if (!matcher) return afterDefault;
194
218
  const globalMatcher = new RegExp(
195
219
  matcher.source,
196
220
  matcher.flags.includes("g") ? matcher.flags : matcher.flags + "g"
@@ -198,19 +222,19 @@ function stripCitationForTemplate(text, template) {
198
222
  let result = "";
199
223
  let lastIndex = 0;
200
224
  let match;
201
- while ((match = globalMatcher.exec(text)) !== null) {
225
+ while ((match = globalMatcher.exec(afterDefault)) !== null) {
202
226
  const matchEnd = match.index + match[0].length;
203
- const enclosure = enclosingDelimiterRange(text, match.index, matchEnd);
227
+ const enclosure = enclosingDelimiterRange(afterDefault, match.index, matchEnd);
204
228
  const removalStart = enclosure?.start ?? match.index;
205
229
  const removalEnd = enclosure?.end ?? matchEnd;
206
- const before = text.slice(lastIndex, removalStart).replace(/[ \t]+$/, "");
230
+ const before = afterDefault.slice(lastIndex, removalStart).replace(/[ \t]+$/, "");
207
231
  result += before;
208
232
  lastIndex = removalEnd;
209
233
  if (match[0].length === 0) {
210
234
  globalMatcher.lastIndex++;
211
235
  }
212
236
  }
213
- const after = text.slice(lastIndex).replace(/^[ \t]+/, "");
237
+ const after = afterDefault.slice(lastIndex).replace(/^[ \t]+/, "");
214
238
  if (after.length > 0) {
215
239
  if (result.length > 0) result += " ";
216
240
  result += after;
@@ -234,10 +258,11 @@ export {
234
258
  formatCitation,
235
259
  hasCitation,
236
260
  hasCitationForTemplate,
261
+ lastCitationMarkerForTemplate,
237
262
  attachCitation,
238
263
  parseCitation,
239
264
  parseAllCitations,
240
265
  stripCitation,
241
266
  stripCitationForTemplate
242
267
  };
243
- //# sourceMappingURL=chunk-J6A3CX5N.js.map
268
+ //# sourceMappingURL=chunk-TG3FAM2S.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/source-attribution.ts"],"sourcesContent":["/**\n * Inline Source Attribution Protocol (issue #369)\n *\n * Extracted facts carry provenance inline inside the fact body, so the\n * citation survives hostile memory text, copy/paste, and LLM quoting. This\n * complements — never replaces — the YAML frontmatter provenance stored on\n * disk.\n *\n * Default format (matches issue #369 proposal):\n *\n * The foo service uses Redis for rate limiting. [Source: agent=planner, session=abc123, ts=2026-04-10T14:25:07Z]\n *\n * Key properties:\n * - Inline (part of the body, not metadata).\n * - Compact (typically <80 chars of overhead per fact).\n * - Machine-parseable by a single regex.\n * - Opt-in via `inlineSourceAttributionEnabled` config flag (default off\n * for backwards compatibility with existing downstream consumers).\n * - Legacy facts without a citation remain fully readable.\n *\n * The format template is configurable via `inlineSourceAttributionFormat`\n * with supported placeholders:\n *\n * {agent} — principal / agent identifier\n * {session} — full session key (colon-delimited)\n * {sessionId} — short stable session id (trailing component)\n * {ts} — extraction timestamp (ISO 8601)\n * {date} — extraction date (YYYY-MM-DD)\n *\n * Any privacy-sensitive identifiers should be normalized before being passed\n * to `formatCitation` — the helper treats them as opaque strings.\n */\n\n/** Default citation format template (matches issue #369). */\nexport const DEFAULT_CITATION_FORMAT =\n \"[Source: agent={agent}, session={sessionId}, ts={ts}]\";\n\n/** Sentinel value used when a provenance field is missing. */\nexport const CITATION_UNKNOWN = \"unknown\";\n\nexport interface CitationContext {\n /** Principal / agent identifier (e.g. resolved via resolvePrincipal). */\n agent?: string;\n /** Full session key (e.g. \"agent:planner:main\"). */\n session?: string;\n /**\n * Opaque short session id. Derived from the trailing component of the\n * session key when not provided explicitly. Use this for compact formats\n * that do not need the full colon-delimited session key.\n */\n sessionId?: string;\n /** Extraction timestamp as an ISO 8601 string. */\n ts?: string;\n}\n\nexport interface ParsedCitation {\n /** Agent identifier parsed from the citation (never crashes on malformed input). */\n agent?: string;\n /** Session identifier parsed from the citation. */\n session?: string;\n /** Extraction timestamp parsed from the citation. */\n ts?: string;\n /** The full matched citation substring. */\n raw: string;\n}\n\n/**\n * Regex that matches the default `[Source: agent=X, session=Y, ts=Z]` shape\n * as well as human-edited variants (extra whitespace, reordered fields,\n * subset of fields). Matches non-greedily so it can be anchored anywhere in\n * the text. Kept as a getter factory so callers do not share regex state.\n */\nfunction defaultCitationMatcher(): RegExp {\n // Bounded repetition {1,1024} instead of + so the match cannot backtrack\n // polynomially over hostile memory text (CodeQL js/polynomial-redos). A real\n // citation is far shorter than 1024 chars, so this is behavior-preserving for\n // any genuine [Source: …] block; only pathological/oversized input is excluded.\n return /\\[Source:([^\\]\\n]{1,1024})\\]/gi;\n}\n\n// Linear trailing-whitespace trim. Replaces text.replace(/\\s+$/u, \"\"), whose\n// anchored quantifier backtracks polynomially on long inputs (CodeQL\n// js/polynomial-redos). Matches the exact \\s (with u flag) semantics one char\n// at a time, so the trailing-content preservation logic in attachCitation is\n// unaffected.\nfunction trimTrailingWhitespace(text: string): string {\n let end = text.length;\n while (end > 0 && /\\s/u.test(text[end - 1]!)) end--;\n return text.slice(0, end);\n}\n\n/**\n * Derive a short session id from a full session key.\n * Falls back to the raw session string if no colon is present.\n */\nexport function deriveSessionId(session: string | undefined): string | undefined {\n if (!session) return undefined;\n const trimmed = session.trim();\n if (trimmed.length === 0) return undefined;\n const parts = trimmed.split(\":\").filter((p) => p.length > 0);\n if (parts.length === 0) return trimmed;\n return parts[parts.length - 1];\n}\n\n/**\n * Format an inline citation tag using the provided template.\n *\n * Missing context fields fall back to {@link CITATION_UNKNOWN} — the caller\n * should always get a non-empty, parseable tag.\n *\n * Uses a single-pass substitution so that values which themselves contain\n * placeholder syntax (e.g. an agent literally named `\"{ts}\"`) cannot be\n * re-interpreted by subsequent replacement steps. Each placeholder slot\n * receives exactly one lookup and the substituted value is treated as\n * terminal text, not template source.\n */\nexport function formatCitation(\n ctx: CitationContext,\n template: string = DEFAULT_CITATION_FORMAT,\n): string {\n const session = ctx.session ?? \"\";\n const sessionId = ctx.sessionId ?? deriveSessionId(session) ?? CITATION_UNKNOWN;\n const ts = ctx.ts ?? CITATION_UNKNOWN;\n const agent = ctx.agent && ctx.agent.trim().length > 0 ? ctx.agent : CITATION_UNKNOWN;\n const date = ts && ts !== CITATION_UNKNOWN ? ts.slice(0, 10) : CITATION_UNKNOWN;\n const sessionForTemplate = session.trim().length > 0 ? session : CITATION_UNKNOWN;\n\n // Map from recognised placeholder names to their resolved value. Unknown\n // placeholder names are left intact (returning the original `{name}`).\n const values: Record<string, string> = {\n agent,\n session: sessionForTemplate,\n sessionId,\n ts,\n date,\n };\n\n // Single-pass scan: replace every recognised `{name}` in one sweep so that\n // substituted values cannot themselves be treated as template source on a\n // subsequent pass. The replacer-function form also guarantees that `$` /\n // `$&` / `$1` sequences inside values are emitted literally.\n return template.replace(/\\{([a-zA-Z_][\\w]*)\\}/g, (match, name: string) => {\n return Object.prototype.hasOwnProperty.call(values, name)\n ? values[name]!\n : match;\n });\n}\n\n/**\n * Returns true if the text already carries at least one citation marker.\n * Safe to call on any string — never throws.\n */\nexport function hasCitation(text: string): boolean {\n if (typeof text !== \"string\" || text.length === 0) return false;\n return defaultCitationMatcher().test(text);\n}\n\n/**\n * Escape a string for use as a regex literal.\n */\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/**\n * Escape a single character for use INSIDE a character class `[...]`.\n * Special chars inside character classes: `]`, `\\`, `^`, `-`.\n */\nfunction escapeRegExpCharClass(ch: string): string {\n if (ch === \"]\") return \"\\\\]\";\n if (ch === \"\\\\\") return \"\\\\\\\\\";\n if (ch === \"^\") return \"\\\\^\";\n if (ch === \"-\") return \"\\\\-\";\n // Other regex meta chars are NOT special inside [...] but escaping them is safe.\n return escapeRegExp(ch);\n}\n\n/**\n * Build a per-placeholder token pattern that excludes newlines, whitespace,\n * and any punctuation characters used as inner separators in the template.\n *\n * This prevents a placeholder span from consuming separator bytes and\n * matching strings that cross separator boundaries in user-supplied content.\n *\n * @param nonWordSepChars - Set of non-word (non-alphanumeric, non-`_`) chars\n * extracted from the inner separator literals of the template.\n */\nfunction buildTokenPattern(nonWordSepChars: Set<string>): string {\n // Always exclude newlines and whitespace.\n const base = \"\\\\n\\\\s\";\n if (nonWordSepChars.size === 0) {\n // No inner separator punctuation — the placeholder spans the full space\n // between prefix and suffix. Fall back to a generous no-newline match.\n return `[^\\\\n]+?`;\n }\n const escaped = [...nonWordSepChars].map(escapeRegExpCharClass).join(\"\");\n return `[^${base}${escaped}]+?`;\n}\n\n/** Regex that matches a `{placeholder}` token inside a template string. */\nconst PLACEHOLDER_REGEX = /\\{[a-zA-Z_][\\w]*\\}/g;\n\n/**\n * Build a regex that matches a citation produced by the given template.\n *\n * The approach depends on the shape of the template:\n *\n * - **Normal case (non-empty literal prefix or suffix).** Anchor the match\n * on the outer literal frame and reconstruct the interior as\n * `interToken + sep + interToken + sep + ... + sep + lastToken`.\n * All **intermediate** per-placeholder tokens exclude the combined set of\n * non-word separator characters used between any two adjacent placeholders,\n * preventing a value from consuming a separator and crossing placeholder\n * boundaries. The **last** token is only required to avoid newlines because\n * it is terminated by the literal suffix anchor — this lets placeholder\n * values that legitimately contain a separator character be recognised (e.g.\n * an ISO-8601 timestamp `2026-04-10T14:25:07Z` in `[src:{agent}:{ts}]`\n * where `:` is the inter-placeholder separator). A template like\n * `[src:{agent}/{sessionId}@{date}]` emits\n * `\\[src:[^\\n\\s/@]+?\\/[^\\n\\s/@]+?@[^\\n]+?\\]` so that `[src:foo/bar]`\n * is NOT matched (wrong separator count), `[src:foo/bar/extra@2026]`\n * is NOT matched (intermediate token crosses a `/` boundary), and\n * `[src:planner/main@2026-04-10]` IS matched correctly.\n *\n * - **Placeholder-bounded with whitespace separator.** Both prefix and\n * suffix are empty and the separator literal(s) between placeholders\n * contain at least one whitespace character (e.g. `{source}: {content}`,\n * `{agent} {sessionId}`). A whitespace-containing separator produces\n * output that is visually indistinguishable from ordinary prose, so the\n * safe strategy is to require a **hard bracket/paren/angle delimiter** on\n * both sides of the reconstructed match. Prose almost never places\n * `[...]` / `(...)` / `<...>` around a phrase, so this yields clean\n * false-positive rejection.\n *\n * - **Placeholder-bounded with compact (non-whitespace) separator.** Both\n * prefix and suffix are empty and the separator literal(s) contain NO\n * whitespace (e.g. `{agent}:{sessionId}`, `{agent}/{sessionId}`).\n * `formatCitation` emits a compact token like `planner:main` with no\n * surrounding delimiters, so the bracket strategy cannot detect it.\n * Instead, the pattern requires that the entire token is bordered by\n * whitespace or a bracket/paren/angle on each side:\n *\n * `(?:(?<=[\\[\\(\\<])|(?<!\\S))[\\w.-]+<sep>[\\w.-]+(?:(?=[\\]\\)\\>])|(?!\\S))`\n *\n * This accepts `planner:main` when it appears standalone or inside a\n * bracket-wrapped token, and rejects `host:80` embedded inside a URL like\n * `http://host:80` because `host` is immediately preceded by `/`\n * (non-whitespace, non-bracket).\n *\n * - **All-placeholder case (no literals between placeholders either).** No\n * reliable regex can be built — a template like `{agent}{sessionId}`\n * contains no anchor characters. Returns `null`; {@link\n * hasCitationForTemplate} treats this as \"cannot detect\" and returns\n * false, falling back on explicit sentinel/format detection only for the\n * default `[Source: ...]` shape.\n *\n * Returns `null` when the template has no placeholders (fully-literal\n * citation, handled by the string-equality fast path in {@link\n * hasCitationForTemplate}) **or** when the template is entirely placeholder-\n * only with no literal content whatsoever.\n */\nfunction templateMatcher(template: string): RegExp | null {\n // Split around all {placeholder} tokens.\n const parts = template.split(PLACEHOLDER_REGEX);\n if (parts.length <= 1) return null;\n\n const prefix = parts[0] ?? \"\";\n const suffix = parts[parts.length - 1] ?? \"\";\n\n // Normal case: at least one literal frame on the outside.\n // Tighten the per-placeholder token so it cannot consume separator\n // characters and match strings that cross separator boundaries\n // (Finding 3 — Uru3).\n if (prefix.length > 0 || suffix.length > 0) {\n const escapedPrefix = escapeRegExp(prefix);\n const escapedSuffix = escapeRegExp(suffix);\n\n // Inner parts: literal separators that sit between adjacent placeholders.\n // For `[src:{agent}/{sessionId}@{date}]`, parts = [\"[src:\", \"/\", \"@\", \"]\"]\n // so innerParts = [\"/\", \"@\"].\n const innerParts = parts.slice(1, -1);\n\n // Collect only the non-word (punctuation/symbol) characters from each\n // inner separator so alphabetic separator text (unlikely but valid) does\n // not exclude letters from the per-placeholder token pattern.\n const nonWordSepChars = new Set<string>();\n for (const sep of innerParts) {\n for (const ch of sep) {\n if (!/\\w/.test(ch)) {\n nonWordSepChars.add(ch);\n }\n }\n }\n\n // All intermediate tokens (every placeholder except the last) use the\n // combined exclusion so they cannot cross placeholder boundaries.\n //\n // The LAST token is different: it is terminated by the literal suffix anchor\n // (e.g. `\\]`), so it does not need to exclude inner-separator characters.\n // Dropping that restriction lets placeholder values that legitimately contain\n // a separator character (e.g. an ISO-8601 timestamp `2026-04-10T14:25:07Z`\n // in template `[src:{agent}:{ts}]`) be recognised correctly instead of\n // producing false-negative misses that trigger duplicate citation injection.\n //\n // Only the LAST token is relaxed. Intermediate tokens keep the combined\n // exclusion so that cross-boundary false positives are still rejected\n // (e.g. `[src:foo/bar/extra@2026-04-11]` for `[src:{a}/{b}@{c}]`).\n const interToken = buildTokenPattern(nonWordSepChars);\n // Last token: terminated by suffix anchor — exclude only newlines.\n const lastToken = buildTokenPattern(new Set<string>());\n\n // Reconstruct the interior: interToken sep interToken sep ... sep lastToken\n // (or just lastToken when there are no inner separators at all).\n const middle =\n innerParts.length === 0\n ? lastToken\n : interToken +\n innerParts\n .slice(0, -1)\n .map((sep) => escapeRegExp(sep) + interToken)\n .join(\"\") +\n escapeRegExp(innerParts[innerParts.length - 1]!) +\n lastToken;\n\n const pattern = escapedPrefix + middle + escapedSuffix;\n return new RegExp(pattern, \"i\");\n }\n\n // Placeholder-bounded case: prefix and suffix are both empty.\n const middleLiterals = parts.slice(1, -1);\n const hasNonEmptyMiddle = middleLiterals.some((p) => p.length > 0);\n if (!hasNonEmptyMiddle) {\n // All-placeholder template with no literal content. Impossible to anchor\n // reliably without sentinel markers; signal the caller.\n return null;\n }\n\n // Identifier token: one or more word chars, dots, dashes, or colons.\n // Colons are included to allow timestamp values like \"10:30\" or session\n // keys like \"agent:planner:main\" inside compact placeholder-bounded\n // templates. URL-like fragments (`http://host:80`) are still rejected\n // because the lead anchor requires whitespace or a bracket immediately\n // before the first id-token group (`http` is preceded by `/`).\n const idToken = \"[\\\\w.:-]+\";\n const body =\n idToken +\n middleLiterals.map((lit) => escapeRegExp(lit) + idToken).join(\"\");\n\n const separatorText = middleLiterals.join(\"\");\n if (/\\s/.test(separatorText)) {\n // Separator contains whitespace: the emitted citation looks like ordinary\n // prose (e.g. `planner main`). Require a hard bracket/paren/angle\n // delimiter on both sides to prevent false matches on English text.\n const opener = \"[\\\\[\\\\(\\\\<]\";\n const closer = \"[\\\\]\\\\)\\\\>]\";\n return new RegExp(opener + body + closer, \"i\");\n }\n\n // Separator is compact (no whitespace): `formatCitation` emits a token like\n // `planner:main` without surrounding delimiters. The challenge is that the\n // same token shape also matches ordinary hyphenated or slashed prose words\n // (e.g. `long-term`, `docs/setup`), causing `hasCitationForTemplate` to\n // return true on uncited fact bodies and silently suppress citation injection\n // from `attachCitation`.\n //\n // Fix (Finding 1): tighten the trail anchor so a bare compact token is only\n // accepted when it sits at the very end of the string (possibly followed by\n // optional trailing whitespace or a newline). Since `attachCitation` always\n // appends the citation at the trimmed end of the fact body, a real citation\n // token will always appear at the tail. Prose like `\"long-term solution\"`\n // has `long-term` in the middle of the string (followed by ` solution`), so\n // the end-of-string anchor rejects it — no false positive, no silent drop.\n //\n // The lead anchor still accepts either a bracket opener or a whitespace\n // boundary (or start of string), so `\"Fact. planner:main\"` and standalone\n // `\"planner:main\"` are both detected after the first attachment pass.\n //\n // Bracket-wrapped form (e.g. `[planner:main]`) is also accepted via the\n // opener/closer pair — bracket still takes precedence over end-of-string.\n //\n // Example — why `http://host:80` does NOT match:\n // Trying to match `host:80`: the char before `h` is `/` (non-whitespace,\n // non-bracket), so `(?<=[\\[\\(\\<])` and `(?<!\\S)` both fail ⟹ no match.\n // Trying to match `http:...`: after `http:` the next chars are `//` which\n // are not `[\\w.-]+`, so the second id-token group fails ⟹ no match.\n const leadAnchor = \"(?:(?<=[\\\\[\\\\(\\\\<])|(?<!\\\\S))\";\n // Trail: either a bracket closer (for `[token]` shape) or end-of-string\n // optionally preceded by whitespace. The `(?!\\S)` is deliberately removed\n // so that a compact token in the MIDDLE of a sentence does not match.\n const trailAnchor = \"(?:(?=[\\\\]\\\\)\\\\>])|(?=\\\\s*$))\";\n return new RegExp(leadAnchor + body + trailAnchor, \"i\");\n}\n\n/**\n * Returns true if `text` already carries a citation produced by `template`\n * **or** by the default `[Source: ...]` format (for facts that were tagged\n * before a config change).\n *\n * Use this instead of {@link hasCitation} whenever the caller has access to\n * the configured `inlineSourceAttributionFormat`.\n *\n * All-placeholder templates such as `{agent}{sessionId}` have no literal\n * content to anchor on and therefore cannot be reliably detected without\n * dedicated sentinel markers. In that case the function returns `false` —\n * callers that need idempotent dedup for such templates should either adopt\n * a template with literal delimiters (recommended) or rely on the default\n * `[Source: ...]` marker detection which is always available via\n * {@link hasCitation}.\n */\nexport function hasCitationForTemplate(text: string, template: string): boolean {\n if (typeof text !== \"string\" || text.length === 0) return false;\n // Always accept the default format as a fallback so facts tagged before a\n // configuration change are not double-tagged on reprocessing.\n if (hasCitation(text)) return true;\n // If the configured template matches the default, we're done.\n //\n // Known limitation (Thread 2 — Codex P2): this fast path exits without\n // checking whether the content carries a citation from a DIFFERENT custom\n // template that was active before the config was changed back to the default.\n // Such a fact would be detected by `hasCitation` above only if the prior\n // custom template happened to match the default `[Source: ...]` pattern.\n // In practice, template changes mid-stream are rare, and the false-negative\n // (missing an old custom citation) produces a benign duplicate citation rather\n // than data loss. A full fix would require storing the citation template used\n // at write time in the frontmatter and checking that here.\n if (template === DEFAULT_CITATION_FORMAT) return false;\n\n // Fully-literal template (no placeholders): exact inclusion check.\n if (!PLACEHOLDER_REGEX.test(template)) {\n // Reset lastIndex because PLACEHOLDER_REGEX is declared with /g.\n PLACEHOLDER_REGEX.lastIndex = 0;\n return text.includes(template);\n }\n // Reset lastIndex after the .test() probe above.\n PLACEHOLDER_REGEX.lastIndex = 0;\n\n const matcher = templateMatcher(template);\n if (!matcher) {\n // All-placeholder template: cannot build a reliable matcher. See the\n // docstring — callers should not rely on dedup for this shape.\n return false;\n }\n return matcher.test(text);\n}\n\n/**\n * Attach an inline citation to fact text.\n *\n * If the text already has a citation — either the default `[Source: ...]`\n * marker or one produced by the configured template — it is returned unchanged.\n * Existing provenance is respected and never overwritten. Otherwise the\n * citation is appended to the trimmed text with a single space separator,\n * which keeps the marker visually adjacent to the fact body.\n */\nexport function attachCitation(\n text: string,\n ctx: CitationContext,\n template: string = DEFAULT_CITATION_FORMAT,\n): string {\n if (typeof text !== \"string\") return text as unknown as string;\n if (hasCitationForTemplate(text, template)) return text;\n const trimmedEnd = trimTrailingWhitespace(text);\n if (trimmedEnd.length === 0) return text;\n const citation = formatCitation(ctx, template);\n // Preserve any trailing newline that callers rely on for markdown rendering.\n const trailing = text.slice(trimmedEnd.length);\n return `${trimmedEnd} ${citation}${trailing}`;\n}\n\n/**\n * Parse a single inline citation from a piece of text. Returns the first\n * citation encountered or `null` when none is present. Malformed citations\n * do not throw — fields that cannot be parsed simply remain `undefined`.\n */\nexport function parseCitation(text: string): ParsedCitation | null {\n if (typeof text !== \"string\" || text.length === 0) return null;\n const matcher = defaultCitationMatcher();\n const match = matcher.exec(text);\n if (!match) return null;\n\n const body = match[1] ?? \"\";\n const raw = match[0] ?? \"\";\n const parsed: ParsedCitation = { raw };\n\n const fields = body\n .split(\",\")\n .map((segment) => segment.trim())\n .filter((segment) => segment.length > 0);\n\n for (const field of fields) {\n const eqIdx = field.indexOf(\"=\");\n if (eqIdx <= 0) continue;\n const key = field.slice(0, eqIdx).trim().toLowerCase();\n const value = field.slice(eqIdx + 1).trim();\n if (value.length === 0) continue;\n switch (key) {\n case \"agent\":\n parsed.agent = value;\n break;\n case \"session\":\n case \"sessionid\":\n parsed.session = value;\n break;\n case \"ts\":\n case \"timestamp\":\n parsed.ts = value;\n break;\n default:\n // Unknown fields are ignored defensively so human edits never crash.\n break;\n }\n }\n\n return parsed;\n}\n\n/**\n * Parse every citation embedded in the text. Always returns an array; empty\n * when none are present.\n */\nexport function parseAllCitations(text: string): ParsedCitation[] {\n if (typeof text !== \"string\" || text.length === 0) return [];\n const matcher = defaultCitationMatcher();\n const results: ParsedCitation[] = [];\n let match: RegExpExecArray | null;\n while ((match = matcher.exec(text)) !== null) {\n const parsed = parseCitation(match[0]);\n if (parsed) results.push(parsed);\n }\n return results;\n}\n\n/**\n * Remove all inline citations from a piece of text.\n *\n * Callers that want the raw fact body (for dedup hashing, display, or\n * comparison) should use this helper instead of hand-rolled regexes so the\n * whole codebase agrees on the citation syntax.\n *\n * Finding 2 fix: when the input contains no citation marker, the input is\n * returned byte-for-byte unchanged. When a citation IS removed, whitespace\n * normalization is applied only at each join seam (the single space between\n * the preceding text and where the citation was), rather than across the\n * entire string. This preserves markdown hard-break spacing, aligned text,\n * and code-like snippets in fact bodies that happen to carry a citation.\n *\n * Implementation: each citation match is replaced by its \"seam fix\" — the\n * content before the match has its trailing whitespace trimmed and then a\n * single space is appended if any text remains, collapsing only the gap\n * left by the removed marker. Whitespace elsewhere in the body is untouched.\n */\nexport function stripCitation(text: string): string {\n if (typeof text !== \"string\" || text.length === 0) return text;\n // Early exit: no citation marker present — return the input unchanged so\n // that callers never lose formatting fidelity on uncited strings.\n if (!hasCitation(text)) return text;\n\n // Walk through all citations and slice them out one by one so that we can\n // normalise ONLY the whitespace at each seam rather than the entire string.\n const matcher = defaultCitationMatcher();\n let result = \"\";\n let lastIndex = 0;\n\n let match: RegExpExecArray | null;\n while ((match = matcher.exec(text)) !== null) {\n // Text before this citation. Trim trailing spaces/tabs at the seam only.\n const before = text.slice(lastIndex, match.index).replace(/[ \\t]+$/, \"\");\n result += before;\n lastIndex = match.index + match[0].length;\n }\n\n // Append any trailing text after the last citation. Trim leading\n // spaces/tabs and trailing whitespace at the join seam.\n const after = text.slice(lastIndex).replace(/^[ \\t]+/, \"\");\n if (after.length > 0) {\n if (result.length > 0) result += \" \";\n result += after;\n }\n\n return result.trimEnd();\n}\n\n/**\n * Strip an inline citation from text using a specific template regex.\n *\n * This is the template-aware counterpart to {@link stripCitation}. When the\n * caller holds the configured `inlineSourceAttributionFormat`, use this\n * function to strip citations produced by that template — including custom\n * templates that differ from the default `[Source: ...]` pattern.\n *\n * Behaviour:\n * - If the text has a **default-format** citation, delegates to\n * {@link stripCitation} (always safe).\n * - If the text has a **custom-template** citation detected by\n * `hasCitationForTemplate`, builds the template regex and removes every\n * occurrence (citations are appended at the end of the fact body by\n * {@link attachCitation}).\n * - All-placeholder templates (no literal prefix/suffix/separator) cannot\n * produce a reliable matcher. `hasCitationForTemplate` already returns\n * `false` for such templates, so this function never attempts to strip an\n * undetectable citation. The text is returned unchanged when no citation\n * is detected.\n * - If no citation is detected for the given template, returns the text\n * unchanged.\n *\n * @returns The stripped text (or the original text when no citation is found).\n */\nexport function stripCitationForTemplate(\n text: string,\n template: string,\n): string {\n if (typeof text !== \"string\" || text.length === 0) return text;\n\n // Fast path: default-format citation — delegate to the existing stripper.\n if (hasCitation(text)) return stripCitation(text);\n\n // No default citation; check whether the custom template produced one.\n // hasCitationForTemplate returns false for all-placeholder templates (no\n // reliable matcher), so those pass through unchanged below.\n if (!hasCitationForTemplate(text, template)) return text;\n\n // Build the template matcher. hasCitationForTemplate already returned true,\n // which means templateMatcher produced a non-null result. The null branch\n // here is a defensive fallback only — delegate to stripCitation.\n const matcher = templateMatcher(template);\n if (!matcher) return stripCitation(text);\n\n // The matcher regex was built without the global flag; add it for exec loop.\n const globalMatcher = new RegExp(\n matcher.source,\n matcher.flags.includes(\"g\") ? matcher.flags : matcher.flags + \"g\",\n );\n let result = \"\";\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = globalMatcher.exec(text)) !== null) {\n const matchEnd = match.index + match[0].length;\n const enclosure = enclosingDelimiterRange(text, match.index, matchEnd);\n const removalStart = enclosure?.start ?? match.index;\n const removalEnd = enclosure?.end ?? matchEnd;\n const before = text.slice(lastIndex, removalStart).replace(/[ \\t]+$/, \"\");\n result += before;\n lastIndex = removalEnd;\n // Guard against zero-width matches causing an infinite loop.\n if (match[0].length === 0) {\n globalMatcher.lastIndex++;\n }\n }\n\n const after = text.slice(lastIndex).replace(/^[ \\t]+/, \"\");\n if (after.length > 0) {\n if (result.length > 0) result += \" \";\n result += after;\n }\n\n return result.trimEnd();\n}\n\nfunction enclosingDelimiterRange(\n text: string,\n start: number,\n end: number,\n): { start: number; end: number } | undefined {\n if (start <= 0 || end >= text.length) return undefined;\n const opener = text[start - 1];\n const closer = text[end];\n if (\n (opener === \"[\" && closer === \"]\") ||\n (opener === \"(\" && closer === \")\") ||\n (opener === \"<\" && closer === \">\")\n ) {\n return { start: start - 1, end: end + 1 };\n }\n return undefined;\n}\n"],"mappings":";AAkCO,IAAM,0BACX;AAGK,IAAM,mBAAmB;AAkChC,SAAS,yBAAiC;AAKxC,SAAO;AACT;AAOA,SAAS,uBAAuB,MAAsB;AACpD,MAAI,MAAM,KAAK;AACf,SAAO,MAAM,KAAK,MAAM,KAAK,KAAK,MAAM,CAAC,CAAE,EAAG;AAC9C,SAAO,KAAK,MAAM,GAAG,GAAG;AAC1B;AAMO,SAAS,gBAAgB,SAAiD;AAC/E,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,UAAU,QAAQ,KAAK;AAC7B,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,QAAQ,QAAQ,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC;AAC3D,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,SAAO,MAAM,MAAM,SAAS,CAAC;AAC/B;AAcO,SAAS,eACd,KACA,WAAmB,yBACX;AACR,QAAM,UAAU,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AK,OAAO,KAAK,OAAQ,QAAO;AAC7C,QAAM,SAAS,KAAK,QAAQ,CAAC;AAC7B,QAAM,SAAS,KAAK,GAAG;AACvB,MACG,WAAW,OAAO,WAAW,OAC7B,WAAW,OAAO,WAAW,OAC7B,WAAW,OAAO,WAAW,KAC9B;AACA,WAAO,EAAE,OAAO,QAAQ,GAAG,KAAK,MAAM,EAAE;AAAA,EAC1C;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/source-attribution.ts"],"sourcesContent":["/**\n * Inline Source Attribution Protocol (issue #369)\n *\n * Extracted facts carry provenance inline inside the fact body, so the\n * citation survives hostile memory text, copy/paste, and LLM quoting. This\n * complements — never replaces — the YAML frontmatter provenance stored on\n * disk.\n *\n * Default format (matches issue #369 proposal):\n *\n * The foo service uses Redis for rate limiting. [Source: agent=planner, session=abc123, ts=2026-04-10T14:25:07Z]\n *\n * Key properties:\n * - Inline (part of the body, not metadata).\n * - Compact (typically <80 chars of overhead per fact).\n * - Machine-parseable by a single regex.\n * - Opt-in via `inlineSourceAttributionEnabled` config flag (default off\n * for backwards compatibility with existing downstream consumers).\n * - Legacy facts without a citation remain fully readable.\n *\n * The format template is configurable via `inlineSourceAttributionFormat`\n * with supported placeholders:\n *\n * {agent} — principal / agent identifier\n * {session} — full session key (colon-delimited)\n * {sessionId} — short stable session id (trailing component)\n * {ts} — extraction timestamp (ISO 8601)\n * {date} — extraction date (YYYY-MM-DD)\n *\n * Any privacy-sensitive identifiers should be normalized before being passed\n * to `formatCitation` — the helper treats them as opaque strings.\n */\n\n/** Default citation format template (matches issue #369). */\nexport const DEFAULT_CITATION_FORMAT =\n \"[Source: agent={agent}, session={sessionId}, ts={ts}]\";\n\n/** Sentinel value used when a provenance field is missing. */\nexport const CITATION_UNKNOWN = \"unknown\";\n\nexport interface CitationContext {\n /** Principal / agent identifier (e.g. resolved via resolvePrincipal). */\n agent?: string;\n /** Full session key (e.g. \"agent:planner:main\"). */\n session?: string;\n /**\n * Opaque short session id. Derived from the trailing component of the\n * session key when not provided explicitly. Use this for compact formats\n * that do not need the full colon-delimited session key.\n */\n sessionId?: string;\n /** Extraction timestamp as an ISO 8601 string. */\n ts?: string;\n}\n\nexport interface ParsedCitation {\n /** Agent identifier parsed from the citation (never crashes on malformed input). */\n agent?: string;\n /** Session identifier parsed from the citation. */\n session?: string;\n /** Extraction timestamp parsed from the citation. */\n ts?: string;\n /** The full matched citation substring. */\n raw: string;\n}\n\n/**\n * Regex that matches the default `[Source: agent=X, session=Y, ts=Z]` shape\n * as well as human-edited variants (extra whitespace, reordered fields,\n * subset of fields). Matches non-greedily so it can be anchored anywhere in\n * the text. Kept as a getter factory so callers do not share regex state.\n */\nfunction defaultCitationMatcher(): RegExp {\n // Bounded repetition {1,1024} instead of + so the match cannot backtrack\n // polynomially over hostile memory text (CodeQL js/polynomial-redos). A real\n // citation is far shorter than 1024 chars, so this is behavior-preserving for\n // any genuine [Source: …] block; only pathological/oversized input is excluded.\n return /\\[Source:([^\\]\\n]{1,1024})\\]/gi;\n}\n\n// Linear trailing-whitespace trim. Replaces text.replace(/\\s+$/u, \"\"), whose\n// anchored quantifier backtracks polynomially on long inputs (CodeQL\n// js/polynomial-redos). Matches the exact \\s (with u flag) semantics one char\n// at a time, so the trailing-content preservation logic in attachCitation is\n// unaffected.\nfunction trimTrailingWhitespace(text: string): string {\n let end = text.length;\n while (end > 0 && /\\s/u.test(text[end - 1]!)) end--;\n return text.slice(0, end);\n}\n\n/**\n * Derive a short session id from a full session key.\n * Falls back to the raw session string if no colon is present.\n */\nexport function deriveSessionId(session: string | undefined): string | undefined {\n if (!session) return undefined;\n const trimmed = session.trim();\n if (trimmed.length === 0) return undefined;\n const parts = trimmed.split(\":\").filter((p) => p.length > 0);\n if (parts.length === 0) return trimmed;\n return parts[parts.length - 1];\n}\n\n/**\n * Format an inline citation tag using the provided template.\n *\n * Missing context fields fall back to {@link CITATION_UNKNOWN} — the caller\n * should always get a non-empty, parseable tag.\n *\n * Uses a single-pass substitution so that values which themselves contain\n * placeholder syntax (e.g. an agent literally named `\"{ts}\"`) cannot be\n * re-interpreted by subsequent replacement steps. Each placeholder slot\n * receives exactly one lookup and the substituted value is treated as\n * terminal text, not template source.\n */\nexport function formatCitation(\n ctx: CitationContext,\n template: string = DEFAULT_CITATION_FORMAT,\n): string {\n const session = ctx.session ?? \"\";\n const sessionId = ctx.sessionId ?? deriveSessionId(session) ?? CITATION_UNKNOWN;\n const ts = ctx.ts ?? CITATION_UNKNOWN;\n const agent = ctx.agent && ctx.agent.trim().length > 0 ? ctx.agent : CITATION_UNKNOWN;\n const date = ts && ts !== CITATION_UNKNOWN ? ts.slice(0, 10) : CITATION_UNKNOWN;\n const sessionForTemplate = session.trim().length > 0 ? session : CITATION_UNKNOWN;\n\n // Map from recognised placeholder names to their resolved value. Unknown\n // placeholder names are left intact (returning the original `{name}`).\n const values: Record<string, string> = {\n agent,\n session: sessionForTemplate,\n sessionId,\n ts,\n date,\n };\n\n // Single-pass scan: replace every recognised `{name}` in one sweep so that\n // substituted values cannot themselves be treated as template source on a\n // subsequent pass. The replacer-function form also guarantees that `$` /\n // `$&` / `$1` sequences inside values are emitted literally.\n return template.replace(/\\{([a-zA-Z_][\\w]*)\\}/g, (match, name: string) => {\n return Object.prototype.hasOwnProperty.call(values, name)\n ? values[name]!\n : match;\n });\n}\n\n/**\n * Returns true if the text already carries at least one citation marker.\n * Safe to call on any string — never throws.\n */\nexport function hasCitation(text: string): boolean {\n if (typeof text !== \"string\" || text.length === 0) return false;\n return defaultCitationMatcher().test(text);\n}\n\n/**\n * Escape a string for use as a regex literal.\n */\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/**\n * Escape a single character for use INSIDE a character class `[...]`.\n * Special chars inside character classes: `]`, `\\`, `^`, `-`.\n */\nfunction escapeRegExpCharClass(ch: string): string {\n if (ch === \"]\") return \"\\\\]\";\n if (ch === \"\\\\\") return \"\\\\\\\\\";\n if (ch === \"^\") return \"\\\\^\";\n if (ch === \"-\") return \"\\\\-\";\n // Other regex meta chars are NOT special inside [...] but escaping them is safe.\n return escapeRegExp(ch);\n}\n\n/**\n * Build a per-placeholder token pattern that excludes newlines, whitespace,\n * and any punctuation characters used as inner separators in the template.\n *\n * This prevents a placeholder span from consuming separator bytes and\n * matching strings that cross separator boundaries in user-supplied content.\n *\n * @param nonWordSepChars - Set of non-word (non-alphanumeric, non-`_`) chars\n * extracted from the inner separator literals of the template.\n */\nfunction buildTokenPattern(nonWordSepChars: Set<string>): string {\n // Always exclude newlines and whitespace.\n const base = \"\\\\n\\\\s\";\n if (nonWordSepChars.size === 0) {\n // No inner separator punctuation — the placeholder spans the full space\n // between prefix and suffix. Fall back to a generous no-newline match.\n return `[^\\\\n]+?`;\n }\n const escaped = [...nonWordSepChars].map(escapeRegExpCharClass).join(\"\");\n return `[^${base}${escaped}]+?`;\n}\n\n/** Regex that matches a `{placeholder}` token inside a template string. */\nconst PLACEHOLDER_REGEX = /\\{[a-zA-Z_][\\w]*\\}/g;\n\n/**\n * Build a regex that matches a citation produced by the given template.\n *\n * The approach depends on the shape of the template:\n *\n * - **Normal case (non-empty literal prefix or suffix).** Anchor the match\n * on the outer literal frame and reconstruct the interior as\n * `interToken + sep + interToken + sep + ... + sep + lastToken`.\n * All **intermediate** per-placeholder tokens exclude the combined set of\n * non-word separator characters used between any two adjacent placeholders,\n * preventing a value from consuming a separator and crossing placeholder\n * boundaries. The **last** token is only required to avoid newlines because\n * it is terminated by the literal suffix anchor — this lets placeholder\n * values that legitimately contain a separator character be recognised (e.g.\n * an ISO-8601 timestamp `2026-04-10T14:25:07Z` in `[src:{agent}:{ts}]`\n * where `:` is the inter-placeholder separator). A template like\n * `[src:{agent}/{sessionId}@{date}]` emits\n * `\\[src:[^\\n\\s/@]+?\\/[^\\n\\s/@]+?@[^\\n]+?\\]` so that `[src:foo/bar]`\n * is NOT matched (wrong separator count), `[src:foo/bar/extra@2026]`\n * is NOT matched (intermediate token crosses a `/` boundary), and\n * `[src:planner/main@2026-04-10]` IS matched correctly.\n *\n * - **Placeholder-bounded with whitespace separator.** Both prefix and\n * suffix are empty and the separator literal(s) between placeholders\n * contain at least one whitespace character (e.g. `{source}: {content}`,\n * `{agent} {sessionId}`). A whitespace-containing separator produces\n * output that is visually indistinguishable from ordinary prose, so the\n * safe strategy is to require a **hard bracket/paren/angle delimiter** on\n * both sides of the reconstructed match. Prose almost never places\n * `[...]` / `(...)` / `<...>` around a phrase, so this yields clean\n * false-positive rejection.\n *\n * - **Placeholder-bounded with compact (non-whitespace) separator.** Both\n * prefix and suffix are empty and the separator literal(s) contain NO\n * whitespace (e.g. `{agent}:{sessionId}`, `{agent}/{sessionId}`).\n * `formatCitation` emits a compact token like `planner:main` with no\n * surrounding delimiters, so the bracket strategy cannot detect it.\n * Instead, the pattern requires that the entire token is bordered by\n * whitespace or a bracket/paren/angle on each side:\n *\n * `(?:(?<=[\\[\\(\\<])|(?<!\\S))[\\w.-]+<sep>[\\w.-]+(?:(?=[\\]\\)\\>])|(?!\\S))`\n *\n * This accepts `planner:main` when it appears standalone or inside a\n * bracket-wrapped token, and rejects `host:80` embedded inside a URL like\n * `http://host:80` because `host` is immediately preceded by `/`\n * (non-whitespace, non-bracket).\n *\n * - **All-placeholder case (no literals between placeholders either).** No\n * reliable regex can be built — a template like `{agent}{sessionId}`\n * contains no anchor characters. Returns `null`; {@link\n * hasCitationForTemplate} treats this as \"cannot detect\" and returns\n * false, falling back on explicit sentinel/format detection only for the\n * default `[Source: ...]` shape.\n *\n * Returns `null` when the template has no placeholders (fully-literal\n * citation, handled by the string-equality fast path in {@link\n * hasCitationForTemplate}) **or** when the template is entirely placeholder-\n * only with no literal content whatsoever.\n */\nfunction templateMatcher(template: string): RegExp | null {\n // Split around all {placeholder} tokens.\n const parts = template.split(PLACEHOLDER_REGEX);\n if (parts.length <= 1) return null;\n\n const prefix = parts[0] ?? \"\";\n const suffix = parts[parts.length - 1] ?? \"\";\n\n // Normal case: at least one literal frame on the outside.\n // Tighten the per-placeholder token so it cannot consume separator\n // characters and match strings that cross separator boundaries\n // (Finding 3 — Uru3).\n if (prefix.length > 0 || suffix.length > 0) {\n const escapedPrefix = escapeRegExp(prefix);\n const escapedSuffix = escapeRegExp(suffix);\n\n // Inner parts: literal separators that sit between adjacent placeholders.\n // For `[src:{agent}/{sessionId}@{date}]`, parts = [\"[src:\", \"/\", \"@\", \"]\"]\n // so innerParts = [\"/\", \"@\"].\n const innerParts = parts.slice(1, -1);\n\n // Collect only the non-word (punctuation/symbol) characters from each\n // inner separator so alphabetic separator text (unlikely but valid) does\n // not exclude letters from the per-placeholder token pattern.\n const nonWordSepChars = new Set<string>();\n for (const sep of innerParts) {\n for (const ch of sep) {\n if (!/\\w/.test(ch)) {\n nonWordSepChars.add(ch);\n }\n }\n }\n\n // All intermediate tokens (every placeholder except the last) use the\n // combined exclusion so they cannot cross placeholder boundaries.\n //\n // The LAST token is different: it is terminated by the literal suffix anchor\n // (e.g. `\\]`), so it does not need to exclude inner-separator characters.\n // Dropping that restriction lets placeholder values that legitimately contain\n // a separator character (e.g. an ISO-8601 timestamp `2026-04-10T14:25:07Z`\n // in template `[src:{agent}:{ts}]`) be recognised correctly instead of\n // producing false-negative misses that trigger duplicate citation injection.\n //\n // Only the LAST token is relaxed. Intermediate tokens keep the combined\n // exclusion so that cross-boundary false positives are still rejected\n // (e.g. `[src:foo/bar/extra@2026-04-11]` for `[src:{a}/{b}@{c}]`).\n const interToken = buildTokenPattern(nonWordSepChars);\n // Last token: terminated by suffix anchor — exclude only newlines.\n const lastToken = buildTokenPattern(new Set<string>());\n\n // Reconstruct the interior: interToken sep interToken sep ... sep lastToken\n // (or just lastToken when there are no inner separators at all).\n const middle =\n innerParts.length === 0\n ? lastToken\n : interToken +\n innerParts\n .slice(0, -1)\n .map((sep) => escapeRegExp(sep) + interToken)\n .join(\"\") +\n escapeRegExp(innerParts[innerParts.length - 1]!) +\n lastToken;\n\n const pattern = escapedPrefix + middle + escapedSuffix;\n return new RegExp(pattern, \"i\");\n }\n\n // Placeholder-bounded case: prefix and suffix are both empty.\n const middleLiterals = parts.slice(1, -1);\n const hasNonEmptyMiddle = middleLiterals.some((p) => p.length > 0);\n if (!hasNonEmptyMiddle) {\n // All-placeholder template with no literal content. Impossible to anchor\n // reliably without sentinel markers; signal the caller.\n return null;\n }\n\n // Identifier token: one or more word chars, dots, dashes, or colons.\n // Colons are included to allow timestamp values like \"10:30\" or session\n // keys like \"agent:planner:main\" inside compact placeholder-bounded\n // templates. URL-like fragments (`http://host:80`) are still rejected\n // because the lead anchor requires whitespace or a bracket immediately\n // before the first id-token group (`http` is preceded by `/`).\n const idToken = \"[\\\\w.:-]+\";\n const body =\n idToken +\n middleLiterals.map((lit) => escapeRegExp(lit) + idToken).join(\"\");\n\n const separatorText = middleLiterals.join(\"\");\n if (/\\s/.test(separatorText)) {\n // Separator contains whitespace: the emitted citation looks like ordinary\n // prose (e.g. `planner main`). Require a hard bracket/paren/angle\n // delimiter on both sides to prevent false matches on English text.\n const opener = \"[\\\\[\\\\(\\\\<]\";\n const closer = \"[\\\\]\\\\)\\\\>]\";\n return new RegExp(opener + body + closer, \"i\");\n }\n\n // Separator is compact (no whitespace): `formatCitation` emits a token like\n // `planner:main` without surrounding delimiters. The challenge is that the\n // same token shape also matches ordinary hyphenated or slashed prose words\n // (e.g. `long-term`, `docs/setup`), causing `hasCitationForTemplate` to\n // return true on uncited fact bodies and silently suppress citation injection\n // from `attachCitation`.\n //\n // Fix (Finding 1): tighten the trail anchor so a bare compact token is only\n // accepted when it sits at the very end of the string (possibly followed by\n // optional trailing whitespace or a newline). Since `attachCitation` always\n // appends the citation at the trimmed end of the fact body, a real citation\n // token will always appear at the tail. Prose like `\"long-term solution\"`\n // has `long-term` in the middle of the string (followed by ` solution`), so\n // the end-of-string anchor rejects it — no false positive, no silent drop.\n //\n // The lead anchor still accepts either a bracket opener or a whitespace\n // boundary (or start of string), so `\"Fact. planner:main\"` and standalone\n // `\"planner:main\"` are both detected after the first attachment pass.\n //\n // Bracket-wrapped form (e.g. `[planner:main]`) is also accepted via the\n // opener/closer pair — bracket still takes precedence over end-of-string.\n //\n // Example — why `http://host:80` does NOT match:\n // Trying to match `host:80`: the char before `h` is `/` (non-whitespace,\n // non-bracket), so `(?<=[\\[\\(\\<])` and `(?<!\\S)` both fail ⟹ no match.\n // Trying to match `http:...`: after `http:` the next chars are `//` which\n // are not `[\\w.-]+`, so the second id-token group fails ⟹ no match.\n const leadAnchor = \"(?:(?<=[\\\\[\\\\(\\\\<])|(?<!\\\\S))\";\n // Trail: either a bracket closer (for `[token]` shape) or end-of-string\n // optionally preceded by whitespace. The `(?!\\S)` is deliberately removed\n // so that a compact token in the MIDDLE of a sentence does not match.\n const trailAnchor = \"(?:(?=[\\\\]\\\\)\\\\>])|(?=\\\\s*$))\";\n return new RegExp(leadAnchor + body + trailAnchor, \"i\");\n}\n\n/**\n * Returns true if `text` already carries a citation produced by `template`\n * **or** by the default `[Source: ...]` format (for facts that were tagged\n * before a config change).\n *\n * Use this instead of {@link hasCitation} whenever the caller has access to\n * the configured `inlineSourceAttributionFormat`.\n *\n * All-placeholder templates such as `{agent}{sessionId}` have no literal\n * content to anchor on and therefore cannot be reliably detected without\n * dedicated sentinel markers. In that case the function returns `false` —\n * callers that need idempotent dedup for such templates should either adopt\n * a template with literal delimiters (recommended) or rely on the default\n * `[Source: ...]` marker detection which is always available via\n * {@link hasCitation}.\n */\nexport function hasCitationForTemplate(text: string, template: string): boolean {\n if (typeof text !== \"string\" || text.length === 0) return false;\n // Always accept the default format as a fallback so facts tagged before a\n // configuration change are not double-tagged on reprocessing.\n if (hasCitation(text)) return true;\n // If the configured template matches the default, we're done.\n //\n // Known limitation (Thread 2 — Codex P2): this fast path exits without\n // checking whether the content carries a citation from a DIFFERENT custom\n // template that was active before the config was changed back to the default.\n // Such a fact would be detected by `hasCitation` above only if the prior\n // custom template happened to match the default `[Source: ...]` pattern.\n // In practice, template changes mid-stream are rare, and the false-negative\n // (missing an old custom citation) produces a benign duplicate citation rather\n // than data loss. A full fix would require storing the citation template used\n // at write time in the frontmatter and checking that here.\n if (template === DEFAULT_CITATION_FORMAT) return false;\n\n // Fully-literal template (no placeholders): exact inclusion check.\n if (!PLACEHOLDER_REGEX.test(template)) {\n // Reset lastIndex because PLACEHOLDER_REGEX is declared with /g.\n PLACEHOLDER_REGEX.lastIndex = 0;\n return text.includes(template);\n }\n // Reset lastIndex after the .test() probe above.\n PLACEHOLDER_REGEX.lastIndex = 0;\n\n const matcher = templateMatcher(template);\n if (!matcher) {\n // All-placeholder template: cannot build a reliable matcher. See the\n // docstring — callers should not rely on dedup for this shape.\n return false;\n }\n return matcher.test(text);\n}\n\n/**\n * Return the LAST citation marker in `text` for the given template (or the\n * default `[Source: ...]` shape). `attachCitation` always appends at the\n * trimmed end, so the last occurrence is the most recently attached marker —\n * callers use this to lift a just-attached citation off a cited body and\n * re-attach it to a derived body (the merged-target commit path). Returns\n * null when the text carries no marker of this template (including\n * all-placeholder templates that cannot be matched reliably).\n */\nexport function lastCitationMarkerForTemplate(\n text: string,\n template: string = DEFAULT_CITATION_FORMAT,\n): string | null {\n if (typeof text !== \"string\" || text.length === 0) return null;\n let matcher: RegExp | null;\n if (template === DEFAULT_CITATION_FORMAT) {\n matcher = defaultCitationMatcher();\n } else if (!PLACEHOLDER_REGEX.test(template)) {\n // Fully-literal template: presence is exact inclusion (no placeholders\n // to widen the match).\n PLACEHOLDER_REGEX.lastIndex = 0;\n return text.includes(template) ? template : null;\n } else {\n PLACEHOLDER_REGEX.lastIndex = 0;\n matcher = templateMatcher(template);\n }\n if (!matcher) return null;\n const global = new RegExp(\n matcher.source,\n matcher.flags.includes(\"g\") ? matcher.flags : matcher.flags + \"g\",\n );\n let last: string | null = null;\n for (let match = global.exec(text); match !== null; match = global.exec(text)) {\n last = match[0];\n if (match[0].length === 0) global.lastIndex++;\n }\n return last;\n}\n\n/**\n * Attach an inline citation to fact text.\n *\n * If the text already has a citation — either the default `[Source: ...]`\n * marker or one produced by the configured template — it is returned unchanged.\n * Existing provenance is respected and never overwritten. Otherwise the\n * citation is appended to the trimmed text with a single space separator,\n * which keeps the marker visually adjacent to the fact body.\n */\nexport function attachCitation(\n text: string,\n ctx: CitationContext,\n template: string = DEFAULT_CITATION_FORMAT,\n): string {\n if (typeof text !== \"string\") return text as unknown as string;\n if (hasCitationForTemplate(text, template)) return text;\n const trimmedEnd = trimTrailingWhitespace(text);\n if (trimmedEnd.length === 0) return text;\n const citation = formatCitation(ctx, template);\n // Preserve any trailing newline that callers rely on for markdown rendering.\n const trailing = text.slice(trimmedEnd.length);\n return `${trimmedEnd} ${citation}${trailing}`;\n}\n\n/**\n * Parse a single inline citation from a piece of text. Returns the first\n * citation encountered or `null` when none is present. Malformed citations\n * do not throw — fields that cannot be parsed simply remain `undefined`.\n */\nexport function parseCitation(text: string): ParsedCitation | null {\n if (typeof text !== \"string\" || text.length === 0) return null;\n const matcher = defaultCitationMatcher();\n const match = matcher.exec(text);\n if (!match) return null;\n\n const body = match[1] ?? \"\";\n const raw = match[0] ?? \"\";\n const parsed: ParsedCitation = { raw };\n\n const fields = body\n .split(\",\")\n .map((segment) => segment.trim())\n .filter((segment) => segment.length > 0);\n\n for (const field of fields) {\n const eqIdx = field.indexOf(\"=\");\n if (eqIdx <= 0) continue;\n const key = field.slice(0, eqIdx).trim().toLowerCase();\n const value = field.slice(eqIdx + 1).trim();\n if (value.length === 0) continue;\n switch (key) {\n case \"agent\":\n parsed.agent = value;\n break;\n case \"session\":\n case \"sessionid\":\n parsed.session = value;\n break;\n case \"ts\":\n case \"timestamp\":\n parsed.ts = value;\n break;\n default:\n // Unknown fields are ignored defensively so human edits never crash.\n break;\n }\n }\n\n return parsed;\n}\n\n/**\n * Parse every citation embedded in the text. Always returns an array; empty\n * when none are present.\n */\nexport function parseAllCitations(text: string): ParsedCitation[] {\n if (typeof text !== \"string\" || text.length === 0) return [];\n const matcher = defaultCitationMatcher();\n const results: ParsedCitation[] = [];\n let match: RegExpExecArray | null;\n while ((match = matcher.exec(text)) !== null) {\n const parsed = parseCitation(match[0]);\n if (parsed) results.push(parsed);\n }\n return results;\n}\n\n/**\n * Remove all inline citations from a piece of text.\n *\n * Callers that want the raw fact body (for dedup hashing, display, or\n * comparison) should use this helper instead of hand-rolled regexes so the\n * whole codebase agrees on the citation syntax.\n *\n * Finding 2 fix: when the input contains no citation marker, the input is\n * returned byte-for-byte unchanged. When a citation IS removed, whitespace\n * normalization is applied only at each join seam (the single space between\n * the preceding text and where the citation was), rather than across the\n * entire string. This preserves markdown hard-break spacing, aligned text,\n * and code-like snippets in fact bodies that happen to carry a citation.\n *\n * Implementation: each citation match is replaced by its \"seam fix\" — the\n * content before the match has its trailing whitespace trimmed and then a\n * single space is appended if any text remains, collapsing only the gap\n * left by the removed marker. Whitespace elsewhere in the body is untouched.\n */\nexport function stripCitation(text: string): string {\n if (typeof text !== \"string\" || text.length === 0) return text;\n // Early exit: no citation marker present — return the input unchanged so\n // that callers never lose formatting fidelity on uncited strings.\n if (!hasCitation(text)) return text;\n\n // Walk through all citations and slice them out one by one so that we can\n // normalise ONLY the whitespace at each seam rather than the entire string.\n const matcher = defaultCitationMatcher();\n let result = \"\";\n let lastIndex = 0;\n\n let match: RegExpExecArray | null;\n while ((match = matcher.exec(text)) !== null) {\n // Text before this citation. Trim trailing spaces/tabs at the seam only.\n const before = text.slice(lastIndex, match.index).replace(/[ \\t]+$/, \"\");\n result += before;\n lastIndex = match.index + match[0].length;\n }\n\n // Append any trailing text after the last citation. Trim leading\n // spaces/tabs and trailing whitespace at the join seam.\n const after = text.slice(lastIndex).replace(/^[ \\t]+/, \"\");\n if (after.length > 0) {\n if (result.length > 0) result += \" \";\n result += after;\n }\n\n return result.trimEnd();\n}\n\n/**\n * Strip an inline citation from text using a specific template regex.\n *\n * This is the template-aware counterpart to {@link stripCitation}. When the\n * caller holds the configured `inlineSourceAttributionFormat`, use this\n * function to strip citations produced by that template — including custom\n * templates that differ from the default `[Source: ...]` pattern.\n *\n * Behaviour:\n * - If the text has a **default-format** citation, strips it first\n * (always safe).\n * - Then, if the result has a **custom-template** citation detected by\n * `hasCitationForTemplate`, builds the template regex and removes every\n * occurrence. BOTH passes run when a body carries both forms — a target\n * written under the default format can carry the default marker plus a\n * custom marker appended after a config change; returning after the\n * default pass alone left the custom marker inside hash inputs (#2330).\n * - All-placeholder templates (no literal prefix/suffix/separator) cannot\n * produce a reliable matcher. `hasCitationForTemplate` already returns\n * `false` for such templates, so this function never attempts to strip an\n * undetectable citation. The text is returned unchanged when no citation\n * is detected.\n * - If no citation is detected for the given template, returns the text\n * unchanged.\n *\n * @returns The stripped text (or the original text when no citation is found).\n */\nexport function stripCitationForTemplate(\n text: string,\n template: string,\n): string {\n if (typeof text !== \"string\" || text.length === 0) return text;\n\n // First pass: the default-format marker, if any. A second pass below still\n // runs — a body can carry the default marker AND the custom template's\n // marker, and canonicalization must remove every recognized form.\n const afterDefault = hasCitation(text) ? stripCitation(text) : text;\n\n if (!hasCitationForTemplate(afterDefault, template)) return afterDefault;\n\n // Build the template matcher. hasCitationForTemplate already returned true,\n // which means templateMatcher produced a non-null result. The null branch\n // here is a defensive fallback only — the default pass already ran.\n const matcher = templateMatcher(template);\n if (!matcher) return afterDefault;\n\n // The matcher regex was built without the global flag; add it for exec loop.\n const globalMatcher = new RegExp(\n matcher.source,\n matcher.flags.includes(\"g\") ? matcher.flags : matcher.flags + \"g\",\n );\n let result = \"\";\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = globalMatcher.exec(afterDefault)) !== null) {\n const matchEnd = match.index + match[0].length;\n const enclosure = enclosingDelimiterRange(afterDefault, match.index, matchEnd);\n const removalStart = enclosure?.start ?? match.index;\n const removalEnd = enclosure?.end ?? matchEnd;\n const before = afterDefault.slice(lastIndex, removalStart).replace(/[ \\t]+$/, \"\");\n result += before;\n lastIndex = removalEnd;\n // Guard against zero-width matches causing an infinite loop.\n if (match[0].length === 0) {\n globalMatcher.lastIndex++;\n }\n }\n\n const after = afterDefault.slice(lastIndex).replace(/^[ \\t]+/, \"\");\n if (after.length > 0) {\n if (result.length > 0) result += \" \";\n result += after;\n }\n\n return result.trimEnd();\n}\n\nfunction enclosingDelimiterRange(\n text: string,\n start: number,\n end: number,\n): { start: number; end: number } | undefined {\n if (start <= 0 || end >= text.length) return undefined;\n const opener = text[start - 1];\n const closer = text[end];\n if (\n (opener === \"[\" && closer === \"]\") ||\n (opener === \"(\" && closer === \")\") ||\n (opener === \"<\" && closer === \">\")\n ) {\n return { start: start - 1, end: end + 1 };\n }\n return undefined;\n}\n"],"mappings":";AAkCO,IAAM,0BACX;AAGK,IAAM,mBAAmB;AAkChC,SAAS,yBAAiC;AAKxC,SAAO;AACT;AAOA,SAAS,uBAAuB,MAAsB;AACpD,MAAI,MAAM,KAAK;AACf,SAAO,MAAM,KAAK,MAAM,KAAK,KAAK,MAAM,CAAC,CAAE,EAAG;AAC9C,SAAO,KAAK,MAAM,GAAG,GAAG;AAC1B;AAMO,SAAS,gBAAgB,SAAiD;AAC/E,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,UAAU,QAAQ,KAAK;AAC7B,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,QAAQ,QAAQ,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC;AAC3D,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,SAAO,MAAM,MAAM,SAAS,CAAC;AAC/B;AAcO,SAAS,eACd,KACA,WAAmB,yBACX;AACR,QAAM,UAAU,IAAI,WAAW;AAC/B,QAAM,YAAY,IAAI,aAAa,gBAAgB,OAAO,KAAK;AAC/D,QAAM,KAAK,IAAI,MAAM;AACrB,QAAM,QAAQ,IAAI,SAAS,IAAI,MAAM,KAAK,EAAE,SAAS,IAAI,IAAI,QAAQ;AACrE,QAAM,OAAO,MAAM,OAAO,mBAAmB,GAAG,MAAM,GAAG,EAAE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,eAAe,WAAW,SAAS,MAAM;AAC/C,UAAM,aAAa,WAAW,OAAO;AACrC,UAAM,SAAS,aAAa,MAAM,WAAW,YAAY,EAAE,QAAQ,WAAW,EAAE;AAChF,cAAU;AACV,gBAAY;AAEZ,QAAI,MAAM,CAAC,EAAE,WAAW,GAAG;AACzB,oBAAc;AAAA,IAChB;AAAA,EACF;AAEA,QAAM,QAAQ,aAAa,MAAM,SAAS,EAAE,QAAQ,WAAW,EAAE;AACjE,MAAI,MAAM,SAAS,GAAG;AACpB,QAAI,OAAO,SAAS,EAAG,WAAU;AACjC,cAAU;AAAA,EACZ;AAEA,SAAO,OAAO,QAAQ;AACxB;AAEA,SAAS,wBACP,MACA,OACA,KAC4C;AAC5C,MAAI,SAAS,KAAK,OAAO,KAAK,OAAQ,QAAO;AAC7C,QAAM,SAAS,KAAK,QAAQ,CAAC;AAC7B,QAAM,SAAS,KAAK,GAAG;AACvB,MACG,WAAW,OAAO,WAAW,OAC7B,WAAW,OAAO,WAAW,OAC7B,WAAW,OAAO,WAAW,KAC9B;AACA,WAAO,EAAE,OAAO,QAAQ,GAAG,KAAK,MAAM,EAAE;AAAA,EAC1C;AACA,SAAO;AACT;","names":[]}
@@ -1,10 +1,10 @@
1
+ import {
2
+ scanMemoryDir
3
+ } from "./chunk-4O6WRBGE.js";
1
4
  import {
2
5
  isSearchAborted,
3
6
  throwIfSearchAborted
4
7
  } from "./chunk-GUMZC2BO.js";
5
- import {
6
- scanMemoryDir
7
- } from "./chunk-W7IGLX4G.js";
8
8
  import {
9
9
  reportSearchDegradation,
10
10
  resolveEnsureCollectionArgs
@@ -776,4 +776,4 @@ export {
776
776
  resolveOramaCollectionDbFilePath,
777
777
  OramaBackend
778
778
  };
779
- //# sourceMappingURL=chunk-XZBXINXZ.js.map
779
+ //# sourceMappingURL=chunk-TNSCIPBQ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isNamespaceKind
3
- } from "./chunk-GGYDJJBO.js";
3
+ } from "./chunk-QOOBICJF.js";
4
4
  import {
5
5
  EngramAccessInputError
6
6
  } from "./chunk-2Z24E5W2.js";
@@ -40,4 +40,4 @@ export {
40
40
  positiveIntQueryParam,
41
41
  optionalNamespaceKindQueryParam
42
42
  };
43
- //# sourceMappingURL=chunk-S37NN23M.js.map
43
+ //# sourceMappingURL=chunk-TVEONGBU.js.map
@@ -6,13 +6,13 @@ import {
6
6
  import {
7
7
  DEFAULT_CITATION_FORMAT,
8
8
  stripCitationForTemplate
9
- } from "./chunk-J6A3CX5N.js";
9
+ } from "./chunk-TG3FAM2S.js";
10
10
  import {
11
11
  inferMemoryStatus
12
12
  } from "./chunk-7RJUVTVF.js";
13
13
  import {
14
14
  ContentHashIndex
15
- } from "./chunk-TVW4C7PV.js";
15
+ } from "./chunk-NB3LRY4T.js";
16
16
  import {
17
17
  computeLegacyContentHash,
18
18
  normalizeLegacyContent
@@ -293,4 +293,4 @@ export {
293
293
  buildReconcileManifest,
294
294
  collapseActiveFactDuplicates
295
295
  };
296
- //# sourceMappingURL=chunk-5RPMTFB6.js.map
296
+ //# sourceMappingURL=chunk-TWF35IC6.js.map
@@ -2,7 +2,7 @@ import {
2
2
  WHO_KNOWS_DEFAULT_LIMIT,
3
3
  WHO_KNOWS_MAX_LIMIT,
4
4
  validateWhoKnowsInput
5
- } from "./chunk-R7LY4YKF.js";
5
+ } from "./chunk-2EKJDQZB.js";
6
6
 
7
7
  // src/who-knows-cli.ts
8
8
  function extractWhoKnowsRawArgs(rest) {
@@ -74,4 +74,4 @@ export {
74
74
  renderWhoKnowsText,
75
75
  renderWhoKnows
76
76
  };
77
- //# sourceMappingURL=chunk-BZTJEILZ.js.map
77
+ //# sourceMappingURL=chunk-U6N5IBVY.js.map
@@ -5,7 +5,7 @@ import {
5
5
  rejectSymlinkPath,
6
6
  renderFrontmatter,
7
7
  writeBundleFile
8
- } from "./chunk-CASWJ2HM.js";
8
+ } from "./chunk-46ZPIGWI.js";
9
9
  import {
10
10
  parseOaiMemCitation
11
11
  } from "./chunk-D24OXEPB.js";
@@ -16,7 +16,7 @@ import {
16
16
  OKF_PROFILE_TYPE,
17
17
  StorageManager,
18
18
  okfTypeForMemory
19
- } from "./chunk-OGTKQ5MJ.js";
19
+ } from "./chunk-XSGUMQQQ.js";
20
20
  import {
21
21
  normalizeProjectionPreview
22
22
  } from "./chunk-SCU65EZI.js";
@@ -270,4 +270,4 @@ export {
270
270
  exportOkfBundle,
271
271
  firstHeading
272
272
  };
273
- //# sourceMappingURL=chunk-7TUB6JWA.js.map
273
+ //# sourceMappingURL=chunk-UCKYTA2T.js.map
@@ -1,3 +1,6 @@
1
+ import {
2
+ startLocationAutoSync
3
+ } from "./chunk-H4SEGIZY.js";
1
4
  import {
2
5
  ensureContradictionScanCron,
3
6
  ensureDaySummaryCron,
@@ -7,19 +10,16 @@ import {
7
10
  ensureProceduralMiningCron,
8
11
  graphEdgeDecayCadenceToCronExpr
9
12
  } from "./chunk-666A3MOW.js";
10
- import {
11
- startLocationAutoSync
12
- } from "./chunk-4HYNMLT6.js";
13
13
  import {
14
14
  rebuildMemoryLifecycleLedger
15
- } from "./chunk-DP4EBV7C.js";
15
+ } from "./chunk-WMLEPWMO.js";
16
16
  import {
17
17
  planNamespaceMaintenance,
18
18
  runNamespaceMaintenanceBatchPlan
19
- } from "./chunk-3LADWWMA.js";
19
+ } from "./chunk-SJDQ5RSN.js";
20
20
  import {
21
21
  rebuildMemoryProjection
22
- } from "./chunk-DK6GMO6D.js";
22
+ } from "./chunk-JEC4DVM3.js";
23
23
  import {
24
24
  validateActivityBaseUrl
25
25
  } from "./chunk-OGUKSLYZ.js";
@@ -37,7 +37,7 @@ import {
37
37
  drainPendingLifecycleLedgerIfAny,
38
38
  pendingLifecycleLedgerDir,
39
39
  readProjectionRebuiltAt
40
- } from "./chunk-JRRQ747T.js";
40
+ } from "./chunk-TBXAY2SS.js";
41
41
  import {
42
42
  displayErrorDetail,
43
43
  openBetterSqlite3
@@ -45,7 +45,7 @@ import {
45
45
  import {
46
46
  assertPathInsideRoot,
47
47
  listContainedSpillFiles
48
- } from "./chunk-GCASGYIO.js";
48
+ } from "./chunk-C7HJ3NEI.js";
49
49
  import {
50
50
  isSafeRouteNamespace
51
51
  } from "./chunk-PCXDUHQH.js";
@@ -65,10 +65,10 @@ import {
65
65
  import {
66
66
  SECURE_STORE_ENVELOPE_OVERHEAD_BYTES,
67
67
  probeEncryptedRegularFileHeader
68
- } from "./chunk-ET2CNMLD.js";
68
+ } from "./chunk-JN72EPOE.js";
69
69
  import {
70
70
  isErrnoCode
71
- } from "./chunk-5UZXUTVO.js";
71
+ } from "./chunk-KNA3BXXL.js";
72
72
  import {
73
73
  log
74
74
  } from "./chunk-3WCASNQZ.js";
@@ -1729,4 +1729,4 @@ export {
1729
1729
  ActivitySyncScheduler,
1730
1730
  MaintenanceScheduler
1731
1731
  };
1732
- //# sourceMappingURL=chunk-PPOT6SPR.js.map
1732
+ //# sourceMappingURL=chunk-UNNPNBR2.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-WEHSQBFR.js";
7
7
  import {
8
8
  encryptCapsuleFile
9
- } from "./chunk-X7Y7WX73.js";
9
+ } from "./chunk-DQEMWVMT.js";
10
10
  import {
11
11
  CAPSULE_SCHEMA_VERSION,
12
12
  EXPORT_FORMAT
@@ -261,4 +261,4 @@ export {
261
261
  exportCapsule,
262
262
  isValidCapsuleSince
263
263
  };
264
- //# sourceMappingURL=chunk-KQAFEZQX.js.map
264
+ //# sourceMappingURL=chunk-VDX2J7OX.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createVersion
3
- } from "./chunk-U62OK7BB.js";
3
+ } from "./chunk-JPKK466T.js";
4
4
  import {
5
5
  bumpMemoryCorpusVersionForDir
6
6
  } from "./chunk-XCB6QDL6.js";
@@ -12,14 +12,14 @@ import {
12
12
  repairContentAfterJournalMove,
13
13
  requestEntityCanonicalIdReconcile,
14
14
  withRawEntityPageMutation
15
- } from "./chunk-NNZFPYYX.js";
15
+ } from "./chunk-R7QY5ZVB.js";
16
16
  import {
17
17
  parseExportBundle
18
18
  } from "./chunk-WEHSQBFR.js";
19
19
  import {
20
20
  decryptCapsuleFileInMemory,
21
21
  isEncryptedCapsuleFile
22
- } from "./chunk-X7Y7WX73.js";
22
+ } from "./chunk-DQEMWVMT.js";
23
23
  import {
24
24
  assertIsDirectoryNotSymlink,
25
25
  assertRealpathInsideRoot,
@@ -294,4 +294,4 @@ function mintForkId(capsuleId, originalId, now) {
294
294
  export {
295
295
  importCapsule
296
296
  };
297
- //# sourceMappingURL=chunk-J2R275FN.js.map
297
+ //# sourceMappingURL=chunk-VVX5PZFS.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ContentHashIndex
3
- } from "./chunk-TVW4C7PV.js";
3
+ } from "./chunk-NB3LRY4T.js";
4
4
  import {
5
5
  sanitizeMemoryContent
6
6
  } from "./chunk-5GKPFL3S.js";
@@ -164,4 +164,4 @@ export {
164
164
  PROMOTION_CANDIDATES_MCP_TOOLS,
165
165
  backfillMemorySubjects
166
166
  };
167
- //# sourceMappingURL=chunk-ME35HVDJ.js.map
167
+ //# sourceMappingURL=chunk-VYCOJKSX.js.map
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-5JMAGU26.js";
6
6
  import {
7
7
  runPostConsolidationMaterialize
8
- } from "./chunk-X33MJFD2.js";
8
+ } from "./chunk-KAXCYM66.js";
9
9
  import {
10
10
  isSemanticConsolidationLlmOperator
11
11
  } from "./chunk-G7D6GZ5J.js";
@@ -220,4 +220,4 @@ export {
220
220
  buildExtensionsBlockForConsolidation,
221
221
  materializeAfterSemanticConsolidation
222
222
  };
223
- //# sourceMappingURL=chunk-F5UWQ4LX.js.map
223
+ //# sourceMappingURL=chunk-W24T5YMW.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readUtilityTelemetryEvents,
3
3
  resolveUtilityTelemetryDir
4
- } from "./chunk-6FC3IZ26.js";
4
+ } from "./chunk-EBA5DA77.js";
5
5
  import {
6
6
  clamp01
7
7
  } from "./chunk-TBBDFYXW.js";
@@ -266,4 +266,4 @@ export {
266
266
  learnUtilityPromotionWeights,
267
267
  getUtilityLearningStatus
268
268
  };
269
- //# sourceMappingURL=chunk-HDQUQBPW.js.map
269
+ //# sourceMappingURL=chunk-W3K3HITK.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WORK_ID_PATTERN,
3
3
  WorkStorage
4
- } from "./chunk-GDB4J2H3.js";
4
+ } from "./chunk-MPC7TYTZ.js";
5
5
 
6
6
  // src/work/board.ts
7
7
  var BOARD_STATUS_ORDER = [
@@ -266,4 +266,4 @@ export {
266
266
  exportWorkBoardMarkdown,
267
267
  importWorkBoardSnapshot
268
268
  };
269
- //# sourceMappingURL=chunk-GDASG7NC.js.map
269
+ //# sourceMappingURL=chunk-W4F3C7N7.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-OGTKQ5MJ.js";
3
+ } from "./chunk-XSGUMQQQ.js";
4
4
  import {
5
5
  normalizeEntityName
6
6
  } from "./chunk-YXZG5TVN.js";
@@ -10,12 +10,12 @@ import {
10
10
  import {
11
11
  extractJsonCandidates
12
12
  } from "./chunk-RGMVMVMF.js";
13
- import {
14
- excludeSupportPassportPrivateMemories
15
- } from "./chunk-EEOUMG3J.js";
16
13
  import {
17
14
  serializeMutations
18
15
  } from "./chunk-FFAZ2XFU.js";
16
+ import {
17
+ excludeSupportPassportPrivateMemories
18
+ } from "./chunk-EEOUMG3J.js";
19
19
  import {
20
20
  readEnvVar,
21
21
  resolveHomeDir
@@ -957,4 +957,4 @@ export {
957
957
  resolveBriefingSaveDir,
958
958
  briefingFilename
959
959
  };
960
- //# sourceMappingURL=chunk-LFK623SF.js.map
960
+ //# sourceMappingURL=chunk-WJHGDE7X.js.map