@delali/narsil 0.3.1-next.144 → 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 (241) hide show
  1. package/dist/adapters/filesystem.d.ts +1 -1
  2. package/dist/adapters/filesystem.mjs +101 -13
  3. package/dist/adapters/gcs.d.ts +49 -0
  4. package/dist/adapters/gcs.mjs +213 -0
  5. package/dist/adapters/indexeddb.d.ts +1 -1
  6. package/dist/adapters/indexeddb.mjs +2 -7
  7. package/dist/adapters/memory.d.ts +1 -1
  8. package/dist/adapters/memory.mjs +5 -0
  9. package/dist/adapters/s3.d.ts +53 -0
  10. package/dist/adapters/s3.mjs +263 -0
  11. package/dist/{adapters-BQFQ4PRz.d.ts → adapters-pljAqmrC.d.ts} +33 -0
  12. package/dist/analysis-change-ZCJNYBJM.mjs +39 -0
  13. package/dist/{browser/analysis-change-entry-7HR4LWL3.mjs → analysis-change-entry-YN3ELL6C.mjs} +1 -1
  14. package/dist/browser/{analysis-change-JPV775LR.mjs → analysis-change-M65AZQQG.mjs} +8 -5
  15. package/dist/{analysis-change-entry-TZTG4AZB.mjs → browser/analysis-change-entry-H3YIOLXZ.mjs} +1 -1
  16. package/dist/browser/{chunk-VFYMPCOV.mjs → chunk-2JABMB4S.mjs} +10 -6
  17. package/dist/{chunk-46NZOPHS.mjs → browser/chunk-4DYLCICG.mjs} +2 -2
  18. package/dist/browser/{chunk-MZI3TEOW.mjs → chunk-4RD3AFSB.mjs} +1 -1
  19. package/dist/browser/{chunk-WCFCHIBB.mjs → chunk-5V74FFZE.mjs} +2 -2
  20. package/dist/{chunk-NN33CZRE.mjs → browser/chunk-6OWX3OP2.mjs} +2 -2
  21. package/dist/browser/chunk-BRWY3JCN.mjs +678 -0
  22. package/dist/browser/{chunk-5DB2VDGI.mjs → chunk-BVX2MEHA.mjs} +306 -607
  23. package/dist/browser/{chunk-KTOK275N.mjs → chunk-D6UFGBF5.mjs} +15 -45
  24. package/dist/browser/{chunk-D33A5VMU.mjs → chunk-IAXZAVYL.mjs} +25 -66
  25. package/dist/browser/chunk-JNOAKDUM.mjs +31 -0
  26. package/dist/browser/{chunk-LVY2LI35.mjs → chunk-KAEVGLYN.mjs} +2 -2
  27. package/dist/browser/{chunk-3ZBJYAS4.mjs → chunk-LURXVCHG.mjs} +1 -1
  28. package/dist/browser/chunk-MPK76GVS.mjs +63 -0
  29. package/dist/browser/{chunk-ZEV26AQ6.mjs → chunk-NVEJJP4R.mjs} +1 -1
  30. package/dist/browser/{chunk-HKX2G6WH.mjs → chunk-ODQP7P3H.mjs} +455 -66
  31. package/dist/browser/{chunk-35B42UFM.mjs → chunk-PIS7ZAP7.mjs} +12 -25
  32. package/dist/browser/{chunk-TCLEOZ4P.mjs → chunk-QMNZFFD3.mjs} +4 -3
  33. package/dist/browser/{chunk-R4WUDZQV.mjs → chunk-SRL47USS.mjs} +2 -2
  34. package/dist/browser/chunk-TY7L6OXO.mjs +69 -0
  35. package/dist/browser/{chunk-MVM33ZUL.mjs → chunk-W643QV3L.mjs} +6 -5
  36. package/dist/browser/chunk-WXLBZJMT.mjs +25 -0
  37. package/dist/browser/{chunk-MWUK3DA5.mjs → chunk-XILIT5MT.mjs} +8 -8
  38. package/dist/browser/{cold-module-MJMKNUYJ.mjs → cold-module-A5S6JFDN.mjs} +20 -20
  39. package/dist/browser/{durability-wiring-SNOWIT6Z.mjs → durability-wiring-W5AVV3RF.mjs} +120 -80
  40. package/dist/browser/gzip-5S7ROJFJ.mjs +1 -0
  41. package/dist/browser/import-PTT63AGK.mjs +12 -0
  42. package/dist/browser/{module-BUFNZMEU.mjs → module-CEKA7MQH.mjs} +13 -10
  43. package/dist/browser/module-X5PGOE47.mjs +4288 -0
  44. package/dist/browser/{phrase-module-HGVBO24W.mjs → phrase-module-CNKMUY4U.mjs} +2 -1
  45. package/dist/browser/pool-DTYSPBMQ.mjs +296 -0
  46. package/dist/{restore-queue-FEYAC4SB.mjs → browser/restore-queue-DD4LWZK7.mjs} +2 -2
  47. package/dist/browser/{runtime-VEUH674B.mjs → runtime-D2ULZGCN.mjs} +3 -2
  48. package/dist/browser/{snapshot-QXBKHJAG.mjs → snapshot-DQ6A4PQP.mjs} +20 -15
  49. package/dist/browser/{write-WHFBDWQS.mjs → write-MAGRAIEH.mjs} +14 -11
  50. package/dist/{capabilities-BCdUwK_L.d.ts → capabilities-BT-HLDC8.d.ts} +3 -3
  51. package/dist/{chunk-O4LJQI4G.mjs → chunk-2HJWQPR6.mjs} +126 -4
  52. package/dist/{chunk-Z4HFMYNX.mjs → chunk-3BVGJ4JR.mjs} +36 -13
  53. package/dist/{chunk-ZPWS2SKJ.mjs → chunk-3HV7M5OJ.mjs} +272 -112
  54. package/dist/{chunk-UIKN2OTQ.mjs → chunk-3MXV3VHR.mjs} +2 -23
  55. package/dist/{browser/chunk-CCOAOO73.mjs → chunk-3SBJVQLL.mjs} +2 -2
  56. package/dist/chunk-3TVDTACC.mjs +104 -0
  57. package/dist/{chunk-YH5OIL7B.mjs → chunk-5QMHMELB.mjs} +6 -1
  58. package/dist/{chunk-SBMAWTRG.mjs → chunk-5WB2A3XU.mjs} +84 -15
  59. package/dist/{chunk-NPNK57CA.mjs → chunk-65WCV5JO.mjs} +1 -1
  60. package/dist/chunk-6BWLDLS3.mjs +58 -0
  61. package/dist/{chunk-UUZCQQG2.mjs → chunk-6C5EX2QR.mjs} +3 -3
  62. package/dist/{chunk-VEFN6X6Q.mjs → chunk-6F6USYII.mjs} +120 -13
  63. package/dist/{chunk-AST3SHFA.mjs → chunk-7HKWO4BJ.mjs} +7 -7
  64. package/dist/{chunk-W2COJ5AH.mjs → chunk-7N223GWV.mjs} +2 -2
  65. package/dist/{chunk-GWOS5DYC.mjs → chunk-ADBS5XRI.mjs} +11 -13
  66. package/dist/{chunk-TNBIK2LQ.mjs → chunk-AWNHDBKV.mjs} +430 -75
  67. package/dist/{chunk-ZMBFWQXN.mjs → chunk-B2FTZNNF.mjs} +2 -2
  68. package/dist/chunk-B7XIOAMK.mjs +100 -0
  69. package/dist/{chunk-W55X2BYN.mjs → chunk-BEZH7VEH.mjs} +1 -1
  70. package/dist/{chunk-QSK35UC2.mjs → chunk-BTPGQC6Z.mjs} +3 -11
  71. package/dist/{chunk-LA4WNDHL.mjs → chunk-CYYSZPVV.mjs} +12 -14
  72. package/dist/{chunk-SRJBFG2T.mjs → chunk-DOY6EG76.mjs} +6 -7
  73. package/dist/{chunk-6SNBQESJ.mjs → chunk-F22IOCR2.mjs} +10 -6
  74. package/dist/{chunk-J6YVB2XM.mjs → chunk-IJPK5PGM.mjs} +1 -1
  75. package/dist/{chunk-L76W3IZJ.mjs → chunk-IRWP524D.mjs} +1 -1
  76. package/dist/{chunk-XS2VM7UE.mjs → chunk-IZT3G24Q.mjs} +2 -2
  77. package/dist/{chunk-NOT5QOHU.mjs → chunk-J7M73VY7.mjs} +1 -1
  78. package/dist/chunk-K5HSUPYS.mjs +11 -0
  79. package/dist/chunk-KAKQ74LS.mjs +53 -0
  80. package/dist/{chunk-ZSWHPKGM.mjs → chunk-KYVRZAYP.mjs} +69 -2
  81. package/dist/{chunk-NRUXBYPH.mjs → chunk-KZ5GQE4Z.mjs} +5 -5
  82. package/dist/{browser/chunk-XNWPP5NS.mjs → chunk-KZQIVGW7.mjs} +2 -2
  83. package/dist/{chunk-KZL72VTC.mjs → chunk-L7TIAYPX.mjs} +11 -10
  84. package/dist/{chunk-DD2673TX.mjs → chunk-LDGGR7YT.mjs} +4 -81
  85. package/dist/{chunk-XZ3SRNDJ.mjs → chunk-LJ4ENXOD.mjs} +77 -16
  86. package/dist/chunk-LQG5G2LY.mjs +39 -0
  87. package/dist/{chunk-HNHCNTVG.mjs → chunk-MDF6PDIA.mjs} +11 -0
  88. package/dist/{chunk-74XB2SXI.mjs → chunk-NVTFQFUL.mjs} +16 -2
  89. package/dist/{chunk-BOJZGUS6.mjs → chunk-NYSONUB7.mjs} +1 -1
  90. package/dist/{chunk-WJGO5PGV.mjs → chunk-O4KUNDVF.mjs} +31 -17
  91. package/dist/{chunk-PWIWSUCX.mjs → chunk-POUYICOU.mjs} +1 -1
  92. package/dist/{chunk-EBIHRL7B.mjs → chunk-Q2UL2TPC.mjs} +1 -1
  93. package/dist/{chunk-NJJCPFXN.mjs → chunk-QEYF2SQ6.mjs} +2 -2
  94. package/dist/{chunk-7AUASRE7.mjs → chunk-QN5WVV5K.mjs} +7 -7
  95. package/dist/{chunk-RIIUZJQ3.mjs → chunk-QYRNLLLI.mjs} +1 -1
  96. package/dist/chunk-SOUZMPME.mjs +1635 -0
  97. package/dist/{chunk-C3YDYX6C.mjs → chunk-T4CJDBBE.mjs} +1 -1
  98. package/dist/{chunk-YLNSJQLX.mjs → chunk-TTCKT2RT.mjs} +5 -5
  99. package/dist/{chunk-KEIYVZUX.mjs → chunk-U2726TL5.mjs} +5 -5
  100. package/dist/{chunk-RKAVHNRW.mjs → chunk-U46IZNCW.mjs} +10 -5
  101. package/dist/{chunk-BRUUBXCB.mjs → chunk-U6NE6RCV.mjs} +10 -38
  102. package/dist/{chunk-VJEGOELZ.mjs → chunk-VP6XRMWR.mjs} +4 -4
  103. package/dist/{chunk-IO5F7ZBE.mjs → chunk-VQDZVWN3.mjs} +874 -413
  104. package/dist/{chunk-IWVEG5CX.mjs → chunk-XIHUI4KB.mjs} +2 -2
  105. package/dist/{chunk-YHUTF6EA.mjs → chunk-XKPNKR3V.mjs} +17 -47
  106. package/dist/{chunk-HJJWY6PT.mjs → chunk-YGQOPB2Z.mjs} +1 -1
  107. package/dist/chunk-YKEHQUSZ.mjs +248 -0
  108. package/dist/{chunk-GLZHNSGB.mjs → chunk-ZAYWOHVG.mjs} +1 -1
  109. package/dist/{chunk-ICW45TTU.mjs → chunk-ZEKDO7YX.mjs} +2 -2
  110. package/dist/chunk-ZXNNR73R.mjs +31 -0
  111. package/dist/{chunk-VJS4JFBQ.mjs → chunk-ZXX5GZEX.mjs} +3 -1
  112. package/dist/{chunk-RHKRTYGO.mjs → chunk-ZYKUD5NX.mjs} +9 -7
  113. package/dist/{client-B12YFALP.d.ts → client-Cn3gNxUU.d.ts} +62 -5
  114. package/dist/client.d.ts +8 -8
  115. package/dist/client.mjs +46 -0
  116. package/dist/{cold-module-4X7WJCFM.mjs → cold-module-2WWGBFJC.mjs} +43 -49
  117. package/dist/{config-CIG5yDyg.d.ts → config-CfhH1IWQ.d.ts} +150 -3
  118. package/dist/{config-BhZxIeb1.d.ts → config-aIsy7mcL.d.ts} +63 -3
  119. package/dist/direct-executor-QLVHMELJ.mjs +24 -0
  120. package/dist/distribution/coordinator/etcd.d.ts +3 -3
  121. package/dist/distribution/coordinator/etcd.mjs +1 -1
  122. package/dist/distribution/coordinator/in-memory.d.ts +3 -3
  123. package/dist/distribution/transport/grpc.mjs +4 -4
  124. package/dist/distribution/transport/in-memory.mjs +2 -2
  125. package/dist/distribution/transport/tcp.mjs +3 -3
  126. package/dist/distribution.d.ts +8 -8
  127. package/dist/distribution.mjs +16116 -14537
  128. package/dist/{durability-wiring-324D2DDD.mjs → durability-wiring-GNWQSZI3.mjs} +142 -109
  129. package/dist/embeddings/openai.d.ts +1 -1
  130. package/dist/embeddings/openai.mjs +2 -2
  131. package/dist/{engine-CtzbHOmG.d.ts → engine-CJRUHXgf.d.ts} +3 -3
  132. package/dist/gzip-F4HMIEEQ.mjs +1 -0
  133. package/dist/import-DX55PN4G.mjs +41 -0
  134. package/dist/{index-DsEurhSl.d.ts → index-MsF7e5hL.d.ts} +2 -2
  135. package/dist/index.browser.mjs +7 -4
  136. package/dist/index.d.ts +542 -8
  137. package/dist/index.mjs +29 -32
  138. package/dist/index.react-native.mjs +19 -0
  139. package/dist/invalidation/broadcast-channel.d.ts +1 -1
  140. package/dist/invalidation/filesystem.d.ts +1 -1
  141. package/dist/invalidation/filesystem.mjs +1 -1
  142. package/dist/invalidation/noop.d.ts +1 -1
  143. package/dist/{long-query-thread-4SW7RWDE.mjs → long-query-thread-SCUE62TO.mjs} +23 -25
  144. package/dist/{module-DXSJ5LT2.mjs → module-HW6IXUM6.mjs} +603 -112
  145. package/dist/module-V5K4ZP23.mjs +45 -0
  146. package/dist/{paged-partition-archive-HFP45PLU.mjs → paged-partition-archive-FDIIWZNR.mjs} +42 -41
  147. package/dist/partial-words.mjs +7 -9
  148. package/dist/pattern.mjs +4 -6
  149. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
  150. package/dist/persistence/durability/checkpoint-worker.mjs +36 -39
  151. package/dist/{phrase-module-5QHBD2VJ.mjs → phrase-module-OUQIRUQU.mjs} +1 -1
  152. package/dist/pool-UPV5PVPY.mjs +298 -0
  153. package/dist/react-native/chunks/analysis-change-HGW3L6NY.mjs +893 -0
  154. package/dist/react-native/chunks/analysis-change-entry-BNRU6STO.mjs +1 -0
  155. package/dist/react-native/chunks/chunk-2J2727V4.mjs +495 -0
  156. package/dist/react-native/chunks/chunk-3CTWSQRW.mjs +1251 -0
  157. package/dist/react-native/chunks/chunk-5FV4ZEVA.mjs +2619 -0
  158. package/dist/react-native/chunks/chunk-7VWQLEFV.mjs +642 -0
  159. package/dist/react-native/chunks/chunk-AAAETEJK.mjs +27 -0
  160. package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +32 -0
  161. package/dist/react-native/chunks/chunk-B6OD63Z3.mjs +997 -0
  162. package/dist/react-native/chunks/chunk-BRNAVOKP.mjs +177 -0
  163. package/dist/react-native/chunks/chunk-DKJTZ625.mjs +207 -0
  164. package/dist/react-native/chunks/chunk-FKGG4UOF.mjs +177 -0
  165. package/dist/{browser/chunk-6RHTAVZX.mjs → react-native/chunks/chunk-GV5KFQ6M.mjs} +38 -15
  166. package/dist/react-native/chunks/chunk-HURV3ASY.mjs +4416 -0
  167. package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +10 -0
  168. package/dist/react-native/chunks/chunk-JV6VQY2S.mjs +17 -0
  169. package/dist/react-native/chunks/chunk-KUJOBRKS.mjs +217 -0
  170. package/dist/react-native/chunks/chunk-KWRW5U65.mjs +226 -0
  171. package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +110 -0
  172. package/dist/react-native/chunks/chunk-LQ6Q4L5B.mjs +360 -0
  173. package/dist/react-native/chunks/chunk-LQAKO5QV.mjs +523 -0
  174. package/dist/react-native/chunks/chunk-LRGWK367.mjs +11 -0
  175. package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +93 -0
  176. package/dist/react-native/chunks/chunk-NFGBOI46.mjs +14 -0
  177. package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +8 -0
  178. package/dist/react-native/chunks/chunk-PPEPTUVV.mjs +56 -0
  179. package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +9 -0
  180. package/dist/{chunk-KGOXHLLZ.mjs → react-native/chunks/chunk-PU55IOG4.mjs} +228 -11
  181. package/dist/react-native/chunks/chunk-QC4ZRBSX.mjs +270 -0
  182. package/dist/react-native/chunks/chunk-R4EEMYM6.mjs +21 -0
  183. package/dist/react-native/chunks/chunk-R4OPUZQ5.mjs +86 -0
  184. package/dist/react-native/chunks/chunk-SLGIAD6B.mjs +2634 -0
  185. package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +25 -0
  186. package/dist/react-native/chunks/chunk-TLYD7IJ2.mjs +23 -0
  187. package/dist/react-native/chunks/chunk-UFNCLEQM.mjs +73 -0
  188. package/dist/react-native/chunks/chunk-YH7W556M.mjs +179 -0
  189. package/dist/react-native/chunks/chunk-YJSMEKRE.mjs +22385 -0
  190. package/dist/react-native/chunks/chunk-ZCKNBPQ4.mjs +79 -0
  191. package/dist/react-native/chunks/cold-module-TSFWLYWC.mjs +755 -0
  192. package/dist/react-native/chunks/durability-wiring-PZR6KOQK.mjs +4509 -0
  193. package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +3 -0
  194. package/dist/react-native/chunks/import-VTODLPLO.mjs +22 -0
  195. package/dist/{browser/module-BVP4TKZU.mjs → react-native/chunks/module-JBBH6PZH.mjs} +671 -146
  196. package/dist/react-native/chunks/module-VEK2KCKU.mjs +25 -0
  197. package/dist/react-native/chunks/phrase-module-76UAPPSG.mjs +329 -0
  198. package/dist/react-native/chunks/pool-CD4ANYUI.mjs +296 -0
  199. package/dist/react-native/chunks/release-D7ZTIANM.mjs +33 -0
  200. package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
  201. package/dist/{browser/restore-queue-ONYNYUDE.mjs → react-native/chunks/restore-queue-OI5EH7R3.mjs} +2 -2
  202. package/dist/react-native/chunks/runtime-3MCDLJAF.mjs +559 -0
  203. package/dist/react-native/chunks/snapshot-AUZMEV36.mjs +1205 -0
  204. package/dist/react-native/chunks/write-DDC2QBRJ.mjs +197 -0
  205. package/dist/{chunk-DQNKVOJ2.mjs → react-native/partial-words.mjs} +13 -228
  206. package/dist/react-native/pattern.mjs +2442 -0
  207. package/dist/react-native/synonyms.mjs +460 -0
  208. package/dist/react.d.ts +11 -11
  209. package/dist/react.mjs +11 -0
  210. package/dist/{rerank-KTLC3E6N.mjs → rerank-3W54N6P2.mjs} +4 -4
  211. package/dist/rerankers/http.d.ts +1 -1
  212. package/dist/rerankers/http.mjs +2 -2
  213. package/dist/restore-queue-BQWWNNQI.mjs +41 -0
  214. package/dist/{runtime-DYV75DCB.mjs → runtime-L2DZYY6N.mjs} +5 -5
  215. package/dist/{schema-B-Runv0n.d.ts → schema-D33CyXCy.d.ts} +1 -1
  216. package/dist/server.d.ts +24 -12
  217. package/dist/server.mjs +159 -38
  218. package/dist/{snapshot-CGM65VCD.mjs → snapshot-EHXTOTW5.mjs} +47 -50
  219. package/dist/synonyms.mjs +3 -4
  220. package/dist/{tasks-CjRJRGTb.d.ts → tasks-C4ElXr4P.d.ts} +59 -7
  221. package/dist/thread-I7DVHHW7.mjs +31 -0
  222. package/dist/vector/search-worker.d.ts +2 -2
  223. package/dist/vector/search-worker.mjs +8 -7
  224. package/dist/workers/entry.mjs +9 -9
  225. package/dist/{write-2DZPEQL2.mjs → write-SDJXXQ2G.mjs} +36 -39
  226. package/openapi.json +349 -2
  227. package/package.json +108 -8
  228. package/dist/analysis-change-HQUT2Z3I.mjs +0 -43
  229. package/dist/browser/import-TLB2A5LJ.mjs +0 -9
  230. package/dist/chunk-5WYVUPGD.mjs +0 -427
  231. package/dist/chunk-AV4IJKD2.mjs +0 -35
  232. package/dist/chunk-GES7U2PM.mjs +0 -68
  233. package/dist/chunk-N37VMC62.mjs +0 -18
  234. package/dist/chunk-WNBRW4Q2.mjs +0 -128
  235. package/dist/chunk-WQBCBKY3.mjs +0 -8
  236. package/dist/chunk-ZATRDAYU.mjs +0 -160
  237. package/dist/direct-executor-7XOQ7VQP.mjs +0 -28
  238. package/dist/import-OOBUW3RR.mjs +0 -44
  239. package/dist/module-IYPLWHGC.mjs +0 -48
  240. package/dist/thread-KGNAIKPD.mjs +0 -33
  241. /package/dist/{chunk-22YPZVMG.mjs → chunk-ZXNQEW43.mjs} +0 -0
