@delali/narsil 0.3.1-next.160 → 0.3.1-next.162

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 (116) hide show
  1. package/dist/browser/{chunk-4RNSFVWI.mjs → chunk-KQXKCMGQ.mjs} +7 -5
  2. package/dist/browser/{core-leaf-TJAGWPZZ.mjs → core-leaf-SIWXFZLV.mjs} +66 -4
  3. package/dist/browser/{module-362VSIGR.mjs → module-PMQBRESM.mjs} +167 -45
  4. package/dist/browser/{storage-leaf-X6CNRHJS.mjs → storage-leaf-VGR2BWJJ.mjs} +35 -26
  5. package/dist/browser/{store-leaf-AEMTAVHX.mjs → store-leaf-3L33V35P.mjs} +3 -2
  6. package/dist/browser/{suggestions-leaf-3Y6MR6OF.mjs → suggestions-leaf-UBNDVKBD.mjs} +3 -1
  7. package/dist/{capabilities-BKDrry0z.d.ts → capabilities-DkXAkb-X.d.ts} +2 -2
  8. package/dist/{chunk-NC4QLCZC.mjs → chunk-3UGZBRDN.mjs} +1 -1
  9. package/dist/{chunk-75UNINFA.mjs → chunk-5DUTOEK5.mjs} +1 -1
  10. package/dist/{chunk-U6B7DUQW.mjs → chunk-5P72V66D.mjs} +4 -4
  11. package/dist/{chunk-TSLV5P2J.mjs → chunk-7OE73OO4.mjs} +6 -10
  12. package/dist/{chunk-GF4K7IUK.mjs → chunk-BKOMO7HT.mjs} +5 -5
  13. package/dist/{chunk-SXIRM4MX.mjs → chunk-D5GNFN6X.mjs} +26 -15
  14. package/dist/{chunk-SHGN3QIF.mjs → chunk-DSXFN5BF.mjs} +4 -4
  15. package/dist/{chunk-TINW4BSH.mjs → chunk-EEYDJB4Z.mjs} +17 -14
  16. package/dist/{chunk-2RIS76RJ.mjs → chunk-EI7U43MX.mjs} +1 -1
  17. package/dist/{chunk-LF4GB4PO.mjs → chunk-EIR3IQCL.mjs} +1 -1
  18. package/dist/{chunk-2JRERUNZ.mjs → chunk-ES5EOXT6.mjs} +2 -2
  19. package/dist/{chunk-FVZ5DB6Y.mjs → chunk-FSLQHOKZ.mjs} +1 -1
  20. package/dist/{chunk-W34VJXY7.mjs → chunk-GJKFXKMI.mjs} +4 -4
  21. package/dist/{chunk-6EZW2GQL.mjs → chunk-GQLOEACG.mjs} +4 -3
  22. package/dist/{chunk-H64YDF5M.mjs → chunk-K4BMDPPX.mjs} +1 -1
  23. package/dist/{chunk-7MWYORQC.mjs → chunk-KSOZJEYU.mjs} +1 -1
  24. package/dist/{chunk-BXM7XM4G.mjs → chunk-NXMGUDZA.mjs} +2 -2
  25. package/dist/{chunk-P5YLI5ED.mjs → chunk-Q2WQSAYH.mjs} +1 -1
  26. package/dist/{chunk-V3SGPXWQ.mjs → chunk-Q7CUUSJ2.mjs} +2 -2
  27. package/dist/{chunk-3D6RZGJH.mjs → chunk-R4F7ZTVG.mjs} +2 -2
  28. package/dist/{chunk-OOO54OVC.mjs → chunk-RXMR2SIQ.mjs} +3 -3
  29. package/dist/{chunk-HOOR4CP5.mjs → chunk-STLNPJXU.mjs} +2 -2
  30. package/dist/{chunk-FE3MRIBN.mjs → chunk-TOZENMM7.mjs} +5 -5
  31. package/dist/{chunk-PTTMGRG5.mjs → chunk-V4YIEMAI.mjs} +2 -2
  32. package/dist/{chunk-LAWIJRMJ.mjs → chunk-VJOS6MHF.mjs} +67 -5
  33. package/dist/{chunk-K67I3RF4.mjs → chunk-XRBPHCCT.mjs} +2 -2
  34. package/dist/{chunk-E2F6LZR3.mjs → chunk-XXWEUXE4.mjs} +1 -1
  35. package/dist/{react-native/chunks/chunk-ZIU6TWXG.mjs → chunk-ZBVHS5KF.mjs} +1 -1
  36. package/dist/{chunk-IH3G6SJO.mjs → chunk-ZGYF37MG.mjs} +1 -1
  37. package/dist/{client-CTp8RRiK.d.ts → client-VJmV_AjZ.d.ts} +3 -3
  38. package/dist/client.d.ts +6 -6
  39. package/dist/{config-_WT5grSL.d.ts → config-Cb3FOlE_.d.ts} +1 -1
  40. package/dist/{config-PCNzWjHL.d.ts → config-ZZg4cwQz.d.ts} +1 -1
  41. package/dist/{core-leaf-KXFGP74A.mjs → core-leaf-LOXCD7MY.mjs} +2 -2
  42. package/dist/{direct-executor-MKTZBR26.mjs → direct-executor-PF4UDSUW.mjs} +2 -2
  43. package/dist/distribution.d.ts +4 -4
  44. package/dist/distribution.mjs +31 -32
  45. package/dist/{engine-DBRVR_d-.d.ts → engine-DdOs682x.d.ts} +9 -1
  46. package/dist/index.browser.mjs +1 -1
  47. package/dist/index.d.ts +4 -4
  48. package/dist/index.mjs +2 -2
  49. package/dist/index.react-native.mjs +4 -4
  50. package/dist/{long-query-thread-JMGNGF6V.mjs → long-query-thread-OTVLP2OI.mjs} +12 -12
  51. package/dist/{module-ZJ6ARG6V.mjs → module-UIKSHY3G.mjs} +173 -51
  52. package/dist/{optional-reads-BR3BOVZW.mjs → optional-reads-RSLNSGNG.mjs} +1 -1
  53. package/dist/{optional-writes-DDFHYUOH.mjs → optional-writes-4ITCV7YT.mjs} +4 -4
  54. package/dist/{paged-partition-archive-G576XGVE.mjs → paged-partition-archive-VMJ2AUA6.mjs} +11 -11
  55. package/dist/partial-words.browser.mjs +3 -2
  56. package/dist/partial-words.mjs +2 -2
  57. package/dist/persistence/durability/checkpoint-worker.mjs +9 -9
  58. package/dist/{phrase-module-XK3T44VU.mjs → phrase-module-IWSG2DDZ.mjs} +1 -1
  59. package/dist/{query-actions-OMXJEC2J.mjs → query-actions-EW72OQXY.mjs} +2 -2
  60. package/dist/query-suggestions/merge-worker.mjs +5 -5
  61. package/dist/query-suggestions.browser.mjs +1 -1
  62. package/dist/query-suggestions.d.ts +1 -1
  63. package/dist/query-suggestions.mjs +3 -3
  64. package/dist/react-native/chunks/{chunk-52QD7CBJ.mjs → chunk-2JMAUU26.mjs} +1 -1
  65. package/dist/react-native/chunks/{chunk-72OKYHZL.mjs → chunk-3RUXKZJG.mjs} +4 -3
  66. package/dist/react-native/chunks/{chunk-L4R5ITVG.mjs → chunk-AUXXPSFB.mjs} +17 -15
  67. package/dist/{chunk-IB4BYLE3.mjs → react-native/chunks/chunk-HEELWLKL.mjs} +1 -1
  68. package/dist/react-native/chunks/{chunk-IY6U6HRA.mjs → chunk-I5W7A2JF.mjs} +2 -2
  69. package/dist/react-native/chunks/{chunk-AQOWRH2C.mjs → chunk-RVHCQJQM.mjs} +1 -1
  70. package/dist/react-native/chunks/{chunk-XEGKQKLY.mjs → chunk-VIPNDN4B.mjs} +67 -5
  71. package/dist/react-native/chunks/{chunk-G3CUQ333.mjs → chunk-XBTFK3AZ.mjs} +1 -1
  72. package/dist/react-native/chunks/{chunk-J2NQW353.mjs → chunk-XOCM3BFU.mjs} +1 -1
  73. package/dist/react-native/chunks/{core-leaf-5B4JXCVA.mjs → core-leaf-O3236QY3.mjs} +2 -2
  74. package/dist/react-native/chunks/{module-VUA27HZZ.mjs → module-LRR7D5ZO.mjs} +168 -46
  75. package/dist/react-native/chunks/{optional-reads-WDTLLHUT.mjs → optional-reads-TOWGNEDH.mjs} +1 -1
  76. package/dist/react-native/chunks/{optional-writes-FZV3QW34.mjs → optional-writes-7AFBIZMN.mjs} +5 -5
  77. package/dist/react-native/chunks/{phrase-module-KCQWVXYZ.mjs → phrase-module-3A4AKMKL.mjs} +1 -1
  78. package/dist/react-native/chunks/{restore-queue-EI2V2I4S.mjs → restore-queue-7FSHTGJ5.mjs} +7 -7
  79. package/dist/react-native/chunks/{segment-codec-leaf-6ULP7H3I.mjs → segment-codec-leaf-4QV4HO4R.mjs} +5 -5
  80. package/dist/react-native/chunks/{segment-merge-leaf-F4GQZNK6.mjs → segment-merge-leaf-5DUZZSXJ.mjs} +6 -6
  81. package/dist/react-native/chunks/{storage-leaf-OAXBU2L6.mjs → storage-leaf-PNU6HWY7.mjs} +42 -33
  82. package/dist/react-native/chunks/{store-leaf-GY2ZZFXB.mjs → store-leaf-ESVUGYYO.mjs} +6 -6
  83. package/dist/react-native/chunks/{suggestions-leaf-SQEZ4IBS.mjs → suggestions-leaf-MOVOPBGD.mjs} +7 -7
  84. package/dist/react-native/chunks/{worker-copies-EEHSCFJW.mjs → worker-copies-VQGF3WZX.mjs} +5 -5
  85. package/dist/react-native/partial-words.mjs +6 -5
  86. package/dist/react-native/pattern.mjs +1 -1
  87. package/dist/react-native/query-suggestions.mjs +4 -4
  88. package/dist/react-native/sync.mjs +4 -4
  89. package/dist/react-native/synonyms.mjs +4 -4
  90. package/dist/react.d.ts +7 -7
  91. package/dist/{rerank-Y6MWBMTT.mjs → rerank-QHJXPSAK.mjs} +2 -2
  92. package/dist/{restore-queue-KPYSRJ4A.mjs → restore-queue-5W5HX44H.mjs} +5 -5
  93. package/dist/{segment-codec-leaf-6IFBSBPN.mjs → segment-codec-leaf-7VLVXKWO.mjs} +3 -3
  94. package/dist/{segment-merge-leaf-VE3FUSVE.mjs → segment-merge-leaf-22XR3IGA.mjs} +3 -3
  95. package/dist/server.d.ts +8 -8
  96. package/dist/server.mjs +17 -17
  97. package/dist/{storage-leaf-HMIIOUYN.mjs → storage-leaf-ZZ77C3DX.mjs} +37 -35
  98. package/dist/{store-leaf-M7T7SUZJ.mjs → store-leaf-LJ6D2PMF.mjs} +4 -4
  99. package/dist/{suggestions-leaf-Q3Q5D6XV.mjs → suggestions-leaf-KTQHO3PY.mjs} +6 -6
  100. package/dist/sync/filesystem.d.ts +2 -2
  101. package/dist/sync/filesystem.mjs +6 -6
  102. package/dist/sync/indexeddb.d.ts +2 -2
  103. package/dist/sync.browser.mjs +1 -1
  104. package/dist/sync.d.ts +3 -3
  105. package/dist/sync.mjs +2 -2
  106. package/dist/synonyms.browser.mjs +1 -1
  107. package/dist/synonyms.mjs +2 -2
  108. package/dist/{tasks-B4tT4vmP.d.ts → tasks-CxA-J_Ty.d.ts} +2 -2
  109. package/dist/{thread-SNILJXX3.mjs → thread-XWDK6TAR.mjs} +11 -11
  110. package/dist/{types-CTg0KaMy.d.ts → types-BboB278g.d.ts} +1 -1
  111. package/dist/vector/search-worker.mjs +4 -4
  112. package/dist/{worker-copies-ZLZS2CUM.mjs → worker-copies-ODAAGQRC.mjs} +5 -5
  113. package/dist/workers/entry.mjs +8 -8
  114. package/openapi.json +2 -2
  115. package/package.json +7 -7
  116. /package/dist/{chunk-YETKPX5M.mjs → chunk-T4HMSZCX.mjs} +0 -0
