@remnic/core 9.3.684 → 9.3.686

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 (315) hide show
  1. package/dist/access-boundary.d.ts +4 -3
  2. package/dist/access-boundary.js +23 -23
  3. package/dist/access-cli.js +152 -71
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +3 -2
  6. package/dist/access-http.js +26 -26
  7. package/dist/access-mcp.d.ts +14 -3
  8. package/dist/access-mcp.js +25 -25
  9. package/dist/access-operations.d.ts +10 -4
  10. package/dist/access-operations.js +26 -24
  11. package/dist/access-schema.d.ts +4 -4
  12. package/dist/{access-service-D-siI-xJ.d.ts → access-service-DmCHJ4cH.d.ts} +106 -39
  13. package/dist/access-service.d.ts +3 -2
  14. package/dist/access-service.js +22 -22
  15. package/dist/access-surface-catalog.d.ts +3 -2
  16. package/dist/access-surface-catalog.js +2 -0
  17. package/dist/access-surface-catalog.js.map +1 -1
  18. package/dist/active-recall.js +2 -2
  19. package/dist/{auto-sync-5CJBJMPZ.js → auto-sync-NUQWSFQD.js} +7 -7
  20. package/dist/bootstrap.d.ts +2 -1
  21. package/dist/bootstrap.js +2 -2
  22. package/dist/boxes.js +2 -2
  23. package/dist/briefing.js +3 -3
  24. package/dist/buffer.js +2 -2
  25. package/dist/calibration.js +4 -4
  26. package/dist/catalog-COqWZlZ6.d.ts +456 -0
  27. package/dist/causal-behavior.js +4 -4
  28. package/dist/causal-chain.js +4 -4
  29. package/dist/causal-consolidation.js +11 -11
  30. package/dist/causal-retrieval.js +4 -4
  31. package/dist/causal-trajectory-graph.js +1 -1
  32. package/dist/causal-trajectory.js +1 -1
  33. package/dist/{chunk-ROHLEUTH.js → chunk-2KAYTPPT.js} +10 -10
  34. package/dist/{chunk-NHQGDVJF.js → chunk-2SJCWLQD.js} +3 -3
  35. package/dist/{chunk-YTWNKQ2G.js → chunk-3FC6LW6T.js} +2 -2
  36. package/dist/{chunk-5OE4PYY5.js → chunk-473JIN2U.js} +61 -11
  37. package/dist/chunk-473JIN2U.js.map +1 -0
  38. package/dist/{chunk-XEA4Z7JU.js → chunk-4FE2K57M.js} +3 -3
  39. package/dist/{chunk-WI7JKV2T.js → chunk-4N3TFFPH.js} +2 -2
  40. package/dist/{chunk-BTVX7ZXZ.js → chunk-4NFVPDIL.js} +4 -4
  41. package/dist/{chunk-OUWAQVDJ.js → chunk-5CEJH5ZN.js} +2 -2
  42. package/dist/{chunk-6QM24CP7.js → chunk-6GJS4BFH.js} +2 -2
  43. package/dist/{chunk-J2FBJ63F.js → chunk-6O6A6YUO.js} +4 -4
  44. package/dist/{chunk-HQ6NIBL6.js → chunk-7FL4CNPV.js} +2 -2
  45. package/dist/{chunk-5VDJMYTF.js → chunk-7WWURLG6.js} +3 -3
  46. package/dist/{chunk-QWRC7GIO.js → chunk-A4HH2EWA.js} +5 -5
  47. package/dist/{chunk-4SKKVWLQ.js → chunk-AGJH5ISO.js} +2 -2
  48. package/dist/{chunk-2L3KLWOV.js → chunk-B43NZNMG.js} +54 -92
  49. package/dist/chunk-B43NZNMG.js.map +1 -0
  50. package/dist/{chunk-WRE3JPAW.js → chunk-B4XVLHJA.js} +3 -3
  51. package/dist/{chunk-53FDU4CE.js → chunk-BLIWOONZ.js} +39 -36
  52. package/dist/chunk-BLIWOONZ.js.map +1 -0
  53. package/dist/{chunk-AJU4PJGY.js → chunk-BVKCV2ZY.js} +2 -2
  54. package/dist/{chunk-DQY7NJ5L.js → chunk-CTOQEZSN.js} +2 -2
  55. package/dist/{chunk-7OGJQP7T.js → chunk-DCWIQFNA.js} +4 -4
  56. package/dist/{chunk-MHQC2WU2.js → chunk-DKTSR7EK.js} +2 -2
  57. package/dist/{chunk-RN7MUWON.js → chunk-EHISUJFN.js} +2 -2
  58. package/dist/{chunk-WLEB7WCG.js → chunk-EO5QWINU.js} +2 -2
  59. package/dist/{chunk-XKXKSQU7.js → chunk-EXM3CQTZ.js} +2 -2
  60. package/dist/{chunk-M3FWYURP.js → chunk-FE6DQUNJ.js} +9 -9
  61. package/dist/{chunk-LCC5EZTT.js → chunk-FIVDN2SM.js} +4 -4
  62. package/dist/{chunk-3MY4W5V4.js → chunk-FUCUR2OZ.js} +550 -63
  63. package/dist/chunk-FUCUR2OZ.js.map +1 -0
  64. package/dist/{chunk-452WDNFO.js → chunk-GG6AJN7A.js} +2 -2
  65. package/dist/{chunk-2IBGHRIO.js → chunk-GS55WYRL.js} +3 -3
  66. package/dist/{chunk-IBTZEBUD.js → chunk-HYNHLBKA.js} +2 -2
  67. package/dist/{chunk-EVWIEEKZ.js → chunk-IQ7WCZRW.js} +2 -2
  68. package/dist/{chunk-B5XMS73R.js → chunk-IQVQJJL7.js} +2 -2
  69. package/dist/{chunk-6RHNCKHG.js → chunk-K43PI6DQ.js} +2 -2
  70. package/dist/{chunk-OIF36KGD.js → chunk-KCQA46NR.js} +2 -2
  71. package/dist/{chunk-2LDBXPLB.js → chunk-KF74X62T.js} +1 -1
  72. package/dist/{chunk-3EVIMVQU.js → chunk-KFBOZYME.js} +42 -3
  73. package/dist/chunk-KFBOZYME.js.map +1 -0
  74. package/dist/{chunk-MAV46GWQ.js → chunk-KYYL4U6X.js} +2 -2
  75. package/dist/{chunk-6GC5SGFE.js → chunk-L24JROPR.js} +2 -2
  76. package/dist/{chunk-Q5ZU3RNY.js → chunk-LQ6JI4VH.js} +2 -2
  77. package/dist/{chunk-GWKCEM3S.js → chunk-MCQDSY4G.js} +3 -3
  78. package/dist/{chunk-HP5FMB6L.js → chunk-MDJURR27.js} +2 -2
  79. package/dist/{chunk-FYEVFGJD.js → chunk-NN7QYW5W.js} +2 -2
  80. package/dist/chunk-NN7QYW5W.js.map +1 -0
  81. package/dist/{chunk-2ODBA7MQ.js → chunk-NU3CSQ4H.js} +5 -5
  82. package/dist/chunk-NU3CSQ4H.js.map +1 -0
  83. package/dist/{chunk-T2PO5MUF.js → chunk-O7GOFAM3.js} +2 -2
  84. package/dist/{chunk-Z2OXSMZK.js → chunk-OBXTMFZQ.js} +3 -3
  85. package/dist/{chunk-K6ZN34WC.js → chunk-OV4D5T7V.js} +3 -3
  86. package/dist/{chunk-OMLIFZ4I.js → chunk-PH3HOKYW.js} +2 -2
  87. package/dist/{chunk-C3IW2F5Z.js → chunk-PLBIPT6I.js} +2 -2
  88. package/dist/{chunk-QY7YA7OL.js → chunk-PNLCEFE4.js} +2 -2
  89. package/dist/{chunk-AGRPGAKR.js → chunk-PONNZ54D.js} +2 -2
  90. package/dist/{chunk-XZ4WBBB5.js → chunk-PWFWCGOO.js} +2 -2
  91. package/dist/{chunk-XWEXT4XU.js → chunk-QANVLERJ.js} +4 -4
  92. package/dist/{chunk-W4RVMTHR.js → chunk-QRDOSYOR.js} +2 -2
  93. package/dist/{chunk-OXNOINIP.js → chunk-QVMXQGT7.js} +24 -24
  94. package/dist/chunk-QVMXQGT7.js.map +1 -0
  95. package/dist/{chunk-6IMKOIZ6.js → chunk-R6OVFAX6.js} +2 -2
  96. package/dist/{chunk-5N5DXYDW.js → chunk-S2OU5DZY.js} +31 -10
  97. package/dist/chunk-S2OU5DZY.js.map +1 -0
  98. package/dist/{chunk-JOASJWQR.js → chunk-SANZHXY2.js} +2 -2
  99. package/dist/{chunk-7DTASS5T.js → chunk-SJHM6I4J.js} +2 -2
  100. package/dist/{chunk-M6BVYHBU.js → chunk-STOEE37X.js} +4 -4
  101. package/dist/{chunk-GKKAXVAJ.js → chunk-U33LWTQQ.js} +1 -7
  102. package/dist/chunk-U33LWTQQ.js.map +1 -0
  103. package/dist/{chunk-LXH3DIF2.js → chunk-U7D7NP4J.js} +2 -2
  104. package/dist/{chunk-DRD2Q7HQ.js → chunk-UFS7OXGL.js} +2 -2
  105. package/dist/{chunk-H3HDXD3U.js → chunk-UPTZYUYJ.js} +2 -2
  106. package/dist/{chunk-3Z7NPD5T.js → chunk-UTYBJR7M.js} +2 -2
  107. package/dist/{chunk-LN4YGHTM.js → chunk-UUH4YQOF.js} +2 -2
  108. package/dist/{chunk-6VF75M3X.js → chunk-VGUOEDTU.js} +2 -2
  109. package/dist/{chunk-44VFF3BB.js → chunk-VILEUJXC.js} +2 -2
  110. package/dist/{chunk-7SI52C65.js → chunk-VL7DP3OW.js} +2 -2
  111. package/dist/{chunk-7DHTMOND.js → chunk-VQ34TERH.js} +2 -2
  112. package/dist/{chunk-6VMIHVGO.js → chunk-VX6OBUDW.js} +2 -2
  113. package/dist/{chunk-EW5KFXHL.js → chunk-WDXCNJSF.js} +7 -7
  114. package/dist/{chunk-FMEKEF47.js → chunk-WIHPNY65.js} +79 -3
  115. package/dist/chunk-WIHPNY65.js.map +1 -0
  116. package/dist/{chunk-X6IRLNOO.js → chunk-WIWPSQYU.js} +2 -2
  117. package/dist/{chunk-DOCTITOP.js → chunk-WRFKZEO6.js} +2 -2
  118. package/dist/{chunk-E6ZDCOHM.js → chunk-XBZQRZ6G.js} +2 -2
  119. package/dist/{chunk-7YX23JBA.js → chunk-XHYGJVXL.js} +2 -2
  120. package/dist/{chunk-JD4SCARD.js → chunk-YN4ZT4CW.js} +1 -1
  121. package/dist/{chunk-YXWAILM4.js → chunk-YOI3ELXF.js} +2 -2
  122. package/dist/{chunk-XCAZF7KQ.js → chunk-ZA2S2VLL.js} +2 -2
  123. package/dist/{chunk-BEUDU7Y4.js → chunk-ZCWIH4LH.js} +2 -2
  124. package/dist/{chunk-V25ZAOSB.js → chunk-ZPTISBQU.js} +5 -5
  125. package/dist/{cli-ooj6JQBS.d.ts → cli-D8nZ2MPH.d.ts} +2 -2
  126. package/dist/cli.d.ts +4 -3
  127. package/dist/cli.js +44 -44
  128. package/dist/compounding/engine.js +4 -4
  129. package/dist/compounding/preference-consolidator.js +1 -1
  130. package/dist/config.js +2 -2
  131. package/dist/connectors/codex-materialize-runner.js +4 -4
  132. package/dist/connectors/codex-materialize.js +2 -2
  133. package/dist/connectors/index.js +5 -5
  134. package/dist/contradiction/index.js +3 -3
  135. package/dist/{contradiction-scan-AZTGFMPY.js → contradiction-scan-HWGEOUDS.js} +3 -3
  136. package/dist/conversation-index/backend.js +5 -5
  137. package/dist/conversation-index/cleanup.js +2 -2
  138. package/dist/conversation-index/faiss-adapter.js +2 -2
  139. package/dist/conversation-index/indexer.js +2 -2
  140. package/dist/conversation-index/search.js +2 -2
  141. package/dist/day-summary.js +2 -2
  142. package/dist/embedding-fallback.js +2 -2
  143. package/dist/entity-retrieval.js +4 -4
  144. package/dist/explicit-capture.d.ts +2 -1
  145. package/dist/explicit-capture.js +1 -1
  146. package/dist/extraction-judge-telemetry.js +2 -2
  147. package/dist/extraction-judge-training.js +2 -2
  148. package/dist/extraction-judge.js +5 -5
  149. package/dist/extraction.js +9 -9
  150. package/dist/fallback-llm.js +4 -4
  151. package/dist/{graph-edge-decay-KSVJGCZW.js → graph-edge-decay-D7OESCBR.js} +2 -2
  152. package/dist/graph-snapshot.js +2 -2
  153. package/dist/graph.js +1 -1
  154. package/dist/index.d.ts +5 -4
  155. package/dist/index.js +80 -80
  156. package/dist/lcm/archive.js +2 -2
  157. package/dist/lcm/engine.js +5 -5
  158. package/dist/lcm/index.js +5 -5
  159. package/dist/lcm/schema.js +2 -2
  160. package/dist/lcm/summarizer.js +3 -3
  161. package/dist/local-llm.js +2 -2
  162. package/dist/logger.js +1 -1
  163. package/dist/maintenance/memory-governance.js +3 -3
  164. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  165. package/dist/maintenance/rebuild-memory-projection.js +5 -5
  166. package/dist/mcp-memory-inspector-app.d.ts +3 -2
  167. package/dist/model-registry.js +2 -2
  168. package/dist/models-json.js +2 -2
  169. package/dist/namespaces/migrate.d.ts +1 -0
  170. package/dist/namespaces/migrate.js +16 -16
  171. package/dist/namespaces/search.js +13 -13
  172. package/dist/namespaces/storage.d.ts +42 -1
  173. package/dist/namespaces/storage.js +3 -3
  174. package/dist/native-knowledge.js +2 -2
  175. package/dist/negative.js +2 -2
  176. package/dist/operator-toolkit.js +22 -22
  177. package/dist/{orchestrator-DIDDvwDw.d.ts → orchestrator-CA6ouzBn.d.ts} +3 -464
  178. package/dist/orchestrator.d.ts +2 -1
  179. package/dist/orchestrator.js +61 -61
  180. package/dist/profiling.js +2 -2
  181. package/dist/qmd.js +2 -2
  182. package/dist/recall-planner-llm.js +4 -4
  183. package/dist/recall-qos.js +2 -2
  184. package/dist/recall-state.js +2 -2
  185. package/dist/relevance.js +2 -2
  186. package/dist/{resolution-IDTEBJFS.js → resolution-MN36NW5P.js} +3 -3
  187. package/dist/resolve-provider-secret.js +2 -2
  188. package/dist/resume-bundles.js +4 -4
  189. package/dist/retrieval-agents.js +2 -2
  190. package/dist/routing/store.js +2 -2
  191. package/dist/schemas.d.ts +38 -38
  192. package/dist/search/embed-helper.js +2 -2
  193. package/dist/search/factory.js +12 -12
  194. package/dist/search/index.js +12 -12
  195. package/dist/search/lancedb-backend.js +2 -2
  196. package/dist/search/meilisearch-backend.js +2 -2
  197. package/dist/search/orama-backend.js +2 -2
  198. package/dist/search/remote-backend.js +2 -2
  199. package/dist/semantic-consolidation.js +5 -5
  200. package/dist/semantic-rule-promotion.js +3 -3
  201. package/dist/semantic-rule-verifier.js +3 -3
  202. package/dist/session-observer-state.js +2 -2
  203. package/dist/session-transcript-migration.js +2 -2
  204. package/dist/shared-context/manager.js +2 -2
  205. package/dist/storage.d.ts +4 -0
  206. package/dist/storage.js +2 -2
  207. package/dist/summarizer.js +7 -7
  208. package/dist/temporal-supersession.js +2 -2
  209. package/dist/threading.js +2 -2
  210. package/dist/transcript.js +2 -2
  211. package/dist/transfer/types.d.ts +22 -22
  212. package/dist/verified-recall.js +4 -4
  213. package/package.json +2 -2
  214. package/src/access-boundary.ts +2 -1
  215. package/src/access-cli.ts +94 -4
  216. package/src/access-http.ts +40 -2
  217. package/src/access-mcp.ts +55 -2
  218. package/src/access-operations.ts +66 -0
  219. package/src/access-service.ts +148 -73
  220. package/src/access-surface-catalog.test.ts +1 -1
  221. package/src/access-surface-catalog.ts +2 -0
  222. package/src/cli.ts +2 -1
  223. package/src/coding/decision-surfaces.test.ts +279 -0
  224. package/src/coding/decision-surfaces.ts +475 -0
  225. package/src/explicit-capture.ts +3 -12
  226. package/src/logger.ts +13 -4
  227. package/src/namespaces/catalog.test.ts +2 -2
  228. package/src/namespaces/storage.ts +81 -0
  229. package/src/orchestrator.ts +22 -64
  230. package/src/storage.ts +36 -36
  231. package/dist/chunk-2L3KLWOV.js.map +0 -1
  232. package/dist/chunk-2ODBA7MQ.js.map +0 -1
  233. package/dist/chunk-3EVIMVQU.js.map +0 -1
  234. package/dist/chunk-3MY4W5V4.js.map +0 -1
  235. package/dist/chunk-53FDU4CE.js.map +0 -1
  236. package/dist/chunk-5N5DXYDW.js.map +0 -1
  237. package/dist/chunk-5OE4PYY5.js.map +0 -1
  238. package/dist/chunk-FMEKEF47.js.map +0 -1
  239. package/dist/chunk-FYEVFGJD.js.map +0 -1
  240. package/dist/chunk-GKKAXVAJ.js.map +0 -1
  241. package/dist/chunk-OXNOINIP.js.map +0 -1
  242. /package/dist/{auto-sync-5CJBJMPZ.js.map → auto-sync-NUQWSFQD.js.map} +0 -0
  243. /package/dist/{chunk-ROHLEUTH.js.map → chunk-2KAYTPPT.js.map} +0 -0
  244. /package/dist/{chunk-NHQGDVJF.js.map → chunk-2SJCWLQD.js.map} +0 -0
  245. /package/dist/{chunk-YTWNKQ2G.js.map → chunk-3FC6LW6T.js.map} +0 -0
  246. /package/dist/{chunk-XEA4Z7JU.js.map → chunk-4FE2K57M.js.map} +0 -0
  247. /package/dist/{chunk-WI7JKV2T.js.map → chunk-4N3TFFPH.js.map} +0 -0
  248. /package/dist/{chunk-BTVX7ZXZ.js.map → chunk-4NFVPDIL.js.map} +0 -0
  249. /package/dist/{chunk-OUWAQVDJ.js.map → chunk-5CEJH5ZN.js.map} +0 -0
  250. /package/dist/{chunk-6QM24CP7.js.map → chunk-6GJS4BFH.js.map} +0 -0
  251. /package/dist/{chunk-J2FBJ63F.js.map → chunk-6O6A6YUO.js.map} +0 -0
  252. /package/dist/{chunk-HQ6NIBL6.js.map → chunk-7FL4CNPV.js.map} +0 -0
  253. /package/dist/{chunk-5VDJMYTF.js.map → chunk-7WWURLG6.js.map} +0 -0
  254. /package/dist/{chunk-QWRC7GIO.js.map → chunk-A4HH2EWA.js.map} +0 -0
  255. /package/dist/{chunk-4SKKVWLQ.js.map → chunk-AGJH5ISO.js.map} +0 -0
  256. /package/dist/{chunk-WRE3JPAW.js.map → chunk-B4XVLHJA.js.map} +0 -0
  257. /package/dist/{chunk-AJU4PJGY.js.map → chunk-BVKCV2ZY.js.map} +0 -0
  258. /package/dist/{chunk-DQY7NJ5L.js.map → chunk-CTOQEZSN.js.map} +0 -0
  259. /package/dist/{chunk-7OGJQP7T.js.map → chunk-DCWIQFNA.js.map} +0 -0
  260. /package/dist/{chunk-MHQC2WU2.js.map → chunk-DKTSR7EK.js.map} +0 -0
  261. /package/dist/{chunk-RN7MUWON.js.map → chunk-EHISUJFN.js.map} +0 -0
  262. /package/dist/{chunk-WLEB7WCG.js.map → chunk-EO5QWINU.js.map} +0 -0
  263. /package/dist/{chunk-XKXKSQU7.js.map → chunk-EXM3CQTZ.js.map} +0 -0
  264. /package/dist/{chunk-M3FWYURP.js.map → chunk-FE6DQUNJ.js.map} +0 -0
  265. /package/dist/{chunk-LCC5EZTT.js.map → chunk-FIVDN2SM.js.map} +0 -0
  266. /package/dist/{chunk-452WDNFO.js.map → chunk-GG6AJN7A.js.map} +0 -0
  267. /package/dist/{chunk-2IBGHRIO.js.map → chunk-GS55WYRL.js.map} +0 -0
  268. /package/dist/{chunk-IBTZEBUD.js.map → chunk-HYNHLBKA.js.map} +0 -0
  269. /package/dist/{chunk-EVWIEEKZ.js.map → chunk-IQ7WCZRW.js.map} +0 -0
  270. /package/dist/{chunk-B5XMS73R.js.map → chunk-IQVQJJL7.js.map} +0 -0
  271. /package/dist/{chunk-6RHNCKHG.js.map → chunk-K43PI6DQ.js.map} +0 -0
  272. /package/dist/{chunk-OIF36KGD.js.map → chunk-KCQA46NR.js.map} +0 -0
  273. /package/dist/{chunk-2LDBXPLB.js.map → chunk-KF74X62T.js.map} +0 -0
  274. /package/dist/{chunk-MAV46GWQ.js.map → chunk-KYYL4U6X.js.map} +0 -0
  275. /package/dist/{chunk-6GC5SGFE.js.map → chunk-L24JROPR.js.map} +0 -0
  276. /package/dist/{chunk-Q5ZU3RNY.js.map → chunk-LQ6JI4VH.js.map} +0 -0
  277. /package/dist/{chunk-GWKCEM3S.js.map → chunk-MCQDSY4G.js.map} +0 -0
  278. /package/dist/{chunk-HP5FMB6L.js.map → chunk-MDJURR27.js.map} +0 -0
  279. /package/dist/{chunk-T2PO5MUF.js.map → chunk-O7GOFAM3.js.map} +0 -0
  280. /package/dist/{chunk-Z2OXSMZK.js.map → chunk-OBXTMFZQ.js.map} +0 -0
  281. /package/dist/{chunk-K6ZN34WC.js.map → chunk-OV4D5T7V.js.map} +0 -0
  282. /package/dist/{chunk-OMLIFZ4I.js.map → chunk-PH3HOKYW.js.map} +0 -0
  283. /package/dist/{chunk-C3IW2F5Z.js.map → chunk-PLBIPT6I.js.map} +0 -0
  284. /package/dist/{chunk-QY7YA7OL.js.map → chunk-PNLCEFE4.js.map} +0 -0
  285. /package/dist/{chunk-AGRPGAKR.js.map → chunk-PONNZ54D.js.map} +0 -0
  286. /package/dist/{chunk-XZ4WBBB5.js.map → chunk-PWFWCGOO.js.map} +0 -0
  287. /package/dist/{chunk-XWEXT4XU.js.map → chunk-QANVLERJ.js.map} +0 -0
  288. /package/dist/{chunk-W4RVMTHR.js.map → chunk-QRDOSYOR.js.map} +0 -0
  289. /package/dist/{chunk-6IMKOIZ6.js.map → chunk-R6OVFAX6.js.map} +0 -0
  290. /package/dist/{chunk-JOASJWQR.js.map → chunk-SANZHXY2.js.map} +0 -0
  291. /package/dist/{chunk-7DTASS5T.js.map → chunk-SJHM6I4J.js.map} +0 -0
  292. /package/dist/{chunk-M6BVYHBU.js.map → chunk-STOEE37X.js.map} +0 -0
  293. /package/dist/{chunk-LXH3DIF2.js.map → chunk-U7D7NP4J.js.map} +0 -0
  294. /package/dist/{chunk-DRD2Q7HQ.js.map → chunk-UFS7OXGL.js.map} +0 -0
  295. /package/dist/{chunk-H3HDXD3U.js.map → chunk-UPTZYUYJ.js.map} +0 -0
  296. /package/dist/{chunk-3Z7NPD5T.js.map → chunk-UTYBJR7M.js.map} +0 -0
  297. /package/dist/{chunk-LN4YGHTM.js.map → chunk-UUH4YQOF.js.map} +0 -0
  298. /package/dist/{chunk-6VF75M3X.js.map → chunk-VGUOEDTU.js.map} +0 -0
  299. /package/dist/{chunk-44VFF3BB.js.map → chunk-VILEUJXC.js.map} +0 -0
  300. /package/dist/{chunk-7SI52C65.js.map → chunk-VL7DP3OW.js.map} +0 -0
  301. /package/dist/{chunk-7DHTMOND.js.map → chunk-VQ34TERH.js.map} +0 -0
  302. /package/dist/{chunk-6VMIHVGO.js.map → chunk-VX6OBUDW.js.map} +0 -0
  303. /package/dist/{chunk-EW5KFXHL.js.map → chunk-WDXCNJSF.js.map} +0 -0
  304. /package/dist/{chunk-X6IRLNOO.js.map → chunk-WIWPSQYU.js.map} +0 -0
  305. /package/dist/{chunk-DOCTITOP.js.map → chunk-WRFKZEO6.js.map} +0 -0
  306. /package/dist/{chunk-E6ZDCOHM.js.map → chunk-XBZQRZ6G.js.map} +0 -0
  307. /package/dist/{chunk-7YX23JBA.js.map → chunk-XHYGJVXL.js.map} +0 -0
  308. /package/dist/{chunk-JD4SCARD.js.map → chunk-YN4ZT4CW.js.map} +0 -0
  309. /package/dist/{chunk-YXWAILM4.js.map → chunk-YOI3ELXF.js.map} +0 -0
  310. /package/dist/{chunk-XCAZF7KQ.js.map → chunk-ZA2S2VLL.js.map} +0 -0
  311. /package/dist/{chunk-BEUDU7Y4.js.map → chunk-ZCWIH4LH.js.map} +0 -0
  312. /package/dist/{chunk-V25ZAOSB.js.map → chunk-ZPTISBQU.js.map} +0 -0
  313. /package/dist/{contradiction-scan-AZTGFMPY.js.map → contradiction-scan-HWGEOUDS.js.map} +0 -0
  314. /package/dist/{graph-edge-decay-KSVJGCZW.js.map → graph-edge-decay-D7OESCBR.js.map} +0 -0
  315. /package/dist/{resolution-IDTEBJFS.js.map → resolution-MN36NW5P.js.map} +0 -0
