@noy-db/hub 0.6.0-pre.17 → 0.6.0-pre.19

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 (426) hide show
  1. package/dist/api-Z5VHH24A.js +20 -0
  2. package/dist/attestation/index.js +18 -18
  3. package/dist/{backup-7X3PFTSI.js → backup-K62BFMYK.js} +16 -16
  4. package/dist/{backup-7X3PFTSI.js.map → backup-K62BFMYK.js.map} +1 -1
  5. package/dist/blobs/index.js +13 -13
  6. package/dist/broker/index.js +12 -12
  7. package/dist/cargo/index.js +32 -32
  8. package/dist/{chunk-5SK5AFYH.js → chunk-2E2MKBMI.js} +2 -2
  9. package/dist/{chunk-SDEHNGWW.js → chunk-2IK6AC6A.js} +7 -6
  10. package/dist/{chunk-SDEHNGWW.js.map → chunk-2IK6AC6A.js.map} +1 -1
  11. package/dist/{chunk-7TZTQS4H.js → chunk-32O2N2CH.js} +48 -21
  12. package/dist/chunk-32O2N2CH.js.map +1 -0
  13. package/dist/{chunk-QKRJUPAC.js → chunk-37P5VB4N.js} +13 -16
  14. package/dist/chunk-37P5VB4N.js.map +1 -0
  15. package/dist/{chunk-5UGEGEIJ.js → chunk-3Y4OFWQJ.js} +1 -1
  16. package/dist/chunk-3Y4OFWQJ.js.map +1 -0
  17. package/dist/{chunk-7LLKPODL.js → chunk-437FDIHO.js} +3 -3
  18. package/dist/{chunk-AMKCY454.js → chunk-47ZFULEZ.js} +8 -3
  19. package/dist/{chunk-AMKCY454.js.map → chunk-47ZFULEZ.js.map} +1 -1
  20. package/dist/{chunk-4GR422R5.js → chunk-4HVTRHSA.js} +16 -9
  21. package/dist/chunk-4HVTRHSA.js.map +1 -0
  22. package/dist/{chunk-VEA35MQP.js → chunk-5BS6IQZZ.js} +11 -14
  23. package/dist/chunk-5BS6IQZZ.js.map +1 -0
  24. package/dist/{chunk-QWNYUTI2.js → chunk-5EJQNA26.js} +2 -2
  25. package/dist/{chunk-C66T4W5P.js → chunk-5J5TTSGW.js} +3 -3
  26. package/dist/{chunk-JHYISAID.js → chunk-5JT4Y5UE.js} +10 -10
  27. package/dist/{chunk-VUQZYVYX.js → chunk-6S466CMQ.js} +92 -35
  28. package/dist/chunk-6S466CMQ.js.map +1 -0
  29. package/dist/{chunk-IRHOQFA7.js → chunk-7RCZ436O.js} +2 -2
  30. package/dist/{chunk-42IDLU5V.js → chunk-A3NTKHDB.js} +2 -2
  31. package/dist/{chunk-3JQVA527.js → chunk-A4K5GLE6.js} +4 -4
  32. package/dist/{chunk-K2MR7ROB.js → chunk-APV42WPR.js} +2 -2
  33. package/dist/{chunk-MVG67SMN.js → chunk-AQF7JSQR.js} +2 -2
  34. package/dist/{chunk-VTTRWLOR.js → chunk-BP4I7IBK.js} +2 -2
  35. package/dist/{chunk-T7AEAFEE.js → chunk-BTNKPDZM.js} +3 -3
  36. package/dist/{chunk-PCXAUC65.js → chunk-C7WJNVJG.js} +2 -2
  37. package/dist/{chunk-UNR6G3EJ.js → chunk-CV7WXCZD.js} +37 -33
  38. package/dist/chunk-CV7WXCZD.js.map +1 -0
  39. package/dist/{chunk-67XA44HH.js → chunk-CVYXIN5B.js} +3 -3
  40. package/dist/{chunk-BKYQNNO3.js → chunk-D5UDZANO.js} +203 -137
  41. package/dist/chunk-D5UDZANO.js.map +1 -0
  42. package/dist/{chunk-HVR74IBG.js → chunk-DJ23QZIN.js} +2 -2
  43. package/dist/{chunk-BMDF4TLU.js → chunk-DKYEVHZH.js} +7 -10
  44. package/dist/chunk-DKYEVHZH.js.map +1 -0
  45. package/dist/{chunk-N7HOHWKF.js → chunk-DYASJSKI.js} +8 -11
  46. package/dist/{chunk-N7HOHWKF.js.map → chunk-DYASJSKI.js.map} +1 -1
  47. package/dist/{chunk-OAWVM5L6.js → chunk-E6VDPBE3.js} +13 -15
  48. package/dist/chunk-E6VDPBE3.js.map +1 -0
  49. package/dist/{chunk-WBHQX6ME.js → chunk-E6WANBD6.js} +14 -15
  50. package/dist/chunk-E6WANBD6.js.map +1 -0
  51. package/dist/{chunk-VQQUOEON.js → chunk-EG6AQBYW.js} +10 -10
  52. package/dist/{chunk-GWI65NDQ.js → chunk-EJIVFOOQ.js} +6 -6
  53. package/dist/{chunk-YGJZLOSR.js → chunk-GDGTIWB4.js} +2 -2
  54. package/dist/{chunk-TQ7IRULX.js → chunk-GILI76SU.js} +2 -2
  55. package/dist/{chunk-4444HN72.js → chunk-GT72D4FO.js} +3 -3
  56. package/dist/{chunk-OXRPH6AR.js → chunk-GYUCRDAU.js} +15 -12
  57. package/dist/chunk-GYUCRDAU.js.map +1 -0
  58. package/dist/{chunk-JV2CNEX2.js → chunk-HGAR7H5M.js} +239 -188
  59. package/dist/chunk-HGAR7H5M.js.map +1 -0
  60. package/dist/{chunk-SGEI3IJK.js → chunk-HGJC7I5F.js} +2 -2
  61. package/dist/{chunk-C52CJDFO.js → chunk-HJRTFXAA.js} +7 -10
  62. package/dist/chunk-HJRTFXAA.js.map +1 -0
  63. package/dist/chunk-HK67PX4J.js +27 -0
  64. package/dist/chunk-HK67PX4J.js.map +1 -0
  65. package/dist/{chunk-V4M4BZNW.js → chunk-HTHRCGWP.js} +2 -2
  66. package/dist/{chunk-YVOW35HH.js → chunk-HTMQBBF3.js} +5 -7
  67. package/dist/chunk-HTMQBBF3.js.map +1 -0
  68. package/dist/{chunk-QC2HGYFX.js → chunk-HUYNPLTT.js} +4 -4
  69. package/dist/{chunk-APUP2J5M.js → chunk-I26TE27S.js} +7 -7
  70. package/dist/{chunk-DEP24EE3.js → chunk-ICCRAPWD.js} +4 -4
  71. package/dist/{chunk-ES36R3U2.js → chunk-IOURTXTM.js} +52 -65
  72. package/dist/chunk-IOURTXTM.js.map +1 -0
  73. package/dist/{chunk-JU3JKOY5.js → chunk-IPDS2TYW.js} +3 -3
  74. package/dist/{chunk-QJBXB4WU.js → chunk-JHO6FGZX.js} +25 -31
  75. package/dist/chunk-JHO6FGZX.js.map +1 -0
  76. package/dist/{chunk-YDJXGYYA.js → chunk-JIF3IBRK.js} +2 -2
  77. package/dist/{chunk-S6CP5FWF.js → chunk-KBOPY6W2.js} +2 -2
  78. package/dist/{chunk-RVTOCAHQ.js → chunk-KDX6VEYV.js} +2 -2
  79. package/dist/chunk-KDX6VEYV.js.map +1 -0
  80. package/dist/{chunk-H545OIWE.js → chunk-KM6YR5XF.js} +2 -2
  81. package/dist/{chunk-AFSMT3WI.js → chunk-KUXTWVAR.js} +3 -3
  82. package/dist/{chunk-466KGOQB.js → chunk-L2XQ776M.js} +2 -2
  83. package/dist/{chunk-QI2KXQOM.js → chunk-L6FSZFG7.js} +2 -2
  84. package/dist/{chunk-EEBMKMA7.js → chunk-LAFP5H5U.js} +35 -47
  85. package/dist/chunk-LAFP5H5U.js.map +1 -0
  86. package/dist/{chunk-I7JF5TNL.js → chunk-LBDTQM3R.js} +3 -3
  87. package/dist/{chunk-V3OLO4TK.js → chunk-M4IKEOJS.js} +20 -17
  88. package/dist/chunk-M4IKEOJS.js.map +1 -0
  89. package/dist/{chunk-5NKSNW25.js → chunk-MNMYHZVU.js} +2 -2
  90. package/dist/{chunk-IEA3TZJE.js → chunk-MNUTPZRQ.js} +31 -49
  91. package/dist/chunk-MNUTPZRQ.js.map +1 -0
  92. package/dist/{chunk-Z2OFE6IX.js → chunk-MQXYR65M.js} +15 -24
  93. package/dist/chunk-MQXYR65M.js.map +1 -0
  94. package/dist/{chunk-5VVBZ6E4.js → chunk-N2HKBESK.js} +4 -4
  95. package/dist/{chunk-HNOBRU24.js → chunk-N7YAQKAO.js} +2 -2
  96. package/dist/{chunk-6U7M7AX6.js → chunk-NH2MST6J.js} +2 -2
  97. package/dist/{chunk-JAHIL6WO.js → chunk-NRNTXBHT.js} +7 -10
  98. package/dist/chunk-NRNTXBHT.js.map +1 -0
  99. package/dist/{chunk-URVL4EKU.js → chunk-NYSD43OE.js} +15 -24
  100. package/dist/chunk-NYSD43OE.js.map +1 -0
  101. package/dist/{chunk-LUFZPROB.js → chunk-ODVIFBAQ.js} +16 -17
  102. package/dist/chunk-ODVIFBAQ.js.map +1 -0
  103. package/dist/{chunk-SJOK23XT.js → chunk-OIIAXFKM.js} +4 -4
  104. package/dist/chunk-OIIAXFKM.js.map +1 -0
  105. package/dist/{chunk-FSZPQCDR.js → chunk-OQLYMBJI.js} +3 -3
  106. package/dist/{chunk-EMFFWSAD.js → chunk-OWGEHDT2.js} +10 -10
  107. package/dist/chunk-OWGEHDT2.js.map +1 -0
  108. package/dist/{chunk-I64WQSN3.js → chunk-P7L3OQLL.js} +19 -2
  109. package/dist/chunk-P7L3OQLL.js.map +1 -0
  110. package/dist/{chunk-FZ2SSI5R.js → chunk-PG6PFMDC.js} +2 -2
  111. package/dist/{chunk-2RGQNFJB.js → chunk-PZSS7MUM.js} +11 -9
  112. package/dist/chunk-PZSS7MUM.js.map +1 -0
  113. package/dist/{chunk-UKKBKEUI.js → chunk-QPIUFRUC.js} +3 -3
  114. package/dist/{chunk-RJTGXZT6.js → chunk-REL4OLWW.js} +2 -2
  115. package/dist/{chunk-N4GAJSRQ.js → chunk-RNSC2ARR.js} +3 -3
  116. package/dist/{chunk-RWPNRCK2.js → chunk-RORE2GX2.js} +2 -2
  117. package/dist/{chunk-YH65A6WM.js → chunk-RSFG7XHM.js} +2 -2
  118. package/dist/{chunk-QLMUW7OC.js → chunk-S55DBWRC.js} +2 -2
  119. package/dist/{chunk-AKFNLRA2.js → chunk-SA77BQ7F.js} +27 -143
  120. package/dist/chunk-SA77BQ7F.js.map +1 -0
  121. package/dist/{chunk-RBTZLXZJ.js → chunk-SFD2LL7G.js} +2 -2
  122. package/dist/{chunk-XTC5EKST.js → chunk-SG3OQCRG.js} +3 -3
  123. package/dist/{chunk-JN64WH3U.js → chunk-T7IR4N2S.js} +1 -1
  124. package/dist/{chunk-JN64WH3U.js.map → chunk-T7IR4N2S.js.map} +1 -1
  125. package/dist/{chunk-P5ARVLNW.js → chunk-TC6MBEGH.js} +11 -8
  126. package/dist/chunk-TC6MBEGH.js.map +1 -0
  127. package/dist/{chunk-D6E5N2O3.js → chunk-TENLCGYD.js} +12 -10
  128. package/dist/{chunk-D6E5N2O3.js.map → chunk-TENLCGYD.js.map} +1 -1
  129. package/dist/{chunk-X2FXEEQT.js → chunk-VH2W6BOG.js} +7 -7
  130. package/dist/{chunk-FHFMWYGM.js → chunk-VHVMJWM6.js} +7 -7
  131. package/dist/{chunk-FHFMWYGM.js.map → chunk-VHVMJWM6.js.map} +1 -1
  132. package/dist/{chunk-QTDAPDDV.js → chunk-VJ4B3ZXY.js} +15 -3
  133. package/dist/chunk-VJ4B3ZXY.js.map +1 -0
  134. package/dist/{chunk-RDPZMUCX.js → chunk-W6NFONOV.js} +2 -2
  135. package/dist/{chunk-Z3U2YVNM.js → chunk-WBNXZU42.js} +4 -4
  136. package/dist/{chunk-7EIPPOEL.js → chunk-WKD5ESK4.js} +2 -2
  137. package/dist/{chunk-6VAM5THN.js → chunk-YEZW6UJA.js} +15 -15
  138. package/dist/{chunk-6VAM5THN.js.map → chunk-YEZW6UJA.js.map} +1 -1
  139. package/dist/chunk-YOT7D63X.js +190 -0
  140. package/dist/chunk-YOT7D63X.js.map +1 -0
  141. package/dist/{chunk-6JRIYG2C.js → chunk-YVTADFTC.js} +14 -15
  142. package/dist/chunk-YVTADFTC.js.map +1 -0
  143. package/dist/{chunk-C3YP5KKS.js → chunk-ZBDWKPBW.js} +15 -16
  144. package/dist/chunk-ZBDWKPBW.js.map +1 -0
  145. package/dist/{chunk-NWPR2V5W.js → chunk-ZPMXYPBR.js} +2 -2
  146. package/dist/{chunk-RGPB25DB.js → chunk-ZVAFJQZB.js} +25 -19
  147. package/dist/chunk-ZVAFJQZB.js.map +1 -0
  148. package/dist/{chunk-TQLYMYOK.js → chunk-ZWKF3CD3.js} +2 -2
  149. package/dist/classified/index.js +5 -5
  150. package/dist/{classified-marker-W2PUYC3K.js → classified-marker-PMDG3O36.js} +3 -3
  151. package/dist/collection-facade-ZJK5EB33.js +45 -0
  152. package/dist/{computed-5E2OM6EN.js → computed-UHCBRILW.js} +3 -3
  153. package/dist/consent/index.js +9 -9
  154. package/dist/cover/index.js +10 -3
  155. package/dist/custody/index.js +11 -11
  156. package/dist/{dead-filter-MVFQCLXY.js → dead-filter-777VWDER.js} +2 -2
  157. package/dist/debug/index.js +1 -1
  158. package/dist/{delegation-I7XXO5LL.js → delegation-4R5DU23X.js} +23 -24
  159. package/dist/delegation-4R5DU23X.js.map +1 -0
  160. package/dist/derivations/index.js +12 -12
  161. package/dist/derive-3WAS2G5T.js +22 -0
  162. package/dist/directory/index.js +10 -10
  163. package/dist/{dispatch-PY5RUHJF.js → dispatch-3EN6YCCS.js} +18 -18
  164. package/dist/{dispatch-K3MDLCXG.js → dispatch-ASL257KG.js} +5 -5
  165. package/dist/{enclave-77K7UDLS.js → enclave-ZJS5R5RH.js} +17 -9
  166. package/dist/executor-GPM6DNWV.js +9 -0
  167. package/dist/executor-LJSMZ4IB.js +9 -0
  168. package/dist/executor-SHUVRZUJ.js +29 -0
  169. package/dist/export-accessible-GNY6DC6U.js +23 -0
  170. package/dist/extract-partition-BG3AF4NZ.js +38 -0
  171. package/dist/{fanout-sidecar-JI3MUPQV.js → fanout-sidecar-TFPWDOME.js} +18 -27
  172. package/dist/fanout-sidecar-TFPWDOME.js.map +1 -0
  173. package/dist/find-KX6OKHDP.js +11 -0
  174. package/dist/forget/index.js +9 -9
  175. package/dist/guards/index.js +4 -4
  176. package/dist/history/index.js +23 -20
  177. package/dist/history/index.js.map +1 -1
  178. package/dist/i18n/index.js +14 -14
  179. package/dist/index.d.ts +16 -0
  180. package/dist/index.js +156 -154
  181. package/dist/index.js.map +1 -1
  182. package/dist/indexing/index.js +2 -2
  183. package/dist/introspection/index.js +11 -11
  184. package/dist/issue-PAUM7NCX.js +19 -0
  185. package/dist/kernel/enclave/index.d.ts +6 -5
  186. package/dist/kernel/enclave/record-aad.d.ts +79 -7
  187. package/dist/kernel/enclave/record-envelope.d.ts +54 -7
  188. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
  189. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
  190. package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
  191. package/dist/kernel/enclave/record-keys/rekey.d.ts +8 -2
  192. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -3
  193. package/dist/kernel/errors.d.ts +17 -1
  194. package/dist/kernel/merge-authority.d.ts +25 -0
  195. package/dist/kernel/tier-visibility.d.ts +15 -0
  196. package/dist/kernel/types.d.ts +8 -0
  197. package/dist/kernel/vault.d.ts +1 -1
  198. package/dist/kernel/via/index.d.ts +11 -2
  199. package/dist/{ledger-3RDSSMGD.js → ledger-62CEPRPX.js} +11 -11
  200. package/dist/liberate-7QY7TULB.js +24 -0
  201. package/dist/{link-set-VJIWWUZO.js → link-set-ZRYNUHN3.js} +11 -11
  202. package/dist/{managed-secret-XGGJ3BC3.js → managed-secret-T2WB4O47.js} +11 -3
  203. package/dist/materialized-views/index.js +22 -22
  204. package/dist/money/index.js +4 -4
  205. package/dist/noydb-VZIVPDXG.js +84 -0
  206. package/dist/overlay-views/index.js +4 -4
  207. package/dist/periods/index.js +12 -12
  208. package/dist/pod/index.js +58 -57
  209. package/dist/{pod-handle-7BVSWP5B.js → pod-handle-UPLXOGIK.js} +11 -11
  210. package/dist/{pod-handle-7BVSWP5B.js.map → pod-handle-UPLXOGIK.js.map} +1 -1
  211. package/dist/policy/index.js +11 -4
  212. package/dist/port/with/merge-authority.d.ts +52 -0
  213. package/dist/port/with/strategies.d.ts +2 -0
  214. package/dist/portability/index.js +8 -8
  215. package/dist/{post-register-W3T4U57K.js → post-register-J4DEVNXK.js} +6 -6
  216. package/dist/query/index.js +3 -3
  217. package/dist/reduce/index.js +4 -4
  218. package/dist/register-UPD4GKBC.js +32 -0
  219. package/dist/registry-7KX2HWFS.js +18 -0
  220. package/dist/registry-PKYYEHEW.js +9 -0
  221. package/dist/registry-XHCYMD34.js +19 -0
  222. package/dist/registry-XIRTZHPC.js +9 -0
  223. package/dist/request-withdrawal-XZSESWZV.js +31 -0
  224. package/dist/{reveal-G7W7N3AZ.js → reveal-525XWQU2.js} +6 -6
  225. package/dist/revoke-QI7YHQ2B.js +24 -0
  226. package/dist/satellites/index.js +1 -1
  227. package/dist/schema-update/index.js +2 -2
  228. package/dist/sealed-record/index.js +20 -13
  229. package/dist/sealed-record/index.js.map +1 -1
  230. package/dist/search/index.js +4 -4
  231. package/dist/{seed-2FUULTQV.js → seed-2KZDTFS4.js} +19 -22
  232. package/dist/seed-2KZDTFS4.js.map +1 -0
  233. package/dist/sequence/index.js +9 -9
  234. package/dist/session/index.js +9 -9
  235. package/dist/shadow/index.js +2 -2
  236. package/dist/signer-BZWDPGGN.js +25 -0
  237. package/dist/snapshots/index.js +10 -10
  238. package/dist/{stale-42FPALK2.js → stale-PQYPVCER.js} +10 -10
  239. package/dist/storage-MJHKNQRO.js +23 -0
  240. package/dist/{store-coordination-provider-Y3VXBHPL.js → store-coordination-provider-TFHZLKHG.js} +18 -12
  241. package/dist/store-coordination-provider-TFHZLKHG.js.map +1 -0
  242. package/dist/sync/index.js +11 -11
  243. package/dist/team/index.js +15 -14
  244. package/dist/tiers/index.js +11 -10
  245. package/dist/to/index.js +1 -1
  246. package/dist/transactions/index.js +3 -3
  247. package/dist/util/index.js +1 -1
  248. package/dist/vault-head/index.js +111 -0
  249. package/dist/vault-head/index.js.map +1 -0
  250. package/dist/{verify-SHJXGZGM.js → verify-J6DEOXP3.js} +5 -5
  251. package/dist/walk-BX4NSB5L.js +21 -0
  252. package/dist/with-audit/periods/periods.d.ts +1 -1
  253. package/dist/with-audit/periods/strategy.d.ts +1 -1
  254. package/dist/with-audit/sealed-record/index.d.ts +13 -0
  255. package/dist/with-audit/tiers/index.d.ts +17 -2
  256. package/dist/with-commit/history/history.d.ts +26 -0
  257. package/dist/with-commit/history/index.d.ts +2 -1
  258. package/dist/with-commit/history/ledger/store.d.ts +7 -1
  259. package/dist/with-commit/history/strategy.d.ts +11 -1
  260. package/dist/with-commit/vault-head/active.d.ts +2 -0
  261. package/dist/with-commit/vault-head/head.d.ts +28 -0
  262. package/dist/with-commit/vault-head/index.d.ts +10 -0
  263. package/dist/with-commit/vault-head/strategy.d.ts +127 -0
  264. package/dist/with-commit/vault-head/verify.d.ts +50 -0
  265. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  266. package/dist/with-party/directory/storage.d.ts +0 -11
  267. package/dist/with-party/directory/visibility.d.ts +0 -21
  268. package/dist/with-party/policy/storage.d.ts +0 -10
  269. package/dist/with-party/team/tiers.d.ts +2 -1
  270. package/dist/with-sync/engine.d.ts +33 -5
  271. package/dist/with-sync/strategy.d.ts +3 -0
  272. package/dist/withdraw-accessible-K4CPMH4C.js +28 -0
  273. package/package.json +7 -3
  274. package/dist/api-AEIN3KAQ.js +0 -20
  275. package/dist/chunk-2RGQNFJB.js.map +0 -1
  276. package/dist/chunk-4GR422R5.js.map +0 -1
  277. package/dist/chunk-5UGEGEIJ.js.map +0 -1
  278. package/dist/chunk-6JRIYG2C.js.map +0 -1
  279. package/dist/chunk-7TZTQS4H.js.map +0 -1
  280. package/dist/chunk-AFHQATY4.js +0 -47
  281. package/dist/chunk-AFHQATY4.js.map +0 -1
  282. package/dist/chunk-AKFNLRA2.js.map +0 -1
  283. package/dist/chunk-BKYQNNO3.js.map +0 -1
  284. package/dist/chunk-BMDF4TLU.js.map +0 -1
  285. package/dist/chunk-C3YP5KKS.js.map +0 -1
  286. package/dist/chunk-C52CJDFO.js.map +0 -1
  287. package/dist/chunk-EEBMKMA7.js.map +0 -1
  288. package/dist/chunk-EMFFWSAD.js.map +0 -1
  289. package/dist/chunk-ES36R3U2.js.map +0 -1
  290. package/dist/chunk-I64WQSN3.js.map +0 -1
  291. package/dist/chunk-IEA3TZJE.js.map +0 -1
  292. package/dist/chunk-JAHIL6WO.js.map +0 -1
  293. package/dist/chunk-JV2CNEX2.js.map +0 -1
  294. package/dist/chunk-LUFZPROB.js.map +0 -1
  295. package/dist/chunk-OAWVM5L6.js.map +0 -1
  296. package/dist/chunk-OXRPH6AR.js.map +0 -1
  297. package/dist/chunk-P5ARVLNW.js.map +0 -1
  298. package/dist/chunk-QJBXB4WU.js.map +0 -1
  299. package/dist/chunk-QKRJUPAC.js.map +0 -1
  300. package/dist/chunk-QTDAPDDV.js.map +0 -1
  301. package/dist/chunk-RGPB25DB.js.map +0 -1
  302. package/dist/chunk-RVTOCAHQ.js.map +0 -1
  303. package/dist/chunk-SJOK23XT.js.map +0 -1
  304. package/dist/chunk-UNR6G3EJ.js.map +0 -1
  305. package/dist/chunk-URVL4EKU.js.map +0 -1
  306. package/dist/chunk-V3OLO4TK.js.map +0 -1
  307. package/dist/chunk-VEA35MQP.js.map +0 -1
  308. package/dist/chunk-VUQZYVYX.js.map +0 -1
  309. package/dist/chunk-WBHQX6ME.js.map +0 -1
  310. package/dist/chunk-YVOW35HH.js.map +0 -1
  311. package/dist/chunk-Z2OFE6IX.js.map +0 -1
  312. package/dist/collection-facade-CRXN72DU.js +0 -45
  313. package/dist/delegation-I7XXO5LL.js.map +0 -1
  314. package/dist/derive-NL7X2EFT.js +0 -22
  315. package/dist/executor-FNGVGDW3.js +0 -29
  316. package/dist/executor-PCZN2LTY.js +0 -9
  317. package/dist/executor-WFTHIDT7.js +0 -9
  318. package/dist/export-accessible-QWUYY2OY.js +0 -23
  319. package/dist/extract-partition-CGCURVS4.js +0 -38
  320. package/dist/fanout-sidecar-JI3MUPQV.js.map +0 -1
  321. package/dist/find-VBNMB42N.js +0 -11
  322. package/dist/issue-7IPUNAFA.js +0 -19
  323. package/dist/liberate-2DNJ7AJ7.js +0 -24
  324. package/dist/noydb-CLQP36JR.js +0 -83
  325. package/dist/register-YUVC4G27.js +0 -32
  326. package/dist/registry-BPKJX562.js +0 -19
  327. package/dist/registry-E4FM32KD.js +0 -9
  328. package/dist/registry-HACMULJJ.js +0 -9
  329. package/dist/registry-HRFRBFDV.js +0 -18
  330. package/dist/request-withdrawal-CXTQLMJK.js +0 -31
  331. package/dist/revoke-ZX3TZUI6.js +0 -24
  332. package/dist/seed-2FUULTQV.js.map +0 -1
  333. package/dist/signer-FPUIX63Z.js +0 -25
  334. package/dist/storage-6QODT6K5.js +0 -23
  335. package/dist/store-coordination-provider-Y3VXBHPL.js.map +0 -1
  336. package/dist/walk-5PGJI3ND.js +0 -21
  337. package/dist/withdraw-accessible-PFCQQGNP.js +0 -28
  338. /package/dist/{api-AEIN3KAQ.js.map → api-Z5VHH24A.js.map} +0 -0
  339. /package/dist/{chunk-5SK5AFYH.js.map → chunk-2E2MKBMI.js.map} +0 -0
  340. /package/dist/{chunk-7LLKPODL.js.map → chunk-437FDIHO.js.map} +0 -0
  341. /package/dist/{chunk-QWNYUTI2.js.map → chunk-5EJQNA26.js.map} +0 -0
  342. /package/dist/{chunk-C66T4W5P.js.map → chunk-5J5TTSGW.js.map} +0 -0
  343. /package/dist/{chunk-JHYISAID.js.map → chunk-5JT4Y5UE.js.map} +0 -0
  344. /package/dist/{chunk-IRHOQFA7.js.map → chunk-7RCZ436O.js.map} +0 -0
  345. /package/dist/{chunk-42IDLU5V.js.map → chunk-A3NTKHDB.js.map} +0 -0
  346. /package/dist/{chunk-3JQVA527.js.map → chunk-A4K5GLE6.js.map} +0 -0
  347. /package/dist/{chunk-K2MR7ROB.js.map → chunk-APV42WPR.js.map} +0 -0
  348. /package/dist/{chunk-MVG67SMN.js.map → chunk-AQF7JSQR.js.map} +0 -0
  349. /package/dist/{chunk-VTTRWLOR.js.map → chunk-BP4I7IBK.js.map} +0 -0
  350. /package/dist/{chunk-T7AEAFEE.js.map → chunk-BTNKPDZM.js.map} +0 -0
  351. /package/dist/{chunk-PCXAUC65.js.map → chunk-C7WJNVJG.js.map} +0 -0
  352. /package/dist/{chunk-67XA44HH.js.map → chunk-CVYXIN5B.js.map} +0 -0
  353. /package/dist/{chunk-HVR74IBG.js.map → chunk-DJ23QZIN.js.map} +0 -0
  354. /package/dist/{chunk-VQQUOEON.js.map → chunk-EG6AQBYW.js.map} +0 -0
  355. /package/dist/{chunk-GWI65NDQ.js.map → chunk-EJIVFOOQ.js.map} +0 -0
  356. /package/dist/{chunk-YGJZLOSR.js.map → chunk-GDGTIWB4.js.map} +0 -0
  357. /package/dist/{chunk-TQ7IRULX.js.map → chunk-GILI76SU.js.map} +0 -0
  358. /package/dist/{chunk-4444HN72.js.map → chunk-GT72D4FO.js.map} +0 -0
  359. /package/dist/{chunk-SGEI3IJK.js.map → chunk-HGJC7I5F.js.map} +0 -0
  360. /package/dist/{chunk-V4M4BZNW.js.map → chunk-HTHRCGWP.js.map} +0 -0
  361. /package/dist/{chunk-QC2HGYFX.js.map → chunk-HUYNPLTT.js.map} +0 -0
  362. /package/dist/{chunk-APUP2J5M.js.map → chunk-I26TE27S.js.map} +0 -0
  363. /package/dist/{chunk-DEP24EE3.js.map → chunk-ICCRAPWD.js.map} +0 -0
  364. /package/dist/{chunk-JU3JKOY5.js.map → chunk-IPDS2TYW.js.map} +0 -0
  365. /package/dist/{chunk-YDJXGYYA.js.map → chunk-JIF3IBRK.js.map} +0 -0
  366. /package/dist/{chunk-S6CP5FWF.js.map → chunk-KBOPY6W2.js.map} +0 -0
  367. /package/dist/{chunk-H545OIWE.js.map → chunk-KM6YR5XF.js.map} +0 -0
  368. /package/dist/{chunk-AFSMT3WI.js.map → chunk-KUXTWVAR.js.map} +0 -0
  369. /package/dist/{chunk-466KGOQB.js.map → chunk-L2XQ776M.js.map} +0 -0
  370. /package/dist/{chunk-QI2KXQOM.js.map → chunk-L6FSZFG7.js.map} +0 -0
  371. /package/dist/{chunk-I7JF5TNL.js.map → chunk-LBDTQM3R.js.map} +0 -0
  372. /package/dist/{chunk-5NKSNW25.js.map → chunk-MNMYHZVU.js.map} +0 -0
  373. /package/dist/{chunk-5VVBZ6E4.js.map → chunk-N2HKBESK.js.map} +0 -0
  374. /package/dist/{chunk-HNOBRU24.js.map → chunk-N7YAQKAO.js.map} +0 -0
  375. /package/dist/{chunk-6U7M7AX6.js.map → chunk-NH2MST6J.js.map} +0 -0
  376. /package/dist/{chunk-FSZPQCDR.js.map → chunk-OQLYMBJI.js.map} +0 -0
  377. /package/dist/{chunk-FZ2SSI5R.js.map → chunk-PG6PFMDC.js.map} +0 -0
  378. /package/dist/{chunk-UKKBKEUI.js.map → chunk-QPIUFRUC.js.map} +0 -0
  379. /package/dist/{chunk-RJTGXZT6.js.map → chunk-REL4OLWW.js.map} +0 -0
  380. /package/dist/{chunk-N4GAJSRQ.js.map → chunk-RNSC2ARR.js.map} +0 -0
  381. /package/dist/{chunk-RWPNRCK2.js.map → chunk-RORE2GX2.js.map} +0 -0
  382. /package/dist/{chunk-YH65A6WM.js.map → chunk-RSFG7XHM.js.map} +0 -0
  383. /package/dist/{chunk-QLMUW7OC.js.map → chunk-S55DBWRC.js.map} +0 -0
  384. /package/dist/{chunk-RBTZLXZJ.js.map → chunk-SFD2LL7G.js.map} +0 -0
  385. /package/dist/{chunk-XTC5EKST.js.map → chunk-SG3OQCRG.js.map} +0 -0
  386. /package/dist/{chunk-X2FXEEQT.js.map → chunk-VH2W6BOG.js.map} +0 -0
  387. /package/dist/{chunk-RDPZMUCX.js.map → chunk-W6NFONOV.js.map} +0 -0
  388. /package/dist/{chunk-Z3U2YVNM.js.map → chunk-WBNXZU42.js.map} +0 -0
  389. /package/dist/{chunk-7EIPPOEL.js.map → chunk-WKD5ESK4.js.map} +0 -0
  390. /package/dist/{chunk-NWPR2V5W.js.map → chunk-ZPMXYPBR.js.map} +0 -0
  391. /package/dist/{chunk-TQLYMYOK.js.map → chunk-ZWKF3CD3.js.map} +0 -0
  392. /package/dist/{classified-marker-W2PUYC3K.js.map → classified-marker-PMDG3O36.js.map} +0 -0
  393. /package/dist/{collection-facade-CRXN72DU.js.map → collection-facade-ZJK5EB33.js.map} +0 -0
  394. /package/dist/{computed-5E2OM6EN.js.map → computed-UHCBRILW.js.map} +0 -0
  395. /package/dist/{dead-filter-MVFQCLXY.js.map → dead-filter-777VWDER.js.map} +0 -0
  396. /package/dist/{derive-NL7X2EFT.js.map → derive-3WAS2G5T.js.map} +0 -0
  397. /package/dist/{dispatch-PY5RUHJF.js.map → dispatch-3EN6YCCS.js.map} +0 -0
  398. /package/dist/{dispatch-K3MDLCXG.js.map → dispatch-ASL257KG.js.map} +0 -0
  399. /package/dist/{enclave-77K7UDLS.js.map → enclave-ZJS5R5RH.js.map} +0 -0
  400. /package/dist/{executor-FNGVGDW3.js.map → executor-GPM6DNWV.js.map} +0 -0
  401. /package/dist/{executor-PCZN2LTY.js.map → executor-LJSMZ4IB.js.map} +0 -0
  402. /package/dist/{executor-WFTHIDT7.js.map → executor-SHUVRZUJ.js.map} +0 -0
  403. /package/dist/{export-accessible-QWUYY2OY.js.map → export-accessible-GNY6DC6U.js.map} +0 -0
  404. /package/dist/{extract-partition-CGCURVS4.js.map → extract-partition-BG3AF4NZ.js.map} +0 -0
  405. /package/dist/{find-VBNMB42N.js.map → find-KX6OKHDP.js.map} +0 -0
  406. /package/dist/{issue-7IPUNAFA.js.map → issue-PAUM7NCX.js.map} +0 -0
  407. /package/dist/{ledger-3RDSSMGD.js.map → ledger-62CEPRPX.js.map} +0 -0
  408. /package/dist/{liberate-2DNJ7AJ7.js.map → liberate-7QY7TULB.js.map} +0 -0
  409. /package/dist/{link-set-VJIWWUZO.js.map → link-set-ZRYNUHN3.js.map} +0 -0
  410. /package/dist/{managed-secret-XGGJ3BC3.js.map → managed-secret-T2WB4O47.js.map} +0 -0
  411. /package/dist/{noydb-CLQP36JR.js.map → noydb-VZIVPDXG.js.map} +0 -0
  412. /package/dist/{post-register-W3T4U57K.js.map → post-register-J4DEVNXK.js.map} +0 -0
  413. /package/dist/{register-YUVC4G27.js.map → register-UPD4GKBC.js.map} +0 -0
  414. /package/dist/{registry-BPKJX562.js.map → registry-7KX2HWFS.js.map} +0 -0
  415. /package/dist/{registry-E4FM32KD.js.map → registry-PKYYEHEW.js.map} +0 -0
  416. /package/dist/{registry-HACMULJJ.js.map → registry-XHCYMD34.js.map} +0 -0
  417. /package/dist/{registry-HRFRBFDV.js.map → registry-XIRTZHPC.js.map} +0 -0
  418. /package/dist/{request-withdrawal-CXTQLMJK.js.map → request-withdrawal-XZSESWZV.js.map} +0 -0
  419. /package/dist/{reveal-G7W7N3AZ.js.map → reveal-525XWQU2.js.map} +0 -0
  420. /package/dist/{revoke-ZX3TZUI6.js.map → revoke-QI7YHQ2B.js.map} +0 -0
  421. /package/dist/{signer-FPUIX63Z.js.map → signer-BZWDPGGN.js.map} +0 -0
  422. /package/dist/{stale-42FPALK2.js.map → stale-PQYPVCER.js.map} +0 -0
  423. /package/dist/{storage-6QODT6K5.js.map → storage-MJHKNQRO.js.map} +0 -0
  424. /package/dist/{verify-SHJXGZGM.js.map → verify-J6DEOXP3.js.map} +0 -0
  425. /package/dist/{walk-5PGJI3ND.js.map → walk-BX4NSB5L.js.map} +0 -0
  426. /package/dist/{withdraw-accessible-PFCQQGNP.js.map → withdraw-accessible-K4CPMH4C.js.map} +0 -0
