@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,6 +1,6 @@
|
|
|
1
1
|
import { osqRecordBytes } from './chunk-37CD3OKS.mjs';
|
|
2
2
|
import { MAX_M, EARLIER_RELEASE_MIN_M, MIN_M } from './chunk-ZXX5GZEX.mjs';
|
|
3
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
3
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
4
4
|
|
|
5
5
|
// src/vector/vector-index/dead-bits.ts
|
|
6
6
|
var NO_LIVE_VECTOR_AT_POSITION = -1;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { oneSyncChangeAtATime } from './chunk-V6EUBAIT.mjs';
|
|
2
|
+
import { newSyncEpoch } from './chunk-BUMREPLU.mjs';
|
|
3
|
+
import { withOpenIndex, emitSyncChange } from './chunk-Y4WPNHMC.mjs';
|
|
4
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
5
|
+
|
|
6
|
+
// src/engine/sync/operations.ts
|
|
7
|
+
function invalidLimit(name, value) {
|
|
8
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The sync setting ${name} must be a positive whole number`, {
|
|
9
|
+
[name]: String(value)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function requireSyncSetting(setting) {
|
|
13
|
+
if (setting === null || typeof setting !== "object") {
|
|
14
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The sync setting must be an object");
|
|
15
|
+
}
|
|
16
|
+
const { enabled, historyMaxAgeMs, historyMaxBytes } = setting;
|
|
17
|
+
if (typeof enabled !== "boolean") {
|
|
18
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The sync setting needs enabled set to true or false");
|
|
19
|
+
}
|
|
20
|
+
const isLimit = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1;
|
|
21
|
+
if (historyMaxAgeMs !== void 0 && !isLimit(historyMaxAgeMs)) invalidLimit("historyMaxAgeMs", historyMaxAgeMs);
|
|
22
|
+
if (historyMaxBytes !== void 0 && !isLimit(historyMaxBytes)) invalidLimit("historyMaxBytes", historyMaxBytes);
|
|
23
|
+
return {
|
|
24
|
+
enabled,
|
|
25
|
+
...historyMaxAgeMs !== void 0 ? { historyMaxAgeMs } : {},
|
|
26
|
+
...historyMaxBytes !== void 0 ? { historyMaxBytes } : {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function syncStorageOf(core, indexName) {
|
|
30
|
+
const storage = core.durability?.manager.syncStorage?.();
|
|
31
|
+
if (storage === void 0) {
|
|
32
|
+
throw new NarsilError(
|
|
33
|
+
ErrorCodes.SYNC_DURABILITY_REQUIRED,
|
|
34
|
+
`Index "${indexName}" needs write-ahead log durability for device sync, because the feed reads the log`,
|
|
35
|
+
{ indexName }
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return storage;
|
|
39
|
+
}
|
|
40
|
+
async function persistSyncState(core, indexName, next) {
|
|
41
|
+
const entry = core.requireIndex(indexName);
|
|
42
|
+
const previous = entry.sync;
|
|
43
|
+
entry.sync = next;
|
|
44
|
+
try {
|
|
45
|
+
await core.durability?.manager.persistMetadata(indexName);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
entry.sync = previous;
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function updateIndexSync(core, indexName, value) {
|
|
52
|
+
const setting = requireSyncSetting(value);
|
|
53
|
+
core.requireIndex(indexName);
|
|
54
|
+
const storage = syncStorageOf(core, indexName);
|
|
55
|
+
return withOpenIndex(
|
|
56
|
+
core,
|
|
57
|
+
indexName,
|
|
58
|
+
() => oneSyncChangeAtATime(core.indexRegistry, indexName, async () => {
|
|
59
|
+
const previous = core.requireIndex(indexName).sync;
|
|
60
|
+
if (!setting.enabled) {
|
|
61
|
+
if (previous === null) return;
|
|
62
|
+
await persistSyncState(core, indexName, null);
|
|
63
|
+
await storage.release(indexName);
|
|
64
|
+
emitSyncChange(core.indexRegistry, { kind: "off", indexName });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const limits = {
|
|
68
|
+
...setting.historyMaxAgeMs !== void 0 ? { historyMaxAgeMs: setting.historyMaxAgeMs } : {},
|
|
69
|
+
...setting.historyMaxBytes !== void 0 ? { historyMaxBytes: setting.historyMaxBytes } : {}
|
|
70
|
+
};
|
|
71
|
+
if (previous !== null) {
|
|
72
|
+
await persistSyncState(core, indexName, { ...limits, active: previous.active, epoch: previous.epoch });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
await storage.release(indexName);
|
|
76
|
+
await persistSyncState(core, indexName, { ...limits, active: false, epoch: newSyncEpoch() });
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
async function renewWhileHeld(core, indexName) {
|
|
81
|
+
const sync = core.indexRegistry.get(indexName)?.sync ?? null;
|
|
82
|
+
if (sync === null) return;
|
|
83
|
+
await persistSyncState(core, indexName, { ...sync, active: false, epoch: newSyncEpoch() });
|
|
84
|
+
await core.durability?.manager.syncStorage?.().release(indexName);
|
|
85
|
+
emitSyncChange(core.indexRegistry, { kind: "epoch", indexName });
|
|
86
|
+
}
|
|
87
|
+
function holdRenewedSyncEpoch(core, indexName) {
|
|
88
|
+
if (core.mutationCtx.capacityScope === "partition") return Promise.resolve(() => void 0);
|
|
89
|
+
return new Promise((resolveHold, rejectHold) => {
|
|
90
|
+
void oneSyncChangeAtATime(core.indexRegistry, indexName, async () => {
|
|
91
|
+
try {
|
|
92
|
+
await renewWhileHeld(core, indexName);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
rejectHold(error);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
await new Promise((release) => resolveHold(() => release()));
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { holdRenewedSyncEpoch, requireSyncSetting, syncStorageOf, updateIndexSync };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { osqCodeBytes, osqStagedQueryBytes, osqRecordBytes, unpackLevels, readTrailer, stageQueryLevels, writeRecord } from './chunk-37CD3OKS.mjs';
|
|
2
1
|
import { stopUsingTheNativeSearchCore, nativeSearchCoreIsEnabled, noteFallback } from './chunk-DJHHF2L5.mjs';
|
|
2
|
+
import { osqCodeBytes, osqStagedQueryBytes, osqRecordBytes, unpackLevels, readTrailer, stageQueryLevels, writeRecord } from './chunk-37CD3OKS.mjs';
|
|
3
3
|
import { markSimdUnavailable } from './chunk-KOKM4PQN.mjs';
|
|
4
|
-
import { OSQ_STEPS, loadNativeCore, OSQ_GRID, OSQ_QUERY_BITS, NATIVE_OK, OSQ_REFINE_ROUNDS, OSQ_REFINE_TOLERANCE, OSQ_PLACEMENT_QUERY_BITS, NATIVE_NEEDS_ROOM, OSQ_LAMBDA, NATIVE_GRAPH_NOT_HELD_ALONE } from './chunk-
|
|
5
|
-
import { turnsAreBudgeted, holdWrites, yieldBackgroundTurn, backgroundTurnIsSpent } from './chunk-LQG5G2LY.mjs';
|
|
4
|
+
import { OSQ_STEPS, loadNativeCore, OSQ_GRID, OSQ_QUERY_BITS, NATIVE_OK, OSQ_REFINE_ROUNDS, OSQ_REFINE_TOLERANCE, OSQ_PLACEMENT_QUERY_BITS, NATIVE_NEEDS_ROOM, OSQ_LAMBDA, NATIVE_GRAPH_NOT_HELD_ALONE } from './chunk-HVKXNBFL.mjs';
|
|
6
5
|
import { NATIVE_THREAD_SEARCH_SLOTS, VECTOR_SCRATCH_SLOTS, MAX_DOC_ID_TABLE_BYTES, MAX_VECTOR_ORDINALS, MAX_WASM_PAGES, WASM_PAGE_BYTES, UNPLACED_FLAG_CHUNK_ORDINALS, VECTOR_STORE_INITIAL_CAPACITY, VECTOR_BLOCK_INITIAL_SLOTS, NATIVE_ATTACH_RETRY_MS, LOCK_SPIN_ITERATIONS, LOCK_WAIT_SLICE_MS, GRAPH_LOCK_WAIT_SLICE_MS, GRAPH_LOCK_WAIT_DEADLINE_MS } from './chunk-BTPGQC6Z.mjs';
|
|
6
|
+
import { turnsAreBudgeted, holdWrites, yieldBackgroundTurn, backgroundTurnIsSpent } from './chunk-LQG5G2LY.mjs';
|
|
7
7
|
import { threadSlotGone } from './chunk-RFBLQLLZ.mjs';
|
|
8
8
|
import { DEFAULT_EF_SEARCH, COMPACTION_TOMBSTONE_RATIO, COMPACTION_ABSOLUTE_THRESHOLD, PLACEMENT_ROOM_REQUESTS, MAX_LAYER_CAP, INITIAL_LIST_CAPACITY, INITIAL_UPPER_SLOTS, CONNECT_RESTARTS_BEFORE_ONE_PASS, FARTHEST_REJECTED_LINKS_KEPT, CONNECT_STEPS_BETWEEN_CLOCK_CHECKS, NEAREST_LINK_FALLBACK_HOSTS } from './chunk-ZXX5GZEX.mjs';
|
|
9
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
9
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
10
10
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
11
11
|
|
|
12
12
|
// src/vector/shared-buffers/memory-limits.ts
|
|
@@ -2016,6 +2016,7 @@ function writeKeepingLastLinks(state, ord, sorted, kept, held) {
|
|
|
2016
2016
|
|
|
2017
2017
|
// src/vector/hnsw/nearest-links.ts
|
|
2018
2018
|
var NOT_YET_FOUND = -2;
|
|
2019
|
+
var NOT_ANCHORED = -1;
|
|
2019
2020
|
function nearer(a, b) {
|
|
2020
2021
|
return nearerPair(a.distance, a.ord, b.distance, b.ord);
|
|
2021
2022
|
}
|
|
@@ -2064,7 +2065,8 @@ function replaceableSlot(pass, host, list) {
|
|
|
2064
2065
|
for (let i = 0; i < list.length; i++) {
|
|
2065
2066
|
const neighbour = list[i];
|
|
2066
2067
|
if (incomingCount(pass.state.adjacency, neighbour) < 2) continue;
|
|
2067
|
-
if (isLive(pass.state, neighbour) && nearestInList(pass, neighbour) === host)
|
|
2068
|
+
if (isLive(pass.state, neighbour) && (nearestInList(pass, neighbour) === host || pass.anchoredBy[neighbour] === host))
|
|
2069
|
+
continue;
|
|
2068
2070
|
const distance = pass.distance(host, neighbour);
|
|
2069
2071
|
if (farthest === -1 || nearerPair(farthestDistance, farthestOrd, distance, neighbour)) {
|
|
2070
2072
|
farthest = i;
|
|
@@ -2079,12 +2081,16 @@ function linkFrom(pass, host, ord) {
|
|
|
2079
2081
|
const base = layerBase(adjacency, host, 0);
|
|
2080
2082
|
if (base === ABSENT) return false;
|
|
2081
2083
|
const list = adjacency.level0.subarray(base + 1, base + 1 + adjacency.level0[base]);
|
|
2082
|
-
if (list.includes(ord))
|
|
2084
|
+
if (list.includes(ord)) {
|
|
2085
|
+
pass.anchoredBy[ord] = host;
|
|
2086
|
+
return true;
|
|
2087
|
+
}
|
|
2083
2088
|
if (list.length < pass.state.Mmax0) {
|
|
2084
2089
|
adjacency.level0[base + list.length + 1] = ord;
|
|
2085
2090
|
adjacency.level0[base] = list.length + 1;
|
|
2086
2091
|
noteLinked(adjacency, ord);
|
|
2087
2092
|
pass.nearest[host] = NOT_YET_FOUND;
|
|
2093
|
+
pass.anchoredBy[ord] = host;
|
|
2088
2094
|
return true;
|
|
2089
2095
|
}
|
|
2090
2096
|
const slot = replaceableSlot(pass, host, list);
|
|
@@ -2094,6 +2100,7 @@ function linkFrom(pass, host, ord) {
|
|
|
2094
2100
|
noteUnlinked(adjacency, replaced);
|
|
2095
2101
|
noteLinked(adjacency, ord);
|
|
2096
2102
|
pass.nearest[host] = NOT_YET_FOUND;
|
|
2103
|
+
pass.anchoredBy[ord] = host;
|
|
2097
2104
|
return true;
|
|
2098
2105
|
}
|
|
2099
2106
|
function linkFromNearest(state) {
|
|
@@ -2106,7 +2113,8 @@ function* linkFromNearestSteps(state, pace) {
|
|
|
2106
2113
|
const pass = {
|
|
2107
2114
|
state,
|
|
2108
2115
|
distance: nodeDistanceFunction(state, state.buildMetric),
|
|
2109
|
-
nearest: new Int32Array(slots).fill(NOT_YET_FOUND)
|
|
2116
|
+
nearest: new Int32Array(slots).fill(NOT_YET_FOUND),
|
|
2117
|
+
anchoredBy: new Int32Array(slots).fill(NOT_ANCHORED)
|
|
2110
2118
|
};
|
|
2111
2119
|
for (let ord = 0; ord < slots; ord++) {
|
|
2112
2120
|
if (stepTaken(pace)) yield;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/sync/epoch.ts
|
|
2
|
+
var SYNC_EPOCH_BYTES = 16;
|
|
3
|
+
var SYNC_EPOCH_PATTERN = /^[0-9a-f]{32}$/;
|
|
4
|
+
function isSyncEpoch(value) {
|
|
5
|
+
return typeof value === "string" && SYNC_EPOCH_PATTERN.test(value);
|
|
6
|
+
}
|
|
7
|
+
function newSyncEpoch() {
|
|
8
|
+
const bytes = new Uint8Array(SYNC_EPOCH_BYTES);
|
|
9
|
+
crypto.getRandomValues(bytes);
|
|
10
|
+
let hex = "";
|
|
11
|
+
for (const byte of bytes) hex += byte.toString(16).padStart(2, "0");
|
|
12
|
+
return hex;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { isSyncEpoch, newSyncEpoch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MIN_HYBRID_DEPTH, MAX_HYBRID_DEPTH } from './chunk-FQBFZAWG.mjs';
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
3
3
|
|
|
4
4
|
// src/search/hybrid-depth.ts
|
|
5
5
|
function fixedHybridDepthOf(hybrid) {
|
|
@@ -4,14 +4,14 @@ function holdsChangeWork(entry) {
|
|
|
4
4
|
}
|
|
5
5
|
async function abandonChangeOf(core, indexName) {
|
|
6
6
|
if (!holdsChangeWork(core.indexRegistry.get(indexName))) return;
|
|
7
|
-
const { abandonAnalysisChange } = await import('./analysis-change-
|
|
7
|
+
const { abandonAnalysisChange } = await import('./analysis-change-4GCRVRBW.mjs');
|
|
8
8
|
await abandonAnalysisChange(core, indexName);
|
|
9
9
|
}
|
|
10
10
|
async function resumeChangeOf(core, indexName) {
|
|
11
11
|
if ((core.indexRegistry.get(indexName)?.pendingAnalysis ?? null) === null) return;
|
|
12
12
|
if (core.mutationCtx.capacityScope === "partition") return;
|
|
13
13
|
if (core.executor.getManager(indexName) === void 0) return;
|
|
14
|
-
const { resumeAnalysisChange } = await import('./analysis-change-
|
|
14
|
+
const { resumeAnalysisChange } = await import('./analysis-change-4GCRVRBW.mjs');
|
|
15
15
|
void resumeAnalysisChange(core, indexName).catch(() => void 0);
|
|
16
16
|
}
|
|
17
17
|
async function resumeEveryChange(core) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAX_DOCUMENT_NESTING_DEPTH } from './chunk-L5ORED7V.mjs';
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
3
3
|
|
|
4
4
|
// src/serialization/base64.ts
|
|
5
5
|
var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -1,9 +1,81 @@
|
|
|
1
1
|
import { withRerankQueryText } from './chunk-KZ3NX2P7.mjs';
|
|
2
|
-
import { sendRelayed, parseJson, validateQuery, rejectInvalid, refuseRegex, respondJson, withServerRerankWindow, respondError, loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedBodyBudget, createSharedRequestGate, registerServerRoutes, closeWhenTheProcessExits, statusLine, sendError, REQUEST_THREAD_MOVE_AFTER_MS, MAX_LONG_QUERIES_IN_FLIGHT, createDocumentReadHandlers, SERVER_CAPABILITIES, versionReport, serverRoutes, validateSuggest, SEARCH_CLOCK_SAMPLE_UNITS, awaitDepartureConfirmation, departureConfirmation, REQUEST_THREAD_DEPARTURE_DRAIN_MS, departureConfirmed
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { sendRelayed, parseJson, validateQuery, rejectInvalid, refuseRegex, respondJson, withServerRerankWindow, respondError, loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedBodyBudget, createSharedRequestGate, registerFeedRoute, registerServerRoutes, closeWhenTheProcessExits, statusLine, sendError, REQUEST_THREAD_MOVE_AFTER_MS, MAX_LONG_QUERIES_IN_FLIGHT, createDocumentReadHandlers, SERVER_CAPABILITIES, versionReport, serverRoutes, validateSuggest, isMainFeedNote, SEARCH_CLOCK_SAMPLE_UNITS, awaitDepartureConfirmation, departureConfirmation, REQUEST_THREAD_DEPARTURE_DRAIN_MS, departureConfirmed } from './chunk-NZMAXR2S.mjs';
|
|
3
|
+
import { SYNC_CLOSE_GOING_AWAY, encodeJson } from './chunk-KYYABCSW.mjs';
|
|
4
|
+
import { executeListDocuments, executeSuggest, executeQuery, lazyQueryBinding, executePreflight } from './chunk-TV2L3BN7.mjs';
|
|
5
|
+
import { holdsQuotedText, resolveProjection, projectionKeepsField, setNestedValue } from './chunk-HWEDFLB7.mjs';
|
|
6
|
+
import { extractVectorFieldsFromSchema } from './chunk-Z3TNWCI5.mjs';
|
|
7
|
+
import { ServerErrorCodes, ErrorCodes, NarsilError, isNarsilError } from './chunk-KUZKUONM.mjs';
|
|
8
|
+
|
|
9
|
+
// src/server/request-threads/feed-relay.ts
|
|
10
|
+
function threadFeedGateway(port, relay) {
|
|
11
|
+
const sockets = /* @__PURE__ */ new Map();
|
|
12
|
+
function post(note, transfer = []) {
|
|
13
|
+
try {
|
|
14
|
+
port.postMessage(note, transfer);
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const onMessage = (message) => {
|
|
19
|
+
if (!isMainFeedNote(message)) return;
|
|
20
|
+
const socket = sockets.get(message.feedId);
|
|
21
|
+
if (socket === void 0) return;
|
|
22
|
+
if (message.type === "feed-close") {
|
|
23
|
+
sockets.delete(message.feedId);
|
|
24
|
+
socket.close(message.code, message.reason);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
socket.send(message.bytes);
|
|
28
|
+
post({
|
|
29
|
+
type: "feed-sent",
|
|
30
|
+
feedId: message.feedId,
|
|
31
|
+
bytes: message.bytes.byteLength,
|
|
32
|
+
buffered: socket.bufferedAmount()
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
port.on("message", onMessage);
|
|
36
|
+
return {
|
|
37
|
+
authorize: (context) => relay.authorize(context),
|
|
38
|
+
async admit(indexName, expiresAt) {
|
|
39
|
+
const reply = await relay.admitFeed(indexName, expiresAt);
|
|
40
|
+
const { feedId } = reply;
|
|
41
|
+
if (feedId === null) {
|
|
42
|
+
const error = reply.error;
|
|
43
|
+
if (error === null) throw new NarsilError(ErrorCodes.WORKER_CRASHED, "The server is closing its feeds");
|
|
44
|
+
throw new NarsilError(error.code, error.message, error.details);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
open(socket) {
|
|
48
|
+
sockets.set(feedId, socket);
|
|
49
|
+
post({ type: "feed-open", feedId });
|
|
50
|
+
return {
|
|
51
|
+
receive(bytes, binary) {
|
|
52
|
+
const copy = bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength ? bytes : bytes.slice();
|
|
53
|
+
post({ type: "feed-message", feedId, bytes: copy, binary }, [copy.buffer]);
|
|
54
|
+
},
|
|
55
|
+
drained() {
|
|
56
|
+
post({ type: "feed-sent", feedId, bytes: 0, buffered: socket.bufferedAmount() });
|
|
57
|
+
},
|
|
58
|
+
closedByPeer() {
|
|
59
|
+
sockets.delete(feedId);
|
|
60
|
+
post({ type: "feed-closed", feedId });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
cancel() {
|
|
65
|
+
post({ type: "feed-cancel", feedId });
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
close() {
|
|
70
|
+
port.off("message", onMessage);
|
|
71
|
+
for (const [feedId, socket] of sockets) {
|
|
72
|
+
socket.close(SYNC_CLOSE_GOING_AWAY, "server closing");
|
|
73
|
+
post({ type: "feed-closed", feedId });
|
|
74
|
+
}
|
|
75
|
+
sockets.clear();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
7
79
|
|
|
8
80
|
// src/server/request-threads/messages.ts
|
|
9
81
|
function isLongQueryPortNote(message) {
|
|
@@ -15,17 +87,51 @@ function isLongQueryPortNote(message) {
|
|
|
15
87
|
function isRelayReply(message) {
|
|
16
88
|
if (typeof message !== "object" || message === null) return false;
|
|
17
89
|
const { type, requestId } = message;
|
|
18
|
-
return typeof requestId === "number" && (type === "response" || type === "authorized" || type === "embedded" || type === "reranked" || type === "writes-applied");
|
|
90
|
+
return typeof requestId === "number" && (type === "response" || type === "authorized" || type === "embedded" || type === "reranked" || type === "writes-applied" || type === "feed-admitted");
|
|
19
91
|
}
|
|
20
92
|
function isStreamPart(message) {
|
|
21
93
|
if (typeof message !== "object" || message === null) return false;
|
|
22
94
|
const { type, requestId } = message;
|
|
23
95
|
return typeof requestId === "number" && (type === "stream-start" || type === "stream-chunk" || type === "stream-end");
|
|
24
96
|
}
|
|
97
|
+
function writeSizedChunks(port, writer, totalSize, requestId) {
|
|
98
|
+
const { ctx, sized } = writer;
|
|
99
|
+
const credit = () => port.postMessage({ type: "stream-credit", requestId });
|
|
100
|
+
while (!sized.waiting && sized.queued.length > 0 && !ctx.abort.aborted) {
|
|
101
|
+
const chunk = sized.queued[0];
|
|
102
|
+
let startOffset = 0;
|
|
103
|
+
let written = true;
|
|
104
|
+
ctx.res.cork(() => {
|
|
105
|
+
startOffset = ctx.res.getWriteOffset();
|
|
106
|
+
written = ctx.res.tryEnd(chunk, totalSize)[0];
|
|
107
|
+
});
|
|
108
|
+
if (written) {
|
|
109
|
+
sized.queued.shift();
|
|
110
|
+
credit();
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
sized.waiting = true;
|
|
114
|
+
ctx.res.onWritable((offset) => {
|
|
115
|
+
if (ctx.abort.aborted) return true;
|
|
116
|
+
const [retried] = ctx.res.tryEnd(chunk.subarray(offset - startOffset), totalSize);
|
|
117
|
+
if (!retried) return false;
|
|
118
|
+
sized.waiting = false;
|
|
119
|
+
sized.queued.shift();
|
|
120
|
+
credit();
|
|
121
|
+
queueMicrotask(() => writeSizedChunks(port, writer, totalSize, requestId));
|
|
122
|
+
return true;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
25
126
|
function writeStreamPart(port, writer, part) {
|
|
26
127
|
const { ctx } = writer;
|
|
27
128
|
if (part.type === "stream-end") {
|
|
28
|
-
if (!ctx.abort.aborted) {
|
|
129
|
+
if (!ctx.abort.aborted && writer.totalSize !== null) {
|
|
130
|
+
if (part.failed) {
|
|
131
|
+
writer.sized.queued.length = 0;
|
|
132
|
+
ctx.res.cork(() => ctx.res.close());
|
|
133
|
+
}
|
|
134
|
+
} else if (!ctx.abort.aborted) {
|
|
29
135
|
ctx.res.cork(() => {
|
|
30
136
|
if (part.failed) ctx.res.close();
|
|
31
137
|
else ctx.res.end();
|
|
@@ -37,12 +143,18 @@ function writeStreamPart(port, writer, part) {
|
|
|
37
143
|
if (ctx.abort.aborted) return;
|
|
38
144
|
if (part.type === "stream-start") {
|
|
39
145
|
writer.started = true;
|
|
146
|
+
writer.totalSize = part.totalSize;
|
|
40
147
|
ctx.res.cork(() => {
|
|
41
148
|
ctx.res.writeStatus(statusLine(part.status));
|
|
42
149
|
for (const [key, value] of part.headers) ctx.res.writeHeader(key, value);
|
|
43
150
|
});
|
|
44
151
|
return;
|
|
45
152
|
}
|
|
153
|
+
if (writer.totalSize !== null) {
|
|
154
|
+
writer.sized.queued.push(part.chunk);
|
|
155
|
+
writeSizedChunks(port, writer, writer.totalSize, part.requestId);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
46
158
|
let writable = true;
|
|
47
159
|
ctx.res.cork(() => {
|
|
48
160
|
writable = ctx.res.write(part.chunk);
|
|
@@ -128,7 +240,7 @@ function createRelayClient(port, touchIntervalMs) {
|
|
|
128
240
|
if (reply.type !== "authorized") return { allowed: false, denial: null };
|
|
129
241
|
if (reply.hookError) return { allowed: false, denial: null };
|
|
130
242
|
if (reply.denial !== null) return { allowed: false, denial: reply.denial };
|
|
131
|
-
return { allowed: true };
|
|
243
|
+
return { allowed: true, expiresAt: reply.expiresAt };
|
|
132
244
|
},
|
|
133
245
|
async request(route, ctx, onUnavailable) {
|
|
134
246
|
let reply;
|
|
@@ -139,6 +251,8 @@ function createRelayClient(port, touchIntervalMs) {
|
|
|
139
251
|
writers.set(requestId, {
|
|
140
252
|
ctx,
|
|
141
253
|
started: false,
|
|
254
|
+
totalSize: null,
|
|
255
|
+
sized: { queued: [], waiting: false },
|
|
142
256
|
finish: () => {
|
|
143
257
|
writers.delete(requestId);
|
|
144
258
|
pending.delete(requestId);
|
|
@@ -156,7 +270,8 @@ function createRelayClient(port, touchIntervalMs) {
|
|
|
156
270
|
rawBody: body.bytes,
|
|
157
271
|
bodyRefusal: ctx.bodyRefusal,
|
|
158
272
|
spooledBody: ctx.spooledBody === null ? null : { path: ctx.spooledBody.path, bytes: ctx.spooledBody.bytes },
|
|
159
|
-
hookContext: ctx.hookContext
|
|
273
|
+
hookContext: ctx.hookContext,
|
|
274
|
+
requestHeaders: { ...ctx.requestHeaders }
|
|
160
275
|
};
|
|
161
276
|
}, body.moved).then(resolve, reject);
|
|
162
277
|
});
|
|
@@ -188,6 +303,11 @@ function createRelayClient(port, touchIntervalMs) {
|
|
|
188
303
|
async awaitWrites(indexName) {
|
|
189
304
|
await send((requestId) => ({ type: "await-writes", requestId, indexName }));
|
|
190
305
|
},
|
|
306
|
+
async admitFeed(indexName, expiresAt) {
|
|
307
|
+
const reply = await send((requestId) => ({ type: "feed-admit", requestId, indexName, expiresAt }));
|
|
308
|
+
if (reply.type === "feed-admitted") return reply;
|
|
309
|
+
throw portClosedError();
|
|
310
|
+
},
|
|
191
311
|
touch(indexName) {
|
|
192
312
|
if (closed) return;
|
|
193
313
|
const now = Date.now();
|
|
@@ -788,16 +908,19 @@ async function serveRequests(executor, settings) {
|
|
|
788
908
|
track: departure.track
|
|
789
909
|
});
|
|
790
910
|
const handlers = guardEveryRoute(threadHandlers(local, relay, longQueries, settings), departure);
|
|
911
|
+
const feeds = settings.sync ? threadFeedGateway(settings.port, relay) : null;
|
|
912
|
+
if (feeds !== null) registerFeedRoute(app, feeds);
|
|
791
913
|
registerServerRoutes(app, run, handlers, settings.limits, settings.cors);
|
|
792
|
-
servingApp = { app: child, relay, longQueries };
|
|
914
|
+
servingApp = { app: child, relay, longQueries, feeds };
|
|
793
915
|
void closeWhenTheProcessExits(new Int32Array(settings.closeAtExit), closeRequestThread);
|
|
794
916
|
return { descriptor: child.getDescriptor() };
|
|
795
917
|
}
|
|
796
918
|
function closeRequestThread() {
|
|
797
919
|
leaveWithoutDeparture();
|
|
798
920
|
if (servingApp === null) return;
|
|
799
|
-
const { app, relay, longQueries } = servingApp;
|
|
921
|
+
const { app, relay, longQueries, feeds } = servingApp;
|
|
800
922
|
servingApp = null;
|
|
923
|
+
feeds?.close();
|
|
801
924
|
app.close();
|
|
802
925
|
longQueries.close();
|
|
803
926
|
relay.close();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND } from './chunk-
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
1
|
+
import { NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND } from './chunk-CP5RRPJR.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
3
3
|
|
|
4
4
|
// src/engine/export/json-line.ts
|
|
5
5
|
function refuse(path, kind, docId) {
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { unrefInterval, DEFAULT_HISTORY_MAX_AGE_MS } from './chunk-PGVPE7GJ.mjs';
|
|
2
|
+
import { archiveLayout } from './chunk-Q7MS6P2J.mjs';
|
|
3
|
+
import { syncStorageOf } from './chunk-B7S6YEBP.mjs';
|
|
4
|
+
import { oneSyncChangeAtATime } from './chunk-V6EUBAIT.mjs';
|
|
5
|
+
import { MAX_SNAPSHOT_ANALYSIS_ATTEMPTS } from './chunk-ZYAY26KG.mjs';
|
|
6
|
+
import { isSyncEpoch } from './chunk-BUMREPLU.mjs';
|
|
7
|
+
import { manifestFileRefs } from './chunk-Q3TCTQCC.mjs';
|
|
8
|
+
import { emitEngineEvent, encodeIndexConfiguration } from './chunk-LSM2YTKM.mjs';
|
|
9
|
+
import { INDEX_CONFIGURATION_ENVELOPE_VERSION } from './chunk-USR7FQRZ.mjs';
|
|
10
|
+
import { openChecksummedEnvelope } from './chunk-HVYICDY3.mjs';
|
|
11
|
+
import { withOpenIndex } from './chunk-Y4WPNHMC.mjs';
|
|
12
|
+
import { NarsilError, ErrorCodes } from './chunk-KUZKUONM.mjs';
|
|
13
|
+
import { decode } from '@msgpack/msgpack';
|
|
14
|
+
|
|
15
|
+
// src/engine/sync/archive.ts
|
|
16
|
+
function publishedArchiveLayout(indexName, snapshot, storage) {
|
|
17
|
+
const prefix = `${indexName}/`;
|
|
18
|
+
return archiveLayout(
|
|
19
|
+
snapshot.config,
|
|
20
|
+
snapshot.manifestBytes,
|
|
21
|
+
manifestFileRefs(snapshot.manifest).map((ref) => ({
|
|
22
|
+
name: ref.key.slice(prefix.length),
|
|
23
|
+
bytes: ref.bytes,
|
|
24
|
+
read: (offset, length) => storage.readFileRange(ref.key, offset, length)
|
|
25
|
+
}))
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/engine/sync/constants.ts
|
|
30
|
+
var HISTORY_SWEEP_INTERVAL_MS = 36e5;
|
|
31
|
+
var epochsOfSnapshots = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
async function epochOfSnapshot(snapshot) {
|
|
33
|
+
const known = epochsOfSnapshots.get(snapshot);
|
|
34
|
+
if (known !== void 0) return known;
|
|
35
|
+
const { payload } = await openChecksummedEnvelope(snapshot.config, {
|
|
36
|
+
envelopeFormatVersion: INDEX_CONFIGURATION_ENVELOPE_VERSION,
|
|
37
|
+
what: "index configuration",
|
|
38
|
+
allowsCompression: true
|
|
39
|
+
});
|
|
40
|
+
const raw = decode(payload);
|
|
41
|
+
const epoch = raw !== null && typeof raw === "object" && isSyncEpoch(raw.syncEpoch) ? raw.syncEpoch : null;
|
|
42
|
+
epochsOfSnapshots.set(snapshot, epoch);
|
|
43
|
+
return epoch;
|
|
44
|
+
}
|
|
45
|
+
function notEnabled(indexName) {
|
|
46
|
+
return new NarsilError(ErrorCodes.SYNC_NOT_ENABLED, `Index "${indexName}" has device sync off`, { indexName });
|
|
47
|
+
}
|
|
48
|
+
function configurationFor(core, indexName) {
|
|
49
|
+
return async (manifest) => {
|
|
50
|
+
const entry = core.requireIndex(indexName);
|
|
51
|
+
if ((manifest.analysisGeneration ?? 0) !== entry.analysisGeneration) {
|
|
52
|
+
throw new NarsilError(
|
|
53
|
+
ErrorCodes.ANALYSIS_CHANGE_NOT_READY,
|
|
54
|
+
`The analysis of index "${indexName}" changed while the engine published its snapshot`,
|
|
55
|
+
{ indexName }
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return encodeIndexConfiguration(entry);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async function publishWithinAnalysis(core, storage, indexName) {
|
|
62
|
+
let lastError = null;
|
|
63
|
+
for (let attempt = 0; attempt < MAX_SNAPSHOT_ANALYSIS_ATTEMPTS; attempt++) {
|
|
64
|
+
try {
|
|
65
|
+
return await storage.publish(indexName, configurationFor(core, indexName));
|
|
66
|
+
} catch (error) {
|
|
67
|
+
if (!(error instanceof NarsilError) || error.code !== ErrorCodes.ANALYSIS_CHANGE_NOT_READY) throw error;
|
|
68
|
+
lastError = error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
throw lastError;
|
|
72
|
+
}
|
|
73
|
+
function publishedSyncSnapshot(core, indexName, republish = false) {
|
|
74
|
+
const entry = core.requireIndex(indexName);
|
|
75
|
+
if (entry.sync === null) throw notEnabled(indexName);
|
|
76
|
+
const storage = syncStorageOf(core, indexName);
|
|
77
|
+
return withOpenIndex(
|
|
78
|
+
core,
|
|
79
|
+
indexName,
|
|
80
|
+
() => oneSyncChangeAtATime(core.indexRegistry, indexName, async () => {
|
|
81
|
+
const sync = core.requireIndex(indexName).sync;
|
|
82
|
+
if (sync === null) throw notEnabled(indexName);
|
|
83
|
+
if (!sync.active) {
|
|
84
|
+
const activated = { ...sync, active: true };
|
|
85
|
+
core.requireIndex(indexName).sync = activated;
|
|
86
|
+
try {
|
|
87
|
+
await core.durability?.manager.persistMetadata(indexName);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
core.requireIndex(indexName).sync = sync;
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const current = republish ? null : await storage.published(indexName);
|
|
94
|
+
if (current !== null) {
|
|
95
|
+
const unpin = storage.pin(current);
|
|
96
|
+
if (await epochOfSnapshot(current).catch(() => null) === sync.epoch) {
|
|
97
|
+
return { snapshot: current, epoch: sync.epoch, storage, unpin };
|
|
98
|
+
}
|
|
99
|
+
unpin();
|
|
100
|
+
}
|
|
101
|
+
const snapshot = await publishWithinAnalysis(core, storage, indexName);
|
|
102
|
+
return { snapshot, epoch: sync.epoch, storage, unpin: storage.pin(snapshot) };
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/engine/sync/retention.ts
|
|
108
|
+
var statesByCore = /* @__PURE__ */ new WeakMap();
|
|
109
|
+
function stateOf(core) {
|
|
110
|
+
let state = statesByCore.get(core);
|
|
111
|
+
if (state === void 0) {
|
|
112
|
+
state = { running: /* @__PURE__ */ new Map(), again: /* @__PURE__ */ new Set(), sweep: null };
|
|
113
|
+
statesByCore.set(core, state);
|
|
114
|
+
}
|
|
115
|
+
return state;
|
|
116
|
+
}
|
|
117
|
+
async function enforce(core, indexName) {
|
|
118
|
+
const sync = core.indexRegistry.get(indexName)?.sync ?? null;
|
|
119
|
+
const storage = core.durability?.manager.syncStorage?.();
|
|
120
|
+
if (sync === null || !sync.active || storage === void 0 || core.shutdownState.isShutdown) return;
|
|
121
|
+
const published = await storage.published(indexName);
|
|
122
|
+
const maxBytes = sync.historyMaxBytes ?? (published === null ? Number.POSITIVE_INFINITY : publishedArchiveLayout(indexName, published, storage).byteLength);
|
|
123
|
+
const publishesSnapshots = core.mutationCtx.capacityScope !== "partition";
|
|
124
|
+
await storage.enforceHistoryLimits(
|
|
125
|
+
indexName,
|
|
126
|
+
{ maxAgeMs: sync.historyMaxAgeMs ?? DEFAULT_HISTORY_MAX_AGE_MS, maxBytes },
|
|
127
|
+
publishesSnapshots ? async () => {
|
|
128
|
+
const { unpin } = await publishedSyncSnapshot(core, indexName, true);
|
|
129
|
+
unpin();
|
|
130
|
+
} : null,
|
|
131
|
+
Date.now()
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function scheduleSyncRetention(core, indexName) {
|
|
135
|
+
const state = stateOf(core);
|
|
136
|
+
startSyncRetentionSweep(core);
|
|
137
|
+
if (state.running.has(indexName)) {
|
|
138
|
+
state.again.add(indexName);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const run = (async () => {
|
|
142
|
+
do {
|
|
143
|
+
state.again.delete(indexName);
|
|
144
|
+
await enforce(core, indexName);
|
|
145
|
+
} while (state.again.has(indexName));
|
|
146
|
+
})().catch((error) => {
|
|
147
|
+
emitEngineEvent(core.eventHandlers, "durabilityError", {
|
|
148
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
149
|
+
});
|
|
150
|
+
}).finally(() => state.running.delete(indexName));
|
|
151
|
+
state.running.set(indexName, run);
|
|
152
|
+
}
|
|
153
|
+
function startSyncRetentionSweep(core) {
|
|
154
|
+
const state = stateOf(core);
|
|
155
|
+
if (state.sweep !== null) return;
|
|
156
|
+
state.sweep = unrefInterval(() => {
|
|
157
|
+
if (core.shutdownState.isShutdown) {
|
|
158
|
+
if (state.sweep !== null) clearInterval(state.sweep);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
for (const [indexName, entry] of core.indexRegistry) {
|
|
162
|
+
if (entry.sync?.active === true) scheduleSyncRetention(core, indexName);
|
|
163
|
+
}
|
|
164
|
+
}, HISTORY_SWEEP_INTERVAL_MS);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { publishedArchiveLayout, publishedSyncSnapshot, scheduleSyncRetention, startSyncRetentionSweep };
|