@remnic/core 9.69.44 → 9.69.45

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 (482) hide show
  1. package/dist/access-admin-ops-surface.d.ts +14 -14
  2. package/dist/access-admin-ops-surface.js +22 -22
  3. package/dist/access-authorization-probe.d.ts +14 -14
  4. package/dist/access-authorization-probe.js +23 -23
  5. package/dist/access-boundary.d.ts +14 -14
  6. package/dist/access-boundary.js +22 -22
  7. package/dist/access-cli.js +65 -63
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +1 -1
  10. package/dist/access-extraction-force-flush.d.ts +14 -14
  11. package/dist/access-extraction-force-flush.js +22 -22
  12. package/dist/access-health-types.d.ts +1 -1
  13. package/dist/access-http-briefing.d.ts +14 -14
  14. package/dist/access-http-briefing.js +23 -23
  15. package/dist/access-http-lcm-compaction.d.ts +14 -14
  16. package/dist/access-http-lifecycle-flush.d.ts +14 -14
  17. package/dist/access-http-offline-stream.d.ts +14 -14
  18. package/dist/access-http-query.d.ts +2 -2
  19. package/dist/access-http-query.js +24 -24
  20. package/dist/access-http.d.ts +15 -15
  21. package/dist/access-http.js +37 -37
  22. package/dist/access-identity-continuity-surface.d.ts +11 -11
  23. package/dist/access-identity-continuity-surface.js +22 -22
  24. package/dist/access-lcm-surface.d.ts +14 -14
  25. package/dist/access-lcm-surface.js +22 -22
  26. package/dist/access-mcp-shared-context-tools.d.ts +14 -14
  27. package/dist/access-mcp.d.ts +14 -14
  28. package/dist/access-mcp.js +30 -30
  29. package/dist/access-memory-search-fanout.d.ts +2 -2
  30. package/dist/{access-namespace-preflight-CE-RrXKu.d.ts → access-namespace-preflight-DDnsN22V.d.ts} +1 -1
  31. package/dist/access-namespace-preflight.d.ts +3 -3
  32. package/dist/access-namespace-preflight.js +22 -22
  33. package/dist/access-observe-transcript.d.ts +11 -11
  34. package/dist/access-observe-write-category.d.ts +3 -3
  35. package/dist/access-observe-write-surface.d.ts +14 -14
  36. package/dist/access-observe-write-surface.js +22 -22
  37. package/dist/access-offline-manifest.d.ts +11 -11
  38. package/dist/access-offline-manifest.js +3 -3
  39. package/dist/access-operations-batch.js +23 -23
  40. package/dist/access-operations.d.ts +14 -14
  41. package/dist/access-operations.js +29 -29
  42. package/dist/access-recall-concurrency.d.ts +14 -14
  43. package/dist/access-recall-concurrency.js +22 -22
  44. package/dist/access-recall-response.d.ts +14 -14
  45. package/dist/access-recall-response.js +22 -22
  46. package/dist/access-recall-surface.d.ts +14 -14
  47. package/dist/access-recall-surface.js +22 -22
  48. package/dist/access-schema.d.ts +114 -114
  49. package/dist/{access-service-Cww3xAAy.d.ts → access-service-CDteK_Gt.d.ts} +73 -73
  50. package/dist/access-service-helpers.d.ts +14 -14
  51. package/dist/access-service.d.ts +14 -14
  52. package/dist/access-service.js +22 -22
  53. package/dist/access-surface-catalog.d.ts +14 -14
  54. package/dist/access-surface-catalog.js +24 -24
  55. package/dist/access-wearables-meetings-surface.d.ts +4 -4
  56. package/dist/action-confidence.d.ts +1 -1
  57. package/dist/active-memory-bridge.d.ts +1 -1
  58. package/dist/active-recall.d.ts +1 -1
  59. package/dist/activity/digest.d.ts +1 -1
  60. package/dist/ambient-provenance.d.ts +1 -1
  61. package/dist/artifact-search.d.ts +1 -1
  62. package/dist/{auto-sync-QZD4RD6H.js → auto-sync-DG5KEOF5.js} +5 -5
  63. package/dist/background-generation.d.ts +1 -1
  64. package/dist/behavior-learner.d.ts +1 -1
  65. package/dist/behavior-signals.d.ts +1 -1
  66. package/dist/bootstrap.d.ts +11 -11
  67. package/dist/briefing-window.d.ts +2 -2
  68. package/dist/briefing.d.ts +2 -2
  69. package/dist/briefing.js +6 -6
  70. package/dist/buffer-surprise-report.d.ts +1 -1
  71. package/dist/buffer-turn-helpers.d.ts +1 -1
  72. package/dist/buffer.d.ts +2 -2
  73. package/dist/buffer.js +3 -3
  74. package/dist/bulk-import/index.d.ts +3 -3
  75. package/dist/calibration.d.ts +1 -1
  76. package/dist/calibration.js +2 -2
  77. package/dist/capabilities.d.ts +1 -1
  78. package/dist/{catalog-Ya3DDn_T.d.ts → catalog-Dl2hYqpS.d.ts} +1 -1
  79. package/dist/causal-behavior.d.ts +1 -1
  80. package/dist/causal-consolidation.d.ts +1 -1
  81. package/dist/causal-consolidation.js +7 -7
  82. package/dist/causal-trajectory-graph.d.ts +1 -1
  83. package/dist/{chunk-BZDK5EOD.js → chunk-2LRO73MN.js} +2 -2
  84. package/dist/{chunk-JDL5BYYF.js → chunk-46A4RGBC.js} +2 -2
  85. package/dist/{chunk-6EGIQEKC.js → chunk-4HTQ76O4.js} +2 -2
  86. package/dist/{chunk-7L54ARML.js → chunk-4XTSKGLX.js} +2 -2
  87. package/dist/{chunk-IOTYIECA.js → chunk-5TKHJ5RW.js} +11 -11
  88. package/dist/{chunk-ZVQ5HF77.js → chunk-5XTILJRI.js} +2 -2
  89. package/dist/{chunk-J2MGTGKC.js → chunk-5ZXGH2ZL.js} +20 -3
  90. package/dist/chunk-5ZXGH2ZL.js.map +1 -0
  91. package/dist/{chunk-VJXMFBVR.js → chunk-6II55MXS.js} +2 -2
  92. package/dist/{chunk-K3IVJ5ML.js → chunk-7LKXP4QG.js} +17 -17
  93. package/dist/{chunk-PF7LQ22G.js → chunk-A2YN3FR4.js} +3 -3
  94. package/dist/chunk-AAQA6ZUP.js +41 -0
  95. package/dist/chunk-AAQA6ZUP.js.map +1 -0
  96. package/dist/{chunk-RJ7Z7YXK.js → chunk-AG6PANBG.js} +14 -20
  97. package/dist/chunk-AG6PANBG.js.map +1 -0
  98. package/dist/{chunk-KDLOKVX7.js → chunk-AOMUIF3R.js} +2 -2
  99. package/dist/{chunk-2YIUUXNK.js → chunk-B55FYF6F.js} +2 -2
  100. package/dist/{chunk-2HDLDBJW.js → chunk-BOWAP64Q.js} +2 -2
  101. package/dist/{chunk-SUS64JER.js → chunk-C3MCMFNV.js} +2 -2
  102. package/dist/{chunk-DABSYX7V.js → chunk-D3DJYGU2.js} +3 -3
  103. package/dist/{chunk-F2FJTOV6.js → chunk-DO6R3LIE.js} +2 -2
  104. package/dist/{chunk-LD22AAJI.js → chunk-DSHSQGSN.js} +2 -2
  105. package/dist/{chunk-3254BYQV.js → chunk-E5VOKZQV.js} +1 -1
  106. package/dist/{chunk-46FVFU7S.js → chunk-EC5SVM6H.js} +2 -2
  107. package/dist/{chunk-UHSOPTNB.js → chunk-EP6BA7VV.js} +50 -15
  108. package/dist/chunk-EP6BA7VV.js.map +1 -0
  109. package/dist/{chunk-BPXJINHW.js → chunk-EUP4AXIW.js} +2 -2
  110. package/dist/{chunk-WJPR2XUN.js → chunk-F6AYWLRN.js} +2 -2
  111. package/dist/{chunk-4AX5OYKC.js → chunk-FDDCZDBI.js} +2 -2
  112. package/dist/{chunk-VHANUT45.js → chunk-HBGSZ62Z.js} +7 -7
  113. package/dist/{chunk-XLPZN3A5.js → chunk-HVGCQMTQ.js} +2 -2
  114. package/dist/{chunk-GMU7MAHS.js → chunk-IAT5WFEU.js} +3 -3
  115. package/dist/{chunk-R3H2AXO2.js → chunk-IFULZYYQ.js} +2 -2
  116. package/dist/{chunk-ZYSOT6HD.js → chunk-J3IWHCMF.js} +2 -2
  117. package/dist/{chunk-QCTXQ2HW.js → chunk-J6NEOCQC.js} +2 -2
  118. package/dist/{chunk-H2N6SLTR.js → chunk-JIWZVOQM.js} +2 -2
  119. package/dist/{chunk-HKQAI6XI.js → chunk-JPNUKKSL.js} +2 -2
  120. package/dist/{chunk-F6PTJLEM.js → chunk-K4KE5MYE.js} +1 -1
  121. package/dist/{chunk-5AJZ7EUW.js → chunk-K75H7FSO.js} +2 -2
  122. package/dist/{chunk-JL4TQYM5.js → chunk-L272A5QW.js} +33 -2
  123. package/dist/{chunk-JL4TQYM5.js.map → chunk-L272A5QW.js.map} +1 -1
  124. package/dist/{chunk-7F47R4H4.js → chunk-LZAJONO5.js} +2 -2
  125. package/dist/{chunk-OCX7OWOC.js → chunk-M7ECD3KN.js} +2 -2
  126. package/dist/{chunk-KORQWGUA.js → chunk-MDYZCPNQ.js} +2 -2
  127. package/dist/{chunk-IWHNT35B.js → chunk-N6I257OM.js} +3 -3
  128. package/dist/{chunk-YR5QT4SR.js → chunk-NAFPHFDM.js} +2 -2
  129. package/dist/{chunk-D7UUB33A.js → chunk-NGAFYIHQ.js} +2 -2
  130. package/dist/{chunk-3K64PLY3.js → chunk-NKDQXDFL.js} +14 -14
  131. package/dist/{chunk-ZBSP4BSN.js → chunk-NRFUYVW7.js} +2 -2
  132. package/dist/{chunk-XOCGC3FJ.js → chunk-OFBJD3V5.js} +2 -2
  133. package/dist/{chunk-SZV2L2IG.js → chunk-OOBUWMPY.js} +3 -3
  134. package/dist/{chunk-WLHPCAVD.js → chunk-OREGA7GY.js} +5 -5
  135. package/dist/{chunk-4WMGRLTV.js → chunk-Q4MI2KCG.js} +2 -2
  136. package/dist/{chunk-MOL7JK4F.js → chunk-R4HFCATE.js} +2 -2
  137. package/dist/{chunk-VDLNQVYW.js → chunk-SPN5YFXN.js} +7 -7
  138. package/dist/{chunk-XK76RJBN.js → chunk-T2ZNUWUY.js} +2 -2
  139. package/dist/{chunk-Y77UTH7F.js → chunk-TFS5FAAC.js} +35 -35
  140. package/dist/{chunk-JDOBQPJY.js → chunk-TNQR7N52.js} +2 -2
  141. package/dist/{chunk-ROXDOKLM.js → chunk-UJXNBZYJ.js} +3 -3
  142. package/dist/{chunk-DDGQDNQW.js → chunk-VA5QRTZX.js} +2 -2
  143. package/dist/{chunk-GKKLI23D.js → chunk-WCQ7L54B.js} +2 -2
  144. package/dist/{chunk-3YQ7VLP3.js → chunk-WMTYEQO5.js} +2 -2
  145. package/dist/{chunk-OGAKUA7I.js → chunk-YHSEUZV5.js} +2 -2
  146. package/dist/{chunk-GR76OKET.js → chunk-YSBYNCCN.js} +2 -2
  147. package/dist/{chunk-IAGEEVQL.js → chunk-Z5YNVWRD.js} +2 -2
  148. package/dist/{chunk-EOXCOZ6L.js → chunk-ZLVURGAJ.js} +2 -2
  149. package/dist/{chunk-M6FKXOYV.js → chunk-ZQ533JDE.js} +2 -2
  150. package/dist/{chunk-TRTLWUDD.js → chunk-ZTHGFTMW.js} +2 -2
  151. package/dist/{cli-Cl7bKIWJ.d.ts → cli-CZDhIcxu.d.ts} +5 -5
  152. package/dist/cli.d.ts +16 -16
  153. package/dist/cli.js +47 -47
  154. package/dist/coding/export-okf-codegraph.d.ts +1 -1
  155. package/dist/coding/export-okf-codegraph.js +5 -5
  156. package/dist/coding/pre-action-gate.d.ts +1 -1
  157. package/dist/compounding/engine.d.ts +2 -2
  158. package/dist/compounding/engine.js +6 -6
  159. package/dist/compounding/preference-consolidator.d.ts +1 -1
  160. package/dist/compression-optimizer.d.ts +1 -1
  161. package/dist/config.d.ts +1 -1
  162. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  163. package/dist/connectors/codex-materialize-runner.js +6 -6
  164. package/dist/connectors/codex-materialize.d.ts +1 -1
  165. package/dist/connectors/index.d.ts +1 -1
  166. package/dist/connectors/index.js +6 -6
  167. package/dist/consolidation-provenance-check.d.ts +2 -2
  168. package/dist/consolidation-undo.d.ts +2 -2
  169. package/dist/contradiction/index.d.ts +4 -4
  170. package/dist/converge-config.d.ts +1 -1
  171. package/dist/convergence-refresh.d.ts +2 -2
  172. package/dist/convergence-refresh.js +8 -8
  173. package/dist/conversation-index/backend.d.ts +1 -1
  174. package/dist/conversation-index/chunker.d.ts +1 -1
  175. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  176. package/dist/conversation-index/indexer.d.ts +1 -1
  177. package/dist/conversation-index/search.d.ts +1 -1
  178. package/dist/corpus-watermark.d.ts +1 -1
  179. package/dist/corpus-watermark.js +8 -8
  180. package/dist/cross-lingual-recall.d.ts +1 -1
  181. package/dist/day-summary.d.ts +1 -1
  182. package/dist/deep-recall-http-glue.d.ts +14 -14
  183. package/dist/deep-recall-mcp-tools.d.ts +14 -14
  184. package/dist/deep-recall-policy-llm.d.ts +2 -2
  185. package/dist/deep-recall-policy-llm.js +3 -3
  186. package/dist/deep-recall-seeds.d.ts +1 -1
  187. package/dist/delinearize.d.ts +1 -1
  188. package/dist/dependency-propagation-config.d.ts +1 -1
  189. package/dist/{dependency-propagation-delivery-CggS9BFT.d.ts → dependency-propagation-delivery-BXaUoVUf.d.ts} +1 -1
  190. package/dist/direct-answer-wiring.d.ts +1 -1
  191. package/dist/direct-answer.d.ts +1 -1
  192. package/dist/embedding-fallback.d.ts +1 -1
  193. package/dist/enrichment/index.d.ts +1 -1
  194. package/dist/entity-origin-fields.d.ts +1 -1
  195. package/dist/entity-retrieval.d.ts +2 -2
  196. package/dist/entity-retrieval.js +6 -6
  197. package/dist/entity-schema.d.ts +1 -1
  198. package/dist/episodic-context.d.ts +1 -1
  199. package/dist/eval-trajectory-contracts.d.ts +1 -1
  200. package/dist/eval-trajectory-store.d.ts +1 -1
  201. package/dist/eval-trajectory.d.ts +1 -1
  202. package/dist/explicit-capture.d.ts +11 -11
  203. package/dist/external-wiki-access.d.ts +14 -14
  204. package/dist/external-wiki-access.js +23 -23
  205. package/dist/external-wiki-collection-registration.d.ts +1 -1
  206. package/dist/external-wiki-collection.d.ts +1 -1
  207. package/dist/external-wiki-mcp-tools.d.ts +14 -14
  208. package/dist/extraction-error-classification.d.ts +1 -1
  209. package/dist/extraction-faithfulness.d.ts +2 -2
  210. package/dist/extraction-faithfulness.js +3 -3
  211. package/dist/extraction-judge-telemetry.d.ts +2 -2
  212. package/dist/extraction-judge-training.d.ts +2 -2
  213. package/dist/extraction-judge.d.ts +2 -2
  214. package/dist/extraction-judge.js +3 -3
  215. package/dist/extraction-liveness.d.ts +1 -1
  216. package/dist/extraction-normalization.d.ts +1 -1
  217. package/dist/extraction-prompt.d.ts +1 -1
  218. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  219. package/dist/extraction-source-grounding.d.ts +1 -1
  220. package/dist/extraction-span-config.d.ts +1 -1
  221. package/dist/extraction-span-materialize.d.ts +1 -1
  222. package/dist/extraction-span-wire.d.ts +23 -4
  223. package/dist/extraction-span-wire.js +7 -8
  224. package/dist/extraction-span-wire.js.map +1 -1
  225. package/dist/extraction.d.ts +2 -2
  226. package/dist/extraction.js +13 -11
  227. package/dist/fallback-llm-codex-subscription.d.ts +1 -1
  228. package/dist/fallback-llm-codex-subscription.js +1 -1
  229. package/dist/fallback-llm.d.ts +1 -1
  230. package/dist/fallback-llm.js +2 -2
  231. package/dist/{generic-recall-paths-CoXPSnCw.d.ts → generic-recall-paths-BkVVEoeO.d.ts} +1 -1
  232. package/dist/graph-append-error.d.ts +1 -1
  233. package/dist/graph-dashboard-diff.d.ts +1 -1
  234. package/dist/graph-dashboard-key.d.ts +1 -1
  235. package/dist/graph-dashboard-parser.d.ts +1 -1
  236. package/dist/graph-edge-reinforcement.d.ts +1 -1
  237. package/dist/graph-jsonl.d.ts +1 -1
  238. package/dist/graph-path-reconstruction.d.ts +1 -1
  239. package/dist/graph-path-scoring.d.ts +1 -1
  240. package/dist/graph-snapshot.d.ts +1 -1
  241. package/dist/graph.d.ts +1 -1
  242. package/dist/harmonic-retrieval.js +1 -1
  243. package/dist/importance.d.ts +1 -1
  244. package/dist/importers/index.d.ts +1 -1
  245. package/dist/importers/test-utils.d.ts +1 -1
  246. package/dist/in-flight-reads.d.ts +1 -1
  247. package/dist/{index-fdw_oK5a.d.ts → index-TBPe6NvB.d.ts} +3 -3
  248. package/dist/index.d.ts +703 -703
  249. package/dist/index.js +65 -63
  250. package/dist/intent.d.ts +1 -1
  251. package/dist/lcm/engine.d.ts +1 -1
  252. package/dist/lcm/index.d.ts +1 -1
  253. package/dist/lcm/tools.d.ts +1 -1
  254. package/dist/lifecycle.d.ts +1 -1
  255. package/dist/live-connectors-runner.d.ts +1 -1
  256. package/dist/{local-llm-3-jtw52a.d.ts → local-llm-DdrhmecM.d.ts} +1 -1
  257. package/dist/local-llm-helpers.d.ts +2 -2
  258. package/dist/local-llm.d.ts +2 -2
  259. package/dist/local-model-endpoint.d.ts +1 -1
  260. package/dist/location/index.d.ts +5 -5
  261. package/dist/location/index.js +8 -8
  262. package/dist/maintenance/memory-governance.d.ts +1 -1
  263. package/dist/maintenance/memory-governance.js +6 -6
  264. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  265. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +6 -6
  266. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  267. package/dist/maintenance/rebuild-memory-projection.js +7 -7
  268. package/dist/{maintenance-DgeeH0a1.d.ts → maintenance-B813YFWJ.d.ts} +3 -3
  269. package/dist/mcp-memory-inspector-app.d.ts +14 -14
  270. package/dist/memory-action-policy.d.ts +1 -1
  271. package/dist/memory-cache.d.ts +1 -1
  272. package/dist/memory-controller.d.ts +1 -1
  273. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  274. package/dist/memory-projection-store.d.ts +1 -1
  275. package/dist/memory-provenance.d.ts +1 -1
  276. package/dist/memory-snapshot.d.ts +1 -1
  277. package/dist/memory-subject-cli.d.ts +14 -14
  278. package/dist/memory-subject.d.ts +14 -14
  279. package/dist/memory-worth-outcomes.d.ts +2 -2
  280. package/dist/models-json.d.ts +1 -1
  281. package/dist/namespaces/migrate.d.ts +3 -3
  282. package/dist/namespaces/migrate.js +7 -7
  283. package/dist/namespaces/principal.d.ts +1 -1
  284. package/dist/namespaces/search.d.ts +1 -1
  285. package/dist/namespaces/storage.d.ts +3 -3
  286. package/dist/namespaces/storage.js +6 -6
  287. package/dist/native-knowledge.d.ts +1 -1
  288. package/dist/offline-sync-impression-drain.d.ts +1 -1
  289. package/dist/operator-doctor-corpus.d.ts +1 -1
  290. package/dist/operator-doctor-corpus.js +9 -9
  291. package/dist/operator-doctor-replica.d.ts +1 -1
  292. package/dist/operator-toolkit.d.ts +3 -3
  293. package/dist/operator-toolkit.js +14 -14
  294. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  295. package/dist/orchestration/maintenance.d.ts +4 -4
  296. package/dist/orchestration/maintenance.js +14 -14
  297. package/dist/{orchestrator-VXWKdatm.d.ts → orchestrator-BCvQavIS.d.ts} +10 -10
  298. package/dist/orchestrator.d.ts +11 -11
  299. package/dist/orchestrator.js +65 -63
  300. package/dist/patterns-cli.d.ts +1 -1
  301. package/dist/{pipeline-CwXZBKR5.d.ts → pipeline-4lqKJZ_0.d.ts} +1 -1
  302. package/dist/policy-runtime.d.ts +1 -1
  303. package/dist/proactive-contention.d.ts +2 -2
  304. package/dist/provenance.d.ts +1 -1
  305. package/dist/{public-http-DdmM4scJ.d.ts → public-http-NH72a6aa.d.ts} +1 -1
  306. package/dist/{qmd-DOLTPIQg.d.ts → qmd-DnoWaXKb.d.ts} +1 -1
  307. package/dist/qmd-preflight.d.ts +2 -2
  308. package/dist/qmd-recall-cache.d.ts +1 -1
  309. package/dist/qmd.d.ts +2 -2
  310. package/dist/recall-concurrency-config.d.ts +1 -1
  311. package/dist/recall-disclosure-escalation.d.ts +1 -1
  312. package/dist/recall-explain-renderer.d.ts +1 -1
  313. package/dist/recall-memory-map.d.ts +1 -1
  314. package/dist/recall-navigate-access.d.ts +1 -1
  315. package/dist/recall-navigate-disclosure.d.ts +1 -1
  316. package/dist/recall-navigate.d.ts +1 -1
  317. package/dist/recall-navigation-http-glue.d.ts +14 -14
  318. package/dist/recall-navigation-mcp-tools.d.ts +14 -14
  319. package/dist/recall-navigation-operations.js +23 -23
  320. package/dist/recall-navigation-renderer.d.ts +1 -1
  321. package/dist/recall-navigation.d.ts +1 -1
  322. package/dist/recall-navigation.js +22 -22
  323. package/dist/recall-planner-llm.d.ts +1 -1
  324. package/dist/recall-planner-llm.js +2 -2
  325. package/dist/recall-state-view-admission.d.ts +2 -2
  326. package/dist/recall-state-view-admission.js +3 -3
  327. package/dist/recall-state-view-anchors.d.ts +1 -1
  328. package/dist/recall-state.d.ts +1 -1
  329. package/dist/recall-tag-filter.d.ts +1 -1
  330. package/dist/recall-timings.d.ts +1 -1
  331. package/dist/recall-xray-cli.d.ts +1 -1
  332. package/dist/recall-xray-renderer.d.ts +1 -1
  333. package/dist/recall-xray.d.ts +1 -1
  334. package/dist/reconcile/cursor.d.ts +1 -1
  335. package/dist/reconcile/manifest.d.ts +1 -1
  336. package/dist/reconcile/manifest.js +2 -2
  337. package/dist/reconcile/plan.d.ts +1 -1
  338. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  339. package/dist/replay/normalizers/claude.d.ts +1 -1
  340. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  341. package/dist/replay/normalizers/shared.d.ts +1 -1
  342. package/dist/replay/runner.d.ts +1 -1
  343. package/dist/replay/types.d.ts +1 -1
  344. package/dist/replica-divergence.d.ts +1 -1
  345. package/dist/replica-peers-config.d.ts +1 -1
  346. package/dist/resolve-auth-token.d.ts +1 -1
  347. package/dist/retrieval-agents.d.ts +2 -2
  348. package/dist/retrieval-tiers.d.ts +1 -1
  349. package/dist/routing/engine.d.ts +1 -1
  350. package/dist/routing/store.d.ts +1 -1
  351. package/dist/salvage-envelope.d.ts +1 -1
  352. package/dist/schemas.d.ts +160 -160
  353. package/dist/{scope-profiles-C564-hrv.d.ts → scope-profiles-crazXegZ.d.ts} +1 -1
  354. package/dist/search/embed-helper.d.ts +1 -1
  355. package/dist/search/factory.d.ts +1 -1
  356. package/dist/search/index.d.ts +1 -1
  357. package/dist/search/lancedb-backend.d.ts +1 -1
  358. package/dist/search/meilisearch-backend.d.ts +1 -1
  359. package/dist/search/noop-backend.d.ts +1 -1
  360. package/dist/search/orama-backend.d.ts +1 -1
  361. package/dist/search/port.d.ts +1 -1
  362. package/dist/search/remote-backend.d.ts +1 -1
  363. package/dist/{semantic-consolidation-g6x-ShY8.d.ts → semantic-consolidation-B09JI9WM.d.ts} +1 -1
  364. package/dist/semantic-consolidation.d.ts +2 -2
  365. package/dist/semantic-consolidation.js +7 -7
  366. package/dist/semantic-rule-promotion.js +6 -6
  367. package/dist/semantic-rule-verifier.d.ts +1 -1
  368. package/dist/semantic-rule-verifier.js +6 -6
  369. package/dist/{service-CaCOk0rd.d.ts → service-Echc5Xso.d.ts} +2 -2
  370. package/dist/session-observer-bands.d.ts +1 -1
  371. package/dist/session-observer-state.d.ts +1 -1
  372. package/dist/shared-context/manager.d.ts +7 -7
  373. package/dist/signal.d.ts +1 -1
  374. package/dist/source-agent-qualifier.d.ts +1 -1
  375. package/dist/source-agent-qualifier.js +9 -9
  376. package/dist/source-attribution.d.ts +7 -4
  377. package/dist/source-attribution.js +1 -1
  378. package/dist/standup/build.js +6 -6
  379. package/dist/{storage-C9nsZX5Q.d.ts → storage-ClkHCQSE.d.ts} +1 -1
  380. package/dist/storage.d.ts +2 -2
  381. package/dist/storage.js +5 -5
  382. package/dist/subject-config.d.ts +1 -1
  383. package/dist/summarizer.d.ts +1 -1
  384. package/dist/summarizer.js +3 -3
  385. package/dist/summary-snapshot.d.ts +1 -1
  386. package/dist/support-passport/index.d.ts +17 -17
  387. package/dist/support-passport/index.js +25 -25
  388. package/dist/{tagging-BA4RFdH3.d.ts → tagging-ksktJ60G.d.ts} +2 -2
  389. package/dist/temporal-supersession.d.ts +2 -2
  390. package/dist/temporal-timeline-recall.d.ts +1 -1
  391. package/dist/temporal-validity.d.ts +1 -1
  392. package/dist/threading.d.ts +1 -1
  393. package/dist/tier-migration.d.ts +2 -2
  394. package/dist/tier-routing.d.ts +1 -1
  395. package/dist/topics.d.ts +1 -1
  396. package/dist/transcript.d.ts +1 -1
  397. package/dist/transfer/export-okf.d.ts +1 -1
  398. package/dist/transfer/export-okf.js +6 -6
  399. package/dist/transfer/types.d.ts +78 -78
  400. package/dist/trust-score-stage.d.ts +1 -1
  401. package/dist/trust-score.d.ts +1 -1
  402. package/dist/{types-Sps-lg5I.d.ts → types-nmhnJpxx.d.ts} +1 -1
  403. package/dist/types.d.ts +1 -1
  404. package/dist/utility-runtime.d.ts +1 -1
  405. package/dist/verified-recall.js +6 -6
  406. package/dist/who-knows-cli.d.ts +14 -14
  407. package/dist/who-knows-cli.js +7 -7
  408. package/dist/who-knows.d.ts +14 -14
  409. package/dist/who-knows.js +6 -6
  410. package/dist/write-envelope.d.ts +1 -1
  411. package/package.json +2 -2
  412. package/src/background-generation.test.ts +77 -0
  413. package/src/extraction-span-wire.test.ts +17 -1
  414. package/src/extraction-span-wire.ts +46 -3
  415. package/src/extraction.ts +2 -11
  416. package/src/providers/codex-subscription.test.ts +109 -3
  417. package/src/providers/codex-subscription.ts +57 -17
  418. package/src/source-attribution.test.ts +27 -0
  419. package/src/source-attribution.ts +41 -5
  420. package/src/summarizer.ts +18 -0
  421. package/dist/chunk-J2MGTGKC.js.map +0 -1
  422. package/dist/chunk-RJ7Z7YXK.js.map +0 -1
  423. package/dist/chunk-UHSOPTNB.js.map +0 -1
  424. /package/dist/{auto-sync-QZD4RD6H.js.map → auto-sync-DG5KEOF5.js.map} +0 -0
  425. /package/dist/{chunk-BZDK5EOD.js.map → chunk-2LRO73MN.js.map} +0 -0
  426. /package/dist/{chunk-JDL5BYYF.js.map → chunk-46A4RGBC.js.map} +0 -0
  427. /package/dist/{chunk-6EGIQEKC.js.map → chunk-4HTQ76O4.js.map} +0 -0
  428. /package/dist/{chunk-7L54ARML.js.map → chunk-4XTSKGLX.js.map} +0 -0
  429. /package/dist/{chunk-IOTYIECA.js.map → chunk-5TKHJ5RW.js.map} +0 -0
  430. /package/dist/{chunk-ZVQ5HF77.js.map → chunk-5XTILJRI.js.map} +0 -0
  431. /package/dist/{chunk-VJXMFBVR.js.map → chunk-6II55MXS.js.map} +0 -0
  432. /package/dist/{chunk-K3IVJ5ML.js.map → chunk-7LKXP4QG.js.map} +0 -0
  433. /package/dist/{chunk-PF7LQ22G.js.map → chunk-A2YN3FR4.js.map} +0 -0
  434. /package/dist/{chunk-KDLOKVX7.js.map → chunk-AOMUIF3R.js.map} +0 -0
  435. /package/dist/{chunk-2YIUUXNK.js.map → chunk-B55FYF6F.js.map} +0 -0
  436. /package/dist/{chunk-2HDLDBJW.js.map → chunk-BOWAP64Q.js.map} +0 -0
  437. /package/dist/{chunk-SUS64JER.js.map → chunk-C3MCMFNV.js.map} +0 -0
  438. /package/dist/{chunk-DABSYX7V.js.map → chunk-D3DJYGU2.js.map} +0 -0
  439. /package/dist/{chunk-F2FJTOV6.js.map → chunk-DO6R3LIE.js.map} +0 -0
  440. /package/dist/{chunk-LD22AAJI.js.map → chunk-DSHSQGSN.js.map} +0 -0
  441. /package/dist/{chunk-3254BYQV.js.map → chunk-E5VOKZQV.js.map} +0 -0
  442. /package/dist/{chunk-46FVFU7S.js.map → chunk-EC5SVM6H.js.map} +0 -0
  443. /package/dist/{chunk-BPXJINHW.js.map → chunk-EUP4AXIW.js.map} +0 -0
  444. /package/dist/{chunk-WJPR2XUN.js.map → chunk-F6AYWLRN.js.map} +0 -0
  445. /package/dist/{chunk-4AX5OYKC.js.map → chunk-FDDCZDBI.js.map} +0 -0
  446. /package/dist/{chunk-VHANUT45.js.map → chunk-HBGSZ62Z.js.map} +0 -0
  447. /package/dist/{chunk-XLPZN3A5.js.map → chunk-HVGCQMTQ.js.map} +0 -0
  448. /package/dist/{chunk-GMU7MAHS.js.map → chunk-IAT5WFEU.js.map} +0 -0
  449. /package/dist/{chunk-R3H2AXO2.js.map → chunk-IFULZYYQ.js.map} +0 -0
  450. /package/dist/{chunk-ZYSOT6HD.js.map → chunk-J3IWHCMF.js.map} +0 -0
  451. /package/dist/{chunk-QCTXQ2HW.js.map → chunk-J6NEOCQC.js.map} +0 -0
  452. /package/dist/{chunk-H2N6SLTR.js.map → chunk-JIWZVOQM.js.map} +0 -0
  453. /package/dist/{chunk-HKQAI6XI.js.map → chunk-JPNUKKSL.js.map} +0 -0
  454. /package/dist/{chunk-F6PTJLEM.js.map → chunk-K4KE5MYE.js.map} +0 -0
  455. /package/dist/{chunk-5AJZ7EUW.js.map → chunk-K75H7FSO.js.map} +0 -0
  456. /package/dist/{chunk-7F47R4H4.js.map → chunk-LZAJONO5.js.map} +0 -0
  457. /package/dist/{chunk-OCX7OWOC.js.map → chunk-M7ECD3KN.js.map} +0 -0
  458. /package/dist/{chunk-KORQWGUA.js.map → chunk-MDYZCPNQ.js.map} +0 -0
  459. /package/dist/{chunk-IWHNT35B.js.map → chunk-N6I257OM.js.map} +0 -0
  460. /package/dist/{chunk-YR5QT4SR.js.map → chunk-NAFPHFDM.js.map} +0 -0
  461. /package/dist/{chunk-D7UUB33A.js.map → chunk-NGAFYIHQ.js.map} +0 -0
  462. /package/dist/{chunk-3K64PLY3.js.map → chunk-NKDQXDFL.js.map} +0 -0
  463. /package/dist/{chunk-ZBSP4BSN.js.map → chunk-NRFUYVW7.js.map} +0 -0
  464. /package/dist/{chunk-XOCGC3FJ.js.map → chunk-OFBJD3V5.js.map} +0 -0
  465. /package/dist/{chunk-SZV2L2IG.js.map → chunk-OOBUWMPY.js.map} +0 -0
  466. /package/dist/{chunk-WLHPCAVD.js.map → chunk-OREGA7GY.js.map} +0 -0
  467. /package/dist/{chunk-4WMGRLTV.js.map → chunk-Q4MI2KCG.js.map} +0 -0
  468. /package/dist/{chunk-MOL7JK4F.js.map → chunk-R4HFCATE.js.map} +0 -0
  469. /package/dist/{chunk-VDLNQVYW.js.map → chunk-SPN5YFXN.js.map} +0 -0
  470. /package/dist/{chunk-XK76RJBN.js.map → chunk-T2ZNUWUY.js.map} +0 -0
  471. /package/dist/{chunk-Y77UTH7F.js.map → chunk-TFS5FAAC.js.map} +0 -0
  472. /package/dist/{chunk-JDOBQPJY.js.map → chunk-TNQR7N52.js.map} +0 -0
  473. /package/dist/{chunk-ROXDOKLM.js.map → chunk-UJXNBZYJ.js.map} +0 -0
  474. /package/dist/{chunk-DDGQDNQW.js.map → chunk-VA5QRTZX.js.map} +0 -0
  475. /package/dist/{chunk-GKKLI23D.js.map → chunk-WCQ7L54B.js.map} +0 -0
  476. /package/dist/{chunk-3YQ7VLP3.js.map → chunk-WMTYEQO5.js.map} +0 -0
  477. /package/dist/{chunk-OGAKUA7I.js.map → chunk-YHSEUZV5.js.map} +0 -0
  478. /package/dist/{chunk-GR76OKET.js.map → chunk-YSBYNCCN.js.map} +0 -0
  479. /package/dist/{chunk-IAGEEVQL.js.map → chunk-Z5YNVWRD.js.map} +0 -0
  480. /package/dist/{chunk-EOXCOZ6L.js.map → chunk-ZLVURGAJ.js.map} +0 -0
  481. /package/dist/{chunk-M6FKXOYV.js.map → chunk-ZQ533JDE.js.map} +0 -0
  482. /package/dist/{chunk-TRTLWUDD.js.map → chunk-ZTHGFTMW.js.map} +0 -0