@@ -1,24 +1,30 @@
1
1
  import {
2
2
  loadFence,
3
3
  saveFence
4
- } from "./chunk-C52CJDFO.js";
4
+ } from "./chunk-HJRTFXAA.js";
5
+ import "./chunk-D5UDZANO.js";
5
6
  import {
6
- NOYDB_FORMAT_VERSION
7
- } from "./chunk-5UGEGEIJ.js";
7
+ buildRecordEnvelope
8
+ } from "./chunk-ZVAFJQZB.js";
9
+ import "./chunk-OQLYMBJI.js";
10
+ import "./chunk-DJ23QZIN.js";
11
+ import "./chunk-SFD2LL7G.js";
12
+ import "./chunk-LP7BEXCT.js";
13
+ import "./chunk-VJ4B3ZXY.js";
14
+ import "./chunk-3Y4OFWQJ.js";
15
+ import "./chunk-P7L3OQLL.js";
8
16
  import "./chunk-PZ5AY32C.js";
9
17
 
10
18
  // src/with-shape/schema-update/client-registry.ts
11
19
  var META_COLLECTION = "_meta";
12
20
  var CLIENT_PREFIX = "schema-fence:client:";
13
21
  async function writeClientDoc(store, vault, clientId, doc) {
14
- const envelope = {
15
- _noydb: NOYDB_FORMAT_VERSION,
16
- _v: 1,
17
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
18
- _iv: "",
19
- _data: JSON.stringify({ clientId, ...doc })
20
- };
21
- await store.put(vault, META_COLLECTION, `${CLIENT_PREFIX}${clientId}`, envelope);
22
+ const recordId = `${CLIENT_PREFIX}${clientId}`;
23
+ const envelope = buildRecordEnvelope(
24
+ { collection: META_COLLECTION, id: recordId, version: 1 },
25
+ { iv: "", data: JSON.stringify({ clientId, ...doc }) }
26
+ );
27
+ await store.put(vault, META_COLLECTION, recordId, envelope);
22
28
  }
