@delali/narsil 0.3.1-next.104 → 0.3.1-next.107

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 (64) hide show
  1. package/dist/browser/{chunk-PW7GJFPW.mjs → chunk-JJKVYLL3.mjs} +2 -1
  2. package/dist/browser/{chunk-ECSLQ3S5.mjs → chunk-NNQPZPTB.mjs} +4 -4
  3. package/dist/browser/{chunk-6E4SWUYZ.mjs → chunk-OKZGAJEF.mjs} +110 -9
  4. package/dist/browser/{chunk-SFXM7PLV.mjs → chunk-OL7S2KLL.mjs} +1 -1
  5. package/dist/browser/{chunk-CWWD2UHP.mjs → chunk-PA56PRWX.mjs} +1 -1
  6. package/dist/browser/{chunk-5YMT23EX.mjs → chunk-WZUSMF7A.mjs} +7 -7
  7. package/dist/browser/{durability-wiring-HTBWDAOX.mjs → durability-wiring-HFQULBSA.mjs} +5 -5
  8. package/dist/browser/{module-6FVNK7DO.mjs → module-VROKZ7IZ.mjs} +19 -15
  9. package/dist/browser/{restore-queue-CL43WZTZ.mjs → restore-queue-EU77FRCV.mjs} +1 -1
  10. package/dist/browser/{snapshot-NL4GSDUD.mjs → snapshot-G77LQBZX.mjs} +6 -6
  11. package/dist/browser/{write-YFOOPLAN.mjs → write-RUC64JIH.mjs} +4 -4
  12. package/dist/{capabilities-DGaz7cb3.d.ts → capabilities-ByKPha_q.d.ts} +1 -1
  13. package/dist/{chunk-MKPE3VZF.mjs → chunk-3BRFOMGX.mjs} +1 -1
  14. package/dist/{chunk-LPQOEU5M.mjs → chunk-5FPMDU54.mjs} +38 -9
  15. package/dist/{chunk-35KEGAOS.mjs → chunk-7IBX2LRA.mjs} +6 -22
  16. package/dist/{chunk-PQHR5FHC.mjs → chunk-BRIOLMIX.mjs} +1 -1
  17. package/dist/{chunk-O372FZM4.mjs → chunk-CKNOGER5.mjs} +14 -14
  18. package/dist/{chunk-RWXFSGKJ.mjs → chunk-DNKM67DF.mjs} +2 -2
  19. package/dist/{chunk-XWJGJ2SE.mjs → chunk-FEOLYA2Y.mjs} +2 -2
  20. package/dist/{chunk-BLDJ5I6I.mjs → chunk-G6YATIRT.mjs} +112 -9
  21. package/dist/chunk-HAQUJYMN.mjs +344 -0
  22. package/dist/{chunk-47PZE6CJ.mjs → chunk-HNAQNAFS.mjs} +2 -2
  23. package/dist/{chunk-VFEALJEA.mjs → chunk-IA3H54X4.mjs} +1 -1
  24. package/dist/{chunk-KSQS77DK.mjs → chunk-IA6I5U36.mjs} +1 -1
  25. package/dist/{chunk-J2KRH2RJ.mjs → chunk-IZLM2OOO.mjs} +3 -3
  26. package/dist/{chunk-5W2ODPPO.mjs → chunk-KOCHOOS5.mjs} +175 -7
  27. package/dist/{chunk-DQ5NJSBZ.mjs → chunk-M5EZVXIM.mjs} +1 -1
  28. package/dist/{chunk-6GFVUXUH.mjs → chunk-NRARRUKN.mjs} +2 -2
  29. package/dist/{chunk-OIN27OQH.mjs → chunk-OKZPYJZX.mjs} +1 -1
  30. package/dist/{chunk-KNRU5CJ4.mjs → chunk-QA6F5MML.mjs} +5 -5
  31. package/dist/{chunk-WU4P5J4G.mjs → chunk-UM6Z7AIP.mjs} +3 -3
  32. package/dist/{chunk-PAWVKEVS.mjs → chunk-VHPVBJOI.mjs} +1 -1
  33. package/dist/{chunk-HMFNFVP7.mjs → chunk-VJS4JFBQ.mjs} +2 -1
  34. package/dist/{chunk-RFVUDM5E.mjs → chunk-VVDQNCOG.mjs} +2 -15
  35. package/dist/{chunk-3IQZYNW6.mjs → chunk-VVFKFHWE.mjs} +1 -1
  36. package/dist/{chunk-PFQQ3LCQ.mjs → chunk-VWFFCDOL.mjs} +5 -5
  37. package/dist/{chunk-IGUTV3MX.mjs → chunk-WCJJCBR4.mjs} +5 -5
  38. package/dist/{chunk-TDUBQ546.mjs → chunk-WXVTQ6NO.mjs} +1 -1
  39. package/dist/chunk-ZXZ26WSO.mjs +14 -0
  40. package/dist/client.d.ts +3 -3
  41. package/dist/{config-DWxtDsJ6.d.ts → config-BZ_e3X8w.d.ts} +6 -3
  42. package/dist/{direct-executor-5NX2ZIAG.mjs → direct-executor-BPBD2PBK.mjs} +8 -7
  43. package/dist/distribution/coordinator/etcd.d.ts +1 -1
  44. package/dist/distribution/coordinator/in-memory.d.ts +1 -1
  45. package/dist/distribution.d.ts +4 -4
  46. package/dist/distribution.mjs +92 -169
  47. package/dist/{durability-wiring-LD4GWPWD.mjs → durability-wiring-AZL4EFLO.mjs} +19 -18
  48. package/dist/{index-Bkdt8nDw.d.ts → index-Cl5qQauj.d.ts} +6 -1
  49. package/dist/index.browser.mjs +2 -2
  50. package/dist/index.mjs +12 -11
  51. package/dist/{module-QFWZ5OBF.mjs → module-6EY7GW2W.mjs} +23 -19
  52. package/dist/partial-words.mjs +3 -3
  53. package/dist/persistence/durability/checkpoint-worker.mjs +15 -14
  54. package/dist/{restore-queue-7QIKM6PY.mjs → restore-queue-DDXFDP7U.mjs} +1 -1
  55. package/dist/server.d.ts +4 -4
  56. package/dist/server.mjs +25 -12
  57. package/dist/{snapshot-JYTT36WI.mjs → snapshot-IDAM65JO.mjs} +21 -20
  58. package/dist/{thread-AHLISTRZ.mjs → thread-LMSYLCPI.mjs} +12 -10
  59. package/dist/vector/search-worker.d.ts +2 -0
  60. package/dist/vector/search-worker.mjs +4 -4
  61. package/dist/workers/entry.mjs +6 -5
  62. package/dist/{write-GPFM2EIX.mjs → write-3LIFIGOL.mjs} +14 -13
  63. package/package.json +7 -7
  64. package/dist/chunk-B7BSQZ27.mjs +0 -206
@@ -1,6 +1,6 @@
1
- import { readMetadataEnvelope } from './chunk-KNRU5CJ4.mjs';
2
- import { readWalSegments, durableRecordMissing, checkpointLastSeqNo, SEGMENT_HEADER_SIZE } from './chunk-IGUTV3MX.mjs';
3
- import { applyDeleteEntry, applyIndexEntry } from './chunk-J2KRH2RJ.mjs';
1
+ import { readMetadataEnvelope } from './chunk-QA6F5MML.mjs';
2
+ import { readWalSegments, durableRecordMissing, checkpointLastSeqNo, SEGMENT_HEADER_SIZE } from './chunk-WCJJCBR4.mjs';
3
+ import { applyDeleteEntry, applyIndexEntry } from './chunk-IZLM2OOO.mjs';
4
4
 
5
5
  // src/persistence/durability/recovery.ts
