@remnic/core 9.15.0 → 9.15.2

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 (354) hide show
  1. package/dist/access-admin-ops-surface.d.ts +10 -7
  2. package/dist/access-admin-ops-surface.js +21 -21
  3. package/dist/access-boundary.d.ts +10 -7
  4. package/dist/access-boundary.js +21 -22
  5. package/dist/access-cli.js +73 -75
  6. package/dist/access-cli.js.map +1 -1
  7. package/dist/access-http.d.ts +8 -7
  8. package/dist/access-http.js +27 -28
  9. package/dist/access-identity-continuity-surface.d.ts +6 -6
  10. package/dist/access-identity-continuity-surface.js +21 -21
  11. package/dist/access-lcm-surface.d.ts +10 -7
  12. package/dist/access-lcm-surface.js +21 -21
  13. package/dist/access-mcp.d.ts +10 -7
  14. package/dist/access-mcp.js +26 -27
  15. package/dist/access-memory-search-fanout.d.ts +2 -2
  16. package/dist/access-namespace-preflight-B9e5GnyZ.d.ts +146 -0
  17. package/dist/access-namespace-preflight.d.ts +8 -0
  18. package/dist/access-namespace-preflight.js +158 -0
  19. package/dist/access-observe-write-surface.d.ts +10 -7
  20. package/dist/access-observe-write-surface.js +21 -21
  21. package/dist/access-operations-batch.js +23 -24
  22. package/dist/access-operations.d.ts +11 -8
  23. package/dist/access-operations.js +25 -26
  24. package/dist/access-recall-concurrency.d.ts +10 -7
  25. package/dist/access-recall-concurrency.js +21 -21
  26. package/dist/access-recall-response.d.ts +10 -7
  27. package/dist/access-recall-response.js +21 -21
  28. package/dist/access-recall-surface.d.ts +10 -7
  29. package/dist/access-recall-surface.js +21 -21
  30. package/dist/access-schema.js +3 -3
  31. package/dist/{access-service-DbZ1G3zV.d.ts → access-service-DgmJd_A-.d.ts} +10 -118
  32. package/dist/access-service.d.ts +10 -7
  33. package/dist/access-service.js +21 -21
  34. package/dist/access-surface-catalog.d.ts +10 -7
  35. package/dist/action-confidence.d.ts +1 -1
  36. package/dist/active-memory-bridge.d.ts +1 -1
  37. package/dist/active-recall.d.ts +1 -1
  38. package/dist/active-recall.js +2 -2
  39. package/dist/behavior-learner.d.ts +1 -1
  40. package/dist/behavior-signals.d.ts +1 -1
  41. package/dist/bootstrap.d.ts +6 -6
  42. package/dist/briefing.d.ts +2 -2
  43. package/dist/briefing.js +6 -6
  44. package/dist/buffer-surprise-report.d.ts +1 -1
  45. package/dist/buffer.d.ts +2 -2
  46. package/dist/bulk-import/index.d.ts +3 -3
  47. package/dist/calibration.d.ts +1 -1
  48. package/dist/capabilities.d.ts +1 -1
  49. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  50. package/dist/capsule-crypto-7FJQINUR.js.map +1 -0
  51. package/dist/{catalog-BWqHb5HT.d.ts → catalog-g_dfT6oL.d.ts} +1 -1
  52. package/dist/causal-behavior.d.ts +1 -1
  53. package/dist/causal-consolidation.d.ts +1 -1
  54. package/dist/causal-consolidation.js +7 -7
  55. package/dist/causal-trajectory-graph.d.ts +1 -1
  56. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  57. package/dist/{chunk-YQQYS2K4.js → chunk-42DJZZUB.js} +2 -2
  58. package/dist/{chunk-YUQOAKPX.js → chunk-47WFEKT7.js} +5 -5
  59. package/dist/{chunk-YO3ZB3PJ.js → chunk-4E5H4FPC.js} +30 -15
  60. package/dist/chunk-4E5H4FPC.js.map +1 -0
  61. package/dist/{chunk-226RNKRU.js → chunk-5HFIHWOF.js} +37 -37
  62. package/dist/{chunk-A56B2AJR.js → chunk-5MDE5MIC.js} +3 -3
  63. package/dist/{chunk-W2OST2HH.js → chunk-6EJL2O3G.js} +2 -2
  64. package/dist/{chunk-ALSGMEJR.js → chunk-7CPOZH6Y.js} +5 -5
  65. package/dist/{chunk-MMGGVZ4Q.js → chunk-7VZWZVYG.js} +40 -18
  66. package/dist/{chunk-MMGGVZ4Q.js.map → chunk-7VZWZVYG.js.map} +1 -1
  67. package/dist/{chunk-WSHJAY5M.js → chunk-B57BIBXI.js} +2 -2
  68. package/dist/{chunk-KN6UGAQB.js → chunk-B6NCHYAK.js} +7 -2
  69. package/dist/chunk-B6NCHYAK.js.map +1 -0
  70. package/dist/{chunk-AS6UOOXF.js → chunk-BNH2VVWP.js} +2 -2
  71. package/dist/{chunk-6KIQT7RG.js → chunk-BZ52BJ6C.js} +2 -2
  72. package/dist/chunk-BZ52BJ6C.js.map +1 -0
  73. package/dist/{chunk-5RZHHANR.js → chunk-CXFVZ3PK.js} +54 -54
  74. package/dist/{chunk-SK7AMF2J.js → chunk-DETNBTZS.js} +3 -3
  75. package/dist/{chunk-TY6NBWV4.js → chunk-EEUZQQRJ.js} +2 -2
  76. package/dist/{chunk-YVKF3HEW.js → chunk-FJ5IQ3SI.js} +1 -1
  77. package/dist/chunk-FJ5IQ3SI.js.map +1 -0
  78. package/dist/{chunk-HLG7VAZP.js → chunk-GQOKO77V.js} +2 -2
  79. package/dist/{chunk-CAZ2SHEP.js → chunk-H4MDUPER.js} +2 -2
  80. package/dist/{chunk-TC5HBIIT.js → chunk-HBYQAOED.js} +2 -2
  81. package/dist/{chunk-YSDVEPV2.js → chunk-IRX5UCGN.js} +10 -10
  82. package/dist/{chunk-3HYWNJDA.js → chunk-JN4N2TMQ.js} +423 -45
  83. package/dist/chunk-JN4N2TMQ.js.map +1 -0
  84. package/dist/{chunk-IQFS4AU7.js → chunk-JTW4TGPV.js} +2 -2
  85. package/dist/{chunk-I4NJ2CDY.js → chunk-KLXG4BBO.js} +4 -6
  86. package/dist/{chunk-I4NJ2CDY.js.map → chunk-KLXG4BBO.js.map} +1 -1
  87. package/dist/{chunk-5W7CTZ2E.js → chunk-KQAFEZQX.js} +4 -4
  88. package/dist/{chunk-PYHOAXTI.js → chunk-LRGSLV7M.js} +4 -4
  89. package/dist/{chunk-Y6XODVJ4.js → chunk-NAY25BGS.js} +9 -9
  90. package/dist/{chunk-7HZMTXXB.js → chunk-O7ACJAHR.js} +18 -11
  91. package/dist/{chunk-7HZMTXXB.js.map → chunk-O7ACJAHR.js.map} +1 -1
  92. package/dist/{chunk-QJAQNXWI.js → chunk-ONHRRJZM.js} +6 -6
  93. package/dist/{chunk-O4K3DWK2.js → chunk-OOGGUXAG.js} +2 -2
  94. package/dist/{chunk-CQ6WP3PA.js → chunk-P53HGVJS.js} +5 -5
  95. package/dist/{chunk-U3ZAVRP3.js → chunk-PXJEL55X.js} +2 -2
  96. package/dist/{chunk-DF552QUN.js → chunk-QCLQ4BGA.js} +5 -5
  97. package/dist/{chunk-IAHNKI2E.js → chunk-QDNE35FU.js} +2 -2
  98. package/dist/{chunk-XMAD32BW.js → chunk-RRS5CDB6.js} +2 -2
  99. package/dist/{chunk-3QAH2S33.js → chunk-SYCVU556.js} +3 -3
  100. package/dist/{chunk-QZGN4773.js → chunk-T4EAQPQQ.js} +3 -3
  101. package/dist/{chunk-7G7DVA2C.js → chunk-T4OTDMX4.js} +2 -2
  102. package/dist/{chunk-XRNU7OEQ.js → chunk-U6QWUFSM.js} +3 -3
  103. package/dist/{chunk-UDIJMITR.js → chunk-UJIBXOJA.js} +23 -23
  104. package/dist/chunk-UJIBXOJA.js.map +1 -0
  105. package/dist/{chunk-CQMEM5CC.js → chunk-WIKOHCQZ.js} +2 -2
  106. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  107. package/dist/{chunk-3332THSR.js → chunk-XJT6LNLY.js} +4 -4
  108. package/dist/{chunk-AVPXXV6J.js → chunk-XKGPIWGI.js} +4 -4
  109. package/dist/{chunk-EZ25VE3G.js → chunk-YNDLCWXS.js} +4 -4
  110. package/dist/{chunk-46OH3OVK.js → chunk-YXTSUIXC.js} +5 -1
  111. package/dist/chunk-YXTSUIXC.js.map +1 -0
  112. package/dist/{cli-5tNLVTvJ.d.ts → cli-BXCd2cgK.d.ts} +5 -5
  113. package/dist/cli.d.ts +12 -9
  114. package/dist/cli.js +51 -52
  115. package/dist/compounding/engine.d.ts +2 -2
  116. package/dist/compounding/engine.js +6 -6
  117. package/dist/compounding/preference-consolidator.d.ts +1 -1
  118. package/dist/compression-optimizer.d.ts +1 -1
  119. package/dist/config.d.ts +1 -1
  120. package/dist/config.js +2 -2
  121. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  122. package/dist/connectors/codex-materialize-runner.js +6 -6
  123. package/dist/connectors/codex-materialize.d.ts +1 -1
  124. package/dist/connectors/index.d.ts +1 -1
  125. package/dist/connectors/index.js +6 -6
  126. package/dist/consolidation-provenance-check.d.ts +2 -2
  127. package/dist/consolidation-undo.d.ts +2 -2
  128. package/dist/contradiction/index.d.ts +2 -2
  129. package/dist/contradiction/index.js +4 -4
  130. package/dist/conversation-index/backend.d.ts +1 -1
  131. package/dist/conversation-index/chunker.d.ts +1 -1
  132. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  133. package/dist/conversation-index/indexer.d.ts +1 -1
  134. package/dist/conversation-index/search.d.ts +1 -1
  135. package/dist/dashboard-runtime.js +2 -2
  136. package/dist/day-summary.d.ts +1 -1
  137. package/dist/delinearize.d.ts +1 -1
  138. package/dist/direct-answer-wiring.d.ts +1 -1
  139. package/dist/direct-answer.d.ts +1 -1
  140. package/dist/embedding-fallback.d.ts +1 -1
  141. package/dist/enrichment/index.d.ts +1 -1
  142. package/dist/entity-retrieval.d.ts +2 -2
  143. package/dist/entity-retrieval.js +6 -6
  144. package/dist/entity-schema.d.ts +1 -1
  145. package/dist/explicit-capture.d.ts +6 -6
  146. package/dist/extraction-faithfulness.d.ts +1 -1
  147. package/dist/extraction-judge-telemetry.d.ts +1 -1
  148. package/dist/extraction-judge-training.d.ts +1 -1
  149. package/dist/extraction-judge.d.ts +1 -1
  150. package/dist/extraction.d.ts +3 -2
  151. package/dist/extraction.js +6 -4
  152. package/dist/fallback-llm.d.ts +1 -1
  153. package/dist/graph-dashboard-diff.d.ts +1 -1
  154. package/dist/graph-dashboard-key.d.ts +1 -1
  155. package/dist/graph-dashboard-parser.d.ts +1 -1
  156. package/dist/graph-edge-reinforcement.d.ts +1 -1
  157. package/dist/graph-snapshot.d.ts +1 -1
  158. package/dist/graph.d.ts +1 -1
  159. package/dist/importance.d.ts +1 -1
  160. package/dist/importers/index.d.ts +1 -1
  161. package/dist/in-flight-reads.d.ts +1 -1
  162. package/dist/index.d.ts +16 -15
  163. package/dist/index.js +84 -86
  164. package/dist/intent.d.ts +1 -1
  165. package/dist/lcm/engine.d.ts +1 -1
  166. package/dist/lcm/index.d.ts +1 -1
  167. package/dist/lcm/index.js +3 -3
  168. package/dist/lcm/tools.d.ts +1 -1
  169. package/dist/lifecycle.d.ts +1 -1
  170. package/dist/live-connectors-runner.d.ts +1 -1
  171. package/dist/local-llm.d.ts +2 -1
  172. package/dist/local-llm.js +1 -1
  173. package/dist/local-model-endpoint.d.ts +1 -1
  174. package/dist/maintenance/memory-governance.d.ts +1 -1
  175. package/dist/maintenance/memory-governance.js +6 -6
  176. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  177. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +6 -6
  178. package/dist/maintenance/rebuild-memory-projection.js +7 -7
  179. package/dist/mcp-memory-inspector-app.d.ts +10 -7
  180. package/dist/memory-action-policy.d.ts +1 -1
  181. package/dist/memory-cache.d.ts +1 -1
  182. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  183. package/dist/memory-projection-store.d.ts +1 -1
  184. package/dist/memory-provenance.d.ts +1 -1
  185. package/dist/memory-worth-outcomes.d.ts +2 -2
  186. package/dist/models-json.d.ts +1 -1
  187. package/dist/namespaces/migrate.d.ts +3 -3
  188. package/dist/namespaces/migrate.js +12 -12
  189. package/dist/namespaces/principal.d.ts +1 -1
  190. package/dist/namespaces/search.d.ts +1 -1
  191. package/dist/namespaces/search.js +5 -5
  192. package/dist/namespaces/storage.d.ts +3 -3
  193. package/dist/namespaces/storage.js +6 -6
  194. package/dist/native-knowledge.d.ts +1 -1
  195. package/dist/offline-sync-impression-drain.d.ts +1 -1
  196. package/dist/offline-sync-impression-drain.js +4 -4
  197. package/dist/operator-toolkit.d.ts +2 -2
  198. package/dist/operator-toolkit.js +18 -18
  199. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  200. package/dist/orchestration/maintenance.d.ts +3 -3
  201. package/dist/orchestration/maintenance.js +10 -10
  202. package/dist/{orchestrator-CQJ8U7En.d.ts → orchestrator-BHfWtvEJ.d.ts} +5 -5
  203. package/dist/orchestrator.d.ts +6 -6
  204. package/dist/orchestrator.js +74 -75
  205. package/dist/patterns-cli.d.ts +1 -1
  206. package/dist/{pipeline-Cn-kvYeV.d.ts → pipeline-CBYcnmDC.d.ts} +1 -1
  207. package/dist/policy-runtime.d.ts +1 -1
  208. package/dist/proactive-contention.d.ts +1 -1
  209. package/dist/provenance.d.ts +1 -1
  210. package/dist/{qmd-oh9VXz1d.d.ts → qmd-BIq-jrV4.d.ts} +1 -1
  211. package/dist/qmd-preflight.d.ts +2 -2
  212. package/dist/qmd-recall-cache.d.ts +1 -1
  213. package/dist/qmd.d.ts +2 -2
  214. package/dist/qmd.js +4 -4
  215. package/dist/recall-concurrency-config.d.ts +1 -1
  216. package/dist/recall-disclosure-escalation.d.ts +1 -1
  217. package/dist/recall-explain-renderer.d.ts +1 -1
  218. package/dist/recall-explain-renderer.js +3 -3
  219. package/dist/recall-memory-map.d.ts +1 -1
  220. package/dist/recall-planner-llm.d.ts +1 -1
  221. package/dist/recall-state.d.ts +1 -1
  222. package/dist/recall-tag-filter.d.ts +1 -1
  223. package/dist/recall-timings.d.ts +1 -1
  224. package/dist/recall-xray-cli.d.ts +1 -1
  225. package/dist/recall-xray-cli.js +4 -4
  226. package/dist/recall-xray-renderer.d.ts +1 -1
  227. package/dist/recall-xray-renderer.js +3 -3
  228. package/dist/recall-xray.d.ts +1 -1
  229. package/dist/recall-xray.js +2 -2
  230. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  231. package/dist/replay/normalizers/claude.d.ts +1 -1
  232. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  233. package/dist/replay/normalizers/shared.d.ts +1 -1
  234. package/dist/replay/runner.d.ts +1 -1
  235. package/dist/replay/types.d.ts +1 -1
  236. package/dist/resolve-auth-token.d.ts +1 -1
  237. package/dist/resume-bundles.js +3 -3
  238. package/dist/retrieval-agents.d.ts +2 -2
  239. package/dist/retrieval-tiers.d.ts +1 -1
  240. package/dist/routing/engine.d.ts +1 -1
  241. package/dist/routing/store.d.ts +1 -1
  242. package/dist/salvage-envelope.d.ts +1 -1
  243. package/dist/{scope-profiles-EpJG7yKP.d.ts → scope-profiles-DDno-uvy.d.ts} +1 -1
  244. package/dist/search/embed-helper.d.ts +1 -1
  245. package/dist/search/factory.d.ts +1 -1
  246. package/dist/search/factory.js +4 -4
  247. package/dist/search/index.d.ts +1 -1
  248. package/dist/search/index.js +6 -6
  249. package/dist/search/lancedb-backend.d.ts +1 -1
  250. package/dist/search/meilisearch-backend.d.ts +1 -1
  251. package/dist/search/noop-backend.d.ts +1 -1
  252. package/dist/search/orama-backend.d.ts +1 -1
  253. package/dist/search/port.d.ts +1 -1
  254. package/dist/search/remote-backend.d.ts +1 -1
  255. package/dist/{semantic-consolidation-DILZEQq3.d.ts → semantic-consolidation-7RIJFDwY.d.ts} +1 -1
  256. package/dist/semantic-consolidation.d.ts +2 -2
  257. package/dist/semantic-consolidation.js +7 -7
  258. package/dist/semantic-rule-promotion.js +6 -6
  259. package/dist/semantic-rule-verifier.d.ts +1 -1
  260. package/dist/semantic-rule-verifier.js +6 -6
  261. package/dist/session-observer-bands.d.ts +1 -1
  262. package/dist/session-observer-state.d.ts +1 -1
  263. package/dist/shared-context/manager.d.ts +1 -1
  264. package/dist/signal.d.ts +1 -1
  265. package/dist/{storage-NIyKYD8g.d.ts → storage-DkphZiOJ.d.ts} +1 -1
  266. package/dist/storage.d.ts +2 -2
  267. package/dist/storage.js +5 -5
  268. package/dist/summarizer.d.ts +1 -1
  269. package/dist/summarizer.js +2 -2
  270. package/dist/summary-snapshot.d.ts +1 -1
  271. package/dist/temporal-supersession.d.ts +2 -2
  272. package/dist/temporal-timeline-recall.d.ts +1 -1
  273. package/dist/temporal-validity.d.ts +1 -1
  274. package/dist/threading.d.ts +1 -1
  275. package/dist/tier-migration.d.ts +2 -2
  276. package/dist/tier-routing.d.ts +1 -1
  277. package/dist/topics.d.ts +1 -1
  278. package/dist/transcript.d.ts +1 -1
  279. package/dist/transfer/backup.js +2 -2
  280. package/dist/transfer/capsule-export.js +2 -2
  281. package/dist/transfer/capsule-import.js +2 -2
  282. package/dist/transfer/import-sqlite.js +2 -2
  283. package/dist/trust-score-stage.d.ts +1 -1
  284. package/dist/trust-score.d.ts +1 -1
  285. package/dist/{types-D_fG2ix8.d.ts → types-2q_MRFcM.d.ts} +6 -0
  286. package/dist/types.d.ts +1 -1
  287. package/dist/types.js +1 -1
  288. package/dist/utility-runtime.d.ts +1 -1
  289. package/dist/verified-recall.js +6 -6
  290. package/dist/write-envelope.d.ts +1 -1
  291. package/package.json +2 -2
  292. package/src/access-http.test.ts +91 -0
  293. package/src/access-http.ts +13 -14
  294. package/src/access-namespace-preflight.test.ts +111 -0
  295. package/src/access-namespace-preflight.ts +111 -0
  296. package/src/access-operations-batch.ts +25 -2
  297. package/src/access-service-observe-scope.test.ts +81 -0
  298. package/src/access-service.ts +64 -78
  299. package/src/config.test.ts +7 -0
  300. package/src/config.ts +6 -0
  301. package/src/extraction-thinking.test.ts +44 -0
  302. package/src/extraction.ts +12 -0
  303. package/src/local-llm-thinking.test.ts +13 -1
  304. package/src/local-llm.ts +2 -1
  305. package/src/orchestration/qmd-result-resolver.test.ts +103 -0
  306. package/src/orchestration/qmd-result-resolver.ts +11 -0
  307. package/src/scopes/scope-plan.ts +66 -0
  308. package/src/types.ts +6 -0
  309. package/dist/chunk-3HYWNJDA.js.map +0 -1
  310. package/dist/chunk-46OH3OVK.js.map +0 -1
  311. package/dist/chunk-6KIQT7RG.js.map +0 -1
  312. package/dist/chunk-KF5EUVKQ.js +0 -289
  313. package/dist/chunk-KF5EUVKQ.js.map +0 -1
  314. package/dist/chunk-KN6UGAQB.js.map +0 -1
  315. package/dist/chunk-UDIJMITR.js.map +0 -1
  316. package/dist/chunk-YO3ZB3PJ.js.map +0 -1
  317. package/dist/chunk-YVKF3HEW.js.map +0 -1
  318. /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-namespace-preflight.js.map} +0 -0
  319. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  320. /package/dist/{chunk-YQQYS2K4.js.map → chunk-42DJZZUB.js.map} +0 -0
  321. /package/dist/{chunk-YUQOAKPX.js.map → chunk-47WFEKT7.js.map} +0 -0
  322. /package/dist/{chunk-226RNKRU.js.map → chunk-5HFIHWOF.js.map} +0 -0
  323. /package/dist/{chunk-A56B2AJR.js.map → chunk-5MDE5MIC.js.map} +0 -0
  324. /package/dist/{chunk-W2OST2HH.js.map → chunk-6EJL2O3G.js.map} +0 -0
  325. /package/dist/{chunk-ALSGMEJR.js.map → chunk-7CPOZH6Y.js.map} +0 -0
  326. /package/dist/{chunk-WSHJAY5M.js.map → chunk-B57BIBXI.js.map} +0 -0
  327. /package/dist/{chunk-AS6UOOXF.js.map → chunk-BNH2VVWP.js.map} +0 -0
  328. /package/dist/{chunk-5RZHHANR.js.map → chunk-CXFVZ3PK.js.map} +0 -0
  329. /package/dist/{chunk-SK7AMF2J.js.map → chunk-DETNBTZS.js.map} +0 -0
  330. /package/dist/{chunk-TY6NBWV4.js.map → chunk-EEUZQQRJ.js.map} +0 -0
  331. /package/dist/{chunk-HLG7VAZP.js.map → chunk-GQOKO77V.js.map} +0 -0
  332. /package/dist/{chunk-CAZ2SHEP.js.map → chunk-H4MDUPER.js.map} +0 -0
  333. /package/dist/{chunk-TC5HBIIT.js.map → chunk-HBYQAOED.js.map} +0 -0
  334. /package/dist/{chunk-YSDVEPV2.js.map → chunk-IRX5UCGN.js.map} +0 -0
  335. /package/dist/{chunk-IQFS4AU7.js.map → chunk-JTW4TGPV.js.map} +0 -0
  336. /package/dist/{chunk-5W7CTZ2E.js.map → chunk-KQAFEZQX.js.map} +0 -0
  337. /package/dist/{chunk-PYHOAXTI.js.map → chunk-LRGSLV7M.js.map} +0 -0
  338. /package/dist/{chunk-Y6XODVJ4.js.map → chunk-NAY25BGS.js.map} +0 -0
  339. /package/dist/{chunk-QJAQNXWI.js.map → chunk-ONHRRJZM.js.map} +0 -0
  340. /package/dist/{chunk-O4K3DWK2.js.map → chunk-OOGGUXAG.js.map} +0 -0
  341. /package/dist/{chunk-CQ6WP3PA.js.map → chunk-P53HGVJS.js.map} +0 -0
  342. /package/dist/{chunk-U3ZAVRP3.js.map → chunk-PXJEL55X.js.map} +0 -0
  343. /package/dist/{chunk-DF552QUN.js.map → chunk-QCLQ4BGA.js.map} +0 -0
  344. /package/dist/{chunk-IAHNKI2E.js.map → chunk-QDNE35FU.js.map} +0 -0
  345. /package/dist/{chunk-XMAD32BW.js.map → chunk-RRS5CDB6.js.map} +0 -0
  346. /package/dist/{chunk-3QAH2S33.js.map → chunk-SYCVU556.js.map} +0 -0
  347. /package/dist/{chunk-QZGN4773.js.map → chunk-T4EAQPQQ.js.map} +0 -0
  348. /package/dist/{chunk-7G7DVA2C.js.map → chunk-T4OTDMX4.js.map} +0 -0
  349. /package/dist/{chunk-XRNU7OEQ.js.map → chunk-U6QWUFSM.js.map} +0 -0
  350. /package/dist/{chunk-CQMEM5CC.js.map → chunk-WIKOHCQZ.js.map} +0 -0
  351. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  352. /package/dist/{chunk-3332THSR.js.map → chunk-XJT6LNLY.js.map} +0 -0
  353. /package/dist/{chunk-AVPXXV6J.js.map → chunk-XKGPIWGI.js.map} +0 -0
  354. /package/dist/{chunk-EZ25VE3G.js.map → chunk-YNDLCWXS.js.map} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-GDB4J2H3.js";
