@delali/narsil 0.3.1-next.152 → 0.3.1-next.154

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 (268) hide show
  1. package/README.md +2 -1
  2. package/dist/adapters/filesystem.mjs +2 -2
  3. package/dist/adapters/gcs.mjs +2 -2
  4. package/dist/adapters/indexeddb.mjs +1 -1
  5. package/dist/adapters/s3.mjs +2 -2
  6. package/dist/{analysis-change-2OYM7ARW.mjs → analysis-change-4GCRVRBW.mjs} +27 -18
  7. package/dist/{react-native/chunks/analysis-change-entry-CXNRW324.mjs → analysis-change-entry-KYGSXW4K.mjs} +1 -1
  8. package/dist/browser/{analysis-change-2V2HZ2NY.mjs → analysis-change-IXWPXXJJ.mjs} +17 -7
  9. package/dist/{analysis-change-entry-QD7YNDEE.mjs → browser/analysis-change-entry-FCSHFQSS.mjs} +1 -1
  10. package/dist/browser/{chunk-TQ5UMFG5.mjs → chunk-2FX6ROWR.mjs} +15 -6
  11. package/dist/browser/{chunk-KWYQ6KX4.mjs → chunk-2SHAKW2Z.mjs} +119 -1922
  12. package/dist/browser/{chunk-55WYRLDZ.mjs → chunk-3U3QR5YP.mjs} +2 -2
  13. package/dist/browser/chunk-4PD752F6.mjs +85 -0
  14. package/dist/browser/chunk-5W3MMTLG.mjs +19 -0
  15. package/dist/browser/{chunk-IAXZAVYL.mjs → chunk-7MEYN7V6.mjs} +1 -151
  16. package/dist/browser/chunk-7TTWXUH6.mjs +1828 -0
  17. package/dist/browser/{chunk-CSCKZBVJ.mjs → chunk-AJ4HHOVT.mjs} +4 -4
  18. package/dist/{react-native/chunks/chunk-DFQJ4IJB.mjs → browser/chunk-AYY6PIKL.mjs} +2 -2
  19. package/dist/browser/{chunk-VD7JEUIR.mjs → chunk-C4KS2QNF.mjs} +9 -8
  20. package/dist/browser/chunk-DSXIBE6N.mjs +78 -0
  21. package/dist/browser/chunk-ELV4OZOI.mjs +29 -0
  22. package/dist/browser/{chunk-PM4MUM5N.mjs → chunk-EUNBNLKM.mjs} +6 -5
  23. package/dist/browser/{chunk-GJKXW3SF.mjs → chunk-G7LUMBSG.mjs} +137 -253
  24. package/dist/browser/{chunk-B3JM6Z74.mjs → chunk-H6QFBMVE.mjs} +3 -2
  25. package/dist/browser/chunk-J433A7P3.mjs +241 -0
  26. package/dist/browser/chunk-ML6HY7T7.mjs +96 -0
  27. package/dist/browser/chunk-ML7THVLJ.mjs +38 -0
  28. package/dist/{chunk-MDF6PDIA.mjs → browser/chunk-MYITLCHT.mjs} +7 -1
  29. package/dist/browser/{chunk-QJCO3TJU.mjs → chunk-QXTPSX2H.mjs} +9 -150
  30. package/dist/browser/{chunk-MPK76GVS.mjs → chunk-RA6LSBCM.mjs} +1 -21
  31. package/dist/browser/{chunk-7ZJTRUVW.mjs → chunk-SIR3LMTV.mjs} +2 -2
  32. package/dist/browser/{chunk-LURXVCHG.mjs → chunk-SJB6VIZG.mjs} +1 -1
  33. package/dist/browser/chunk-TTD27VXX.mjs +298 -0
  34. package/dist/browser/chunk-U2E3HMYW.mjs +151 -0
  35. package/dist/browser/{chunk-2A2IPRC3.mjs → chunk-VCOYGVP7.mjs} +5 -31
  36. package/dist/browser/chunk-VI7BQR4U.mjs +21 -0
  37. package/dist/browser/chunk-W5X2UFWQ.mjs +102 -0
  38. package/dist/browser/{chunk-HT7J73QL.mjs → chunk-XRV72TJD.mjs} +2 -2
  39. package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
  40. package/dist/browser/chunk-ZI2V4VD7.mjs +21 -0
  41. package/dist/{react-native/chunks/chunk-QC4ZRBSX.mjs → browser/chunk-ZPTA75ZC.mjs} +2 -79
  42. package/dist/browser/{cold-module-YECAK4MN.mjs → cold-module-VTUGDYNY.mjs} +20 -14
  43. package/dist/browser/{durability-wiring-LM7WFL6X.mjs → durability-wiring-GL4A7KDV.mjs} +1886 -1364
  44. package/dist/browser/import-YI5GNB4H.mjs +17 -0
  45. package/dist/browser/methods-LMUTS7OI.mjs +30 -0
  46. package/dist/browser/{module-XQLEOYNM.mjs → module-EC3FYW7N.mjs} +9 -8
  47. package/dist/browser/{module-KAMRAJLE.mjs → module-M4JNBV6V.mjs} +16 -10
  48. package/dist/browser/operations-WVYLF72Q.mjs +5 -0
  49. package/dist/browser/{phrase-module-CNKMUY4U.mjs → phrase-module-NPYUVX75.mjs} +1 -1
  50. package/dist/browser/{pool-DTYSPBMQ.mjs → pool-WCGDZHJP.mjs} +3 -2
  51. package/dist/{restore-queue-AOF5OTQV.mjs → browser/restore-queue-TYIGDL5L.mjs} +2 -2
  52. package/dist/browser/retention-6QMRS5VK.mjs +207 -0
  53. package/dist/browser/{runtime-D2ULZGCN.mjs → runtime-3EW2AGB6.mjs} +1 -1
  54. package/dist/browser/{snapshot-UGZVMP4H.mjs → snapshot-DN3CRVUQ.mjs} +38 -307
  55. package/dist/browser/sync-state-P5XG6LTQ.mjs +15 -0
  56. package/dist/browser/{write-I5P5MW4O.mjs → write-WAWAFGKQ.mjs} +16 -11
  57. package/dist/{capabilities-BT-HLDC8.d.ts → capabilities-B3Brs1Rc.d.ts} +62 -7
  58. package/dist/{chunk-DGRM4EZZ.mjs → chunk-37IVJLP6.mjs} +1 -1
  59. package/dist/{chunk-KYVRZAYP.mjs → chunk-3A5KI24C.mjs} +2 -69
  60. package/dist/{chunk-POUYICOU.mjs → chunk-3OFU3NJT.mjs} +1 -1
  61. package/dist/{chunk-3TVDTACC.mjs → chunk-3Y3J4V2R.mjs} +1 -1
  62. package/dist/{chunk-FNBNZCGP.mjs → chunk-466PYR4P.mjs} +2 -2
  63. package/dist/{chunk-SEAJS664.mjs → chunk-4HWZV5MK.mjs} +5 -5
  64. package/dist/{chunk-UGVUW27S.mjs → chunk-5FUOVJKG.mjs} +13 -9
  65. package/dist/{chunk-ZHAXP7SD.mjs → chunk-5KGYQT6W.mjs} +6 -235
  66. package/dist/{chunk-NPXVQS33.mjs → chunk-62G63NMH.mjs} +4 -3
  67. package/dist/chunk-6MSZ543Y.mjs +32 -0
  68. package/dist/chunk-7GXJUJ24.mjs +49 -0
  69. package/dist/{chunk-3E4RRF5J.mjs → chunk-7HCZWC7B.mjs} +58 -8
  70. package/dist/{chunk-6RKSY3BX.mjs → chunk-7NTMUDC5.mjs} +5 -5
  71. package/dist/chunk-7QUGDVFC.mjs +101 -0
  72. package/dist/{chunk-G5KHSM6E.mjs → chunk-AO2FAYIZ.mjs} +1 -1
  73. package/dist/chunk-B7S6YEBP.mjs +102 -0
  74. package/dist/{chunk-AWNHDBKV.mjs → chunk-BPSKLCS7.mjs} +15 -7
  75. package/dist/chunk-BUMREPLU.mjs +15 -0
  76. package/dist/{chunk-T4CJDBBE.mjs → chunk-C6ASEFZI.mjs} +1 -1
  77. package/dist/{chunk-NITCPDFL.mjs → chunk-C73JLU4E.mjs} +2 -2
  78. package/dist/{chunk-NYSONUB7.mjs → chunk-CP5RRPJR.mjs} +1 -1
  79. package/dist/{chunk-TTCKT2RT.mjs → chunk-DMQPFLGI.mjs} +134 -11
  80. package/dist/{chunk-3SBJVQLL.mjs → chunk-DVWYODEB.mjs} +2 -2
  81. package/dist/chunk-ECX4SGX6.mjs +167 -0
  82. package/dist/chunk-GES7U2PM.mjs +68 -0
  83. package/dist/{chunk-NVTFQFUL.mjs → chunk-HVKXNBFL.mjs} +1 -1
  84. package/dist/chunk-HVYICDY3.mjs +214 -0
  85. package/dist/{chunk-3HV7M5OJ.mjs → chunk-HWEDFLB7.mjs} +9 -133
  86. package/dist/{chunk-52QQWEBS.mjs → chunk-IBNLW3AV.mjs} +21 -6
  87. package/dist/chunk-IJU7LL7D.mjs +242 -0
  88. package/dist/chunk-IPN7S4KX.mjs +130 -0
  89. package/dist/{chunk-5QMHMELB.mjs → chunk-IQ4R2I6N.mjs} +4 -1
  90. package/dist/chunk-JCLTESFN.mjs +96 -0
  91. package/dist/{chunk-J4BDAH2W.mjs → chunk-JFNKIBDT.mjs} +2 -2
  92. package/dist/{chunk-LDGGR7YT.mjs → chunk-K4B7OH65.mjs} +2 -2
  93. package/dist/{chunk-7TE2AJIH.mjs → chunk-K7KLL263.mjs} +13 -10
  94. package/dist/{chunk-CSHHU7PA.mjs → chunk-KCUIFVVW.mjs} +11 -30
  95. package/dist/{react-native/chunks/chunk-YH7W556M.mjs → chunk-KUZKUONM.mjs} +11 -2
  96. package/dist/chunk-KYYABCSW.mjs +72 -0
  97. package/dist/{chunk-B2FTZNNF.mjs → chunk-LKUE5GXS.mjs} +34 -14
  98. package/dist/{chunk-2PNYKG2D.mjs → chunk-LSM2YTKM.mjs} +100 -335
  99. package/dist/{chunk-DMNPYF54.mjs → chunk-LTUGDMV4.mjs} +2 -2
  100. package/dist/{chunk-FDG4KXX5.mjs → chunk-MLHNSAPK.mjs} +5 -3
  101. package/dist/{chunk-VP6XRMWR.mjs → chunk-MMBEANB2.mjs} +6 -32
  102. package/dist/{chunk-LJ4ENXOD.mjs → chunk-MMEMEUOO.mjs} +2 -2
  103. package/dist/{chunk-2HJWQPR6.mjs → chunk-NTZOXVUZ.mjs} +6 -122
  104. package/dist/{chunk-5WB2A3XU.mjs → chunk-NZMAXR2S.mjs} +397 -24
  105. package/dist/{chunk-IZT3G24Q.mjs → chunk-O43Z4MS6.mjs} +2 -2
  106. package/dist/{chunk-U46IZNCW.mjs → chunk-OKX2BBNW.mjs} +3 -2
  107. package/dist/{chunk-RBEHLIKX.mjs → chunk-PFKM7VNZ.mjs} +14 -8
  108. package/dist/chunk-PGVPE7GJ.mjs +96 -0
  109. package/dist/chunk-Q3TCTQCC.mjs +85 -0
  110. package/dist/chunk-Q7MS6P2J.mjs +74 -0
  111. package/dist/chunk-QDZJM7NI.mjs +23 -0
  112. package/dist/{chunk-ZS6CMXAE.mjs → chunk-QKZHLADX.mjs} +89 -250
  113. package/dist/{chunk-IJSFWGVW.mjs → chunk-REL7LFLR.mjs} +3 -3
  114. package/dist/chunk-RVKFI3A2.mjs +237 -0
  115. package/dist/chunk-S2N75OTN.mjs +83 -0
  116. package/dist/chunk-TRISKD4Q.mjs +50 -0
  117. package/dist/{chunk-6F6USYII.mjs → chunk-TV2L3BN7.mjs} +13 -11
  118. package/dist/{chunk-6BWLDLS3.mjs → chunk-URPCYQVJ.mjs} +1 -1
  119. package/dist/chunk-USR7FQRZ.mjs +34 -0
  120. package/dist/chunk-V6EUBAIT.mjs +19 -0
  121. package/dist/{chunk-SOUZMPME.mjs → chunk-VMXSVVXG.mjs} +7 -194
  122. package/dist/{chunk-4QCSHLNM.mjs → chunk-VREK3MYG.mjs} +3 -3
  123. package/dist/{chunk-YGQOPB2Z.mjs → chunk-WCBA2LVZ.mjs} +1 -1
  124. package/dist/{chunk-KQJVNPRM.mjs → chunk-X6NSJYQ3.mjs} +19 -16
  125. package/dist/chunk-Y4WPNHMC.mjs +50 -0
  126. package/dist/{chunk-IRWP524D.mjs → chunk-YBJDOA2T.mjs} +1 -1
  127. package/dist/{chunk-IJPK5PGM.mjs → chunk-YPUEV6ZC.mjs} +1 -1
  128. package/dist/{chunk-J7M73VY7.mjs → chunk-YROWNOMH.mjs} +1 -1
  129. package/dist/chunk-Z3TNWCI5.mjs +196 -0
  130. package/dist/{chunk-65WCV5JO.mjs → chunk-ZIFJXCKA.mjs} +1 -1
  131. package/dist/chunk-ZYAY26KG.mjs +29 -0
  132. package/dist/{client-Cn3gNxUU.d.ts → client-Df76GNKm.d.ts} +76 -6
  133. package/dist/client.d.ts +8 -7
  134. package/dist/client.mjs +56 -5
  135. package/dist/{cold-module-PYSSBIL7.mjs → cold-module-YLWMTTZG.mjs} +38 -28
  136. package/dist/{config-CfhH1IWQ.d.ts → config-05G_hy-1.d.ts} +3 -3
  137. package/dist/config-B8DP2VwR.d.ts +463 -0
  138. package/dist/{direct-executor-WYALQSMD.mjs → direct-executor-FI5GJHWX.mjs} +14 -9
  139. package/dist/distribution/coordinator/etcd.d.ts +11 -2
  140. package/dist/distribution/coordinator/etcd.mjs +268 -107
  141. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  142. package/dist/distribution/transport/grpc.mjs +4 -4
  143. package/dist/distribution/transport/in-memory.mjs +2 -2
  144. package/dist/distribution/transport/tcp.mjs +3 -3
  145. package/dist/distribution.d.ts +41 -9
  146. package/dist/distribution.mjs +1296 -117
  147. package/dist/{durability-wiring-7VBZEJLG.mjs → durability-wiring-RHLXDIVF.mjs} +1751 -1226
  148. package/dist/embeddings/openai.mjs +2 -2
  149. package/dist/{engine-CJRUHXgf.d.ts → engine-DYu-e0oR.d.ts} +50 -40
  150. package/dist/{import-GJOMB2HC.mjs → import-SRBNC6TE.mjs} +27 -19
  151. package/dist/{index-MsF7e5hL.d.ts → index-nRqDM6uS.d.ts} +1 -1
  152. package/dist/index.browser.mjs +8 -4
  153. package/dist/index.d.ts +7 -6
  154. package/dist/index.mjs +24 -16
  155. package/dist/index.react-native.mjs +17 -11
  156. package/dist/{long-query-thread-SCUE62TO.mjs → long-query-thread-EMYTGSJP.mjs} +28 -15
  157. package/dist/methods-ABM5ELBR.mjs +30 -0
  158. package/dist/{module-AVQEIB7O.mjs → module-3OMJZUFT.mjs} +12 -12
  159. package/dist/{module-6RLIKSZQ.mjs → module-MG7JMV2U.mjs} +33 -23
  160. package/dist/operations-PGOAY2KS.mjs +5 -0
  161. package/dist/{paged-partition-archive-KGRW366Y.mjs → paged-partition-archive-UOLHOEZJ.mjs} +37 -26
  162. package/dist/partial-words.mjs +6 -4
  163. package/dist/pattern.mjs +4 -3
  164. package/dist/persistence/durability/checkpoint-worker.d.ts +9 -1
  165. package/dist/persistence/durability/checkpoint-worker.mjs +34 -23
  166. package/dist/{phrase-module-OUQIRUQU.mjs → phrase-module-O3MDRQXP.mjs} +1 -1
  167. package/dist/{pool-UPV5PVPY.mjs → pool-CQXYPFLG.mjs} +2 -2
  168. package/dist/react-native/chunks/{analysis-change-DXPZRGWF.mjs → analysis-change-EAYO3Y6Q.mjs} +27 -15
  169. package/dist/{browser/analysis-change-entry-JL5U2N3Q.mjs → react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs} +1 -1
  170. package/dist/react-native/chunks/{chunk-D7LFYPYI.mjs → chunk-2CGSQM4O.mjs} +12 -10
  171. package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +1 -0
  172. package/dist/react-native/chunks/{chunk-R4OPUZQ5.mjs → chunk-3O57C2ZO.mjs} +2 -2
  173. package/dist/react-native/chunks/chunk-3XKMRNRE.mjs +298 -0
  174. package/dist/react-native/chunks/{chunk-IDFMNRIC.mjs → chunk-63YSZOXB.mjs} +97 -333
  175. package/dist/react-native/chunks/{chunk-UFNCLEQM.mjs → chunk-75VWIY35.mjs} +1 -1
  176. package/dist/react-native/chunks/{chunk-2J2727V4.mjs → chunk-7GWPJDOA.mjs} +1 -1
  177. package/dist/react-native/chunks/{chunk-PU55IOG4.mjs → chunk-AUT7PMA4.mjs} +6 -190
  178. package/dist/react-native/chunks/chunk-C2H2QQFW.mjs +288 -0
  179. package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +43 -0
  180. package/dist/{browser/chunk-PIS7ZAP7.mjs → react-native/chunks/chunk-CUNGPR5R.mjs} +11 -2
  181. package/dist/{browser/chunk-NVEJJP4R.mjs → react-native/chunks/chunk-DCKMICOB.mjs} +2 -79
  182. package/dist/react-native/chunks/chunk-DH3TVWWK.mjs +102 -0
  183. package/dist/react-native/chunks/{chunk-ZCKNBPQ4.mjs → chunk-EH5CFV6Z.mjs} +2 -2
  184. package/dist/react-native/chunks/chunk-F753DA54.mjs +23 -0
  185. package/dist/{browser/chunk-VBX2TI5V.mjs → react-native/chunks/chunk-GFYFQLJD.mjs} +2 -2
  186. package/dist/react-native/chunks/{chunk-7IQR3SZO.mjs → chunk-I5PGWQJF.mjs} +142 -257
  187. package/dist/react-native/chunks/{chunk-NFGBOI46.mjs → chunk-IOY2SM2P.mjs} +1 -1
  188. package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +38 -0
  189. package/dist/react-native/chunks/{chunk-TLYD7IJ2.mjs → chunk-JPAJWO6D.mjs} +1 -1
  190. package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +15 -0
  191. package/dist/react-native/chunks/{chunk-KLZGAOLT.mjs → chunk-JX2RIAXH.mjs} +4 -4
  192. package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +68 -0
  193. package/dist/react-native/chunks/{chunk-LQAKO5QV.mjs → chunk-NCJS3WIY.mjs} +2 -2
  194. package/dist/react-native/chunks/{chunk-BRNAVOKP.mjs → chunk-NKIZX26F.mjs} +2 -2
  195. package/dist/react-native/chunks/{chunk-CLE3LZ77.mjs → chunk-NP7DD4G5.mjs} +5 -4
  196. package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +78 -0
  197. package/dist/react-native/chunks/chunk-O32RB3BL.mjs +191 -0
  198. package/dist/react-native/chunks/{chunk-DKJTZ625.mjs → chunk-OQQVRWZ2.mjs} +2 -69
  199. package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +29 -0
  200. package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
  201. package/dist/react-native/chunks/{chunk-LRGWK367.mjs → chunk-RVAEBN74.mjs} +1 -1
  202. package/dist/react-native/chunks/{chunk-KOCTCUXW.mjs → chunk-RYMDHGL4.mjs} +16 -8
  203. package/dist/react-native/chunks/chunk-SJWDBRNP.mjs +85 -0
  204. package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +68 -0
  205. package/dist/react-native/chunks/chunk-UWDNZDWK.mjs +242 -0
  206. package/dist/react-native/chunks/{chunk-FS7BYE23.mjs → chunk-VQSKZ3EZ.mjs} +9 -152
  207. package/dist/react-native/chunks/{chunk-UCJU6WNH.mjs → chunk-VVFYOADG.mjs} +7 -6
  208. package/dist/react-native/chunks/{chunk-VGUWIZFQ.mjs → chunk-YBEW6YTR.mjs} +1 -1
  209. package/dist/react-native/chunks/{chunk-JYL35A4A.mjs → chunk-YHKZSLOC.mjs} +7 -33
  210. package/dist/react-native/chunks/{chunk-3CTWSQRW.mjs → chunk-ZBSWRSBG.mjs} +4 -30
  211. package/dist/react-native/chunks/chunk-ZYDKJXQJ.mjs +96 -0
  212. package/dist/react-native/chunks/{cold-module-KFGEWYEL.mjs → cold-module-TJL6AFAD.mjs} +29 -21
  213. package/dist/react-native/chunks/{durability-wiring-QKJB2QBT.mjs → durability-wiring-RRDYJLLM.mjs} +1882 -1358
  214. package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +3 -0
  215. package/dist/react-native/chunks/import-JYBMEJPQ.mjs +29 -0
  216. package/dist/react-native/chunks/methods-X6F36SJE.mjs +30 -0
  217. package/dist/react-native/chunks/module-QT5HZAY4.mjs +33 -0
  218. package/dist/react-native/chunks/{module-UJ5VUARS.mjs → module-S4DKSWMF.mjs} +10 -9
  219. package/dist/react-native/chunks/operations-RYKTSZQA.mjs +5 -0
  220. package/dist/react-native/chunks/{phrase-module-76UAPPSG.mjs → phrase-module-JZ37TB7N.mjs} +1 -1
  221. package/dist/react-native/chunks/{pool-CD4ANYUI.mjs → pool-RTGXJXPU.mjs} +3 -2
  222. package/dist/{browser/restore-queue-UQ6AAUVX.mjs → react-native/chunks/restore-queue-ZBVIKJWI.mjs} +2 -2
  223. package/dist/react-native/chunks/retention-PPCTP2VY.mjs +219 -0
  224. package/dist/react-native/chunks/{runtime-3MCDLJAF.mjs → runtime-KUATOLYB.mjs} +1 -1
  225. package/dist/react-native/chunks/{snapshot-KVBD4LRC.mjs → snapshot-ZBIEOZTZ.mjs} +47 -314
  226. package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +15 -0
  227. package/dist/react-native/chunks/{write-ES5A3WUA.mjs → write-2W4FTX7J.mjs} +25 -18
  228. package/dist/react-native/partial-words.mjs +6 -4
  229. package/dist/react-native/pattern.mjs +4 -3
  230. package/dist/react-native/sync.mjs +2236 -0
  231. package/dist/react-native/synonyms.mjs +7 -4
  232. package/dist/react.d.ts +10 -9
  233. package/dist/react.mjs +7 -1
  234. package/dist/{rerank-3W54N6P2.mjs → rerank-IZOB6NII.mjs} +4 -4
  235. package/dist/rerankers/http.mjs +2 -2
  236. package/dist/{react-native/chunks/restore-queue-H5VCN453.mjs → restore-queue-COI2GSSK.mjs} +2 -2
  237. package/dist/retention-55WA7GPU.mjs +58 -0
  238. package/dist/{runtime-L2DZYY6N.mjs → runtime-UZOC3NPY.mjs} +5 -5
  239. package/dist/{schema-D33CyXCy.d.ts → schema-DDauvDOv.d.ts} +1 -1
  240. package/dist/server.d.ts +22 -19
  241. package/dist/server.mjs +868 -50
  242. package/dist/{snapshot-WMX6JCLP.mjs → snapshot-NFX2EYN2.mjs} +62 -36
  243. package/dist/sync/filesystem.d.ts +30 -0
  244. package/dist/sync/filesystem.mjs +271 -0
  245. package/dist/sync/indexeddb.d.ts +30 -0
  246. package/dist/sync/indexeddb.mjs +237 -0
  247. package/dist/sync-state-ZWHLAFLE.mjs +15 -0
  248. package/dist/{config-aIsy7mcL.d.ts → sync-uXR7MmM7.d.ts} +53 -444
  249. package/dist/sync.browser.mjs +2231 -0
  250. package/dist/sync.d.ts +23 -0
  251. package/dist/sync.mjs +2206 -0
  252. package/dist/synonyms.mjs +5 -3
  253. package/dist/{tasks-C4ElXr4P.d.ts → tasks-BShx8pdK.d.ts} +4 -4
  254. package/dist/thread-P2G2FWM2.mjs +44 -0
  255. package/dist/types-SnO7_tAI.d.ts +228 -0
  256. package/dist/vector/search-worker.d.ts +1 -1
  257. package/dist/vector/search-worker.mjs +6 -6
  258. package/dist/workers/entry.mjs +7 -7
  259. package/dist/{write-SKJ6HW7O.mjs → write-FGB62BHQ.mjs} +31 -23
  260. package/openapi.json +119 -3
  261. package/package.json +28 -8
  262. package/dist/browser/import-QOY6ZH6X.mjs +0 -12
  263. package/dist/chunk-7LDMWKP6.mjs +0 -209
  264. package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +0 -110
  265. package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +0 -3
  266. package/dist/react-native/chunks/import-XFBCCENV.mjs +0 -22
  267. package/dist/react-native/chunks/module-FHJ2GOBI.mjs +0 -25
  268. package/dist/thread-I7DVHHW7.mjs +0 -31