@@ -58,10 +58,10 @@ import {
58
58
  listMemoryGovernanceRuns,
59
59
  readMemoryGovernanceRunArtifact,
60
60
  runMemoryGovernance
61
- } from "./chunk-WI7JKV2T.js";
61
+ } from "./chunk-4N3TFFPH.js";
62
62
  import {
63
63
  namespaceCollectionName
64
- } from "./chunk-DQY7NJ5L.js";
64
+ } from "./chunk-CTOQEZSN.js";
65
65
  import {
66
66
  namespaceIdentityFromToken
67
67
  } from "./chunk-ZFXCQPNO.js";
@@ -70,18 +70,18 @@ import {
70
70
  } from "./chunk-EIR5VLIH.js";
71
71
  import {
72
72
  buildGraphSnapshot
73
- } from "./chunk-YXWAILM4.js";
73
+ } from "./chunk-YOI3ELXF.js";
74
74
  import {
75
75
  persistExplicitCapture,
76
76
  queueExplicitCaptureForReview,
77
77
  validateExplicitCaptureInput
78
- } from "./chunk-GKKAXVAJ.js";
78
+ } from "./chunk-U33LWTQQ.js";
79
79
  import {
80
80
  wrapWorkLayerContext
81
81
  } from "./chunk-EI6V5UXY.js";