@@ -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 * 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 * True when a template can be matched and stripped later. All-placeholder\n * templates such as `{agent}{sessionId}` have no literal anchors.\n */\nexport function citationTemplateIsDetectable(template: string): boolean {\n if (typeof template !== \"string\" || template.length === 0) return false;\n if (template === DEFAULT_CITATION_FORMAT) return true;\n PLACEHOLDER_REGEX.lastIndex = 0;\n if (!PLACEHOLDER_REGEX.test(template)) {\n PLACEHOLDER_REGEX.lastIndex = 0;\n return true;\n }\n PLACEHOLDER_REGEX.lastIndex = 0;\n return templateMatcher(template) !== null;\n}\n\n/**\n * Templates the merge path may lift, preserve, or strip: the default\n * format, the current format when it is detectable, then any prior\n * configured formats the caller still holds. Undetectable shapes are\n * dropped so we never hash or attach a marker we cannot re-match.\n */\nexport function citationTemplatesToRecognize(\n primary: string | undefined,\n extra: readonly string[] = [],\n): string[] {\n const out: string[] = [];\n const add = (template: string | undefined): void => {\n if (typeof template !== \"string\" || template.length === 0) return;\n if (!citationTemplateIsDetectable(template)) return;\n if (!out.includes(template)) out.push(template);\n };\n add(DEFAULT_CITATION_FORMAT);\n add(primary);\n for (const template of extra) add(template);\n return out;\n}\n\n/**\n * Prior formats the caller still holds, if any. Absent or malformed\n * history is ignored — fail safe, do not invent templates.\n */\nexport function citationTemplatesForMerge(config: {\n inlineSourceAttributionFormat?: string;\n inlineSourceAttributionFormatHistory?: unknown;\n}): string[] {\n const raw = config.inlineSourceAttributionFormatHistory;\n const extra = Array.isArray(raw)\n ? raw.filter((value): value is string => typeof value === \"string\" && value.length > 0)\n : [];\n return citationTemplatesToRecognize(config.inlineSourceAttributionFormat, extra);\n}\n\nexport function lastRecognizedCitationMarker(\n text: string,\n templates: readonly string[],\n): string | null {\n for (const template of templates) {\n const marker = lastCitationMarkerForTemplate(text, template);\n if (marker) return marker;\n }\n return null;\n}\n\nexport function stripRecognizedCitations(text: string, templates: readonly string[]): string {\n let out = text;\n for (const template of templates) {\n out = stripCitationForTemplate(out, template);\n }\n return out;\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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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
+ {"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 * True when a template can be matched and stripped later. All-placeholder\n * templates such as `{agent}{sessionId}` have no literal anchors.\n */\nexport function citationTemplateIsDetectable(template: string): boolean {\n if (typeof template !== \"string\" || template.length === 0) return false;\n if (template === DEFAULT_CITATION_FORMAT) return true;\n PLACEHOLDER_REGEX.lastIndex = 0;\n if (!PLACEHOLDER_REGEX.test(template)) {\n PLACEHOLDER_REGEX.lastIndex = 0;\n return true;\n }\n PLACEHOLDER_REGEX.lastIndex = 0;\n return templateMatcher(template) !== null;\n}\n\n/**\n * Templates the merge path may lift, preserve, or strip. Longest\n * templates first so an overlapping custom marker beats an inner default\n * match; the current template wins equal-length ties. Undetectable\n * shapes are dropped so we never hash or attach a marker we cannot re-match.\n */\nexport function citationTemplatesToRecognize(\n primary: string | undefined,\n extra: readonly string[] = [],\n): string[] {\n const out: string[] = [];\n const add = (template: string | undefined): void => {\n if (typeof template !== \"string\" || template.length === 0) return;\n if (!citationTemplateIsDetectable(template)) return;\n if (!out.includes(template)) out.push(template);\n };\n add(primary);\n for (const template of extra) add(template);\n add(DEFAULT_CITATION_FORMAT);\n out.sort((a, b) => {\n if (b.length !== a.length) return b.length - a.length;\n if (a === primary && b !== primary) return -1;\n if (b === primary && a !== primary) return 1;\n return 0;\n });\n return out;\n}\n\n/**\n * Prior formats the caller still holds, if any. Absent or malformed\n * history is ignored — fail safe, do not invent templates.\n */\nexport function citationTemplatesForMerge(config: {\n inlineSourceAttributionFormat?: string;\n inlineSourceAttributionFormatHistory?: unknown;\n}): string[] {\n const raw = config.inlineSourceAttributionFormatHistory;\n const extra = Array.isArray(raw)\n ? raw.filter((value): value is string => typeof value === \"string\" && value.length > 0)\n : [];\n return citationTemplatesToRecognize(config.inlineSourceAttributionFormat, extra);\n}\n\nexport function lastRecognizedCitationMarker(\n text: string,\n templates: readonly string[],\n): string | null {\n for (const template of templates) {\n const marker = lastCitationMarkerForTemplate(text, template);\n if (marker) return marker;\n }\n return null;\n}\n\nexport function stripRecognizedCitations(text: string, templates: readonly string[]): string {\n let out = text;\n for (const template of templates) {\n out = stripCitationForTemplate(out, template);\n }\n return out;\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 * - Fully-literal templates (no placeholders) are stripped by exact match\n * of the template text, the same inclusion check `hasCitationForTemplate`\n * uses.\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 PLACEHOLDER_REGEX.lastIndex = 0;\n if (!PLACEHOLDER_REGEX.test(template)) {\n PLACEHOLDER_REGEX.lastIndex = 0;\n return stripExactLiteralCitation(afterDefault, template);\n }\n PLACEHOLDER_REGEX.lastIndex = 0;\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 stripExactLiteralCitation(text: string, marker: string): string {\n if (marker.length === 0) return text;\n let result = \"\";\n let lastIndex = 0;\n let idx = text.indexOf(marker);\n if (idx === -1) return text;\n while (idx !== -1) {\n const before = text.slice(lastIndex, idx).replace(/[ \\t]+$/, \"\");\n result += before;\n lastIndex = idx + marker.length;\n idx = text.indexOf(marker, lastIndex);\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 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,IAAI;AAC/D,QAAM,qBAAqB,QAAQ,KAAK,EAAE,SAAS,IAAI,UAAU;AAIjE,QAAM,SAAiC;AAAA,IACrC;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAMA,SAAO,SAAS,QAAQ,yBAAyB,CAAC,OAAO,SA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,WAAW,OAAO,WAAW,KAC9B;AACA,WAAO,EAAE,OAAO,QAAQ,GAAG,KAAK,MAAM,EAAE;AAAA,EAC1C;AACA,SAAO;AACT;","names":[]}
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  computeCorpusWatermarks,
6
6
  resolveCorpusNamespaceRoots
7
- } from "./chunk-KDLOKVX7.js";
7
+ } from "./chunk-AOMUIF3R.js";
8
8
 
