@delali/narsil 0.3.1-next.153 → 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 +2 -2
  140. package/dist/distribution/coordinator/etcd.mjs +1 -1
  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,5 +1,5 @@
1
- import { sanitizeSurfaceForms, patternIndexesFromWire, dropStoredVectorValues } from './chunk-ZS6CMXAE.mjs';
2
- import { requireValidFieldTypes } from './chunk-SOUZMPME.mjs';
1
+ import { sanitizeSurfaceForms, patternIndexesFromWire, dropStoredVectorValues } from './chunk-QKZHLADX.mjs';
2
+ import { requireValidFieldTypes } from './chunk-Z3TNWCI5.mjs';
3
3
  import { VALID_HNSW_METRICS } from './chunk-U476IXKQ.mjs';
4
4
  import { decode } from '@msgpack/msgpack';
5
5
 
@@ -1,11 +1,11 @@
1
- import { untagDocumentLine } from './chunk-NYSONUB7.mjs';
1
+ import { untagDocumentLine } from './chunk-CP5RRPJR.mjs';
2
+ import { restoredConfigFields, restoredEmbedding } from './chunk-YBJDOA2T.mjs';
2
3
  import { chunksOf } from './chunk-CZQ33DLW.mjs';
3
- import { restoredConfigFields, restoredEmbedding } from './chunk-IRWP524D.mjs';
4
- import { requireConfigurationShape } from './chunk-2PNYKG2D.mjs';
5
4
  import { MAX_EXPORT_LINE_BYTES, IMPORT_BATCH_DOCUMENTS, MAX_IMPORT_REFUSALS_REPORTED } from './chunk-EEBCDP36.mjs';
5
+ import { requireConfigurationShape } from './chunk-USR7FQRZ.mjs';
6
6
  import { turnsAreBudgeted, turnIsSpent, yieldTurn } from './chunk-LQG5G2LY.mjs';
7
- import { flattenSchema } from './chunk-SOUZMPME.mjs';
8
- import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
7
+ import { flattenSchema } from './chunk-Z3TNWCI5.mjs';
8
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
9
9
 
10
10
  // src/engine/export/lines.ts
11
11
  var NEWLINE = 10;
@@ -1,15 +1,19 @@
1
- import { requirePatternSearchFor, requirePartialWordSearchFor, createPartitionIndex, cloneProjected, projectIncludedPaths, valueWithOwnBuffers, buildPartialWordTableFrom, createSurfaceRegistry, encodePartialSpellingsOf, recordValueSize, patternIndexOf, encodeFieldIndexes, countPartialSpelling, ARRAY_POSITION_GAP, readHeapStatistics, documentWithOwnBuffers, readProjectedPath, copyVectorsInto, isCompositePartition, partialSpellingsOfDocuments, createFrozenPartialWords, requirePatternSearch, documentValueBytes, MAX_TERM_FREQUENCY, loadPhraseCodeFor, joinPatternWorkMeter, fanOutQuery, sanitizeGlobalStats, countsWithoutScores, fanOutMatchCount, createGeoIndex, createNumericIndex, createBooleanIndex, createEnumIndex, ValueAffixes, readResidentMemory, createCompositePartition } from './chunk-3HV7M5OJ.mjs';
1
+ import { requirePatternSearchFor, requirePartialWordSearchFor, createPartitionIndex, cloneProjected, projectIncludedPaths, valueWithOwnBuffers, buildPartialWordTableFrom, createSurfaceRegistry, encodePartialSpellingsOf, recordValueSize, patternIndexOf, encodeFieldIndexes, countPartialSpelling, ARRAY_POSITION_GAP, documentWithOwnBuffers, readProjectedPath, copyVectorsInto, isCompositePartition, partialSpellingsOfDocuments, createFrozenPartialWords, requirePatternSearch, documentValueBytes, MAX_TERM_FREQUENCY, loadPhraseCodeFor, joinPatternWorkMeter, fanOutQuery, sanitizeGlobalStats, countsWithoutScores, fanOutMatchCount, createGeoIndex, createNumericIndex, createBooleanIndex, createEnumIndex, ValueAffixes, readResidentMemory, createCompositePartition } from './chunk-HWEDFLB7.mjs';
2
+ import { readHeapStatistics } from './chunk-IPN7S4KX.mjs';
2
3
  import { fnv1a } from './chunk-KAKQ74LS.mjs';
3
- import { resolveIndexAnalysis, getLanguage, synonymSearchModule } from './chunk-2HJWQPR6.mjs';
4
- import { loadedVectorCode, loadVectorCode, loadVectorCodeFor, requireLoadedVectorCode } from './chunk-DGRM4EZZ.mjs';
4
+ import { synonymSearchModule } from './chunk-NTZOXVUZ.mjs';
5
+ import { resolveIndexAnalysis, getLanguage } from './chunk-JCLTESFN.mjs';
6
+ import { loadedVectorCode, loadVectorCode, loadVectorCodeFor, requireLoadedVectorCode } from './chunk-37IVJLP6.mjs';
5
7
  import { createDocIdMap } from './chunk-LQG5G2LY.mjs';
