@noy-db/hub 0.4.0-pre.4 → 0.4.0-pre.6

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 (470) hide show
  1. package/README.md +2 -2
  2. package/dist/api-5QVQX4HG.js +20 -0
  3. package/dist/attestation/index.js +18 -18
  4. package/dist/{backup-JL2GOTYQ.js → backup-USYSNCYM.js} +11 -11
  5. package/dist/blobs/index.js +15 -12
  6. package/dist/blobs/index.js.map +1 -1
  7. package/dist/broker/index.js +12 -12
  8. package/dist/cargo/index.js +34 -36
  9. package/dist/{chunk-JLHKBAFY.js → chunk-2BVW754E.js} +3 -3
  10. package/dist/{chunk-T7S4V52L.js → chunk-2PDBYF2O.js} +4 -4
  11. package/dist/{chunk-YGBIBOCR.js → chunk-2ZSC454H.js} +7 -7
  12. package/dist/{chunk-IGAIOGCN.js → chunk-32467U5J.js} +4 -4
  13. package/dist/{chunk-JA5O7UEZ.js → chunk-3GXDB3NQ.js} +6 -6
  14. package/dist/chunk-3GXDB3NQ.js.map +1 -0
  15. package/dist/{chunk-U73LHVPF.js → chunk-3S2YNMUS.js} +54 -6
  16. package/dist/chunk-3S2YNMUS.js.map +1 -0
  17. package/dist/{chunk-JW3XCZA2.js → chunk-3TZUC4WS.js} +11 -11
  18. package/dist/{chunk-JA5B3SLH.js → chunk-44Y3P5U6.js} +2 -2
  19. package/dist/{chunk-25G7U6RD.js → chunk-4B3DL75F.js} +2 -2
  20. package/dist/{chunk-L4OA7G5T.js → chunk-522MBPE5.js} +2 -2
  21. package/dist/chunk-5ABOFAHN.js +81 -0
  22. package/dist/chunk-5ABOFAHN.js.map +1 -0
  23. package/dist/chunk-5D2ALSM5.js +19 -0
  24. package/dist/chunk-5D2ALSM5.js.map +1 -0
  25. package/dist/{chunk-M25ZIEB2.js → chunk-5HSSTOOG.js} +2 -2
  26. package/dist/{chunk-LLVW4V7R.js → chunk-5WLDZZ6S.js} +3 -3
  27. package/dist/{chunk-BCOKZC4B.js → chunk-6SSWOUUS.js} +19 -19
  28. package/dist/chunk-6SSWOUUS.js.map +1 -0
  29. package/dist/{chunk-IGM563N5.js → chunk-6SYOHUHM.js} +6 -6
  30. package/dist/chunk-6SYOHUHM.js.map +1 -0
  31. package/dist/{chunk-7B4GPCX7.js → chunk-7IQWHYL2.js} +5 -5
  32. package/dist/{chunk-J3VW4J4E.js → chunk-7LP7FFJ2.js} +2 -2
  33. package/dist/chunk-7LP7FFJ2.js.map +1 -0
  34. package/dist/{chunk-5P5AAXYA.js → chunk-7U6AB7DZ.js} +7 -7
  35. package/dist/chunk-7U6AB7DZ.js.map +1 -0
  36. package/dist/chunk-AFHQATY4.js +47 -0
  37. package/dist/chunk-AFHQATY4.js.map +1 -0
  38. package/dist/{chunk-OWE4BNTM.js → chunk-AZXEOEQK.js} +4 -4
  39. package/dist/{chunk-GBEXTC6Z.js → chunk-BAAUFCJK.js} +3 -3
  40. package/dist/chunk-BAAUFCJK.js.map +1 -0
  41. package/dist/{chunk-BZEPJJOK.js → chunk-C2V7AJO2.js} +4 -4
  42. package/dist/chunk-CADUYBQD.js +151 -0
  43. package/dist/chunk-CADUYBQD.js.map +1 -0
  44. package/dist/{chunk-2JZ763FV.js → chunk-D4LAJ737.js} +2 -2
  45. package/dist/{chunk-5BHNQNBI.js → chunk-DOZFU7OZ.js} +1 -1
  46. package/dist/chunk-DOZFU7OZ.js.map +1 -0
  47. package/dist/{chunk-MEKAMERX.js → chunk-E7FSBI6I.js} +29 -29
  48. package/dist/chunk-E7FSBI6I.js.map +1 -0
  49. package/dist/{chunk-N4FZ6ITM.js → chunk-EGU4PWQW.js} +2 -2
  50. package/dist/chunk-EP5L47XV.js +22 -0
  51. package/dist/chunk-EP5L47XV.js.map +1 -0
  52. package/dist/{chunk-EW4HFWGJ.js → chunk-EPME33Y4.js} +6 -6
  53. package/dist/{chunk-W7TCXZWU.js → chunk-EWPS35AR.js} +794 -1045
  54. package/dist/chunk-EWPS35AR.js.map +1 -0
  55. package/dist/{chunk-JKWNG3TM.js → chunk-FHHYCBBP.js} +2 -2
  56. package/dist/{chunk-5BB3N4KU.js → chunk-G4MFQXYX.js} +2 -2
  57. package/dist/{chunk-KVHWEPT2.js → chunk-GHEMAVTN.js} +2 -2
  58. package/dist/{chunk-CGPO3ZYB.js → chunk-GQT6J4FJ.js} +15 -2
  59. package/dist/chunk-GQT6J4FJ.js.map +1 -0
  60. package/dist/{chunk-XW7NWO4A.js → chunk-GTNRMJYH.js} +2 -2
  61. package/dist/{chunk-YG2EG6CB.js → chunk-H5GMROCB.js} +4 -4
  62. package/dist/{chunk-JIMEB4C6.js → chunk-HA7P3BTB.js} +26 -177
  63. package/dist/chunk-HA7P3BTB.js.map +1 -0
  64. package/dist/{chunk-5KI3REO3.js → chunk-HDF5R2K6.js} +7 -7
  65. package/dist/{chunk-V3YB7RGR.js → chunk-HVPW6PCX.js} +3 -3
  66. package/dist/{chunk-2VUISNGP.js → chunk-HXVRRJBD.js} +5 -5
  67. package/dist/{chunk-ZJGZDOQO.js → chunk-ICYC5YNI.js} +6 -6
  68. package/dist/{chunk-KR5EGWI4.js → chunk-IUATR5UE.js} +27 -5
  69. package/dist/chunk-IUATR5UE.js.map +1 -0
  70. package/dist/{chunk-AFBJHD55.js → chunk-JGOKAZNB.js} +5 -5
  71. package/dist/{chunk-XGVDLQJE.js → chunk-JOCMXSR2.js} +3 -3
  72. package/dist/{chunk-XGVDLQJE.js.map → chunk-JOCMXSR2.js.map} +1 -1
  73. package/dist/{chunk-HGVFJL63.js → chunk-JTIPVW4J.js} +15 -5
  74. package/dist/{chunk-HGVFJL63.js.map → chunk-JTIPVW4J.js.map} +1 -1
  75. package/dist/{chunk-QXPOEAKR.js → chunk-KCZAFDP5.js} +2 -2
  76. package/dist/{chunk-MSO2C3KG.js → chunk-LC7DSMHR.js} +2 -2
  77. package/dist/{chunk-OVFCAS7U.js → chunk-LG2GUYRX.js} +9 -9
  78. package/dist/{chunk-2KL6NDD4.js → chunk-LN3MQFUE.js} +56 -4
  79. package/dist/chunk-LN3MQFUE.js.map +1 -0
  80. package/dist/{chunk-QUIG6BZT.js → chunk-M4GO4ZJK.js} +226 -36
  81. package/dist/chunk-M4GO4ZJK.js.map +1 -0
  82. package/dist/{chunk-QDNVHA2F.js → chunk-M7W2KYTL.js} +2 -2
  83. package/dist/{chunk-XULHFSHO.js → chunk-MLCTPWSO.js} +5 -5
  84. package/dist/chunk-MLCTPWSO.js.map +1 -0
  85. package/dist/{chunk-PEY6ZTCF.js → chunk-MMVQ3SUO.js} +9 -9
  86. package/dist/{chunk-PEY6ZTCF.js.map → chunk-MMVQ3SUO.js.map} +1 -1
  87. package/dist/{chunk-4X6DJZHY.js → chunk-MPPWL64H.js} +26 -43
  88. package/dist/chunk-MPPWL64H.js.map +1 -0
  89. package/dist/{chunk-QYJIOWKN.js → chunk-MQBFT2OT.js} +11 -9
  90. package/dist/chunk-MQBFT2OT.js.map +1 -0
  91. package/dist/{chunk-IUIVDVXM.js → chunk-MUPZ6IZX.js} +2 -2
  92. package/dist/{chunk-GZ2GKOF6.js → chunk-NA374QG7.js} +3 -3
  93. package/dist/chunk-NIKO2BBZ.js +23 -0
  94. package/dist/chunk-NIKO2BBZ.js.map +1 -0
  95. package/dist/{chunk-2U7Y7BNJ.js → chunk-ONB627HU.js} +2 -2
  96. package/dist/{chunk-GYB2QK5H.js → chunk-OWLZONGX.js} +2 -2
  97. package/dist/{chunk-YHPUDB7Q.js → chunk-OWOT7CFC.js} +2 -2
  98. package/dist/{chunk-VEX6G3YL.js → chunk-P4NUJVWL.js} +2 -2
  99. package/dist/chunk-PEOZ34EM.js +13 -0
  100. package/dist/chunk-PEOZ34EM.js.map +1 -0
  101. package/dist/{chunk-NM4LVUXH.js → chunk-PTT2NB46.js} +2 -2
  102. package/dist/chunk-PVEWA2DU.js +23 -0
  103. package/dist/chunk-PVEWA2DU.js.map +1 -0
  104. package/dist/{chunk-2ITLQZV5.js → chunk-PWWWMRT7.js} +2 -2
  105. package/dist/{chunk-FLHOTGOO.js → chunk-QVGEVZ5F.js} +3 -3
  106. package/dist/{chunk-HKR25MGX.js → chunk-QVIZDLAR.js} +10 -10
  107. package/dist/chunk-QVIZDLAR.js.map +1 -0
  108. package/dist/{chunk-OOTTXUNV.js → chunk-RM5EXCFF.js} +2 -2
  109. package/dist/{chunk-OOTTXUNV.js.map → chunk-RM5EXCFF.js.map} +1 -1
  110. package/dist/{chunk-OGFPMCSP.js → chunk-SBOHNJUD.js} +2 -2
  111. package/dist/{chunk-EDC6MLXV.js → chunk-SEU6QHH4.js} +2 -2
  112. package/dist/chunk-SMY5X46Z.js +14 -0
  113. package/dist/chunk-SMY5X46Z.js.map +1 -0
  114. package/dist/{chunk-F4COUZLL.js → chunk-TMR64XPL.js} +2 -2
  115. package/dist/{chunk-5OZCCLNC.js → chunk-TSNRZSRC.js} +2 -2
  116. package/dist/{chunk-2RMDVWGB.js → chunk-UNREYBZO.js} +2 -2
  117. package/dist/{chunk-BLB7P7LS.js → chunk-V2R2VWER.js} +176 -17
  118. package/dist/chunk-V2R2VWER.js.map +1 -0
  119. package/dist/{chunk-3XVOLB75.js → chunk-VDTWFN2P.js} +7 -5
  120. package/dist/chunk-VDTWFN2P.js.map +1 -0
  121. package/dist/chunk-VKQCVU2Z.js +21 -0
  122. package/dist/chunk-VKQCVU2Z.js.map +1 -0
  123. package/dist/{chunk-QCUH2G77.js → chunk-VNJMLOQS.js} +6 -6
  124. package/dist/{chunk-UEO5CHOP.js → chunk-WCJJQV2D.js} +13 -13
  125. package/dist/chunk-WCJJQV2D.js.map +1 -0
  126. package/dist/{chunk-25ZDB25Z.js → chunk-WWBC4KLB.js} +3 -3
  127. package/dist/chunk-WWBC4KLB.js.map +1 -0
  128. package/dist/{chunk-V7RGFJ3Z.js → chunk-XG7OZDOS.js} +6 -6
  129. package/dist/{chunk-GS3Q2KOZ.js → chunk-XONZGK6J.js} +2 -2
  130. package/dist/{chunk-5SZ24DL5.js → chunk-XSOGLHGY.js} +6 -6
  131. package/dist/{chunk-CCT4WZI6.js → chunk-XY6MNSAF.js} +5 -5
  132. package/dist/chunk-XY6MNSAF.js.map +1 -0
  133. package/dist/chunk-XZHEOSQ2.js +16 -0
  134. package/dist/chunk-XZHEOSQ2.js.map +1 -0
  135. package/dist/{chunk-NOT7XA7Q.js → chunk-YGMREQAK.js} +5 -5
  136. package/dist/{chunk-H4SMS4O2.js → chunk-YJ3TREAC.js} +2 -2
  137. package/dist/chunk-YMUFFJCO.js +23 -0
  138. package/dist/chunk-YMUFFJCO.js.map +1 -0
  139. package/dist/{chunk-E2R5NRZD.js → chunk-Z4D3YGAB.js} +2 -2
  140. package/dist/{chunk-WJDYZP3U.js → chunk-ZDFU34XY.js} +42 -39
  141. package/dist/chunk-ZDFU34XY.js.map +1 -0
  142. package/dist/{chunk-BZK6JEX4.js → chunk-ZF572E2M.js} +5 -5
  143. package/dist/{chunk-DEQ2JTBR.js → chunk-ZGEFBDPR.js} +4 -4
  144. package/dist/chunk-ZGEFBDPR.js.map +1 -0
  145. package/dist/{chunk-QAFWRGVD.js → chunk-ZHMUFYZF.js} +7 -7
  146. package/dist/{chunk-BVZGNMVM.js → chunk-ZHZ4PET5.js} +3 -3
  147. package/dist/{chunk-IZX3WZBF.js → chunk-ZM72UO3Y.js} +4 -4
  148. package/dist/{chunk-STR7WBOB.js → chunk-ZUDAK436.js} +2 -2
  149. package/dist/{chunk-ITI3SJRB.js → chunk-ZX5FNWH7.js} +2 -2
  150. package/dist/classified/index.js +5 -5
  151. package/dist/{classified-marker-7S5IEP6Q.js → classified-marker-SVDRXLD3.js} +3 -3
  152. package/dist/collection-facade-S5PPKZD5.js +44 -0
  153. package/dist/{computed-WZNKRLCY.js → computed-33DRJDOC.js} +3 -3
  154. package/dist/consent/index.js +13 -9
  155. package/dist/consent/index.js.map +1 -1
  156. package/dist/{cover-B5MY43CK.js → cover-ADBCTIKN.js} +4 -4
  157. package/dist/crdt/index.js +4 -0
  158. package/dist/crdt/index.js.map +1 -1
  159. package/dist/{dead-filter-KRRD57MR.js → dead-filter-HKDMTMVY.js} +2 -2
  160. package/dist/delegation-EV7LKJPH.js +25 -0
  161. package/dist/derivations/index.js +12 -12
  162. package/dist/derive-5LDJW76F.js +21 -0
  163. package/dist/dispatch-SPMYNXNW.js +194 -0
  164. package/dist/dispatch-SPMYNXNW.js.map +1 -0
  165. package/dist/dispatch-V5MSMQYX.js +72 -0
  166. package/dist/dispatch-V5MSMQYX.js.map +1 -0
  167. package/dist/{enclave-YFKA3GJT.js → enclave-ZA7C3H2L.js} +11 -11
  168. package/dist/executor-FCJEH3FU.js +9 -0
  169. package/dist/executor-OHET7TF7.js +9 -0
  170. package/dist/executor-SVHAJZ4A.js +28 -0
  171. package/dist/export-accessible-S35YKIBL.js +23 -0
  172. package/dist/extract-partition-UVHAM5WZ.js +38 -0
  173. package/dist/{fanout-sidecar-HJV3A7PM.js → fanout-sidecar-HRMHC34B.js} +9 -9
  174. package/dist/find-LEBUXVL7.js +11 -0
  175. package/dist/forget/index.js +9 -9
  176. package/dist/guards/index.js +3 -3
  177. package/dist/history/index.js +16 -12
  178. package/dist/history/index.js.map +1 -1
  179. package/dist/i18n/index.js +16 -14
  180. package/dist/i18n/index.js.map +1 -1
  181. package/dist/index.d.ts +17 -16
  182. package/dist/index.js +155 -211
  183. package/dist/index.js.map +1 -1
  184. package/dist/indexing/index.js +4 -2
  185. package/dist/indexing/index.js.map +1 -1
  186. package/dist/issue-5X3SMCF4.js +19 -0
  187. package/dist/kernel/collection.d.ts +0 -1
  188. package/dist/kernel/enclave/crypto.d.ts +8 -8
  189. package/dist/kernel/enclave/index.d.ts +2 -2
  190. package/dist/kernel/errors.d.ts +20 -20
  191. package/dist/kernel/lazy.d.ts +30 -0
  192. package/dist/kernel/noydb.d.ts +53 -101
  193. package/dist/kernel/query/builder.d.ts +10 -10
  194. package/dist/kernel/query/index.d.ts +0 -6
  195. package/dist/kernel/query/scan-builder.d.ts +4 -4
  196. package/dist/kernel/types.d.ts +87 -46
  197. package/dist/kernel/validation.d.ts +33 -33
  198. package/dist/kernel/vault.d.ts +12 -149
  199. package/dist/kernel/via/dispatch.d.ts +7 -0
  200. package/dist/{ledger-SW6QQOAV.js → ledger-K6JBFL3Z.js} +11 -11
  201. package/dist/liberate-NHTCKBU4.js +24 -0
  202. package/dist/{link-set-GNGGCFI4.js → link-set-XVZY2ODC.js} +11 -11
  203. package/dist/materialized-views/index.js +22 -19
  204. package/dist/noydb-TI3RFU6M.js +78 -0
  205. package/dist/overlay-views/index.js +4 -4
  206. package/dist/periods/index.js +15 -13
  207. package/dist/pod/index.js +11 -12
  208. package/dist/{policy-EAXSJNOT.js → policy-QWGJB7P7.js} +5 -5
  209. package/dist/port/with/collection-options.d.ts +171 -0
  210. package/dist/port/with/collection-registries.d.ts +62 -0
  211. package/dist/port/with/strategies.d.ts +2 -2
  212. package/dist/port/with/team-strategy.d.ts +3 -2
  213. package/dist/portability/index.js +8 -8
  214. package/dist/{post-register-A7HCFBP5.js → post-register-5VHHVFJY.js} +6 -6
  215. package/dist/query/index.js +6 -46
  216. package/dist/{aggregate → reduce}/index.js +24 -17
  217. package/dist/reduce/index.js.map +1 -0
  218. package/dist/register-CEX7R7NE.js +23 -0
  219. package/dist/registry-7CZWF3EQ.js +9 -0
  220. package/dist/registry-DIKMRXUC.js +19 -0
  221. package/dist/registry-EWIB5NTI.js +18 -0
  222. package/dist/request-withdrawal-AAG57QO4.js +31 -0
  223. package/dist/{reveal-PB3YG544.js → reveal-7OOT5XPD.js} +6 -6
  224. package/dist/revoke-U5LCIJMF.js +24 -0
  225. package/dist/satellites/index.js +1 -1
  226. package/dist/sealed-record/index.js +12 -12
  227. package/dist/{seed-EKF4DIBB.js → seed-GVOI6QP6.js} +12 -12
  228. package/dist/seed-GVOI6QP6.js.map +1 -0
  229. package/dist/session/index.js +13 -9
  230. package/dist/session/index.js.map +1 -1
  231. package/dist/shadow/index.js +6 -2
  232. package/dist/shadow/index.js.map +1 -1
  233. package/dist/signer-NAA2OX7H.js +25 -0
  234. package/dist/snapshots/index.js +14 -10
  235. package/dist/snapshots/index.js.map +1 -1
  236. package/dist/{stale-4UNPHWOU.js → stale-BJO2WIN7.js} +11 -10
  237. package/dist/storage-FL7XXZTN.js +23 -0
  238. package/dist/{store-coordination-provider-3AELCZ4Y.js → store-coordination-provider-DX5HECK3.js} +3 -3
  239. package/dist/sync/index.js +14 -10
  240. package/dist/sync/index.js.map +1 -1
  241. package/dist/team/index.js +26 -28
  242. package/dist/tiers/index.js +10 -10
  243. package/dist/to/index.js +1 -1
  244. package/dist/tx/index.js +7 -3
  245. package/dist/tx/index.js.map +1 -1
  246. package/dist/util/index.js +1 -1
  247. package/dist/{verify-MXN66IIH.js → verify-5X37OXRY.js} +5 -5
  248. package/dist/via/blob/index.d.ts +2 -0
  249. package/dist/via/i18n/core.d.ts +1 -1
  250. package/dist/via/i18n/index.d.ts +2 -0
  251. package/dist/via/money/money-reducer.d.ts +2 -2
  252. package/dist/{walk-H4YE52S2.js → walk-JXMWKKQW.js} +11 -11
  253. package/dist/with-audit/consent/index.d.ts +2 -0
  254. package/dist/with-audit/periods/index.d.ts +2 -0
  255. package/dist/with-audit/portability/export-accessible.d.ts +4 -4
  256. package/dist/with-audit/portability/request-withdrawal.d.ts +3 -3
  257. package/dist/with-audit/portability/withdraw-accessible.d.ts +2 -2
  258. package/dist/with-audit/sealed-record/strategy.d.ts +1 -1
  259. package/dist/with-cargo/adopt-partition.d.ts +7 -7
  260. package/dist/with-cargo/floor.d.ts +3 -3
  261. package/dist/with-cargo/index.d.ts +1 -1
  262. package/dist/with-commit/crdt/index.d.ts +2 -0
  263. package/dist/with-commit/history/index.d.ts +2 -0
  264. package/dist/with-commit/history/time-machine.d.ts +2 -2
  265. package/dist/with-fork/shadow/index.d.ts +2 -0
  266. package/dist/with-fork/snapshots/index.d.ts +2 -0
  267. package/dist/with-formula/derivations/dispatch.d.ts +98 -0
  268. package/dist/with-formula/materialized-views/dispatch.d.ts +75 -0
  269. package/dist/with-formula/materialized-views/types.d.ts +7 -7
  270. package/dist/with-lookup/indexing/index.d.ts +2 -0
  271. package/dist/with-lookup/{aggregate → reduce}/active.d.ts +8 -8
  272. package/dist/with-lookup/{aggregate → reduce}/groupby.d.ts +21 -21
  273. package/dist/with-lookup/reduce/index.d.ts +34 -0
  274. package/dist/with-lookup/{aggregate → reduce}/reducers.d.ts +10 -10
  275. package/dist/with-lookup/{aggregate/aggregation.d.ts → reduce/reduction.d.ts} +21 -21
  276. package/dist/with-lookup/{aggregate → reduce}/strategy.d.ts +15 -15
  277. package/dist/with-party/custody/liberate.d.ts +3 -3
  278. package/dist/with-party/session/dev-unlock.d.ts +2 -2
  279. package/dist/with-party/session/index.d.ts +2 -0
  280. package/dist/with-party/session/session.d.ts +2 -2
  281. package/dist/with-party/sync/index.d.ts +2 -0
  282. package/dist/with-party/team/deed.d.ts +8 -8
  283. package/dist/with-party/team/index.d.ts +2 -2
  284. package/dist/with-party/team/keyring.d.ts +39 -20
  285. package/dist/with-party/team/{managed-passphrase.d.ts → managed-secret.d.ts} +27 -27
  286. package/dist/with-party/team/noydb-facade.d.ts +43 -42
  287. package/dist/with-party/team/peer-recover.d.ts +13 -13
  288. package/dist/with-party/team/recovery.d.ts +5 -5
  289. package/dist/with-party/team/rotate-recover.d.ts +30 -30
  290. package/dist/with-pod/bundle.d.ts +30 -30
  291. package/dist/with-pod/format.d.ts +2 -2
  292. package/dist/withdraw-accessible-GO6KQJVM.js +28 -0
  293. package/package.json +6 -34
  294. package/dist/aggregate/index.js.map +0 -1
  295. package/dist/api-UPAT2O3M.js +0 -20
  296. package/dist/as/index.js +0 -30
  297. package/dist/at/index.js +0 -1
  298. package/dist/by/index.js +0 -11
  299. package/dist/chunk-25ZDB25Z.js.map +0 -1
  300. package/dist/chunk-2KL6NDD4.js.map +0 -1
  301. package/dist/chunk-2YELV6TV.js +0 -1
  302. package/dist/chunk-3O62PVDW.js +0 -205
  303. package/dist/chunk-3O62PVDW.js.map +0 -1
  304. package/dist/chunk-3XVOLB75.js.map +0 -1
  305. package/dist/chunk-4X6DJZHY.js.map +0 -1
  306. package/dist/chunk-5BHNQNBI.js.map +0 -1
  307. package/dist/chunk-5P5AAXYA.js.map +0 -1
  308. package/dist/chunk-BCOKZC4B.js.map +0 -1
  309. package/dist/chunk-BLB7P7LS.js.map +0 -1
  310. package/dist/chunk-CCT4WZI6.js.map +0 -1
  311. package/dist/chunk-CGPO3ZYB.js.map +0 -1
  312. package/dist/chunk-DEQ2JTBR.js.map +0 -1
  313. package/dist/chunk-GBEXTC6Z.js.map +0 -1
  314. package/dist/chunk-HKR25MGX.js.map +0 -1
  315. package/dist/chunk-IGM563N5.js.map +0 -1
  316. package/dist/chunk-J3VW4J4E.js.map +0 -1
  317. package/dist/chunk-JA5O7UEZ.js.map +0 -1
  318. package/dist/chunk-JIMEB4C6.js.map +0 -1
  319. package/dist/chunk-KMONEHDJ.js +0 -54
  320. package/dist/chunk-KMONEHDJ.js.map +0 -1
  321. package/dist/chunk-KR5EGWI4.js.map +0 -1
  322. package/dist/chunk-LB7FD65R.js +0 -163
  323. package/dist/chunk-LB7FD65R.js.map +0 -1
  324. package/dist/chunk-MEKAMERX.js.map +0 -1
  325. package/dist/chunk-QUIG6BZT.js.map +0 -1
  326. package/dist/chunk-QYJIOWKN.js.map +0 -1
  327. package/dist/chunk-U73LHVPF.js.map +0 -1
  328. package/dist/chunk-UEO5CHOP.js.map +0 -1
  329. package/dist/chunk-W7TCXZWU.js.map +0 -1
  330. package/dist/chunk-WEC3JGBA.js +0 -255
  331. package/dist/chunk-WEC3JGBA.js.map +0 -1
  332. package/dist/chunk-WJDYZP3U.js.map +0 -1
  333. package/dist/chunk-XULHFSHO.js.map +0 -1
  334. package/dist/collection-facade-CMZGQ6IS.js +0 -44
  335. package/dist/delegation-UT76AQIG.js +0 -25
  336. package/dist/derive-SGRCCKVP.js +0 -21
  337. package/dist/executor-TEZYRDN3.js +0 -9
  338. package/dist/executor-WQQRU6DO.js +0 -9
  339. package/dist/executor-YORMIBWV.js +0 -26
  340. package/dist/export-accessible-HXMKW5LJ.js +0 -23
  341. package/dist/extract-partition-QGQ2R42J.js +0 -38
  342. package/dist/find-VV6PBIHK.js +0 -11
  343. package/dist/in/index.js +0 -1
  344. package/dist/issue-7JJ4Z7E2.js +0 -19
  345. package/dist/liberate-FK7JI2QX.js +0 -24
  346. package/dist/noydb-N5IW6OFZ.js +0 -70
  347. package/dist/on/index.js +0 -17
  348. package/dist/port/as/index.d.ts +0 -26
  349. package/dist/port/at/index.d.ts +0 -18
  350. package/dist/port/in/index.d.ts +0 -21
  351. package/dist/port/on/index.d.ts +0 -27
  352. package/dist/port/ui/index.d.ts +0 -21
  353. package/dist/port/with/index.d.ts +0 -18
  354. package/dist/register-YBMRLZLO.js +0 -23
  355. package/dist/registry-3LXKNXWI.js +0 -9
  356. package/dist/registry-4V4YQCXJ.js +0 -19
  357. package/dist/registry-ZULMLCJK.js +0 -18
  358. package/dist/request-withdrawal-SEVUEUDG.js +0 -31
  359. package/dist/request-withdrawal-SEVUEUDG.js.map +0 -1
  360. package/dist/revoke-5QULL5GT.js +0 -24
  361. package/dist/revoke-5QULL5GT.js.map +0 -1
  362. package/dist/seed-EKF4DIBB.js.map +0 -1
  363. package/dist/signer-ZMH35FT4.js +0 -25
  364. package/dist/signer-ZMH35FT4.js.map +0 -1
  365. package/dist/stale-4UNPHWOU.js.map +0 -1
  366. package/dist/storage-QOZKQMID.js +0 -23
  367. package/dist/storage-QOZKQMID.js.map +0 -1
  368. package/dist/ui/index.js +0 -1
  369. package/dist/ui/index.js.map +0 -1
  370. package/dist/with/index.js +0 -31
  371. package/dist/with/index.js.map +0 -1
  372. package/dist/with-lookup/aggregate/index.d.ts +0 -23
  373. package/dist/withdraw-accessible-HPOVNG2G.js +0 -28
  374. package/dist/withdraw-accessible-HPOVNG2G.js.map +0 -1
  375. /package/dist/{api-UPAT2O3M.js.map → api-5QVQX4HG.js.map} +0 -0
  376. /package/dist/{backup-JL2GOTYQ.js.map → backup-USYSNCYM.js.map} +0 -0
  377. /package/dist/{chunk-JLHKBAFY.js.map → chunk-2BVW754E.js.map} +0 -0
  378. /package/dist/{chunk-T7S4V52L.js.map → chunk-2PDBYF2O.js.map} +0 -0
  379. /package/dist/{chunk-YGBIBOCR.js.map → chunk-2ZSC454H.js.map} +0 -0
  380. /package/dist/{chunk-IGAIOGCN.js.map → chunk-32467U5J.js.map} +0 -0
  381. /package/dist/{chunk-JW3XCZA2.js.map → chunk-3TZUC4WS.js.map} +0 -0
  382. /package/dist/{chunk-JA5B3SLH.js.map → chunk-44Y3P5U6.js.map} +0 -0
  383. /package/dist/{chunk-25G7U6RD.js.map → chunk-4B3DL75F.js.map} +0 -0
  384. /package/dist/{chunk-L4OA7G5T.js.map → chunk-522MBPE5.js.map} +0 -0
  385. /package/dist/{chunk-M25ZIEB2.js.map → chunk-5HSSTOOG.js.map} +0 -0
  386. /package/dist/{chunk-LLVW4V7R.js.map → chunk-5WLDZZ6S.js.map} +0 -0
  387. /package/dist/{chunk-7B4GPCX7.js.map → chunk-7IQWHYL2.js.map} +0 -0
  388. /package/dist/{chunk-OWE4BNTM.js.map → chunk-AZXEOEQK.js.map} +0 -0
  389. /package/dist/{chunk-BZEPJJOK.js.map → chunk-C2V7AJO2.js.map} +0 -0
  390. /package/dist/{chunk-2JZ763FV.js.map → chunk-D4LAJ737.js.map} +0 -0
  391. /package/dist/{chunk-N4FZ6ITM.js.map → chunk-EGU4PWQW.js.map} +0 -0
  392. /package/dist/{chunk-EW4HFWGJ.js.map → chunk-EPME33Y4.js.map} +0 -0
  393. /package/dist/{chunk-JKWNG3TM.js.map → chunk-FHHYCBBP.js.map} +0 -0
  394. /package/dist/{chunk-5BB3N4KU.js.map → chunk-G4MFQXYX.js.map} +0 -0
  395. /package/dist/{chunk-KVHWEPT2.js.map → chunk-GHEMAVTN.js.map} +0 -0
  396. /package/dist/{chunk-XW7NWO4A.js.map → chunk-GTNRMJYH.js.map} +0 -0
  397. /package/dist/{chunk-YG2EG6CB.js.map → chunk-H5GMROCB.js.map} +0 -0
  398. /package/dist/{chunk-5KI3REO3.js.map → chunk-HDF5R2K6.js.map} +0 -0
  399. /package/dist/{chunk-V3YB7RGR.js.map → chunk-HVPW6PCX.js.map} +0 -0
  400. /package/dist/{chunk-2VUISNGP.js.map → chunk-HXVRRJBD.js.map} +0 -0
  401. /package/dist/{chunk-ZJGZDOQO.js.map → chunk-ICYC5YNI.js.map} +0 -0
  402. /package/dist/{chunk-AFBJHD55.js.map → chunk-JGOKAZNB.js.map} +0 -0
  403. /package/dist/{chunk-QXPOEAKR.js.map → chunk-KCZAFDP5.js.map} +0 -0
  404. /package/dist/{chunk-MSO2C3KG.js.map → chunk-LC7DSMHR.js.map} +0 -0
  405. /package/dist/{chunk-OVFCAS7U.js.map → chunk-LG2GUYRX.js.map} +0 -0
  406. /package/dist/{chunk-QDNVHA2F.js.map → chunk-M7W2KYTL.js.map} +0 -0
  407. /package/dist/{chunk-IUIVDVXM.js.map → chunk-MUPZ6IZX.js.map} +0 -0
  408. /package/dist/{chunk-GZ2GKOF6.js.map → chunk-NA374QG7.js.map} +0 -0
  409. /package/dist/{chunk-2U7Y7BNJ.js.map → chunk-ONB627HU.js.map} +0 -0
  410. /package/dist/{chunk-GYB2QK5H.js.map → chunk-OWLZONGX.js.map} +0 -0
  411. /package/dist/{chunk-YHPUDB7Q.js.map → chunk-OWOT7CFC.js.map} +0 -0
  412. /package/dist/{chunk-VEX6G3YL.js.map → chunk-P4NUJVWL.js.map} +0 -0
  413. /package/dist/{chunk-NM4LVUXH.js.map → chunk-PTT2NB46.js.map} +0 -0
  414. /package/dist/{chunk-2ITLQZV5.js.map → chunk-PWWWMRT7.js.map} +0 -0
  415. /package/dist/{chunk-FLHOTGOO.js.map → chunk-QVGEVZ5F.js.map} +0 -0
  416. /package/dist/{chunk-OGFPMCSP.js.map → chunk-SBOHNJUD.js.map} +0 -0
  417. /package/dist/{chunk-EDC6MLXV.js.map → chunk-SEU6QHH4.js.map} +0 -0
  418. /package/dist/{chunk-F4COUZLL.js.map → chunk-TMR64XPL.js.map} +0 -0
  419. /package/dist/{chunk-5OZCCLNC.js.map → chunk-TSNRZSRC.js.map} +0 -0
  420. /package/dist/{chunk-2RMDVWGB.js.map → chunk-UNREYBZO.js.map} +0 -0
  421. /package/dist/{chunk-QCUH2G77.js.map → chunk-VNJMLOQS.js.map} +0 -0
  422. /package/dist/{chunk-V7RGFJ3Z.js.map → chunk-XG7OZDOS.js.map} +0 -0
  423. /package/dist/{chunk-GS3Q2KOZ.js.map → chunk-XONZGK6J.js.map} +0 -0
  424. /package/dist/{chunk-5SZ24DL5.js.map → chunk-XSOGLHGY.js.map} +0 -0
  425. /package/dist/{chunk-NOT7XA7Q.js.map → chunk-YGMREQAK.js.map} +0 -0
  426. /package/dist/{chunk-H4SMS4O2.js.map → chunk-YJ3TREAC.js.map} +0 -0
  427. /package/dist/{chunk-E2R5NRZD.js.map → chunk-Z4D3YGAB.js.map} +0 -0
  428. /package/dist/{chunk-BZK6JEX4.js.map → chunk-ZF572E2M.js.map} +0 -0
  429. /package/dist/{chunk-QAFWRGVD.js.map → chunk-ZHMUFYZF.js.map} +0 -0
  430. /package/dist/{chunk-BVZGNMVM.js.map → chunk-ZHZ4PET5.js.map} +0 -0
  431. /package/dist/{chunk-IZX3WZBF.js.map → chunk-ZM72UO3Y.js.map} +0 -0
  432. /package/dist/{chunk-STR7WBOB.js.map → chunk-ZUDAK436.js.map} +0 -0
  433. /package/dist/{chunk-ITI3SJRB.js.map → chunk-ZX5FNWH7.js.map} +0 -0
  434. /package/dist/{classified-marker-7S5IEP6Q.js.map → classified-marker-SVDRXLD3.js.map} +0 -0
  435. /package/dist/{as/index.js.map → collection-facade-S5PPKZD5.js.map} +0 -0
  436. /package/dist/{at/index.js.map → computed-33DRJDOC.js.map} +0 -0
  437. /package/dist/{by/index.js.map → cover-ADBCTIKN.js.map} +0 -0
  438. /package/dist/{dead-filter-KRRD57MR.js.map → dead-filter-HKDMTMVY.js.map} +0 -0
  439. /package/dist/{chunk-2YELV6TV.js.map → delegation-EV7LKJPH.js.map} +0 -0
  440. /package/dist/{collection-facade-CMZGQ6IS.js.map → derive-5LDJW76F.js.map} +0 -0
  441. /package/dist/{computed-WZNKRLCY.js.map → enclave-ZA7C3H2L.js.map} +0 -0
  442. /package/dist/{cover-B5MY43CK.js.map → executor-FCJEH3FU.js.map} +0 -0
  443. /package/dist/{delegation-UT76AQIG.js.map → executor-OHET7TF7.js.map} +0 -0
  444. /package/dist/{derive-SGRCCKVP.js.map → executor-SVHAJZ4A.js.map} +0 -0
  445. /package/dist/{enclave-YFKA3GJT.js.map → export-accessible-S35YKIBL.js.map} +0 -0
  446. /package/dist/{executor-TEZYRDN3.js.map → extract-partition-UVHAM5WZ.js.map} +0 -0
  447. /package/dist/{fanout-sidecar-HJV3A7PM.js.map → fanout-sidecar-HRMHC34B.js.map} +0 -0
  448. /package/dist/{executor-WQQRU6DO.js.map → find-LEBUXVL7.js.map} +0 -0
  449. /package/dist/{executor-YORMIBWV.js.map → issue-5X3SMCF4.js.map} +0 -0
  450. /package/dist/{export-accessible-HXMKW5LJ.js.map → ledger-K6JBFL3Z.js.map} +0 -0
  451. /package/dist/{extract-partition-QGQ2R42J.js.map → liberate-NHTCKBU4.js.map} +0 -0
  452. /package/dist/{find-VV6PBIHK.js.map → link-set-XVZY2ODC.js.map} +0 -0
  453. /package/dist/{in/index.js.map → noydb-TI3RFU6M.js.map} +0 -0
  454. /package/dist/{issue-7JJ4Z7E2.js.map → policy-QWGJB7P7.js.map} +0 -0
  455. /package/dist/{post-register-A7HCFBP5.js.map → post-register-5VHHVFJY.js.map} +0 -0
  456. /package/dist/{ledger-SW6QQOAV.js.map → register-CEX7R7NE.js.map} +0 -0
  457. /package/dist/{liberate-FK7JI2QX.js.map → registry-7CZWF3EQ.js.map} +0 -0
  458. /package/dist/{link-set-GNGGCFI4.js.map → registry-DIKMRXUC.js.map} +0 -0
  459. /package/dist/{noydb-N5IW6OFZ.js.map → registry-EWIB5NTI.js.map} +0 -0
  460. /package/dist/{on/index.js.map → request-withdrawal-AAG57QO4.js.map} +0 -0
  461. /package/dist/{reveal-PB3YG544.js.map → reveal-7OOT5XPD.js.map} +0 -0
  462. /package/dist/{policy-EAXSJNOT.js.map → revoke-U5LCIJMF.js.map} +0 -0
  463. /package/dist/{register-YBMRLZLO.js.map → signer-NAA2OX7H.js.map} +0 -0
  464. /package/dist/{registry-3LXKNXWI.js.map → stale-BJO2WIN7.js.map} +0 -0
  465. /package/dist/{registry-4V4YQCXJ.js.map → storage-FL7XXZTN.js.map} +0 -0
  466. /package/dist/{store-coordination-provider-3AELCZ4Y.js.map → store-coordination-provider-DX5HECK3.js.map} +0 -0
  467. /package/dist/{verify-MXN66IIH.js.map → verify-5X37OXRY.js.map} +0 -0
  468. /package/dist/{walk-H4YE52S2.js.map → walk-JXMWKKQW.js.map} +0 -0
  469. /package/dist/with-lookup/{aggregate → reduce}/canonical-key.d.ts +0 -0
  470. /package/dist/{registry-ZULMLCJK.js.map → withdraw-accessible-GO6KQJVM.js.map} +0 -0
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  grant,
3
3
  revoke