@@ -1,18 +1,22 @@
1
- import { loadVectorField, VECTOR_FILE_ENVELOPE_VERSION, GRAPH_PART_ENVELOPE_VERSION } from './chunk-6RKSY3BX.mjs';
1
+ import { loadVectorField, VECTOR_FILE_ENVELOPE_VERSION, GRAPH_PART_ENVELOPE_VERSION } from './chunk-7NTMUDC5.mjs';
2
2
  import { gunzip, gzip } from './chunk-ZXNNR73R.mjs';
3
- import { SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES } from './chunk-DMNPYF54.mjs';
4
3
  import { defaultQuantizationFor } from './chunk-MATMVH65.mjs';
5
4
  import { DEFAULT_VECTOR_METRIC } from './chunk-VD7J552I.mjs';
6
- import { VECTOR_FILE_MAX_VECTORS, deadBytesFor } from './chunk-G5KHSM6E.mjs';
7
- import { readSegmentFile, STABLE_HEAD_ATTEMPTS } from './chunk-CSHHU7PA.mjs';
8
- import { MAX_SEGMENT_ID, MANIFEST_ENVELOPE_VERSION, EARLIER_SEGMENT_MANIFEST_VERSION, SEGMENT_MANIFEST_VERSION, MAX_SEGMENTS_PER_PARTITION, segmentKey, manifestKey, segmentsPrefix, vectorFileKey, graphPartKey } from './chunk-7LDMWKP6.mjs';
9
- import { VERSION, rulesOfStoredSynonyms, openChecksummedEnvelope, readHeader, HEADER_SIZE, crc32, engineVersionParts, writeHeader, packChecksummedEnvelope, packEnvelopeWithChecksum, checksumOfChunks } from './chunk-2PNYKG2D.mjs';
10
- import { decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays } from './chunk-UGVUW27S.mjs';
11
- import { DEFAULT_BM25_B, DEFAULT_BM25_K1 } from './chunk-3HV7M5OJ.mjs';
12
- import { flattenSchema, requireValidFieldTypes, isQuantizationMode, isStorageMode } from './chunk-SOUZMPME.mjs';
5
+ import { decodeSegmentManifest } from './chunk-IJU7LL7D.mjs';
6
+ import { isSyncEpoch } from './chunk-BUMREPLU.mjs';
7
+ import { SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES } from './chunk-LTUGDMV4.mjs';
8
+ import { readSegmentFile, STABLE_HEAD_ATTEMPTS } from './chunk-KCUIFVVW.mjs';
9
+ import { manifestKey, segmentsPrefix, vectorFileKey, graphPartKey } from './chunk-Q3TCTQCC.mjs';
10
+ import { VERSION, rulesOfStoredSynonyms, engineVersionParts, packChecksummedEnvelope, packEnvelopeWithChecksum } from './chunk-LSM2YTKM.mjs';
11
+ import { decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays } from './chunk-5FUOVJKG.mjs';
12
+ import { DEFAULT_BM25_B, DEFAULT_BM25_K1 } from './chunk-HWEDFLB7.mjs';
13
+ import { readHeader, HEADER_SIZE, writeHeader, checksumOfChunks } from './chunk-HVYICDY3.mjs';
14
+ import { crc32 } from './chunk-7GXJUJ24.mjs';
15
+ import { isQuantizationMode, isStorageMode } from './chunk-VMXSVVXG.mjs';
16
+ import { flattenSchema, requireValidFieldTypes } from './chunk-Z3TNWCI5.mjs';
13
17
  import { VECTOR_PATTERN } from './chunk-L5ORED7V.mjs';