9
9
  import {
10
10
  importCapsule
11
- } from "./chunk-ALSGMEJR.js";
11
+ } from "./chunk-7CPOZH6Y.js";
12
12
  import {
13
13
  WriteQuarantineStore
14
14
  } from "./chunk-PJSK6OJM.js";
@@ -30,18 +30,18 @@ import {
30
30
  import {
31
31
  planSessionTranscriptMigration
32
32
  } from "./chunk-P5FPO2BR.js";
33
- import {
34
- decideDisclosureEscalation
35
- } from "./chunk-H7XKCNR6.js";
36
33
  import {
37
34
  toRecallExplainJson
38
- } from "./chunk-CQMEM5CC.js";
35
+ } from "./chunk-WIKOHCQZ.js";
39
36
  import {
40
37
  estimateRecallTokens
41
- } from "./chunk-U3ZAVRP3.js";
38
+ } from "./chunk-PXJEL55X.js";
39
+ import {
40
+ decideDisclosureEscalation
41
+ } from "./chunk-H7XKCNR6.js";
42
42
  import {
43
43
  namespaceCollectionName
44
- } from "./chunk-IAHNKI2E.js";
44
+ } from "./chunk-QDNE35FU.js";
45
45
  import {
46
46
  buildProposedActions,
47
47
  buildQualityScore,
@@ -49,7 +49,7 @@ import {
49
49
  listMemoryGovernanceRuns,
50
50
  readMemoryGovernanceRunArtifact,
51
51
  runMemoryGovernance
52
- } from "./chunk-HLG7VAZP.js";
52
+ } from "./chunk-GQOKO77V.js";
53
53
  import {
54
54
  recordObjectiveStateSnapshotsFromObservedMessages
55
55
  } from "./chunk-ICP53SKG.js";