4
- } from "./chunk-WJDYZP3U.js";
4
+ } from "./chunk-ZDFU34XY.js";
5
5
  import {
6
6
  CargoNotEnabledError,
7
- CustodyNotEnabledError
8
- } from "./chunk-IGM563N5.js";
7
+ CustodyNotEnabledError,
8
+ QuiesceTimeoutError
9
+ } from "./chunk-6SYOHUHM.js";
9
10
 
10
11
  // src/with-cargo/strategy.ts
11
12
  var NO_CARGO = {
@@ -37,7 +38,7 @@ function withCustody() {
37
38
  return host._revokeCustodianImpl(revoke, vault, options, factors);
38
39
  },
39
40
  async liberate(vault, opts) {
40
- const { liberateVault } = await import("./liberate-FK7JI2QX.js");
41
+ const { liberateVault } = await import("./liberate-NHTCKBU4.js");
41
42
  return liberateVault(vault, opts);
42
43
  }
43
44
  };
@@ -77,10 +78,57 @@ var CustodyApi = class {
77
78
  }
78
79
  };
79
80
 
81
+ // src/port/by/types.ts
82
+ function isQuorum(writers, generation, excludeWriterId) {
83
+ return writers.filter((w) => w.writerId !== excludeWriterId).every((w) => w.quiescedAtVersion === generation);
84
+ }
85
+ async function runDrainBarrier(provider, o, run) {
86
+ await provider.setFence(o.vault, { currentSchemaVersion: o.generation, fenceState: "draining" });
87
+ await o.onFlush();
88
+ const deadline = o.now() + o.quiesceTimeoutMs;
89
+ const seeded = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() });
90
+ if (!isQuorum(seeded, o.generation, o.writerId)) {
91
+ await new Promise((resolve, reject) => {
92
+ let settled = false;
93
+ const finish = (fn) => {
94
+ if (!settled) {
95
+ settled = true;
96
+ unsub();
97
+ fn();
98
+ }
99
+ };
100
+ const unsub = provider.observePresence(o.vault, (writers) => {
101
+ if (isQuorum(writers, o.generation, o.writerId)) finish(resolve);
102
+ });
103
+ const tick = async () => {
104
+ if (settled) return;
105
+ if (o.now() >= deadline) {
106
+ finish(
107
+ () => reject(
108
+ new QuiesceTimeoutError(
109
+ `Cutover of vault "${o.vault}" to generation ${o.generation} timed out after ${o.quiesceTimeoutMs}ms waiting for active writers to quiesce.`
110
+ )
111
+ )
112
+ );
113
+ return;
114
+ }
115
+ if (o.onPoll) await o.onPoll();
116
+ const w = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() });
117
+ if (isQuorum(w, o.generation, o.writerId)) finish(resolve);
118
+ else setTimeout(() => void tick(), 25);
119
+ };
120
+ void tick();
121
+ });
122
+ }
123
+ await run();
124
+ }
125
+
80
126
  export {
81
127
  NO_CARGO,
82
128
  NO_CUSTODY,
83
129
  withCustody,
84
- CustodyApi
130
+ CustodyApi,
131
+ isQuorum,
132
+ runDrainBarrier
85
133
  };
