@delali/narsil 0.3.1-next.154 → 0.3.1-next.156
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 +1 -0
- 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-4GCRVRBW.mjs → analysis-change-5BQOQ4BF.mjs} +35 -28
- package/dist/{react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs → analysis-change-entry-TXX6JSMX.mjs} +1 -1
- package/dist/archive-history-E4R73RWD.mjs +29 -0
- package/dist/browser/{analysis-change-IXWPXXJJ.mjs → analysis-change-435CUEPZ.mjs} +32 -12
- package/dist/{analysis-change-entry-KYGSXW4K.mjs → browser/analysis-change-entry-HZXKPPGV.mjs} +1 -1
- package/dist/browser/archive-history-4IP5XQZY.mjs +29 -0
- package/dist/browser/{chunk-4PD752F6.mjs → chunk-23XRXIBW.mjs} +1 -1
- package/dist/browser/{chunk-J433A7P3.mjs → chunk-2CFI5VVV.mjs} +5 -5
- package/dist/{react-native/chunks/chunk-3XKMRNRE.mjs → browser/chunk-2TI4SSUP.mjs} +27 -10
- package/dist/browser/chunk-3SSRJMFN.mjs +100 -0
- package/dist/browser/{chunk-2SHAKW2Z.mjs → chunk-3V7DNNZL.mjs} +515 -733
- package/dist/browser/{chunk-C4KS2QNF.mjs → chunk-4NGKC4H4.mjs} +9 -9
- package/dist/browser/{chunk-XRV72TJD.mjs → chunk-6LWDPLTB.mjs} +2 -2
- package/dist/browser/chunk-7IGKGWSQ.mjs +79 -0
- package/dist/browser/{chunk-VCOYGVP7.mjs → chunk-7U3WVJUP.mjs} +3 -3
- package/dist/browser/chunk-ATEBYXP6.mjs +10 -0
- package/dist/browser/chunk-BHFQATSC.mjs +432 -0
- package/dist/browser/chunk-CRE3G7F3.mjs +1007 -0
- package/dist/browser/{chunk-QXTPSX2H.mjs → chunk-EA63E3D2.mjs} +7 -7
- package/dist/{react-native/chunks/chunk-DCKMICOB.mjs → browser/chunk-EXQZGUQH.mjs} +1 -1
- package/dist/browser/{chunk-ML6HY7T7.mjs → chunk-G64Q6OJF.mjs} +1 -1
- package/dist/browser/chunk-GPPOG6PT.mjs +9 -0
- package/dist/browser/{chunk-EUNBNLKM.mjs → chunk-IZXVW2ZJ.mjs} +5 -5
- package/dist/browser/{chunk-G7LUMBSG.mjs → chunk-K4Q6KX3R.mjs} +30 -20
- package/dist/browser/{chunk-H6QFBMVE.mjs → chunk-KZWSX6BH.mjs} +3 -3
- package/dist/browser/chunk-M3MQE2X7.mjs +151 -0
- package/dist/browser/chunk-MGI4BCXC.mjs +63 -0
- package/dist/browser/chunk-MOG4OVDK.mjs +51 -0
- package/dist/browser/{chunk-W5X2UFWQ.mjs → chunk-NLWTBAGB.mjs} +12 -3
- package/dist/browser/{chunk-AYY6PIKL.mjs → chunk-NQAME3RK.mjs} +2 -2
- package/dist/browser/{chunk-7MEYN7V6.mjs → chunk-NXQG7DRA.mjs} +29 -14
- package/dist/browser/chunk-OEDCEZXJ.mjs +92 -0
- package/dist/{chunk-KUZKUONM.mjs → browser/chunk-SRMZXJSL.mjs} +1 -0
- package/dist/browser/chunk-SSTPBZZX.mjs +1106 -0
- package/dist/browser/{chunk-7TTWXUH6.mjs → chunk-STOWQFT3.mjs} +3 -2
- package/dist/browser/{chunk-26A5JFT2.mjs → chunk-TK63WFXK.mjs} +2 -1
- package/dist/browser/{chunk-SJB6VIZG.mjs → chunk-U3JOQGWX.mjs} +1 -1
- package/dist/browser/{chunk-AJ4HHOVT.mjs → chunk-U4YDIBUT.mjs} +4 -4
- package/dist/browser/{chunk-2FX6ROWR.mjs → chunk-VLJQW4J6.mjs} +2986 -2986
- package/dist/{react-native/chunks/chunk-3O57C2ZO.mjs → browser/chunk-WI4MR75E.mjs} +2 -2
- package/dist/browser/{chunk-3U3QR5YP.mjs → chunk-WN464PTL.mjs} +2 -2
- package/dist/browser/{chunk-U2E3HMYW.mjs → chunk-XAWNZ4G2.mjs} +11 -11
- package/dist/browser/{cold-module-VTUGDYNY.mjs → cold-module-2EHCIV4K.mjs} +20 -18
- package/dist/browser/durability-config-TIYKW6XX.mjs +89 -0
- package/dist/browser/{durability-wiring-GL4A7KDV.mjs → durability-wiring-A7BVG2DW.mjs} +50 -153
- package/dist/browser/engine-hooks-E4UD67JD.mjs +17 -0
- package/dist/browser/geo-index-HHWGMNIS.mjs +1386 -0
- package/dist/browser/import-DXYB6756.mjs +19 -0
- package/dist/browser/{methods-LMUTS7OI.mjs → methods-KTQCSIN4.mjs} +3 -3
- package/dist/browser/{module-M4JNBV6V.mjs → module-NIYMEA5R.mjs} +16 -14
- package/dist/browser/{module-EC3FYW7N.mjs → module-TCT66FWA.mjs} +10 -9
- package/dist/browser/operations-OJ3BXS55.mjs +5 -0
- package/dist/browser/{phrase-module-NPYUVX75.mjs → phrase-module-HAT3TLZN.mjs} +2 -2
- package/dist/browser/{pool-WCGDZHJP.mjs → pool-3JLET5RO.mjs} +1 -1
- package/dist/browser/restore-hooks-YPN4ZFCY.mjs +114 -0
- package/dist/browser/restore-queue-G3RQGL3Y.mjs +55 -0
- package/dist/browser/{retention-6QMRS5VK.mjs → retention-ZWVMNC3Q.mjs} +18 -15
- package/dist/browser/{runtime-3EW2AGB6.mjs → runtime-OTAGEFQW.mjs} +1 -1
- package/dist/browser/{snapshot-DN3CRVUQ.mjs → snapshot-VEQNIE6C.mjs} +71 -36
- package/dist/browser/start-BM442C6R.mjs +25 -0
- package/dist/browser/{write-WAWAFGKQ.mjs → write-2EVMZWDE.mjs} +16 -14
- package/dist/{capabilities-B3Brs1Rc.d.ts → capabilities-Da4ywVVl.d.ts} +35 -3
- package/dist/{chunk-K4B7OH65.mjs → chunk-25KDNIZZ.mjs} +2 -2
- package/dist/{chunk-O43Z4MS6.mjs → chunk-2NE7VCYE.mjs} +2 -2
- package/dist/chunk-2UV4QBHW.mjs +1092 -0
- package/dist/{chunk-3Y3J4V2R.mjs → chunk-3C7MTCCI.mjs} +1 -1
- package/dist/{chunk-TRISKD4Q.mjs → chunk-3HYC4JRF.mjs} +2 -2
- package/dist/{chunk-HVYICDY3.mjs → chunk-3OH67G7R.mjs} +1 -1
- package/dist/{chunk-PFKM7VNZ.mjs → chunk-46KY2PJD.mjs} +30 -11
- package/dist/{chunk-IJU7LL7D.mjs → chunk-4KKXNJM6.mjs} +5 -5
- package/dist/{chunk-IQ4R2I6N.mjs → chunk-5FLRXF73.mjs} +5 -1
- package/dist/{chunk-BPSKLCS7.mjs → chunk-5VV4R6P7.mjs} +3017 -3017
- package/dist/chunk-5YNRKI2C.mjs +81 -0
- package/dist/chunk-6HTGOXIK.mjs +875 -0
- package/dist/{chunk-7HCZWC7B.mjs → chunk-6I6AYAXS.mjs} +50 -8
- package/dist/{chunk-C6ASEFZI.mjs → chunk-6OEGXLBX.mjs} +1 -1
- package/dist/{chunk-DVWYODEB.mjs → chunk-6RC4K46J.mjs} +2 -2
- package/dist/chunk-7GFE3PEY.mjs +40 -0
- package/dist/{chunk-QKZHLADX.mjs → chunk-7LXHHCXZ.mjs} +28 -19
- package/dist/{chunk-JUKYYXSP.mjs → chunk-7V5IUP2T.mjs} +1 -31
- package/dist/{react-native/chunks/chunk-7GWPJDOA.mjs → chunk-A4L7YTKX.mjs} +53 -90
- package/dist/{chunk-Z3TNWCI5.mjs → chunk-BU4SAIC4.mjs} +3 -3
- package/dist/chunk-BWZ3P4MU.mjs +20 -0
- package/dist/{chunk-OKX2BBNW.mjs → chunk-CITFCZKF.mjs} +5 -4
- package/dist/{chunk-4HWZV5MK.mjs → chunk-CSLGFPFQ.mjs} +5 -5
- package/dist/chunk-DP5C7YFQ.mjs +543 -0
- package/dist/{chunk-RVKFI3A2.mjs → chunk-DWEPMFJE.mjs} +11 -8
- package/dist/{chunk-LSM2YTKM.mjs → chunk-EFBDHH5P.mjs} +87 -144
- package/dist/{chunk-NZMAXR2S.mjs → chunk-FAKFUDZZ.mjs} +121 -11
- package/dist/chunk-FB6463IN.mjs +1499 -0
- package/dist/{chunk-REL7LFLR.mjs → chunk-FCJ553HS.mjs} +3 -3
- package/dist/{chunk-MMEMEUOO.mjs → chunk-FJKKCV4D.mjs} +2 -2
- package/dist/{chunk-K7KLL263.mjs → chunk-FNGAM5B7.mjs} +14 -13
- package/dist/{chunk-DMQPFLGI.mjs → chunk-FRBFVQFN.mjs} +6 -5
- package/dist/{chunk-IBNLW3AV.mjs → chunk-FYOVBEMM.mjs} +20 -6
- package/dist/chunk-G6HRSGOU.mjs +74 -0
- package/dist/{chunk-USR7FQRZ.mjs → chunk-GH4WQ22V.mjs} +2 -2
- package/dist/chunk-GQPTDQCL.mjs +54 -0
- package/dist/{chunk-VREK3MYG.mjs → chunk-HFPMMRQT.mjs} +3 -3
- package/dist/{chunk-MLHNSAPK.mjs → chunk-HHBUCIUY.mjs} +3 -3
- package/dist/{chunk-YROWNOMH.mjs → chunk-HJJI72X7.mjs} +1 -1
- package/dist/{chunk-ECX4SGX6.mjs → chunk-I2KPOLOZ.mjs} +9 -9
- package/dist/{chunk-TV2L3BN7.mjs → chunk-I53G4JAU.mjs} +266 -265
- package/dist/{chunk-3A5KI24C.mjs → chunk-I54T6CQP.mjs} +1 -1
- package/dist/{chunk-NTZOXVUZ.mjs → chunk-I5B7RXU7.mjs} +93 -24
- package/dist/{chunk-YBJDOA2T.mjs → chunk-INJYO3BU.mjs} +1 -1
- package/dist/{react-native/chunks/chunk-KWRW5U65.mjs → chunk-J4IJTTEX.mjs} +1 -1
- package/dist/{chunk-X6NSJYQ3.mjs → chunk-JDJBQLRO.mjs} +13 -13
- package/dist/{chunk-MMBEANB2.mjs → chunk-JWRUUCWD.mjs} +3 -3
- package/dist/{chunk-AO2FAYIZ.mjs → chunk-K4ZIGL2O.mjs} +1 -1
- package/dist/{chunk-JFNKIBDT.mjs → chunk-K5QFDYST.mjs} +2 -2
- package/dist/{chunk-C73JLU4E.mjs → chunk-KF4EXSM4.mjs} +2 -2
- package/dist/{chunk-WCBA2LVZ.mjs → chunk-KHKIRS5D.mjs} +1 -1
- package/dist/{chunk-7QUGDVFC.mjs → chunk-KJ3RTZDJ.mjs} +1 -1
- package/dist/{chunk-HVKXNBFL.mjs → chunk-KKQC526K.mjs} +20 -12
- package/dist/chunk-KP7TYHWT.mjs +92 -0
- package/dist/{chunk-VMXSVVXG.mjs → chunk-L6V6BST3.mjs} +9 -22
- package/dist/{chunk-URPCYQVJ.mjs → chunk-LHKOSI2J.mjs} +1 -1
- package/dist/chunk-LNGE7SLY.mjs +151 -0
- package/dist/{react-native/chunks/chunk-CUNGPR5R.mjs → chunk-MP7ABPTD.mjs} +1 -0
- package/dist/{chunk-5KGYQT6W.mjs → chunk-MQOJIO5B.mjs} +26 -9
- package/dist/{chunk-Q3TCTQCC.mjs → chunk-NF4DT3IH.mjs} +1 -1
- package/dist/{chunk-3OFU3NJT.mjs → chunk-OIJ64LGT.mjs} +1 -1
- package/dist/chunk-ORN5BLL7.mjs +11 -0
- package/dist/{chunk-HWEDFLB7.mjs → chunk-P5ZI2P2W.mjs} +126 -1701
- package/dist/{chunk-466PYR4P.mjs → chunk-PWC4VB3Q.mjs} +2 -2
- package/dist/{chunk-B7S6YEBP.mjs → chunk-QJVOLKU6.mjs} +12 -3
- package/dist/{chunk-KCUIFVVW.mjs → chunk-QOW2JPUI.mjs} +9 -9
- package/dist/chunk-RDXO6JST.mjs +63 -0
- package/dist/chunk-RLOES5SX.mjs +31 -0
- package/dist/{chunk-YPUEV6ZC.mjs → chunk-RVGRFOGN.mjs} +1 -1
- package/dist/{chunk-JCLTESFN.mjs → chunk-RZWWB2XR.mjs} +1 -1
- package/dist/chunk-S5LN746F.mjs +10 -0
- package/dist/chunk-SA5LOGO3.mjs +470 -0
- package/dist/chunk-SQJWAIF4.mjs +12 -0
- package/dist/{chunk-YTJCGKM4.mjs → chunk-TBC3XUL2.mjs} +29 -6
- package/dist/chunk-TDIK6NTV.mjs +10 -0
- package/dist/chunk-TGS5UXBE.mjs +216 -0
- package/dist/{chunk-CP5RRPJR.mjs → chunk-TQXHPFWT.mjs} +1 -1
- package/dist/{chunk-7NTMUDC5.mjs → chunk-TZ3355VS.mjs} +5 -5
- package/dist/{chunk-Q7MS6P2J.mjs → chunk-TZTRKM33.mjs} +2 -2
- package/dist/{chunk-4UMZ7KQL.mjs → chunk-U55XJEIG.mjs} +2 -1
- package/dist/{chunk-S2N75OTN.mjs → chunk-UHICS3JI.mjs} +1 -1
- package/dist/{chunk-5FUOVJKG.mjs → chunk-VTTRFF2C.mjs} +32 -19
- package/dist/{chunk-62G63NMH.mjs → chunk-WX4LAO6M.mjs} +4 -4
- package/dist/{chunk-LTUGDMV4.mjs → chunk-WZ7YV54N.mjs} +1 -1
- package/dist/chunk-XAXKV65G.mjs +72 -0
- package/dist/chunk-XXHN7J46.mjs +101 -0
- package/dist/{chunk-PGVPE7GJ.mjs → chunk-YEKL4JBK.mjs} +1 -1
- package/dist/chunk-YTWZVGCB.mjs +382 -0
- package/dist/chunk-Z2KAFCRT.mjs +30 -0
- package/dist/{chunk-LKUE5GXS.mjs → chunk-ZKP7G7TV.mjs} +2 -2
- package/dist/{client-Df76GNKm.d.ts → client-DRv7UVeY.d.ts} +123 -11
- package/dist/client.d.ts +9 -8
- package/dist/client.mjs +65 -3
- package/dist/{cold-module-YLWMTTZG.mjs → cold-module-6MO2XJF2.mjs} +45 -39
- package/dist/{config-B8DP2VwR.d.ts → config-CoSig5Ox.d.ts} +22 -3
- package/dist/{config-05G_hy-1.d.ts → config-DMwffLKn.d.ts} +20 -5
- package/dist/direct-executor-FTMYY3TI.mjs +34 -0
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +3 -3
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/coordinator/in-memory.mjs +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 +8 -8
- package/dist/distribution.mjs +6799 -5939
- package/dist/durability-config-GE4U7MCZ.mjs +89 -0
- package/dist/{durability-wiring-RHLXDIVF.mjs → durability-wiring-VIF5MOSY.mjs} +82 -179
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{sync-uXR7MmM7.d.ts → engine-CFxPYqEk.d.ts} +702 -2
- package/dist/engine-hooks-EGUGNZYE.mjs +54 -0
- package/dist/geo-index-MRH5JMIR.mjs +1387 -0
- package/dist/import-XKDPJQDP.mjs +56 -0
- package/dist/{index-nRqDM6uS.d.ts → index-C4AmUnl1.d.ts} +1 -1
- package/dist/index.browser.mjs +9 -7
- package/dist/index.d.ts +134 -9
- package/dist/index.mjs +33 -26
- package/dist/index.react-native.mjs +20 -17
- package/dist/invalidation/filesystem.mjs +2 -2
- package/dist/{long-query-thread-EMYTGSJP.mjs → long-query-thread-YA4IAYSY.mjs} +34 -28
- package/dist/{methods-ABM5ELBR.mjs → methods-7IOINERF.mjs} +3 -3
- package/dist/{module-MG7JMV2U.mjs → module-FQ4JWNQJ.mjs} +41 -34
- package/dist/{module-3OMJZUFT.mjs → module-N55W4Q5C.mjs} +14 -14
- package/dist/operations-G5EP6JPX.mjs +5 -0
- package/dist/{paged-partition-archive-UOLHOEZJ.mjs → paged-partition-archive-PXW5XAYU.mjs} +48 -38
- package/dist/partial-words.mjs +11 -9
- package/dist/pattern.mjs +6 -5
- package/dist/persistence/durability/checkpoint-worker.d.ts +8 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +44 -35
- package/dist/{phrase-module-O3MDRQXP.mjs → phrase-module-XW5MKWP5.mjs} +4 -3
- package/dist/{pool-CQXYPFLG.mjs → pool-Y4A46T36.mjs} +1 -1
- package/dist/query-suggestions/merge-worker.d.ts +55 -0
- package/dist/query-suggestions/merge-worker.mjs +88 -0
- package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
- package/dist/query-suggestions.browser.mjs +247 -0
- package/dist/query-suggestions.d.ts +20 -0
- package/dist/query-suggestions.mjs +69 -0
- package/dist/react-native/chunks/{analysis-change-EAYO3Y6Q.mjs → analysis-change-LT5QBQ3H.mjs} +43 -22
- package/dist/{browser/analysis-change-entry-FCSHFQSS.mjs → react-native/chunks/analysis-change-entry-SCVWK6OU.mjs} +1 -1
- package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +29 -0
- package/dist/{chunk-ZIFJXCKA.mjs → react-native/chunks/chunk-2PRHILX3.mjs} +54 -20
- package/dist/react-native/chunks/{chunk-VQSKZ3EZ.mjs → chunk-3JWDECAZ.mjs} +8 -8
- package/dist/{chunk-R6A773WK.mjs → react-native/chunks/chunk-3WI35N75.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-75VWIY35.mjs → chunk-4DII3ZSM.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-NKIZX26F.mjs → chunk-4J74WHQM.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-UWDNZDWK.mjs → chunk-4JYO3JD2.mjs} +6 -6
- package/dist/react-native/chunks/chunk-5CQX3XXV.mjs +17 -0
- package/dist/react-native/chunks/chunk-6VBXNFLE.mjs +9 -0
- package/dist/react-native/chunks/{chunk-SJWDBRNP.mjs → chunk-6WA3C3DV.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-OQQVRWZ2.mjs → chunk-C5G6TJ7A.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-RVAEBN74.mjs → chunk-CKNRFDTZ.mjs} +1 -1
- package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +10 -0
- package/dist/react-native/chunks/{chunk-O32RB3BL.mjs → chunk-DNXOMPAQ.mjs} +4 -4
- package/dist/react-native/chunks/{chunk-YBEW6YTR.mjs → chunk-DVDX4SDR.mjs} +2 -2
- package/dist/react-native/chunks/chunk-DXRSEWA2.mjs +12 -0
- package/dist/{browser/chunk-MYITLCHT.mjs → react-native/chunks/chunk-DZ7H7D2C.mjs} +1 -0
- package/dist/react-native/chunks/{chunk-PPEPTUVV.mjs → chunk-EJ33LCHV.mjs} +29 -6
- package/dist/react-native/chunks/{chunk-RYMDHGL4.mjs → chunk-ENLMYKSX.mjs} +3045 -3075
- package/dist/react-native/chunks/chunk-FHPW7P2O.mjs +40 -0
- package/dist/react-native/chunks/{chunk-JV6VQY2S.mjs → chunk-FTZHMRD2.mjs} +2 -1
- package/dist/react-native/chunks/{chunk-YHKZSLOC.mjs → chunk-G43IPIDG.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-AUT7PMA4.mjs → chunk-GXX3DQXP.mjs} +8 -22
- package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
- package/dist/react-native/chunks/{chunk-DH3TVWWK.mjs → chunk-IYNT75CE.mjs} +12 -3
- package/dist/react-native/chunks/chunk-KV46CT4D.mjs +1007 -0
- package/dist/{browser/chunk-ZPTA75ZC.mjs → react-native/chunks/chunk-LZSLNSUN.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-63YSZOXB.mjs → chunk-MIP4SOR6.mjs} +1480 -826
- package/dist/react-native/chunks/{chunk-ZBSWRSBG.mjs → chunk-MJDQU5MW.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-GFYFQLJD.mjs → chunk-MUWD2H2S.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-IOY2SM2P.mjs → chunk-MVXELMJX.mjs} +1 -1
- package/dist/{browser/chunk-TTD27VXX.mjs → react-native/chunks/chunk-NB3LP33V.mjs} +27 -10
- package/dist/react-native/chunks/{chunk-I5PGWQJF.mjs → chunk-PDRWWPKV.mjs} +33 -24
- package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +79 -0
- package/dist/react-native/chunks/{chunk-2CGSQM4O.mjs → chunk-POPDAGH6.mjs} +13 -13
- package/dist/react-native/chunks/{chunk-NP7DD4G5.mjs → chunk-QUKQNI3H.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-EH5CFV6Z.mjs → chunk-RDWG33MM.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-JX2RIAXH.mjs → chunk-SK2PWYDH.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-ZYDKJXQJ.mjs → chunk-SUPXRTMD.mjs} +1 -1
- package/dist/react-native/chunks/chunk-TP6KCKER.mjs +63 -0
- package/dist/react-native/chunks/{chunk-JPAJWO6D.mjs → chunk-U4KSKA4Z.mjs} +1 -1
- package/dist/react-native/chunks/chunk-UQ4OAXKU.mjs +1106 -0
- package/dist/react-native/chunks/{chunk-VVFYOADG.mjs → chunk-VWUDIOT6.mjs} +6 -6
- package/dist/{browser/chunk-SIR3LMTV.mjs → react-native/chunks/chunk-WBYQRHDY.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-C2H2QQFW.mjs → chunk-YH7QY657.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-NCJS3WIY.mjs → chunk-YZW4CHM6.mjs} +51 -12
- package/dist/react-native/chunks/chunk-ZLWVW734.mjs +100 -0
- package/dist/react-native/chunks/chunk-ZXZFN7FI.mjs +432 -0
- package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +92 -0
- package/dist/react-native/chunks/{cold-module-TJL6AFAD.mjs → cold-module-KVZYUGRY.mjs} +31 -28
- package/dist/react-native/chunks/durability-config-QXVZEO7T.mjs +89 -0
- package/dist/react-native/chunks/{durability-wiring-RRDYJLLM.mjs → durability-wiring-34OYO32E.mjs} +60 -162
- package/dist/react-native/chunks/engine-hooks-M7JV46NH.mjs +30 -0
- package/dist/react-native/chunks/geo-index-PX3BIHAH.mjs +1387 -0
- package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +3 -0
- package/dist/react-native/chunks/import-H6AQREWI.mjs +32 -0
- package/dist/react-native/chunks/{methods-X6F36SJE.mjs → methods-6W5U4C3H.mjs} +3 -3
- package/dist/react-native/chunks/module-LBZPGOWH.mjs +36 -0
- package/dist/react-native/chunks/{module-S4DKSWMF.mjs → module-TTEVPRCW.mjs} +14 -13
- package/dist/react-native/chunks/operations-GNRMD6EX.mjs +5 -0
- package/dist/react-native/chunks/{phrase-module-JZ37TB7N.mjs → phrase-module-QK22HSQ2.mjs} +2 -2
- package/dist/react-native/chunks/{pool-RTGXJXPU.mjs → pool-JR3NJCAF.mjs} +1 -1
- package/dist/react-native/chunks/restore-hooks-IBGIY3DR.mjs +127 -0
- package/dist/react-native/chunks/restore-queue-ZZX54AH7.mjs +55 -0
- package/dist/react-native/chunks/{retention-PPCTP2VY.mjs → retention-EW4TTDFB.mjs} +29 -25
- package/dist/react-native/chunks/{runtime-KUATOLYB.mjs → runtime-R5E3TB3J.mjs} +1 -1
- package/dist/react-native/chunks/{snapshot-ZBIEOZTZ.mjs → snapshot-REYVIN3X.mjs} +80 -44
- package/dist/react-native/chunks/start-BQK6KN3R.mjs +38 -0
- package/dist/react-native/chunks/{write-2W4FTX7J.mjs → write-FQAYCZF5.mjs} +27 -24
- package/dist/react-native/partial-words.mjs +11 -9
- package/dist/react-native/pattern.mjs +4 -4
- package/dist/react-native/query-suggestions.mjs +260 -0
- package/dist/react-native/sync.mjs +78 -15
- package/dist/react-native/synonyms.mjs +95 -27
- package/dist/react.d.ts +11 -11
- package/dist/react.mjs +1 -0
- package/dist/{rerank-IZOB6NII.mjs → rerank-MQ37IYRV.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/restore-hooks-CDERDEF4.mjs +153 -0
- package/dist/restore-queue-7NNSTROA.mjs +55 -0
- package/dist/retention-QSVBBNRM.mjs +66 -0
- package/dist/{runtime-UZOC3NPY.mjs → runtime-COIUORCN.mjs} +5 -5
- package/dist/{schema-DDauvDOv.d.ts → schema-Jwt928nJ.d.ts} +1 -1
- package/dist/server.d.ts +108 -12
- package/dist/server.mjs +303 -50
- package/dist/{snapshot-NFX2EYN2.mjs → snapshot-RH4NSKIZ.mjs} +98 -61
- package/dist/start-MCKCOGIW.mjs +66 -0
- package/dist/sync/filesystem.d.ts +4 -4
- package/dist/sync/filesystem.mjs +6 -6
- package/dist/sync/indexeddb.d.ts +4 -4
- package/dist/sync/indexeddb.mjs +2 -2
- package/dist/sync.browser.mjs +74 -11
- package/dist/sync.d.ts +5 -5
- package/dist/sync.mjs +78 -16
- package/dist/synonyms.mjs +9 -8
- package/dist/{tasks-BShx8pdK.d.ts → tasks-qrJojgST.d.ts} +13 -5
- package/dist/thread-O4SBJJJS.mjs +50 -0
- package/dist/{types-SnO7_tAI.d.ts → types-BZCGjfLn.d.ts} +2 -3
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +8 -8
- package/dist/workers/entry.mjs +19 -8
- package/dist/{write-FGB62BHQ.mjs → write-3FK7NG3Y.mjs} +40 -33
- package/openapi.json +798 -7
- package/package.json +32 -8
- package/dist/browser/import-YI5GNB4H.mjs +0 -17
- package/dist/browser/operations-WVYLF72Q.mjs +0 -5
- package/dist/browser/restore-queue-TYIGDL5L.mjs +0 -41
- package/dist/chunk-37IVJLP6.mjs +0 -44
- package/dist/chunk-DJHHF2L5.mjs +0 -17
- package/dist/direct-executor-FI5GJHWX.mjs +0 -29
- package/dist/engine-DYu-e0oR.d.ts +0 -674
- package/dist/import-SRBNC6TE.mjs +0 -49
- package/dist/operations-PGOAY2KS.mjs +0 -5
- package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +0 -25
- package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +0 -3
- package/dist/react-native/chunks/import-JYBMEJPQ.mjs +0 -29
- package/dist/react-native/chunks/module-QT5HZAY4.mjs +0 -33
- package/dist/react-native/chunks/operations-RYKTSZQA.mjs +0 -5
- package/dist/react-native/chunks/restore-queue-ZBVIKJWI.mjs +0 -41
- package/dist/restore-queue-COI2GSSK.mjs +0 -41
- package/dist/retention-55WA7GPU.mjs +0 -58
- package/dist/thread-P2G2FWM2.mjs +0 -44
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import { dayFileKey, restoreStagingPrefix, restoredFileKey, listHistoryFolder, historyFileOf } from './chunk-KP7TYHWT.mjs';
|
|
2
|
+
import { resolveSetting } from './chunk-YTWZVGCB.mjs';
|
|
3
|
+
import { openCountsFile, encodeCountsFile } from './chunk-SA5LOGO3.mjs';
|
|
4
|
+
import { DAY_MS, SCRAMBLED_ID_BYTES, QUERY_HISTORY_ARCHIVE_PREFIX, MIN_PHRASE_TABLE_CAPACITY, PERSON_TABLE_MIN_SLOTS, PAIR_PAGE_BLOCKS, PAIR_BLOCK_SLOTS } from './chunk-5YNRKI2C.mjs';
|
|
5
|
+
|
|
6
|
+
// src/query-suggestions/day-counts.ts
|
|
7
|
+
var EMPTY_SLOT = -1;
|
|
8
|
+
var NO_BLOCK = -1;
|
|
9
|
+
function nextPowerOfTwo(value) {
|
|
10
|
+
let power = 1;
|
|
11
|
+
while (power < value) power *= 2;
|
|
12
|
+
return power;
|
|
13
|
+
}
|
|
14
|
+
function idsEqual(left, leftOffset, right, rightOffset) {
|
|
15
|
+
for (let i = 0; i < SCRAMBLED_ID_BYTES; i++) {
|
|
16
|
+
if (left[leftOffset + i] !== right[rightOffset + i]) return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
function hashOfId(id, offset) {
|
|
21
|
+
return (id[offset] | id[offset + 1] << 8 | id[offset + 2] << 16 | id[offset + 3] << 24) >>> 0;
|
|
22
|
+
}
|
|
23
|
+
var DayCounts = class {
|
|
24
|
+
day;
|
|
25
|
+
limits;
|
|
26
|
+
groups = /* @__PURE__ */ new Map();
|
|
27
|
+
phraseCount = 0;
|
|
28
|
+
phraseTexts = [];
|
|
29
|
+
phraseGroups = [];
|
|
30
|
+
phraseCounts = new Uint32Array(0);
|
|
31
|
+
phrasePeopleLengths = new Uint16Array(0);
|
|
32
|
+
phrasePeople = new Uint8Array(0);
|
|
33
|
+
personCount = 0;
|
|
34
|
+
personIds = new Uint8Array(0);
|
|
35
|
+
personPairs = new Uint16Array(0);
|
|
36
|
+
personHeads = new Int32Array(0);
|
|
37
|
+
personTails = new Int32Array(0);
|
|
38
|
+
personSlots = new Int32Array(0);
|
|
39
|
+
pairPages = [];
|
|
40
|
+
linkPages = [];
|
|
41
|
+
blockCount = 0;
|
|
42
|
+
changed = false;
|
|
43
|
+
constructor(day, limits) {
|
|
44
|
+
this.day = day;
|
|
45
|
+
this.limits = limits;
|
|
46
|
+
}
|
|
47
|
+
get phrases() {
|
|
48
|
+
return this.phraseCount;
|
|
49
|
+
}
|
|
50
|
+
get people() {
|
|
51
|
+
return this.personCount;
|
|
52
|
+
}
|
|
53
|
+
get groupNames() {
|
|
54
|
+
return this.groups.keys();
|
|
55
|
+
}
|
|
56
|
+
get isChanged() {
|
|
57
|
+
return this.changed;
|
|
58
|
+
}
|
|
59
|
+
markSaved() {
|
|
60
|
+
this.changed = false;
|
|
61
|
+
}
|
|
62
|
+
markChanged() {
|
|
63
|
+
this.changed = true;
|
|
64
|
+
}
|
|
65
|
+
get groupTables() {
|
|
66
|
+
return this.groups;
|
|
67
|
+
}
|
|
68
|
+
get peopleBytes() {
|
|
69
|
+
return this.phrasePeople;
|
|
70
|
+
}
|
|
71
|
+
countOf(phraseNumber) {
|
|
72
|
+
return this.phraseCounts[phraseNumber];
|
|
73
|
+
}
|
|
74
|
+
peopleLengthOf(phraseNumber) {
|
|
75
|
+
return this.phrasePeopleLengths[phraseNumber];
|
|
76
|
+
}
|
|
77
|
+
peopleOffsetOf(phraseNumber) {
|
|
78
|
+
return phraseNumber * this.limits.minPeople * SCRAMBLED_ID_BYTES;
|
|
79
|
+
}
|
|
80
|
+
hasGroup(group) {
|
|
81
|
+
return this.groups.has(group);
|
|
82
|
+
}
|
|
83
|
+
count(group, phrase, scrambledId, groupAllowed) {
|
|
84
|
+
const groupPhrases = this.groups.get(group);
|
|
85
|
+
const existingPhrase = groupPhrases?.get(phrase);
|
|
86
|
+
const person = this.findPerson(scrambledId);
|
|
87
|
+
if (person !== EMPTY_SLOT && existingPhrase !== void 0 && this.personHasPhrase(person, existingPhrase)) {
|
|
88
|
+
return "repeat";
|
|
89
|
+
}
|
|
90
|
+
if (person !== EMPTY_SLOT && this.personPairs[person] >= this.limits.maxPhrasesPerPerson) return "person-limit";
|
|
91
|
+
if (existingPhrase === void 0 && this.phraseCount >= this.limits.maxPhrasesPerDay) return "phrase-limit";
|
|
92
|
+
if (person === EMPTY_SLOT && this.personCount >= this.limits.maxPeoplePerDay) return "people-limit";
|
|
93
|
+
if (groupPhrases === void 0 && (!groupAllowed || this.groups.size >= this.limits.maxGroups)) {
|
|
94
|
+
return "group-limit";
|
|
95
|
+
}
|
|
96
|
+
const phraseNumber = existingPhrase ?? this.addPhrase(group, phrase, groupPhrases);
|
|
97
|
+
const personNumber = person === EMPTY_SLOT ? this.addPerson(scrambledId) : person;
|
|
98
|
+
this.appendPair(personNumber, phraseNumber);
|
|
99
|
+
this.phraseCounts[phraseNumber] += 1;
|
|
100
|
+
this.addToPeople(phraseNumber, scrambledId, 0);
|
|
101
|
+
this.changed = true;
|
|
102
|
+
return "recorded";
|
|
103
|
+
}
|
|
104
|
+
restorePhrase(group, phrase, count, people, peopleCount) {
|
|
105
|
+
const groupPhrases = this.groups.get(group);
|
|
106
|
+
if (groupPhrases?.has(phrase) === true) return false;
|
|
107
|
+
if (this.phraseCount >= this.limits.maxPhrasesPerDay) return false;
|
|
108
|
+
if (groupPhrases === void 0 && this.groups.size >= this.limits.maxGroups) return false;
|
|
109
|
+
const phraseNumber = this.addPhrase(group, phrase, groupPhrases);
|
|
110
|
+
for (let i = 0; i < peopleCount; i++) this.addToPeople(phraseNumber, people, i * SCRAMBLED_ID_BYTES);
|
|
111
|
+
this.phraseCounts[phraseNumber] = Math.max(count, this.phrasePeopleLengths[phraseNumber]);
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
addPhrase(group, phrase, existing) {
|
|
115
|
+
const groupPhrases = existing ?? /* @__PURE__ */ new Map();
|
|
116
|
+
if (existing === void 0) this.groups.set(group, groupPhrases);
|
|
117
|
+
if (this.phraseCount === this.phraseCounts.length) this.growPhrases();
|
|
118
|
+
const number = this.phraseCount;
|
|
119
|
+
this.phraseCount += 1;
|
|
120
|
+
groupPhrases.set(phrase, number);
|
|
121
|
+
this.phraseTexts.push(phrase);
|
|
122
|
+
this.phraseGroups.push(group);
|
|
123
|
+
return number;
|
|
124
|
+
}
|
|
125
|
+
growPhrases() {
|
|
126
|
+
const capacity = Math.min(
|
|
127
|
+
this.limits.maxPhrasesPerDay,
|
|
128
|
+
Math.max(MIN_PHRASE_TABLE_CAPACITY, this.phraseCounts.length * 2)
|
|
129
|
+
);
|
|
130
|
+
const counts = new Uint32Array(capacity);
|
|
131
|
+
counts.set(this.phraseCounts);
|
|
132
|
+
this.phraseCounts = counts;
|
|
133
|
+
const lengths = new Uint16Array(capacity);
|
|
134
|
+
lengths.set(this.phrasePeopleLengths);
|
|
135
|
+
this.phrasePeopleLengths = lengths;
|
|
136
|
+
const people = new Uint8Array(capacity * this.limits.minPeople * SCRAMBLED_ID_BYTES);
|
|
137
|
+
people.set(this.phrasePeople);
|
|
138
|
+
this.phrasePeople = people;
|
|
139
|
+
}
|
|
140
|
+
addToPeople(phraseNumber, id, idOffset) {
|
|
141
|
+
const length = this.phrasePeopleLengths[phraseNumber];
|
|
142
|
+
if (length >= this.limits.minPeople) return;
|
|
143
|
+
const base = phraseNumber * this.limits.minPeople * SCRAMBLED_ID_BYTES;
|
|
144
|
+
for (let i = 0; i < length; i++) {
|
|
145
|
+
if (idsEqual(this.phrasePeople, base + i * SCRAMBLED_ID_BYTES, id, idOffset)) return;
|
|
146
|
+
}
|
|
147
|
+
this.phrasePeople.set(id.subarray(idOffset, idOffset + SCRAMBLED_ID_BYTES), base + length * SCRAMBLED_ID_BYTES);
|
|
148
|
+
this.phrasePeopleLengths[phraseNumber] = length + 1;
|
|
149
|
+
}
|
|
150
|
+
findPerson(id) {
|
|
151
|
+
if (this.personSlots.length === 0) return EMPTY_SLOT;
|
|
152
|
+
const mask = this.personSlots.length - 1;
|
|
153
|
+
let slot = hashOfId(id, 0) & mask;
|
|
154
|
+
for (; ; ) {
|
|
155
|
+
const person = this.personSlots[slot];
|
|
156
|
+
if (person === EMPTY_SLOT) return EMPTY_SLOT;
|
|
157
|
+
if (idsEqual(this.personIds, person * SCRAMBLED_ID_BYTES, id, 0)) return person;
|
|
158
|
+
slot = slot + 1 & mask;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
addPerson(id) {
|
|
162
|
+
if (this.personCount === this.personPairs.length) this.growPeople();
|
|
163
|
+
const person = this.personCount;
|
|
164
|
+
this.personCount += 1;
|
|
165
|
+
this.personIds.set(id.subarray(0, SCRAMBLED_ID_BYTES), person * SCRAMBLED_ID_BYTES);
|
|
166
|
+
this.personHeads[person] = NO_BLOCK;
|
|
167
|
+
this.personTails[person] = NO_BLOCK;
|
|
168
|
+
this.insertSlot(person);
|
|
169
|
+
return person;
|
|
170
|
+
}
|
|
171
|
+
insertSlot(person) {
|
|
172
|
+
const mask = this.personSlots.length - 1;
|
|
173
|
+
let slot = hashOfId(this.personIds, person * SCRAMBLED_ID_BYTES) & mask;
|
|
174
|
+
while (this.personSlots[slot] !== EMPTY_SLOT) slot = slot + 1 & mask;
|
|
175
|
+
this.personSlots[slot] = person;
|
|
176
|
+
}
|
|
177
|
+
growPeople() {
|
|
178
|
+
const capacity = Math.min(
|
|
179
|
+
this.limits.maxPeoplePerDay,
|
|
180
|
+
Math.max(PERSON_TABLE_MIN_SLOTS / 2, this.personPairs.length * 2)
|
|
181
|
+
);
|
|
182
|
+
const ids = new Uint8Array(capacity * SCRAMBLED_ID_BYTES);
|
|
183
|
+
ids.set(this.personIds);
|
|
184
|
+
this.personIds = ids;
|
|
185
|
+
const pairs = new Uint16Array(capacity);
|
|
186
|
+
pairs.set(this.personPairs);
|
|
187
|
+
this.personPairs = pairs;
|
|
188
|
+
const heads = new Int32Array(capacity);
|
|
189
|
+
heads.set(this.personHeads);
|
|
190
|
+
this.personHeads = heads;
|
|
191
|
+
const tails = new Int32Array(capacity);
|
|
192
|
+
tails.set(this.personTails);
|
|
193
|
+
this.personTails = tails;
|
|
194
|
+
this.personSlots = new Int32Array(nextPowerOfTwo(capacity * 2)).fill(EMPTY_SLOT);
|
|
195
|
+
for (let person = 0; person < this.personCount; person++) this.insertSlot(person);
|
|
196
|
+
}
|
|
197
|
+
personHasPhrase(person, phraseNumber) {
|
|
198
|
+
let remaining = this.personPairs[person];
|
|
199
|
+
let block = this.personHeads[person];
|
|
200
|
+
while (block !== NO_BLOCK && remaining > 0) {
|
|
201
|
+
const page = this.pairPages[Math.floor(block / PAIR_PAGE_BLOCKS)];
|
|
202
|
+
const start = block % PAIR_PAGE_BLOCKS * PAIR_BLOCK_SLOTS;
|
|
203
|
+
const used = Math.min(remaining, PAIR_BLOCK_SLOTS);
|
|
204
|
+
for (let i = 0; i < used; i++) {
|
|
205
|
+
if (page[start + i] === phraseNumber) return true;
|
|
206
|
+
}
|
|
207
|
+
remaining -= used;
|
|
208
|
+
block = this.linkPages[Math.floor(block / PAIR_PAGE_BLOCKS)][block % PAIR_PAGE_BLOCKS];
|
|
209
|
+
}
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
appendPair(person, phraseNumber) {
|
|
213
|
+
const pairs = this.personPairs[person];
|
|
214
|
+
const slot = pairs % PAIR_BLOCK_SLOTS;
|
|
215
|
+
let block = this.personTails[person];
|
|
216
|
+
if (slot === 0) {
|
|
217
|
+
const fresh = this.allocateBlock();
|
|
218
|
+
if (block === NO_BLOCK) this.personHeads[person] = fresh;
|
|
219
|
+
else this.linkPages[Math.floor(block / PAIR_PAGE_BLOCKS)][block % PAIR_PAGE_BLOCKS] = fresh;
|
|
220
|
+
this.personTails[person] = fresh;
|
|
221
|
+
block = fresh;
|
|
222
|
+
}
|
|
223
|
+
const page = this.pairPages[Math.floor(block / PAIR_PAGE_BLOCKS)];
|
|
224
|
+
page[block % PAIR_PAGE_BLOCKS * PAIR_BLOCK_SLOTS + slot] = phraseNumber;
|
|
225
|
+
this.personPairs[person] = pairs + 1;
|
|
226
|
+
}
|
|
227
|
+
allocateBlock() {
|
|
228
|
+
const block = this.blockCount;
|
|
229
|
+
if (block % PAIR_PAGE_BLOCKS === 0) {
|
|
230
|
+
this.pairPages.push(new Uint16Array(PAIR_PAGE_BLOCKS * PAIR_BLOCK_SLOTS));
|
|
231
|
+
this.linkPages.push(new Int32Array(PAIR_PAGE_BLOCKS).fill(NO_BLOCK));
|
|
232
|
+
}
|
|
233
|
+
this.blockCount += 1;
|
|
234
|
+
return block;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// src/query-suggestions/history-groups.ts
|
|
239
|
+
var HistoryGroups = class {
|
|
240
|
+
host;
|
|
241
|
+
fingerprint;
|
|
242
|
+
held = /* @__PURE__ */ new Map();
|
|
243
|
+
constructor(host, fingerprint) {
|
|
244
|
+
this.host = host;
|
|
245
|
+
this.fingerprint = fingerprint;
|
|
246
|
+
}
|
|
247
|
+
async of(indexName, cutoff) {
|
|
248
|
+
const held = this.held.get(indexName);
|
|
249
|
+
if (held !== void 0 && held.cutoff <= cutoff) {
|
|
250
|
+
if (held.cutoff < cutoff) {
|
|
251
|
+
for (const [group, day] of held.newestDay) if (day < cutoff) held.newestDay.delete(group);
|
|
252
|
+
held.cutoff = cutoff;
|
|
253
|
+
}
|
|
254
|
+
return held.newestDay.keys();
|
|
255
|
+
}
|
|
256
|
+
const newestDay = await this.load(indexName, cutoff);
|
|
257
|
+
this.held.set(indexName, { cutoff, newestDay });
|
|
258
|
+
return newestDay.keys();
|
|
259
|
+
}
|
|
260
|
+
note(indexName, day, groups) {
|
|
261
|
+
const held = this.held.get(indexName);
|
|
262
|
+
if (held === void 0 || day < held.cutoff) return;
|
|
263
|
+
for (const group of groups) {
|
|
264
|
+
const newest = held.newestDay.get(group);
|
|
265
|
+
if (newest === void 0 || newest < day) held.newestDay.set(group, day);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
forget(indexName) {
|
|
269
|
+
this.held.delete(indexName);
|
|
270
|
+
}
|
|
271
|
+
async load(indexName, cutoff) {
|
|
272
|
+
const newestDay = /* @__PURE__ */ new Map();
|
|
273
|
+
const expectedUuid = this.host.view(indexName)?.indexUuid ?? null;
|
|
274
|
+
for (const key of await listHistoryFolder(this.host.files, indexName)) {
|
|
275
|
+
const file = historyFileOf(indexName, key);
|
|
276
|
+
if (file === null || file.day < cutoff) continue;
|
|
277
|
+
const bytes = await this.host.files.read(key);
|
|
278
|
+
if (!(bytes instanceof Uint8Array)) continue;
|
|
279
|
+
const opened = await openCountsFile(bytes, file.day, this.fingerprint);
|
|
280
|
+
if (opened.kind !== "counts") continue;
|
|
281
|
+
if (this.host.clustered && (opened.indexUuid === null || opened.indexUuid !== expectedUuid)) continue;
|
|
282
|
+
for (const group of opened.groupNames()) {
|
|
283
|
+
const newest = newestDay.get(group);
|
|
284
|
+
if (newest === void 0 || newest < file.day) newestDay.set(group, file.day);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return newestDay;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// src/query-suggestions/day-store.ts
|
|
292
|
+
function dayOf(instant) {
|
|
293
|
+
return new Date(instant).toISOString().slice(0, 10);
|
|
294
|
+
}
|
|
295
|
+
function limitsOf(setting) {
|
|
296
|
+
return {
|
|
297
|
+
minPeople: setting.minPeople,
|
|
298
|
+
maxPhrasesPerDay: setting.maxPhrasesPerDay,
|
|
299
|
+
maxPhrasesPerPerson: setting.maxPhrasesPerPerson,
|
|
300
|
+
maxPeoplePerDay: setting.maxPeoplePerDay,
|
|
301
|
+
maxGroups: setting.maxGroups
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function sameLimits(left, right) {
|
|
305
|
+
return left.minPeople === right.minPeople && left.maxPhrasesPerDay === right.maxPhrasesPerDay && left.maxPhrasesPerPerson === right.maxPhrasesPerPerson && left.maxPeoplePerDay === right.maxPeoplePerDay && left.maxGroups === right.maxGroups;
|
|
306
|
+
}
|
|
307
|
+
var DayStore = class {
|
|
308
|
+
host;
|
|
309
|
+
scrambler;
|
|
310
|
+
history;
|
|
311
|
+
days = /* @__PURE__ */ new Map();
|
|
312
|
+
unsavedDays = /* @__PURE__ */ new Map();
|
|
313
|
+
turns = /* @__PURE__ */ new Map();
|
|
314
|
+
warnedLimits = /* @__PURE__ */ new Map();
|
|
315
|
+
generations = /* @__PURE__ */ new Map();
|
|
316
|
+
constructor(host, scrambler) {
|
|
317
|
+
this.host = host;
|
|
318
|
+
this.scrambler = scrambler;
|
|
319
|
+
this.history = new HistoryGroups(host, scrambler.fingerprint);
|
|
320
|
+
}
|
|
321
|
+
hasUnsaved(indexName) {
|
|
322
|
+
return this.days.get(indexName)?.isChanged === true || this.unsavedDays.has(indexName);
|
|
323
|
+
}
|
|
324
|
+
indexes() {
|
|
325
|
+
return [.../* @__PURE__ */ new Set([...this.days.keys(), ...this.unsavedDays.keys()])];
|
|
326
|
+
}
|
|
327
|
+
inTurn(indexName, work) {
|
|
328
|
+
const previous = this.turns.get(indexName) ?? Promise.resolve();
|
|
329
|
+
const next = previous.then(work, work);
|
|
330
|
+
const settled = next.catch(() => void 0);
|
|
331
|
+
this.turns.set(indexName, settled);
|
|
332
|
+
void settled.then(() => {
|
|
333
|
+
if (this.turns.get(indexName) === settled) this.turns.delete(indexName);
|
|
334
|
+
});
|
|
335
|
+
return next;
|
|
336
|
+
}
|
|
337
|
+
count(indexName, setting, now, request) {
|
|
338
|
+
return this.inTurn(indexName, async () => {
|
|
339
|
+
if (!request.stillEnabled()) return null;
|
|
340
|
+
if (request.isBanned()) return "banned";
|
|
341
|
+
const counts = await this.currentDay(indexName, setting, now);
|
|
342
|
+
const groupAllowed = counts.hasGroup(request.group) || request.groupAllowed(await this.knownGroups(indexName, counts, dayOf(now - setting.retentionDays * DAY_MS)));
|
|
343
|
+
const outcome = counts.count(request.group, request.phrase, this.scrambler.scramble(request.person), groupAllowed);
|
|
344
|
+
if (outcome === "phrase-limit" || outcome === "people-limit") this.warnLimit(indexName, counts.day, outcome);
|
|
345
|
+
return outcome;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
save(indexName) {
|
|
349
|
+
return this.inTurn(indexName, () => this.saveNow(indexName));
|
|
350
|
+
}
|
|
351
|
+
retire(indexName, today) {
|
|
352
|
+
return this.inTurn(indexName, async () => {
|
|
353
|
+
await this.saveNow(indexName);
|
|
354
|
+
const counts = this.days.get(indexName);
|
|
355
|
+
if (counts === void 0 || counts.day >= today || counts.isChanged) return;
|
|
356
|
+
this.history.note(indexName, counts.day, counts.groupNames);
|
|
357
|
+
this.days.delete(indexName);
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
forgetHistoryGroups(indexName) {
|
|
361
|
+
return this.inTurn(indexName, async () => this.history.forget(indexName));
|
|
362
|
+
}
|
|
363
|
+
discard(indexName) {
|
|
364
|
+
return this.inTurn(indexName, async () => {
|
|
365
|
+
this.days.delete(indexName);
|
|
366
|
+
this.unsavedDays.delete(indexName);
|
|
367
|
+
this.history.forget(indexName);
|
|
368
|
+
this.warnedLimits.delete(indexName);
|
|
369
|
+
this.generations.set(indexName, (this.generations.get(indexName) ?? 0) + 1);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
async knownGroups(indexName, counts, cutoff) {
|
|
373
|
+
const known = new Set(counts.groupNames);
|
|
374
|
+
for (const unsaved of this.unsavedDays.get(indexName) ?? []) {
|
|
375
|
+
for (const group of unsaved.groupNames) known.add(group);
|
|
376
|
+
}
|
|
377
|
+
for (const group of await this.history.of(indexName, cutoff)) known.add(group);
|
|
378
|
+
return known;
|
|
379
|
+
}
|
|
380
|
+
warnLimit(indexName, day, reason) {
|
|
381
|
+
const mark = `${day}:${reason}`;
|
|
382
|
+
const warned = this.warnedLimits.get(indexName) ?? "";
|
|
383
|
+
if (warned.split("|").includes(mark)) return;
|
|
384
|
+
this.warnedLimits.set(indexName, warned === "" ? mark : `${warned}|${mark}`);
|
|
385
|
+
this.host.emit("querySuggestionsWarning", { indexName, reason });
|
|
386
|
+
}
|
|
387
|
+
async currentDay(indexName, setting, now) {
|
|
388
|
+
const day = dayOf(now);
|
|
389
|
+
const limits = limitsOf(setting);
|
|
390
|
+
const current = this.days.get(indexName);
|
|
391
|
+
if (current !== void 0 && current.day === day && sameLimits(current.limits, limits)) return current;
|
|
392
|
+
if (current !== void 0) {
|
|
393
|
+
await this.saveNow(indexName);
|
|
394
|
+
if (current.isChanged) {
|
|
395
|
+
if (current.day === day) return current;
|
|
396
|
+
this.unsavedDays.set(indexName, [...this.unsavedDays.get(indexName) ?? [], current]);
|
|
397
|
+
}
|
|
398
|
+
this.history.note(indexName, current.day, current.groupNames);
|
|
399
|
+
this.days.delete(indexName);
|
|
400
|
+
}
|
|
401
|
+
const loaded = await this.load(indexName, day, limits);
|
|
402
|
+
this.days.set(indexName, loaded);
|
|
403
|
+
return loaded;
|
|
404
|
+
}
|
|
405
|
+
async load(indexName, day, limits) {
|
|
406
|
+
const counts = new DayCounts(day, limits);
|
|
407
|
+
const key = dayFileKey(indexName, day);
|
|
408
|
+
const bytes = await this.host.files.read(key);
|
|
409
|
+
if (bytes === null) return counts;
|
|
410
|
+
if (bytes === "too-long") {
|
|
411
|
+
this.host.emit("querySuggestionsWarning", { indexName, reason: "damaged-file", file: key });
|
|
412
|
+
return counts;
|
|
413
|
+
}
|
|
414
|
+
const opened = await openCountsFile(bytes, day, this.scrambler.fingerprint);
|
|
415
|
+
if (opened.kind !== "counts") {
|
|
416
|
+
const reason = opened.kind === "other-key" ? "other-key" : "damaged-file";
|
|
417
|
+
this.host.emit("querySuggestionsWarning", { indexName, reason, file: key });
|
|
418
|
+
return counts;
|
|
419
|
+
}
|
|
420
|
+
if (this.host.clustered && opened.indexUuid !== (this.host.view(indexName)?.indexUuid ?? null)) return counts;
|
|
421
|
+
opened.visit((group, phrase, count, people) => {
|
|
422
|
+
const ids = new Uint8Array(people.offsets.length * SCRAMBLED_ID_BYTES);
|
|
423
|
+
people.offsets.forEach((offset, i) => {
|
|
424
|
+
ids.set(people.source.subarray(offset, offset + SCRAMBLED_ID_BYTES), i * SCRAMBLED_ID_BYTES);
|
|
425
|
+
});
|
|
426
|
+
counts.restorePhrase(group, phrase, count, ids, people.offsets.length);
|
|
427
|
+
});
|
|
428
|
+
return counts;
|
|
429
|
+
}
|
|
430
|
+
async saveNow(indexName) {
|
|
431
|
+
const unsaved = this.unsavedDays.get(indexName);
|
|
432
|
+
if (unsaved !== void 0) {
|
|
433
|
+
const stillUnsaved = [];
|
|
434
|
+
for (const counts2 of unsaved) {
|
|
435
|
+
await this.write(indexName, counts2);
|
|
436
|
+
if (counts2.isChanged) stillUnsaved.push(counts2);
|
|
437
|
+
}
|
|
438
|
+
if (this.unsavedDays.get(indexName) === unsaved) {
|
|
439
|
+
if (stillUnsaved.length === 0) this.unsavedDays.delete(indexName);
|
|
440
|
+
else this.unsavedDays.set(indexName, stillUnsaved);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const counts = this.days.get(indexName);
|
|
444
|
+
if (counts !== void 0) await this.write(indexName, counts);
|
|
445
|
+
}
|
|
446
|
+
async write(indexName, counts) {
|
|
447
|
+
if (!counts.isChanged) return;
|
|
448
|
+
const generation = this.generations.get(indexName) ?? 0;
|
|
449
|
+
const view = this.host.view(indexName);
|
|
450
|
+
const bytes = encodeCountsFile(counts, {
|
|
451
|
+
fingerprint: this.scrambler.fingerprint,
|
|
452
|
+
savedAt: Date.now(),
|
|
453
|
+
indexUuid: this.host.clustered ? view?.indexUuid ?? null : null
|
|
454
|
+
});
|
|
455
|
+
counts.markSaved();
|
|
456
|
+
try {
|
|
457
|
+
if ((this.generations.get(indexName) ?? 0) !== generation) return;
|
|
458
|
+
await this.host.files.write(dayFileKey(indexName, counts.day), bytes);
|
|
459
|
+
} catch (error) {
|
|
460
|
+
counts.markChanged();
|
|
461
|
+
this.host.emit("querySuggestionsWarning", {
|
|
462
|
+
indexName,
|
|
463
|
+
reason: "save-failed",
|
|
464
|
+
message: error instanceof Error ? error.message : String(error)
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
// src/query-suggestions/restored-history.ts
|
|
471
|
+
async function collect(chunks) {
|
|
472
|
+
const parts = [];
|
|
473
|
+
let length = 0;
|
|
474
|
+
for await (const chunk of chunks) {
|
|
475
|
+
parts.push(chunk);
|
|
476
|
+
length += chunk.byteLength;
|
|
477
|
+
}
|
|
478
|
+
const bytes = new Uint8Array(length);
|
|
479
|
+
let offset = 0;
|
|
480
|
+
for (const part of parts) {
|
|
481
|
+
bytes.set(part, offset);
|
|
482
|
+
offset += part.byteLength;
|
|
483
|
+
}
|
|
484
|
+
return bytes;
|
|
485
|
+
}
|
|
486
|
+
var RestoredHistory = class {
|
|
487
|
+
runtime;
|
|
488
|
+
indexName;
|
|
489
|
+
cutoff;
|
|
490
|
+
prefix = restoreStagingPrefix();
|
|
491
|
+
staged = [];
|
|
492
|
+
received = 0;
|
|
493
|
+
constructor(runtime, indexName, setting) {
|
|
494
|
+
this.runtime = runtime;
|
|
495
|
+
this.indexName = indexName;
|
|
496
|
+
this.cutoff = dayOf(Date.now() - resolveSetting(setting).retentionDays * DAY_MS);
|
|
497
|
+
}
|
|
498
|
+
async add(chunks) {
|
|
499
|
+
const position = this.received;
|
|
500
|
+
this.received += 1;
|
|
501
|
+
const bytes = await collect(chunks);
|
|
502
|
+
const scrambler = this.runtime.scrambler;
|
|
503
|
+
if (scrambler === null) return;
|
|
504
|
+
const opened = await openCountsFile(bytes, null, scrambler.fingerprint);
|
|
505
|
+
if (opened.kind !== "counts") {
|
|
506
|
+
this.runtime.host.emit("querySuggestionsWarning", {
|
|
507
|
+
indexName: this.indexName,
|
|
508
|
+
reason: opened.kind === "other-key" ? "other-key" : "damaged-file",
|
|
509
|
+
file: `${QUERY_HISTORY_ARCHIVE_PREFIX}${position}`
|
|
510
|
+
});
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
if (opened.day < this.cutoff) return;
|
|
514
|
+
const key = `${this.prefix}${position}.nrsl`;
|
|
515
|
+
const indexUuid = this.runtime.host.clustered ? this.runtime.host.view(this.indexName)?.indexUuid ?? null : null;
|
|
516
|
+
await this.runtime.host.files.write(key, opened.withIndexUuid(indexUuid, opened.savedAt));
|
|
517
|
+
this.staged.push({ key, day: opened.day });
|
|
518
|
+
}
|
|
519
|
+
async commit() {
|
|
520
|
+
if (this.received === 0) return;
|
|
521
|
+
const { files } = this.runtime.host;
|
|
522
|
+
await this.runtime.discardHistory(this.indexName);
|
|
523
|
+
const sequences = /* @__PURE__ */ new Map();
|
|
524
|
+
const ordered = [...this.staged].sort((left, right) => left.day < right.day ? -1 : left.day > right.day ? 1 : 0);
|
|
525
|
+
for (const file of ordered) {
|
|
526
|
+
const bytes = await files.read(file.key);
|
|
527
|
+
if (bytes instanceof Uint8Array) {
|
|
528
|
+
const sequence = sequences.get(file.day) ?? 0;
|
|
529
|
+
sequences.set(file.day, sequence + 1);
|
|
530
|
+
await files.write(restoredFileKey(this.indexName, file.day, sequence), bytes);
|
|
531
|
+
}
|
|
532
|
+
await files.remove(file.key);
|
|
533
|
+
}
|
|
534
|
+
this.staged.length = 0;
|
|
535
|
+
await this.runtime.days?.forgetHistoryGroups(this.indexName);
|
|
536
|
+
}
|
|
537
|
+
async abandon() {
|
|
538
|
+
for (const file of this.staged) await this.runtime.host.files.remove(file.key);
|
|
539
|
+
this.staged.length = 0;
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
export { DayStore, RestoredHistory, dayOf };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { writeLiveVectors, SINGLE_NODE_PRIMARY_TERM } from './chunk-
|
|
2
|
-
import { vectorsPerFile } from './chunk-
|
|
3
|
-
import { ARCHIVE_CONFIG_ENTRY, ARCHIVE_MANIFEST_ENTRY, tarEnd, tarEntryHeaders, tarPadding, ARCHIVE_FILE_CHUNK_BYTES } from './chunk-
|
|
4
|
-
import { decodeSegmentManifest } from './chunk-
|
|
5
|
-
import { vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-
|
|
6
|
-
import { writeCheckpointSegments, commitCheckpointManifest, partitionContentsOf } from './chunk-
|
|
7
|
-
import { manifestKey, manifestFileRefs } from './chunk-
|
|
1
|
+
import { writeLiveVectors, SINGLE_NODE_PRIMARY_TERM } from './chunk-7LXHHCXZ.mjs';
|
|
2
|
+
import { vectorsPerFile } from './chunk-FCJ553HS.mjs';
|
|
3
|
+
import { ARCHIVE_CONFIG_ENTRY, ARCHIVE_MANIFEST_ENTRY, tarEnd, tarEntryHeaders, tarPadding, ARCHIVE_FILE_CHUNK_BYTES } from './chunk-MQOJIO5B.mjs';
|
|
4
|
+
import { decodeSegmentManifest } from './chunk-4KKXNJM6.mjs';
|
|
5
|
+
import { vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-K4ZIGL2O.mjs';
|
|
6
|
+
import { writeCheckpointSegments, commitCheckpointManifest, partitionContentsOf } from './chunk-JDJBQLRO.mjs';
|
|
7
|
+
import { manifestKey, manifestFileRefs } from './chunk-NF4DT3IH.mjs';
|
|
8
8
|
import { DEFAULT_COMPACTION_THRESHOLD } from './chunk-QDZJM7NI.mjs';
|
|
9
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
9
|
+
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
10
10
|
|
|
11
11
|
// src/persistence/archive/memory-store.ts
|
|
12
12
|
function joined(chunks) {
|
|
@@ -181,6 +181,9 @@ async function* archiveChunks(source) {
|
|
|
181
181
|
for (const ref of manifestFileRefs(source.manifest)) {
|
|
182
182
|
yield* fileEntryChunks(source, ref.key.slice(prefix.length), ref);
|
|
183
183
|
}
|
|
184
|
+
if (source.trailingEntries !== void 0) {
|
|
185
|
+
for await (const entry of source.trailingEntries()) yield* entryChunks(entry.name, entry.bytes);
|
|
186
|
+
}
|
|
184
187
|
yield tarEnd();
|
|
185
188
|
}
|
|
186
189
|
function archiveStream(source) {
|