@delali/narsil 0.3.1-next.99 → 0.4.1-next.211
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/NOTICE +45 -0
- package/README.md +30 -11
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +101 -13
- package/dist/adapters/gcs.d.ts +49 -0
- package/dist/adapters/gcs.mjs +213 -0
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +2 -7
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/adapters/memory.mjs +5 -0
- package/dist/adapters/s3.d.ts +53 -0
- package/dist/adapters/s3.mjs +263 -0
- package/dist/{adapters-BQFQ4PRz.d.ts → adapters-pljAqmrC.d.ts} +33 -0
- package/dist/browser/chunk-4E5APHTM.mjs +1459 -0
- package/dist/browser/chunk-NDYADQ4Y.mjs +23426 -0
- package/dist/browser/chunk-QAOVAYAG.mjs +564 -0
- package/dist/browser/chunk-WC2DEXWU.mjs +29 -0
- package/dist/browser/chunk-YINZFPLT.mjs +1239 -0
- package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
- package/dist/browser/{chunk-Z7QH2XHB.mjs → core-leaf-HWAXCEWX.mjs} +3987 -2103
- package/dist/browser/custom-token-results-R5BIX7SL.mjs +59 -0
- package/dist/browser/digest-leaf-64IPRPZD.mjs +151 -0
- package/dist/browser/durability-config-75NSFCQN.mjs +97 -0
- package/dist/browser/embed-GG6PS3EA.mjs +264 -0
- package/dist/browser/geo-index-GNHY4PUB.mjs +1484 -0
- package/dist/browser/gzip-JF3S6PPT.mjs +31 -0
- package/dist/browser/module-ZZTNG5JZ.mjs +5762 -0
- package/dist/browser/msgpack-leaf-44XNWSSY.mjs +302 -0
- package/dist/browser/optional-reads-XMVPG6HG.mjs +3230 -0
- package/dist/browser/optional-writes-76DWMRQH.mjs +3603 -0
- package/dist/browser/phrase-module-6UGFVW5J.mjs +617 -0
- package/dist/browser/resolve-vector-text-XRR2OVHE.mjs +85 -0
- package/dist/browser/restore-queue-SG5O735W.mjs +196 -0
- package/dist/browser/{runtime-NYE5TB6O.mjs → runtime-OMKE7DF4.mjs} +83 -25
- package/dist/browser/segment-codec-leaf-A427QJUX.mjs +554 -0
- package/dist/browser/segment-merge-leaf-7BZ54JPI.mjs +1636 -0
- package/dist/browser/storage-leaf-5UTR5K7J.mjs +19829 -0
- package/dist/browser/store-leaf-3L33V35P.mjs +2070 -0
- package/dist/browser/suggestions-leaf-UBNDVKBD.mjs +1430 -0
- package/dist/browser/worker-copies-JXSGYR5X.mjs +2951 -0
- package/dist/{capabilities-BTTIs96E.d.ts → capabilities-DMte5K9_.d.ts} +162 -18
- package/dist/chunk-2AFZE7Y3.mjs +72 -0
- package/dist/chunk-2CKDCC65.mjs +47 -0
- package/dist/chunk-3ECIRFS5.mjs +61 -0
- package/dist/chunk-44W3CBNG.mjs +7 -0
- package/dist/chunk-4H4RG2FR.mjs +13 -0
- package/dist/chunk-4PY4JYMY.mjs +11 -0
- package/dist/chunk-4ZPVAHWF.mjs +1289 -0
- package/dist/chunk-5EI5CXO6.mjs +197 -0
- package/dist/chunk-5F5MXWS5.mjs +283 -0
- package/dist/{chunk-OHP7QR33.mjs → chunk-5FLRXF73.mjs} +25 -4
- package/dist/chunk-6FOENO4E.mjs +273 -0
- package/dist/chunk-6GHX35ZM.mjs +108 -0
- package/dist/chunk-6MSZ543Y.mjs +32 -0
- package/dist/chunk-6N6HHBCQ.mjs +4596 -0
- package/dist/{chunk-LXPIXDUJ.mjs → chunk-7P5YWDRQ.mjs} +403 -169
- package/dist/{chunk-TGP5M5R7.mjs → chunk-7T4LAYT4.mjs} +1 -1
- package/dist/{chunk-GGSH6KBQ.mjs → chunk-ASZLNVWW.mjs} +23 -3
- package/dist/chunk-AVBPB3MI.mjs +602 -0
- package/dist/{chunk-UCDF35PU.mjs → chunk-AVGUEEQ3.mjs} +494 -245
- package/dist/chunk-BUMREPLU.mjs +15 -0
- package/dist/chunk-BY6NALRK.mjs +31921 -0
- package/dist/chunk-C4ZMXXTL.mjs +92 -0
- package/dist/{chunk-2WYMG3OZ.mjs → chunk-C74KPRR7.mjs} +274 -19
- package/dist/{chunk-RSRVGAIQ.mjs → chunk-D456ZFPQ.mjs} +3 -2
- package/dist/chunk-DXZ6JDWG.mjs +797 -0
- package/dist/chunk-FJXJZUWF.mjs +209 -0
- package/dist/chunk-FS3HPPSC.mjs +212 -0
- package/dist/chunk-FT4KLZXW.mjs +1164 -0
- package/dist/chunk-GR5GMFJJ.mjs +104 -0
- package/dist/chunk-GXCDWLQI.mjs +193 -0
- package/dist/chunk-GXED6R3Q.mjs +271 -0
- package/dist/chunk-HLPRHOSO.mjs +17 -0
- package/dist/chunk-IL5DRCNU.mjs +3041 -0
- package/dist/{chunk-P36MUFEJ.mjs → chunk-JDDXV6UF.mjs} +2 -1
- package/dist/chunk-K5HSUPYS.mjs +11 -0
- package/dist/chunk-KYIRXTCA.mjs +100 -0
- package/dist/chunk-LFXS6OF7.mjs +289 -0
- package/dist/chunk-LNGE7SLY.mjs +151 -0
- package/dist/chunk-M2Z5WVWW.mjs +194 -0
- package/dist/{chunk-45AVKHMJ.mjs → chunk-M3B7SGJB.mjs} +63 -50
- package/dist/chunk-M3OW2XSP.mjs +40 -0
- package/dist/chunk-MFPSQZ6P.mjs +127 -0
- package/dist/chunk-MRCJBWJZ.mjs +1292 -0
- package/dist/chunk-MSIN4NM3.mjs +25 -0
- package/dist/chunk-MW3CJVGP.mjs +219 -0
- package/dist/chunk-MYM6CAVK.mjs +76 -0
- package/dist/chunk-NJJN4FMM.mjs +84 -0
- package/dist/chunk-NM7I3BM7.mjs +59 -0
- package/dist/chunk-OIJ64LGT.mjs +19 -0
- package/dist/{chunk-K7D4ZTSW.mjs → chunk-P4F4UWLC.mjs} +1 -1
- package/dist/chunk-Q2AP2FSN.mjs +15 -0
- package/dist/chunk-R2PJKSNL.mjs +54 -0
- package/dist/{chunk-HXJBSHXF.mjs → chunk-R724DJSG.mjs} +5056 -2619
- package/dist/chunk-S2POFTLN.mjs +10 -0
- package/dist/chunk-S5QMWECL.mjs +7 -0
- package/dist/chunk-SLAC5PAB.mjs +5008 -0
- package/dist/chunk-T4HMSZCX.mjs +5 -0
- package/dist/chunk-TACP6VK6.mjs +111 -0
- package/dist/chunk-TGPKS2UM.mjs +125 -0
- package/dist/chunk-TKKXPKEO.mjs +979 -0
- package/dist/chunk-V6EUBAIT.mjs +19 -0
- package/dist/chunk-XL56L4IR.mjs +228 -0
- package/dist/chunk-XQIAMDAG.mjs +3076 -0
- package/dist/chunk-YTUZ4R22.mjs +1063 -0
- package/dist/{chunk-KV3AZFT3.mjs → chunk-ZKOQR7EA.mjs} +45 -1
- package/dist/chunk-ZPJFGGGI.mjs +638 -0
- package/dist/chunk-ZXX5GZEX.mjs +17 -0
- package/dist/{client-i9eLJrw5.d.ts → client-BKqtl0_V.d.ts} +442 -22
- package/dist/client.d.ts +11 -10
- package/dist/client.mjs +8 -898
- package/dist/config-Bnl7L-0H.d.ts +608 -0
- package/dist/{config-P__Diiy4.d.ts → config-CJ-jfI0a.d.ts} +119 -9
- package/dist/core-leaf-6JVHEVFB.mjs +8 -0
- package/dist/custom-token-results-NXHBVY7U.mjs +59 -0
- package/dist/digest-leaf-KXBGKYHZ.mjs +1 -0
- package/dist/direct-executor-V3WOYU2Y.mjs +17 -0
- package/dist/distribution/coordinator/etcd.d.ts +63 -7
- package/dist/distribution/coordinator/etcd.mjs +725 -81
- package/dist/distribution/coordinator/in-memory.d.ts +3 -3
- package/dist/distribution/coordinator/in-memory.mjs +65 -10
- package/dist/distribution/transport/grpc.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +39 -10
- package/dist/distribution/transport/in-memory.d.ts +2 -2
- package/dist/distribution/transport/in-memory.mjs +9 -6
- package/dist/distribution/transport/tcp.d.ts +2 -2
- package/dist/distribution/transport/tcp.mjs +20 -15
- package/dist/distribution.d.ts +267 -56
- package/dist/distribution.mjs +23156 -11362
- package/dist/durability-config-VWS2K24E.mjs +96 -0
- package/dist/embed-4PHHKGBK.mjs +263 -0
- package/dist/embeddings/openai.d.ts +1 -1
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{memory-CUEDwr-F.d.ts → engine-qjAxJSKk.d.ts} +2254 -1123
- package/dist/geo-index-2ZMMWWSK.mjs +1484 -0
- package/dist/gzip-2UCZW2MM.mjs +31 -0
- package/dist/{index-lcdGLyJH.d.ts → index-B_vmxpgW.d.ts} +260 -102
- package/dist/index.browser.mjs +4 -4
- package/dist/index.d.ts +2133 -57
- package/dist/index.mjs +16 -32
- package/dist/index.react-native.mjs +12 -0
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/filesystem.mjs +1 -2
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/languages/albanian.mjs +1 -1
- package/dist/languages/amharic.mjs +1 -1
- package/dist/languages/arabic.mjs +1 -1
- package/dist/languages/armenian.mjs +1 -1
- package/dist/languages/azerbaijani.mjs +1 -1
- package/dist/languages/bambara.mjs +1 -1
- package/dist/languages/basque.mjs +1 -1
- package/dist/languages/belarusian.mjs +1 -1
- package/dist/languages/bengali.mjs +1 -1
- package/dist/languages/bosnian.mjs +1 -1
- package/dist/languages/breton.mjs +1 -1
- package/dist/languages/bulgarian.mjs +1 -1
- package/dist/languages/burmese.mjs +1 -1
- package/dist/languages/catalan.mjs +1 -1
- package/dist/languages/chinese.mjs +1 -1
- package/dist/languages/croatian.mjs +1 -1
- package/dist/languages/czech.mjs +1 -1
- package/dist/languages/dagbani.mjs +1 -1
- package/dist/languages/danish.mjs +1 -1
- package/dist/languages/dutch.mjs +1 -1
- package/dist/languages/english.mjs +1 -1
- package/dist/languages/esperanto.mjs +1 -1
- package/dist/languages/estonian.mjs +1 -1
- package/dist/languages/ewe.mjs +1 -1
- package/dist/languages/faroese.mjs +1 -1
- package/dist/languages/fijian.mjs +1 -1
- package/dist/languages/finnish.mjs +1 -1
- package/dist/languages/french.mjs +1 -1
- package/dist/languages/ga.mjs +1 -1
- package/dist/languages/galician.mjs +1 -1
- package/dist/languages/georgian.mjs +1 -1
- package/dist/languages/german.mjs +1 -1
- package/dist/languages/greek.mjs +1 -1
- package/dist/languages/guarani.mjs +1 -1
- package/dist/languages/gujarati.mjs +1 -1
- package/dist/languages/haitian-creole.mjs +1 -1
- package/dist/languages/hausa.mjs +1 -1
- package/dist/languages/hawaiian.mjs +1 -1
- package/dist/languages/hebrew.mjs +1 -1
- package/dist/languages/hindi.mjs +1 -1
- package/dist/languages/hungarian.mjs +1 -1
- package/dist/languages/icelandic.mjs +1 -1
- package/dist/languages/igbo.mjs +1 -1
- package/dist/languages/indonesian.mjs +1 -1
- package/dist/languages/irish.mjs +1 -1
- package/dist/languages/italian.mjs +1 -1
- package/dist/languages/japanese.mjs +1 -1
- package/dist/languages/kannada.mjs +1 -1
- package/dist/languages/kazakh.mjs +1 -1
- package/dist/languages/khmer.mjs +1 -1
- package/dist/languages/kinyarwanda.mjs +1 -1
- package/dist/languages/kirundi.mjs +1 -1
- package/dist/languages/korean.mjs +1 -1
- package/dist/languages/kurmanji.mjs +1 -1
- package/dist/languages/kyrgyz.mjs +1 -1
- package/dist/languages/lao.mjs +1 -1
- package/dist/languages/latin.mjs +1 -1
- package/dist/languages/latvian.mjs +1 -1
- package/dist/languages/lingala.mjs +1 -1
- package/dist/languages/lithuanian.mjs +1 -1
- package/dist/languages/luxembourgish.mjs +1 -1
- package/dist/languages/macedonian.mjs +1 -1
- package/dist/languages/malagasy.mjs +1 -1
- package/dist/languages/malay.mjs +1 -1
- package/dist/languages/malayalam.mjs +1 -1
- package/dist/languages/maltese.mjs +1 -1
- package/dist/languages/maori.mjs +1 -1
- package/dist/languages/marathi.mjs +1 -1
- package/dist/languages/nepali.mjs +1 -1
- package/dist/languages/norwegian.mjs +1 -1
- package/dist/languages/oromo.mjs +1 -1
- package/dist/languages/persian.mjs +1 -1
- package/dist/languages/polish.mjs +1 -1
- package/dist/languages/portuguese.mjs +1 -1
- package/dist/languages/punjabi.mjs +1 -1
- package/dist/languages/romanian.mjs +1 -1
- package/dist/languages/russian.mjs +1 -1
- package/dist/languages/samoan.mjs +1 -1
- package/dist/languages/sanskrit.mjs +1 -1
- package/dist/languages/scottish-gaelic.mjs +1 -1
- package/dist/languages/serbian.mjs +1 -1
- package/dist/languages/shona.mjs +1 -1
- package/dist/languages/sinhala.mjs +1 -1
- package/dist/languages/slovak.mjs +1 -1
- package/dist/languages/slovenian.mjs +1 -1
- package/dist/languages/sorani.mjs +1 -1
- package/dist/languages/spanish.mjs +1 -1
- package/dist/languages/swahili.mjs +1 -1
- package/dist/languages/swedish.mjs +1 -1
- package/dist/languages/tagalog.mjs +1 -1
- package/dist/languages/tamil.mjs +1 -1
- package/dist/languages/tatar.mjs +1 -1
- package/dist/languages/telugu.mjs +1 -1
- package/dist/languages/thai.mjs +1 -1
- package/dist/languages/tibetan.mjs +1 -1
- package/dist/languages/tigrinya.mjs +1 -1
- package/dist/languages/tongan.mjs +1 -1
- package/dist/languages/turkish.mjs +1 -1
- package/dist/languages/twi.mjs +1 -1
- package/dist/languages/ukrainian.mjs +1 -1
- package/dist/languages/urdu.mjs +1 -1
- package/dist/languages/vietnamese.mjs +1 -1
- package/dist/languages/welsh.mjs +1 -1
- package/dist/languages/wolof.mjs +1 -1
- package/dist/languages/xhosa.mjs +1 -1
- package/dist/languages/yoruba.mjs +1 -1
- package/dist/languages/zulu.mjs +1 -1
- package/dist/long-query-thread-UCRK7MSI.mjs +154 -0
- package/dist/module-5ZSLUQII.mjs +3729 -0
- package/dist/msgpack-leaf-H5ZYW7S7.mjs +9 -0
- package/dist/optional-reads-5HFMF2QZ.mjs +3373 -0
- package/dist/optional-writes-4UOQKETU.mjs +247 -0
- package/dist/paged-partition-archive-BBRLZCIF.mjs +253 -0
- package/dist/partial-words.browser.mjs +1650 -0
- package/dist/partial-words.mjs +17 -11
- package/dist/{chunk-ASY5PHYI.mjs → pattern.browser.mjs} +253 -311
- package/dist/pattern.mjs +6 -7
- package/dist/persistence/durability/checkpoint-worker.d.ts +93 -25
- package/dist/persistence/durability/checkpoint-worker.mjs +51 -41
- package/dist/phrase-module-EFESWOCR.mjs +635 -0
- package/dist/query-actions-HMJUVWGT.mjs +119 -0
- package/dist/query-suggestions/merge-worker.d.ts +55 -0
- package/dist/query-suggestions/merge-worker.mjs +53 -0
- package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
- package/dist/query-suggestions.browser.mjs +47 -0
- package/dist/query-suggestions.d.ts +20 -0
- package/dist/query-suggestions.mjs +19 -0
- package/dist/react-native/chunks/chunk-3OEFSHVV.mjs +970 -0
- package/dist/{browser/chunk-RELZRJNR.mjs → react-native/chunks/chunk-43R4GCM7.mjs} +49 -50
- package/dist/react-native/chunks/chunk-AKRYHAVG.mjs +6729 -0
- package/dist/react-native/chunks/chunk-CW2ZFXSE.mjs +14 -0
- package/dist/react-native/chunks/chunk-G3WCDTOF.mjs +29640 -0
- package/dist/react-native/chunks/chunk-GXXHHA2T.mjs +212 -0
- package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
- package/dist/react-native/chunks/chunk-HQEVQEDJ.mjs +52 -0
- package/dist/react-native/chunks/chunk-HRDMIQ63.mjs +131 -0
- package/dist/react-native/chunks/chunk-HTBY4GON.mjs +565 -0
- package/dist/react-native/chunks/chunk-LX62Y4B5.mjs +61 -0
- package/dist/react-native/chunks/chunk-MRH36RN3.mjs +902 -0
- package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
- package/dist/react-native/chunks/chunk-UE4ANHSX.mjs +127 -0
- package/dist/react-native/chunks/chunk-UNZPWLVL.mjs +1063 -0
- package/dist/react-native/chunks/chunk-UO44MA5M.mjs +232 -0
- package/dist/react-native/chunks/chunk-UYKIV2KT.mjs +42 -0
- package/dist/react-native/chunks/chunk-VUJCSQG5.mjs +11 -0
- package/dist/react-native/chunks/chunk-WVHF4ZAK.mjs +802 -0
- package/dist/react-native/chunks/chunk-ZUJCUPVS.mjs +54 -0
- package/dist/react-native/chunks/core-leaf-S2KNBWDY.mjs +7 -0
- package/dist/react-native/chunks/custom-token-results-3OZEMRE7.mjs +59 -0
- package/dist/react-native/chunks/digest-leaf-X6OIFDIU.mjs +1 -0
- package/dist/react-native/chunks/durability-config-FCSD4MXY.mjs +96 -0
- package/dist/react-native/chunks/embed-HA2I7RCF.mjs +263 -0
- package/dist/react-native/chunks/geo-index-QEYKEVPH.mjs +1484 -0
- package/dist/react-native/chunks/gzip.react-native-CVM4NQG2.mjs +12 -0
- package/dist/react-native/chunks/module-FMBX75GP.mjs +5209 -0
- package/dist/react-native/chunks/msgpack-leaf-JMNGSTRW.mjs +7 -0
- package/dist/react-native/chunks/optional-reads-AFPO2FEB.mjs +3364 -0
- package/dist/react-native/chunks/optional-writes-XOH25XZI.mjs +296 -0
- package/dist/react-native/chunks/phrase-module-IGYBK7XH.mjs +636 -0
- package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
- package/dist/react-native/chunks/resolve-vector-text-GE2CRJKI.mjs +84 -0
- package/dist/react-native/chunks/restore-queue-LLNMYB4Z.mjs +187 -0
- package/dist/react-native/chunks/runtime-UOHD2XUJ.mjs +615 -0
- package/dist/react-native/chunks/segment-codec-leaf-VR6O5GLC.mjs +13 -0
- package/dist/react-native/chunks/segment-merge-leaf-LLMWU4EW.mjs +14 -0
- package/dist/react-native/chunks/storage-leaf-JD7PIDO4.mjs +19633 -0
- package/dist/react-native/chunks/store-leaf-4UVCMYGN.mjs +15 -0
- package/dist/react-native/chunks/suggestions-leaf-J5VT5RHY.mjs +1321 -0
- package/dist/react-native/chunks/worker-copies-ZYHY7FKJ.mjs +2831 -0
- package/dist/react-native/partial-words.mjs +1658 -0
- package/dist/react-native/pattern.mjs +2570 -0
- package/dist/react-native/query-suggestions.mjs +55 -0
- package/dist/react-native/sync.mjs +2759 -0
- package/dist/react-native/synonyms.mjs +676 -0
- package/dist/react.d.ts +12 -8
- package/dist/react.mjs +45 -1
- package/dist/{rerank-NWTKK636.mjs → rerank-RI2PMNOD.mjs} +22 -12
- package/dist/rerankers/http.d.ts +1 -1
- package/dist/rerankers/http.mjs +2 -2
- package/dist/resolve-vector-text-OD4J3WHF.mjs +3 -0
- package/dist/restore-queue-PCKWDAKQ.mjs +192 -0
- package/dist/runtime-USQYKN3I.mjs +615 -0
- package/dist/{schema-4W_7tk1f.d.ts → schema-CzG9OUw5.d.ts} +70 -30
- package/dist/segment-codec-leaf-QJM7I6QG.mjs +18 -0
- package/dist/segment-merge-leaf-4BJGIJHY.mjs +18 -0
- package/dist/server.d.ts +348 -22
- package/dist/server.mjs +2211 -327
- package/dist/storage-leaf-GRRRI7UV.mjs +5962 -0
- package/dist/store-leaf-6VMMSVBE.mjs +20 -0
- package/dist/stored-values-BWIMpiT_.d.ts +25 -0
- package/dist/suggestions-leaf-4KPTMPTL.mjs +54 -0
- package/dist/sync/filesystem.d.ts +30 -0
- package/dist/sync/filesystem.mjs +288 -0
- package/dist/sync/indexeddb.browser.mjs +287 -0
- package/dist/sync/indexeddb.d.ts +30 -0
- package/dist/sync/indexeddb.mjs +242 -0
- package/dist/sync.browser.mjs +1271 -0
- package/dist/sync.d.ts +23 -0
- package/dist/sync.mjs +2712 -0
- package/dist/synonyms.browser.mjs +658 -0
- package/dist/synonyms.mjs +17 -7
- package/dist/tasks-65b6t6lk.d.ts +782 -0
- package/dist/thread-UJ3W5LVI.mjs +31 -0
- package/dist/{types-B3b68nfF.d.ts → types-Ck97nB3D.d.ts} +1 -1
- package/dist/types-CpCg-Gq-.d.ts +227 -0
- package/dist/{types-Cb9kiY5P.d.ts → types-DvncmvuQ.d.ts} +12 -1
- package/dist/vector/search-worker.d.ts +10 -2
- package/dist/vector/search-worker.mjs +11 -11
- package/dist/worker-copies-YSXZXIGC.mjs +2232 -0
- package/dist/workers/entry.mjs +75 -15
- package/openapi.json +6840 -0
- package/package.json +404 -19
- package/dist/browser/chunk-CN4I4FZU.mjs +0 -602
- package/dist/browser/chunk-HOZW3PKP.mjs +0 -9
- package/dist/browser/chunk-JPTQZWJQ.mjs +0 -10
- package/dist/browser/chunk-LD55ZGU3.mjs +0 -347
- package/dist/browser/chunk-NAFT3K6X.mjs +0 -24546
- package/dist/browser/chunk-NNG3EEB6.mjs +0 -2728
- package/dist/browser/chunk-QWES44AW.mjs +0 -473
- package/dist/browser/durability-wiring-PY3L7DES.mjs +0 -3679
- package/dist/browser/module-PDXYHT75.mjs +0 -2822
- package/dist/browser/release-76MXRPGV.mjs +0 -33
- package/dist/browser/restore-queue-DVIYJ7RU.mjs +0 -35
- package/dist/browser/snapshot-J57MZK6L.mjs +0 -1207
- package/dist/browser/write-L7FAQA47.mjs +0 -208
- package/dist/chunk-37CD3OKS.mjs +0 -87
- package/dist/chunk-5XNIRLFC.mjs +0 -96
- package/dist/chunk-7X5JST5L.mjs +0 -114
- package/dist/chunk-AV4IJKD2.mjs +0 -35
- package/dist/chunk-AY3AQ3UH.mjs +0 -73
- package/dist/chunk-BKB3XTMI.mjs +0 -707
- package/dist/chunk-C7SLA6CM.mjs +0 -19
- package/dist/chunk-COVCQ73F.mjs +0 -587
- package/dist/chunk-DJHHF2L5.mjs +0 -17
- package/dist/chunk-E74YLAIG.mjs +0 -24
- package/dist/chunk-FMWRCP2C.mjs +0 -57
- package/dist/chunk-GES7U2PM.mjs +0 -68
- package/dist/chunk-HJSN7UYG.mjs +0 -10
- package/dist/chunk-JFRNNBOM.mjs +0 -35
- package/dist/chunk-K25LZA54.mjs +0 -8484
- package/dist/chunk-KEHK2O6P.mjs +0 -13
- package/dist/chunk-KOKM4PQN.mjs +0 -52
- package/dist/chunk-KZ3NX2P7.mjs +0 -21
- package/dist/chunk-L3L5YFXC.mjs +0 -614
- package/dist/chunk-L5ORED7V.mjs +0 -25
- package/dist/chunk-LH4NZNJJ.mjs +0 -1731
- package/dist/chunk-LU2CE5AE.mjs +0 -507
- package/dist/chunk-LXWDQLTW.mjs +0 -30
- package/dist/chunk-MHOSCQCQ.mjs +0 -948
- package/dist/chunk-NKRBEGJZ.mjs +0 -1705
- package/dist/chunk-NTRMFARG.mjs +0 -462
- package/dist/chunk-NW4XDSP2.mjs +0 -212
- package/dist/chunk-OOEXLUGR.mjs +0 -117
- package/dist/chunk-ORBLD3EL.mjs +0 -6
- package/dist/chunk-OWNZYMRE.mjs +0 -3591
- package/dist/chunk-PPY2GSIB.mjs +0 -44
- package/dist/chunk-QY7GC2MW.mjs +0 -33
- package/dist/chunk-R6A773WK.mjs +0 -226
- package/dist/chunk-R6PR4WYZ.mjs +0 -68
- package/dist/chunk-R7EEKAJE.mjs +0 -593
- package/dist/chunk-RONEOEON.mjs +0 -426
- package/dist/chunk-VWULPWRJ.mjs +0 -7469
- package/dist/chunk-WCJKUGHB.mjs +0 -262
- package/dist/chunk-WQBCBKY3.mjs +0 -8
- package/dist/chunk-X5CV2E2B.mjs +0 -1
- package/dist/chunk-YA7XLE2R.mjs +0 -1256
- package/dist/chunk-YTJCGKM4.mjs +0 -56
- package/dist/chunk-ZG477IPV.mjs +0 -526
- package/dist/chunk-ZYNAMIYX.mjs +0 -113
- package/dist/config-BGB_fDtq.d.ts +0 -237
- package/dist/direct-executor-CXZ66ACP.mjs +0 -22
- package/dist/durability-wiring-QTHOGFMZ.mjs +0 -3229
- package/dist/engine-BGCEm9E_.d.ts +0 -577
- package/dist/module-3NONKBZX.mjs +0 -1860
- package/dist/release-BH3DKW3T.mjs +0 -33
- package/dist/restore-queue-JPRBUYII.mjs +0 -35
- package/dist/runtime-ZKYZFJJC.mjs +0 -177
- package/dist/snapshot-HOGXNO5W.mjs +0 -793
- package/dist/tasks-HG3rlxx6.d.ts +0 -302
- package/dist/thread-B657LQXK.mjs +0 -692
- package/dist/write-XLIGTXBU.mjs +0 -238
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { MAX_FILE_BYTES } from './chunk-4PY4JYMY.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
3
|
+
|
|
4
|
+
// src/persistence/object-store.ts
|
|
5
|
+
function objectKeyPrefix(prefix, adapter) {
|
|
6
|
+
if (prefix === void 0 || prefix.length === 0) return "";
|
|
7
|
+
if (prefix.startsWith("/") || prefix.includes("\0")) {
|
|
8
|
+
throw new NarsilError(
|
|
9
|
+
ErrorCodes.CONFIG_INVALID,
|
|
10
|
+
`The ${adapter} key prefix must not start with '/' or hold a null byte`,
|
|
11
|
+
{ prefix }
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return prefix.endsWith("/") ? prefix : `${prefix}/`;
|
|
15
|
+
}
|
|
16
|
+
function requireBucket(bucket, adapter) {
|
|
17
|
+
if (typeof bucket !== "string" || bucket.trim().length === 0) {
|
|
18
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${adapter} adapter needs a bucket name`, {});
|
|
19
|
+
}
|
|
20
|
+
return bucket;
|
|
21
|
+
}
|
|
22
|
+
function requireObjectKey(key) {
|
|
23
|
+
if (key.length === 0 || key.includes("\0")) {
|
|
24
|
+
throw new NarsilError(
|
|
25
|
+
ErrorCodes.PERSISTENCE_SAVE_FAILED,
|
|
26
|
+
"Invalid key: a key must be non-empty and hold no null byte",
|
|
27
|
+
{
|
|
28
|
+
key
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function refuseOversizedObject(key, bytes) {
|
|
34
|
+
if (bytes > MAX_FILE_BYTES) {
|
|
35
|
+
throw new NarsilError(
|
|
36
|
+
ErrorCodes.PERSISTENCE_LOAD_FAILED,
|
|
37
|
+
`The object "${key}" holds ${bytes} bytes, which passes the ${MAX_FILE_BYTES}-byte limit of one stored file`,
|
|
38
|
+
{ key, bytes, limit: MAX_FILE_BYTES }
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function objectStoreFailure(code, action, key, error) {
|
|
43
|
+
if (error instanceof NarsilError) return error;
|
|
44
|
+
const cause = error instanceof Error ? error.message : String(error);
|
|
45
|
+
return new NarsilError(code, `The object store could not ${action} "${key}": ${cause}`, { key, cause });
|
|
46
|
+
}
|
|
47
|
+
function lengthMismatch(key, length, yielded) {
|
|
48
|
+
return new NarsilError(
|
|
49
|
+
ErrorCodes.PERSISTENCE_SAVE_FAILED,
|
|
50
|
+
`The stream for "${key}" yielded ${yielded} bytes where the caller declared ${length}`,
|
|
51
|
+
{ key, length, yielded }
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function requireStreamLength(key, length) {
|
|
55
|
+
if (!Number.isSafeInteger(length) || length < 0 || length > MAX_FILE_BYTES) {
|
|
56
|
+
throw new NarsilError(
|
|
57
|
+
ErrorCodes.PERSISTENCE_SAVE_FAILED,
|
|
58
|
+
`A stream for "${key}" declares ${length} bytes, which is not a byte count from 0 to ${MAX_FILE_BYTES}`,
|
|
59
|
+
{ key, length }
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function* countedChunks(key, data, length) {
|
|
64
|
+
let yielded = 0;
|
|
65
|
+
for await (const chunk of data) {
|
|
66
|
+
yielded += chunk.byteLength;
|
|
67
|
+
if (yielded > length) throw lengthMismatch(key, length, yielded);
|
|
68
|
+
if (chunk.byteLength > 0) yield chunk;
|
|
69
|
+
}
|
|
70
|
+
if (yielded !== length) throw lengthMismatch(key, length, yielded);
|
|
71
|
+
}
|
|
72
|
+
async function* partsOf(chunks, partBytes) {
|
|
73
|
+
let pending = [];
|
|
74
|
+
let pendingBytes = 0;
|
|
75
|
+
for await (const chunk of chunks) {
|
|
76
|
+
pending.push(chunk);
|
|
77
|
+
pendingBytes += chunk.byteLength;
|
|
78
|
+
if (pendingBytes < partBytes) continue;
|
|
79
|
+
yield joinChunks(pending, pendingBytes);
|
|
80
|
+
pending = [];
|
|
81
|
+
pendingBytes = 0;
|
|
82
|
+
}
|
|
83
|
+
if (pendingBytes > 0 || pending.length > 0) yield joinChunks(pending, pendingBytes);
|
|
84
|
+
}
|
|
85
|
+
async function readWhole(chunks, length) {
|
|
86
|
+
const joined = new Uint8Array(length);
|
|
87
|
+
let offset = 0;
|
|
88
|
+
for await (const chunk of chunks) {
|
|
89
|
+
joined.set(chunk, offset);
|
|
90
|
+
offset += chunk.byteLength;
|
|
91
|
+
}
|
|
92
|
+
return joined;
|
|
93
|
+
}
|
|
94
|
+
function joinChunks(chunks, total) {
|
|
95
|
+
const joined = new Uint8Array(total);
|
|
96
|
+
let offset = 0;
|
|
97
|
+
for (const chunk of chunks) {
|
|
98
|
+
joined.set(chunk, offset);
|
|
99
|
+
offset += chunk.byteLength;
|
|
100
|
+
}
|
|
101
|
+
return joined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { countedChunks, joinChunks, objectKeyPrefix, objectStoreFailure, partsOf, readWhole, refuseOversizedObject, requireBucket, requireObjectKey, requireStreamLength };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER } from './chunk-4PY4JYMY.mjs';
|
|
2
|
+
import { Decoder as Decoder$1, ExtensionCodec } from '@msgpack/msgpack';
|
|
3
|
+
|
|
4
|
+
// src/serialization/msgpack-host.ts
|
|
5
|
+
function bindMsgpackHost(_host) {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// src/serialization/msgpack-header.ts
|
|
9
|
+
function headerAt(view, offset) {
|
|
10
|
+
if (offset >= view.byteLength) return null;
|
|
11
|
+
const tag = view.getUint8(offset);
|
|
12
|
+
if (tag <= 127 || tag >= 224) return { headerBytes: 1, bodyBytes: 0, children: 0 };
|
|
13
|
+
if (tag <= 143) return { headerBytes: 1, bodyBytes: 0, children: (tag & 15) * 2 };
|
|
14
|
+
if (tag <= 159) return { headerBytes: 1, bodyBytes: 0, children: tag & 15 };
|
|
15
|
+
if (tag <= 191) return { headerBytes: 1, bodyBytes: tag & 31, children: 0 };
|
|
16
|
+
const lengthBytes = LENGTH_BYTES_BY_TAG.get(tag);
|
|
17
|
+
if (lengthBytes !== void 0) {
|
|
18
|
+
if (offset + 1 + lengthBytes > view.byteLength) return null;
|
|
19
|
+
const length = lengthBytes === 1 ? view.getUint8(offset + 1) : lengthBytes === 2 ? view.getUint16(offset + 1, false) : view.getUint32(offset + 1, false);
|
|
20
|
+
const headerBytes = 1 + lengthBytes;
|
|
21
|
+
if (ARRAY_TAGS.has(tag)) return { headerBytes, bodyBytes: 0, children: length };
|
|
22
|
+
if (MAP_TAGS.has(tag)) return { headerBytes, bodyBytes: 0, children: length * 2 };
|
|
23
|
+
return { headerBytes, bodyBytes: length + (EXT_TAGS.has(tag) ? 1 : 0), children: 0 };
|
|
24
|
+
}
|
|
25
|
+
const fixedBytes = FIXED_BODY_BYTES_BY_TAG.get(tag);
|
|
26
|
+
return fixedBytes === void 0 ? null : { headerBytes: 1, bodyBytes: fixedBytes, children: 0 };
|
|
27
|
+
}
|
|
28
|
+
var LENGTH_BYTES_BY_TAG = /* @__PURE__ */ new Map([
|
|
29
|
+
[196, 1],
|
|
30
|
+
[197, 2],
|
|
31
|
+
[198, 4],
|
|
32
|
+
[199, 1],
|
|
33
|
+
[200, 2],
|
|
34
|
+
[201, 4],
|
|
35
|
+
[217, 1],
|
|
36
|
+
[218, 2],
|
|
37
|
+
[219, 4],
|
|
38
|
+
[220, 2],
|
|
39
|
+
[221, 4],
|
|
40
|
+
[222, 2],
|
|
41
|
+
[223, 4]
|
|
42
|
+
]);
|
|
43
|
+
var ARRAY_TAGS = /* @__PURE__ */ new Set([220, 221]);
|
|
44
|
+
var MAP_TAGS = /* @__PURE__ */ new Set([222, 223]);
|
|
45
|
+
var EXT_TAGS = /* @__PURE__ */ new Set([199, 200, 201]);
|
|
46
|
+
var FIXED_BODY_BYTES_BY_TAG = /* @__PURE__ */ new Map([
|
|
47
|
+
[192, 0],
|
|
48
|
+
[194, 0],
|
|
49
|
+
[195, 0],
|
|
50
|
+
[202, 4],
|
|
51
|
+
[203, 8],
|
|
52
|
+
[204, 1],
|
|
53
|
+
[205, 2],
|
|
54
|
+
[206, 4],
|
|
55
|
+
[207, 8],
|
|
56
|
+
[208, 1],
|
|
57
|
+
[209, 2],
|
|
58
|
+
[210, 4],
|
|
59
|
+
[211, 8],
|
|
60
|
+
[212, 2],
|
|
61
|
+
[213, 3],
|
|
62
|
+
[214, 5],
|
|
63
|
+
[215, 9],
|
|
64
|
+
[216, 17]
|
|
65
|
+
]);
|
|
66
|
+
var textDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
67
|
+
var keyDecoder = {
|
|
68
|
+
canBeCached: () => true,
|
|
69
|
+
decode: (bytes, offset, length) => textDecoder.decode(bytes.subarray(offset, offset + length))
|
|
70
|
+
};
|
|
71
|
+
function mayHoldByteOrderMark(bytes) {
|
|
72
|
+
for (let at = bytes.indexOf(239); at >= 0; at = bytes.indexOf(239, at + 1)) {
|
|
73
|
+
if (bytes[at + 1] === 187 && bytes[at + 2] === 191) return true;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
function scanStrings(bytes, start, strings, headerLimit) {
|
|
78
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
79
|
+
let at = start;
|
|
80
|
+
let pending = 1;
|
|
81
|
+
let affected = false;
|
|
82
|
+
let headers = 0;
|
|
83
|
+
while (pending > 0) {
|
|
84
|
+
if (headers >= headerLimit) return null;
|
|
85
|
+
headers += 1;
|
|
86
|
+
const header = headerAt(view, at);
|
|
87
|
+
if (header === null) throw new RangeError("Invalid MessagePack value header");
|
|
88
|
+
const tag = bytes[at];
|
|
89
|
+
at += header.headerBytes;
|
|
90
|
+
if (tag >= 160 && tag <= 191 || tag === 217 || tag === 218 || tag === 219) {
|
|
91
|
+
strings?.set(bytes.byteOffset + at, header.bodyBytes);
|
|
92
|
+
if (header.bodyBytes >= 3 && bytes[at] === 239 && bytes[at + 1] === 187 && bytes[at + 2] === 191)
|
|
93
|
+
affected = true;
|
|
94
|
+
}
|
|
95
|
+
at += header.bodyBytes;
|
|
96
|
+
pending += header.children - 1;
|
|
97
|
+
if (at > bytes.length || pending > bytes.length - at) throw new RangeError("Incomplete MessagePack value");
|
|
98
|
+
}
|
|
99
|
+
return { end: at, affected, headers };
|
|
100
|
+
}
|
|
101
|
+
function stringRegions(bytes, start) {
|
|
102
|
+
const strings = /* @__PURE__ */ new Map();
|
|
103
|
+
const scan = scanStrings(bytes, start, strings, Number.POSITIVE_INFINITY);
|
|
104
|
+
if (scan === null) throw new RangeError("Invalid MessagePack value header");
|
|
105
|
+
return { strings, end: scan.end, affected: scan.affected };
|
|
106
|
+
}
|
|
107
|
+
function holdsOnlyPlainStrings(bytes, holdsOneValue) {
|
|
108
|
+
let remaining = Math.ceil(bytes.length / BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER);
|
|
109
|
+
let at = 0;
|
|
110
|
+
try {
|
|
111
|
+
while (at < bytes.length) {
|
|
112
|
+
const scan = scanStrings(bytes, at, null, remaining);
|
|
113
|
+
if (scan === null || scan.affected) return false;
|
|
114
|
+
if (holdsOneValue) return scan.end === bytes.length;
|
|
115
|
+
remaining -= scan.headers;
|
|
116
|
+
at = scan.end;
|
|
117
|
+
}
|
|
118
|
+
return !holdsOneValue;
|
|
119
|
+
} catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function restoreStrings(value, bytes, strings, extensions) {
|
|
124
|
+
const pending = [];
|
|
125
|
+
function convert(entry) {
|
|
126
|
+
if (entry !== null && typeof entry === "object" && extensions.has(entry)) return entry;
|
|
127
|
+
if (entry instanceof Uint8Array) {
|
|
128
|
+
return entry.buffer === bytes.buffer && strings.get(entry.byteOffset) === entry.byteLength ? textDecoder.decode(entry) : entry;
|
|
129
|
+
}
|
|
130
|
+
if (Array.isArray(entry)) pending.push(entry);
|
|
131
|
+
else if (entry !== null && typeof entry === "object" && Object.getPrototypeOf(entry) === Object.prototype)
|
|
132
|
+
pending.push(entry);
|
|
133
|
+
return entry;
|
|
134
|
+
}
|
|
135
|
+
const result = convert(value);
|
|
136
|
+
while (pending.length > 0) {
|
|
137
|
+
const container = pending.pop();
|
|
138
|
+
if (container === void 0) break;
|
|
139
|
+
if (Array.isArray(container)) {
|
|
140
|
+
for (let at = 0; at < container.length; at++) container[at] = convert(container[at]);
|
|
141
|
+
} else {
|
|
142
|
+
for (const key of Object.keys(container)) container[key] = convert(container[key]);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
function losslessDecoder() {
|
|
148
|
+
const extensions = /* @__PURE__ */ new WeakSet();
|
|
149
|
+
const extensionCodec = {
|
|
150
|
+
tryToEncode: ExtensionCodec.defaultCodec.tryToEncode.bind(ExtensionCodec.defaultCodec),
|
|
151
|
+
decode(data, type) {
|
|
152
|
+
const value = ExtensionCodec.defaultCodec.decode(data, type, void 0);
|
|
153
|
+
if (value !== null && typeof value === "object") extensions.add(value);
|
|
154
|
+
return value;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
return { decoder: new Decoder$1({ rawStrings: true, keyDecoder, extensionCodec }), extensions };
|
|
158
|
+
}
|
|
159
|
+
var Decoder = class {
|
|
160
|
+
ordinary = new Decoder$1();
|
|
161
|
+
decode(bytes) {
|
|
162
|
+
if (!mayHoldByteOrderMark(bytes) || holdsOnlyPlainStrings(bytes, true)) return this.ordinary.decode(bytes);
|
|
163
|
+
const { strings, end, affected } = stringRegions(bytes, 0);
|
|
164
|
+
if (end !== bytes.length) throw new RangeError("Extra bytes after a MessagePack value");
|
|
165
|
+
if (!affected) return this.ordinary.decode(bytes);
|
|
166
|
+
const { decoder, extensions } = losslessDecoder();
|
|
167
|
+
return restoreStrings(decoder.decode(bytes), bytes, strings, extensions);
|
|
168
|
+
}
|
|
169
|
+
*decodeMulti(bytes) {
|
|
170
|
+
if (!mayHoldByteOrderMark(bytes) || holdsOnlyPlainStrings(bytes, false)) {
|
|
171
|
+
yield* this.ordinary.decodeMulti(bytes);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
let at = 0;
|
|
175
|
+
const { decoder, extensions } = losslessDecoder();
|
|
176
|
+
while (at < bytes.length) {
|
|
177
|
+
const { strings, end, affected } = stringRegions(bytes, at);
|
|
178
|
+
const value = (affected ? decoder : this.ordinary).decode(bytes.subarray(at, end));
|
|
179
|
+
at = end;
|
|
180
|
+
yield affected ? restoreStrings(value, bytes, strings, extensions) : value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
var sharedDecoder = null;
|
|
185
|
+
function decode(bytes) {
|
|
186
|
+
sharedDecoder ??= new Decoder();
|
|
187
|
+
return sharedDecoder.decode(bytes);
|
|
188
|
+
}
|
|
189
|
+
function decodeMulti(bytes) {
|
|
190
|
+
return new Decoder().decodeMulti(bytes);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export { Decoder, MAP_TAGS, bindMsgpackHost, decode, decodeMulti, headerAt };
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { DEFAULT_LINEAR_ALPHA, DEFAULT_RANK_CONSTANT, FUSION_TIE_INSERTION_LIMIT, MIN_LINEAR_ALPHA, MAX_LINEAR_ALPHA, MIN_RANK_CONSTANT } from './chunk-3ECIRFS5.mjs';
|
|
2
|
+
import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback } from './chunk-ASZLNVWW.mjs';
|
|
3
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
4
|
+
import { compareCodePoints } from './chunk-TGPKS2UM.mjs';
|
|
5
|
+
|
|
6
|
+
// src/search/fusion-core.native.ts
|
|
7
|
+
function fusionCore() {
|
|
8
|
+
if (!nativeSearchCoreIsEnabled()) return void 0;
|
|
9
|
+
const core = loadNativeCore();
|
|
10
|
+
if (core !== null) return core;
|
|
11
|
+
noteFallback("fuse");
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/search/fusion-memory.ts
|
|
16
|
+
var FusionMemory = class {
|
|
17
|
+
capacity = 0;
|
|
18
|
+
words = Array.from({ length: 4 }, () => new Uint32Array(0));
|
|
19
|
+
numbers = Array.from({ length: 3 }, () => new Float64Array(0));
|
|
20
|
+
keyViews = [];
|
|
21
|
+
scoreViews = [];
|
|
22
|
+
reserve(count) {
|
|
23
|
+
if (count <= this.capacity) return;
|
|
24
|
+
const words = Array.from({ length: 4 }, () => new Uint32Array(count));
|
|
25
|
+
const numbers = Array.from({ length: 3 }, () => new Float64Array(count));
|
|
26
|
+
this.words = words;
|
|
27
|
+
this.numbers = numbers;
|
|
28
|
+
this.capacity = count;
|
|
29
|
+
this.keyViews = [];
|
|
30
|
+
this.scoreViews = [];
|
|
31
|
+
}
|
|
32
|
+
keys(region, count) {
|
|
33
|
+
const previous = this.keyViews[region];
|
|
34
|
+
if (previous?.length === count) return previous;
|
|
35
|
+
const view = this.words[region].subarray(0, count);
|
|
36
|
+
this.keyViews[region] = view;
|
|
37
|
+
return view;
|
|
38
|
+
}
|
|
39
|
+
scores(region, count) {
|
|
40
|
+
const previous = this.scoreViews[region];
|
|
41
|
+
if (previous?.length === count) return previous;
|
|
42
|
+
const view = this.numbers[region].subarray(0, count);
|
|
43
|
+
this.scoreViews[region] = view;
|
|
44
|
+
return view;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var available;
|
|
48
|
+
function takeFusionMemory(count) {
|
|
49
|
+
const memory = available ?? new FusionMemory();
|
|
50
|
+
available = void 0;
|
|
51
|
+
memory.reserve(count);
|
|
52
|
+
return memory;
|
|
53
|
+
}
|
|
54
|
+
function releaseFusionMemory(memory) {
|
|
55
|
+
available = memory;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/search/fusion-rankings.ts
|
|
59
|
+
function compareFused(left, right) {
|
|
60
|
+
return (right.score ?? 0) - (left.score ?? 0) || compareCodePoints(left.docId, right.docId);
|
|
61
|
+
}
|
|
62
|
+
function fuseByRank(lists, k, project) {
|
|
63
|
+
const positions = /* @__PURE__ */ new Map();
|
|
64
|
+
const results = [];
|
|
65
|
+
for (const list of lists) {
|
|
66
|
+
for (let rank = 0; rank < list.length; rank++) {
|
|
67
|
+
const entry = list[rank];
|
|
68
|
+
const contribution = 1 / (k + rank + 1);
|
|
69
|
+
const position = positions.get(entry.docId);
|
|
70
|
+
if (position === void 0) {
|
|
71
|
+
positions.set(entry.docId, results.length);
|
|
72
|
+
results.push(project(entry, contribution));
|
|
73
|
+
} else {
|
|
74
|
+
const result = results[position];
|
|
75
|
+
result.score = (result.score ?? 0) + contribution;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
results.sort(compareFused);
|
|
80
|
+
return results;
|
|
81
|
+
}
|
|
82
|
+
function saturate(score) {
|
|
83
|
+
if (score > Number.MAX_VALUE) return Number.MAX_VALUE;
|
|
84
|
+
if (score < -Number.MAX_VALUE) return -Number.MAX_VALUE;
|
|
85
|
+
return score;
|
|
86
|
+
}
|
|
87
|
+
function normalisedScores(entries) {
|
|
88
|
+
let min = Number.POSITIVE_INFINITY;
|
|
89
|
+
let max = Number.NEGATIVE_INFINITY;
|
|
90
|
+
for (const entry of entries) {
|
|
91
|
+
const score = saturate(entry.score ?? 0);
|
|
92
|
+
if (score < min) min = score;
|
|
93
|
+
if (score > max) max = score;
|
|
94
|
+
}
|
|
95
|
+
const width = max - min;
|
|
96
|
+
const normalised = /* @__PURE__ */ new Map();
|
|
97
|
+
for (const entry of entries) {
|
|
98
|
+
const score = saturate(entry.score ?? 0);
|
|
99
|
+
if (Number.isNaN(score)) normalised.set(entry.docId, 0);
|
|
100
|
+
else if (width === 0) normalised.set(entry.docId, 1);
|
|
101
|
+
else if (Number.isFinite(width)) normalised.set(entry.docId, (score - min) / width);
|
|
102
|
+
else normalised.set(entry.docId, (score / 2 - min / 2) / (max / 2 - min / 2));
|
|
103
|
+
}
|
|
104
|
+
return normalised;
|
|
105
|
+
}
|
|
106
|
+
function fuseByScore(text, vector, alpha, project) {
|
|
107
|
+
const textScores = normalisedScores(text);
|
|
108
|
+
const vectorScores = normalisedScores(vector);
|
|
109
|
+
const results = [];
|
|
110
|
+
const placed = /* @__PURE__ */ new Set();
|
|
111
|
+
for (const list of [text, vector]) {
|
|
112
|
+
for (const entry of list) {
|
|
113
|
+
if (placed.has(entry.docId)) continue;
|
|
114
|
+
placed.add(entry.docId);
|
|
115
|
+
const vectorScore = vectorScores.get(entry.docId) ?? 0;
|
|
116
|
+
const textScore = textScores.get(entry.docId) ?? 0;
|
|
117
|
+
results.push(project(entry, alpha * vectorScore + (1 - alpha) * textScore));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
results.sort(compareFused);
|
|
121
|
+
return results;
|
|
122
|
+
}
|
|
123
|
+
function insertTiesById(entries, keys, start, end) {
|
|
124
|
+
for (let at = start + 1; at < end; at++) {
|
|
125
|
+
const key = keys[at];
|
|
126
|
+
const id = entries[key].docId;
|
|
127
|
+
let to = at;
|
|
128
|
+
while (to > start && compareCodePoints(entries[keys[to - 1]].docId, id) > 0) {
|
|
129
|
+
keys[to] = keys[to - 1];
|
|
130
|
+
to--;
|
|
131
|
+
}
|
|
132
|
+
keys[to] = key;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function orderTiesById(entries, keys, scores, found) {
|
|
136
|
+
let start = 0;
|
|
137
|
+
while (start < found) {
|
|
138
|
+
let end = start + 1;
|
|
139
|
+
while (end < found && scores[end] === scores[start]) end++;
|
|
140
|
+
if (end - start > FUSION_TIE_INSERTION_LIMIT)
|
|
141
|
+
keys.subarray(start, end).sort((left, right) => compareCodePoints(entries[left].docId, entries[right].docId));
|
|
142
|
+
else if (end - start > 1) insertTiesById(entries, keys, start, end);
|
|
143
|
+
start = end;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function fuseRankings(text, vector, strategy, k, alpha, project) {
|
|
147
|
+
const core = fusionCore();
|
|
148
|
+
if (core === void 0) {
|
|
149
|
+
return strategy === 0 ? fuseByRank([text, vector], k, project) : fuseByScore(text, vector, alpha, project);
|
|
150
|
+
}
|
|
151
|
+
const memory = takeFusionMemory(text.length + vector.length);
|
|
152
|
+
try {
|
|
153
|
+
return fuseInCore(core, text, vector, strategy, k, alpha, memory, project);
|
|
154
|
+
} finally {
|
|
155
|
+
releaseFusionMemory(memory);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function fuseInCore(core, text, vector, strategy, k, alpha, memory, project) {
|
|
159
|
+
const positions = /* @__PURE__ */ new Map();
|
|
160
|
+
const entries = text.slice();
|
|
161
|
+
const textKeys = memory.keys(0, text.length);
|
|
162
|
+
const textScores = memory.scores(0, text.length);
|
|
163
|
+
for (let position = 0; position < text.length; position++) {
|
|
164
|
+
const entry = text[position];
|
|
165
|
+
positions.set(entry.docId, position);
|
|
166
|
+
textKeys[position] = position;
|
|
167
|
+
if (strategy === 1) textScores[position] = entry.score ?? 0;
|
|
168
|
+
}
|
|
169
|
+
if (positions.size !== text.length) {
|
|
170
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The hybrid rankings cannot be fused", { status: -1 });
|
|
171
|
+
}
|
|
172
|
+
const vectorKeys = memory.keys(1, vector.length);
|
|
173
|
+
const vectorScores = memory.scores(1, vector.length);
|
|
174
|
+
for (let position = 0; position < vector.length; position++) {
|
|
175
|
+
const entry = vector[position];
|
|
176
|
+
let key = positions.get(entry.docId);
|
|
177
|
+
if (key === void 0) {
|
|
178
|
+
key = entries.length;
|
|
179
|
+
positions.set(entry.docId, key);
|
|
180
|
+
entries.push(entry);
|
|
181
|
+
}
|
|
182
|
+
vectorKeys[position] = key;
|
|
183
|
+
if (strategy === 1) vectorScores[position] = entry.score ?? 0;
|
|
184
|
+
}
|
|
185
|
+
const capacity = text.length + vector.length;
|
|
186
|
+
const idRanks = memory.keys(2, capacity);
|
|
187
|
+
for (let key = 0; key < entries.length; key++) idRanks[key] = key;
|
|
188
|
+
const keys = memory.keys(3, capacity);
|
|
189
|
+
const scores = memory.scores(2, capacity);
|
|
190
|
+
const found = core.fuse(strategy, k, alpha, textKeys, textScores, vectorKeys, vectorScores, idRanks, keys, scores);
|
|
191
|
+
if (found < 0) {
|
|
192
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The hybrid rankings cannot be fused", { status: found });
|
|
193
|
+
}
|
|
194
|
+
orderTiesById(entries, keys, scores, found);
|
|
195
|
+
const result = new Array(found);
|
|
196
|
+
for (let position = 0; position < found; position++) {
|
|
197
|
+
result[position] = project(entries[keys[position]], scores[position]);
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// src/search/fusion.ts
|
|
203
|
+
function rankConstantOf(k) {
|
|
204
|
+
if (k === void 0 || k === null) return DEFAULT_RANK_CONSTANT;
|
|
205
|
+
if (!Number.isInteger(k) || k < MIN_RANK_CONSTANT) {
|
|
206
|
+
throw new NarsilError(
|
|
207
|
+
ErrorCodes.CONFIG_INVALID,
|
|
208
|
+
`hybrid.k must be a whole number of at least ${MIN_RANK_CONSTANT}`,
|
|
209
|
+
{ k }
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
return k;
|
|
213
|
+
}
|
|
214
|
+
function linearAlphaOf(alpha) {
|
|
215
|
+
if (alpha === void 0 || alpha === null) return DEFAULT_LINEAR_ALPHA;
|
|
216
|
+
if (!Number.isFinite(alpha) || alpha < MIN_LINEAR_ALPHA || alpha > MAX_LINEAR_ALPHA) {
|
|
217
|
+
throw new NarsilError(
|
|
218
|
+
ErrorCodes.CONFIG_INVALID,
|
|
219
|
+
`hybrid.alpha must be a number from ${MIN_LINEAR_ALPHA} to ${MAX_LINEAR_ALPHA}`,
|
|
220
|
+
{ alpha }
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
return alpha;
|
|
224
|
+
}
|
|
225
|
+
function resolveHybridFusion(hybrid) {
|
|
226
|
+
const strategy = hybrid?.strategy ?? "rrf";
|
|
227
|
+
if (strategy !== "rrf" && strategy !== "linear") {
|
|
228
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `hybrid.strategy must be "rrf" or "linear"`, { strategy });
|
|
229
|
+
}
|
|
230
|
+
return { strategy, k: rankConstantOf(hybrid?.k), alpha: linearAlphaOf(hybrid?.alpha) };
|
|
231
|
+
}
|
|
232
|
+
function reciprocalRankFusion(lists, options) {
|
|
233
|
+
return fuseRankings(lists[0], lists[1], 0, options.k, DEFAULT_LINEAR_ALPHA, withFusedScore);
|
|
234
|
+
}
|
|
235
|
+
function linearCombination(textResults, vectorResults, options) {
|
|
236
|
+
return fuseRankings(textResults, vectorResults, 1, DEFAULT_RANK_CONSTANT, options.alpha, withFusedScore);
|
|
237
|
+
}
|
|
238
|
+
function withFusedScore(entry, score) {
|
|
239
|
+
return {
|
|
240
|
+
docId: entry.docId,
|
|
241
|
+
score,
|
|
242
|
+
termFrequencies: entry.termFrequencies,
|
|
243
|
+
fieldLengths: entry.fieldLengths,
|
|
244
|
+
idf: entry.idf
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/runtime/background-memory.ts
|
|
249
|
+
var admissions = /* @__PURE__ */ new Set();
|
|
250
|
+
var waiting = /* @__PURE__ */ new Map();
|
|
251
|
+
function addBackgroundAdmission(admission) {
|
|
252
|
+
admissions.add(admission);
|
|
253
|
+
return () => {
|
|
254
|
+
admissions.delete(admission);
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function admitsBackgroundBytes(bytes) {
|
|
258
|
+
for (const admission of admissions) {
|
|
259
|
+
if (!admission(bytes)) return false;
|
|
260
|
+
}
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
function noteWaitingForMemory(owner, work) {
|
|
264
|
+
if (work === null) waiting.delete(owner);
|
|
265
|
+
else waiting.set(owner, work);
|
|
266
|
+
}
|
|
267
|
+
function workWaitingForMemory() {
|
|
268
|
+
return [...waiting.values()];
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export { addBackgroundAdmission, admitsBackgroundBytes, fuseRankings, linearCombination, noteWaitingForMemory, reciprocalRankFusion, resolveHybridFusion, workWaitingForMemory };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/persistence/durability/node-fs.ts
|
|
2
|
+
var cachedFs = null;
|
|
3
|
+
var cachedPath = null;
|
|
4
|
+
async function getFs() {
|
|
5
|
+
if (cachedFs === null) {
|
|
6
|
+
cachedFs = await import('fs/promises');
|
|
7
|
+
}
|
|
8
|
+
return cachedFs;
|
|
9
|
+
}
|
|
10
|
+
async function getPath() {
|
|
11
|
+
if (cachedPath === null) {
|
|
12
|
+
cachedPath = await import('path');
|
|
13
|
+
}
|
|
14
|
+
return cachedPath;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { getFs, getPath };
|