23
29
  async function listClientDocs(store, vault) {
24
30
  const ids = await store.list(vault, META_COLLECTION);
@@ -139,4 +145,4 @@ function unref(timer) {
139
145
  export {
140
146
  StoreCoordinationProvider
141
147
  };
142
- //# sourceMappingURL=store-coordination-provider-Y3VXBHPL.js.map
148
+ //# sourceMappingURL=store-coordination-provider-TFHZLKHG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/schema-update/client-registry.ts","../src/with-shape/schema-update/store-coordination-provider.ts"],"sourcesContent":["/**\n * Schema-cutover client registry. Each client keeps a\n * heartbeat doc at `_meta/schema-fence:client:<clientId>` carrying its\n * liveness (`lastSeen`) and the fence generation it has quiesced for\n * (`quiescedAtVersion`). Plaintext envelope, like the fence doc.\n */\nimport type { NoydbStore } from '../../kernel/types.js'\nimport { buildRecordEnvelope } from '../../kernel/enclave/index.js'\n\nconst META_COLLECTION = '_meta'\nconst CLIENT_PREFIX = 'schema-fence:client:'\n\nexport interface ClientDoc {\n readonly clientId: string\n readonly lastSeen: number\n readonly quiescedAtVersion: number | null\n /**\n * Session that owns this writer (one user's writers across vaults). Additive\n * and optional so legacy client docs (written without it) keep parsing;\n * readers default it.\n */\n readonly sessionId?: string\n}\n\nexport async function writeClientDoc(\n store: NoydbStore,\n vault: string,\n clientId: string,\n doc: { lastSeen: number; quiescedAtVersion: number | null; sessionId?: string },\n): Promise<void> {\n const recordId = `${CLIENT_PREFIX}${clientId}`\n const envelope = buildRecordEnvelope(\n { collection: META_COLLECTION, id: recordId, version: 1 },\n { iv: '', data: JSON.stringify({ clientId, ...doc }) },\n )\n await store.put(vault, META_COLLECTION, recordId, envelope)\n}\n\nexport async function listClientDocs(store: NoydbStore, vault: string): Promise<ClientDoc[]> {\n const ids = await store.list(vault, META_COLLECTION)\n const out: ClientDoc[] = []\n for (const id of ids) {\n if (!id.startsWith(CLIENT_PREFIX)) continue\n const env = await store.get(vault, META_COLLECTION, id)\n if (!env) continue\n try {\n const parsed = JSON.parse(env._data) as unknown\n if (isClientDoc(parsed)) out.push(parsed)\n } catch { /* skip corrupt */ }\n }\n return out\n}\n\n/**\n * True when every *active* client (lastSeen within staleMs of now) has\n * `quiescedAtVersion === generation`. Stale clients are ignored. An empty\n * active set is vacuously quiesced.\n */\nexport async function activeQuiesced(\n store: NoydbStore,\n vault: string,\n opts: { generation: number; now: number; staleMs: number; excludeClientId?: string },\n): Promise<boolean> {\n const docs = await listClientDocs(store, vault)\n const active = docs.filter(\n d => d.lastSeen >= opts.now - opts.staleMs && d.clientId !== opts.excludeClientId,\n )\n return active.every(d => d.quiescedAtVersion === opts.generation)\n}\n\nfunction isClientDoc(x: unknown): x is ClientDoc {\n if (x === null || typeof x !== 'object') return false\n const o = x as Record<string, unknown>\n return typeof o['clientId'] === 'string'\n && typeof o['lastSeen'] === 'number'\n && (o['quiescedAtVersion'] === null || typeof o['quiescedAtVersion'] === 'number')\n && (o['sessionId'] === undefined || typeof o['sessionId'] === 'string')\n}\n","/**\n * Store-backed default {@link CoordinationProvider}.\n *\n * Maps the five coordination-port methods onto today's `_meta/schema-fence`\n * store ops so that, with no `by-*` provider injected, the fence service\n * reproduces its current store-polling behavior byte-for-byte. The `observe*`\n * methods are poll-emit (the legacy {@link FenceWatcher} model); `by-tabs` /\n * `by-peer` override them with real-time push.\n *\n * @module\n */\n\nimport type { NoydbStore } from '../../kernel/types.js'\nimport type { Unsubscribe } from '../../port/with/write-hooks.js'\nimport { loadFence, saveFence, type FenceDoc } from './fence.js'\nimport { writeClientDoc, listClientDocs, type ClientDoc } from './client-registry.js'\nimport type { CoordinationProvider, FenceState, WriterPresence } from '../../port/by/types.js'\n\n/**\n * Default poll cadence for the `observe*` fallbacks (ms). Matches the\n * store-poll granularity the fence-controller uses while waiting for quorum\n * (`delay(50)`); the same value the migration cutover falls back to when no\n * real-time provider is injected.\n */\nconst DEFAULT_POLL_INTERVAL_MS = 50\n\n/** Map a stored {@link ClientDoc} to the port's {@link WriterPresence}. */\nfunction toPresence(doc: ClientDoc): WriterPresence {\n return {\n writerId: doc.clientId,\n // Legacy docs written without a sessionId (and explicit empty) have no\n // session — fall back to the writerId so every presence is session-addressable.\n sessionId: doc.sessionId && doc.sessionId.length > 0 ? doc.sessionId : doc.clientId,\n lastSeen: doc.lastSeen,\n quiescedAtVersion: doc.quiescedAtVersion,\n }\n}\n\nfunction fenceEqual(a: FenceState, b: FenceState): boolean {\n return a.currentSchemaVersion === b.currentSchemaVersion && a.fenceState === b.fenceState\n}\n\nfunction presenceListEqual(a: readonly WriterPresence[], b: readonly WriterPresence[]): boolean {\n if (a.length !== b.length) return false\n const key = (w: WriterPresence) => `${w.writerId}\\u0000${w.sessionId}\\u0000${w.lastSeen}\\u0000${String(w.quiescedAtVersion)}`\n const bk = new Set(b.map(key))\n return a.every((w) => bk.has(key(w)))\n}\n\nexport class StoreCoordinationProvider implements CoordinationProvider {\n readonly #store: NoydbStore\n readonly #pollIntervalMs: number\n\n constructor(store: NoydbStore, opts?: { pollIntervalMs?: number }) {\n this.#store = store\n this.#pollIntervalMs = opts?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS\n }\n\n async setFence(vault: string, fence: FenceState): Promise<void> {\n // FenceState is structurally FenceDoc (currentSchemaVersion + fenceState).\n await saveFence(this.#store, vault, fence as FenceDoc)\n }\n\n async readFence(vault: string): Promise<FenceState> {\n // FenceDoc is structurally FenceState (currentSchemaVersion + fenceState).\n return loadFence(this.#store, vault)\n }\n\n observeFence(vault: string, onChange: (f: FenceState) => void): Unsubscribe {\n let last: FenceState | null = null\n let busy = false\n const poll = async () => {\n if (busy) return\n busy = true\n try {\n const fence = await loadFence(this.#store, vault)\n if (last === null || !fenceEqual(last, fence)) {\n last = fence\n onChange(fence)\n }\n } catch {\n /* transient store error — retry next tick */\n } finally {\n busy = false\n }\n }\n void poll() // emit current state once immediately\n const timer = setInterval(() => void poll(), this.#pollIntervalMs)\n unref(timer)\n return () => clearInterval(timer)\n }\n\n async reportPresence(vault: string, p: WriterPresence): Promise<void> {\n await writeClientDoc(this.#store, vault, p.writerId, {\n lastSeen: p.lastSeen,\n quiescedAtVersion: p.quiescedAtVersion,\n sessionId: p.sessionId,\n })\n }\n\n observePresence(vault: string, onChange: (writers: readonly WriterPresence[]) => void): Unsubscribe {\n let last: readonly WriterPresence[] | null = null\n let busy = false\n const poll = async () => {\n if (busy) return\n busy = true\n try {\n const docs = await listClientDocs(this.#store, vault)\n const writers = docs.map(toPresence)\n if (last === null || !presenceListEqual(last, writers)) {\n last = writers\n onChange(writers)\n }\n } catch {\n /* transient store error — retry next tick */\n } finally {\n busy = false\n }\n }\n void poll() // emit current set once immediately\n const timer = setInterval(() => void poll(), this.#pollIntervalMs)\n unref(timer)\n return () => clearInterval(timer)\n }\n\n async reachableWriters(vault: string, o: { staleMs: number; now: number }): Promise<readonly WriterPresence[]> {\n const docs = await listClientDocs(this.#store, vault)\n return docs.map(toPresence).filter((w) => o.now - w.lastSeen <= o.staleMs)\n }\n}\n\n/** Best-effort `unref` so a poll timer never holds the process open (Node only). */\nfunction unref(timer: ReturnType<typeof setInterval>): void {\n const t = timer as unknown as { unref?: () => void }\n if (typeof t.unref === 'function') t.unref()\n}\n"],"mappings":"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","names":[]}
@@ -2,20 +2,20 @@ import {
2
2
  PresenceHandle,
3
3
  SyncEngine,
4
4
  SyncTransaction
5
- } from "../chunk-7TZTQS4H.js";
5
+ } from "../chunk-32O2N2CH.js";
6
6
  import {
7
7
  NO_SYNC
8
- } from "../chunk-JN64WH3U.js";
9
- import "../chunk-V4M4BZNW.js";
10
- import "../chunk-BKYQNNO3.js";
11
- import "../chunk-RGPB25DB.js";
12
- import "../chunk-FSZPQCDR.js";
13
- import "../chunk-HVR74IBG.js";
14
- import "../chunk-RBTZLXZJ.js";
8
+ } from "../chunk-T7IR4N2S.js";
9
+ import "../chunk-HTHRCGWP.js";
10
+ import "../chunk-D5UDZANO.js";
11
+ import "../chunk-ZVAFJQZB.js";
12
+ import "../chunk-OQLYMBJI.js";
13
+ import "../chunk-DJ23QZIN.js";
14
+ import "../chunk-SFD2LL7G.js";
15
15
  import "../chunk-LP7BEXCT.js";