@@ -1,59 +1,57 @@
1
- import { deserializePayloadV2, documentsOfPayloadV2 } from './chunk-NJJCPFXN.mjs';
2
- import { closePartitionWriter, drainIndexStateForUnload, listPersistedIndexes, removeLeftoverRewriteFiles, loadMetadata, snapshotCheckpointFor, replayWal } from './chunk-RHKRTYGO.mjs';
3
- import { decodeSegmentManifest, metadataFromConfig, SINGLE_NODE_PRIMARY_TERM, readMetadataEnvelope, createSeqOwner, readSegmentManifest, writeMetadataEnvelope, reclaimUnlistedKeys, loadSegmentedCheckpoint, isRecord, invalidManifest, unpackEnvelopeBytes, isId, isUint32, isSequenceNumber, writeLiveVectors, growPartitionsTo, metadataConfigOf, durableMetadataConfigOf, readCurrentManifest } from './chunk-YHUTF6EA.mjs';
4
- import { VECTOR_FILE_ENVELOPE_VERSION } from './chunk-NRUXBYPH.mjs';
5
- import './chunk-W2COJ5AH.mjs';
6
- import { decodeVectorIndexParts, VECTOR_FILE_MAX_VECTORS, deadBytesFor, countDead, decodeVectorFilePayload, decodeVectorGraphPayload, graphPartsOfEarlierPayload } from './chunk-ICW45TTU.mjs';
1
+ import { deserializePayloadV2, documentsOfPayloadV2 } from './chunk-QEYF2SQ6.mjs';
2
+ import { closePartitionWriter, drainIndexStateForUnload, listPersistedIndexes, removeLeftoverRewriteFiles, loadMetadata, snapshotCheckpointFor, replayWal } from './chunk-ZYKUD5NX.mjs';
3
+ import { writeMetadataEnvelope, decodeSegmentManifest, metadataFromConfig, SINGLE_NODE_PRIMARY_TERM, readMetadataEnvelope, createSeqOwner, readSegmentManifest, reclaimUnlistedKeys, loadSegmentedCheckpoint, isRecord, invalidManifest, unpackEnvelopeBytes, isId, isUint32, isSequenceNumber, writeLiveVectors, growPartitionsTo, metadataConfigOf, durableMetadataConfigOf, readCurrentManifest } from './chunk-XKPNKR3V.mjs';
4
+ import { VECTOR_FILE_ENVELOPE_VERSION } from './chunk-KZ5GQE4Z.mjs';
5
+ import './chunk-ZXNNR73R.mjs';
6
+ import './chunk-7N223GWV.mjs';
7
+ import { decodeVectorIndexParts, VECTOR_FILE_MAX_VECTORS, deadBytesFor, countDead, decodeVectorFilePayload, decodeVectorGraphPayload, graphPartsOfEarlierPayload } from './chunk-ZEKDO7YX.mjs';
7
8
  import './chunk-37CD3OKS.mjs';
