@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.
- package/README.md +2 -1
- package/dist/adapters/filesystem.mjs +2 -2
- package/dist/adapters/gcs.mjs +2 -2
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +2 -2
- package/dist/{analysis-change-2OYM7ARW.mjs → analysis-change-4GCRVRBW.mjs} +27 -18
- package/dist/{react-native/chunks/analysis-change-entry-CXNRW324.mjs → analysis-change-entry-KYGSXW4K.mjs} +1 -1
- package/dist/browser/{analysis-change-2V2HZ2NY.mjs → analysis-change-IXWPXXJJ.mjs} +17 -7
- package/dist/{analysis-change-entry-QD7YNDEE.mjs → browser/analysis-change-entry-FCSHFQSS.mjs} +1 -1
- package/dist/browser/{chunk-TQ5UMFG5.mjs → chunk-2FX6ROWR.mjs} +15 -6
- package/dist/browser/{chunk-KWYQ6KX4.mjs → chunk-2SHAKW2Z.mjs} +119 -1922
- package/dist/browser/{chunk-55WYRLDZ.mjs → chunk-3U3QR5YP.mjs} +2 -2
- package/dist/browser/chunk-4PD752F6.mjs +85 -0
- package/dist/browser/chunk-5W3MMTLG.mjs +19 -0
- package/dist/browser/{chunk-IAXZAVYL.mjs → chunk-7MEYN7V6.mjs} +1 -151
- package/dist/browser/chunk-7TTWXUH6.mjs +1828 -0
- package/dist/browser/{chunk-CSCKZBVJ.mjs → chunk-AJ4HHOVT.mjs} +4 -4
- package/dist/{react-native/chunks/chunk-DFQJ4IJB.mjs → browser/chunk-AYY6PIKL.mjs} +2 -2
- package/dist/browser/{chunk-VD7JEUIR.mjs → chunk-C4KS2QNF.mjs} +9 -8
- package/dist/browser/chunk-DSXIBE6N.mjs +78 -0
- package/dist/browser/chunk-ELV4OZOI.mjs +29 -0
- package/dist/browser/{chunk-PM4MUM5N.mjs → chunk-EUNBNLKM.mjs} +6 -5
- package/dist/browser/{chunk-GJKXW3SF.mjs → chunk-G7LUMBSG.mjs} +137 -253
- package/dist/browser/{chunk-B3JM6Z74.mjs → chunk-H6QFBMVE.mjs} +3 -2
- package/dist/browser/chunk-J433A7P3.mjs +241 -0
- package/dist/browser/chunk-ML6HY7T7.mjs +96 -0
- package/dist/browser/chunk-ML7THVLJ.mjs +38 -0
- package/dist/{chunk-MDF6PDIA.mjs → browser/chunk-MYITLCHT.mjs} +7 -1
- package/dist/browser/{chunk-QJCO3TJU.mjs → chunk-QXTPSX2H.mjs} +9 -150
- package/dist/browser/{chunk-MPK76GVS.mjs → chunk-RA6LSBCM.mjs} +1 -21
- package/dist/browser/{chunk-7ZJTRUVW.mjs → chunk-SIR3LMTV.mjs} +2 -2
- package/dist/browser/{chunk-LURXVCHG.mjs → chunk-SJB6VIZG.mjs} +1 -1
- package/dist/browser/chunk-TTD27VXX.mjs +298 -0
- package/dist/browser/chunk-U2E3HMYW.mjs +151 -0
- package/dist/browser/{chunk-2A2IPRC3.mjs → chunk-VCOYGVP7.mjs} +5 -31
- package/dist/browser/chunk-VI7BQR4U.mjs +21 -0
- package/dist/browser/chunk-W5X2UFWQ.mjs +102 -0
- package/dist/browser/{chunk-HT7J73QL.mjs → chunk-XRV72TJD.mjs} +2 -2
- package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
- package/dist/browser/chunk-ZI2V4VD7.mjs +21 -0
- package/dist/{react-native/chunks/chunk-QC4ZRBSX.mjs → browser/chunk-ZPTA75ZC.mjs} +2 -79
- package/dist/browser/{cold-module-YECAK4MN.mjs → cold-module-VTUGDYNY.mjs} +20 -14
- package/dist/browser/{durability-wiring-LM7WFL6X.mjs → durability-wiring-GL4A7KDV.mjs} +1886 -1364
- package/dist/browser/import-YI5GNB4H.mjs +17 -0
- package/dist/browser/methods-LMUTS7OI.mjs +30 -0
- package/dist/browser/{module-XQLEOYNM.mjs → module-EC3FYW7N.mjs} +9 -8
- package/dist/browser/{module-KAMRAJLE.mjs → module-M4JNBV6V.mjs} +16 -10
- package/dist/browser/operations-WVYLF72Q.mjs +5 -0
- package/dist/browser/{phrase-module-CNKMUY4U.mjs → phrase-module-NPYUVX75.mjs} +1 -1
- package/dist/browser/{pool-DTYSPBMQ.mjs → pool-WCGDZHJP.mjs} +3 -2
- package/dist/{restore-queue-AOF5OTQV.mjs → browser/restore-queue-TYIGDL5L.mjs} +2 -2
- package/dist/browser/retention-6QMRS5VK.mjs +207 -0
- package/dist/browser/{runtime-D2ULZGCN.mjs → runtime-3EW2AGB6.mjs} +1 -1
- package/dist/browser/{snapshot-UGZVMP4H.mjs → snapshot-DN3CRVUQ.mjs} +38 -307
- package/dist/browser/sync-state-P5XG6LTQ.mjs +15 -0
- package/dist/browser/{write-I5P5MW4O.mjs → write-WAWAFGKQ.mjs} +16 -11
- package/dist/{capabilities-BT-HLDC8.d.ts → capabilities-B3Brs1Rc.d.ts} +62 -7
- package/dist/{chunk-DGRM4EZZ.mjs → chunk-37IVJLP6.mjs} +1 -1
- package/dist/{chunk-KYVRZAYP.mjs → chunk-3A5KI24C.mjs} +2 -69
- package/dist/{chunk-POUYICOU.mjs → chunk-3OFU3NJT.mjs} +1 -1
- package/dist/{chunk-3TVDTACC.mjs → chunk-3Y3J4V2R.mjs} +1 -1
- package/dist/{chunk-FNBNZCGP.mjs → chunk-466PYR4P.mjs} +2 -2
- package/dist/{chunk-SEAJS664.mjs → chunk-4HWZV5MK.mjs} +5 -5
- package/dist/{chunk-UGVUW27S.mjs → chunk-5FUOVJKG.mjs} +13 -9
- package/dist/{chunk-ZHAXP7SD.mjs → chunk-5KGYQT6W.mjs} +6 -235
- package/dist/{chunk-NPXVQS33.mjs → chunk-62G63NMH.mjs} +4 -3
- package/dist/chunk-6MSZ543Y.mjs +32 -0
- package/dist/chunk-7GXJUJ24.mjs +49 -0
- package/dist/{chunk-3E4RRF5J.mjs → chunk-7HCZWC7B.mjs} +58 -8
- package/dist/{chunk-6RKSY3BX.mjs → chunk-7NTMUDC5.mjs} +5 -5
- package/dist/chunk-7QUGDVFC.mjs +101 -0
- package/dist/{chunk-G5KHSM6E.mjs → chunk-AO2FAYIZ.mjs} +1 -1
- package/dist/chunk-B7S6YEBP.mjs +102 -0
- package/dist/{chunk-AWNHDBKV.mjs → chunk-BPSKLCS7.mjs} +15 -7
- package/dist/chunk-BUMREPLU.mjs +15 -0
- package/dist/{chunk-T4CJDBBE.mjs → chunk-C6ASEFZI.mjs} +1 -1
- package/dist/{chunk-NITCPDFL.mjs → chunk-C73JLU4E.mjs} +2 -2
- package/dist/{chunk-NYSONUB7.mjs → chunk-CP5RRPJR.mjs} +1 -1
- package/dist/{chunk-TTCKT2RT.mjs → chunk-DMQPFLGI.mjs} +134 -11
- package/dist/{chunk-3SBJVQLL.mjs → chunk-DVWYODEB.mjs} +2 -2
- package/dist/chunk-ECX4SGX6.mjs +167 -0
- package/dist/chunk-GES7U2PM.mjs +68 -0
- package/dist/{chunk-NVTFQFUL.mjs → chunk-HVKXNBFL.mjs} +1 -1
- package/dist/chunk-HVYICDY3.mjs +214 -0
- package/dist/{chunk-3HV7M5OJ.mjs → chunk-HWEDFLB7.mjs} +9 -133
- package/dist/{chunk-52QQWEBS.mjs → chunk-IBNLW3AV.mjs} +21 -6
- package/dist/chunk-IJU7LL7D.mjs +242 -0
- package/dist/chunk-IPN7S4KX.mjs +130 -0
- package/dist/{chunk-5QMHMELB.mjs → chunk-IQ4R2I6N.mjs} +4 -1
- package/dist/chunk-JCLTESFN.mjs +96 -0
- package/dist/{chunk-J4BDAH2W.mjs → chunk-JFNKIBDT.mjs} +2 -2
- package/dist/{chunk-LDGGR7YT.mjs → chunk-K4B7OH65.mjs} +2 -2
- package/dist/{chunk-7TE2AJIH.mjs → chunk-K7KLL263.mjs} +13 -10
- package/dist/{chunk-CSHHU7PA.mjs → chunk-KCUIFVVW.mjs} +11 -30
- package/dist/{react-native/chunks/chunk-YH7W556M.mjs → chunk-KUZKUONM.mjs} +11 -2
- package/dist/chunk-KYYABCSW.mjs +72 -0
- package/dist/{chunk-B2FTZNNF.mjs → chunk-LKUE5GXS.mjs} +34 -14
- package/dist/{chunk-2PNYKG2D.mjs → chunk-LSM2YTKM.mjs} +100 -335
- package/dist/{chunk-DMNPYF54.mjs → chunk-LTUGDMV4.mjs} +2 -2
- package/dist/{chunk-FDG4KXX5.mjs → chunk-MLHNSAPK.mjs} +5 -3
- package/dist/{chunk-VP6XRMWR.mjs → chunk-MMBEANB2.mjs} +6 -32
- package/dist/{chunk-LJ4ENXOD.mjs → chunk-MMEMEUOO.mjs} +2 -2
- package/dist/{chunk-2HJWQPR6.mjs → chunk-NTZOXVUZ.mjs} +6 -122
- package/dist/{chunk-5WB2A3XU.mjs → chunk-NZMAXR2S.mjs} +397 -24
- package/dist/{chunk-IZT3G24Q.mjs → chunk-O43Z4MS6.mjs} +2 -2
- package/dist/{chunk-U46IZNCW.mjs → chunk-OKX2BBNW.mjs} +3 -2
- package/dist/{chunk-RBEHLIKX.mjs → chunk-PFKM7VNZ.mjs} +14 -8
- package/dist/chunk-PGVPE7GJ.mjs +96 -0
- package/dist/chunk-Q3TCTQCC.mjs +85 -0
- package/dist/chunk-Q7MS6P2J.mjs +74 -0
- package/dist/chunk-QDZJM7NI.mjs +23 -0
- package/dist/{chunk-ZS6CMXAE.mjs → chunk-QKZHLADX.mjs} +89 -250
- package/dist/{chunk-IJSFWGVW.mjs → chunk-REL7LFLR.mjs} +3 -3
- package/dist/chunk-RVKFI3A2.mjs +237 -0
- package/dist/chunk-S2N75OTN.mjs +83 -0
- package/dist/chunk-TRISKD4Q.mjs +50 -0
- package/dist/{chunk-6F6USYII.mjs → chunk-TV2L3BN7.mjs} +13 -11
- package/dist/{chunk-6BWLDLS3.mjs → chunk-URPCYQVJ.mjs} +1 -1
- package/dist/chunk-USR7FQRZ.mjs +34 -0
- package/dist/chunk-V6EUBAIT.mjs +19 -0
- package/dist/{chunk-SOUZMPME.mjs → chunk-VMXSVVXG.mjs} +7 -194
- package/dist/{chunk-4QCSHLNM.mjs → chunk-VREK3MYG.mjs} +3 -3
- package/dist/{chunk-YGQOPB2Z.mjs → chunk-WCBA2LVZ.mjs} +1 -1
- package/dist/{chunk-KQJVNPRM.mjs → chunk-X6NSJYQ3.mjs} +19 -16
- package/dist/chunk-Y4WPNHMC.mjs +50 -0
- package/dist/{chunk-IRWP524D.mjs → chunk-YBJDOA2T.mjs} +1 -1
- package/dist/{chunk-IJPK5PGM.mjs → chunk-YPUEV6ZC.mjs} +1 -1
- package/dist/{chunk-J7M73VY7.mjs → chunk-YROWNOMH.mjs} +1 -1
- package/dist/chunk-Z3TNWCI5.mjs +196 -0
- package/dist/{chunk-65WCV5JO.mjs → chunk-ZIFJXCKA.mjs} +1 -1
- package/dist/chunk-ZYAY26KG.mjs +29 -0
- package/dist/{client-Cn3gNxUU.d.ts → client-Df76GNKm.d.ts} +76 -6
- package/dist/client.d.ts +8 -7
- package/dist/client.mjs +56 -5
- package/dist/{cold-module-PYSSBIL7.mjs → cold-module-YLWMTTZG.mjs} +38 -28
- package/dist/{config-CfhH1IWQ.d.ts → config-05G_hy-1.d.ts} +3 -3
- package/dist/config-B8DP2VwR.d.ts +463 -0
- package/dist/{direct-executor-WYALQSMD.mjs → direct-executor-FI5GJHWX.mjs} +14 -9
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +4 -4
- package/dist/distribution/transport/in-memory.mjs +2 -2
- package/dist/distribution/transport/tcp.mjs +3 -3
- package/dist/distribution.d.ts +41 -9
- package/dist/distribution.mjs +1296 -117
- package/dist/{durability-wiring-7VBZEJLG.mjs → durability-wiring-RHLXDIVF.mjs} +1751 -1226
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-CJRUHXgf.d.ts → engine-DYu-e0oR.d.ts} +50 -40
- package/dist/{import-GJOMB2HC.mjs → import-SRBNC6TE.mjs} +27 -19
- package/dist/{index-MsF7e5hL.d.ts → index-nRqDM6uS.d.ts} +1 -1
- package/dist/index.browser.mjs +8 -4
- package/dist/index.d.ts +7 -6
- package/dist/index.mjs +24 -16
- package/dist/index.react-native.mjs +17 -11
- package/dist/{long-query-thread-SCUE62TO.mjs → long-query-thread-EMYTGSJP.mjs} +28 -15
- package/dist/methods-ABM5ELBR.mjs +30 -0
- package/dist/{module-AVQEIB7O.mjs → module-3OMJZUFT.mjs} +12 -12
- package/dist/{module-6RLIKSZQ.mjs → module-MG7JMV2U.mjs} +33 -23
- package/dist/operations-PGOAY2KS.mjs +5 -0
- package/dist/{paged-partition-archive-KGRW366Y.mjs → paged-partition-archive-UOLHOEZJ.mjs} +37 -26
- package/dist/partial-words.mjs +6 -4
- package/dist/pattern.mjs +4 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +9 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +34 -23
- package/dist/{phrase-module-OUQIRUQU.mjs → phrase-module-O3MDRQXP.mjs} +1 -1
- package/dist/{pool-UPV5PVPY.mjs → pool-CQXYPFLG.mjs} +2 -2
- package/dist/react-native/chunks/{analysis-change-DXPZRGWF.mjs → analysis-change-EAYO3Y6Q.mjs} +27 -15
- package/dist/{browser/analysis-change-entry-JL5U2N3Q.mjs → react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-D7LFYPYI.mjs → chunk-2CGSQM4O.mjs} +12 -10
- package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +1 -0
- package/dist/react-native/chunks/{chunk-R4OPUZQ5.mjs → chunk-3O57C2ZO.mjs} +2 -2
- package/dist/react-native/chunks/chunk-3XKMRNRE.mjs +298 -0
- package/dist/react-native/chunks/{chunk-IDFMNRIC.mjs → chunk-63YSZOXB.mjs} +97 -333
- package/dist/react-native/chunks/{chunk-UFNCLEQM.mjs → chunk-75VWIY35.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-2J2727V4.mjs → chunk-7GWPJDOA.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-PU55IOG4.mjs → chunk-AUT7PMA4.mjs} +6 -190
- package/dist/react-native/chunks/chunk-C2H2QQFW.mjs +288 -0
- package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +43 -0
- package/dist/{browser/chunk-PIS7ZAP7.mjs → react-native/chunks/chunk-CUNGPR5R.mjs} +11 -2
- package/dist/{browser/chunk-NVEJJP4R.mjs → react-native/chunks/chunk-DCKMICOB.mjs} +2 -79
- package/dist/react-native/chunks/chunk-DH3TVWWK.mjs +102 -0
- package/dist/react-native/chunks/{chunk-ZCKNBPQ4.mjs → chunk-EH5CFV6Z.mjs} +2 -2
- package/dist/react-native/chunks/chunk-F753DA54.mjs +23 -0
- package/dist/{browser/chunk-VBX2TI5V.mjs → react-native/chunks/chunk-GFYFQLJD.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-7IQR3SZO.mjs → chunk-I5PGWQJF.mjs} +142 -257
- package/dist/react-native/chunks/{chunk-NFGBOI46.mjs → chunk-IOY2SM2P.mjs} +1 -1
- package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +38 -0
- package/dist/react-native/chunks/{chunk-TLYD7IJ2.mjs → chunk-JPAJWO6D.mjs} +1 -1
- package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +15 -0
- package/dist/react-native/chunks/{chunk-KLZGAOLT.mjs → chunk-JX2RIAXH.mjs} +4 -4
- package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +68 -0
- package/dist/react-native/chunks/{chunk-LQAKO5QV.mjs → chunk-NCJS3WIY.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-BRNAVOKP.mjs → chunk-NKIZX26F.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-CLE3LZ77.mjs → chunk-NP7DD4G5.mjs} +5 -4
- package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +78 -0
- package/dist/react-native/chunks/chunk-O32RB3BL.mjs +191 -0
- package/dist/react-native/chunks/{chunk-DKJTZ625.mjs → chunk-OQQVRWZ2.mjs} +2 -69
- package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +29 -0
- package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
- package/dist/react-native/chunks/{chunk-LRGWK367.mjs → chunk-RVAEBN74.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-KOCTCUXW.mjs → chunk-RYMDHGL4.mjs} +16 -8
- package/dist/react-native/chunks/chunk-SJWDBRNP.mjs +85 -0
- package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +68 -0
- package/dist/react-native/chunks/chunk-UWDNZDWK.mjs +242 -0
- package/dist/react-native/chunks/{chunk-FS7BYE23.mjs → chunk-VQSKZ3EZ.mjs} +9 -152
- package/dist/react-native/chunks/{chunk-UCJU6WNH.mjs → chunk-VVFYOADG.mjs} +7 -6
- package/dist/react-native/chunks/{chunk-VGUWIZFQ.mjs → chunk-YBEW6YTR.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-JYL35A4A.mjs → chunk-YHKZSLOC.mjs} +7 -33
- package/dist/react-native/chunks/{chunk-3CTWSQRW.mjs → chunk-ZBSWRSBG.mjs} +4 -30
- package/dist/react-native/chunks/chunk-ZYDKJXQJ.mjs +96 -0
- package/dist/react-native/chunks/{cold-module-KFGEWYEL.mjs → cold-module-TJL6AFAD.mjs} +29 -21
- package/dist/react-native/chunks/{durability-wiring-QKJB2QBT.mjs → durability-wiring-RRDYJLLM.mjs} +1882 -1358
- package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +3 -0
- package/dist/react-native/chunks/import-JYBMEJPQ.mjs +29 -0
- package/dist/react-native/chunks/methods-X6F36SJE.mjs +30 -0
- package/dist/react-native/chunks/module-QT5HZAY4.mjs +33 -0
- package/dist/react-native/chunks/{module-UJ5VUARS.mjs → module-S4DKSWMF.mjs} +10 -9
- package/dist/react-native/chunks/operations-RYKTSZQA.mjs +5 -0
- package/dist/react-native/chunks/{phrase-module-76UAPPSG.mjs → phrase-module-JZ37TB7N.mjs} +1 -1
- package/dist/react-native/chunks/{pool-CD4ANYUI.mjs → pool-RTGXJXPU.mjs} +3 -2
- package/dist/{browser/restore-queue-UQ6AAUVX.mjs → react-native/chunks/restore-queue-ZBVIKJWI.mjs} +2 -2
- package/dist/react-native/chunks/retention-PPCTP2VY.mjs +219 -0
- package/dist/react-native/chunks/{runtime-3MCDLJAF.mjs → runtime-KUATOLYB.mjs} +1 -1
- package/dist/react-native/chunks/{snapshot-KVBD4LRC.mjs → snapshot-ZBIEOZTZ.mjs} +47 -314
- package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +15 -0
- package/dist/react-native/chunks/{write-ES5A3WUA.mjs → write-2W4FTX7J.mjs} +25 -18
- package/dist/react-native/partial-words.mjs +6 -4
- package/dist/react-native/pattern.mjs +4 -3
- package/dist/react-native/sync.mjs +2236 -0
- package/dist/react-native/synonyms.mjs +7 -4
- package/dist/react.d.ts +10 -9
- package/dist/react.mjs +7 -1
- package/dist/{rerank-3W54N6P2.mjs → rerank-IZOB6NII.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{react-native/chunks/restore-queue-H5VCN453.mjs → restore-queue-COI2GSSK.mjs} +2 -2
- package/dist/retention-55WA7GPU.mjs +58 -0
- package/dist/{runtime-L2DZYY6N.mjs → runtime-UZOC3NPY.mjs} +5 -5
- package/dist/{schema-D33CyXCy.d.ts → schema-DDauvDOv.d.ts} +1 -1
- package/dist/server.d.ts +22 -19
- package/dist/server.mjs +868 -50
- package/dist/{snapshot-WMX6JCLP.mjs → snapshot-NFX2EYN2.mjs} +62 -36
- package/dist/sync/filesystem.d.ts +30 -0
- package/dist/sync/filesystem.mjs +271 -0
- package/dist/sync/indexeddb.d.ts +30 -0
- package/dist/sync/indexeddb.mjs +237 -0
- package/dist/sync-state-ZWHLAFLE.mjs +15 -0
- package/dist/{config-aIsy7mcL.d.ts → sync-uXR7MmM7.d.ts} +53 -444
- package/dist/sync.browser.mjs +2231 -0
- package/dist/sync.d.ts +23 -0
- package/dist/sync.mjs +2206 -0
- package/dist/synonyms.mjs +5 -3
- package/dist/{tasks-C4ElXr4P.d.ts → tasks-BShx8pdK.d.ts} +4 -4
- package/dist/thread-P2G2FWM2.mjs +44 -0
- package/dist/types-SnO7_tAI.d.ts +228 -0
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +6 -6
- package/dist/workers/entry.mjs +7 -7
- package/dist/{write-SKJ6HW7O.mjs → write-FGB62BHQ.mjs} +31 -23
- package/openapi.json +119 -3
- package/package.json +28 -8
- package/dist/browser/import-QOY6ZH6X.mjs +0 -12
- package/dist/chunk-7LDMWKP6.mjs +0 -209
- package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +0 -110
- package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +0 -3
- package/dist/react-native/chunks/import-XFBCCENV.mjs +0 -22
- package/dist/react-native/chunks/module-FHJ2GOBI.mjs +0 -25
- package/dist/thread-I7DVHHW7.mjs +0 -31
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { encodeJson, SYNC_CLOSE_SERVER_ERROR, SYNC_SUBPROTOCOL } from './chunk-KYYABCSW.mjs';
|
|
2
|
+
import { answerRefusalOf } from './chunk-K4B7OH65.mjs';
|
|
3
|
+
import { archiveRange } from './chunk-Q7MS6P2J.mjs';
|
|
2
4
|
import { nativeSearchCoreIsEnabled } from './chunk-DJHHF2L5.mjs';
|
|
3
|
-
import { readRecentMemoryFigures, readMemoryFigures } from './chunk-
|
|
5
|
+
import { readRecentMemoryFigures, readMemoryFigures } from './chunk-TV2L3BN7.mjs';
|
|
4
6
|
import { DEFAULT_RERANK_WINDOW } from './chunk-HJSN7UYG.mjs';
|
|
5
7
|
import { collectGarbageBeforeRefusal, collectYoungGenerationBeforeRefusal, reportRefusalAfterCollection, reservedHeapBytes, admitHeapBytes } from './chunk-XIHUI4KB.mjs';
|
|
6
8
|
import { ANALYSIS_CHANGE_MEMBERS } from './chunk-EEBCDP36.mjs';
|
|
7
9
|
import { HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE } from './chunk-ZXNQEW43.mjs';
|
|
8
|
-
import { loadNativeCore } from './chunk-
|
|
9
|
-
import { MAX_FILTER_DEPTH } from './chunk-
|
|
10
|
+
import { loadNativeCore } from './chunk-HVKXNBFL.mjs';
|
|
11
|
+
import { MAX_FILTER_DEPTH } from './chunk-OKX2BBNW.mjs';
|
|
10
12
|
import { MAX_SORT_FIELDS } from './chunk-FQBFZAWG.mjs';
|
|
11
|
-
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-
|
|
13
|
+
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
12
14
|
import { randomUUID } from 'crypto';
|
|
13
15
|
import { mkdtemp, open, rm } from 'fs/promises';
|
|
14
16
|
import { tmpdir } from 'os';
|
|
@@ -228,6 +230,11 @@ var STATUS_BY_CODE = {
|
|
|
228
230
|
BACKUP_STORE_CLAIMED: 409,
|
|
229
231
|
BACKUP_STORE_NOT_CONFIGURED: 501,
|
|
230
232
|
BACKUP_NOT_READY: 503,
|
|
233
|
+
SYNC_DURABILITY_REQUIRED: 409,
|
|
234
|
+
SYNC_BACKUP_STORE_REQUIRED: 409,
|
|
235
|
+
SYNC_NOT_READY: 503,
|
|
236
|
+
SYNC_NOT_ENABLED: 404,
|
|
237
|
+
SYNC_SNAPSHOT_PREPARING: 503,
|
|
231
238
|
EMBEDDING_FAILED: 503,
|
|
232
239
|
RERANK_FAILED: 503,
|
|
233
240
|
QUERY_ROUTING_FAILED: 503,
|
|
@@ -500,23 +507,13 @@ function bodyRefusalOf(bodyBytes, kind) {
|
|
|
500
507
|
return refusal(429, bodyBytes, leastParseBytes, settled, collectedGarbage, line);
|
|
501
508
|
}
|
|
502
509
|
|
|
503
|
-
// src/json-encoding.ts
|
|
504
|
-
function toPlainNumbers(key, value) {
|
|
505
|
-
if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {
|
|
506
|
-
return Array.from(value);
|
|
507
|
-
}
|
|
508
|
-
return value;
|
|
509
|
-
}
|
|
510
|
-
function encodeJson(value) {
|
|
511
|
-
return JSON.stringify(value, toPlainNumbers);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
510
|
// src/server/response.ts
|
|
515
511
|
var STATUS_TEXT = {
|
|
516
512
|
200: "200 OK",
|
|
517
513
|
201: "201 Created",
|
|
518
514
|
202: "202 Accepted",
|
|
519
515
|
204: "204 No Content",
|
|
516
|
+
206: "206 Partial Content",
|
|
520
517
|
400: "400 Bad Request",
|
|
521
518
|
401: "401 Unauthorized",
|
|
522
519
|
403: "403 Forbidden",
|
|
@@ -525,6 +522,7 @@ var STATUS_TEXT = {
|
|
|
525
522
|
409: "409 Conflict",
|
|
526
523
|
413: "413 Payload Too Large",
|
|
527
524
|
415: "415 Unsupported Media Type",
|
|
525
|
+
416: "416 Range Not Satisfiable",
|
|
528
526
|
429: "429 Too Many Requests",
|
|
529
527
|
500: "500 Internal Server Error",
|
|
530
528
|
503: "503 Service Unavailable"
|
|
@@ -560,11 +558,13 @@ function sendEncodedJson(res, payload, status = 200, abort) {
|
|
|
560
558
|
res.writeStatus(statusLine(status)).writeHeader("Content-Type", "application/json").end(payload);
|
|
561
559
|
});
|
|
562
560
|
}
|
|
563
|
-
function sendError(res, status, code, message, details) {
|
|
561
|
+
function sendError(res, status, code, message, details, headers = []) {
|
|
564
562
|
const body = { error: details ? { code, message, details } : { code, message } };
|
|
565
563
|
const payload = encodeJson(body);
|
|
566
564
|
res.cork(() => {
|
|
567
|
-
res.writeStatus(statusLine(status)).writeHeader("Content-Type", "application/json")
|
|
565
|
+
res.writeStatus(statusLine(status)).writeHeader("Content-Type", "application/json");
|
|
566
|
+
for (const [name, value] of headers) res.writeHeader(name, value);
|
|
567
|
+
res.end(payload);
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
570
|
function sendText(res, text, contentType, abort) {
|
|
@@ -633,6 +633,68 @@ function sendRelayed(res, abort, status, headers, body) {
|
|
|
633
633
|
res.end(body);
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
|
+
function writeSizedChunk(res, abort, wait, chunk, totalSize, begin) {
|
|
637
|
+
let startOffset = 0;
|
|
638
|
+
let written = true;
|
|
639
|
+
res.cork(() => {
|
|
640
|
+
begin();
|
|
641
|
+
startOffset = res.getWriteOffset();
|
|
642
|
+
written = res.tryEnd(chunk, totalSize)[0];
|
|
643
|
+
});
|
|
644
|
+
if (written || abort.aborted) return Promise.resolve();
|
|
645
|
+
return new Promise((resolve) => {
|
|
646
|
+
wait.wake = () => {
|
|
647
|
+
wait.wake = null;
|
|
648
|
+
resolve();
|
|
649
|
+
};
|
|
650
|
+
res.onWritable((offset) => {
|
|
651
|
+
if (abort.aborted) {
|
|
652
|
+
wait.wake?.();
|
|
653
|
+
return true;
|
|
654
|
+
}
|
|
655
|
+
const [retried] = res.tryEnd(chunk.subarray(offset - startOffset), totalSize);
|
|
656
|
+
if (retried) wait.wake?.();
|
|
657
|
+
return retried;
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
async function sendSizedStream(res, abort, status, headers, totalSize, chunks) {
|
|
662
|
+
let started = false;
|
|
663
|
+
const begin = () => {
|
|
664
|
+
if (started) return;
|
|
665
|
+
started = true;
|
|
666
|
+
res.writeStatus(statusLine(status));
|
|
667
|
+
for (const [key, value] of headers) res.writeHeader(key, value);
|
|
668
|
+
};
|
|
669
|
+
const wait = { wake: null };
|
|
670
|
+
abort.onAbort(() => wait.wake?.());
|
|
671
|
+
let sent = 0;
|
|
672
|
+
try {
|
|
673
|
+
for await (const chunk of chunks) {
|
|
674
|
+
if (abort.aborted) return;
|
|
675
|
+
const bounded = chunk.subarray(0, Math.max(0, totalSize - sent));
|
|
676
|
+
if (bounded.byteLength === 0) continue;
|
|
677
|
+
await writeSizedChunk(res, abort, wait, bounded, totalSize, begin);
|
|
678
|
+
sent += bounded.byteLength;
|
|
679
|
+
}
|
|
680
|
+
} catch (err) {
|
|
681
|
+
if (abort.aborted) return;
|
|
682
|
+
if (!started) throw err;
|
|
683
|
+
res.cork(() => {
|
|
684
|
+
res.close();
|
|
685
|
+
});
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
if (abort.aborted || sent === totalSize && started) return;
|
|
689
|
+
res.cork(() => {
|
|
690
|
+
if (totalSize > 0) {
|
|
691
|
+
res.close();
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
begin();
|
|
695
|
+
res.end();
|
|
696
|
+
});
|
|
697
|
+
}
|
|
636
698
|
|
|
637
699
|
// src/server/handler-utils.ts
|
|
638
700
|
function refusesParse(ctx, raw, kind) {
|
|
@@ -1409,6 +1471,16 @@ function decodePathParameter(raw) {
|
|
|
1409
1471
|
return null;
|
|
1410
1472
|
}
|
|
1411
1473
|
}
|
|
1474
|
+
var NO_HEADERS = Object.freeze({});
|
|
1475
|
+
function capturedHeaders(req, names) {
|
|
1476
|
+
if (names === void 0 || names.length === 0) return NO_HEADERS;
|
|
1477
|
+
const headers = {};
|
|
1478
|
+
for (const name of names) {
|
|
1479
|
+
const value = req.getHeader(name);
|
|
1480
|
+
if (value !== "") headers[name] = value;
|
|
1481
|
+
}
|
|
1482
|
+
return headers;
|
|
1483
|
+
}
|
|
1412
1484
|
function sinkWritingAfterStatus(res, headers) {
|
|
1413
1485
|
if (headers.length === 0) return res;
|
|
1414
1486
|
const sink = {
|
|
@@ -1473,12 +1545,19 @@ function sinkWritingAfterStatus(res, headers) {
|
|
|
1473
1545
|
function isDenial(value) {
|
|
1474
1546
|
return typeof value === "object" && value !== null && "status" in value;
|
|
1475
1547
|
}
|
|
1548
|
+
function expiryOf(value) {
|
|
1549
|
+
if (typeof value !== "object" || value === null || !("expiresAt" in value)) return null;
|
|
1550
|
+
const { expiresAt } = value;
|
|
1551
|
+
return typeof expiresAt === "number" && Number.isFinite(expiresAt) ? expiresAt : void 0;
|
|
1552
|
+
}
|
|
1476
1553
|
function authorizerFor(hook) {
|
|
1477
1554
|
return async (context) => {
|
|
1478
1555
|
try {
|
|
1479
1556
|
const result = await hook(context);
|
|
1480
1557
|
if (isDenial(result)) return { allowed: false, denial: result };
|
|
1481
|
-
|
|
1558
|
+
const expiresAt = expiryOf(result);
|
|
1559
|
+
if (expiresAt === void 0) return { allowed: false, denial: null };
|
|
1560
|
+
return { allowed: true, expiresAt };
|
|
1482
1561
|
} catch {
|
|
1483
1562
|
return { allowed: false, denial: null };
|
|
1484
1563
|
}
|
|
@@ -1513,6 +1592,7 @@ function createRouteRunner(deps) {
|
|
|
1513
1592
|
}
|
|
1514
1593
|
const query = new URLSearchParams(req.getQuery() ?? "");
|
|
1515
1594
|
const contentType = req.getHeader("content-type");
|
|
1595
|
+
const requestHeaders = capturedHeaders(req, opts.headers);
|
|
1516
1596
|
const declaredBytes = needsBody ? declaredBodyBytes(req.getHeader("content-length")) : null;
|
|
1517
1597
|
let hookContext = null;
|
|
1518
1598
|
if (useHook) {
|
|
@@ -1546,7 +1626,7 @@ function createRouteRunner(deps) {
|
|
|
1546
1626
|
bodyRefusal = err.refusal;
|
|
1547
1627
|
return null;
|
|
1548
1628
|
}) : Promise.resolve(null);
|
|
1549
|
-
const hookPromise = hookContext !== null && authorize !== void 0 ? authorize(hookContext) : Promise.resolve({ allowed: true });
|
|
1629
|
+
const hookPromise = hookContext !== null && authorize !== void 0 ? authorize(hookContext) : Promise.resolve({ allowed: true, expiresAt: null });
|
|
1550
1630
|
const spoolPromise = opts.spoolsBody === true ? spoolBody(
|
|
1551
1631
|
res,
|
|
1552
1632
|
opts.maxBytes,
|
|
@@ -1573,7 +1653,18 @@ function createRouteRunner(deps) {
|
|
|
1573
1653
|
return;
|
|
1574
1654
|
}
|
|
1575
1655
|
try {
|
|
1576
|
-
await handler({
|
|
1656
|
+
await handler({
|
|
1657
|
+
res,
|
|
1658
|
+
params,
|
|
1659
|
+
query,
|
|
1660
|
+
contentType,
|
|
1661
|
+
rawBody,
|
|
1662
|
+
bodyRefusal,
|
|
1663
|
+
spooledBody,
|
|
1664
|
+
abort,
|
|
1665
|
+
hookContext,
|
|
1666
|
+
requestHeaders
|
|
1667
|
+
});
|
|
1577
1668
|
} catch (err) {
|
|
1578
1669
|
if (!abort.aborted) {
|
|
1579
1670
|
sendError(res, 500, ServerErrorCodes.INTERNAL_ERROR, "An unexpected error occurred");
|
|
@@ -2365,6 +2456,131 @@ function sharedRouteOptions(limits) {
|
|
|
2365
2456
|
};
|
|
2366
2457
|
}
|
|
2367
2458
|
|
|
2459
|
+
// src/server/sync/range.ts
|
|
2460
|
+
var WHOLE = { kind: "whole" };
|
|
2461
|
+
var UNSATISFIABLE = { kind: "unsatisfiable" };
|
|
2462
|
+
var SINGLE_BYTE_RANGE = /^bytes=(\d{0,20})-(\d{0,20})$/;
|
|
2463
|
+
function ifRangeMatches(ifRange, entityTag) {
|
|
2464
|
+
return ifRange === void 0 || ifRange.trim() === `"${entityTag}"`;
|
|
2465
|
+
}
|
|
2466
|
+
function rangeOf(range, ifRange, entityTag, length) {
|
|
2467
|
+
if (range === void 0 || !ifRangeMatches(ifRange, entityTag)) return WHOLE;
|
|
2468
|
+
const match = SINGLE_BYTE_RANGE.exec(range.trim());
|
|
2469
|
+
if (match === null) return WHOLE;
|
|
2470
|
+
const [, first, last] = match;
|
|
2471
|
+
if (first === "" && last === "") return WHOLE;
|
|
2472
|
+
if (first === "") {
|
|
2473
|
+
const suffix = Number(last);
|
|
2474
|
+
if (suffix === 0 || length === 0) return UNSATISFIABLE;
|
|
2475
|
+
return { kind: "partial", start: Math.max(0, length - suffix), endExclusive: length };
|
|
2476
|
+
}
|
|
2477
|
+
const start = Number(first);
|
|
2478
|
+
if (last !== "" && Number(last) < start) return WHOLE;
|
|
2479
|
+
if (start >= length) return UNSATISFIABLE;
|
|
2480
|
+
const endExclusive = last === "" ? length : Math.min(length, Number(last) + 1);
|
|
2481
|
+
return { kind: "partial", start, endExclusive };
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
// src/server/sync/snapshot-handler.ts
|
|
2485
|
+
var SYNC_SNAPSHOT_REQUEST_HEADERS = ["range", "if-range"];
|
|
2486
|
+
function refuseRange(ctx, length, entityTag) {
|
|
2487
|
+
ctx.res.cork(() => {
|
|
2488
|
+
ctx.res.writeStatus(statusLine(416)).writeHeader("Content-Range", `bytes */${length}`).writeHeader("ETag", `"${entityTag}"`).writeHeader("Cache-Control", "no-store").end();
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
function retryAfterSecondsOf(err) {
|
|
2492
|
+
if (!(err instanceof NarsilError) || err.code !== ErrorCodes.SYNC_SNAPSHOT_PREPARING) return null;
|
|
2493
|
+
const retryAfterMs = err.details?.retryAfterMs;
|
|
2494
|
+
return typeof retryAfterMs === "number" && retryAfterMs > 0 ? Math.ceil(retryAfterMs / 1e3) : 1;
|
|
2495
|
+
}
|
|
2496
|
+
function refuseSnapshot(ctx, err) {
|
|
2497
|
+
const retryAfterSeconds = retryAfterSecondsOf(err);
|
|
2498
|
+
if (retryAfterSeconds === null || ctx.abort.aborted) {
|
|
2499
|
+
respondError(ctx, err);
|
|
2500
|
+
return;
|
|
2501
|
+
}
|
|
2502
|
+
const { status, body } = toHttpError(err);
|
|
2503
|
+
sendError(ctx.res, status, body.code, body.message, body.details, [["Retry-After", String(retryAfterSeconds)]]);
|
|
2504
|
+
}
|
|
2505
|
+
function createSyncSnapshotHandler(serving) {
|
|
2506
|
+
return async (ctx) => {
|
|
2507
|
+
const sync = serving();
|
|
2508
|
+
if (sync === null) {
|
|
2509
|
+
sendError(ctx.res, 404, ServerErrorCodes.NOT_FOUND, "Route not found");
|
|
2510
|
+
return;
|
|
2511
|
+
}
|
|
2512
|
+
let download;
|
|
2513
|
+
try {
|
|
2514
|
+
download = await sync.snapshot(ctx.params[0]);
|
|
2515
|
+
} catch (err) {
|
|
2516
|
+
refuseSnapshot(ctx, err);
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2519
|
+
try {
|
|
2520
|
+
if (ctx.abort.aborted) return;
|
|
2521
|
+
const { layout, entityTag } = download;
|
|
2522
|
+
const length = layout.byteLength;
|
|
2523
|
+
const answer = rangeOf(ctx.requestHeaders.range, ctx.requestHeaders["if-range"], entityTag, length);
|
|
2524
|
+
if (answer.kind === "unsatisfiable") {
|
|
2525
|
+
refuseRange(ctx, length, entityTag);
|
|
2526
|
+
return;
|
|
2527
|
+
}
|
|
2528
|
+
const start = answer.kind === "partial" ? answer.start : 0;
|
|
2529
|
+
const endExclusive = answer.kind === "partial" ? answer.endExclusive : length;
|
|
2530
|
+
const headers = [
|
|
2531
|
+
["Content-Type", SNAPSHOT_ARCHIVE_CONTENT_TYPE],
|
|
2532
|
+
["ETag", `"${entityTag}"`],
|
|
2533
|
+
["Accept-Ranges", "bytes"],
|
|
2534
|
+
["Cache-Control", "no-store"]
|
|
2535
|
+
];
|
|
2536
|
+
if (answer.kind === "partial") headers.push(["Content-Range", `bytes ${start}-${endExclusive - 1}/${length}`]);
|
|
2537
|
+
await sendSizedStream(
|
|
2538
|
+
ctx.res,
|
|
2539
|
+
ctx.abort,
|
|
2540
|
+
answer.kind === "partial" ? 206 : 200,
|
|
2541
|
+
headers,
|
|
2542
|
+
endExclusive - start,
|
|
2543
|
+
archiveRange(layout, start, endExclusive)
|
|
2544
|
+
);
|
|
2545
|
+
} catch (err) {
|
|
2546
|
+
respondError(ctx, err);
|
|
2547
|
+
} finally {
|
|
2548
|
+
download.release();
|
|
2549
|
+
}
|
|
2550
|
+
};
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
// src/server/routes/sync.ts
|
|
2554
|
+
function syncRoutes(shared) {
|
|
2555
|
+
return [
|
|
2556
|
+
{
|
|
2557
|
+
method: "put",
|
|
2558
|
+
path: "/indexes/:name/sync",
|
|
2559
|
+
handler: "updateSync",
|
|
2560
|
+
options: shared.namedBody,
|
|
2561
|
+
operationId: "updateSync",
|
|
2562
|
+
summary: "Replace the device sync setting of an index",
|
|
2563
|
+
tags: ["Sync"],
|
|
2564
|
+
request: "SyncSetting",
|
|
2565
|
+
responses: { 200: "OkResponse" }
|
|
2566
|
+
},
|
|
2567
|
+
{
|
|
2568
|
+
method: "get",
|
|
2569
|
+
path: "/indexes/:name/sync/snapshot",
|
|
2570
|
+
handler: "syncSnapshot",
|
|
2571
|
+
options: { ...shared.named, headers: SYNC_SNAPSHOT_REQUEST_HEADERS },
|
|
2572
|
+
operationId: "syncSnapshot",
|
|
2573
|
+
summary: "Download the published snapshot of an index with device sync on, whole or as one byte range",
|
|
2574
|
+
tags: ["Sync"],
|
|
2575
|
+
request: null,
|
|
2576
|
+
responses: {
|
|
2577
|
+
200: { contentType: SNAPSHOT_ARCHIVE_CONTENT_TYPE },
|
|
2578
|
+
206: { contentType: SNAPSHOT_ARCHIVE_CONTENT_TYPE }
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
];
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2368
2584
|
// src/server/routes/table.ts
|
|
2369
2585
|
function serverRoutes(limits) {
|
|
2370
2586
|
const shared = sharedRouteOptions(limits);
|
|
@@ -2374,7 +2590,8 @@ function serverRoutes(limits) {
|
|
|
2374
2590
|
...documentRoutes(shared),
|
|
2375
2591
|
...searchRoutes(shared),
|
|
2376
2592
|
...maintenanceRoutes(shared),
|
|
2377
|
-
...backupRoutes(shared)
|
|
2593
|
+
...backupRoutes(shared),
|
|
2594
|
+
...syncRoutes(shared)
|
|
2378
2595
|
];
|
|
2379
2596
|
}
|
|
2380
2597
|
|
|
@@ -2415,12 +2632,146 @@ async function loadUWebSockets() {
|
|
|
2415
2632
|
} catch (err) {
|
|
2416
2633
|
throw new NarsilError(
|
|
2417
2634
|
ErrorCodes.CONFIG_INVALID,
|
|
2418
|
-
"The `uWebSockets.js` package is required to run the Narsil HTTP server. Install it with `pnpm add github:uNetworking/uWebSockets.js#v20.
|
|
2635
|
+
"The `uWebSockets.js` package is required to run the Narsil HTTP server. Install it with `pnpm add github:uNetworking/uWebSockets.js#v20.70.0` (or the npm or yarn equivalent).",
|
|
2419
2636
|
{ cause: err instanceof Error ? err.message : String(err) }
|
|
2420
2637
|
);
|
|
2421
2638
|
}
|
|
2422
2639
|
}
|
|
2423
2640
|
|
|
2641
|
+
// src/sync/feed/constants.ts
|
|
2642
|
+
var DEFAULT_FEED_WINDOW_BYTES = 8388608;
|
|
2643
|
+
var ENTRIES_MESSAGE_LIMIT_BYTES = 1048576;
|
|
2644
|
+
var DEFAULT_MAX_FEED_CONNECTIONS = 1e4;
|
|
2645
|
+
var DEFAULT_MAX_FEED_CATCH_UPS = 32;
|
|
2646
|
+
var DEFAULT_MAX_FEED_BUFFERED_BYTES = 268435456;
|
|
2647
|
+
var FEED_HEAD_RETRY_MS = 200;
|
|
2648
|
+
var TIMER_DELAY_LIMIT_MS = 2147483647;
|
|
2649
|
+
var FEED_SOCKET_MAX_PAYLOAD_BYTES = 131072;
|
|
2650
|
+
var FEED_SOCKET_MAX_BACKPRESSURE_BYTES = 1073741824;
|
|
2651
|
+
|
|
2652
|
+
// src/server/sync/feed-route.ts
|
|
2653
|
+
var SYNC_FEED_PATH = "/indexes/:name/sync/feed";
|
|
2654
|
+
function offersSubprotocol(header) {
|
|
2655
|
+
return header.split(",").some((value) => value.trim() === SYNC_SUBPROTOCOL);
|
|
2656
|
+
}
|
|
2657
|
+
function indexNameOf(raw) {
|
|
2658
|
+
if (!raw.includes("%")) return raw;
|
|
2659
|
+
try {
|
|
2660
|
+
return decodeURIComponent(raw);
|
|
2661
|
+
} catch {
|
|
2662
|
+
return null;
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
function socketOf(ws) {
|
|
2666
|
+
const data = ws.getUserData();
|
|
2667
|
+
return {
|
|
2668
|
+
send(bytes) {
|
|
2669
|
+
if (data.closed) return;
|
|
2670
|
+
ws.cork(() => {
|
|
2671
|
+
ws.send(bytes, true);
|
|
2672
|
+
});
|
|
2673
|
+
},
|
|
2674
|
+
bufferedAmount: () => data.closed ? 0 : ws.getBufferedAmount(),
|
|
2675
|
+
close(code, reason) {
|
|
2676
|
+
if (data.closed) return;
|
|
2677
|
+
data.closed = true;
|
|
2678
|
+
ws.end(code, reason);
|
|
2679
|
+
}
|
|
2680
|
+
};
|
|
2681
|
+
}
|
|
2682
|
+
function refuse(res, err) {
|
|
2683
|
+
const { status, body } = toHttpError(err);
|
|
2684
|
+
sendError(res, status, body.code, body.message, body.details);
|
|
2685
|
+
}
|
|
2686
|
+
async function upgradeFeed(gateway, res, context, indexName, handshake) {
|
|
2687
|
+
const abort = initAbortHandler(res);
|
|
2688
|
+
let authorization;
|
|
2689
|
+
try {
|
|
2690
|
+
authorization = await gateway.authorize(context);
|
|
2691
|
+
} catch {
|
|
2692
|
+
authorization = { allowed: false, denial: null };
|
|
2693
|
+
}
|
|
2694
|
+
if (abort.aborted) return;
|
|
2695
|
+
if (!authorization.allowed) {
|
|
2696
|
+
const { denial } = authorization;
|
|
2697
|
+
if (denial === null) sendError(res, 500, ServerErrorCodes.HOOK_ERROR, "The onRequest hook threw an error");
|
|
2698
|
+
else sendError(res, denial.status, denial.code, denial.message);
|
|
2699
|
+
return;
|
|
2700
|
+
}
|
|
2701
|
+
let ticket;
|
|
2702
|
+
try {
|
|
2703
|
+
ticket = await gateway.admit(indexName, authorization.expiresAt);
|
|
2704
|
+
} catch (err) {
|
|
2705
|
+
if (!abort.aborted) refuse(res, err);
|
|
2706
|
+
return;
|
|
2707
|
+
}
|
|
2708
|
+
if (abort.aborted) {
|
|
2709
|
+
ticket.cancel();
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2712
|
+
const userData = { ticket, endpoint: null, closed: false };
|
|
2713
|
+
res.cork(() => {
|
|
2714
|
+
res.upgrade(userData, handshake.key, SYNC_SUBPROTOCOL, handshake.extensions, handshake.socketContext);
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2717
|
+
function registerFeedRoute(app, gateway) {
|
|
2718
|
+
app.ws(SYNC_FEED_PATH, {
|
|
2719
|
+
maxPayloadLength: FEED_SOCKET_MAX_PAYLOAD_BYTES,
|
|
2720
|
+
maxBackpressure: FEED_SOCKET_MAX_BACKPRESSURE_BYTES,
|
|
2721
|
+
upgrade(res, req, socketContext) {
|
|
2722
|
+
const rawName = req.getParameter(0) ?? "";
|
|
2723
|
+
const protocols = req.getHeader("sec-websocket-protocol");
|
|
2724
|
+
const handshake = {
|
|
2725
|
+
key: req.getHeader("sec-websocket-key"),
|
|
2726
|
+
extensions: req.getHeader("sec-websocket-extensions"),
|
|
2727
|
+
socketContext
|
|
2728
|
+
};
|
|
2729
|
+
const headers = {};
|
|
2730
|
+
req.forEach((key, value) => {
|
|
2731
|
+
headers[key] = value;
|
|
2732
|
+
});
|
|
2733
|
+
const context = {
|
|
2734
|
+
method: req.getMethod().toUpperCase(),
|
|
2735
|
+
path: req.getUrl(),
|
|
2736
|
+
headers,
|
|
2737
|
+
remoteAddress: Buffer.from(res.getRemoteAddressAsText()).toString()
|
|
2738
|
+
};
|
|
2739
|
+
const indexName = indexNameOf(rawName);
|
|
2740
|
+
if (indexName === null || !offersSubprotocol(protocols)) {
|
|
2741
|
+
res.onAborted(() => void 0);
|
|
2742
|
+
sendError(
|
|
2743
|
+
res,
|
|
2744
|
+
400,
|
|
2745
|
+
ServerErrorCodes.INVALID_REQUEST,
|
|
2746
|
+
indexName === null ? "A path segment holds a percent-escape the server cannot decode" : `The upgrade must offer the subprotocol ${SYNC_SUBPROTOCOL}`
|
|
2747
|
+
);
|
|
2748
|
+
return;
|
|
2749
|
+
}
|
|
2750
|
+
void upgradeFeed(gateway, res, context, indexName, handshake).catch(() => void 0);
|
|
2751
|
+
},
|
|
2752
|
+
open(ws) {
|
|
2753
|
+
const data = ws.getUserData();
|
|
2754
|
+
try {
|
|
2755
|
+
data.endpoint = data.ticket.open(socketOf(ws));
|
|
2756
|
+
} catch {
|
|
2757
|
+
data.closed = true;
|
|
2758
|
+
ws.end(SYNC_CLOSE_SERVER_ERROR, "feed unavailable");
|
|
2759
|
+
}
|
|
2760
|
+
},
|
|
2761
|
+
message(ws, message, isBinary) {
|
|
2762
|
+
ws.getUserData().endpoint?.receive(new Uint8Array(message.slice(0)), isBinary);
|
|
2763
|
+
},
|
|
2764
|
+
drain(ws) {
|
|
2765
|
+
ws.getUserData().endpoint?.drained();
|
|
2766
|
+
},
|
|
2767
|
+
close(ws) {
|
|
2768
|
+
const data = ws.getUserData();
|
|
2769
|
+
data.closed = true;
|
|
2770
|
+
data.endpoint?.closedByPeer();
|
|
2771
|
+
}
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2424
2775
|
// src/server/request-threads/acceptor.ts
|
|
2425
2776
|
function acceptorOf(app) {
|
|
2426
2777
|
const candidate = app;
|
|
@@ -2468,6 +2819,28 @@ async function closeWhenTheProcessExits(word, close) {
|
|
|
2468
2819
|
}
|
|
2469
2820
|
}
|
|
2470
2821
|
|
|
2822
|
+
// src/server/sync/feed-messages.ts
|
|
2823
|
+
var THREAD_FEED_NOTES = /* @__PURE__ */ new Set([
|
|
2824
|
+
"feed-open",
|
|
2825
|
+
"feed-cancel",
|
|
2826
|
+
"feed-message",
|
|
2827
|
+
"feed-sent",
|
|
2828
|
+
"feed-closed"
|
|
2829
|
+
]);
|
|
2830
|
+
function typeAndFeedId(message) {
|
|
2831
|
+
if (typeof message !== "object" || message === null) return null;
|
|
2832
|
+
const { type, feedId } = message;
|
|
2833
|
+
return { type, feedId };
|
|
2834
|
+
}
|
|
2835
|
+
function isThreadFeedNote(message) {
|
|
2836
|
+
const fields = typeAndFeedId(message);
|
|
2837
|
+
return fields !== null && typeof fields.feedId === "number" && THREAD_FEED_NOTES.has(String(fields.type));
|
|
2838
|
+
}
|
|
2839
|
+
function isMainFeedNote(message) {
|
|
2840
|
+
const fields = typeAndFeedId(message);
|
|
2841
|
+
return fields !== null && typeof fields.feedId === "number" && (fields.type === "feed-send" || fields.type === "feed-close");
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2471
2844
|
// src/server/request-threads/departure.ts
|
|
2472
2845
|
var DEPARTURE_WORD = 0;
|
|
2473
2846
|
var AWAITING_DEPARTURE = 0;
|
|
@@ -2490,4 +2863,4 @@ async function departureConfirmation(word) {
|
|
|
2490
2863
|
if (waiting.async) await waiting.value;
|
|
2491
2864
|
}
|
|
2492
2865
|
|
|
2493
|
-
export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, CHANGE_ANALYSIS_CAPABILITY, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_RETAINED_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_TASK_PAGE_SIZE, DOCUMENT_EXPORT_CAPABILITY, DOCUMENT_EXPORT_CONTENT_TYPE, IMPORT_FLUSHES_IN_FLIGHT, INDEX_LIFECYCLE_CAPABILITY, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, MAIN_THREAD_GATE_SLOT, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, MAX_INDEX_TOUCH_INTERVAL_MS, MAX_LONG_QUERIES_IN_FLIGHT, MIN_COUNTED_SERVER_LIMIT, MIN_UNBOUNDED_SERVER_LIMIT, PROMETHEUS_TEXT_CONTENT_TYPE, REBUILD_ANALYSIS_CAPABILITY, RELAY_STREAM_CHUNKS_IN_FLIGHT, REQUEST_THREAD_CLOSE_AT_EXIT_MS, REQUEST_THREAD_DEPARTURE_DRAIN_MS, REQUEST_THREAD_MOVE_AFTER_MS, RUNNING_TASK_TTL_MS, SEARCH_CLOCK_SAMPLE_UNITS, SERVER_CAPABILITIES, SNAPSHOT_ARCHIVE_CONTENT_TYPE, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, TASK_PROGRESS_WRITE_INTERVAL_MS, TERMINAL_TASK_TTL_MS, acceptorOf, authorizerFor, awaitDepartureConfirmation, badRequest, childAppOf, clearBodyBudgetSlot, clearGateSlot, closeEveryThreadAtExit, closeWhenTheProcessExits, confirmDeparture, corsHeaderReader, createBodyBudgetBuffer, createCloseAtExitWords, createDepartureWord, createDocumentReadHandlers, createRouteRunner, createSharedBodyBudget, createSharedGateBuffer, createSharedRequestGate, createVersionHandler, departureConfirmation, departureConfirmed,
|
|
2866
|
+
export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, CHANGE_ANALYSIS_CAPABILITY, DEFAULT_FEED_WINDOW_BYTES, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_FEED_BUFFERED_BYTES, DEFAULT_MAX_FEED_CATCH_UPS, DEFAULT_MAX_FEED_CONNECTIONS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_RETAINED_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_TASK_PAGE_SIZE, DOCUMENT_EXPORT_CAPABILITY, DOCUMENT_EXPORT_CONTENT_TYPE, ENTRIES_MESSAGE_LIMIT_BYTES, FEED_HEAD_RETRY_MS, IMPORT_FLUSHES_IN_FLIGHT, INDEX_LIFECYCLE_CAPABILITY, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, MAIN_THREAD_GATE_SLOT, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, MAX_INDEX_TOUCH_INTERVAL_MS, MAX_LONG_QUERIES_IN_FLIGHT, MIN_COUNTED_SERVER_LIMIT, MIN_UNBOUNDED_SERVER_LIMIT, PROMETHEUS_TEXT_CONTENT_TYPE, REBUILD_ANALYSIS_CAPABILITY, RELAY_STREAM_CHUNKS_IN_FLIGHT, REQUEST_THREAD_CLOSE_AT_EXIT_MS, REQUEST_THREAD_DEPARTURE_DRAIN_MS, REQUEST_THREAD_MOVE_AFTER_MS, RUNNING_TASK_TTL_MS, SEARCH_CLOCK_SAMPLE_UNITS, SERVER_CAPABILITIES, SNAPSHOT_ARCHIVE_CONTENT_TYPE, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, TASK_PROGRESS_WRITE_INTERVAL_MS, TERMINAL_TASK_TTL_MS, TIMER_DELAY_LIMIT_MS, acceptorOf, authorizerFor, awaitDepartureConfirmation, badRequest, childAppOf, clearBodyBudgetSlot, clearGateSlot, closeEveryThreadAtExit, closeWhenTheProcessExits, confirmDeparture, corsHeaderReader, createBodyBudgetBuffer, createCloseAtExitWords, createDepartureWord, createDocumentReadHandlers, createRouteRunner, createSharedBodyBudget, createSharedGateBuffer, createSharedRequestGate, createSyncSnapshotHandler, createVersionHandler, departureConfirmation, departureConfirmed, gateSlotOfWorker, httpStatusForNarsilError, isMainFeedNote, isRemoveOnlyBatch, isThreadFeedNote, loadUWebSockets, parseJson, parseJsonOptional, parseRefusalOf, parseTaskListQuery, parseWriteJson, refuseRegex, registerFeedRoute, registerServerRoutes, rejectInvalid, resolveCors, respondAnswer, respondError, respondJson, sendError, sendRelayed, sendStream, sendText, serializeBatchResult, serializeNarsilError, serverRoutes, statusLine, toHttpError, validateBatch, validateChangeAnalysis, validateCreateIndex, validateDocumentBody, validateQuery, validateRebalance, validateSuggest, versionReport, withServerRerankWindow };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { rerankQueryTextOf } from './chunk-KZ3NX2P7.mjs';
|
|
2
|
-
import { fixedHybridDepthOf, pageByPosition, requireWithinHybridDepth } from './chunk-
|
|
2
|
+
import { fixedHybridDepthOf, pageByPosition, requireWithinHybridDepth } from './chunk-C6ASEFZI.mjs';
|
|
3
3
|
import { DEFAULT_RERANK_WINDOW, MIN_RERANK_WINDOW } from './chunk-HJSN7UYG.mjs';
|
|
4
4
|
import { DEFAULT_LIMIT, DEFAULT_OFFSET } from './chunk-EEBCDP36.mjs';
|
|
5
5
|
import { RESULT_WINDOW } from './chunk-FQBFZAWG.mjs';
|
|
6
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
6
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
7
7
|
|
|
8
8
|
// src/rerank/params.ts
|
|
9
9
|
function invalid(message, details = {}) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bitsetHas, bitsetSet, GrowableUint32, createBitSet, bitsetAnd, bitsetNot } from './chunk-JUKYYXSP.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { tabulatedLevenshtein } from './chunk-GES7U2PM.mjs';
|
|
3
|
+
import { parsedTypeOf } from './chunk-3A5KI24C.mjs';
|
|
4
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
4
5
|
import { codePointCount, exceedsCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
5
6
|
|
|
6
7
|
// src/core/pattern-index/constants.ts
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { requireAnalysisRebuildMemory } from './chunk-
|
|
2
|
-
import { requireConfigurationWithinSizeLimit, DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, rewriteSpillOf, emitEngineEvent, reconstructSchemaFromMetadata, prepareStoredSynonyms, rulesOfStoredSynonyms, prepareConfiguredSynonyms, REBALANCE_CHUNK_SIZE, yieldToEventLoop, prepareDocumentVectors, removeDocumentVectors, insertDocumentVectors, vectorsEqual, rebuildTextIndexes, textRebuildTargetOf, extractVectorFromDoc, deleteNestedValue } from './chunk-
|
|
3
|
-
import { resolvePartialWordAnalysis } from './chunk-UGVUW27S.mjs';
|
|
4
|
-
import { createPartitionIndex, ARRAY_POSITION_GAP } from './chunk-3HV7M5OJ.mjs';
|
|
1
|
+
import { requireAnalysisRebuildMemory } from './chunk-MMBEANB2.mjs';
|
|
2
|
+
import { requireConfigurationWithinSizeLimit, DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, rewriteSpillOf, emitEngineEvent, reconstructSchemaFromMetadata, prepareStoredSynonyms, rulesOfStoredSynonyms, prepareConfiguredSynonyms, REBALANCE_CHUNK_SIZE, yieldToEventLoop, prepareDocumentVectors, removeDocumentVectors, insertDocumentVectors, vectorsEqual, rebuildTextIndexes, holdSyncEpochChange, textRebuildTargetOf, extractVectorFromDoc, deleteNestedValue } from './chunk-LSM2YTKM.mjs';
|
|
5
3
|
import { ANALYSIS_CHANGE_MEMBERS, ANALYSIS_HOLD_APPLY_INTERVAL_MS } from './chunk-EEBCDP36.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { resolvePartialWordAnalysis } from './chunk-5FUOVJKG.mjs';
|
|
5
|
+
import { createPartitionIndex, ARRAY_POSITION_GAP } from './chunk-HWEDFLB7.mjs';
|
|
6
|
+
import { configUnderAnalysis, targetOfPending } from './chunk-NTZOXVUZ.mjs';
|
|
7
|
+
import { getLanguage, resolveIndexAnalysis } from './chunk-JCLTESFN.mjs';
|
|
8
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
8
9
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
9
10
|
|
|
10
11
|
// src/engine/analysis-change/run.ts
|
|
@@ -667,13 +668,18 @@ async function buildAndSwitch(scope) {
|
|
|
667
668
|
},
|
|
668
669
|
onSwitch: () => adopt(),
|
|
669
670
|
...hold === null ? {} : { holdBeforeSwitch: (keepCurrent) => waitForRelease(run, hold, keepCurrent) },
|
|
670
|
-
runSwitch(swap) {
|
|
671
|
+
async runSwitch(swap) {
|
|
671
672
|
const swapWithSynonyms = () => {
|
|
672
673
|
if (!isCurrent()) return false;
|
|
673
674
|
adopt = switchIndex(scope);
|
|
674
675
|
return swap();
|
|
675
676
|
};
|
|
676
|
-
|
|
677
|
+
const releaseSyncEpoch = await holdSyncEpochChange(core, indexName);
|
|
678
|
+
try {
|
|
679
|
+
return await (durable?.checkpointAfterSwitch?.(indexName, swapWithSynonyms) ?? swapWithSynonyms());
|
|
680
|
+
} finally {
|
|
681
|
+
releaseSyncEpoch();
|
|
682
|
+
}
|
|
677
683
|
}
|
|
678
684
|
},
|
|
679
685
|
textRebuildTargetOf(run.target.config, run.target.language, run.target.analysis)
|