16
- import "../chunk-QTDAPDDV.js";
17
- import "../chunk-5UGEGEIJ.js";
18
- import "../chunk-I64WQSN3.js";
16
+ import "../chunk-VJ4B3ZXY.js";
17
+ import "../chunk-3Y4OFWQJ.js";
18
+ import "../chunk-P7L3OQLL.js";
19
19
  import "../chunk-PZ5AY32C.js";
20
20
 
21
21
  // src/with-sync/active.ts
@@ -2,7 +2,7 @@ import {
2
2
  MemoryDeviceSealProvider,
3
3
  beginEchoUnlock,
4
4
  withTeam
5
- } from "../chunk-I7JF5TNL.js";
5
+ } from "../chunk-LBDTQM3R.js";
6
6
  import {
7
7
  NO_TEAM,
8
8
  burnPaperRecoveryEntry,
@@ -31,8 +31,8 @@ import {
31
31
  unwrapMagicLinkGrant,
32
32
  updateAuthenticator,
33
33
  writeMagicLinkGrant
34
- } from "../chunk-EEBMKMA7.js";
35
- import "../chunk-BMDF4TLU.js";
34
+ } from "../chunk-LAFP5H5U.js";
35
+ import "../chunk-DKYEVHZH.js";
36
36
  import {
37
37
  buildEchoBlock,
38
38
  buildRecipientKeyringFile,
@@ -53,20 +53,21 @@ import {
53
53
  updateKeyringIdentity,
54
54
  verifyPrompt,
55
55
  verifyTypedEcho
56
- } from "../chunk-WBHQX6ME.js";
57
- import "../chunk-QJBXB4WU.js";
58
- import "../chunk-YVOW35HH.js";
59
- import "../chunk-BKYQNNO3.js";
60
- import "../chunk-RGPB25DB.js";
61
- import "../chunk-FSZPQCDR.js";
62
- import "../chunk-HVR74IBG.js";
63
- import "../chunk-RBTZLXZJ.js";
56
+ } from "../chunk-E6WANBD6.js";
57
+ import "../chunk-JHO6FGZX.js";
58
+ import "../chunk-HTMQBBF3.js";
59
+ import "../chunk-47ZFULEZ.js";
60
+ import "../chunk-D5UDZANO.js";
61
+ import "../chunk-ZVAFJQZB.js";
62
+ import "../chunk-OQLYMBJI.js";
63
+ import "../chunk-DJ23QZIN.js";
64
+ import "../chunk-SFD2LL7G.js";
64
65
  import "../chunk-LP7BEXCT.js";
