@delali/narsil 0.3.1-next.145 → 0.3.1-next.146

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist/adapters/filesystem.mjs +2 -2
  2. package/dist/adapters/gcs.mjs +2 -2
  3. package/dist/adapters/indexeddb.mjs +1 -1
  4. package/dist/adapters/s3.mjs +2 -2
  5. package/dist/analysis-change-ZCJNYBJM.mjs +39 -0
  6. package/dist/{analysis-change-entry-V4SQQSXQ.mjs → analysis-change-entry-YN3ELL6C.mjs} +1 -1
  7. package/dist/browser/{analysis-change-QTCQ5ETU.mjs → analysis-change-M65AZQQG.mjs} +8 -5
  8. package/dist/browser/{analysis-change-entry-KYEQSP3I.mjs → analysis-change-entry-H3YIOLXZ.mjs} +1 -1
  9. package/dist/browser/{chunk-GP4QLUQM.mjs → chunk-2JABMB4S.mjs} +10 -6
  10. package/dist/browser/{chunk-5WYWLTM5.mjs → chunk-4DYLCICG.mjs} +2 -2
  11. package/dist/browser/{chunk-75PMIFQA.mjs → chunk-4RD3AFSB.mjs} +1 -1
  12. package/dist/browser/{chunk-XWMEGKDC.mjs → chunk-5V74FFZE.mjs} +2 -2
  13. package/dist/browser/{chunk-PMBSBSCN.mjs → chunk-6OWX3OP2.mjs} +2 -2
  14. package/dist/browser/chunk-BRWY3JCN.mjs +678 -0
  15. package/dist/browser/{chunk-ZALEKEUH.mjs → chunk-BVX2MEHA.mjs} +306 -607
  16. package/dist/browser/{chunk-FXPMF65P.mjs → chunk-D6UFGBF5.mjs} +15 -45
  17. package/dist/browser/{chunk-QNDWMPV2.mjs → chunk-IAXZAVYL.mjs} +25 -66
  18. package/dist/browser/chunk-JNOAKDUM.mjs +31 -0
  19. package/dist/browser/{chunk-BTMRV5MY.mjs → chunk-KAEVGLYN.mjs} +2 -2
  20. package/dist/browser/{chunk-FHO5N7FD.mjs → chunk-LURXVCHG.mjs} +1 -1
  21. package/dist/browser/chunk-MPK76GVS.mjs +63 -0
  22. package/dist/browser/{chunk-6OFS7RUN.mjs → chunk-NVEJJP4R.mjs} +1 -1
  23. package/dist/browser/{chunk-U77XQJOY.mjs → chunk-ODQP7P3H.mjs} +455 -66
  24. package/dist/browser/{chunk-IFGTRRPU.mjs → chunk-PIS7ZAP7.mjs} +3 -25
  25. package/dist/browser/{chunk-XIHLIMFX.mjs → chunk-QMNZFFD3.mjs} +4 -3
  26. package/dist/browser/{chunk-AOKLYVTT.mjs → chunk-SRL47USS.mjs} +2 -2
  27. package/dist/browser/chunk-TY7L6OXO.mjs +69 -0
  28. package/dist/browser/{chunk-LGJ6XMH5.mjs → chunk-W643QV3L.mjs} +6 -5
  29. package/dist/browser/chunk-WXLBZJMT.mjs +25 -0
  30. package/dist/browser/{chunk-ZKVDQ5ZH.mjs → chunk-XILIT5MT.mjs} +8 -8
  31. package/dist/browser/{cold-module-Y2IJAP7S.mjs → cold-module-A5S6JFDN.mjs} +20 -20
  32. package/dist/browser/{durability-wiring-MLXZ5QQF.mjs → durability-wiring-W5AVV3RF.mjs} +53 -30
  33. package/dist/browser/gzip-5S7ROJFJ.mjs +1 -0
  34. package/dist/browser/import-PTT63AGK.mjs +12 -0
  35. package/dist/browser/{module-5LMDGXQH.mjs → module-CEKA7MQH.mjs} +13 -10
  36. package/dist/browser/module-X5PGOE47.mjs +4288 -0
  37. package/dist/browser/{phrase-module-KXNRTWCS.mjs → phrase-module-CNKMUY4U.mjs} +2 -1
  38. package/dist/browser/pool-DTYSPBMQ.mjs +296 -0
  39. package/dist/{restore-queue-UAVGBSJG.mjs → browser/restore-queue-DD4LWZK7.mjs} +2 -2
  40. package/dist/browser/{runtime-ZNEGK33G.mjs → runtime-D2ULZGCN.mjs} +3 -2
  41. package/dist/browser/{snapshot-2EGS2FYU.mjs → snapshot-DQ6A4PQP.mjs} +18 -14
  42. package/dist/browser/{write-WMZA6NSF.mjs → write-MAGRAIEH.mjs} +14 -11
  43. package/dist/{capabilities-CNnzGtqP.d.ts → capabilities-BT-HLDC8.d.ts} +2 -2
  44. package/dist/{chunk-FRJ5RGX7.mjs → chunk-2HJWQPR6.mjs} +2 -2
  45. package/dist/{chunk-DKMZ7JFW.mjs → chunk-3BVGJ4JR.mjs} +10 -4
  46. package/dist/{chunk-QYMAYU7M.mjs → chunk-3HV7M5OJ.mjs} +155 -149
  47. package/dist/chunk-3MXV3VHR.mjs +46 -0
  48. package/dist/{chunk-6FOJKNUR.mjs → chunk-3SBJVQLL.mjs} +2 -2
  49. package/dist/{chunk-PRID7CA6.mjs → chunk-3TVDTACC.mjs} +1 -1
  50. package/dist/{chunk-RTVAWNUL.mjs → chunk-5WB2A3XU.mjs} +9 -6
  51. package/dist/{chunk-LWFK3TC2.mjs → chunk-65WCV5JO.mjs} +1 -1
  52. package/dist/{chunk-G6Q5DEF5.mjs → chunk-6BWLDLS3.mjs} +3 -46
  53. package/dist/{chunk-W6M4RRAT.mjs → chunk-6C5EX2QR.mjs} +3 -3
  54. package/dist/{chunk-HOC5JP2H.mjs → chunk-6F6USYII.mjs} +119 -11
  55. package/dist/{chunk-7523VCM4.mjs → chunk-7HKWO4BJ.mjs} +7 -7
  56. package/dist/{chunk-ONDEEBTA.mjs → chunk-7N223GWV.mjs} +2 -2
  57. package/dist/{chunk-UGQULMSU.mjs → chunk-ADBS5XRI.mjs} +10 -10
  58. package/dist/{chunk-MJTEU2XK.mjs → chunk-AWNHDBKV.mjs} +429 -73
  59. package/dist/{chunk-2E2ZFOPT.mjs → chunk-B2FTZNNF.mjs} +2 -2
  60. package/dist/{chunk-NWTEJ2T7.mjs → chunk-B7XIOAMK.mjs} +3 -3
  61. package/dist/{chunk-W55X2BYN.mjs → chunk-BEZH7VEH.mjs} +1 -1
  62. package/dist/chunk-BTPGQC6Z.mjs +27 -0
  63. package/dist/{chunk-KG5N7LE6.mjs → chunk-CYYSZPVV.mjs} +11 -11
  64. package/dist/{chunk-HTMUGEFU.mjs → chunk-DOY6EG76.mjs} +6 -6
  65. package/dist/{chunk-UHVTEVF5.mjs → chunk-F22IOCR2.mjs} +10 -6
  66. package/dist/{chunk-FTQLF5JI.mjs → chunk-IRWP524D.mjs} +1 -1
  67. package/dist/{chunk-XLAI4OIO.mjs → chunk-IZT3G24Q.mjs} +2 -2
  68. package/dist/{chunk-SE7MKJVK.mjs → chunk-J7M73VY7.mjs} +1 -1
  69. package/dist/chunk-KAKQ74LS.mjs +53 -0
  70. package/dist/{chunk-GVPYMSLO.mjs → chunk-KYVRZAYP.mjs} +1 -1
  71. package/dist/{chunk-F442VZUL.mjs → chunk-KZ5GQE4Z.mjs} +5 -5
  72. package/dist/{chunk-WDEWU46C.mjs → chunk-KZQIVGW7.mjs} +2 -2
  73. package/dist/{chunk-7AJAW6NN.mjs → chunk-L7TIAYPX.mjs} +8 -8
  74. package/dist/{chunk-GRFXSEFF.mjs → chunk-LDGGR7YT.mjs} +4 -81
  75. package/dist/{chunk-WMIV7PJ7.mjs → chunk-LJ4ENXOD.mjs} +15 -14
  76. package/dist/chunk-LQG5G2LY.mjs +39 -0
  77. package/dist/{chunk-IQHZMCLX.mjs → chunk-MDF6PDIA.mjs} +2 -0
  78. package/dist/{chunk-QXH2CS4V.mjs → chunk-NVTFQFUL.mjs} +7 -26
  79. package/dist/{chunk-5K2JHKM3.mjs → chunk-NYSONUB7.mjs} +1 -1
  80. package/dist/{chunk-OH7SX5MY.mjs → chunk-O4KUNDVF.mjs} +12 -10
  81. package/dist/{chunk-EBIHRL7B.mjs → chunk-Q2UL2TPC.mjs} +1 -1
  82. package/dist/{chunk-RNUP6WZ6.mjs → chunk-QEYF2SQ6.mjs} +2 -2
  83. package/dist/{chunk-RVBUQITB.mjs → chunk-QN5WVV5K.mjs} +7 -7
  84. package/dist/{chunk-RIIUZJQ3.mjs → chunk-QYRNLLLI.mjs} +1 -1
  85. package/dist/{chunk-BTARFTEN.mjs → chunk-SOUZMPME.mjs} +4 -4
  86. package/dist/{chunk-ISUOSACK.mjs → chunk-T4CJDBBE.mjs} +1 -1
  87. package/dist/{chunk-DHEJAGVW.mjs → chunk-TTCKT2RT.mjs} +5 -5
  88. package/dist/{chunk-QU2XF7VI.mjs → chunk-U2726TL5.mjs} +5 -4
  89. package/dist/{chunk-LYKUJNAV.mjs → chunk-U46IZNCW.mjs} +2 -2
  90. package/dist/{chunk-SNB4DYL3.mjs → chunk-U6NE6RCV.mjs} +4 -4
  91. package/dist/{chunk-SA52N7G3.mjs → chunk-VP6XRMWR.mjs} +4 -4
  92. package/dist/{chunk-YUCGFPMS.mjs → chunk-VQDZVWN3.mjs} +449 -405
  93. package/dist/{chunk-IWVEG5CX.mjs → chunk-XIHUI4KB.mjs} +2 -2
  94. package/dist/{chunk-IV2XTSS2.mjs → chunk-XKPNKR3V.mjs} +16 -46
  95. package/dist/{chunk-UQS5PAS5.mjs → chunk-YGQOPB2Z.mjs} +1 -1
  96. package/dist/{chunk-SVO6NV4D.mjs → chunk-YKEHQUSZ.mjs} +4 -4
  97. package/dist/{chunk-6Z22L5RN.mjs → chunk-ZAYWOHVG.mjs} +1 -1
  98. package/dist/{chunk-QLDLQW36.mjs → chunk-ZEKDO7YX.mjs} +2 -2
  99. package/dist/chunk-ZXNNR73R.mjs +31 -0
  100. package/dist/{chunk-VJS4JFBQ.mjs → chunk-ZXX5GZEX.mjs} +3 -1
  101. package/dist/{chunk-X5SBWARI.mjs → chunk-ZYKUD5NX.mjs} +9 -7
  102. package/dist/{client-DoYPHcUn.d.ts → client-Cn3gNxUU.d.ts} +3 -3
  103. package/dist/client.d.ts +5 -5
  104. package/dist/client.mjs +2 -0
  105. package/dist/{cold-module-NUD332YD.mjs → cold-module-2WWGBFJC.mjs} +36 -33
  106. package/dist/{config-CuUfls_H.d.ts → config-CfhH1IWQ.d.ts} +1 -1
  107. package/dist/{config-Dzs46im6.d.ts → config-aIsy7mcL.d.ts} +52 -1
  108. package/dist/direct-executor-QLVHMELJ.mjs +24 -0
  109. package/dist/distribution/coordinator/etcd.mjs +1 -1
  110. package/dist/distribution/transport/grpc.mjs +1 -1
  111. package/dist/distribution.d.ts +4 -4
  112. package/dist/distribution.mjs +150 -255
  113. package/dist/{durability-wiring-K7RDXWL6.mjs → durability-wiring-GNWQSZI3.mjs} +67 -42
  114. package/dist/embeddings/openai.mjs +2 -2
  115. package/dist/{engine-C0ifUEcm.d.ts → engine-CJRUHXgf.d.ts} +1 -1
  116. package/dist/gzip-F4HMIEEQ.mjs +1 -0
  117. package/dist/import-DX55PN4G.mjs +41 -0
  118. package/dist/index.browser.mjs +7 -4
  119. package/dist/index.d.ts +539 -5
  120. package/dist/index.mjs +22 -16
  121. package/dist/index.react-native.mjs +19 -0
  122. package/dist/{long-query-thread-FKVHRCHF.mjs → long-query-thread-SCUE62TO.mjs} +20 -17
  123. package/dist/{module-GJUKW5VU.mjs → module-HW6IXUM6.mjs} +601 -108
  124. package/dist/{module-TMFIWOD2.mjs → module-V5K4ZP23.mjs} +29 -23
  125. package/dist/{paged-partition-archive-WNUEMYWM.mjs → paged-partition-archive-FDIIWZNR.mjs} +31 -25
  126. package/dist/partial-words.mjs +5 -5
  127. package/dist/pattern.mjs +3 -3
  128. package/dist/persistence/durability/checkpoint-worker.mjs +28 -22
  129. package/dist/{phrase-module-OMY3QQV7.mjs → phrase-module-OUQIRUQU.mjs} +1 -1
  130. package/dist/pool-UPV5PVPY.mjs +298 -0
  131. package/dist/react-native/chunks/analysis-change-HGW3L6NY.mjs +893 -0
  132. package/dist/react-native/chunks/analysis-change-entry-BNRU6STO.mjs +1 -0
  133. package/dist/react-native/chunks/chunk-2J2727V4.mjs +495 -0
  134. package/dist/react-native/chunks/chunk-3CTWSQRW.mjs +1251 -0
  135. package/dist/react-native/chunks/chunk-5FV4ZEVA.mjs +2619 -0
  136. package/dist/react-native/chunks/chunk-7VWQLEFV.mjs +642 -0
  137. package/dist/react-native/chunks/chunk-AAAETEJK.mjs +27 -0
  138. package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +32 -0
  139. package/dist/react-native/chunks/chunk-B6OD63Z3.mjs +997 -0
  140. package/dist/react-native/chunks/chunk-BRNAVOKP.mjs +177 -0
  141. package/dist/react-native/chunks/chunk-DKJTZ625.mjs +207 -0
  142. package/dist/react-native/chunks/chunk-FKGG4UOF.mjs +177 -0
  143. package/dist/{browser/chunk-K7UFXEJS.mjs → react-native/chunks/chunk-GV5KFQ6M.mjs} +12 -6
  144. package/dist/react-native/chunks/chunk-HURV3ASY.mjs +4416 -0
  145. package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +10 -0
  146. package/dist/react-native/chunks/chunk-JV6VQY2S.mjs +17 -0
  147. package/dist/react-native/chunks/chunk-KUJOBRKS.mjs +217 -0
  148. package/dist/react-native/chunks/chunk-KWRW5U65.mjs +226 -0
  149. package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +110 -0
  150. package/dist/react-native/chunks/chunk-LQ6Q4L5B.mjs +360 -0
  151. package/dist/react-native/chunks/chunk-LQAKO5QV.mjs +523 -0
  152. package/dist/react-native/chunks/chunk-LRGWK367.mjs +11 -0
  153. package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +93 -0
  154. package/dist/react-native/chunks/chunk-NFGBOI46.mjs +14 -0
  155. package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +8 -0
  156. package/dist/react-native/chunks/chunk-PPEPTUVV.mjs +56 -0
  157. package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +9 -0
  158. package/dist/react-native/chunks/chunk-PU55IOG4.mjs +910 -0
  159. package/dist/react-native/chunks/chunk-QC4ZRBSX.mjs +270 -0
  160. package/dist/react-native/chunks/chunk-R4EEMYM6.mjs +21 -0
  161. package/dist/react-native/chunks/chunk-R4OPUZQ5.mjs +86 -0
  162. package/dist/react-native/chunks/chunk-SLGIAD6B.mjs +2634 -0
  163. package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +25 -0
  164. package/dist/react-native/chunks/chunk-TLYD7IJ2.mjs +23 -0
  165. package/dist/react-native/chunks/chunk-UFNCLEQM.mjs +73 -0
  166. package/dist/react-native/chunks/chunk-YH7W556M.mjs +179 -0
  167. package/dist/react-native/chunks/chunk-YJSMEKRE.mjs +22385 -0
  168. package/dist/react-native/chunks/chunk-ZCKNBPQ4.mjs +79 -0
  169. package/dist/react-native/chunks/cold-module-TSFWLYWC.mjs +755 -0
  170. package/dist/react-native/chunks/durability-wiring-PZR6KOQK.mjs +4509 -0
  171. package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +3 -0
  172. package/dist/react-native/chunks/import-VTODLPLO.mjs +22 -0
  173. package/dist/{browser/module-Q6VFGLMG.mjs → react-native/chunks/module-JBBH6PZH.mjs} +609 -144
  174. package/dist/react-native/chunks/module-VEK2KCKU.mjs +25 -0
  175. package/dist/react-native/chunks/phrase-module-76UAPPSG.mjs +329 -0
  176. package/dist/react-native/chunks/pool-CD4ANYUI.mjs +296 -0
  177. package/dist/react-native/chunks/release-D7ZTIANM.mjs +33 -0
  178. package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
  179. package/dist/{browser/restore-queue-SOAHKZSQ.mjs → react-native/chunks/restore-queue-OI5EH7R3.mjs} +2 -2
  180. package/dist/react-native/chunks/runtime-3MCDLJAF.mjs +559 -0
  181. package/dist/react-native/chunks/snapshot-AUZMEV36.mjs +1205 -0
  182. package/dist/react-native/chunks/write-DDC2QBRJ.mjs +197 -0
  183. package/dist/react-native/partial-words.mjs +733 -0
  184. package/dist/react-native/pattern.mjs +2442 -0
  185. package/dist/react-native/synonyms.mjs +460 -0
  186. package/dist/react.d.ts +7 -7
  187. package/dist/react.mjs +2 -0
  188. package/dist/{rerank-ZZ5CHKLW.mjs → rerank-3W54N6P2.mjs} +4 -4
  189. package/dist/rerankers/http.mjs +2 -2
  190. package/dist/restore-queue-BQWWNNQI.mjs +41 -0
  191. package/dist/{runtime-RAOCKSYA.mjs → runtime-L2DZYY6N.mjs} +5 -5
  192. package/dist/server.d.ts +8 -8
  193. package/dist/server.mjs +32 -28
  194. package/dist/{snapshot-DB5ZVCDN.mjs → snapshot-EHXTOTW5.mjs} +39 -33
  195. package/dist/synonyms.mjs +3 -3
  196. package/dist/{tasks-ChWp0wrF.d.ts → tasks-C4ElXr4P.d.ts} +2 -2
  197. package/dist/thread-I7DVHHW7.mjs +31 -0
  198. package/dist/vector/search-worker.mjs +7 -5
  199. package/dist/workers/entry.mjs +9 -9
  200. package/dist/{write-KZVTLGCI.mjs → write-SDJXXQ2G.mjs} +29 -23
  201. package/package.json +88 -7
  202. package/dist/analysis-change-D5APH4Z3.mjs +0 -34
  203. package/dist/browser/import-FTMLTPGQ.mjs +0 -9
  204. package/dist/direct-executor-FDQYQEJQ.mjs +0 -22
  205. package/dist/import-6KXFY6XI.mjs +0 -35
  206. package/dist/thread-OV6T555H.mjs +0 -28
  207. /package/dist/{chunk-22YPZVMG.mjs → chunk-ZXNQEW43.mjs} +0 -0
