@delali/narsil 0.3.1-next.70 → 0.3.1-next.72

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 (57) hide show
  1. package/dist/adapters/filesystem.mjs +1 -1
  2. package/dist/adapters/indexeddb.mjs +1 -1
  3. package/dist/{capabilities-Dt-7B4Wz.d.ts → capabilities-D6gjjQyA.d.ts} +2 -2
  4. package/dist/{chunk-P4DSQ6M4.mjs → chunk-2X2ZQOAB.mjs} +69 -28
  5. package/dist/chunk-3HQPUCCT.mjs +785 -0
  6. package/dist/{chunk-VNMTB3KC.mjs → chunk-7QMTA7AA.mjs} +194 -59
  7. package/dist/{chunk-FVLQ63B7.mjs → chunk-CVPA5Q7R.mjs} +24 -3
  8. package/dist/{chunk-2STVUTNA.mjs → chunk-EDMCZLSJ.mjs} +4 -3
  9. package/dist/{chunk-M76V3OGJ.mjs → chunk-HVJYTKK7.mjs} +940 -647
  10. package/dist/{chunk-HWQLTLNG.mjs → chunk-KZTI25D3.mjs} +1 -1
  11. package/dist/{chunk-YJDQ7NLA.mjs → chunk-LCCL6EEH.mjs} +3 -3
  12. package/dist/{chunk-OI42GWLR.mjs → chunk-LJYTW7GT.mjs} +57 -11
  13. package/dist/{chunk-653BNMAF.mjs → chunk-M6XF5HDE.mjs} +57 -17
  14. package/dist/{chunk-YNVIUGF5.mjs → chunk-P2ZZN32C.mjs} +1 -1
  15. package/dist/{chunk-LMO5TJUS.mjs → chunk-QR4OKRVY.mjs} +637 -196
  16. package/dist/{chunk-USKFU7J5.mjs → chunk-RV77FR2F.mjs} +1 -0
  17. package/dist/{chunk-GIVAGD3Q.mjs → chunk-XZ4PAREY.mjs} +1 -1
  18. package/dist/{chunk-3JGWULDF.mjs → chunk-Y52WZWAU.mjs} +5 -5
  19. package/dist/chunk-ZKRV5M2P.mjs +75 -0
  20. package/dist/{client-COek5GXK.d.ts → client-C2TiW29y.d.ts} +3 -3
  21. package/dist/client.d.ts +8 -8
  22. package/dist/client.mjs +1 -0
  23. package/dist/{config-rBpbgTw8.d.ts → config-BLguB-om.d.ts} +2 -2
  24. package/dist/{config-Dfanyqqt.d.ts → config-C7Ip8Ife.d.ts} +17 -2
  25. package/dist/direct-executor-SVCHXR74.mjs +14 -0
  26. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  27. package/dist/distribution/coordinator/etcd.mjs +2 -2
  28. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  29. package/dist/distribution/coordinator/in-memory.mjs +1 -1
  30. package/dist/distribution/transport/grpc.mjs +1 -1
  31. package/dist/distribution.d.ts +8 -8
  32. package/dist/distribution.mjs +58 -35
  33. package/dist/embeddings/openai.mjs +1 -1
  34. package/dist/{engine-CXKfmK7I.d.ts → engine-Dm4446j1.d.ts} +104 -62
  35. package/dist/index.browser.mjs +2222 -1100
  36. package/dist/index.d.ts +27 -8
  37. package/dist/index.mjs +14 -12
  38. package/dist/invalidation/filesystem.mjs +1 -1
  39. package/dist/{memory-C7UMCMH3.d.ts → memory-CKHTU1CL.d.ts} +66 -25
  40. package/dist/pattern-Cledccbl.d.ts +18 -0
  41. package/dist/pattern.d.ts +22 -0
  42. package/dist/pattern.mjs +7 -0
  43. package/dist/persistence/durability/checkpoint-worker.d.ts +17 -1
  44. package/dist/persistence/durability/checkpoint-worker.mjs +14 -12
  45. package/dist/react.d.ts +277 -182
  46. package/dist/react.mjs +190 -45
  47. package/dist/{schema-Bgzr4g7b.d.ts → schema-BBOCdhND.d.ts} +9 -7
  48. package/dist/server.d.ts +10 -10
  49. package/dist/server.mjs +13 -12
  50. package/dist/{tasks-BZt_zes6.d.ts → tasks-BECd0b__.d.ts} +1 -1
  51. package/dist/{thread-JEVAYETR.mjs → thread-IBSIZZ6W.mjs} +22 -13
  52. package/dist/{types-gOUqhs2F.d.ts → types-BiUmaiWT.d.ts} +1 -1
  53. package/dist/vector/search-worker.d.ts +1 -1
  54. package/dist/vector/search-worker.mjs +4 -4
  55. package/dist/workers/entry.mjs +4 -4
  56. package/package.json +15 -7
  57. package/dist/direct-executor-GYJEKNV5.mjs +0 -12
