@remnic/core 10.0.92 → 10.0.94

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 (501) hide show
  1. package/dist/access-admin-ops-surface.js +332 -59
  2. package/dist/access-authorization-probe.js +2 -283
  3. package/dist/access-boundary.d.ts +1 -1
  4. package/dist/access-boundary.d.ts.map +1 -1
  5. package/dist/access-boundary.js +1 -282
  6. package/dist/access-cli.js +287 -303
  7. package/dist/access-cli.js.map +1 -1
  8. package/dist/access-coding-context-resolution.js +3 -3
  9. package/dist/access-extraction-force-flush.js +332 -59
  10. package/dist/access-http-briefing.js +332 -60
  11. package/dist/access-http-query.js +332 -61
  12. package/dist/access-http.js +330 -112
  13. package/dist/access-identity-continuity-surface.js +332 -59
  14. package/dist/access-lcm-surface.js +332 -59
  15. package/dist/access-mcp-frames.d.ts +20 -6
  16. package/dist/access-mcp-frames.d.ts.map +1 -1
  17. package/dist/access-mcp-frames.js +1 -1
  18. package/dist/access-mcp.d.ts +5 -0
  19. package/dist/access-mcp.d.ts.map +1 -1
  20. package/dist/access-mcp.js +330 -87
  21. package/dist/access-namespace-preflight.js +2 -282
  22. package/dist/access-observe-transcript.js +3 -3
  23. package/dist/access-observe-write-category.js +6 -6
  24. package/dist/access-observe-write-surface.js +332 -59
  25. package/dist/access-offline-manifest.js +12 -11
  26. package/dist/access-operations-batch.js +330 -64
  27. package/dist/access-operations.js +330 -73
  28. package/dist/access-recall-concurrency.js +332 -59
  29. package/dist/access-recall-diagnostics.js +5 -4
  30. package/dist/access-recall-response.js +332 -59
  31. package/dist/access-recall-surface.js +332 -59
  32. package/dist/access-schema.js +2 -2
  33. package/dist/access-service.js +335 -62
  34. package/dist/access-surface-catalog.js +6 -283
  35. package/dist/access-surface-catalog.js.map +1 -1
  36. package/dist/active-context-transform.js +1 -1
  37. package/dist/active-memory-bridge.js +3 -2
  38. package/dist/active-recall.js +36 -37
  39. package/dist/active-recall.js.map +1 -1
  40. package/dist/activity/journal-extract.d.ts +13 -1
  41. package/dist/activity/journal-extract.d.ts.map +1 -1
  42. package/dist/{auto-sync-3AZW7MXI.js → auto-sync-BO5YZKM6.js} +13 -15
  43. package/dist/{auto-sync-3AZW7MXI.js.map → auto-sync-BO5YZKM6.js.map} +1 -1
  44. package/dist/briefing.js +20 -20
  45. package/dist/buffer.js +16 -16
  46. package/dist/calibration.js +10 -10
  47. package/dist/{capsule-merge-2IIXFXN5.js → capsule-merge-6IDAYTKG.js} +6 -6
  48. package/dist/causal-consolidation.js +23 -23
  49. package/dist/{chunk-RGUUBAT5.js → chunk-2WCLTWV2.js} +3 -3
  50. package/dist/{chunk-BQZEGOZ4.js → chunk-2YODOG2O.js} +2 -2
  51. package/dist/{chunk-WYG5UNDY.js → chunk-3AUDELZL.js} +2 -2
  52. package/dist/{chunk-MB6ZJDN6.js → chunk-3FBAEPCU.js} +2 -2
  53. package/dist/{chunk-PIITB2YZ.js → chunk-3ZS3NUEI.js} +4 -4
  54. package/dist/{chunk-ATPWZ4F7.js → chunk-4EZWSDFL.js} +5 -5
  55. package/dist/{chunk-ANZZLRUX.js → chunk-4IVRQMZW.js} +2 -2
  56. package/dist/{chunk-63E37JCN.js → chunk-4RAJT5L2.js} +4 -4
  57. package/dist/{chunk-45VUHDV2.js → chunk-5CO5G4MN.js} +2 -2
  58. package/dist/{chunk-LUJCQQ3L.js → chunk-65HWAQ4F.js} +2 -2
  59. package/dist/{chunk-T67LUYCR.js → chunk-77NTFICT.js} +5 -5
  60. package/dist/chunk-A2WFUMUN.js +86 -0
  61. package/dist/chunk-A2WFUMUN.js.map +1 -0
  62. package/dist/{chunk-UE6RRXMF.js → chunk-A4F7OIC5.js} +2 -2
  63. package/dist/chunk-AHA5VQGP.js +117 -0
  64. package/dist/chunk-AHA5VQGP.js.map +1 -0
  65. package/dist/{chunk-RRJBDXAQ.js → chunk-B377OKUP.js} +2 -2
  66. package/dist/{chunk-IUKYFTGW.js → chunk-B3DR2JBZ.js} +140 -125
  67. package/dist/chunk-B3DR2JBZ.js.map +1 -0
  68. package/dist/{chunk-Z7JIZ42P.js → chunk-BN2EBCLB.js} +3 -3
  69. package/dist/{chunk-YYOMGOHB.js → chunk-BOK6BN5M.js} +2 -2
  70. package/dist/{chunk-U6UNF5ZS.js → chunk-BPK32FRM.js} +3 -3
  71. package/dist/{chunk-OH7QLI6W.js → chunk-BPPUH5JM.js} +5 -5
  72. package/dist/{chunk-O6ZSWHVR.js → chunk-C2KE5DMD.js} +4 -4
  73. package/dist/{chunk-47F6WWLQ.js → chunk-C73N66PR.js} +2 -2
  74. package/dist/{chunk-WRT7GJ2D.js → chunk-CIWMTNHW.js} +4 -4
  75. package/dist/{chunk-HF3BKUVV.js → chunk-CL4JU3DF.js} +7 -7
  76. package/dist/{chunk-O55EKIEC.js → chunk-D3ZKHLN2.js} +2 -2
  77. package/dist/chunk-D5S6RL32.js +67137 -0
  78. package/dist/chunk-D5S6RL32.js.map +1 -0
  79. package/dist/{chunk-ETZLQOUR.js → chunk-D5XG2KPS.js} +2 -2
  80. package/dist/{chunk-CD4BCCNP.js → chunk-DJ7WVEWX.js} +2 -2
  81. package/dist/{chunk-PWXPRVLK.js → chunk-DNY63QWJ.js} +2 -2
  82. package/dist/{chunk-4CJTQHEG.js → chunk-ESLOLCD4.js} +3 -3
  83. package/dist/{chunk-VILPVT4S.js → chunk-EZ47HOJ6.js} +4 -4
  84. package/dist/{chunk-EFYN5I7Z.js → chunk-F4QFU5IZ.js} +2 -2
  85. package/dist/{chunk-T6OZW2WR.js → chunk-FA7SLQ5X.js} +7 -1
  86. package/dist/chunk-FA7SLQ5X.js.map +1 -0
  87. package/dist/{chunk-BRLXOZLM.js → chunk-FQAQ63QA.js} +729 -17
  88. package/dist/chunk-FQAQ63QA.js.map +1 -0
  89. package/dist/{chunk-FSO3G4JJ.js → chunk-FWRXW7CZ.js} +5000 -2748
  90. package/dist/chunk-FWRXW7CZ.js.map +1 -0
  91. package/dist/{chunk-XYKBWTWI.js → chunk-FZZMLGWQ.js} +2 -2
  92. package/dist/{chunk-FNXQZGUS.js → chunk-GBJUTX44.js} +2 -2
  93. package/dist/{chunk-YLXETSAH.js → chunk-GCZJ7XRI.js} +2 -2
  94. package/dist/{chunk-UDKWFDV2.js → chunk-HLUHEMN4.js} +27 -3
  95. package/dist/chunk-HLUHEMN4.js.map +1 -0
  96. package/dist/{chunk-SUSW74WU.js → chunk-IL3RHBWM.js} +56 -5
  97. package/dist/chunk-IL3RHBWM.js.map +1 -0
  98. package/dist/{chunk-JV4S6VDH.js → chunk-ILY5SSOM.js} +2 -2
  99. package/dist/{chunk-EXHXJETE.js → chunk-IQ55QGY5.js} +2 -2
  100. package/dist/{chunk-4J363OAA.js → chunk-J7BIFOYP.js} +2 -2
  101. package/dist/{chunk-QFEDITXM.js → chunk-JNDMIAJ4.js} +2 -2
  102. package/dist/chunk-JTSSSR4L.js +359 -0
  103. package/dist/chunk-JTSSSR4L.js.map +1 -0
  104. package/dist/{chunk-5KBIOI4G.js → chunk-JVBAPAWZ.js} +217 -13
  105. package/dist/chunk-JVBAPAWZ.js.map +1 -0
  106. package/dist/{chunk-E5PPE4VA.js → chunk-K2VRKCPA.js} +2 -2
  107. package/dist/{chunk-MKRYQROF.js → chunk-LGEHAQHK.js} +4 -4
  108. package/dist/{chunk-7HTUYFR3.js → chunk-LLPMMMWG.js} +27 -10
  109. package/dist/chunk-LLPMMMWG.js.map +1 -0
  110. package/dist/{chunk-XYTQJD7F.js → chunk-LMJVP5CM.js} +2 -2
  111. package/dist/{chunk-E7YZXWIS.js → chunk-LNGELD2M.js} +2 -2
  112. package/dist/{chunk-FQKBJJYB.js → chunk-LPV72KRQ.js} +2 -2
  113. package/dist/{chunk-2LCRG2YV.js → chunk-M2XR6B6V.js} +2 -2
  114. package/dist/{chunk-EQ4U73UH.js → chunk-MLAMXQAW.js} +14 -2
  115. package/dist/chunk-MLAMXQAW.js.map +1 -0
  116. package/dist/{chunk-ZU5JDLOH.js → chunk-MMRTPH3J.js} +2 -2
  117. package/dist/{chunk-TVIVY7KU.js → chunk-NED7IR7B.js} +4 -4
  118. package/dist/{chunk-6F5MJFXY.js → chunk-NHVAX7MH.js} +2 -2
  119. package/dist/{chunk-TG3R2SID.js → chunk-NMGHGTVR.js} +5 -5
  120. package/dist/{chunk-YCNIGRRF.js → chunk-NS7U4ZYU.js} +13 -117
  121. package/dist/chunk-NS7U4ZYU.js.map +1 -0
  122. package/dist/{chunk-NGHDW6UU.js → chunk-NUQEREIP.js} +2 -2
  123. package/dist/{chunk-5IIQU4JZ.js → chunk-OB72KNMF.js} +4 -4
  124. package/dist/{chunk-RIMK327Y.js → chunk-OUVYYKYU.js} +7 -7
  125. package/dist/{chunk-QJPJXCS4.js → chunk-P3WRNWWM.js} +157 -4
  126. package/dist/chunk-P3WRNWWM.js.map +1 -0
  127. package/dist/{chunk-E6M225BJ.js → chunk-PC5DRBGD.js} +18 -8
  128. package/dist/chunk-PC5DRBGD.js.map +1 -0
  129. package/dist/{chunk-RWGRSKN5.js → chunk-PT4DZDJA.js} +2 -2
  130. package/dist/{chunk-7EPY3IQL.js → chunk-PZJQ46DH.js} +2 -2
  131. package/dist/{chunk-MXHMNKWG.js → chunk-QDESY76F.js} +3 -3
  132. package/dist/{chunk-E3A7ELSG.js → chunk-QHARXWTC.js} +2 -2
  133. package/dist/{chunk-BLJT6JP2.js → chunk-QMFAMOT2.js} +2 -2
  134. package/dist/{chunk-I6QGI65T.js → chunk-QRMG4HK4.js} +3 -3
  135. package/dist/{chunk-ZU3NJNO7.js → chunk-QSF5SJAM.js} +4 -4
  136. package/dist/{chunk-5IYOKDM4.js → chunk-R23JWJD3.js} +5 -5
  137. package/dist/{chunk-RHQLIHMB.js → chunk-R4BBGPI2.js} +218 -218
  138. package/dist/chunk-R4BBGPI2.js.map +1 -0
  139. package/dist/{chunk-NT7F7WJQ.js → chunk-RFUL2ZIQ.js} +291 -93
  140. package/dist/chunk-RFUL2ZIQ.js.map +1 -0
  141. package/dist/{chunk-E4IRW2FG.js → chunk-RKABLU5M.js} +233 -40
  142. package/dist/chunk-RKABLU5M.js.map +1 -0
  143. package/dist/{chunk-P4WNBSTW.js → chunk-RNG7S3FY.js} +2 -2
  144. package/dist/{chunk-IPT2OY4B.js → chunk-RQFXZYTF.js} +35 -33
  145. package/dist/chunk-RQFXZYTF.js.map +1 -0
  146. package/dist/{chunk-5HFXGXE5.js → chunk-RUTN5MMC.js} +7 -9
  147. package/dist/{chunk-5HFXGXE5.js.map → chunk-RUTN5MMC.js.map} +1 -1
  148. package/dist/{chunk-AP6NCP3V.js → chunk-S3S72HRM.js} +8 -6
  149. package/dist/chunk-S3S72HRM.js.map +1 -0
  150. package/dist/{chunk-ZGFLIK5H.js → chunk-SPAKBUJY.js} +2 -2
  151. package/dist/{chunk-ER7XANP3.js → chunk-SQ3GEIEL.js} +4 -4
  152. package/dist/{chunk-PMJFRDJI.js → chunk-SUTEBYGI.js} +2 -2
  153. package/dist/{chunk-HVX4LPNY.js → chunk-T4KY6UYF.js} +5 -3
  154. package/dist/{chunk-HVX4LPNY.js.map → chunk-T4KY6UYF.js.map} +1 -1
  155. package/dist/{chunk-R6HMAIKM.js → chunk-TOSPNM4T.js} +2 -2
  156. package/dist/{chunk-RMXS4I66.js → chunk-TVDJEUV5.js} +2 -2
  157. package/dist/{chunk-PLCYKAWH.js → chunk-TYRWSE4B.js} +2 -2
  158. package/dist/{chunk-B4QYQFGY.js → chunk-UBEKET2V.js} +383 -36
  159. package/dist/chunk-UBEKET2V.js.map +1 -0
  160. package/dist/{chunk-IQWUACVG.js → chunk-UHMHJX5G.js} +3 -3
  161. package/dist/{chunk-YODUDA6R.js → chunk-UN4RVUG2.js} +22 -22
  162. package/dist/{chunk-E6Z4FBX6.js → chunk-V2QSNFCT.js} +2 -2
  163. package/dist/{chunk-NBH6K6G5.js → chunk-V65H7MI6.js} +345 -16
  164. package/dist/chunk-V65H7MI6.js.map +1 -0
  165. package/dist/chunk-W54Z2MOP.js +4500 -0
  166. package/dist/chunk-W54Z2MOP.js.map +1 -0
  167. package/dist/{chunk-7W3RXOIG.js → chunk-WGGRZYSQ.js} +14 -14
  168. package/dist/{chunk-RIZ5NUNN.js → chunk-WQ4XKIOX.js} +4 -4
  169. package/dist/{chunk-QEYTRFR3.js → chunk-X26YOFGS.js} +2 -2
  170. package/dist/{chunk-ITHZFHST.js → chunk-X2BVB74H.js} +2 -2
  171. package/dist/{chunk-6F42QONS.js → chunk-X5HGU2EM.js} +4 -4
  172. package/dist/{chunk-GVGAO3WV.js → chunk-XJ2S5UBF.js} +3 -3
  173. package/dist/{chunk-IBJ6U753.js → chunk-XKZBZOKV.js} +4 -4
  174. package/dist/{chunk-65AUYLU3.js → chunk-XPXHQI6N.js} +2 -2
  175. package/dist/chunk-XRWWCW4H.js +102 -0
  176. package/dist/chunk-XRWWCW4H.js.map +1 -0
  177. package/dist/{chunk-HH5LY6RR.js → chunk-YIXJSW5M.js} +5 -5
  178. package/dist/{chunk-2JSDPUKD.js → chunk-YMFPFXEX.js} +2 -2
  179. package/dist/{chunk-N4KAE2NB.js → chunk-Z3FTSHT5.js} +3 -3
  180. package/dist/{chunk-7GLJMDEQ.js → chunk-ZDV5YWID.js} +6 -6
  181. package/dist/{chunk-645WOU5I.js → chunk-ZDZJNXL6.js} +4 -4
  182. package/dist/{chunk-6TCXIRP5.js → chunk-ZKE4CO6B.js} +4 -4
  183. package/dist/cli.js +303 -185
  184. package/dist/coding/export-okf-codegraph.js +29 -29
  185. package/dist/compounding/engine.js +23 -24
  186. package/dist/config.js +36 -37
  187. package/dist/connectors/codex-materialize-runner.js +20 -20
  188. package/dist/connectors/index.js +21 -21
  189. package/dist/connectors/live/google-drive.d.ts +2 -0
  190. package/dist/connectors/live/google-drive.d.ts.map +1 -1
  191. package/dist/consolidation-provenance-check.js +4 -4
  192. package/dist/consolidation-undo.js +5 -5
  193. package/dist/contradiction/index.js +7 -6
  194. package/dist/{contradiction-scan-P2MHYFVG.js → contradiction-scan-IBPYGQZF.js} +4 -3
  195. package/dist/convergence-refresh.js +22 -22
  196. package/dist/corpus-watermark.js +23 -23
  197. package/dist/deep-recall-http-glue.js +2 -2
  198. package/dist/deep-recall-policy-llm.js +4 -4
  199. package/dist/direct-answer-wiring.js +2 -2
  200. package/dist/embedding-fallback.js +1 -1
  201. package/dist/entity-retrieval.js +21 -21
  202. package/dist/eval-trajectory-store.js +2 -2
  203. package/dist/eval-trajectory.js +2 -2
  204. package/dist/event-order-recall.js +2 -2
  205. package/dist/explicit-capture.d.ts +3 -2
  206. package/dist/explicit-capture.d.ts.map +1 -1
  207. package/dist/explicit-capture.js +530 -6
  208. package/dist/explicit-cue-recall.js +2 -2
  209. package/dist/external-wiki-access.js +2 -283
  210. package/dist/extraction-faithfulness.js +4 -4
  211. package/dist/extraction-judge.js +5 -5
  212. package/dist/extraction-normalization.js +1 -1
  213. package/dist/extraction-quote-grounding.d.ts.map +1 -1
  214. package/dist/extraction-quote-grounding.js +1 -1
  215. package/dist/extraction-source-grounding-rules.js +2 -2
  216. package/dist/extraction-source-grounding.js +3 -3
  217. package/dist/extraction.js +43 -44
  218. package/dist/fallback-llm-codex-subscription.js +2 -2
  219. package/dist/fallback-llm.js +3 -3
  220. package/dist/{first-start-migration-QFI7B5SH.js → first-start-migration-FILJH3RO.js} +6 -5
  221. package/dist/{first-start-migration-QFI7B5SH.js.map → first-start-migration-FILJH3RO.js.map} +1 -1
  222. package/dist/focused-list-recall.js +2 -2
  223. package/dist/harmonic-retrieval.js +20 -20
  224. package/dist/index.js +773 -794
  225. package/dist/lcm/index.js +2 -2
  226. package/dist/live-connectors-runner.js +2 -3
  227. package/dist/local-llm-config.js +2 -2
  228. package/dist/local-llm-helpers.d.ts +4 -0
  229. package/dist/local-llm-helpers.d.ts.map +1 -1
  230. package/dist/local-llm-helpers.js +3 -1
  231. package/dist/local-llm.d.ts +4 -1
  232. package/dist/local-llm.d.ts.map +1 -1
  233. package/dist/local-llm.js +4 -4
  234. package/dist/location/index.js +27 -29
  235. package/dist/maintenance/memory-governance.js +20 -20
  236. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +20 -20
  237. package/dist/maintenance/rebuild-memory-projection-runner.js +22 -22
  238. package/dist/maintenance/rebuild-memory-projection.js +21 -21
  239. package/dist/memory-browse-operations.js +2 -283
  240. package/dist/memory-browse.js +8 -7
  241. package/dist/memory-controller.js +2 -2
  242. package/dist/memory-subject.js +2 -2
  243. package/dist/namespaces/migrate.js +21 -21
  244. package/dist/namespaces/search.js +5 -5
  245. package/dist/namespaces/storage.js +20 -20
  246. package/dist/offline-sync-changeset-generations.js +1 -1
  247. package/dist/offline-sync-embedding-generation.js +1 -1
  248. package/dist/offline-sync-impression-drain.js +6 -6
  249. package/dist/offline-sync-snapshot-stream.js +1 -1
  250. package/dist/offline-sync.js +1 -1
  251. package/dist/operator-doctor-corpus.js +24 -24
  252. package/dist/operator-toolkit.js +58 -61
  253. package/dist/orchestration/backlog-scheduler.js +278 -294
  254. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  255. package/dist/orchestration/buffer-drain-runner.js +278 -294
  256. package/dist/orchestration/extraction-run.d.ts +4 -0
  257. package/dist/orchestration/extraction-run.d.ts.map +1 -1
  258. package/dist/orchestration/fact-dedup-window.d.ts +1 -1
  259. package/dist/orchestration/fact-dedup-window.d.ts.map +1 -1
  260. package/dist/orchestration/maintenance.js +39 -42
  261. package/dist/orchestrator.d.ts +9 -11
  262. package/dist/orchestrator.d.ts.map +1 -1
  263. package/dist/orchestrator.js +290 -307
  264. package/dist/page-versioning.js +3 -3
  265. package/dist/qmd-daemon-session.js +2 -2
  266. package/dist/qmd.js +3 -3
  267. package/dist/recall-explain-renderer.js +1 -1
  268. package/dist/recall-navigation-operations.js +2 -283
  269. package/dist/recall-navigation.js +332 -59
  270. package/dist/recall-planner-llm.js +3 -3
  271. package/dist/recall-state-view-admission.js +6 -6
  272. package/dist/recall-why-service.js +10 -9
  273. package/dist/recall-why.js +4 -3
  274. package/dist/recall-xray-cli.js +2 -2
  275. package/dist/recall-xray-renderer.js +1 -1
  276. package/dist/reconcile/manifest.js +3 -3
  277. package/dist/{resolution-N7H3F2E4.js → resolution-OVVIF7ZY.js} +8 -7
  278. package/dist/response-guidance-recall.js +2 -2
  279. package/dist/resume-bundles.js +40 -41
  280. package/dist/salvage-envelope.js +4 -4
  281. package/dist/search/factory.js +4 -4
  282. package/dist/search/index.js +4 -4
  283. package/dist/semantic-consolidation.js +23 -23
  284. package/dist/semantic-rule-promotion.js +20 -20
  285. package/dist/semantic-rule-verifier.js +20 -20
  286. package/dist/shared-context/manager.js +2 -3
  287. package/dist/source-agent-qualifier.js +32 -33
  288. package/dist/standup/build.js +20 -20
  289. package/dist/storage/buffer-drain-claims.d.ts +97 -12
  290. package/dist/storage/buffer-drain-claims.d.ts.map +1 -1
  291. package/dist/storage/buffer-drain-claims.js +1 -1
  292. package/dist/storage/buffer-session-files.d.ts +4 -0
  293. package/dist/storage/buffer-session-files.d.ts.map +1 -1
  294. package/dist/storage/buffer-session-files.js +1 -1
  295. package/dist/storage/content-hash-index.d.ts +10 -0
  296. package/dist/storage/content-hash-index.d.ts.map +1 -1
  297. package/dist/storage.d.ts.map +1 -1
  298. package/dist/storage.js +19 -19
  299. package/dist/subject-config.js +3 -3
  300. package/dist/summarizer.d.ts +4 -1
  301. package/dist/summarizer.d.ts.map +1 -1
  302. package/dist/summarizer.js +6 -6
  303. package/dist/support-passport/index.js +53 -297
  304. package/dist/targeted-fact-recall.js +2 -2
  305. package/dist/tier-routing.js +3 -2
  306. package/dist/{tier-stats-FQGQSFET.js → tier-stats-FXEUJN73.js} +6 -5
  307. package/dist/{tier-stats-FQGQSFET.js.map → tier-stats-FXEUJN73.js.map} +1 -1
  308. package/dist/transcript.js +2 -2
  309. package/dist/transfer/capsule-import.js +4 -4
  310. package/dist/transfer/export-okf.js +20 -20
  311. package/dist/verified-recall.js +20 -20
  312. package/dist/wearables/memory-gen.d.ts +5 -1
  313. package/dist/wearables/memory-gen.d.ts.map +1 -1
  314. package/dist/wearables/service.d.ts.map +1 -1
  315. package/dist/who-knows-cli.js +21 -21
  316. package/dist/who-knows.js +20 -20
  317. package/dist/write-envelope.js +3 -3
  318. package/package.json +2 -2
  319. package/src/access-boundary.ts +5 -1
  320. package/src/access-category-alias.test.ts +5 -0
  321. package/src/access-mcp-frames.test.ts +60 -5
  322. package/src/access-mcp-frames.ts +72 -18
  323. package/src/access-mcp.test.ts +66 -2
  324. package/src/access-mcp.ts +19 -13
  325. package/src/access-service-coding-write.test.ts +7 -0
  326. package/src/activity/journal-extract-storage.test.ts +31 -0
  327. package/src/activity/journal-extract.test.ts +1 -0
  328. package/src/activity/journal-extract.ts +24 -3
  329. package/src/buffer-drain-handover.test.ts +5 -1
  330. package/src/connectors/live/google-drive.test.ts +39 -0
  331. package/src/connectors/live/google-drive.ts +41 -12
  332. package/src/explicit-capture.test.ts +109 -17
  333. package/src/explicit-capture.ts +90 -37
  334. package/src/extraction-quote-grounding.test.ts +20 -0
  335. package/src/extraction-quote-grounding.ts +21 -11
  336. package/src/fact-dedup-window.test.ts +37 -0
  337. package/src/local-llm-helpers.ts +12 -0
  338. package/src/local-llm-shutdown.test.ts +194 -0
  339. package/src/local-llm.ts +32 -30
  340. package/src/orchestration/extraction-run.ts +12 -3
  341. package/src/orchestration/fact-dedup-window.ts +5 -1
  342. package/src/orchestrator-connector-dedup.test.ts +9 -5
  343. package/src/orchestrator.ts +47 -50
  344. package/src/storage/buffer-drain-claims.test.ts +385 -1
  345. package/src/storage/buffer-drain-claims.ts +380 -97
  346. package/src/storage/buffer-session-files.ts +4 -0
  347. package/src/storage/content-hash-index.ts +27 -2
  348. package/src/storage-fact-hash-publish-failure.test.ts +87 -0
  349. package/src/storage.ts +5 -1
  350. package/src/summarizer-shutdown.test.ts +195 -0
  351. package/src/summarizer.ts +15 -2
  352. package/src/wearables/memory-gen.test.ts +20 -0
  353. package/src/wearables/memory-gen.ts +14 -7
  354. package/src/wearables/service.ts +14 -1
  355. package/src/wearables/storage-io.test.ts +25 -0
  356. package/dist/chunk-2FGLEF7C.js +0 -61
  357. package/dist/chunk-2FGLEF7C.js.map +0 -1
  358. package/dist/chunk-3RLK65ZK.js +0 -203
  359. package/dist/chunk-3RLK65ZK.js.map +0 -1
  360. package/dist/chunk-4WR2OD7K.js +0 -43
  361. package/dist/chunk-4WR2OD7K.js.map +0 -1
  362. package/dist/chunk-5KBIOI4G.js.map +0 -1
  363. package/dist/chunk-5M5M22GW.js +0 -346
  364. package/dist/chunk-5M5M22GW.js.map +0 -1
  365. package/dist/chunk-7HTUYFR3.js.map +0 -1
  366. package/dist/chunk-AP6NCP3V.js.map +0 -1
  367. package/dist/chunk-B4QYQFGY.js.map +0 -1
  368. package/dist/chunk-BJRTMNCB.js +0 -1919
  369. package/dist/chunk-BJRTMNCB.js.map +0 -1
  370. package/dist/chunk-BRLXOZLM.js.map +0 -1
  371. package/dist/chunk-BSACVS6R.js +0 -621
  372. package/dist/chunk-BSACVS6R.js.map +0 -1
  373. package/dist/chunk-DKAA2IHQ.js +0 -3644
  374. package/dist/chunk-DKAA2IHQ.js.map +0 -1
  375. package/dist/chunk-E4IRW2FG.js.map +0 -1
  376. package/dist/chunk-E6M225BJ.js.map +0 -1
  377. package/dist/chunk-EQ4U73UH.js.map +0 -1
  378. package/dist/chunk-ETSJD5IV.js +0 -361
  379. package/dist/chunk-ETSJD5IV.js.map +0 -1
  380. package/dist/chunk-F55YQP7N.js +0 -336
  381. package/dist/chunk-F55YQP7N.js.map +0 -1
  382. package/dist/chunk-FHGWKODN.js +0 -2300
  383. package/dist/chunk-FHGWKODN.js.map +0 -1
  384. package/dist/chunk-FLRP63GU.js +0 -32219
  385. package/dist/chunk-FLRP63GU.js.map +0 -1
  386. package/dist/chunk-FSO3G4JJ.js.map +0 -1
  387. package/dist/chunk-ID6JGIMD.js +0 -25
  388. package/dist/chunk-ID6JGIMD.js.map +0 -1
  389. package/dist/chunk-IGLJNHOX.js +0 -62
  390. package/dist/chunk-IGLJNHOX.js.map +0 -1
  391. package/dist/chunk-IPT2OY4B.js.map +0 -1
  392. package/dist/chunk-IUKYFTGW.js.map +0 -1
  393. package/dist/chunk-NBH6K6G5.js.map +0 -1
  394. package/dist/chunk-NT7F7WJQ.js.map +0 -1
  395. package/dist/chunk-NTRUKAAE.js +0 -223
  396. package/dist/chunk-NTRUKAAE.js.map +0 -1
  397. package/dist/chunk-OGXXGHW6.js +0 -223
  398. package/dist/chunk-OGXXGHW6.js.map +0 -1
  399. package/dist/chunk-PPCLZ4JU.js +0 -28
  400. package/dist/chunk-PPCLZ4JU.js.map +0 -1
  401. package/dist/chunk-QJPJXCS4.js.map +0 -1
  402. package/dist/chunk-R2LBF4HH.js +0 -729
  403. package/dist/chunk-R2LBF4HH.js.map +0 -1
  404. package/dist/chunk-RHQLIHMB.js.map +0 -1
  405. package/dist/chunk-RRTVGD3J.js +0 -792
  406. package/dist/chunk-RRTVGD3J.js.map +0 -1
  407. package/dist/chunk-SUSW74WU.js.map +0 -1
  408. package/dist/chunk-T6OZW2WR.js.map +0 -1
  409. package/dist/chunk-UDKWFDV2.js.map +0 -1
  410. package/dist/chunk-V7IZKJI3.js +0 -22
  411. package/dist/chunk-V7IZKJI3.js.map +0 -1
  412. package/dist/chunk-X562NQFA.js +0 -10144
  413. package/dist/chunk-X562NQFA.js.map +0 -1
  414. package/dist/chunk-XDSCJOH7.js +0 -3991
  415. package/dist/chunk-XDSCJOH7.js.map +0 -1
  416. package/dist/chunk-YCNIGRRF.js.map +0 -1
  417. package/dist/chunk-ZTTCDQ4I.js +0 -18796
  418. package/dist/chunk-ZTTCDQ4I.js.map +0 -1
  419. /package/dist/{capsule-merge-2IIXFXN5.js.map → capsule-merge-6IDAYTKG.js.map} +0 -0
  420. /package/dist/{chunk-RGUUBAT5.js.map → chunk-2WCLTWV2.js.map} +0 -0
  421. /package/dist/{chunk-BQZEGOZ4.js.map → chunk-2YODOG2O.js.map} +0 -0
  422. /package/dist/{chunk-WYG5UNDY.js.map → chunk-3AUDELZL.js.map} +0 -0
  423. /package/dist/{chunk-MB6ZJDN6.js.map → chunk-3FBAEPCU.js.map} +0 -0
  424. /package/dist/{chunk-PIITB2YZ.js.map → chunk-3ZS3NUEI.js.map} +0 -0
  425. /package/dist/{chunk-ATPWZ4F7.js.map → chunk-4EZWSDFL.js.map} +0 -0
  426. /package/dist/{chunk-ANZZLRUX.js.map → chunk-4IVRQMZW.js.map} +0 -0
  427. /package/dist/{chunk-63E37JCN.js.map → chunk-4RAJT5L2.js.map} +0 -0
  428. /package/dist/{chunk-45VUHDV2.js.map → chunk-5CO5G4MN.js.map} +0 -0
  429. /package/dist/{chunk-LUJCQQ3L.js.map → chunk-65HWAQ4F.js.map} +0 -0
  430. /package/dist/{chunk-T67LUYCR.js.map → chunk-77NTFICT.js.map} +0 -0
  431. /package/dist/{chunk-UE6RRXMF.js.map → chunk-A4F7OIC5.js.map} +0 -0
  432. /package/dist/{chunk-RRJBDXAQ.js.map → chunk-B377OKUP.js.map} +0 -0
  433. /package/dist/{chunk-Z7JIZ42P.js.map → chunk-BN2EBCLB.js.map} +0 -0
  434. /package/dist/{chunk-YYOMGOHB.js.map → chunk-BOK6BN5M.js.map} +0 -0
  435. /package/dist/{chunk-U6UNF5ZS.js.map → chunk-BPK32FRM.js.map} +0 -0
  436. /package/dist/{chunk-OH7QLI6W.js.map → chunk-BPPUH5JM.js.map} +0 -0
  437. /package/dist/{chunk-O6ZSWHVR.js.map → chunk-C2KE5DMD.js.map} +0 -0
  438. /package/dist/{chunk-47F6WWLQ.js.map → chunk-C73N66PR.js.map} +0 -0
  439. /package/dist/{chunk-WRT7GJ2D.js.map → chunk-CIWMTNHW.js.map} +0 -0
  440. /package/dist/{chunk-HF3BKUVV.js.map → chunk-CL4JU3DF.js.map} +0 -0
  441. /package/dist/{chunk-O55EKIEC.js.map → chunk-D3ZKHLN2.js.map} +0 -0
  442. /package/dist/{chunk-ETZLQOUR.js.map → chunk-D5XG2KPS.js.map} +0 -0
  443. /package/dist/{chunk-CD4BCCNP.js.map → chunk-DJ7WVEWX.js.map} +0 -0
  444. /package/dist/{chunk-PWXPRVLK.js.map → chunk-DNY63QWJ.js.map} +0 -0
  445. /package/dist/{chunk-4CJTQHEG.js.map → chunk-ESLOLCD4.js.map} +0 -0
  446. /package/dist/{chunk-VILPVT4S.js.map → chunk-EZ47HOJ6.js.map} +0 -0
  447. /package/dist/{chunk-EFYN5I7Z.js.map → chunk-F4QFU5IZ.js.map} +0 -0
  448. /package/dist/{chunk-XYKBWTWI.js.map → chunk-FZZMLGWQ.js.map} +0 -0
  449. /package/dist/{chunk-FNXQZGUS.js.map → chunk-GBJUTX44.js.map} +0 -0
  450. /package/dist/{chunk-YLXETSAH.js.map → chunk-GCZJ7XRI.js.map} +0 -0
  451. /package/dist/{chunk-JV4S6VDH.js.map → chunk-ILY5SSOM.js.map} +0 -0
  452. /package/dist/{chunk-EXHXJETE.js.map → chunk-IQ55QGY5.js.map} +0 -0
  453. /package/dist/{chunk-4J363OAA.js.map → chunk-J7BIFOYP.js.map} +0 -0
  454. /package/dist/{chunk-QFEDITXM.js.map → chunk-JNDMIAJ4.js.map} +0 -0
  455. /package/dist/{chunk-E5PPE4VA.js.map → chunk-K2VRKCPA.js.map} +0 -0
  456. /package/dist/{chunk-MKRYQROF.js.map → chunk-LGEHAQHK.js.map} +0 -0
  457. /package/dist/{chunk-XYTQJD7F.js.map → chunk-LMJVP5CM.js.map} +0 -0
  458. /package/dist/{chunk-E7YZXWIS.js.map → chunk-LNGELD2M.js.map} +0 -0
  459. /package/dist/{chunk-FQKBJJYB.js.map → chunk-LPV72KRQ.js.map} +0 -0
  460. /package/dist/{chunk-2LCRG2YV.js.map → chunk-M2XR6B6V.js.map} +0 -0
  461. /package/dist/{chunk-ZU5JDLOH.js.map → chunk-MMRTPH3J.js.map} +0 -0
  462. /package/dist/{chunk-TVIVY7KU.js.map → chunk-NED7IR7B.js.map} +0 -0
  463. /package/dist/{chunk-6F5MJFXY.js.map → chunk-NHVAX7MH.js.map} +0 -0
  464. /package/dist/{chunk-TG3R2SID.js.map → chunk-NMGHGTVR.js.map} +0 -0
  465. /package/dist/{chunk-NGHDW6UU.js.map → chunk-NUQEREIP.js.map} +0 -0
  466. /package/dist/{chunk-5IIQU4JZ.js.map → chunk-OB72KNMF.js.map} +0 -0
  467. /package/dist/{chunk-RIMK327Y.js.map → chunk-OUVYYKYU.js.map} +0 -0
  468. /package/dist/{chunk-RWGRSKN5.js.map → chunk-PT4DZDJA.js.map} +0 -0
  469. /package/dist/{chunk-7EPY3IQL.js.map → chunk-PZJQ46DH.js.map} +0 -0
  470. /package/dist/{chunk-MXHMNKWG.js.map → chunk-QDESY76F.js.map} +0 -0
  471. /package/dist/{chunk-E3A7ELSG.js.map → chunk-QHARXWTC.js.map} +0 -0
  472. /package/dist/{chunk-BLJT6JP2.js.map → chunk-QMFAMOT2.js.map} +0 -0
  473. /package/dist/{chunk-I6QGI65T.js.map → chunk-QRMG4HK4.js.map} +0 -0
  474. /package/dist/{chunk-ZU3NJNO7.js.map → chunk-QSF5SJAM.js.map} +0 -0
  475. /package/dist/{chunk-5IYOKDM4.js.map → chunk-R23JWJD3.js.map} +0 -0
  476. /package/dist/{chunk-P4WNBSTW.js.map → chunk-RNG7S3FY.js.map} +0 -0
  477. /package/dist/{chunk-ZGFLIK5H.js.map → chunk-SPAKBUJY.js.map} +0 -0
  478. /package/dist/{chunk-ER7XANP3.js.map → chunk-SQ3GEIEL.js.map} +0 -0
  479. /package/dist/{chunk-PMJFRDJI.js.map → chunk-SUTEBYGI.js.map} +0 -0
  480. /package/dist/{chunk-R6HMAIKM.js.map → chunk-TOSPNM4T.js.map} +0 -0
  481. /package/dist/{chunk-RMXS4I66.js.map → chunk-TVDJEUV5.js.map} +0 -0
  482. /package/dist/{chunk-PLCYKAWH.js.map → chunk-TYRWSE4B.js.map} +0 -0
  483. /package/dist/{chunk-IQWUACVG.js.map → chunk-UHMHJX5G.js.map} +0 -0
  484. /package/dist/{chunk-YODUDA6R.js.map → chunk-UN4RVUG2.js.map} +0 -0
  485. /package/dist/{chunk-E6Z4FBX6.js.map → chunk-V2QSNFCT.js.map} +0 -0
  486. /package/dist/{chunk-7W3RXOIG.js.map → chunk-WGGRZYSQ.js.map} +0 -0
  487. /package/dist/{chunk-RIZ5NUNN.js.map → chunk-WQ4XKIOX.js.map} +0 -0
  488. /package/dist/{chunk-QEYTRFR3.js.map → chunk-X26YOFGS.js.map} +0 -0
  489. /package/dist/{chunk-ITHZFHST.js.map → chunk-X2BVB74H.js.map} +0 -0
  490. /package/dist/{chunk-6F42QONS.js.map → chunk-X5HGU2EM.js.map} +0 -0
  491. /package/dist/{chunk-GVGAO3WV.js.map → chunk-XJ2S5UBF.js.map} +0 -0
  492. /package/dist/{chunk-IBJ6U753.js.map → chunk-XKZBZOKV.js.map} +0 -0
  493. /package/dist/{chunk-65AUYLU3.js.map → chunk-XPXHQI6N.js.map} +0 -0
  494. /package/dist/{chunk-HH5LY6RR.js.map → chunk-YIXJSW5M.js.map} +0 -0
  495. /package/dist/{chunk-2JSDPUKD.js.map → chunk-YMFPFXEX.js.map} +0 -0
  496. /package/dist/{chunk-N4KAE2NB.js.map → chunk-Z3FTSHT5.js.map} +0 -0
  497. /package/dist/{chunk-7GLJMDEQ.js.map → chunk-ZDV5YWID.js.map} +0 -0
  498. /package/dist/{chunk-645WOU5I.js.map → chunk-ZDZJNXL6.js.map} +0 -0
  499. /package/dist/{chunk-6TCXIRP5.js.map → chunk-ZKE4CO6B.js.map} +0 -0
  500. /package/dist/{contradiction-scan-P2MHYFVG.js.map → contradiction-scan-IBPYGQZF.js.map} +0 -0
  501. /package/dist/{resolution-N7H3F2E4.js.map → resolution-OVVIF7ZY.js.map} +0 -0
