@delali/narsil 0.2.4-next.48 → 0.2.4-next.49

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 (48) hide show
  1. package/README.md +2 -2
  2. package/dist/adapters/indexeddb.mjs +15 -10
  3. package/dist/{chunk-BFIH7OV5.mjs → chunk-2GWVQWGA.mjs} +3 -1
  4. package/dist/{chunk-UZTT2BKQ.mjs → chunk-56PJBIJ6.mjs} +891 -542
  5. package/dist/chunk-CBLS46IE.mjs +10 -0
  6. package/dist/{chunk-JQUL2T6I.mjs → chunk-GCM3JFVA.mjs} +1 -2
  7. package/dist/{chunk-4COAUBLJ.mjs → chunk-HGJC5L65.mjs} +4 -7
  8. package/dist/{chunk-DFZDV5FV.mjs → chunk-JXHUHFJ5.mjs} +27 -14
  9. package/dist/{chunk-XWICBGYT.mjs → chunk-KGRYQVZ5.mjs} +2 -5
  10. package/dist/{chunk-EV45L35L.mjs → chunk-M6JGMKA5.mjs} +391 -183
  11. package/dist/{chunk-PM52SMBT.mjs → chunk-OOSIDHA3.mjs} +2 -1
  12. package/dist/chunk-ORBLD3EL.mjs +6 -0
  13. package/dist/chunk-OWCFK42Q.mjs +30 -0
  14. package/dist/{chunk-WTONLDU3.mjs → chunk-RDGXYRF4.mjs} +1 -0
  15. package/dist/chunk-UNEEFTEU.mjs +7 -0
  16. package/dist/chunk-YEO6G2NG.mjs +6 -0
  17. package/dist/{client-C5BkUqB8.d.ts → client-DX7xPcNA.d.ts} +1 -1
  18. package/dist/client.d.ts +5 -5
  19. package/dist/client.mjs +224 -222
  20. package/dist/{config-B-ZI-ft5.d.ts → config-B41W23Us.d.ts} +1 -1
  21. package/dist/{config-BZRExglL.d.ts → config-Co-zAXqO.d.ts} +27 -11
  22. package/dist/direct-executor-HRTDWMVB.mjs +9 -0
  23. package/dist/distribution/coordinator/etcd.mjs +2 -3
  24. package/dist/distribution/coordinator/in-memory.mjs +2 -2
  25. package/dist/distribution/transport/grpc.mjs +7 -9
  26. package/dist/distribution/transport/in-memory.mjs +2 -1
  27. package/dist/distribution/transport/tcp.mjs +3 -2
  28. package/dist/distribution.d.ts +5 -5
  29. package/dist/distribution.mjs +121 -97
  30. package/dist/embeddings/openai.mjs +5 -3
  31. package/dist/{engine-Cjr1uBLa.d.ts → engine-CABZg25p.d.ts} +12 -8
  32. package/dist/index.browser.mjs +1514 -894
  33. package/dist/index.d.ts +5 -5
  34. package/dist/index.mjs +9 -8
  35. package/dist/invalidation/broadcast-channel.mjs +2 -1
  36. package/dist/invalidation/filesystem.mjs +3 -4
  37. package/dist/{options-BC68VPoE.d.ts → options-Dtk99qUs.d.ts} +1 -1
  38. package/dist/persistence/durability/checkpoint-worker.mjs +9 -8
  39. package/dist/react.d.ts +3 -3
  40. package/dist/react.mjs +7 -5
  41. package/dist/{search-DDHjfXhJ.d.ts → search-FjWhZN3f.d.ts} +20 -3
  42. package/dist/server.d.ts +6 -6
  43. package/dist/server.mjs +43 -30
  44. package/dist/vector/hnsw-build-worker.mjs +2 -4
  45. package/dist/vector/search-worker.mjs +3 -4
  46. package/dist/workers/entry.mjs +2 -2
  47. package/package.json +1 -1
  48. package/dist/direct-executor-EOTFGXTO.mjs +0 -8
package/README.md CHANGED
@@ -91,7 +91,7 @@ Every hit holds the document, its id, and its BM25 score. `results.count` report
91
91
 
