@delali/narsil 0.3.1-next.153 → 0.3.1-next.155

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 (330) hide show
  1. package/README.md +3 -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-3TFIHT5E.mjs} +32 -23
  7. package/dist/{react-native/chunks/analysis-change-entry-CXNRW324.mjs → analysis-change-entry-KA6JAO4X.mjs} +1 -1
  8. package/dist/archive-history-E4R73RWD.mjs +29 -0
  9. package/dist/browser/{analysis-change-2V2HZ2NY.mjs → analysis-change-TC36BU47.mjs} +39 -10
  10. package/dist/{analysis-change-entry-QD7YNDEE.mjs → browser/analysis-change-entry-4MH3CZXH.mjs} +1 -1
  11. package/dist/browser/archive-history-4IP5XQZY.mjs +29 -0
  12. package/dist/browser/chunk-23XRXIBW.mjs +85 -0
  13. package/dist/browser/chunk-3UIEB4QF.mjs +63 -0
  14. package/dist/browser/{chunk-CSCKZBVJ.mjs → chunk-4EWUGZYZ.mjs} +4 -4
  15. package/dist/browser/chunk-4WCVMOU3.mjs +151 -0
  16. package/dist/browser/{chunk-QJCO3TJU.mjs → chunk-56W3HQVJ.mjs} +9 -150
  17. package/dist/{react-native/chunks/chunk-VGUWIZFQ.mjs → browser/chunk-5TCXK5SB.mjs} +2 -2
  18. package/dist/browser/chunk-5W3MMTLG.mjs +19 -0
  19. package/dist/browser/chunk-7IGKGWSQ.mjs +79 -0
  20. package/dist/browser/chunk-A5KUEGDY.mjs +241 -0
  21. package/dist/browser/{chunk-HT7J73QL.mjs → chunk-ABCXENU5.mjs} +2 -2
  22. package/dist/browser/chunk-ATEBYXP6.mjs +10 -0
  23. package/dist/browser/chunk-BXM5XOCA.mjs +315 -0
  24. package/dist/browser/chunk-CJSYBQ4J.mjs +100 -0
  25. package/dist/browser/chunk-DSXIBE6N.mjs +78 -0
  26. package/dist/browser/chunk-ELV4OZOI.mjs +29 -0
  27. package/dist/{react-native/chunks/chunk-QC4ZRBSX.mjs → browser/chunk-EXQZGUQH.mjs} +2 -79
  28. package/dist/browser/{chunk-2A2IPRC3.mjs → chunk-FNIFPFB7.mjs} +5 -31
  29. package/dist/browser/chunk-G64Q6OJF.mjs +96 -0
  30. package/dist/browser/chunk-GPPOG6PT.mjs +9 -0
  31. package/dist/browser/chunk-IKDKX5VQ.mjs +1007 -0
  32. package/dist/browser/chunk-JIJXMI42.mjs +1829 -0
  33. package/dist/browser/chunk-JVBP5EYO.mjs +1106 -0
  34. package/dist/browser/{chunk-TQ5UMFG5.mjs → chunk-K4GCSZLI.mjs} +15 -6
  35. package/dist/browser/{chunk-PM4MUM5N.mjs → chunk-K5AXJBLL.mjs} +6 -5
  36. package/dist/browser/chunk-KKAMCABR.mjs +432 -0
  37. package/dist/browser/{chunk-IAXZAVYL.mjs → chunk-LFIWRCEA.mjs} +1 -159
  38. package/dist/browser/chunk-M3MQE2X7.mjs +151 -0
  39. package/dist/browser/chunk-ML7THVLJ.mjs +38 -0
  40. package/dist/browser/chunk-NLWTBAGB.mjs +111 -0
  41. package/dist/browser/chunk-OEDCEZXJ.mjs +92 -0
  42. package/dist/browser/{chunk-MPK76GVS.mjs → chunk-RA6LSBCM.mjs} +1 -21
  43. package/dist/browser/{chunk-GJKXW3SF.mjs → chunk-RND5CLX3.mjs} +147 -253
  44. package/dist/{react-native/chunks/chunk-DFQJ4IJB.mjs → browser/chunk-RQBUNZQW.mjs} +2 -2
  45. package/dist/browser/{chunk-VD7JEUIR.mjs → chunk-RRO3EV4C.mjs} +9 -8
  46. package/dist/browser/{chunk-KWYQ6KX4.mjs → chunk-SMEQ36NT.mjs} +162 -2019
  47. package/dist/{chunk-MDF6PDIA.mjs → browser/chunk-SRMZXJSL.mjs} +8 -1
  48. package/dist/browser/{chunk-7ZJTRUVW.mjs → chunk-SUDNZKPL.mjs} +2 -2
  49. package/dist/browser/{chunk-LURXVCHG.mjs → chunk-U3JOQGWX.mjs} +1 -1
  50. package/dist/browser/chunk-VI7BQR4U.mjs +21 -0
  51. package/dist/browser/{chunk-B3JM6Z74.mjs → chunk-XY4VVBBO.mjs} +3 -2
  52. package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
  53. package/dist/browser/chunk-ZI2V4VD7.mjs +21 -0
  54. package/dist/browser/{cold-module-YECAK4MN.mjs → cold-module-NEUGHUPA.mjs} +21 -14
  55. package/dist/browser/durability-config-TIYKW6XX.mjs +89 -0
  56. package/dist/browser/{durability-wiring-LM7WFL6X.mjs → durability-wiring-CVGPRO6D.mjs} +1299 -881
  57. package/dist/browser/engine-hooks-YXMPHZKZ.mjs +16 -0
  58. package/dist/browser/import-OM6QAW45.mjs +18 -0
  59. package/dist/browser/methods-KTQCSIN4.mjs +30 -0
  60. package/dist/browser/{module-XQLEOYNM.mjs → module-3HNFCBJ5.mjs} +10 -8
  61. package/dist/browser/{module-KAMRAJLE.mjs → module-E33X4AOK.mjs} +17 -10
  62. package/dist/browser/operations-OJ3BXS55.mjs +5 -0
  63. package/dist/browser/{phrase-module-CNKMUY4U.mjs → phrase-module-ZXXU7S3B.mjs} +1 -1
  64. package/dist/browser/{pool-DTYSPBMQ.mjs → pool-3JLET5RO.mjs} +3 -2
  65. package/dist/browser/restore-hooks-IF2ZROUP.mjs +113 -0
  66. package/dist/browser/restore-queue-ZBS7CJA6.mjs +55 -0
  67. package/dist/browser/retention-ASWUHAYI.mjs +209 -0
  68. package/dist/browser/{runtime-D2ULZGCN.mjs → runtime-OTAGEFQW.mjs} +1 -1
  69. package/dist/browser/{snapshot-UGZVMP4H.mjs → snapshot-PN7ZW6Q4.mjs} +80 -315
  70. package/dist/browser/start-ZIRB7MQ2.mjs +24 -0
  71. package/dist/browser/sync-state-P5XG6LTQ.mjs +15 -0
  72. package/dist/browser/{write-I5P5MW4O.mjs → write-HMDYCTV2.mjs} +17 -11
  73. package/dist/{capabilities-BT-HLDC8.d.ts → capabilities-Da4ywVVl.d.ts} +94 -7
  74. package/dist/{chunk-LDGGR7YT.mjs → chunk-2MANFZJ3.mjs} +2 -2
  75. package/dist/{chunk-IZT3G24Q.mjs → chunk-2NE7VCYE.mjs} +2 -2
  76. package/dist/{chunk-3TVDTACC.mjs → chunk-3C7MTCCI.mjs} +1 -1
  77. package/dist/chunk-3HB3PEC6.mjs +240 -0
  78. package/dist/chunk-3HHQLEEQ.mjs +1092 -0
  79. package/dist/chunk-3OH67G7R.mjs +214 -0
  80. package/dist/{chunk-ZS6CMXAE.mjs → chunk-3R4UZWQG.mjs} +98 -250
  81. package/dist/{chunk-65WCV5JO.mjs → chunk-4BYWRYPM.mjs} +1 -1
  82. package/dist/{chunk-SOUZMPME.mjs → chunk-4KRC2APY.mjs} +7 -194
  83. package/dist/{chunk-5QMHMELB.mjs → chunk-5FLRXF73.mjs} +8 -1
  84. package/dist/chunk-5FVU47TB.mjs +20 -0
  85. package/dist/chunk-5YNRKI2C.mjs +81 -0
  86. package/dist/chunk-6L3XJXGU.mjs +470 -0
  87. package/dist/chunk-6MSZ543Y.mjs +32 -0
  88. package/dist/{chunk-T4CJDBBE.mjs → chunk-6OEGXLBX.mjs} +1 -1
  89. package/dist/{chunk-3SBJVQLL.mjs → chunk-6RC4K46J.mjs} +2 -2
  90. package/dist/chunk-7GXJUJ24.mjs +49 -0
  91. package/dist/{chunk-FNBNZCGP.mjs → chunk-AILVAOLX.mjs} +2 -2
  92. package/dist/chunk-BDRIVYOK.mjs +72 -0
  93. package/dist/chunk-BUMREPLU.mjs +15 -0
  94. package/dist/chunk-BY6ZDGYS.mjs +50 -0
  95. package/dist/{chunk-5WB2A3XU.mjs → chunk-DCNKVEDB.mjs} +511 -27
  96. package/dist/{chunk-NITCPDFL.mjs → chunk-DIBHI6W5.mjs} +2 -2
  97. package/dist/{chunk-4QCSHLNM.mjs → chunk-DUOLGBTE.mjs} +3 -3
  98. package/dist/chunk-GES7U2PM.mjs +68 -0
  99. package/dist/chunk-GH4WQ22V.mjs +34 -0
  100. package/dist/chunk-GQPTDQCL.mjs +54 -0
  101. package/dist/chunk-H4KHPLHJ.mjs +382 -0
  102. package/dist/{chunk-7TE2AJIH.mjs → chunk-H6VIGE62.mjs} +13 -10
  103. package/dist/{chunk-J7M73VY7.mjs → chunk-HJJI72X7.mjs} +1 -1
  104. package/dist/{chunk-DGRM4EZZ.mjs → chunk-HNVVEQP7.mjs} +1 -1
  105. package/dist/{chunk-RBEHLIKX.mjs → chunk-HW5TNXBO.mjs} +35 -11
  106. package/dist/{chunk-KYVRZAYP.mjs → chunk-I54T6CQP.mjs} +2 -69
  107. package/dist/{chunk-IRWP524D.mjs → chunk-INJYO3BU.mjs} +1 -1
  108. package/dist/chunk-IPN7S4KX.mjs +130 -0
  109. package/dist/{chunk-CSHHU7PA.mjs → chunk-J4IWBIVY.mjs} +11 -30
  110. package/dist/{chunk-G5KHSM6E.mjs → chunk-K4ZIGL2O.mjs} +1 -1
  111. package/dist/{chunk-6RKSY3BX.mjs → chunk-KBDBPVLN.mjs} +5 -5
  112. package/dist/{chunk-J4BDAH2W.mjs → chunk-KBKEXQZA.mjs} +2 -2
  113. package/dist/{chunk-IJSFWGVW.mjs → chunk-KFLK5NA2.mjs} +3 -3
  114. package/dist/{chunk-YGQOPB2Z.mjs → chunk-KHKIRS5D.mjs} +1 -1
  115. package/dist/chunk-KJ3RTZDJ.mjs +101 -0
  116. package/dist/{chunk-2PNYKG2D.mjs → chunk-KMUNHGBQ.mjs} +139 -432
  117. package/dist/chunk-KP7TYHWT.mjs +92 -0
  118. package/dist/{chunk-VP6XRMWR.mjs → chunk-KPIV4RUC.mjs} +6 -32
  119. package/dist/{chunk-NPXVQS33.mjs → chunk-KXCVQWOR.mjs} +4 -3
  120. package/dist/chunk-KYYABCSW.mjs +72 -0
  121. package/dist/{chunk-6F6USYII.mjs → chunk-L7ZD4L3K.mjs} +267 -265
  122. package/dist/{chunk-U46IZNCW.mjs → chunk-LC3FDWTX.mjs} +3 -2
  123. package/dist/{chunk-6BWLDLS3.mjs → chunk-LHKOSI2J.mjs} +1 -1
  124. package/dist/chunk-LNGE7SLY.mjs +151 -0
  125. package/dist/{react-native/chunks/chunk-YH7W556M.mjs → chunk-MP7ABPTD.mjs} +12 -2
  126. package/dist/chunk-MT2NRTA6.mjs +216 -0
  127. package/dist/chunk-NF4DT3IH.mjs +85 -0
  128. package/dist/{chunk-POUYICOU.mjs → chunk-OIJ64LGT.mjs} +1 -1
  129. package/dist/{chunk-SEAJS664.mjs → chunk-PCRA7HTI.mjs} +5 -5
  130. package/dist/chunk-PHQNACDT.mjs +63 -0
  131. package/dist/chunk-Q622CTMC.mjs +74 -0
  132. package/dist/{chunk-NVTFQFUL.mjs → chunk-Q7G3BV3Y.mjs} +1 -1
  133. package/dist/chunk-QDZJM7NI.mjs +23 -0
  134. package/dist/{chunk-52QQWEBS.mjs → chunk-QH3YIQP4.mjs} +36 -7
  135. package/dist/chunk-QJVOLKU6.mjs +111 -0
  136. package/dist/chunk-QUJHMPTP.mjs +30 -0
  137. package/dist/{chunk-3E4RRF5J.mjs → chunk-RSVULW4Q.mjs} +100 -8
  138. package/dist/{chunk-IJPK5PGM.mjs → chunk-RVGRFOGN.mjs} +1 -1
  139. package/dist/chunk-RZWWB2XR.mjs +96 -0
  140. package/dist/{chunk-KQJVNPRM.mjs → chunk-S2EQU2GE.mjs} +19 -16
  141. package/dist/chunk-S5LN746F.mjs +10 -0
  142. package/dist/{chunk-LJ4ENXOD.mjs → chunk-SG3JBNHY.mjs} +2 -2
  143. package/dist/{chunk-B2FTZNNF.mjs → chunk-SMVH6JBE.mjs} +34 -14
  144. package/dist/chunk-SY3EWKQY.mjs +242 -0
  145. package/dist/{chunk-NYSONUB7.mjs → chunk-TQXHPFWT.mjs} +1 -1
  146. package/dist/{chunk-ZHAXP7SD.mjs → chunk-U4BS74YN.mjs} +26 -238
  147. package/dist/chunk-UHICS3JI.mjs +83 -0
  148. package/dist/chunk-UZRZKNNZ.mjs +101 -0
  149. package/dist/chunk-V6EUBAIT.mjs +19 -0
  150. package/dist/{chunk-TTCKT2RT.mjs → chunk-VGF7CFRP.mjs} +134 -11
  151. package/dist/chunk-VHBNF4MA.mjs +543 -0
  152. package/dist/{chunk-AWNHDBKV.mjs → chunk-VQEUR6T6.mjs} +16 -8
  153. package/dist/chunk-WQRN64Q6.mjs +196 -0
  154. package/dist/{chunk-DMNPYF54.mjs → chunk-WZ7YV54N.mjs} +2 -2
  155. package/dist/chunk-Y4WPNHMC.mjs +50 -0
  156. package/dist/{chunk-2HJWQPR6.mjs → chunk-YEDIDCR7.mjs} +6 -122
  157. package/dist/chunk-YEKL4JBK.mjs +96 -0
  158. package/dist/{chunk-UGVUW27S.mjs → chunk-Z2BE2MAM.mjs} +14 -10
  159. package/dist/{chunk-3HV7M5OJ.mjs → chunk-ZAUJFLEN.mjs} +11 -135
  160. package/dist/{chunk-FDG4KXX5.mjs → chunk-ZHCUZZE5.mjs} +6 -4
  161. package/dist/chunk-ZTW5WTGG.mjs +167 -0
  162. package/dist/chunk-ZYAY26KG.mjs +29 -0
  163. package/dist/{client-Cn3gNxUU.d.ts → client-DRv7UVeY.d.ts} +193 -11
  164. package/dist/client.d.ts +9 -7
  165. package/dist/client.mjs +120 -7
  166. package/dist/{cold-module-PYSSBIL7.mjs → cold-module-7XXCEGTZ.mjs} +43 -33
  167. package/dist/config-CoSig5Ox.d.ts +482 -0
  168. package/dist/{config-CfhH1IWQ.d.ts → config-DMwffLKn.d.ts} +20 -5
  169. package/dist/{direct-executor-WYALQSMD.mjs → direct-executor-G5TK7NLA.mjs} +18 -13
  170. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  171. package/dist/distribution/coordinator/etcd.mjs +1 -1
  172. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  173. package/dist/distribution/transport/grpc.mjs +4 -4
  174. package/dist/distribution/transport/in-memory.mjs +2 -2
  175. package/dist/distribution/transport/tcp.mjs +3 -3
  176. package/dist/distribution.d.ts +41 -9
  177. package/dist/distribution.mjs +9304 -7271
  178. package/dist/durability-config-GE4U7MCZ.mjs +89 -0
  179. package/dist/{durability-wiring-7VBZEJLG.mjs → durability-wiring-NCKUC5EO.mjs} +1293 -872
  180. package/dist/embeddings/openai.mjs +2 -2
  181. package/dist/{config-aIsy7mcL.d.ts → engine-CFxPYqEk.d.ts} +716 -407
  182. package/dist/engine-hooks-DHCMOADY.mjs +47 -0
  183. package/dist/{import-GJOMB2HC.mjs → import-NBFXFCSG.mjs} +32 -24
  184. package/dist/{index-MsF7e5hL.d.ts → index-C4AmUnl1.d.ts} +1 -1
  185. package/dist/index.browser.mjs +9 -4
  186. package/dist/index.d.ts +7 -6
  187. package/dist/index.mjs +29 -21
  188. package/dist/index.react-native.mjs +19 -12
  189. package/dist/{long-query-thread-SCUE62TO.mjs → long-query-thread-J4DVRM4A.mjs} +33 -19
  190. package/dist/methods-7IOINERF.mjs +30 -0
  191. package/dist/{module-6RLIKSZQ.mjs → module-DWKPBSMN.mjs} +38 -28
  192. package/dist/{module-AVQEIB7O.mjs → module-UN76TF7I.mjs} +14 -14
  193. package/dist/operations-G5EP6JPX.mjs +5 -0
  194. package/dist/{paged-partition-archive-KGRW366Y.mjs → paged-partition-archive-DPNWVSK2.mjs} +46 -31
  195. package/dist/partial-words.mjs +7 -5
  196. package/dist/pattern.mjs +4 -3
  197. package/dist/persistence/durability/checkpoint-worker.d.ts +16 -1
  198. package/dist/persistence/durability/checkpoint-worker.mjs +40 -29
  199. package/dist/{phrase-module-OUQIRUQU.mjs → phrase-module-ZI4WSQVH.mjs} +1 -1
  200. package/dist/{pool-UPV5PVPY.mjs → pool-Y4A46T36.mjs} +2 -2
  201. package/dist/query-suggestions/merge-worker.d.ts +55 -0
  202. package/dist/query-suggestions/merge-worker.mjs +81 -0
  203. package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
  204. package/dist/query-suggestions.browser.mjs +246 -0
  205. package/dist/query-suggestions.d.ts +20 -0
  206. package/dist/query-suggestions.mjs +62 -0
  207. package/dist/react-native/chunks/{analysis-change-DXPZRGWF.mjs → analysis-change-6BPDPH6K.mjs} +50 -19
  208. package/dist/{browser/analysis-change-entry-JL5U2N3Q.mjs → react-native/chunks/analysis-change-entry-JLL42PH6.mjs} +1 -1
  209. package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +29 -0
  210. package/dist/react-native/chunks/chunk-3JIBF3XT.mjs +191 -0
  211. package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +1 -0
  212. package/dist/react-native/chunks/{chunk-UFNCLEQM.mjs → chunk-4DII3ZSM.mjs} +1 -1
  213. package/dist/react-native/chunks/{chunk-BRNAVOKP.mjs → chunk-4J74WHQM.mjs} +2 -2
  214. package/dist/react-native/chunks/chunk-4LCEN2IU.mjs +315 -0
  215. package/dist/react-native/chunks/{chunk-PU55IOG4.mjs → chunk-4Y53T4YE.mjs} +6 -190
  216. package/dist/react-native/chunks/chunk-5CQX3XXV.mjs +17 -0
  217. package/dist/react-native/chunks/chunk-6VBXNFLE.mjs +9 -0
  218. package/dist/react-native/chunks/chunk-6WA3C3DV.mjs +85 -0
  219. package/dist/react-native/chunks/chunk-7GRCBBME.mjs +63 -0
  220. package/dist/react-native/chunks/{chunk-2J2727V4.mjs → chunk-7PXRWYUU.mjs} +1 -1
  221. package/dist/{browser/chunk-VBX2TI5V.mjs → react-native/chunks/chunk-ALOIBXWN.mjs} +2 -2
  222. package/dist/react-native/chunks/{chunk-FS7BYE23.mjs → chunk-C3PTWYKT.mjs} +10 -153
  223. package/dist/react-native/chunks/{chunk-DKJTZ625.mjs → chunk-C5G6TJ7A.mjs} +2 -69
  224. package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +43 -0
  225. package/dist/react-native/chunks/{chunk-LRGWK367.mjs → chunk-CKNRFDTZ.mjs} +1 -1
  226. package/dist/react-native/chunks/chunk-CUH5F57W.mjs +242 -0
  227. package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +10 -0
  228. package/dist/{browser/chunk-55WYRLDZ.mjs → react-native/chunks/chunk-DVDX4SDR.mjs} +2 -2
  229. package/dist/{browser/chunk-PIS7ZAP7.mjs → react-native/chunks/chunk-DZ7H7D2C.mjs} +12 -2
  230. package/dist/react-native/chunks/{chunk-KOCTCUXW.mjs → chunk-EIOYM5TO.mjs} +17 -9
  231. package/dist/react-native/chunks/chunk-F753DA54.mjs +23 -0
  232. package/dist/react-native/chunks/chunk-GIZTJXYW.mjs +1007 -0
  233. package/dist/react-native/chunks/{chunk-CLE3LZ77.mjs → chunk-GJFXPHXI.mjs} +5 -4
  234. package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
  235. package/dist/react-native/chunks/{chunk-IDFMNRIC.mjs → chunk-HUOYZJ3Q.mjs} +140 -430
  236. package/dist/react-native/chunks/chunk-IYNT75CE.mjs +111 -0
  237. package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +38 -0
  238. package/dist/react-native/chunks/{chunk-LQAKO5QV.mjs → chunk-JLIIWJUV.mjs} +2 -2
  239. package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +15 -0
  240. package/dist/react-native/chunks/chunk-KJIG57UD.mjs +1106 -0
  241. package/dist/react-native/chunks/{chunk-KLZGAOLT.mjs → chunk-KTTAU63H.mjs} +5 -5
  242. package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +68 -0
  243. package/dist/{browser/chunk-NVEJJP4R.mjs → react-native/chunks/chunk-LZSLNSUN.mjs} +2 -79
  244. package/dist/react-native/chunks/{chunk-3CTWSQRW.mjs → chunk-MJDQU5MW.mjs} +4 -30
  245. package/dist/react-native/chunks/{chunk-NFGBOI46.mjs → chunk-MVXELMJX.mjs} +1 -1
  246. package/dist/react-native/chunks/{chunk-D7LFYPYI.mjs → chunk-N2WUOWLL.mjs} +12 -10
  247. package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +78 -0
  248. package/dist/react-native/chunks/{chunk-JYL35A4A.mjs → chunk-OL3WDV53.mjs} +7 -33
  249. package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +29 -0
  250. package/dist/react-native/chunks/{chunk-UCJU6WNH.mjs → chunk-PEHS2UO3.mjs} +7 -6
  251. package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +79 -0
  252. package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
  253. package/dist/react-native/chunks/chunk-QJXTNPLQ.mjs +100 -0
  254. package/dist/react-native/chunks/{chunk-ZCKNBPQ4.mjs → chunk-RDWG33MM.mjs} +2 -2
  255. package/dist/react-native/chunks/chunk-SUPXRTMD.mjs +96 -0
  256. package/dist/react-native/chunks/chunk-TYIRMPD3.mjs +432 -0
  257. package/dist/react-native/chunks/{chunk-TLYD7IJ2.mjs → chunk-U4KSKA4Z.mjs} +1 -1
  258. package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +68 -0
  259. package/dist/react-native/chunks/{chunk-7IQR3SZO.mjs → chunk-VXGE4ZXL.mjs} +151 -257
  260. package/dist/react-native/chunks/{chunk-R4OPUZQ5.mjs → chunk-WBYQRHDY.mjs} +2 -2
  261. package/dist/react-native/chunks/chunk-YH7QY657.mjs +288 -0
  262. package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +92 -0
  263. package/dist/react-native/chunks/{cold-module-KFGEWYEL.mjs → cold-module-5PHF6DZR.mjs} +31 -22
  264. package/dist/react-native/chunks/durability-config-QXVZEO7T.mjs +89 -0
  265. package/dist/react-native/chunks/{durability-wiring-QKJB2QBT.mjs → durability-wiring-KO565FZC.mjs} +1309 -889
  266. package/dist/react-native/chunks/engine-hooks-MVRRHH6B.mjs +28 -0
  267. package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +3 -0
  268. package/dist/react-native/chunks/import-YVZA4V4V.mjs +30 -0
  269. package/dist/react-native/chunks/methods-6W5U4C3H.mjs +30 -0
  270. package/dist/react-native/chunks/{module-UJ5VUARS.mjs → module-H5MVPSP2.mjs} +13 -11
  271. package/dist/react-native/chunks/module-ZL5ZG6YB.mjs +34 -0
  272. package/dist/react-native/chunks/operations-GNRMD6EX.mjs +5 -0
  273. package/dist/react-native/chunks/{phrase-module-76UAPPSG.mjs → phrase-module-RTVKEWJT.mjs} +1 -1
  274. package/dist/react-native/chunks/{pool-CD4ANYUI.mjs → pool-JR3NJCAF.mjs} +3 -2
  275. package/dist/react-native/chunks/restore-hooks-SILFPU6B.mjs +125 -0
  276. package/dist/react-native/chunks/restore-queue-HSYP2AEC.mjs +55 -0
  277. package/dist/react-native/chunks/retention-7I7UAWYK.mjs +221 -0
  278. package/dist/react-native/chunks/{runtime-3MCDLJAF.mjs → runtime-R5E3TB3J.mjs} +1 -1
  279. package/dist/react-native/chunks/{snapshot-KVBD4LRC.mjs → snapshot-EZYB6SLF.mjs} +90 -323
  280. package/dist/react-native/chunks/start-SHVZ72I5.mjs +36 -0
  281. package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +15 -0
  282. package/dist/react-native/chunks/{write-ES5A3WUA.mjs → write-JUESXHDL.mjs} +27 -19
  283. package/dist/react-native/partial-words.mjs +8 -5
  284. package/dist/react-native/pattern.mjs +4 -3
  285. package/dist/react-native/query-suggestions.mjs +258 -0
  286. package/dist/react-native/sync.mjs +2299 -0
  287. package/dist/react-native/synonyms.mjs +7 -4
  288. package/dist/react.d.ts +11 -10
  289. package/dist/react.mjs +8 -1
  290. package/dist/{rerank-3W54N6P2.mjs → rerank-MQ37IYRV.mjs} +4 -4
  291. package/dist/rerankers/http.mjs +2 -2
  292. package/dist/restore-hooks-HZ3ILAMO.mjs +146 -0
  293. package/dist/restore-queue-JVGENGGE.mjs +55 -0
  294. package/dist/retention-HROPV2QU.mjs +59 -0
  295. package/dist/{runtime-L2DZYY6N.mjs → runtime-COIUORCN.mjs} +5 -5
  296. package/dist/{schema-D33CyXCy.d.ts → schema-Jwt928nJ.d.ts} +1 -1
  297. package/dist/server.d.ts +119 -20
  298. package/dist/server.mjs +1123 -58
  299. package/dist/{snapshot-WMX6JCLP.mjs → snapshot-4HS2G2UM.mjs} +106 -49
  300. package/dist/start-UTWHGH42.mjs +59 -0
  301. package/dist/sync/filesystem.d.ts +30 -0
  302. package/dist/sync/filesystem.mjs +271 -0
  303. package/dist/sync/indexeddb.d.ts +30 -0
  304. package/dist/sync/indexeddb.mjs +237 -0
  305. package/dist/sync-state-ZWHLAFLE.mjs +15 -0
  306. package/dist/sync.browser.mjs +2294 -0
  307. package/dist/sync.d.ts +23 -0
  308. package/dist/sync.mjs +2268 -0
  309. package/dist/synonyms.mjs +6 -4
  310. package/dist/{tasks-C4ElXr4P.d.ts → tasks-qrJojgST.d.ts} +13 -5
  311. package/dist/thread-6MOXY2KD.mjs +45 -0
  312. package/dist/types-BZCGjfLn.d.ts +227 -0
  313. package/dist/vector/search-worker.d.ts +1 -1
  314. package/dist/vector/search-worker.mjs +7 -7
  315. package/dist/workers/entry.mjs +8 -8
  316. package/dist/{write-SKJ6HW7O.mjs → write-GTTWWRRG.mjs} +36 -28
  317. package/openapi.json +912 -5
  318. package/package.json +45 -8
  319. package/dist/browser/import-QOY6ZH6X.mjs +0 -12
  320. package/dist/browser/restore-queue-UQ6AAUVX.mjs +0 -41
  321. package/dist/chunk-7LDMWKP6.mjs +0 -209
  322. package/dist/engine-CJRUHXgf.d.ts +0 -664
  323. package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +0 -110
  324. package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +0 -25
  325. package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +0 -3
  326. package/dist/react-native/chunks/import-XFBCCENV.mjs +0 -22
  327. package/dist/react-native/chunks/module-FHJ2GOBI.mjs +0 -25
  328. package/dist/react-native/chunks/restore-queue-H5VCN453.mjs +0 -41
  329. package/dist/restore-queue-AOF5OTQV.mjs +0 -41
  330. package/dist/thread-I7DVHHW7.mjs +0 -31