@@ -1,7 +1,7 @@
1
- import { chargeHeapBytes } from './chunk-52QD7CBJ.mjs';
2
- import { VECTOR_WORKER_COPIES_ALLOWED, DEFAULT_RANK_CONSTANT, MAX_RENUMBERED_SEARCH_ATTEMPTS, openSharedQuantizer, STORE_ORDINAL_LAYOUT_GENERATION, searchOrdinals, withTransientAdmission, insertNode, GRAPH_RETIRED, nodeCountOf, tombstoneCountOf, DEFAULT_PROMOTION_THRESHOLD, DEFAULT_FILTER_THRESHOLD, defaultQuantizationFor, osqBitsOf, DEFAULT_VECTOR_METRIC, noBuildHistory, createOsqQuantizer, recordCheckpoint, assignStorePartitions, liveSize, writeSequenceOf, writeSequenceWords, storePinsOf, admissionAt, handOverBuildTurns, filterForOptions, openGraphState, DEFAULT_LINEAR_ALPHA, MIN_LINEAR_ALPHA, MAX_LINEAR_ALPHA, MIN_RANK_CONSTANT, requirePinnedState, RESULT_WINDOW, STORE_UNPLACED_COUNT, STORE_LIVE_COUNT, STORE_REMOVED_COUNT, fixedView, VECTOR_MEMORY_LIMITS, createDocIdMap, sharedVectorStoreBytes, IN_MEMORY, STORE_RELEASED_VECTORS_TO_DISK, STORE_SLOTS, DISK_STORAGE_BLOCK_BYTES, ESTIMATED_MS_PER_TOMBSTONE, graphNeedsRebuild, ESTIMATED_MS_PER_VECTOR_REBUILD, turnsAreBudgeted, yieldBackgroundTurn, yieldBuildTurn, holdAdmission, fieldHandlesOf, ordinalFilterForSubsets, ordinalFilterValues, nativeScoresOf, toScore, ordinalFilterHas, threadedNativeCore, threadsHoldCurrentLayout, WORKER_COPY_MIN_VECTORS, MIN_OVERSAMPLE, signalOfSearch, bindSearchSignal, UNPLACED_FLAG_CHUNK_ORDINALS, openVectorBlock, NOTHING_STAGED, magnitude, arenaFloat32Distance, slotByteOffset, detachNativeStore, STORE_BLOCK_COUNT, STORE_CODE_BLOCK_COUNT, createVectorFileReader, createSharedVectorStoreHandles, sequenceWritesOf, STORE_DOC_ID_BYTES, unplacedChunkCount, blocksGrowthBytes, oldestHeldPin, coverOrdinal, nextSequence, publishSequence, createOrdinalFilter, addToOrdinalFilter, stampBorn, mayFree, retiredAtOf, stampRetired, SHUFFLED_REBUILD_MEMORY_RETRY_MS, emptyFieldBeforeRestore, nativeStoreScratchBytes, toDistance, SEARCH_ATTEMPTS_BEFORE_HOLDING_WRITES, holdWritesAndBackgroundWork, FUSION_TIE_INSERTION_LIMIT, QUERY_STAGED, euclideanDistance, dotProduct, cosineSimilarityWithMagnitudes, grownByteLength, growBufferTo, resetStoreHeader, STORE_CODE_COUNT, STORE_CALIBRATED, STORE_CALIBRATION_GENERATION, recalibrateFromStore, NO_LIVE_VECTOR_AT_POSITION, signatureOf, bytesToVectors, isDead, BUILD_RETRY_MAX_DELAY_MS, BUILD_RETRY_FIRST_DELAY_MS, allLiveDocIds, sharedMemoryAvailable, createVectorBlock, ensureBlockSlots, releaseReplacedVectors, createHNSWIndex, adoptGraph, topLayerInParts, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, GRAPH_BUILD_DISPATCH_CHUNK, shuffleInPlace, requireWholeNeighbourLists, BUILD_STEPS_BETWEEN_CLOCK_CHECKS, backgroundTurnIsSpent, createCentroidSums, liveOrdinals, RECALIBRATION_CHUNK_VECTORS, BUILD_CHUNK_SIZE, shuffleStep, NATIVE_THREAD_SCAN_CHUNK_ORDINALS, turnIsSpent, yieldTurn, SEARCH_REFILL_RESERVE, resolveWorkerCount, centroidOfCentroidSums, meanOfCentroidSums, countOfCentroidSums, squaredLengthsOfCentroidSums, nativeStoreFor, nativeMetricCode, withNativeThreadSlot, SEARCH_SCAN_CHUNK_VECTORS, noteThreadSlotLive, noteThreadSlotGone, releasePinsHeldBy, releaseLocksHeldBy, DRIFT_CHECK_GROWTH_FACTOR, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, adoptLoadedCalibration, planCheckpoint, deserialize, VECTOR_SCRATCH_SLOTS, VECTOR_INSERT_TIMEOUT_MS, RECALIBRATION_DRIFT_RATIO, DISK_ADOPTION_YIELD_INTERVAL } from './chunk-XEGKQKLY.mjs';
3
- export { bindVectorHost, holdAdmission, releaseLocksHeldBy, releasePinsHeldBy } from './chunk-XEGKQKLY.mjs';
4
- import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback, NATIVE_OK } from './chunk-G3CUQ333.mjs';
1
+ import { chargeHeapBytes } from './chunk-2JMAUU26.mjs';
2
+ import { VECTOR_WORKER_COPIES_ALLOWED, DEFAULT_RANK_CONSTANT, MAX_RENUMBERED_SEARCH_ATTEMPTS, openSharedQuantizer, STORE_ORDINAL_LAYOUT_GENERATION, searchOrdinals, withTransientAdmission, insertNode, GRAPH_RETIRED, nodeCountOf, tombstoneCountOf, DEFAULT_PROMOTION_THRESHOLD, DEFAULT_FILTER_THRESHOLD, defaultQuantizationFor, osqBitsOf, DEFAULT_VECTOR_METRIC, noBuildHistory, createOsqQuantizer, recordCheckpoint, assignStorePartitions, liveSize, writeSequenceOf, writeSequenceWords, storePinsOf, admissionAt, handOverBuildTurns, filterForOptions, openGraphState, DEFAULT_LINEAR_ALPHA, MIN_LINEAR_ALPHA, MAX_LINEAR_ALPHA, MIN_RANK_CONSTANT, requirePinnedState, RESULT_WINDOW, STORE_UNPLACED_COUNT, STORE_LIVE_COUNT, STORE_REMOVED_COUNT, fixedView, VECTOR_MEMORY_LIMITS, createDocIdMap, sharedVectorStoreBytes, IN_MEMORY, STORE_RELEASED_VECTORS_TO_DISK, STORE_SLOTS, DISK_STORAGE_BLOCK_BYTES, ESTIMATED_MS_PER_TOMBSTONE, graphNeedsRebuild, ESTIMATED_MS_PER_VECTOR_REBUILD, turnsAreBudgeted, yieldBackgroundTurn, yieldBuildTurn, holdAdmission, fieldHandlesOf, ordinalFilterForSubsets, ordinalFilterValues, nativeScoresOf, toScore, ordinalFilterHas, threadedNativeCore, threadsHoldCurrentLayout, WORKER_COPY_MIN_VECTORS, signalOfSearch, bindSearchSignal, UNPLACED_FLAG_CHUNK_ORDINALS, openVectorBlock, NOTHING_STAGED, magnitude, arenaFloat32Distance, slotByteOffset, detachNativeStore, STORE_BLOCK_COUNT, STORE_CODE_BLOCK_COUNT, createVectorFileReader, createSharedVectorStoreHandles, sequenceWritesOf, STORE_DOC_ID_BYTES, unplacedChunkCount, blocksGrowthBytes, oldestHeldPin, coverOrdinal, nextSequence, publishSequence, createOrdinalFilter, addToOrdinalFilter, stampBorn, mayFree, retiredAtOf, stampRetired, SHUFFLED_REBUILD_MEMORY_RETRY_MS, emptyFieldBeforeRestore, nativeStoreScratchBytes, toDistance, SEARCH_ATTEMPTS_BEFORE_HOLDING_WRITES, holdWritesAndBackgroundWork, FUSION_TIE_INSERTION_LIMIT, QUERY_STAGED, euclideanDistance, dotProduct, cosineSimilarityWithMagnitudes, grownByteLength, growBufferTo, resetStoreHeader, STORE_CODE_COUNT, STORE_CALIBRATED, STORE_CALIBRATION_GENERATION, recalibrateFromStore, NO_LIVE_VECTOR_AT_POSITION, signatureOf, bytesToVectors, isDead, BUILD_RETRY_MAX_DELAY_MS, BUILD_RETRY_FIRST_DELAY_MS, allLiveDocIds, sharedMemoryAvailable, createVectorBlock, ensureBlockSlots, releaseReplacedVectors, createHNSWIndex, adoptGraph, topLayerInParts, shuffleInPlace, requireWholeNeighbourLists, BUILD_STEPS_BETWEEN_CLOCK_CHECKS, backgroundTurnIsSpent, createCentroidSums, liveOrdinals, RECALIBRATION_CHUNK_VECTORS, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, GRAPH_BUILD_DISPATCH_CHUNK, shuffleStep, NATIVE_THREAD_SCAN_CHUNK_ORDINALS, turnIsSpent, yieldTurn, SEARCH_REFILL_RESERVE, resolveWorkerCount, centroidOfCentroidSums, meanOfCentroidSums, countOfCentroidSums, squaredLengthsOfCentroidSums, BUILD_CHUNK_SIZE, nativeStoreFor, nativeMetricCode, withNativeThreadSlot, SEARCH_SCAN_CHUNK_VECTORS, noteThreadSlotLive, noteThreadSlotGone, releasePinsHeldBy, releaseLocksHeldBy, DRIFT_CHECK_GROWTH_FACTOR, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, adoptLoadedCalibration, planCheckpoint, deserialize, VECTOR_SCRATCH_SLOTS, VECTOR_INSERT_TIMEOUT_MS, RECALIBRATION_DRIFT_RATIO, DISK_ADOPTION_YIELD_INTERVAL } from './chunk-VIPNDN4B.mjs';
3
+ export { bindVectorHost, holdAdmission, releaseLocksHeldBy, releasePinsHeldBy, requireUsableVectorOptions } from './chunk-VIPNDN4B.mjs';
4
+ import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback, NATIVE_OK } from './chunk-XBTFK3AZ.mjs';
5
5
  import './chunk-PVMEHBQO.mjs';
