@delali/narsil 0.3.1-next.69 → 0.3.1-next.71

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 (46) hide show
  1. package/dist/{capabilities-B1wz2Zl0.d.ts → capabilities-Dt-7B4Wz.d.ts} +2 -2
  2. package/dist/{chunk-DD5X23E6.mjs → chunk-2STVUTNA.mjs} +1 -1
  3. package/dist/chunk-3JGWULDF.mjs +256 -0
  4. package/dist/{chunk-6TGZG2TV.mjs → chunk-653BNMAF.mjs} +190 -58
  5. package/dist/{chunk-YA52AC2V.mjs → chunk-FVLQ63B7.mjs} +203 -9
  6. package/dist/{chunk-5JLSTECC.mjs → chunk-GIVAGD3Q.mjs} +1 -1
  7. package/dist/{chunk-AV4IJKD2.mjs → chunk-HWQLTLNG.mjs} +18 -1
  8. package/dist/{chunk-6IT3MH5M.mjs → chunk-IOR2K26O.mjs} +178 -238
  9. package/dist/{chunk-4VU5TWCR.mjs → chunk-LMO5TJUS.mjs} +40 -35
  10. package/dist/{chunk-BEWOA4VV.mjs → chunk-M76V3OGJ.mjs} +508 -401
  11. package/dist/{chunk-YMZCMH5M.mjs → chunk-OI42GWLR.mjs} +17 -1
  12. package/dist/{chunk-2BDG2IWP.mjs → chunk-P4DSQ6M4.mjs} +16 -6
  13. package/dist/{chunk-THYRHHO2.mjs → chunk-YJDQ7NLA.mjs} +1 -1
  14. package/dist/{client-xVrOCYTW.d.ts → client-COek5GXK.d.ts} +3 -3
  15. package/dist/client.d.ts +8 -8
  16. package/dist/{config-CEeSV_Xo.d.ts → config-Dfanyqqt.d.ts} +2 -2
  17. package/dist/{config-CSvCVtB7.d.ts → config-rBpbgTw8.d.ts} +2 -2
  18. package/dist/direct-executor-GYJEKNV5.mjs +12 -0
  19. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  20. package/dist/distribution/coordinator/etcd.mjs +1 -1
  21. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  22. package/dist/distribution/coordinator/in-memory.mjs +1 -1
  23. package/dist/distribution.d.ts +8 -8
  24. package/dist/distribution.mjs +109 -69
  25. package/dist/{engine-77ErLy8P.d.ts → engine-igk0aMpQ.d.ts} +109 -60
  26. package/dist/index.browser.mjs +1167 -749
  27. package/dist/index.d.ts +7 -7
  28. package/dist/index.mjs +10 -10
  29. package/dist/invalidation/filesystem.mjs +1 -1
  30. package/dist/{memory-CKF-9WLP.d.ts → memory-C7UMCMH3.d.ts} +35 -17
  31. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -1
  32. package/dist/persistence/durability/checkpoint-worker.mjs +10 -10
  33. package/dist/react.d.ts +277 -182
  34. package/dist/react.mjs +189 -45
  35. package/dist/{schema-d5Afu03A.d.ts → schema-Bgzr4g7b.d.ts} +62 -10
  36. package/dist/server.d.ts +10 -10
  37. package/dist/server.mjs +11 -7
  38. package/dist/{tasks-BEiNxDRs.d.ts → tasks-BZt_zes6.d.ts} +3 -1
  39. package/dist/{thread-FLP45EUD.mjs → thread-JEVAYETR.mjs} +6 -6
  40. package/dist/{types-DAK7mnUZ.d.ts → types-gOUqhs2F.d.ts} +1 -1
  41. package/dist/vector/search-worker.d.ts +1 -1
  42. package/dist/vector/search-worker.mjs +2 -2
  43. package/dist/workers/entry.mjs +3 -3
  44. package/package.json +7 -7
  45. package/dist/chunk-VTPLKNWI.mjs +0 -135
  46. package/dist/direct-executor-3ZYXSGFX.mjs +0 -12
