@delali/narsil 0.3.1-next.195 → 0.3.1-next.196

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 (77) hide show
  1. package/dist/browser/{chunk-UHJHOEMY.mjs → chunk-YKHBTLYW.mjs} +1 -1
  2. package/dist/browser/{storage-leaf-N3JMQ6CF.mjs → storage-leaf-KIPJKTWU.mjs} +68 -39
  3. package/dist/{chunk-VPOPC7JA.mjs → chunk-23UYFZXF.mjs} +2 -2
  4. package/dist/{react-native/chunks/chunk-GJQIMGXT.mjs → chunk-23WLACOL.mjs} +1 -1
  5. package/dist/{chunk-UP5TJ3II.mjs → chunk-2TWR6YCG.mjs} +1 -1
  6. package/dist/{chunk-5SLAXEVJ.mjs → chunk-2WKZM3FS.mjs} +21 -5
  7. package/dist/{chunk-OICMFLQF.mjs → chunk-3CRBNUPW.mjs} +9 -9
  8. package/dist/{chunk-Y3T4HQGT.mjs → chunk-7BCL5QK5.mjs} +2 -2
  9. package/dist/{chunk-QIMI4O6R.mjs → chunk-D2H5RN3Q.mjs} +4 -4
  10. package/dist/{chunk-5IXLDFKK.mjs → chunk-D4PSKC3O.mjs} +2 -2
  11. package/dist/{chunk-DU5HRFLQ.mjs → chunk-DEKP2BZO.mjs} +2 -2
  12. package/dist/{chunk-BBSLCYJM.mjs → chunk-F62PEMTB.mjs} +1 -1
  13. package/dist/{chunk-5WN5TOPY.mjs → chunk-FIMLVUHE.mjs} +1 -1
  14. package/dist/{chunk-KYVJPISW.mjs → chunk-IC6LWK2D.mjs} +5 -5
  15. package/dist/{chunk-MQMZ25D7.mjs → chunk-IQAV6Z3Y.mjs} +2 -2
  16. package/dist/{chunk-3Y3QYL6Q.mjs → chunk-JYIH6G2H.mjs} +2 -2
  17. package/dist/{chunk-I2FKNCDS.mjs → chunk-K2KNE7W2.mjs} +8 -8
  18. package/dist/{chunk-WORMC6FN.mjs → chunk-KFU4KW77.mjs} +1 -1
  19. package/dist/{chunk-VSLFZDVA.mjs → chunk-NTO2EMWZ.mjs} +2 -2
  20. package/dist/{chunk-ZV25WJNK.mjs → chunk-NVGSHRLW.mjs} +1 -1
  21. package/dist/{chunk-KRCP4W26.mjs → chunk-QRKC25IO.mjs} +1 -1
  22. package/dist/{chunk-YYNLEWSP.mjs → chunk-RDGMV4R3.mjs} +3 -3
  23. package/dist/{chunk-ZVJPJZIP.mjs → chunk-SUFAI37B.mjs} +1 -1
  24. package/dist/{chunk-AH5J62FF.mjs → chunk-TQ5EEJEO.mjs} +2 -2
  25. package/dist/{chunk-P3JMBYEG.mjs → chunk-V24XTYHX.mjs} +2 -2
  26. package/dist/{chunk-KDLH3BWY.mjs → chunk-V6H3ZFC3.mjs} +1 -1
  27. package/dist/{chunk-DKTRJCPP.mjs → chunk-V76B76ML.mjs} +3 -3
  28. package/dist/{direct-executor-YDIA6FU5.mjs → direct-executor-7EROGEUZ.mjs} +1 -1
  29. package/dist/distribution.mjs +25 -25
  30. package/dist/index.browser.mjs +1 -1
  31. package/dist/index.mjs +1 -1
  32. package/dist/index.react-native.mjs +1 -1
  33. package/dist/{long-query-thread-4E6J6WME.mjs → long-query-thread-DNQR25LY.mjs} +10 -10
  34. package/dist/{optional-writes-H6WO6E6B.mjs → optional-writes-3CFEDQ7M.mjs} +3 -3
  35. package/dist/{paged-partition-archive-O3RUZ3II.mjs → paged-partition-archive-YXXCF5WC.mjs} +9 -9
  36. package/dist/partial-words.browser.mjs +1 -1
  37. package/dist/partial-words.mjs +1 -1
  38. package/dist/persistence/durability/checkpoint-worker.mjs +7 -7
  39. package/dist/{query-actions-UTAYIRGP.mjs → query-actions-QCR7WPSV.mjs} +1 -1
  40. package/dist/query-suggestions/merge-worker.mjs +4 -4
  41. package/dist/query-suggestions.browser.mjs +1 -1
  42. package/dist/query-suggestions.mjs +2 -2
  43. package/dist/react-native/chunks/{chunk-3OHO4SEF.mjs → chunk-2CDDI2XI.mjs} +2 -2
  44. package/dist/react-native/chunks/{chunk-2S57X2ZY.mjs → chunk-FXZ3AFKS.mjs} +8 -8
  45. package/dist/react-native/chunks/{chunk-5KRTKOH6.mjs → chunk-HE4S2X7Q.mjs} +1 -1
  46. package/dist/react-native/chunks/{chunk-JZCEJO3N.mjs → chunk-WDR5JEUM.mjs} +1 -1
  47. package/dist/{chunk-RWJQ3XU7.mjs → react-native/chunks/chunk-YVCOZKVC.mjs} +1 -1
  48. package/dist/react-native/chunks/{chunk-UEBUWCYN.mjs → chunk-ZBY7QVQ5.mjs} +1 -1
  49. package/dist/react-native/chunks/{optional-writes-LG24CKDY.mjs → optional-writes-ONME3PSY.mjs} +2 -2
  50. package/dist/react-native/chunks/{restore-queue-6BL75XHS.mjs → restore-queue-OGKLTLU5.mjs} +4 -4
  51. package/dist/react-native/chunks/{segment-codec-leaf-OFY6JAIV.mjs → segment-codec-leaf-PAE2HHEQ.mjs} +2 -2
  52. package/dist/react-native/chunks/{segment-merge-leaf-S2EGW7J7.mjs → segment-merge-leaf-72FIRC26.mjs} +3 -3
  53. package/dist/react-native/chunks/{storage-leaf-SWCGMIES.mjs → storage-leaf-2T5ZTSNK.mjs} +73 -44
  54. package/dist/react-native/chunks/{store-leaf-PK2G37EL.mjs → store-leaf-BC77ZO4Z.mjs} +3 -3
  55. package/dist/react-native/chunks/{suggestions-leaf-MJXF4PPT.mjs → suggestions-leaf-QL3H332L.mjs} +3 -3
  56. package/dist/react-native/chunks/{worker-copies-PCLN3TVS.mjs → worker-copies-WIJCP6YJ.mjs} +2 -2
  57. package/dist/react-native/partial-words.mjs +1 -1
  58. package/dist/react-native/query-suggestions.mjs +1 -1
  59. package/dist/react-native/sync.mjs +1 -1
  60. package/dist/react-native/synonyms.mjs +1 -1
  61. package/dist/{rerank-FQU2Z64X.mjs → rerank-GVUOXQCU.mjs} +1 -1
  62. package/dist/{restore-queue-4OM3MMJ7.mjs → restore-queue-FVVCUHIY.mjs} +4 -4
  63. package/dist/{segment-codec-leaf-ZJL3UUED.mjs → segment-codec-leaf-KXZPLILR.mjs} +2 -2
  64. package/dist/{segment-merge-leaf-VDQ7BLE7.mjs → segment-merge-leaf-MLX5VM3E.mjs} +2 -2
  65. package/dist/server.mjs +15 -15
  66. package/dist/{storage-leaf-7IYAULRJ.mjs → storage-leaf-S2RWQ63Q.mjs} +70 -57
  67. package/dist/{store-leaf-VI3FC46A.mjs → store-leaf-JBMZL6QN.mjs} +3 -3
  68. package/dist/{suggestions-leaf-YP3BMVLS.mjs → suggestions-leaf-MA2PUFB5.mjs} +5 -5
  69. package/dist/sync/filesystem.mjs +4 -4
  70. package/dist/sync.browser.mjs +1 -1
  71. package/dist/sync.mjs +1 -1
  72. package/dist/synonyms.browser.mjs +1 -1
  73. package/dist/synonyms.mjs +1 -1
  74. package/dist/{thread-X36MGME4.mjs → thread-LDS6OTXA.mjs} +9 -9
  75. package/dist/{worker-copies-R53BVAFV.mjs → worker-copies-4T3SR5XZ.mjs} +4 -4
  76. package/dist/workers/entry.mjs +7 -7
  77. package/package.json +5 -5
@@ -1,10 +1,10 @@
1
1
  import { sha256 } from './chunk-H3MDVPBO.mjs';
2
2
  import { oneSyncChangeAtATime } from './chunk-Q32DDFKX.mjs';
