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

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 (43) hide show
  1. package/README.md +1 -1
  2. package/dist/{options-Dtk99qUs.d.ts → capabilities-JrVQOwi4.d.ts} +55 -47
  3. package/dist/chunk-AV4IJKD2.mjs +35 -0
  4. package/dist/{chunk-M6JGMKA5.mjs → chunk-BEIK3EOZ.mjs} +503 -2273
  5. package/dist/chunk-CMVG2UEF.mjs +2038 -0
  6. package/dist/chunk-CV5H7XL7.mjs +876 -0
  7. package/dist/{chunk-KGRYQVZ5.mjs → chunk-MHE7YWAU.mjs} +2 -1
  8. package/dist/{chunk-56PJBIJ6.mjs → chunk-ND34I3SV.mjs} +427 -1455
  9. package/dist/chunk-PIWKZPP7.mjs +64 -0
  10. package/dist/{chunk-HGJC5L65.mjs → chunk-PMBHH44R.mjs} +121 -2
  11. package/dist/chunk-RP23PWMV.mjs +11 -0
  12. package/dist/{chunk-RDGXYRF4.mjs → chunk-WYJXSLER.mjs} +8 -19
  13. package/dist/{chunk-JXHUHFJ5.mjs → chunk-X6YZO4MQ.mjs} +2 -11
  14. package/dist/{chunk-OWCFK42Q.mjs → chunk-XE6XR2OE.mjs} +3 -10
  15. package/dist/chunk-ZHUQKZBE.mjs +1292 -0
  16. package/dist/{client-DX7xPcNA.d.ts → client-CBOVHdjp.d.ts} +31 -7
  17. package/dist/client.d.ts +7 -7
  18. package/dist/client.mjs +26 -10
  19. package/dist/{config-B41W23Us.d.ts → config-Czh2YNDi.d.ts} +2 -2
  20. package/dist/{config-Co-zAXqO.d.ts → config-OON7IJ_B.d.ts} +26 -5
  21. package/dist/direct-executor-OREXU72C.mjs +12 -0
  22. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  23. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  24. package/dist/distribution.d.ts +8 -8
  25. package/dist/distribution.mjs +28 -11
  26. package/dist/{engine-CABZg25p.d.ts → engine-9PtFY50q.d.ts} +114 -62
  27. package/dist/index.browser.mjs +3255 -2516
  28. package/dist/index.d.ts +7 -7
  29. package/dist/index.mjs +11 -6
  30. package/dist/{search-FjWhZN3f.d.ts → memory-Bzd5xcEW.d.ts} +88 -79
  31. package/dist/persistence/durability/checkpoint-worker.d.ts +1 -1
  32. package/dist/persistence/durability/checkpoint-worker.mjs +11 -6
  33. package/dist/react.d.ts +4 -4
  34. package/dist/{schema-B7juWg8Q.d.ts → schema-BqRx9t4E.d.ts} +22 -3
  35. package/dist/server.d.ts +47 -42
  36. package/dist/server.mjs +321 -817
  37. package/dist/thread-PZLEO6JL.mjs +310 -0
  38. package/dist/{types-DsSSjY4d.d.ts → types-DXPxaXPO.d.ts} +1 -1
  39. package/dist/vector/hnsw-build-worker.mjs +2 -1
  40. package/dist/vector/search-worker.mjs +3 -121
  41. package/dist/workers/entry.mjs +47 -3
  42. package/package.json +5 -1
  43. package/dist/direct-executor-HRTDWMVB.mjs +0 -9