65
- import "../chunk-QTDAPDDV.js";
66
- import "../chunk-5UGEGEIJ.js";
66
+ import "../chunk-VJ4B3ZXY.js";
67
+ import "../chunk-3Y4OFWQJ.js";
67
68
  import {
68
69
  TeamNotEnabledError
69
- } from "../chunk-I64WQSN3.js";
70
+ } from "../chunk-P7L3OQLL.js";
70
71
  import "../chunk-PZ5AY32C.js";
71
72
  export {
72
73
  MemoryDeviceSealProvider,
@@ -11,19 +11,20 @@ import {
11
11
  putAtTier,
12
12
  syncDerivedOutputs,
13
13
  withTiers
14
- } from "../chunk-VUQZYVYX.js";
15
- import "../chunk-YVOW35HH.js";
16
- import "../chunk-BKYQNNO3.js";
17
- import "../chunk-RGPB25DB.js";
18
- import "../chunk-FSZPQCDR.js";
19
- import "../chunk-HVR74IBG.js";
20
- import "../chunk-RBTZLXZJ.js";
14
+ } from "../chunk-6S466CMQ.js";
15
+ import "../chunk-HTMQBBF3.js";
16
+ import "../chunk-47ZFULEZ.js";
17
+ import "../chunk-D5UDZANO.js";
18
+ import "../chunk-ZVAFJQZB.js";
19
+ import "../chunk-OQLYMBJI.js";
20
+ import "../chunk-DJ23QZIN.js";
21
+ import "../chunk-SFD2LL7G.js";
21
22
  import "../chunk-LP7BEXCT.js";