82
82
  import {
83
83
  formatProfileTraceAscii
84
- } from "./chunk-QY7YA7OL.js";
84
+ } from "./chunk-PNLCEFE4.js";
85
85
  import {
86
86
  buildProcedurePersistBody,
87
87
  normalizeProcedureSteps
@@ -95,16 +95,16 @@ import {
95
95
  import {
96
96
  filterTrajectoriesByLookbackDays,
97
97
  readCausalTrajectoryRecords
98
- } from "./chunk-JD4SCARD.js";
98
+ } from "./chunk-YN4ZT4CW.js";
99
99
  import {
100
100
  FileCalendarSource,
101
101
  buildBriefing,
102
102
  parseBriefingFocus,
103
103
  parseBriefingWindow
104
- } from "./chunk-K6ZN34WC.js";
104
+ } from "./chunk-OV4D5T7V.js";
105
105
  import {
106
106
  parseEntityFile
107
- } from "./chunk-53FDU4CE.js";
107
+ } from "./chunk-BLIWOONZ.js";
108
108
  import {
109
109
  DEFAULT_RECALL_DISCLOSURE,
110
110
  isRecallDisclosure
@@ -151,7 +151,7 @@ import {
151
151
  } from "./chunk-UZYLX7M6.js";
152
152
  import {
153
153
  log
154
- } from "./chunk-2ODBA7MQ.js";
154
+ } from "./chunk-NU3CSQ4H.js";
155
155
  import {
156
156
  AccessAuditAdapter
157
157
  } from "./chunk-TVVEYCNW.js";