@@ -1,5 +1,5 @@
1
- import { P as PartitionConfig, A as AnyDocument, b as InsertOptions } from './schema-B7juWg8Q.js';
2
- import { V as VectorMaintenanceResult, M as MemoryStats, 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, i as SuggestParams, j as SuggestResult } from './search-FjWhZN3f.js';
1
+ import { P as PartitionConfig, A as AnyDocument, b as InsertOptions, W as WriteOptions } from './schema-BqRx9t4E.js';
2
+ import { V as VectorMaintenanceResult, M as MemoryStats, 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, i as SuggestParams, j as SuggestResult } from './memory-Bzd5xcEW.js';
3
3
  import { e as TaskRecord, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-Bn4R1NPN.js';
4
4
 
5
5
  /**
@@ -248,6 +248,8 @@ interface BulkOperations {
248
248
  * @param indexName - This names the index holding the documents.
249
249
  * @param updates - Each entry names the document to replace and holds its
250
250
  * replacement.
251
+ * @param writeOptions - These per-write settings reach the server, and apply
252
+ * to the whole batch.
251
253
  * @param options - This sets the signal, the deadline, and the headers for
252
254
  * this request.
253
255
  * @returns The result lists the ids replaced, and each failure with its
@@ -256,17 +258,19 @@ interface BulkOperations {
256
258
  updateBatch(indexName: string, updates: Array<{
257
259
  docId: string;
258
260
  document: AnyDocument;
259
- }>, options?: RequestOptions): Promise<BatchResult>;
261
+ }>, writeOptions?: WriteOptions, options?: RequestOptions): Promise<BatchResult>;
260
262
  /**
261
263
  * Removes many documents in one request and reports each one's outcome.
262
264
  *
263
265
  * @param indexName - This names the index holding the documents.
264
266
  * @param docIds - These name the documents to remove.
267
+ * @param writeOptions - These per-write settings reach the server, and apply
268
+ * to the whole batch.
265
269
  * @param options - This sets the signal, the deadline, and the headers for
266
270
  * this request.
267
271
  * @returns The result lists the ids removed, and each failure with its error.
268
272
  */
269
- removeBatch(indexName: string, docIds: string[], options?: RequestOptions): Promise<BatchResult>;
273
+ removeBatch(indexName: string, docIds: string[], writeOptions?: WriteOptions, options?: RequestOptions): Promise<BatchResult>;
270
274
  /**
271
275
  * Reads many documents by id in one request.
272
276
  *
@@ -409,12 +413,14 @@ interface DocumentOperations {
409
413
  * @param indexName - This names the index that receives the document.
410
414
  * @param docId - This is the id to write at.
411
415
  * @param document - Its fields must match the types the schema declares.
416
+ * @param writeOptions - These per-write settings reach the server, such as
417
+ * waiting for every worker copy to apply the write.
412
418
  * @param options - This sets the signal, the deadline, and the headers for
413
419
  * this request.
414
420
  * @returns The result names the id, and says whether the write created the
415
421
  * document or replaced one.
416
422
  */
417
- put(indexName: string, docId: string, document: AnyDocument, options?: RequestOptions): Promise<PutResult>;
423
+ put(indexName: string, docId: string, document: AnyDocument, writeOptions?: WriteOptions, options?: RequestOptions): Promise<PutResult>;
418
424
  /**
419
425
  * Replaces the stored document at an id.
420
426
  *
@@ -422,23 +428,41 @@ interface DocumentOperations {
422
428
  * @param docId - This names the document to replace.
423
429
  * @param document - This replacement goes through the same schema validation
424
430
  * an insert would.
431
+ * @param writeOptions - These per-write settings reach the server, such as
432
+ * waiting for every worker copy to apply the write.
425
433
  * @param options - This sets the signal, the deadline, and the headers for
426
434
  * this request.
427
435
  * @throws A `NarsilError` with `DOC_NOT_FOUND` when the index holds no such
428
436
  * document.
429
437
  */
430
- update(indexName: string, docId: string, document: AnyDocument, options?: RequestOptions): Promise<void>;
438
+ update(indexName: string, docId: string, document: AnyDocument, writeOptions?: WriteOptions, options?: RequestOptions): Promise<void>;
431
439
  /**
432
440
  * Removes one document.
433
441
  *
434
442
  * @param indexName - This names the index holding the document.
435
443
  * @param docId - This names the document to remove.
444
+ * @param writeOptions - These per-write settings reach the server, such as
445
+ * waiting for every worker copy to apply the removal.
436
446
  * @param options - This sets the signal, the deadline, and the headers for
437
447
  * this request.
438
448
  * @throws A `NarsilError` with `DOC_NOT_FOUND` when the index holds no such
439
449
  * document.
440
450
  */
441
- remove(indexName: string, docId: string, options?: RequestOptions): Promise<void>;
451
+ remove(indexName: string, docId: string, writeOptions?: WriteOptions, options?: RequestOptions): Promise<void>;
452
+ /**
453
+ * Resolves once every worker copy of an index on the server has applied
454
+ * every write that returned before the call.
455
+ *
456
+ * A write returns once the server's main copy holds it, and the copies
457
+ * apply it afterwards, so a query can come back without a write that
458
+ * returned before it. Call this after a run of writes, or pass `wait: true`
459
+ * on one write, before a query that has to see them.
460
+ *
461
+ * @param indexName - This names the index whose copies have to catch up.
462
+ * @param options - This sets the signal, the deadline, and the headers for
463
+ * this request.
464
+ */
465
+ waitForWrites(indexName: string, options?: RequestOptions): Promise<void>;
442
466
  /**
443
467
  * Counts the documents in an index.
444
468
  *
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 } from './search-FjWhZN3f.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 './options-Dtk99qUs.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 } from './memory-Bzd5xcEW.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-JrVQOwi4.js';
3
3
  export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-Bn4R1NPN.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-DX7xPcNA.js';
5
- import './schema-B7juWg8Q.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-CBOVHdjp.js';
5
+ import './schema-BqRx9t4E.js';
6
6
  import './adapters-79OIa4xm.js';
7
- import './config-B41W23Us.js';
8
- import './config-Co-zAXqO.js';
9
- import './types-DsSSjY4d.js';
7
+ import './config-Czh2YNDi.js';
8
+ import './config-OON7IJ_B.js';
9
+ import './types-DXPxaXPO.js';
10
10
  import './types-D5OwhtsQ.js';
package/dist/client.mjs CHANGED
@@ -334,11 +334,19 @@ function createBulkOperations(transport) {
334
334
  options
335
335
  );
336
336
  },
337
- updateBatch(indexName, updates, options) {
338
- return batch(indexName, { action: "update", updates }, options);
337
+ updateBatch(indexName, updates, writeOptions, options) {
338
+ return batch(
339
+ indexName,
340
+ { action: "update", updates, ...writeOptions === void 0 ? {} : { options: writeOptions } },
341
+ options
342
+ );
339
343
  },
340
- removeBatch(indexName, docIds, options) {
341
- return batch(indexName, { action: "delete", docIds }, options);
344
+ removeBatch(indexName, docIds, writeOptions, options) {
345
+ return batch(
346
+ indexName,
347
+ { action: "delete", docIds, ...writeOptions === void 0 ? {} : { options: writeOptions } },
348
+ options
349
+ );
342
350
  },
343
351
  async getMultiple(indexName, docIds, options) {
344
352
  const path = `${indexPath(indexName)}/documents/_multi-get`;
@@ -402,28 +410,36 @@ function createDocumentOperations(transport) {
402
410
  const path = `${documentPath(indexName, docId)}/_exists`;
403
411
  return readBoolean(await transport.json({ method: "GET", path, options }), "exists", path);
404
412
  },
405
- async put(indexName, docId, document, options) {
413
+ async put(indexName, docId, document, writeOptions, options) {
406
414
  const path = documentPath(indexName, docId);
407
415
  const payload = await transport.json({
408
416
  method: "PUT",
409
417
  path,
410
- body: encodeJson({ document }),
418
+ body: encodeJson({ document, ...writeOptions === void 0 ? {} : { options: writeOptions } }),
411
419
  contentType: "application/json",
412
420
  options
413
421
  });
414
422
  return { id: readString(payload, "id", path), created: readBoolean(payload, "created", path) };
415
423
  },
416
- async update(indexName, docId, document, options) {
424
+ async update(indexName, docId, document, writeOptions, options) {
417
425
  await transport.json({
418
426
  method: "PATCH",
419
427
  path: documentPath(indexName, docId),
420
- body: encodeJson({ document }),
428
+ body: encodeJson({ document, ...writeOptions === void 0 ? {} : { options: writeOptions } }),
421
429
  contentType: "application/json",
422
430
  options
423
431
  });
424
432
  },
425
- async remove(indexName, docId, options) {
426
- await transport.json({ method: "DELETE", path: documentPath(indexName, docId), options });
433
+ async remove(indexName, docId, writeOptions, options) {
434
+ await transport.json({
435
+ method: "DELETE",
436
+ path: documentPath(indexName, docId),
437
+ ...writeOptions?.wait === true ? { query: { wait: "true" } } : {},
438
+ options
439
+ });
440
+ },
441
+ async waitForWrites(indexName, options) {
442
+ await transport.json({ method: "POST", path: `${indexPath(indexName)}/_wait-for-writes`, options });
427
443
  },
428
444
  async countDocuments(indexName, options) {
429
445
  const path = `${indexPath(indexName)}/count`;
@@ -1,5 +1,5 @@
1
- import { N as NarsilConfig } from './config-Co-zAXqO.js';
2
- import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-DsSSjY4d.js';
1
+ import { N as NarsilConfig } from './config-OON7IJ_B.js';
2
+ import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-DXPxaXPO.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 './search-FjWhZN3f.js';
3
- import { I as IndexConfig, A as AnyDocument } from './schema-B7juWg8Q.js';
2
+ import { Q as QueryParams, e as QueryResult } from './memory-Bzd5xcEW.js';
3
+ import { I as IndexConfig, A as AnyDocument } from './schema-BqRx9t4E.js';
4
4
 
5
5
  /**
6
6
  * Hooks that run alongside the engine's own work, which is how you add
@@ -248,6 +248,18 @@ interface DurabilityConfig {
248
248
  /** Compaction reclaims the log once this fraction of it is dead. */
249
249
  compactionThreshold?: number;
250
250
  }