@@ -1,29 +1,32 @@
1
- import { DEFAULT_BLOCK_WRITES_ABOVE, DEFAULT_RESUME_WRITES_BELOW, validateWorkerConfig, validateIndexName, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateBM25Params, validatePartitionConfig, executeQuery, lazyQueryBinding, executePreflight, executeSuggest, executeListDocuments, ENGINE_MEMORY_FIGURES_MAX_AGE_MS, storedBM25Params, readEngineMemoryFigures, FULL_MEMORY_COLLECTION_INTERVAL_MS, validateBatchList, validateDocId } from './chunk-6F6USYII.mjs';
2
- import { resolvePartialWordAnalysis, resolvePartitionInsertOptions, isEmptySynonymSet, synonymModule, createDirectExecutor, generateId, createPartitionRouter, availableSynonymModule, mergeFrozenSegments, createSharedFrozenSegment, freezeSegmentShared, createFrozenSegment } from './chunk-UGVUW27S.mjs';
3
- import { ARRAY_POSITION_GAP, requirePatternSearchFor, requirePartialWordSearchFor, loadPhraseCodeFor, collectQueryTermStats, requireLoadedPhraseCode, readHeapStatistics, createPartitionIndex, mergePartitionStats, oversampledFacetConfig, availablePatternSearch, PATTERN_HOST, kWayMerge, mergeFacets, isCompositePartition, encodeSegmentState } from './chunk-3HV7M5OJ.mjs';
4
- import { fnv1a } from './chunk-KAKQ74LS.mjs';
1
+ import { DEFAULT_BLOCK_WRITES_ABOVE, DEFAULT_RESUME_WRITES_BELOW, validateWorkerConfig, validateIndexName, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateBM25Params, validatePartitionConfig, executeQuery, lazyQueryBinding, executePreflight, executeSuggest, executeListDocuments, validateBatchList, ENGINE_MEMORY_FIGURES_MAX_AGE_MS, validateDocId, storedBM25Params, readEngineMemoryFigures, FULL_MEMORY_COLLECTION_INTERVAL_MS } from './chunk-L7ZD4L3K.mjs';
5
2
  import { DEFAULT_MAX_RERANK_WINDOW, DEFAULT_RERANK_TIMEOUT_MS } from './chunk-HJSN7UYG.mjs';