86
- //# sourceMappingURL=chunk-U73LHVPF.js.map
134
+ //# sourceMappingURL=chunk-3S2YNMUS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-cargo/strategy.ts","../src/with-party/custody/strategy.ts","../src/with-party/custody/active.ts","../src/with-party/custody/index.ts","../src/port/by/types.ts"],"sourcesContent":["/**\n * Cargo capability strategy (FR-6/FR-7) — the source-side, owner-level\n * partition operation that requires a live {@link Vault}: extracting a re-keyed\n * transfer-sealed partition ({@link extractPartitionCore}). The active engine\n * ({@link withCargo}) dynamically imports that engine (keeping the extraction\n * crypto out of the floor bundle); {@link NO_CARGO} throws.\n *\n * The public free function `extractPartition` (which takes a `Vault`) delegates\n * here via `vault.cargoStrategy`, so an un-opted-in caller hits `NO_CARGO`'s\n * throw.\n *\n * Carve-out (mirrors `openSealedRecord` / `liberateVault`): the recipient-side\n * free functions `adoptPartition` and `decryptExtractedPartition` operate on\n * raw bundle bytes + a destination store — they carry NO source instance to\n * gate against, so they stay ungated host-side tooling. `diffVault` is likewise\n * ungated: it's shared import/merge infrastructure the `as-*` exporters call\n * internally, not a gated cargo capability.\n * @internal\n */\nimport type { Vault } from '../kernel/vault.js'\nimport type { ExtractPartitionResult, ExtractPartitionOptions } from './extract-partition.js'\nimport { CargoNotEnabledError } from '../kernel/errors.js'\n\nexport interface CargoStrategy {\n extractPartition(vault: Vault, opts: ExtractPartitionOptions): Promise<ExtractPartitionResult>\n}\n\n/**\n * No-op stub — the floor default. The source-side cargo op throws\n * {@link CargoNotEnabledError}; opt in with `cargoStrategy: withCargo()` in\n * createNoydb. @internal\n */\nexport const NO_CARGO: CargoStrategy = {\n async extractPartition() { throw new CargoNotEnabledError() },\n}\n","/**\n * Sovereign-custody (FR-6) capability strategy — the three on-demand\n * operations the custody surface routes through: minting a custodian\n * (`grantCustodian`), removing one (`revokeCustodian`), and the audited\n * ownership-claim ceremony (`liberate`). The active engine ({@link withCustody})\n * runs the grant/revoke impls the host exposes and dynamically imports the\n * heavy `liberateVault` ceremony (keeping it out of the floor bundle);\n * {@link NO_CUSTODY} throws.\n *\n * `Noydb.grantCustodian` / `Noydb.revokeCustodian` delegate here (passing\n * themselves as the {@link CustodyHost}), and `vault.custody.liberate` delegates\n * here with its {@link Vault}. An un-opted-in caller hits `NO_CUSTODY`'s throw.\n *\n * Note: the lower-level `liberateVault` FREE FUNCTION (exported from\n * `custody/liberate.ts`) stays ungated — it has no `createNoydb` instance to\n * gate against (the same carve-out as the `openSealedRecord` host opener). Only\n * the instance surfaces (`db.grantCustodian` / `db.revokeCustodian` /\n * `vault.custody.*`) are the capability.\n * @internal\n */\nimport type { GrantOptions, RevokeOptions, FactorProofBundle, NoydbStore } from '../../kernel/types.js'\nimport type { Vault } from '../../kernel/vault.js'\nimport type { UnlockedKeyring } from '../team/keyring.js'\nimport type { GrantCustodianOptions } from './index.js'\nimport type { LiberateOptions, LiberateResult } from './liberate.js'\nimport { CustodyNotEnabledError } from '../../kernel/errors.js'\n\n/**\n * The grant/revoke engine the strategy runs when opted in — implemented by\n * `Noydb` (`_grantCustodianImpl` / `_revokeCustodianImpl` hold the gate +\n * keyring logic; the public `grantCustodian` / `revokeCustodian` route through\n * the strategy). Since the #267 team split the keyring grant/revoke engines\n * are passed IN by `withCustody()` (statically linked there, not in the\n * kernel) so the single-user floor never carries them.\n */\nexport interface CustodyHost {\n _grantCustodianImpl(\n engine: (adapter: NoydbStore, vault: string, callerKeyring: UnlockedKeyring, options: GrantOptions) => Promise<void>,\n vault: string,\n options: GrantCustodianOptions,\n factors?: FactorProofBundle,\n ): Promise<void>\n _revokeCustodianImpl(\n engine: (adapter: NoydbStore, vault: string, callerKeyring: UnlockedKeyring, options: RevokeOptions) => Promise<void>,\n vault: string,\n options: RevokeOptions,\n factors?: FactorProofBundle,\n ): Promise<void>\n}\n\nexport interface CustodyStrategy {\n grantCustodian(host: CustodyHost, vault: string, options: GrantCustodianOptions, factors?: FactorProofBundle): Promise<void>\n revokeCustodian(host: CustodyHost, vault: string, options: RevokeOptions, factors?: FactorProofBundle): Promise<void>\n liberate(vault: Vault, opts: LiberateOptions): Promise<LiberateResult>\n}\n\n/**\n * No-op stub — the floor default. Every custody operation throws\n * {@link CustodyNotEnabledError}; opt in with `custodyStrategy: withCustody()`\n * in createNoydb. @internal\n */\nexport const NO_CUSTODY: CustodyStrategy = {\n async grantCustodian() { throw new CustodyNotEnabledError() },\n async revokeCustodian() { throw new CustodyNotEnabledError() },\n async liberate() { throw new CustodyNotEnabledError() },\n}\n","/**\n * Enable the sovereign-custody (FR-6) capability.\n * Pass to `createNoydb({ custodyStrategy: withCustody() })` to make\n * `db.grantCustodian` / `db.revokeCustodian` (and the `vault.custody.*` facade\n * that delegates to them) plus `vault.custody.liberate()` live. The heavy\n * `liberateVault` ceremony is dynamically imported here, so it is reached only\n * via opt-in; grant/revoke run the host's own gate + keyring engine.\n */\nimport type { CustodyStrategy } from './strategy.js'\nimport { grant as grantEngine, revoke as revokeEngine } from '../team/keyring.js'\n\nexport function withCustody(): CustodyStrategy {\n return {\n async grantCustodian(host, vault, options, factors) {\n return host._grantCustodianImpl(grantEngine, vault, options, factors)\n },\n async revokeCustodian(host, vault, options, factors) {\n return host._revokeCustodianImpl(revokeEngine, vault, options, factors)\n },\n async liberate(vault, opts) {\n const { liberateVault } = await import('./liberate.js')\n return liberateVault(vault, opts)\n },\n }\n}\n","/**\n * Public `vault.custody.*` API surface (FR-6).\n *\n * The custody namespace is the vault-instance face of the FR-6 sovereign-custody\n * model — it mirrors `vault.user.*` exactly: a thin delegation shell with NO\n * business logic. The Vault constructs one `CustodyApi` per session, injecting\n * closures that bind the vault name / keyring into the genuinely-core\n * implementations (`Noydb.grantCustodian` / `Noydb.revokeCustodian` and the\n * `liberateVault` ceremony). Each method just forwards to its injected callback.\n *\n * Three operations:\n * - `grantCustodian(opts)` — owner-only: mint a `custodian` who operates the\n * vault fully but can never grant / rotate / sever / extract.\n * - `revokeCustodian(opts)` — owner-only: remove a custodian.\n * - `liberate(opts)` — custodian-only: audited claim of ownership over a\n * sealed-owner (Deed) vault (mints a DISTINCT new owner; ledger-audited).\n *\n * Provisioning a Deed (`createDeedOwner`) is deliberately NOT on this class: it\n * is a store-level operation that mints the vault's first owner, so there is no\n * vault instance (and thus no custody namespace) yet — it stays the exported\n * `team/deed.ts` function.\n *\n * @see docs/superpowers/specs/2026-06-17-fr6-deed-custodian-liberate-design.md\n * @module\n */\nimport type { GrantOptions, RevokeOptions, FactorProofBundle } from '../../kernel/types.js'\nimport type { LiberateOptions, LiberateResult } from './liberate.js'\n\n/** Options for `vault.custody.grantCustodian` — a grant with the role fixed to `custodian`. */\nexport type GrantCustodianOptions = Omit<GrantOptions, 'role'>\n\n// Capability opt-in seam (S4): grant/revoke custodian + liberate throw\n// CustodyNotEnabledError unless `custodyStrategy: withCustody()` is opted in.\nexport { withCustody } from './active.js'\nexport { NO_CUSTODY, type CustodyStrategy, type CustodyHost } from './strategy.js'\nexport { CustodyNotEnabledError } from '../../kernel/errors.js'\n\n/**\n * Implementation behind `vault.custody`. Constructed once per Vault. Holds the\n * injected, vault-bound implementations in closure; every method delegates with\n * no added logic (the owner-only / custodian-only / gate checks all live in the\n * injected implementations — `Noydb.grantCustodian` etc. and `liberateVault`).\n */\nexport class CustodyApi {\n constructor(\n /** Bound `Noydb.grantCustodian(this.name, ...)` — owner-only, gated. */\n private readonly _grantCustodian: (options: GrantCustodianOptions, factors?: FactorProofBundle) => Promise<void>,\n /** Bound `Noydb.revokeCustodian(this.name, ...)` — owner-only, gated. */\n private readonly _revokeCustodian: (options: RevokeOptions, factors?: FactorProofBundle) => Promise<void>,\n /** Bound `liberateVault(this, ...)` — custodian-only audited ownership claim. */\n private readonly _liberate: (opts: LiberateOptions) => Promise<LiberateResult>,\n ) {}\n\n /**\n * Owner-only: grant the FR-6 `custodian` role. The custodian operates every\n * collection (rw + access) but is provably unable to grant / revoke / rotate /\n * extract-and-sever. Defended in depth (gate + owner-only role check) inside\n * the injected `Noydb.grantCustodian`.\n */\n async grantCustodian(options: GrantCustodianOptions, factors?: FactorProofBundle): Promise<void> {\n return this._grantCustodian(options, factors)\n }\n\n /** Owner-only: revoke a custodian. */\n async revokeCustodian(options: RevokeOptions, factors?: FactorProofBundle): Promise<void> {\n return this._revokeCustodian(options, factors)\n }\n\n /**\n * Custodian-only: the audited claim of ownership over a sealed-owner (Deed)\n * vault. Mints a DISTINCT new owner re-wrapping the incumbent DEKs under a\n * fresh KEK (the latent owner is never impersonated), ledger-audited. See\n * {@link liberateVault}.\n */\n async liberate(opts: LiberateOptions): Promise<LiberateResult> {\n return this._liberate(opts)\n }\n}\n","/**\n * Kernel coordination port — the injected `CoordinationProvider` seam for the\n * schema-fence drain-barrier.\n *\n * The kernel defines this port; `@noy-db/by-tabs` / `@noy-db/by-peer` implement\n * it for real-time quorum, and an external orchestrator (`@klum-db/lobby`)\n * drives it through the `Noydb` handle without ever naming a `by-*` package.\n * The dependency arrow is `by-* → kernel ← klum`, the app at the apex.\n *\n * This module carries only the port TYPES plus two pure-ish helpers:\n * {@link isQuorum} (a pure quorum predicate extracted from the legacy\n * `activeQuiesced`) and {@link runDrainBarrier} (the reusable barrier protocol\n * the migration cutover and klum both call).\n *\n * @module\n */\n\nimport { QuiesceTimeoutError } from '../../kernel/errors.js'\nimport type { Unsubscribe } from '../with/write-hooks.js'\n\n/** Vault fence state (the existing FenceDoc shape). */\nexport interface FenceState {\n readonly currentSchemaVersion: number\n readonly fenceState: 'normal' | 'draining' | 'migrating' | 'complete'\n}\n\n/** A writer's presence + ack, tagged with the session that owns it. */\nexport interface WriterPresence {\n /** = today's clientId (one per tab/peer). */\n readonly writerId: string\n /** Groups one user's writers across vaults (consolidation is klum's job). */\n readonly sessionId: string\n readonly lastSeen: number\n readonly quiescedAtVersion: number | null\n}\n\n/** Session-addressable drain-barrier coordination transport. Per-vault ops. */\nexport interface CoordinationProvider {\n /** orchestrator → all writers */\n setFence(vault: string, fence: FenceState): Promise<void>\n /**\n * Fresh one-shot fence read for the write-path gate (`assertWritable`).\n * A direct read (not a cached `observeFence` snapshot) avoids a staleness\n * window and keeps the timing-sensitive cutover gate exact. The store\n * default reads `_meta/schema-fence`; `by-*` return their last-pushed fence.\n */\n readFence(vault: string): Promise<FenceState>\n /** writer observes fence changes (default: poll-emit; by-*: push) */\n observeFence(vault: string, onChange: (f: FenceState) => void): Unsubscribe\n /** writer → orchestrator: presence + ack (heartbeat + quiescedAtVersion) */\n reportPresence(vault: string, p: WriterPresence): Promise<void>\n /** orchestrator observes presence changes (default: poll-emit; by-*: push) */\n observePresence(vault: string, onChange: (writers: readonly WriterPresence[]) => void): Unsubscribe\n /** orchestrator one-shot snapshot of reachable writers (quorum input) */\n reachableWriters(vault: string, o: { staleMs: number; now: number }): Promise<readonly WriterPresence[]>\n}\n\n/**\n * Pure quorum predicate: true when every writer (other than `excludeWriterId`)\n * has acked at exactly `generation`. An empty set is trivially a quorum.\n *\n * Extracted from the legacy `activeQuiesced` store-polling check so the\n * migration cutover, the store default provider, and `by-*` real-time\n * providers all share one definition of \"everyone has drained\".\n */\nexport function isQuorum(\n writers: readonly WriterPresence[],\n generation: number,\n excludeWriterId?: string,\n): boolean {\n return writers.filter((w) => w.writerId !== excludeWriterId).every((w) => w.quiescedAtVersion === generation)\n}\n\n/** Inputs for {@link runDrainBarrier}. */\nexport interface DrainBarrierOptions {\n readonly vault: string\n readonly generation: number\n readonly writerId: string\n readonly onFlush: () => Promise<void>\n readonly staleMs: number\n readonly quiesceTimeoutMs: number\n readonly now: () => number\n /** Optional seam (mainly for deterministic tests) run before each poll tick. */\n readonly onPoll?: () => Promise<void>\n}\n\n/**\n * The reusable drain-barrier protocol shared by the migration cutover and klum:\n *\n * drain self → setFence(draining) → await quorum (presence push + isQuorum,\n * polling as a fallback, or timeout) → run() → release-by-caller.\n *\n * Resolves once every reachable writer (excluding `writerId`) has quiesced at\n * `generation`, at which point `run` is invoked exactly once. Rejects with\n * {@link QuiesceTimeoutError} if `quiesceTimeoutMs` elapses first.\n */\nexport async function runDrainBarrier(\n provider: CoordinationProvider,\n o: DrainBarrierOptions,\n run: () => Promise<void>,\n): Promise<void> {\n await provider.setFence(o.vault, { currentSchemaVersion: o.generation, fenceState: 'draining' })\n await o.onFlush()\n\n const deadline = o.now() + o.quiesceTimeoutMs\n const seeded = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() })\n if (!isQuorum(seeded, o.generation, o.writerId)) {\n await new Promise<void>((resolve, reject) => {\n let settled = false\n const finish = (fn: () => void) => {\n if (!settled) {\n settled = true\n unsub()\n fn()\n }\n }\n const unsub = provider.observePresence(o.vault, (writers) => {\n if (isQuorum(writers, o.generation, o.writerId)) finish(resolve)\n })\n const tick = async () => {\n if (settled) return\n if (o.now() >= deadline) {\n finish(() =>\n reject(\n new QuiesceTimeoutError(\n `Cutover of vault \"${o.vault}\" to generation ${o.generation} timed out ` +\n `after ${o.quiesceTimeoutMs}ms waiting for active writers to quiesce.`,\n ),\n ),\n )\n return\n }\n if (o.onPoll) await o.onPoll()\n const w = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() })\n if (isQuorum(w, o.generation, o.writerId)) finish(resolve)\n else setTimeout(() => void tick(), 25)\n }\n void tick()\n })\n }\n await run()\n}\n"],"mappings":";;;;;;;;;;;AAgCO,IAAM,WAA0B;AAAA,EACrC,MAAM,mBAAmB;AAAE,UAAM,IAAI,qBAAqB;AAAA,EAAE;AAC9D;;;AC2BO,IAAM,aAA8B;AAAA,EACzC,MAAM,iBAAiB;AAAE,UAAM,IAAI,uBAAuB;AAAA,EAAE;AAAA,EAC5D,MAAM,kBAAkB;AAAE,UAAM,IAAI,uBAAuB;AAAA,EAAE;AAAA,EAC7D,MAAM,WAAW;AAAE,UAAM,IAAI,uBAAuB;AAAA,EAAE;AACxD;;;ACtDO,SAAS,cAA+B;AAC7C,SAAO;AAAA,IACL,MAAM,eAAe,MAAM,OAAO,SAAS,SAAS;AAClD,aAAO,KAAK,oBAAoB,OAAa,OAAO,SAAS,OAAO;AAAA,IACtE;AAAA,IACA,MAAM,gBAAgB,MAAM,OAAO,SAAS,SAAS;AACnD,aAAO,KAAK,qBAAqB,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CAAC,OAAmB;AACjC,YAAI,CAAC,SAAS;AACZ,oBAAU;AACV,gBAAM;AACN,aAAG;AAAA,QACL;AAAA,MACF;AACA,YAAM,QAAQ,SAAS,gBAAgB,EAAE,OAAO,CAAC,YAAY;AAC3D,YAAI,SAAS,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAG,QAAO,OAAO;AAAA,MACjE,CAAC;AACD,YAAM,OAAO,YAAY;AACvB,YAAI,QAAS;AACb,YAAI,EAAE,IAAI,KAAK,UAAU;AACvB;AAAA,YAAO,MACL;AAAA,cACE,IAAI;AAAA,gBACF,qBAAqB,EAAE,KAAK,mBAAmB,EAAE,UAAU,oBAChD,EAAE,gBAAgB;AAAA,cAC/B;AAAA,YACF;AAAA,UACF;AACA;AAAA,QACF;AACA,YAAI,EAAE,OAAQ,OAAM,EAAE,OAAO;AAC7B,cAAM,IAAI,MAAM,SAAS,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,KAAK,EAAE,IAAI,EAAE,CAAC;AACvF,YAAI,SAAS,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAG,QAAO,OAAO;AAAA,YACpD,YAAW,MAAM,KAAK,KAAK,GAAG,EAAE;AAAA,MACvC;AACA,WAAK,KAAK;AAAA,IACZ,CAAC;AAAA,EACH;AACA,QAAM,IAAI;AACZ;","names":[]}
@@ -5,15 +5,15 @@ import {
5
5
  getAtPath,
6
6
  isStaticDictDescriptor,
7
7
  stripI18nFilled
8
- } from "./chunk-XGVDLQJE.js";
8
+ } from "./chunk-JOCMXSR2.js";
9
9
  import {
10
10
  liveRecordIsElevated
11
- } from "./chunk-NM4LVUXH.js";
11
+ } from "./chunk-PTT2NB46.js";
12
12
  import {
13
13
  EmbeddingDimMismatchError,
14
14
  EmbeddingModelMismatchError,
15
15
  SearchNotEnabledError
16
- } from "./chunk-IGM563N5.js";
16
+ } from "./chunk-6SYOHUHM.js";
17
17
 