8
- import { createDurableDirectory } from './chunk-AST3SHFA.mjs';
9
- import { spawnNodeWorker } from './chunk-W55X2BYN.mjs';
9
+ import { createDurableDirectory } from './chunk-7HKWO4BJ.mjs';
10
+ import { spawnNodeWorker } from './chunk-BEZH7VEH.mjs';
10
11
  import { getFs } from './chunk-HLPRHOSO.mjs';
11
- import { nextSegmentKey, checkpointPrimaryTerm, frameRecord, writeCheckpointSegments, partitionContentsOf, commitCheckpointManifest, removeCheckpointGarbage, writeSegmentHeader, readCommitMarker, nextMarkerSlot, encodeMarkerSlot, markerSlotOffset, SEGMENT_HEADER_SIZE, buildEntry, captureWholePartition, checkpointLastSeqNo } from './chunk-LA4WNDHL.mjs';
12
+ import { nextSegmentKey, checkpointPrimaryTerm, frameRecord, writeCheckpointSegments, partitionContentsOf, commitCheckpointManifest, removeCheckpointGarbage, writeSegmentHeader, readCommitMarker, nextMarkerSlot, encodeMarkerSlot, markerSlotOffset, SEGMENT_HEADER_SIZE, buildEntry, captureWholePartition, checkpointLastSeqNo } from './chunk-CYYSZPVV.mjs';
12
13
  import './chunk-JDDXV6UF.mjs';