6
6
  import { compareCodePoints } from './chunk-HRDMIQ63.mjs';
7
7
  import './chunk-VUJCSQG5.mjs';
@@ -278,18 +278,6 @@ function withFusedScore(entry, score) {
278
278
  }
279
279
 
280
280
  // src/engine/query/vector.ts
281
- function oversampleOf(vectorConfig) {
282
- const oversample = vectorConfig.oversample;
283
- if (oversample === void 0) return void 0;
284
- if (typeof oversample !== "number" || !Number.isFinite(oversample) || oversample < MIN_OVERSAMPLE) {
285
- throw new NarsilError(
286
- ErrorCodes.CONFIG_INVALID,
287
- `vector.oversample must be a finite number of at least ${MIN_OVERSAMPLE}`,
288
- { oversample }
289
- );
290
- }
291
- return oversample;
292
- }
293
281
  function vectorFetchDepth(limit, offset, cursorDepth) {
294
282
  const reach = cursorDepth + offset + limit;
295
283
  if (reach > RESULT_WINDOW) {
@@ -327,7 +315,7 @@ async function searchField(search2, k, host) {
327
315
  metric: vectorConfig.metric ?? "cosine",
328
316
  minSimilarity: vectorConfig.similarity ?? -Infinity,
329
317
  efSearch: vectorConfig.efSearch,
330
- oversample: oversampleOf(vectorConfig),
318
+ oversample: vectorConfig.oversample,
331
319
  ...rescoreWindow !== void 0 ? { rescoreWindow } : {}
332
320
  };
333
321
  if (filtered !== void 0) {
@@ -2772,7 +2760,7 @@ async function insertIntoGraph(state, graph, docIds, admit) {
2772
2760
  const dispatch = found;
2773
2761
  const pending = /* @__PURE__ */ new Set();
2774
2762
  const limit = dispatch.workerCount * GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER;
2775
- const fallback = { noWorkerWarned: false, shortAnswerWarned: false };
2763
+ const fallback = { noWorkerWarned: false, shortAnswerWarned: false, workerAnswerFailed: false };
2776
2764
  let batchDocIds = [];
2777
2765
  let batchOrdinals = [];
2778
2766
  async function flush() {
@@ -2788,6 +2776,7 @@ async function insertIntoGraph(state, graph, docIds, admit) {
2788
2776
  pending.add(run);
2789
2777
  if (pending.size >= limit) await Promise.race(pending);
2790
2778
  }
2779
+ state.graphsPlacedIntoSinceConnect.add(graph);
2791
2780
  for (const docId of docIds) {
2792
2781
  if (state.disposed) break;
2793
2782
  if (!admit(docId)) continue;
@@ -2803,6 +2792,7 @@ async function insertIntoGraph(state, graph, docIds, admit) {
2803
2792
  if (turnsAreBudgeted) await connectGraph(state, graph);
2804
2793
  else graph.connectUnreached();
2805
2794
  if (state.disposed) return false;
2795
+ if (!fallback.workerAnswerFailed) state.graphsPlacedIntoSinceConnect.delete(graph);
2806
2796
  noteWrite(state);
2807
2797
  return true;
2808
2798
  }
@@ -2812,6 +2802,7 @@ async function placeChunk(state, graph, dispatch, chunkDocIds, chunkOrdinals, fa
2812
2802
  outcome = await dispatch.send(chunkOrdinals);
2813
2803
  } catch {
2814
2804
  outcome = null;
2805
+ fallback.workerAnswerFailed = true;
2815
2806
  }
2816
2807
  if (state.disposed) return;
2817
2808
  if (outcome === null) {
@@ -2848,6 +2839,7 @@ async function insertLocally(state, graph, docIds, admit) {
2848
2839
  if (!admit(docId)) continue;
2849
2840
  const ordinal = state.store.getOrdinal(docId);
2850
2841
  if (ordinal === void 0) continue;
2842
+ state.graphsPlacedIntoSinceConnect.add(graph);
2851
2843
  if (turnsAreBudgeted) {
2852
2844
  graph.insertOrdinal(ordinal, true);
2853
2845
  if (graph.holdsUnlinkedNode) await connectGraph(state, graph);
@@ -2870,6 +2862,7 @@ async function insertLocally(state, graph, docIds, admit) {
2870
2862
  if (count > 0) {
2871
2863
  if (turnsAreBudgeted) await connectGraph(state, graph);
2872
2864
  else graph.connectUnreached();
2865
+ state.graphsPlacedIntoSinceConnect.delete(graph);
2873
2866
  noteWrite(state);
2874
2867
  }
2875
2868
  return true;
@@ -3108,11 +3101,19 @@ function noteWaitingForMemory(owner, work) {
3108
3101
  }
3109
3102
 
3110
3103
  // src/vector/vector-index/memory-charge.ts
3104
+ function waitForMemory(state) {
3105
+ state.waitingForMemory = true;
3106
+ noteWaitingForMemory(state, { indexName: state.indexName, fieldName: state.fieldName });
3107
+ }
3108
+ function admitGrowingCopy(state, graph) {
3109
+ if (admitsBackgroundBytes(graph.graphBytes)) return true;
3110
+ waitForMemory(state);
3111
+ return false;
3112
+ }
3111
3113
  function admitShuffledRebuild(state) {
3112
3114
  const bytes = state.hnsw?.graphBytes ?? 0;
3113
3115
  if (!admitsBackgroundBytes(bytes)) {
3114
- state.waitingForMemory = true;
3115
- noteWaitingForMemory(state, { indexName: state.indexName, fieldName: state.fieldName });
3116
+ waitForMemory(state);
3116
3117
  return false;
3117
3118
  }
3118
3119
  stopWaitingForMemory(state);
@@ -3136,6 +3137,64 @@ function releaseMemoryCharges(state) {
3136
3137
  state.rebuildWaitTimer = null;
3137
3138
  }
3138
3139
 
3140
+ // src/vector/vector-index/growing-copy.ts
3141
+ var lineages = /* @__PURE__ */ new WeakMap();
3142
+ function lineageOfGraph(graph) {
3143
+ const known = lineages.get(graph);
3144
+ if (known !== void 0) return known;
3145
+ const lineage = {};
3146
+ lineages.set(graph, lineage);
3147
+ return lineage;
3148
+ }
3149
+ function lineageOf(graph) {
3150
+ return graph === null ? null : lineageOfGraph(graph);
3151
+ }
3152
+ function moveWhatTheCopyHoldsOutOfBuffer(state, copy) {
3153
+ for (const docId of [...state.buffer]) {
3154
+ const ordinal = state.store.getOrdinal(docId);
3155
+ if (ordinal !== void 0 && copy.holdsNode(ordinal) && !copy.holdsTombstone(ordinal)) moveOutOfBuffer(state, docId);
3156
+ }
3157
+ }
3158
+ async function publishCopy(state, graph, copy) {
3159
+ if (state.sharedHandles.get(graph)?.searchable === true) await shareGraph(state, copy, true);
3160
+ if (state.disposed || state.hnsw !== graph) return false;
3161
+ lineages.set(copy, lineageOfGraph(graph));
3162
+ state.hnsw = copy;
3163
+ graph.retire();
3164
+ moveWhatTheCopyHoldsOutOfBuffer(state, copy);
3165
+ dropSharedGraph(state, graph);
3166
+ noteWrite(state);
3167
+ return true;
3168
+ }
3169
+ function* startingWith(first, rest) {
3170
+ yield first;
3171
+ for (let next = rest.next(); !next.done; next = rest.next()) yield next.value;
3172
+ }
3173
+ async function placeInGrowingCopy(state, graph, docIds, admit) {
3174
+ const pending = docIds[Symbol.iterator]();
3175
+ let first = pending.next();
3176
+ while (!first.done && !admit(first.value)) first = pending.next();
3177
+ if (first.done) return "nothingToPlace";
3178
+ if (!admitGrowingCopy(state, graph)) return "waitingForMemory";
3179
+ const copy = graph.copy();
3180
+ const chargedBytes = copy.graphBytes;
3181
+ chargeHeapBytes(chargedBytes);
3182
+ state.growingCopy = copy;
3183
+ let published = false;
3184
+ try {
3185
+ const placed = await insertIntoGraph(state, copy, startingWith(first.value, pending), admit);
3186
+ published = placed && !state.disposed && state.hnsw === graph && await publishCopy(state, graph, copy);
3187
+ return published ? "published" : "dropped";
3188
+ } finally {
3189
+ if (state.growingCopy === copy) state.growingCopy = null;
3190
+ chargeHeapBytes(-chargedBytes);
3191
+ if (!published) {
3192
+ copy.retire();
3193
+ dropSharedGraph(state, copy);
3194
+ }
3195
+ }
3196
+ }
3197
+
3139
3198
  // src/vector/vector-index/build.ts
3140
3199
  function bufferIfTheGraphLacks(state, graph, docId) {
3141
3200
  const ordinal = state.store.getOrdinal(docId);
@@ -3150,9 +3209,9 @@ async function bufferWhatTheGraphLacksInTurns(state, graph) {
3150
3209
  await forEachInTurns(allLiveDocIds(state), visit, () => !state.disposed && state.hnsw === graph);
3151
3210
  }
3152
3211
  async function buildGraphFromStore(state) {
3153
- const previous = state.hnsw;
3212
+ const lineage = lineageOf(state.hnsw);
3154
3213
  const order = turnsAreBudgeted ? await shuffledLiveDocIdsInTurns(state) : shuffleInPlace([...allLiveDocIds(state)]);
3155
- if (order === null || state.hnsw !== previous) return false;
3214
+ if (order === null || lineageOf(state.hnsw) !== lineage) return false;
3156
3215
  const graph = createHNSWIndex(state.dimension, state.store, state.hnswConfig, state.osq ?? void 0);
3157
3216
  state.freshGraph = graph;
3158
3217
  let completed = false;
@@ -3161,16 +3220,17 @@ async function buildGraphFromStore(state) {
3161
3220
  } finally {
3162
3221
  state.freshGraph = null;
3163
3222
  }
3164
- if (!completed || state.hnsw !== previous) {
3223
+ if (!completed || lineageOf(state.hnsw) !== lineage) {
3165
3224
  dropSharedGraph(state, graph);
3166
3225
  return false;
3167
3226
  }
3227
+ const replaced = state.hnsw;
3168
3228
  adoptGraph(state, graph);
3169
3229
  state.shuffledBuildCount = graph.size;
3170
3230
  noteWrite(state);
3171
3231
  if (turnsAreBudgeted) await bufferWhatTheGraphLacksInTurns(state, graph);
3172
3232
  else bufferWhatTheGraphLacks(state, graph);
3173
- if (previous !== null) dropSharedGraph(state, previous);
3233
+ if (replaced !== null) dropSharedGraph(state, replaced);
3174
3234
  await releasePendingLocations(state);
3175
3235
  return true;
3176
3236
  }
@@ -3187,10 +3247,31 @@ async function recalibratesForRebuild(state, graph) {
3187
3247
  if (state.shuffledBuildCount === null) return calibrateBeforeBuild(state);
3188
3248
  return recalibrateWhenDrifted(state, graph.size);
3189
3249
  }
3190
- async function buildExclusively(state, work, waitsForShuffledRebuild = true) {
3250
+ async function keepBuildsOut(state) {
3251
+ while (state.buildsKeptOut !== null) await state.buildsKeptOut.ended;
3252
+ if (state.disposed) return () => void 0;
3253
+ let end = () => void 0;
3254
+ const ended = new Promise((resolve) => {
3255
+ end = resolve;
3256
+ });
3257
+ const kept = { ended, end };
3258
+ state.buildsKeptOut = kept;
3259
+ return () => {
3260
+ if (state.buildsKeptOut !== kept) return;
3261
+ letBuildsIn(state);
3262
+ scheduleBuild(state);
3263
+ };
3264
+ }
3265
+ function letBuildsIn(state) {
3266
+ const kept = state.buildsKeptOut;
3267
+ state.buildsKeptOut = null;
3268
+ kept?.end();
3269
+ }
3270
+ async function buildExclusively(state, work, waitsForShuffledRebuild = true, keepsBuildsOut = false) {
3191
3271
  for (; ; ) {
3192
3272
  if (state.pendingBuild !== null) await state.pendingBuild;
3193
3273
  else if (waitsForShuffledRebuild && state.shuffledRebuild !== null) await state.shuffledRebuild;
3274
+ else if (!keepsBuildsOut && state.buildsKeptOut !== null) await state.buildsKeptOut.ended;
3194
3275
  else break;
3195
3276
  }
3196
3277
  if (state.disposed) return;
@@ -3209,7 +3290,10 @@ async function buildExclusively(state, work, waitsForShuffledRebuild = true) {
3209
3290
  }
3210
3291
  async function rebuildInShuffledOrder(state) {
3211
3292
  await yieldBuildTurn(state);
3212
- const replacing = { graph: null, loadedWithoutCount: false };
3293
+ const replacing = {
3294
+ lineage: null,
3295
+ loadedWithoutCount: false
3296
+ };
3213
3297
  await buildExclusively(
3214
3298
  state,
3215
3299
  async () => {
@@ -3217,12 +3301,12 @@ async function rebuildInShuffledOrder(state) {
3217
3301
  if (graph === null || !shuffledRebuildDue(state)) return;
3218
3302
  const loadedWithoutCount = state.shuffledBuildCount === null;
3219
3303
  if (!await recalibratesForRebuild(state, graph) || state.hnsw !== graph) return;
3220
- replacing.graph = graph;
3304
+ replacing.lineage = lineageOf(graph);
3221
3305
  replacing.loadedWithoutCount = loadedWithoutCount;
3222
3306
  },
3223
3307
  false
3224
3308
  );
3225
- if (replacing.graph === null || state.hnsw !== replacing.graph) return;
3309
+ if (replacing.lineage === null || lineageOf(state.hnsw) !== replacing.lineage) return;
3226
3310
  const adopted = await buildGraphFromStore(state);
3227
3311
  if (adopted && replacing.loadedWithoutCount) state.onLoadedGraphRepaired();
3228
3312
  }
@@ -3230,11 +3314,16 @@ function retryWhenMemoryAllows(state) {
3230
3314
  if (state.rebuildWaitTimer !== null || state.disposed) return;
3231
3315
  const timer = setTimeout(() => {
3232
3316
  state.rebuildWaitTimer = null;
3233
- startShuffledRebuild(state);
3317
+ if (state.hnsw !== null && state.buffer.size > 0) placeWhatWaitedForMemory(state);
3318
+ else startShuffledRebuild(state);
3234
3319
  }, SHUFFLED_REBUILD_MEMORY_RETRY_MS);
3235
3320
  timer.unref?.();
3236
3321
  state.rebuildWaitTimer = timer;
3237
3322
  }
3323
+ function placeWhatWaitedForMemory(state) {
3324
+ if (state.building || state.buildsKeptOut !== null) retryWhenMemoryAllows(state);
3325
+ else triggerBuild(state);
3326
+ }
3238
3327
  function startShuffledRebuild(state) {
3239
3328
  if (state.shuffledRebuild !== null || state.disposed) return;
3240
3329
  if (!shuffledRebuildDue(state)) {
@@ -3267,11 +3356,14 @@ async function growGraph(state, graph, bufferSnapshot) {
3267
3356
  return true;
3268
3357
  };
3269
3358
  if (state.osq && !state.osq.isCalibrated() && !await calibrateBeforeBuild(state)) return;
3270
- await insertIntoGraph(state, graph, bufferSnapshot, admit);
3271
- startShuffledRebuild(state);
3359
+ continueAfterGrowth(state, await placeInGrowingCopy(state, graph, bufferSnapshot, admit));
3360
+ }
3361
+ function continueAfterGrowth(state, outcome) {
3362
+ if (outcome === "waitingForMemory") retryWhenMemoryAllows(state);
3363
+ else startShuffledRebuild(state);
3272
3364
  }
3273
3365
  function triggerBuild(state) {
3274
- if (state.building) return;
3366
+ if (state.building || state.buildsKeptOut !== null) return;
3275
3367
  state.building = true;
3276
3368
  const bufferSnapshot = turnsAreBudgeted ? null : new Set(state.buffer);
3277
3369
  const existingGraph = state.hnsw;
@@ -3322,6 +3414,15 @@ function armBuildTimer(state, delayMs, run) {
3322
3414
  timer.unref?.();
3323
3415
  state.buildTimer = timer;
3324
3416
  }
3417
+ function connectAfterUnfinishedPass(state, graph) {
3418
+ graph.connectUnreached();
3419
+ state.graphsPlacedIntoSinceConnect.delete(graph);
3420
+ noteWrite(state);
3421
+ }
3422
+ function connectWhereAPassStoppedEarly(state) {
3423
+ const graph = state.hnsw;
3424
+ if (graph !== null && state.graphsPlacedIntoSinceConnect.has(graph)) connectAfterUnfinishedPass(state, graph);
3425
+ }
3325
3426
  function retryAfterBackoff(state) {
3326
3427
  const delayMs = Math.min(BUILD_RETRY_MAX_DELAY_MS, Math.max(BUILD_RETRY_FIRST_DELAY_MS, state.buildRetryDelayMs * 2));
3327
3428
  state.buildRetryDelayMs = delayMs;
@@ -3329,7 +3430,7 @@ function retryAfterBackoff(state) {
3329
3430
  state.buildTimer = null;
3330
3431
  armBuildTimer(state, delayMs, () => {
3331
3432
  const graph = state.hnsw;
3332
- if (state.building) {
3433
+ if (state.building || state.buildsKeptOut !== null) {
3333
3434
  retryAfterBackoff(state);
3334
3435
  return;
3335
3436
  }
@@ -3338,8 +3439,7 @@ function retryAfterBackoff(state) {
3338
3439
  return;
3339
3440
  }
3340
3441
  try {
3341
- graph.connectUnreached();
3342
- noteWrite(state);
3442
+ connectAfterUnfinishedPass(state, graph);
3343
3443
  state.buildRetryDelayMs = 0;
3344
3444
  scheduleWorkerCopyLoad(state);
3345
3445
  } catch (error) {
@@ -3351,11 +3451,12 @@ function retryAfterBackoff(state) {
3351
3451
  function buildDue(state) {
3352
3452
  if (state.hnsw === null) return liveSize(state) >= state.promotionThreshold;
3353
3453
  if (state.buffer.size === 0) return false;
3454
+ if (state.waitingForMemory && state.rebuildWaitTimer !== null) return false;
3354
3455
  if (state.workerCopies.enabled && state.workerCopies.host !== void 0) return true;
3355
3456
  return state.buffer.size >= state.promotionThreshold;
3356
3457
  }
3357
3458
  function scheduleBuild(state) {
3358
- if (state.building || state.buildScheduled || state.disposed) return;
3459
+ if (state.building || state.buildScheduled || state.disposed || state.buildsKeptOut !== null) return;
3359
3460
  if (!buildDue(state)) return;
3360
3461
  state.buildScheduled = true;
3361
3462
  const turn = turnsAreBudgeted ? yieldBackgroundTurn() : yieldBuildTurn(state);
@@ -3377,6 +3478,7 @@ function releaseHeldMemory(state) {
3377
3478
  state.store.release();
3378
3479
  state.hnsw = null;
3379
3480
  state.freshGraph = null;
3481
+ state.growingCopy = null;
3380
3482
  state.osq = null;
3381
3483
  state.tombstones.clear();
3382
3484
  state.buffer.clear();
@@ -3387,6 +3489,7 @@ function releaseHeldMemory(state) {
3387
3489
  }
3388
3490
  function disposeIndex(state) {
3389
3491
  state.disposed = true;
3492
+ letBuildsIn(state);
3390
3493
  if (state.rebuildWaitTimer !== null) clearTimeout(state.rebuildWaitTimer);
3391
3494
  state.rebuildWaitTimer = null;
3392
3495
  if (state.buildTimer !== null) clearTimeout(state.buildTimer);
@@ -3930,6 +4033,7 @@ function compact(state) {
3930
4033
  state.compactedNodeCount += before - state.hnsw.tombstoneCount;
3931
4034
  }
3932
4035
  state.freshGraph?.compactTombstones(oldestPin);
4036
+ state.growingCopy?.compactTombstones(oldestPin);
3933
4037
  for (const docId of state.tombstones) {
3934
4038
  const ordinal = state.store.getOrdinal(docId);
3935
4039
  if (ordinal !== void 0 && !state.store.mayFreeOrdinal(ordinal, oldestPin)) continue;
@@ -3946,8 +4050,7 @@ async function insertMissing(state, graph) {
3946
4050
  const missingOrReplaced = (docId) => !graph.has(docId) || state.buffer.has(docId);
3947
4051
  const heldWhenTheCallStarted = [...allLiveDocIds(state)];
3948
4052
  const stillLiveAndUnplaced = (docId) => !state.tombstones.has(docId) && missingOrReplaced(docId);
3949
- await insertIntoGraph(state, graph, heldWhenTheCallStarted, stillLiveAndUnplaced);
3950
- startShuffledRebuild(state);
4053
+ continueAfterGrowth(state, await placeInGrowingCopy(state, graph, heldWhenTheCallStarted, stillLiveAndUnplaced));
3951
4054
  }
3952
4055
  async function foldIntoGraph(state) {
3953
4056
  const rebuildNeeded = graphNeedsRebuild(state);
@@ -3990,7 +4093,7 @@ async function fillGraph(state) {
3990
4093
  await insertMissing(state, graph);
3991
4094
  }
3992
4095
  function completeGraph(state) {
3993
- return buildExclusively(state, () => fillGraph(state), false);
4096
+ return buildExclusively(state, () => fillGraph(state), false, true);
3994
4097
  }
3995
4098
  function maintenanceStatus(state) {
3996
4099
  const storeSize = state.store.size;
@@ -4017,8 +4120,8 @@ function flatScanScratchBytes(state) {
4017
4120
  }
4018
4121
  function estimateMemoryBytes(state) {
4019
4122
  if (state.hnsw === null) return state.store.memoryBytes() + flatScanScratchBytes(state);
4020
- const freshGraphBytes = state.freshGraph?.graphBytes ?? 0;
4021
- return state.store.memoryBytes() + state.hnsw.graphBytes + state.hnsw.searchScratchBytes + freshGraphBytes;
4123
+ const passGraphBytes = (state.freshGraph?.graphBytes ?? 0) + (state.growingCopy?.graphBytes ?? 0);
4124
+ return state.store.memoryBytes() + state.hnsw.graphBytes + state.hnsw.searchScratchBytes + passGraphBytes;
4022
4125
  }
4023
4126
 
4024
4127
  // src/vector/vector-index/publication.ts
@@ -4478,14 +4581,16 @@ function createVectorWrites(state) {
4478
4581
  noteWrite(state);
4479
4582
  noteSearchedDocWritten(state, docId);
4480
4583
  state.tombstones.delete(docId);
4481
- const graphHoldsPrevious = previous !== void 0 && ((state.hnsw?.holdsNode(previous) ?? false) || (state.freshGraph?.holdsNode(previous) ?? false));
4584
+ const graphHoldsPrevious = previous !== void 0 && ((state.hnsw?.holdsNode(previous) ?? false) || (state.freshGraph?.holdsNode(previous) ?? false) || (state.growingCopy?.holdsNode(previous) ?? false));
4482
4585
  state.store.insert(docId, vector, partitionId, graphHoldsPrevious);
4483
4586
  if (previous !== void 0) {
4484
4587
  const graph = state.hnsw;
4485
4588
  const freshGraph = state.freshGraph;
4589
+ const growingCopy = state.growingCopy;
4486
4590
  afterGraphPass(state, () => {
4487
4591
  graph?.markTombstoneOrdinal(previous);
4488
4592
  freshGraph?.markTombstoneOrdinal(previous);
4593
+ growingCopy?.markTombstoneOrdinal(previous);
4489
4594
  });
4490
4595
  if (!graphHoldsPrevious) state.osq?.removeOrdinal(previous);
4491
4596
  }
@@ -4506,7 +4611,11 @@ function createVectorWrites(state) {
4506
4611
  if (state.buffer.retiredCount !== 0) forgetRetiredFlags();
4507
4612
  state.pendingLocations.delete(docId);
4508
4613
  const graph = state.hnsw;
4509
- if (graph !== null) afterGraphPass(state, () => graph.markTombstoneOrdinal(ordinal));
4614
+ const growingCopy = state.growingCopy;
4615
+ afterGraphPass(state, () => {
4616
+ graph?.markTombstoneOrdinal(ordinal);
4617
+ growingCopy?.markTombstoneOrdinal(ordinal);
4618
+ });
4510
4619
  }
4511
4620
  return {
4512
4621
  insert(docId, vector, partitionId) {
@@ -4579,6 +4688,7 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
4579
4688
  osq: codeBits === null ? null : createOsqQuantizer(dimension, codeBits, metric, store),
4580
4689
  hnsw: null,
4581
4690
  freshGraph: null,
4691
+ growingCopy: null,
4582
4692
  ...noBuildHistory(),
4583
4693
  rebuildChargeBytes: 0,
4584
4694
  waitingForMemory: false,
@@ -4592,6 +4702,7 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
4592
4702
  buildRetryDelayMs: 0,
4593
4703
  buildTurnWaiters: /* @__PURE__ */ new Map(),
4594
4704
  pendingBuild: null,
4705
+ buildsKeptOut: null,
4595
4706
  disposed: false,
4596
4707
  revision: 0,
4597
4708
  workerCopyPool: null,
@@ -4606,6 +4717,7 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
4606
4717
  releaseToFilesInFlight: Promise.resolve(),
4607
4718
  cold: null,
4608
4719
  graphsHeldOffThread: null,
4720
+ graphsPlacedIntoSinceConnect: /* @__PURE__ */ new WeakSet(),
4609
4721
  searchWatches: /* @__PURE__ */ new Set(),
4610
4722
  writeListeners: /* @__PURE__ */ new Set()
4611
4723
  };
@@ -4689,9 +4801,16 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
4689
4801
  await whenLoaded();
4690
4802
  await awaitBuilds(state);
4691
4803
  },
4692
- completeGraph: async () => {
4804
+ holdGraphComplete: async () => {
4693
4805
  await whenLoaded();
4694
- await completeGraph(state);
4806
+ const letBuildsIn2 = await keepBuildsOut(state);
4807
+ try {
4808
+ await completeGraph(state);
4809
+ return letBuildsIn2;
4810
+ } catch (error) {
4811
+ letBuildsIn2();
4812
+ throw error;
4813
+ }
4695
4814
  },
4696
4815
  dispose: () => {
4697
4816
  cancelColdHold(state);
@@ -4728,7 +4847,10 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
4728
4847
  }),
4729
4848
  planCheckpoint: withGraphFree(
4730
4849
  state,
4731
- (listedKeys, rewritesGraph, pinsRetiredVectors) => planCheckpoint(state, listedKeys, rewritesGraph, pinsRetiredVectors)
4850
+ (listedKeys, rewritesGraph, pinsRetiredVectors) => {
4851
+ connectWhereAPassStoppedEarly(state);
4852
+ return planCheckpoint(state, listedKeys, rewritesGraph, pinsRetiredVectors);
4853
+ }
4732
4854
  ),
4733
4855
  recordCheckpoint: (plan, written) => recordCheckpoint(state, plan, written),
4734
4856
  restoreCheckpoint: withGraphFree(state, (shape) => {
@@ -1,4 +1,4 @@
1
- import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback } from './chunk-G3CUQ333.mjs';
1
+ import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback } from './chunk-XBTFK3AZ.mjs';
2
2
  import './chunk-PVMEHBQO.mjs';
3
3
  import './chunk-TQ26BKBH.mjs';
4
4
 
@@ -1,9 +1,9 @@
1
- import { readHeapStatistics, withOpenIndex, oneAtATime, validateBM25Params, storedBM25Params, loadSchemaCodeFor, loadStorageCode, lookupOfStoredSynonyms, reconstructSchemaFromMetadata, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, prepareStoredSynonyms, getVectorFieldPaths, arrayPositionsAreStale, validatePartitionConfig, emitSyncChange, validateEmbeddingConfig, isSyncEpoch, newSyncEpoch } from './chunk-L4R5ITVG.mjs';
2
- export { bindOptionalWritesHost, insertDocument, insertDocumentBatch, removeDocument, removeDocumentBatch, rollbackInsertedDocument, rollbackRemovedDocument, rollbackUpdatedDocument, updateDocument, updateDocumentBatch } from './chunk-L4R5ITVG.mjs';
3
- import './chunk-52QD7CBJ.mjs';
4
- import './chunk-XEGKQKLY.mjs';
1
+ import { readHeapStatistics, withOpenIndex, oneAtATime, validateBM25Params, storedBM25Params, loadSchemaCodeFor, loadStorageCode, lookupOfStoredSynonyms, reconstructSchemaFromMetadata, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, prepareStoredSynonyms, getVectorFieldPaths, arrayPositionsAreStale, validatePartitionConfig, emitSyncChange, validateEmbeddingConfig, isSyncEpoch, newSyncEpoch } from './chunk-AUXXPSFB.mjs';
2
+ export { bindOptionalWritesHost, insertDocument, insertDocumentBatch, removeDocument, removeDocumentBatch, rollbackInsertedDocument, rollbackRemovedDocument, rollbackUpdatedDocument, updateDocument, updateDocumentBatch } from './chunk-AUXXPSFB.mjs';
3
+ import './chunk-2JMAUU26.mjs';
4
+ import './chunk-VIPNDN4B.mjs';
5
5
  import './chunk-4EXKQ2IB.mjs';
6
- import './chunk-G3CUQ333.mjs';
6
+ import './chunk-XBTFK3AZ.mjs';
7
7
  import './chunk-PVMEHBQO.mjs';
8
8
  import './chunk-YOTP2FPE.mjs';
9
9
  import { validateSchema, validateVectorStorage, validateTextStorage } from './chunk-FTQ7JNMU.mjs';
@@ -1,4 +1,4 @@
1
- import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback } from './chunk-G3CUQ333.mjs';
1
+ import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback } from './chunk-XBTFK3AZ.mjs';
2
2
  import './chunk-PVMEHBQO.mjs';
3
3
  import './chunk-TQ26BKBH.mjs';
4
4
 
@@ -1,11 +1,11 @@
1
- import { installSuggestionHooks, RestoredHistory, clearLeftoversOfName } from './chunk-IY6U6HRA.mjs';
2
- export { startQuerySuggestions } from './chunk-IY6U6HRA.mjs';
3
- import { attachedRuntimeOf, withState, unionOfBans, BUILD_WRITE_BATCH } from './chunk-72OKYHZL.mjs';
4
- import { loadStorageCode, loadOptionalWrites, emitEngineEvent, removeDocumentBatch2 } from './chunk-L4R5ITVG.mjs';
5
- import './chunk-52QD7CBJ.mjs';
6
- import './chunk-XEGKQKLY.mjs';
1
+ import { installSuggestionHooks, RestoredHistory, clearLeftoversOfName } from './chunk-I5W7A2JF.mjs';
2
+ export { startQuerySuggestions } from './chunk-I5W7A2JF.mjs';
3
+ import { attachedRuntimeOf, withState, unionOfBans, BUILD_WRITE_BATCH } from './chunk-3RUXKZJG.mjs';
4
+ import { loadStorageCode, loadOptionalWrites, emitEngineEvent, removeDocumentBatch2 } from './chunk-AUXXPSFB.mjs';
5
+ import './chunk-2JMAUU26.mjs';
6
+ import './chunk-VIPNDN4B.mjs';
7
7
  import './chunk-4EXKQ2IB.mjs';
8
- import './chunk-G3CUQ333.mjs';
8
+ import './chunk-XBTFK3AZ.mjs';
9
9
  import './chunk-PVMEHBQO.mjs';
10
10
  import './chunk-YOTP2FPE.mjs';
11
11
  import './chunk-FTQ7JNMU.mjs';
@@ -1,9 +1,9 @@
1
- export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, rebuildTextIndexes, rewriteSpillOf, textRebuildTargetOf } from './chunk-ZIU6TWXG.mjs';
2
- export { bindSegmentCodecHost, createEncodedDocumentSource, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, encodeDocumentTableData, endOfValue, reconstructSchemaFromMetadata, storedDocumentsOf, topLevelMapKeys } from './chunk-L4R5ITVG.mjs';
3
- import './chunk-52QD7CBJ.mjs';
4
- import './chunk-XEGKQKLY.mjs';
1
+ export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, rebuildTextIndexes, rewriteSpillOf, textRebuildTargetOf } from './chunk-HEELWLKL.mjs';
2
+ export { bindSegmentCodecHost, createEncodedDocumentSource, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, encodeDocumentTableData, endOfValue, reconstructSchemaFromMetadata, storedDocumentsOf, topLevelMapKeys } from './chunk-AUXXPSFB.mjs';
3
+ import './chunk-2JMAUU26.mjs';
4
+ import './chunk-VIPNDN4B.mjs';
5
5
  import './chunk-4EXKQ2IB.mjs';
6
- import './chunk-G3CUQ333.mjs';
6
+ import './chunk-XBTFK3AZ.mjs';
7
7
  import './chunk-PVMEHBQO.mjs';
8
8
  import './chunk-YOTP2FPE.mjs';
9
9
  import './chunk-FTQ7JNMU.mjs';
@@ -1,10 +1,10 @@
1
- export { deserializePartition, serializePartition } from './chunk-J2NQW353.mjs';
2
- export { alreadyPresentOnWorker, buildSegmentPayloads, createRequestId, eligibleIndexNames, fieldIndexRemapOf, freezeEncodedSegmentShared, freezeSegmentShared, holdsADiscardedField, isDeterministicFailure, isValidWorkerResponse, mergeFieldIndexes, mergeSegmentContents, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, reportIneligible, segmentArraysOf, selectionKeeps, shareSegmentArrays, toError, workerIneligibility } from './chunk-AQOWRH2C.mjs';
3
- export { bindSegmentMergeHost, mergePostings } from './chunk-L4R5ITVG.mjs';
4
- import './chunk-52QD7CBJ.mjs';
5
- import './chunk-XEGKQKLY.mjs';
1
+ export { deserializePartition, serializePartition } from './chunk-XOCM3BFU.mjs';
2
+ export { alreadyPresentOnWorker, buildSegmentPayloads, createRequestId, eligibleIndexNames, fieldIndexRemapOf, freezeEncodedSegmentShared, freezeSegmentShared, holdsADiscardedField, isDeterministicFailure, isValidWorkerResponse, mergeFieldIndexes, mergeSegmentContents, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, reportIneligible, segmentArraysOf, selectionKeeps, shareSegmentArrays, toError, workerIneligibility } from './chunk-RVHCQJQM.mjs';
3
+ export { bindSegmentMergeHost, mergePostings } from './chunk-AUXXPSFB.mjs';
4
+ import './chunk-2JMAUU26.mjs';
5
+ import './chunk-VIPNDN4B.mjs';
6
6
  import './chunk-4EXKQ2IB.mjs';
7
- import './chunk-G3CUQ333.mjs';
7
+ import './chunk-XBTFK3AZ.mjs';
8
8
  import './chunk-PVMEHBQO.mjs';
9
9
  import './chunk-YOTP2FPE.mjs';
10
10
  import './chunk-FTQ7JNMU.mjs';