@@ -1,119 +1,168 @@
1
1
  import { E as EmbeddingAdapter } from './adapters-79OIa4xm.js';
2
- import { B as BatchResult, I as IndexInfo, f as IndexStats, P as PartitionStatsResult, L as ListParams, g as ListResult, Q as QueryParams, e as QueryResult, h as PreflightResult, j as SuggestParams, k as SuggestResult, M as MemoryStats, V as VectorMaintenanceResult } from './memory-CKF-9WLP.js';
3
- import { A as AnyDocument, a as InsertOptions, W as WriteOptions, I as IndexConfig, P as PartitionConfig } from './schema-d5Afu03A.js';
2
+ import { B as BatchResult, I as IndexInfo, f as IndexStats, P as PartitionStatsResult, L as ListParams, g as ListResult, Q as QueryParams, e as QueryResult, h as PreflightResult, j as SuggestParams, k as SuggestResult, M as MemoryStats, V as VectorMaintenanceResult } from './memory-C7UMCMH3.js';
3
+ import { A as AnyDocument, a as InsertOptions, W as WriteOptions, I as IndexConfig, P as PartitionConfig } from './schema-Bgzr4g7b.js';
4
4
 
5
5
  /**
6
- * Every event the engine emits, with the payload each one carries.
6
+ * This map lists every event that the engine emits, with the payload of each
7
+ * one.
7
8
  *
8
- * {@link Narsil.on} takes a key from this map and hands your listener the
9
- * matching payload. These events report work the engine does on its own, away
10
- * from the call that triggered it, so a failure here never rejects a promise
11
- * you are holding.
9
+ * {@link Narsil.on} registers a listener under a key from this map, so that the
10
+ * engine can pass the matching payload to that listener. Most of these events
11
+ * report work that the engine does in the background, away from the call that
12
+ * started it, so a failure that such an event reports never rejects a promise
13
+ * that you are holding.
12
14
  *
13
15
  * @public
14
16
  */