9
9
  // src/operator-doctor-corpus.ts
10
10
  var DIGEST_PREFIX_LENGTH = 12;
@@ -78,4 +78,4 @@ export {
78
78
  corpusWatermarksFromCheck,
79
79
  summarizeCorpusAndReplica
80
80
  };
81
- //# sourceMappingURL=chunk-7F47R4H4.js.map
81
+ //# sourceMappingURL=chunk-LZAJONO5.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineOperation
3
- } from "./chunk-3K64PLY3.js";
3
+ } from "./chunk-NKDQXDFL.js";
4
4
  import {
5
5
  EngramAccessInputError
6
6
  } from "./chunk-2Z24E5W2.js";
@@ -92,4 +92,4 @@ defineOperation({
92
92
  };
93
93
  }
94
94
  });
95
- //# sourceMappingURL=chunk-OCX7OWOC.js.map
95
+ //# sourceMappingURL=chunk-M7ECD3KN.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-PIWFNPQT.js";
8
8
  import {
9
9
  StorageManager
10
- } from "./chunk-GMU7MAHS.js";
10
+ } from "./chunk-IAT5WFEU.js";
11
11
  import {
12
12
  projectProceduresToSkills
13
13
  } from "./chunk-236PXYG7.js";
@@ -134,4 +134,4 @@ export {
134
134
  runCodexMaterialize,
135
135
  runPostConsolidationMaterialize
136
136
  };
