@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,4 @@
1
- import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter, R as RerankAdapter } from './adapters-pljAqmrC.js';
2
- import { A as AnyDocument, S as SchemaDefinition, B as BM25Params, e as ScoringMode, a as IndexConfig } from './schema-D33CyXCy.js';
1
+ import { A as AnyDocument, S as SchemaDefinition, B as BM25Params, b as ScoringMode } from './schema-DDauvDOv.js';
3
2
 
4
3
  /**
5
4
  * Every code a {@link NarsilError} carries, grouped by the part of the engine
@@ -45,6 +44,11 @@ declare const ErrorCodes: {
45
44
  readonly BACKUP_STORE_CLAIMED: "BACKUP_STORE_CLAIMED";
46
45
  readonly BACKUP_STORE_NOT_CONFIGURED: "BACKUP_STORE_NOT_CONFIGURED";
47
46
  readonly BACKUP_NOT_READY: "BACKUP_NOT_READY";
47
+ readonly SYNC_DURABILITY_REQUIRED: "SYNC_DURABILITY_REQUIRED";
48
+ readonly SYNC_BACKUP_STORE_REQUIRED: "SYNC_BACKUP_STORE_REQUIRED";
49
+ readonly SYNC_NOT_READY: "SYNC_NOT_READY";
50
+ readonly SYNC_NOT_ENABLED: "SYNC_NOT_ENABLED";
51
+ readonly SYNC_SNAPSHOT_PREPARING: "SYNC_SNAPSHOT_PREPARING";
48
52
  readonly SEARCH_INVALID_FIELD: "SEARCH_INVALID_FIELD";
49
53
  readonly VECTOR_DIMENSION_MISMATCH: "VECTOR_DIMENSION_MISMATCH";
50
54
  readonly SEARCH_INVALID_FILTER: "SEARCH_INVALID_FILTER";
@@ -175,8 +179,10 @@ type ServerErrorCode = (typeof ServerErrorCodes)[keyof typeof ServerErrorCodes];
175
179
  * a server, or where the caller cannot read the answer.
176
180
  *
177
181
  * The HTTP client raises the first five. The React bindings raise
178
- * `CLIENT_UNEXPECTED_ERROR` alone, which reports a fault inside a hook. No
179
- * server sends any of them, so a failure under one means the exchange broke
182
+ * `CLIENT_UNEXPECTED_ERROR` alone, which reports a fault inside a hook. A
183
+ * synced device raises `SYNC_ANALYSIS_UNAVAILABLE` before it downloads a
184
+ * snapshot whose language, tokeniser, or stop words it has not registered,
185
+ * and it keeps its copy of the index. No server sends any of them, so a failure under one means the exchange broke
180
186
  * before the operation ran. `STATUS_BY_CODE` in `src/server/errors.ts`
181
187
  * therefore maps none of them, because no request can arrive under one and no
182
188
  * HTTP status belongs to one.
@@ -190,6 +196,7 @@ declare const ClientErrorCodes: {
190
196
  readonly CLIENT_INVALID_RESPONSE: "CLIENT_INVALID_RESPONSE";
191
197
  readonly CLIENT_TASK_TIMEOUT: "CLIENT_TASK_TIMEOUT";
192
198
  readonly CLIENT_UNEXPECTED_ERROR: "CLIENT_UNEXPECTED_ERROR";
199
+ readonly SYNC_ANALYSIS_UNAVAILABLE: "SYNC_ANALYSIS_UNAVAILABLE";
193
200
  };
194
201
  /**
195
202
  * Any one of the codes in {@link ClientErrorCodes}.
@@ -559,7 +566,7 @@ interface SuggestResult {
559
566
  }
560
567
  /**
561
568
  * The state of one vector field, and what maintenance would cost, as
562
- * {@link Narsil.vectorMaintenanceStatus} reports it.
569
+ * {@link VectorMaintenanceOperations.vectorMaintenanceStatus} reports it.
563
570
  *
564
571
  * Removing a vector leaves a tombstone in the graph, and enough of them slow a
565
572
  * search down. Read this to decide when compaction earns its cost.
@@ -592,9 +599,9 @@ interface VectorMaintenanceResult {
592
599
  * background, during which a search reads them from the field's files.
593
600
  */