6
8
  import { GrowableUint32, bitsetHas, bitsetSet, createBitSet } from './chunk-JUKYYXSP.mjs';
7
- import { partialFieldsOf, getNestedValue, schemaFieldsOf, tokenizeOptions, sameFields, encodeDocument, validateDocument, validateDocumentStrict, extractVectorFieldsFromSchema, visitDocumentSurfaceSpellings, visitDocumentSpellings } from './chunk-SOUZMPME.mjs';
8
- import { encodeStringBlob, encodeLookupKey, visitTokens, codePointOrder } from './chunk-65WCV5JO.mjs';
9
+ import { getNestedValue, tokenizeOptions, sameFields, validateDocument, validateDocumentStrict, visitDocumentSurfaceSpellings, visitDocumentSpellings } from './chunk-VMXSVVXG.mjs';
10
+ import { partialFieldsOf, schemaFieldsOf, encodeDocument, extractVectorFieldsFromSchema } from './chunk-Z3TNWCI5.mjs';
11
+ import { encodeStringBlob, encodeLookupKey, visitTokens, codePointOrder } from './chunk-ZIFJXCKA.mjs';
9
12
  import { SEGMENT_TOKEN_TABLE_START, SEGMENT_POSTING_LOG_START, SEGMENT_POSITION_POOL_START, SEGMENT_FIELD_SCRATCH_START, FROZEN_REMOVAL_INDEX_MAX_PROCESS_FRACTION } from './chunk-4UMZ7KQL.mjs';
10
- import { isWordIndexedBase, fuzzyPrefixOf, boundedLevenshtein } from './chunk-KYVRZAYP.mjs';
13
+ import { fuzzyPrefixOf, boundedLevenshtein } from './chunk-GES7U2PM.mjs';
14
+ import { isWordIndexedBase } from './chunk-3A5KI24C.mjs';
11
15
  import { PROTOTYPE_POLLUTION_KEYS } from './chunk-L5ORED7V.mjs';
12
- import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
16
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
13
17
  import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
14
18
  import { Decoder, decode } from '@msgpack/msgpack';
15
19
 
@@ -3234,7 +3238,7 @@ async function attachSegments(entry, action) {
3234
3238
  growPartitionsTo(entry.manager, segment.partitionId);
3235
3239
  const surfaceForms = segment.survivingSurfaceForms;
3236
3240
  const spellings = surfaceForms === void 0 ? void 0 : NO_REMOVED_SPELLINGS;
3237
- const frozen = isPagedSnapshot(segment.snapshot) ? (await import('./module-6RLIKSZQ.mjs')).createPagedFrozenSegment(segment.snapshot) : createSharedFrozenSegment(segment.snapshot, surfaceForms);
3241
+ const frozen = isPagedSnapshot(segment.snapshot) ? (await import('./module-MG7JMV2U.mjs')).createPagedFrozenSegment(segment.snapshot) : createSharedFrozenSegment(segment.snapshot, surfaceForms);
3238
3242
  for (const docId of segment.tombstonedDocIds ?? []) frozen.tombstoneDocument(docId, spellings);
3239
3243
  entry.manager.attachFrozenSegment(segment.partitionId, frozen);
3240
3244
  }
