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

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 (59) hide show
  1. package/README.md +2 -2
  2. package/dist/adapters/filesystem.mjs +1 -1
  3. package/dist/adapters/indexeddb.mjs +1 -1
  4. package/dist/{capabilities-D6gjjQyA.d.ts → capabilities-CYeAWYxQ.d.ts} +19 -4
  5. package/dist/{chunk-Y52WZWAU.mjs → chunk-2WLD2NFW.mjs} +4 -4
  6. package/dist/{chunk-QR4OKRVY.mjs → chunk-3YKWSO54.mjs} +8 -3
  7. package/dist/{chunk-KZTI25D3.mjs → chunk-4MQ5F4IL.mjs} +1 -1
  8. package/dist/{chunk-CVPA5Q7R.mjs → chunk-AFKH4ZK3.mjs} +9 -6
  9. package/dist/{chunk-M6XF5HDE.mjs → chunk-AK3BLGCI.mjs} +141 -11
  10. package/dist/{chunk-7QMTA7AA.mjs → chunk-CVFAFZSN.mjs} +7771 -4271
  11. package/dist/{chunk-RV77FR2F.mjs → chunk-I64LXKO3.mjs} +0 -1
  12. package/dist/{chunk-EDMCZLSJ.mjs → chunk-LPBWCHBE.mjs} +193 -13
  13. package/dist/{chunk-P2ZZN32C.mjs → chunk-PU43WDY4.mjs} +4 -2
  14. package/dist/{chunk-HVJYTKK7.mjs → chunk-THMSFOJO.mjs} +365 -774
  15. package/dist/{chunk-LCCL6EEH.mjs → chunk-WVDFG45M.mjs} +92 -94
  16. package/dist/{chunk-3HQPUCCT.mjs → chunk-XW25X6AU.mjs} +66 -237
  17. package/dist/{chunk-2X2ZQOAB.mjs → chunk-ZULSEZCE.mjs} +3 -4
  18. package/dist/{client-C2TiW29y.d.ts → client-D698E5ge.d.ts} +76 -25
  19. package/dist/client.d.ts +7 -7
  20. package/dist/client.mjs +44 -22
  21. package/dist/{config-BLguB-om.d.ts → config-Bv8etwUZ.d.ts} +10 -3
  22. package/dist/{config-C7Ip8Ife.d.ts → config-QXU3HMpq.d.ts} +10 -1
  23. package/dist/direct-executor-5SRDFZAS.mjs +13 -0
  24. package/dist/distribution/coordinator/etcd.d.ts +27 -14
  25. package/dist/distribution/coordinator/etcd.mjs +162 -75
  26. package/dist/distribution/transport/grpc.d.ts +2 -2
  27. package/dist/distribution/transport/grpc.mjs +22 -2
  28. package/dist/distribution/transport/in-memory.d.ts +2 -2
  29. package/dist/distribution/transport/in-memory.mjs +6 -3
  30. package/dist/distribution/transport/tcp.d.ts +2 -2
  31. package/dist/distribution/transport/tcp.mjs +40 -16
  32. package/dist/distribution.d.ts +6 -6
  33. package/dist/distribution.mjs +637 -366
  34. package/dist/embeddings/openai.mjs +1 -1
  35. package/dist/{engine-Dm4446j1.d.ts → engine-D_OzKZ-6.d.ts} +96 -187
  36. package/dist/index.browser.mjs +7179 -4031
  37. package/dist/index.d.ts +5 -5
  38. package/dist/index.mjs +11 -14
  39. package/dist/{memory-CKHTU1CL.d.ts → memory-B4jMmygw.d.ts} +213 -2
  40. package/dist/pattern.mjs +1 -1
  41. package/dist/persistence/durability/checkpoint-worker.d.ts +24 -16
  42. package/dist/persistence/durability/checkpoint-worker.mjs +22 -16
  43. package/dist/react.d.ts +6 -6
  44. package/dist/react.mjs +0 -1
  45. package/dist/server.d.ts +9 -9
  46. package/dist/server.mjs +210 -32
  47. package/dist/{tasks-BECd0b__.d.ts → tasks-DpgCpW1x.d.ts} +3 -3
  48. package/dist/{thread-IBSIZZ6W.mjs → thread-3LNVA43V.mjs} +79 -21
  49. package/dist/{types-BQDlIvfS.d.ts → types-B3b68nfF.d.ts} +1 -1
  50. package/dist/{types-D5OwhtsQ.d.ts → types-Cb9kiY5P.d.ts} +1 -1
  51. package/dist/vector/search-worker.mjs +3 -3
  52. package/dist/workers/entry.mjs +4 -4
  53. package/package.json +7 -7
  54. package/dist/chunk-3L4U6EJQ.mjs +0 -49
  55. package/dist/chunk-IFBKLBGB.mjs +0 -7
  56. package/dist/chunk-XZ4PAREY.mjs +0 -25
  57. package/dist/direct-executor-SVCHXR74.mjs +0 -14
  58. package/dist/serialization/crc32-worker.d.ts +0 -20
  59. package/dist/serialization/crc32-worker.mjs +0 -62