6
- import { detectRuntime, resolveWorkerEntry, missingWorkerEntry, workerResourceLimits } from './chunk-6BWLDLS3.mjs';
3
+ import { detectRuntime, resolveWorkerEntry, missingWorkerEntry, workerResourceLimits } from './chunk-LHKOSI2J.mjs';
7
4
  import { collectYoungGenerationBeforeRefusal, collectGarbageBeforeRefusal } from './chunk-XIHUI4KB.mjs';
5
+ import { splitWorkerBudget, resolveWorkerCount, resolveRequestThreadCount, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_BACKPRESSURE_LIMIT, SHUTDOWN_TIMEOUT_MS, CONSECUTIVE_TIMEOUTS_BEFORE_DEATH } from './chunk-3MXV3VHR.mjs';
6
+ import { MAX_INDEX_CONFIGURATION_BYTES, BATCH_CHUNK_SIZE, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, STATISTICS_BROADCAST_INTERVAL_MS, HEAP_PRESSURE_WARNING_FRACTION, FOREIGN_STATS_TTL_MS, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION } from './chunk-EEBCDP36.mjs';
7
+ import { resolvePartialWordAnalysis, resolvePartitionInsertOptions, isEmptySynonymSet, synonymModule, createDirectExecutor, generateId, createPartitionRouter, availableSynonymModule, mergeFrozenSegments, createSharedFrozenSegment, freezeSegmentShared, createFrozenSegment } from './chunk-Z2BE2MAM.mjs';
8
+ import { ARRAY_POSITION_GAP, requirePatternSearchFor, requirePartialWordSearchFor, loadPhraseCodeFor, collectQueryTermStats, requireLoadedPhraseCode, createPartitionIndex, mergePartitionStats, oversampledFacetConfig, availablePatternSearch, PATTERN_HOST, kWayMerge, mergeFacets, isCompositePartition, encodeSegmentState } from './chunk-ZAUJFLEN.mjs';
9
+ import { INDEX_CONFIGURATION_ENVELOPE_VERSION } from './chunk-GH4WQ22V.mjs';
10
+ import { requireWithinFileLimit, HEADER_SIZE, payloadByteLength, checksumOfChunks, packEnvelopeWithEngineVersion } from './chunk-3OH67G7R.mjs';
11
+ import { readHeapStatistics } from './chunk-IPN7S4KX.mjs';
12
+ import { fnv1a } from './chunk-KAKQ74LS.mjs';
8
13
  import { countEngineThread } from './chunk-Q2UL2TPC.mjs';