594
601
  loadingFromFiles: boolean;
595
- /** {@link Narsil.compactVectors} would take about this many milliseconds. */
602
+ /** {@link VectorMaintenanceOperations.compactVectors} would take about this many milliseconds. */
596
603
  estimatedCompactMs: number;
597
- /** {@link Narsil.optimizeVectors} would take about this many milliseconds. */
604
+ /** {@link VectorMaintenanceOperations.optimizeVectors} would take about this many milliseconds. */
598
605
  estimatedOptimizeMs: number;
599
606
  }
600
607
  /**
@@ -1481,170 +1488,6 @@ interface HighlightConfig {
1481
1488
  maxSnippetLength?: number;
1482
1489
  }
1483
1490
 
1484
- /**
1485
- * Hooks that the engine calls alongside its own work, so that an application
1486
- * can add validation, auditing, enrichment, or metrics without forking the
1487
- * engine.
1488
- *
1489
- * Every hook is optional. A `before` hook fires first and rejects the
1490
- * operation by throwing, while an `after` hook fires once the operation
1491
- * succeeds. Where a `before` hook on a write throws a {@link NarsilError}, the
1492
- * engine passes that error to the caller unchanged. It turns any other error
1493
- * into `DOC_VALIDATION_FAILED` with the same message, for a single write and
1494
- * for each entry of a batch alike. The engine awaits a hook that returns a
1495
- * promise, so slow work in one hook slows every write or search that it
1496
- * covers.
1497
- *
1498
- * @public
1499
- */
1500
- interface NarsilPlugin {
1501
- /** This name identifies the plugin in errors and in event payloads. */
1502
- name: string;
1503
- /** Fires before the engine indexes a document. Throw to reject the write. */
1504
- beforeInsert?(ctx: InsertContext): void | Promise<void>;
1505
- /** Fires once the engine has indexed a document. */
1506
- afterInsert?(ctx: InsertContext): void | Promise<void>;
1507
- /** Fires before the engine removes a document. Throw to reject the removal. */
1508
- beforeRemove?(ctx: RemoveContext): void | Promise<void>;
1509
- /** Fires once the engine has removed a document. */
1510
- afterRemove?(ctx: RemoveContext): void | Promise<void>;
1511
- /** Fires before the engine replaces a document. Throw to reject the update. */
1512
- beforeUpdate?(ctx: UpdateContext): void | Promise<void>;
1513
- /** Fires once the engine has replaced a document. */
1514
- afterUpdate?(ctx: UpdateContext): void | Promise<void>;
1515
- /**
1516
- * Fires before every search, and before every preflight. Throw to reject the
1517
- * query. It fires before the engine embeds a `vector.text` query, so a hook
1518
- * that counts or refuses work stops the call to the embedding provider, and
1519
- * `ctx.params.vector` still holds the text that the caller passed.
1520
- * {@link Narsil.suggest} scans the term dictionary and searches no document,
1521
- * so it fires no hook.
1522
- */
1523
- beforeSearch?(ctx: SearchContext): void | Promise<void>;
1524
- /**
1525
- * Fires once a search returns. The context holds a copy of the results, so a
1526
- * change that you make here leaves the caller's own result untouched. Where
1527
- * this hook throws, the engine logs a warning and answers the query all the
1528
- * same, because the search is already over.
1529
- */
1530
- afterSearch?(ctx: SearchContext): void | Promise<void>;
1531
- /**
1532
- * Fires once the engine creates an index, and a `restore` fires it too,
1533
- * because a restore recreates the index that it replaces. Where this hook
1534
- * throws, the engine logs a warning and keeps the index, because the hook
1535
- * fires after the index exists.
1536
- */
1537
- onIndexCreate?(ctx: IndexContext): void | Promise<void>;
1538
- /**
1539
- * Fires once the engine drops an index, and a `restore` fires it too,
1540
- * because a restore drops the index that it replaces. Where this hook
1541
- * throws, the engine logs a warning, because the hook fires after the index
1542
- * is gone.
1543
- */
1544
- onIndexDrop?(ctx: IndexContext): void | Promise<void>;
1545
- /**
1546
- * Fires once {@link Narsil.rebalance} moves an index onto a new partition
1547
- * count, which is the only way that the count changes. An index opens with
1548
- * the count that `partitions.maxPartitions` sets, because the engine adds no
1549
- * partition on its own. Subscribe to the `partitionWatermark` event to learn
1550
- * when an index fills its capacity.
1551
- */
1552
- onPartitionSplit?(ctx: PartitionContext): void | Promise<void>;
1553
- /** Fires once the engine loads worker copies of its indexes. */
1554
- onWorkerPromote?(ctx: WorkerContext): void | Promise<void>;
1555
- }
1556
- /**
1557
- * What a plugin receives around an insert.
1558
- *
1559
- * @public
1560
- */
1561
- interface InsertContext {
1562
- /** The engine writes the document to this index. */
1563
- indexName: string;
1564
- /** The document is stored under this id, which the engine resolves before the `before` hook runs. */
1565
- docId: string;
1566
- /** This is the document itself, and the engine indexes whatever a `before` hook leaves here. */
1567
- document: AnyDocument;
1568
- }
1569
- /**
1570
- * What a plugin receives around a removal.
1571
- *
1572
- * @public
1573
- */
1574
- interface RemoveContext {
1575
- /** The engine removes the document from this index. */
1576
- indexName: string;
1577
- /** The engine removes this document. */
1578
- docId: string;
1579
- }
1580
- /**
1581
- * What a plugin receives around an update.
1582
- *
1583
- * @public
1584
- */
1585
- interface UpdateContext {
1586
- /** The document belongs to this index. */
1587
- indexName: string;
1588
- /** The engine replaces this document. */
1589
- docId: string;
1590
- /** The index holds this document before the update. */
1591
- oldDocument: AnyDocument;
1592
- /** This document replaces it, and the engine indexes whatever a `before` hook leaves here. */
1593
- newDocument: AnyDocument;
1594
- }
1595
- /**
1596
- * What a plugin receives around a search.
1597
- *
1598
- * @public
1599
- */
1600
- interface SearchContext {
1601
- /** The search runs against this index. */
1602
- indexName: string;
1603
- /** These are the parameters the query runs with, and a `before` hook that changes them rewrites the search. */
1604
- params: QueryParams;
1605
- /**
1606
- * These are the results, which an `after` hook alone receives. A preflight
1607
- * fires `beforeSearch` and stops there, because it answers with a count and
1608
- * no hits. Read this field inside an `afterSearch` hook alone.
1609
- */
1610
- results?: QueryResult;
1611
- }
1612
- /**
1613
- * What a plugin receives when the engine creates or drops an index.
1614
- *
1615
- * @public
1616
- */
1617
- interface IndexContext {
1618
- /** The engine creates or drops this index. */
1619
- indexName: string;
1620
- /** The index holds this configuration. */
1621
- config: IndexConfig;
1622
- }
1623
- /**
1624
- * What a plugin receives when a rebalance changes an index's partition count.
1625
- *
1626
- * @public
1627
- */
1628
- interface PartitionContext {
1629
- /** The rebalance moved this index. */
1630
- indexName: string;
1631
- /** The index held this many partitions before the rebalance. */
1632
- oldPartitionCount: number;
1633
- /** The index holds this many partitions now. */
1634
- newPartitionCount: number;
1635
- }
1636
- /**
1637
- * What a plugin receives when the engine moves onto worker threads.
1638
- *
1639
- * @public
1640
- */
1641
- interface WorkerContext {
1642
- /** The pool holds this many workers. */
1643
- workerCount: number;
1644
- /** The engine promoted for this reason, such as the threshold that the index crossed. */
1645
- reason: string;
1646
- }
1647
-
1648
1491
  /**
1649
1492
  * Snapshot of V8 heap usage as reported by `process.memoryUsage()`, with the
1650
1493
  * limit the heap may grow to. All values are bytes. `null` in environments
@@ -1953,297 +1796,63 @@ type NarsilEventHandlers = {
1953
1796
  };
1954
1797
 
1955
1798
  /**
1956
- * Everything {@link createNarsil} accepts when it builds an engine.
1799
+ * The device sync setting of one index, which {@link SyncOperations.updateSync} takes.
1957
1800
  *
1958
- * Every field is optional, and an engine created without any of them keeps
1959
- * its indexes in memory alone. Add persistence to survive a restart, add
1960
- * invalidation to share a store with another process, and add durability to
1961
- * recover the writes made since the last snapshot.
1801
+ * Turn sync on only for an index whose every document belongs to one user, because every device that syncs the index
1802
+ * receives the whole index. Create one index for each user, and leave sync off for a public index or for an index that
1803
+ * holds the data of several users.
1962
1804
  *
1963
1805
  * @public
1964
1806
  */