18
18
  // src/with-lookup/embeddings/cosine.ts
19
19
  function cosine(a, b) {
@@ -376,31 +376,31 @@ function buildBlobFieldEntries(filenamesByField) {
376
376
  function withSearch() {
377
377
  return {
378
378
  async search(ctx, field, query, opts) {
379
- const { search: search2 } = await import("./collection-facade-CMZGQ6IS.js");
379
+ const { search: search2 } = await import("./collection-facade-S5PPKZD5.js");
380
380
  return search2(ctx, field, query, opts);
381
381
  },
382
382
  async retrieve(ctx, query, opts) {
383
- const { retrieve: retrieve2 } = await import("./collection-facade-CMZGQ6IS.js");
383
+ const { retrieve: retrieve2 } = await import("./collection-facade-S5PPKZD5.js");
384
384
  return retrieve2(ctx, query, opts);
385
385
  },
386
386
  async similarTo(ctx, vector, opts) {
387
- const { similarTo: similarTo2 } = await import("./collection-facade-CMZGQ6IS.js");
387
+ const { similarTo: similarTo2 } = await import("./collection-facade-S5PPKZD5.js");
388
388
  return similarTo2(ctx, vector, opts);
389
389
  },
390
390
  async warmIndex(ctx) {
391
- const { warmIndex: warmIndex2 } = await import("./collection-facade-CMZGQ6IS.js");
391
+ const { warmIndex: warmIndex2 } = await import("./collection-facade-S5PPKZD5.js");
392
392
  return warmIndex2(ctx);
393
393
  },
394
394
  async flushIndex(ctx) {
395
- const { flushIndex: flushIndex2 } = await import("./collection-facade-CMZGQ6IS.js");
395
+ const { flushIndex: flushIndex2 } = await import("./collection-facade-S5PPKZD5.js");
396
396
  return flushIndex2(ctx);
397
397
  },
398
398
  async embedOnWrite(ctx, id, record, version) {
399
- const { embedOnWrite: embedOnWrite2 } = await import("./collection-facade-CMZGQ6IS.js");
399
+ const { embedOnWrite: embedOnWrite2 } = await import("./collection-facade-S5PPKZD5.js");
400
400
  return embedOnWrite2(ctx, id, record, version);
401
401
  },
402
402
  async rebuildEmbeddings(ctx) {
403
- const { rebuildEmbeddings: rebuildEmbeddings2 } = await import("./collection-facade-CMZGQ6IS.js");
403
+ const { rebuildEmbeddings: rebuildEmbeddings2 } = await import("./collection-facade-S5PPKZD5.js");
404
404
  return rebuildEmbeddings2(ctx);
405
405
  }
406
406
  };
@@ -736,4 +736,4 @@ export {
736
736
  rebuildEmbeddings,
737
737
  syncTierSearch
738
738
  };
739
- //# sourceMappingURL=chunk-JW3XCZA2.js.map
739
+ //# sourceMappingURL=chunk-3TZUC4WS.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NOYDB_FORMAT_VERSION
3
- } from "./chunk-5BHNQNBI.js";
3
+ } from "./chunk-DOZFU7OZ.js";
4
4
 
5
5
  // src/with-shape/schema-update/fence.ts
6
6
  var FENCE_RECORD_ID = "schema-fence";
@@ -37,4 +37,4 @@ export {
37
37
  loadFence,
38
38
  saveFence
39
39
  };
40
- //# sourceMappingURL=chunk-JA5B3SLH.js.map
40
+ //# sourceMappingURL=chunk-44Y3P5U6.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  linkI18nVia
3
- } from "./chunk-XGVDLQJE.js";
3
+ } from "./chunk-JOCMXSR2.js";
4
4
 