13
- import { DEFAULT_SEGMENT_MAX_BYTES, DEFAULT_CHECKPOINT_INTERVAL_MS, DEFAULT_CHECKPOINT_MUTATION_THRESHOLD, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ASYNC_FLUSH_INTERVAL_MS, WRITES_STALL_ABOVE_UNCHECKPOINTED_BYTES, readSegmentFile, DIRECTORY_IDENTITY_CHECK_INTERVAL_MS, WHOLE_PARTITION_LARGEST_DOCUMENT_COUNT, WHOLE_PARTITION_MIN_CHANGED_SHARE, CHECKPOINT_TIMEOUT_RECOVERY_BACKOFF_MS, CHECKPOINT_WORKER_TIMEOUT_MS, CHECKPOINT_WORKER_IDLE_MS, LOG_RECORDS_PER_CHECKPOINT } from './chunk-7AUASRE7.mjs';
14
- import { directoryCheckpointStore, manifestKey, readListedFile, adapterCheckpointStore, snapshotBundleKey, manifestReferencedKeys, manifestFileRefs, MAX_SEGMENTS_PER_PARTITION } from './chunk-UUZCQQG2.mjs';
15
- import './chunk-KEIYVZUX.mjs';
16
- import './chunk-YH5OIL7B.mjs';
17
- import { openChecksummedEnvelope, HEADER_SIZE } from './chunk-IO5F7ZBE.mjs';
18
- import './chunk-VEFN6X6Q.mjs';
19
- import './chunk-5WYVUPGD.mjs';
14
+ import { DEFAULT_SEGMENT_MAX_BYTES, DEFAULT_CHECKPOINT_INTERVAL_MS, DEFAULT_CHECKPOINT_MUTATION_THRESHOLD, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ASYNC_FLUSH_INTERVAL_MS, WRITES_STALL_ABOVE_UNCHECKPOINTED_BYTES, readSegmentFile, DIRECTORY_IDENTITY_CHECK_INTERVAL_MS, WHOLE_PARTITION_LARGEST_DOCUMENT_COUNT, WHOLE_PARTITION_MIN_CHANGED_SHARE, CHECKPOINT_TIMEOUT_RECOVERY_BACKOFF_MS, CHECKPOINT_WORKER_TIMEOUT_MS, CHECKPOINT_WORKER_IDLE_MS, LOG_RECORDS_PER_CHECKPOINT } from './chunk-QN5WVV5K.mjs';
15
+ import './chunk-U2726TL5.mjs';
16
+ import { directoryCheckpointStore, manifestKey, readListedFile, adapterCheckpointStore, snapshotBundleKey, manifestReferencedKeys, manifestFileRefs, MAX_SEGMENTS_PER_PARTITION } from './chunk-6C5EX2QR.mjs';
17
+ import './chunk-5QMHMELB.mjs';
18
+ import { toError, openChecksummedEnvelope, HEADER_SIZE } from './chunk-VQDZVWN3.mjs';
19
+ import './chunk-6F6USYII.mjs';
20
+ import { buildSegmentPayload, resolvePartitionInsertOptions, freezeSegmentShared, createSharedFrozenSegment } from './chunk-O4KUNDVF.mjs';
21
+ import './chunk-3HV7M5OJ.mjs';
22
+ import { fnv1a } from './chunk-KAKQ74LS.mjs';
20
23
  import './chunk-HJSN7UYG.mjs';
21
- import { resolveWorkerEntry } from './chunk-UIKN2OTQ.mjs';
22
- import { detectRuntime } from './chunk-AV4IJKD2.mjs';
24
+ import { detectRuntime, resolveWorkerEntry } from './chunk-6BWLDLS3.mjs';
25
+ import './chunk-XIHUI4KB.mjs';
26
+ import './chunk-Q2UL2TPC.mjs';
27
+ import './chunk-3MXV3VHR.mjs';
23
28
  import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-EEBCDP36.mjs';
24
- import { buildSegmentPayload, resolvePartitionInsertOptions, freezeSegmentShared, createSharedFrozenSegment } from './chunk-WJGO5PGV.mjs';
25
- import { fnv1a } from './chunk-ZPWS2SKJ.mjs';
26
- import './chunk-N37VMC62.mjs';
27
- import './chunk-ZATRDAYU.mjs';
28
- import './chunk-EBIHRL7B.mjs';
29
- import './chunk-KOKM4PQN.mjs';
30
- import './chunk-QSK35UC2.mjs';
31
- import './chunk-74XB2SXI.mjs';
32
- import './chunk-RKAVHNRW.mjs';
33
- import './chunk-WQBCBKY3.mjs';
34
- import './chunk-JUKYYXSP.mjs';
35
- import './chunk-DQNKVOJ2.mjs';
36
- import { encodeDocument, requireValidFieldTypes } from './chunk-KGOXHLLZ.mjs';
37
- import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
38
- import './chunk-FQBFZAWG.mjs';
39
- import { MIN_M } from './chunk-VJS4JFBQ.mjs';
40
- import './chunk-GES7U2PM.mjs';
41
- import './chunk-ZSWHPKGM.mjs';
42
- import './chunk-O4LJQI4G.mjs';
29
+ import './chunk-2HJWQPR6.mjs';
43
30
  import './chunk-X5CV2E2B.mjs';
44
- import './chunk-WNBRW4Q2.mjs';
45
31
  import './chunk-TGP5M5R7.mjs';
46
32
  import './chunk-U2BKYEC7.mjs';
47
- import './chunk-NPNK57CA.mjs';
48
- import './chunk-4UMZ7KQL.mjs';
49
- import './chunk-R6A773WK.mjs';
50
- import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
33
+ import './chunk-ZAYWOHVG.mjs';
51
34
  import { createRequestId } from './chunk-QHPYS427.mjs';
52
- import './chunk-GLZHNSGB.mjs';
53
- import './chunk-22YPZVMG.mjs';
35
+ import './chunk-QYRNLLLI.mjs';
36
+ import './chunk-ZXNQEW43.mjs';
37
+ import './chunk-KOKM4PQN.mjs';
38
+ import './chunk-NVTFQFUL.mjs';
39
+ import { turnsAreBudgeted, turnIsSpent, yieldTurn, waitOutsideCountedWrite } from './chunk-LQG5G2LY.mjs';
40
+ import './chunk-BTPGQC6Z.mjs';
54
41
  import './chunk-RFBLQLLZ.mjs';