@@ -31,6 +31,7 @@ var ErrorCodes = {
31
31
  SEARCH_INVALID_MODE: "SEARCH_INVALID_MODE",
32
32
  SEARCH_INVALID_CURSOR: "SEARCH_INVALID_CURSOR",
33
33
  SEARCH_RESULT_WINDOW_EXCEEDED: "SEARCH_RESULT_WINDOW_EXCEEDED",
34
+ SEARCH_WORK_CAP_EXCEEDED: "SEARCH_WORK_CAP_EXCEEDED",
34
35
  LANGUAGE_NOT_SUPPORTED: "LANGUAGE_NOT_SUPPORTED",
35
36
  ENVELOPE_VERSION_MISMATCH: "ENVELOPE_VERSION_MISMATCH",
36
37
  ENVELOPE_INVALID_MAGIC: "ENVELOPE_INVALID_MAGIC",
@@ -1,4 +1,4 @@
1
- import { DEFAULT_PAGE_SIZE } from './chunk-653BNMAF.mjs';
1
+ import { DEFAULT_PAGE_SIZE } from './chunk-M6XF5HDE.mjs';
2
2
 
3
3
  // src/engine/constants.ts
4
4
  var MIN_DOCUMENTS_FOR_SEGMENTS = 64;
@@ -1,8 +1,8 @@
1
- import { readSharedConfigFields, restoredEmbedding, restoredPartitionConfig, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR } from './chunk-FVLQ63B7.mjs';
2
- import { getLanguage } from './chunk-HWQLTLNG.mjs';
3
- import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-GIVAGD3Q.mjs';
4
- import { compareCodePoints } from './chunk-OI42GWLR.mjs';
5
- import { NarsilError, ErrorCodes } from './chunk-USKFU7J5.mjs';
1
+ import { readSharedConfigFields, restoredEmbedding, restoredPartitionConfig, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR } from './chunk-CVPA5Q7R.mjs';
2
+ import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-XZ4PAREY.mjs';
3
+ import { getLanguage } from './chunk-KZTI25D3.mjs';
4
+ import { compareCodePoints } from './chunk-LJYTW7GT.mjs';
5
+ import { NarsilError, ErrorCodes } from './chunk-RV77FR2F.mjs';
6
6
  import { encode, decode } from '@msgpack/msgpack';
7
7
 
8
8
  // src/distribution/cluster/index-settings.ts
@@ -0,0 +1,75 @@
1
+ // src/core/pattern-index/constants.ts
2
+ var DEFAULT_PATTERN_WORK_CAP = 25e6;
3
+ var MAX_PATTERN_TEXT_CODE_POINTS = 1024;
4
+ var MAX_PATTERN_POSITIONS = 2048;
5
+ var MATCHER_STATE_BUDGET_BYTES = 1e6;
6
+ var MATCHER_CODE_POINT_BYTES = 8;
7
+ var MATCHER_SIMULATION_BYTES_PER_POSITION = 16;
8
+ var MATCHER_STATE_OVERHEAD_BYTES = 96;
9
+ var PATTERN_WORK_FLUSH_UNITS = 65536;
10
+ var PATTERN_RUN_CODE_POINTS = 3;
11
+ var PATTERN_TEST_OPERATORS = ["eq", "ne", "in", "nin", "startsWith", "endsWith", "contains"];
12
+
13
+ // src/core/bitset.ts
14
+ function createBitSet(capacity) {
15
+ return new Uint32Array(capacity + 31 >>> 5 || 1);
16
+ }
17
+ function bitsetSet(bs, index) {
18
+ const word = index >>> 5;
19
+ if (word < bs.length) {
20
+ bs[word] |= 1 << (index & 31);
21
+ }
22
+ }
23
+ function bitsetHas(bs, index) {
24
+ const word = index >>> 5;
25
+ if (word >= bs.length) return false;
26
+ return (bs[word] & 1 << (index & 31)) !== 0;
27
+ }
28
+ function bitsetAnd(a, b) {
29
+ const len = Math.min(a.length, b.length);
30
+ const result = new Uint32Array(len);
31
+ for (let i = 0; i < len; i++) {
32
+ result[i] = a[i] & b[i];
33
+ }
34
+ return result;
35
+ }
36
+ function bitsetAndInto(target, other) {
37
+ const shared = Math.min(target.length, other.length);
38
+ for (let i = 0; i < shared; i++) target[i] &= other[i];
39
+ target.fill(0, shared);
40
+ }
41
+ function bitsetOrInto(target, other) {
42
+ const shared = Math.min(target.length, other.length);
43
+ for (let i = 0; i < shared; i++) target[i] |= other[i];
44
+ }
45
+ function bitsetAndNotInto(target, removed) {
46
+ const shared = Math.min(target.length, removed.length);
47
+ for (let i = 0; i < shared; i++) target[i] &= ~removed[i];
48
+ }
49
+ function bitsetNot(bs, capacity) {
50
+ const result = new Uint32Array(bs.length);
51
+ const fullWords = capacity >>> 5;
52
+ for (let i = 0; i < fullWords; i++) {
53
+ result[i] = ~bs[i];
54
+ }
55
+ const remainder = capacity & 31;
56
+ if (remainder > 0 && fullWords < bs.length) {
57
+ result[fullWords] = ~bs[fullWords] & (1 << remainder) - 1;
58
+ }
59
+ return result;
60
+ }
61
+ function bitsetIsEmpty(bs) {
62
+ for (let i = 0; i < bs.length; i++) {
63
+ if (bs[i] !== 0) return false;
64
+ }
65
+ return true;
66
+ }
67
+ function bitsetFromSet(set, capacity) {
68
+ const bs = createBitSet(capacity);
69
+ for (const id of set) {
70
+ bs[id >>> 5] |= 1 << (id & 31);
71
+ }
72
+ return bs;
73
+ }
74
+
75
+ export { DEFAULT_PATTERN_WORK_CAP, MATCHER_CODE_POINT_BYTES, MATCHER_SIMULATION_BYTES_PER_POSITION, MATCHER_STATE_BUDGET_BYTES, MATCHER_STATE_OVERHEAD_BYTES, MAX_PATTERN_POSITIONS, MAX_PATTERN_TEXT_CODE_POINTS, PATTERN_RUN_CODE_POINTS, PATTERN_TEST_OPERATORS, PATTERN_WORK_FLUSH_UNITS, bitsetAnd, bitsetAndInto, bitsetAndNotInto, bitsetFromSet, bitsetHas, bitsetIsEmpty, bitsetNot, bitsetOrInto, bitsetSet, createBitSet };
@@ -1,6 +1,6 @@
1
- import { P as PartitionConfig, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-Bgzr4g7b.js';
2
- import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, f as IndexStats, P as PartitionStatsResult, Q as QueryParams, e as QueryResult, h as PreflightResult, j as SuggestParams, k as SuggestResult } from './memory-C7UMCMH3.js';
3
- import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-BZt_zes6.js';
1
+ import { P as PartitionConfig, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-BBOCdhND.js';
2
+ import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, f as IndexStats, P as PartitionStatsResult, Q as QueryParams, e as QueryResult, h as PreflightResult, j as SuggestParams, k as SuggestResult } from './memory-CKHTU1CL.js';
3
+ import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-BECd0b__.js';
4
4
 
5
5
  /**
6
6
  * This is the `fetch` implementation the client sends every request through.
package/dist/client.d.ts CHANGED
@@ -1,10 +1,10 @@
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 './memory-C7UMCMH3.js';
2
- export { A as ASYNC_IMPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-Dt-7B4Wz.js';
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-BZt_zes6.js';
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-COek5GXK.js';
5
- import './schema-Bgzr4g7b.js';
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 './memory-CKHTU1CL.js';
2
+ export { A as ASYNC_IMPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-D6gjjQyA.js';
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-BECd0b__.js';
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-C2TiW29y.js';
5
+ import './schema-BBOCdhND.js';
6
6
  import './adapters-79OIa4xm.js';
7
- import './config-rBpbgTw8.js';
8
- import './config-Dfanyqqt.js';
9
- import './types-gOUqhs2F.js';
7
+ import './config-BLguB-om.js';
8
+ import './config-C7Ip8Ife.js';
9
+ import './types-BiUmaiWT.js';
10
10
  import './types-D5OwhtsQ.js';
package/dist/client.mjs CHANGED
@@ -31,6 +31,7 @@ var ErrorCodes = {
31
31
  SEARCH_INVALID_MODE: "SEARCH_INVALID_MODE",
32
32
  SEARCH_INVALID_CURSOR: "SEARCH_INVALID_CURSOR",
33
33
  SEARCH_RESULT_WINDOW_EXCEEDED: "SEARCH_RESULT_WINDOW_EXCEEDED",
34
+ SEARCH_WORK_CAP_EXCEEDED: "SEARCH_WORK_CAP_EXCEEDED",
34
35
  LANGUAGE_NOT_SUPPORTED: "LANGUAGE_NOT_SUPPORTED",
35
36
  ENVELOPE_VERSION_MISMATCH: "ENVELOPE_VERSION_MISMATCH",
36
37
  ENVELOPE_INVALID_MAGIC: "ENVELOPE_INVALID_MAGIC",
@@ -1,5 +1,5 @@
1
- import { N as NarsilConfig } from './config-Dfanyqqt.js';
2
- import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-gOUqhs2F.js';
1
+ import { N as NarsilConfig } from './config-C7Ip8Ife.js';
2
+ import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-BiUmaiWT.js';
3
3
  import { N as NodeTransport } from './types-D5OwhtsQ.js';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter } from './adapters-79OIa4xm.js';
2
- import { Q as QueryParams, e as QueryResult } from './memory-C7UMCMH3.js';
3
- import { I as IndexConfig, A as AnyDocument } from './schema-Bgzr4g7b.js';
2
+ import { Q as QueryParams, e as QueryResult } from './memory-CKHTU1CL.js';
3
+ import { I as IndexConfig, A as AnyDocument } from './schema-BBOCdhND.js';
4
4
 
5
5
  /**
6
6
  * Hooks that the engine calls alongside its own work, so that an application
@@ -197,6 +197,21 @@ interface NarsilConfig {
197
197
  analysis?: AnalysisConfig;
198
198
  /** These limits close indexes while keeping their durable files ready to reopen. */
199
199
  lifecycle?: IndexLifecycleConfig;
200
+ /**
201
+ * This is the most work that the engine may do on the pattern tests of one
202
+ * search, counted over every partition that it searches. The engine adds one
203
+ * unit for each run of three code points that it looks up in a pattern
204
+ * index, one for each entry that it reads from a pattern index, and one for
205
+ * each step of its matcher. For a text whose case fold is shorter than three
206
+ * code points, it counts each document that it checks as an entry that it
207
+ * reads. It counts an `in` or `nin` test as one `eq` test for each distinct
208
+ * value in its list. Once the count passes the cap, the engine throws
209
+ * `SEARCH_WORK_CAP_EXCEEDED`. The cap
210
+ * defaults to 25,000,000 units. For any value other than a whole number from
211
+ * 1 to `Number.MAX_SAFE_INTEGER`, {@link createNarsil} throws
212
+ * `CONFIG_INVALID`.
213
+ */
214
+ patternWorkCap?: number;
200
215
  }