22
- import "../chunk-QTDAPDDV.js";
23
- import "../chunk-5UGEGEIJ.js";
23
+ import "../chunk-VJ4B3ZXY.js";
24
+ import "../chunk-3Y4OFWQJ.js";
24
25
  import {
25
26
  TiersNotEnabledError
26
- } from "../chunk-I64WQSN3.js";
27
+ } from "../chunk-P7L3OQLL.js";
27
28
  import "../chunk-PZ5AY32C.js";
28
29
  export {
29
30
  NO_TIERS,
package/dist/to/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  PodVersionConflictError,
6
6
  StoreCapabilityError,
7
7
  UnknownStoreKindError
8
- } from "../chunk-I64WQSN3.js";
8
+ } from "../chunk-P7L3OQLL.js";
9
9
  import "../chunk-PZ5AY32C.js";
10
10
 
11
11
  // src/port/to/locator.ts
@@ -3,16 +3,16 @@ import {
3
3
  TxContext,
4
4
  TxVault,
5
5
  runTransaction
6
- } from "../chunk-4444HN72.js";
6
+ } from "../chunk-GT72D4FO.js";
7
7
  import {
8
8
  lazy
9
9
  } from "../chunk-5D2ALSM5.js";
10
10
  import "../chunk-4AOERLTV.js";
11
- import "../chunk-I64WQSN3.js";
11
+ import "../chunk-P7L3OQLL.js";
12
12
  import "../chunk-PZ5AY32C.js";
13
13
 
14
14
  // src/with-commit/tx/dry-run.ts
15
- var loadGuardExecutor = lazy(() => import("../executor-WFTHIDT7.js"));
15
+ var loadGuardExecutor = lazy(() => import("../executor-LJSMZ4IB.js"));
16
16
  var SEP = " ";
17
17
  var keyOf = (op) => `${op.vaultName}${SEP}${op.collectionName}${SEP}${op.id}`;
18
18
  async function runDryRun(db, fn) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-PY4KJPYU.js";
4
4
  import {
5
5
  FilenameSanitizationError
6
- } from "../chunk-I64WQSN3.js";
6
+ } from "../chunk-P7L3OQLL.js";
7
7
  import "../chunk-PZ5AY32C.js";
8
8
 
9
9
  // src/kernel/util/sanitize-filename.ts