@@ -167,6 +167,448 @@ import { constants as fsConstants } from "fs";
167
167
  import { createHash as createHash2 } from "crypto";
168
168
  import { ZodError } from "zod";
169
169
 
170
+ // src/coding/decision-records.ts
171
+ var DECISION_STATUSES = [
172
+ "proposed",
173
+ "accepted",
174
+ "superseded",
175
+ "rejected"
176
+ ];
177
+ var ACTIVE_DECISION_STATUSES = /* @__PURE__ */ new Set([
178
+ "proposed",
179
+ "accepted"
180
+ ]);
181
+ var DEFAULT_DECISION_STATUS = "proposed";
182
+ var DECISION_STATUS_BY_VALUE = Object.freeze({
183
+ proposed: "proposed",
184
+ accepted: "accepted",
185
+ superseded: "superseded",
186
+ rejected: "rejected"
187
+ });
188
+ function isDecisionStatus(value) {
189
+ return typeof value === "string" && Object.prototype.hasOwnProperty.call(DECISION_STATUS_BY_VALUE, value);
190
+ }
191
+ var FRONTMATTER_KEYS = Object.freeze([
192
+ "id",
193
+ "title",
194
+ "status",
195
+ "context",
196
+ "decision",
197
+ "consequences",
198
+ "entityRefs",
199
+ "supersedes"
200
+ ]);
201
+ function serializeDecisionRecord(record) {
202
+ const lines = ["---"];
203
+ for (const key of FRONTMATTER_KEYS) {
204
+ const present = key === "supersedes" ? record.supersedes !== void 0 : key === "consequences" ? record.consequences !== void 0 : true;
205
+ if (!present) continue;
206
+ lines.push(`${key}: ${encodeFrontmatterValue(key, record)}`);
207
+ }
208
+ lines.push("---", "");
209
+ if (record.context) lines.push(record.context);
210
+ lines.push("");
211
+ lines.push("# Decision");
212
+ lines.push("");
213
+ if (record.decision) lines.push(record.decision);
214
+ if (record.consequences !== void 0 && record.consequences.length > 0) {
215
+ lines.push("");
216
+ lines.push("# Consequences");
217
+ lines.push("");
218
+ lines.push(record.consequences);
219
+ }
220
+ if (record.entityRefs.length > 0) {
221
+ lines.push("");
222
+ lines.push("# Entity references");
223
+ for (const ref of record.entityRefs) lines.push(`- ${ref}`);
224
+ }
225
+ lines.push("");
226
+ return lines.join("\n");
227
+ }
228
+ function encodeFrontmatterValue(key, record) {
229
+ if (key === "entityRefs") {
230
+ const refs = record.entityRefs;
231
+ if (refs.length === 0) return "[]";
232
+ const inner = refs.map((ref) => `"${escapeYamlString(ref)}"`).join(", ");
233
+ return `[${inner}]`;
234
+ }
235
+ if (key === "status") return `"${record.status}"`;
236
+ if (key === "supersedes") return `"${record.supersedes ?? ""}"`;
237
+ if (key === "consequences") return `"${escapeYamlString(record.consequences ?? "")}"`;
238
+ const value = record[key];
239
+ return `"${escapeYamlString(typeof value === "string" ? value : String(value))}"`;
240
+ }
241
+ function escapeYamlString(value) {
242
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n");
243
+ }
244
+ function parseDecisionRecord(raw) {
245
+ const { fields, body } = extractFrontmatter(raw);
246
+ for (const fieldKey of Object.keys(fields)) {
247
+ if (!FRONTMATTER_KEYS.includes(fieldKey)) {
248
+ throw new Error(
249
+ `decision record frontmatter contains unknown key '${fieldKey}'; valid keys are ${FRONTMATTER_KEYS.join(", ")}.`
250
+ );
251
+ }
252
+ }
253
+ const id = requireString(fields.id, "id");
254
+ const title = requireString(fields.title, "title");
255
+ const context = requireString(fields.context, "context");
256
+ const decision = requireString(fields.decision, "decision");
257
+ const consequences = fields.consequences === void 0 ? void 0 : requireString(fields.consequences, "consequences");
258
+ let status = DEFAULT_DECISION_STATUS;
259
+ if (fields.status !== void 0 && fields.status !== null) {
260
+ if (!isDecisionStatus(fields.status)) {
261
+ throw new Error(
262
+ `decision '${id}' has invalid status '${JSON.stringify(fields.status)}'; valid statuses are ${DECISION_STATUSES.join(", ")}.`
263
+ );
264
+ }
265
+ status = fields.status;
266
+ }
267
+ const entityRefs = parseEntityRefs(fields.entityRefs);
268
+ const supersedes = fields.supersedes === void 0 ? void 0 : requireString(fields.supersedes, "supersedes");
269
+ const record = {
270
+ id,
271
+ title,
272
+ status,
273
+ context,
274
+ decision,
275
+ consequences,
276
+ entityRefs,
277
+ ...supersedes !== void 0 ? { supersedes } : {}
278
+ };
279
+ void body;
280
+ return record;
281
+ }
282
+ function requireString(field, key) {
283
+ if (field === void 0 || field === null) {
284
+ throw new Error(`decision record frontmatter is missing required field '${key}'.`);
285
+ }
286
+ if (typeof field !== "string") {
287
+ throw new Error(
288
+ `decision record frontmatter field '${key}' must be a string; got ${JSON.stringify(field)}.`
289
+ );
290
+ }
291
+ return field;
292
+ }
293
+ function parseEntityRefs(field) {
294
+ if (field === void 0) return [];
295
+ if (!Array.isArray(field)) {
296
+ throw new Error(
297
+ `decision record frontmatter field 'entityRefs' must be an array of strings; got ${JSON.stringify(field)}.`
298
+ );
299
+ }
300
+ for (const entry of field) {
301
+ if (typeof entry !== "string") {
302
+ throw new Error(
303
+ `decision record frontmatter 'entityRefs' entries must be strings; got ${JSON.stringify(entry)}.`
304
+ );
305
+ }
306
+ }
307
+ return [...field];
308
+ }
309
+ function extractFrontmatter(raw) {
310
+ const text = raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw;
311
+ if (!text.startsWith("---\n")) {
312
+ throw new Error(
313
+ "decision record must start with a YAML frontmatter fence (`---\\n`); got a document with no leading fence."
314
+ );
315
+ }
316
+ const closeAt = text.indexOf("\n---", 4);
317
+ if (closeAt === -1) {
318
+ throw new Error(
319
+ "decision record frontmatter is missing its closing fence (`\\n---`); the document is truncated."
320
+ );
321
+ }
322
+ const yamlBody = text.slice(4, closeAt);
323
+ const after = text.slice(closeAt + 4);
324
+ const body = after.startsWith("\n") ? after.slice(1) : after;
325
+ return { fields: parseYamlMapping(yamlBody), body };
326
+ }
327
+ function parseYamlMapping(input) {
328
+ const fields = {};
329
+ for (const rawLine of input.split("\n")) {
330
+ const line = rawLine.trimEnd();
331
+ if (line.length === 0 || line.startsWith("#")) continue;
332
+ const colonAt = line.indexOf(":");
333
+ if (colonAt === -1) {
334
+ throw new Error(`decision record frontmatter line is not a key:value pair: "${line}".`);
335
+ }
336
+ const key = line.slice(0, colonAt).trim();
337
+ const valueText = line.slice(colonAt + 1).trim();
338
+ if (key.length === 0) {
339
+ throw new Error(`decision record frontmatter has an empty key in line: "${line}".`);
340
+ }
341
+ fields[key] = decodeScalar(valueText);
342
+ }
343
+ return fields;
344
+ }
345
+ function decodeScalar(valueText) {
346
+ if (valueText.length === 0) return "";
347
+ const lower = valueText.toLowerCase();
348
+ if (lower === "true") return true;
349
+ if (lower === "false") return false;
350
+ if (lower === "null" || lower === "~") return null;
351
+ if (/^-?\d+$/.test(valueText)) return Number(valueText);
352
+ if (/^".*"$/.test(valueText)) {
353
+ return valueText.slice(1, -1).replace(/\\\\/g, "\0").replace(/\\n/g, "\n").replace(/\\"/g, '"').replace(/\u0000/g, "\\");
354
+ }
355
+ if (/^\[.*\]$/.test(valueText)) return parseFlowList(valueText);
356
+ return valueText;
357
+ }
358
+ function parseFlowList(valueText) {
359
+ const inner = valueText.slice(1, -1).trim();
360
+ if (inner.length === 0) return [];
361
+ const out = [];
362
+ let buf = "";
363
+ let inQuotes = false;
364
+ let escaped = false;
365
+ for (let i = 0; i < inner.length; i += 1) {
366
+ const c = inner[i];
367
+ if (escaped) {
368
+ buf += c;
369
+ escaped = false;
370
+ continue;
371
+ }
372
+ if (c === "\\") {
373
+ buf += c;
374
+ escaped = true;
375
+ continue;
376
+ }
377
+ if (c === '"') {
378
+ inQuotes = !inQuotes;
379
+ buf += c;
380
+ continue;
381
+ }
382
+ if (c === "," && !inQuotes) {
383
+ out.push(stripFlowStringQuotes(buf.trim()));
384
+ buf = "";
385
+ continue;
386
+ }
387
+ buf += c;
388
+ }
389
+ if (buf.length > 0) out.push(stripFlowStringQuotes(buf.trim()));
390
+ return out;
391
+ }
392
+ function stripFlowStringQuotes(value) {
393
+ if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) {
394
+ return value.slice(1, -1).replace(/\\\\/g, "\0").replace(/\\n/g, "\n").replace(/\\"/g, '"').replace(/\u0000/g, "\\");
395
+ }
396
+ return value;
397
+ }
398
+
399
+ // src/coding/decision-surfaces.ts
400
+ var DECISION_SUBCOMMANDS = [
401
+ "list",
402
+ "get",
403
+ "record",
404
+ "supersede"
405
+ ];
406
+ function isDecisionRecordSurfaceEnabled(config, codingContext) {
407
+ return config.enabled === true && config.decisionRecords === true && codingContext != null;
408
+ }
409
+ async function handleCodingDecision(request, ctx) {
410
+ const codingContext = request.sessionKey ? ctx.getCodingContext(request.sessionKey) : null;
411
+ if (!isDecisionRecordSurfaceEnabled(ctx.codingKnowledge, codingContext)) {
412
+ ctx.throwInputError(
413
+ "coding_decision requires codingKnowledge.enabled, codingKnowledge.decisionRecords, and an attached coding context"
414
+ );
415
+ }
416
+ switch (request.subcommand) {
417
+ case "list":
418
+ return decisionList(request, ctx);
419
+ case "get":
420
+ return decisionGet(request, ctx);
421
+ case "record":
422
+ return decisionRecord(request, ctx);
423
+ case "supersede":
424
+ return decisionSupersede(request, ctx);
425
+ }
426
+ }
427
+ async function decisionList(request, ctx) {
428
+ const storage = await ctx.resolveStorage(request);
429
+ const memories = await storage.readAllMemories();
430
+ const records = [];
431
+ for (const m of memories) {
432
+ if (m.frontmatter.category !== "decision") continue;
433
+ const memStatus = m.frontmatter.status;
434
+ if (memStatus && memStatus !== "active") continue;
435
+ const parsed = safeParseDecisionRecord(m.content);
436
+ if (!parsed) continue;
437
+ const structStatus = m.frontmatter.structuredAttributes?.decisionStatus;
438
+ const effectiveStatus = structStatus ?? parsed.status;
439
+ records.push({
440
+ id: m.frontmatter.id,
441
+ title: parsed.title,
442
+ status: effectiveStatus,
443
+ entityRefs: parsed.entityRefs,
444
+ supersedes: parsed.supersedes
445
+ });
446
+ }
447
+ const visible = records.filter(
448
+ (r) => ACTIVE_DECISION_STATUSES.has(r.status)
449
+ );
450
+ return { subcommand: "list", records: visible, count: visible.length };
451
+ }
452
+ async function decisionGet(request, ctx) {
453
+ if (!request.id?.trim()) {
454
+ ctx.throwInputError("id is required for the 'get' subcommand");
455
+ }
456
+ const storage = await ctx.resolveStorage(request);
457
+ const memory = await storage.getMemoryById(request.id);
458
+ if (!memory || memory.frontmatter.category !== "decision") {
459
+ return { subcommand: "get", found: false };
460
+ }
461
+ const parsed = safeParseDecisionRecord(memory.content);
462
+ if (!parsed) {
463
+ return { subcommand: "get", found: false };
464
+ }
465
+ const structStatus = memory.frontmatter.structuredAttributes?.decisionStatus;
466
+ return {
467
+ subcommand: "get",
468
+ found: true,
469
+ record: {
470
+ id: memory.frontmatter.id,
471
+ title: parsed.title,
472
+ status: structStatus ?? parsed.status,
473
+ context: parsed.context,
474
+ decision: parsed.decision,
475
+ consequences: parsed.consequences,
476
+ entityRefs: parsed.entityRefs,
477
+ supersedes: parsed.supersedes
478
+ }
479
+ };
480
+ }
481
+ async function decisionRecord(request, ctx) {
482
+ if (!request.title?.trim()) {
483
+ ctx.throwInputError("title is required for the 'record' subcommand");
484
+ }
485
+ if (!request.decision?.trim()) {
486
+ ctx.throwInputError("decision is required for the 'record' subcommand");
487
+ }
488
+ const status = request.status?.trim() ? isDecisionStatus(request.status) ? request.status : raiseInvalidStatus(request.status, ctx) : DEFAULT_DECISION_STATUS;
489
+ const record = {
490
+ id: "",
491
+ title: request.title.trim(),
492
+ status,
493
+ context: request.context?.trim() ?? "",
494
+ decision: request.decision.trim(),
495
+ consequences: request.consequences?.trim() ?? "",
496
+ entityRefs: request.entityRefs ?? []
497
+ };
498
+ const content = serializeDecisionRecord(record);
499
+ const storage = await ctx.resolveStorage(request);
500
+ const isActive = ACTIVE_DECISION_STATUSES.has(status);
501
+ const memoryId = await storage.writeMemory("decision", content, {
502
+ confidence: 1,
503
+ tags: ["decision-record"],
504
+ source: "coding-decision",
505
+ // Persist the decision lifecycle in BOTH places so generic
506
+ // recall/search/maintenance (which read frontmatter.status) and the
507
+ // decision list/get projection (which reads structuredAttributes) agree:
508
+ // - structuredAttributes.decisionStatus is the authoritative decision
509
+ // marker, mirrored from the serialized body (one source of truth);
510
+ // - frontmatter.status is set to "archived" for inactive decisions
511
+ // (rejected/superseded) so the outer memory pipeline excludes them
512
+ // from the active corpus exactly like a supersede does (review P2:
513
+ // persist inactive decision statuses in frontmatter).
514
+ structuredAttributes: { decisionStatus: status },
515
+ status: isActive ? void 0 : "archived"
516
+ });
517
+ log.info(
518
+ `access-write op=coding_decision/record memoryId=${memoryId} status=${status}`
519
+ );
520
+ return { subcommand: "record", memoryId, status };
521
+ }
522
+ async function decisionSupersede(request, ctx) {
523
+ const targetId = request.id?.trim() || request.supersedesId?.trim();
524
+ if (!targetId) {
525
+ ctx.throwInputError(
526
+ "id (or supersedesId) is required for the 'supersede' subcommand (the record being superseded)"
527
+ );
528
+ }
529
+ if (!request.title?.trim()) {
530
+ ctx.throwInputError(
531
+ "title is required for the 'supersede' subcommand (the replacement record)"
532
+ );
533
+ }
534
+ if (!request.decision?.trim()) {
535
+ ctx.throwInputError("decision is required for the 'supersede' subcommand");
536
+ }
537
+ const storage = await ctx.resolveStorage(request);
538
+ const oldMemory = await storage.getMemoryById(targetId);
539
+ if (!oldMemory || oldMemory.frontmatter.category !== "decision") {
540
+ ctx.throwInputError(`decision record not found: ${targetId}`);
541
+ }
542
+ const oldParsed = safeParseDecisionRecord(oldMemory.content);
543
+ if (!oldParsed) {
544
+ ctx.throwInputError(
545
+ `decision record is corrupted and cannot be superseded: ${targetId}`
546
+ );
547
+ }
548
+ const replacement = {
549
+ id: "",
550
+ title: request.title.trim(),
551
+ status: "accepted",
552
+ context: request.context?.trim() ?? "",
553
+ decision: request.decision.trim(),
554
+ consequences: request.consequences?.trim() ?? "",
555
+ entityRefs: request.entityRefs ?? [],
556
+ supersedes: targetId
557
+ };
558
+ const replacementContent = serializeDecisionRecord(replacement);
559
+ const replacementId = await storage.writeMemory(
560
+ "decision",
561
+ replacementContent,
562
+ {
563
+ confidence: 1,
564
+ tags: ["decision-record"],
565
+ source: "coding-decision",
566
+ // Mirror decisionRecord: persist structuredAttributes.decisionStatus on
567
+ // the replacement so list/get projection and QMD indexing see the
568
+ // authoritative marker (review: supersede omits decisionStatus attrs).
569
+ structuredAttributes: { decisionStatus: "accepted" }
570
+ }
571
+ );
572
+ try {
573
+ await storage.writeMemoryFrontmatter(oldMemory, {
574
+ status: "archived",
575
+ // Refresh the updated timestamp so the archive/supersede lifecycle event
576
+ // and browse/maintenance sort key reflect when the decision was retired,
577
+ // not when it was originally recorded (review: set updated timestamp when
578
+ // retiring old decisions).
579
+ updated: (/* @__PURE__ */ new Date()).toISOString(),
580
+ structuredAttributes: {
581
+ ...oldMemory.frontmatter.structuredAttributes ?? {},
582
+ decisionStatus: "superseded"
583
+ }
584
+ });
585
+ } catch (err) {
586
+ log.warn(
587
+ `coding_decision/supersede: replacement ${replacementId} written but old record ${targetId} status update failed \u2014 old record will still appear until retried: ${err instanceof Error ? err.message : String(err)}`
588
+ );
589
+ }
590
+ log.info(
591
+ `access-write op=coding_decision/supersede superseded=${targetId} replacement=${replacementId}`
592
+ );
593
+ return {
594
+ subcommand: "supersede",
595
+ supersededMemoryId: targetId,
596
+ replacementMemoryId: replacementId
597
+ };
598
+ }
599
+ function safeParseDecisionRecord(content) {
600
+ try {
601
+ return parseDecisionRecord(content);
602
+ } catch {
603
+ return null;
604
+ }
605
+ }
606
+ function raiseInvalidStatus(value, ctx) {
607
+ ctx.throwInputError(
608
+ `invalid decision status "${value}". Valid options: proposed, accepted, superseded, rejected`
609
+ );
610
+ }
611
+
170
612
  // src/procedural/procedure-miner.ts
171
613
  import { createHash } from "crypto";
172
614
  import { mkdir, rm, stat } from "fs/promises";
@@ -748,48 +1190,13 @@ var EngramAccessService = class {
748
1190
  }
749
1191
  return null;
750
1192
  }