6
6
  async function listPersistedIndexes(directory) {
@@ -1,5 +1,5 @@
1
1
  import { osqRecordBytes } from './chunk-37CD3OKS.mjs';
2
- import { MAX_M, EARLIER_RELEASE_MIN_M, MIN_M } from './chunk-HMFNFVP7.mjs';
2
+ import { MAX_M, EARLIER_RELEASE_MIN_M, MIN_M } from './chunk-VJS4JFBQ.mjs';
3
3
  import { NarsilError, ErrorCodes } from './chunk-6JUOMMHQ.mjs';
4
4
 
5
5
  // src/vector/vector-index/dead-bits.ts
@@ -10,5 +10,6 @@ var FARTHEST_REJECTED_LINKS_KEPT = 1;
10
10
  var COMPACTION_TOMBSTONE_RATIO = 0.1;
11
11
  var COMPACTION_ABSOLUTE_THRESHOLD = 1e3;
12
12
  var DEFAULT_EF_SEARCH = 50;
13
+ var NEAREST_LINK_FALLBACK_HOSTS = 4;
13
14
 
14
- export { COMPACTION_ABSOLUTE_THRESHOLD, COMPACTION_TOMBSTONE_RATIO, DEFAULT_EF_SEARCH, EARLIER_RELEASE_MIN_M, FARTHEST_REJECTED_LINKS_KEPT, INITIAL_LIST_CAPACITY, INITIAL_UPPER_SLOTS, MAX_LAYER_CAP, MAX_M, MIN_M, PLACEMENT_ROOM_REQUESTS };
15
+ export { COMPACTION_ABSOLUTE_THRESHOLD, COMPACTION_TOMBSTONE_RATIO, DEFAULT_EF_SEARCH, EARLIER_RELEASE_MIN_M, FARTHEST_REJECTED_LINKS_KEPT, INITIAL_LIST_CAPACITY, INITIAL_UPPER_SLOTS, MAX_LAYER_CAP, MAX_M, MIN_M, NEAREST_LINK_FALLBACK_HOSTS, PLACEMENT_ROOM_REQUESTS };
@@ -1,21 +1,8 @@
1
+ import { IDLE_HEAP_CLEANUP_CHECK_MS, IDLE_HEAP_CLEANUP_MAX_UTILISATION, IDLE_HEAP_CLEANUP_MAX_GROWTH_BYTES, IDLE_HEAP_CLEANUP_QUIET_CHECKS, IDLE_HEAP_CLEANUP_MIN_RECLAIMABLE_BYTES } from './chunk-ZXZ26WSO.mjs';
1
2
  import { performance } from 'perf_hooks';
2
3
  import { setFlagsFromString, getHeapStatistics } from 'v8';
3
4
  import { runInNewContext } from 'vm';
4
5
 
5
- // src/runtime/idle-heap-cleanup.ts
6
-
7
- // src/runtime/constants.ts
8
- var IDLE_HEAP_CLEANUP_CHECK_MS = 1e3;
9
- var IDLE_HEAP_CLEANUP_QUIET_CHECKS = 2;
10
- var IDLE_HEAP_CLEANUP_MAX_UTILISATION = 0.1;
11
- var IDLE_HEAP_CLEANUP_MAX_GROWTH_BYTES = 4 * 1024 * 1024;
12
- var IDLE_HEAP_CLEANUP_MIN_RECLAIMABLE_BYTES = 64 * 1024 * 1024;
13
- var REFUSAL_COLLECTION_MIN_INTERVAL_MS = 1e3;
14
- var REFUSAL_COLLECTION_TIME_MULTIPLE = 10;
15
- var REFUSAL_YOUNG_COLLECTION_MIN_INTERVAL_MS = 10;
16
- var HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE = 0.75;
17
- var HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE = 0.65;
18
-
19
6
  // src/runtime/idle-heap-cleaner.ts
20
7
  function createIdleHeapCleaner(deps) {
21
8
  let quietChecks = 0;
@@ -108,4 +95,4 @@ function startIdleHeapCleanup() {
108
95
  return () => clearInterval(timer);
109
96
  }
110
97
 
111
- export { HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, REFUSAL_COLLECTION_MIN_INTERVAL_MS, REFUSAL_COLLECTION_TIME_MULTIPLE, REFUSAL_YOUNG_COLLECTION_MIN_INTERVAL_MS, collectAndReturnPages, collectYoungGeneration, startIdleHeapCleanup };
98
+ export { collectAndReturnPages, collectYoungGeneration, startIdleHeapCleanup };
@@ -1,5 +1,5 @@
1
1
  import { MAX_DOCUMENT_ENCODING_DEPTH, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, DOCUMENT_REPLY_ENVELOPE_DEPTH } from './chunk-U476IXKQ.mjs';
2
- import { EARLIER_RELEASE_MIN_M, MIN_M, MAX_M } from './chunk-HMFNFVP7.mjs';
2
+ import { EARLIER_RELEASE_MIN_M, MIN_M, MAX_M } from './chunk-VJS4JFBQ.mjs';
3
3
  import { isWordIndexedBase, parseFieldType } from './chunk-77SO7G55.mjs';
4
4
  import { compareCodePoints, holdsUnpairedSurrogate, exceedsCodePoints } from './chunk-YTJCGKM4.mjs';
5
5
  import { DEFAULT_PATTERN_VALUE_LIMIT, isPlainObject, MAX_TEXT_FIELDS, MAX_VECTOR_DIMENSION, MAX_DOCUMENT_BYTES, MAX_NESTING_DEPTH, PROTOTYPE_POLLUTION_KEYS, FIELD_NAME_PATTERN, RESERVED_ROOT_FIELDS, MAX_DOCUMENT_NESTING_DEPTH, VECTOR_PATTERN } from './chunk-L5ORED7V.mjs';
@@ -1,8 +1,8 @@
1
- import { vectorsPerFile } from './chunk-47PZE6CJ.mjs';
2
- import { writeLiveVectors, decodeSegmentManifest, openManifestPayload, listedKeysOf, decodeManifestPayload, SINGLE_NODE_PRIMARY_TERM } from './chunk-KNRU5CJ4.mjs';
3
- import { vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-PAWVKEVS.mjs';
4
- import { writeCheckpointSegments, DEFAULT_COMPACTION_THRESHOLD, commitCheckpointManifest, manifestKey, manifestFileRefs, partitionContentsOf } from './chunk-IGUTV3MX.mjs';
5
- import { HEADER_SIZE } from './chunk-O372FZM4.mjs';
1
+ import { vectorsPerFile } from './chunk-HNAQNAFS.mjs';
2
+ import { writeLiveVectors, decodeSegmentManifest, openManifestPayload, listedKeysOf, decodeManifestPayload, SINGLE_NODE_PRIMARY_TERM } from './chunk-QA6F5MML.mjs';
3
+ import { vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-VHPVBJOI.mjs';
4
+ import { writeCheckpointSegments, DEFAULT_COMPACTION_THRESHOLD, commitCheckpointManifest, manifestKey, manifestFileRefs, partitionContentsOf } from './chunk-WCJJCBR4.mjs';
5
+ import { HEADER_SIZE } from './chunk-CKNOGER5.mjs';
6
6
  import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
7
7
  import { NarsilError, ErrorCodes } from './chunk-6JUOMMHQ.mjs';
8
8
 
@@ -1,11 +1,11 @@
1
- import { KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment, restoreVectorFields, KEYWORD_SEGMENT_PAYLOAD_VERSION, littleEndianBytes } from './chunk-J2KRH2RJ.mjs';
1
+ import { KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment, restoreVectorFields, KEYWORD_SEGMENT_PAYLOAD_VERSION, littleEndianBytes } from './chunk-IZLM2OOO.mjs';
2
2
  import { WIRE_BATCH_BUDGET } from './chunk-P36MUFEJ.mjs';
3
3
  import { ReplicationMessageTypes } from './chunk-RPIE4QCL.mjs';
4
- import { packChecksummedEnvelope, crc32, openChecksummedEnvelope, reconstructSchemaFromMetadata, HEADER_SIZE, prepareDocumentVectors } from './chunk-O372FZM4.mjs';
5
- import { freezeSegmentShared, createSharedFrozenSegment, createFrozenSegment, createPartitionManager, createPartitionRouter, buildSegmentPayload, resolvePartitionInsertOptions, selectionKeeps, decodeMapWithoutFields, shareSegmentArrays, segmentArraysOf, mergeSegmentContents } from './chunk-35KEGAOS.mjs';
6
- import { fnv1a, isCompositePartition, survivorDocumentsOf, partitionStateOf } from './chunk-XWJGJ2SE.mjs';
4
+ import { packChecksummedEnvelope, crc32, openChecksummedEnvelope, reconstructSchemaFromMetadata, HEADER_SIZE, prepareDocumentVectors } from './chunk-CKNOGER5.mjs';
5
+ import { freezeSegmentShared, createSharedFrozenSegment, createFrozenSegment, createPartitionManager, createPartitionRouter, buildSegmentPayload, resolvePartitionInsertOptions, selectionKeeps, decodeMapWithoutFields, shareSegmentArrays, segmentArraysOf, mergeSegmentContents } from './chunk-7IBX2LRA.mjs';
6
+ import { fnv1a, isCompositePartition, survivorDocumentsOf, partitionStateOf } from './chunk-FEOLYA2Y.mjs';
7
7
  import { generateId, getLanguage } from './chunk-QALAFGF5.mjs';
8
- import { extractVectorFieldsFromSchema, partialFieldsOf, messagePackUpperBoundBytes } from './chunk-3IQZYNW6.mjs';
8
+ import { extractVectorFieldsFromSchema, partialFieldsOf, messagePackUpperBoundBytes } from './chunk-VVFKFHWE.mjs';
9
9
  import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
10
10
  import { resolveIndexAnalysis } from './chunk-RI5VNFAI.mjs';
11
11
  import { NarsilError, ErrorCodes } from './chunk-6JUOMMHQ.mjs';
@@ -1,4 +1,4 @@
1
- import { flattenSchema } from './chunk-3IQZYNW6.mjs';
1
+ import { flattenSchema } from './chunk-VVFKFHWE.mjs';
2
2
  import { PARTIAL_WORD_MIN_CODE_POINTS, PARTIAL_WORDS_ADDED_PER_QUERY, DEFAULT_FUZZY_PREFIX_LENGTH } from './chunk-E74YLAIG.mjs';
3
3
  import { fuzzyTermMatches } from './chunk-GES7U2PM.mjs';
4
4
  import { isWordIndexedBase } from './chunk-77SO7G55.mjs';
@@ -0,0 +1,14 @@
1
+ // src/runtime/constants.ts
2
+ var IDLE_HEAP_CLEANUP_CHECK_MS = 1e3;
3
+ var IDLE_HEAP_CLEANUP_QUIET_CHECKS = 2;
4
+ var IDLE_HEAP_CLEANUP_MAX_UTILISATION = 0.1;
5
+ var IDLE_HEAP_CLEANUP_MAX_GROWTH_BYTES = 4 * 1024 * 1024;
6
+ var IDLE_HEAP_CLEANUP_MIN_RECLAIMABLE_BYTES = 64 * 1024 * 1024;
7
+ var REFUSAL_COLLECTION_MIN_INTERVAL_MS = 1e3;
8
+ var REFUSAL_COLLECTION_TIME_MULTIPLE = 10;
9
+ var REFUSAL_YOUNG_COLLECTION_MIN_INTERVAL_MS = 10;
10
+ var HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE = 0.75;
11
+ var HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE = 0.65;
12
+ var PROCESS_LIMIT_REFRESH_INTERVAL_MS = 1e3;
13
+
14
+ export { HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, IDLE_HEAP_CLEANUP_CHECK_MS, IDLE_HEAP_CLEANUP_MAX_GROWTH_BYTES, IDLE_HEAP_CLEANUP_MAX_UTILISATION, IDLE_HEAP_CLEANUP_MIN_RECLAIMABLE_BYTES, IDLE_HEAP_CLEANUP_QUIET_CHECKS, PROCESS_LIMIT_REFRESH_INTERVAL_MS, REFUSAL_COLLECTION_MIN_INTERVAL_MS, REFUSAL_COLLECTION_TIME_MULTIPLE, REFUSAL_YOUNG_COLLECTION_MIN_INTERVAL_MS };
package/dist/client.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './events-C7_dboUr.js';
2
- export { A as ASYNC_IMPORT_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-DGaz7cb3.js';
2
+ export { A as ASYNC_IMPORT_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-ByKPha_q.js';
3
3
  export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-BhjQZ8Qf.js';
4
4
  export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-DI-xIXgR.js';
5
5
  import './schema-4W_7tk1f.js';
6
6
  import './adapters-BQFQ4PRz.js';
7
7
  import './synonyms-CpOAHPa-.js';
8
- import './config-DWxtDsJ6.js';
8
+ import './config-BZ_e3X8w.js';
9
9
  import './config-DL_bDDD8.js';
10
- import './index-Bkdt8nDw.js';
10
+ import './index-Cl5qQauj.js';
11
11
  import './types-DvncmvuQ.js';
@@ -1,5 +1,5 @@
1
1
  import { N as NarsilConfig } from './config-DL_bDDD8.js';
2
- import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './index-Bkdt8nDw.js';
2
+ import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './index-Cl5qQauj.js';
3
3
  import { N as NodeTransport } from './types-DvncmvuQ.js';
4
4
 
5
5
  /**
@@ -191,8 +191,11 @@ interface ClusterNodeConfig {
191
191
  * When this node counts as full, which is what makes the cluster refuse inserts and updates to every index with a
192
192
  * copy on the node.
193
193
  *
194
- * The node measures its process memory against the container's limit, or the host's memory where no container sets
195
- * one, and its main thread's heap against the heap limit, once a second. It counts as full once either figure passes
194
+ * The node measures its process memory and its main thread's heap once a second, and it compares the heap with the
195
+ * heap limit. It compares the process memory with the container's memory limit where a container sets one. Without a
196
+ * container limit, a node on Linux compares it with its own resident memory plus the memory that the host reports as
197
+ * available, up to the host's total memory, so that the memory that other processes take counts against the node. A
198
+ * node on any other system compares it with the host's total memory. The node counts as full once either figure passes
196
199
  * `blockWritesAbove` of its limit, and as clear again once both fall below `resumeWritesBelow`, so that a node hovering
197
200
  * at the threshold does not switch writes on and off. Removes and searches go through while the node is full, which is
198
201
  * how an operator frees memory.
@@ -1,16 +1,16 @@
1
- export { createDirectExecutor } from './chunk-35KEGAOS.mjs';
2
- import './chunk-XWJGJ2SE.mjs';
1
+ export { createDirectExecutor } from './chunk-7IBX2LRA.mjs';
2
+ import './chunk-FEOLYA2Y.mjs';
3
3
  import './chunk-QALAFGF5.mjs';
4
- import './chunk-LPQOEU5M.mjs';
4
+ import './chunk-5FPMDU54.mjs';
5
5
  import './chunk-TGP5M5R7.mjs';
6
6
  import './chunk-U2BKYEC7.mjs';
7
7
  import './chunk-2MNJ2HX7.mjs';
8
8
  import './chunk-WQBCBKY3.mjs';
9
- import './chunk-TDUBQ546.mjs';
10
- import './chunk-3IQZYNW6.mjs';
9
+ import './chunk-WXVTQ6NO.mjs';
10
+ import './chunk-VVFKFHWE.mjs';
11
11
  import './chunk-U476IXKQ.mjs';
12
12
  import './chunk-E74YLAIG.mjs';
13
- import './chunk-HMFNFVP7.mjs';
13
+ import './chunk-VJS4JFBQ.mjs';
14
14
  import './chunk-GES7U2PM.mjs';
15
15
  import './chunk-77SO7G55.mjs';
16
16
  import './chunk-RI5VNFAI.mjs';
@@ -19,6 +19,7 @@ import './chunk-7X5JST5L.mjs';
19
19
  import './chunk-AEF2O7B4.mjs';
20
20
  import './chunk-R6A773WK.mjs';
21
21
  import './chunk-YTJCGKM4.mjs';
22
- import './chunk-KSQS77DK.mjs';
22
+ import './chunk-IA6I5U36.mjs';
23
+ import './chunk-ZXZ26WSO.mjs';
23
24
  import './chunk-L5ORED7V.mjs';
24
25
  import './chunk-6JUOMMHQ.mjs';
@@ -1,4 +1,4 @@
1
- import { C as ClusterCoordinator } from '../../index-Bkdt8nDw.js';
1
+ import { C as ClusterCoordinator } from '../../index-Cl5qQauj.js';
2
2
  import '../../schema-4W_7tk1f.js';
3
3
  import '../../adapters-BQFQ4PRz.js';
4
4
  import '../../synonyms-CpOAHPa-.js';
@@ -1,4 +1,4 @@
1
- import { C as ClusterCoordinator } from '../../index-Bkdt8nDw.js';
1
+ import { C as ClusterCoordinator } from '../../index-Cl5qQauj.js';
2
2
  import '../../schema-4W_7tk1f.js';
3
3
  import '../../adapters-BQFQ4PRz.js';
4
4
  import '../../synonyms-CpOAHPa-.js';
@@ -1,11 +1,11 @@
1
- import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-DWxtDsJ6.js';
2
- export { c as ClusterControllerConfig, d as ClusterHealth, e as ClusterHealthStatus, f as ClusterMemoryConfig, g as ClusterMetrics, h as ClusterNodeInfo, i as ClusterQueryConfig, j as CommitPointFigure, k as CoordinatorRequestFigure, I as IndexHealth, N as NodeReadiness, P as PartitionReplicationFigure, R as ReplicaLagFigure, l as ReplicationConfig } from './config-DWxtDsJ6.js';
1
+ import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-BZ_e3X8w.js';
2
+ export { c as ClusterControllerConfig, d as ClusterHealth, e as ClusterHealthStatus, f as ClusterMemoryConfig, g as ClusterMetrics, h as ClusterNodeInfo, i as ClusterQueryConfig, j as CommitPointFigure, k as CoordinatorRequestFigure, I as IndexHealth, N as NodeReadiness, P as PartitionReplicationFigure, R as ReplicaLagFigure, l as ReplicationConfig } from './config-BZ_e3X8w.js';
3
3
  import { R as RerankAdapter } from './adapters-BQFQ4PRz.js';
4
4
  import { B as BatchResult, L as ListParams, g as ListResult, h as SuggestParams, j as SuggestResult, Q as QueryParams, P as PreflightResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, M as MemoryStats, m as NarsilEventMap, e as QueryResult } from './events-C7_dboUr.js';
5
5
  import { I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-4W_7tk1f.js';
6
6
  import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
7
- import { b as NodeCapacity, N as NodeRole } from './index-Bkdt8nDw.js';
8
- export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, I as IndexPartitionBytes, e as NodeEvent, f as NodeMemoryReport, a as NodeRegistration, P as PartitionAssignment, g as PartitionState, R as RegistrationLease, S as SchemaEvent, U as UnassignedReason } from './index-Bkdt8nDw.js';
7
+ import { b as NodeCapacity, N as NodeRole } from './index-Cl5qQauj.js';
8
+ export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, I as IndexPartitionBytes, e as NodeEvent, f as NodeMemoryReport, a as NodeRegistration, P as PartitionAssignment, g as PartitionState, R as RegistrationLease, S as SchemaEvent, U as UnassignedReason } from './index-Cl5qQauj.js';
9
9
  import { N as Narsil } from './engine-D_SYDsId.js';
10
10
  export { L as ListenHandler, N as NodeTransport, R as RespondFn, T as TransportConfig, a as TransportMessage } from './types-DvncmvuQ.js';
11
11
  import './config-DL_bDDD8.js';
@@ -1,45 +1,45 @@
1
- import { DEFAULT_NODE_LIFECYCLE_CONFIG, bindWriteBlockLookup, bindEngineWriteBlock, bindIndexReads, DEFAULT_CONTROLLER_CONFIG, getIndexMetadata, getClusterIndexConfig, withPartitionCount, validateIndexName, readIndexState, readIndexMetadataSnapshot, storeSynonymSet, deleteSynonymSet, indexSettingsOf, putIndexMetadata, isValidInteger, isRecord, HIDDEN_GENERATION_PREFIX, indexConfigFromSettings, metadataWithSynonymSet, indexConfigKey, RESHARD_RECORD_CAS_ATTEMPTS, indexUuidOfStoredMetadata, RESHARD_FORWARD_BATCH_DOCUMENTS, storedSynonymSetOf, RESHARD_RETRY_DELAY_MS, RESHARD_RECORD_CHECK_INTERVAL_MS, RESHARD_POLL_INTERVAL_MS, ALLOCATION_RETRY_DELAY_MS, TEARDOWN_CAS_ATTEMPTS, TEARDOWN_RETRY_ROUNDS, putIndexReplicationFactor, ALLOCATION_CAS_ATTEMPTS, TEARDOWN_RETRY_DELAY_MS, RESHARD_CONTROLLER_POLL_INTERVAL_MS, MAX_RESHARD_CUTOVER_ATTEMPTS, RECOVERY_CAS_ATTEMPTS, ESTIMATED_PARTITION_BYTES, REBALANCE_THRESHOLD, putGenerationMetadata, RESHARD_CUTOVER_LAG_ENTRIES, RESHARD_CUTOVER_TIMEOUT_MS, PARTITION_STORES_TIMEOUT_MS, LEADERSHIP_IMBALANCE_THRESHOLD, BOOTSTRAP_CAS_ATTEMPTS } from './chunk-OIN27OQH.mjs';
2
- import { MAX_WAIT_FOR_ACTIVE_REPLICAS, MIN_CONTROLLER_LEASE_TTL_MS, MAX_NODE_LEFT_DELAY_MS, DEFAULT_MAX_PER_SOURCE_SNAPSHOTS, DEFAULT_MAX_STREAMS_PER_INDEX, DEFAULT_CAPACITY, CATCH_UP_TICK_MS, DEFAULT_RESUME_WRITES_BELOW, DEFAULT_BLOCK_WRITES_ABOVE, readMemoryFigures, DEFAULT_IN_FLIGHT_WRITE_FRACTION, onRefusalAfterCollection, MAX_DROP_ACKNOWLEDGE_WAIT_MS, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, DEFAULT_CREATE_INDEX_WAIT_MS, readRecentMemoryFigures, DEFAULT_BOOTSTRAP_SYNC_DEADLINE_MS, MAX_SYNONYM_REPLACEMENT_ATTEMPTS, DROP_ACKNOWLEDGE_POLL_INTERVAL_MS, COORDINATOR_REQUEST_BUCKET_BOUNDS_SECONDS, COPY_FAILURE_ATTEMPTS, DECOMMISSION_RECHECK_INTERVAL_MS, CASE_FOLD_EXPANSION_FACTOR, PATTERN_RUN_HEAP_BYTES, ENUM_VALUE_HEAP_BYTES, MAX_SOURCE_ID_LENGTH, reserveHeapBytes, reservedHeapBytes, DOCUMENT_VALUE_HEAP_BYTES, DOCUMENT_HEAP_BYTES_PER_ESTIMATED_BYTE, DOCUMENT_PROPERTY_HEAP_BYTES, VECTOR_DOCUMENT_HEAP_BYTES, VECTOR_COMPONENT_HEAP_BYTES, NORMALIZATION_EXPANSION_FACTOR, TERM_UNIT_HEAP_BYTES, PARTITION_BYTES_INDEX_OVERHEAD_BYTES, DISTINCT_TERM_HEAP_BYTES, PARTIAL_SPELLING_HEAP_BYTES, PARTITION_BYTES_ENTRY_BYTES, PARTITION_BYTES_REPORT_BUDGET_BYTES, DOCUMENT_NUMBER_BYTES, DOCUMENT_SCALAR_BYTES, DOCUMENT_ENTRY_OVERHEAD_BYTES, SNAPSHOT_CHUNK_YIELD_INTERVAL_MS, CATCH_UP_FEED_WINDOW_MS, MAX_CATCH_UP_IN_FLIGHT_BYTES, SYNCED_POSITION_REPORT_TIMEOUT_MS, ADMISSION_TIMEOUT_MS, REGISTRATION_LEASE_DRIFT_SHARE, REGISTRATION_LEASE_CONFIRM_TIMEOUT_MS, WRITE_APPLY_YIELD_INTERVAL_MS, ROLLBACK_RETRY_INITIAL_DELAY_MS, ROLLBACK_RETRY_DELAY_CAP_MS, COPY_FAILURE_RETRY_DELAY_MS, collectYoungGenerationBeforeRefusal, collectGarbageBeforeRefusal, FULL_MEMORY_COLLECTION_INTERVAL_MS, MEMORY_SAMPLE_INTERVAL_MS, WRITE_MEMORY_SAMPLE_MAX_AGE_MS, CLEAR_PAGE_SIZE, PRIMARY_CHANGE_POLL_INTERVAL_MS, PARTITION_WRITE_CONCURRENCY, FORWARD_RETRY_INITIAL_DELAY_MS, PRIMARY_CHANGE_RETRY_WINDOW_MS, FORWARD_RETRY_DELAY_CAP_MS } from './chunk-B7BSQZ27.mjs';
3
- export { DEFAULT_CAPACITY, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR } from './chunk-B7BSQZ27.mjs';
1
+ import { DEFAULT_NODE_LIFECYCLE_CONFIG, bindWriteBlockLookup, bindEngineWriteBlock, bindIndexReads, DEFAULT_CONTROLLER_CONFIG, getIndexMetadata, getClusterIndexConfig, withPartitionCount, validateIndexName, readIndexState, readIndexMetadataSnapshot, storeSynonymSet, deleteSynonymSet, indexSettingsOf, putIndexMetadata, isValidInteger, isRecord, HIDDEN_GENERATION_PREFIX, indexConfigFromSettings, metadataWithSynonymSet, indexConfigKey, RESHARD_RECORD_CAS_ATTEMPTS, indexUuidOfStoredMetadata, RESHARD_FORWARD_BATCH_DOCUMENTS, storedSynonymSetOf, RESHARD_RETRY_DELAY_MS, RESHARD_RECORD_CHECK_INTERVAL_MS, RESHARD_POLL_INTERVAL_MS, ALLOCATION_RETRY_DELAY_MS, TEARDOWN_CAS_ATTEMPTS, TEARDOWN_RETRY_ROUNDS, putIndexReplicationFactor, ALLOCATION_CAS_ATTEMPTS, TEARDOWN_RETRY_DELAY_MS, RESHARD_CONTROLLER_POLL_INTERVAL_MS, MAX_RESHARD_CUTOVER_ATTEMPTS, RECOVERY_CAS_ATTEMPTS, ESTIMATED_PARTITION_BYTES, REBALANCE_THRESHOLD, putGenerationMetadata, RESHARD_CUTOVER_LAG_ENTRIES, RESHARD_CUTOVER_TIMEOUT_MS, PARTITION_STORES_TIMEOUT_MS, LEADERSHIP_IMBALANCE_THRESHOLD, BOOTSTRAP_CAS_ATTEMPTS } from './chunk-OKZPYJZX.mjs';
2
+ import { MAX_WAIT_FOR_ACTIVE_REPLICAS, MIN_CONTROLLER_LEASE_TTL_MS, MAX_NODE_LEFT_DELAY_MS, DEFAULT_MAX_PER_SOURCE_SNAPSHOTS, DEFAULT_MAX_STREAMS_PER_INDEX, DEFAULT_CAPACITY, CATCH_UP_TICK_MS, DEFAULT_RESUME_WRITES_BELOW, DEFAULT_BLOCK_WRITES_ABOVE, readMemoryFigures, createWritePressure, WRITE_MEMORY_SAMPLE_MAX_AGE_MS, DEFAULT_IN_FLIGHT_WRITE_FRACTION, onRefusalAfterCollection, MAX_DROP_ACKNOWLEDGE_WAIT_MS, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, DEFAULT_CREATE_INDEX_WAIT_MS, refuseEncodeWithoutRoom, readRecentMemoryFigures, DEFAULT_BOOTSTRAP_SYNC_DEADLINE_MS, MAX_SYNONYM_REPLACEMENT_ATTEMPTS, DROP_ACKNOWLEDGE_POLL_INTERVAL_MS, COORDINATOR_REQUEST_BUCKET_BOUNDS_SECONDS, COPY_FAILURE_ATTEMPTS, DECOMMISSION_RECHECK_INTERVAL_MS, withAdmittedWrite, estimateForwardedBytes, CASE_FOLD_EXPANSION_FACTOR, PATTERN_RUN_HEAP_BYTES, ENUM_VALUE_HEAP_BYTES, MAX_SOURCE_ID_LENGTH, reserveHeapBytes, reservedHeapBytes, DOCUMENT_VALUE_HEAP_BYTES, DOCUMENT_HEAP_BYTES_PER_ESTIMATED_BYTE, DOCUMENT_PROPERTY_HEAP_BYTES, VECTOR_DOCUMENT_HEAP_BYTES, VECTOR_COMPONENT_HEAP_BYTES, NORMALIZATION_EXPANSION_FACTOR, TERM_UNIT_HEAP_BYTES, PARTITION_BYTES_INDEX_OVERHEAD_BYTES, DISTINCT_TERM_HEAP_BYTES, PARTIAL_SPELLING_HEAP_BYTES, PARTITION_BYTES_ENTRY_BYTES, PARTITION_BYTES_REPORT_BUDGET_BYTES, SNAPSHOT_CHUNK_YIELD_INTERVAL_MS, CATCH_UP_FEED_WINDOW_MS, MAX_CATCH_UP_IN_FLIGHT_BYTES, SYNCED_POSITION_REPORT_TIMEOUT_MS, ADMISSION_TIMEOUT_MS, REGISTRATION_LEASE_DRIFT_SHARE, REGISTRATION_LEASE_CONFIRM_TIMEOUT_MS, WRITE_APPLY_YIELD_INTERVAL_MS, ROLLBACK_RETRY_INITIAL_DELAY_MS, ROLLBACK_RETRY_DELAY_CAP_MS, COPY_FAILURE_RETRY_DELAY_MS, FETCH_GROUP_DOCUMENT_IDS, collectYoungGenerationBeforeRefusal, collectGarbageBeforeRefusal, FULL_MEMORY_COLLECTION_INTERVAL_MS, MEMORY_SAMPLE_INTERVAL_MS, answerRefusalOf, ANSWER_DECODE_HEAP_BYTES_PER_PAYLOAD_BYTE, CLEAR_PAGE_SIZE, estimateDocumentsBytes, estimateDocumentBytes, PRIMARY_CHANGE_POLL_INTERVAL_MS, PARTITION_WRITE_CONCURRENCY, FORWARD_RETRY_INITIAL_DELAY_MS, PRIMARY_CHANGE_RETRY_WINDOW_MS, FORWARD_RETRY_DELAY_CAP_MS } from './chunk-HAQUJYMN.mjs';
3
+ export { DEFAULT_CAPACITY, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR } from './chunk-HAQUJYMN.mjs';
4
4
  import { fixedHybridDepthOf, requireWithinHybridDepth, pageByPosition } from './chunk-WCNN2PLX.mjs';
5
- import { closePartitionWriter, replaySyncedWal } from './chunk-WU4P5J4G.mjs';
6
- import { buildArchiveFromMemory, archiveStream, memoryCheckpointStore, readSnapshotArchive } from './chunk-PFQQ3LCQ.mjs';
7
- import './chunk-47PZE6CJ.mjs';
8
- import { indexMetadataOf, loadPartitionSegments, readSegmentManifest, readVectorFile } from './chunk-KNRU5CJ4.mjs';
9
- import { decodeVectorFilePayload, bytesToVectors, isDead } from './chunk-PAWVKEVS.mjs';
5
+ import { closePartitionWriter, replaySyncedWal } from './chunk-UM6Z7AIP.mjs';
6
+ import { buildArchiveFromMemory, archiveStream, memoryCheckpointStore, readSnapshotArchive } from './chunk-VWFFCDOL.mjs';
7
+ import './chunk-HNAQNAFS.mjs';
8
+ import { indexMetadataOf, loadPartitionSegments, readSegmentManifest, readVectorFile } from './chunk-QA6F5MML.mjs';
9
+ import { decodeVectorFilePayload, bytesToVectors, isDead } from './chunk-VHPVBJOI.mjs';
10
10
  import { CONTROLLER_LEASE_KEY } from './chunk-44W3CBNG.mjs';
11
11
  import { MAX_MESSAGE_SIZE_BYTES } from './chunk-UNEEFTEU.mjs';
12
- import './chunk-BLDJ5I6I.mjs';
12
+ import './chunk-G6YATIRT.mjs';
13
13
  import './chunk-DJHHF2L5.mjs';
14
14
  import './chunk-37CD3OKS.mjs';
15
15
  import { getPath, getFs } from './chunk-HLPRHOSO.mjs';
16
- import { createForwardBatchResultMessage, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, readListedFile, optionalIndexUuid, computeEntryChecksum, createPrimaryResignMessage, validateInsyncConfirmPayload, buildEntry, createInsyncRemoveMessage, createEntryBatchMessage, createInsyncConfirmMessage, createEntryMessage, validateAckPayload, createInsyncAddMessage, directoryCheckpointStore, checkpointLastSeqNo, checkpointPrimaryTerm, createForwardMessage, createForwardBatchMessage, validateForwardBatchResultPayload } from './chunk-IGUTV3MX.mjs';
17
- import { applyIndexEntry, applyDeleteEntry, validateReplicationEntry } from './chunk-J2KRH2RJ.mjs';
16
+ import { createForwardBatchResultMessage, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, readListedFile, optionalIndexUuid, computeEntryChecksum, createPrimaryResignMessage, validateInsyncConfirmPayload, buildEntry, createInsyncRemoveMessage, createEntryBatchMessage, createInsyncConfirmMessage, createEntryMessage, validateAckPayload, createInsyncAddMessage, directoryCheckpointStore, checkpointLastSeqNo, checkpointPrimaryTerm, createForwardBatchMessage, validateForwardBatchResultPayload, createForwardMessage } from './chunk-WCJJCBR4.mjs';
17
+ import { applyIndexEntry, applyDeleteEntry, validateReplicationEntry } from './chunk-IZLM2OOO.mjs';
18
18
  import { MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-P36MUFEJ.mjs';
19
19
  import { TransportErrorCodes, ReplicationMessageTypes, ClusterMessageTypes, QueryMessageTypes, TransportError, DEFAULT_TRANSPORT_CONFIG } from './chunk-RPIE4QCL.mjs';
20
- import { requireKnownConfig, resolveRunnableConfig, createEngineCore, startEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, createEngineIndex, encodeIndexConfiguration, requireConfigurationWithinSizeLimit, prepareConfiguredSynonyms, createByteReader, openChecksummedEnvelope, emptySerializablePartition, crc32Init, crc32Final, crc32Update, yieldToEventLoop } from './chunk-O372FZM4.mjs';
21
- import { runtimeHost, requireSurfaceFormsForPartialFields, queryBindingOf, now, listBindingOf, hitsKeptPerGroup, clampLimit, resolveHybridFusion, dedupePinnedEntries, foldGroupReducer } from './chunk-6GFVUXUH.mjs';
22
- import { bindRerankWindowSource, rerankWindowCapOf, engineCoreOf, providedDocId } from './chunk-MKPE3VZF.mjs';
20
+ import { requireKnownConfig, resolveRunnableConfig, createEngineCore, startEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, createEngineIndex, encodeIndexConfiguration, requireConfigurationWithinSizeLimit, prepareConfiguredSynonyms, createByteReader, openChecksummedEnvelope, emptySerializablePartition, crc32Init, crc32Final, crc32Update, yieldToEventLoop } from './chunk-CKNOGER5.mjs';
21
+ import { runtimeHost, requireSurfaceFormsForPartialFields, queryBindingOf, now, listBindingOf, hitsKeptPerGroup, clampLimit, resolveHybridFusion, dedupePinnedEntries, foldGroupReducer } from './chunk-NRARRUKN.mjs';
22
+ import { bindRerankWindowSource, rerankWindowCapOf, engineCoreOf, providedDocId } from './chunk-3BRFOMGX.mjs';
23
23
  import './chunk-CYHQNM3T.mjs';
24
24
  import './chunk-AV4IJKD2.mjs';
25
- import { synonymModule } from './chunk-35KEGAOS.mjs';
26
- import { oversampledShardSize, normalizeSort, sortModesOf, readSortValues, resolveProjection, applyProjection, fnv1a, FILTER_EXPRESSION_KEYS, filterTestCount, FIELD_FILTER_OPERATORS, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, encodePageCursor, requireWithinResultWindow, sortSignatureEntry, fnv1aUint32s, mergePartitionStats } from './chunk-XWJGJ2SE.mjs';
25
+ import { synonymModule } from './chunk-7IBX2LRA.mjs';
26
+ import { oversampledShardSize, normalizeSort, sortModesOf, readSortValues, resolveProjection, applyProjection, fnv1a, FILTER_EXPRESSION_KEYS, filterTestCount, FIELD_FILTER_OPERATORS, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, encodePageCursor, requireWithinResultWindow, sortSignatureEntry, fnv1aUint32s, mergePartitionStats } from './chunk-FEOLYA2Y.mjs';
27
27
  import { generateId, getLanguage } from './chunk-QALAFGF5.mjs';
28
- import './chunk-LPQOEU5M.mjs';
28
+ import './chunk-5FPMDU54.mjs';
29
29
  import './chunk-HJSN7UYG.mjs';
30
30
  import { MAX_DOC_ID_LENGTH, BATCH_CHUNK_SIZE, DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING } from './chunk-LXWDQLTW.mjs';
31
31
  import './chunk-TGP5M5R7.mjs';
32
32
  import './chunk-U2BKYEC7.mjs';
33
33
  import './chunk-KOKM4PQN.mjs';
34
34
  import { MIN_OVERSAMPLE } from './chunk-QSK35UC2.mjs';
35
- import './chunk-PQHR5FHC.mjs';
35
+ import './chunk-BRIOLMIX.mjs';
36
36
  import { isPatternTolerance } from './chunk-2MNJ2HX7.mjs';
37
37
  import { MAX_FILTER_DEPTH, MAX_FILTER_TESTS, MAX_FILTER_ARRAY_SIZE } from './chunk-WQBCBKY3.mjs';
38
- import { getNestedValue } from './chunk-TDUBQ546.mjs';
39
- import { validateSchema, requireCreatableSchema, encodeDocumentReply, encodeDocument, schemaFieldsOf, MIN_POLYGON_POINTS, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES } from './chunk-3IQZYNW6.mjs';
38
+ import { getNestedValue } from './chunk-WXVTQ6NO.mjs';
39
+ import { validateSchema, requireCreatableSchema, encodeDocumentReply, encodeDocument, schemaFieldsOf, MIN_POLYGON_POINTS, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES } from './chunk-VVFKFHWE.mjs';
40
40
  import { MAX_DOCUMENT_ENCODING_DEPTH } from './chunk-U476IXKQ.mjs';
41
41
  import { MAX_SORT_FIELDS, MAX_CURSOR_LENGTH, MAX_TOLERANCE, MAX_PREFIX_LENGTH, RESULT_WINDOW, MIN_HYBRID_DEPTH, MAX_HYBRID_DEPTH, DEFAULT_PAGE_SIZE, HYBRID_RESCORE_WINDOW } from './chunk-E74YLAIG.mjs';
42
- import './chunk-HMFNFVP7.mjs';
42
+ import './chunk-VJS4JFBQ.mjs';
43
43
  import './chunk-GES7U2PM.mjs';
44
44
  import './chunk-77SO7G55.mjs';
45
45
  import { resolveIndexAnalysis } from './chunk-RI5VNFAI.mjs';
@@ -48,9 +48,10 @@ import './chunk-7X5JST5L.mjs';
48
48
  import './chunk-AEF2O7B4.mjs';
49
49
  import { isSortMode, SORT_MODES, toComparableSortValue, compareComparableKeys, compareSortValues } from './chunk-R6A773WK.mjs';
50
50
  import { compareCodePoints, exceedsCodePoints } from './chunk-YTJCGKM4.mjs';
51
- import { HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, collectAndReturnPages } from './chunk-RFVUDM5E.mjs';
51
+ import { collectAndReturnPages } from './chunk-VVDQNCOG.mjs';
52
52
  import './chunk-CQUMNIIG.mjs';
53
- import './chunk-KSQS77DK.mjs';
53
+ import './chunk-IA6I5U36.mjs';
54
+ import { HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE } from './chunk-ZXZ26WSO.mjs';
54
55
  import './chunk-RFBLQLLZ.mjs';
55
56
  import { MAX_STORED_VECTOR_DIMENSION, MAX_NESTING_DEPTH } from './chunk-L5ORED7V.mjs';
56
57
  import { ErrorCodes, NarsilError, describeError } from './chunk-6JUOMMHQ.mjs';
@@ -9679,6 +9680,10 @@ function nodeRejectionOf(code, message, details) {
9679
9680
  nodeRejections.add(rejection);
9680
9681
  return rejection;
9681
9682
  }
9683
+ function markNodeRejection(error) {
9684
+ nodeRejections.add(error);
9685
+ return error;
9686
+ }
9682
9687
  function isNodeRejection(error) {
9683
9688
  return error instanceof NarsilError && nodeRejections.has(error);
9684
9689
  }
@@ -9827,6 +9832,44 @@ function selectReplicasForQuery(allocationTable, selector = randomSelector) {
9827
9832
  }
9828
9833
  return { nodeToPartitions, copiesByPartition, unavailablePartitions };
9829
9834
  }
9835
+ function transportableDetails(error) {
9836
+ if (!(error instanceof NarsilError)) {
9837
+ return void 0;
9838
+ }
9839
+ try {
9840
+ encode(error.details);
9841
+ return error.details;
9842
+ } catch {
9843
+ return void 0;
9844
+ }
9845
+ }
9846
+ function encodeErrorReply(code, message, details) {
9847
+ if (details !== void 0) {
9848
+ try {
9849
+ return encode({ error: true, code, message, details });
9850
+ } catch {
9851
+ return encode({ error: true, code, message });
9852
+ }
9853
+ }
9854
+ return encode({ error: true, code, message });
9855
+ }
9856
+ function encodeErrorReplyFrom(error, fallbackCode) {
9857
+ return encodeErrorReply(
9858
+ error instanceof NarsilError ? error.code : fallbackCode,
9859
+ error instanceof Error ? error.message : String(error),
9860
+ error instanceof NarsilError ? error.details : void 0
9861
+ );
9862
+ }
9863
+ function isPlainRecord(value) {
9864
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
9865
+ return false;
9866
+ }
9867
+ const prototype = Object.getPrototypeOf(value);
9868
+ return prototype === Object.prototype || prototype === null;
9869
+ }
9870
+ function remoteErrorDetails(value) {
9871
+ return isPlainRecord(value) ? value : {};
9872
+ }
9830
9873
 
9831
9874
  // src/distribution/cluster-node/vector-bytes.ts
9832
9875
  var FLOAT32_BYTES = 4;
@@ -9979,141 +10022,6 @@ function requireWritableIndex(table, view) {
9979
10022
  throw block;
9980
10023
  }
9981
10024
  }
9982
-
9983
- // src/distribution/cluster-node/memory/write-pressure.ts
9984
- var WRITE_BYTES_IN_FLIGHT_REASON = "write_bytes_in_flight";
9985
- function createWritePressure(options) {
9986
- let inFlight = 0;
9987
- return {
9988
- admit(indexName, bytes) {
9989
- options.beforeAdmit();
9990
- const requestBytes = Math.max(0, Math.ceil(bytes));
9991
- if (inFlight > 0 && inFlight + requestBytes > options.limitBytes) {
9992
- throw new NarsilError(
9993
- ErrorCodes.CLUSTER_WRITE_BLOCKED,
9994
- `Node '${options.nodeId}' refuses this write to index '${indexName}' because its ${requestBytes} bytes would take the writes in flight on the node from ${inFlight} bytes past the limit of ${options.limitBytes} bytes. Retry once the writes in flight finish, or send smaller batches.`,
9995
- {
9996
- reason: WRITE_BYTES_IN_FLIGHT_REASON,
9997
- indexName,
9998
- nodeId: options.nodeId,
9999
- requestBytes,
10000
- inFlightBytes: inFlight,
10001
- limitBytes: options.limitBytes
10002
- }
10003
- );
10004
- }
10005
- inFlight += requestBytes;
10006
- let released = false;
10007
- return () => {
10008
- if (released) {
10009
- return;
10010
- }
10011
- released = true;
10012
- inFlight -= requestBytes;
10013
- };
10014
- }
10015
- };
10016
- }
10017
- async function withAdmittedWrite(pressure, indexName, bytes, work) {
10018
- if (pressure === void 0) {
10019
- return work();
10020
- }
10021
- const release = pressure.admit(indexName, bytes());
10022
- try {
10023
- return await work();
10024
- } finally {
10025
- release();
10026
- }
10027
- }
10028
- function estimateDocumentBytes(document) {
10029
- let bytes = 0;
10030
- const pending = [document];
10031
- const visited = /* @__PURE__ */ new Set();
10032
- while (pending.length > 0) {
10033
- const value = pending.pop();
10034
- if (typeof value === "string") {
10035
- bytes += value.length;
10036
- continue;
10037
- }
10038
- if (typeof value === "number" || typeof value === "bigint") {
10039
- bytes += DOCUMENT_NUMBER_BYTES;
10040
- continue;
10041
- }
10042
- if (value === null || typeof value !== "object") {
10043
- bytes += DOCUMENT_SCALAR_BYTES;
10044
- continue;
10045
- }
10046
- if (visited.has(value)) {
10047
- continue;
10048
- }
10049
- visited.add(value);
10050
- if (ArrayBuffer.isView(value)) {
10051
- bytes += value.byteLength;
10052
- } else if (Array.isArray(value)) {
10053
- bytes += DOCUMENT_ENTRY_OVERHEAD_BYTES;
10054
- for (const item of value) {
10055
- pending.push(item);
10056
- }
10057
- } else {
10058
- for (const [key, item] of Object.entries(value)) {
10059
- bytes += key.length + DOCUMENT_ENTRY_OVERHEAD_BYTES;
10060
- pending.push(item);
10061
- }
10062
- }
10063
- }
10064
- return bytes;
10065
- }
10066
- function estimateDocumentsBytes(documents) {
10067
- let bytes = 0;
10068
- for (const document of documents) {
10069
- bytes += estimateDocumentBytes(document);
10070
- }
10071
- return bytes;
10072
- }
10073
- function estimateForwardedBytes(operation) {
10074
- const documentBytes = operation.document?.byteLength ?? 0;
10075
- return operation.updateFields === null ? documentBytes : documentBytes + estimateDocumentBytes(operation.updateFields);
10076
- }
10077
- function transportableDetails(error) {
10078
- if (!(error instanceof NarsilError)) {
10079
- return void 0;
10080
- }
10081
- try {
10082
- encode(error.details);
10083
- return error.details;
10084
- } catch {
10085
- return void 0;
10086
- }
10087
- }
10088
- function encodeErrorReply(code, message, details) {
10089
- if (details !== void 0) {
10090
- try {
10091
- return encode({ error: true, code, message, details });
10092
- } catch {
10093
- return encode({ error: true, code, message });
10094
- }
10095
- }
10096
- return encode({ error: true, code, message });
10097
- }
10098
- function encodeErrorReplyFrom(error, fallbackCode) {
10099
- return encodeErrorReply(
10100
- error instanceof NarsilError ? error.code : fallbackCode,
10101
- error instanceof Error ? error.message : String(error),
10102
- error instanceof NarsilError ? error.details : void 0
10103
- );
10104
- }
10105
- function isPlainRecord(value) {
10106
- if (value === null || typeof value !== "object" || Array.isArray(value)) {
10107
- return false;
10108
- }
10109
- const prototype = Object.getPrototypeOf(value);
10110
- return prototype === Object.prototype || prototype === null;
10111
- }
10112
- function remoteErrorDetails(value) {
10113
- return isPlainRecord(value) ? value : {};
10114
- }
10115
-
10116
- // src/distribution/cluster-node/write-routing/forwarding.ts
10117
10025
  function assertForwardResponse(response, indexName, primaryNodeId) {
10118
10026
  const decoded = decode(response.payload);
10119
10027
  if (response.type.endsWith(".error") || response.type === "error" || decoded.error === true) {
@@ -12304,6 +12212,18 @@ function routeDocumentIds(docIds, allocation) {
12304
12212
  }
12305
12213
  return { routing, idsByPartition };
12306
12214
  }
12215
+ function readRejectionOf(decoded, targetNodeId, indexName) {
12216
+ const details = { ...remoteErrorDetails(decoded.details), indexName, targetNodeId };
12217
+ return nodeRejectionOf(decoded.code, decoded.message, details) ?? new NarsilError(
12218
+ typeof decoded.code === "string" ? decoded.code : ErrorCodes.QUERY_ROUTING_FAILED,
12219
+ typeof decoded.message === "string" ? decoded.message : `Node '${targetNodeId}' rejected a read request for index '${indexName}'`,
12220
+ details
12221
+ );
12222
+ }
12223
+ function refuseDecodeWithoutRoom(payload) {
12224
+ const refusal = answerRefusalOf(payload.byteLength * ANSWER_DECODE_HEAP_BYTES_PER_PAYLOAD_BYTE);
12225
+ if (refusal !== null) throw markNodeRejection(refusal);
12226
+ }
12307
12227
  async function readFromCopies(config, nodeId, engine, indexName, documentRouting, fields) {
12308
12228
  const documents = /* @__PURE__ */ new Map();
12309
12229
  await sendToEveryPartition(documentRouting.routing, async (targetNodeId, partitionIds) => {
@@ -12318,14 +12238,19 @@ async function readFromCopies(config, nodeId, engine, indexName, documentRouting
12318
12238
  );
12319
12239
  for (const [docId, document] of local) found.set(docId, document);
12320
12240
  } else {
12321
- for (let start = 0; start < documentIds.length; start += MAX_FETCH_DOCUMENT_IDS) {
12322
- const chunk = documentIds.slice(start, start + MAX_FETCH_DOCUMENT_IDS);
12241
+ for (let start = 0; start < documentIds.length; start += FETCH_GROUP_DOCUMENT_IDS) {
12242
+ const chunk = documentIds.slice(start, start + FETCH_GROUP_DOCUMENT_IDS);
12323
12243
  const fetchMessage = createFetchMessage({ indexName, documentIds: chunk, fields, highlight: null }, nodeId);
12324
12244
  const response = await sendToNode2(config, targetNodeId, fetchMessage, {
12325
12245
  message: `Node '${targetNodeId}' did not answer a document fetch for index '${indexName}'`,
12326
12246
  details: { indexName }
12327
12247
  });
12328
- const payload = validateFetchResultPayload(decode(response.payload));
12248
+ refuseDecodeWithoutRoom(response.payload);
12249
+ const decoded = decode(response.payload);
12250
+ if (response.type.endsWith(".error") || decoded.error === true) {
12251
+ throw readRejectionOf(decoded, targetNodeId, indexName);
12252
+ }
12253
+ const payload = validateFetchResultPayload(decoded);
12329
12254
  for (const fetched of payload.documents) {
12330
12255
  found.set(fetched.docId, restoreVectorValues(fetched.document));
12331
12256
  }
@@ -13600,6 +13525,7 @@ async function handleFetch(message, respond, deps) {
13600
13525
  });
13601
13526
  }
13602
13527
  }
13528
+ refuseEncodeWithoutRoom(documents.map((fetched) => fetched.document));
13603
13529
  const resultPayload = { documents };
13604
13530
  await respond({
13605
13531
  type: QueryMessageTypes.FETCH_RESULT,
@@ -13679,6 +13605,7 @@ async function handleList(message, respond, deps) {
13679
13605
  document: listed.document,
13680
13606
  sortValues: sortFields === null ? null : readSortValues(listed.document, sortFields, sortModes).map(toWireSortValue2)
13681
13607
  }));
13608
+ refuseEncodeWithoutRoom(entries.map((entry) => entry.document));
13682
13609
  await respond(
13683
13610
  createListResultMessage(
13684
13611
  { entries, total: result.total, hasMore: result.cursor !== null },
@@ -15515,19 +15442,15 @@ async function gatherFromEveryPartition(allocation, indexName, read) {
15515
15442
  const answered = await sendToEveryPartition(routing, (nodeId, partitionIds) => read({ nodeId, partitionIds }));
15516
15443
  return answered.map((answer) => answer.result);
15517
15444
  }
15518
- async function sendReadRequest(deps, targetNodeId, message, indexName, validate) {
15445
+ async function sendReadRequest(deps, targetNodeId, message, indexName, validate, boundDecode = false) {
15519
15446
  const response = await sendToNode2(deps.config, targetNodeId, message, {
15520
15447
  message: `Node '${targetNodeId}' did not answer a read request for index '${indexName}'`,
15521
15448
  details: { indexName }
15522
15449
  });
15450
+ if (boundDecode) refuseDecodeWithoutRoom(response.payload);
15523
15451
  const decoded = decode(response.payload);
15524
15452
  if (response.type.endsWith(".error") || response.type === "error" || decoded.error === true) {
15525
- const details = { indexName, targetNodeId };
15526
- throw nodeRejectionOf(decoded.code, decoded.message, details) ?? new NarsilError(
15527
- typeof decoded.code === "string" ? decoded.code : ErrorCodes.QUERY_ROUTING_FAILED,
15528
- typeof decoded.message === "string" ? decoded.message : `Node '${targetNodeId}' rejected a read request for index '${indexName}'`,
15529
- details
15530
- );
15453
+ throw readRejectionOf(decoded, targetNodeId, indexName);
15531
15454
  }
15532
15455
  return validate(decoded);
15533
15456
  }
@@ -15737,7 +15660,7 @@ async function listCluster(deps, indexName, params) {
15737
15660
  );
15738
15661
  }
15739
15662
  const message = createListMessage({ ...payload, partitionIds: group.partitionIds }, deps.nodeId);
15740
- return sendReadRequest(deps, group.nodeId, message, indexName, validateListResultPayload);
15663
+ return sendReadRequest(deps, group.nodeId, message, indexName, validateListResultPayload, true);
15741
15664
  });
15742
15665
  let total = 0;
15743
15666
  let nodeReportsMore = false;