@@ -0,0 +1,111 @@
1
+ import {
2
+ DEFAULT_HEAD_BUCKETS,
3
+ NO_VAULT_HEAD,
4
+ VAULT_HEAD_COLLECTION
5
+ } from "../chunk-HK67PX4J.js";
6
+ import {
7
+ buildRecordAad,
8
+ openEnvelopeJson
9
+ } from "../chunk-D5UDZANO.js";
10
+ import {
11
+ buildRecordEnvelope
12
+ } from "../chunk-ZVAFJQZB.js";
13
+ import "../chunk-OQLYMBJI.js";
14
+ import "../chunk-DJ23QZIN.js";
15
+ import "../chunk-SFD2LL7G.js";
16
+ import "../chunk-LP7BEXCT.js";
17
+ import {
18
+ encrypt
19
+ } from "../chunk-VJ4B3ZXY.js";
20
+ import "../chunk-3Y4OFWQJ.js";
21
+ import "../chunk-P7L3OQLL.js";
22
+ import "../chunk-PZ5AY32C.js";
23
+
24
+ // src/with-commit/vault-head/head.ts
25
+ function bucketIndex(collection, id, buckets) {
26
+ let h = 2166136261;
27
+ const s = `${collection}/${id}`;
28
+ for (let i = 0; i < s.length; i++) {
29
+ h ^= s.charCodeAt(i);
30
+ h = Math.imul(h, 16777619) >>> 0;
31
+ }
32
+ return h % buckets;
33
+ }
34
+ function bucketId(collection, id, buckets) {
35
+ return `${collection}::${String(bucketIndex(collection, id, buckets))}`;
36
+ }
37
+ async function readBucket(store, vault, dek, bucket) {
38
+ const env = await store.get(vault, VAULT_HEAD_COLLECTION, bucket);
39
+ if (!env) return { body: {}, version: 0 };
40
+ const json = await openEnvelopeJson({ collection: VAULT_HEAD_COLLECTION, id: bucket }, env, dek);
41
+ return { body: JSON.parse(json), version: env._v };
42
+ }
43
+ async function writeBucket(store, vault, dek, bucket, body, expectedVersion) {
44
+ const identity = { collection: VAULT_HEAD_COLLECTION, id: bucket, version: expectedVersion + 1 };
45
+ const json = JSON.stringify(body);
46
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
47
+ const env = buildRecordEnvelope(identity, { iv, data });
48
+ await store.put(vault, VAULT_HEAD_COLLECTION, bucket, env, expectedVersion || void 0);
49
+ }
50
+
51
+ // src/with-commit/vault-head/active.ts
52
+ function withVaultHead(opts = {}) {
53
+ const buckets = opts.buckets ?? DEFAULT_HEAD_BUCKETS;
54
+ const dekFor = (getDEK) => getDEK(VAULT_HEAD_COLLECTION);
55
+ return {
56
+ enabled: true,
57
+ bucketFor: (collection, id) => bucketId(collection, id, buckets),
58
+ async note(store, vault, getDEK, entry) {
59
+ const dek = await dekFor(getDEK);
60
+ const bucket = bucketId(entry.collection, entry.id, buckets);
61
+ const { body, version } = await readBucket(store, vault, dek, bucket);
62
+ const key = `${entry.collection}/${entry.id}`;
63
+ if ((body[key] ?? -1) >= entry.version) return;
64
+ body[key] = entry.version;
65
+ await writeBucket(store, vault, dek, bucket, body, version);
66
+ },
67
+ async expected(store, vault, getDEK, collection, id) {
68
+ const dek = await dekFor(getDEK);
69
+ const { body } = await readBucket(store, vault, dek, bucketId(collection, id, buckets));
70
+ return body[`${collection}/${id}`] ?? null;
71
+ },
72
+ async knownIn(store, vault, getDEK, collection) {
73
+ const dek = await dekFor(getDEK);
74
+ const out = /* @__PURE__ */ new Map();
75
+ const prefix = `${collection}/`;
76
+ for (const bucket of await store.list(vault, VAULT_HEAD_COLLECTION)) {
77
+ if (!bucket.startsWith(`${collection}::`)) continue;
78
+ const { body } = await readBucket(store, vault, dek, bucket);
79
+ for (const [k, v] of Object.entries(body)) {
80
+ if (k.startsWith(prefix)) out.set(k.slice(prefix.length), v);
81
+ }
82
+ }
83
+ return out;
84
+ }
85
+ };
86
+ }
87
+
88
+ // src/with-commit/vault-head/verify.ts
89
+ async function verifyVaultHead(head, store, vault, getDEK, collection) {
90
+ const known = await head.knownIn(store, vault, getDEK, collection);
91
+ const discrepancies = [];
92
+ for (const [id, expected] of known) {
93
+ const env = await store.get(vault, collection, id);
94
+ if (env === null) {
95
+ discrepancies.push({ collection, id, expected, actual: null, kind: "withheld" });
96
+ continue;
97
+ }
98
+ if (env._v < expected) {
99
+ discrepancies.push({ collection, id, expected, actual: env._v, kind: "rolled-back" });
100
+ }
101
+ }
102
+ return { checked: known.size, discrepancies, clean: discrepancies.length === 0 };
103
+ }
104
+ export {
105
+ DEFAULT_HEAD_BUCKETS,
106
+ NO_VAULT_HEAD,
107
+ VAULT_HEAD_COLLECTION,
108
+ verifyVaultHead,
109
+ withVaultHead
110
+ };
111
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/with-commit/vault-head/head.ts","../../src/with-commit/vault-head/active.ts","../../src/with-commit/vault-head/verify.ts"],"sourcesContent":["/**\n * The vault head's storage layer (#1044).\n *\n * A bucket is an ordinary encrypted record at `_head/<collection>::<n>`, so it\n * inherits #1041's identity binding for free: the store cannot relocate a\n * bucket, re-author it, or serve one bucket's bytes as another's. What it can\n * still do is serve an OLD bucket, which is why {@link readBucket} enforces\n * monotonicity against the caller's own record of what it last wrote.\n *\n * @packageDocumentation\n */\nimport { encrypt, buildRecordAad, openEnvelopeJson, buildRecordEnvelope, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport type { NoydbStore } from '../../kernel/types.js'\nimport { VAULT_HEAD_COLLECTION } from './strategy.js'\n\n/** `{ recordId → version }` for one bucket. */\nexport type BucketBody = Record<string, number>\n\n/**\n * FNV-1a over `collection/id`. A hash, not a cipher: the bucket a record lands\n * in is not secret — the store already sees which bucket was written, and it\n * already saw the record's own address. Choosing something stronger would buy\n * nothing and cost every write.\n */\nexport function bucketIndex(collection: string, id: string, buckets: number): number {\n let h = 0x811c9dc5\n const s = `${collection}/${id}`\n for (let i = 0; i < s.length; i++) {\n h ^= s.charCodeAt(i)\n h = Math.imul(h, 0x01000193) >>> 0\n }\n return h % buckets\n}\n\nexport function bucketId(collection: string, id: string, buckets: number): string {\n return `${collection}::${String(bucketIndex(collection, id, buckets))}`\n}\n\nexport async function readBucket(\n store: NoydbStore,\n vault: string,\n dek: EnclaveKey,\n bucket: string,\n): Promise<{ body: BucketBody; version: number }> {\n const env = await store.get(vault, VAULT_HEAD_COLLECTION, bucket)\n if (!env) return { body: {}, version: 0 }\n const json = await openEnvelopeJson({ collection: VAULT_HEAD_COLLECTION, id: bucket }, env, dek)\n return { body: JSON.parse(json) as BucketBody, version: env._v }\n}\n\nexport async function writeBucket(\n store: NoydbStore,\n vault: string,\n dek: EnclaveKey,\n bucket: string,\n body: BucketBody,\n expectedVersion: number,\n): Promise<void> {\n const identity = { collection: VAULT_HEAD_COLLECTION, id: bucket, version: expectedVersion + 1 }\n const json = JSON.stringify(body)\n const { iv, data } = await encrypt(json, dek, buildRecordAad(identity))\n const env = buildRecordEnvelope(identity, { iv, data })\n // CAS: two writers racing on one bucket must not silently lose an entry.\n // A lost head entry is a record the sweep stops expecting — a false clean.\n await store.put(vault, VAULT_HEAD_COLLECTION, bucket, env, expectedVersion || undefined)\n}\n","/**\n * The real {@link VaultHeadStrategy} (#1044).\n *\n * @packageDocumentation\n */\nimport type { NoydbStore } from '../../kernel/types.js'\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\nimport {\n DEFAULT_HEAD_BUCKETS,\n VAULT_HEAD_COLLECTION,\n type HeadEntry,\n type VaultHeadStrategy,\n type WithVaultHeadOptions,\n} from './strategy.js'\nimport { bucketId, readBucket, writeBucket } from './head.js'\n\nexport function withVaultHead(opts: WithVaultHeadOptions = {}): VaultHeadStrategy {\n const buckets = opts.buckets ?? DEFAULT_HEAD_BUCKETS\n\n const dekFor = (getDEK: (c: string) => Promise<EnclaveKey>) => getDEK(VAULT_HEAD_COLLECTION)\n\n return {\n enabled: true,\n bucketFor: (collection, id) => bucketId(collection, id, buckets),\n\n async note(store: NoydbStore, vault, getDEK, entry: HeadEntry) {\n const dek = await dekFor(getDEK)\n const bucket = bucketId(entry.collection, entry.id, buckets)\n const { body, version } = await readBucket(store, vault, dek, bucket)\n const key = `${entry.collection}/${entry.id}`\n // Monotonic: a head entry never moves BACKWARD. A write that would lower\n // it is either a stale retry or a rollback being laundered through the\n // client's own head, and neither should be recorded.\n if ((body[key] ?? -1) >= entry.version) return\n body[key] = entry.version\n await writeBucket(store, vault, dek, bucket, body, version)\n },\n\n async expected(store, vault, getDEK, collection, id) {\n const dek = await dekFor(getDEK)\n const { body } = await readBucket(store, vault, dek, bucketId(collection, id, buckets))\n return body[`${collection}/${id}`] ?? null\n },\n\n async knownIn(store, vault, getDEK, collection) {\n const dek = await dekFor(getDEK)\n const out = new Map<string, number>()\n const prefix = `${collection}/`\n // Sweep every bucket: a record's bucket is a function of its id, so the\n // set for one collection is spread across all of them.\n for (const bucket of await store.list(vault, VAULT_HEAD_COLLECTION)) {\n if (!bucket.startsWith(`${collection}::`)) continue\n const { body } = await readBucket(store, vault, dek, bucket)\n for (const [k, v] of Object.entries(body)) {\n if (k.startsWith(prefix)) out.set(k.slice(prefix.length), v)\n }\n }\n return out\n },\n }\n}\n","/**\n * The sweep — comparing what the head expects against what the store serves (#1044).\n *\n * This is the only place absence becomes visible. #1041 and #1042 can reject a\n * record that lies about itself; neither can notice one that never arrived, or\n * one served at an older version than the client wrote. Both are indistinguishable\n * from the truth without an independent record of what should be there.\n *\n * @packageDocumentation\n */\nimport type { NoydbStore } from '../../kernel/types.js'\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\nimport type { VaultHeadStrategy } from './strategy.js'\n\n/** One record the store is not serving faithfully. */\nexport interface HeadDiscrepancy {\n readonly collection: string\n readonly id: string\n /** What the client last committed. */\n readonly expected: number\n /**\n * What the store serves now — or `null` when it serves nothing.\n *\n * The two are different attacks wearing the same result. `null` is\n * **suppression**: the record is gone. A lower number is **rollback**: an\n * authentic older version served in place of the current one, which is the\n * case no amount of per-envelope authentication can see.\n */\n readonly actual: number | null\n readonly kind: 'withheld' | 'rolled-back'\n}\n\nexport interface HeadVerifyResult {\n readonly checked: number\n readonly discrepancies: readonly HeadDiscrepancy[]\n /** `true` when every record the head knows about is served at or above its expected version. */\n readonly clean: boolean\n}\n\n/**\n * Sweep one collection.\n *\n * **A record the store serves that the head does NOT know is not reported.**\n * That is not an oversight: the head can be enabled on an existing vault, and\n * every pre-existing record would otherwise read as an anomaly. The head's\n * claim is one-directional — *what I wrote must still be there* — and an\n * unknown record simply falls outside it.\n *\n * **A HIGHER version than expected is also not reported**, for the same reason:\n * another device legitimately advanced it. The head detects going backwards, not\n * moving forwards.\n */\nexport async function verifyVaultHead(\n head: VaultHeadStrategy,\n store: NoydbStore,\n vault: string,\n getDEK: (collection: string) => Promise<EnclaveKey>,\n collection: string,\n): Promise<HeadVerifyResult> {\n const known = await head.knownIn(store, vault, getDEK, collection)\n const discrepancies: HeadDiscrepancy[] = []\n\n for (const [id, expected] of known) {\n const env = await store.get(vault, collection, id)\n if (env === null) {\n discrepancies.push({ collection, id, expected, actual: null, kind: 'withheld' })\n continue\n }\n if (env._v < expected) {\n discrepancies.push({ collection, id, expected, actual: env._v, kind: 'rolled-back' })\n }\n }\n\n return { checked: known.size, discrepancies, clean: discrepancies.length === 0 }\n}\n"],"mappings":"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","names":[]}
@@ -2,10 +2,10 @@ import {
2
2
  blindedEqual,
3
3
  evaluateKofN,
4
4
  openVdigPayload
5
- } from "./chunk-FSZPQCDR.js";
5
+ } from "./chunk-OQLYMBJI.js";
6
6
  import {
7
7
  dualReadSealedSlot
8
- } from "./chunk-HVR74IBG.js";
8
+ } from "./chunk-DJ23QZIN.js";
9
9
  import {
10
10
  VDIG_ITERATIONS,
11
11
  normalizeForVerify,
@@ -14,11 +14,11 @@ import {
14
14
  import {
15
15
  base64ToBuffer,
16
16
  generateSalt
17
- } from "./chunk-QTDAPDDV.js";
17
+ } from "./chunk-VJ4B3ZXY.js";
18
18
  import {
19
19
  ClassifiedConfigError,
20
20
  ClassifiedVerifyError
21
- } from "./chunk-I64WQSN3.js";
21
+ } from "./chunk-P7L3OQLL.js";
22
22
  import "./chunk-PZ5AY32C.js";
23
23
 
24
24
  // src/kernel/enclave/classify/verify.ts
@@ -137,4 +137,4 @@ export {
137
137
  verifyDigestField,
138
138
  verifyTextField
139
139
  };