251
+ /**
252
+ * Which queries the main copy of an index answers once the index holds worker
253
+ * copies. Under `lone`, the main copy answers a query the engine receives
254
+ * while no copy holds one, on an index of at most 50,000 documents. Once
255
+ * every copy is busy, it also answers one query per turn of the event loop.
256
+ * Under `none`, every query on an index that holds copies goes to one of
257
+ * them, while the main copy still answers a query on an index whose copies
258
+ * are loading.
259
+ *
260
+ * @public
261
+ */
262
+ type MainCopyQueries = 'lone' | 'none';
251
263
  /**
252
264
  * How the engine holds worker copies of its indexes, and how many threads
253
265
  * they may use.
@@ -268,8 +280,9 @@ interface WorkerConfig {
268
280
  enabled?: boolean;
269
281
  /**
270
282
  * The keyword copies and the vector search pool share this many threads
271
- * between them, half each. The engine takes the host's cores minus one by
272
- * default, between 2 and 8.
283
+ * between them, half each, in an embedded engine. The HTTP server holds a
284
+ * copy on every one of them and receives requests there. The engine takes
285
+ * the host's cores minus one by default, between 2 and 8.
273
286
  */
274
287
  count?: number;
275
288
  /** An index gains worker copies once it holds this many documents, 1,000 by default. */