15
17
  type NarsilEventMap = {
16
18
  /**
17
- * A worker thread died. The pool drops it and fails the requests that it was
18
- * serving with `WORKER_CRASHED`, and the engine answers each of those queries
19
- * again on the main thread, so the caller receives a result and no error.
20
- * The remaining workers keep answering, because each holds a full worker
21
- * copy of every promoted index. After a delay the
22
- * engine spawns a replacement, loads every copy onto it, and puts it back
23
- * into rotation. Once no worker is left, queries fall back to the main
24
- * thread, which holds every document, and the next request after the delay
25
- * starts a new pool. The delay starts at one second and doubles up to a
26
- * minute while replacements keep failing.
19
+ * The engine emits this event after a call changes what a read returns from
20
+ * an index. The calls are the inserts, updates, and removals, singly or in a
21
+ * batch, together with `clear`, `restore`, `rebalance`, `rebuildAnalysis`,
22
+ * `compactVectors`, `optimizeVectors`, `createIndex`, and `dropIndex`. The
23
+ * engine emits the event after a call that throws as well, because a call can
24
+ * change the index before it throws. It also emits the event after it reloads
25
+ * an index, once a shared invalidation adapter reports that another instance
26
+ * saved that index. The engine emits one event per batch, however many
27
+ * documents the batch holds.
28
+ *
29
+ * The engine emits the event once a query can see the change, which means
30
+ * after every worker copy applies the change and after any rebalance in
31
+ * progress replays it. A query that a listener sends from its handler
32
+ * therefore returns results that include the change. The engine waits for the
33
+ * change to become visible only while a listener is registered for the event.
34
+ */
35
+ write: {
36
+ /** This is the name of the index that changed. */
37
+ indexName: string;
38
+ };
39
+ /**
40
+ * A worker thread exited unexpectedly. The pool removes the thread and fails
41
+ * the requests that the thread was serving with `WORKER_CRASHED`. The engine
42
+ * then sends each of those queries again on the main thread, so the caller
43
+ * receives a result with no error. The remaining workers keep serving
44
+ * queries, because each of them holds a full worker copy of every promoted
45
+ * index.
46
+ *
47
+ * After a delay, the engine spawns a replacement and loads every copy onto
48
+ * it before it sends queries to the replacement. Once no worker is left, the
49
+ * main thread serves every query, because it holds every document. The first
50
+ * request after the delay then starts a new pool. The delay starts at one
51
+ * second and doubles up to a minute while replacements keep failing.
27
52
  */
28
53
  workerCrash: {
29
- /** This worker died. */
54
+ /** This is the id of the worker that exited. */
30
55
  workerId: number;
31
- /** That worker was holding these indexes. */
56
+ /** These are the indexes that the worker held. */
32
57
  indexNames: string[];
33
- /** This ended the worker. */
58
+ /** This is the error that ended the worker. */
34
59
  error: Error;
35
60
  };
36
- /** An index gained worker copies, whether it reached the copy threshold or loaded its copies again after an idle spell. */
61
+ /** An index gained worker copies, either because it reached the copy
62
+ * threshold or because a request loaded its copies again after an idle
63
+ * spell. */
37
64
  workerPromote: {
38
- /** The pool holds this many workers. */
65
+ /** This is the number of workers in the pool. */
39
66
  workerCount: number;
40
- /** The index gained its copies for this reason, such as the copy threshold it reached. */
67
+ /** This is the reason that the index gained its copies, such as the copy
68
+ * threshold that it reached. */
41
69
  reason: string;
42
70
  };
43
- /** An index could not gain worker copies. It keeps answering on the main thread. */
71
+ /** An index could not gain worker copies, so the main thread keeps serving
72
+ * its queries. */
44
73
  workerPromoteFailure: {
45
- /** The engine tried to load the copies for this reason. */
74
+ /** This is the reason that the engine tried to load the copies. */
46
75
  reason: string;
47
- /** This stopped it. */
76
+ /** This is the error that stopped the load. */
48
77
  error: Error;
49
- /** This turns true when the engine will try again on a later threshold. */
78
+ /** This is true when the engine will try again at a later threshold. */
50
79
  retryable: boolean;
51
80
  };
52
- /** An index finished spreading its documents across a new partition count. */
81
+ /** An index finished spreading its documents across a new number of
82
+ * partitions. */
53
83
  partitionRebalance: {
54
- /** This index was rebalanced. */
84
+ /** This is the name of the index that the engine rebalanced. */
55
85
  indexName: string;
56
- /** The index held this many partitions before. */
86
+ /** This is the number of partitions before the rebalance. */
57
87
  oldCount: number;
58
- /** The index holds this many partitions now. */
88
+ /** This is the number of partitions after the rebalance. */
59
89
  newCount: number;
60
90
  };
61
- /** A partition passed its watermark, so the index is close to needing another one. */
91
+ /**
92
+ * An index passed its watermark, so its partitions are close to their
93
+ * capacity. On a cluster node, the engine reports the document count and the
94
+ * capacity of the one partition that `partitionId` identifies, which this
95
+ * node leads.
96
+ */
62
97
  partitionWatermark: {
63
- /** This index crossed the mark. */
98
+ /** This is the name of the index that crossed the mark. */
64
99
  indexName: string;
65
- /** The index holds this many documents. */
100
+ /** This is the number of documents in the index, or in the partition on a
101
+ * cluster node. */
66
102
  documentCount: number;
67
- /** The index can hold this many across its current partitions. */
103
+ /** This is the number of documents that the current partitions of the
104
+ * index can hold, or that the partition can hold on a cluster node. */
68
105
  capacity: number;
69
- /** The index holds this many partitions. */
106
+ /** This is the number of partitions in the index. */
70
107
  partitionCount: number;
108
+ /** On a cluster node, this is the partition that crossed the mark, while
109
+ * outside a cluster the field is absent. */
110
+ partitionId?: number;
71
111
  };
72
112
  /**
73
- * The process uses nine tenths of its heap, measured during a write or a
74
- * load, so the next large index may end the process with an out-of-memory
75
- * error. Where `--max-old-space-size` or `--max-old-space-size-percentage`
76
- * sets a limit, on the command line or in `NODE_OPTIONS`, the engine measures
77
- * the used bytes against that figure and `heapLimit` reports it. Where
78
- * neither flag sets one, the engine compares the used bytes with the headroom
79
- * that V8 reports, which runs about 192 MB above the true ceiling, so a
80
- * default heap below about 2 GB may end before this event fires. The engine
81
- * emits the event once per crossing and arms it again once the headroom
82
- * recovers to two tenths. Raise the limit with
113
+ * The process uses nine tenths of its heap, as measured during a write or a
114
+ * load, so the next large index can end the process with an out-of-memory
115
+ * error.
116
+ *
117
+ * Where `--max-old-space-size` or `--max-old-space-size-percentage` sets a
118
+ * limit, on the command line or in `NODE_OPTIONS`, the engine measures the
119
+ * used bytes against that limit, which `heapLimit` then reports. Where
120
+ * neither flag sets a limit, the engine measures the share of the heap that
121
+ * V8 reports as no longer available. V8 reports a limit about 192 MB above
122
+ * the true ceiling, so a process on a default heap below about 2 GB can end before
123
+ * this event fires.
124
+ *
125
+ * The engine emits the event once per crossing, then arms it again once the
126
+ * free share of the heap recovers to two tenths. Raise the limit with
83
127
  * `--max-old-space-size-percentage` or `--max-old-space-size`, or close an
84
128
  * idle index; see {@link ProcessMemoryReport.heapLimit}.
85
129
  */
86
130
  heapPressure: {
87
- /** The heap reaches that point during a write to this index or a load of it. */
131
+ /** This is the index that a write or a load was touching when the heap
132
+ * reached that point. */
88
133
  indexName: string;
89
- /** The process uses this much heap, in bytes. */
134
+ /** This is the heap that the process uses, in bytes. */
90
135
  heapUsed: number;
91
- /** The heap may grow to this many bytes. */
136
+ /** This is the size in bytes that the heap can grow to. */
92
137
  heapLimit: number;
93
- /** The engine estimates that the index holds this many bytes. */
138
+ /** This is the estimate of the bytes that the index holds. */
94
139
  estimatedMemoryBytes: number;
95
140
  };
96
- /** A rebuild is bringing an index's terms up to its language module's current analysis. */
141
+ /** The engine started, completed, or failed a rebuild that brings the terms
142
+ * of an index up to the current analysis of its language module. */
97
143
  analysisRebuild: {
98
- /** This index is being rebuilt. */
144
+ /** This is the name of the index under rebuild. */
99
145
  indexName: string;
100
- /** The rebuild stands here. */
146
+ /** This is the stage that the rebuild has reached. */
101
147
  status: 'started' | 'completed' | 'failed';
102
- /** The rebuild has covered this many partitions so far. */
148
+ /** This is the number of partitions that the rebuild has covered so far. */
103
149
  partitionsRebuilt: number;
104
- /** The rebuild covers this many partitions in total. */
150
+ /** This is the number of partitions that the rebuild covers in total. */
105
151
  partitionCount: number;
106
- /** This stopped the rebuild, and only a `failed` status carries it. */
152
+ /** This is the error that stopped the rebuild, which only a `failed`
153
+ * status includes. */
107
154
  error?: Error;
108
155
  };
109
- /** The write-ahead log or a checkpoint failed, so writes since the last checkpoint are at risk. */
156
+ /** A write to the write-ahead log or a checkpoint failed, so the writes since
157
+ * the last checkpoint are at risk. */
110
158
  durabilityError: {
111
- /** The durability layer threw this. */
159
+ /** This is the error that the durability layer threw. */
112
160
  error: Error;
113
161
  };
114
- /** The invalidation channel failed, so this instance may be reading partitions another instance has changed. */
162
+ /** The invalidation channel failed, so this instance can serve partitions
163
+ * that another instance has since changed. */
115
164
  invalidationError: {
116
- /** The adapter threw this. */
165
+ /** This is the error that the adapter threw. */
117
166
  error: Error;
118
167
  };
119
168
  };