137
- //# sourceMappingURL=chunk-KORQWGUA.js.map
137
+ //# sourceMappingURL=chunk-MDYZCPNQ.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  hasMemoryData
3
- } from "./chunk-GKKLI23D.js";
3
+ } from "./chunk-WCQ7L54B.js";
4
4
  import {
5
5
  resolveNamespaceStorageRoot
6
- } from "./chunk-3YQ7VLP3.js";
6
+ } from "./chunk-WMTYEQO5.js";
7
7
  import {
8
8
  getConfiguredNamespaces
9
9
  } from "./chunk-OQQXGYMX.js";
@@ -724,4 +724,4 @@ export {
724
724
  runNamespaceMaintenancePlan,
725
725
  runNamespaceMaintenanceBatchPlan
726
726
  };
727
- //# sourceMappingURL=chunk-IWHNT35B.js.map
727
+ //# sourceMappingURL=chunk-N6I257OM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  gatewayTaskChainOptions
3
- } from "./chunk-TRTLWUDD.js";
3
+ } from "./chunk-ZTHGFTMW.js";
4
4
  import {
5
5
  isAbortError,
6
6
  throwIfAborted
@@ -70,4 +70,4 @@ export {
70
70
  DEEP_RECALL_POLICY_SYSTEM_PROMPT,
71
71
  callDeepRecallPolicyLlm
72
72
  };
73
- //# sourceMappingURL=chunk-YR5QT4SR.js.map
73
+ //# sourceMappingURL=chunk-NAFPHFDM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseEntityFile
3
- } from "./chunk-GMU7MAHS.js";
3
+ } from "./chunk-IAT5WFEU.js";
4
4
  import {
5
5
  inferMemoryStatus
6
6
  } from "./chunk-7RJUVTVF.js";