3
- import { openChecksummedEnvelope, HEADER_SIZE, requireWithinFileLimit, crc32Init, crc32Update, crc32Final, engineVersionParts, writeHeader, crc32, QUERY_HISTORY_ARCHIVE_PREFIX, MAX_HISTORY_FILE_BYTES, packChecksummedEnvelope, hasNrslMagic, readHeader, storedStateOf, attachedRuntimeOf, historyFilesOf, listHistoryFolder, historyFileOf, packEnvelopeWithChecksum, checksumOfChunks, QUERY_HISTORY_FOLDER, storedStateToWire, storedStateFromWire } from './chunk-UEBUWCYN.mjs';
4
- import { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, rewriteSpillOf, REBALANCE_CHUNK_SIZE, rebuildTextIndexes, textRebuildTargetOf } from './chunk-GJQIMGXT.mjs';
5
- import { deserializePartition } from './chunk-JZCEJO3N.mjs';
6
- import { mergeFieldIndexes, selectionKeeps, fieldIndexRemapOf, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, shareSegmentArrays, freezeSegmentShared, holdsADiscardedField, toError, segmentArraysOf, mergeSegmentContents, buildSegmentPayloads, createRequestId } from './chunk-5KRTKOH6.mjs';
7
- import { resolveIndexAnalysis, getLanguage, emitEngineEvent, reconstructSchemaFromMetadata, prepareStoredSynonyms, rulesOfStoredSynonyms, resolvePartialWordAnalysis, loadSchemaCodeFor, decodeStoredDocument, generateId, wrapFrozenTokenTable, createEncodedDocumentSource, assemblePagedFrozenSegment, yieldToEventLoop, buildPartialWordTableFrom, configurationPayloadOf, withOpenIndex, emitSyncChange, newSyncEpoch, isCompositePartition, mergePartitionStats, resolvePartitionInsertOptions, createPartitionIndex, createCompositePartition, isSyncEpoch, prepareDocumentVectors, removedSurfaceSpellings, prepareConfiguredSynonyms, decodeSurfaceTable, mergeDocFrequencies, TermLookup, createFrozenRemovals, mergeKeywordSources, createSharedFrozenSegment, ARRAY_POSITION_GAP, createFrozenSegment, createPublicationGate, prepareRemovalText, prepareDocumentText, writePartitionDocument, updateDocumentVectors, oversizedConfigurationPayloadOf, requireEncodedConfigurationWithinSizeLimit, readHeapStatistics, readResidentMemory, holdSyncEpochChange, emptyPendingRegions, mergePostings2, scanPostingBlocks, SegmentRefusal, VERSION, DEFAULT_BM25_B, DEFAULT_BM25_K1, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateRequiredFieldsInSchema, validateEmbeddingConfig, storedArrayPositionGap, validQueryFilter, createPatternWorkMeter, compareScores, endOfValue, decodeEveryStoredDocument, createPartitionManager, createPartitionRouter, loadGzip, arrayPositionsAreStale, insertDocumentVectors, decodeMapWithoutFields, survivorDocumentsOf, partitionStateOf, noteDocumentChurn, removeDocumentVectors } from './chunk-2S57X2ZY.mjs';
3
+ import { openChecksummedEnvelope, HEADER_SIZE, requireWithinFileLimit, crc32Init, crc32Update, crc32Final, engineVersionParts, writeHeader, crc32, QUERY_HISTORY_ARCHIVE_PREFIX, MAX_HISTORY_FILE_BYTES, packChecksummedEnvelope, hasNrslMagic, readHeader, storedStateOf, attachedRuntimeOf, historyFilesOf, listHistoryFolder, historyFileOf, packEnvelopeWithChecksum, checksumOfChunks, QUERY_HISTORY_FOLDER, storedStateToWire, storedStateFromWire } from './chunk-ZBY7QVQ5.mjs';
4
+ import { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, rewriteSpillOf, REBALANCE_CHUNK_SIZE, rebuildTextIndexes, textRebuildTargetOf } from './chunk-YVCOZKVC.mjs';
5
+ import { deserializePartition } from './chunk-WDR5JEUM.mjs';
6
+ import { mergeFieldIndexes, selectionKeeps, fieldIndexRemapOf, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, shareSegmentArrays, freezeSegmentShared, holdsADiscardedField, toError, segmentArraysOf, mergeSegmentContents, buildSegmentPayloads, createRequestId } from './chunk-HE4S2X7Q.mjs';
7
+ import { resolveIndexAnalysis, getLanguage, emitEngineEvent, reconstructSchemaFromMetadata, prepareStoredSynonyms, rulesOfStoredSynonyms, resolvePartialWordAnalysis, loadSchemaCodeFor, decodeStoredDocument, generateId, wrapFrozenTokenTable, createEncodedDocumentSource, assemblePagedFrozenSegment, yieldToEventLoop, buildPartialWordTableFrom, configurationPayloadOf, withOpenIndex, emitSyncChange, newSyncEpoch, isCompositePartition, mergePartitionStats, resolvePartitionInsertOptions, createPartitionIndex, createCompositePartition, isSyncEpoch, prepareDocumentVectors, removedSurfaceSpellings, prepareConfiguredSynonyms, decodeSurfaceTable, mergeDocFrequencies, TermLookup, createFrozenRemovals, mergeKeywordSources, createSharedFrozenSegment, ARRAY_POSITION_GAP, createFrozenSegment, createPublicationGate, prepareRemovalText, prepareDocumentText, writePartitionDocument, updateDocumentVectors, oversizedConfigurationPayloadOf, requireEncodedConfigurationWithinSizeLimit, readHeapStatistics, readResidentMemory, holdSyncEpochChange, emptyPendingRegions, mergePostings2, scanPostingBlocks, SegmentRefusal, VERSION, DEFAULT_BM25_B, DEFAULT_BM25_K1, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateRequiredFieldsInSchema, validateEmbeddingConfig, storedArrayPositionGap, validQueryFilter, createPatternWorkMeter, compareScores, endOfValue, decodeEveryStoredDocument, createPartitionManager, createPartitionRouter, loadGzip, arrayPositionsAreStale, insertDocumentVectors, decodeMapWithoutFields, survivorDocumentsOf, partitionStateOf, noteDocumentChurn, removeDocumentVectors } from './chunk-FXZ3AFKS.mjs';
8
8
  import './chunk-AN4HKLB4.mjs';
9
9
  import { turnsAreBudgeted, turnIsSpent, yieldTurn, isDead, VECTOR_FILE_PAYLOAD_VERSION, bytesToVectors, countWrite, collectAndReturnPages, requireBoundedUpperLists, osqRecordBytes, createFixedBuffer, magnitude, rescoreDepth, defaultEfSearch, computeCodeBlockLayout, toScore, createVectorFileReader, decodeVectorIndexParts, signalOfSearch, requireSearchActive, osqQuantize, createOsqScratch, stageQueryLevels, scalarQueryProducts, readTrailer, osqEstimate, osqDistance, toDistance, decodeVectorFilePayload, DEFAULT_VECTOR_METRIC, defaultQuantizationFor, VECTOR_FILE_MAX_VECTORS, deadBytesFor, vectorsPerFile, vectorsToBytes, decodeVectorGraphPartPayload, assembleGraphParts, waitOutsideCountedWrite, fnv1a, osqBitsOf, countDead, nodeThreadId, detectRuntime, graphPartsOfEarlierPayload, decodeVectorGraphPayload } from './chunk-G434H5WG.mjs';
10
10
  export { createHNSWIndex, osqBitsOf } from './chunk-G434H5WG.mjs';
@@ -8019,6 +8019,22 @@ function frameRecord(entry) {
8019
8019
  view.setUint32(RECORD_LENGTH_SIZE + payload.length, crc32(payload), false);
8020
8020
  return frame;
8021
8021
  }