201
216
  /**
202
217
  * Limits on the indexes one engine keeps open in memory.
@@ -0,0 +1,14 @@
1
+ export { createDirectExecutor } from './chunk-HVJYTKK7.mjs';
2
+ import './chunk-QR4OKRVY.mjs';
3
+ import './chunk-KZTI25D3.mjs';
4
+ import './chunk-M6XF5HDE.mjs';
5
+ import './chunk-TGP5M5R7.mjs';
6
+ import './chunk-LCCL6EEH.mjs';
7
+ import './chunk-ZJ4CSAB2.mjs';
8
+ import './chunk-P2ZZN32C.mjs';
9
+ import './chunk-IFBKLBGB.mjs';
10
+ import './chunk-3HQPUCCT.mjs';
11
+ import './chunk-ZKRV5M2P.mjs';
12
+ import './chunk-U2BKYEC7.mjs';
13
+ import './chunk-LJYTW7GT.mjs';
14
+ import './chunk-RV77FR2F.mjs';
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../types-gOUqhs2F.js';
2
- import '../../schema-Bgzr4g7b.js';
1
+ import { C as ClusterCoordinator } from '../../types-BiUmaiWT.js';
2
+ import '../../schema-BBOCdhND.js';
3
3
  import '../../adapters-79OIa4xm.js';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { MAX_NODE_ID_LENGTH, MAX_WATCHERS } from '../../chunk-ORBLD3EL.mjs';
2
- import { compareCodePoints } from '../../chunk-OI42GWLR.mjs';
3
- import { NarsilError, ErrorCodes } from '../../chunk-USKFU7J5.mjs';
2
+ import { compareCodePoints } from '../../chunk-LJYTW7GT.mjs';
3
+ import { NarsilError, ErrorCodes } from '../../chunk-RV77FR2F.mjs';
4
4
  import { decode, encode } from '@msgpack/msgpack';
5
5
 
6
6
  // src/distribution/coordinator/etcd/types.ts
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../types-gOUqhs2F.js';
2
- import '../../schema-Bgzr4g7b.js';
1
+ import { C as ClusterCoordinator } from '../../types-BiUmaiWT.js';
2
+ import '../../schema-BBOCdhND.js';
3
3
  import '../../adapters-79OIa4xm.js';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { NODE_HEARTBEAT_TTL_MS } from '../../chunk-ORBLD3EL.mjs';
2
- import { compareCodePoints } from '../../chunk-OI42GWLR.mjs';
2
+ import { compareCodePoints } from '../../chunk-LJYTW7GT.mjs';
3
3
 
4
4
  // src/distribution/coordinator/in-memory.ts
5
5
  var NODE_HEARTBEAT_PREFIX = "_narsil/node/";
@@ -1,7 +1,7 @@
1
1
  import { decodeTransportMessage, encodeTransportMessage } from '../../chunk-OOSIDHA3.mjs';
2
2
  import { MAX_MESSAGE_SIZE_BYTES, GRPC_KEEPALIVE_TIMEOUT_MS, GRPC_KEEPALIVE_TIME_MS, GRPC_ENVELOPE_OVERHEAD_BYTES } from '../../chunk-UNEEFTEU.mjs';
3
3
  import { TransportError, TransportErrorCodes } from '../../chunk-GCM3JFVA.mjs';
4
- import { NarsilError, ErrorCodes } from '../../chunk-USKFU7J5.mjs';
4
+ import { NarsilError, ErrorCodes } from '../../chunk-RV77FR2F.mjs';
5
5
 
6
6
  // src/distribution/transport/grpc/codec.ts
7
7
  var FIELD_ONE_LENGTH_DELIMITED_KEY = 10;
@@ -1,12 +1,12 @@
1
- import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-rBpbgTw8.js';
2
- export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-rBpbgTw8.js';
3
- import { N as NarsilEventMap, a as Narsil } from './engine-CXKfmK7I.js';
4
- import { B as BatchResult, L as ListParams, g as ListResult, j as SuggestParams, k as SuggestResult, Q as QueryParams, h as PreflightResult, f as IndexStats, P as PartitionStatsResult, M as MemoryStats, e as QueryResult } from './memory-C7UMCMH3.js';
5
- import { I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-Bgzr4g7b.js';
6
- import { b as NodeCapacity, N as NodeRole } from './types-gOUqhs2F.js';
7
- export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, e as NodeEvent, a as NodeRegistration, P as PartitionAssignment, f as PartitionState, S as SchemaEvent, U as UnassignedReason } from './types-gOUqhs2F.js';
1
+ import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-BLguB-om.js';
2
+ export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-BLguB-om.js';
3
+ import { N as NarsilEventMap, a as Narsil } from './engine-Dm4446j1.js';
4
+ import { B as BatchResult, L as ListParams, g as ListResult, j as SuggestParams, k as SuggestResult, Q as QueryParams, h as PreflightResult, f as IndexStats, P as PartitionStatsResult, M as MemoryStats, e as QueryResult } from './memory-CKHTU1CL.js';
5
+ import { I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-BBOCdhND.js';
6
+ import { b as NodeCapacity, N as NodeRole } from './types-BiUmaiWT.js';
7
+ export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, e as NodeEvent, a as NodeRegistration, P as PartitionAssignment, f as PartitionState, S as SchemaEvent, U as UnassignedReason } from './types-BiUmaiWT.js';
8
8
  export { L as ListenHandler, N as NodeTransport, R as RespondFn, T as TransportConfig, a as TransportMessage } from './types-D5OwhtsQ.js';
9
- import './config-Dfanyqqt.js';
9
+ import './config-C7Ip8Ife.js';
10
10
  import './adapters-79OIa4xm.js';
11
11
 
12
12
  /**
@@ -1,24 +1,26 @@
1
1
  import { MAX_MESSAGE_SIZE_BYTES } from './chunk-UNEEFTEU.mjs';
2
- import { validateIndexName, indexConfigKey, indexSettingsOf, putIndexMetadata, withPartitionCount, getIndexMetadata, getClusterIndexConfig } from './chunk-3JGWULDF.mjs';
3
- import { requireKnownConfig, resolveRunnableConfig, createEngineCore, startEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, createEngineIndex, applyIndexEntry, applyDeleteEntry, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, createForwardBatchResultMessage, createForwardBatchMessage, validateForwardBatchResultPayload, createForwardMessage, validateReplicationEntry, computeEntryChecksum, createEntryMessage, createEntryBatchMessage, createInsyncConfirmMessage, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, createInsyncAddMessage } from './chunk-VNMTB3KC.mjs';
2
+ import { validateIndexName, indexConfigKey, indexSettingsOf, putIndexMetadata, withPartitionCount, getIndexMetadata, getClusterIndexConfig } from './chunk-Y52WZWAU.mjs';
3
+ import { requireKnownConfig, resolveRunnableConfig, createEngineCore, startEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, createEngineIndex, applyIndexEntry, applyDeleteEntry, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, createForwardBatchResultMessage, createForwardBatchMessage, validateForwardBatchResultPayload, createForwardMessage, validateReplicationEntry, computeEntryChecksum, createEntryMessage, createEntryBatchMessage, createInsyncConfirmMessage, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, createInsyncAddMessage } from './chunk-7QMTA7AA.mjs';
4
+ import { now, listBindingOf, queryBindingOf, hitsKeptPerGroup, clampLimit, resolveHybridFusion, dedupePinnedEntries, foldGroupReducer } from './chunk-2X2ZQOAB.mjs';
4
5
  import { ReplicationMessageTypes, TransportErrorCodes, ClusterMessageTypes, QueryMessageTypes, TransportError } from './chunk-GCM3JFVA.mjs';
5
- import { providedDocId, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-FVLQ63B7.mjs';
6
- import { generateId, deserializePayloadV2, createPartitionIndex, FILTER_EXPRESSION_KEYS, FIELD_FILTER_OPERATORS } from './chunk-M76V3OGJ.mjs';
7
- import { getLanguage } from './chunk-HWQLTLNG.mjs';
8
- import { now, listBindingOf, queryBindingOf, hitsKeptPerGroup, clampLimit, resolveHybridFusion, dedupePinnedEntries, foldGroupReducer } from './chunk-P4DSQ6M4.mjs';
9
- import { DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, MAX_INDEX_NAME_LENGTH, MAX_DOC_ID_LENGTH, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING, INDEX_NAME_PATTERN } from './chunk-GIVAGD3Q.mjs';
10
- import { oversampledShardSize, resolveProjection, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, normalizeSort, sortModesOf, encodePageCursor, applyProjection, readSortValues, requireWithinResultWindow, fnv1a, sortSignatureEntry, MAX_FILTER_DEPTH, fnv1aUint32s, mergePartitionStats, MIN_POLYGON_POINTS } from './chunk-LMO5TJUS.mjs';
11
- import { validateSchema, DEFAULT_PAGE_SIZE, MAX_SORT_FIELDS, MAX_CURSOR_LENGTH, MAX_TOLERANCE, MAX_PREFIX_LENGTH, RESULT_WINDOW, MAX_NESTING_DEPTH } from './chunk-653BNMAF.mjs';
6
+ import { providedDocId, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-CVPA5Q7R.mjs';
7
+ import { DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, MAX_INDEX_NAME_LENGTH, MAX_DOC_ID_LENGTH, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING, INDEX_NAME_PATTERN } from './chunk-XZ4PAREY.mjs';
8
+ import { generateId, deserializePayloadV2, createPartitionIndex, FILTER_EXPRESSION_KEYS, FIELD_FILTER_OPERATORS } from './chunk-HVJYTKK7.mjs';
9
+ import { oversampledShardSize, resolveProjection, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, normalizeSort, sortModesOf, encodePageCursor, applyProjection, readSortValues, requireWithinResultWindow, fnv1a, sortSignatureEntry, MAX_FILTER_DEPTH, filterTestCount, MAX_FILTER_TESTS, fnv1aUint32s, mergePartitionStats, MAX_FILTER_ARRAY_SIZE } from './chunk-QR4OKRVY.mjs';
10
+ import { getLanguage } from './chunk-KZTI25D3.mjs';
11
+ import { validateSchema, DEFAULT_PAGE_SIZE, MAX_SORT_FIELDS, MAX_CURSOR_LENGTH, MAX_TOLERANCE, MAX_PREFIX_LENGTH, RESULT_WINDOW, MIN_POLYGON_POINTS, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MAX_NESTING_DEPTH } from './chunk-M6XF5HDE.mjs';
12
12
  import './chunk-TGP5M5R7.mjs';
13
- import './chunk-YJDQ7NLA.mjs';
13
+ import './chunk-LCCL6EEH.mjs';
14
14
  import { MIN_OVERSAMPLE } from './chunk-ZJ4CSAB2.mjs';
15
- import './chunk-YNVIUGF5.mjs';
15
+ import './chunk-P2ZZN32C.mjs';
16
16
  import { crc32 } from './chunk-3L4U6EJQ.mjs';
17
17
  import './chunk-IFBKLBGB.mjs';
18
+ import './chunk-3HQPUCCT.mjs';
19
+ import './chunk-ZKRV5M2P.mjs';
18
20
  import './chunk-U2BKYEC7.mjs';
19
- import { compareCodePoints, toComparableSortValue, compareComparableKeys, isSortMode, SORT_MODES, compareSortValues } from './chunk-OI42GWLR.mjs';
21
+ import { compareCodePoints, toComparableSortValue, compareComparableKeys, isSortMode, SORT_MODES, exceedsCodePoints, compareSortValues } from './chunk-LJYTW7GT.mjs';
20
22
  import './chunk-POWOTUKJ.mjs';
21
- import { ErrorCodes, NarsilError, describeError } from './chunk-USKFU7J5.mjs';
23
+ import { ErrorCodes, NarsilError, describeError } from './chunk-RV77FR2F.mjs';
22
24
  import { encode, decode } from '@msgpack/msgpack';
23
25
 
24
26
  // src/distribution/cluster/constants.ts
@@ -6104,7 +6106,6 @@ var MAX_FACETS = 64;
6104
6106
  var MAX_FACET_RANGES = 1e3;
6105
6107
  var MAX_FETCH_DOCUMENT_IDS = 1e4;
6106
6108
  var MAX_FILTER_FIELDS = 256;
6107
- var MAX_FILTER_ARRAY_SIZE = 65536;
6108
6109
  var MAX_FILTER_STRING_LENGTH = 1024;
6109
6110
  var MAX_LIMIT = 1e4;
6110
6111
  var MAX_OFFSET = 1e4;
@@ -6337,18 +6338,16 @@ function validateFetchResultPayload(decoded) {
6337
6338
 
6338
6339
  // src/distribution/query/validators/filters.ts
6339
6340
  var GEO_UNITS = ["km", "mi", "m"];
6341
+ function throwTooLong(value, fieldLabel, errorCode) {
6342
+ throwInvalid(
6343
+ errorCode,
6344
+ `Invalid payload: "${fieldLabel}" exceeds the maximum length of ${MAX_FILTER_STRING_LENGTH} code points`,
6345
+ { length: [...value].length, limit: MAX_FILTER_STRING_LENGTH }
6346
+ );
6347
+ }
6340
6348
  function validateScalarPrimitive(value, fieldLabel, errorCode) {
6341
6349
  if (typeof value === "string") {
6342
- if (value.length > MAX_FILTER_STRING_LENGTH) {
6343
- throwInvalid(
6344
- errorCode,
6345
- `Invalid payload: "${fieldLabel}" exceeds maximum length of ${MAX_FILTER_STRING_LENGTH}`,
6346
- {
6347
- length: value.length,
6348
- limit: MAX_FILTER_STRING_LENGTH
6349
- }
6350
- );
6351
- }
6350
+ if (exceedsCodePoints(value, MAX_FILTER_STRING_LENGTH)) throwTooLong(value, fieldLabel, errorCode);
6352
6351
  return value;
6353
6352
  }
6354
6353
  if (typeof value === "number") {
@@ -6366,12 +6365,7 @@ function validateBoundedString(value, fieldLabel, errorCode) {
6366
6365
  if (typeof value !== "string") {
6367
6366
  throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" must be a string`);
6368
6367
  }
6369
- if (value.length > MAX_FILTER_STRING_LENGTH) {
6370
- throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" exceeds maximum length of ${MAX_FILTER_STRING_LENGTH}`, {
6371
- length: value.length,
6372
- limit: MAX_FILTER_STRING_LENGTH
6373
- });
6374
- }
6368
+ if (exceedsCodePoints(value, MAX_FILTER_STRING_LENGTH)) throwTooLong(value, fieldLabel, errorCode);
6375
6369
  return value;
6376
6370
  }
6377
6371
  function validateNumericOperand(value, fieldLabel, errorCode) {
@@ -6380,6 +6374,20 @@ function validateNumericOperand(value, fieldLabel, errorCode) {
6380
6374
  }
6381
6375
  return value;
6382
6376
  }
6377
+ function validateCoordinates(lat, lon, fieldLabel, errorCode) {
6378
+ if (!isLatitude(validateNumericOperand(lat, `${fieldLabel}.lat`, errorCode))) {
6379
+ throwInvalid(
6380
+ errorCode,
6381
+ `Invalid payload: "${fieldLabel}.lat" must be from -${MAX_LATITUDE_DEGREES} to ${MAX_LATITUDE_DEGREES}`
6382
+ );
6383
+ }
6384
+ if (!isLongitude(validateNumericOperand(lon, `${fieldLabel}.lon`, errorCode))) {
6385
+ throwInvalid(
6386
+ errorCode,
6387
+ `Invalid payload: "${fieldLabel}.lon" must be from -${MAX_LONGITUDE_DEGREES} to ${MAX_LONGITUDE_DEGREES}`
6388
+ );
6389
+ }
6390
+ }
6383
6391
  function validateBooleanOperand(value, fieldLabel, errorCode) {
6384
6392
  if (typeof value !== "boolean") {
6385
6393
  throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" must be a boolean`);
@@ -6440,8 +6448,7 @@ function validateGeoRadius(value, fieldLabel, errorCode) {
6440
6448
  if (!isRecord2(value)) {
6441
6449
  throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" must be an object`);
6442
6450
  }
6443
- validateNumericOperand(value.lat, `${fieldLabel}.lat`, errorCode);
6444
- validateNumericOperand(value.lon, `${fieldLabel}.lon`, errorCode);
6451
+ validateCoordinates(value.lat, value.lon, fieldLabel, errorCode);
6445
6452
  validateNumericOperand(value.distance, `${fieldLabel}.distance`, errorCode);
6446
6453
  if (value.distance < 0) {
6447
6454
  throwInvalid(errorCode, `Invalid payload: "${fieldLabel}.distance" must be non-negative`);
@@ -6483,8 +6490,7 @@ function validateGeoPolygon(value, fieldLabel, errorCode) {
6483
6490
  if (!isRecord2(point)) {
6484
6491
  throwInvalid(errorCode, `Invalid payload: "${fieldLabel}.points[${i}]" must be an object`);
6485
6492
  }
6486
- validateNumericOperand(point.lat, `${fieldLabel}.points[${i}].lat`, errorCode);
6487
- validateNumericOperand(point.lon, `${fieldLabel}.points[${i}].lon`, errorCode);
6493
+ validateCoordinates(point.lat, point.lon, `${fieldLabel}.points[${i}]`, errorCode);
6488
6494
  }
6489
6495
  if (value.inside !== void 0) {
6490
6496
  validateBooleanOperand(value.inside, `${fieldLabel}.inside`, errorCode);
@@ -6504,10 +6510,14 @@ function validateLeafOperator(opKey, opValue, leafLabel, errorCode) {
6504
6510
  validateBetween(opValue, opLabel, errorCode);
6505
6511
  return;
6506
6512
  }
6507
- if (opKey === "startsWith" || opKey === "endsWith") {
6513
+ if (opKey === "startsWith" || opKey === "endsWith" || opKey === "contains") {
6508
6514
  validateBoundedString(opValue, opLabel, errorCode);
6509
6515
  return;
6510
6516
  }
6517
+ if (opKey === "caseFold") {
6518
+ validateBooleanOperand(opValue, opLabel, errorCode);
6519
+ return;
6520
+ }
6511
6521
  if (opKey === "in" || opKey === "nin") {
6512
6522
  validateStringList(opValue, opLabel, errorCode);
6513
6523
  return;
@@ -6625,6 +6635,18 @@ function validateFilterExpression(value, fieldLabel, errorCode = SEARCH_INVALID_
6625
6635
  validateFilterExpression(clauseValue, `${fieldLabel}.not`, errorCode, depth + 1);
6626
6636
  }
6627
6637
  }
6638
+ if (depth > 0) return;
6639
+ const tests = filterTestCount(value);
6640
+ if (tests > MAX_FILTER_TESTS) {
6641
+ throwInvalid(
6642
+ errorCode,
6643
+ `Invalid payload: "${fieldLabel}" holds ${tests} tests, above the maximum of ${MAX_FILTER_TESTS}`,
6644
+ {
6645
+ tests,
6646
+ limit: MAX_FILTER_TESTS
6647
+ }
6648
+ );
6649
+ }
6628
6650
  }
6629
6651
 
6630
6652
  // src/distribution/query/validators/search-options.ts
@@ -9824,6 +9846,7 @@ var QUERY_REJECTION_CODES = /* @__PURE__ */ new Set([
9824
9846
  ErrorCodes.SEARCH_INVALID_MODE,
9825
9847
  ErrorCodes.SEARCH_INVALID_CURSOR,
9826
9848
  ErrorCodes.SEARCH_RESULT_WINDOW_EXCEEDED,
9849
+ ErrorCodes.SEARCH_WORK_CAP_EXCEEDED,
9827
9850
  ErrorCodes.VECTOR_DIMENSION_MISMATCH,
9828
9851
  ErrorCodes.CONFIG_INVALID
9829
9852
  ]);
@@ -1,4 +1,4 @@
1
- import { NarsilError, ErrorCodes } from '../chunk-USKFU7J5.mjs';
1
+ import { NarsilError, ErrorCodes } from '../chunk-RV77FR2F.mjs';
2
2
 
3
3
  // src/embeddings/constants.ts
4
4
  var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);