14
- import { MAX_FILE_BYTES, VALID_HNSW_METRICS } from './chunk-U476IXKQ.mjs';
15
- import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
18
+ import { VALID_HNSW_METRICS } from './chunk-U476IXKQ.mjs';
19
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
16
20
  import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
17
21
  import { decode, encode } from '@msgpack/msgpack';
18
22
 
@@ -111,6 +115,9 @@ function metadataFromConfig(indexName, config, partitionCount, documentCount) {
111
115
  if (config.heldPartitions !== void 0) {
112
116
  metadata.heldPartitions = config.heldPartitions;
113
117
  }
118
+ if (config.sync !== void 0) metadata.sync = config.sync;
119
+ if (config.syncActive !== void 0) metadata.syncActive = config.syncActive;
120
+ if (config.syncEpoch !== void 0) metadata.syncEpoch = config.syncEpoch;
114
121
  return metadata;
115
122
  }
116
123
  function metadataConfigOf(entry) {
@@ -145,7 +152,21 @@ function metadataConfigOf(entry) {
145
152
  ...entry.config.required !== void 0 ? { required: entry.config.required } : {},
146
153
  ...entry.config.vectorPromotion !== void 0 ? { vectorPromotion: entry.config.vectorPromotion } : {},
147
154
  ...entry.config.patternValueLimit !== void 0 ? { patternValueLimit: entry.config.patternValueLimit } : {},
148
- ...entry.synonyms !== null ? { synonyms: rulesOfStoredSynonyms(entry.synonyms) } : {}
155
+ ...entry.synonyms !== null ? { synonyms: rulesOfStoredSynonyms(entry.synonyms) } : {},
156
+ ...syncMetadataOf(entry)
157
+ };
158
+ }
159
+ function syncMetadataOf(entry) {
160
+ const sync = entry.sync;
161
+ if (sync === null) return {};
162
+ return {
163
+ sync: {
164
+ enabled: true,
165
+ ...sync.historyMaxAgeMs !== void 0 ? { historyMaxAgeMs: sync.historyMaxAgeMs } : {},
166
+ ...sync.historyMaxBytes !== void 0 ? { historyMaxBytes: sync.historyMaxBytes } : {}
167
+ },
168
+ syncActive: sync.active,
169
+ syncEpoch: sync.epoch
149
170
  };
150
171
  }