751
- /**
752
- * Resolve the write namespace for explicit-write tools (memory_store /
753
- * suggestion_submit), project-scoping the write the same way recall does so a
754
- * memory stored with a client-injected `cwd`/`projectTag` is discoverable by
755
- * project-scoped recall (#1434, rule 42).
756
- *
757
- * Precedence:
758
- * - An explicit `namespace` always wins and is authorized strictly via
759
- * `resolveWritableNamespace` → `canWriteNamespace`. A coding-overlay
760
- * namespace string (`<base>-project-*`) is NOT a writable target via the
761
- * explicit field — project scoping is requested with `cwd`/`projectTag`,
762
- * never by naming the derived namespace — so there is no way to bypass the
763
- * policy allow-list by guessing/forging an overlay name (Codex review).
764
- * - With NO coding overlay, the write stays on `config.defaultNamespace` —
765
- * exactly the pre-#1434 behavior, so an unqualified write is NOT silently
766
- * moved to a principal self namespace (Codex review).
767
- * - WITH a coding overlay, the base is the principal self namespace
768
- * (`defaultNamespaceForPrincipal`, write-checked) — the SAME base recall,
769
- * observe, and the orchestrator buffer-flush write path overlay onto
770
- * (rule 42 / Cursor) — so a project-scoped store lands exactly where
771
- * project-scoped recall searches. The overlay namespace is always REBUILT
772
- * from the authenticated principal's base, never accepted as a caller
773
- * string, so a caller can never reach another principal's subtree.
774
- *
775
- * Read-only: this NEVER mutates session coding context, so the idempotency
776
- * peeks and dryRun preflights that call it stay side-effect free (Codex
777
- * review). It prefers the per-call `cwd`/`projectTag` (the project explicitly
778
- * identified for this write), else the session's existing context. The HTTP
779
- * surface lets the peek and the write each resolve independently; the peek's
780
- * namespace only gates rate-limiting (memory_store/suggestion_submit run their
781
- * own idempotency check), so a benign session-context change between the two
782
- * never fails a write — there is no namespace to "pin".
783
- */
784
- async resolveCodingScopedWriteNamespace(request) {
785
- const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
786
- if (hasExplicitNamespace) {
787
- return this.resolveWritableNamespace(
788
- request.namespace,
789
- request.sessionKey,
790
- request.authenticatedPrincipal
791
- );
792
- }
1193
+ /** Shared coding-scope derivation for the read/write resolvers below —
1194
+ * coding context, overlay, principal, scope-profile plan for an IMPLICIT
1195
+ * request, IDENTICAL to recall precedence (session-first, per-call fallback)
1196
+ * so a scoped store is discoverable by scoped recall (#1434). Single source
1197
+ * of truth for the namespacesEnabled/projectScope gates (rule 22; keeps the
1198
+ * scattered-config-read ratchet flat). READ-ONLY: never mutates session. */
1199
+ async resolveCodingScopeInputs(request) {
793
1200
  const hasSession = typeof request.sessionKey === "string" && request.sessionKey.length > 0;
794
1201
  const codingContext = hasSession && this.orchestrator.config.namespacesEnabled && this.orchestrator.config.codingMode?.projectScope ? this.orchestrator.getCodingContextForSession(request.sessionKey) ?? await this.resolveCodingContextFromOptions(request) : null;
795
1202
  const overlay = hasSession && this.orchestrator.config.namespacesEnabled && this.orchestrator.config.codingMode?.projectScope ? resolveCodingNamespaceOverlay(
@@ -807,6 +1214,27 @@ var EngramAccessService = class {
807
1214
  codingContext,
808
1215
  codingOverlay: overlay
809
1216
  });
1217
+ return { principal, codingContext, overlay, profilePlan };
1218
+ }
1219
+ /**
1220
+ * Resolve the write namespace for explicit-write tools (memory_store /
1221
+ * suggestion_submit), project-scoping the write the same way recall does so a
1222
+ * memory stored with a client-injected `cwd`/`projectTag` is discoverable by
1223
+ * project-scoped recall (#1434, rule 42). Shared derivation lives in
1224
+ * {@link resolveCodingScopeInputs}; this method enforces the WRITE acl
1225
+ * (`canWriteNamespace` / profile-layer writability). Read-only: never mutates
1226
+ * session coding context.
1227
+ */
1228
+ async resolveCodingScopedWriteNamespace(request) {
1229
+ const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
1230
+ if (hasExplicitNamespace) {
1231
+ return this.resolveWritableNamespace(
1232
+ request.namespace,
1233
+ request.sessionKey,
1234
+ request.authenticatedPrincipal
1235
+ );
1236
+ }
1237
+ const { principal, overlay, profilePlan } = await this.resolveCodingScopeInputs(request);
810
1238
  if (profilePlan) {
811
1239
  const selectedLayer = profilePlan.layers.find((layer) => layer.id === profilePlan.writeLayer);
812
1240
  const writeNamespaceReadable = profilePlan.writeNamespace.length > 0 && profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
@@ -830,6 +1258,40 @@ var EngramAccessService = class {
830
1258
  }
831
1259
  return combineNamespaces(base, overlay.namespace);
832
1260
  }
1261
+ /** Read-side mirror of {@link resolveCodingScopedWriteNamespace}. Decision
1262
+ * `list`/`get` use this so a record written by a project-scoped session is
1263
+ * listable/fetchable by the SAME session without manually supplying the
1264
+ * overlaid namespace (review P2). Derivation is IDENTICAL to the write path
1265
+ * (shared via {@link resolveCodingScopeInputs}); the only difference is the
1266
+ * ACL — reads enforce {@link canReadNamespace}, so a read-but-not-write
1267
+ * principal can still list/fetch (rule 42). */
1268
+ async resolveCodingScopedReadableNamespace(request) {
1269
+ const principal = this.resolveRequestPrincipal(
1270
+ request.sessionKey,
1271
+ request.authenticatedPrincipal
1272
+ );
1273
+ const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
1274
+ if (hasExplicitNamespace) {
1275
+ return this.resolveReadableNamespace(request.namespace, principal);
1276
+ }
1277
+ const inputs = await this.resolveCodingScopeInputs(request);
1278
+ const { overlay, profilePlan, principal: resolvedPrincipal } = inputs;
1279
+ if (profilePlan) {
1280
+ const target = profilePlan.writeNamespace;
1281
+ if (!profilePlan.readNamespaces.includes(target)) {
1282
+ throw new EngramAccessInputError(`namespace is not readable: ${target}`);
1283
+ }
1284
+ return target;
1285
+ }
1286
+ if (!overlay) {
1287
+ return this.resolveReadableNamespace(void 0, resolvedPrincipal);
1288
+ }
1289
+ const base = defaultNamespaceForPrincipal(resolvedPrincipal, this.orchestrator.config);
1290
+ if (!canReadNamespace(resolvedPrincipal, base, this.orchestrator.config)) {
1291
+ throw new EngramAccessInputError(`namespace is not readable: ${base}`);
1292
+ }
1293
+ return combineNamespaces(base, overlay.namespace);
1294
+ }
833
1295
  /**
834
1296
  * Resolve ONE effective memory scope plan for a write-producing request
835
1297
  * (#1495 / seed for epic #1494). The returned {@link MemoryScopePlan} is the
@@ -2759,6 +3221,40 @@ var EngramAccessService = class {
2759
3221
  memory: this.serializeMemory(memory)
2760
3222
  };
2761
3223
  }
3224
+ /** Whether the coding_decision tool should appear in tools/list (rule 39). */
3225
+ get decisionRecordSurfaceVisible() {
3226
+ return this.orchestrator.config.codingKnowledge?.enabled === true && this.orchestrator.config.codingKnowledge?.decisionRecords === true;
3227
+ }
3228
+ /**
3229
+ * Thin delegate — handler logic in coding/decision-surfaces.ts (#1548 PR2).
3230
+ * All three surfaces (MCP/HTTP/CLI) arrive here via the boundary operation.
3231
+ * Namespace resolution uses the SAME path as memory_store (principal ACL +
3232
+ * coding overlay + default fallback) so decision records land in the same
3233
+ * storage root.
3234
+ */
3235
+ async codingDecision(request, authenticatedPrincipal) {
3236
+ return handleCodingDecision(request, {
3237
+ codingKnowledge: this.orchestrator.config.codingKnowledge,
3238
+ getCodingContext: (sk) => this.orchestrator.getCodingContextForSession(sk),
3239
+ resolveStorage: async (req) => {
3240
+ const isWrite = req.subcommand === "record" || req.subcommand === "supersede";
3241
+ const ns = isWrite ? await this.resolveCodingScopedWriteNamespace({
3242
+ namespace: req.namespace,
3243
+ sessionKey: req.sessionKey,
3244
+ authenticatedPrincipal
3245
+ }) : await this.resolveCodingScopedReadableNamespace({
3246
+ namespace: req.namespace,
3247
+ sessionKey: req.sessionKey,
3248
+ authenticatedPrincipal
3249
+ });
3250
+ const storage = await this.orchestrator.getStorage(ns);
3251
+ return Object.assign(storage, { namespace: ns });
3252
+ },
3253
+ throwInputError: (msg) => {
3254
+ throw new EngramAccessInputError(msg);
3255
+ }
3256
+ });
3257
+ }
2762
3258
  async memoryBrowse(request = {}) {
2763
3259
  const resolvedNamespace = this.resolveReadableNamespace(
2764
3260
  request.namespace,
@@ -5094,17 +5590,7 @@ ${next}`);
5094
5590
  get storageRef() {
5095
5591
  return this.orchestrator.storage;
5096
5592
  }
5097
- /**
5098
- * Best-effort catalog write touch delegate (issue #1499 sweep). HTTP/MCP
5099
- * surfaces resolve a per-namespace storage and write through it directly (e.g.
5100
- * a contradiction merge), bypassing the extraction write path that owns
5101
- * `markCatalogWrite`. They call this to record the write so a (possibly
5102
- * dynamic) namespace's `lastWriteAt` stays accurate and QMD maintenance does
5103
- * not miss it. Fire-and-forget and failure-tolerant on the orchestrator side.
5104
- */
5105
- recordCatalogWrite(namespace, storageDir) {
5106
- this.orchestrator.recordCatalogWrite(namespace, storageDir);
5107
- }
5593
+ // #1522: recordCatalogWrite removed — catalog touch handled at the storage chokepoint.
5108
5594
  get configRef() {
5109
5595
  return this.orchestrator.config;
5110
5596
  }
@@ -5572,6 +6058,7 @@ ${next}`);
5572
6058
  };
5573
6059
 
5574
6060
  export {
6061
+ DECISION_SUBCOMMANDS,
5575
6062
  computeProcedureStats,
5576
6063
  formatProcedureStatsText,
5577
6064
  EngramAccessInputError,
@@ -5579,4 +6066,4 @@ export {
5579
6066
  shapeMemorySummary,
5580
6067
  EngramAccessService
5581
6068
  };
5582
- //# sourceMappingURL=chunk-3MY4W5V4.js.map
6069
+ //# sourceMappingURL=chunk-FUCUR2OZ.js.map