8022
+ function joinFrames(frames) {
8023
+ if (frames.length === 1) {
8024
+ return frames[0];
8025
+ }
8026
+ let totalBytes = 0;
8027
+ for (const frame of frames) {
8028
+ totalBytes += frame.length;
8029
+ }
8030
+ const joined4 = new Uint8Array(totalBytes);
8031
+ let offset = 0;
8032
+ for (const frame of frames) {
8033
+ joined4.set(frame, offset);
8034
+ offset += frame.length;
8035
+ }
8036
+ return joined4;
8037
+ }
8022
8038
  function checkSegmentHeader(data) {
8023
8039
  if (data.length < SEGMENT_HEADER_SIZE) {
8024
8040
  return { ok: false, reason: "segment shorter than the 8-byte header", code: ErrorCodes.PERSISTENCE_WAL_CORRUPT };
@@ -16862,6 +16878,8 @@ function createWalWriter(directory, config) {
16862
16878
  let highestDurableSeqNo = 0;
16863
16879
  let markerWriter = null;
16864
16880
  let durabilityLock = Promise.resolve();
16881
+ let synced = null;
16882
+ let failure = null;
16865
16883
  const coordinator = createGroupCommitCoordinator(() => withDurabilityLock(flushActiveSegment));
16866
16884
  function withDurabilityLock(fn) {
16867
16885
  const result = durabilityLock.then(fn);
@@ -16884,18 +16902,37 @@ function createWalWriter(directory, config) {
16884
16902
  }
16885
16903
  return markerWriter;
16886
16904
  }
16905
+ function latchFailure(err) {
16906
+ if (failure === null) {
16907
+ failure = { error: err };
16908
+ }
16909
+ return failure.error;
16910
+ }
16887
16911
  async function flushActiveSegment() {
16888
- if (handle === null) {
16912
+ if (failure !== null) {
16913
+ throw failure.error;
16914
+ }
16915
+ const flushing = handle;
16916
+ if (flushing === null) {
16889
16917
  return;
16890
16918
  }
16891
- const writer = await getMarkerWriter();
16892
16919
  const durableByteLength = activeBytes;
16893
16920
  const activeSegmentSeqNo = activeStartSeqNo;
16894
- const durableSeqNo = Math.max(highestAppendedSeqNo, highestDurableSeqNo);
16895
- await handle.sync();
16896
- await writer.commit({ activeSegmentSeqNo, durableByteLength, highestDurableSeqNo: durableSeqNo });
16897
- if (durableSeqNo > highestDurableSeqNo) {
16898
- highestDurableSeqNo = durableSeqNo;
16921
+ const appendedSeqNo = highestAppendedSeqNo;
16922
+ if (synced !== null && synced.startSeqNo === activeSegmentSeqNo && synced.bytes === durableByteLength) {
16923
+ return;
16924
+ }
16925
+ try {
16926
+ const writer = await getMarkerWriter();
16927
+ const durableSeqNo = Math.max(appendedSeqNo, highestDurableSeqNo);
16928
+ await flushing.sync();
16929
+ await writer.commit({ activeSegmentSeqNo, durableByteLength, highestDurableSeqNo: durableSeqNo });
16930
+ if (durableSeqNo > highestDurableSeqNo) {
16931
+ highestDurableSeqNo = durableSeqNo;
16932
+ }
16933
+ synced = { startSeqNo: activeSegmentSeqNo, bytes: durableByteLength };
16934
+ } catch (err) {
16935
+ throw latchFailure(err);
16899
16936
  }
16900
16937
  }
16901
16938
  function formatVersionFor(holdsPreviousDocument) {
@@ -16998,22 +17035,30 @@ function createWalWriter(directory, config) {
16998
17035
  }
16999
17036
  }
17000
17037
  async function swapToPreparedSegment(sealed) {
17001
- const writer = await getMarkerWriter();
17002
- const startSeqNo = highestAppendedSeqNo + 1;
17003
- const durableSeqNo = Math.max(highestAppendedSeqNo, highestDurableSeqNo);
17004
- const key = segmentKey2(config.indexName, config.partitionId, startSeqNo);
17005
- await Promise.all([sealed.sync(), directory.move(preparedKey, key)]);
17006
- handle = await directory.appendHandle(key);
17007
- activeKey = key;
17008
- activeStartSeqNo = startSeqNo;
17009
- activeBytes = SEGMENT_HEADER_SIZE;
17010
- activeFormatVersion = preparedFormatVersion;
17011
- await writer.commit({
17012
- activeSegmentSeqNo: startSeqNo,
17013
- durableByteLength: SEGMENT_HEADER_SIZE,
17014
- highestDurableSeqNo: durableSeqNo
17015
- });
17016
- highestDurableSeqNo = durableSeqNo;
17038
+ if (failure !== null) {
17039
+ throw failure.error;
17040
+ }
17041
+ try {
17042
+ const writer = await getMarkerWriter();
17043
+ const startSeqNo = highestAppendedSeqNo + 1;
17044
+ const durableSeqNo = Math.max(highestAppendedSeqNo, highestDurableSeqNo);
17045
+ const key = segmentKey2(config.indexName, config.partitionId, startSeqNo);
17046
+ await Promise.all([sealed.sync(), directory.move(preparedKey, key)]);
17047
+ handle = await directory.appendHandle(key);
17048
+ activeKey = key;
17049
+ activeStartSeqNo = startSeqNo;
17050
+ activeBytes = SEGMENT_HEADER_SIZE;
17051
+ activeFormatVersion = preparedFormatVersion;
17052
+ await writer.commit({
17053
+ activeSegmentSeqNo: startSeqNo,
17054
+ durableByteLength: SEGMENT_HEADER_SIZE,
17055
+ highestDurableSeqNo: durableSeqNo
17056
+ });
17057
+ highestDurableSeqNo = durableSeqNo;
17058
+ synced = { startSeqNo, bytes: SEGMENT_HEADER_SIZE };
17059
+ } catch (err) {
17060
+ throw latchFailure(err);
17061
+ }
17017
17062
  await sealed.close();
17018
17063
  }
17019
17064
  async function maybeRoll(nextSeqNo, appendedBytes, holdsPreviousDocument) {
@@ -17024,22 +17069,6 @@ function createWalWriter(directory, config) {
17024
17069
  await withDurabilityLock(() => rollUnderLock(nextSeqNo, formatVersionFor(holdsPreviousDocument)));
17025
17070
  }
17026
17071
  }
17027
- function joinFrames(frames) {
17028
- if (frames.length === 1) {
17029
- return frames[0];
17030
- }
17031
- let totalBytes = 0;
17032
- for (const frame of frames) {
17033
- totalBytes += frame.length;
17034
- }
17035
- const joined4 = new Uint8Array(totalBytes);
17036
- let offset = 0;
17037
- for (const frame of frames) {
17038
- joined4.set(frame, offset);
17039
- offset += frame.length;
17040
- }
17041
- return joined4;
17042
- }
17043
17072
  function framesThatFit(frames, start) {
17044
17073
  const room = segmentMaxBytes - activeBytes;
17045
17074
  let end = start + 1;
@@ -1,7 +1,7 @@
1
- export { DayStore, RestoredHistory, clearLeftoversOfName, dayOf, installSuggestionHooks, openCountsFile, sameBytes, startQuerySuggestions } from './chunk-3OHO4SEF.mjs';
1
+ export { DayStore, RestoredHistory, clearLeftoversOfName, dayOf, installSuggestionHooks, openCountsFile, sameBytes, startQuerySuggestions } from './chunk-2CDDI2XI.mjs';
2
2
  export { oneSyncChangeAtATime } from './chunk-Q32DDFKX.mjs';
3
- export { BUILD_LIST_PAGE, BUILD_WRITE_BATCH, BYTES_PER_MIB, DAY_MS, DEFAULT_PREVIEW_LIMIT, HEADER_SIZE, HISTORY_SWEEP_INTERVAL_MS, KEY_FINGERPRINT_BYTES, KEY_FINGERPRINT_LABEL, MAX_HISTORY_FILE_BYTES, MAX_MANUAL_SUGGESTION_COUNT, MAX_PREVIEW_LIMIT, MAX_SOURCE_INDEX_NAME_LENGTH, MAX_TIMER_DELAY_MS, MIN_KEY_BYTES, MS_PER_SECOND, QUERY_HISTORY_ARCHIVE_PREFIX, QUERY_HISTORY_FOLDER, SCHEDULE_OFF, SCRAMBLED_ID_BYTES, acceptedPhrase, attachRuntime, attachedRuntimeOf, banListFromInput, bindSuggestionStoreHost, buildRecordKey, checksumOfChunks, crc32, crc32Final, crc32Init, crc32Update, engineVersionParts, hasNrslMagic, historyFileOf, historyFilesOf, invalidSetting, isGroup, isPerson, latestMatchAtOrBefore, listHistoryFolder, nextMatchAfter, normaliseBan, openChecksummedEnvelope, packChecksummedEnvelope, packEnvelopeWithChecksum, parseSchedule, readHeader, removeHistoryFolder, removeRestoreLeftovers, requireFieldsInSchema, requireWithinFileLimit, resolveSetting, storedStateFromWire, storedStateOf, storedStateToWire, unionOfBans, validateSetting, withState, writeHeader } from './chunk-UEBUWCYN.mjs';
4
- import './chunk-2S57X2ZY.mjs';
3
+ export { BUILD_LIST_PAGE, BUILD_WRITE_BATCH, BYTES_PER_MIB, DAY_MS, DEFAULT_PREVIEW_LIMIT, HEADER_SIZE, HISTORY_SWEEP_INTERVAL_MS, KEY_FINGERPRINT_BYTES, KEY_FINGERPRINT_LABEL, MAX_HISTORY_FILE_BYTES, MAX_MANUAL_SUGGESTION_COUNT, MAX_PREVIEW_LIMIT, MAX_SOURCE_INDEX_NAME_LENGTH, MAX_TIMER_DELAY_MS, MIN_KEY_BYTES, MS_PER_SECOND, QUERY_HISTORY_ARCHIVE_PREFIX, QUERY_HISTORY_FOLDER, SCHEDULE_OFF, SCRAMBLED_ID_BYTES, acceptedPhrase, attachRuntime, attachedRuntimeOf, banListFromInput, bindSuggestionStoreHost, buildRecordKey, checksumOfChunks, crc32, crc32Final, crc32Init, crc32Update, engineVersionParts, hasNrslMagic, historyFileOf, historyFilesOf, invalidSetting, isGroup, isPerson, latestMatchAtOrBefore, listHistoryFolder, nextMatchAfter, normaliseBan, openChecksummedEnvelope, packChecksummedEnvelope, packEnvelopeWithChecksum, parseSchedule, readHeader, removeHistoryFolder, removeRestoreLeftovers, requireFieldsInSchema, requireWithinFileLimit, resolveSetting, storedStateFromWire, storedStateOf, storedStateToWire, unionOfBans, validateSetting, withState, writeHeader } from './chunk-ZBY7QVQ5.mjs';
4
+ import './chunk-FXZ3AFKS.mjs';
5
5
  import './chunk-AN4HKLB4.mjs';
6
6
  import './chunk-G434H5WG.mjs';
7
7
  import './chunk-LX62Y4B5.mjs';
@@ -1,7 +1,7 @@
1
- import { installSuggestionHooks, DayStore, RestoredHistory, dayOf, sameBytes, openCountsFile } from './chunk-3OHO4SEF.mjs';
1
+ import { installSuggestionHooks, DayStore, RestoredHistory, dayOf, sameBytes, openCountsFile } from './chunk-2CDDI2XI.mjs';
2
2
  import { oneSyncChangeAtATime } from './chunk-Q32DDFKX.mjs';
3
- import { attachedRuntimeOf, attachRuntime, isGroup, invalidSetting, MIN_KEY_BYTES, historyFilesOf, buildRecordKey, resolveSetting, acceptedPhrase, normaliseBan, banListFromInput, validateSetting, withState, SCRAMBLED_ID_BYTES, KEY_FINGERPRINT_LABEL, KEY_FINGERPRINT_BYTES, isPerson, removeHistoryFolder, packEnvelopeWithChecksum, crc32, openChecksummedEnvelope, MAX_MANUAL_SUGGESTION_COUNT, MAX_SOURCE_INDEX_NAME_LENGTH, DEFAULT_PREVIEW_LIMIT, MAX_PREVIEW_LIMIT, requireFieldsInSchema, removeRestoreLeftovers, HISTORY_SWEEP_INTERVAL_MS, SCHEDULE_OFF, parseSchedule, nextMatchAfter, latestMatchAtOrBefore, DAY_MS, listHistoryFolder, historyFileOf, BUILD_WRITE_BATCH, MAX_TIMER_DELAY_MS, MS_PER_SECOND, BUILD_LIST_PAGE, unionOfBans } from './chunk-UEBUWCYN.mjs';
4
- import { GROUP_FORMAT, loadDigest, emitEngineEvent, emitWriteEventAfter, createEngineIndex, withOpenIndex, SUGGESTIONS_INDEX_INFIX } from './chunk-2S57X2ZY.mjs';
3
+ import { attachedRuntimeOf, attachRuntime, isGroup, invalidSetting, MIN_KEY_BYTES, historyFilesOf, buildRecordKey, resolveSetting, acceptedPhrase, normaliseBan, banListFromInput, validateSetting, withState, SCRAMBLED_ID_BYTES, KEY_FINGERPRINT_LABEL, KEY_FINGERPRINT_BYTES, isPerson, removeHistoryFolder, packEnvelopeWithChecksum, crc32, openChecksummedEnvelope, MAX_MANUAL_SUGGESTION_COUNT, MAX_SOURCE_INDEX_NAME_LENGTH, DEFAULT_PREVIEW_LIMIT, MAX_PREVIEW_LIMIT, requireFieldsInSchema, removeRestoreLeftovers, HISTORY_SWEEP_INTERVAL_MS, SCHEDULE_OFF, parseSchedule, nextMatchAfter, latestMatchAtOrBefore, DAY_MS, listHistoryFolder, historyFileOf, BUILD_WRITE_BATCH, MAX_TIMER_DELAY_MS, MS_PER_SECOND, BUILD_LIST_PAGE, unionOfBans } from './chunk-ZBY7QVQ5.mjs';
4
+ import { GROUP_FORMAT, loadDigest, emitEngineEvent, emitWriteEventAfter, createEngineIndex, withOpenIndex, SUGGESTIONS_INDEX_INFIX } from './chunk-FXZ3AFKS.mjs';
5
5
  import './chunk-AN4HKLB4.mjs';
6
6
  import './chunk-G434H5WG.mjs';
7
7
  import './chunk-LX62Y4B5.mjs';
@@ -1,5 +1,5 @@
1
- import { buildSegmentPayloads, freezeSegmentShared, isValidWorkerResponse, createRequestId, mergeSegmentContents, freezeEncodedSegmentShared, toError, isDeterministicFailure, workerIneligibility, reportIneligible, selectionKeeps, alreadyPresentOnWorker, eligibleIndexNames } from './chunk-5KRTKOH6.mjs';
2
- import { growPartitionsTo, isCompositePartition, createSharedFrozenSegment, loadStorageCode, resolvePartitionInsertOptions, DEFAULT_COPY_THRESHOLD, workersEnabledByDefault, POOL_RESTART_DELAY_MS, SegmentRefusal, NO_REMOVED_SPELLINGS, DEFAULT_COPY_IDLE_TIMEOUT_MS, LONG_QUERY_THREADS, prepareDocumentVectors, MAX_PENDING_REPLICATION_DOCUMENTS, MAIN_COPY_LONE_QUERY_DOCUMENTS, returnsEveryMatch, oversampledFacetConfig, afterCurrentTurn, LOAD_BUFFER_YIELD_INTERVAL, yieldToEventLoop, IDLE_MERGE_DELAY_MS, REPLICATION_WINDOW, RETIRED_THREADS_EXIT_WAIT_MS, createWorkerFactory, availablePatternSearch, patternHost, kWayMerge, mergeFacets, generateId, encodeSegmentState, POOL_RESTART_DELAY_MAX_MS, COMPACTION_SEGMENT_TRIGGER, LIVE_TAIL_FREEZE_FLOOR, requireLoadedVectorCode, LIVE_TAIL_FLUSH_DOCUMENTS, SEGMENTS_PER_MERGE } from './chunk-2S57X2ZY.mjs';
1
+ import { buildSegmentPayloads, freezeSegmentShared, isValidWorkerResponse, createRequestId, mergeSegmentContents, freezeEncodedSegmentShared, toError, isDeterministicFailure, workerIneligibility, reportIneligible, selectionKeeps, alreadyPresentOnWorker, eligibleIndexNames } from './chunk-HE4S2X7Q.mjs';
2
+ import { growPartitionsTo, isCompositePartition, createSharedFrozenSegment, loadStorageCode, resolvePartitionInsertOptions, DEFAULT_COPY_THRESHOLD, workersEnabledByDefault, POOL_RESTART_DELAY_MS, SegmentRefusal, NO_REMOVED_SPELLINGS, DEFAULT_COPY_IDLE_TIMEOUT_MS, LONG_QUERY_THREADS, prepareDocumentVectors, MAX_PENDING_REPLICATION_DOCUMENTS, MAIN_COPY_LONE_QUERY_DOCUMENTS, returnsEveryMatch, oversampledFacetConfig, afterCurrentTurn, LOAD_BUFFER_YIELD_INTERVAL, yieldToEventLoop, IDLE_MERGE_DELAY_MS, REPLICATION_WINDOW, RETIRED_THREADS_EXIT_WAIT_MS, createWorkerFactory, availablePatternSearch, patternHost, kWayMerge, mergeFacets, generateId, encodeSegmentState, POOL_RESTART_DELAY_MAX_MS, COMPACTION_SEGMENT_TRIGGER, LIVE_TAIL_FREEZE_FLOOR, requireLoadedVectorCode, LIVE_TAIL_FLUSH_DOCUMENTS, SEGMENTS_PER_MERGE } from './chunk-FXZ3AFKS.mjs';
3
3
  import './chunk-AN4HKLB4.mjs';
4
4
  import { resolveWorkerCount, DEFAULT_BACKPRESSURE_LIMIT, DEFAULT_REQUEST_TIMEOUT_MS, splitWorkerBudget, SHUTDOWN_TIMEOUT_MS, resolveRequestThreadCount, CONSECUTIVE_TIMEOUTS_BEFORE_DEATH, fnv1a, noteThreadSlotGone, threadSlotOfWorker } from './chunk-G434H5WG.mjs';
5
5
  import { MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS } from './chunk-LX62Y4B5.mjs';
@@ -1,4 +1,4 @@
1
- import { spellingCountsOf, encodePartialSpellings, countSpelling, SurfaceTable, SURFACE_TABLE_START_CAPACITY, StringPlan, SegmentRefusal, reserveStrings, grownCapacity, PARTIAL_WORD_RUN_CODE_POINTS, encodeStringBlob, sameFields, countDocumentSpellings, tokenize, GROWING_PARTIAL_ENTRY_BYTES, GROWING_PARTIAL_RUN_BYTES, GROWING_PARTIAL_RUN_MEMBER_BYTES, GROWING_PARTIAL_PENDING_ENTRY_BYTES, RUN_TABLE_START_CAPACITY, TERM_REGION_GROWTH_FACTOR, RUN_MEMBER_START_CAPACITY, SLICE_CAPACITIES, TERM_SLOT_LOAD_DENOMINATOR, TERM_SLOT_LOAD_NUMERATOR, PoolPlan, requireRoom, releaseRange, requireSegment, termText, partitionDocumentFrequency, visitDocumentSpellings, visitDocumentSurfaceSpellings, resolveStopWords, transformToken, expansionSource, liveFrequency, codePointCountOf, GROWING_PARTIAL_PENDING_ENTRIES_PER_ENTRY, typedRegion, regionsOverlap, mergeText } from './chunks/chunk-2S57X2ZY.mjs';
1
+ import { spellingCountsOf, encodePartialSpellings, countSpelling, SurfaceTable, SURFACE_TABLE_START_CAPACITY, StringPlan, SegmentRefusal, reserveStrings, grownCapacity, PARTIAL_WORD_RUN_CODE_POINTS, encodeStringBlob, sameFields, countDocumentSpellings, tokenize, GROWING_PARTIAL_ENTRY_BYTES, GROWING_PARTIAL_RUN_BYTES, GROWING_PARTIAL_RUN_MEMBER_BYTES, GROWING_PARTIAL_PENDING_ENTRY_BYTES, RUN_TABLE_START_CAPACITY, TERM_REGION_GROWTH_FACTOR, RUN_MEMBER_START_CAPACITY, SLICE_CAPACITIES, TERM_SLOT_LOAD_DENOMINATOR, TERM_SLOT_LOAD_NUMERATOR, PoolPlan, requireRoom, releaseRange, requireSegment, termText, partitionDocumentFrequency, visitDocumentSpellings, visitDocumentSurfaceSpellings, resolveStopWords, transformToken, expansionSource, liveFrequency, codePointCountOf, GROWING_PARTIAL_PENDING_ENTRIES_PER_ENTRY, typedRegion, regionsOverlap, mergeText } from './chunks/chunk-FXZ3AFKS.mjs';
2
2
  import './chunks/chunk-AN4HKLB4.mjs';
3
3
  import { FNV_OFFSET_BASIS, FNV_PRIME } from './chunks/chunk-G434H5WG.mjs';
4
4
  import { PARTIAL_WORD_MIN_CODE_POINTS, PARTIAL_WORDS_ADDED_PER_QUERY, DEFAULT_FUZZY_PREFIX_LENGTH } from './chunks/chunk-LX62Y4B5.mjs';
@@ -1,4 +1,4 @@
1
- import { engineCoreOf, loadSuggestionsCode, GROUP_PATTERN_SOURCE, GROUP_FORMAT, SUGGESTIONS_INDEX_INFIX } from './chunks/chunk-2S57X2ZY.mjs';
1
+ import { engineCoreOf, loadSuggestionsCode, GROUP_PATTERN_SOURCE, GROUP_FORMAT, SUGGESTIONS_INDEX_INFIX } from './chunks/chunk-FXZ3AFKS.mjs';
2
2
  import './chunks/chunk-AN4HKLB4.mjs';
3
3
  import './chunks/chunk-G434H5WG.mjs';
4
4
  import './chunks/chunk-LX62Y4B5.mjs';
@@ -1,4 +1,4 @@
1
- import { isSyncEpoch, hasLanguage, hasTokenizer, hasStopWords, readHeapStatistics, loadStorageCode, getLanguage } from './chunks/chunk-2S57X2ZY.mjs';
1
+ import { isSyncEpoch, hasLanguage, hasTokenizer, hasStopWords, readHeapStatistics, loadStorageCode, getLanguage } from './chunks/chunk-FXZ3AFKS.mjs';
2
2
  import './chunks/chunk-AN4HKLB4.mjs';
3
3
  import './chunks/chunk-G434H5WG.mjs';
4
4
  import './chunks/chunk-LX62Y4B5.mjs';
@@ -1,4 +1,4 @@
1
- import { withOpenIndex, oneAtATime, resolveIndexAnalysis, loadStorageCode, emitSyncChange, encodeStringBlob, tokenize, typedRegion, regionsOverlap, encodeLookupKey } from './chunks/chunk-2S57X2ZY.mjs';
1
+ import { withOpenIndex, oneAtATime, resolveIndexAnalysis, loadStorageCode, emitSyncChange, encodeStringBlob, tokenize, typedRegion, regionsOverlap, encodeLookupKey } from './chunks/chunk-FXZ3AFKS.mjs';
2
2
  import './chunks/chunk-AN4HKLB4.mjs';
3
3
  import './chunks/chunk-G434H5WG.mjs';
4
4
  import './chunks/chunk-LX62Y4B5.mjs';
@@ -1,4 +1,4 @@
1
- import { loadRerankRuntime } from './chunk-I2FKNCDS.mjs';
1
+ import { loadRerankRuntime } from './chunk-K2KNE7W2.mjs';
2
2
  import './chunk-2CKDCC65.mjs';
3
3
  import './chunk-AOYQTX6W.mjs';
4
4
  import './chunk-GXCDWLQI.mjs';
@@ -1,7 +1,7 @@
1
- import { installSuggestionHooks, RestoredHistory, clearLeftoversOfName } from './chunk-Y3T4HQGT.mjs';
2
- export { startQuerySuggestions } from './chunk-Y3T4HQGT.mjs';
3
- import { attachedRuntimeOf, withState, unionOfBans, BUILD_WRITE_BATCH } from './chunk-ZVJPJZIP.mjs';
4
- import { loadStorageCode, loadOptionalWrites, emitEngineEvent, removeDocumentBatch2 } from './chunk-I2FKNCDS.mjs';
1
+ import { installSuggestionHooks, RestoredHistory, clearLeftoversOfName } from './chunk-7BCL5QK5.mjs';
2
+ export { startQuerySuggestions } from './chunk-7BCL5QK5.mjs';
3
+ import { attachedRuntimeOf, withState, unionOfBans, BUILD_WRITE_BATCH } from './chunk-SUFAI37B.mjs';
4
+ import { loadStorageCode, loadOptionalWrites, emitEngineEvent, removeDocumentBatch2 } from './chunk-K2KNE7W2.mjs';
5
5
  import './chunk-2CKDCC65.mjs';
6
6
  import './chunk-AOYQTX6W.mjs';
7
7
  import './chunk-GXCDWLQI.mjs';
@@ -1,5 +1,5 @@
1
- export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, rebuildTextIndexes, rewriteSpillOf, textRebuildTargetOf } from './chunk-RWJQ3XU7.mjs';
2
- export { bindSegmentCodecHost, createEncodedDocumentSource, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, encodeDocumentTableData, endOfValue, reconstructSchemaFromMetadata, storedDocumentsOf, topLevelMapKeys } from './chunk-I2FKNCDS.mjs';
1
+ export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, rebuildTextIndexes, rewriteSpillOf, textRebuildTargetOf } from './chunk-23WLACOL.mjs';
2
+ export { bindSegmentCodecHost, createEncodedDocumentSource, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, encodeDocumentTableData, endOfValue, reconstructSchemaFromMetadata, storedDocumentsOf, topLevelMapKeys } from './chunk-K2KNE7W2.mjs';
3
3
  import './chunk-2CKDCC65.mjs';
4
4
  import './chunk-AOYQTX6W.mjs';
5
5
  import './chunk-GXCDWLQI.mjs';
@@ -1,5 +1,5 @@
1
- export { deserializePartition, serializePartition } from './chunk-KDLH3BWY.mjs';
2
- export { alreadyPresentOnWorker, bindSegmentMergeHost, buildSegmentPayloads, createRequestId, eligibleIndexNames, fieldIndexRemapOf, freezeEncodedSegmentShared, freezeSegmentShared, holdsADiscardedField, isDeterministicFailure, isValidWorkerResponse, mergeFieldIndexes, mergePostings, mergeSegmentContents, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, reportIneligible, segmentArraysOf, selectionKeeps, shareSegmentArrays, toError, workerIneligibility } from './chunk-I2FKNCDS.mjs';
1
+ export { deserializePartition, serializePartition } from './chunk-V6H3ZFC3.mjs';
2
+ export { alreadyPresentOnWorker, bindSegmentMergeHost, buildSegmentPayloads, createRequestId, eligibleIndexNames, fieldIndexRemapOf, freezeEncodedSegmentShared, freezeSegmentShared, holdsADiscardedField, isDeterministicFailure, isValidWorkerResponse, mergeFieldIndexes, mergePostings, mergeSegmentContents, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, reportIneligible, segmentArraysOf, selectionKeeps, shareSegmentArrays, toError, workerIneligibility } from './chunk-K2KNE7W2.mjs';
3
3
  import './chunk-2CKDCC65.mjs';
4
4
  import './chunk-AOYQTX6W.mjs';
5
5
  import './chunk-GXCDWLQI.mjs';
package/dist/server.mjs CHANGED
@@ -1,29 +1,29 @@
1
- import { answerRequest } from './chunk-ZV25WJNK.mjs';
1
+ import { answerRequest } from './chunk-NVGSHRLW.mjs';
2
2
  import { resolveVectorText } from './chunk-NJJN4FMM.mjs';
3
- import { DEFAULT_MAX_RETAINED_TASKS, loadUWebSockets, registerFeedRoute, SYNC_FEED_ROUTE, CHANGES_FEED_ROUTE, resolveCors, authorizerFor, createSharedGateBuffer, gateSlotOfWorker, createBodyBudgetBuffer, createRouteRunner, corsHeaderReader, createSharedBodyBudget, MAIN_THREAD_GATE_SLOT, createSharedRequestGate, registerServerRoutes, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, RUNNING_TASK_TTL_MS, DEFAULT_TASK_PAGE_SIZE, TERMINAL_TASK_TTL_MS, TASK_PROGRESS_WRITE_INTERVAL_MS, serializeNarsilError, createVersionHandler, createSyncSnapshotHandler, acceptorOf, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, createDocumentReadHandlers, sendError, respondError, respondJson, sendText, PROMETHEUS_TEXT_CONTENT_TYPE, MAX_INDEX_TOUCH_INTERVAL_MS, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, closeEveryThreadAtExit, REQUEST_THREAD_CLOSE_AT_EXIT_MS, clearGateSlot, clearBodyBudgetSlot, createCloseAtExitWords, createDepartureWord, departureConfirmed, refusedRegex, toHttpError, parseJson, validateCreateIndex, rejectInvalid, isRemoveOnlyBatch, validateBatch, serializeBatchResult, parseWriteJson, validateDocumentBody, validateSuggest, validateQuery, refuseRegex, requestSignal, withServerRerankWindow, respondAnswer, encodeQueryResult, parseTaskListQuery, parseJsonOptional, validateChangeAnalysis, validateRebalance, badRequest, sendStream, SNAPSHOT_ARCHIVE_CONTENT_TYPE, DOCUMENT_EXPORT_CONTENT_TYPE, respondPreparingError, parseRefusalOf, IMPORT_FLUSHES_IN_FLIGHT, confirmDeparture, isThreadFeedNote, SERVER_CAPABILITIES, MIN_UNBOUNDED_SERVER_LIMIT, MIN_COUNTED_SERVER_LIMIT } from './chunk-YYNLEWSP.mjs';
4
- export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, CHANGE_ANALYSIS_CAPABILITY, DOCUMENT_EXPORT_CAPABILITY, INDEX_LIFECYCLE_CAPABILITY, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, httpStatusForNarsilError } from './chunk-YYNLEWSP.mjs';
5
- import { startSyncRetentionSweep, publishedSyncSnapshot, publishedArchiveLayout } from './chunk-KYVJPISW.mjs';
3
+ import { DEFAULT_MAX_RETAINED_TASKS, loadUWebSockets, registerFeedRoute, SYNC_FEED_ROUTE, CHANGES_FEED_ROUTE, resolveCors, authorizerFor, createSharedGateBuffer, gateSlotOfWorker, createBodyBudgetBuffer, createRouteRunner, corsHeaderReader, createSharedBodyBudget, MAIN_THREAD_GATE_SLOT, createSharedRequestGate, registerServerRoutes, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, RUNNING_TASK_TTL_MS, DEFAULT_TASK_PAGE_SIZE, TERMINAL_TASK_TTL_MS, TASK_PROGRESS_WRITE_INTERVAL_MS, serializeNarsilError, createVersionHandler, createSyncSnapshotHandler, acceptorOf, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, createDocumentReadHandlers, sendError, respondError, respondJson, sendText, PROMETHEUS_TEXT_CONTENT_TYPE, MAX_INDEX_TOUCH_INTERVAL_MS, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, closeEveryThreadAtExit, REQUEST_THREAD_CLOSE_AT_EXIT_MS, clearGateSlot, clearBodyBudgetSlot, createCloseAtExitWords, createDepartureWord, departureConfirmed, refusedRegex, toHttpError, parseJson, validateCreateIndex, rejectInvalid, isRemoveOnlyBatch, validateBatch, serializeBatchResult, parseWriteJson, validateDocumentBody, validateSuggest, validateQuery, refuseRegex, requestSignal, withServerRerankWindow, respondAnswer, encodeQueryResult, parseTaskListQuery, parseJsonOptional, validateChangeAnalysis, validateRebalance, badRequest, sendStream, SNAPSHOT_ARCHIVE_CONTENT_TYPE, DOCUMENT_EXPORT_CONTENT_TYPE, respondPreparingError, parseRefusalOf, IMPORT_FLUSHES_IN_FLIGHT, confirmDeparture, isThreadFeedNote, SERVER_CAPABILITIES, MIN_UNBOUNDED_SERVER_LIMIT, MIN_COUNTED_SERVER_LIMIT } from './chunk-RDGMV4R3.mjs';
4
+ export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, CHANGE_ANALYSIS_CAPABILITY, DOCUMENT_EXPORT_CAPABILITY, INDEX_LIFECYCLE_CAPABILITY, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, httpStatusForNarsilError } from './chunk-RDGMV4R3.mjs';
5
+ import { startSyncRetentionSweep, publishedSyncSnapshot, publishedArchiveLayout } from './chunk-IC6LWK2D.mjs';
6
6
  import { SYNC_CLOSE_RESYNC, SYNC_CLOSE_CREDENTIAL_EXPIRED, SYNC_CLOSE_POLICY, MAX_DEVICE_MESSAGE_BYTES, SYNC_CLOSE_TOO_LARGE, deviceMessageOf, SYNC_CLOSE_SERVER_ERROR, positionList, positionsByPartition, CHANGES_CLOSE_RESYNC, CHANGES_CLOSE_POLICY, MAX_SUBSCRIBER_MESSAGE_BYTES, CHANGES_CLOSE_TOO_LARGE, closeReasonOf, CHANGES_CLOSE_CREDENTIAL_EXPIRED, CHANGES_CLOSE_SETTING, CHANGES_CLOSE_SERVER_ERROR, CHANGES_CLOSE_GOING_AWAY, SYNC_CLOSE_GOING_AWAY } from './chunk-F6F4G322.mjs';
7
- import { syncServingSourceOf, changesServingSourceOf, writeBlockLookupOf, indexReadsOf, validateBackupName, readRestorePlacement } from './chunk-3Y3QYL6Q.mjs';
8
- import { isRecord, validateIndexName } from './chunk-VPOPC7JA.mjs';
9
- import './chunk-UP5TJ3II.mjs';
10
- import { engineChangeSource, createSemaphore, createByteBudget, changesNotEnabled, subscriberMessageOf, ChangeCursor, changePositionList, seqNosByPartition } from './chunk-AH5J62FF.mjs';
7
+ import { syncServingSourceOf, changesServingSourceOf, writeBlockLookupOf, indexReadsOf, validateBackupName, readRestorePlacement } from './chunk-JYIH6G2H.mjs';
8
+ import { isRecord, validateIndexName } from './chunk-23UYFZXF.mjs';
9
+ import './chunk-2TWR6YCG.mjs';
10
+ import { engineChangeSource, createSemaphore, createByteBudget, changesNotEnabled, subscriberMessageOf, ChangeCursor, changePositionList, seqNosByPartition } from './chunk-TQ5EEJEO.mjs';
11
11
  import './chunk-M2Z5WVWW.mjs';
12
- import { DEFAULT_MAX_FEED_BUFFERED_BYTES, DEFAULT_MAX_FEED_CATCH_UPS, DEFAULT_MAX_FEED_CONNECTIONS, DEFAULT_FEED_WINDOW_BYTES, estimatedArchiveBytes, TIMER_DELAY_LIMIT_MS, FEED_HEAD_RETRY_MS, ENTRIES_MESSAGE_LIMIT_BYTES } from './chunk-VSLFZDVA.mjs';
12
+ import { DEFAULT_MAX_FEED_BUFFERED_BYTES, DEFAULT_MAX_FEED_CATCH_UPS, DEFAULT_MAX_FEED_CONNECTIONS, DEFAULT_FEED_WINDOW_BYTES, estimatedArchiveBytes, TIMER_DELAY_LIMIT_MS, FEED_HEAD_RETRY_MS, ENTRIES_MESSAGE_LIMIT_BYTES } from './chunk-NTO2EMWZ.mjs';
13
13
  import './chunk-JDDXV6UF.mjs';
14
- import { manifestFileRefs } from './chunk-5WN5TOPY.mjs';
14
+ import { manifestFileRefs } from './chunk-FIMLVUHE.mjs';
15
15
  import './chunk-MSIN4NM3.mjs';
16
16
  import { encode as encode$1 } from './chunk-S5QMWECL.mjs';
17
17
  import './chunk-LNGE7SLY.mjs';
18
18
  import './chunk-R2PJKSNL.mjs';
19
- import './chunk-RWJQ3XU7.mjs';
20
- import './chunk-KDLH3BWY.mjs';
19
+ import './chunk-23WLACOL.mjs';
20
+ import './chunk-V6H3ZFC3.mjs';
21
21
  import './chunk-KBU3ZFJN.mjs';
22
22
  import './chunk-V6EUBAIT.mjs';
23
- import './chunk-ZVJPJZIP.mjs';
24
- import { querySuggestions } from './chunk-KRCP4W26.mjs';
23
+ import './chunk-SUFAI37B.mjs';
24
+ import { querySuggestions } from './chunk-QRKC25IO.mjs';
25
25
  import './chunk-S2POFTLN.mjs';
26
- import { rerankWindowCapOf, engineCoreOf, readMemoryFigures, listenForSyncChanges, MAX_RERANK_WINDOW, bindQuerySignal, clearQuerySignal, providedDocId, loadRerankRuntime, rulesOfStoredSynonyms } from './chunk-I2FKNCDS.mjs';
26
+ import { rerankWindowCapOf, engineCoreOf, readMemoryFigures, listenForSyncChanges, MAX_RERANK_WINDOW, bindQuerySignal, clearQuerySignal, providedDocId, loadRerankRuntime, rulesOfStoredSynonyms } from './chunk-K2KNE7W2.mjs';
27
27
  import './chunk-2CKDCC65.mjs';
28
28
  import './chunk-AOYQTX6W.mjs';
29
29
  import { decode } from './chunk-GXCDWLQI.mjs';
@@ -1,34 +1,34 @@
1
- import { scheduleSyncRetention, createDirectoryWatch, unrefInterval, LOG_READ_CHUNK_BYTES } from './chunk-KYVJPISW.mjs';
2
- export { scheduleSyncRetention, startSyncRetentionSweep } from './chunk-KYVJPISW.mjs';
3
- import { buildArchiveFromMemory, indexMetadataOf, archiveStream, createByteReader, documentExportStream, requireRestoreMemory, memoryCheckpointStore, admitDurableWrite, metadataConfigOf, durableMetadataConfigOf, unpackIndexSnapshotEnvelope, nestedSchemaOf, earlierSnapshotFootprint, writeArchiveFile, storedBytesOfSegments, archiveFootprint, loadSegmentedCheckpoint, createIndexLoads, closePartitionWriter, switchInTurn, writeMetadataEnvelope, listPersistedIndexes, removeLeftoverRewriteFiles, requireSavedPartitionCount, createDetachedIndex, requireCheckpointLayout, holdScheduledCheckpoint, checkpointInTurn, deserializePayloadV1, SINGLE_NODE_PRIMARY_TERM, readCurrentManifest, drainIndexStateForUnload, readSegmentManifest, readMetadataEnvelope, snapshotCheckpointFor, whileGraphsStayComplete, captureAppliedPrefix, createSeqOwner, loadMetadata, reclaimUnlistedKeys, writeLiveVectors, dropStoredVectorValues, requiresLayoutCheckpoint, transitionKey, readTransition, invalidTransition, unpackEnvelopeBytes, replayWal, sanitizeSurfaceForms, patternIndexesFromWire, replayWalUpTo, createRebalancer, highestPartitionIdOf, growPartitionsTo, createMarkerWriter, metadataFromConfig, metadataPartitionCount } from './chunk-OICMFLQF.mjs';
4
- export { DOCUMENT_EXPORT_FORMAT, DOCUMENT_EXPORT_VERSION, abandonAnalysisChange, adoptSavedAnalysis, buildHeldAnalysisChange, changeIndexAnalysis, changesOf, createByteReader, documentExportStream, dropHeldAnalysisChange, executeRebalance, followIndexChanges, heldAnalysisIsBuilt, holdsNamedSettings, openFileVectorReads, pagedPartitionLines, readDocumentExport, releaseHeldAnalysisChange, requireSavedPartitionCount, resumeAnalysisChange, stampAnalysisGeneration, startReadingOpeningSectionsAhead, targetOfPending, transitionWalLayout, updateChangesOf } from './chunk-OICMFLQF.mjs';
5
- import { readVectorFile, readGraphParts, VECTOR_FILE_ENVELOPE_VERSION } from './chunk-DKTRJCPP.mjs';
6
- export { loadFilesByParts, openColdVectorField, waitBeforeColdLoad } from './chunk-DKTRJCPP.mjs';
7
- import { MAX_SNAPSHOT_ANALYSIS_ATTEMPTS, encodeIndexConfiguration, indexConfigurationOf, updateIndexSync, decodeIndexConfiguration } from './chunk-AH5J62FF.mjs';
8
- export { decodeIndexConfiguration, encodeIndexConfiguration, holdRenewedSyncEpoch, indexConfigurationOf, persistEpochStates, requireNoQuerySuggestions, requireSyncSetting, syncStorageOf, updateIndexSync } from './chunk-AH5J62FF.mjs';
1
+ import { scheduleSyncRetention, createDirectoryWatch, unrefInterval, LOG_READ_CHUNK_BYTES } from './chunk-IC6LWK2D.mjs';
2
+ export { scheduleSyncRetention, startSyncRetentionSweep } from './chunk-IC6LWK2D.mjs';
3
+ import { buildArchiveFromMemory, indexMetadataOf, archiveStream, createByteReader, documentExportStream, requireRestoreMemory, memoryCheckpointStore, admitDurableWrite, metadataConfigOf, durableMetadataConfigOf, unpackIndexSnapshotEnvelope, nestedSchemaOf, earlierSnapshotFootprint, writeArchiveFile, storedBytesOfSegments, archiveFootprint, loadSegmentedCheckpoint, createIndexLoads, closePartitionWriter, switchInTurn, writeMetadataEnvelope, listPersistedIndexes, removeLeftoverRewriteFiles, requireSavedPartitionCount, createDetachedIndex, requireCheckpointLayout, holdScheduledCheckpoint, checkpointInTurn, deserializePayloadV1, SINGLE_NODE_PRIMARY_TERM, readCurrentManifest, drainIndexStateForUnload, readSegmentManifest, readMetadataEnvelope, snapshotCheckpointFor, whileGraphsStayComplete, captureAppliedPrefix, createSeqOwner, loadMetadata, reclaimUnlistedKeys, writeLiveVectors, dropStoredVectorValues, requiresLayoutCheckpoint, transitionKey, readTransition, invalidTransition, unpackEnvelopeBytes, replayWal, sanitizeSurfaceForms, patternIndexesFromWire, replayWalUpTo, createRebalancer, highestPartitionIdOf, growPartitionsTo, createMarkerWriter, metadataFromConfig, metadataPartitionCount } from './chunk-3CRBNUPW.mjs';
4
+ export { DOCUMENT_EXPORT_FORMAT, DOCUMENT_EXPORT_VERSION, abandonAnalysisChange, adoptSavedAnalysis, buildHeldAnalysisChange, changeIndexAnalysis, changesOf, createByteReader, documentExportStream, dropHeldAnalysisChange, executeRebalance, followIndexChanges, heldAnalysisIsBuilt, holdsNamedSettings, openFileVectorReads, pagedPartitionLines, readDocumentExport, releaseHeldAnalysisChange, requireSavedPartitionCount, resumeAnalysisChange, stampAnalysisGeneration, startReadingOpeningSectionsAhead, targetOfPending, transitionWalLayout, updateChangesOf } from './chunk-3CRBNUPW.mjs';
5
+ import { readVectorFile, readGraphParts, VECTOR_FILE_ENVELOPE_VERSION } from './chunk-V76B76ML.mjs';
6
+ export { loadFilesByParts, openColdVectorField, waitBeforeColdLoad } from './chunk-V76B76ML.mjs';
7
+ import { MAX_SNAPSHOT_ANALYSIS_ATTEMPTS, encodeIndexConfiguration, indexConfigurationOf, updateIndexSync, decodeIndexConfiguration } from './chunk-TQ5EEJEO.mjs';
8
+ export { decodeIndexConfiguration, encodeIndexConfiguration, holdRenewedSyncEpoch, indexConfigurationOf, persistEpochStates, requireNoQuerySuggestions, requireSyncSetting, syncStorageOf, updateIndexSync } from './chunk-TQ5EEJEO.mjs';
9
9
  import { restoredConfigFields, restoredEmbedding, rejectSnapshot } from './chunk-M2Z5WVWW.mjs';
10
- import { readSnapshotArchive, decodeSegmentManifest, isRecord, invalidManifest, isId, isUint32, isSequenceNumber } from './chunk-VSLFZDVA.mjs';
11
- export { readSnapshotArchive } from './chunk-VSLFZDVA.mjs';
10
+ import { readSnapshotArchive, decodeSegmentManifest, isRecord, invalidManifest, isId, isUint32, isSequenceNumber } from './chunk-NTO2EMWZ.mjs';
11
+ export { readSnapshotArchive } from './chunk-NTO2EMWZ.mjs';
12
12
  import { createDurableDirectory } from './chunk-SCZI7COG.mjs';
13
- import { isPagedSegmentFile, openPagedSnapshot, pagedListingOf, createPagedFrozenSegment, writePagedSegment, bytesThatSegmentsHoldInMemory, savedBytesOfManifest, checkPagedSegmentFully, readSegmentFile, NOTHING_SAVED, SEGMENT_HEADER_SIZE, checkpointLastSeqNo, partitionContentsOf, writeCheckpointSegments, commitCheckpointManifest, checkpointGarbage, removeCheckpointGarbage, nextSegmentKey, rewrittenHeaderKey, checkSegmentHeader, RECORD_LENGTH_SIZE, MAX_WAL_RECORD_BYTES, FRAME_CRC_SIZE, decodeWalEntry, readCommitMarker, captureWholePartition, frameRecord, checkpointPrimaryTerm, openPagedSegmentScan, countsAsLatestHolder, segmentKey, WAL_FORMAT_VERSION_WITH_PREVIOUS_DOCUMENT, SEGMENT_TAIL_PATTERN, writeSegmentHeader, WAL_FORMAT_VERSION, parseSegmentStartSeqNo, readWalSegments, buildEntry } from './chunk-5SLAXEVJ.mjs';
14
- export { bytesThatSegmentsHoldInMemory, checkPagedContents, checkPagedSegmentFully, checkPagedSelections, countsAsLatestHolder, createPagedFrozenSegment, isPagedSegmentFile, mergePagedWindow, openPagedSegmentScan, openPagedSnapshot, pagedListingOf, pagedTombstonesFor, writePagedSegment } from './chunk-5SLAXEVJ.mjs';
15
- import { REWRITE_SPILL_BYTES, TOMBSTONES_BETWEEN_YIELDS, encodeSegmentManifest, adapterCheckpointStore, directoryCheckpointStore, readListedFile } from './chunk-P3JMBYEG.mjs';
13
+ import { isPagedSegmentFile, openPagedSnapshot, pagedListingOf, createPagedFrozenSegment, writePagedSegment, bytesThatSegmentsHoldInMemory, savedBytesOfManifest, checkPagedSegmentFully, readSegmentFile, NOTHING_SAVED, SEGMENT_HEADER_SIZE, checkpointLastSeqNo, partitionContentsOf, writeCheckpointSegments, commitCheckpointManifest, checkpointGarbage, removeCheckpointGarbage, nextSegmentKey, rewrittenHeaderKey, checkSegmentHeader, RECORD_LENGTH_SIZE, MAX_WAL_RECORD_BYTES, FRAME_CRC_SIZE, decodeWalEntry, readCommitMarker, captureWholePartition, frameRecord, checkpointPrimaryTerm, openPagedSegmentScan, countsAsLatestHolder, segmentKey, WAL_FORMAT_VERSION_WITH_PREVIOUS_DOCUMENT, SEGMENT_TAIL_PATTERN, writeSegmentHeader, WAL_FORMAT_VERSION, parseSegmentStartSeqNo, readWalSegments, joinFrames, buildEntry } from './chunk-2WKZM3FS.mjs';
14
+ export { bytesThatSegmentsHoldInMemory, checkPagedContents, checkPagedSegmentFully, checkPagedSelections, countsAsLatestHolder, createPagedFrozenSegment, isPagedSegmentFile, mergePagedWindow, openPagedSegmentScan, openPagedSnapshot, pagedListingOf, pagedTombstonesFor, writePagedSegment } from './chunk-2WKZM3FS.mjs';
15
+ import { REWRITE_SPILL_BYTES, TOMBSTONES_BETWEEN_YIELDS, encodeSegmentManifest, adapterCheckpointStore, directoryCheckpointStore, readListedFile } from './chunk-V24XTYHX.mjs';
16
16
  import './chunk-5FLRXF73.mjs';
17
17
  import './chunk-JDDXV6UF.mjs';
18
- import { manifestKey, manifestFileRefs, manifestReferencedKeys, manifestWithinPartitionCount, snapshotBundleKey, MAX_SEGMENTS_PER_PARTITION } from './chunk-5WN5TOPY.mjs';
18
+ import { manifestKey, manifestFileRefs, manifestReferencedKeys, manifestWithinPartitionCount, snapshotBundleKey, MAX_SEGMENTS_PER_PARTITION } from './chunk-FIMLVUHE.mjs';
19
19
  import { getFs } from './chunk-HLPRHOSO.mjs';
20
20
  import { DEFAULT_SEGMENT_MAX_BYTES, DEFAULT_CHECKPOINT_INTERVAL_MS, DEFAULT_CHECKPOINT_MUTATION_THRESHOLD, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_REWRITE_BYTES_PER_CHECKPOINT, DEFAULT_ASYNC_FLUSH_INTERVAL_MS, WRITES_STALL_ABOVE_UNCHECKPOINTED_BYTES, 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-MSIN4NM3.mjs';
21
21
  import { encode } from './chunk-S5QMWECL.mjs';
22
22
  export { bindStorageHost } from './chunk-S5QMWECL.mjs';
23
23
  import { sha256 } from './chunk-LNGE7SLY.mjs';
24
24
  import { setNestedValue } from './chunk-R2PJKSNL.mjs';
25
- import { rewriteSpillOf } from './chunk-RWJQ3XU7.mjs';
26
- import { deserializePartition } from './chunk-KDLH3BWY.mjs';
25
+ import { rewriteSpillOf } from './chunk-23WLACOL.mjs';
26
+ import { deserializePartition } from './chunk-V6H3ZFC3.mjs';
27
27
  import { decodeVectorIndexParts, bytesToVectors, VECTOR_FILE_MAX_VECTORS, deadBytesFor, countDead, decodeVectorFilePayload, graphPartsOfEarlierPayload, decodeVectorGraphPayload } from './chunk-KBU3ZFJN.mjs';
28
28
  export { createHNSWIndex, osqBitsOf } from './chunk-KBU3ZFJN.mjs';
29
29
  import { oneSyncChangeAtATime } from './chunk-V6EUBAIT.mjs';
30
- import { hasNrslMagic, HEADER_SIZE, readHeader, storedStateOf, attachedRuntimeOf, historyFilesOf, listHistoryFolder, historyFileOf, QUERY_HISTORY_ARCHIVE_PREFIX, QUERY_HISTORY_FOLDER, openChecksummedEnvelope, crc32, packChecksummedEnvelope } from './chunk-ZVJPJZIP.mjs';
31
- import { isCompositePartition, generateId, mergePartitionStats, resolvePartitionInsertOptions, createPartitionIndex, createCompositePartition, ARRAY_POSITION_GAP, fnv1a, freezeSegmentShared, createFrozenSegment, createSharedFrozenSegment, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateRequiredFieldsInSchema, resolveIndexAnalysis, validateEmbeddingConfig, storedArrayPositionGap, emitSyncChange, toError, prepareStoredSynonyms, loadSchemaCodeFor, decodeEveryStoredDocument, arrayPositionsAreStale, insertDocumentVectors, createPartitionRouter, buildSegmentPayloads, createRequestId } from './chunk-I2FKNCDS.mjs';
30
+ import { hasNrslMagic, HEADER_SIZE, readHeader, storedStateOf, attachedRuntimeOf, historyFilesOf, listHistoryFolder, historyFileOf, QUERY_HISTORY_ARCHIVE_PREFIX, QUERY_HISTORY_FOLDER, openChecksummedEnvelope, crc32, packChecksummedEnvelope } from './chunk-SUFAI37B.mjs';
31
+ import { isCompositePartition, generateId, mergePartitionStats, resolvePartitionInsertOptions, createPartitionIndex, createCompositePartition, ARRAY_POSITION_GAP, fnv1a, freezeSegmentShared, createFrozenSegment, createSharedFrozenSegment, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateRequiredFieldsInSchema, resolveIndexAnalysis, validateEmbeddingConfig, storedArrayPositionGap, emitSyncChange, toError, prepareStoredSynonyms, loadSchemaCodeFor, decodeEveryStoredDocument, arrayPositionsAreStale, insertDocumentVectors, createPartitionRouter, buildSegmentPayloads, createRequestId } from './chunk-K2KNE7W2.mjs';
32
32
  import { encodeDocument } from './chunk-2CKDCC65.mjs';
33
33
  import './chunk-AOYQTX6W.mjs';
34
34
  import { decode } from './chunk-GXCDWLQI.mjs';
@@ -3414,6 +3414,8 @@ function createWalWriter(directory, config) {
3414
3414
  let highestDurableSeqNo = 0;
3415
3415
  let markerWriter = null;
3416
3416
  let durabilityLock = Promise.resolve();
3417
+ let synced = null;
3418
+ let failure = null;
3417
3419
  const coordinator = createGroupCommitCoordinator(() => withDurabilityLock(flushActiveSegment));
3418
3420
  function withDurabilityLock(fn) {
3419
3421
  const result = durabilityLock.then(fn);
@@ -3436,18 +3438,37 @@ function createWalWriter(directory, config) {
3436
3438
  }
3437
3439
  return markerWriter;
3438
3440
  }
3441
+ function latchFailure(err) {
3442
+ if (failure === null) {
3443
+ failure = { error: err };
3444
+ }
3445
+ return failure.error;
3446
+ }
3439
3447
  async function flushActiveSegment() {
3440
- if (handle === null) {
3448
+ if (failure !== null) {
3449
+ throw failure.error;
3450
+ }
3451
+ const flushing = handle;
3452
+ if (flushing === null) {
3441
3453
  return;
3442
3454
  }
3443
- const writer = await getMarkerWriter();
3444
3455
  const durableByteLength = activeBytes;
3445
3456
  const activeSegmentSeqNo = activeStartSeqNo;
3446
- const durableSeqNo = Math.max(highestAppendedSeqNo, highestDurableSeqNo);
3447
- await handle.sync();
3448
- await writer.commit({ activeSegmentSeqNo, durableByteLength, highestDurableSeqNo: durableSeqNo });
3449
- if (durableSeqNo > highestDurableSeqNo) {
3450
- highestDurableSeqNo = durableSeqNo;
3457
+ const appendedSeqNo = highestAppendedSeqNo;
3458
+ if (synced !== null && synced.startSeqNo === activeSegmentSeqNo && synced.bytes === durableByteLength) {
3459
+ return;
3460
+ }
3461
+ try {
3462
+ const writer = await getMarkerWriter();
3463
+ const durableSeqNo = Math.max(appendedSeqNo, highestDurableSeqNo);
3464
+ await flushing.sync();
3465
+ await writer.commit({ activeSegmentSeqNo, durableByteLength, highestDurableSeqNo: durableSeqNo });
3466
+ if (durableSeqNo > highestDurableSeqNo) {
3467
+ highestDurableSeqNo = durableSeqNo;
3468
+ }
3469
+ synced = { startSeqNo: activeSegmentSeqNo, bytes: durableByteLength };
3470
+ } catch (err) {
3471
+ throw latchFailure(err);
3451
3472
  }
3452
3473
  }
3453
3474
  function formatVersionFor(holdsPreviousDocument) {
@@ -3550,22 +3571,30 @@ function createWalWriter(directory, config) {
3550
3571
  }
3551
3572
  }
3552
3573
  async function swapToPreparedSegment(sealed) {
3553
- const writer = await getMarkerWriter();
3554
- const startSeqNo = highestAppendedSeqNo + 1;
3555
- const durableSeqNo = Math.max(highestAppendedSeqNo, highestDurableSeqNo);
3556
- const key = segmentKey(config.indexName, config.partitionId, startSeqNo);
3557
- await Promise.all([sealed.sync(), directory.move(preparedKey, key)]);
3558
- handle = await directory.appendHandle(key);
3559
- activeKey = key;
3560
- activeStartSeqNo = startSeqNo;
3561
- activeBytes = SEGMENT_HEADER_SIZE;
3562
- activeFormatVersion = preparedFormatVersion;
3563
- await writer.commit({
3564
- activeSegmentSeqNo: startSeqNo,
3565
- durableByteLength: SEGMENT_HEADER_SIZE,
3566
- highestDurableSeqNo: durableSeqNo
3567
- });
3568
- highestDurableSeqNo = durableSeqNo;
3574
+ if (failure !== null) {
3575
+ throw failure.error;
3576
+ }
3577
+ try {
3578
+ const writer = await getMarkerWriter();
3579
+ const startSeqNo = highestAppendedSeqNo + 1;
3580
+ const durableSeqNo = Math.max(highestAppendedSeqNo, highestDurableSeqNo);
3581
+ const key = segmentKey(config.indexName, config.partitionId, startSeqNo);
3582
+ await Promise.all([sealed.sync(), directory.move(preparedKey, key)]);
3583
+ handle = await directory.appendHandle(key);
3584
+ activeKey = key;
3585
+ activeStartSeqNo = startSeqNo;
3586
+ activeBytes = SEGMENT_HEADER_SIZE;
3587
+ activeFormatVersion = preparedFormatVersion;
3588
+ await writer.commit({
3589
+ activeSegmentSeqNo: startSeqNo,
3590
+ durableByteLength: SEGMENT_HEADER_SIZE,
3591
+ highestDurableSeqNo: durableSeqNo
3592
+ });
3593
+ highestDurableSeqNo = durableSeqNo;
3594
+ synced = { startSeqNo, bytes: SEGMENT_HEADER_SIZE };
3595
+ } catch (err) {
3596
+ throw latchFailure(err);
3597
+ }
3569
3598
  await sealed.close();
3570
3599
  }
3571
3600
  async function maybeRoll(nextSeqNo, appendedBytes, holdsPreviousDocument) {
@@ -3576,22 +3605,6 @@ function createWalWriter(directory, config) {
3576
3605
  await withDurabilityLock(() => rollUnderLock(nextSeqNo, formatVersionFor(holdsPreviousDocument)));
3577
3606
  }
3578
3607
  }
3579
- function joinFrames(frames) {
3580
- if (frames.length === 1) {
3581
- return frames[0];
3582
- }
3583
- let totalBytes = 0;
3584
- for (const frame of frames) {
3585
- totalBytes += frame.length;
3586
- }
3587
- const joined = new Uint8Array(totalBytes);
3588
- let offset = 0;
3589
- for (const frame of frames) {
3590
- joined.set(frame, offset);
3591
- offset += frame.length;
3592
- }
3593
- return joined;
3594
- }
3595
3608
  function framesThatFit(frames, start) {
3596
3609
  const room = segmentMaxBytes - activeBytes;
3597
3610
  let end = start + 1;
@@ -1,7 +1,7 @@
1
- export { DayStore, RestoredHistory, clearLeftoversOfName, dayOf, installSuggestionHooks, openCountsFile, sameBytes, startQuerySuggestions } from './chunk-Y3T4HQGT.mjs';
1
+ export { DayStore, RestoredHistory, clearLeftoversOfName, dayOf, installSuggestionHooks, openCountsFile, sameBytes, startQuerySuggestions } from './chunk-7BCL5QK5.mjs';
2
2
  export { oneSyncChangeAtATime } from './chunk-V6EUBAIT.mjs';
3
- export { BUILD_LIST_PAGE, BUILD_WRITE_BATCH, BYTES_PER_MIB, DAY_MS, DEFAULT_PREVIEW_LIMIT, HEADER_SIZE, HISTORY_SWEEP_INTERVAL_MS, KEY_FINGERPRINT_BYTES, KEY_FINGERPRINT_LABEL, MAX_HISTORY_FILE_BYTES, MAX_MANUAL_SUGGESTION_COUNT, MAX_PREVIEW_LIMIT, MAX_SOURCE_INDEX_NAME_LENGTH, MAX_TIMER_DELAY_MS, MIN_KEY_BYTES, MS_PER_SECOND, QUERY_HISTORY_ARCHIVE_PREFIX, QUERY_HISTORY_FOLDER, SCHEDULE_OFF, SCRAMBLED_ID_BYTES, acceptedPhrase, attachRuntime, attachedRuntimeOf, banListFromInput, bindSuggestionStoreHost, buildRecordKey, checksumOfChunks, crc32, crc32Final, crc32Init, crc32Update, engineVersionParts, hasNrslMagic, historyFileOf, historyFilesOf, invalidSetting, isGroup, isPerson, latestMatchAtOrBefore, listHistoryFolder, nextMatchAfter, normaliseBan, openChecksummedEnvelope, packChecksummedEnvelope, packEnvelopeWithChecksum, parseSchedule, readHeader, removeHistoryFolder, removeRestoreLeftovers, requireFieldsInSchema, requireWithinFileLimit, resolveSetting, storedStateFromWire, storedStateOf, storedStateToWire, unionOfBans, validateSetting, withState, writeHeader } from './chunk-ZVJPJZIP.mjs';
4
- import './chunk-I2FKNCDS.mjs';
3
+ export { BUILD_LIST_PAGE, BUILD_WRITE_BATCH, BYTES_PER_MIB, DAY_MS, DEFAULT_PREVIEW_LIMIT, HEADER_SIZE, HISTORY_SWEEP_INTERVAL_MS, KEY_FINGERPRINT_BYTES, KEY_FINGERPRINT_LABEL, MAX_HISTORY_FILE_BYTES, MAX_MANUAL_SUGGESTION_COUNT, MAX_PREVIEW_LIMIT, MAX_SOURCE_INDEX_NAME_LENGTH, MAX_TIMER_DELAY_MS, MIN_KEY_BYTES, MS_PER_SECOND, QUERY_HISTORY_ARCHIVE_PREFIX, QUERY_HISTORY_FOLDER, SCHEDULE_OFF, SCRAMBLED_ID_BYTES, acceptedPhrase, attachRuntime, attachedRuntimeOf, banListFromInput, bindSuggestionStoreHost, buildRecordKey, checksumOfChunks, crc32, crc32Final, crc32Init, crc32Update, engineVersionParts, hasNrslMagic, historyFileOf, historyFilesOf, invalidSetting, isGroup, isPerson, latestMatchAtOrBefore, listHistoryFolder, nextMatchAfter, normaliseBan, openChecksummedEnvelope, packChecksummedEnvelope, packEnvelopeWithChecksum, parseSchedule, readHeader, removeHistoryFolder, removeRestoreLeftovers, requireFieldsInSchema, requireWithinFileLimit, resolveSetting, storedStateFromWire, storedStateOf, storedStateToWire, unionOfBans, validateSetting, withState, writeHeader } from './chunk-SUFAI37B.mjs';
4
+ import './chunk-K2KNE7W2.mjs';
5
5
  import './chunk-2CKDCC65.mjs';
6
6
  import './chunk-AOYQTX6W.mjs';
7
7
  import './chunk-GXCDWLQI.mjs';
@@ -1,9 +1,9 @@
1
- import { querySuggestionsOf, keyBytesOf, createQuerySuggestionsRuntime, createLocalHost } from './chunk-QIMI4O6R.mjs';
2
- export { bindSuggestionsHost } from './chunk-DU5HRFLQ.mjs';
3
- import { installSuggestionHooks } from './chunk-Y3T4HQGT.mjs';
1
+ import { querySuggestionsOf, keyBytesOf, createQuerySuggestionsRuntime, createLocalHost } from './chunk-D2H5RN3Q.mjs';
2
+ export { bindSuggestionsHost } from './chunk-DEKP2BZO.mjs';
3
+ import { installSuggestionHooks } from './chunk-7BCL5QK5.mjs';
4
4
  import './chunk-V6EUBAIT.mjs';
5
- import { attachedRuntimeOf, attachRuntime } from './chunk-ZVJPJZIP.mjs';
6
- import './chunk-I2FKNCDS.mjs';
5
+ import { attachedRuntimeOf, attachRuntime } from './chunk-SUFAI37B.mjs';
6
+ import './chunk-K2KNE7W2.mjs';
7
7
  import './chunk-2CKDCC65.mjs';
8
8
  import './chunk-AOYQTX6W.mjs';
9
9
  import './chunk-GXCDWLQI.mjs';
@@ -6,12 +6,12 @@ import '../chunk-MSIN4NM3.mjs';
6
6
  import '../chunk-S5QMWECL.mjs';
7
7
  import '../chunk-LNGE7SLY.mjs';
8
8
  import '../chunk-R2PJKSNL.mjs';
9
- import '../chunk-RWJQ3XU7.mjs';
10
- import '../chunk-KDLH3BWY.mjs';
9
+ import '../chunk-23WLACOL.mjs';
10
+ import '../chunk-V6H3ZFC3.mjs';
11
11
  import '../chunk-KBU3ZFJN.mjs';
12
12
  import '../chunk-V6EUBAIT.mjs';
13
- import { crc32 } from '../chunk-ZVJPJZIP.mjs';
14
- import '../chunk-I2FKNCDS.mjs';
13
+ import { crc32 } from '../chunk-SUFAI37B.mjs';
14
+ import '../chunk-K2KNE7W2.mjs';
15
15
  import '../chunk-2CKDCC65.mjs';
16
16
  import '../chunk-AOYQTX6W.mjs';
17
17
  import '../chunk-GXCDWLQI.mjs';
@@ -1,5 +1,5 @@
1
1
  import { createSerial, KEPT_ENTRY_FLUSH_IDLE_MS, KEPT_ENTRY_OVERHEAD_BYTES, DEFAULT_REPLAY_LIMIT_OF_SNAPSHOT, BACKOFF_DOUBLINGS_LIMIT, KEPT_ENTRY_FLUSH_BYTES, UPLOAD_BATCH_WRITES, RETRY_MAX_DELAY_MS, UPLOAD_RETRY_DELAY_MS, DOWNLOAD_SAVE_BYTES, SNAPSHOT_MEMORY_PER_ARCHIVE_BYTE, SNAPSHOT_RETRY_DELAY_MS, RECONNECT_MIN_DELAY_MS } from './browser/chunk-WC2DEXWU.mjs';
2
- import { hasLanguage, hasTokenizer, hasStopWords, readHeapStatistics, loadStorageCode, getLanguage } from './browser/chunk-UHJHOEMY.mjs';
2
+ import { hasLanguage, hasTokenizer, hasStopWords, readHeapStatistics, loadStorageCode, getLanguage } from './browser/chunk-YKHBTLYW.mjs';
3
3
  import './browser/chunk-QAOVAYAG.mjs';
4
4
  import { isSyncEpoch } from './browser/chunk-YJHGOJAC.mjs';
5
5
  import { createNarsilClient } from './browser/chunk-4E5APHTM.mjs';
package/dist/sync.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SYNC_CLOSE_RESYNC, SYNC_CLOSE_CREDENTIAL_EXPIRED, encodeJson, SYNC_SUBPROTOCOL, CHANGES_SUBPROTOCOL, decodeScore } from './chunk-F6F4G322.mjs';
2
2
  import { createSerial, KEPT_ENTRY_FLUSH_IDLE_MS, KEPT_ENTRY_OVERHEAD_BYTES, DEFAULT_REPLAY_LIMIT_OF_SNAPSHOT, BACKOFF_DOUBLINGS_LIMIT, KEPT_ENTRY_FLUSH_BYTES, UPLOAD_BATCH_WRITES, RETRY_MAX_DELAY_MS, UPLOAD_RETRY_DELAY_MS, DOWNLOAD_SAVE_BYTES, SNAPSHOT_MEMORY_PER_ARCHIVE_BYTE, SNAPSHOT_RETRY_DELAY_MS, RECONNECT_MIN_DELAY_MS } from './chunk-6MSZ543Y.mjs';
3
- import { hasLanguage, hasTokenizer, hasStopWords, readHeapStatistics, loadStorageCode, getLanguage } from './chunk-I2FKNCDS.mjs';
3
+ import { hasLanguage, hasTokenizer, hasStopWords, readHeapStatistics, loadStorageCode, getLanguage } from './chunk-K2KNE7W2.mjs';
4
4
  import './chunk-2CKDCC65.mjs';
5
5
  import './chunk-AOYQTX6W.mjs';
6
6
  import './chunk-GXCDWLQI.mjs';