5
5
  // src/via/i18n/dictionary.ts
6
6
  function dictKey(name, keysOrMap, opts) {
@@ -71,4 +71,4 @@ export {
71
71
  dictKey,
72
72
  staticDict
73
73
  };
74
- //# sourceMappingURL=chunk-25G7U6RD.js.map
74
+ //# sourceMappingURL=chunk-4B3DL75F.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SatelliteConfigError
3
- } from "./chunk-IGM563N5.js";
3
+ } from "./chunk-6SYOHUHM.js";
4
4
 
5
5
  // src/with-shape/satellites/validate.ts
6
6
  function validateSatelliteDeclaration(input) {
@@ -47,4 +47,4 @@ export {
47
47
  validateSatelliteDeclaration,
48
48
  hashFields
49
49
  };
50
- //# sourceMappingURL=chunk-L4OA7G5T.js.map
50
+ //# sourceMappingURL=chunk-522MBPE5.js.map
@@ -0,0 +1,81 @@
1
+ import {
2
+ lazy
3
+ } from "./chunk-5D2ALSM5.js";
4
+
5
+ // src/with-formula/derivations/stale.ts
6
+ var loadDerivationExecutor = lazy(() => import("./executor-FCJEH3FU.js"));
7
+ var _staleByRegistry = /* @__PURE__ */ new WeakMap();
8
+ var keyFor = (source, sourceId) => `${source}/${sourceId}`;
9
+ async function markStale(registry, strategy, sourceId) {
10
+ let map = _staleByRegistry.get(registry);
11
+ if (!map) {
12
+ map = /* @__PURE__ */ new Map();
13
+ _staleByRegistry.set(registry, map);
14
+ }
15
+ const k = keyFor(strategy.source, sourceId);
16
+ let set = map.get(k);
17
+ if (!set) {
18
+ set = /* @__PURE__ */ new Set();
19
+ map.set(k, set);
20
+ }
21
+ set.add(strategy);
22
+ }
23
+ async function resolveStaleOnRead(accessor, outputCollection, id) {
24
+ const registry = accessor.registry();
25
+ const producers = registry.strategiesProducingOutput(outputCollection);
26
+ if (producers.length === 0) return;
27
+ const map = _staleByRegistry.get(registry);
28
+ if (!map) return;
29
+ let DerivationExecutor = null;
30
+ for (const { spec, strategyHash } of producers) {
31
+ const k = keyFor(spec.source, id);
32
+ const pending = map.get(k);
33
+ if (!pending || !pending.has(spec)) continue;
34
+ const sourceColl = accessor.getCollection(spec.source);
35
+ const source = await sourceColl.get(id);
36
+ if (!source) {
37
+ pending.delete(spec);
38
+ continue;
39
+ }
40
+ const sourceWithId = { ...source, id };
41
+ DerivationExecutor ??= (await loadDerivationExecutor()).DerivationExecutor;
42
+ const ctx = { vault: accessor.getReadOnlyFacade() };
43
+ const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
44
+ for (const key of Object.keys(spec.outputs)) {
45
+ const out = result.outputs[key];
46
+ if (!out) continue;
47
+ if (out.kind === "failed") {
48
+ const err = out.error;
49
+ if (spec.strict) {
50
+ throw err;
51
+ }
52
+ console.warn(
53
+ `[derivation] lazy output "${key}" for source "${spec.source}" id="${id}" failed:`,
54
+ err
55
+ );
56
+ continue;
57
+ }
58
+ if (out.kind === "array") {
59
+ console.warn(
60
+ `[derivation] unexpected array-shape output "${key}" in lazy resolve path; array-shape derivations require lifecycle: "eager".`
61
+ );
62
+ continue;
63
+ }
64
+ const outSpec = spec.outputs[key];
65
+ if (!outSpec) continue;
66
+ const outputColl = accessor.getCollection(outSpec.collection);
67
+ if (out.skipped === true) {
68
+ await outputColl._internalDelete(id, accessor.getActiveTxContext());
69
+ continue;
70
+ }
71
+ await outputColl.put(id, out.value);
72
+ }
73
+ pending.delete(spec);
74
+ }
75
+ }
76
+
77
+ export {
78
+ markStale,
79
+ resolveStaleOnRead
80
+ };
81
+ //# sourceMappingURL=chunk-5ABOFAHN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-formula/derivations/stale.ts"],"sourcesContent":["import type { Collection } from '../../kernel/collection.js'\nimport type { DerivationExecutor as DerivationExecutorType } from './executor.js'\nimport type { ReadOnlyVaultFacade } from '../../with-audit/guards/types.js'\nimport type { TxContext } from '../../with-commit/tx/transaction.js'\nimport type { DerivationRegistry } from './registry.js'\n// Type-only — runtime class loaded via dynamic import in\n// `resolveStaleOnRead` only when a stale flag actually fires. Keeps\n// the executor chunk out of the floor bundle.\nimport type { DerivationStrategy } from './types.js'\n\nimport { lazy } from '../../kernel/lazy.js'\n\n/** #846c — one memoized binding instead of a cast at the call site. */\nconst loadDerivationExecutor = lazy(() => import('./executor.js'))\n\n/**\n * Accessor shape passed through from the owning Vault. Provides the\n * registry (used to look up strategies and as the WeakMap key) and a\n * resolver from collection name to the live `Collection` instance.\n * Same shape as `Collection.derivationSource` so callers can pass it\n * through directly.\n */\nexport interface DerivationStaleAccessor {\n registry(): DerivationRegistry\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getCollection(name: string): Collection<any>\n /**\n * Read-only vault facade handed to `derive(source, ctx)` on the lazy\n * resolve-on-read path. Same instance/shape as the eager path uses.\n */\n getReadOnlyFacade(): ReadOnlyVaultFacade\n /**\n * Active multi-record TxContext or `null`. The lazy resolve-on-read\n * path uses this to register tombstone deletes on `_executed` so a\n * later rollback restores the prior emission. Mirrors the eager\n * path's rollback tracking; the lazy `put` was historically\n * unregistered but the tombstone delete (a NEW write path)\n * matches the eager registration for symmetry.\n */\n getActiveTxContext(): TxContext | null\n}\n\n/**\n * In-memory stale map keyed by `DerivationRegistry` instance (stable\n * per vault). Maps `${source}/${sourceId}` → set of pending strategies.\n *\n * Persistence across vault close is NOT implemented in v1 (concern\n * flagged in the dim14 spec). On vault re-open, derived records'\n * `_derivedFrom.strategyHash` will still match the registered\n * strategies' hash, so an unset stale flag is interpreted as \"fresh.\"\n * `vault.deriveAll()` (Task D13) is the explicit recompute escape\n * hatch.\n *\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst _staleByRegistry = new WeakMap<DerivationRegistry, Map<string, Set<DerivationStrategy<any, any>>>>()\n\nconst keyFor = (source: string, sourceId: string): string => `${source}/${sourceId}`\n\n/** Mark every output of (strategy, sourceId) as stale. */\nexport async function markStale(\n registry: DerivationRegistry,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n strategy: DerivationStrategy<any, any>,\n sourceId: string,\n): Promise<void> {\n let map = _staleByRegistry.get(registry)\n if (!map) {\n map = new Map()\n _staleByRegistry.set(registry, map)\n }\n const k = keyFor(strategy.source, sourceId)\n let set = map.get(k)\n if (!set) {\n set = new Set()\n map.set(k, set)\n }\n set.add(strategy)\n}\n\n/**\n * Called from `Collection.get` on lazy-mode output collections. If the\n * id has a pending stale flag for any strategy producing this output\n * collection, re-derive before returning the record. No-op when there\n * is no pending work — keeps the read fast path negligible.\n */\nexport async function resolveStaleOnRead(\n accessor: DerivationStaleAccessor,\n outputCollection: string,\n id: string,\n): Promise<void> {\n const registry = accessor.registry()\n const producers = registry.strategiesProducingOutput(outputCollection)\n if (producers.length === 0) return\n\n const map = _staleByRegistry.get(registry)\n if (!map) return\n\n // Dynamic-import the executor only when at least one stale flag\n // actually fires. Vaults with no derivation strategies never call\n // this function (gated on `derivationSource` in `Collection.get`);\n // vaults with strategies but no pending stale ids reach the\n // `pending.has(spec)` short-circuit below without ever touching\n // the executor chunk.\n let DerivationExecutor: typeof DerivationExecutorType | null = null\n\n for (const { spec, strategyHash } of producers) {\n const k = keyFor(spec.source, id)\n const pending = map.get(k)\n if (!pending || !pending.has(spec)) continue\n\n // Read the source record from the source collection and re-derive.\n // We use the same getCollection accessor that eager dispatch uses\n // — it returns the live `Collection<any>` instance with full\n // crypto / keyring wiring.\n const sourceColl = accessor.getCollection(spec.source)\n const source = await sourceColl.get(id)\n if (!source) {\n pending.delete(spec)\n continue\n }\n const sourceWithId = { ...(source as Record<string, unknown>), id } as Record<string, unknown> & { id: string }\n // sourceVersion: not tracked in v1 stale map; pass 0 — matches the\n // forthcoming v0 semantics, `_derivedFrom.sourceVersion` is\n // informational, not load-bearing for correctness.\n DerivationExecutor ??= (await loadDerivationExecutor()).DerivationExecutor\n const ctx = { vault: accessor.getReadOnlyFacade() }\n const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx)\n for (const key of Object.keys(spec.outputs)) {\n const out = result.outputs[key]\n if (!out) continue\n if (out.kind === 'failed') {\n const err = out.error\n if (spec.strict) {\n // Leave the stale flag set so a future read retries.\n throw err\n }\n console.warn(\n `[derivation] lazy output \"${key}\" for source \"${spec.source}\" id=\"${id}\" failed:`,\n err,\n )\n continue\n }\n if (out.kind === 'array') {\n // Defensive — array-shape requires `lifecycle: 'eager'`\n // (validated at withDerivation registration).\n // Reaching the lazy-resolve path for array-shape would mean\n // a registration check was bypassed. Log and skip.\n console.warn(\n `[derivation] unexpected array-shape output \"${key}\" in lazy resolve path; `\n + 'array-shape derivations require lifecycle: \"eager\".',\n )\n continue\n }\n const outSpec = spec.outputs[key]\n if (!outSpec) continue\n const outputColl = accessor.getCollection(outSpec.collection)\n if (out.skipped === true) {\n // Optional output skipped on lazy resolve — delete any\n // prior emission so the read returns null (matches eager-path\n // tombstone semantics). Routed through `_internalDelete` so a\n // user-registered `onDelete` on the output collection\n // does NOT fire. The active TxContext (if any) is forwarded:\n // `resolveStaleOnRead` is reachable from `Collection.get()`\n // which can be called from inside a transaction, so the\n // tombstone must be observable to `revertExecuted` on\n // rollback.\n await outputColl._internalDelete(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AAG;AACxD,UAAM,MAAM,EAAE,OAAO,SAAS,kBAAkB,EAAE;AAClD,UAAM,SAAS,MAAM,mBAAmB,IAAI,MAAM,cAAc,GAAG,cAAc,GAAG;AACpF,eAAW,OAAO,OAAO,KAAK,KAAK,OAAO,GAAG;AAC3C,YAAM,MAAM,OAAO,QAAQ,GAAG;AAC9B,UAAI,CAAC,IAAK;AACV,UAAI,IAAI,SAAS,UAAU;AACzB,cAAM,MAAM,IAAI;AAChB,YAAI,KAAK,QAAQ;AAEf,gBAAM;AAAA,QACR;AACA,gBAAQ;AAAA,UACN,6BAA6B,GAAG,iBAAiB,KAAK,MAAM,SAAS,EAAE;AAAA,UACvE;AAAA,QACF;AACA;AAAA,MACF;AACA,UAAI,IAAI,SAAS,SAAS;AAKxB,gBAAQ;AAAA,UACN,+CAA+C,GAAG;AAAA,QAEpD;AACA;AAAA,MACF;AACA,YAAM,UAAU,KAAK,QAAQ,GAAG;AAChC,UAAI,CAAC,QAAS;AACd,YAAM,aAAa,SAAS,cAAc,QAAQ,UAAU;AAC5D,UAAI,IAAI,YAAY,MAAM;AAUxB,cAAM,WAAW,gBAAgB,IAAI,SAAS,mBAAmB,CAAC;AAClE;AAAA,MACF;AACA,YAAM,WAAW,IAAI,IAAI,IAAI,KAAK;AAAA,IACpC;AACA,YAAQ,OAAO,IAAI;AAAA,EACrB;AACF;","names":[]}
@@ -0,0 +1,19 @@
1
+ // src/kernel/lazy.ts
2
+ function lazy(load) {
3
+ let cached;
4
+ let inflight;
5
+ return async () => {
6
+ if (cached !== void 0) return cached;
7
+ inflight ??= load().then((mod) => {
8
+ cached = mod;
9
+ inflight = void 0;
10
+ return mod;
11
+ });
12
+ return inflight;
13
+ };
14
+ }
15
+
16
+ export {
17
+ lazy
18
+ };
19
+ //# sourceMappingURL=chunk-5D2ALSM5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/kernel/lazy.ts"],"sourcesContent":["/**\n * Memoized module loader for the S4 lazy-import seam (#846c).\n *\n * The spine and the services reach optional machinery through a dynamic\n * `import()` — that is what keeps a service out of the floor bundle for\n * consumers who never opt into it, and `check-architecture`'s `port-layering`\n * rule requires it for any spine→service edge. The pattern stays; this only\n * removes the ceremony that grew around it.\n *\n * Call sites had each re-invented the same shape: a `let mod = null` cache\n * declared *inside* the function (so it cached for one invocation and no\n * longer), plus in several places an `as { … }` cast, because destructuring a\n * dynamic import inline gave up the module's type.\n *\n * ```ts\n * const loadExecutor = lazy(() => import('./executor.js'))\n * // …\n * const { DerivationExecutor } = await loadExecutor()\n * ```\n *\n * Note this is about clarity, not speed: the ES module system already caches a\n * resolved module, so the win is one named binding per module instead of a\n * hand-rolled cache and a cast at every call site.\n *\n * Concurrent first calls share a single in-flight promise rather than each\n * starting their own `import()`.\n *\n * @internal\n */\nexport function lazy<T>(load: () => Promise<T>): () => Promise<T> {\n let cached: T | undefined\n let inflight: Promise<T> | undefined\n\n return async (): Promise<T> => {\n if (cached !== undefined) return cached\n inflight ??= load().then((mod) => {\n cached = mod\n inflight = undefined\n return mod\n })\n return inflight\n }\n}\n"],"mappings":";AA6BO,SAAS,KAAQ,MAA0C;AAChE,MAAI;AACJ,MAAI;AAEJ,SAAO,YAAwB;AAC7B,QAAI,WAAW,OAAW,QAAO;AACjC,iBAAa,KAAK,EAAE,KAAK,CAAC,QAAQ;AAChC,eAAS;AACT,iBAAW;AACX,aAAO;AAAA,IACT,CAAC;AACD,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -2,7 +2,7 @@ import {
2
2
  decrypt,
3
3
  deriveSealedFieldKey,
4
4
  deriveSealedFieldKeyFromCek
5
- } from "./chunk-5P5AAXYA.js";
5
+ } from "./chunk-7U6AB7DZ.js";
6
6
 