@@ -3289,7 +3293,7 @@ function runSegmentAction(entry, action) {
3289
3293
  case "attachSegments":
3290
3294
  return attachSegments(entry, action);
3291
3295
  case "adoptDiskSegments":
3292
- return import('./module-6RLIKSZQ.mjs').then((code) => code.adoptSegmentsOnWorker(entry.manager, action));
3296
+ return import('./module-MG7JMV2U.mjs').then((code) => code.adoptSegmentsOnWorker(entry.manager, action));
3293
3297
  case "compactSegments": {
3294
3298
  const partition = requireComposite(entry, action.indexName, action.partitionId, "compact");
3295
3299
  return mergeFrozenSegments(
@@ -1,168 +1,13 @@
1
- import { writeLiveVectors, decodeSegmentManifest, openManifestPayload, listedKeysOf, decodeManifestPayload, SINGLE_NODE_PRIMARY_TERM } from './chunk-ZS6CMXAE.mjs';
2
- import { vectorsPerFile } from './chunk-IJSFWGVW.mjs';
3
- import { vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-G5KHSM6E.mjs';
4
- import { writeCheckpointSegments, commitCheckpointManifest, partitionContentsOf } from './chunk-KQJVNPRM.mjs';
5
- import { DEFAULT_COMPACTION_THRESHOLD } from './chunk-CSHHU7PA.mjs';
6
- import { manifestKey, manifestFileRefs } from './chunk-7LDMWKP6.mjs';
7
- import { HEADER_SIZE } from './chunk-2PNYKG2D.mjs';
1
+ import { openManifestPayload, listedKeysOf, decodeManifestPayload } from './chunk-IJU7LL7D.mjs';
2
+ import { manifestFileRefs } from './chunk-Q3TCTQCC.mjs';
3
+ import { HEADER_SIZE } from './chunk-HVYICDY3.mjs';
8
4
  import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
9
- import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.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
- }
5
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
162
6
 
163
7
  // src/persistence/archive/constants.ts
164
8
  var MAX_PAX_HEADER_BYTES = 65536;
165
9
  var ARCHIVE_FILE_CHUNK_BYTES = 4194304;
10
+ var ARCHIVE_ENTRY_ESTIMATE_BYTES = 1536;
166
11
 
167
12
  // src/persistence/archive/tar.ts
168
13
  var TAR_BLOCK_BYTES = 512;
@@ -451,78 +296,4 @@ async function readSnapshotArchive(reader, handlers) {
451
296
  }
452
297
  }
453
298
 
454
- // src/persistence/archive/write.ts
455
- function entryChunks(name, bytes) {
456
- return [...tarEntryHeaders(name, bytes.byteLength), bytes, tarPadding(bytes.byteLength)].filter(
457
- (chunk) => chunk.byteLength > 0
458
- );
459
- }
460
- async function* fileEntryChunks(source, name, ref) {
461
- yield* tarEntryHeaders(name, ref.bytes).filter((chunk) => chunk.byteLength > 0);
462
- for (let offset = 0; offset < ref.bytes; offset += ARCHIVE_FILE_CHUNK_BYTES) {
463
- yield await source.readRange(ref, offset, Math.min(ARCHIVE_FILE_CHUNK_BYTES, ref.bytes - offset));
464
- }
465
- const padding = tarPadding(ref.bytes);
466
- if (padding.byteLength > 0) yield padding;
467
- }
468
- async function* archiveChunks(source) {
469
- yield* entryChunks(ARCHIVE_CONFIG_ENTRY, source.config);
470
- yield* entryChunks(ARCHIVE_MANIFEST_ENTRY, source.manifestBytes);
471
- const prefix = `${source.sourceIndexName}/`;
472
- for (const ref of manifestFileRefs(source.manifest)) {
473
- yield* fileEntryChunks(source, ref.key.slice(prefix.length), ref);
474
- }
475
- yield tarEnd();
476
- }
477
- function archiveStream(source) {
478
- const chunks = archiveChunks(source);
479
- let released = false;
480
- const release = () => {
481
- if (released) return;
482
- released = true;
483
- source.release();
484
- };
485
- return new ReadableStream({
486
- async pull(controller) {
487
- try {
488
- const step = await chunks.next();
489
- if (step.done) {
490
- release();
491
- controller.close();
492
- return;
493
- }
494
- controller.enqueue(step.value);
495
- } catch (error) {
496
- release();
497
- controller.error(error);
498
- }
499
- },
500
- async cancel() {
501
- release();
502
- await chunks.return(void 0);
503
- }
504
- });
505
- }
506
-
507
- // src/persistence/archive/file-entry.ts
508
- async function writeArchiveFile(store, key, chunks) {
509
- const { directory } = store;
510
- if (directory === void 0) {
511
- const held = [];
512
- for await (const chunk of chunks) held.push(chunk);
513
- await store.write(key, held);
514
- return;
515
- }
516
- const receiving = `${key}.receiving`;
517
- await directory.remove(receiving);
518
- const handle = await directory.appendHandle(receiving);
519
- try {
520
- for await (const chunk of chunks) await handle.append(chunk);
521
- await handle.sync();
522
- } finally {
523
- await handle.close();
524
- }
525
- await directory.move(receiving, key);
526
- }
527
-
528
- export { archiveStream, buildArchiveFromMemory, memoryCheckpointStore, readSnapshotArchive, sourceIndexNameOf, writeArchiveFile };
299
+ export { ARCHIVE_CONFIG_ENTRY, ARCHIVE_ENTRY_ESTIMATE_BYTES, ARCHIVE_FILE_CHUNK_BYTES, ARCHIVE_MANIFEST_ENTRY, readSnapshotArchive, sourceIndexNameOf, tarEnd, tarEntryHeaders, tarPadding };
@@ -1,7 +1,8 @@
1
- import { removeDocumentVectors, prepareDocumentVectors, insertDocumentVectors } from './chunk-2PNYKG2D.mjs';
2
- import { getNestedValue, requireValidFieldTypes } from './chunk-SOUZMPME.mjs';
1
+ import { removeDocumentVectors, prepareDocumentVectors, insertDocumentVectors } from './chunk-LSM2YTKM.mjs';
2
+ import { getNestedValue } from './chunk-VMXSVVXG.mjs';
3
+ import { requireValidFieldTypes } from './chunk-Z3TNWCI5.mjs';
3
4
  import { VECTOR_PATTERN } from './chunk-L5ORED7V.mjs';
4
- import { ErrorCodes, NarsilError } from './chunk-MDF6PDIA.mjs';
5
+ import { ErrorCodes, NarsilError } from './chunk-KUZKUONM.mjs';
5
6
  import { decode } from '@msgpack/msgpack';
6
7
 
7
8
  function validateReplicationEntry(entry, localPrimaryTerm, log) {
@@ -0,0 +1,32 @@
1
+ // src/sync/device/constants.ts
2
+ var RECONNECT_MIN_DELAY_MS = 500;
3
+ var RETRY_MAX_DELAY_MS = 3e4;
4
+ var BACKOFF_DOUBLINGS_LIMIT = 30;
5
+ var DEFAULT_REPLAY_LIMIT_OF_SNAPSHOT = 1;
6
+ var KEPT_ENTRY_FLUSH_BYTES = 4 * 1024 * 1024;
7
+ var KEPT_ENTRY_FLUSH_IDLE_MS = 1e3;
8
+ var UPLOAD_RETRY_DELAY_MS = 1e3;
9
+ var SNAPSHOT_RETRY_DELAY_MS = 5e3;
10
+ var SNAPSHOT_MEMORY_PER_ARCHIVE_BYTE = 3;
11
+ var QUEUE_COMPACTION_BYTES = 1024 * 1024;
12
+ var STORE_FRAME_LIMIT_BYTES = 256 * 1024 * 1024;
13
+ var DOWNLOAD_FRAME_BYTES = 1024 * 1024;
14
+ var DOWNLOAD_SAVE_BYTES = 1024 * 1024;
15
+ var UPLOAD_BATCH_WRITES = 100;
16
+ var KEPT_ENTRY_OVERHEAD_BYTES = 32;
17
+ var DEFAULT_INDEXEDDB_DEVICE_STORE_NAME = "narsil-device-sync";
18
+ var INDEXEDDB_DEVICE_STORE_BLOCKED_TIMEOUT_MS = 5e3;
19
+
20
+ // src/sync/device/stores/serial.ts
21
+ function createSerial() {
22
+ let tail = Promise.resolve();
23
+ return {
24
+ run(task) {
25
+ const result = tail.then(task, task);
26
+ tail = result.catch(() => void 0);
27
+ return result;
28
+ }
29
+ };
30
+ }
31
+
32
+ export { BACKOFF_DOUBLINGS_LIMIT, DEFAULT_INDEXEDDB_DEVICE_STORE_NAME, DEFAULT_REPLAY_LIMIT_OF_SNAPSHOT, DOWNLOAD_FRAME_BYTES, DOWNLOAD_SAVE_BYTES, INDEXEDDB_DEVICE_STORE_BLOCKED_TIMEOUT_MS, KEPT_ENTRY_FLUSH_BYTES, KEPT_ENTRY_FLUSH_IDLE_MS, KEPT_ENTRY_OVERHEAD_BYTES, QUEUE_COMPACTION_BYTES, RECONNECT_MIN_DELAY_MS, RETRY_MAX_DELAY_MS, SNAPSHOT_MEMORY_PER_ARCHIVE_BYTE, SNAPSHOT_RETRY_DELAY_MS, STORE_FRAME_LIMIT_BYTES, UPLOAD_BATCH_WRITES, UPLOAD_RETRY_DELAY_MS, createSerial };
@@ -0,0 +1,49 @@
1
+ import { NATIVE_CRC32_MIN_BYTES } from './chunk-U476IXKQ.mjs';
2
+ import * as zlib from 'zlib';
3
+
4
+ var candidate = zlib.crc32;
5
+ var nativeCrc32 = typeof candidate === "function" ? candidate : null;
6
+
7
+ // src/serialization/crc32.ts
8
+ var IEEE_POLYNOMIAL = 3988292384;
9
+ var ALL_BITS = 4294967295;
10
+ var cachedTable = null;
11
+ function buildTable() {
12
+ const table = new Uint32Array(256);
13
+ for (let i = 0; i < 256; i++) {
14
+ let crc = i;
15
+ for (let bit = 0; bit < 8; bit++) {
16
+ crc = crc & 1 ? crc >>> 1 ^ IEEE_POLYNOMIAL : crc >>> 1;
17
+ }
18
+ table[i] = crc;
19
+ }
20
+ return table;
21
+ }
22
+ function getTable() {
23
+ if (cachedTable === null) {
24
+ cachedTable = buildTable();
25
+ }
26
+ return cachedTable;
27
+ }
28
+ function crc322(data) {
29
+ return crc32Final(crc32Update(crc32Init(), data));
30
+ }
31
+ function crc32Init() {
32
+ return ALL_BITS;
33
+ }
34
+ function crc32Update(state, data) {
35
+ if (nativeCrc32 !== null && data.length >= NATIVE_CRC32_MIN_BYTES) {
36
+ return nativeCrc32(data, (state ^ ALL_BITS) >>> 0) ^ ALL_BITS;
37
+ }
38
+ const table = getTable();
39
+ let crc = state;
40
+ for (let i = 0; i < data.length; i++) {
41
+ crc = crc >>> 8 ^ table[(crc ^ data[i]) & 255];
42
+ }
43
+ return crc;
44
+ }
45
+ function crc32Final(state) {
46
+ return (state ^ ALL_BITS) >>> 0;
47
+ }
48
+
49
+ export { crc322 as crc32, crc32Final, crc32Init, crc32Update };
@@ -1,11 +1,13 @@
1
- import { restoredEmbedding, restoredPartitionConfig, readSharedConfigFields } from './chunk-IRWP524D.mjs';
1
+ import { restoredEmbedding, restoredPartitionConfig, readSharedConfigFields } from './chunk-YBJDOA2T.mjs';
2
+ import { isSyncEpoch } from './chunk-BUMREPLU.mjs';
2
3
  import { MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR } from './chunk-JDDXV6UF.mjs';
3
- import { generateId } from './chunk-UGVUW27S.mjs';
4
4
  import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-EEBCDP36.mjs';
5
- import { getLanguage, decodeSynonymRules } from './chunk-2HJWQPR6.mjs';
6
- import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
5
+ import { generateId } from './chunk-5FUOVJKG.mjs';
6
+ import { decodeSynonymRules } from './chunk-NTZOXVUZ.mjs';
7
+ import { getLanguage } from './chunk-JCLTESFN.mjs';
8
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
7
9
  import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
8
- import { encode, decode } from '@msgpack/msgpack';
10
+ import { decode, encode } from '@msgpack/msgpack';
9
11
 
10
12
  // src/distribution/payload-guards.ts
11
13
  function isRecord(value) {
@@ -27,6 +29,7 @@ var TEARDOWN_RETRY_DELAY_MS = 500;
27
29
  var TEARDOWN_RETRY_ROUNDS = 3;
28
30
  var RECOVERY_CAS_ATTEMPTS = 5;
29
31
  var REPLICATION_FACTOR_CAS_ATTEMPTS = 5;
32
+ var SYNC_EPOCH_CAS_ATTEMPTS = 5;
30
33
  var HIDDEN_GENERATION_PREFIX = "narsil-generation-";
31
34
  var RESHARD_CUTOVER_LAG_ENTRIES = 1e3;
32
35
  var RESHARD_CUTOVER_TIMEOUT_MS = 1e4;
@@ -54,6 +57,48 @@ var DEFAULT_NODE_LIFECYCLE_CONFIG = {
54
57
  nodeHeartbeatIntervalMs: 1e4
55
58
  };
56
59
  var MAX_SYNONYM_GENERATION_LENGTH = 128;
60
+ function isPositiveSafeInteger(value) {
61
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 1;
62
+ }
63
+ function decodeSyncSetting(raw, reject) {
64
+ if (!isRecord2(raw) || typeof raw.enabled !== "boolean") return reject("sync must be a map with a boolean enabled");
65
+ const { historyMaxAgeMs, historyMaxBytes } = raw;
66
+ if (historyMaxAgeMs !== void 0 && !isPositiveSafeInteger(historyMaxAgeMs)) {
67
+ return reject("sync.historyMaxAgeMs must be a positive whole number");
68
+ }
69
+ if (historyMaxBytes !== void 0 && !isPositiveSafeInteger(historyMaxBytes)) {
70
+ return reject("sync.historyMaxBytes must be a positive whole number");
71
+ }
72
+ return {
73
+ enabled: raw.enabled,
74
+ ...historyMaxAgeMs !== void 0 ? { historyMaxAgeMs } : {},
75
+ ...historyMaxBytes !== void 0 ? { historyMaxBytes } : {}
76
+ };
77
+ }
78
+ function decodeClusterSyncSettings(raw, reject) {
79
+ const sync = raw.sync === void 0 ? void 0 : decodeSyncSetting(raw.sync, reject);
80
+ if (raw.syncActive !== void 0 && typeof raw.syncActive !== "boolean") {
81
+ return reject("syncActive must be a boolean");
82
+ }
83
+ if (raw.syncEpoch !== void 0 && !isSyncEpoch(raw.syncEpoch)) {
84
+ return reject("syncEpoch must be 32 lowercase hexadecimal digits");
85
+ }
86
+ return {
87
+ ...sync !== void 0 ? { sync } : {},
88
+ ...raw.syncActive !== void 0 ? { syncActive: raw.syncActive } : {},
89
+ ...raw.syncEpoch !== void 0 ? { syncEpoch: raw.syncEpoch } : {}
90
+ };
91
+ }
92
+ function metadataWithSync(snapshot, next) {
93
+ const decoded = decode(snapshot.bytes);
94
+ const fields = isRecord2(decoded) ? decoded : {};
95
+ const settings = isRecord2(fields.settings) ? withoutSyncFields(fields.settings) : { language: snapshot.settings?.language ?? getLanguage("english").name };
96
+ return new Uint8Array(encode({ ...fields, settings: { ...settings, ...next } }, { ignoreUndefined: true }));
97
+ }
98
+ function withoutSyncFields(settings) {
99
+ const { sync: _sync, syncActive: _active, syncEpoch: _epoch, ...rest } = settings;
100
+ return rest;
101
+ }
57
102
 
58
103
  // src/distribution/cluster/synonym-set.ts
59
104
  var SYNONYM_CHUNK_BYTES = 1048576;
@@ -300,7 +345,8 @@ function decodeIndexSettings(raw, indexName) {
300
345
  ...partitions !== void 0 ? { partitions } : {},
301
346
  ...embedding !== void 0 ? { embedding } : {}
302
347
  }),
303
- ...synonyms !== void 0 ? { synonyms } : {}
348
+ ...synonyms !== void 0 ? { synonyms } : {},
349
+ ...decodeClusterSyncSettings(raw, reject)
304
350
  };
305
351
  }
306
352
  function withPartitionCount(config, partitionCount) {
@@ -319,6 +365,9 @@ function indexConfigFromSettings(schema, settings, indexName) {
319
365
  analysisGeneration: _generation,
320
366
  pendingAnalysis: _pending,
321
367
  analysisFailure: _failure,
368
+ sync: _sync,
369
+ syncActive: _syncActive,
370
+ syncEpoch: _syncEpoch,
322
371
  ...fields
323
372
  } = settings;
324
373
  return {
@@ -464,7 +513,8 @@ async function putGenerationMetadata(coordinator, sourceName, generation) {
464
513
  copiedSetGeneration = held.ref.generation;
465
514
  continue;
466
515
  }
467
- const bytes = new Uint8Array(encode({ ...decoded, ...generation }, { ignoreUndefined: true }));
516
+ const settings = isRecord2(decoded.settings) ? withoutSyncFields(decoded.settings) : decoded.settings;
517
+ const bytes = new Uint8Array(encode({ ...decoded, settings, ...generation }, { ignoreUndefined: true }));
468
518
  return coordinator.compareAndSet(key, current, bytes);
469
519
  }
470
520
  }
@@ -576,4 +626,4 @@ function storedSynonymSetOf(bytes) {
576
626
  return ref === null ? null : { indexUuid: decoded.indexUuid, ref };
577
627
  }
578
628
 
579
- export { ALLOCATION_CAS_ATTEMPTS, ALLOCATION_RETRY_DELAY_MS, ANALYSIS_CHANGE_POLL_INTERVAL_MS, ANALYSIS_CHANGE_RETRY_MS, ANALYSIS_REBUILD_RESEND_MS, BOOTSTRAP_CAS_ATTEMPTS, DEFAULT_CONTROLLER_CONFIG, DEFAULT_NODE_LIFECYCLE_CONFIG, ESTIMATED_PARTITION_BYTES, HIDDEN_GENERATION_PREFIX, LEADERSHIP_IMBALANCE_THRESHOLD, MAX_RESHARD_CUTOVER_ATTEMPTS, PARTITION_STORES_TIMEOUT_MS, REBALANCE_THRESHOLD, RECOVERY_CAS_ATTEMPTS, RESHARD_CONTROLLER_POLL_INTERVAL_MS, RESHARD_CUTOVER_LAG_ENTRIES, RESHARD_CUTOVER_TIMEOUT_MS, RESHARD_FORWARD_BATCH_DOCUMENTS, RESHARD_POLL_INTERVAL_MS, RESHARD_RECORD_CAS_ATTEMPTS, RESHARD_RECORD_CHECK_INTERVAL_MS, RESHARD_RETRY_DELAY_MS, TEARDOWN_CAS_ATTEMPTS, TEARDOWN_RETRY_DELAY_MS, TEARDOWN_RETRY_ROUNDS, decodeIndexSettings, deleteSynonymSet, getClusterIndexConfig, getIndexMetadata, indexConfigFromSettings, indexConfigKey, indexMetadataSnapshotOf, indexSettingsOf, indexUuidOfStoredMetadata, isRecord, isRecord2, isValidInteger, metadataWithBm25, metadataWithSynonymSet, putGenerationMetadata, putIndexMetadata, putIndexReplicationFactor, readIndexMetadataSnapshot, readIndexState, storeSynonymSet, storedSynonymSetOf, validateIndexName, withPartitionCount };
629
+ export { ALLOCATION_CAS_ATTEMPTS, ALLOCATION_RETRY_DELAY_MS, ANALYSIS_CHANGE_POLL_INTERVAL_MS, ANALYSIS_CHANGE_RETRY_MS, ANALYSIS_REBUILD_RESEND_MS, BOOTSTRAP_CAS_ATTEMPTS, DEFAULT_CONTROLLER_CONFIG, DEFAULT_NODE_LIFECYCLE_CONFIG, ESTIMATED_PARTITION_BYTES, HIDDEN_GENERATION_PREFIX, LEADERSHIP_IMBALANCE_THRESHOLD, MAX_RESHARD_CUTOVER_ATTEMPTS, PARTITION_STORES_TIMEOUT_MS, REBALANCE_THRESHOLD, RECOVERY_CAS_ATTEMPTS, RESHARD_CONTROLLER_POLL_INTERVAL_MS, RESHARD_CUTOVER_LAG_ENTRIES, RESHARD_CUTOVER_TIMEOUT_MS, RESHARD_FORWARD_BATCH_DOCUMENTS, RESHARD_POLL_INTERVAL_MS, RESHARD_RECORD_CAS_ATTEMPTS, RESHARD_RECORD_CHECK_INTERVAL_MS, RESHARD_RETRY_DELAY_MS, SYNC_EPOCH_CAS_ATTEMPTS, TEARDOWN_CAS_ATTEMPTS, TEARDOWN_RETRY_DELAY_MS, TEARDOWN_RETRY_ROUNDS, decodeIndexSettings, deleteSynonymSet, getClusterIndexConfig, getIndexMetadata, indexConfigFromSettings, indexConfigKey, indexMetadataSnapshotOf, indexSettingsOf, indexUuidOfStoredMetadata, isRecord, isRecord2, isValidInteger, metadataWithBm25, metadataWithSync, metadataWithSynonymSet, putGenerationMetadata, putIndexMetadata, putIndexReplicationFactor, readIndexMetadataSnapshot, readIndexState, storeSynonymSet, storedSynonymSetOf, validateIndexName, withPartitionCount };
@@ -1,7 +1,7 @@
1
- import { decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, countDead } from './chunk-G5KHSM6E.mjs';
2
- import { readListedFile, requireListedChecksum, requireListedSize } from './chunk-7LDMWKP6.mjs';
3
- import { HEADER_SIZE, openChecksummedEnvelope } from './chunk-2PNYKG2D.mjs';
4
- import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
1
+ import { decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, countDead } from './chunk-AO2FAYIZ.mjs';
2
+ import { readListedFile, requireListedChecksum, requireListedSize } from './chunk-S2N75OTN.mjs';
3
+ import { HEADER_SIZE, openChecksummedEnvelope } from './chunk-HVYICDY3.mjs';
4
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
5
5
  import { decode } from '@msgpack/msgpack';
6
6
 
7
7
  var VECTOR_FILE_ENVELOPE_VERSION = 2;
@@ -64,7 +64,7 @@ function holdsEveryHead(ref) {
64
64
  async function loadFieldOnDemand(store, ref, vectorIndex, resolvePartition) {
65
65
  const { pathOf } = store;
66
66
  if (pathOf === void 0 || vectorIndex.storage !== "disk" || !holdsEveryHead(ref)) return false;
67
- const { loadFilesByParts, openColdVectorField, osqBitsOf, waitBeforeColdLoad } = await import('./cold-module-PYSSBIL7.mjs');
67
+ const { loadFilesByParts, openColdVectorField, osqBitsOf, waitBeforeColdLoad } = await import('./cold-module-YLWMTTZG.mjs');
68
68
  await Promise.all([
69
69
  ...ref.files.map((file) => requireListedSize(store, file.key, { bytes: file.bytes, what: "vector file" })),
70
70
  ...ref.graphParts.map((part) => requireListedSize(store, part.key, { bytes: part.bytes, what: "graph part" }))
@@ -0,0 +1,101 @@
1
+ import { isSyncEpoch } from './chunk-BUMREPLU.mjs';
2
+ import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
3
+ import { encode, decode } from '@msgpack/msgpack';
4
+
5
+ function damaged(detail) {
6
+ return new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, `The device sync store is damaged: ${detail}`);
7
+ }
8
+ function isRecord(value) {
9
+ return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Uint8Array);
10
+ }
11
+ function isCount(value) {
12
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
13
+ }
14
+ function encodeQueueRecord(record) {
15
+ return encode(record, { ignoreUndefined: true });
16
+ }
17
+ function decodeQueueRecord(bytes) {
18
+ const raw = decode(bytes);
19
+ if (!isRecord(raw)) throw damaged("a queue record is not a map");
20
+ if (raw.type === "next" && isCount(raw.sequence)) return { type: "next", sequence: raw.sequence };
21
+ if (raw.type === "removed" && Array.isArray(raw.sequences) && raw.sequences.every(isCount)) {
22
+ return { type: "removed", sequences: raw.sequences };
23
+ }
24
+ if (raw.type === "write" && isRecord(raw.write)) {
25
+ const write = raw.write;
26
+ if (isCount(write.sequence) && typeof write.documentId === "string") {
27
+ if (write.document === null || write.document === void 0) {
28
+ return { type: "write", write: { sequence: write.sequence, documentId: write.documentId, document: null } };
29
+ }
30
+ if (isRecord(write.document)) {
31
+ const document = write.document;
32
+ return { type: "write", write: { sequence: write.sequence, documentId: write.documentId, document } };
33
+ }
34
+ }
35
+ }
36
+ throw damaged("a queue record is invalid");
37
+ }
38
+ function encodeKeptEntries(entries) {
39
+ return encode(entries.map((entry) => [entry.partitionId, entry.seqNo, entry.documentId, entry.document]));
40
+ }
41
+ function decodeKeptEntries(bytes) {
42
+ const raw = decode(bytes);
43
+ if (!Array.isArray(raw)) throw damaged("a kept entry batch is not a list");
44
+ return raw.map((item) => {
45
+ if (!Array.isArray(item) || item.length !== 4) throw damaged("a kept entry is invalid");
46
+ const [partitionId, seqNo, documentId, document] = item;
47
+ if (!isCount(partitionId) || !isCount(seqNo) || typeof documentId !== "string") {
48
+ throw damaged("a kept entry is invalid");
49
+ }
50
+ if (document !== null && !(document instanceof Uint8Array)) throw damaged("a kept entry is invalid");
51
+ return { partitionId, seqNo, documentId, document };
52
+ });
53
+ }
54
+ function encodePosition(position) {
55
+ return encode({ epoch: position.epoch, seqNos: position.seqNos });
56
+ }
57
+ function decodePosition(bytes) {
58
+ const raw = decode(bytes);
59
+ if (!isRecord(raw) || !isSyncEpoch(raw.epoch) || !Array.isArray(raw.seqNos) || !raw.seqNos.every(isCount)) {
60
+ throw damaged("the saved position is invalid");
61
+ }
62
+ return { epoch: raw.epoch, seqNos: raw.seqNos };
63
+ }
64
+ function encodeDownloadTag(entityTag) {
65
+ return encode({ entityTag });
66
+ }
67
+ function decodeDownloadTag(bytes) {
68
+ const raw = decode(bytes);
69
+ if (!isRecord(raw) || typeof raw.entityTag !== "string") throw damaged("the saved download is invalid");
70
+ return raw.entityTag;
71
+ }
72
+ function downloadOutOfOrder(entityTag, offset, saved) {
73
+ return new NarsilError(
74
+ ErrorCodes.PERSISTENCE_SAVE_FAILED,
75
+ `The device sync store holds ${saved} bytes of the download, so the next bytes must start at ${saved} or at 0`,
76
+ { entityTag, offset, saved }
77
+ );
78
+ }
79
+ function replayQueue(payloads) {
80
+ const writes = /* @__PURE__ */ new Map();
81
+ const recordBytes = /* @__PURE__ */ new Map();
82
+ let nextSequence = 1;
83
+ for (const payload of payloads) {
84
+ const record = decodeQueueRecord(payload);
85
+ if (record.type === "next") {
86
+ nextSequence = Math.max(nextSequence, record.sequence);
87
+ } else if (record.type === "removed") {
88
+ for (const sequence of record.sequences) {
89
+ writes.delete(sequence);
90
+ recordBytes.delete(sequence);
91
+ }
92
+ } else {
93
+ writes.set(record.write.sequence, record.write);
94
+ recordBytes.set(record.write.sequence, payload.byteLength);
95
+ nextSequence = Math.max(nextSequence, record.write.sequence + 1);
96
+ }
97
+ }
98
+ return { writes, recordBytes, nextSequence };
99
+ }
100
+
101
+ export { decodeDownloadTag, decodeKeptEntries, decodePosition, downloadOutOfOrder, encodeDownloadTag, encodeKeptEntries, encodePosition, encodeQueueRecord, replayQueue };