9
- import { splitWorkerBudget, resolveWorkerCount, DEFAULT_REQUEST_TIMEOUT_MS, resolveRequestThreadCount, DEFAULT_BACKPRESSURE_LIMIT, SHUTDOWN_TIMEOUT_MS, CONSECUTIVE_TIMEOUTS_BEFORE_DEATH } from './chunk-3MXV3VHR.mjs';
10
- import { MAX_INDEX_CONFIGURATION_BYTES, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, STATISTICS_BROADCAST_INTERVAL_MS, HEAP_PRESSURE_WARNING_FRACTION, FOREIGN_STATS_TTL_MS, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION, BATCH_CHUNK_SIZE } from './chunk-EEBCDP36.mjs';
11
- import { getLanguage, withOpenIndex, oneAtATime } from './chunk-2HJWQPR6.mjs';
12
- import { loadVectorCodeFor, loadedVectorCode, loadVectorCode, requireLoadedVectorCode } from './chunk-DGRM4EZZ.mjs';
14
+ import { DEFAULT_PATTERN_WORK_CAP, MATCHER_STATE_BUDGET_BYTES } from './chunk-LC3FDWTX.mjs';
15
+ import { raiseEarlierReleaseGraphSetting, getNestedValue, messagePackUpperBoundBytes, validateVectorPromotion, validateVectorStorage, validateTextStorage, validateRequiredFields, requireDocumentWithinSizeLimit, validateDocument, validateDocumentStrict } from './chunk-4KRC2APY.mjs';
16
+ import { flattenSchema, validateSchema, requireCreatableSchema, schemaFieldsOf, extractVectorFieldsFromSchema } from './chunk-WQRN64Q6.mjs';
17
+ import { isSingleStringFieldType } from './chunk-I54T6CQP.mjs';
18
+ import { emitSyncChange, withOpenIndex, oneAtATime } from './chunk-Y4WPNHMC.mjs';
19
+ import { getLanguage } from './chunk-RZWWB2XR.mjs';
13
20
  import { createRequestId, isValidWorkerResponse } from './chunk-QHPYS427.mjs';
14
21
  import { collectAndReturnPages } from './chunk-QYRNLLLI.mjs';
22
+ import { loadVectorCodeFor, loadedVectorCode, loadVectorCode, requireLoadedVectorCode } from './chunk-HNVVEQP7.mjs';
15
23
  import { HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE } from './chunk-ZXNQEW43.mjs';
16
- import { requireSearchBackendSettings } from './chunk-NVTFQFUL.mjs';
17
- import { countWrite, turnsAreBudgeted, turnIsSpent, yieldTurn, indexChangeOutsideExternalWaits, changeIndexOutsideExternalWaits } from './chunk-LQG5G2LY.mjs';
24
+ import { requireSearchBackendSettings } from './chunk-Q7G3BV3Y.mjs';
25
+ import { turnsAreBudgeted, turnIsSpent, yieldTurn, countWrite, indexChangeOutsideExternalWaits, changeIndexOutsideExternalWaits } from './chunk-LQG5G2LY.mjs';
18
26
  import { noteThreadSlotLive, threadSlotOfWorker, noteThreadSlotGone } from './chunk-RFBLQLLZ.mjs';
19
- import { DEFAULT_PATTERN_WORK_CAP, MATCHER_STATE_BUDGET_BYTES } from './chunk-U46IZNCW.mjs';
20
- import { flattenSchema, raiseEarlierReleaseGraphSetting, getNestedValue, messagePackUpperBoundBytes, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, schemaFieldsOf, extractVectorFieldsFromSchema, validateRequiredFields, requireDocumentWithinSizeLimit, validateDocument, validateDocumentStrict } from './chunk-SOUZMPME.mjs';
21
- import { isSingleStringFieldType } from './chunk-KYVRZAYP.mjs';
22
- import { NATIVE_CRC32_MIN_BYTES, MAX_FILE_BYTES, CHECKSUM_YIELD_CHUNK_BYTES } from './chunk-U476IXKQ.mjs';
23
- import { ErrorCodes, NarsilError } from './chunk-MDF6PDIA.mjs';
27
+ import { ErrorCodes, NarsilError } from './chunk-MP7ABPTD.mjs';
24
28
  import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
25
- import { encode, decode } from '@msgpack/msgpack';
26
- import * as zlib from 'zlib';
29
+ import { encode } from '@msgpack/msgpack';
27
30
 
28
31
  // src/engine/memory/fractions.ts