92
92
  **Storage.** [Persistence adapters](https://github.com/assetcorp/narsil/blob/main/docs/persistence-and-durability.md) plug in filesystem, IndexedDB, memory, or custom backends. Durability adds a write-ahead log with periodic checkpoints and automatic recovery, and snapshots capture a whole index as one portable byte array.
93
93
 
94
- **Scale.** [Partitioned indexes](https://github.com/assetcorp/narsil/blob/main/docs/partitions-and-workers.md) route documents by deterministic hash and reshape online through `rebalance()`, with writes buffering in a write-ahead queue during the reshape. Worker promotion moves search off the main thread once document counts cross a threshold.
94
+ **Scale.** [Partitioned indexes](https://github.com/assetcorp/narsil/blob/main/docs/partitions-and-workers.md) route documents by deterministic hash and reshape online through `rebalance()`, with writes buffering in a write-ahead queue during the reshape. Worker copies answer keyword queries on half the worker threads once an index holds 1,000 documents.
95
95
 
96
96
  **Operations.** The [HTTP server](https://github.com/assetcorp/narsil/blob/main/docs/http-server.md) subpath wraps an engine in a REST API with health probes, bulk NDJSON import, snapshot and restore endpoints, and task-based long operations. The [client](https://github.com/assetcorp/narsil/blob/main/docs/client.md) subpath reaches every one of those routes from a browser or from Node under the engine's own method names, and the [React](https://github.com/assetcorp/narsil/blob/main/docs/react.md) subpath gives those methods to components as hooks. [Events, plugins, and memory reporting](https://github.com/assetcorp/narsil/blob/main/docs/observability.md) cover observability, and [language modules](https://github.com/assetcorp/narsil/blob/main/docs/language-support.md) cover 107 languages as separate entry points, 20 of them African.
97
97
 
@@ -108,7 +108,7 @@ Every hit holds the document, its id, and its BM25 score. `results.count` report
108
108
  | [Geosearch](../../docs/geosearch.md) | Radius and polygon filters, and the two distance formulas |
109
109
  | [Embedding adapters](../../docs/embedding-adapters.md) | Automatic embedding on insert and query, named adapters, the bundled ones, and custom ones |
110
110
  | [Persistence and durability](../../docs/persistence-and-durability.md) | Storage backends, the write-ahead log, checkpoints, recovery, and snapshots |
111
- | [Partitions and workers](../../docs/partitions-and-workers.md) | Partition routing, online rebalancing, worker promotion, and multi-instance invalidation |
111
+ | [Partitions and workers](../../docs/partitions-and-workers.md) | Partition routing, online rebalancing, worker copies, and multi-instance invalidation |
112
112
  | [Language support](../../docs/language-support.md) | The 107 language modules, analysis revisions and rebuilds, and named tokenizers and stop words |
113
113
  | [HTTP server](../../docs/http-server.md) | Wrapping an engine in a REST API, every route it serves, and long-running tasks |
114
114
  | [Cluster mode](../../docs/cluster.md) | Multi-node indexes: nodes and roles, replication, routed writes, distributed searches and reads, and what a cluster refuses |
@@ -1,18 +1,20 @@
1
1
  import { NarsilError, ErrorCodes } from '../chunk-P4ELXVJQ.mjs';
2
2
 
3
+ // src/persistence/constants.ts
4
+ var DEFAULT_INDEXEDDB_NAME = "narsil";
5
+ var DEFAULT_INDEXEDDB_STORE_NAME = "partitions";
6
+ var MAX_PERSISTENCE_KEY_LENGTH = 1024;
7
+ var INDEXEDDB_BLOCKED_TIMEOUT_MS = 5e3;
8
+
3
9
  // src/persistence/indexeddb.ts
4
- var DEFAULT_DB_NAME = "narsil";
5
- var DEFAULT_STORE_NAME = "partitions";
6
- var MAX_KEY_LENGTH = 1024;
7
- var BLOCKED_TIMEOUT_MS = 5e3;
8
10
  function validateKey(key) {
9
11
  if (!key || key.length === 0) {
10
12
  throw new NarsilError(ErrorCodes.PERSISTENCE_SAVE_FAILED, "Key must be a non-empty string");
11
13
  }
12
- if (key.length > MAX_KEY_LENGTH) {
14
+ if (key.length > MAX_PERSISTENCE_KEY_LENGTH) {
13
15
  throw new NarsilError(
14
16
  ErrorCodes.PERSISTENCE_SAVE_FAILED,
15
- `Key length ${key.length} exceeds maximum of ${MAX_KEY_LENGTH}`
17
+ `Key length ${key.length} exceeds maximum of ${MAX_PERSISTENCE_KEY_LENGTH}`
16
18
  );
17
19
  }
18
20
  }
@@ -23,8 +25,8 @@ function createIndexedDBPersistence(config) {
23
25
  "IndexedDB is not available in this environment. Use createMemoryPersistence() or createFilesystemPersistence() instead."
24
26
  );
25
27
  }
26
- const dbName = config?.dbName ?? DEFAULT_DB_NAME;
27
- const storeName = config?.storeName ?? DEFAULT_STORE_NAME;
28
+ const dbName = config?.dbName ?? DEFAULT_INDEXEDDB_NAME;
29
+ const storeName = config?.storeName ?? DEFAULT_INDEXEDDB_STORE_NAME;
28
30
  let cachedDb = null;
29
31
  function openDatabase() {
30
32
  if (cachedDb !== null) {
@@ -36,9 +38,12 @@ function createIndexedDBPersistence(config) {
36
38
  request.onblocked = () => {
37
39
  blockedTimer = setTimeout(() => {
38
40
  reject(
39
- new NarsilError(ErrorCodes.PERSISTENCE_SAVE_FAILED, `IndexedDB open blocked for ${BLOCKED_TIMEOUT_MS}ms`)
41
+ new NarsilError(
42
+ ErrorCodes.PERSISTENCE_SAVE_FAILED,
43
+ `IndexedDB open blocked for ${INDEXEDDB_BLOCKED_TIMEOUT_MS}ms`
44
+ )
40
45
  );
41
- }, BLOCKED_TIMEOUT_MS);
46
+ }, INDEXEDDB_BLOCKED_TIMEOUT_MS);
42
47
  };
43
48
  request.onupgradeneeded = () => {
44
49
  const db = request.result;
@@ -108,8 +108,10 @@ function compareSortStrings(a, b) {
108
108
  return compareCodePoints(a, b);
109
109
  }
110
110
 
111
- // src/core/ordering/sort-values.ts
111
+ // src/core/ordering/constants.ts
112
112
  var SORT_VALUE_MAX_CODE_POINTS = 512;
113
+
114
+ // src/core/ordering/sort-values.ts
113
115
  function truncateSortString(value) {
114
116
  if (value.length <= SORT_VALUE_MAX_CODE_POINTS) return value;
115
117
  let index = 0;