@@ -58,7 +58,7 @@ import {
58
58
  } from "./chunk-6HMYUWXR.js";
59
59
  import {
60
60
  offlineSyncStorageForSnapshot
61
- } from "./chunk-SK7AMF2J.js";
61
+ } from "./chunk-DETNBTZS.js";
62
62
  import {
63
63
  combineNamespaces,
64
64
  defaultGitInvoker,
@@ -69,9 +69,10 @@ import {
69
69
  resolveGitContext,
70
70
  resolveScopePlan,
71
71
  resolveScopeProfilePlan,
72
+ resolveScopedWritableNamespaceValue,
72
73
  resolveWritableNamespaceValue,
73
74
  sanitizeFragment
74
- } from "./chunk-MMGGVZ4Q.js";
75
+ } from "./chunk-7VZWZVYG.js";
75
76
  import {
76
77
  recordMemoryOutcome
77
78
  } from "./chunk-EIR5VLIH.js";
@@ -113,26 +114,30 @@ import {
113
114
  enqueuePassiveCorrectionNotification,
114
115
  parseBriefingFocus,
115
116
  parseBriefingWindow
116
- } from "./chunk-7G7DVA2C.js";
117
+ } from "./chunk-T4OTDMX4.js";
117
118
  import {
118
119
  parseEntityFile,
119
120
  qmdCollectionPathParts,
120
121
  qmdResultPathCandidates,
121
122
  selfDeps
122
- } from "./chunk-7HZMTXXB.js";
123
+ } from "./chunk-O7ACJAHR.js";
123
124
  import {
124
125
  supersessionKeysForFact
125
126
  } from "./chunk-DNHVPZOD.js";