@@ -282,8 +295,16 @@ interface WorkerConfig {
282
295
  * smaller of five minutes and that interval.
283
296
  */
284
297
  idleTimeoutMs?: number;
298
+ /**
299
+ * Which queries the main copy answers, `lone` by default. Set `none` where
300
+ * the main thread also serves the host's own work, such as HTTP requests,
301
+ * because a query answered on the main copy then delays every other request
302
+ * waiting on that thread. A server created with `createServer` sets `none` on
303
+ * an engine that leaves this unset.
304
+ */
305
+ mainCopyQueries?: MainCopyQueries;
285
306
  /** Each worker imports this module on start-up, which is how a worker reaches a custom tokeniser or language. */
286
307
  bootstrapModule?: string;
287
308
  }
288
309
 
289
- export type { AnalysisConfig as A, DurabilityConfig as D, IndexContext as I, NarsilConfig as N, PartitionContext as P, RemoveContext as R, SearchContext as S, UpdateContext as U, WorkerConfig as W, IndexLifecycleConfig as a, InsertContext as b, NarsilPlugin as c, StaleAnalysis as d, WorkerContext as e };
310
+ export type { AnalysisConfig as A, DurabilityConfig as D, IndexContext as I, MainCopyQueries as M, NarsilConfig as N, PartitionContext as P, RemoveContext as R, SearchContext as S, UpdateContext as U, WorkerConfig as W, IndexLifecycleConfig as a, InsertContext as b, NarsilPlugin as c, StaleAnalysis as d, WorkerContext as e };
@@ -0,0 +1,12 @@
1
+ export { createDirectExecutor } from './chunk-BEIK3EOZ.mjs';
2
+ import './chunk-CMVG2UEF.mjs';
3
+ import './chunk-AV4IJKD2.mjs';
4
+ import './chunk-CBLS46IE.mjs';
5
+ import './chunk-TGP5M5R7.mjs';
6
+ import './chunk-PMBHH44R.mjs';
7
+ import './chunk-X6YZO4MQ.mjs';
8
+ import './chunk-RP23PWMV.mjs';
9
+ import './chunk-U2BKYEC7.mjs';
10
+ import './chunk-2GWVQWGA.mjs';
11
+ import './chunk-WYJXSLER.mjs';
12
+ import './chunk-P4ELXVJQ.mjs';
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../types-DsSSjY4d.js';
2
- import '../../schema-B7juWg8Q.js';
1
+ import { C as ClusterCoordinator } from '../../types-DXPxaXPO.js';
2
+ import '../../schema-BqRx9t4E.js';
3
3
  import '../../adapters-79OIa4xm.js';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../types-DsSSjY4d.js';