@@ -0,0 +1,460 @@
1
+ import { targetOfPending } from './chunks/chunk-TLYD7IJ2.mjs';
2
+ import { withOpenIndex, oneAtATime, resolveIndexAnalysis } from './chunks/chunk-3CTWSQRW.mjs';
3
+ import { encodeStringBlob, tokenize, encodeLookupKey } from './chunks/chunk-2J2727V4.mjs';
4
+ import './chunks/chunk-KWRW5U65.mjs';
5
+ import { compareCodePoints } from './chunks/chunk-PPEPTUVV.mjs';
6
+ import './chunks/chunk-JV6VQY2S.mjs';
7
+ import { NarsilError, ErrorCodes } from './chunks/chunk-YH7W556M.mjs';
8
+ import { encode, decode } from '@msgpack/msgpack';
9
+
10
+ // src/core/synonyms/constants.ts
11
+ var MAX_SYNONYM_RULES = 1e5;
12
+ var MAX_SYNONYM_WORDS = 5e5;
13
+ var MAX_SYNONYM_WORD_BYTES = 4194304;
14
+ var MAX_SYNONYM_RULE_WORDS = 100;
15
+ var MIN_TWO_WAY_SYNONYM_WORDS = 2;
16
+ var MIN_ONE_WAY_SYNONYMS = 1;
17
+ var SYNONYMS_ADDED_PER_QUERY = 50;
18
+ var SYNONYM_EXPANSION_CACHE_ENTRIES = 1024;
19
+
20
+ // src/core/synonyms/combined-postings.ts
21
+ var NO_DELETED = { size: 0, has: () => false };
22
+ var FIELD_SLOTS = 65536;
23
+ function combinePostingLists(lists) {
24
+ if (lists.length === 1) return lists[0];
25
+ const rowOf = /* @__PURE__ */ new Map();
26
+ const docIds = [];
27
+ const fieldNameIndices = [];
28
+ const frequencies = [];
29
+ const documents = /* @__PURE__ */ new Set();
30
+ let totalTermFrequency = 0;
31
+ for (const list of lists) {
32
+ const deleted = list.deletedDocs;
33
+ const hasDeleted = deleted.size > 0;
34
+ for (let row = 0; row < list.length; row++) {
35
+ const docId = list.docIds[row];
36
+ if (hasDeleted && deleted.has(docId)) continue;
37
+ const field = list.fieldNameIndices[row];
38
+ const frequency = list.termFrequencies[row];
39
+ totalTermFrequency += frequency;
40
+ const key = docId * FIELD_SLOTS + field;
41
+ const existing = rowOf.get(key);
42
+ if (existing !== void 0) {
43
+ frequencies[existing] += frequency;
44
+ continue;
45
+ }
46
+ rowOf.set(key, docIds.length);
47
+ docIds.push(docId);
48
+ fieldNameIndices.push(field);
49
+ frequencies.push(frequency);
50
+ documents.add(docId);
51
+ }
52
+ }
53
+ return {
54
+ length: docIds.length,
55
+ docIds: Uint32Array.from(docIds),
56
+ termFrequencies: Float64Array.from(frequencies),
57
+ fieldNameIndices: Uint16Array.from(fieldNameIndices),
58
+ positions: null,
59
+ docIdSet: documents,
60
+ deletedDocs: NO_DELETED,
61
+ totalTermFrequency,
62
+ structureRevision: 0,
63
+ ordered: false
64
+ };
65
+ }
66
+
67
+ // src/core/synonyms/expand.ts
68
+ function groupSynonymsOf(tokens) {
69
+ return {
70
+ tokens,
71
+ has: (token) => tokens.includes(token),
72
+ documentFrequency(frequencyOf) {
73
+ let most = 0;
74
+ for (const token of tokens) most = Math.max(most, frequencyOf(token));
75
+ return most;
76
+ },
77
+ postings(lookup, own) {
78
+ const lists = [];
79
+ for (const token of [own, ...tokens]) {
80
+ const list = lookup(token);
81
+ if (list !== void 0) lists.push(list);
82
+ }
83
+ return lists.length === 0 ? void 0 : combinePostingLists(lists);
84
+ }
85
+ };
86
+ }
87
+ function expandQuerySynonyms(lookup, queryTokens) {
88
+ const withSynonyms = [];
89
+ const seen = /* @__PURE__ */ new Set();
90
+ for (const token of queryTokens) {
91
+ if (seen.has(token)) continue;
92
+ seen.add(token);
93
+ const synonyms2 = lookup.synonymsOf(token);
94
+ if (synonyms2.length > 0) withSynonyms.push({ token, synonyms: synonyms2 });
95
+ if (withSynonyms.length === SYNONYMS_ADDED_PER_QUERY) break;
96
+ }
97
+ const count = withSynonyms.length;
98
+ if (count === 0) return void 0;
99
+ const share = Math.floor(SYNONYMS_ADDED_PER_QUERY / count);
100
+ const extra = SYNONYMS_ADDED_PER_QUERY % count;
101
+ const expanded = /* @__PURE__ */ new Map();
102
+ const added = /* @__PURE__ */ new Set();
103
+ for (let i = 0; i < count; i++) {
104
+ const quota = share + (i < extra ? 1 : 0);
105
+ const { token, synonyms: synonyms2 } = withSynonyms[i];
106
+ const kept = synonyms2.length <= quota ? synonyms2 : synonyms2.slice(0, quota);
107
+ expanded.set(token, kept);
108
+ for (const synonym of kept) added.add(synonym);
109
+ }
110
+ return {
111
+ tokens: [...added],
112
+ addTo(groupOf) {
113
+ for (const [token, synonyms2] of expanded) {
114
+ const group = groupOf(token);
115
+ group.synonyms = groupSynonymsOf(synonyms2);
116
+ group.members = group.members.filter((member) => member.token === token || !synonyms2.includes(member.token));
117
+ }
118
+ }
119
+ };
120
+ }
121
+
122
+ // src/core/synonyms/lookup.ts
123
+ var NO_SOURCE = -1;
124
+ var NO_SYNONYMS = Object.freeze([]);
125
+ var decoder = new TextDecoder();
126
+ function analyseWord(word, analysis, cache) {
127
+ const cached = cache.get(word);
128
+ if (cached !== void 0) return cached;
129
+ const { tokens } = tokenize(word, analysis.language, {
130
+ stem: true,
131
+ removeStopWords: true,
132
+ customTokenizer: analysis.customTokenizer,
133
+ stopWordOverride: analysis.stopWords
134
+ });
135
+ const result = tokens.length === 1 ? tokens[0].token : tokens.length;
136
+ cache.set(word, result);
137
+ return result;
138
+ }
139
+ function intern(interned, token) {
140
+ let id = interned.ids.get(token);
141
+ if (id === void 0) {
142
+ id = interned.tokens.length;
143
+ interned.tokens.push(token);
144
+ interned.ids.set(token, id);
145
+ }
146
+ return id;
147
+ }
148
+ function sourceWordOf(rule) {
149
+ return "word" in rule ? rule.word : void 0;
150
+ }
151
+ function targetWordsOf(rule) {
152
+ return "words" in rule ? rule.words : rule.synonyms;
153
+ }
154
+ function packedLookup(tokens, ruleStart, ruleTokenIds, ruleSource) {
155
+ const order = tokens.map((_, id) => id).sort((a, b) => compareCodePoints(tokens[a], tokens[b]));
156
+ const rank = new Uint32Array(tokens.length);
157
+ for (let position = 0; position < order.length; position++) rank[order[position]] = position;
158
+ const { blob, offsets } = encodeStringBlob(order.map((id) => tokens[id]));
159
+ const ruleTokens = Uint32Array.from(ruleTokenIds, (id) => rank[id]);
160
+ const sources = Int32Array.from(ruleSource, (id) => id === NO_SOURCE ? NO_SOURCE : rank[id]);
161
+ const ruleCount = sources.length;
162
+ const tokenRuleStart = new Uint32Array(tokens.length + 1);
163
+ for (let rule = 0; rule < ruleCount; rule++) {
164
+ if (sources[rule] !== NO_SOURCE) tokenRuleStart[sources[rule] + 1]++;
165
+ else for (let i = ruleStart[rule]; i < ruleStart[rule + 1]; i++) tokenRuleStart[ruleTokens[i] + 1]++;
166
+ }
167
+ for (let token = 0; token < tokens.length; token++) tokenRuleStart[token + 1] += tokenRuleStart[token];
168
+ const tokenRules = new Uint32Array(tokenRuleStart[tokens.length]);
169
+ const fill = tokenRuleStart.slice(0, tokens.length);
170
+ for (let rule = 0; rule < ruleCount; rule++) {
171
+ if (sources[rule] !== NO_SOURCE) tokenRules[fill[sources[rule]]++] = rule;
172
+ else for (let i = ruleStart[rule]; i < ruleStart[rule + 1]; i++) tokenRules[fill[ruleTokens[i]]++] = rule;
173
+ }
174
+ const cache = /* @__PURE__ */ new Map();
175
+ const bytes = blob.byteLength + offsets.byteLength + ruleStart.byteLength + ruleTokens.byteLength + sources.byteLength + tokenRuleStart.byteLength + tokenRules.byteLength;
176
+ function rankOf(token) {
177
+ const key = encodeLookupKey(token);
178
+ let low = 0;
179
+ let high = offsets.length - 2;
180
+ while (low <= high) {
181
+ const middle = low + high >>> 1;
182
+ const start = offsets[middle];
183
+ const end = offsets[middle + 1];
184
+ let order2 = 0;
185
+ const shorter = Math.min(end - start, key.length);
186
+ for (let i = 0; i < shorter && order2 === 0; i++) order2 = blob[start + i] - key[i];
187
+ if (order2 === 0) order2 = end - start - key.length;
188
+ if (order2 === 0) return middle;
189
+ if (order2 < 0) low = middle + 1;
190
+ else high = middle - 1;
191
+ }
192
+ return -1;
193
+ }
194
+ function collect(token) {
195
+ const found = [];
196
+ for (let i = tokenRuleStart[token]; i < tokenRuleStart[token + 1]; i++) {
197
+ const rule = tokenRules[i];
198
+ for (let j = ruleStart[rule]; j < ruleStart[rule + 1]; j++) {
199
+ if (ruleTokens[j] !== token) found.push(ruleTokens[j]);
200
+ }
201
+ }
202
+ if (found.length === 0) return NO_SYNONYMS;
203
+ found.sort((a, b) => a - b);
204
+ const synonyms2 = [];
205
+ let previous = -1;
206
+ for (const id of found) {
207
+ if (synonyms2.length === SYNONYMS_ADDED_PER_QUERY) break;
208
+ if (id === previous) continue;
209
+ previous = id;
210
+ synonyms2.push(decoder.decode(blob.subarray(offsets[id], offsets[id + 1])));
211
+ }
212
+ return Object.freeze(synonyms2);
213
+ }
214
+ const lookup = {
215
+ tokenCount: tokens.length,
216
+ bytes,
217
+ expand: (queryTokens) => expandQuerySynonyms(lookup, queryTokens),
218
+ synonymsOf(token) {
219
+ const cached = cache.get(token);
220
+ if (cached !== void 0) {
221
+ cache.delete(token);
222
+ cache.set(token, cached);
223
+ return cached;
224
+ }
225
+ const rankOfToken = rankOf(token);
226
+ if (rankOfToken < 0) return NO_SYNONYMS;
227
+ const synonyms2 = collect(rankOfToken);
228
+ if (cache.size >= SYNONYM_EXPANSION_CACHE_ENTRIES) {
229
+ const oldest = cache.keys().next();
230
+ if (oldest.done !== true) cache.delete(oldest.value);
231
+ }
232
+ cache.set(token, synonyms2);
233
+ return synonyms2;
234
+ }
235
+ };
236
+ return lookup;
237
+ }
238
+ function buildSynonymLookup(rules, analysis, raise) {
239
+ const analysed = /* @__PURE__ */ new Map();
240
+ const interned = { ids: /* @__PURE__ */ new Map(), tokens: [] };
241
+ const ruleStart = new Uint32Array(rules.length + 1);
242
+ const ruleTokenIds = [];
243
+ const ruleSource = new Int32Array(rules.length).fill(NO_SOURCE);
244
+ const kept = new Uint8Array(rules.length);
245
+ function tokenOf(word, rule) {
246
+ const result = analyseWord(word, analysis, analysed);
247
+ if (typeof result === "string") return result;
248
+ if (raise !== null) {
249
+ const reason = result === 0 ? "to no token, as a stop word does" : `to ${result} tokens, as a phrase does`;
250
+ raise(`Synonym rule ${rule} holds a word that the index analyses ${reason}`, { rule, tokens: result });
251
+ }
252
+ return null;
253
+ }
254
+ for (let rule = 0; rule < rules.length; rule++) {
255
+ const source = sourceWordOf(rules[rule]);
256
+ const sourceToken = source === void 0 ? null : tokenOf(source, rule);
257
+ const seen = /* @__PURE__ */ new Set();
258
+ for (const word of targetWordsOf(rules[rule])) {
259
+ const token = tokenOf(word, rule);
260
+ if (token === null) continue;
261
+ const id = intern(interned, token);
262
+ if (seen.has(id)) continue;
263
+ seen.add(id);
264
+ ruleTokenIds.push(id);
265
+ }
266
+ if (source === void 0) kept[rule] = 1;
267
+ else if (sourceToken !== null) {
268
+ ruleSource[rule] = intern(interned, sourceToken);
269
+ kept[rule] = 1;
270
+ }
271
+ if (kept[rule] === 0) ruleTokenIds.length = ruleStart[rule];
272
+ ruleStart[rule + 1] = ruleTokenIds.length;
273
+ }
274
+ if (ruleTokenIds.length === 0) return null;
275
+ return packedLookup(interned.tokens, ruleStart, ruleTokenIds, ruleSource);
276
+ }
277
+ var FIRST_PRINTABLE_CODE = 32;
278
+ function holdsControlCharacter(word) {
279
+ for (let i = 0; i < word.length; i++) if (word.charCodeAt(i) < FIRST_PRINTABLE_CODE) return true;
280
+ return false;
281
+ }
282
+ function utf8Length(word) {
283
+ let bytes = 0;
284
+ for (let i = 0; i < word.length; i++) {
285
+ const unit = word.charCodeAt(i);
286
+ if (unit < 128) bytes += 1;
287
+ else if (unit < 2048) bytes += 2;
288
+ else if (unit >= 55296 && unit < 56320 && i + 1 < word.length) {
289
+ const low = word.charCodeAt(i + 1);
290
+ if (low >= 56320 && low < 57344) {
291
+ bytes += 4;
292
+ i++;
293
+ } else bytes += 3;
294
+ } else bytes += 3;
295
+ }
296
+ return bytes;
297
+ }
298
+ function hasOnlyKeys(value, keys) {
299
+ const own = Object.keys(value);
300
+ return own.length === keys.length && keys.every((key) => Object.hasOwn(value, key));
301
+ }
302
+ function readWord(value, rule, tally, raise) {
303
+ if (typeof value !== "string") {
304
+ raise(`Synonym rule ${rule} holds a word that is not a string`, { rule });
305
+ }
306
+ if (holdsControlCharacter(value)) {
307
+ raise(`Synonym rule ${rule} holds a word with a control character`, { rule });
308
+ }
309
+ tally.words++;
310
+ tally.bytes += utf8Length(value);
311
+ if (tally.words > MAX_SYNONYM_WORDS) {
312
+ raise(`A synonym set holds at most ${MAX_SYNONYM_WORDS} words`, { maxWords: MAX_SYNONYM_WORDS });
313
+ }
314
+ if (tally.bytes > MAX_SYNONYM_WORD_BYTES) {
315
+ raise(`The words of a synonym set hold at most ${MAX_SYNONYM_WORD_BYTES} bytes in UTF-8`, {
316
+ maxWordBytes: MAX_SYNONYM_WORD_BYTES
317
+ });
318
+ }
319
+ return value;
320
+ }
321
+ function readWords(value, rule, key, minimum, maximum, tally, raise) {
322
+ if (!Array.isArray(value) || value.length < minimum || value.length > maximum) {
323
+ raise(`Synonym rule ${rule} needs "${key}" as a list of ${minimum} to ${maximum} words`, { rule });
324
+ }
325
+ const words = new Array(value.length);
326
+ for (let i = 0; i < value.length; i++) words[i] = readWord(value[i], rule, tally, raise);
327
+ return words;
328
+ }
329
+ function readRule(value, rule, tally, raise) {
330
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
331
+ raise(`Synonym rule ${rule} must be an object`, { rule });
332
+ }
333
+ if (hasOnlyKeys(value, ["words"])) {
334
+ const words = Reflect.get(value, "words");
335
+ return { words: readWords(words, rule, "words", MIN_TWO_WAY_SYNONYM_WORDS, MAX_SYNONYM_RULE_WORDS, tally, raise) };
336
+ }
337
+ if (hasOnlyKeys(value, ["word", "synonyms"])) {
338
+ const word = readWord(Reflect.get(value, "word"), rule, tally, raise);
339
+ const synonyms2 = readWords(
340
+ Reflect.get(value, "synonyms"),
341
+ rule,
342
+ "synonyms",
343
+ MIN_ONE_WAY_SYNONYMS,
344
+ MAX_SYNONYM_RULE_WORDS - 1,
345
+ tally,
346
+ raise
347
+ );
348
+ return { word, synonyms: synonyms2 };
349
+ }
350
+ raise(`Synonym rule ${rule} must hold either "words" alone, or "word" and "synonyms"`, { rule });
351
+ }
352
+ function parseSynonymRules(value, raise) {
353
+ if (!Array.isArray(value)) raise("A synonym set must be a list of rules", {});
354
+ if (value.length > MAX_SYNONYM_RULES) {
355
+ raise(`A synonym set holds at most ${MAX_SYNONYM_RULES} rules`, { maxRules: MAX_SYNONYM_RULES });
356
+ }
357
+ const tally = { words: 0, bytes: 0 };
358
+ const rules = new Array(value.length);
359
+ for (let rule = 0; rule < value.length; rule++) rules[rule] = readRule(value[rule], rule, tally, raise);
360
+ return rules;
361
+ }
362
+ function encodeSynonymRules(rules) {
363
+ return encode(rules);
364
+ }
365
+ function decodeSynonymRules(bytes, raise) {
366
+ let decoded;
367
+ try {
368
+ decoded = decode(bytes);
369
+ } catch {
370
+ raise("A stored synonym set is not valid MessagePack", {});
371
+ }
372
+ return parseSynonymRules(decoded, raise);
373
+ }
374
+
375
+ // src/core/synonyms/prepare.ts
376
+ function invalidIn(source) {
377
+ return (message, details) => {
378
+ throw new NarsilError(ErrorCodes.CONFIG_INVALID, `${source}${message}`, details);
379
+ };
380
+ }
381
+ var raiseConfigInvalid = invalidIn("");
382
+ function synonymAnalysisOf(config, language) {
383
+ return { language, ...resolveIndexAnalysis(config) };
384
+ }
385
+ function prepareSynonyms(value, config, language, strictWords, raise = raiseConfigInvalid) {
386
+ const report = typeof raise === "string" ? invalidIn(raise) : raise;
387
+ const rules = parseSynonymRules(value, report);
388
+ if (rules.length === 0) return null;
389
+ const lookup = buildSynonymLookup(rules, synonymAnalysisOf(config, language), strictWords ? report : null);
390
+ return { encoded: encodeSynonymRules(rules), lookup };
391
+ }
392
+ function storedSynonymLookup(encoded, config, language) {
393
+ return buildSynonymLookup(decodeSynonymRules(encoded, raiseConfigInvalid), synonymAnalysisOf(config, language), null);
394
+ }
395
+ function storedSynonymRules(encoded) {
396
+ return decodeSynonymRules(encoded, raiseConfigInvalid);
397
+ }
398
+
399
+ // src/core/synonyms/operations.ts
400
+ async function replaceNow(core, indexName, value, strictWords) {
401
+ const entry = core.requireIndex(indexName);
402
+ const manager = core.requireManager(indexName);
403
+ const prepared = prepareSynonyms(value, entry.config, entry.language, strictWords);
404
+ if (entry.pendingAnalysis !== null) {
405
+ const target = targetOfPending(entry, entry.pendingAnalysis);
406
+ prepareSynonyms(value, target.config, target.language, strictWords);
407
+ }
408
+ const preparedUnder = manager.analysis;
409
+ const previous = entry.synonyms;
410
+ entry.synonyms = prepared?.encoded ?? null;
411
+ try {
412
+ if (core.durability) await core.durability.manager.persistMetadata(indexName);
413
+ } catch (err) {
414
+ entry.synonyms = previous;
415
+ throw err;
416
+ }
417
+ const current = manager.analysis === preparedUnder ? prepared : prepareSynonyms(value, entry.config, entry.language, false);
418
+ manager.synonyms = current?.lookup ?? null;
419
+ await core.orchestrator.replicateToWorkers({
420
+ type: "replaceSynonyms",
421
+ indexName,
422
+ requestId: `replace-synonyms-${indexName}`,
423
+ ...prepared !== null ? { synonyms: prepared.encoded } : {}
424
+ });
425
+ await core.orchestrator.awaitWrites(indexName);
426
+ }
427
+ function replaceSynonymSet(core, indexName, value, strictWords) {
428
+ return withOpenIndex(
429
+ core,
430
+ indexName,
431
+ () => oneAtATime(core, indexName, () => replaceNow(core, indexName, value, strictWords))
432
+ );
433
+ }
434
+ function applyLoadedSynonyms(core, indexName, load) {
435
+ return withOpenIndex(
436
+ core,
437
+ indexName,
438
+ () => oneAtATime(core, indexName, async () => {
439
+ const rules = await load();
440
+ if (rules === null) return false;
441
+ await replaceNow(core, indexName, rules, false);
442
+ return true;
443
+ })
444
+ );
445
+ }
446
+
447
+ // src/core/synonyms/module.ts
448
+ var synonymSearchModule = {
449
+ name: "synonyms",
450
+ prepare: prepareSynonyms,
451
+ storedLookup: storedSynonymLookup,
452
+ decodeRules: storedSynonymRules,
453
+ replace: replaceSynonymSet,
454
+ applyLoaded: applyLoadedSynonyms
455
+ };
456
+
457
+ // src/synonyms/index.ts
458
+ var synonyms = synonymSearchModule;
459
+
460
+ export { synonyms };
package/dist/react.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { N as NarsilError, L as ListParams, f as ListResult, I as IndexInfo, k as IndexStats, Q as QueryParams, j as PreflightResult, m as QueryResult, g as SuggestParams, h as SuggestResult } from './config-Dzs46im6.js';
2
- export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './config-Dzs46im6.js';
3
- import { f as TaskRecord, e as TaskProgress, c as ImportResult, d as TaskListQuery, T as TaskListPage } from './tasks-ChWp0wrF.js';
4
- export { E as ErrorDetail, I as ImportError, g as TaskStatus, i as TaskType } from './tasks-ChWp0wrF.js';
1
+ import { N as NarsilError, L as ListParams, f as ListResult, I as IndexInfo, k as IndexStats, Q as QueryParams, j as PreflightResult, m as QueryResult, g as SuggestParams, h as SuggestResult } from './config-aIsy7mcL.js';
2
+ export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './config-aIsy7mcL.js';
3
+ import { f as TaskRecord, e as TaskProgress, c as ImportResult, d as TaskListQuery, T as TaskListPage } from './tasks-C4ElXr4P.js';
4
+ export { E as ErrorDetail, I as ImportError, g as TaskStatus, i as TaskType } from './tasks-C4ElXr4P.js';
5
5
  import { ReactNode, ReactElement } from 'react';