126
127
  import {
127
128
  DEFAULT_RECALL_DISCLOSURE,
128
129
  isRecallDisclosure
129
- } from "./chunk-YVKF3HEW.js";
130
+ } from "./chunk-FJ5IQ3SI.js";
130
131
  import {
131
132
  namespaceIdentityFromToken
132
133
  } from "./chunk-EGGE52UU.js";
133
134
  import {
134
135
  serializeMutations
135
136
  } from "./chunk-WL5EBRDH.js";
137
+ import {
138
+ inferMemoryStatus,
139
+ toMemoryPathRel
140
+ } from "./chunk-ILGC6JH6.js";
136
141
  import {
137
142
  normalizeProjectionPreview,
138
143
  normalizeProjectionTags
@@ -143,10 +148,6 @@ import {
143
148
  import {
144
149
  displayErrorDetail
145
150
  } from "./chunk-RL6NEVXT.js";
146
- import {
147
- inferMemoryStatus,
148
- toMemoryPathRel
149
- } from "./chunk-ILGC6JH6.js";
150
151
  import {
151
152
  STRUCTURED_ATTRIBUTE_LIMITS,
152
153
  buildAccessWriteRequestFingerprint,
@@ -168,6 +169,14 @@ import {
168
169
  import {
169
170
  computeContentHash
170
171
  } from "./chunk-W5H6ZRPT.js";
172
+ import {
173
+ assertFleetWideOperationAllowed,
174
+ assertOperationAllowed,
175
+ capabilityAllowsOp,
176
+ enforceNamespaceAllowList,
177
+ isNamespaceAllowed,
178
+ tokenCapabilityStore
179
+ } from "./chunk-7AMFUATK.js";
171
180
  import {
172
181
  sanitizeMemoryContent
173
182
  } from "./chunk-5GKPFL3S.js";
@@ -180,7 +189,7 @@ import {
180
189
  } from "./chunk-JAKIDQB2.js";
181
190
  import {
182
191
  exportCapsule
183
- } from "./chunk-5W7CTZ2E.js";
192
+ } from "./chunk-KQAFEZQX.js";
184
193
  import {
185
194
  evaluateActionConfidence
186
195
  } from "./chunk-Z2YFLXHU.js";
@@ -196,6 +205,7 @@ import {
196
205
  readOfflineSyncFileContentChunk
197
206
  } from "./chunk-E4OCKU67.js";
198
207
  import {
208
+ EngramAccessForbiddenError,
199
209
  EngramAccessInputError,
200
210
  NamespaceNotWritableError
201
211
  } from "./chunk-2Z24E5W2.js";
@@ -4782,6 +4792,333 @@ function formatProcedureStatsText(report) {
4782
4792
  return lines.join("\n") + "\n";
4783
4793
  }
4784
4794
 
4795
+ // src/access-boundary.ts
4796
+ import { z } from "zod";
4797
+ var OPERATION_NAMES = [
4798
+ "memory_get",
4799
+ "memory_search",
4800
+ "memory_store",
4801
+ "coding_decision",
4802
+ "coding_architecture",
4803
+ // codegraph parity tools (issue #1554) -- each maps to one codegraph_*
4804
+ // boundary operation that delegates to the surface handler in
4805
+ // coding/codegraph-surfaces.ts. Names match the external tool suffixes.
4806
+ "codegraph_index",
4807
+ "codegraph_list_projects",
4808
+ "codegraph_delete_project",
4809
+ "codegraph_index_status",
4810
+ "codegraph_search_graph",
4811
+ "codegraph_trace_path",
4812
+ "codegraph_detect_changes",
4813
+ "codegraph_query_graph",
4814
+ "codegraph_get_schema",
4815
+ "codegraph_get_snippet",
4816
+ "codegraph_get_architecture",
4817
+ "codegraph_search_code",
4818
+ "codegraph_manage_adr",
4819
+ "codegraph_ingest_traces",
4820
+ "memory_correct_plan",
4821
+ "memory_correct_apply",
4822
+ "coding_delta",
4823
+ // Remaining MCP/HTTP handlers migrated through the boundary (issue #1525).
4824
+ "recall",
4825
+ "recall_explain",
4826
+ "set_coding_context",
4827
+ "recall_tier_explain",
4828
+ "recall_xray",
4829
+ "namespace_writable",
4830
+ "wearables_status",
4831
+ "wearables_sync",
4832
+ "transcript_day",
4833
+ "transcript_search",
4834
+ "transcript_memories",
4835
+ "action_confidence",
4836
+ "chatgpt_memory_inspector",
4837
+ "day_summary",
4838
+ "capsule_export",
4839
+ "capsule_import",
4840
+ "capsule_list",
4841
+ "memory_governance_run",
4842
+ "procedure_mining_run",
4843
+ "pattern_reinforcement_run",
4844
+ "procedural_stats",
4845
+ "memory_timeline",
4846
+ "suggestion_submit",
4847
+ "entity_get",
4848
+ "review_queue_list",
4849
+ "correction_pending",
4850
+ "observe",
4851
+ "lcm_search",
4852
+ "lcm_compaction_flush",
4853
+ "lcm_compaction_record",
4854
+ "continuity_audit_generate",
4855
+ "continuity_incident_open",
4856
+ "continuity_incident_close",
4857
+ "continuity_incident_list",
4858
+ "continuity_loop_add_or_update",
4859
+ "continuity_loop_review",
4860
+ "identity_anchor_get",
4861
+ "identity_anchor_update",
4862
+ "memory_identity",
4863
+ "work_task",
4864
+ "work_project",
4865
+ "work_board",
4866
+ "shared_context_write_output",
4867
+ "shared_feedback_record",
4868
+ "shared_priorities_append",
4869
+ "relay_mission_append",
4870
+ "relay_mission_read",
4871
+ "shared_context_cross_signals_run",
4872
+ "shared_context_curate_daily",
4873
+ "compounding_weekly_synthesize",
4874
+ "compounding_promote_candidate",
4875
+ "compression_guidelines_optimize",
4876
+ "compression_guidelines_activate",
4877
+ "memory_profile",
4878
+ "memory_entities_list",
4879
+ "memory_questions",
4880
+ "memory_last_recall",
4881
+ "memory_intent_debug",
4882
+ "memory_qmd_debug",
4883
+ "memory_graph_explain",
4884
+ "graph_snapshot",
4885
+ "memory_feedback",
4886
+ "memory_promote",
4887
+ "memory_outcome",
4888
+ "memory_action_apply",
4889
+ "context_checkpoint",
4890
+ "briefing",
4891
+ "review_list",
4892
+ "review_resolve",
4893
+ "contradiction_scan_run",
4894
+ "memory_summarize_hourly",
4895
+ "conversation_index_update",
4896
+ "profiling_report",
4897
+ "graph_edge_decay_run",
4898
+ "live_connectors_run",
4899
+ "peer_list",
4900
+ "peer_get",
4901
+ "peer_set",
4902
+ "peer_delete",
4903
+ "peer_profile_get",
4904
+ "peer_forget",
4905
+ "console_state",
4906
+ "dreams_status",
4907
+ "dreams_run",
4908
+ // HTTP-only routes (no direct MCP tool equivalent).
4909
+ "adapters_status",
4910
+ "offline_sync_snapshot",
4911
+ "offline_sync_snapshot_stream",
4912
+ "offline_sync_files",
4913
+ "offline_sync_file_content",
4914
+ "offline_sync_apply_file_content",
4915
+ "offline_sync_apply",
4916
+ "lcm_status",
4917
+ "memory_list",
4918
+ "recall_timings",
4919
+ "entity_list",
4920
+ "maintenance_status",
4921
+ "quality_status",
4922
+ "trust_zones_status",
4923
+ "trust_zones_records",
4924
+ "review_disposition",
4925
+ "trust_zones_promote",
4926
+ "trust_zones_demo_seed",
4927
+ "citations_observed",
4928
+ "contradiction_detail",
4929
+ "graph_events",
4930
+ // Chat surface — conversational memory inspection/correction (issue #1583).
4931
+ "chat_message",
4932
+ "chat_events"
4933
+ ];
4934
+ function coerceBooleanLike(value) {
4935
+ if (value === void 0 || value === null || value === "") return void 0;
4936
+ if (typeof value === "boolean") return value;
4937
+ if (typeof value === "string") {
4938
+ const lower = value.trim().toLowerCase();
4939
+ if (lower === "true" || lower === "1" || lower === "yes" || lower === "on") return true;
4940
+ if (lower === "false" || lower === "0" || lower === "no" || lower === "off") return false;
4941
+ }
4942
+ throw new EngramAccessInputError(
4943
+ `expected a boolean-like value (true|false|1|0|yes|no|on|off); got ${JSON.stringify(value)}`
4944
+ );
4945
+ }
4946
+ function coercePositiveInteger(value, label) {
4947
+ if (value === void 0 || value === null || value === "") return void 0;
4948
+ if (typeof value === "number") {
4949
+ if (!Number.isFinite(value) || value <= 0 || !Number.isInteger(value)) {
4950
+ throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
4951
+ }
4952
+ return value;
4953
+ }
4954
+ if (typeof value === "string") {
4955
+ const trimmed = value.trim();
4956
+ if (!/^[+-]?\d+$/.test(trimmed)) {
4957
+ throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
4958
+ }
4959
+ const parsed = Number(trimmed);
4960
+ if (!Number.isSafeInteger(parsed) || parsed <= 0) {
4961
+ throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
4962
+ }
4963
+ return parsed;
4964
+ }
4965
+ throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
4966
+ }
4967
+ function normalizeOptionalPath(value) {
4968
+ if (value === void 0 || value === null || value === "") return void 0;
4969
+ if (typeof value !== "string") {
4970
+ throw new EngramAccessInputError(`expected a path string; got ${JSON.stringify(value)}`);
4971
+ }
4972
+ return expandTildePath(value);
4973
+ }
4974
+ function formatZodIssues(error) {
4975
+ const parts = [];
4976
+ for (const issue of error.issues) {
4977
+ const hasNumeric = issue.path.some((p) => typeof p === "number");
4978
+ const path9 = hasNumeric ? issue.path.filter((p) => typeof p === "string").join(".") || "(root)" : issue.path.length > 0 ? issue.path.join(".") : "(root)";
4979
+ const options = enumOptionsFromIssue(issue);
4980
+ const suffix = options ? `. Valid: ${options.join(", ")}` : "";
4981
+ parts.push(`${path9}: ${issue.message}${suffix}`);
4982
+ }
4983
+ return parts.length > 0 ? `request validation failed: ${parts.join("; ")}` : "request validation failed";
4984
+ }
4985
+ function enumOptionsFromIssue(issue) {
4986
+ if (issue.code === z.ZodIssueCode.invalid_enum_value) {
4987
+ const rawOptions = issue.options;
4988
+ if (Array.isArray(rawOptions)) {
4989
+ return rawOptions.map((opt) => String(opt));
4990
+ }
4991
+ }
4992
+ return void 0;
4993
+ }
4994
+ var registry = /* @__PURE__ */ new Map();
4995
+ var humanReadableErrorMap = (issue, ctx) => {
4996
+ if (issue.code === z.ZodIssueCode.invalid_type) {
4997
+ if (issue.received === "undefined") return { message: ctx.defaultError };
4998
+ if (issue.path.some((p) => typeof p === "number")) {
4999
+ const arrField = issue.path.filter((p) => typeof p === "string").join(".");
5000
+ return { message: `${arrField} must be an array of ${issue.expected}s` };
5001
+ }
5002
+ const fieldName = issue.path.length > 0 ? String(issue.path[issue.path.length - 1]) : "value";
5003
+ switch (issue.expected) {
5004
+ case "string":
5005
+ return { message: `${fieldName} must be a string` };
5006
+ case "boolean":
5007
+ return { message: `${fieldName} must be a boolean` };
5008
+ case "number":
5009
+ return { message: `${fieldName} must be a number` };
5010
+ case "array":
5011
+ return { message: `${fieldName} must be an array` };
5012
+ case "object":
5013
+ return { message: `${fieldName} must be an object` };
5014
+ default:
5015
+ return { message: ctx.defaultError };
5016
+ }
5017
+ }
5018
+ return { message: ctx.defaultError };
5019
+ };
5020
+ function defineOperation(spec) {
5021
+ if (registry.has(spec.name)) {
5022
+ throw new Error(`access-boundary: operation already registered: ${spec.name}`);
5023
+ }
5024
+ const bound = {
5025
+ spec,
5026
+ run: async (rawInput, ctx) => {
5027
+ const parseResult = spec.schema.safeParse(rawInput, { errorMap: humanReadableErrorMap });
5028
+ if (!parseResult.success) {
5029
+ throw new EngramAccessInputError(formatZodIssues(parseResult.error));
5030
+ }
5031
+ if (spec.allowedByOps && spec.allowedByOps.length > 0) {
5032
+ const store = tokenCapabilityStore.getStore();
5033
+ if (!spec.allowedByOps.some((op) => capabilityAllowsOp(store, op))) {
5034
+ throw new EngramAccessForbiddenError(`token is not permitted to call operation: ${spec.name}`);
5035
+ }
5036
+ } else {
5037
+ assertOperationAllowed(tokenCapabilityStore.getStore(), spec.name);
5038
+ }
5039
+ if (spec.fleetWide) {
5040
+ assertFleetWideOperationAllowed(tokenCapabilityStore.getStore());
5041
+ }
5042
+ return spec.handler(parseResult.data, ctx);
5043
+ }
5044
+ };
5045
+ registry.set(spec.name, bound);
5046
+ return bound;
5047
+ }
5048
+ function getOperation(name) {
5049
+ return registry.get(name);
5050
+ }
5051
+ function listRegisteredOperations() {
5052
+ return [...registry.keys()];
5053
+ }
5054
+ function __resetRegistryForTest() {
5055
+ registry.clear();
5056
+ }
5057
+
5058
+ // src/access-namespace-preflight.ts
5059
+ function namespaceWritableRequest(params, authenticatedPrincipal) {
5060
+ const namespace = params.get("namespace") || void 0;
5061
+ return {
5062
+ namespace,
5063
+ sessionKey: params.get("session") || void 0,
5064
+ authenticatedPrincipal,
5065
+ cwd: params.get("cwd") || void 0,
5066
+ projectTag: params.get("projectTag") || void 0
5067
+ };
5068
+ }
5069
+ function parseNamespacePreflightWriteOp(value) {
5070
+ if (value === void 0 || value === "observe") return "observe";
5071
+ if (value === "memory_store") return "memory_store";
5072
+ throw new EngramAccessInputError(`unsupported namespace preflight operation: ${value}`);
5073
+ }
5074
+ function assertNamespacePreflightPermitted(caps) {
5075
+ const allowedOps = getOperation("namespace_writable")?.spec.allowedByOps ?? [];
5076
+ if (!allowedOps.some((op) => capabilityAllowsOp(caps, op))) {
5077
+ throw new EngramAccessForbiddenError("token is not permitted to run the namespace preflight");
5078
+ }
5079
+ }
5080
+ async function resolveNamespaceWritablePreflight(request, resolveWritable) {
5081
+ try {
5082
+ return { ok: true, namespace: await resolveWritable(request) };
5083
+ } catch (error) {
5084
+ if (error instanceof NamespaceNotWritableError) {
5085
+ return { ok: false, reason: "not_writable", namespace: error.attemptedNamespace };
5086
+ }
5087
+ if (error instanceof EngramAccessInputError) {
5088
+ return {
5089
+ ok: false,
5090
+ reason: "unsupported",
5091
+ namespace: request.namespace?.trim() ?? ""
5092
+ };
5093
+ }
5094
+ throw error;
5095
+ }
5096
+ }
5097
+ async function resolveAuthorizedNamespaceWritablePreflight(caps, request, defaultNamespace, writeOp, resolvePreflight) {
5098
+ if (!capabilityAllowsOp(caps, writeOp)) {
5099
+ return {
5100
+ ok: false,
5101
+ reason: "not_writable",
5102
+ namespace: request.namespace?.trim() || defaultNamespace
5103
+ };
5104
+ }
5105
+ const result = await resolvePreflight(request);
5106
+ if (!isNamespaceAllowed(caps, result.namespace, defaultNamespace)) {
5107
+ return { ok: false, reason: "not_writable", namespace: result.namespace };
5108
+ }
5109
+ return result;
5110
+ }
5111
+ function resolveQueryNamespaceWritablePreflight(caps, params, authenticatedPrincipal, defaultNamespace, resolvePreflight) {
5112
+ assertNamespacePreflightPermitted(caps);
5113
+ return resolveAuthorizedNamespaceWritablePreflight(
5114
+ caps,
5115
+ namespaceWritableRequest(params, authenticatedPrincipal),
5116
+ defaultNamespace,
5117
+ parseNamespacePreflightWriteOp(params.get("op") ?? void 0),
5118
+ resolvePreflight
5119
+ );
5120
+ }
5121
+
4785
5122
  // src/admin/admin-surfaces.ts
4786
5123
  import path7 from "path";
4787
5124
  var REDACTED = "<redacted>";
@@ -8623,6 +8960,13 @@ var EngramAccessService = class {
8623
8960
  });
8624
8961
  return { principal, codingContext, overlay, profilePlan };
8625
8962
  }
8963
+ assertTokenCanWriteNamespace(namespace) {
8964
+ enforceNamespaceAllowList(
8965
+ tokenCapabilityStore.getStore(),
8966
+ namespace,
8967
+ this.orchestrator.config.defaultNamespace
8968
+ );
8969
+ }
8626
8970
  /**
8627
8971
  * Resolve the write namespace for explicit-write tools (memory_store /
8628
8972
  * suggestion_submit), project-scoping the write the same way recall does so a
@@ -8632,42 +8976,49 @@ var EngramAccessService = class {
8632
8976
  * (`canWriteNamespace` / profile-layer writability). Read-only: never mutates
8633
8977
  * session coding context.
8634
8978
  */
8635
- async resolveCodingScopedWriteNamespace(request) {
8636
- const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
8637
- if (hasExplicitNamespace) {
8638
- return this.writableNamespaceFor(
8639
- request.namespace,
8979
+ async resolveCodingScopedWriteNamespace(request, enforceToken = true) {
8980
+ const requested = request.namespace?.trim();
8981
+ if (requested) {
8982
+ const namespace = this.writableNamespaceFor(
8983
+ requested,
8640
8984
  request.sessionKey,
8641
8985
  request.authenticatedPrincipal
8642
8986
  );
8987
+ if (enforceToken) this.assertTokenCanWriteNamespace(namespace);
8988
+ return namespace;
8643
8989
  }
8644
8990
  const { principal, overlay, profilePlan } = await this.resolveCodingScopeInputs(request);
8645
- if (profilePlan) {
8646
- const selectedLayer = profilePlan.layers.find((layer) => layer.id === profilePlan.writeLayer);
8647
- const writeNamespaceReadable = profilePlan.writeNamespace.length > 0 && profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
8648
- if (!selectedLayer?.writable || !writeNamespaceReadable) {
8649
- throw new NamespaceNotWritableError(
8650
- profilePlan.writeNamespace,
8651
- principal,
8652
- `scope profile ${profilePlan.profileId} has no writable layer for principal ${principal ?? "anonymous"}`
8653
- );
8654
- }
8655
- return profilePlan.writeNamespace;
8991
+ const result = resolveScopedWritableNamespaceValue({
8992
+ sessionKey: request.sessionKey,
8993
+ authenticatedPrincipal: request.authenticatedPrincipal,
8994
+ principal,
8995
+ codingOverlay: overlay,
8996
+ scopeProfile: profilePlan,
8997
+ config: this.orchestrator.config
8998
+ });
8999
+ if (result.ok) {
9000
+ if (enforceToken) this.assertTokenCanWriteNamespace(result.namespace);
9001
+ return result.namespace;
8656
9002
  }
8657
- if (!overlay) {
8658
- return this.writableNamespaceFor(
8659
- void 0,
8660
- request.sessionKey,
8661
- request.authenticatedPrincipal
9003
+ if (profilePlan && result.namespace === profilePlan.writeNamespace) {
9004
+ throw new NamespaceNotWritableError(
9005
+ result.namespace,
9006
+ principal,
9007
+ `scope profile ${profilePlan.profileId} has no writable layer for principal ${principal ?? "anonymous"}`
8662
9008
  );
8663
9009
  }
8664
- const base = defaultNamespaceForPrincipal(principal, this.orchestrator.config);
8665
- if (!canWriteNamespace(principal, base, this.orchestrator.config)) {
8666
- throw new NamespaceNotWritableError(base, principal);
9010
+ if (result.reason === "unsupported") {
9011
+ throw new EngramAccessInputError(`unsupported namespace: ${result.namespace}`);
8667
9012
  }
8668
- return combineNamespaces(base, overlay.namespace);
9013
+ throw new NamespaceNotWritableError(result.namespace, principal);
9014
+ }
9015
+ async namespaceWritablePreflight(request) {
9016
+ return resolveNamespaceWritablePreflight(
9017
+ request,
9018
+ (preflightRequest) => this.resolveCodingScopedWriteNamespace(preflightRequest, false)
9019
+ );
8669
9020
  }
8670
- /** Read-side mirror of {@link resolveCodingScopedWriteNamespace}. Decision
9021
+ /**
8671
9022
  * `list`/`get` use this so a record written by a project-scoped session is
8672
9023
  * listable/fetchable by the SAME session without manually supplying the
8673
9024
  * overlaid namespace (review P2). Derivation is IDENTICAL to the write path
@@ -8738,6 +9089,7 @@ var EngramAccessService = class {
8738
9089
  request.sessionKey,
8739
9090
  request.authenticatedPrincipal
8740
9091
  );
9092
+ this.assertTokenCanWriteNamespace(writeNamespace2);
8741
9093
  return {
8742
9094
  principal,
8743
9095
  explicitNamespace: request.namespace.trim(),
@@ -8772,6 +9124,14 @@ var EngramAccessService = class {
8772
9124
  this.orchestrator.setCodingContextForSession(request.sessionKey, null);
8773
9125
  }
8774
9126
  };
9127
+ const assertWriteNamespaceAllowed = (namespace) => {
9128
+ try {
9129
+ this.assertTokenCanWriteNamespace(namespace);
9130
+ } catch (error) {
9131
+ clearSeededContext();
9132
+ throw error;
9133
+ }
9134
+ };
8775
9135
  const overlaidBase = this.orchestrator.applyCodingNamespaceOverlay(
8776
9136
  request.sessionKey,
8777
9137
  baseNamespace
@@ -8814,6 +9174,7 @@ var EngramAccessService = class {
8814
9174
  (layer) => (layer.id === "userProject" || layer.id === "teamProject") && layer.readable && layer.namespace && readNamespaces2.includes(layer.namespace)
8815
9175
  )
8816
9176
  );
9177
+ assertWriteNamespaceAllowed(profilePlan.writeNamespace);
8817
9178
  return {
8818
9179
  principal,
8819
9180
  baseNamespace: profilePlan.baseNamespace,
@@ -8839,6 +9200,7 @@ var EngramAccessService = class {
8839
9200
  clearSeededContext();
8840
9201
  throw new NamespaceNotWritableError(baseNamespace, principal);
8841
9202
  }
9203
+ assertWriteNamespaceAllowed(writeNamespace2);
8842
9204
  return {
8843
9205
  principal,
8844
9206
  // scopeDebug.baseNamespace must report the principal SELF base
@@ -8867,6 +9229,7 @@ var EngramAccessService = class {
8867
9229
  const ns = combineNamespaces(baseNamespace, fallback);
8868
9230
  if (!readNamespaces.includes(ns)) readNamespaces.push(ns);
8869
9231
  }
9232
+ assertWriteNamespaceAllowed(writeNamespace);
8870
9233
  return {
8871
9234
  principal,
8872
9235
  baseNamespace,
@@ -11992,6 +12355,21 @@ export {
11992
12355
  clusterByKey,
11993
12356
  computeProcedureStats,
11994
12357
  formatProcedureStatsText,
12358
+ OPERATION_NAMES,
12359
+ coerceBooleanLike,
12360
+ coercePositiveInteger,
12361
+ normalizeOptionalPath,
12362
+ formatZodIssues,
12363
+ defineOperation,
12364
+ getOperation,
12365
+ listRegisteredOperations,
12366
+ __resetRegistryForTest,
12367
+ namespaceWritableRequest,
12368
+ parseNamespacePreflightWriteOp,
12369
+ assertNamespacePreflightPermitted,
12370
+ resolveNamespaceWritablePreflight,
12371
+ resolveAuthorizedNamespaceWritablePreflight,
12372
+ resolveQueryNamespaceWritablePreflight,
11995
12373
  AccessObserveWriteSurface,
11996
12374
  AccessLcmSurface,
11997
12375
  hasIdentityRecoveryIntent,
@@ -12007,4 +12385,4 @@ export {
12007
12385
  EngramAccessService,
12008
12386
  AccessAdminOpsSurface
12009
12387
  };
12010
- //# sourceMappingURL=chunk-3HYWNJDA.js.map
12388
+ //# sourceMappingURL=chunk-JN4N2TMQ.js.map