7
7
  // src/kernel/enclave/record-keys/sealed-slot.ts
8
8
  function parseSealedSlot(blob) {
@@ -26,4 +26,4 @@ export {
26
26
  parseSealedSlot,
27
27
  dualReadSealedSlot
28
28
  };
29
- //# sourceMappingURL=chunk-M25ZIEB2.js.map
29
+ //# sourceMappingURL=chunk-5HSSTOOG.js.map
@@ -2,10 +2,10 @@ import {
2
2
  base64ToBuffer,
3
3
  decryptBytesWithAAD,
4
4
  encryptBytesWithAAD
5
- } from "./chunk-5P5AAXYA.js";
5
+ } from "./chunk-7U6AB7DZ.js";
6
6
  import {
7
7
  TamperedError
8
- } from "./chunk-IGM563N5.js";
8
+ } from "./chunk-6SYOHUHM.js";
9
9
 
10
10
  // src/kernel/enclave/classify/compare.ts
11
11
  var subtle = globalThis.crypto.subtle;
@@ -92,4 +92,4 @@ export {
92
92
  openVdigPayload,
93
93
  evaluateKofN
94
94
  };
95
- //# sourceMappingURL=chunk-LLVW4V7R.js.map
95
+ //# sourceMappingURL=chunk-5WLDZZ6S.js.map
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  NOYDB_FORMAT_VERSION
3
- } from "./chunk-5BHNQNBI.js";
3
+ } from "./chunk-DOZFU7OZ.js";
4
4
 
5
- // src/with-party/team/managed-passphrase.ts
5
+ // src/with-party/team/managed-secret.ts
6
6
  var MemorySealingKeyProvider = class {
7
7
  id;
8
8
  fingerprint;
@@ -25,11 +25,11 @@ var MemorySealingKeyProvider = class {
25
25
  this.keyBytes[i] = this.fingerprint[i % 4] ^ i * 17;
26
26
  }
27
27
  }