@@ -253,4 +253,4 @@ export {
253
253
  WHO_KNOWS_MCP_TOOLS,
254
254
  handleWhoKnowsHttpQuery
255
255
  };
256
- //# sourceMappingURL=chunk-D7UUB33A.js.map
256
+ //# sourceMappingURL=chunk-NGAFYIHQ.js.map
@@ -38,7 +38,7 @@ import {
38
38
  computeWhoKnows,
39
39
  loadWhoKnowsEntities,
40
40
  validateWhoKnowsInput
41
- } from "./chunk-D7UUB33A.js";
41
+ } from "./chunk-NGAFYIHQ.js";
42
42
  import {
43
43
  WriteQuarantineStore
44
44
  } from "./chunk-PJSK6OJM.js";
@@ -59,13 +59,13 @@ import {
59
59
  } from "./chunk-ROBHL3GL.js";
60
60
  import {
61
61
  summarizeHourlyStatus
62
- } from "./chunk-J2MGTGKC.js";
62
+ } from "./chunk-5ZXGH2ZL.js";
63
63
  import {
64
64
  planSessionTranscriptMigration
65
65
  } from "./chunk-P5FPO2BR.js";
66
66
  import {
67
67
  isSearchExcludedPath
68
- } from "./chunk-46FVFU7S.js";
68
+ } from "./chunk-EC5SVM6H.js";
69
69
  import {
70
70
  renderNavigationResult
71
71
  } from "./chunk-KIW3OOZE.js";