140
- //# sourceMappingURL=verify-SHJXGZGM.js.map
140
+ //# sourceMappingURL=verify-J6DEOXP3.js.map
@@ -0,0 +1,21 @@
1
+ import {
2
+ dumpVaultSchema
3
+ } from "./chunk-SG3OQCRG.js";
4
+ import "./chunk-KHKKD62N.js";
5
+ import "./chunk-N7YAQKAO.js";
6
+ import "./chunk-Y2NBBT6K.js";
7
+ import "./chunk-YVTADFTC.js";
8
+ import "./chunk-D5UDZANO.js";
9
+ import "./chunk-ZVAFJQZB.js";
10
+ import "./chunk-OQLYMBJI.js";
11
+ import "./chunk-DJ23QZIN.js";
12
+ import "./chunk-SFD2LL7G.js";
13
+ import "./chunk-LP7BEXCT.js";
14
+ import "./chunk-VJ4B3ZXY.js";
15
+ import "./chunk-3Y4OFWQJ.js";
16
+ import "./chunk-P7L3OQLL.js";
17
+ import "./chunk-PZ5AY32C.js";
18
+ export {
19
+ dumpVaultSchema
20
+ };
21
+ //# sourceMappingURL=walk-BX4NSB5L.js.map
@@ -501,7 +501,7 @@ export interface ReadOnlyCollection<T> {
501
501
  * @internal — called by Vault methods that need the closed-period
502
502
  * cache. Not part of the public API surface.
503
503
  */
504
- export declare function loadPeriods(adapter: NoydbStore, vault: string, decrypt: (envelope: EncryptedEnvelope) => Promise<PeriodRecord>): Promise<PeriodRecord[]>;
504
+ export declare function loadPeriods(adapter: NoydbStore, vault: string, decrypt: (id: string, envelope: EncryptedEnvelope) => Promise<PeriodRecord>): Promise<PeriodRecord[]>;
505
505
  /**
506
506
  * Given the current ordered period list, pick the last entry that
507
507
  * belongs to the hash chain — used as the `priorPeriodHash` anchor
@@ -17,7 +17,7 @@ import type { PeriodRecord, PeriodPartition, PartitionResolver } from './periods
17
17
  * @internal
18
18
  */
19
19
  export interface PeriodsStrategy {
20
- loadPeriods(adapter: NoydbStore, vault: string, decrypt: (envelope: EncryptedEnvelope) => Promise<PeriodRecord>): Promise<PeriodRecord[]>;
20
+ loadPeriods(adapter: NoydbStore, vault: string, decrypt: (id: string, envelope: EncryptedEnvelope) => Promise<PeriodRecord>): Promise<PeriodRecord[]>;
21
21
  chainAnchor(records: readonly PeriodRecord[], partition?: PeriodPartition): Promise<{
22
22
  priorPeriodName?: string;
23
23
  priorPeriodHash: string;
@@ -46,10 +46,23 @@ export { SealedRecordNotEnabledError } from '../../kernel/errors.js';
46
46
  * @param expectedCollection Collection the caller believes `recordEnvelope` is in.
47
47
  * @param expectedId Record id the caller believes `recordEnvelope` is.
48
48
  * @returns The decrypted record body as a JSON string.
49
+ *
50
+ * ⚠️ **`recordEnvelope` must carry `_tier` and `_by`, not just the body**
51
+ * (#1041). They are plaintext metadata rather than secrets, but they are bound
52
+ * into the record's AAD, so a host handed only `{_iv, _data}` cannot
53
+ * reconstruct the identity the body was sealed against.
54
+ *
55
+ * That is a feature, not a tax: it means a host cannot be fed a body with its
56
+ * tags stripped or rewritten — a re-tiered or re-authored envelope no longer
57
+ * opens, even with a valid sealed CEK.
49
58
  */
50
59
  export declare function openSealedRecord(sealedCekEnvelope: SealedCekDeliveryEnvelope, recordEnvelope: {
51
60
  readonly _iv: string;
52
61
  readonly _data: string;
62
+ /** Bound into the AAD since #1093 — a rewound body no longer opens. */
63
+ readonly _v: number;
64
+ readonly _tier?: number | undefined;
65
+ readonly _by?: string | undefined;
53
66
  }, recipientSealer: {
54
67
  unseal(bytes: Uint8Array): Promise<Uint8Array>;
55
68
  }, expectedCollection: string, expectedId: string): Promise<string>;
@@ -23,7 +23,7 @@
23
23
  export { withTiers } from './active.js';
24
24
  export { NO_TIERS, type TiersStrategy } from './strategy.js';
25
25
  export { TiersNotEnabledError } from '../../kernel/errors.js';
26
- import { type RecordCodec, type EnclaveKey, type SealedShredSlot } from '../../kernel/enclave/index.js';
26
+ import { type RecordIdentity, type RecordCodec, type EnclaveKey, type SealedShredSlot } from '../../kernel/enclave/index.js';
27
27
  import type { UnlockedKeyring } from '../../with-party/team/keyring.js';
28
28
  import type { Lru } from '../../kernel/cache/index.js';
29
29
  import type { BlobFieldsConfig } from '../../with-shape/blobs/blob-compaction.js';
@@ -123,7 +123,22 @@ export interface TiersContext<T> {
123
123
  * pre-move body whenever `fromTier > 0`. No-op when history is disabled
124
124
  * (folds the `historyConfig.enabled` gate so `tiers/index.ts` stays simple).
125
125
  */
126
- saveHistorySnapshot(id: string, envelope: EncryptedEnvelope): Promise<void>;
126
+ /**
127
+ * Persist a `_history` snapshot of `version`, sealed against the address it
128
+ * will be STORED at (#1041).
129
+ *
130
+ * Takes a **sealer**, not a finished envelope, because the destination
131
+ * identity is not knowable here: only the history strategy owns the
132
+ * `_history` layout. It hands the address in; the caller seals to it.
133
+ *
134
+ * ⚠️ The identity passed to `rewrapBodyToDek` must be what a READER will
135
+ * recompute — `recordAadFor(address, finalEnvelope)`. A tier-move snapshot
136
+ * strips `_tier`/`_elevatedBy` but KEEPS `_by`, so the destination is
137
+ * `{...address, by: envelope._by}` with no tier. Sealing against the bare
138
+ * address would produce history nothing can open, and the failure would
139
+ * surface only when someone reads it.
140
+ */
141
+ saveHistorySnapshot(id: string, version: number, seal: (address: RecordIdentity) => Promise<EncryptedEnvelope>): Promise<void>;
127
142
  /**
128
143
  * `true` iff a real history strategy is wired (not `NO_HISTORY`) AND not
129
144
  * explicitly disabled via `historyConfig.enabled`. `putAtTier` checks this
@@ -1,5 +1,31 @@
1
+ import type { RecordIdentity } from '../../kernel/enclave/index.js';
1
2
  import type { NoydbStore, EncryptedEnvelope, HistoryOptions, PruneOptions } from '../../kernel/types.js';
2
3
  import { type EnclaveKey } from '../../kernel/enclave/index.js';
4
+ /**
5
+ * The identity a history snapshot is **sealed against** — its STORAGE location,
6
+ * not the live record it is a copy of (#1041).
7
+ *
8
+ * ## Why storage, and why this is a decision rather than a detail
9
+ *
10
+ * A snapshot is a copy, so two identities are available: the live record
11
+ * (`collection`/`recordId`) or where the bytes actually land
12
+ * (`_history`/`historyId(...)`). They are not equivalent under attack.
13
+ *
14
+ * Binding the LIVE identity makes a snapshot's AAD **indistinguishable from the
15
+ * live record's at the same version** — so an untrusted store could serve a
16
+ * history entry *as the current record* and the client would accept it. It also
17
+ * leaves entries relocatable within `_history`.
18
+ *
19
+ * Binding STORAGE identity closes both. The cost is that the id must be known
20
+ * *before* the envelope is sealed, where `saveHistory` previously derived it
21
+ * *after* (from `envelope._v`) — which is precisely the restructure this
22
+ * function exists to make possible.
23
+ *
24
+ * `saveHistory` uses this too, so the sealed identity and the put location have
25
+ * **one definition** and cannot drift apart. Changing the layout here changes
26
+ * both at once, by construction.
27
+ */
28
+ export declare function historyIdentity(collection: string, recordId: string, version: number): RecordIdentity;
3
29
  /** Save a history entry (a complete encrypted envelope snapshot). */
4
30
  export declare function saveHistory(adapter: NoydbStore, vault: string, collection: string, recordId: string, envelope: EncryptedEnvelope): Promise<void>;
5
31
  /** Get history entries for a record, sorted newest-first. */
@@ -17,7 +17,7 @@
17
17
  */
18
18
  export { withHistory } from './active.js';
19
19
  export type { HistoryStrategy } from './strategy.js';
20
- export { saveHistory, getHistory, getVersionEnvelope, pruneHistory, clearHistory, } from './history.js';
20
+ export { saveHistory, historyIdentity, getHistory, getVersionEnvelope, pruneHistory, clearHistory, } from './history.js';
21
21
  export { diff, formatDiff } from './diff.js';
22
22
  export type { ChangeType, DiffEntry } from './diff.js';
23
23
  export { LedgerStore, LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION, envelopePayloadHash, } from './ledger/store.js';
@@ -30,3 +30,4 @@ export { VaultInstant, CollectionInstant } from './time-machine.js';
30
30
  export type { VaultEngine } from './time-machine.js';
31
31
  /** The un-opted-in stub for this service — exported so callers can compare against it (#844). */
32
32
  export { NO_HISTORY } from './strategy.js';
33
+ export type { RecordIdentity } from '../../kernel/enclave/index.js';
@@ -237,7 +237,13 @@ export declare class LedgerStore {
237
237
  * version/timestamp/actor) fully intact for audit purposes.
238
238
  */
239
239
  purgeRecordDeltas(collection: string, id: string): Promise<number>;
240
- /** Encrypt a JSON Patch into an envelope for storage. Mirrors encryptEntry. */
240
+ /**
241
+ * Encrypt a JSON Patch into an envelope for storage. Mirrors encryptEntry.
242
+ *
243
+ * `index` is the ledger index this delta will be stored under — the caller
244
+ * knows it before the entry exists, and it is what makes the envelope's
245
+ * identity bindable (#1051).
246
+ */
241
247
  private encryptDelta;
242
248
  /**
243
249
  * Read all entries in ascending-index order. Used internally by
@@ -33,7 +33,7 @@ import type { LedgerStore } from './ledger/store.js';
33
33
  import type { JsonPatch } from './ledger/patch.js';
34
34
  import type { DiffEntry } from './diff.js';
35
35
  import type { VaultInstant, VaultEngine } from './time-machine.js';
36
- import type { EnclaveKey } from '../../kernel/enclave/index.js';
36
+ import type { EnclaveKey, RecordIdentity } from '../../kernel/enclave/index.js';
37
37
  /**
38
38
  * Options accepted by `HistoryStrategy.buildLedger`. Mirrors the
39
39
  * `LedgerStore` constructor verbatim — kept in this file so `core`
@@ -58,6 +58,16 @@ export interface HistoryStrategy {
58
58
  * `NO_HISTORY`.
59
59
  */
60
60
  saveHistory(adapter: NoydbStore, vault: string, collection: string, recordId: string, envelope: EncryptedEnvelope): Promise<void>;
61
+ /**
62
+ * The identity a snapshot of `collection/recordId@version` must be **sealed
63
+ * against** — its `_history` storage location (#1041).
64
+ *
65
+ * On the port because the kernel writes history snapshots but must not import
66
+ * `with-commit` to learn its layout. Exposing it here keeps the derivation in
67
+ * the module that owns the layout, and `saveHistory` uses the same function,
68
+ * so the sealed identity and the put location cannot drift.
69
+ */
70
+ historyIdentity(collection: string, recordId: string, version: number): RecordIdentity;
61
71
  /**
62
72
  * List history envelopes for a record, newest first. Throws under
63
73
  * `NO_HISTORY` — callers reach this via `collection.history()` /
@@ -0,0 +1,2 @@
1
+ import { type VaultHeadStrategy, type WithVaultHeadOptions } from './strategy.js';
2
+ export declare function withVaultHead(opts?: WithVaultHeadOptions): VaultHeadStrategy;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The vault head's storage layer (#1044).
3
+ *
4
+ * A bucket is an ordinary encrypted record at `_head/<collection>::<n>`, so it
5
+ * inherits #1041's identity binding for free: the store cannot relocate a
6
+ * bucket, re-author it, or serve one bucket's bytes as another's. What it can
7
+ * still do is serve an OLD bucket, which is why {@link readBucket} enforces
8
+ * monotonicity against the caller's own record of what it last wrote.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import { type EnclaveKey } from '../../kernel/enclave/index.js';
13
+ import type { NoydbStore } from '../../kernel/types.js';
14
+ /** `{ recordId → version }` for one bucket. */
15
+ export type BucketBody = Record<string, number>;
16
+ /**
17
+ * FNV-1a over `collection/id`. A hash, not a cipher: the bucket a record lands
18
+ * in is not secret — the store already sees which bucket was written, and it
19
+ * already saw the record's own address. Choosing something stronger would buy
20
+ * nothing and cost every write.
21
+ */
22
+ export declare function bucketIndex(collection: string, id: string, buckets: number): number;
23
+ export declare function bucketId(collection: string, id: string, buckets: number): string;
24
+ export declare function readBucket(store: NoydbStore, vault: string, dek: EnclaveKey, bucket: string): Promise<{
25
+ body: BucketBody;
26
+ version: number;
27
+ }>;
28
+ export declare function writeBucket(store: NoydbStore, vault: string, dek: EnclaveKey, bucket: string, body: BucketBody, expectedVersion: number): Promise<void>;