1965
- interface NarsilConfig {
1966
- /** This adapter writes partitions somewhere they outlive the process. */
1967
- persistence?: PersistenceAdapter;
1968
- /** This channel carries partition changes to other instances sharing the store. */
1969
- invalidation?: InvalidationAdapter;
1970
- /** These hooks observe or reject writes, searches, and lifecycle changes. */
1971
- plugins?: NarsilPlugin[];
1972
- /** This supplies the id for a document inserted without one. The engine generates a UUID v7 by default. */
1973
- idGenerator?: () => string;
1974
- /** These settings control when an index gains worker copies, how many threads they share, and when an idle index gives them up. */
1975
- workers?: WorkerConfig;
1976
- /** Every index uses this adapter unless its own config names another. */
1977
- embedding?: EmbeddingAdapter;
1978
- /** Named adapters; names persist in index metadata so recovery can rebind. */
1979
- embeddingAdapters?: Record<string, EmbeddingAdapter>;
1980
- /**
1981
- * These rerank adapters are registered under their keys, so that a query
1982
- * can give a key in `rerank.adapter`. The engine throws
1983
- * `RERANK_CONFIG_INVALID` for an empty key and for an entry without a
1984
- * `rerank` function.
1985
- */
1986
- rerankAdapters?: Record<string, RerankAdapter>;
1987
- /**
1988
- * The engine waits this many milliseconds for a rerank adapter to score one
1989
- * query, and 30,000 by default. It then cancels the call through the
1990
- * adapter's abort signal and throws `RERANK_FAILED`. Set a whole number of
1991
- * at least 1; {@link createNarsil} throws `CONFIG_INVALID` for any other
1992
- * value.
1993
- */
1994
- rerankTimeout?: number;
1995
- /**
1996
- * A query may rerank at most this many of its top hits, which caps the
1997
- * documents that one query sends to a model. Set a whole number from 1 to
1998
- * 1,000, or leave it out for 100; {@link createNarsil} throws
1999
- * `CONFIG_INVALID` for any other value.
2000
- */
2001
- maxRerankWindow?: number;
2002
- /** These settings recover the writes made since the last snapshot. */
2003
- durability?: DurabilityConfig;
2004
- /** These settings control what the engine does when an index's stored analysis differs from its language module. */
2005
- analysis?: AnalysisConfig;
2006
- /** These limits close indexes while keeping their durable files ready to reopen. */
2007
- lifecycle?: IndexLifecycleConfig;
2008
- /**
2009
- * These listeners receive events from the moment that the engine starts.
2010
- * The engine registers each one before it recovers any index, so a listener
2011
- * here receives the `layoutUpgrade` events of that recovery, which come
2012
- * before {@link createNarsil} returns the engine. For a name outside
2013
- * {@link NarsilEventMap}, or an entry that is not a function,
2014
- * {@link createNarsil} throws `CONFIG_INVALID`.
2015
- */
2016
- events?: NarsilEventHandlers;
2017
- /**
2018
- * This is the most work that the engine may do on the pattern tests and
2019
- * phrases of one search, counted over every partition that it searches. For
2020
- * a phrase, the engine adds one unit for each posting of its starting word
2021
- * that it visits, and one for each position that it compares. For a pattern
2022
- * test, it adds one unit for each run of three code points that it looks up in a pattern
2023
- * index, one for each entry that it reads from a pattern index, and one for
2024
- * each step of its matcher. For a text whose case fold is shorter than three
2025
- * code points, it counts each document that it checks as an entry that it
2026
- * reads. It counts an `in` or `nin` test as one `eq` test for each distinct
2027
- * value in its list. For an `eq` test with a `tolerance`, it also adds one
2028
- * unit for each cell that it fills in the table of edit distances between
2029
- * the text and a value. It also counts the preparation of that test once for
2030
- * a search, however many worker copies prepare it. Once the count passes the
2031
- * cap, the engine throws `SEARCH_WORK_CAP_EXCEEDED`. The cap
2032
- * defaults to 25,000,000 units. For any value other than a whole number from
2033
- * 1 to `Number.MAX_SAFE_INTEGER`, {@link createNarsil} throws
2034
- * `CONFIG_INVALID`.
2035
- */
2036
- patternWorkCap?: number;
2037
- /**
2038
- * These fractions set the memory levels at which the engine stops and resumes
2039
- * accepting inserts and updates, so that a write cannot take the process past
2040
- * its memory limit. Inside a cluster node, the node's own memory settings
2041
- * apply in place of these. For a fraction outside the range that
2042
- * {@link MemoryConfig} describes, {@link createNarsil} throws `CONFIG_INVALID`
2043
- * on Node.js and on a phone. A browser reports no memory limit, so the
2044
- * engine there ignores this setting and leaves it unchecked.
2045
- */
2046
- memory?: MemoryConfig;
2047
- }
2048
- /**
2049
- * The memory levels at which an engine stops and resumes accepting inserts and
2050
- * updates.
2051
- *
2052
- * The engine measures its process memory and its heap before a write whenever
2053
- * its latest measurement is more than one second old. It counts as full once
2054
- * either figure passes `blockWritesAbove` of its limit, and as clear again once
2055
- * both fall below `resumeWritesBelow`, so that an engine near the threshold
2056
- * does not switch writes on and off. While the engine is full, it refuses every
2057
- * insert and update with `MEMORY_WRITE_BLOCKED` and the reason `memory_full`,
2058
- * and it accepts removes, searches, and document reads, so that you can free
2059
- * memory by removing documents. It also refuses a document whose indexing could
2060
- * take the memory in use past the block level, with the reason
2061
- * `write_would_fill_memory`. In a batch, it refuses that document and every
2062
- * later one, and it keeps the documents that it has already indexed. A runtime
2063
- * that reports no memory limit, such as a browser, leaves every write
2064
- * unchecked.
2065
- *
2066
- * @public
2067
- */
2068
- interface MemoryConfig {
2069
- /**
2070
- * The engine counts as full once either memory figure passes this fraction
2071
- * of its limit. It must lie above `resumeWritesBelow` and at most 1, and it
2072
- * is 0.9 where you set none. On Node.js, the engine compares its heap with
2073
- * the smaller of this setting and 0.75, because V8 stops a process after four
2074
- * full collections in a row that each leave the old generation holding at
2075
- * least 0.8 of its limit.
2076
- */
2077
- blockWritesAbove?: number;
2078
- /**
2079
- * A full engine accepts writes again once both memory figures fall below
2080
- * this fraction of their limits. It must lie above 0 and below
2081
- * `blockWritesAbove`, and it is 0.8 where you set none. On Node.js, the
2082
- * engine compares its heap with the smaller of this setting and 0.65, for the
2083
- * same reason that it caps the heap side of `blockWritesAbove` at 0.75.
2084
- */
2085
- resumeWritesBelow?: number;
1807
+ interface SyncSetting {
1808
+ /** This turns sync on or off. Turning it on gives the index a new epoch, so every synced device loads a new copy. */
1809
+ enabled: boolean;
1810
+ /** This is the age in milliseconds after which the server deletes a log segment from history. It defaults to 30
1811
+ * days. */
1812
+ historyMaxAgeMs?: number;
1813
+ /** This is the byte count above which the server deletes the oldest log segment from history. It defaults to the
1814
+ * length of the published snapshot. */
1815
+ historyMaxBytes?: number;
2086
1816
  }
2087
1817
  /**
2088
- * Limits on the indexes one engine keeps open in memory.
1818
+ * The device sync state of one index, which {@link SyncOperations.getSync} returns.
2089
1819
  *
2090
1820
  * @public
2091
1821
  */
2092
- interface IndexLifecycleConfig {
2093
- /** An index closes after this many milliseconds without activity. */
2094
- idleTimeoutMs?: number;
2095
- /** The engine keeps at most this many indexes open at once. */
2096
- maxOpenIndexes?: number;
2097
- /** Open indexes may use at most this many estimated bytes in total. */
2098
- maxOpenBytes?: number;
2099
- /** At most this many callers may wait behind one index reopen. */
2100
- maxReopenWaiters?: number;
2101
- }
2102
- /**
2103
- * Describes an index whose stored terms came from an older analysis than the
2104
- * one its language module carries today.
2105
- *
2106
- * The engine hands this to {@link AnalysisConfig.onStaleAnalysis} together
2107
- * with the rebuild that fixes it, so you decide when the work runs.
2108
- *
2109
- * @public
2110
- */
2111
- interface StaleAnalysis {
2112
- /** This index holds terms that are out of date. */
2113
- indexName: string;
2114
- /** The index was built with this language module. */
2115
- language: string;
2116
- /** The index recorded this revision when it was written, and `null` for an index written before revisions existed. */
2117
- storedRevision: string | null;
2118
- /** The language module carries this revision now. */
2119
- currentRevision: string;
2120
- /** The rebuild reindexes this many documents. */
2121
- documentCount: number;
1822
+ interface SyncStatus extends SyncSetting {
1823
+ /** This is true once a device has asked for the published snapshot, from when the server keeps history. */
1824
+ active: boolean;
1825
+ /** This is the index epoch, 32 lowercase hexadecimal digits, or `null` while sync is off. */
1826
+ epoch: string | null;
2122
1827
  }
2123
1828
  /**
2124
- * What the engine does when an index's stored terms no longer match the
2125
- * analysis its language module produces.
2126
- *
2127
- * A stale index answers text queries from terms an older analysis wrote, and
2128
- * every such result reports `analysisStale`. Rebuilding fixes it, and this
2129
- * setting controls whether the engine starts that work itself.
1829
+ * The methods that turn device sync on and off for an index.
2130
1830
  *
2131
1831
  * @public
2132
1832
  */
2133
- interface AnalysisConfig {
2134
- /** `auto` rebuilds a stale index in the background, and `manual` leaves it to you. The engine rebuilds automatically by default. */
2135
- rebuild?: 'auto' | 'manual';
1833
+ interface SyncOperations {
2136
1834
  /**
2137
- * Called once for each stale index the engine finds.
1835
+ * Replaces the device sync setting of an index.
2138
1836
  *
2139
- * @param index - The index that is stale, and how far behind it is.
2140
- * @param rebuild - Starts the rebuild and resolves once every partition
2141
- * carries current terms. Under `manual` nothing rebuilds until you call it.
2142
- */
2143
- onStaleAnalysis?(index: StaleAnalysis, rebuild: () => Promise<void>): void | Promise<void>;
2144
- }
2145
- /**
2146
- * Write-ahead logging and checkpointing, which recover the writes made since
2147
- * the last snapshot.
2148
- *
2149
- * The `wal` tier logs every mutation before applying it, so a crash costs
2150
- * nothing once the log replays. The `snapshot` tier writes whole partitions on
2151
- * an interval, which is cheaper to run and loses whatever arrived after the
2152
- * last write.
2153
- *
2154
- * @public
2155
- */
2156
- interface DurabilityConfig {
2157
- /** `wal` logs every mutation, and `snapshot` writes whole partitions on an interval. */
2158
- tier?: 'wal' | 'snapshot';
2159
- /** The engine writes the log and its checkpoints into this directory. */
2160
- directory?: string;
2161
- /** `sync` flushes before a write resolves, and `async` flushes on the interval below. */
2162
- mode?: 'sync' | 'async';
2163
- /** In `async` mode the engine flushes this many milliseconds apart. */
2164
- flushIntervalMs?: number;
2165
- /** The log rolls over to a new segment once it reaches this size. */
2166
- segmentMaxBytes?: number;
2167
- /** The engine checkpoints this many milliseconds apart, which shortens the replay a restart has to do. */
2168
- checkpointIntervalMs?: number;
2169
- /** This many mutations trigger a checkpoint before the interval elapses. */
2170
- checkpointMutationThreshold?: number;
2171
- /**
2172
- * The engine merges a partition's checkpoint segments once that partition
2173
- * holds more than this many of them, 12 by default. The value is a whole
2174
- * number of segments.
2175
- */
2176
- compactionThreshold?: number;
2177
- }
2178
- /**
2179
- * Which queries the main copy of an index answers once the index holds worker
2180
- * copies. Under `lone`, the main copy answers a query the engine receives
2181
- * while no copy holds one, on an index of at most 50,000 documents. Once
2182
- * every copy is busy, it also answers one query per turn of the event loop.
2183
- * Under `none`, every query on an index that holds copies goes to one of
2184
- * them, while the main copy still answers a query on an index whose copies
2185
- * are loading.
2186
- *
2187
- * @public
2188
- */
2189
- type MainCopyQueries = 'lone' | 'none';
2190
- /**
2191
- * How the engine holds worker copies of its indexes, and how many threads
2192
- * they may use.
2193
- *
2194
- * A small index answers fastest on the main thread. Once an index holds as
2195
- * many documents as the copy threshold, the engine loads a copy of it onto
2196
- * every worker thread, and each query then runs whole on the copy with the
2197
- * fewest queries in flight. The same switch governs the vector search pool.
2198
- *
2199
- * @public
2200
- */
2201
- interface WorkerConfig {
2202
- /**
2203
- * Whether the engine may hold worker copies and a vector search pool. It is
2204
- * on everywhere but a browser page. Set it to false to hold the process to
2205
- * one thread, which leaves both pools absent. Where a bundler folds
2206
- * `@delali/narsil` into an application bundle, the engine finds no worker
2207
- * entry: left unset, it answers on one thread and prints one warning, and
2208
- * set to true, `createNarsil` throws `CONFIG_INVALID`.
2209
- */
2210
- enabled?: boolean;
2211
- /**
2212
- * The keyword copies and the vector search pool share this many threads
2213
- * between them, half each, in an embedded engine, so a budget of 4 gives 2
2214
- * keyword copies and 2 vector search workers. The HTTP server holds a copy
2215
- * on every one of them and receives requests there. The engine takes the
2216
- * host's cores minus one by default, between 2 and 8. It caps a value that
2217
- * you set at 31, which is how many scratch slots the shared vector arena
2218
- * reserves.
2219
- */
2220
- count?: number;
2221
- /** An index gains worker copies once it holds this many documents, 1,000 by default. */
2222
- promotionThreshold?: number;
2223
- /**
2224
- * The engine drops an index's copies after this many milliseconds without a
2225
- * read or a write, five minutes by default, and loads them again on the
2226
- * next request while the main copy answers it. It may not exceed
2227
- * `lifecycle.idleTimeoutMs`, and where it is unset the copies take the
2228
- * smaller of five minutes and that interval.
2229
- */
2230
- idleTimeoutMs?: number;
2231
- /**
2232
- * Which queries the main copy answers, `lone` by default. Set `none` where
2233
- * the main thread also serves the host's own work, such as HTTP requests,
2234
- * because a query answered on the main copy then delays every other request
2235
- * waiting on that thread. A server created with `createServer` sets `none` on
2236
- * an engine that leaves this unset.
1837
+ * Turning sync on gives the index a new epoch. Changing a history limit while sync is on keeps the epoch. Turning
1838
+ * sync off deletes the published snapshot and the history, and the server closes every feed of the index with
1839
+ * close code 4410. The engine saves the setting with the index, so the setting stays in place after a restart, and
1840
+ * no snapshot of the index includes it.
1841
+ *
1842
+ * @param indexName - The index whose setting the engine replaces.
1843
+ * @param setting - The new setting.
1844
+ * @throws A `NarsilError` with `SYNC_DURABILITY_REQUIRED` when the engine has no write-ahead log durability, and
1845
+ * with `CONFIG_INVALID` when a history limit is not a positive whole number.
2237
1846
  */
2238
- mainCopyQueries?: MainCopyQueries;
1847
+ updateSync(indexName: string, setting: SyncSetting): Promise<void>;
2239
1848
  /**
2240
- * Each worker imports this module on start-up, which is how a worker reaches
2241
- * a custom tokeniser or language. Give an absolute path or a URL, such as
2242
- * `new URL('./bootstrap.js', import.meta.url).href`, because a worker
2243
- * resolves a relative specifier against Narsil's own directory. A relative
2244
- * value raises `CONFIG_INVALID`.
1849
+ * Returns the device sync state of an index.
1850
+ *
1851
+ * @param indexName - The index whose state the engine returns.
1852
+ * @returns The setting, whether a device has asked for the snapshot, and the epoch.
1853
+ * @throws A `NarsilError` with `INDEX_NOT_FOUND` when no index has that name.
2245
1854
  */
2246
- bootstrapModule?: string;
1855
+ getSync(indexName: string): Promise<SyncStatus>;
2247
1856
  }
2248
1857
 
2249
- export { type PartitionContext as $, type AnalysisConfig as A, type BatchResult as B, type ClientErrorCode as C, type DocumentImportResult as D, type ErrorCode as E, type FacetConfig as F, type GroupResult as G, type HeldCheckpointReport as H, type IndexInfo as I, type HighlightMatch as J, type Hit as K, type ListParams as L, type MemoryStats as M, NarsilError as N, type HybridConfig as O, type PartitionStatsResult as P, type QueryParams as Q, type IndexContext as R, type ServerErrorCode as S, type IndexLifecycleConfig as T, type InsertContext as U, type VectorMaintenanceResult as V, type ListedDocument as W, type MainCopyQueries as X, type MemoryConfig as Y, type NarsilEventHandlers as Z, type NarsilPlugin as _, ClientErrorCodes as a, type PresenceFilter as a0, type ProcessMemoryReport as a1, type QueryCoverage as a2, type RemoveContext as a3, type RerankConfig as a4, type ScoreComponents as a5, type SearchContext as a6, type SearchMode as a7, type SortField as a8, type SortSpec as a9, type StaleAnalysis as aa, type StringFilter as ab, type TermMatchPolicy as ac, type UpdateContext as ad, type VectorQueryConfig as ae, type WorkerConfig as af, type WorkerContext as ag, type WorkerCopyReport as ah, ErrorCodes as b, type NarsilErrorCode as c, ServerErrorCodes as d, type NarsilConfig as e, type ListResult as f, type SuggestParams as g, type SuggestResult as h, isNarsilError as i, type PreflightResult as j, type IndexStats as k, type NarsilEventMap as l, type QueryResult as m, type GroupConfig as n, type ArrayFilter as o, type ComparisonFilter as p, type DocumentProjection as q, type DurabilityConfig as r, type FacetResult as s, type FieldFilter as t, type FilterExpression as u, type GeoFilter as v, type GeoPolygonFilter as w, type GeoRadiusFilter as x, type GroupReducer as y, type HighlightConfig as z };
1858
+ export { type SortField as $, type ArrayFilter as A, type BatchResult as B, type ClientErrorCode as C, type DocumentImportResult as D, type ErrorCode as E, type FacetConfig as F, type GroupResult as G, type HeldCheckpointReport as H, type IndexInfo as I, type HighlightConfig as J, type HighlightMatch as K, type ListParams as L, type MemoryStats as M, NarsilError as N, type Hit as O, type PartitionStatsResult as P, type QueryParams as Q, type HybridConfig as R, type ServerErrorCode as S, type ListedDocument as T, type PresenceFilter as U, type VectorMaintenanceResult as V, type ProcessMemoryReport as W, type QueryCoverage as X, type RerankConfig as Y, type ScoreComponents as Z, type SearchMode as _, ClientErrorCodes as a, type SortSpec as a0, type StringFilter as a1, type TermMatchPolicy as a2, type VectorQueryConfig as a3, type WorkerCopyReport as a4, ErrorCodes as b, type NarsilErrorCode as c, ServerErrorCodes as d, type SyncSetting as e, type QueryResult as f, type NarsilEventHandlers as g, type GroupConfig as h, isNarsilError as i, type SuggestParams as j, type IndexStats as k, type ListResult as l, type PreflightResult as m, type SuggestResult as n, type SyncStatus as o, type NarsilEventMap as p, type SyncOperations as q, type ComparisonFilter as r, type DocumentProjection as s, type FacetResult as t, type FieldFilter as u, type FilterExpression as v, type GeoFilter as w, type GeoPolygonFilter as x, type GeoRadiusFilter as y, type GroupReducer as z };