@@ -97,7 +97,7 @@ import {
97
97
  } from "./chunk-VW5TGNJN.js";
98
98
  import {
99
99
  readAggregateExtractionWatermark
100
- } from "./chunk-2HDLDBJW.js";
100
+ } from "./chunk-BOWAP64Q.js";
101
101
  import {
102
102
  ReplicaDivergenceMonitor
103
103
  } from "./chunk-CVILPI77.js";
@@ -118,7 +118,7 @@ import {
118
118
  } from "./chunk-HWLIMQE2.js";
119
119
  import {
120
120
  readProjectedHarmonicGraph
121
- } from "./chunk-3254BYQV.js";
121
+ } from "./chunk-E5VOKZQV.js";
122
122
  import {
123
123
  wrapWorkLayerContext
124
124
  } from "./chunk-EI6V5UXY.js";
@@ -152,7 +152,7 @@ import {
152
152
  } from "./chunk-7ZNJN5WZ.js";
153
153
  import {
154
154
  callDeepRecallPolicyLlm
155
- } from "./chunk-YR5QT4SR.js";
155
+ } from "./chunk-NAFPHFDM.js";
156
156
  import {
157
157
  renderDeepRecallResult
158
158
  } from "./chunk-RF2SMMPP.js";
@@ -169,18 +169,18 @@ import {
169
169
  listMemoryGovernanceRuns,
170
170
  readMemoryGovernanceRunArtifact,
171
171
  runMemoryGovernance
172
- } from "./chunk-5AJZ7EUW.js";
172
+ } from "./chunk-K75H7FSO.js";
173
173
  import {
174
174
  CorpusWatermarkCache,
175
175
  computeServiceCorpusCensus
176
- } from "./chunk-KDLOKVX7.js";
176
+ } from "./chunk-AOMUIF3R.js";
177
177
  import {
178
178
  CrossNamespaceBudget,
179
179
  toBudgetWarning
180
180
  } from "./chunk-UFGFMWAD.js";