151
172
  function durableMetadataConfigOf(entry) {
@@ -354,6 +375,56 @@ function deserializePayloadV1(data) {
354
375
  const raw = decode(data);
355
376
  return wireToPartition(raw);
356
377
  }
378
+
379
+ // src/serialization/payload-v1/sync-metadata.ts
380
+ function invalid(message, details) {
381
+ throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The device sync state in the index metadata ${message}`, details);
382
+ }
383
+ function isPositiveSafeInteger(value) {
384
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 1;
385
+ }
386
+ function syncMetadataToWire(meta) {
387
+ const wire = {};
388
+ if (meta.sync !== void 0) {
389
+ wire.sync = {
390
+ enabled: meta.sync.enabled,
391
+ ...meta.sync.historyMaxAgeMs !== void 0 ? { history_max_age_ms: meta.sync.historyMaxAgeMs } : {},
392
+ ...meta.sync.historyMaxBytes !== void 0 ? { history_max_bytes: meta.sync.historyMaxBytes } : {}
393
+ };
394
+ }
395
+ if (meta.syncActive !== void 0) wire.sync_active = meta.syncActive;
396
+ if (meta.syncEpoch !== void 0) wire.sync_epoch = meta.syncEpoch;
397
+ return wire;
398
+ }
399
+ function storedSyncSetting(raw) {
400
+ if (raw === null || typeof raw !== "object") invalid("holds a sync setting that is not a map", {});
401
+ const { enabled, history_max_age_ms: maxAge, history_max_bytes: maxBytes } = raw;
402
+ if (typeof enabled !== "boolean") invalid("holds a sync setting without a boolean enabled", {});
403
+ if (maxAge !== void 0 && !isPositiveSafeInteger(maxAge)) {
404
+ invalid("holds a history age limit that is not a positive whole number", { historyMaxAgeMs: String(maxAge) });
405
+ }
406
+ if (maxBytes !== void 0 && !isPositiveSafeInteger(maxBytes)) {
407
+ invalid("holds a history byte limit that is not a positive whole number", { historyMaxBytes: String(maxBytes) });
408
+ }
409
+ return {
410
+ enabled,
411
+ ...maxAge !== void 0 ? { historyMaxAgeMs: maxAge } : {},
412
+ ...maxBytes !== void 0 ? { historyMaxBytes: maxBytes } : {}
413
+ };
414
+ }
415
+ function syncMetadataFromWire(raw, meta) {
416
+ if (raw.sync !== void 0 && raw.sync !== null) meta.sync = storedSyncSetting(raw.sync);
417
+ if (raw.sync_active !== void 0 && raw.sync_active !== null) {
418
+ if (typeof raw.sync_active !== "boolean") invalid("holds a sync_active that is not a boolean", {});
419
+ meta.syncActive = raw.sync_active;
420
+ }
421
+ if (raw.sync_epoch !== void 0 && raw.sync_epoch !== null) {
422
+ if (!isSyncEpoch(raw.sync_epoch)) invalid("holds an epoch that is not 32 lowercase hexadecimal digits", {});
423
+ meta.syncEpoch = raw.sync_epoch;
424
+ }
425
+ }
426
+
427
+ // src/serialization/payload-v1/metadata.ts
357
428
  function metadataToWire(meta) {
358
429
  const wire = {
359
430
  index_name: meta.indexName,
@@ -454,7 +525,7 @@ function metadataToWire(meta) {
454
525
  if (Array.isArray(meta.synonyms) && meta.synonyms.length > 0) {
455
526
  wire.synonyms = meta.synonyms;
456
527
  }
457
- return wire;
528
+ return { ...wire, ...syncMetadataToWire(meta) };
458
529
  }
459
530
  function wireToMetadata(raw) {
460
531
  const meta = {
@@ -610,6 +681,7 @@ function wireToMetadata(raw) {
610
681
  meta.heldPartitions = raw.held_partitions;
611
682
  }
612
683
  if (raw.synonyms !== void 0 && raw.synonyms !== null) meta.synonyms = raw.synonyms;
684
+ syncMetadataFromWire(raw, meta);
613
685
  return meta;
614
686
  }
615
687
  function isNonNegativeInteger(value) {
@@ -741,239 +813,6 @@ async function readMetadataEnvelope(data) {
741
813
  return { header, metadata };
742
814
  }
743
815
 
744
- // src/persistence/durability/segment/manifest-fields.ts
745
- function invalidManifest(message, details) {
746
- throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, `Segment manifest ${message}`, details);
747
- }
748
- function isRecord(value) {
749
- return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Uint8Array);
750
- }
751
- function isId(value) {
752
- return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= MAX_SEGMENT_ID;
753
- }
754
- function isUint32(value) {
755
- return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 4294967295;
756
- }
757
- function isSequenceNumber(value) {
758
- return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
759
- }
760
- function readFileRef(raw, expectedKey, what) {
761
- if (raw.key !== expectedKey) {
762
- invalidManifest(`lists the ${what} under the key "${String(raw.key)}" where it belongs at "${expectedKey}"`, {
763
- key: raw.key,
764
- expected: expectedKey
765
- });
766
- }
767
- const bytes = raw.bytes;
768
- if (typeof bytes !== "number" || !Number.isInteger(bytes) || bytes < HEADER_SIZE || bytes > MAX_FILE_BYTES) {
769
- invalidManifest(`gives the ${what} "${expectedKey}" an invalid length`, { key: expectedKey, bytes });
770
- }
771
- if (!isUint32(raw.checksum)) invalidManifest(`gives the ${what} "${expectedKey}" an invalid checksum`);
772
- if (raw.headOffset === void 0) return { key: expectedKey, bytes, checksum: raw.checksum };
773
- const { headOffset, headLength, headChecksum } = raw;
774
- if (!isSequenceNumber(headOffset) || !isUint32(headLength) || !isUint32(headChecksum)) {
775
- invalidManifest(`gives the ${what} "${expectedKey}" an invalid head`, { key: expectedKey });
776
- }
777
- if (headOffset + headLength > bytes - HEADER_SIZE) {
778
- invalidManifest(`ends the head of the ${what} "${expectedKey}" outside its payload`, {
779
- key: expectedKey,
780
- headOffset,
781
- headLength,
782
- bytes
783
- });
784
- }
785
- return { key: expectedKey, bytes, checksum: raw.checksum, headOffset, headLength, headChecksum };
786
- }
787
-
788
- // src/persistence/durability/segment/manifest-vectors-decode.ts
789
- function normalizeFile(raw, indexName, fieldPath, nextFileId, seenIds) {
790
- if (!isRecord(raw) || !isId(raw.id)) invalidManifest("has an invalid vector file reference", { fieldPath });
791
- if (raw.id >= nextFileId || seenIds.has(raw.id)) {
792
- invalidManifest(`lists vector file ${raw.id} of "${fieldPath}" twice or at its next file id`, { fieldPath });
793
- }
794
- seenIds.add(raw.id);
795
- const count = raw.count;
796
- if (typeof count !== "number" || !Number.isInteger(count) || count < 0 || count > VECTOR_FILE_MAX_VECTORS) {
797
- invalidManifest(`gives vector file ${raw.id} of "${fieldPath}" an invalid count`, { fieldPath, count });
798
- }
799
- const dead = raw.dead ?? null;
800
- if (dead !== null && !(dead instanceof Uint8Array)) invalidManifest("has dead vectors that are not bytes");
801
- if (dead !== null && dead.byteLength !== deadBytesFor(count)) {
802
- invalidManifest(`marks the dead vectors of file ${raw.id} of "${fieldPath}" with the wrong number of bytes`);
803
- }
804
- const ref = readFileRef(raw, vectorFileKey(indexName, fieldPath, raw.id), "vector file");
805
- return { ...ref, id: raw.id, count, dead };
806
- }
807
- function normalizeGraphParts(raw, indexName, fieldPath, generation) {
808
- if (!Array.isArray(raw)) invalidManifest(`gives "${fieldPath}" no list of graph parts`, { fieldPath });
809
- if (raw.length > 0 && generation === 0) invalidManifest(`lists graph parts of "${fieldPath}" at generation 0`);
810
- return raw.map((part, at) => {
811
- if (!isRecord(part)) invalidManifest(`has an invalid graph part of "${fieldPath}"`, { fieldPath });
812
- return readFileRef(part, graphPartKey(indexName, fieldPath, generation, at), "graph part");
813
- });
814
- }
815
- function normalizeField(raw, indexName, seenFields) {
816
- if (!isRecord(raw) || typeof raw.fieldPath !== "string") invalidManifest("has an invalid vector reference");
817
- const fieldPath = raw.fieldPath;
818
- if (seenFields.has(fieldPath)) invalidManifest(`lists the vector field "${fieldPath}" twice`, { fieldPath });
819
- seenFields.add(fieldPath);
820
- if (!isId(raw.nextFileId)) invalidManifest(`gives "${fieldPath}" an invalid next file id`, { fieldPath });
821
- if (!Array.isArray(raw.files)) invalidManifest(`gives "${fieldPath}" no list of vector files`, { fieldPath });
822
- if (!isId(raw.graphGeneration)) invalidManifest(`gives "${fieldPath}" an invalid graph generation`, { fieldPath });
823
- const nextFileId = raw.nextFileId;
824
- const seenIds = /* @__PURE__ */ new Set();
825
- return {
826
- fieldPath,
827
- nextFileId,
828
- files: raw.files.map((file) => normalizeFile(file, indexName, fieldPath, nextFileId, seenIds)),
829
- graphGeneration: raw.graphGeneration,
830
- graphParts: normalizeGraphParts(raw.graphParts, indexName, fieldPath, raw.graphGeneration)
831
- };
832
- }
833
- function normalizeVectorFields(raw, indexName) {
834
- if (!Array.isArray(raw)) invalidManifest("has malformed vector references");
835
- const seenFields = /* @__PURE__ */ new Set();
836
- return raw.map((field) => normalizeField(field, indexName, seenFields));
837
- }
838
-
839
- // src/persistence/durability/segment/manifest-decode.ts
840
- async function openManifestPayload(data) {
841
- const { payload } = await openChecksummedEnvelope(data, {
842
- envelopeFormatVersion: MANIFEST_ENVELOPE_VERSION,
843
- what: "segment manifest",
844
- allowsCompression: true
845
- });
846
- const raw = decode(payload);
847
- if (!isRecord(raw)) invalidManifest("is not a map");
848
- return raw;
849
- }
850
- function listedKeysOf(raw) {
851
- const keys = [];
852
- for (const partition of Array.isArray(raw.partitions) ? raw.partitions : []) {
853
- if (!isRecord(partition) || !Array.isArray(partition.segments)) continue;
854
- for (const segment of partition.segments)
855
- if (isRecord(segment) && typeof segment.key === "string") keys.push(segment.key);
856
- }
857
- for (const field of Array.isArray(raw.vectors) ? raw.vectors : []) {
858
- if (!isRecord(field)) continue;
859
- for (const list of [field.files, field.graphParts]) {
860
- if (!Array.isArray(list)) continue;
861
- for (const file of list) if (isRecord(file) && typeof file.key === "string") keys.push(file.key);
862
- }
863
- }
864
- return keys;
865
- }
866
- async function decodeSegmentManifest(data, indexName) {
867
- return decodeManifestPayload(await openManifestPayload(data), indexName);
868
- }
869
- function decodeManifestPayload(raw, indexName) {
870
- if (raw.version === EARLIER_SEGMENT_MANIFEST_VERSION) return { kind: "earlier", payload: raw };
871
- if (raw.version !== SEGMENT_MANIFEST_VERSION) {
872
- throw new NarsilError(
873
- ErrorCodes.ENVELOPE_VERSION_MISMATCH,
874
- `The segment manifest of index "${indexName}" holds layout ${String(raw.version)}, which this release cannot open. Export the index with the release that wrote it and import the export`,
875
- { indexName, version: raw.version }
876
- );
877
- }
878
- const schema = raw.schema;
879
- if (!isRecord(schema)) invalidManifest("is missing its schema");
880
- requireValidFieldTypes(schema);
881
- if (typeof raw.language !== "string") invalidManifest("is missing its language");
882
- if (raw.analysisGeneration !== void 0 && !isSequenceNumber(raw.analysisGeneration)) {
883
- invalidManifest("has an invalid analysis generation");
884
- }
885
- return {
886
- kind: "current",
887
- manifest: {
888
- version: SEGMENT_MANIFEST_VERSION,
889
- schema,
890
- language: raw.language,
891
- ...raw.analysisGeneration ? { analysisGeneration: raw.analysisGeneration } : {},
892
- checkpoint: normalizeCheckpoint(raw.checkpoint),
893
- partitions: normalizePartitions(raw.partitions, indexName),
894
- vectors: normalizeVectorFields(raw.vectors, indexName)
895
- }
896
- };
897
- }
898
- function normalizeCheckpoint(raw) {
899
- if (!Array.isArray(raw)) invalidManifest("is missing its checkpoint list");
900
- const seen = /* @__PURE__ */ new Set();
901
- return raw.map((entry) => {
902
- if (!isRecord(entry) || !isUint32(entry.partitionId) || !isSequenceNumber(entry.lastSeqNo) || !isSequenceNumber(entry.primaryTerm) || seen.has(entry.partitionId)) {
903
- invalidManifest("has an invalid partition checkpoint", { entry });
904
- }
905
- seen.add(entry.partitionId);
906
- const checkpoint = {
907
- partitionId: entry.partitionId,
908
- lastSeqNo: entry.lastSeqNo,
909
- primaryTerm: entry.primaryTerm
910
- };
911
- if (entry.termHistory !== void 0) {
912
- checkpoint.termHistory = normalizeTermHistory(entry.termHistory, entry.partitionId, entry.lastSeqNo);
913
- }
914
- return checkpoint;
915
- });
916
- }
917
- function normalizeTermHistory(raw, partitionId, lastSeqNo) {
918
- if (!Array.isArray(raw)) invalidManifest("has a term history that is not a list", { partitionId });
919
- let previous = null;
920
- return raw.map((start) => {
921
- if (!isRecord(start) || !isSequenceNumber(start.primaryTerm) || !isSequenceNumber(start.firstSeqNo)) {
922
- invalidManifest("has an invalid term history entry", { partitionId });
923
- }
924
- const read = { primaryTerm: start.primaryTerm, firstSeqNo: start.firstSeqNo };
925
- if (read.firstSeqNo > lastSeqNo) {
926
- invalidManifest(`has a term starting at seqNo ${read.firstSeqNo}, above lastSeqNo ${lastSeqNo}`, { partitionId });
927
- }
928
- if (previous !== null && (read.primaryTerm <= previous.primaryTerm || read.firstSeqNo <= previous.firstSeqNo)) {
929
- invalidManifest("has a term history that fails to ascend strictly", { partitionId });
930
- }
931
- previous = read;
932
- return read;
933
- });
934
- }
935
- function normalizePartitions(raw, indexName) {
936
- if (!Array.isArray(raw)) invalidManifest("is missing partition entries");
937
- const seen = /* @__PURE__ */ new Set();
938
- return raw.map((entry) => {
939
- if (!isRecord(entry) || !isUint32(entry.partitionId) || seen.has(entry.partitionId)) {
940
- invalidManifest("has a partition without a valid id", { partitionId: isRecord(entry) ? entry.partitionId : null });
941
- }
942
- seen.add(entry.partitionId);
943
- const segments = normalizeSegments(entry.segments, indexName, entry.partitionId);
944
- return {
945
- partitionId: entry.partitionId,
946
- nextSegmentId: readNextSegmentId(entry.nextSegmentId, segments, entry.partitionId),
947
- segments
948
- };
949
- });
950
- }
951
- function normalizeSegments(raw, indexName, partitionId) {
952
- if (!Array.isArray(raw)) invalidManifest("has malformed segment references", { partitionId });
953
- if (raw.length > MAX_SEGMENTS_PER_PARTITION) {
954
- invalidManifest(`lists ${raw.length} segments for partition ${partitionId}, above ${MAX_SEGMENTS_PER_PARTITION}`);
955
- }
956
- const seenIds = /* @__PURE__ */ new Set();
957
- return raw.map((segment) => {
958
- if (!isRecord(segment) || !isId(segment.id) || !isUint32(segment.docCount) || !isUint32(segment.tombstoneCount)) {
959
- invalidManifest("has an invalid segment reference", { partitionId });
960
- }
961
- if (seenIds.has(segment.id)) invalidManifest(`reuses segment id ${segment.id} in partition ${partitionId}`);
962
- seenIds.add(segment.id);
963
- const ref = readFileRef(segment, segmentKey(indexName, partitionId, segment.id), "segment");
964
- return { ...ref, id: segment.id, docCount: segment.docCount, tombstoneCount: segment.tombstoneCount };
965
- });
966
- }
967
- function readNextSegmentId(value, segments, partitionId) {
968
- if (!isId(value)) invalidManifest("has an invalid next segment id", { partitionId });
969
- for (const segment of segments) {
970
- if (segment.id >= value) {
971
- invalidManifest(`next segment id ${value} does not exceed segment id ${segment.id}`, { partitionId });
972
- }
973
- }
974
- return value;
975
- }
976
-
977
816
  // src/serialization/crc32-combine.ts
978
817
  var IEEE_POLYNOMIAL = 3988292384;
979
818
  var CRC_BITS = 32;
@@ -1441,7 +1280,7 @@ function removeFromPartition(manager, partitionId, docIds) {
1441
1280
  }
1442
1281
  }
1443
1282
  async function attachPagedSegment(directory, ref, partitionId, manager, options) {
1444
- const { checkPagedSegmentFully, createPagedFrozenSegment, openPagedSnapshot, pagedListingOf } = await import('./module-6RLIKSZQ.mjs');
1283
+ const { checkPagedSegmentFully, createPagedFrozenSegment, openPagedSnapshot, pagedListingOf } = await import('./module-MG7JMV2U.mjs');
1445
1284
  if (options.decodesEveryDocument) await checkPagedSegmentFully(directory, ref);
1446
1285
  const snapshot = openPagedSnapshot(await pagedListingOf(directory, ref));
1447
1286
  requireAgreedSchema(options.schema, snapshot.schema, ref.key);
@@ -1455,7 +1294,7 @@ async function loadPartitionSegments(store, partition, manager, options) {
1455
1294
  const { directory } = store;
1456
1295
  for (const ref of partition.segments) {
1457
1296
  if (manager.config.textStorage === "disk" && directory !== void 0) {
1458
- const { isPagedSegmentFile } = await import('./module-6RLIKSZQ.mjs');
1297
+ const { isPagedSegmentFile } = await import('./module-MG7JMV2U.mjs');
1459
1298
  if (await isPagedSegmentFile(directory, ref.key)) {
1460
1299
  await attachPagedSegment(directory, ref, partition.partitionId, manager, options);
1461
1300
  await yieldToEventLoop();
@@ -1511,7 +1350,7 @@ async function loadSegmentedCheckpoint(store, indexName, manifest, deps, decodes
1511
1350
  (field) => deps.vectorIndexes.get(field.fieldPath)?.storage === "disk" && field.files.some((file) => file.headOffset !== void 0)
1512
1351
  );
1513
1352
  if (!decodesEveryDocument && directory !== void 0 && opensVectorsOnDemand) {
1514
- const { startReadingOpeningSectionsAhead } = await import('./module-6RLIKSZQ.mjs');
1353
+ const { startReadingOpeningSectionsAhead } = await import('./module-MG7JMV2U.mjs');
1515
1354
  await startReadingOpeningSectionsAhead(directory, manifest);
1516
1355
  }
1517
1356
  for (const partition of manifest.partitions) {
@@ -1546,4 +1385,4 @@ async function reclaimUnlistedKeys(store, indexName, referenced) {
1546
1385
  }
1547
1386
  }
1548
1387
 
1549
- export { SINGLE_NODE_PRIMARY_TERM, createSeqOwner, decodeManifestPayload, decodeSegmentManifest, deserializePayloadV1, dropStoredVectorValues, durableMetadataConfigOf, growPartitionsTo, indexMetadataOf, invalidManifest, isId, isRecord, isSequenceNumber, isUint32, listedKeysOf, loadPartitionSegments, loadSegmentedCheckpoint, metadataConfigOf, metadataFromConfig, openManifestPayload, patternIndexesFromWire, readCurrentManifest, readMetadataEnvelope, readSegmentManifest, reclaimUnlistedKeys, sanitizeSurfaceForms, unpackEnvelopeBytes, unpackIndexSnapshotEnvelope, writeLiveVectors, writeMetadataEnvelope };
1388
+ export { SINGLE_NODE_PRIMARY_TERM, createSeqOwner, deserializePayloadV1, dropStoredVectorValues, durableMetadataConfigOf, growPartitionsTo, indexMetadataOf, loadPartitionSegments, loadSegmentedCheckpoint, metadataConfigOf, metadataFromConfig, patternIndexesFromWire, readCurrentManifest, readMetadataEnvelope, readSegmentManifest, reclaimUnlistedKeys, sanitizeSurfaceForms, unpackEnvelopeBytes, unpackIndexSnapshotEnvelope, writeLiveVectors, writeMetadataEnvelope };
@@ -1,11 +1,11 @@
1
1
  import { REBUILD_REMOVED_RATIO, BUILD_TURN_HANDOVER_AFTER_MS, DRIFT_CHECK_GROWTH_FACTOR, VECTOR_FILE_REPLACED_ABOVE_DEAD_SHARE, VECTOR_FILE_FIXED_OVERHEAD_BYTES, VECTOR_FILE_CENTROID_BYTES_PER_COMPONENT, VECTOR_FILE_STRING_HEADER_BYTES } from './chunk-VD7J552I.mjs';
2
- import { VECTOR_FILE_MAX_VECTORS, NO_LIVE_VECTOR_AT_POSITION, bytesToVectors, VECTOR_GRAPH_PART_VECTORS, VECTOR_GRAPH_PART_PAYLOAD_VERSION, VECTOR_FILE_PAYLOAD_VERSION, deadBitsWhere, vectorsToBytes } from './chunk-G5KHSM6E.mjs';
3
- import { createOrdinalFilter, addToOrdinalFilter, osqBitsOf, STORE_ORDINAL_LAYOUT_GENERATION, removeFromOrdinalFilter, createHNSWIndex, STORE_CALIBRATION_GENERATION, graphWithoutNodes, createOsqScratch, osqQuantize } from './chunk-AWNHDBKV.mjs';
2
+ import { VECTOR_FILE_MAX_VECTORS, NO_LIVE_VECTOR_AT_POSITION, bytesToVectors, VECTOR_GRAPH_PART_VECTORS, VECTOR_GRAPH_PART_PAYLOAD_VERSION, VECTOR_FILE_PAYLOAD_VERSION, deadBitsWhere, vectorsToBytes } from './chunk-AO2FAYIZ.mjs';
3
+ import { createOrdinalFilter, addToOrdinalFilter, osqBitsOf, STORE_ORDINAL_LAYOUT_GENERATION, removeFromOrdinalFilter, createHNSWIndex, STORE_CALIBRATION_GENERATION, graphWithoutNodes, createOsqScratch, osqQuantize } from './chunk-BPSKLCS7.mjs';
4
4
  import { osqRecordBytes, writeRecord } from './chunk-37CD3OKS.mjs';
5
5
  import { MAX_DOC_ID_LENGTH } from './chunk-EEBCDP36.mjs';
6
6
  import { turnsAreBudgeted, backgroundTurnIsSpent, yieldBackgroundTurn } from './chunk-LQG5G2LY.mjs';
7
7
  import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
8
- import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
8
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
9
9
 
10
10
  // src/vector/filter-ordinals.ts
11
11
  var UNRESOLVED_ORDINAL = -1;
@@ -0,0 +1,237 @@
1
+ import { writeLiveVectors, SINGLE_NODE_PRIMARY_TERM } from './chunk-QKZHLADX.mjs';
2
+ import { vectorsPerFile } from './chunk-REL7LFLR.mjs';
3
+ import { ARCHIVE_CONFIG_ENTRY, ARCHIVE_MANIFEST_ENTRY, tarEnd, tarEntryHeaders, tarPadding, ARCHIVE_FILE_CHUNK_BYTES } from './chunk-5KGYQT6W.mjs';
4
+ import { decodeSegmentManifest } from './chunk-IJU7LL7D.mjs';
5
+ import { vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-AO2FAYIZ.mjs';
6
+ import { writeCheckpointSegments, commitCheckpointManifest, partitionContentsOf } from './chunk-X6NSJYQ3.mjs';
7
+ import { manifestKey, manifestFileRefs } from './chunk-Q3TCTQCC.mjs';
8
+ import { DEFAULT_COMPACTION_THRESHOLD } from './chunk-QDZJM7NI.mjs';
9
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
10
+
11
+ // src/persistence/archive/memory-store.ts
12
+ function joined(chunks) {
13
+ let total = 0;
14
+ for (const chunk of chunks) total += chunk.byteLength;
15
+ const bytes = new Uint8Array(total);
16
+ let offset = 0;
17
+ for (const chunk of chunks) {
18
+ bytes.set(chunk, offset);
19
+ offset += chunk.byteLength;
20
+ }
21
+ return bytes;
22
+ }
23
+ function memoryCheckpointStore() {
24
+ const files = /* @__PURE__ */ new Map();
25
+ return {
26
+ files,
27
+ read: async (key) => files.get(key) ?? null,
28
+ write: async (key, chunks) => {
29
+ files.set(key, joined(chunks));
30
+ },
31
+ remove: async (key) => {
32
+ files.delete(key);
33
+ },
34
+ list: async (prefix) => [...files.keys()].filter((key) => key.startsWith(prefix)).sort(),
35
+ byteLength: async (key) => files.get(key)?.byteLength ?? null
36
+ };
37
+ }
38
+
39
+ // src/persistence/archive/from-memory.ts
40
+ function frozenPlan(plan) {
41
+ const files = [];
42
+ for (let index = 0; index < plan.newFiles; index++) files.push(plan.readNewFile(index));
43
+ return { ...plan, readNewFile: (index) => files[index] };
44
+ }
45
+ function partitionVectorPlan(vectorIndex, docIds) {
46
+ const held = [];
47
+ const vectors = [];
48
+ for (const docId of docIds) {
49
+ const vector = vectorIndex.getVector(docId);
50
+ if (vector === null) continue;
51
+ held.push(docId);
52
+ vectors.push(Float32Array.from(vector));
53
+ }
54
+ const capacity = vectorsPerFile(vectorIndex.dimension, null);
55
+ const files = [];
56
+ for (let start = 0; start < held.length; start += capacity) {
57
+ const slice = held.slice(start, start + capacity);
58
+ const packed = new Float32Array(slice.length * vectorIndex.dimension);
59
+ for (let i = 0; i < slice.length; i++) packed.set(vectors[start + i], i * vectorIndex.dimension);
60
+ const payload = {
61
+ v: VECTOR_FILE_PAYLOAD_VERSION,
62
+ fieldName: vectorIndex.fieldName,
63
+ dimension: vectorIndex.dimension,
64
+ docIds: slice,
65
+ codes: null,
66
+ vectors: vectorsToBytes(packed)
67
+ };
68
+ files.push({ payload, ordinals: new Int32Array(slice.length), dead: null, magnitudes: null });
69
+ }
70
+ return {
71
+ unchanged: false,
72
+ storesHeads: false,
73
+ kept: [],
74
+ keptFiles: [],
75
+ newFiles: files.length,
76
+ graphParts: null,
77
+ signature: { revision: 0, graphSize: -1, calibration: null },
78
+ readNewFile: (index) => files[index],
79
+ release: () => void 0
80
+ };
81
+ }
82
+ function capture(input) {
83
+ const partitionIds = input.partitionId === null ? Array.from({ length: input.manager.partitionCount }, (_, partitionId) => partitionId) : [input.partitionId];
84
+ const { indexName } = input;
85
+ const writeRecords = input.writeRecords ?? null;
86
+ const targets = partitionIds.map((partitionId) => {
87
+ const target = {
88
+ partitionId,
89
+ lastSeqNo: input.appliedSeqNo(partitionId),
90
+ primaryTerm: SINGLE_NODE_PRIMARY_TERM
91
+ };
92
+ if (writeRecords !== null) target.termHistory = writeRecords.termHistoryOf(indexName, partitionId, target.lastSeqNo);
93
+ return target;
94
+ });
95
+ const contents = partitionIds.map(
96
+ (partitionId) => partitionContentsOf(
97
+ input.manager,
98
+ partitionId,
99
+ writeRecords === null ? void 0 : (segments) => writeRecords.captureSegments(indexName, partitionId, segments)
100
+ )
101
+ );
102
+ const plans = /* @__PURE__ */ new Map();
103
+ const partitionDocIds = input.partitionId === null ? null : [...input.manager.getPartition(input.partitionId).docIds()];
104
+ for (const [fieldPath, vectorIndex] of input.vectorIndexes) {
105
+ plans.set(
106
+ fieldPath,
107
+ partitionDocIds === null ? frozenPlan(vectorIndex.planCheckpoint(null)) : partitionVectorPlan(vectorIndex, partitionDocIds)
108
+ );
109
+ }
110
+ return { targets, contents, plans };
111
+ }
112
+ async function buildArchiveFromMemory(input) {
113
+ if (input.partitionId === null) {
114
+ for (const vectorIndex of input.vectorIndexes.values()) await vectorIndex.completeGraph();
115
+ }
116
+ const captured = capture(input);
117
+ const store = memoryCheckpointStore();
118
+ const written = await writeCheckpointSegments({
119
+ store,
120
+ metadata: input.metadata,
121
+ targets: captured.targets,
122
+ compactionThreshold: DEFAULT_COMPACTION_THRESHOLD,
123
+ prior: null,
124
+ wholePartitions: captured.contents,
125
+ keepsWriteRecords: input.writeRecords != null
126
+ });
127
+ const vectors = await writeLiveVectors({ store, indexName: input.indexName, plans: captured.plans, priorVectors: [] });
128
+ const refs = vectors.refs;
129
+ await commitCheckpointManifest(store, input.metadata, written, refs);
130
+ const manifestBytes = store.files.get(manifestKey(input.indexName));
131
+ const decoded = manifestBytes === void 0 ? null : await decodeSegmentManifest(manifestBytes, input.indexName);
132
+ if (manifestBytes === void 0 || decoded === null || decoded.kind !== "current") {
133
+ throw new NarsilError(
134
+ ErrorCodes.PERSISTENCE_SAVE_FAILED,
135
+ `The archive of index "${input.indexName}" holds no manifest`
136
+ );
137
+ }
138
+ return {
139
+ manifestBytes,
140
+ manifest: decoded.manifest,
141
+ readFile: async (ref) => {
142
+ const bytes = store.files.get(ref.key);
143
+ if (bytes === void 0) {
144
+ throw new NarsilError(ErrorCodes.PERSISTENCE_SAVE_FAILED, `The archive file "${ref.key}" is missing`, {
145
+ key: ref.key
146
+ });
147
+ }
148
+ return bytes;
149
+ },
150
+ readRange: async (ref, offset, length) => {
151
+ const bytes = store.files.get(ref.key);
152
+ if (bytes === void 0 || offset + length > bytes.byteLength) {
153
+ throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, `The archive file "${ref.key}" is missing`, {
154
+ key: ref.key
155
+ });
156
+ }
157
+ return bytes.subarray(offset, offset + length);
158
+ },
159
+ release: () => store.files.clear()
160
+ };
161
+ }
162
+
163
+ // src/persistence/archive/write.ts
164
+ function entryChunks(name, bytes) {
165
+ return [...tarEntryHeaders(name, bytes.byteLength), bytes, tarPadding(bytes.byteLength)].filter(
166
+ (chunk) => chunk.byteLength > 0
167
+ );
168
+ }
169
+ async function* fileEntryChunks(source, name, ref) {
170
+ yield* tarEntryHeaders(name, ref.bytes).filter((chunk) => chunk.byteLength > 0);
171
+ for (let offset = 0; offset < ref.bytes; offset += ARCHIVE_FILE_CHUNK_BYTES) {
172
+ yield await source.readRange(ref, offset, Math.min(ARCHIVE_FILE_CHUNK_BYTES, ref.bytes - offset));
173
+ }
174
+ const padding = tarPadding(ref.bytes);
175
+ if (padding.byteLength > 0) yield padding;
176
+ }
177
+ async function* archiveChunks(source) {
178
+ yield* entryChunks(ARCHIVE_CONFIG_ENTRY, source.config);
179
+ yield* entryChunks(ARCHIVE_MANIFEST_ENTRY, source.manifestBytes);
180
+ const prefix = `${source.sourceIndexName}/`;
181
+ for (const ref of manifestFileRefs(source.manifest)) {
182
+ yield* fileEntryChunks(source, ref.key.slice(prefix.length), ref);
183
+ }
184
+ yield tarEnd();
185
+ }
186
+ function archiveStream(source) {
187
+ const chunks = archiveChunks(source);
188
+ let released = false;
189
+ const release = () => {
190
+ if (released) return;
191
+ released = true;
192
+ source.release();
193
+ };
194
+ return new ReadableStream({
195
+ async pull(controller) {
196
+ try {
197
+ const step = await chunks.next();
198
+ if (step.done) {
199
+ release();
200
+ controller.close();
201
+ return;
202
+ }
203
+ controller.enqueue(step.value);
204
+ } catch (error) {
205
+ release();
206
+ controller.error(error);
207
+ }
208
+ },
209
+ async cancel() {
210
+ release();
211
+ await chunks.return(void 0);
212
+ }
213
+ });
214
+ }
215
+
216
+ // src/persistence/archive/file-entry.ts
217
+ async function writeArchiveFile(store, key, chunks) {
218
+ const { directory } = store;
219
+ if (directory === void 0) {
220
+ const held = [];
221
+ for await (const chunk of chunks) held.push(chunk);
222
+ await store.write(key, held);
223
+ return;
224
+ }
225
+ const receiving = `${key}.receiving`;
226
+ await directory.remove(receiving);
227
+ const handle = await directory.appendHandle(receiving);
228
+ try {
229
+ for await (const chunk of chunks) await handle.append(chunk);
230
+ await handle.sync();
231
+ } finally {
232
+ await handle.close();
233
+ }
234
+ await directory.move(receiving, key);
235
+ }
236
+
237
+ export { archiveStream, buildArchiveFromMemory, memoryCheckpointStore, writeArchiveFile };