@delali/narsil 0.2.4-next.51 → 0.2.4-next.54
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.
- package/README.md +33 -27
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/{capabilities-BWm4IITU.d.ts → capabilities-DlYw0Ov0.d.ts} +13 -2
- package/dist/{chunk-KMMJMDUA.mjs → chunk-3L4U6EJQ.mjs} +15 -10
- package/dist/chunk-4NVPQ6S5.mjs +366 -0
- package/dist/{chunk-CMVG2UEF.mjs → chunk-5T6AOR37.mjs} +56 -518
- package/dist/{chunk-ND34I3SV.mjs → chunk-BH5SYB5W.mjs} +3295 -2149
- package/dist/{chunk-XE6XR2OE.mjs → chunk-D2S642IV.mjs} +4 -2
- package/dist/{chunk-P4ELXVJQ.mjs → chunk-FRQVMFY7.mjs} +7 -1
- package/dist/chunk-IFBKLBGB.mjs +7 -0
- package/dist/chunk-L225SHNB.mjs +513 -0
- package/dist/{chunk-MHE7YWAU.mjs → chunk-NTZYA3SJ.mjs} +3 -3
- package/dist/{chunk-WYJXSLER.mjs → chunk-POWOTUKJ.mjs} +7 -1
- package/dist/{chunk-CV5H7XL7.mjs → chunk-RGS7FMCB.mjs} +53 -10
- package/dist/{chunk-ZHUQKZBE.mjs → chunk-TVT5V4E7.mjs} +101 -34
- package/dist/chunk-U2AL3SON.mjs +4198 -0
- package/dist/chunk-UTOFOJOR.mjs +135 -0
- package/dist/{chunk-BEIK3EOZ.mjs → chunk-XNQAIO74.mjs} +5523 -3847
- package/dist/chunk-Y3L5MDRV.mjs +96 -0
- package/dist/chunk-ZJ4CSAB2.mjs +13 -0
- package/dist/{client-B_X6_AbT.d.ts → client-CQUqt9Ir.d.ts} +13 -4
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +20 -14
- package/dist/{config-Czh2YNDi.d.ts → config-CNas6wJH.d.ts} +2 -2
- package/dist/{config-OON7IJ_B.d.ts → config-bXxnJrQc.d.ts} +80 -35
- package/dist/direct-executor-RBA5O7EN.mjs +12 -0
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +8 -8
- package/dist/distribution.mjs +32 -17
- package/dist/embeddings/openai.mjs +1 -1
- package/dist/{engine-9PtFY50q.d.ts → engine-Dj4I91Jv.d.ts} +21 -8
- package/dist/index.browser.mjs +12962 -7786
- package/dist/index.d.ts +9 -21
- package/dist/index.mjs +14 -13
- package/dist/{memory-Bzd5xcEW.d.ts → memory-xrXOZMbw.d.ts} +68 -13
- package/dist/persistence/durability/checkpoint-worker.d.ts +138 -3
- package/dist/persistence/durability/checkpoint-worker.mjs +32 -18
- package/dist/react.d.ts +11 -11
- package/dist/react.mjs +16 -4
- package/dist/{schema-BqRx9t4E.d.ts → schema-mLpXZBEh.d.ts} +43 -12
- package/dist/serialization/crc32-worker.mjs +2 -1
- package/dist/server.d.ts +13 -10
- package/dist/server.mjs +136 -47
- package/dist/simd-DW5AtJ6B.d.ts +41 -0
- package/dist/{tasks-DT7L1p6w.d.ts → tasks-Df73Tjgq.d.ts} +9 -5
- package/dist/{thread-PZLEO6JL.mjs → thread-5UP6MGED.mjs} +131 -43
- package/dist/{types-DXPxaXPO.d.ts → types-BTIVO8DI.d.ts} +1 -1
- package/dist/vector/search-worker.d.ts +292 -128
- package/dist/vector/search-worker.mjs +70 -54
- package/dist/workers/entry.mjs +30 -14
- package/package.json +52 -31
- package/dist/brute-force-DbHYCTc3.d.ts +0 -8
- package/dist/chunk-CBLS46IE.mjs +0 -10
- package/dist/chunk-PIWKZPP7.mjs +0 -64
- package/dist/chunk-PMBHH44R.mjs +0 -492
- package/dist/chunk-RP23PWMV.mjs +0 -11
- package/dist/chunk-X6YZO4MQ.mjs +0 -1572
- package/dist/direct-executor-OREXU72C.mjs +0 -12
- package/dist/vector/hnsw-build-worker.d.ts +0 -105
- package/dist/vector/hnsw-build-worker.mjs +0 -123
package/dist/distribution.mjs
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { MAX_MESSAGE_SIZE_BYTES } from './chunk-UNEEFTEU.mjs';
|
|
2
|
-
import { validateIndexName, indexConfigKey, putIndexMetadata, getIndexMetadata } from './chunk-
|
|
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-
|
|
4
|
-
import { now, listBindingOf, queryBindingOf, foldGroupReducer, clampLimit, dedupePinnedEntries } from './chunk-ZHUQKZBE.mjs';
|
|
2
|
+
import { validateIndexName, indexConfigKey, putIndexMetadata, getIndexMetadata } from './chunk-NTZYA3SJ.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-BH5SYB5W.mjs';
|
|
5
4
|
import { ReplicationMessageTypes, TransportErrorCodes, ClusterMessageTypes, QueryMessageTypes, TransportError } from './chunk-GCM3JFVA.mjs';
|
|
6
|
-
import { MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-
|
|
7
|
-
import {
|
|
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';
|
|
5
|
+
import { providedDocId, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-4NVPQ6S5.mjs';
|
|
6
|
+
import { generateId, deserializePayloadV2, createPartitionIndex, getLanguage, FILTER_EXPRESSION_KEYS, FIELD_FILTER_OPERATORS } from './chunk-XNQAIO74.mjs';
|
|
10
7
|
import './chunk-AV4IJKD2.mjs';
|
|
11
|
-
import {
|
|
8
|
+
import { now, listBindingOf, queryBindingOf, foldGroupReducer, clampLimit, dedupePinnedEntries } from './chunk-TVT5V4E7.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-D2S642IV.mjs';
|
|
10
|
+
import { resolveProjection, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, normalizeSort, encodePageCursor, applyProjection, readSortValues, requireWithinResultWindow, fnv1a, mergePartitionStats } from './chunk-5T6AOR37.mjs';
|
|
11
|
+
import { DEFAULT_PAGE_SIZE, MAX_SORT_FIELDS, MAX_CURSOR_LENGTH, RESULT_WINDOW, MAX_NESTING_DEPTH } from './chunk-L225SHNB.mjs';
|
|
12
12
|
import './chunk-TGP5M5R7.mjs';
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import { crc32 } from './chunk-
|
|
13
|
+
import './chunk-U2AL3SON.mjs';
|
|
14
|
+
import { MIN_OVERSAMPLE } from './chunk-ZJ4CSAB2.mjs';
|
|
15
|
+
import './chunk-UTOFOJOR.mjs';
|
|
16
|
+
import { crc32 } from './chunk-3L4U6EJQ.mjs';
|
|
17
|
+
import './chunk-IFBKLBGB.mjs';
|
|
17
18
|
import './chunk-U2BKYEC7.mjs';
|
|
18
19
|
import { compareCodePoints, toComparableSortValue, compareComparableKeys, compareSortValues } from './chunk-2GWVQWGA.mjs';
|
|
19
|
-
import './chunk-
|
|
20
|
-
import { ErrorCodes, NarsilError, describeError } from './chunk-
|
|
20
|
+
import './chunk-POWOTUKJ.mjs';
|
|
21
|
+
import { ErrorCodes, NarsilError, describeError } from './chunk-FRQVMFY7.mjs';
|
|
21
22
|
import { encode, decode } from '@msgpack/msgpack';
|
|
22
23
|
|
|
23
24
|
// src/distribution/cluster/constants.ts
|
|
@@ -5159,7 +5160,7 @@ async function applyLocalReplicationEntry(core, entry) {
|
|
|
5159
5160
|
const vecIndexes = manager.getVectorIndexes();
|
|
5160
5161
|
if (entry.operation === "INDEX") {
|
|
5161
5162
|
applyIndexEntry(entry, manager, indexEntry.vectorFieldPaths, vecIndexes);
|
|
5162
|
-
const appliedDocument = manager.
|
|
5163
|
+
const appliedDocument = manager.getRef(entry.documentId);
|
|
5163
5164
|
if (appliedDocument !== void 0) {
|
|
5164
5165
|
await core.orchestrator.replicateToWorkers({
|
|
5165
5166
|
type: "insert",
|
|
@@ -6088,6 +6089,7 @@ var MAX_PREFIX_LENGTH = 1024;
|
|
|
6088
6089
|
var MAX_PINNED_ENTRIES = 1e3;
|
|
6089
6090
|
var MAX_PINNED_POSITION = RESULT_WINDOW;
|
|
6090
6091
|
var MAX_EF_SEARCH = 1e4;
|
|
6092
|
+
var MAX_OVERSAMPLE = 100;
|
|
6091
6093
|
var MAX_GROUP_FIELDS = 64;
|
|
6092
6094
|
var MAX_HIGHLIGHT_TAG_LENGTH = 256;
|
|
6093
6095
|
var MAX_HIGHLIGHT_SNIPPET_LENGTH = 65536;
|
|
@@ -6722,6 +6724,14 @@ function validateEfSearchParam(value) {
|
|
|
6722
6724
|
);
|
|
6723
6725
|
}
|
|
6724
6726
|
}
|
|
6727
|
+
function validateOversampleParam(value) {
|
|
6728
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < MIN_OVERSAMPLE || value > MAX_OVERSAMPLE) {
|
|
6729
|
+
throwInvalid(
|
|
6730
|
+
CONFIG_INVALID,
|
|
6731
|
+
`Invalid SearchPayload: "params.vector.oversample" must be a number between ${MIN_OVERSAMPLE} and ${MAX_OVERSAMPLE}`
|
|
6732
|
+
);
|
|
6733
|
+
}
|
|
6734
|
+
}
|
|
6725
6735
|
|
|
6726
6736
|
// src/distribution/query/validators/search.ts
|
|
6727
6737
|
var MAX_FACET_SHARD_SIZE = oversampledShardSize(MAX_FACET_SIZE);
|
|
@@ -6784,6 +6794,9 @@ function validateVectorParams(value) {
|
|
|
6784
6794
|
if (value.efSearch !== null) {
|
|
6785
6795
|
validateEfSearchParam(value.efSearch);
|
|
6786
6796
|
}
|
|
6797
|
+
if (value.oversample !== null) {
|
|
6798
|
+
validateOversampleParam(value.oversample);
|
|
6799
|
+
}
|
|
6787
6800
|
}
|
|
6788
6801
|
function validateSortParams(value) {
|
|
6789
6802
|
if (!Array.isArray(value)) {
|
|
@@ -7560,6 +7573,7 @@ function convertWireVectorToLocal(vector) {
|
|
|
7560
7573
|
if (vector.similarity !== null) local.similarity = vector.similarity;
|
|
7561
7574
|
if (vector.metric !== null) local.metric = vector.metric;
|
|
7562
7575
|
if (vector.efSearch !== null) local.efSearch = vector.efSearch;
|
|
7576
|
+
if (vector.oversample !== null) local.oversample = vector.oversample;
|
|
7563
7577
|
return local;
|
|
7564
7578
|
}
|
|
7565
7579
|
function convertWireHybridToLocal(hybrid) {
|
|
@@ -7659,7 +7673,8 @@ function convertLocalVectorToWire(vector) {
|
|
|
7659
7673
|
text: vector.text ?? null,
|
|
7660
7674
|
similarity: vector.similarity ?? null,
|
|
7661
7675
|
metric: vector.metric ?? null,
|
|
7662
|
-
efSearch: vector.efSearch ?? null
|
|
7676
|
+
efSearch: vector.efSearch ?? null,
|
|
7677
|
+
oversample: vector.oversample ?? null
|
|
7663
7678
|
};
|
|
7664
7679
|
}
|
|
7665
7680
|
function convertLocalHybridToWire(hybrid) {
|
|
@@ -9189,7 +9204,7 @@ async function routeDropIndex(name, coordinator, engine) {
|
|
|
9189
9204
|
await coordinator.dropSchema(name);
|
|
9190
9205
|
}
|
|
9191
9206
|
async function routeInsert(indexName, document, docId, deps, options) {
|
|
9192
|
-
const resolvedDocId = docId ?? generateId();
|
|
9207
|
+
const resolvedDocId = docId ?? providedDocId(document) ?? generateId();
|
|
9193
9208
|
const resolution = await resolvePrimaryAssignment(indexName, resolvedDocId, deps, false);
|
|
9194
9209
|
if (resolution === null) {
|
|
9195
9210
|
return deps.engine.insert(indexName, document, resolvedDocId, options);
|
|
@@ -1,6 +1,6 @@
|
|
|
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,
|
|
3
|
-
import { A as AnyDocument,
|
|
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-xrXOZMbw.js';
|
|
3
|
+
import { A as AnyDocument, a as InsertOptions, W as WriteOptions, I as IndexConfig, P as PartitionConfig } from './schema-mLpXZBEh.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Every event the engine emits, with the payload each one carries.
|
|
@@ -68,17 +68,23 @@ type NarsilEventMap = {
|
|
|
68
68
|
partitionCount: number;
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
|
-
* The process
|
|
71
|
+
* The process uses nine tenths of its heap, measured during a write or a
|
|
72
72
|
* load, so the next large index may end the process with an out-of-memory
|
|
73
|
-
* error.
|
|
74
|
-
*
|
|
73
|
+
* error. Where `--max-old-space-size` or `--max-old-space-size-percentage`
|
|
74
|
+
* sets a limit, on the command line or in `NODE_OPTIONS`, the engine measures
|
|
75
|
+
* the used bytes against that figure and `heapLimit` reports it. Where
|
|
76
|
+
* neither flag sets one, the engine compares the used bytes with the headroom
|
|
77
|
+
* that V8 reports, which runs about 192 MB above the true ceiling, so a
|
|
78
|
+
* default heap below about 2 GB may end before this event fires. The engine
|
|
79
|
+
* emits the event once per crossing and arms it again once the headroom
|
|
80
|
+
* recovers to two tenths. Raise the limit with
|
|
75
81
|
* `--max-old-space-size-percentage` or `--max-old-space-size`, or close an
|
|
76
82
|
* idle index; see {@link ProcessMemoryReport.heapLimit}.
|
|
77
83
|
*/
|
|
78
84
|
heapPressure: {
|
|
79
|
-
/** The heap
|
|
85
|
+
/** The heap reaches that point during a write to this index or a load of it. */
|
|
80
86
|
indexName: string;
|
|
81
|
-
/** The process
|
|
87
|
+
/** The process uses this much heap, in bytes. */
|
|
82
88
|
heapUsed: number;
|
|
83
89
|
/** The heap may grow to this many bytes. */
|
|
84
90
|
heapLimit: number;
|
|
@@ -155,7 +161,9 @@ interface DocumentWriteOperations {
|
|
|
155
161
|
* @param indexName - The index that receives the document.
|
|
156
162
|
* @param document - Its fields must match the types the schema declares.
|
|
157
163
|
* @param docId - Pass an id to control it yourself, or omit it and read the
|
|
158
|
-
* returned value.
|
|
164
|
+
* returned value. An id that differs from the document's own `id` field
|
|
165
|
+
* raises `DOC_VALIDATION_FAILED`, because the stored document would
|
|
166
|
+
* otherwise contradict the key that it is stored under.
|
|
159
167
|
* @param options - Per-write settings, such as skipping the defensive copy
|
|
160
168
|
* or waiting for every worker copy to apply the write.
|
|
161
169
|
* @returns The id the document is stored under.
|
|
@@ -294,6 +302,11 @@ interface Narsil extends IndexLifecycleOperations, DocumentWriteOperations {
|
|
|
294
302
|
/**
|
|
295
303
|
* Fetches one stored document by id, without searching.
|
|
296
304
|
*
|
|
305
|
+
* A vector field comes back as a `Float32Array`, whatever form you give it.
|
|
306
|
+
* `JSON.stringify` writes one as an object keyed by index, so convert it
|
|
307
|
+
* with `Array.from`, or project the field away, before you serialise the
|
|
308
|
+
* document yourself. The HTTP routes convert it for you.
|
|
309
|
+
*
|
|
297
310
|
* @param indexName - The index holding the document.
|
|
298
311
|
* @param docId - The document to fetch.
|
|
299
312
|
* @returns The document, or `undefined` when the index holds no such id.
|