181
181
  import {
182
182
  ExtractionDeadlineError
183
- } from "./chunk-BPXJINHW.js";
183
+ } from "./chunk-EUP4AXIW.js";
184
184
  import {
185
185
  defaultCapsulesDir
186
186
  } from "./chunk-ZY2MNJR6.js";
@@ -190,14 +190,14 @@ import {
190
190
  enqueuePassiveCorrectionNotification,
191
191
  parseBriefingFocus,
192
192
  parseBriefingWindow
193
- } from "./chunk-OGAKUA7I.js";
193
+ } from "./chunk-YHSEUZV5.js";
194
194
  import {
195
195
  parseEntityFile,
196
196
  parseFrontmatter,
197
197
  qmdCollectionPathParts,
198
198
  qmdResultPathCandidates,
199
199
  selfDeps
200
- } from "./chunk-GMU7MAHS.js";
200
+ } from "./chunk-IAT5WFEU.js";
201
201
  import {
202
202
  namespaceCollectionName
203
203
  } from "./chunk-T3F2HWIG.js";
@@ -228,7 +228,7 @@ import {
228
228
  } from "./chunk-5WITETWU.js";
229
229
  import {
230
230
  FallbackLlmClient
231
- } from "./chunk-TRTLWUDD.js";
231
+ } from "./chunk-ZTHGFTMW.js";
232
232
  import {
233
233
  CORRECTION_TEXT_MAX,
234
234
  CorrectionContractError,
@@ -312,7 +312,7 @@ import {
312
312
  } from "./chunk-Z2YFLXHU.js";
313
313
  import {
314
314
  createOfflineSyncManifestStream
315
- } from "./chunk-6EGIQEKC.js";
315
+ } from "./chunk-4HTQ76O4.js";
316
316
  import {
317
317
  offlineSyncStorageForSnapshot
318
318
  } from "./chunk-RFIJH2OE.js";
@@ -18238,4 +18238,4 @@ export {
18238
18238
  EngramAccessService,
18239
18239
  AccessAdminOpsSurface
18240
18240
  };