@@ -0,0 +1,359 @@
1
+ import {
2
+ assertNamespaceAllowed,
3
+ assertOperationAuthorizationAllowed,
4
+ tokenCapabilityStore
5
+ } from "./chunk-OGBQMY46.js";
6
+ import {
7
+ expandTildePath
8
+ } from "./chunk-6KH5NLQS.js";
9
+ import {
10
+ EngramAccessInputError
11
+ } from "./chunk-CJCTKL6Y.js";
12
+
13
+ // src/access-boundary.ts
14
+ import { z } from "zod";
15
+ var OPERATION_NAMES = [
16
+ "memory_get",
17
+ "memory_search",
18
+ "external_wiki_search",
19
+ "memory_store",
20
+ "coding_decision",
21
+ "coding_architecture",
22
+ // codegraph parity tools (issue #1554) -- each maps to one codegraph_*
23
+ // boundary operation that delegates to the surface handler in
24
+ // coding/codegraph-surfaces.ts. Names match the external tool suffixes.
25
+ "codegraph_index",
26
+ "codegraph_list_projects",
27
+ "codegraph_delete_project",
28
+ "codegraph_index_status",
29
+ "codegraph_search_graph",
30
+ "codegraph_trace_path",
31
+ "codegraph_detect_changes",
32
+ "codegraph_query_graph",
33
+ "codegraph_get_schema",
34
+ "codegraph_get_snippet",
35
+ "codegraph_get_architecture",
36
+ "codegraph_search_code",
37
+ "codegraph_manage_adr",
38
+ "codegraph_ingest_traces",
39
+ "memory_correct_plan",
40
+ "memory_correct_apply",
41
+ "coding_delta",
42
+ // Remaining MCP/HTTP handlers migrated through the boundary (issue #1525).
43
+ "recall",
44
+ "recall_explain",
45
+ "set_coding_context",
46
+ "recall_tier_explain",
47
+ "recall_xray",
48
+ "recall_why",
49
+ "who_knows",
50
+ "promotion_candidates",
51
+ "namespace_writable",
52
+ "wearables_status",
53
+ "wearables_sync",
54
+ "transcript_day",
55
+ "transcript_search",
56
+ "transcript_memories",
57
+ "location_status",
58
+ "location_check",
59
+ "location_sync",
60
+ "location_backfill",
61
+ "location_day",
62
+ "meetings_list",
63
+ "meetings_get",
64
+ "meetings_build",
65
+ "deep_recall",
66
+ "memory_expand",
67
+ "memory_traverse",
68
+ "memory_ls",
69
+ "memory_tree",
70
+ "memory_find",
71
+ "standup",
72
+ "action_confidence",
73
+ "chatgpt_memory_inspector",
74
+ "day_summary",
75
+ "capsule_export",
76
+ "capsule_import",
77
+ "capsule_list",
78
+ "memory_governance_run",
79
+ "entity_synthesis_run",
80
+ "procedure_mining_run",
81
+ "pattern_reinforcement_run",
82
+ "procedural_stats",
83
+ "procedure_library_maintenance",
84
+ "memory_timeline",
85
+ "suggestion_submit",
86
+ "entity_get",
87
+ "review_queue_list",
88
+ "correction_pending",
89
+ "observe",
90
+ "lcm_search",
91
+ "lcm_compaction_flush",
92
+ "extraction_force_flush",
93
+ "lcm_compaction_record",
94
+ "continuity_audit_generate",
95
+ "continuity_incident_open",
96
+ "continuity_incident_close",
97
+ "continuity_incident_list",
98
+ "continuity_loop_add_or_update",
99
+ "continuity_loop_review",
100
+ "identity_anchor_get",
101
+ "identity_anchor_update",
102
+ "memory_identity",
103
+ "work_task",
104
+ "work_project",
105
+ "work_board",
106
+ "shared_context_write_output",
107
+ "shared_feedback_record",
108
+ "shared_priorities_append",
109
+ "relay_mission_append",
110
+ "relay_mission_read",
111
+ "shared_context_cross_signals_run",
112
+ "shared_context_curate_daily",
113
+ "compounding_weekly_synthesize",
114
+ "compounding_promote_candidate",
115
+ "compression_guidelines_optimize",
116
+ "compression_guidelines_activate",
117
+ "memory_profile",
118
+ "memory_entities_list",
119
+ "memory_questions",
120
+ "memory_last_recall",
121
+ "memory_intent_debug",
122
+ "memory_qmd_debug",
123
+ "memory_graph_explain",
124
+ "graph_snapshot",
125
+ "memory_feedback",
126
+ "memory_promote",
127
+ "memory_outcome",
128
+ "memory_action_apply",
129
+ "context_checkpoint",
130
+ "briefing",
131
+ "review_list",
132
+ "review_resolve",
133
+ "contradiction_scan_run",
134
+ "preference_drift_scan",
135
+ "memory_summarize_hourly",
136
+ "conversation_index_update",
137
+ "profiling_report",
138
+ "graph_edge_decay_run",
139
+ "live_connectors_run",
140
+ "peer_list",
141
+ "peer_get",
142
+ "peer_set",
143
+ "peer_delete",
144
+ "peer_profile_get",
145
+ "peer_forget",
146
+ "console_state",
147
+ "dreams_status",
148
+ "dreams_run",
149
+ "support_passport_memory_preview",
150
+ "support_passport_cards_list",
151
+ "support_passport_draft_create",
152
+ "support_passport_drafts_generate",
153
+ "support_passport_card_replace",
154
+ "support_passport_card_approve",
155
+ "support_passport_card_reject",
156
+ "support_passport_card_withdraw",
157
+ "support_passport_grant_create",
158
+ "support_passport_grants_list",
159
+ "support_passport_grant_revoke",
160
+ "support_passport_grant_read",
161
+ "support_passport_grant_ask",
162
+ // HTTP-only routes (no direct MCP tool equivalent).
163
+ "adapters_status",
164
+ "offline_sync_snapshot",
165
+ "offline_sync_snapshot_stream",
166
+ "offline_sync_files",
167
+ "offline_sync_file_content",
168
+ "offline_sync_apply_file_content",
169
+ "offline_sync_apply",
170
+ "lcm_status",
171
+ "memory_list",
172
+ "recall_timings",
173
+ "entity_list",
174
+ "maintenance_status",
175
+ "quality_status",
176
+ "trust_zones_status",
177
+ "trust_zones_records",
178
+ "review_disposition",
179
+ "review_deck_list",
180
+ "review_deck_action",
181
+ "review_deck_undo",
182
+ "trust_zones_promote",
183
+ "trust_zones_demo_seed",
184
+ "citations_observed",
185
+ "contradiction_detail",
186
+ "graph_events",
187
+ // Chat surface — conversational memory inspection/correction (issue #1583).
188
+ "chat_message",
189
+ "chat_events"
190
+ ];
191
+ var IMPLICIT_HTTP_NAMESPACE_OPERATIONS = /* @__PURE__ */ new Set([
192
+ "offline_sync_snapshot",
193
+ "offline_sync_snapshot_stream",
194
+ "memory_list",
195
+ "entity_list",
196
+ "maintenance_status",
197
+ "quality_status",
198
+ "trust_zones_status",
199
+ "graph_events",
200
+ "citations_observed"
201
+ ]);
202
+ var PRINCIPAL_NAMESPACE_OPERATIONS = /* @__PURE__ */ new Set([
203
+ "support_passport_memory_preview",
204
+ "support_passport_cards_list",
205
+ "support_passport_draft_create",
206
+ "support_passport_drafts_generate",
207
+ "support_passport_card_replace",
208
+ "support_passport_card_approve",
209
+ "support_passport_card_reject",
210
+ "support_passport_card_withdraw",
211
+ "support_passport_grant_create",
212
+ "support_passport_grants_list",
213
+ "support_passport_grant_revoke"
214
+ ]);
215
+ function coerceBooleanLike(value) {
216
+ if (value === void 0 || value === null || value === "") return void 0;
217
+ if (typeof value === "boolean") return value;
218
+ if (typeof value === "string") {
219
+ const lower = value.trim().toLowerCase();
220
+ if (lower === "true" || lower === "1" || lower === "yes" || lower === "on") return true;
221
+ if (lower === "false" || lower === "0" || lower === "no" || lower === "off") return false;
222
+ }
223
+ throw new EngramAccessInputError(
224
+ `expected a boolean-like value (true|false|1|0|yes|no|on|off); got ${JSON.stringify(value)}`
225
+ );
226
+ }
227
+ function coercePositiveInteger(value, label) {
228
+ if (value === void 0 || value === null || value === "") return void 0;
229
+ if (typeof value === "number") {
230
+ if (!Number.isFinite(value) || value <= 0 || !Number.isInteger(value)) {
231
+ throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
232
+ }
233
+ return value;
234
+ }
235
+ if (typeof value === "string") {
236
+ const trimmed = value.trim();
237
+ if (!/^[+-]?\d+$/.test(trimmed)) {
238
+ throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
239
+ }
240
+ const parsed = Number(trimmed);
241
+ if (!Number.isSafeInteger(parsed) || parsed <= 0) {
242
+ throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
243
+ }
244
+ return parsed;
245
+ }
246
+ throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
247
+ }
248
+ function normalizeOptionalPath(value) {
249
+ if (value === void 0 || value === null || value === "") return void 0;
250
+ if (typeof value !== "string") {
251
+ throw new EngramAccessInputError(`expected a path string; got ${JSON.stringify(value)}`);
252
+ }
253
+ return expandTildePath(value);
254
+ }
255
+ function formatZodIssues(error) {
256
+ const parts = [];
257
+ for (const issue of error.issues) {
258
+ const hasNumeric = issue.path.some((p) => typeof p === "number");
259
+ const path = hasNumeric ? issue.path.filter((p) => typeof p === "string").join(".") || "(root)" : issue.path.length > 0 ? issue.path.join(".") : "(root)";
260
+ const options = enumOptionsFromIssue(issue);
261
+ const suffix = options ? `. Valid: ${options.join(", ")}` : "";
262
+ parts.push(`${path}: ${humanReadableIssueMessage(issue, path, hasNumeric)}${suffix}`);
263
+ }
264
+ return parts.length > 0 ? `request validation failed: ${parts.join("; ")}` : "request validation failed";
265
+ }
266
+ function enumOptionsFromIssue(issue) {
267
+ if (issue.code !== "invalid_value") return void 0;
268
+ const rawValues = "values" in issue ? issue.values : void 0;
269
+ return Array.isArray(rawValues) ? rawValues.map((opt) => String(opt)) : void 0;
270
+ }
271
+ function humanReadableIssueMessage(issue, pathLabel, hasNumericPath) {
272
+ if (issue.code !== "invalid_type") return issue.message;
273
+ const expected = issue.expected;
274
+ if (issue.message.endsWith("received undefined")) return issue.message;
275
+ if (hasNumericPath && expected) {
276
+ return `${pathLabel} must be an array of ${expected}s`;
277
+ }
278
+ const fieldName = issue.path.length > 0 ? String(issue.path[issue.path.length - 1]) : "value";
279
+ switch (expected) {
280
+ case "string":
281
+ return `${fieldName} must be a string`;
282
+ case "boolean":
283
+ return `${fieldName} must be a boolean`;
284
+ case "number":
285
+ return `${fieldName} must be a number`;
286
+ case "array":
287
+ return `${fieldName} must be an array`;
288
+ case "object":
289
+ return `${fieldName} must be an object`;
290
+ default:
291
+ return issue.message;
292
+ }
293
+ }
294
+ var registry = /* @__PURE__ */ new Map();
295
+ function defineOperation(spec) {
296
+ if (registry.has(spec.name)) {
297
+ throw new Error(`access-boundary: operation already registered: ${spec.name}`);
298
+ }
299
+ const bound = {
300
+ spec,
301
+ run: async (rawInput, ctx) => {
302
+ const parseResult = spec.schema.safeParse(rawInput);
303
+ if (!parseResult.success) {
304
+ throw new EngramAccessInputError(formatZodIssues(parseResult.error));
305
+ }
306
+ assertOperationAuthorizationAllowed(tokenCapabilityStore.getStore(), spec);
307
+ if (operationRequiresAuthorizedNamespace(spec.name)) {
308
+ const parsedNamespace = parseResult.data.namespace;
309
+ if (parsedNamespace) {
310
+ assertNamespaceAllowed(tokenCapabilityStore.getStore(), parsedNamespace);
311
+ }
312
+ }
313
+ return spec.handler(parseResult.data, { ...ctx, rawInput });
314
+ }
315
+ };
316
+ registry.set(spec.name, bound);
317
+ return bound;
318
+ }
319
+ function getOperation(name) {
320
+ return registry.get(name);
321
+ }
322
+ function operationRequiresAuthorizedNamespace(name) {
323
+ if (name === "namespace_writable") return false;
324
+ if (IMPLICIT_HTTP_NAMESPACE_OPERATIONS.has(name)) return true;
325
+ let schema = registry.get(name)?.spec.schema;
326
+ while (schema instanceof z.ZodType && !(schema instanceof z.ZodObject)) {
327
+ const wrapper = schema;
328
+ const sides = [wrapper.in, wrapper.out].filter(
329
+ (side) => side instanceof z.ZodType && !(side instanceof z.ZodTransform)
330
+ );
331
+ if (sides.length !== 1) break;
332
+ schema = sides[0];
333
+ }
334
+ return schema instanceof z.ZodObject && Object.hasOwn(schema.shape, "namespace");
335
+ }
336
+ function operationUsesPrincipalNamespace(name) {
337
+ return PRINCIPAL_NAMESPACE_OPERATIONS.has(name);
338
+ }
339
+ function listRegisteredOperations() {
340
+ return [...registry.keys()];
341
+ }
342
+ function __resetRegistryForTest() {
343
+ registry.clear();
344
+ }
345
+
346
+ export {
347
+ OPERATION_NAMES,
348
+ coerceBooleanLike,
349
+ coercePositiveInteger,
350
+ normalizeOptionalPath,
351
+ formatZodIssues,
352
+ defineOperation,
353
+ getOperation,
354
+ operationRequiresAuthorizedNamespace,
355
+ operationUsesPrincipalNamespace,
356
+ listRegisteredOperations,
357
+ __resetRegistryForTest
358
+ };
359
+ //# sourceMappingURL=chunk-JTSSSR4L.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/access-boundary.ts"],"sourcesContent":["/**\n * Single input-validation and error boundary for the CLI/MCP/HTTP access\n * surfaces (issue #1525, epic #1520 Phase 1).\n *\n * Every operation that crosses the access-service facade passes through ONE\n * registry entry: a zod-validated request envelope, a shared error mapper,\n * and the \"reject invalid input and list valid options\" behavior that\n * CLAUDE.md rules 14/17/24/28/36/48/51 previously had to be re-implemented\n * per handler. The three surfaces become thin adapters — one operation\n * definition, three transports — so a validation fix lands everywhere at\n * once.\n *\n * Host-agnostic (rule 31): operation names carry no `openclaw-*`/`engram-*`\n * prefix. Session/namespace tenancy stays in the handler layer (resolved via\n * ScopePlan #1521); the boundary validates SHAPE, not tenancy.\n */\n\nimport { z } from \"zod\";\n// The input error lives in the leaf module; importing it from access-service\n// here (a re-export) drags the whole service hub into this module's init and\n// leaves `registry` TDZ-uninitialized when the cycle re-enters (#3354).\nimport { EngramAccessInputError } from \"./access-errors.js\";\nimport type { EngramAccessService } from \"./access-service.js\";\nimport {\n assertNamespaceAllowed,\n assertOperationAuthorizationAllowed,\n tokenCapabilityStore,\n} from \"./access-token-capabilities.js\";\nimport { expandTildePath } from \"./utils/path.js\";\n\n// ---------------------------------------------------------------------------\n// Canonical operation names — host-agnostic (rule 31)\n// ---------------------------------------------------------------------------\n\n/**\n * Canonical operation ids. One id is shared by the MCP tool, the HTTP route,\n * and the CLI command that expose the same operation. Add to this union as\n * each domain-group migration PR (memory ops → connectors → namespaces …)\n * lands; the fitness test in `access-surface-catalog.test.ts` treats the\n * registered set as the migration state.\n */\nexport const OPERATION_NAMES = [\n \"memory_get\",\n \"memory_search\",\n \"external_wiki_search\",\n \"memory_store\",\n \"coding_decision\",\n \"coding_architecture\",\n // codegraph parity tools (issue #1554) -- each maps to one codegraph_*\n // boundary operation that delegates to the surface handler in\n // coding/codegraph-surfaces.ts. Names match the external tool suffixes.\n \"codegraph_index\",\n \"codegraph_list_projects\",\n \"codegraph_delete_project\",\n \"codegraph_index_status\",\n \"codegraph_search_graph\",\n \"codegraph_trace_path\",\n \"codegraph_detect_changes\",\n \"codegraph_query_graph\",\n \"codegraph_get_schema\",\n \"codegraph_get_snippet\",\n \"codegraph_get_architecture\",\n \"codegraph_search_code\",\n \"codegraph_manage_adr\",\n \"codegraph_ingest_traces\",\n \"memory_correct_plan\",\n \"memory_correct_apply\",\n \"coding_delta\",\n // Remaining MCP/HTTP handlers migrated through the boundary (issue #1525).\n \"recall\",\n \"recall_explain\",\n \"set_coding_context\",\n \"recall_tier_explain\",\n \"recall_xray\",\n \"recall_why\",\n \"who_knows\",\n \"promotion_candidates\",\n \"namespace_writable\",\n \"wearables_status\",\n \"wearables_sync\",\n \"transcript_day\",\n \"transcript_search\",\n \"transcript_memories\",\n \"location_status\",\n \"location_check\",\n \"location_sync\",\n \"location_backfill\",\n \"location_day\",\n \"meetings_list\",\n \"meetings_get\",\n \"meetings_build\",\n \"deep_recall\",\n \"memory_expand\",\n \"memory_traverse\",\n \"memory_ls\",\n \"memory_tree\",\n \"memory_find\",\n \"standup\",\n \"action_confidence\",\n \"chatgpt_memory_inspector\",\n \"day_summary\",\n \"capsule_export\",\n \"capsule_import\",\n \"capsule_list\",\n \"memory_governance_run\",\n \"entity_synthesis_run\",\n \"procedure_mining_run\",\n \"pattern_reinforcement_run\",\n \"procedural_stats\",\n \"procedure_library_maintenance\",\n \"memory_timeline\",\n \"suggestion_submit\",\n \"entity_get\",\n \"review_queue_list\",\n \"correction_pending\",\n \"observe\",\n \"lcm_search\",\n \"lcm_compaction_flush\",\n \"extraction_force_flush\",\n \"lcm_compaction_record\",\n \"continuity_audit_generate\",\n \"continuity_incident_open\",\n \"continuity_incident_close\",\n \"continuity_incident_list\",\n \"continuity_loop_add_or_update\",\n \"continuity_loop_review\",\n \"identity_anchor_get\",\n \"identity_anchor_update\",\n \"memory_identity\",\n \"work_task\",\n \"work_project\",\n \"work_board\",\n \"shared_context_write_output\",\n \"shared_feedback_record\",\n \"shared_priorities_append\",\n \"relay_mission_append\",\n \"relay_mission_read\",\n \"shared_context_cross_signals_run\",\n \"shared_context_curate_daily\",\n \"compounding_weekly_synthesize\",\n \"compounding_promote_candidate\",\n \"compression_guidelines_optimize\",\n \"compression_guidelines_activate\",\n \"memory_profile\",\n \"memory_entities_list\",\n \"memory_questions\",\n \"memory_last_recall\",\n \"memory_intent_debug\",\n \"memory_qmd_debug\",\n \"memory_graph_explain\",\n \"graph_snapshot\",\n \"memory_feedback\",\n \"memory_promote\",\n \"memory_outcome\",\n \"memory_action_apply\",\n \"context_checkpoint\",\n \"briefing\",\n \"review_list\",\n \"review_resolve\",\n \"contradiction_scan_run\",\n \"preference_drift_scan\",\n \"memory_summarize_hourly\",\n \"conversation_index_update\",\n \"profiling_report\",\n \"graph_edge_decay_run\",\n \"live_connectors_run\",\n \"peer_list\",\n \"peer_get\",\n \"peer_set\",\n \"peer_delete\",\n \"peer_profile_get\",\n \"peer_forget\",\n \"console_state\",\n \"dreams_status\",\n \"dreams_run\",\n \"support_passport_memory_preview\",\n \"support_passport_cards_list\",\n \"support_passport_draft_create\",\n \"support_passport_drafts_generate\",\n \"support_passport_card_replace\",\n \"support_passport_card_approve\",\n \"support_passport_card_reject\",\n \"support_passport_card_withdraw\",\n \"support_passport_grant_create\",\n \"support_passport_grants_list\",\n \"support_passport_grant_revoke\",\n \"support_passport_grant_read\",\n \"support_passport_grant_ask\",\n // HTTP-only routes (no direct MCP tool equivalent).\n \"adapters_status\",\n \"offline_sync_snapshot\",\n \"offline_sync_snapshot_stream\",\n \"offline_sync_files\",\n \"offline_sync_file_content\",\n \"offline_sync_apply_file_content\",\n \"offline_sync_apply\",\n \"lcm_status\",\n \"memory_list\",\n \"recall_timings\",\n \"entity_list\",\n \"maintenance_status\",\n \"quality_status\",\n \"trust_zones_status\",\n \"trust_zones_records\",\n \"review_disposition\",\n \"review_deck_list\",\n \"review_deck_action\",\n \"review_deck_undo\",\n \"trust_zones_promote\",\n \"trust_zones_demo_seed\",\n \"citations_observed\",\n \"contradiction_detail\",\n \"graph_events\",\n // Chat surface — conversational memory inspection/correction (issue #1583).\n \"chat_message\",\n \"chat_events\",\n] as const;\n\n/**\n * Canonical operation ids. One id is shared by the MCP tool, the HTTP route,\n * and the CLI command that expose the same operation. Derived from\n * {@link OPERATION_NAMES} (single source of truth) so the runtime catalog\n * used for token-capability validation cannot drift from the type. The\n * fitness test in `access-surface-catalog.test.ts` treats the registered set\n * as the migration state.\n */\nexport type OperationName = (typeof OPERATION_NAMES)[number];\n\nconst IMPLICIT_HTTP_NAMESPACE_OPERATIONS = new Set<OperationName>([\n \"offline_sync_snapshot\",\n \"offline_sync_snapshot_stream\",\n \"memory_list\",\n \"entity_list\",\n \"maintenance_status\",\n \"quality_status\",\n \"trust_zones_status\",\n \"graph_events\",\n \"citations_observed\",\n]);\n\nconst PRINCIPAL_NAMESPACE_OPERATIONS = new Set<OperationName>([\n \"support_passport_memory_preview\",\n \"support_passport_cards_list\",\n \"support_passport_draft_create\",\n \"support_passport_drafts_generate\",\n \"support_passport_card_replace\",\n \"support_passport_card_approve\",\n \"support_passport_card_reject\",\n \"support_passport_card_withdraw\",\n \"support_passport_grant_create\",\n \"support_passport_grants_list\",\n \"support_passport_grant_revoke\",\n]);\n\n// ---------------------------------------------------------------------------\n// Operation context — what every handler receives\n// ---------------------------------------------------------------------------\n\n/**\n * Per-call context. `service` is the facade the handler delegates to; the\n * boundary never reaches past it. `authenticatedPrincipal` is resolved by\n * the SURFACE (MCP header / HTTP identity / CLI flag) before the boundary\n * runs, so handlers stay principal-source-agnostic. `hooks` carries\n * transport-level callbacks (e.g. HTTP write-quota enforcement) that must\n * fire atomically inside the service call; surfaces that have no such hook\n * leave it undefined.\n */\nexport interface OperationContext {\n readonly service: EngramAccessService;\n readonly authenticatedPrincipal?: string;\n readonly operatorPrincipal?: string;\n /** Per-request cancellation supplied by transports that own a request lifecycle. */\n readonly abortSignal?: AbortSignal;\n /** Server-resolved connector identity (Phase 1 provenance). Set by the HTTP auth boundary from the matched token's connector; flows to write handlers so frontmatter records which connector submitted the memory. Client-supplied values are always overridden. */\n readonly sourceConnector?: string;\n /**\n * The PRE-validation raw envelope exactly as the transport supplied it\n * (issue #2829). Handlers use it to retain input spellings the schema's\n * transforms canonicalize — e.g. the memory-store category aliases — so\n * diagnostics can name what the caller actually sent. Never trust it for\n * behavior; only the parsed `input` is validated.\n */\n readonly rawInput?: unknown;\n readonly hooks?: OperationHooks;\n}\n\n/**\n * Transport-level callbacks a handler forwards into the service call. Kept\n * narrow on purpose: the boundary owns validation + dispatch shape, not\n * transport policy. Add fields here only when a surface genuinely needs a\n * callback the service itself consumes.\n */\nexport interface OperationHooks {\n /** HTTP write-quota gate; throws to reject the write when exhausted. */\n readonly enforceWriteQuota?: () => void | Promise<void>;\n /** Commit-boundary accounting for writes that can fail after durability. */\n readonly recordWriteCommit?: () => void;\n}\n\n// ---------------------------------------------------------------------------\n// Operation spec + bound operation\n// ---------------------------------------------------------------------------\n\nexport interface OperationSpec<In, Out> {\n /** Canonical operation id; matches an {@link OperationName}. */\n readonly name: OperationName;\n readonly description: string;\n /**\n * Zod schema validating the raw request envelope. Input type may differ\n * from the output `In` — schemas that canonicalize during parsing (issue\n * #2829 category aliases) are first-class, declared truthfully instead of\n * cast into an input-equals-output shape.\n */\n readonly schema: z.ZodType<In, unknown>;\n /** Handler invoked with the parsed input; throws EngramAccessInputError for domain faults. */\n readonly handler: (input: In, ctx: OperationContext) => Promise<Out>;\n /**\n * Marks an operation as inherently FLEET-WIDE / global — it runs across ALL\n * namespaces (or against a single non-namespaced global layer) and carries no\n * `namespace` argument, so the MCP `tools/call` effective-namespace chokepoint\n * never applies. When set, {@link defineOperation}'s run wrapper rejects any\n * namespace-SCOPED token (fail closed) via assertFleetWideOperationAllowed\n * BEFORE the handler — no side effect on denial. Unrestricted/legacy tokens\n * (cron, internal callers, no capability record) are unaffected (issue #1850).\n */\n readonly fleetWide?: boolean;\n /**\n * Alternate op allow-list: when set, the token may invoke this operation if\n * its ops allow-list permits ANY of these ops (instead of the default rule\n * that requires the op's own {@link name}). Lets a read-only diagnostic be\n * granted by the write ops it diagnoses — e.g. `namespace_writable` is\n * runnable by any token permitted to `observe`/`memory_store`, so a token\n * minted before the diagnostic op existed can still call it. Unrestricted /\n * legacy tokens (no ops axis) are unaffected. Keeps the boundary and any HTTP\n * transport for the same op enforcing ONE policy.\n */\n readonly allowedByOps?: readonly OperationName[];\n}\n\nexport interface BoundOperation<In = unknown, Out = unknown> {\n readonly spec: OperationSpec<In, Out>;\n /** Validate the raw envelope, then invoke the handler. Throws EngramAccessInputError on any validation failure. */\n readonly run: (rawInput: unknown, ctx: OperationContext) => Promise<Out>;\n}\n\n// ---------------------------------------------------------------------------\n// Shared normalizers the boundary owns (rules 17, 28, 36, 48, 51)\n// ---------------------------------------------------------------------------\n\n/**\n * Coerce boolean-like strings at the edge (rule 36). Accepts actual booleans\n * and the string spellings clients send (\"true\"/\"false\"/\"1\"/\"0\"/\"yes\"/\"no\"/\n * \"on\"/\"off\", case-insensitive). Rejects anything else loudly — `Boolean(\"false\")`\n * would silently be `true`, which is the bug rule 36 exists to prevent.\n *\n * `undefined`/`null`/`\"\"` → `undefined`, so callers can keep treating an\n * absent flag as \"use the default\" without a separate presence check.\n */\nexport function coerceBooleanLike(value: unknown): boolean | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n if (typeof value === \"boolean\") return value;\n if (typeof value === \"string\") {\n const lower = value.trim().toLowerCase();\n if (lower === \"true\" || lower === \"1\" || lower === \"yes\" || lower === \"on\") return true;\n if (lower === \"false\" || lower === \"0\" || lower === \"no\" || lower === \"off\") return false;\n }\n throw new EngramAccessInputError(\n `expected a boolean-like value (true|false|1|0|yes|no|on|off); got ${JSON.stringify(value)}`,\n );\n}\n\n/**\n * Coerce + validate a positive integer from a numeric string or number\n * (rule 28). Loosely-typed MCP/CLI clients send `\"5\"`; `typeof saved === \"number\"`\n * on read-back would reject it later, so we coerce at the edge and reject\n * booleans/objects loudly (`Number(true) === 1` would silently pass otherwise).\n *\n * `undefined`/`null`/`\"\"` → `undefined`.\n */\nexport function coercePositiveInteger(value: unknown, label: string): number | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value) || value <= 0 || !Number.isInteger(value)) {\n throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);\n }\n return value;\n }\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n if (!/^[+-]?\\d+$/.test(trimmed)) {\n throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);\n }\n const parsed = Number(trimmed);\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);\n }\n return parsed;\n }\n throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);\n}\n\n/**\n * Expand `~` in a path-shaped input (rule 17). Node `fs` does NOT expand `~`;\n * ad-hoc regex drifts. `undefined`/`null`/`\"\"` → `undefined`.\n */\nexport function normalizeOptionalPath(value: unknown): string | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n if (typeof value !== \"string\") {\n throw new EngramAccessInputError(`expected a path string; got ${JSON.stringify(value)}`);\n }\n return expandTildePath(value);\n}\n\n// ---------------------------------------------------------------------------\n// Error formatting — rule 51: list valid options, never silently default\n// ---------------------------------------------------------------------------\n\n/**\n * Turn a zod failure into an {@link EngramAccessInputError} whose message\n * names the offending field and — for enum/union issues — lists the valid\n * options, so the caller can correct rather than guess (rule 51).\n */\nexport function formatZodIssues(error: z.ZodError): string {\n const parts: string[] = [];\n for (const issue of error.issues) {\n // Collapse array-index paths (e.g. [\"currentContextScopes\", 1]) to\n // the field name so the message reads \"field: must be ...\" not\n // \"field.1: must be ...\".\n const hasNumeric = issue.path.some((p) => typeof p === \"number\");\n const path = hasNumeric\n ? issue.path.filter((p) => typeof p === \"string\").join(\".\") || \"(root)\"\n : issue.path.length > 0 ? issue.path.join(\".\") : \"(root)\";\n const options = enumOptionsFromIssue(issue);\n const suffix = options ? `. Valid: ${options.join(\", \")}` : \"\";\n parts.push(`${path}: ${humanReadableIssueMessage(issue, path, hasNumeric)}${suffix}`);\n }\n return parts.length > 0\n ? `request validation failed: ${parts.join(\"; \")}`\n : \"request validation failed\";\n}\n\nfunction enumOptionsFromIssue(issue: z.core.$ZodIssue): readonly string[] | undefined {\n // zod 4 exposes accepted enum values on invalid_value issues as `values`\n // (the v3 `options` spelling is kept as a fallback). Reading them here\n // keeps \"list valid options\" in ONE place rather than per handler.\n if (issue.code !== \"invalid_value\") return undefined;\n const rawValues = \"values\" in issue ? issue.values : undefined;\n return Array.isArray(rawValues) ? rawValues.map((opt) => String(opt)) : undefined;\n}\n\n/**\n * Human-readable \"must be a <type>\" message for generic type mismatches\n * (rule 51). zod 4 removed parse-time error maps, so the boundary applies\n * this post-parse in formatZodIssues instead — same messages, one place.\n * The caller supplies the collapsed path label and its numeric-segment\n * verdict so this helper runs no representation checks of its own.\n */\nfunction humanReadableIssueMessage(issue: z.core.$ZodIssue, pathLabel: string, hasNumericPath: boolean): string {\n if (issue.code !== \"invalid_type\") return issue.message;\n const expected = issue.expected;\n // zod 4 issues carry no `received` field; its message ends \"received undefined\"\n // for an absent value, which is a missing field, not a type mismatch.\n if (issue.message.endsWith(\"received undefined\")) return issue.message;\n if (hasNumericPath && expected) {\n return `${pathLabel} must be an array of ${expected}s`;\n }\n const fieldName = issue.path.length > 0 ? String(issue.path[issue.path.length - 1]) : \"value\";\n switch (expected) {\n case \"string\": return `${fieldName} must be a string`;\n case \"boolean\": return `${fieldName} must be a boolean`;\n case \"number\": return `${fieldName} must be a number`;\n case \"array\": return `${fieldName} must be an array`;\n case \"object\": return `${fieldName} must be an object`;\n default: return issue.message;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Registry\n// ---------------------------------------------------------------------------\n\nconst registry = new Map<OperationName, BoundOperation>();\n\n/**\n * Register an operation. Throws if the name is already registered — duplicate\n * registration is a programming error, not a runtime input fault, so it throws\n * a plain Error (not the input-error class surfaces translate for clients).\n */\nexport function defineOperation<In, Out>(spec: OperationSpec<In, Out>): BoundOperation<In, Out> {\n if (registry.has(spec.name)) {\n throw new Error(`access-boundary: operation already registered: ${spec.name}`);\n }\n const bound: BoundOperation<In, Out> = {\n spec,\n run: async (rawInput, ctx) => {\n const parseResult = spec.schema.safeParse(rawInput);\n if (!parseResult.success) {\n throw new EngramAccessInputError(formatZodIssues(parseResult.error));\n }\n assertOperationAuthorizationAllowed(tokenCapabilityStore.getStore(), spec);\n // Post-parse namespace re-check (issue #3225 B1): the transports authorize\n // the RAW namespace before preprocessing. Re-check the PARSED value so a\n // namespace that only appears after validation cannot bypass the token\n // allow-list. Absent namespaces keep the transport check; no default is\n // invented here.\n if (operationRequiresAuthorizedNamespace(spec.name)) {\n // SAFETY: namespace-bearing schemas parse `namespace` as a non-empty\n // string, an explicit null (transport null-for-absent idiom), or\n // undefined; falsy spellings mean absent and keep the transport check.\n const parsedNamespace = (parseResult.data as { namespace?: string | null }).namespace;\n if (parsedNamespace) {\n assertNamespaceAllowed(tokenCapabilityStore.getStore(), parsedNamespace);\n }\n }\n return spec.handler(parseResult.data, { ...ctx, rawInput });\n },\n };\n // Store under the canonical name; the cast is safe because In/Out are\n // erased at the registry boundary and recovered by callers via getOperation.\n registry.set(spec.name, bound as unknown as BoundOperation);\n return bound;\n}\n\n/** Look up a registered operation by canonical name. */\nexport function getOperation(name: OperationName): BoundOperation | undefined {\n return registry.get(name);\n}\n\n/** Whether a probe must authorize an operation's effective namespace. */\nexport function operationRequiresAuthorizedNamespace(name: OperationName): boolean {\n if (name === \"namespace_writable\") return false;\n if (IMPLICIT_HTTP_NAMESPACE_OPERATIONS.has(name)) return true;\n let schema: unknown = registry.get(name)?.spec.schema;\n // zod 4 has no ZodEffects. Transforms and preprocessors wrap as pipes with\n // the base schema on the side opposite the ZodTransform. Unwrap until the\n // base object appears — one unwrap left suggestion_submit looking\n // namespace-free after the category transform, so the loop stays.\n while (schema instanceof z.ZodType && !(schema instanceof z.ZodObject)) {\n // SAFETY: pipe wrappers expose their two sides as `in` / `out`.\n const wrapper = schema as { in?: unknown; out?: unknown };\n const sides = [wrapper.in, wrapper.out].filter(\n (side) => side instanceof z.ZodType && !(side instanceof z.ZodTransform),\n );\n if (sides.length !== 1) break;\n schema = sides[0];\n }\n return schema instanceof z.ZodObject && Object.hasOwn(schema.shape, \"namespace\");\n}\n\n/** Whether an operation resolves its namespace from the authenticated principal. */\nexport function operationUsesPrincipalNamespace(name: OperationName): boolean {\n return PRINCIPAL_NAMESPACE_OPERATIONS.has(name);\n}\n\n/** All registered operation names. */\nexport function listRegisteredOperations(): readonly OperationName[] {\n return [...registry.keys()];\n}\n\n/** Test-only: clear the registry so pilot definitions can be re-registered. */\nexport function __resetRegistryForTest(): void {\n registry.clear();\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAS,SAAS;AAwBX,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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","names":[]}