package/dist/index.d.ts CHANGED
@@ -3,11 +3,11 @@ export { A as AnyDocument, B as BM25Params, E as EmbeddingFieldConfig, F as Fiel
3
3
  import { P as PatternSearch } from './pattern-Cledccbl.js';
4
4
  import { L as LanguageModule } from './language-DB8KG1z5.js';
5
5
  export { T as TokenizerConfig } from './language-DB8KG1z5.js';
6
- export { A as ArrayFilter, B as BatchResult, C as ClientErrorCode, a as ClientErrorCodes, l as ComparisonFilter, D as DocumentProjection, E as ErrorCode, b as ErrorCodes, F as FacetConfig, m as FacetResult, n as FieldFilter, o as FilterExpression, G as GeoFilter, p as GeoPolygonFilter, q as GeoRadiusFilter, r as GroupConfig, s as GroupReducer, t as GroupResult, H as HighlightConfig, u as HighlightMatch, v as Hit, w as HybridConfig, I as IndexInfo, f as IndexStats, L as ListParams, g as ListResult, x as ListedDocument, M as MemoryStats, N as NarsilError, c as NarsilErrorCode, P as PartitionStatsResult, h as PreflightResult, y as PresenceFilter, z as ProcessMemoryReport, J as QueryCoverage, Q as QueryParams, e as QueryResult, K as ScoreComponents, O as SearchMode, S as ServerErrorCode, d as ServerErrorCodes, R as SortField, T as SortSpec, U as StringFilter, j as SuggestParams, k as SuggestResult, W as TermMatchPolicy, V as VectorMaintenanceResult, X as VectorQueryConfig, Y as WorkerCopyReport, i as isNarsilError } from './memory-CKHTU1CL.js';
7
- import { N as NarsilConfig } from './config-C7Ip8Ife.js';
8
- export { A as AnalysisConfig, D as DurabilityConfig, I as IndexContext, a as IndexLifecycleConfig, b as InsertContext, M as MainCopyQueries, c as NarsilPlugin, P as PartitionContext, R as RemoveContext, S as SearchContext, d as StaleAnalysis, U as UpdateContext, W as WorkerConfig, e as WorkerContext } from './config-C7Ip8Ife.js';
9
- import { a as Narsil } from './engine-Dm4446j1.js';
10
- export { D as DocumentWriteOperations, I as IndexLifecycleOperations, N as NarsilEventMap } from './engine-Dm4446j1.js';
6
+ export { A as ArrayFilter, B as BatchResult, C as ClientErrorCode, a as ClientErrorCodes, n as ComparisonFilter, D as DocumentImportResult, o as DocumentProjection, E as ErrorCode, b as ErrorCodes, F as FacetConfig, p as FacetResult, q as FieldFilter, r as FilterExpression, G as GeoFilter, s as GeoPolygonFilter, t as GeoRadiusFilter, u as GroupConfig, v as GroupReducer, w as GroupResult, H as HighlightConfig, x as HighlightMatch, y as Hit, z as HybridConfig, I as IndexInfo, g as IndexStats, L as ListParams, h as ListResult, J as ListedDocument, M as MemoryStats, N as NarsilError, c as NarsilErrorCode, f as NarsilEventHandlers, m as NarsilEventMap, P as PartitionStatsResult, j as PreflightResult, K as PresenceFilter, O as ProcessMemoryReport, R as QueryCoverage, Q as QueryParams, e as QueryResult, T as ScoreComponents, U as SearchMode, S as ServerErrorCode, d as ServerErrorCodes, W as SortField, X as SortSpec, Y as StringFilter, k as SuggestParams, l as SuggestResult, Z as TermMatchPolicy, V as VectorMaintenanceResult, _ as VectorQueryConfig, $ as WorkerCopyReport, i as isNarsilError } from './memory-B4jMmygw.js';
7
+ import { N as NarsilConfig } from './config-QXU3HMpq.js';
8
+ export { A as AnalysisConfig, D as DurabilityConfig, I as IndexContext, a as IndexLifecycleConfig, b as InsertContext, M as MainCopyQueries, c as NarsilPlugin, P as PartitionContext, R as RemoveContext, S as SearchContext, d as StaleAnalysis, U as UpdateContext, W as WorkerConfig, e as WorkerContext } from './config-QXU3HMpq.js';
9
+ import { N as Narsil } from './engine-D_OzKZ-6.js';
10
+ export { B as ByteSource, D as DocumentWriteOperations, I as IndexLifecycleOperations } from './engine-D_OzKZ-6.js';
11
11
  export { E as EmbeddingAdapter, I as InvalidationAdapter, a as InvalidationEvent, b as PartitionStatistics, P as PersistenceAdapter } from './adapters-79OIa4xm.js';
12
12
  export { i as isSimdAvailable } from './simd-DW5AtJ6B.js';
13
13
 
package/dist/index.mjs CHANGED
@@ -1,21 +1,18 @@
1
- export { VERSION, createNarsil } from './chunk-7QMTA7AA.mjs';
2
- import './chunk-2X2ZQOAB.mjs';
1
+ export { VERSION, createNarsil } from './chunk-CVFAFZSN.mjs';
3
2
  import './chunk-GCM3JFVA.mjs';
4
- import './chunk-CVPA5Q7R.mjs';
5
- import './chunk-XZ4PAREY.mjs';
6
- export { getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerPatternSearch, registerStopWords, registerTokenizer } from './chunk-HVJYTKK7.mjs';
7
- export { clearNormalizationCache, configureNormalizationCache, getNormalizationCacheSize, resetNormalizationCache } from './chunk-QR4OKRVY.mjs';
8
- export { getLanguage, registerLanguage } from './chunk-KZTI25D3.mjs';
9
- import './chunk-M6XF5HDE.mjs';
3
+ import './chunk-AFKH4ZK3.mjs';
4
+ export { getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerPatternSearch, registerStopWords, registerTokenizer } from './chunk-THMSFOJO.mjs';
5
+ export { getLanguage, registerLanguage } from './chunk-4MQ5F4IL.mjs';
6
+ import './chunk-ZULSEZCE.mjs';
7
+ export { clearNormalizationCache, configureNormalizationCache, getNormalizationCacheSize, resetNormalizationCache } from './chunk-3YKWSO54.mjs';
8
+ import './chunk-AK3BLGCI.mjs';
10
9
  import './chunk-TGP5M5R7.mjs';
11
- export { isSimdAvailable } from './chunk-LCCL6EEH.mjs';
10
+ export { isSimdAvailable } from './chunk-WVDFG45M.mjs';
12
11
  import './chunk-ZJ4CSAB2.mjs';
13
- import './chunk-P2ZZN32C.mjs';
14
- import './chunk-3L4U6EJQ.mjs';
15
- import './chunk-IFBKLBGB.mjs';
16
- import './chunk-3HQPUCCT.mjs';
12
+ import './chunk-PU43WDY4.mjs';
13
+ import './chunk-XW25X6AU.mjs';
17
14
  import './chunk-ZKRV5M2P.mjs';
18
15
  import './chunk-U2BKYEC7.mjs';
19
16
  import './chunk-LJYTW7GT.mjs';
20
17
  import './chunk-POWOTUKJ.mjs';
21
- export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './chunk-RV77FR2F.mjs';
18
+ export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './chunk-I64LXKO3.mjs';
@@ -82,7 +82,6 @@ declare const ErrorCodes: {
82
82
  readonly SNAPSHOT_SYNC_UNAUTHORIZED: "SNAPSHOT_SYNC_UNAUTHORIZED";
83
83
  readonly SNAPSHOT_SYNC_REQUEST_INVALID: "SNAPSHOT_SYNC_REQUEST_INVALID";
84
84
  readonly SNAPSHOT_SYNC_INDEX_NOT_FOUND: "SNAPSHOT_SYNC_INDEX_NOT_FOUND";
85
- readonly SNAPSHOT_SYNC_TOO_LARGE: "SNAPSHOT_SYNC_TOO_LARGE";
86
85
  readonly SNAPSHOT_SYNC_CAPACITY_EXHAUSTED: "SNAPSHOT_SYNC_CAPACITY_EXHAUSTED";
87
86
  readonly SNAPSHOT_SYNC_SNAPSHOT_FAILED: "SNAPSHOT_SYNC_SNAPSHOT_FAILED";
88
87
  readonly SNAPSHOT_SYNC_DECODE_FAILED: "SNAPSHOT_SYNC_DECODE_FAILED";
@@ -226,6 +225,200 @@ declare class NarsilError extends Error {
226
225
  */
227
226
  declare function isNarsilError(value: unknown): value is NarsilError;
228
227
 
228
+ /**
229
+ * This map lists every event that the engine emits, with the payload of each
230
+ * one.
231
+ *
232
+ * {@link Narsil.on} registers a listener under a key from this map, so that the
233
+ * engine can pass the matching payload to that listener. Most of these events
234
+ * report work that the engine does in the background, away from the call that
235
+ * started it, so a failure that such an event reports never rejects a promise
236
+ * that you are holding.
237
+ *
238
+ * @public
239
+ */
240
+ type NarsilEventMap = {
241
+ /**
242
+ * The engine emits this event after a call changes what a read returns from
243
+ * an index. The calls are the inserts, updates, and removals, singly or in a
244
+ * batch, together with `clear`, `restore`, `rebalance`, `rebuildAnalysis`,
245
+ * `compactVectors`, `optimizeVectors`, `createIndex`, and `dropIndex`. The
246
+ * engine emits the event after a call that throws as well, because a call can
247
+ * change the index before it throws. It also emits the event after it reloads
248
+ * an index, once a shared invalidation adapter reports that another instance
249
+ * saved that index. The engine emits one event per batch, however many
250
+ * documents the batch holds.
251
+ *
252
+ * The engine emits the event once a query can see the change, which means
253
+ * after every worker copy applies the change and after any rebalance in
254
+ * progress replays it. A query that a listener sends from its handler
255
+ * therefore returns results that include the change. The engine waits for the
256
+ * change to become visible only while a listener is registered for the event.
257
+ */
258
+ write: {
259
+ /** This is the name of the index that changed. */
260
+ indexName: string;
261
+ };
262
+ /**
263
+ * A worker thread exited unexpectedly. The pool removes the thread and fails
264
+ * the requests that the thread was serving with `WORKER_CRASHED`. The engine
265
+ * then sends each of those queries again on the main thread, so the caller
266
+ * receives a result with no error. The remaining workers keep serving
267
+ * queries, because each of them holds a full worker copy of every promoted
268
+ * index.
269
+ *
270
+ * After a delay, the engine spawns a replacement and loads every copy onto
271
+ * it before it sends queries to the replacement. Once no worker is left, the
272
+ * main thread serves every query, because it holds every document. The first
273
+ * request after the delay then starts a new pool. The delay starts at one
274
+ * second and doubles up to a minute while replacements keep failing.
275
+ */
276
+ workerCrash: {
277
+ /** This is the id of the worker that exited. */
278
+ workerId: number;
279
+ /** These are the indexes that the worker held. */
280
+ indexNames: string[];
281
+ /** This is the error that ended the worker. */
282
+ error: Error;
283
+ };
284
+ /** An index gained worker copies, either because it reached the copy
285
+ * threshold or because a request loaded its copies again after an idle
286
+ * spell. */
287
+ workerPromote: {
288
+ /** This is the number of workers in the pool. */
289
+ workerCount: number;
290
+ /** This is the reason that the index gained its copies, such as the copy
291
+ * threshold that it reached. */
292
+ reason: string;
293
+ };
294
+ /** An index could not gain worker copies, so the main thread keeps serving
295
+ * its queries. */
296
+ workerPromoteFailure: {
297
+ /** This is the reason that the engine tried to load the copies. */
298
+ reason: string;
299
+ /** This is the error that stopped the load. */
300
+ error: Error;
301
+ /** This is true when the engine will try again at a later threshold. */
302
+ retryable: boolean;
303
+ };
304
+ /** An index finished spreading its documents across a new number of
305
+ * partitions. */
306
+ partitionRebalance: {
307
+ /** This is the name of the index that the engine rebalanced. */
308
+ indexName: string;
309
+ /** This is the number of partitions before the rebalance. */
310
+ oldCount: number;
311
+ /** This is the number of partitions after the rebalance. */
312
+ newCount: number;
313
+ };
314
+ /**
315
+ * An index passed its watermark, so its partitions are close to their
316
+ * capacity. On a cluster node, the engine reports the document count and the
317
+ * capacity of the one partition that `partitionId` identifies, which this
318
+ * node leads.
319
+ */
320
+ partitionWatermark: {
321
+ /** This is the name of the index that crossed the mark. */
322
+ indexName: string;
323
+ /** This is the number of documents in the index, or in the partition on a
324
+ * cluster node. */
325
+ documentCount: number;
326
+ /** This is the number of documents that the current partitions of the
327
+ * index can hold, or that the partition can hold on a cluster node. */
328
+ capacity: number;
329
+ /** This is the number of partitions in the index. */
330
+ partitionCount: number;
331
+ /** On a cluster node, this is the partition that crossed the mark, while
332
+ * outside a cluster the field is absent. */
333
+ partitionId?: number;
334
+ };
335
+ /**
336
+ * The process uses nine tenths of its heap, as measured during a write or a
337
+ * load, so the next large index can end the process with an out-of-memory
338
+ * error.
339
+ *
340
+ * Where `--max-old-space-size` or `--max-old-space-size-percentage` sets a
341
+ * limit, on the command line or in `NODE_OPTIONS`, the engine measures the
342
+ * used bytes against that limit, which `heapLimit` then reports. Where
343
+ * neither flag sets a limit, the engine measures the share of the heap that
344
+ * V8 reports as no longer available. V8 reports a limit about 192 MB above
345
+ * the true ceiling, so a process on a default heap below about 2 GB can end before
346
+ * this event fires.
347
+ *
348
+ * The engine emits the event once per crossing, then arms it again once the
349
+ * free share of the heap recovers to two tenths. Raise the limit with
350
+ * `--max-old-space-size-percentage` or `--max-old-space-size`, or close an
351
+ * idle index; see {@link ProcessMemoryReport.heapLimit}.
352
+ */
353
+ heapPressure: {
354
+ /** This is the index that a write or a load was touching when the heap
355
+ * reached that point. */
356
+ indexName: string;
357
+ /** This is the heap that the process uses, in bytes. */
358
+ heapUsed: number;
359
+ /** This is the size in bytes that the heap can grow to. */
360
+ heapLimit: number;
361
+ /** This is the estimate of the bytes that the index holds. */
362
+ estimatedMemoryBytes: number;
363
+ };
364
+ /** The engine started, completed, or failed a rebuild that brings the terms
365
+ * of an index up to the current analysis of its language module. */
366
+ analysisRebuild: {
367
+ /** This is the name of the index under rebuild. */
368
+ indexName: string;
369
+ /** This is the stage that the rebuild has reached. */
370
+ status: 'started' | 'completed' | 'failed';
371
+ /** This is the number of partitions that the rebuild has covered so far. */
372
+ partitionsRebuilt: number;
373
+ /** This is the number of partitions that the rebuild covers in total. */
374
+ partitionCount: number;
375
+ /** This is the error that stopped the rebuild, which only a `failed`
376
+ * status includes. */
377
+ error?: Error;
378
+ };
379
+ /** The engine started, completed, or failed the rewrite of an index that you
380
+ * saved with an earlier release. The engine rewrites the index as it
381
+ * recovers it, before it serves the index's first request. Because the
382
+ * engine writes the new manifest last, the earlier files stay intact through
383
+ * a failed rewrite. The engine then starts the rewrite again the next time
384
+ * it recovers the index. Without index lifecycle settings, the engine
385
+ * recovers every index before {@link createNarsil} returns, so pass the
386
+ * listener in the `events` setting of {@link createNarsil}. */
387
+ layoutUpgrade: {
388
+ /** This is the name of the index under rewrite. */
389
+ indexName: string;
390
+ /** This is the stage that the rewrite has reached. */
391
+ status: 'started' | 'completed' | 'failed';
392
+ /** This is `manifest` where the earlier index is a segment manifest with
393
+ * its files, and `bundle` where it is a single snapshot bundle. */
394
+ layout: 'manifest' | 'bundle';
395
+ /** This is the error that stopped the rewrite, which only a `failed`
396
+ * status includes. */
397
+ error?: Error;
398
+ };
399
+ /** A write to the write-ahead log or a checkpoint failed, so the writes since
400
+ * the last checkpoint are at risk. */
401
+ durabilityError: {
402
+ /** This is the error that the durability layer threw. */
403
+ error: Error;
404
+ };
405
+ /** The invalidation channel failed, so this instance can serve partitions
406
+ * that another instance has since changed. */
407
+ invalidationError: {
408
+ /** This is the error that the adapter threw. */
409
+ error: Error;
410
+ };
411
+ };
412
+ /**
413
+ * This map holds a listener for any event of {@link NarsilEventMap}, so that
414
+ * the engine can register each listener before it starts.
415
+ *
416
+ * @public
417
+ */
418
+ type NarsilEventHandlers = {
419
+ [K in keyof NarsilEventMap]?: (payload: NarsilEventMap[K]) => void;
420
+ };
421
+
229
422
  /**
230
423
  * What {@link Narsil.query} returns: the ranked hits and everything the query
231
424
  * asked for alongside them.
@@ -425,6 +618,24 @@ interface BatchResult {
425
618
  error: NarsilError;
426
619
  }>;
427
620
  }
621
+ /**
622
+ * What {@link Narsil.importDocumentExport} returns. The engine continues past each
623
+ * refused line, so read the refusals to learn which documents it skipped.
624
+ *
625
+ * @public
626
+ */
627
+ interface DocumentImportResult {
628
+ /** The engine wrote this many documents, counting each one that it replaced. */
629
+ imported: number;
630
+ /** The engine refused this many lines in total. */
631
+ refusedCount: number;
632
+ /** These are the 1,000 refusals with the lowest line numbers. Each entry contains the line number, where the header is line 1, along with the error code and a message. */
633
+ refused: Array<{
634
+ line: number;
635
+ code: NarsilErrorCode;
636
+ message: string;
637
+ }>;
638
+ }
428
639
  /**
429
640
  * What {@link Narsil.getStats} returns about one index.
430
641
  *
@@ -1293,4 +1504,4 @@ interface MemoryStats {
1293
1504
  }>;
1294
1505
  }
1295
1506
 
1296
- export { type ArrayFilter as A, type BatchResult as B, type ClientErrorCode as C, type DocumentProjection as D, type ErrorCode as E, type FacetConfig as F, type GeoFilter as G, type HighlightConfig as H, type IndexInfo as I, type QueryCoverage as J, type ScoreComponents as K, type ListParams as L, type MemoryStats as M, NarsilError as N, type SearchMode as O, type PartitionStatsResult as P, type QueryParams as Q, type SortField as R, type ServerErrorCode as S, type SortSpec as T, type StringFilter as U, type VectorMaintenanceResult as V, type TermMatchPolicy as W, type VectorQueryConfig as X, type WorkerCopyReport as Y, ClientErrorCodes as a, ErrorCodes as b, type NarsilErrorCode as c, ServerErrorCodes as d, type QueryResult as e, type IndexStats as f, type ListResult as g, type PreflightResult as h, isNarsilError as i, type SuggestParams as j, type SuggestResult as k, type ComparisonFilter as l, type FacetResult as m, type FieldFilter as n, type FilterExpression as o, type GeoPolygonFilter as p, type GeoRadiusFilter as q, type GroupConfig as r, type GroupReducer as s, type GroupResult as t, type HighlightMatch as u, type Hit as v, type HybridConfig as w, type ListedDocument as x, type PresenceFilter as y, type ProcessMemoryReport as z };
1507
+ export { type WorkerCopyReport as $, type ArrayFilter as A, type BatchResult as B, type ClientErrorCode as C, type DocumentImportResult as D, type ErrorCode as E, type FacetConfig as F, type GeoFilter as G, type HighlightConfig as H, type IndexInfo as I, type ListedDocument as J, type PresenceFilter as K, type ListParams as L, type MemoryStats as M, NarsilError as N, type ProcessMemoryReport as O, type PartitionStatsResult as P, type QueryParams as Q, type QueryCoverage as R, type ServerErrorCode as S, type ScoreComponents as T, type SearchMode as U, type VectorMaintenanceResult as V, type SortField as W, type SortSpec as X, type StringFilter as Y, type TermMatchPolicy as Z, type VectorQueryConfig as _, ClientErrorCodes as a, ErrorCodes as b, type NarsilErrorCode as c, ServerErrorCodes as d, type QueryResult as e, type NarsilEventHandlers as f, type IndexStats as g, type ListResult as h, isNarsilError as i, type PreflightResult as j, type SuggestParams as k, type SuggestResult as l, type NarsilEventMap as m, type ComparisonFilter as n, type DocumentProjection as o, type FacetResult as p, type FieldFilter as q, type FilterExpression as r, type GeoPolygonFilter as s, type GeoRadiusFilter as t, type GroupConfig as u, type GroupReducer as v, type GroupResult as w, type HighlightMatch as x, type Hit as y, type HybridConfig as z };
package/dist/pattern.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { patternSearchModule } from './chunk-3HQPUCCT.mjs';
1
+ import { patternSearchModule } from './chunk-XW25X6AU.mjs';
2
2
  import './chunk-ZKRV5M2P.mjs';
3
3
 
4
4
  // src/pattern/index.ts
@@ -68,7 +68,7 @@ interface SegmentPayload {
68
68
  postingOffsets: Uint32Array;
69
69
  postingDocIds: Uint32Array;
70
70
  postingFrequencies: Uint16Array;
71
- postingFieldIndices: Uint8Array;
71
+ postingFieldIndices: Uint16Array;
72
72
  positionOffsets: Uint32Array | null;
73
73
  positionValues: Uint32Array | null;
74
74
  fieldLengthNames: string[];
@@ -110,7 +110,7 @@ interface SegmentPostingColumns {
110
110
  postingOffsets: Uint32Array;
111
111
  postingDocIds: Uint32Array;
112
112
  postingFrequencies: Uint16Array;
113
- postingFieldIndices: Uint8Array;
113
+ postingFieldIndices: Uint16Array;
114
114
  positionOffsets: Uint32Array | null;
115
115
  positionValues: Uint32Array | null;
116
116
  }
@@ -132,6 +132,7 @@ interface SegmentColumns extends SegmentPostingColumns {
132
132
  interface EncodedDocumentTableData {
133
133
  blob: Uint8Array;
134
134
  offsets: Uint32Array;
135
+ discardedFields?: readonly string[];
135
136
  }
136
137
 
137
138
  interface ExternalIdTableData {
@@ -162,27 +163,19 @@ interface SharedSegmentSnapshot extends Omit<SegmentColumns, 'surfaceForms'> {
162
163
  surfaceTable: SurfaceTableData | null;
163
164
  }
164
165
 
165
- interface CapturedFrozenSegment {
166
- snapshot: SharedSegmentSnapshot;
167
- tombstonedDocIds: string[];
168
- }
169
- interface CapturedWholePartition {
170
- partitionId: number;
171
- totalPartitions: number;
172
- docCount: number;
173
- liveTail: Uint8Array | null;
174
- frozen: CapturedFrozenSegment[];
175
- }
176
-
177
166
  interface PartitionCheckpoint {
178
167
  partitionId: number;
179
168
  lastSeqNo: number;
180
169
  primaryTerm: number;
181
170
  }
182
171
 
183
- interface SegmentRef {
184
- id: number;
172
+ interface FileRef {
185
173
  key: string;
174
+ bytes: number;
175
+ checksum: number;
176
+ }
177
+ interface SegmentRef extends FileRef {
178
+ id: number;
186
179
  docCount: number;
187
180
  tombstoneCount: number;
188
181
  }
@@ -192,6 +185,20 @@ interface PartitionManifestEntry {
192
185
  segments: SegmentRef[];
193
186
  }
194
187
 
188
+ interface CapturedSegment {
189
+ snapshot: SharedSegmentSnapshot;
190
+ keep: Uint8Array;
191
+ }
192
+ interface CapturedWholePartition {
193
+ partitionId: number;
194
+ docCount: number;
195
+ segments: CapturedSegment[];
196
+ }
197
+
198
+ interface PriorCheckpoint {
199
+ checkpoint: PartitionCheckpoint[];
200
+ partitions: PartitionManifestEntry[];
201
+ }
195
202
  interface CheckpointSegmentsWritten {
196
203
  checkpoint: PartitionCheckpoint[];
197
204
  partitions: PartitionManifestEntry[];
@@ -202,6 +209,7 @@ interface CheckpointWorkerRequest {
202
209
  metadata: IndexMetadata;
203
210
  targets: PartitionCheckpoint[];
204
211
  compactionThreshold: number;
212
+ prior: PriorCheckpoint | null;
205
213
  capturedPartitions?: CapturedWholePartition[];
206
214
  }
207
215
  interface CheckpointWorkerSuccess {
@@ -1,29 +1,34 @@
1
- import { CHECKPOINT_WORKER_HEARTBEAT_MS, createDurableDirectory, writeCheckpointSegments } from '../../chunk-7QMTA7AA.mjs';
2
- import '../../chunk-2X2ZQOAB.mjs';
1
+ import { CHECKPOINT_WORKER_HEARTBEAT_MS, createDurableDirectory, writeCheckpointSegments, directoryCheckpointStore } from '../../chunk-CVFAFZSN.mjs';
3
2
  import '../../chunk-GCM3JFVA.mjs';
4
- import '../../chunk-CVPA5Q7R.mjs';
5
- import '../../chunk-XZ4PAREY.mjs';
6
- import '../../chunk-HVJYTKK7.mjs';
7
- import '../../chunk-QR4OKRVY.mjs';
8
- import '../../chunk-KZTI25D3.mjs';
9
- import '../../chunk-M6XF5HDE.mjs';
3
+ import '../../chunk-AFKH4ZK3.mjs';
4
+ import '../../chunk-THMSFOJO.mjs';
5
+ import '../../chunk-4MQ5F4IL.mjs';
6
+ import '../../chunk-ZULSEZCE.mjs';
7
+ import '../../chunk-3YKWSO54.mjs';
8
+ import '../../chunk-AK3BLGCI.mjs';
10
9
  import '../../chunk-TGP5M5R7.mjs';
11
- import '../../chunk-LCCL6EEH.mjs';
10
+ import '../../chunk-WVDFG45M.mjs';
12
11
  import '../../chunk-ZJ4CSAB2.mjs';
13
- import '../../chunk-P2ZZN32C.mjs';
14
- import '../../chunk-3L4U6EJQ.mjs';
15
- import '../../chunk-IFBKLBGB.mjs';
16
- import '../../chunk-3HQPUCCT.mjs';
12
+ import '../../chunk-PU43WDY4.mjs';
13
+ import '../../chunk-XW25X6AU.mjs';
17
14
  import '../../chunk-ZKRV5M2P.mjs';
18
15
  import '../../chunk-U2BKYEC7.mjs';
19
16
  import '../../chunk-LJYTW7GT.mjs';
20
17
  import '../../chunk-POWOTUKJ.mjs';
21
- import '../../chunk-RV77FR2F.mjs';
18
+ import '../../chunk-I64LXKO3.mjs';
22
19
 
23
20
  // src/persistence/durability/rebuild.ts
24
- async function rebuildSegmentsFromDurable(root, metadata, targets, compactionThreshold, capturedPartitions = []) {
21
+ async function rebuildSegmentsFromDurable(root, metadata, targets, compactionThreshold, prior, capturedPartitions = []) {
25
22
  const directory = createDurableDirectory(root);
26
- return writeCheckpointSegments({ directory, metadata, targets, compactionThreshold, capturedPartitions });
23
+ return writeCheckpointSegments({
24
+ store: directoryCheckpointStore(directory),
25
+ directory,
26
+ metadata,
27
+ targets,
28
+ compactionThreshold,
29
+ prior,
30
+ capturedPartitions
31
+ });
27
32
  }
28
33
 
29
34
  // src/persistence/durability/checkpoint-worker.ts
@@ -49,6 +54,7 @@ async function handleRequest(raw) {
49
54
  request.metadata,
50
55
  request.targets,
51
56
  request.compactionThreshold,
57
+ request.prior ?? null,
52
58
  request.capturedPartitions
53
59
  );
54
60
  return { type: "success", segments };
package/dist/react.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { N as NarsilError, L as ListParams, g as ListResult, I as IndexInfo, f as IndexStats, Q as QueryParams, h as PreflightResult, e as QueryResult, j as SuggestParams, k as SuggestResult } from './memory-CKHTU1CL.js';
2
- export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './memory-CKHTU1CL.js';
3
- import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-BECd0b__.js';
4
- export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-BECd0b__.js';
1
+ import { N as NarsilError, L as ListParams, h as ListResult, I as IndexInfo, g as IndexStats, Q as QueryParams, j as PreflightResult, e as QueryResult, k as SuggestParams, l as SuggestResult } from './memory-B4jMmygw.js';
2
+ export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './memory-B4jMmygw.js';
3
+ import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-DpgCpW1x.js';
4
+ export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-DpgCpW1x.js';
5
5
  import { ReactNode, ReactElement } from 'react';
6
- import { a as Narsil } from './engine-Dm4446j1.js';
7
- import { N as NarsilClient, I as ImportSource } from './client-C2TiW29y.js';
6
+ import { N as Narsil } from './engine-D_OzKZ-6.js';
7
+ import { N as NarsilClient, I as ImportSource } from './client-D698E5ge.js';
8
8
  import { A as AnyDocument } from './schema-BBOCdhND.js';
9
9
  import './adapters-79OIa4xm.js';
10
10
 
package/dist/react.mjs CHANGED
@@ -74,7 +74,6 @@ var ErrorCodes = {
74
74
  SNAPSHOT_SYNC_UNAUTHORIZED: "SNAPSHOT_SYNC_UNAUTHORIZED",
75
75
  SNAPSHOT_SYNC_REQUEST_INVALID: "SNAPSHOT_SYNC_REQUEST_INVALID",
76
76
  SNAPSHOT_SYNC_INDEX_NOT_FOUND: "SNAPSHOT_SYNC_INDEX_NOT_FOUND",
77
- SNAPSHOT_SYNC_TOO_LARGE: "SNAPSHOT_SYNC_TOO_LARGE",
78
77
  SNAPSHOT_SYNC_CAPACITY_EXHAUSTED: "SNAPSHOT_SYNC_CAPACITY_EXHAUSTED",
79
78
  SNAPSHOT_SYNC_SNAPSHOT_FAILED: "SNAPSHOT_SYNC_SNAPSHOT_FAILED",
80
79
  SNAPSHOT_SYNC_DECODE_FAILED: "SNAPSHOT_SYNC_DECODE_FAILED",
package/dist/server.d.ts CHANGED
@@ -1,15 +1,15 @@
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
- import { b as ServerOptions, N as NarsilServer } from './capabilities-D6gjjQyA.js';
3
- export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, c as RequestContext, d as RequestDenial, S as SERVER_CAPABILITIES, e as ServerLimits, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-D6gjjQyA.js';
4
- import { a as Narsil } from './engine-Dm4446j1.js';
5
- import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-BECd0b__.js';
6
- export { C as CapabilitiesResponse, a as CreateIndexEmbedding, i as CreateIndexRequest, H as HttpIndexConfig, I as ImportError, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, f as TaskStatus, g as TaskType } from './tasks-BECd0b__.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-B4jMmygw.js';
2
+ import { b as ServerOptions, N as NarsilServer } from './capabilities-CYeAWYxQ.js';
3
+ export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, c as RequestContext, d as RequestDenial, S as SERVER_CAPABILITIES, e as ServerLimits, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-CYeAWYxQ.js';
4
+ import { N as Narsil } from './engine-D_OzKZ-6.js';
5
+ import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-DpgCpW1x.js';
6
+ export { C as CapabilitiesResponse, a as CreateIndexEmbedding, i as CreateIndexRequest, H as HttpIndexConfig, I as ImportError, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, f as TaskStatus, g as TaskType } from './tasks-DpgCpW1x.js';
7
7
  import './schema-BBOCdhND.js';
8
8
  import './adapters-79OIa4xm.js';
9
- import './config-BLguB-om.js';
10
- import './config-C7Ip8Ife.js';
9
+ import './config-Bv8etwUZ.js';
10
+ import './config-QXU3HMpq.js';
11
11
  import './types-BiUmaiWT.js';
12
- import './types-D5OwhtsQ.js';
12
+ import './types-Cb9kiY5P.js';
13
13
 
14
14
  /**
15
15
  * What a running task reports back while it works, and how it learns that a