18241
- //# sourceMappingURL=chunk-3K64PLY3.js.map
18241
+ //# sourceMappingURL=chunk-NKDQXDFL.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-B7RWBZXW.js";
4
4
  import {
5
5
  StorageManager
6
- } from "./chunk-GMU7MAHS.js";
6
+ } from "./chunk-IAT5WFEU.js";
7
7
  import {
8
8
  getCachedEpisodeMap,
9
9
  setCachedEpisodeMap
@@ -109,4 +109,4 @@ export {
109
109
  compareVerifiedEpisodeResults,
110
110
  searchVerifiedEpisodes
111
111
  };
112
- //# sourceMappingURL=chunk-ZBSP4BSN.js.map
112
+ //# sourceMappingURL=chunk-NRFUYVW7.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-D7UUB33A.js";
5
+ } from "./chunk-NGAFYIHQ.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-XOCGC3FJ.js.map
77
+ //# sourceMappingURL=chunk-OFBJD3V5.js.map
@@ -29,13 +29,13 @@ import {
29
29
  defineOperation,
30
30
  parseNamespacePreflightWriteOp,
31
31
  resolveAuthorizedNamespaceWritablePreflight
32
- } from "./chunk-3K64PLY3.js";
32
+ } from "./chunk-NKDQXDFL.js";
33
33
  import {
34
34
  parseSharedWriteOutputControls
35
35
  } from "./chunk-IFBSZGW3.js";
36
36
  import {
37
37
  validateBriefingFormat
38
- } from "./chunk-OGAKUA7I.js";
38
+ } from "./chunk-YHSEUZV5.js";
39
39
  import {
40
40
  parseDeepRecallMaxSteps
41
41
  } from "./chunk-7RGX7BMF.js";
@@ -594,4 +594,4 @@ defineOperation({ name: "graph_events", description: "SSE graph events.", schema
594
594
  defineOperation({ name: "chat_message", description: "Chat message.", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
595
595
  defineOperation({ name: "chat_events", description: "SSE chat events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
596
596
  defineOperation({ name: "adapters_status", description: "Adapter registry metadata (issue #1850 round 5). Marker op: the HTTP transport builds the response from its own adapterRegistry, but the op still must be registered so it appears in listRegisteredOperations and enforceTokenOp can gate it for scoped tokens.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
597
- //# sourceMappingURL=chunk-SZV2L2IG.js.map
597
+ //# sourceMappingURL=chunk-OOBUWMPY.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildStandup,
3
3
  parseStandupDate
4
- } from "./chunk-M6FKXOYV.js";
4
+ } from "./chunk-ZQ533JDE.js";
5
5
  import {
6
6
  backfillMemoryStorage,
7
7
  runLocationBackfill,
@@ -9,16 +9,16 @@ import {
9
9
  runLocationDay,
10
10
  runLocationStatus,
11
11
  runLocationSync
12
- } from "./chunk-PF7LQ22G.js";
12
+ } from "./chunk-A2YN3FR4.js";
13
13
  import {
14
14
  externalWikiSearchOperation
15
- } from "./chunk-IAGEEVQL.js";
15
+ } from "./chunk-Z5YNVWRD.js";
16
16
  import {
17
17
  DECISION_SUBCOMMANDS,
18
18
  DELTA_SUBCOMMANDS,
19
19
  defineOperation,
20
20
  isCodegraphToolName
21
- } from "./chunk-3K64PLY3.js";
21
+ } from "./chunk-NKDQXDFL.js";
22
22
  import {
23
23
  CorrectionContractError
24
24
  } from "./chunk-QLK3SL7Q.js";
@@ -1914,4 +1914,4 @@ export {
1914
1914
  codegraphIngestTracesOperation,
1915
1915
  REGISTERED_OPERATIONS
1916
1916
  };
1917
- //# sourceMappingURL=chunk-WLHPCAVD.js.map
1917
+ //# sourceMappingURL=chunk-OREGA7GY.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-KJTKLXTH.js";
4
4
  import {
5
5
  StorageManager
6
- } from "./chunk-GMU7MAHS.js";
6
+ } from "./chunk-IAT5WFEU.js";
7
7
  import {
8
8
  assertInjectedStorageRooted
9
9
  } from "./chunk-SGHGCFVV.js";
@@ -260,4 +260,4 @@ export {
260
260
  backupExistingLedger,
261
261
  rebuildMemoryLifecycleLedger
262
262
  };
263
- //# sourceMappingURL=chunk-4WMGRLTV.js.map
263
+ //# sourceMappingURL=chunk-Q4MI2KCG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-GMU7MAHS.js";
3
+ } from "./chunk-IAT5WFEU.js";
4
4
  import {
5
5
  composeMemoryEnvelope
6
6
  } from "./chunk-GDYU6VF4.js";
@@ -546,4 +546,4 @@ export {
546
546
  setSemanticRulePromotionTestHooks,
547
547
  promoteSemanticRuleFromMemory
548
548
  };
549
- //# sourceMappingURL=chunk-MOL7JK4F.js.map
549
+ //# sourceMappingURL=chunk-R4HFCATE.js.map
@@ -3,7 +3,7 @@ import {
3
3
  readNamespaceMaintenanceLastRanStatuses,
4
4
  readNamespaceMaintenanceStatuses,
5
5
  runNamespaceMaintenancePlan
6
- } from "./chunk-IWHNT35B.js";
6
+ } from "./chunk-N6I257OM.js";
7
7
  import {
8
8
  analyzeSessionIntegrity,
9
9
  applySessionRepair,
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-CMTINOFS.js";
15
15
  import {
16
16
  summarizeCorpusAndReplica
17
- } from "./chunk-7F47R4H4.js";
17
+ } from "./chunk-LZAJONO5.js";
18
18
  import {
19
19
  readJudgeVerdictStats
20
20
  } from "./chunk-OZKOPQCM.js";
@@ -41,20 +41,20 @@ import {
41
41
  } from "./chunk-W6YDAIVB.js";
42
42
  import {
43
43
  readAggregateExtractionWatermark
44
- } from "./chunk-2HDLDBJW.js";
44
+ } from "./chunk-BOWAP64Q.js";
45
45
  import {
46
46
  listMemoryGovernanceRuns,
47
47
  readMemoryGovernanceRunArtifact
48
- } from "./chunk-5AJZ7EUW.js";
48
+ } from "./chunk-K75H7FSO.js";
49
49
  import {
50
50
  listNamespaces
51
- } from "./chunk-JDL5BYYF.js";
51
+ } from "./chunk-46A4RGBC.js";
52
52
  import {
53
53
  analyzeGraphHealth
54
54
  } from "./chunk-5FAGCOZD.js";
55
55
  import {
56
56
  StorageManager
57
- } from "./chunk-GMU7MAHS.js";
57
+ } from "./chunk-IAT5WFEU.js";
58
58
  import {
59
59
  lintWorkspaceFiles
60
60
  } from "./chunk-DM2T26WE.js";
@@ -1683,4 +1683,4 @@ export {
1683
1683
  runBenchmarkRecall,
1684
1684
  runOperatorRepair
1685
1685
  };
1686
- //# sourceMappingURL=chunk-VDLNQVYW.js.map
1686
+ //# sourceMappingURL=chunk-SPN5YFXN.js.map
@@ -3,7 +3,7 @@ import {
3
3
  getOperation,
4
4
  operationRequiresAuthorizedNamespace,
5
5
  operationUsesPrincipalNamespace
6
- } from "./chunk-3K64PLY3.js";
6
+ } from "./chunk-NKDQXDFL.js";
7
7
  import {
8
8
  assertOperationAuthorizationAllowed
9
9
  } from "./chunk-MZWSOLMT.js";
@@ -60,4 +60,4 @@ export {
60
60
  authorizationProbeNamespaces,
61
61
  authorizationProbeRequiresPrincipalNamespace
62
62
  };
63
- //# sourceMappingURL=chunk-XK76RJBN.js.map
63
+ //# sourceMappingURL=chunk-T2ZNUWUY.js.map