2
- import '../../schema-B7juWg8Q.js';
1
+ import { C as ClusterCoordinator } from '../../types-DXPxaXPO.js';
2
+ import '../../schema-BqRx9t4E.js';
3
3
  import '../../adapters-79OIa4xm.js';
4
4
 
5
5
  /**
@@ -1,12 +1,12 @@
1
- import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-B41W23Us.js';
2
- export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-B41W23Us.js';
3
- import { N as NarsilEventMap, a as Narsil } from './engine-CABZg25p.js';
4
- import { B as BatchResult, L as ListParams, g as ListResult, i as SuggestParams, j as SuggestResult, Q as QueryParams, h as PreflightResult, f as IndexStats, P as PartitionStatsResult, M as MemoryStats, e as QueryResult } from './search-FjWhZN3f.js';
5
- import { I as IndexConfig, A as AnyDocument, b as InsertOptions } from './schema-B7juWg8Q.js';
6
- import { b as NodeCapacity, N as NodeRole } from './types-DsSSjY4d.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-DsSSjY4d.js';
1
+ import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-Czh2YNDi.js';
2
+ export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-Czh2YNDi.js';
3
+ import { N as NarsilEventMap, a as Narsil } from './engine-9PtFY50q.js';
4
+ import { B as BatchResult, L as ListParams, g as ListResult, i as SuggestParams, j as SuggestResult, Q as QueryParams, h as PreflightResult, f as IndexStats, P as PartitionStatsResult, M as MemoryStats, e as QueryResult } from './memory-Bzd5xcEW.js';
5
+ import { I as IndexConfig, A as AnyDocument, b as InsertOptions } from './schema-BqRx9t4E.js';
6
+ import { b as NodeCapacity, N as NodeRole } from './types-DXPxaXPO.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-DXPxaXPO.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-Co-zAXqO.js';
9
+ import './config-OON7IJ_B.js';
10
10
  import './adapters-79OIa4xm.js';
11
11
 
12
12
  /**
@@ -1,17 +1,22 @@
1
1
  import { MAX_MESSAGE_SIZE_BYTES } from './chunk-UNEEFTEU.mjs';
2
- import { validateIndexName, indexConfigKey, putIndexMetadata, getIndexMetadata } from './chunk-KGRYQVZ5.mjs';
3
- import { createEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, createEngineIndex, applyIndexEntry, applyDeleteEntry, now, listBindingOf, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, createForwardBatchResultMessage, queryBindingOf, foldGroupReducer, clampLimit, createForwardBatchMessage, validateForwardBatchResultPayload, createForwardMessage, validateReplicationEntry, computeEntryChecksum, dedupePinnedEntries, createEntryMessage, createEntryBatchMessage, createInsyncConfirmMessage, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, createInsyncAddMessage } from './chunk-56PJBIJ6.mjs';
2
+ import { validateIndexName, indexConfigKey, putIndexMetadata, getIndexMetadata } from './chunk-MHE7YWAU.mjs';
3
+ import { createEngineCore, checkHeapAfterRecovery, 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-ND34I3SV.mjs';
4
+ import { now, listBindingOf, queryBindingOf, foldGroupReducer, clampLimit, dedupePinnedEntries } from './chunk-ZHUQKZBE.mjs';
4
5
  import { ReplicationMessageTypes, TransportErrorCodes, ClusterMessageTypes, QueryMessageTypes, TransportError } from './chunk-GCM3JFVA.mjs';
5
- import { DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, MAX_SUGGEST_SCATTER_LIMIT, WIRE_BATCH_BUDGET, MAX_INDEX_NAME_LENGTH, MAX_DOC_ID_LENGTH, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING, INDEX_NAME_PATTERN } from './chunk-OWCFK42Q.mjs';
6
- import { deserializePayloadV2, createPartitionIndex, resolveProjection, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, normalizeSort, encodePageCursor, applyProjection, readSortValues, getLanguage, requireWithinResultWindow, fnv1a, FILTER_EXPRESSION_KEYS, mergePartitionStats, FIELD_FILTER_OPERATORS, MAX_NESTING_DEPTH } from './chunk-M6JGMKA5.mjs';
6
+ import { MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-PIWKZPP7.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-XE6XR2OE.mjs';
8
+ import { generateId, deserializePayloadV2, createPartitionIndex, getLanguage, FILTER_EXPRESSION_KEYS, FIELD_FILTER_OPERATORS } from './chunk-BEIK3EOZ.mjs';
9
+ import { resolveProjection, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, normalizeSort, encodePageCursor, applyProjection, readSortValues, requireWithinResultWindow, fnv1a, mergePartitionStats, MAX_NESTING_DEPTH } from './chunk-CMVG2UEF.mjs';
10
+ import './chunk-AV4IJKD2.mjs';
7
11
  import { DEFAULT_PAGE_SIZE, MAX_SORT_FIELDS, MAX_CURSOR_LENGTH, RESULT_WINDOW } from './chunk-CBLS46IE.mjs';
8
12
  import './chunk-TGP5M5R7.mjs';
9
- import './chunk-HGJC5L65.mjs';
10
- import './chunk-JXHUHFJ5.mjs';
13
+ import './chunk-PMBHH44R.mjs';
14
+ import './chunk-X6YZO4MQ.mjs';
15
+ import './chunk-RP23PWMV.mjs';
11
16
  import { crc32 } from './chunk-KMMJMDUA.mjs';
12
17
  import './chunk-U2BKYEC7.mjs';
13
18
  import { compareCodePoints, toComparableSortValue, compareComparableKeys, compareSortValues } from './chunk-2GWVQWGA.mjs';
14
- import { generateId } from './chunk-RDGXYRF4.mjs';
19
+ import './chunk-WYJXSLER.mjs';
15
20
  import { ErrorCodes, NarsilError, describeError } from './chunk-P4ELXVJQ.mjs';
16
21
  import { encode, decode } from '@msgpack/msgpack';
17
22
 
@@ -5183,11 +5188,13 @@ async function createClusterLocalEngine(config, hooks) {
5183
5188
  const core = createEngineCore(config, hooks);
5184
5189
  if (core.durability !== null) {
5185
5190
  await core.durability.manager.recover(config?.lifecycle !== void 0);
5191
+ checkHeapAfterRecovery(core);
5186
5192
  }
5187
5193
  if (core.invalidation !== null) {
5188
5194
  await core.invalidation.start();
5189
5195
  }
5190
5196
  if (config?.lifecycle === void 0) await core.analysisRebuild.reviewStaleIndexes();
5197
+ core.orchestrator.shareMainThread();
5191
5198
  const engine = createNarsilFromCore(core, config);
5192
5199
  const heldPartitions = createHeldPartitionRecord(core);
5193
5200
  return Object.assign(engine, {
@@ -11481,6 +11488,9 @@ function unsupported(operation) {
11481
11488
  { operation }
11482
11489
  );
11483
11490
  }
11491
+ function rejectWait(options) {
11492
+ if (options?.wait === true) unsupported("wait");
11493
+ }
11484
11494
  function clusterNodeEngine(node, options) {
11485
11495
  return {
11486
11496
  open(indexName) {
@@ -11493,21 +11503,27 @@ function clusterNodeEngine(node, options) {
11493
11503
  return node.createIndex(name, config, options?.createIndex);
11494
11504
  },
11495
11505
  async insert(indexName, document, docId, insertOptions) {
11506
+ rejectWait(insertOptions);
11496
11507
  return node.insert(indexName, document, docId, insertOptions);
11497
11508
  },
11498
11509
  async insertBatch(indexName, documents, insertOptions) {
11510
+ rejectWait(insertOptions);
11499
11511
  return node.insertBatch(indexName, documents, insertOptions);
11500
11512
  },
11501
- async remove(indexName, docId) {
11513
+ async remove(indexName, docId, options2) {
11514
+ rejectWait(options2);
11502
11515
  return node.remove(indexName, docId);
11503
11516
  },
11504
- async removeBatch(indexName, docIds) {
11517
+ async removeBatch(indexName, docIds, options2) {
11518
+ rejectWait(options2);
11505
11519
  return node.removeBatch(indexName, docIds);
11506
11520
  },
11507
- async update(indexName, docId, document) {
11521
+ async update(indexName, docId, document, options2) {
11522
+ rejectWait(options2);
11508
11523
  return node.update(indexName, docId, document);
11509
11524
  },
11510
- async updateBatch(indexName, updates) {
11525
+ async updateBatch(indexName, updates, options2) {
11526
+ rejectWait(options2);
11511
11527
  return node.updateBatch(indexName, updates);
11512
11528
  },
11513
11529
  async dropIndex(name) {
@@ -11555,6 +11571,7 @@ function clusterNodeEngine(node, options) {
11555
11571
  async shutdown() {
11556
11572
  return node.shutdown();
11557
11573
  },
11574
+ waitForWrites: () => unsupported("waitForWrites"),
11558
11575
  registerEmbeddingAdapter: () => unsupported("registerEmbeddingAdapter"),
11559
11576
  listIndexes: () => unsupported("listIndexes"),
11560
11577
  getStats: () => unsupported("getStats"),