42
+ import './chunk-U46IZNCW.mjs';
43
+ import './chunk-JUKYYXSP.mjs';
44
+ import { encodeDocument, requireValidFieldTypes } from './chunk-SOUZMPME.mjs';
45
+ import './chunk-FQBFZAWG.mjs';
46
+ import './chunk-65WCV5JO.mjs';
47
+ import './chunk-4UMZ7KQL.mjs';
48
+ import { MIN_M } from './chunk-ZXX5GZEX.mjs';
49
+ import './chunk-KYVRZAYP.mjs';
55
50
  import './chunk-L5ORED7V.mjs';
56
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
51
+ import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
52
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
53
+ import './chunk-R6A773WK.mjs';
54
+ import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
57
55
  import { decode } from '@msgpack/msgpack';
58
56
 
59
57
  // src/persistence/durability/sha256.ts
@@ -360,7 +358,7 @@ function recoverDirectoryRestores(directory) {
360
358
  }
361
359
 
362
360
  // src/persistence/durability/restore-staging.ts
363
- function toError(error) {
361
+ function toError2(error) {
364
362
  return error instanceof Error ? error : new Error(String(error));
365
363
  }
366
364
  function pathUnder(path, root) {
@@ -429,7 +427,7 @@ function createRestoreStaging(storage, indexName, options = {}) {
429
427
  await storage.remove(journalKey(indexName));
430
428
  } catch (removal) {
431
429
  committed = true;
432
- options.onStorageLost?.(toError(removal));
430
+ options.onStorageLost?.(toError2(removal));
433
431
  }
434
432
  throw error;
435
433
  }
@@ -439,7 +437,7 @@ function createRestoreStaging(storage, indexName, options = {}) {
439
437
  try {
440
438
  await (options.finish === void 0 ? finishOnStorage() : options.finish(finishOnStorage));
441
439
  } catch (error) {
442
- options.onStorageLost?.(toError(error));
440
+ options.onStorageLost?.(toError2(error));
443
441
  }
444
442
  },
445
443
  async removeRetired() {
@@ -471,7 +469,7 @@ function adapterRestoreStorage(adapter) {
471
469
  }
472
470
 
473
471
  // src/persistence/durability/archive-checkpoint.ts
474
- function toError2(error) {
472
+ function toError3(error) {
475
473
  return error instanceof Error ? error : new Error(String(error));
476
474
  }
477
475
  function stageDirectoryRestore(deps, indexName) {
@@ -480,7 +478,7 @@ function stageDirectoryRestore(deps, indexName) {
480
478
  try {
481
479
  await run();
482
480
  } catch (error) {
483
- deps.markFatal(toError2(error));
481
+ deps.markFatal(toError3(error));
484
482
  throw error;
485
483
  }
486
484
  },
@@ -504,8 +502,8 @@ function createArchiveCheckpointAccess(deps) {
504
502
  deps.held.set(indexName, (deps.held.get(indexName) ?? 0) + 1);
505
503
  const release = releaser(deps.held, indexName);
506
504
  try {
507
- await deps.checkpoint(indexName);
508
- await deps.checkpoint(indexName);
505
+ await deps.checkpoint(indexName, false);
506
+ await deps.checkpoint(indexName, true);
509
507
  const manifestBytes = await deps.directory.read(manifestKey(indexName));
510
508
  if (manifestBytes === null) {
511
509
  throw new NarsilError(ErrorCodes.PERSISTENCE_SAVE_FAILED, `Index "${indexName}" holds no checkpoint`, {
@@ -710,7 +708,7 @@ function wholePartitionsWhereMostChanged(manager, rules) {
710
708
  return whole;
711
709
  };
712
710
  }
713
- async function captureCheckpoint(indexState, manager, vectorIndexes, wholePartitionsOf = noWholePartitions, priorCheckpointThatLimitsTheRecords, listedVectorFields = [], termHistoryOf, onCaptured) {
711
+ async function captureCheckpoint(indexState, manager, vectorIndexes, wholePartitionsOf = noWholePartitions, priorCheckpointThatLimitsTheRecords, listedVectorFields = [], termHistoryOf, onCaptured, pinsRetiredVectors = false) {
714
712
  for (const vectorIndex of vectorIndexes.values()) await vectorIndex.completeGraph();
715
713
  return whileNoMutationApplies([...indexState.partitions.values()], () => {
716
714
  onCaptured?.();
@@ -735,14 +733,19 @@ async function captureCheckpoint(indexState, manager, vectorIndexes, wholePartit
735
733
  targets.push(target);
736
734
  }
737
735
  const vectorPlans = /* @__PURE__ */ new Map();
738
- for (const [fieldPath, vectorIndex] of vectorIndexes) {
739
- const listed = listedVectorFields.find((ref) => ref.fieldPath === fieldPath);
740
- const listedKeys2 = listed === void 0 ? null : listed.files.map((file) => file.key);
741
- vectorPlans.set(fieldPath, vectorIndex.planCheckpoint(listedKeys2));
742
- }
743
- const memoryMatchesTheTargets = recordsLeftInLog === 0;
744
- const wholePartitions = memoryMatchesTheTargets ? wholePartitionsOf(targets) : noWholePartitions();
745
- return { targets, documentCount, vectorPlans, wholePartitions, recordsLeftInLog };
736
+ try {
737
+ for (const [fieldPath, vectorIndex] of vectorIndexes) {
738
+ const listed = listedVectorFields.find((ref) => ref.fieldPath === fieldPath);
739
+ const listedKeys2 = listed === void 0 ? null : listed.files.map((file) => file.key);
740
+ vectorPlans.set(fieldPath, vectorIndex.planCheckpoint(listedKeys2, false, pinsRetiredVectors));
741
+ }
742
+ const memoryMatchesTheTargets = recordsLeftInLog === 0;
743
+ const wholePartitions = memoryMatchesTheTargets ? wholePartitionsOf(targets) : noWholePartitions();
744
+ return { targets, documentCount, vectorPlans, wholePartitions, recordsLeftInLog };
745
+ } catch (error) {
746
+ for (const plan of vectorPlans.values()) plan.release();
747
+ throw error;
748
+ }
746
749
  });
747
750
  }
748
751
  async function writeCapturedVectors(store, indexName, capture2, priorManifest, rewriteUnchanged) {
@@ -763,6 +766,15 @@ async function writeCapturedVectors(store, indexName, capture2, priorManifest, r
763
766
  return { vectors: written.refs, layouts: written.layouts, written: written.written };
764
767
  }
765
768
 
769
+ // src/persistence/durability/checkpoint-worker-entry.ts
770
+ function resolveCheckpointWorkerEntry() {
771
+ return resolveWorkerEntry(
772
+ import.meta.url,
773
+ /\/src\/persistence\/durability\/[^/]+$/,
774
+ "persistence/durability/checkpoint-worker.mjs"
775
+ );
776
+ }
777
+
766
778
  // src/persistence/durability/checkpoint-worker-dispatch.ts
767
779
  var workerUsable = true;
768
780
  var pooledWorker = null;
@@ -771,11 +783,7 @@ var spawnedWorkerCount = 0;
771
783
  var workerIdleMs = CHECKPOINT_WORKER_IDLE_MS;
772
784
  var idleTimer = null;
773
785
  async function spawnWorker() {
774
- const entryPoint = resolveWorkerEntry(
775
- import.meta.url,
776
- /\/src\/persistence\/durability\/[^/]+$/,
777
- "persistence/durability/checkpoint-worker.mjs"
778
- );
786
+ const entryPoint = resolveCheckpointWorkerEntry();
779
787
  if (entryPoint === null) return null;
780
788
  try {
781
789
  const worker = await spawnNodeWorker(new URL(entryPoint));
@@ -1006,9 +1014,11 @@ function checkpointIsDue(indexState, mutationThreshold, stallAboveBytes = WRITES
1006
1014
  }
1007
1015
  async function stallWhileCheckpointsFallBehind(indexState, stallAboveBytes = WRITES_STALL_ABOVE_UNCHECKPOINTED_BYTES) {
1008
1016
  while (indexState.documentBytesSinceCheckpoint >= stallAboveBytes && indexState.checkpointInFlight !== null && !indexState.unloading) {
1009
- await new Promise((resume) => {
1010
- indexState.stalledWrites.push(resume);
1011
- });
1017
+ await waitOutsideCountedWrite(
1018
+ () => new Promise((resume) => {
1019
+ indexState.stalledWrites.push(resume);
1020
+ })
1021
+ );
1012
1022
  }
1013
1023
  }
1014
1024
  function noteCheckpointCommitted(indexState, recordsBeyondTheCheckpoint) {
@@ -1090,7 +1100,8 @@ async function writeOneBoundedCheckpoint(input) {
1090
1100
  writeRecords === null ? void 0 : (partitionId, lastSeqNo) => writeRecords.termHistoryOf(indexName, partitionId, lastSeqNo),
1091
1101
  textOnDisk ? () => {
1092
1102
  changesSinceCapture = manager.openCheckpointChangeLog();
1093
- } : void 0
1103
+ } : void 0,
1104
+ input.pinsRetiredVectors
1094
1105
  );
1095
1106
  try {
1096
1107
  await openNewLogSegments(input.indexState, input.failPartition);
@@ -1098,12 +1109,13 @@ async function writeOneBoundedCheckpoint(input) {
1098
1109
  return changesSinceCapture;
1099
1110
  });
1100
1111
  } finally {
1112
+ for (const plan of capture2.vectorPlans.values()) plan.release();
1101
1113
  changesSinceCapture?.close();
1102
1114
  }
1103
1115
  }
1104
1116
  async function adoptWrittenSegments(input, manager, partitions, changes) {
1105
1117
  const { indexName, indexState, hooks } = input;
1106
- const { actionPartitionsOf, closeUnusedSegments, prepareDiskAdoption, swapPreparedPartitions } = await import('./module-IYPLWHGC.mjs');
1118
+ const { actionPartitionsOf, closeUnusedSegments, prepareDiskAdoption, swapPreparedPartitions } = await import('./module-V5K4ZP23.mjs');
1107
1119
  const adoption = await prepareDiskAdoption(input.directory, manager, partitions);
1108
1120
  if (adoption === null) return [];
1109
1121
  const adopted = await whileNoMutationApplies([...indexState.partitions.values()], () => {
@@ -1158,7 +1170,7 @@ async function finishBoundedCheckpoint(input, manager, store, metadata, priorMan
1158
1170
  const droppedThisCheckpoint = changes !== null && capture2.recordsLeftInLog === 0 ? new Set(await adoptWrittenSegments(input, manager, segments.partitions, changes)) : /* @__PURE__ */ new Set();
1159
1171
  if (!input.holdsCheckpointFiles()) {
1160
1172
  const removable = await garbageThatNoFieldStillReads(store, vectorIndexes, written.garbage);
1161
- const stillRead = metadata.textStorage === "disk" ? (await import('./module-IYPLWHGC.mjs')).keysThatSegmentsStillRead(manager) : /* @__PURE__ */ new Set();
1173
+ const stillRead = metadata.textStorage === "disk" ? (await import('./module-V5K4ZP23.mjs')).keysThatSegmentsStillRead(manager) : /* @__PURE__ */ new Set();
1162
1174
  await removeCheckpointGarbage(
1163
1175
  store,
1164
1176
  removable.filter((key) => !droppedThisCheckpoint.has(key) && !stillRead.has(key))
@@ -1200,7 +1212,10 @@ function recordsBeyond(indexState, targets) {
1200
1212
  function createIndexLoads(vectorIndexesOf2) {
1201
1213
  const loads = /* @__PURE__ */ new Map();
1202
1214
  const startGraphRepairs = (indexName) => {
1203
- for (const vectorIndex of vectorIndexesOf2(indexName).values()) vectorIndex.startShuffledRebuildWhenDue();
1215
+ for (const vectorIndex of vectorIndexesOf2(indexName).values()) {
1216
+ vectorIndex.scheduleBuild();
1217
+ vectorIndex.startShuffledRebuildWhenDue();
1218
+ }
1204
1219
  };
1205
1220
  return {
1206
1221
  track(indexName, load, startsGraphRepairs = true) {
@@ -1383,8 +1398,28 @@ function createHeldCheckpoints(hooks) {
1383
1398
  };
1384
1399
  }
1385
1400
 
1401
+ // src/persistence/durability/metadata-write-queue.ts
1402
+ function createMetadataWriteQueue() {
1403
+ const writes = /* @__PURE__ */ new Map();
1404
+ return {
1405
+ queue(indexName, write) {
1406
+ const previous = writes.get(indexName) ?? Promise.resolve();
1407
+ const queued = previous.then(write);
1408
+ writes.set(
1409
+ indexName,
1410
+ queued.catch(() => void 0)
1411
+ );
1412
+ return queued;
1413
+ },
1414
+ pending: (indexName) => writes.get(indexName),
1415
+ forget(indexName) {
1416
+ writes.delete(indexName);
1417
+ }
1418
+ };
1419
+ }
1420
+
1386
1421
  // src/persistence/durability/mutation-batch.ts
1387
- function toError3(err) {
1422
+ function toError4(err) {
1388
1423
  return err instanceof Error ? err : new Error(String(err));
1389
1424
  }
1390
1425
  function requireAscendingSeqNo(record, seqNo, previousSeqNo) {
@@ -1404,7 +1439,7 @@ function failUnlessAlreadyFailed(outcomes, count, error) {
1404
1439
  }
1405
1440
  }
1406
1441
  function failPartition(partition, address, deps, err) {
1407
- const error = toError3(err);
1442
+ const error = toError4(err);
1408
1443
  if (partition.failed !== null) return partition.failed;
1409
1444
  partition.failed = error;
1410
1445
  if (!deps.failsPartitionAlone(address.indexName, address.partitionId, error)) deps.markFatal(error);
@@ -1465,6 +1500,7 @@ async function recordPartitionBatch(partition, records, deps) {
1465
1500
  }
1466
1501
  const applied = [];
1467
1502
  for (let i = 0; i < records.length; i++) {
1503
+ if (turnsAreBudgeted && turnIsSpent()) await yieldTurn();
1468
1504
  try {
1469
1505
  await records[i].apply();
1470
1506
  applied.push(i);
@@ -1479,6 +1515,7 @@ async function recordPartitionBatch(partition, records, deps) {
1479
1515
  const entries = [];
1480
1516
  try {
1481
1517
  for (const i of applied) {
1518
+ if (turnsAreBudgeted && turnIsSpent()) await yieldTurn();
1482
1519
  let numbered;
1483
1520
  try {
1484
1521
  numbered = deps.numberEntry(records[i]);
@@ -1516,7 +1553,7 @@ async function recordPartitionBatch(partition, records, deps) {
1516
1553
  }
1517
1554
  }
1518
1555
  } catch (err) {
1519
- failUnlessAlreadyFailed(outcomes, records.length, toError3(err));
1556
+ failUnlessAlreadyFailed(outcomes, records.length, toError4(err));
1520
1557
  }
1521
1558
  return outcomes;
1522
1559
  }
@@ -1843,7 +1880,11 @@ function createWalWriter(directory, config) {
1843
1880
  if (entries.length === 0) {
1844
1881
  return;
1845
1882
  }
1846
- const frames = entries.map(frameRecord);
1883
+ const frames = [];
1884
+ for (const entry of entries) {
1885
+ if (turnsAreBudgeted && turnIsSpent()) await yieldTurn();
1886
+ frames.push(frameRecord(entry));
1887
+ }
1847
1888
  await ensureSegment(entries[0].seqNo);
1848
1889
  let start = 0;
1849
1890
  while (start < frames.length) {
@@ -2355,7 +2396,7 @@ var decoder = new TextDecoder();
2355
2396
  async function countPagedPartition(store, partition) {
2356
2397
  const { directory } = store;
2357
2398
  if (directory === void 0 || partition.segments.length === 0) return null;
2358
- const { countsAsLatestHolder, isPagedSegmentFile, openPagedSegmentScan } = await import('./module-IYPLWHGC.mjs');
2399
+ const { countsAsLatestHolder, isPagedSegmentFile, openPagedSegmentScan } = await import('./module-V5K4ZP23.mjs');
2359
2400
  for (const ref of partition.segments) if (!await isPagedSegmentFile(directory, ref.key)) return null;
2360
2401
  const scans = [];
2361
2402
  try {
@@ -2736,7 +2777,8 @@ async function recoverPersistedIndex(deps, indexName, metadataOnly) {
2736
2777
  manager,
2737
2778
  vectorFieldPaths: hooks.getVectorFieldPaths(indexName),
2738
2779
  vectorIndexes: hooks.getVectorIndexes(indexName),
2739
- writeRecords
2780
+ writeRecords,
2781
+ defersGraphBuilds: true
2740
2782
  };
2741
2783
  const replay = async (checkpoint) => {
2742
2784
  const replayed = [];
@@ -2802,7 +2844,8 @@ function createDurabilityManager(config, hooks, directoryOverride) {
2802
2844
  let commitDeferral = null;
2803
2845
  const partitionFailures = createPartitionFailureRouting();
2804
2846
  const heldCheckpoints = createHeldCheckpoints(hooks);
2805
- const metadataWrites = /* @__PURE__ */ new Map();
2847
+ const metadataWrites = createMetadataWriteQueue();
2848
+ const queueMetadataWrite = metadataWrites.queue;
2806
2849
  let checkpointTimer = null;
2807
2850
  let asyncFlushTimer = null;
2808
2851
  let shuttingDown = false;
@@ -2823,25 +2866,13 @@ function createDurabilityManager(config, hooks, directoryOverride) {
2823
2866
  stopTimers();
2824
2867
  hooks.onFatalError(error);
2825
2868
  }
2826
- function toError5(err) {
2827
- return err instanceof Error ? err : new Error(String(err));
2828
- }
2829
2869
  async function closeWriterReportingFailure(closePromise) {
2830
2870
  try {
2831
2871
  await closePromise;
2832
2872
  } catch (err) {
2833
- markFatal(toError5(err));
2873
+ markFatal(toError(err));
2834
2874
  }
2835
2875
  }
2836
- function queueMetadataWrite(indexName, write) {
2837
- const previous = metadataWrites.get(indexName) ?? Promise.resolve();
2838
- const queued = previous.then(write);
2839
- metadataWrites.set(
2840
- indexName,
2841
- queued.catch(() => void 0)
2842
- );
2843
- return queued;
2844
- }
2845
2876
  function startCheckpointTimer() {
2846
2877
  if (checkpointTimer !== null || shuttingDown || fatalError !== null || checkpointIntervalMs <= 0) {
2847
2878
  return;
@@ -2865,25 +2896,25 @@ function createDurabilityManager(config, hooks, directoryOverride) {
2865
2896
  try {
2866
2897
  await checkpointIndex(indexName);
2867
2898
  } catch (err) {
2868
- markFatal(toError5(err));
2899
+ markFatal(toError(err));
2869
2900
  }
2870
2901
  }
2871
2902
  }
2872
- async function checkpointIndex(indexName, fromMemory = false, afterInFlight = fromMemory) {
2903
+ async function checkpointIndex(indexName, fromMemory = false, afterInFlight = fromMemory, pinsRetiredVectors = false) {
2873
2904
  const indexState = indexes.get(indexName);
2874
2905
  if (indexState === void 0 || indexState.unloading || heldCheckpoints.holds(indexName, indexState)) return;
2875
2906
  return checkpointInTurn(indexState, {
2876
- joinsInFlight: !afterInFlight,
2907
+ joinsInFlight: !afterInFlight && !pinsRetiredVectors,
2877
2908
  mayStart: () => !indexState.unloading && !shuttingDown,
2878
- perform: () => performCheckpoint(indexName, indexState, fromMemory),
2909
+ perform: () => performCheckpoint(indexName, indexState, fromMemory, pinsRetiredVectors),
2879
2910
  afterSettling: () => releaseStalledWrites(indexState)
2880
2911
  });
2881
2912
  }
2882
- async function requestedCheckpoint(indexName, fromMemory = false) {
2913
+ async function requestedCheckpoint(indexName, fromMemory = false, pinsVectors = false) {
2883
2914
  heldCheckpoints.refuse(indexName, indexes.get(indexName));
2884
- return checkpointIndex(indexName, fromMemory);
2915
+ return checkpointIndex(indexName, fromMemory, fromMemory, pinsVectors);
2885
2916
  }
2886
- async function performCheckpoint(indexName, indexState, fromMemory = false) {
2917
+ async function performCheckpoint(indexName, indexState, fromMemory = false, pinsRetiredVectors = false) {
2887
2918
  await directoryWatch.verify();
2888
2919
  if (fatalError !== null) throw fatalError;
2889
2920
  await runDurableCheckpoint({
@@ -2894,6 +2925,7 @@ function createDurabilityManager(config, hooks, directoryOverride) {
2894
2925
  compactionThreshold,
2895
2926
  canOffload: canOffloadCheckpoint,
2896
2927
  fromMemory,
2928
+ pinsRetiredVectors,
2897
2929
  mutationThreshold: checkpointMutationThreshold,
2898
2930
  mayContinue: () => !indexState.unloading && !shuttingDown && fatalError === null,
2899
2931
  holdsCheckpointFiles: () => heldCheckpointFiles.has(indexName),
@@ -2935,7 +2967,7 @@ function createDurabilityManager(config, hooks, directoryOverride) {
2935
2967
  indexState.documentBytesSinceCheckpoint += recorded.documentBytes;
2936
2968
  if (checkpointIsDue(indexState, checkpointMutationThreshold)) {
2937
2969
  void checkpointIndex(indexName).catch((err) => {
2938
- markFatal(toError5(err));
2970
+ markFatal(toError(err));
2939
2971
  });
2940
2972
  }
2941
2973
  await stallWhileCheckpointsFallBehind(indexState);
@@ -3039,7 +3071,7 @@ function createDurabilityManager(config, hooks, directoryOverride) {
3039
3071
  },
3040
3072
  async checkpointAfterInFlight(indexName) {
3041
3073
  await loads.settled(indexName);
3042
- await checkpointIndex(indexName, false, true).catch((err) => markFatal(toError5(err)));
3074
+ await checkpointIndex(indexName, false, true).catch((err) => markFatal(toError(err)));
3043
3075
  },
3044
3076
  async checkpointAll() {
3045
3077
  for (const indexName of [...indexes.keys()]) {
@@ -3050,9 +3082,9 @@ function createDurabilityManager(config, hooks, directoryOverride) {
3050
3082
  hooks.writeRecords?.dropIndex(indexName);
3051
3083
  const indexState = indexes.get(indexName);
3052
3084
  if (indexState !== void 0) {
3053
- await drainIndexStateForUnload(indexState, metadataWrites.get(indexName), closeWriterReportingFailure);
3085
+ await drainIndexStateForUnload(indexState, metadataWrites.pending(indexName), closeWriterReportingFailure);
3054
3086
  indexes.delete(indexName);
3055
- metadataWrites.delete(indexName);
3087
+ metadataWrites.forget(indexName);
3056
3088
  }
3057
3089
  for (const vectorIndex of hooks.getVectorIndexes(indexName).values()) await vectorIndex.releaseVectorFiles();
3058
3090
  for (const key of await directory.list(`${indexName}/`)) {
@@ -3064,14 +3096,14 @@ function createDurabilityManager(config, hooks, directoryOverride) {
3064
3096
  if (indexState === void 0) {
3065
3097
  return;
3066
3098
  }
3067
- await drainIndexStateForUnload(indexState, metadataWrites.get(indexName), (close) => close);
3099
+ await drainIndexStateForUnload(indexState, metadataWrites.pending(indexName), (close) => close);
3068
3100
  indexes.delete(indexName);
3069
- metadataWrites.delete(indexName);
3101
+ metadataWrites.forget(indexName);
3070
3102
  },
3071
3103
  ...createArchiveCheckpointAccess({
3072
3104
  directory,
3073
3105
  held: heldCheckpointFiles,
3074
- checkpoint: (name) => requestedCheckpoint(name),
3106
+ checkpoint: (name, pinsVectors) => requestedCheckpoint(name, false, pinsVectors),
3075
3107
  registerPartition: (name, partitionId, startSeqNo, primaryTerm) => getOrCreatePartition(name, partitionId, startSeqNo, primaryTerm),
3076
3108
  markFatal
3077
3109
  }),
@@ -3161,7 +3193,7 @@ function createSnapshotIndexState() {
3161
3193
  }
3162
3194
 
3163
3195
  // src/persistence/durability/snapshot-only/restores.ts
3164
- function toError4(error) {
3196
+ function toError5(error) {
3165
3197
  return error instanceof Error ? error : new Error(String(error));
3166
3198
  }
3167
3199
  function createPendingRestores(onFatalError) {
@@ -3182,7 +3214,7 @@ function createPendingRestores(onFatalError) {
3182
3214
  return running;
3183
3215
  };
3184
3216
  pending.set(indexName, finish);
3185
- void finish().catch((error) => onFatalError(toError4(error)));
3217
+ void finish().catch((error) => onFatalError(toError5(error)));
3186
3218
  return Promise.resolve();
3187
3219
  },
3188
3220
  async settle(indexName) {
@@ -3568,6 +3600,7 @@ function createDurabilityIntegration(tier, hooks) {
3568
3600
  const outcomes = new Array(mutations.length);
3569
3601
  const recordPositions = [];
3570
3602
  for (let i = 0; i < mutations.length; i++) {
3603
+ if (turnsAreBudgeted && turnIsSpent()) await yieldTurn();
3571
3604
  const mutation = mutations[i];
3572
3605
  try {
3573
3606
  records.push({
@@ -1,4 +1,4 @@
1
- import { E as EmbeddingAdapter } from '../adapters-BQFQ4PRz.js';
1
+ import { E as EmbeddingAdapter } from '../adapters-pljAqmrC.js';
2
2
 
3
3
  /**
4
4
  * How {@link createOpenAIEmbedding} reaches an embeddings endpoint.
@@ -1,5 +1,5 @@
1
- import { resolveApiKey, buildSignal, postJsonWithRetry } from '../chunk-NOT5QOHU.mjs';
2
- import { NarsilError, ErrorCodes } from '../chunk-HNHCNTVG.mjs';
1
+ import { resolveApiKey, buildSignal, postJsonWithRetry } from '../chunk-J7M73VY7.mjs';
2
+ import { NarsilError, ErrorCodes } from '../chunk-MDF6PDIA.mjs';
3
3
 
4
4
  // src/embeddings/constants.ts
5
5
  var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
@@ -1,6 +1,6 @@
1
- import { E as EmbeddingAdapter, R as RerankAdapter } from './adapters-BQFQ4PRz.js';
2
- import { B as BM25Params, A as AnyDocument, I as InsertOptions, W as WriteOptions, a as IndexConfig, P as PartitionConfig } from './schema-B-Runv0n.js';
3
- import { B as BatchResult, I as IndexInfo, k as IndexStats, P as PartitionStatsResult, L as ListParams, f as ListResult, Q as QueryParams, m as QueryResult, j as PreflightResult, g as SuggestParams, h as SuggestResult, D as DocumentImportResult, M as MemoryStats, V as VectorMaintenanceResult, l as NarsilEventMap } from './config-BhZxIeb1.js';
1
+ import { E as EmbeddingAdapter, R as RerankAdapter } from './adapters-pljAqmrC.js';
2
+ import { B as BM25Params, A as AnyDocument, I as InsertOptions, W as WriteOptions, a as IndexConfig, P as PartitionConfig } from './schema-D33CyXCy.js';
3
+ import { B as BatchResult, I as IndexInfo, k as IndexStats, P as PartitionStatsResult, L as ListParams, f as ListResult, Q as QueryParams, m as QueryResult, j as PreflightResult, g as SuggestParams, h as SuggestResult, D as DocumentImportResult, M as MemoryStats, V as VectorMaintenanceResult, l as NarsilEventMap } from './config-aIsy7mcL.js';
4
4
  import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
5
5
 
6
6
  /**
@@ -0,0 +1 @@
1
+ export { gunzip, gzip } from './chunk-ZXNNR73R.mjs';
@@ -0,0 +1,41 @@
1
+ export { DOCUMENT_EXPORT_FORMAT, DOCUMENT_EXPORT_VERSION, readDocumentExport } from './chunk-F22IOCR2.mjs';
2
+ import './chunk-NYSONUB7.mjs';
3
+ import './chunk-CZQ33DLW.mjs';
4
+ import './chunk-IRWP524D.mjs';
5
+ import './chunk-VQDZVWN3.mjs';
6
+ import './chunk-6F6USYII.mjs';
7
+ import './chunk-O4KUNDVF.mjs';
8
+ import './chunk-3HV7M5OJ.mjs';
9
+ import './chunk-KAKQ74LS.mjs';
10
+ import './chunk-HJSN7UYG.mjs';
11
+ import './chunk-6BWLDLS3.mjs';
12
+ import './chunk-XIHUI4KB.mjs';
13
+ import './chunk-Q2UL2TPC.mjs';
14
+ import './chunk-3MXV3VHR.mjs';
15
+ import './chunk-EEBCDP36.mjs';
16
+ import './chunk-2HJWQPR6.mjs';
17
+ import './chunk-X5CV2E2B.mjs';
18
+ import './chunk-TGP5M5R7.mjs';
19
+ import './chunk-U2BKYEC7.mjs';
20
+ import './chunk-ZAYWOHVG.mjs';
21
+ import './chunk-QHPYS427.mjs';
22
+ import './chunk-QYRNLLLI.mjs';
23
+ import './chunk-ZXNQEW43.mjs';
24
+ import './chunk-KOKM4PQN.mjs';
25
+ import './chunk-NVTFQFUL.mjs';
26
+ import './chunk-LQG5G2LY.mjs';
27
+ import './chunk-BTPGQC6Z.mjs';
28
+ import './chunk-RFBLQLLZ.mjs';
29
+ import './chunk-U46IZNCW.mjs';
30
+ import './chunk-JUKYYXSP.mjs';
31
+ import './chunk-SOUZMPME.mjs';
32
+ import './chunk-FQBFZAWG.mjs';
33
+ import './chunk-65WCV5JO.mjs';
34
+ import './chunk-4UMZ7KQL.mjs';
35
+ import './chunk-ZXX5GZEX.mjs';
36
+ import './chunk-KYVRZAYP.mjs';
37
+ import './chunk-L5ORED7V.mjs';
38
+ import './chunk-U476IXKQ.mjs';
39
+ import './chunk-MDF6PDIA.mjs';
40
+ import './chunk-R6A773WK.mjs';
41
+ import './chunk-YTJCGKM4.mjs';
@@ -1,4 +1,4 @@
1
- import { S as SchemaDefinition } from './schema-B-Runv0n.js';
1
+ import { S as SchemaDefinition } from './schema-D33CyXCy.js';
2
2
 
3
3
  /**
4
4
  * Tells watchers that the stored metadata of an index changed.
@@ -516,4 +516,4 @@ interface ClusterCoordinator extends IndexMetadataWatch {
516
516
  shutdown(): Promise<void>;
517
517
  }
518
518
 
519
- export type { AllocationTable as A, ClusterCoordinator as C, IndexMetadataEvent as I, NodeRole as N, PartitionAssignment as P, RegistrationLease as R, SchemaEvent as S, UnassignedReason as U, NodeRegistration as a, NodeCapacity as b, NodeMemoryReport as c, AllocationConstraints as d, AllocationEvent as e, IndexMetadataWatch as f, IndexPartitionBytes as g, NodeEvent as h, PartitionState as i };
519
+ export type { AllocationConstraints as A, ClusterCoordinator as C, IndexMetadataEvent as I, NodeRole as N, PartitionAssignment as P, RegistrationLease as R, SchemaEvent as S, UnassignedReason as U, AllocationTable as a, NodeRegistration as b, NodeCapacity as c, NodeMemoryReport as d, AllocationEvent as e, IndexMetadataWatch as f, IndexPartitionBytes as g, NodeEvent as h, PartitionState as i };
@@ -1,6 +1,9 @@
1
- export { VERSION, clearNormalizationCache, configureNormalizationCache, createNarsil, getLanguage, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerLanguage, registerPartialWordSearch, registerPatternSearch, registerStopWords, registerSynonyms, registerTokenizer, resetNormalizationCache } from './browser/chunk-5DB2VDGI.mjs';
1
+ export { VERSION, clearNormalizationCache, configureNormalizationCache, createNarsil, getLanguage, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerLanguage, registerPartialWordSearch, registerPatternSearch, registerStopWords, registerSynonyms, registerTokenizer, resetNormalizationCache } from './browser/chunk-BVX2MEHA.mjs';
2
+ import './browser/chunk-MPK76GVS.mjs';
2
3
  import './browser/chunk-JPTQZWJQ.mjs';
3
4
  import './browser/chunk-26A5JFT2.mjs';
4
- export { isSimdAvailable } from './browser/chunk-D33A5VMU.mjs';
5
- import './browser/chunk-MZI3TEOW.mjs';
6
- export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './browser/chunk-35B42UFM.mjs';
5
+ export { isSimdAvailable } from './browser/chunk-IAXZAVYL.mjs';
6
+ import './browser/chunk-TY7L6OXO.mjs';
7
+ import './browser/chunk-4RD3AFSB.mjs';
8
+ import './browser/chunk-WXLBZJMT.mjs';
9
+ export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './browser/chunk-PIS7ZAP7.mjs';