29
32
  function memoryFractionsOf(config) {
@@ -272,7 +275,8 @@ var NARSIL_CONFIG_KEYS = {
272
275
  lifecycle: true,
273
276
  patternWorkCap: true,
274
277
  events: true,
275
- memory: true
278
+ memory: true,
279
+ querySuggestions: true
276
280
  };
277
281
  var EVENT_NAMES = {
278
282
  write: true,
@@ -286,7 +290,9 @@ var EVENT_NAMES = {
286
290
  layoutUpgrade: true,
287
291
  checkpointHeld: true,
288
292
  durabilityError: true,
289
- invalidationError: true
293
+ invalidationError: true,
294
+ querySuggestionsBuild: true,
295
+ querySuggestionsWarning: true
290
296
  };
291
297
  var DURABILITY_CONFIG_KEYS = {
292
298
  tier: true,
@@ -608,7 +614,7 @@ var TEXT_REBUILD_SWITCH_BACKLOG_DOCUMENTS = 1e3;
608
614
  // src/partitioning/rewrite-spill-of.ts
609
615
  async function rewriteSpillOf(storage, manager, target) {
610
616
  if (storage === void 0 || (target?.config ?? manager.config).textStorage !== "disk") return null;
611
- const { openRewriteSpill } = await import('./module-6RLIKSZQ.mjs');
617
+ const { openRewriteSpill } = await import('./module-DWKPBSMN.mjs');
612
618
  return openRewriteSpill(storage, manager, target);
613
619
  }
614
620
 
@@ -920,91 +926,6 @@ function createAnalysisRebuildCoordinator(config, deps) {
920
926
  };
921
927
  }
922
928
 
923
- // src/engine/durability-config.ts
924
- var WAL_ONLY_FIELDS = ["directory", "mode", "flushIntervalMs", "segmentMaxBytes", "compactionThreshold"];
925
- function configError(message) {
926
- return new NarsilError(ErrorCodes.CONFIG_INVALID, message);
927
- }
928
- function requireKnob(name, value, minimum) {
929
- if (value === void 0) {
930
- return;
931
- }
932
- if (typeof value !== "number" || !Number.isFinite(value) || value < minimum) {
933
- throw configError(`durability.${name} must be a finite number of at least ${minimum}, got ${String(value)}`);
934
- }
935
- }
936
- function requireValidDurabilityConfig(durability) {
937
- if (durability.tier !== void 0 && durability.tier !== "wal" && durability.tier !== "snapshot") {
938
- throw configError(`durability.tier must be "wal" or "snapshot", got "${String(durability.tier)}"`);
939
- }
940
- if (durability.mode !== void 0 && durability.mode !== "sync" && durability.mode !== "async") {
941
- throw configError(`durability.mode must be "sync" or "async", got "${String(durability.mode)}"`);
942
- }
943
- requireKnob("checkpointIntervalMs", durability.checkpointIntervalMs, 0);
944
- requireKnob("checkpointMutationThreshold", durability.checkpointMutationThreshold, 1);
945
- requireKnob("flushIntervalMs", durability.flushIntervalMs, 0);
946
- requireKnob("segmentMaxBytes", durability.segmentMaxBytes, 1);
947
- if (durability.segmentMaxBytes !== void 0 && durability.segmentMaxBytes > MAX_FILE_BYTES) {
948
- throw configError(
949
- `durability.segmentMaxBytes must be at most ${MAX_FILE_BYTES}, the largest file that every implementation reads, got ${durability.segmentMaxBytes}`
950
- );
951
- }
952
- requireKnob("compactionThreshold", durability.compactionThreshold, 1);
953
- if (durability.tier === "snapshot") {
954
- for (const field of WAL_ONLY_FIELDS) {
955
- if (durability[field] !== void 0) {
956
- throw configError(
957
- `durability.${field} applies to the write-ahead log tier only and cannot combine with durability.tier "snapshot"`
958
- );
959
- }
960
- }
961
- }
962
- }
963
- function filesystemBackedDirectory(config) {
964
- const adapterDirectory = config.persistence?.directory;
965
- if (adapterDirectory !== void 0 && adapterDirectory.trim().length > 0) {
966
- return adapterDirectory;
967
- }
968
- return null;
969
- }
970
- function resolveDurabilityTier(config) {
971
- const filesystemDirectory = filesystemBackedDirectory(config);
972
- if (config.durability) {
973
- requireValidDurabilityConfig(config.durability);
974
- }
975
- if (config.durability?.tier === "snapshot") {
976
- if (config.persistence === void 0) {
977
- throw configError(
978
- "Snapshot durability persists through a persistence adapter. Configure persistence, or remove durability.tier"
979
- );
980
- }
981
- return { kind: "snapshot", config: { ...config.durability }, adapter: config.persistence };
982
- }
983
- if (config.durability) {
984
- if (config.durability.directory !== void 0 && config.durability.directory.trim().length > 0) {
985
- return { kind: "wal", config: { ...config.durability } };
986
- }
987
- if (filesystemDirectory !== null) {
988
- return { kind: "wal", config: { ...config.durability, directory: filesystemDirectory } };
989
- }
990
- if (config.persistence !== void 0) {
991
- throw configError(
992
- "WAL durability requires a filesystem directory, but the configured persistence adapter is not filesystem-backed. Use a filesystem persistence adapter or set durability.directory"
993
- );
994
- }
995
- throw configError(
996
- "Durability requires a directory. Set durability.directory explicitly, or configure a filesystem persistence adapter"
997
- );
998
- }
999
- if (config.persistence === void 0) {
1000
- return null;
1001
- }
1002
- if (filesystemDirectory !== null) {
1003
- return { kind: "wal", config: { directory: filesystemDirectory } };
1004
- }
1005
- return { kind: "snapshot", config: {}, adapter: config.persistence };
1006
- }
1007
-
1008
929
  // src/engine/array-positions.ts
1009
930
  function holdsStringArrayField(schema) {
1010
931
  return schemaFieldsOf(schema).some((field) => field.base === "string[]");
@@ -1122,10 +1043,10 @@ var RECOVERY_CONFIG_ERROR_CODES = /* @__PURE__ */ new Set([
1122
1043
  function resolveEmbeddingAdapter(deps, metadata, schema) {
1123
1044
  const name = metadata.embedding?.adapter ?? null;
1124
1045
  if (!metadata.embedding) return { adapter: null, name };
1125
- const candidate2 = name !== null ? deps.embeddingAdapters.get(name) ?? null : deps.config?.embedding ?? null;
1126
- if (!candidate2) return { adapter: null, name };
1046
+ const candidate = name !== null ? deps.embeddingAdapters.get(name) ?? null : deps.config?.embedding ?? null;
1047
+ if (!candidate) return { adapter: null, name };
1127
1048
  try {
1128
- validateEmbeddingConfig({ fields: metadata.embedding.fields, adapter: candidate2 }, schema, void 0);
1049
+ validateEmbeddingConfig({ fields: metadata.embedding.fields, adapter: candidate }, schema, void 0);
1129
1050
  } catch (err) {
1130
1051
  if (err instanceof NarsilError) {
1131
1052
  throw new NarsilError(err.code, `Recovery of index "${metadata.indexName}" failed: ${err.message}`, {
@@ -1135,7 +1056,7 @@ function resolveEmbeddingAdapter(deps, metadata, schema) {
1135
1056
  }
1136
1057
  throw err;
1137
1058
  }
1138
- return { adapter: candidate2, name };
1059
+ return { adapter: candidate, name };
1139
1060
  }
1140
1061
  function recoveryFailure(metadata, err) {
1141
1062
  if (!(err instanceof NarsilError) || !RECOVERY_CONFIG_ERROR_CODES.has(err.code)) return err;
@@ -1152,7 +1073,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
1152
1073
  const existing = deps.indexRegistry.get(metadata.indexName);
1153
1074
  if (existing !== void 0) {
1154
1075
  if ((metadata.analysisGeneration ?? 0) > existing.analysisGeneration) {
1155
- const { adoptSavedAnalysis } = await import('./analysis-change-2OYM7ARW.mjs');
1076
+ const { adoptSavedAnalysis } = await import('./analysis-change-3TFIHT5E.mjs');
1156
1077
  adoptSavedAnalysis(deps.executor.getManager(metadata.indexName), existing, metadata);
1157
1078
  }
1158
1079
  if (loadData && deps.executor.getManager(metadata.indexName) === void 0) {
@@ -1207,7 +1128,9 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
1207
1128
  synonyms,
1208
1129
  analysisGeneration: metadata.analysisGeneration ?? 0,
1209
1130
  pendingAnalysis: metadata.pendingAnalysis ?? null,
1210
- durableAnalysis: null
1131
+ durableAnalysis: null,
1132
+ sync: metadata.sync?.enabled === true ? (await import('./sync-state-ZWHLAFLE.mjs')).syncStateOfMetadata(metadata) : null,
1133
+ querySuggestions: metadata.querySuggestions ?? null
1211
1134
  });
1212
1135
  if (loadData) await deps.indexState().registerOpen(metadata.indexName);
1213
1136
  else deps.indexState().registerClosed(metadata.indexName);
@@ -1474,8 +1397,8 @@ function createIndexStateCoordinator(config, callbacks) {
1474
1397
  if (config?.maxOpenIndexes === void 0 && config?.maxOpenBytes === void 0) return;
1475
1398
  while (exceedsLimits()) {
1476
1399
  const candidates = [...entries].filter(([name, entry]) => name !== protectedName && entry.state === "open" && entry.activeOperations === 0).sort((left, right) => left[1].lastAccessAt - right[1].lastAccessAt);
1477
- const candidate2 = candidates[0];
1478
- if (candidate2 === void 0 || !await closeEntry(candidate2[0], true)) return;
1400
+ const candidate = candidates[0];
1401
+ if (candidate === void 0 || !await closeEntry(candidate[0], true)) return;
1479
1402
  }
1480
1403
  }
1481
1404
  async function sweep() {
@@ -3297,7 +3220,7 @@ async function startPool(state) {
3297
3220
  );
3298
3221
  }
3299
3222
  eligibleIndexNames(state);
3300
- const [factory, { createWorkerPool }] = await Promise.all([createWorkerFactory(), import('./pool-UPV5PVPY.mjs')]);
3223
+ const [factory, { createWorkerPool }] = await Promise.all([createWorkerFactory(), import('./pool-Y4A46T36.mjs')]);
3301
3224
  let started = null;
3302
3225
  const pool = createWorkerPool({
3303
3226
  count: state.keywordWorkerCount + state.longQueryWorkerCount,
@@ -3988,18 +3911,18 @@ async function emitWriteEventAfter(source, indexName, write) {
3988
3911
  // src/engine/core.ts
3989
3912
  async function createEngineCore(config, hooks, capacityScope = "index") {
3990
3913
  validateWorkerConfig(config?.workers, config?.lifecycle);
3991
- const rerankSettings = config?.rerankTimeout === void 0 && config?.maxRerankWindow === void 0 ? { timeoutMs: DEFAULT_RERANK_TIMEOUT_MS, maxWindow: DEFAULT_MAX_RERANK_WINDOW } : (await import('./runtime-L2DZYY6N.mjs')).resolveRerankSettings(config);
3914
+ const rerankSettings = config?.rerankTimeout === void 0 && config?.maxRerankWindow === void 0 ? { timeoutMs: DEFAULT_RERANK_TIMEOUT_MS, maxWindow: DEFAULT_MAX_RERANK_WINDOW } : (await import('./runtime-COIUORCN.mjs')).resolveRerankSettings(config);
3992
3915
  const eventHandlers = eventHandlersOf(config?.events);
3993
3916
  const vectorWorkerCount = splitWorkerBudget(resolveWorkerCount(config?.workers?.count)).vector;
3994
3917
  const vectorCopyPolicy = {
3995
3918
  enabled: (config?.workers?.enabled ?? workersEnabledByDefault()) && vectorWorkerCount > 0,
3996
3919
  count: vectorWorkerCount
3997
3920
  };
3998
- const durabilityTier = config !== void 0 ? resolveDurabilityTier(config) : null;
3921
+ const durabilityTier = config !== void 0 && (config.durability || config.persistence !== void 0) ? (await import('./durability-config-GE4U7MCZ.mjs')).resolveDurabilityTier(config) : null;
3999
3922
  if (config?.lifecycle !== void 0 && durabilityTier === null) {
4000
3923
  throw new NarsilError(ErrorCodes.CONFIG_INVALID, "Index lifecycle settings require durability");
4001
3924
  }
4002
- const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-7VBZEJLG.mjs');
3925
+ const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-NCKUC5EO.mjs');
4003
3926
  const filesystemDurability = durabilityTier?.kind === "wal";
4004
3927
  const executor = createDirectExecutor({
4005
3928
  vectorWorkerCopies: vectorCopyPolicy,
@@ -4126,7 +4049,8 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
4126
4049
  if (entry === void 0) return;
4127
4050
  entry.documentCount = documentCount;
4128
4051
  entry.partitionCount = partitionCount;
4129
- }
4052
+ },
4053
+ engineCore: () => engineCore
4130
4054
  });
4131
4055
  invalidation = createInvalidationFromConfig(config, durabilityTier?.kind ?? null, {
4132
4056
  getManager: (indexName) => executor.getManager(indexName) ?? void 0,
@@ -4184,7 +4108,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
4184
4108
  requireManager,
4185
4109
  resumeChange: async (indexName) => {
4186
4110
  if ((indexRegistry.get(indexName)?.pendingAnalysis ?? null) === null) return;
4187
- await (await import('./analysis-change-entry-QD7YNDEE.mjs')).resumeChangeOf(engineCore, indexName);
4111
+ await (await import('./analysis-change-entry-KA6JAO4X.mjs')).resumeChangeOf(engineCore, indexName);
4188
4112
  },
4189
4113
  onClose: hooks?.onIndexClose,
4190
4114
  onOpen: (indexName) => {
@@ -4245,6 +4169,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
4245
4169
  orchestrator,
4246
4170
  rebalanceRouter,
4247
4171
  rebalancingIndexes,
4172
+ restoresInFlight: /* @__PURE__ */ new Map(),
4248
4173
  waqMap,
4249
4174
  guardShutdown,
4250
4175
  requireIndex,
@@ -4269,7 +4194,7 @@ async function startEngineCore(core, config) {
4269
4194
  checkHeapAfterRecovery(core);
4270
4195
  }
4271
4196
  if (core.invalidation) await core.invalidation.start();
4272
- if (core.durability) await (await import('./analysis-change-entry-QD7YNDEE.mjs')).resumeEveryChange(core);
4197
+ if (core.durability) await (await import('./analysis-change-entry-KA6JAO4X.mjs')).resumeEveryChange(core);
4273
4198
  if (config?.lifecycle === void 0) await core.analysisRebuild.reviewStaleIndexes();
4274
4199
  } catch (err) {
4275
4200
  await core.durability?.manager.shutdown().catch(() => void 0);
@@ -4279,6 +4204,7 @@ async function startEngineCore(core, config) {
4279
4204
  }
4280
4205
  async function shutdownEngine(core) {
4281
4206
  const { executor, durability, indexRegistry, eventHandlers, orchestrator } = core;
4207
+ await core.querySuggestionHooks?.shutdown();
4282
4208
  core.indexState.dispose();
4283
4209
  if (durability) {
4284
4210
  await durability.manager.shutdown();
@@ -4307,7 +4233,7 @@ async function shutdownEngine(core) {
4307
4233
  }
4308
4234
  }
4309
4235
  if (core.rerankAdapters.size > 0) {
4310
- await (await import('./runtime-L2DZYY6N.mjs')).shutdownRerankAdapters(core.rerankAdapters);
4236
+ await (await import('./runtime-COIUORCN.mjs')).shutdownRerankAdapters(core.rerankAdapters);
4311
4237
  }
4312
4238
  await orchestrator.shutdown();
4313
4239
  await executor.shutdown();
@@ -4340,169 +4266,8 @@ async function resolveRunnableConfig(config) {
4340
4266
  return withoutWorkers(config, err);
4341
4267
  }
4342
4268
  }
4343
- var candidate = zlib.crc32;
4344
- var nativeCrc32 = typeof candidate === "function" ? candidate : null;
4345
-
4346
- // src/serialization/crc32.ts
4347
- var IEEE_POLYNOMIAL = 3988292384;
4348
- var ALL_BITS = 4294967295;
4349
- var cachedTable = null;
4350
- function buildTable() {
4351
- const table = new Uint32Array(256);
4352
- for (let i = 0; i < 256; i++) {
4353
- let crc = i;
4354
- for (let bit = 0; bit < 8; bit++) {
4355
- crc = crc & 1 ? crc >>> 1 ^ IEEE_POLYNOMIAL : crc >>> 1;
4356
- }
4357
- table[i] = crc;
4358
- }
4359
- return table;
4360
- }
4361
- function getTable() {
4362
- if (cachedTable === null) {
4363
- cachedTable = buildTable();
4364
- }
4365
- return cachedTable;
4366
- }
4367
- function crc322(data) {
4368
- return crc32Final(crc32Update(crc32Init(), data));
4369
- }
4370
- function crc32Init() {
4371
- return ALL_BITS;
4372
- }
4373
- function crc32Update(state, data) {
4374
- if (nativeCrc32 !== null && data.length >= NATIVE_CRC32_MIN_BYTES) {
4375
- return nativeCrc32(data, (state ^ ALL_BITS) >>> 0) ^ ALL_BITS;
4376
- }
4377
- const table = getTable();
4378
- let crc = state;
4379
- for (let i = 0; i < data.length; i++) {
4380
- crc = crc >>> 8 ^ table[(crc ^ data[i]) & 255];
4381
- }
4382
- return crc;
4383
- }
4384
- function crc32Final(state) {
4385
- return (state ^ ALL_BITS) >>> 0;
4386
- }
4387
-
4388
- // src/serialization/chunk-checksum.ts
4389
- function yieldToEventLoop2() {
4390
- if (typeof setImmediate === "function") {
4391
- return new Promise((resolve) => setImmediate(resolve));
4392
- }
4393
- return new Promise((resolve) => setTimeout(resolve, 0));
4394
- }
4395
- async function advanceChecksum(start, payload) {
4396
- let state = start;
4397
- for (let offset = 0; offset < payload.length; offset += CHECKSUM_YIELD_CHUNK_BYTES) {
4398
- const end = Math.min(offset + CHECKSUM_YIELD_CHUNK_BYTES, payload.length);
4399
- state = crc32Update(state, payload.subarray(offset, end));
4400
- if (end < payload.length) {
4401
- await yieldToEventLoop2();
4402
- }
4403
- }
4404
- return state;
4405
- }
4406
- async function checksumOfChunks(chunks) {
4407
- let state = crc32Init();
4408
- for (const chunk of chunks) state = await advanceChecksum(state, chunk);
4409
- return crc32Final(state);
4410
- }
4411
4269
 
4412
- // src/serialization/header.ts
4413
- var MAGIC_BYTES = new Uint8Array([78, 82, 83, 76]);
4414
- var HEADER_SIZE = 32;
4415
- var RESERVED_SIZE = 14;
4416
- var MAX_PAYLOAD_LENGTH = 4294967295;
4417
- var COMPRESSION_ALGORITHMS = {
4418
- 0: "none",
4419
- 1: "gzip",
4420
- 2: "lz4",
4421
- 3: "zstd"
4422
- };
4423
- var COMPRESSION_TO_BITS = {
4424
- none: 0,
4425
- gzip: 1,
4426
- lz4: 2,
4427
- zstd: 3
4428
- };
4429
- function encodeFlags(flags) {
4430
- let bits = 0;
4431
- if (flags.compressionEnabled) bits |= 1;
4432
- bits |= (COMPRESSION_TO_BITS[flags.compressionAlgorithm] & 3) << 1;
4433
- if (flags.checksumPresent) bits |= 1 << 3;
4434
- if (flags.encryptionEnabled) bits |= 1 << 4;
4435
- return bits;
4436
- }
4437
- function decodeFlags(value) {
4438
- const compressionEnabled = (value & 1) === 1;
4439
- const algorithmBits = value >> 1 & 3;
4440
- const checksumPresent = (value >> 3 & 1) === 1;
4441
- const encryptionEnabled = (value >> 4 & 1) === 1;
4442
- return {
4443
- compressionEnabled,
4444
- compressionAlgorithm: COMPRESSION_ALGORITHMS[algorithmBits] ?? "none",
4445
- checksumPresent,
4446
- encryptionEnabled
4447
- };
4448
- }
4449
- function writeHeader(header) {
4450
- if (header.payloadLength > MAX_PAYLOAD_LENGTH) {
4451
- throw new NarsilError(
4452
- ErrorCodes.PERSISTENCE_SAVE_FAILED,
4453
- `A payload of ${header.payloadLength} bytes exceeds the ${MAX_PAYLOAD_LENGTH} bytes the envelope header can describe`,
4454
- { payloadLength: header.payloadLength, maxPayloadLength: MAX_PAYLOAD_LENGTH }
4455
- );
4456
- }
4457
- const buffer = new Uint8Array(HEADER_SIZE);
4458
- const view = new DataView(buffer.buffer);
4459
- buffer.set(MAGIC_BYTES, 0);
4460
- buffer[4] = header.envelopeFormatVersion & 255;
4461
- buffer[5] = header.engineVersionMajor & 255;
4462
- buffer[6] = header.engineVersionMinor & 255;
4463
- buffer[7] = header.engineVersionPatch & 255;
4464
- view.setUint32(8, header.payloadLength, false);
4465
- view.setUint16(12, encodeFlags(header.flags), false);
4466
- view.setUint32(14, header.checksum, false);
4467
- for (let i = 18; i < HEADER_SIZE; i++) {
4468
- buffer[i] = 0;
4469
- }
4470
- return buffer;
4471
- }
4472
- function hasNrslMagic(data) {
4473
- return data.length >= MAGIC_BYTES.length && data[0] === MAGIC_BYTES[0] && data[1] === MAGIC_BYTES[1] && data[2] === MAGIC_BYTES[2] && data[3] === MAGIC_BYTES[3];
4474
- }
4475
- function readHeader(data) {
4476
- if (data.length < HEADER_SIZE) {
4477
- throw new NarsilError(
4478
- ErrorCodes.ENVELOPE_INVALID_MAGIC,
4479
- `Expected at least ${HEADER_SIZE} bytes, received ${data.length}`
4480
- );
4481
- }
4482
- if (data[0] !== MAGIC_BYTES[0] || data[1] !== MAGIC_BYTES[1] || data[2] !== MAGIC_BYTES[2] || data[3] !== MAGIC_BYTES[3]) {
4483
- throw new NarsilError(ErrorCodes.ENVELOPE_INVALID_MAGIC, "File does not begin with NRSL magic bytes");
4484
- }
4485
- const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
4486
- const envelopeFormatVersion = data[4];
4487
- const engineVersionMajor = data[5];
4488
- const engineVersionMinor = data[6];
4489
- const engineVersionPatch = data[7];
4490
- const payloadLength = view.getUint32(8, false);
4491
- const flagBits = view.getUint16(12, false);
4492
- const checksum = view.getUint32(14, false);
4493
- const reserved = data.slice(18, HEADER_SIZE);
4494
- return {
4495
- magic: "NRSL",
4496
- envelopeFormatVersion,
4497
- engineVersionMajor,
4498
- engineVersionMinor,
4499
- engineVersionPatch,
4500
- payloadLength,
4501
- flags: decodeFlags(flagBits),
4502
- checksum,
4503
- reserved
4504
- };
4505
- }
4270
+ // src/serialization/envelope-file.ts
4506
4271
  function engineVersionParts() {
4507
4272
  const parts = VERSION.split(".");
4508
4273
  return [
@@ -4511,103 +4276,15 @@ function engineVersionParts() {
4511
4276
  Number.parseInt(parts[2] ?? "0", 10)
4512
4277
  ];
4513
4278
  }
4514
- function payloadByteLength(chunks) {
4515
- let total = 0;
4516
- for (const chunk of chunks) total += chunk.byteLength;
4517
- return total;
4518
- }
4519
- function requireWithinFileLimit(byteLength, what) {
4520
- if (byteLength <= MAX_FILE_BYTES) return;
4521
- throw new NarsilError(
4522
- ErrorCodes.PERSISTENCE_SAVE_FAILED,
4523
- `The ${what} would take ${byteLength} bytes, above the file size limit of ${MAX_FILE_BYTES}`,
4524
- { bytes: byteLength, maximum: MAX_FILE_BYTES }
4525
- );
4526
- }
4527
4279
  async function packChecksummedEnvelope(payloadChunks, envelopeFormatVersion, what) {
4528
4280
  requireWithinFileLimit(HEADER_SIZE + payloadByteLength(payloadChunks), what);
4529
4281
  return packEnvelopeWithChecksum(payloadChunks, envelopeFormatVersion, what, await checksumOfChunks(payloadChunks));
4530
4282
  }
4531
4283
  function packEnvelopeWithChecksum(payloadChunks, envelopeFormatVersion, what, checksum) {
4532
- const payloadLength = payloadByteLength(payloadChunks);
4533
- requireWithinFileLimit(HEADER_SIZE + payloadLength, what);
4534
- const [major, minor, patch] = engineVersionParts();
4535
- const header = writeHeader({
4536
- envelopeFormatVersion,
4537
- engineVersionMajor: major,
4538
- engineVersionMinor: minor,
4539
- engineVersionPatch: patch,
4540
- payloadLength,
4541
- flags: { compressionEnabled: false, compressionAlgorithm: "none", checksumPresent: true, encryptionEnabled: false },
4542
- checksum});
4543
- return { chunks: [header, ...payloadChunks], byteLength: HEADER_SIZE + payloadLength, checksum };
4544
- }
4545
- function loadFailed(message, details) {
4546
- throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, message, details);
4547
- }
4548
- async function gunzipWithinLimit(compressed, what) {
4549
- const { gunzip } = await import('./gzip-F4HMIEEQ.mjs');
4550
- try {
4551
- return await gunzip(compressed, MAX_FILE_BYTES);
4552
- } catch (error) {
4553
- if (error?.code === "EFBIG") {
4554
- loadFailed(`The ${what} inflates past the file size limit of ${MAX_FILE_BYTES} bytes`);
4555
- }
4556
- loadFailed(`The ${what} holds a gzip payload that fails to inflate`, {
4557
- cause: error instanceof Error ? error.message : String(error)
4558
- });
4559
- }
4560
- }
4561
- async function openChecksummedEnvelope(data, expected) {
4562
- const { envelopeFormatVersion, what } = expected;
4563
- const header = readHeader(data);
4564
- if (header.envelopeFormatVersion !== envelopeFormatVersion) {
4565
- throw new NarsilError(
4566
- ErrorCodes.ENVELOPE_VERSION_MISMATCH,
4567
- `The ${what} holds envelope format v${header.envelopeFormatVersion}, while this build reads it as v${envelopeFormatVersion}`,
4568
- { version: header.envelopeFormatVersion, expected: envelopeFormatVersion }
4569
- );
4570
- }
4571
- if (header.flags.encryptionEnabled) {
4572
- throw new NarsilError(
4573
- ErrorCodes.ENVELOPE_VERSION_MISMATCH,
4574
- `The ${what} is encrypted, which this build cannot read`
4575
- );
4576
- }
4577
- if (header.flags.compressionEnabled && !expected.allowsCompression) {
4578
- loadFailed(`The ${what} is compressed, while its format stores it raw`);
4579
- }
4580
- if (header.flags.compressionEnabled && header.flags.compressionAlgorithm !== "gzip") {
4581
- throw new NarsilError(
4582
- ErrorCodes.ENVELOPE_VERSION_MISMATCH,
4583
- `The ${what} uses ${header.flags.compressionAlgorithm} compression, which this build cannot read`
4584
- );
4585
- }
4586
- if (!header.flags.checksumPresent) loadFailed(`The ${what} carries no checksum, while its format requires one`);
4587
- if (data.byteLength !== HEADER_SIZE + header.payloadLength) {
4588
- loadFailed(
4589
- `The ${what} holds ${data.byteLength} bytes where its header gives ${HEADER_SIZE + header.payloadLength}`,
4590
- { bytes: data.byteLength, expected: HEADER_SIZE + header.payloadLength }
4591
- );
4592
- }
4593
- const payload = data.subarray(HEADER_SIZE);
4594
- const computed = await checksumOfChunks([payload]);
4595
- if (computed !== header.checksum) {
4596
- throw new NarsilError(
4597
- ErrorCodes.PERSISTENCE_CRC_MISMATCH,
4598
- `The checksum of the ${what} does not match its payload`,
4599
- {
4600
- expected: header.checksum,
4601
- computed
4602
- }
4603
- );
4604
- }
4605
- if (header.flags.compressionEnabled) return { header, payload: await gunzipWithinLimit(payload, what) };
4606
- return { header, payload };
4284
+ return packEnvelopeWithEngineVersion(payloadChunks, envelopeFormatVersion, what, checksum, engineVersionParts());
4607
4285
  }
4608
4286
 
4609
4287
  // src/engine/snapshot/index-configuration.ts
4610
- var INDEX_CONFIGURATION_ENVELOPE_VERSION = 5;
4611
4288
  function refuseCode(entry) {
4612
4289
  if (entry.config.tokenizer !== void 0 && typeof entry.config.tokenizer !== "string") {
4613
4290
  throw new NarsilError(
@@ -4625,7 +4302,7 @@ function refuseCode(entry) {
4625
4302
  function indexConfigurationOf(entry) {
4626
4303
  refuseCode(entry);
4627
4304
  const synonyms = entry.synonyms === null ? void 0 : rulesOfStoredSynonyms(entry.synonyms);
4628
- return configurationPayloadOf(
4305
+ const payload = configurationPayloadOf(
4629
4306
  entry.config,
4630
4307
  entry.language,
4631
4308
  entry.embeddingAdapterName,
@@ -4634,6 +4311,8 @@ function indexConfigurationOf(entry) {
4634
4311
  synonyms,
4635
4312
  entry.analysisGeneration
4636
4313
  );
4314
+ const withSuggestions = { ...payload, ...entry.querySuggestions };
4315
+ return entry.sync === null ? withSuggestions : { ...withSuggestions, syncEpoch: entry.sync.epoch };
4637
4316
  }
4638
4317
  function requireConfigurationWithinSizeLimit(config, language) {
4639
4318
  const adapter = config.embedding?.adapter;
@@ -4703,33 +4382,6 @@ async function encodeIndexConfiguration(entry) {
4703
4382
  }
4704
4383
  return bytes;
4705
4384
  }
4706
- function requireConfigurationShape(raw, what) {
4707
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
4708
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} does not hold an index configuration`);
4709
- }
4710
- const configuration = raw;
4711
- if (configuration.schema === null || typeof configuration.schema !== "object") {
4712
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} holds no schema`);
4713
- }
4714
- if (typeof configuration.language !== "string" || configuration.language.length === 0) {
4715
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} holds no language`);
4716
- }
4717
- return configuration;
4718
- }
4719
- async function decodeIndexConfiguration(bytes) {
4720
- const { payload } = await openChecksummedEnvelope(bytes, {
4721
- envelopeFormatVersion: INDEX_CONFIGURATION_ENVELOPE_VERSION,
4722
- what: "index configuration",
4723
- allowsCompression: true
4724
- });
4725
- let raw;
4726
- try {
4727
- raw = decode(payload);
4728
- } catch {
4729
- throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, "The index configuration is not MessagePack");
4730
- }
4731
- return requireConfigurationShape(raw, "index configuration");
4732
- }
4733
4385
 
4734
4386
  // src/engine/index-lifecycle.ts
4735
4387
  async function runLifecycleHook(core, hookName, context) {
@@ -4827,6 +4479,7 @@ async function createEngineIndex(core, config, name, requestedConfig, creation =
4827
4479
  const language = getLanguage(indexConfig.language ?? "english");
4828
4480
  if (appliesCreationLimits) requireConfigurationWithinSizeLimit(indexConfig, language);
4829
4481
  const synonyms = prepareConfiguredSynonyms(configured, language, appliesCreationLimits);
4482
+ await core.querySuggestionHooks?.beforeCreate(name);
4830
4483
  core.executor.createIndex(name, indexConfig, language, false, synonyms?.lookup ?? null);
4831
4484
  core.indexRegistry.set(name, {
4832
4485
  config: indexConfig,
@@ -4843,7 +4496,9 @@ async function createEngineIndex(core, config, name, requestedConfig, creation =
4843
4496
  synonyms: synonyms?.encoded ?? null,
4844
4497
  analysisGeneration: 0,
4845
4498
  pendingAnalysis: null,
4846
- durableAnalysis: null
4499
+ durableAnalysis: null,
4500
+ sync: null,
4501
+ querySuggestions: creation.querySuggestions ?? null
4847
4502
  });
4848
4503
  await core.indexState.registerOpen(name);
4849
4504
  if (core.durability) {
@@ -4856,10 +4511,11 @@ async function dropEngineIndex(core, name) {
4856
4511
  const entry = core.requireIndex(name);
4857
4512
  const changeRecorded = () => entry.pendingAnalysis !== null || entry.durableAnalysis !== null;
4858
4513
  const abandonChange = async () => {
4859
- await (await import('./analysis-change-entry-QD7YNDEE.mjs')).abandonChangeOf(core, name);
4514
+ await (await import('./analysis-change-entry-KA6JAO4X.mjs')).abandonChangeOf(core, name);
4860
4515
  };
4861
4516
  if (changeRecorded()) await abandonChange();
4862
4517
  await core.indexState.drop(name, async () => {
4518
+ await core.querySuggestionHooks?.beforeDrop(name);
4863
4519
  await core.analysisRebuild.abandon(name);
4864
4520
  if (changeRecorded()) await abandonChange();
4865
4521
  await core.orchestrator.closeIndex(name);
@@ -4875,7 +4531,9 @@ async function dropEngineIndex(core, name) {
4875
4531
  core.indexRegistry.delete(name);
4876
4532
  core.watermarkNotifier.forget(name);
4877
4533
  core.analysisRebuild.clearStale(name);
4534
+ if (entry.sync !== null) emitSyncChange(core.indexRegistry, { kind: "dropped", indexName: name });
4878
4535
  });
4536
+ await core.querySuggestionHooks?.afterDrop(name);
4879
4537
  await runLifecycleHook(core, "onIndexDrop", { indexName: name, config: entry.config });
4880
4538
  }
4881
4539
  function registerEngineEmbeddingAdapter(core, name, adapter) {
@@ -6611,6 +6269,31 @@ async function dropEngineIndex2(core, name) {
6611
6269
  core.mutationCtx.memoryWriteBlock?.memoryReleased();
6612
6270
  }
6613
6271
 
6272
+ // src/engine/sync-epoch.ts
6273
+ async function holdSyncEpochChange(core, indexName) {
6274
+ if ((core.indexRegistry.get(indexName)?.sync ?? null) === null) return () => void 0;
6275
+ return (await import('./operations-G5EP6JPX.mjs')).holdRenewedSyncEpoch(core, indexName);
6276
+ }
6277
+ async function withRenewedSyncEpoch(core, indexName, change) {
6278
+ const release = await holdSyncEpochChange(core, indexName);
6279
+ try {
6280
+ return await change();
6281
+ } finally {
6282
+ release();
6283
+ }
6284
+ }
6285
+
6286
+ // src/engine/clear-index.ts
6287
+ function clearEngineIndex(core, indexName) {
6288
+ return withRenewedSyncEpoch(core, indexName, async () => {
6289
+ await core.executor.execute({ type: "clear", indexName, requestId: indexName });
6290
+ await core.orchestrator.replicateToWorkers({ type: "clear", indexName, requestId: `replicate-clear-${indexName}` });
6291
+ core.watermarkNotifier.forget(indexName);
6292
+ const durable = core.durability?.manager;
6293
+ await (durable?.checkpointFromMemory?.(indexName) ?? durable?.checkpoint(indexName));
6294
+ });
6295
+ }
6296
+
6614
6297
  // src/runtime/process-memory.ts
6615
6298
  function readProcessMemory() {
6616
6299
  const proc = globalThis.process;
@@ -6653,6 +6336,7 @@ async function replaceNow(core, indexName, bm25) {
6653
6336
  ...bm25 !== void 0 ? { bm25 } : {}
6654
6337
  });
6655
6338
  await core.orchestrator.awaitWrites(indexName);
6339
+ if (core.requireIndex(indexName).sync !== null) emitSyncChange(core.indexRegistry, { kind: "settings", indexName });
6656
6340
  }
6657
6341
  function updateIndexBm25(core, indexName, value) {
6658
6342
  return withOpenIndex(
@@ -6717,7 +6401,23 @@ function portabilityOperations(core, config, engine) {
6717
6401
  release();
6718
6402
  }
6719
6403
  }
6720
- const restoresInFlight = /* @__PURE__ */ new Map();
6404
+ function queueRestore(indexName, data) {
6405
+ const { restoresInFlight } = core;
6406
+ const previous = restoresInFlight.get(indexName) ?? Promise.resolve();
6407
+ const restored = previous.then(async () => {
6408
+ const { runRestore } = await import('./restore-queue-JVGENGGE.mjs');
6409
+ await runRestore(core, restoreHost, indexName, data, engine());
6410
+ });
6411
+ const settled2 = restored.then(
6412
+ () => void 0,
6413
+ () => void 0
6414
+ );
6415
+ restoresInFlight.set(indexName, settled2);
6416
+ void settled2.then(() => {
6417
+ if (restoresInFlight.get(indexName) === settled2) restoresInFlight.delete(indexName);
6418
+ });
6419
+ return restored;
6420
+ }
6721
6421
  const restoreHost = {
6722
6422
  getVectorFieldPaths,
6723
6423
  announceIndexCreated: (name, restoredConfig) => announceIndexCreated(core, name, restoredConfig),
@@ -6734,26 +6434,23 @@ function portabilityOperations(core, config, engine) {
6734
6434
  };
6735
6435
  }
6736
6436
  return {
6737
- snapshot(indexName) {
6437
+ snapshot(indexName, options) {
6738
6438
  return withOpenIndex2(indexName, async () => {
6739
- const { createSnapshot } = await import('./snapshot-WMX6JCLP.mjs');
6740
- return createSnapshot(snapshotDepsOf(indexName));
6439
+ const { createSnapshot } = await import('./snapshot-4HS2G2UM.mjs');
6440
+ return createSnapshot(snapshotDepsOf(indexName), options?.queryHistory === true ? core : null);
6741
6441
  });
6742
6442
  },
6743
6443
  async restore(indexName, data) {
6744
6444
  core.guardShutdown();
6745
6445
  validateIndexName(indexName);
6746
- const restored = import('./restore-queue-AOF5OTQV.mjs').then(
6747
- ({ queueRestore }) => queueRestore(core, restoreHost, restoresInFlight, indexName, data)
6748
- );
6749
- await emitWriteEventAfter(core, indexName, restored);
6446
+ await emitWriteEventAfter(core, indexName, queueRestore(indexName, data));
6750
6447
  core.heapPressureNotifier.check(indexName);
6751
6448
  },
6752
6449
  exportDocuments(indexName) {
6753
6450
  return withOpenIndex2(indexName, async () => {
6754
6451
  const [{ checkpointForArchive }, { documentExportStream }] = await Promise.all([
6755
- import('./snapshot-WMX6JCLP.mjs'),
6756
- import('./write-SKJ6HW7O.mjs')
6452
+ import('./snapshot-4HS2G2UM.mjs'),
6453
+ import('./write-GTTWWRRG.mjs')
6757
6454
  ]);
6758
6455
  const header = indexConfigurationOf(core.requireIndex(indexName));
6759
6456
  return documentExportStream(header, await checkpointForArchive(snapshotDepsOf(indexName)));
@@ -6761,7 +6458,7 @@ function portabilityOperations(core, config, engine) {
6761
6458
  },
6762
6459
  importDocumentExport(indexName, data) {
6763
6460
  core.guardShutdown();
6764
- const imported = import('./import-GJOMB2HC.mjs').then(
6461
+ const imported = import('./import-NBFXFCSG.mjs').then(
6765
6462
  ({ readDocumentExport }) => readDocumentExport(engine(), indexName, data)
6766
6463
  );
6767
6464
  return emitWriteEventAfter(core, indexName, imported);
@@ -6872,7 +6569,7 @@ async function runEngineQuery(core, indexName, params, options) {
6872
6569
  const manager = core.requireManager(indexName);
6873
6570
  const scoped = scopedParams(params, options);
6874
6571
  await core.pluginRegistry.runHook("beforeSearch", { indexName, params: scoped });
6875
- const rerank = scoped.rerank === void 0 ? void 0 : await import('./runtime-L2DZYY6N.mjs');
6572
+ const rerank = scoped.rerank === void 0 ? void 0 : await import('./runtime-COIUORCN.mjs');
6876
6573
  const resolvedParams = await resolveVectorText(
6877
6574
  rerank === void 0 ? scoped : rerank.withRerankQueryText(scoped),
6878
6575
  entry.embeddingAdapter,
@@ -7019,6 +6716,14 @@ async function runEngineListDocuments(core, indexName, params, partitionIds) {
7019
6716
  }
7020
6717
  }
7021
6718
 
6719
+ // src/narsil/sync.ts
6720
+ function syncOperations(core) {
6721
+ return {
6722
+ updateSync: async (indexName, setting) => (await import('./methods-7IOINERF.mjs')).updateSyncOf(core, indexName, setting),
6723
+ getSync: async (indexName) => (await import('./methods-7IOINERF.mjs')).syncOf(core, indexName)
6724
+ };
6725
+ }
6726
+
7022
6727
  // src/narsil/synonyms.ts
7023
6728
  function synonymOperations(core) {
7024
6729
  return {
@@ -7197,7 +6902,7 @@ function createNarsilFromCore(core, config) {
7197
6902
  const entry = requireIndex(indexName);
7198
6903
  await withOpenIndexWrite(indexName, async () => {
7199
6904
  if (entry.pendingAnalysis === null) return core.analysisRebuild.rebuild(indexName);
7200
- return (await import('./analysis-change-2OYM7ARW.mjs')).resumeAnalysisChange(core, indexName);
6905
+ return (await import('./analysis-change-3TFIHT5E.mjs')).resumeAnalysisChange(core, indexName);
7201
6906
  });
7202
6907
  },
7203
6908
  async changeAnalysis(indexName, change) {
@@ -7205,13 +6910,14 @@ function createNarsilFromCore(core, config) {
7205
6910
  requireIndex(indexName);
7206
6911
  const changed = withOpenIndex2(
7207
6912
  indexName,
7208
- async () => (await import('./analysis-change-2OYM7ARW.mjs')).changeIndexAnalysis(core, indexName, change)
6913
+ async () => (await import('./analysis-change-3TFIHT5E.mjs')).changeIndexAnalysis(core, indexName, change)
7209
6914
  );
7210
6915
  await emitWriteEventAfter(core, indexName, changed);
7211
6916
  },
7212
6917
  ...portabilityOperations(core, config, () => narsil),
7213
6918
  ...synonymOperations(core),
7214
6919
  ...bm25Operations(core),
6920
+ ...syncOperations(core),
7215
6921
  async checkpoint(indexName) {
7216
6922
  guardShutdown();
7217
6923
  requireIndex(indexName);
@@ -7222,13 +6928,7 @@ function createNarsilFromCore(core, config) {
7222
6928
  async clear(indexName) {
7223
6929
  guardShutdown();
7224
6930
  requireIndex(indexName);
7225
- await withOpenIndexWrite(indexName, async () => {
7226
- await executor.execute({ type: "clear", indexName, requestId: indexName });
7227
- await orchestrator.replicateToWorkers({ type: "clear", indexName, requestId: `replicate-clear-${indexName}` });
7228
- core.watermarkNotifier.forget(indexName);
7229
- const durable = core.durability?.manager;
7230
- await (durable?.checkpointFromMemory?.(indexName) ?? durable?.checkpoint(indexName));
7231
- });
6931
+ await withOpenIndexWrite(indexName, () => clearEngineIndex(core, indexName));
7232
6932
  },
7233
6933
  async rebalance(indexName, targetPartitionCount) {
7234
6934
  guardShutdown();
@@ -7242,12 +6942,15 @@ function createNarsilFromCore(core, config) {
7242
6942
  if (rebalancesStarting.get(indexName) === started) rebalancesStarting.delete(indexName);
7243
6943
  }
7244
6944
  rebalancesStarting.set(indexName, started);
7245
- const rebalanced = withOpenIndex2(indexName, async () => {
7246
- const { executeRebalance } = await import('./analysis-change-2OYM7ARW.mjs');
7247
- const running = executeRebalance(requireManager(indexName), indexName, targetPartitionCount, rebalanceCtx);
7248
- releaseWrites();
7249
- return running;
7250
- });
6945
+ const rebalanced = withOpenIndex2(
6946
+ indexName,
6947
+ () => withRenewedSyncEpoch(core, indexName, async () => {
6948
+ const { executeRebalance } = await import('./analysis-change-3TFIHT5E.mjs');
6949
+ const running = executeRebalance(requireManager(indexName), indexName, targetPartitionCount, rebalanceCtx);
6950
+ releaseWrites();
6951
+ await running;
6952
+ })
6953
+ );
7251
6954
  return emitWriteEventAfter(core, indexName, rebalanced).finally(releaseWrites);
7252
6955
  },
7253
6956
  async updatePartitionConfig(indexName, partitionConfig) {
@@ -7364,10 +7067,14 @@ async function createNarsil(config) {
7364
7067
  const runnableConfig = await resolveRunnableConfig(config);
7365
7068
  const core = await createEngineCore(runnableConfig);
7366
7069
  await startEngineCore(core, runnableConfig);
7367
- return createNarsilFromCore(core, runnableConfig);
7070
+ const engine = createNarsilFromCore(core, runnableConfig);
7071
+ if (runnableConfig?.querySuggestions !== void 0 || core.durability !== null) {
7072
+ await (await import('./engine-hooks-DHCMOADY.mjs')).startQuerySuggestions(core, engine, runnableConfig);
7073
+ }
7074
+ return engine;
7368
7075
  }
7369
7076
 
7370
7077
  // src/index.ts
7371
7078
  var VERSION = "0.1.0";
7372
7079
 
7373
- export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, HEADER_SIZE, REBALANCE_CHUNK_SIZE, RESERVED_SIZE, VERSION, applyStoredIndexBm25, arrayPositionsAreStale, bindRerankWindowSource, checksumOfChunks, crc322 as crc32, crc32Final, crc32Init, crc32Update, createEngineCore, createEngineIndex, createMemoryMonitor, createNarsil, createNarsilFromCore, decodeIndexConfiguration, deleteNestedValue, emitEngineEvent, emptySerializablePartition, encodeIndexConfiguration, engineCoreOf, engineVersionParts, extractVectorFromDoc, hasNrslMagic, insertDocumentVectors, memoryFractionsOf, openChecksummedEnvelope, packChecksummedEnvelope, packEnvelopeWithChecksum, prepareConfiguredSynonyms, prepareDocumentVectors, prepareStoredSynonyms, providedDocId, readHeader, rebuildTextIndexes, reconstructSchemaFromMetadata, removeDocumentVectors, requireConfigurationShape, requireConfigurationWithinSizeLimit, requireKnownConfig, requireWithinFileLimit, rerankWindowCapOf, resolveRunnableConfig, resolveVectorText, rewriteSpillOf, rulesOfStoredSynonyms, runEngineListDocuments, runEnginePreflight, runEngineQuery, runEngineQueryStats, runEngineSuggest, startEngineCore, storedArrayPositionGap, textRebuildTargetOf, toError2 as toError, validateEmbeddingConfig, validateMemoryFractions, validateRequiredFieldsInSchema, vectorsEqual, writeHeader, yieldToEventLoop };
7080
+ export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, VERSION, applyStoredIndexBm25, arrayPositionsAreStale, bindRerankWindowSource, createEngineCore, createEngineIndex, createMemoryMonitor, createNarsil, createNarsilFromCore, deleteNestedValue, dropEngineIndex, emitEngineEvent, emitWriteEventAfter, emptySerializablePartition, encodeIndexConfiguration, engineCoreOf, engineVersionParts, extractVectorFromDoc, holdSyncEpochChange, insertDocumentVectors, memoryFractionsOf, packChecksummedEnvelope, packEnvelopeWithChecksum, prepareConfiguredSynonyms, prepareDocumentVectors, prepareStoredSynonyms, providedDocId, rebuildTextIndexes, reconstructSchemaFromMetadata, removeDocumentBatch2 as removeDocumentBatch, removeDocumentVectors, requireConfigurationWithinSizeLimit, requireKnownConfig, rerankWindowCapOf, resolveRunnableConfig, resolveVectorText, rewriteSpillOf, rulesOfStoredSynonyms, runEngineListDocuments, runEnginePreflight, runEngineQuery, runEngineQueryStats, runEngineSuggest, startEngineCore, storedArrayPositionGap, textRebuildTargetOf, toError2 as toError, validateEmbeddingConfig, validateMemoryFractions, validateRequiredFieldsInSchema, vectorsEqual, yieldToEventLoop };