28
- async seal(passphrase) {
29
- const out = new Uint8Array(4 + passphrase.length);
28
+ async seal(secret) {
29
+ const out = new Uint8Array(4 + secret.length);
30
30
  out.set(this.fingerprint, 0);
31
- for (let i = 0; i < passphrase.length; i++) {
32
- out[4 + i] = passphrase[i] ^ this.keyBytes[i % 16];
31
+ for (let i = 0; i < secret.length; i++) {
32
+ out[4 + i] = secret[i] ^ this.keyBytes[i % 16];
33
33
  }
34
34
  return out;
35
35
  }
@@ -138,7 +138,7 @@ var MemoryRecipientSealer = class {
138
138
  return pt;
139
139
  }
140
140
  };
141
- var SEALED_PASSPHRASE_RECORD_ID = "sealed-passphrase";
141
+ var SEALED_SECRET_RECORD_ID = "sealed-secret";
142
142
  function bytesToBase64(bytes) {
143
143
  let binary = "";
144
144
  for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
@@ -170,14 +170,14 @@ function parseSealedEnvelope(raw) {
170
170
  }
171
171
  return void 0;
172
172
  }
173
- async function saveSealedPassphrase(store, vault, payload) {
173
+ async function saveSealedSecret(store, vault, payload) {
174
174
  const persisted = {
175
175
  v: 1,
176
176
  _noydb_sealed: 1,
177
177
  pid: payload.providerId,
178
178
  payload: bytesToBase64(payload.sealed)
179
179
  };
180
- const prior = await store.get(vault, "_meta", SEALED_PASSPHRASE_RECORD_ID);
180
+ const prior = await store.get(vault, "_meta", SEALED_SECRET_RECORD_ID);
181
181
  const env = {
182
182
  _noydb: NOYDB_FORMAT_VERSION,
183
183
  _v: (prior?._v ?? 0) + 1,
@@ -186,10 +186,10 @@ async function saveSealedPassphrase(store, vault, payload) {
186
186
  _iv: "",
187
187
  _data: JSON.stringify(persisted)
188
188
  };
189
- await store.put(vault, "_meta", SEALED_PASSPHRASE_RECORD_ID, env);
189
+ await store.put(vault, "_meta", SEALED_SECRET_RECORD_ID, env);
190
190
  }
191
- async function loadSealedPassphrase(store, vault) {
192
- const envelope = await store.get(vault, "_meta", SEALED_PASSPHRASE_RECORD_ID);
191
+ async function loadSealedSecret(store, vault) {
192
+ const envelope = await store.get(vault, "_meta", SEALED_SECRET_RECORD_ID);
193
193
  if (!envelope) return void 0;
194
194
  try {
195
195
  return parseSealedEnvelope(JSON.parse(envelope._data));
@@ -198,11 +198,11 @@ async function loadSealedPassphrase(store, vault) {
198
198
  }
199
199
  }
200
200
  async function resolveManagedSecret(store, vault, provider) {
201
- const existing = await loadSealedPassphrase(store, vault);
201
+ const existing = await loadSealedSecret(store, vault);
202
202
  if (existing) {
203
203
  if (existing.providerId !== provider.id) {
204
204
  throw new Error(
205
- `Managed-mode vault "${vault}" was sealed under provider id "${existing.providerId}" but the current SealingKeyProvider is "${provider.id}". Pass the same provider that originally enrolled the vault, or treat this as a fresh enrollment and clear \`_meta/sealed-passphrase\` first.`
205
+ `Managed-mode vault "${vault}" was sealed under provider id "${existing.providerId}" but the current SealingKeyProvider is "${provider.id}". Pass the same provider that originally enrolled the vault, or treat this as a fresh enrollment and clear \`_meta/sealed-secret\` first.`
206
206
  );
207
207
  }
208
208
  const plaintext = await provider.unseal(existing.sealed);
@@ -211,7 +211,7 @@ async function resolveManagedSecret(store, vault, provider) {
211
211
  const random = new Uint8Array(32);
212
212
  globalThis.crypto.getRandomValues(random);
213
213
  const sealed = await provider.seal(random);
214
- await saveSealedPassphrase(store, vault, { providerId: provider.id, sealed });
214
+ await saveSealedSecret(store, vault, { providerId: provider.id, sealed });
215
215
  return bytesToBase64(random);
216
216
  }
217
217
 
@@ -221,10 +221,10 @@ export {
221
221
  parseRsaOaepTlv,
222
222
  aesGcmOpen,
223
223
  MemoryRecipientSealer,
224
- SEALED_PASSPHRASE_RECORD_ID,
224
+ SEALED_SECRET_RECORD_ID,
225
225
  parseSealedEnvelope,
226
- saveSealedPassphrase,
227
- loadSealedPassphrase,
226
+ saveSealedSecret,
227
+ loadSealedSecret,
228
228
  resolveManagedSecret
229
229
  };
230
- //# sourceMappingURL=chunk-BCOKZC4B.js.map
230
+ //# sourceMappingURL=chunk-6SSWOUUS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-party/team/managed-secret.ts"],"sourcesContent":["/**\n * Managed-secret mode — rubber-hose-resistant vaults.\n *\n * A vault mode where the secret is machine-generated and never\n * exposed to the user, sealed under a developer-provided\n * {@link SealingKeyProvider} (macOS Keychain, Windows Credential\n * Manager, libsecret, AWS KMS, …). The user has no secret to give\n * up to coercion — they can't reveal what they don't know.\n *\n * ## Components in this file\n *\n * - {@link SealingKeyProvider} — the interface concrete providers\n * implement. Provider implementations live OUTSIDE hub (per-\n * platform packages).\n * - {@link MemorySealingKeyProvider} — in-memory test provider; uses\n * a deterministic per-instance \"key\" so two providers with\n * different ids cannot unseal each other's outputs.\n * - {@link RecipientHint} — public material a sender uses to seal\n * plaintext for a specific recipient; published by\n * {@link RecipientSealer.publishRecipientHint} and transported\n * out-of-band to the sender before bundle writes.\n * - {@link RecipientSealer} — interface for asymmetric/granted\n * providers that support recipient-target sealing (RSA-OAEP,\n * cloud-KMS asymmetric, etc.); distinct from self-only\n * {@link SealingKeyProvider} (macOS Keychain, WebAuthn-PRF).\n * - {@link MemoryRecipientSealer} — in-process reference\n * implementation of both `RecipientSealer` and\n * `SealingKeyProvider` using real WebCrypto RSA-OAEP + AES-GCM;\n * safe for tests and same-process sender/recipient scenarios.\n * - {@link loadSealedSecret} / {@link saveSealedSecret} —\n * plaintext envelope storage at `_meta/sealed-secret`.\n * Mirrors the `_meta/handle` and `_meta/public-envelope` AES-\n * GCM-bypassed patterns. The sealing layer (provider's job)\n * is the security boundary; hub doesn't have a key to encrypt\n * with at this layer — that's the whole point of the design.\n * - {@link resolveManagedSecret} — orchestrates the \"generate +\n * seal + persist on first open; unseal on reopen\" flow.\n * Returns the plaintext secret string that the rest of the\n * `createNoydb` keyring path consumes.\n *\n * Deferred to follow-ups:\n * - Block `rotate-secret` policy gate under managed mode.\n * - Mandatory strong-recovery enforcement.\n * - Recovery flow under managed mode (generates fresh sealed phrase).\n *\n * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/session-tiers.md → Managed-secret mode\n *\n * @module\n */\n\nimport type { NoydbStore, EncryptedEnvelope, RecipientSealer } from '../../kernel/types.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\n\n/**\n * The contract concrete providers (per-platform key stores) implement\n * to seal and unseal a hub-generated random secret. The plaintext\n * secret NEVER leaves hub-controlled memory in unsealed form —\n * the provider receives the bytes, returns opaque sealed bytes, and\n * later reverses the operation. Hub treats the sealed bytes as\n * fully opaque.\n *\n * Implementations live OUTSIDE `@noy-db/hub` (separate packages\n * per the issue's \"Concrete providers (live outside hub)\" note):\n *\n * | Platform | Package (TBD) | Backing |\n * |---|---|---|\n * | macOS | `@noy-db/seal-macos-keychain` | Security.framework |\n * | Windows | `@noy-db/seal-wincred` | Credential Manager |\n * | Linux | `@noy-db/seal-libsecret` | libsecret / secret-service |\n * | Cloud / server | `@noy-db/seal-aws-kms` | AWS KMS Decrypt |\n */\nexport interface SealingKeyProvider {\n /**\n * Non-sensitive identifier disclosed in the persisted envelope.\n * Surfaced to consumers via `loadSealedSecret().providerId` so\n * a vault opened with the wrong provider class can detect the\n * mismatch and surface a clear error. NOT secret — fine to log.\n *\n * Suggested format: `<family>:<scope>` — e.g. `macos-keychain:com.acme.app`,\n * `aws-kms:arn:aws:kms:us-east-1:123:key/abc`. The hub never\n * parses this; it's purely audit metadata.\n */\n readonly id: string\n\n /** Seal raw secret bytes. Output bytes are opaque to hub. */\n seal(secret: Uint8Array): Promise<Uint8Array>\n\n /**\n * Reverse {@link seal}. MUST throw on tamper, wrong-provider, or\n * any other failure — hub treats a thrown error as \"this provider\n * cannot unlock this vault\" and surfaces it to the caller.\n */\n unseal(sealed: Uint8Array): Promise<Uint8Array>\n}\n\n/**\n * In-memory test provider. NOT secure — uses a deterministic\n * per-instance \"key\" (16-byte SHA-256 of `id`) XOR'd over the\n * secret plus a 4-byte provider-id fingerprint prefix. The XOR is\n * sufficient to make different `id` values produce mutually-unsealable\n * outputs (the contract tests for that), but offers ZERO real\n * confidentiality — never use outside tests.\n *\n * Replace with a real platform provider in production.\n */\nexport class MemorySealingKeyProvider implements SealingKeyProvider {\n readonly id: string\n private readonly fingerprint: Uint8Array\n private readonly keyBytes: Uint8Array\n\n constructor(opts: { id: string }) {\n this.id = opts.id\n // Deterministic 4-byte fingerprint of the provider id, prepended\n // to every sealed output so we can detect \"wrong provider\" at\n // unseal time without leaking anything sensitive about either\n // provider's actual key material.\n const encoded = new TextEncoder().encode(opts.id)\n let h = 0\n for (let i = 0; i < encoded.length; i++) {\n h = (h * 31 + encoded[i]!) >>> 0\n }\n this.fingerprint = new Uint8Array([\n (h >>> 24) & 0xff, (h >>> 16) & 0xff, (h >>> 8) & 0xff, h & 0xff,\n ])\n // Deterministic 16-byte \"key\" derived from the id by repeating\n // the fingerprint with offsets. Good enough for the XOR-stream\n // test cipher; never confuse this with real key derivation.\n this.keyBytes = new Uint8Array(16)\n for (let i = 0; i < 16; i++) {\n this.keyBytes[i] = this.fingerprint[i % 4]! ^ (i * 17)\n }\n }\n\n async seal(secret: Uint8Array): Promise<Uint8Array> {\n const out = new Uint8Array(4 + secret.length)\n out.set(this.fingerprint, 0)\n for (let i = 0; i < secret.length; i++) {\n out[4 + i] = secret[i]! ^ this.keyBytes[i % 16]!\n }\n return out\n }\n\n async unseal(sealed: Uint8Array): Promise<Uint8Array> {\n if (sealed.length < 4) {\n throw new Error('MemorySealingKeyProvider: sealed input too short')\n }\n for (let i = 0; i < 4; i++) {\n if (sealed[i] !== this.fingerprint[i]) {\n throw new Error(\n `MemorySealingKeyProvider(\"${this.id}\"): provider-id mismatch on unseal `\n + '(sealed bytes were produced by a different provider)',\n )\n }\n }\n const body = sealed.subarray(4)\n const out = new Uint8Array(body.length)\n for (let i = 0; i < body.length; i++) {\n out[i] = body[i]! ^ this.keyBytes[i % 16]!\n }\n return out\n }\n}\n\n/**\n * Public material a sender uses to seal-for-this-recipient. Published by\n * a recipient's RecipientSealer; transported to the sender out-of-band\n * (email, S3, in-app message). The sender obtains the hint, supplies it\n * to writePod's sealedCredentials.perUser[userId].hint, and the\n * hub seals each user's credential against it. Per foundation §11.4.\n */\nexport type RecipientHint = {\n readonly v: 1\n /** Recipient's provider id; matches the SealedAutoUnlockEntry.pid they'll unseal under. */\n readonly pid: string\n /** Algorithm the sender uses to produce the seal. Slice 1 ships RSA-OAEP-SHA256 only. */\n readonly alg: 'rsa-oaep-sha256'\n /** Public material — alg-specific. For 'rsa-oaep-sha256': { publicKeyPem: string }. */\n readonly material: Readonly<Record<string, unknown>>\n}\n\n// Hoisted to kernel/types.ts (C3 — enclave self-containment: sealing.ts\n// consumes this as a spine-owned contract type). Re-exported here so existing\n// importers of this module are unaffected.\nexport type { RecipientSealer } from '../../kernel/types.js'\n\n/**\n * Shared RSA-OAEP-SHA256 + AES-GCM seal in the canonical recipient-target\n * TLV wire format. Mints a fresh 32-byte CEK, AES-GCM-encrypts `plaintext`\n * under it, RSA-OAEP-SHA256-wraps the CEK to `publicKeyPem`, and packs:\n *\n * byte 0 : version (0x01)\n * bytes 1..256 : RSA-OAEP-wrapped CEK (fixed 256 bytes at RSA-2048)\n * bytes 257..268: AES-GCM IV (12 bytes)\n * bytes 269.. : AES-GCM ciphertext ‖ 16-byte tag\n *\n * This is the single source of truth for the wire format — both\n * {@link MemoryRecipientSealer} and external sealers (e.g. `@noy-db/at-aws-kms`'s\n * asymmetric-KMS recipient sealer) call it so a blob sealed by one unseals\n * by the other. WebCrypto RSA-OAEP/SHA-256 here is wire-compatible with\n * AWS KMS `RSAES_OAEP_SHA_256` (both RSAES-OAEP, SHA-256 hash, MGF1-SHA256,\n * empty label).\n *\n * @public — re-exported from the hub barrel for external sealer packages.\n */\nexport async function sealRsaOaepTlv(plaintext: Uint8Array, publicKeyPem: string): Promise<Uint8Array> {\n // Parse PEM → SPKI bytes.\n const b64 = publicKeyPem.replace(/-----BEGIN PUBLIC KEY-----/, '').replace(/-----END PUBLIC KEY-----/, '').replace(/\\s+/g, '')\n const spki = base64ToBytes(b64)\n const recipientPub = await crypto.subtle.importKey(\n 'spki', spki as BufferSource,\n { name: 'RSA-OAEP', hash: 'SHA-256' },\n false, ['encrypt'],\n )\n // Mint fresh CEK + IV, AES-GCM encrypt plaintext.\n const cekBytes = crypto.getRandomValues(new Uint8Array(32))\n const cek = await crypto.subtle.importKey('raw', cekBytes as BufferSource, 'AES-GCM', false, ['encrypt'])\n const iv = crypto.getRandomValues(new Uint8Array(12))\n const ct = new Uint8Array(await crypto.subtle.encrypt({ name: 'AES-GCM', iv: iv as BufferSource }, cek, plaintext as BufferSource))\n // RSA-OAEP-wrap the CEK bytes.\n const wrapped = new Uint8Array(await crypto.subtle.encrypt({ name: 'RSA-OAEP' }, recipientPub, cekBytes as BufferSource))\n cekBytes.fill(0)\n if (wrapped.length !== 256) {\n throw new Error(`sealRsaOaepTlv: expected 256-byte RSA-OAEP wrap, got ${wrapped.length}`)\n }\n // TLV layout.\n const out = new Uint8Array(1 + 256 + 12 + ct.length)\n out[0] = 0x01\n out.set(wrapped, 1)\n out.set(iv, 1 + 256)\n out.set(ct, 1 + 256 + 12)\n return out\n}\n\n/**\n * Parse a {@link sealRsaOaepTlv} blob into its three segments without\n * decrypting. The `wrapped` CEK is RSA-OAEP-SHA256 ciphertext over a\n * 32-byte CEK — the unwrap step is pluggable: {@link MemoryRecipientSealer}\n * decrypts it with a local RSA private key; `@noy-db/at-aws-kms` hands it to\n * KMS `Decrypt`. After unwrapping, pass the CEK + `iv` + `ct` to\n * {@link aesGcmOpen}.\n *\n * @public — re-exported from the hub barrel for external sealer packages.\n */\nexport function parseRsaOaepTlv(bytes: Uint8Array): { wrapped: Uint8Array; iv: Uint8Array; ct: Uint8Array } {\n if (bytes.length < 1 + 256 + 12 + 16) {\n throw new Error('parseRsaOaepTlv: sealed input too short')\n }\n if (bytes[0] !== 0x01) {\n throw new Error(`parseRsaOaepTlv: unknown TLV version ${bytes[0]}`)\n }\n return {\n wrapped: bytes.subarray(1, 1 + 256),\n iv: bytes.subarray(1 + 256, 1 + 256 + 12),\n ct: bytes.subarray(1 + 256 + 12),\n }\n}\n\n/**\n * AES-GCM-decrypt the `ct` segment of a {@link parseRsaOaepTlv} result under\n * the unwrapped 32-byte CEK and its `iv`. Throws on a bad tag (tamper) — the\n * same authenticated-decryption guarantee the TLV relies on.\n *\n * @public — re-exported from the hub barrel for external sealer packages.\n */\nexport async function aesGcmOpen(cekBytes: Uint8Array, iv: Uint8Array, ct: Uint8Array): Promise<Uint8Array> {\n const cek = await crypto.subtle.importKey('raw', cekBytes as BufferSource, 'AES-GCM', false, ['decrypt'])\n return new Uint8Array(await crypto.subtle.decrypt({ name: 'AES-GCM', iv: iv as BufferSource }, cek, ct as BufferSource))\n}\n\n/**\n * Reference implementation of `RecipientSealer` + `SealingKeyProvider`.\n * Uses WebCrypto RSA-OAEP-SHA256 (2048-bit) to wrap a fresh 32-byte\n * AES-GCM CEK, AES-GCM-encrypts plaintext under it, and packs the\n * result into a self-describing TLV:\n *\n * byte 0 : version (0x01)\n * bytes 1..256 : RSA-OAEP-wrapped CEK (fixed 256 bytes at RSA-2048)\n * bytes 257..268: AES-GCM IV (12 bytes)\n * bytes 269.. : AES-GCM ciphertext ‖ 16-byte tag\n *\n * Implements BOTH interfaces. `seal(plaintext)` (self-target) is just\n * `sealForRecipient(plaintext, this own hint)` — same TLV. Convenient\n * for tests where one provider plays both ends. Real cloud providers\n * (`at-aws-kms`, etc.) will pick their own internal layouts; the only\n * contract is round-trip identity.\n *\n * SAFE for production within its scope — the cryptography is real\n * (RSA-OAEP + AES-GCM via WebCrypto), but the keypair lives in-process\n * and is regenerated on every construction. Not suitable as a managed\n * keychain; use it for tests and for shipping bundles where the\n * recipient instance lives in the same process as the sender (rare).\n */\nexport class MemoryRecipientSealer implements SealingKeyProvider, RecipientSealer {\n readonly id: string\n private readonly keypair: Promise<CryptoKeyPair>\n\n constructor(opts: { id: string }) {\n this.id = opts.id\n this.keypair = crypto.subtle.generateKey(\n { name: 'RSA-OAEP', modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: 'SHA-256' },\n true,\n ['encrypt', 'decrypt'],\n )\n }\n\n async publishRecipientHint(): Promise<RecipientHint> {\n const { publicKey } = await this.keypair\n const spki = await crypto.subtle.exportKey('spki', publicKey)\n const pem = '-----BEGIN PUBLIC KEY-----\\n'\n + bytesToBase64(new Uint8Array(spki)).match(/.{1,64}/g)!.join('\\n')\n + '\\n-----END PUBLIC KEY-----\\n'\n return { v: 1, pid: this.id, alg: 'rsa-oaep-sha256', material: { publicKeyPem: pem } }\n }\n\n async sealForRecipient(plaintext: Uint8Array, hint: RecipientHint): Promise<Uint8Array> {\n if (hint.v !== 1) {\n throw new Error(`MemoryRecipientSealer.sealForRecipient: unsupported hint.v ${String(hint.v)} (expected 1)`)\n }\n if (hint.alg !== 'rsa-oaep-sha256') {\n throw new Error(`MemoryRecipientSealer.sealForRecipient: unsupported hint.alg '${String(hint.alg)}' (expected 'rsa-oaep-sha256')`)\n }\n const pem = hint.material['publicKeyPem']\n if (typeof pem !== 'string') {\n throw new Error('MemoryRecipientSealer.sealForRecipient: hint.material.publicKeyPem missing or not a string')\n }\n return sealRsaOaepTlv(plaintext, pem)\n }\n\n async seal(plaintext: Uint8Array): Promise<Uint8Array> {\n const hint = await this.publishRecipientHint()\n return this.sealForRecipient(plaintext, hint)\n }\n\n async unseal(bytes: Uint8Array): Promise<Uint8Array> {\n const { wrapped, iv, ct } = parseRsaOaepTlv(bytes)\n const { privateKey } = await this.keypair\n // Local RSA-OAEP-SHA256 unwrap of the CEK — the pluggable step external\n // sealers replace with KMS Decrypt.\n const cekBytes = new Uint8Array(await crypto.subtle.decrypt({ name: 'RSA-OAEP' }, privateKey, wrapped as BufferSource))\n const pt = await aesGcmOpen(cekBytes, iv, ct)\n cekBytes.fill(0)\n return pt\n }\n}\n\n// ─── Persisted envelope ────────────────────────────────────────────────\n\n/** Reserved id for the managed-secret envelope under `_meta`. */\nexport const SEALED_SECRET_RECORD_ID = 'sealed-secret' as const\n\n/** Plaintext payload stored inside the `_meta/sealed-secret` envelope. */\nexport interface SealedSecret {\n readonly _noydb_sealed: 1\n readonly providerId: string\n /** Sealed bytes. Base64-encoded on the wire; decoded on load. */\n readonly sealed: Uint8Array\n}\n\n/**\n * Wire-format envelope persisted at `_meta/sealed-secret` for\n * managed-mode vaults. The provider produces raw sealed bytes via\n * {@link SealingKeyProvider.seal}; this wrapper carries the dispatch\n * metadata hub needs to pick the right provider on the unseal path.\n *\n * Stability boundary: once shipped, the wire format only grows by\n * adding optional fields. See the at-* sealing dimension foundation\n * doc, §11.9.1.\n *\n * v1 shape (this release): `{ v: 1, _noydb_sealed: 1, pid, payload }`.\n *\n * Legacy shape (earlier releases): `{ _noydb_sealed: 1, providerId, sealed }`\n * — accepted on read for backwards compatibility; never produced on\n * write going forward.\n */\nexport interface SealedEnvelope {\n /** Envelope schema version. v1 is the current shape. */\n readonly v: 1\n /** Magic marker for forensics + legacy-shape detection. */\n readonly _noydb_sealed: 1\n /** Matches the producing provider's `.id`. Dispatch key on unseal. */\n readonly pid: string\n /** Sealed bytes from the provider, base64-encoded on the wire. */\n readonly payload: string\n}\n\nfunction bytesToBase64(bytes: Uint8Array): string {\n let binary = ''\n for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]!)\n return btoa(binary)\n}\n\nfunction base64ToBytes(b64: string): Uint8Array {\n const binary = atob(b64)\n const out = new Uint8Array(binary.length)\n for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i)\n return out\n}\n\n/**\n * Parse a `_meta/sealed-secret` `_data` JSON string into the\n * in-memory {@link SealedSecret} representation. Accepts both:\n *\n * 1. v1 wire format `{ v: 1, _noydb_sealed: 1, pid, payload }` —\n * the current shape.\n * 2. Legacy wire format `{ _noydb_sealed: 1, providerId, sealed }` —\n * read-only; never written\n * going forward.\n *\n * Returns `undefined` for any input that doesn't match either shape,\n * so callers can fall back to \"no managed-mode envelope present.\"\n *\n * @internal — exported only for the migration safety-net test suite.\n */\nexport function parseSealedEnvelope(raw: unknown): SealedSecret | undefined {\n if (typeof raw !== 'object' || raw === null) return undefined\n const r = raw as Record<string, unknown>\n if (r._noydb_sealed !== 1) return undefined\n\n // v1 shape — preferred.\n if (\n r.v === 1\n && typeof r.pid === 'string'\n && typeof r.payload === 'string'\n ) {\n return {\n _noydb_sealed: 1,\n providerId: r.pid,\n sealed: base64ToBytes(r.payload),\n }\n }\n\n // Legacy shape — earlier releases. Accept on read for compat.\n if (\n typeof r.providerId === 'string'\n && typeof r.sealed === 'string'\n ) {\n return {\n _noydb_sealed: 1,\n providerId: r.providerId,\n sealed: base64ToBytes(r.sealed),\n }\n }\n\n return undefined\n}\n\nexport async function saveSealedSecret(\n store: NoydbStore,\n vault: string,\n payload: { readonly providerId: string; readonly sealed: Uint8Array },\n): Promise<void> {\n const persisted: SealedEnvelope = {\n v: 1,\n _noydb_sealed: 1,\n pid: payload.providerId,\n payload: bytesToBase64(payload.sealed),\n }\n const prior = await store.get(vault, '_meta', SEALED_SECRET_RECORD_ID)\n const env: EncryptedEnvelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: (prior?._v ?? 0) + 1,\n _ts: new Date().toISOString(),\n // AES-GCM bypassed — the sealing layer is the security boundary.\n _iv: '',\n _data: JSON.stringify(persisted),\n }\n await store.put(vault, '_meta', SEALED_SECRET_RECORD_ID, env)\n}\n\nexport async function loadSealedSecret(\n store: NoydbStore,\n vault: string,\n): Promise<SealedSecret | undefined> {\n const envelope = await store.get(vault, '_meta', SEALED_SECRET_RECORD_ID)\n if (!envelope) return undefined\n try {\n return parseSealedEnvelope(JSON.parse(envelope._data))\n } catch {\n return undefined\n }\n}\n\n// ─── createNoydb orchestration ─────────────────────────────────────────\n\n/**\n * Resolve the effective plaintext secret string for a managed-mode\n * vault. Two paths:\n *\n * 1. **First open (no envelope persisted):** generate a 256-bit random\n * via `crypto.getRandomValues`, base64-encode for use as a\n * secret string, seal the underlying bytes under the\n * provider, persist `_meta/sealed-secret`, return the\n * base64 string.\n *\n * 2. **Reopen (envelope exists):** read + unseal + decode → return.\n * A different provider whose `seal` output disagrees on the\n * stored bytes throws here, surfaced as a clear error.\n *\n * The returned string is the same shape that `secret:` would take in\n * standard mode — the rest of the keyring path consumes it\n * unchanged.\n *\n * @internal — called from `createNoydb` / `getKeyringInternal`.\n */\nexport async function resolveManagedSecret(\n store: NoydbStore,\n vault: string,\n provider: SealingKeyProvider,\n): Promise<string> {\n const existing = await loadSealedSecret(store, vault)\n if (existing) {\n if (existing.providerId !== provider.id) {\n throw new Error(\n `Managed-mode vault \"${vault}\" was sealed under provider id `\n + `\"${existing.providerId}\" but the current SealingKeyProvider is `\n + `\"${provider.id}\". Pass the same provider that originally enrolled `\n + 'the vault, or treat this as a fresh enrollment and clear '\n + '`_meta/sealed-secret` first.',\n )\n }\n const plaintext = await provider.unseal(existing.sealed)\n return bytesToBase64(plaintext)\n }\n\n // First open: mint a 256-bit random, seal, persist.\n const random = new Uint8Array(32)\n globalThis.crypto.getRandomValues(random)\n const sealed = await provider.seal(random)\n await saveSealedSecret(store, vault, { providerId: provider.id, sealed })\n return bytesToBase64(random)\n}\n"],"mappings":";;;;;AAyGO,IAAM,2BAAN,MAA6D;AAAA,EACzD;AAAA,EACQ;AAAA,EACA;AAAA,EAEjB,YAAY,MAAsB;AAChC,SAAK,KAAK,KAAK;AAKf,UAAM,UAAU,IAAI,YAAY,EAAE,OAAO,KAAK,EAAE;AAChD,QAAI,IAAI;AACR,aAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,UAAK,IAAI,KAAK,QAAQ,CAAC,MAAQ;AAAA,IACjC;AACA,SAAK,cAAc,IAAI,WAAW;AAAA,MAC/B,MAAM,KAAM;AAAA,MAAO,MAAM,KAAM;AAAA,MAAO,MAAM,IAAK;AAAA,MAAM,IAAI;AAAA,IAC9D,CAAC;AAID,SAAK,WAAW,IAAI,WAAW,EAAE;AACjC,aAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AAC3B,WAAK,SAAS,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,IAAM,IAAI;AAAA,IACrD;AAAA,EACF;AAAA,EAEA,MAAM,KAAK,QAAyC;AAClD,UAAM,MAAM,IAAI,WAAW,IAAI,OAAO,MAAM;AAC5C,QAAI,IAAI,KAAK,aAAa,CAAC;AAC3B,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,UAAI,IAAI,CAAC,IAAI,OAAO,CAAC,IAAK,KAAK,SAAS,IAAI,EAAE;AAAA,IAChD;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,OAAO,QAAyC;AACpD,QAAI,OAAO,SAAS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AAU,SAAS;AAAA,EACjC;AACA,QAAM,MAAM,IAAI,OAAO,SAAS,yBAAyB,GAAG;AAC9D;AAEA,eAAsB,iBACpB,OACA,OACmC;AACnC,QAAM,WAAW,MAAM,MAAM,IAAI,OAAO,SAAS,uBAAuB;AACxE,MAAI,CAAC,SAAU,QAAO;AACtB,MAAI;AACF,WAAO,oBAAoB,KAAK,MAAM,SAAS,KAAK,CAAC;AAAA,EACvD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAwBA,eAAsB,qBACpB,OACA,OACA,UACiB;AACjB,QAAM,WAAW,MAAM,iBAAiB,OAAO,KAAK;AACpD,MAAI,UAAU;AACZ,QAAI,SAAS,eAAe,SAAS,IAAI;AACvC,YAAM,IAAI;AAAA,QACR,uBAAuB,KAAK,mCACtB,SAAS,UAAU,4CACnB,SAAS,EAAE;AAAA,MAGnB;AAAA,IACF;AACA,UAAM,YAAY,MAAM,SAAS,OAAO,SAAS,MAAM;AACvD,WAAO,cAAc,SAAS;AAAA,EAChC;AAGA,QAAM,SAAS,IAAI,WAAW,EAAE;AAChC,aAAW,OAAO,gBAAgB,MAAM;AACxC,QAAM,SAAS,MAAM,SAAS,KAAK,MAAM;AACzC,QAAM,iBAAiB,OAAO,OAAO,EAAE,YAAY,SAAS,IAAI,OAAO,CAAC;AACxE,SAAO,cAAc,MAAM;AAC7B;","names":[]}
@@ -41,7 +41,7 @@ var TamperedError = class extends NoydbError {
41
41
  }
42
42
  };
43
43
  var InvalidKeyError = class extends NoydbError {
44
- constructor(message = "Invalid key \u2014 wrong passphrase or corrupted keyring") {
44
+ constructor(message = "Invalid key \u2014 wrong secret or corrupted keyring") {
45
45
  super("INVALID_KEY", message);
46
46
  this.name = "InvalidKeyError";
47
47
  }
@@ -52,7 +52,7 @@ var KeyringCorruptError = class extends NoydbError {
52
52
  constructor(opts) {
53
53
  super(
54
54
  "KEYRING_CORRUPT",
55
- opts.message ?? `Keyring has ${opts.failedCollections.length} corrupted wrapped DEK(s) (${opts.failedCollections.join(", ")}); ${opts.intactCount} other DEK(s) unwrapped successfully \u2014 the passphrase is correct, the entries are damaged. Do NOT use onInvalidKey: 'reset' here \u2014 that would destroy the intact DEKs.`
55
+ opts.message ?? `Keyring has ${opts.failedCollections.length} corrupted wrapped DEK(s) (${opts.failedCollections.join(", ")}); ${opts.intactCount} other DEK(s) unwrapped successfully \u2014 the secret is correct, the entries are damaged. Do NOT use onInvalidKey: 'reset' here \u2014 that would destroy the intact DEKs.`
56
56
  );
57
57
  this.name = "KeyringCorruptError";
58
58
  this.failedCollections = opts.failedCollections;
@@ -610,7 +610,7 @@ var BundleSealMismatchError = class extends NoydbError {
610
610
  constructor(userId, pid) {
611
611
  super(
612
612
  "BUNDLE_SEAL_MISMATCH",
613
- `bundle carries sealed passphrase for user "${userId}" under provider "${pid}", but no registered provider matches that pid.
613
+ `bundle carries sealed secret for user "${userId}" under provider "${pid}", but no registered provider matches that pid.
614
614
 
615
615
  Resolutions:
616
616
  1. Configure a provider matching the pid and retry import.
@@ -1341,7 +1341,7 @@ var PolicyDeniedError = class extends NoydbError {
1341
1341
  }
1342
1342
  };
1343
1343
  var RecoveryNotEnrolledError = class extends NoydbError {
1344
- constructor(message = 'Recovery profile not enrolled. Pass `recovery: [{ profile: "paper", codes: 10 }]` to `createNoydb()`, or set `policy.gates["recover-passphrase"].enabled = false` to opt out of recovery (passphrase loss = data loss). See https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/session-tiers.md.') {
1344
+ constructor(message = 'Recovery profile not enrolled. Pass `recovery: [{ profile: "paper", codes: 10 }]` to `createNoydb()`, or set `policy.gates["recover-secret"].enabled = false` to opt out of recovery (secret loss = data loss). See https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/session-tiers.md.') {
1345
1345
  super("RECOVERY_NOT_ENROLLED", message);
1346
1346
  this.name = "RecoveryNotEnrolledError";
1347
1347
  }
@@ -1351,7 +1351,7 @@ var ManagedRecoveryNotEnrolledError = class extends NoydbError {
1351
1351
  constructor(vault) {
1352
1352
  super(
1353
1353
  "MANAGED_RECOVERY_NOT_ENROLLED",
1354
- `Managed-mode vault "${vault}" requires at least one strong recovery profile (Shamir today; multi-channel / admin-mediated when they ship). Paper alone is NOT strong under managed mode \u2014 losing the paper sheet would mean losing every record permanently. Bootstrap with \`db.openVaultAndEnrollRecovery("${vault}", { recovery: [{ profile: "shamir", k: 2, n: 3 }] })\`, or call \`db.enrollRecovery(vault, { profile: "shamir", k, n })\` separately, then re-attempt \`openVault\`.`
1354
+ `Managed-mode vault "${vault}" requires at least one strong recovery profile (Shamir today; multi-channel / admin-mediated when they ship). Paper alone is NOT strong under managed mode \u2014 losing the paper sheet would mean losing every record permanently. Bootstrap with \`db.team.openVaultAndEnrollRecovery("${vault}", { recovery: [{ profile: "shamir", k: 2, n: 3 }] })\`, or call \`db.team.enrollRecovery(vault, { profile: "shamir", k, n })\` separately, then re-attempt \`openVault\`.`
1355
1355
  );
1356
1356
  this.name = "ManagedRecoveryNotEnrolledError";
1357
1357
  this.vault = vault;
@@ -1568,4 +1568,4 @@ export {
1568
1568
  ClassifiedRotationError,
1569
1569
  SatelliteConfigError
1570
1570
  };
1571
- //# sourceMappingURL=chunk-IGM563N5.js.map
1571
+ //# sourceMappingURL=chunk-6SYOHUHM.js.map