6
- import { N as Narsil } from './engine-C0ifUEcm.js';
7
- import { N as NarsilClient, I as ImportSource } from './client-DoYPHcUn.js';
6
+ import { N as Narsil } from './engine-CJRUHXgf.js';
7
+ import { N as NarsilClient, I as ImportSource } from './client-Cn3gNxUU.js';
8
8
  import { A as AnyDocument } from './schema-D33CyXCy.js';
9
9
  import './adapters-pljAqmrC.js';
10
- import './config-CuUfls_H.js';
10
+ import './config-CfhH1IWQ.js';
11
11
  import './index-MsF7e5hL.js';
12
12
  import './types-DvncmvuQ.js';
13
13
  import './synonyms-CpOAHPa-.js';
package/dist/react.mjs CHANGED
@@ -51,6 +51,7 @@ var ErrorCodes = {
51
51
  ENVELOPE_INVALID_MAGIC: "ENVELOPE_INVALID_MAGIC",
52
52
  PARTITION_CAPACITY_EXCEEDED: "PARTITION_CAPACITY_EXCEEDED",
53
53
  RESTORE_MEMORY_EXCEEDED: "RESTORE_MEMORY_EXCEEDED",
54
+ MEMORY_WRITE_BLOCKED: "MEMORY_WRITE_BLOCKED",
54
55
  ANALYSIS_CHANGE_REPLACED: "ANALYSIS_CHANGE_REPLACED",
55
56
  ANALYSIS_CHANGE_NOT_READY: "ANALYSIS_CHANGE_NOT_READY",
56
57
  ANALYSIS_GENERATION_MISSING: "ANALYSIS_GENERATION_MISSING",
@@ -84,6 +85,7 @@ var ErrorCodes = {
84
85
  COORDINATOR_AUTH_FAILED: "COORDINATOR_AUTH_FAILED",
85
86
  COORDINATOR_UNAVAILABLE: "COORDINATOR_UNAVAILABLE",
86
87
  TRANSPORT_DEPENDENCY_MISSING: "TRANSPORT_DEPENDENCY_MISSING",
88
+ NATIVE_DEPENDENCY_MISSING: "NATIVE_DEPENDENCY_MISSING",
87
89
  REPLICATION_ENTRY_INVALID: "REPLICATION_ENTRY_INVALID",
88
90
  REPLICATION_INSYNC_REMOVAL_FAILED: "REPLICATION_INSYNC_REMOVAL_FAILED",
89
91
  REPLICATION_ROLLBACK_FAILED: "REPLICATION_ROLLBACK_FAILED",
@@ -1,11 +1,11 @@
1
- import { runRerankedQuery, rerankTextOf } from './chunk-XLAI4OIO.mjs';
1
+ import { runRerankedQuery, rerankTextOf } from './chunk-IZT3G24Q.mjs';
2
2
  import './chunk-KZ3NX2P7.mjs';
3
- import { rerankOnHost } from './chunk-UQS5PAS5.mjs';
4
- import './chunk-ISUOSACK.mjs';
3
+ import { rerankOnHost } from './chunk-YGQOPB2Z.mjs';
4
+ import './chunk-T4CJDBBE.mjs';
5
5
  import './chunk-HJSN7UYG.mjs';
6
6
  import './chunk-EEBCDP36.mjs';
7
7
  import './chunk-FQBFZAWG.mjs';
8
- import { NarsilError, ErrorCodes } from './chunk-IQHZMCLX.mjs';
8
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
9
9
 
10
10
  // src/distribution/cluster-node/reads/rerank.ts
11
11
  async function rerankClusterQuery(deps, indexName, params, firstStage, readDocuments, host) {
@@ -1,5 +1,5 @@
1
- import { resolveApiKey, buildSignal, postJsonWithRetry } from '../chunk-SE7MKJVK.mjs';
2
- import { ErrorCodes, NarsilError } from '../chunk-IQHZMCLX.mjs';
1
+ import { resolveApiKey, buildSignal, postJsonWithRetry } from '../chunk-J7M73VY7.mjs';
2
+ import { ErrorCodes, NarsilError } from '../chunk-MDF6PDIA.mjs';
3
3
 
4
4
  // src/rerankers/constants.ts
5
5
  var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
@@ -0,0 +1,41 @@
1
+ import { abandonChangeOf } from './chunk-KZQIVGW7.mjs';
2
+
3
+ // src/narsil/restore-queue.ts
4
+ function restoreDepsOf(core, host) {
5
+ return {
6
+ ...host,
7
+ executor: core.executor,
8
+ indexRegistry: core.indexRegistry,
9
+ durability: core.durability,
10
+ filesystemDurability: core.filesystemDurability,
11
+ embeddingAdapters: core.embeddingAdapters,
12
+ markAnalysisStale: core.analysisRebuild.markStale,
13
+ clearAnalysisStale: core.analysisRebuild.clearStale,
14
+ abandonAnalysisRebuild: async (indexName) => {
15
+ await core.analysisRebuild.abandon(indexName);
16
+ await abandonChangeOf(core, indexName);
17
+ },
18
+ abandonAnalysisChange: (indexName) => abandonChangeOf(core, indexName),
19
+ indexState: core.indexState,
20
+ copies: core.orchestrator,
21
+ forgetWatermark: core.watermarkNotifier.forget
22
+ };
23
+ }
24
+ function queueRestore(core, host, restoresInFlight, indexName, data) {
25
+ const previous = restoresInFlight.get(indexName) ?? Promise.resolve();
26
+ const restored = previous.then(async () => {
27
+ const { restoreFromSnapshot } = await import('./snapshot-EHXTOTW5.mjs');
28
+ await restoreFromSnapshot(indexName, data, restoreDepsOf(core, host));
29
+ });
30
+ const settled = restored.then(
31
+ () => void 0,
32
+ () => void 0
33
+ );
34
+ restoresInFlight.set(indexName, settled);
35
+ void settled.then(() => {
36
+ if (restoresInFlight.get(indexName) === settled) restoresInFlight.delete(indexName);
37
+ });
38
+ return restored;
39
+ }
40
+
41
+ export { queueRestore };
@@ -1,12 +1,12 @@
1
- import { runRerankedQuery, rerankTextOf } from './chunk-XLAI4OIO.mjs';
1
+ import { runRerankedQuery, rerankTextOf } from './chunk-IZT3G24Q.mjs';
2
2
  export { withRerankQueryText } from './chunk-KZ3NX2P7.mjs';
3
- import { rerankOnHost } from './chunk-UQS5PAS5.mjs';
4
- export { rerankOnHost } from './chunk-UQS5PAS5.mjs';
5
- import { fixedHybridDepthOf, requireWithinHybridDepth, pageByPosition } from './chunk-ISUOSACK.mjs';
3
+ import { rerankOnHost } from './chunk-YGQOPB2Z.mjs';
4
+ export { rerankOnHost } from './chunk-YGQOPB2Z.mjs';
5
+ import { fixedHybridDepthOf, requireWithinHybridDepth, pageByPosition } from './chunk-T4CJDBBE.mjs';
6
6
  import { MIN_RERANK_TIMEOUT_MS, MAX_RERANK_TIMEOUT_MS, MIN_RERANK_WINDOW, MAX_RERANK_WINDOW, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_RERANK_TIMEOUT_MS } from './chunk-HJSN7UYG.mjs';
7
7
  import './chunk-EEBCDP36.mjs';
8
8
  import { HYBRID_RESCORE_WINDOW } from './chunk-FQBFZAWG.mjs';
9
- import { NarsilError, ErrorCodes } from './chunk-IQHZMCLX.mjs';
9
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
10
10
 
11
11
  // src/engine/query/hybrid-depth.ts
12
12
  function countOfUnion(text, vectorScored) {
package/dist/server.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { G as GroupResult, Q as QueryParams, n as GroupConfig, m as QueryResult, L as ListParams, g as SuggestParams, k as IndexStats, f as ListResult, j as PreflightResult, h as SuggestResult } from './config-Dzs46im6.js';
2
- export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './config-Dzs46im6.js';
3
- import { E as ErrorEnvelope, c as ServerOptions, N as NarsilServer } from './capabilities-CNnzGtqP.js';
4
- export { A as ASYNC_IMPORT_CAPABILITY, B as BM25_TUNING_CAPABILITY, C as CHANGE_ANALYSIS_CAPABILITY, d as CorsOptions, D as DOCUMENT_EXPORT_CAPABILITY, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, e as RequestContext, f as RequestDenial, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, g as ServerLimits, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-CNnzGtqP.js';
5
- import { N as Narsil } from './engine-C0ifUEcm.js';
6
- import { k as CreateIndexRequest, H as HttpIndexConfig, l as BatchBody, a as ChangeAnalysisBody, m as CreateBackupBody, D as DocumentBody, n as InsertBody, o as MultiGetBody, p as RebalanceBody, q as ReplicationFactorBody, R as RestoreBackupBody, d as TaskListQuery, V as VectorFieldBody, S as SynonymSetBody, B as BackupListResponse, r as BatchResponse, C as CapabilitiesResponse, s as ClusterAllocationResponse, t as ClusterTopologyResponse, u as DocumentCountResponse, v as DocumentExistsResponse, w as DocumentIdResponse, x as DocumentPutResponse, y as DocumentRemovedResponse, z as DocumentResponse, c as ImportResult, A as IndexClearedResponse, F as IndexCreatedResponse, G as IndexDroppedResponse, J as IndexListResponse, K as IndexPartitionsResponse, L as IndexStateResponse, N as LivenessResponse, M as MemoryStatsResponse, O as MultiGetResponse, P as OkResponse, Q as ReadinessResponse, U as ReplicationFactorResponse, T as TaskListPage, f as TaskRecord, W as VectorMaintenanceResponse, X as VersionResponse, e as TaskProgress, h as TaskStepProgress, j as TaskStore } from './tasks-ChWp0wrF.js';
7
- export { Y as BatchFailure, Z as ClusterMemberReport, _ as ClusterNodeReport, b as CreateIndexEmbedding, E as ErrorDetail, I as ImportError, $ as PartitionAllocationReport, g as TaskStatus, i as TaskType } from './tasks-ChWp0wrF.js';
8
- import { i as ClusterHealth } from './config-CuUfls_H.js';
1
+ import { G as GroupResult, Q as QueryParams, n as GroupConfig, m as QueryResult, L as ListParams, g as SuggestParams, k as IndexStats, f as ListResult, j as PreflightResult, h as SuggestResult } from './config-aIsy7mcL.js';
2
+ export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './config-aIsy7mcL.js';
3
+ import { E as ErrorEnvelope, c as ServerOptions, N as NarsilServer } from './capabilities-BT-HLDC8.js';
4
+ export { A as ASYNC_IMPORT_CAPABILITY, B as BM25_TUNING_CAPABILITY, C as CHANGE_ANALYSIS_CAPABILITY, d as CorsOptions, D as DOCUMENT_EXPORT_CAPABILITY, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, e as RequestContext, f as RequestDenial, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, g as ServerLimits, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-BT-HLDC8.js';
5
+ import { N as Narsil } from './engine-CJRUHXgf.js';
6
+ import { k as CreateIndexRequest, H as HttpIndexConfig, l as BatchBody, a as ChangeAnalysisBody, m as CreateBackupBody, D as DocumentBody, n as InsertBody, o as MultiGetBody, p as RebalanceBody, q as ReplicationFactorBody, R as RestoreBackupBody, d as TaskListQuery, V as VectorFieldBody, S as SynonymSetBody, B as BackupListResponse, r as BatchResponse, C as CapabilitiesResponse, s as ClusterAllocationResponse, t as ClusterTopologyResponse, u as DocumentCountResponse, v as DocumentExistsResponse, w as DocumentIdResponse, x as DocumentPutResponse, y as DocumentRemovedResponse, z as DocumentResponse, c as ImportResult, A as IndexClearedResponse, F as IndexCreatedResponse, G as IndexDroppedResponse, J as IndexListResponse, K as IndexPartitionsResponse, L as IndexStateResponse, N as LivenessResponse, M as MemoryStatsResponse, O as MultiGetResponse, P as OkResponse, Q as ReadinessResponse, U as ReplicationFactorResponse, T as TaskListPage, f as TaskRecord, W as VectorMaintenanceResponse, X as VersionResponse, e as TaskProgress, h as TaskStepProgress, j as TaskStore } from './tasks-C4ElXr4P.js';
7
+ export { Y as BatchFailure, Z as ClusterMemberReport, _ as ClusterNodeReport, b as CreateIndexEmbedding, E as ErrorDetail, I as ImportError, $ as PartitionAllocationReport, g as TaskStatus, i as TaskType } from './tasks-C4ElXr4P.js';
8
+ import { i as ClusterHealth } from './config-CfhH1IWQ.js';
9
9
  import { S as SchemaDefinition, P as PartitionConfig, V as VectorIndexConfig, B as BM25Params, F as FieldType } from './schema-D33CyXCy.js';
10
10
  import './adapters-pljAqmrC.js';
11
11
  import './synonyms-CpOAHPa-.js';