@delali/narsil 0.2.4-next.59 → 0.3.1-next.101
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 +9 -8
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/{adapters-79OIa4xm.d.ts → adapters-BQFQ4PRz.d.ts} +27 -1
- package/dist/browser/chunk-BDOSMEEP.mjs +493 -0
- package/dist/browser/chunk-EJDUFWSO.mjs +602 -0
- package/dist/browser/chunk-HOZW3PKP.mjs +9 -0
- package/dist/browser/chunk-JOVZ6HMT.mjs +4358 -0
- package/dist/browser/chunk-JPTQZWJQ.mjs +10 -0
- package/dist/browser/chunk-KPJMDPHG.mjs +24558 -0
- package/dist/browser/chunk-PGIM3HIM.mjs +2743 -0
- package/dist/browser/chunk-RHG4O77A.mjs +206 -0
- package/dist/browser/chunk-RIJSLY2I.mjs +360 -0
- package/dist/browser/durability-wiring-SRUYT3VV.mjs +3875 -0
- package/dist/browser/module-CBB2ETYP.mjs +3111 -0
- package/dist/browser/release-76MXRPGV.mjs +33 -0
- package/dist/browser/replace-RURXTGVG.mjs +57 -0
- package/dist/browser/restore-queue-EEZQO6RF.mjs +35 -0
- package/dist/browser/runtime-7ZAHCHWR.mjs +557 -0
- package/dist/browser/snapshot-OAAA5UJ7.mjs +1210 -0
- package/dist/browser/write-7D6VIK6O.mjs +208 -0
- package/dist/{capabilities-DSsOGz6F.d.ts → capabilities-DiGlB6Sr.d.ts} +68 -7
- package/dist/chunk-2RIRGOUL.mjs +113 -0
- package/dist/chunk-37CD3OKS.mjs +87 -0
- package/dist/chunk-44W3CBNG.mjs +7 -0
- package/dist/chunk-46D6JQIG.mjs +426 -0
- package/dist/{chunk-VMRR3DQU.mjs → chunk-5JNA5SKS.mjs} +546 -35
- package/dist/chunk-747OHOUA.mjs +11 -0
- package/dist/chunk-75XIEF6H.mjs +126 -0
- package/dist/chunk-7X5JST5L.mjs +114 -0
- package/dist/chunk-BOFBLJFZ.mjs +209 -0
- package/dist/{chunk-USKFU7J5.mjs → chunk-BWJVNZPR.mjs} +8 -1
- package/dist/chunk-C7SLA6CM.mjs +19 -0
- package/dist/{chunk-POWOTUKJ.mjs → chunk-CQUMNIIG.mjs} +3 -6
- package/dist/chunk-CVXLLEQ3.mjs +1011 -0
- package/dist/chunk-DJHHF2L5.mjs +17 -0
- package/dist/chunk-E74YLAIG.mjs +24 -0
- package/dist/{chunk-UXNWQZST.mjs → chunk-EMRMGYRE.mjs} +236 -18
- package/dist/chunk-EWZLIYHV.mjs +57 -0
- package/dist/chunk-GBEEG5AN.mjs +35 -0
- package/dist/chunk-GES7U2PM.mjs +68 -0
- package/dist/chunk-HJSN7UYG.mjs +10 -0
- package/dist/chunk-HLPRHOSO.mjs +17 -0
- package/dist/chunk-HMFNFVP7.mjs +14 -0
- package/dist/chunk-J5QP52HA.mjs +1751 -0
- package/dist/{chunk-YNVIUGF5.mjs → chunk-JZVARCRZ.mjs} +3 -28
- package/dist/chunk-KOKM4PQN.mjs +52 -0
- package/dist/{chunk-B2TFROFX.mjs → chunk-KWTW6VTG.mjs} +465 -250
- package/dist/chunk-KZ3NX2P7.mjs +21 -0
- package/dist/chunk-L5ORED7V.mjs +25 -0
- package/dist/{chunk-THYRHHO2.mjs → chunk-LGAMKHA2.mjs} +2009 -2351
- package/dist/chunk-LKOB5COA.mjs +117 -0
- package/dist/chunk-LPQOEU5M.mjs +96 -0
- package/dist/{chunk-3LHGNRYE.mjs → chunk-LXWDQLTW.mjs} +7 -2
- package/dist/{chunk-L6TNPLAR.mjs → chunk-OEYI3KRB.mjs} +270 -108
- package/dist/chunk-OM362BRO.mjs +948 -0
- package/dist/chunk-OZDFA4WC.mjs +67 -0
- package/dist/chunk-P36MUFEJ.mjs +10 -0
- package/dist/chunk-PC2G76VW.mjs +2540 -0
- package/dist/{chunk-GCM3JFVA.mjs → chunk-PNEYIHA4.mjs} +11 -2
- package/dist/chunk-PNFKUCG3.mjs +1130 -0
- package/dist/chunk-Q6XWVUZX.mjs +44 -0
- package/dist/chunk-R27EMH5M.mjs +617 -0
- package/dist/{chunk-YMZCMH5M.mjs → chunk-R6A773WK.mjs} +19 -24
- package/dist/chunk-RF7PLG43.mjs +106 -0
- package/dist/chunk-RFBLQLLZ.mjs +16 -0
- package/dist/{chunk-Y3L5MDRV.mjs → chunk-RFVUDM5E.mjs} +17 -2
- package/dist/chunk-S7FL6UAH.mjs +521 -0
- package/dist/chunk-S7GNDRPS.mjs +651 -0
- package/dist/chunk-SP3NM3ZG.mjs +3537 -0
- package/dist/chunk-U476IXKQ.mjs +10 -0
- package/dist/chunk-UA3AUGNV.mjs +462 -0
- package/dist/chunk-UTG5YNXV.mjs +507 -0
- package/dist/chunk-VI4R6W25.mjs +8484 -0
- package/dist/chunk-WQBCBKY3.mjs +8 -0
- package/dist/{chunk-24RXHMEL.mjs → chunk-WVCOCKBU.mjs} +3794 -7570
- package/dist/chunk-X5CV2E2B.mjs +1 -0
- package/dist/chunk-XADZPPZI.mjs +614 -0
- package/dist/chunk-YEEQHT4V.mjs +212 -0
- package/dist/chunk-YTJCGKM4.mjs +56 -0
- package/dist/chunk-YYQIODMF.mjs +275 -0
- package/dist/chunk-ZI34TVOA.mjs +144 -0
- package/dist/{chunk-OOSIDHA3.mjs → chunk-ZKWYWW4Y.mjs} +1 -1
- package/dist/chunk-ZM7KU4YW.mjs +35 -0
- package/dist/{client-BQK6Tf6A.d.ts → client-BOStAkc5.d.ts} +160 -37
- package/dist/client.d.ts +11 -10
- package/dist/client.mjs +209 -45
- package/dist/{config-DmXULPa-.d.ts → config-Cjvzbs_j.d.ts} +51 -3
- package/dist/config-DffQlmRq.d.ts +421 -0
- package/dist/direct-executor-ZD64PPEZ.mjs +24 -0
- package/dist/distribution/coordinator/etcd.d.ts +79 -18
- package/dist/distribution/coordinator/etcd.mjs +553 -109
- package/dist/distribution/coordinator/in-memory.d.ts +4 -3
- package/dist/distribution/coordinator/in-memory.mjs +22 -3
- package/dist/distribution/transport/grpc.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +79 -14
- package/dist/distribution/transport/in-memory.d.ts +2 -2
- package/dist/distribution/transport/in-memory.mjs +12 -7
- package/dist/distribution/transport/tcp.d.ts +2 -2
- package/dist/distribution/transport/tcp.mjs +50 -28
- package/dist/distribution.d.ts +144 -23
- package/dist/distribution.mjs +14479 -8173
- package/dist/durability-wiring-FEUBR5BT.mjs +3330 -0
- package/dist/embeddings/openai.d.ts +2 -2
- package/dist/embeddings/openai.mjs +22 -133
- package/dist/{engine-CIOyFozK.d.ts → engine-rC0vjjY-.d.ts} +165 -141
- package/dist/{memory-yFaVn2xZ.d.ts → events-DqOIg5xa.d.ts} +645 -136
- package/dist/{types-DAK7mnUZ.d.ts → index-Bkdt8nDw.d.ts} +182 -45
- package/dist/index.browser.mjs +4 -32180
- package/dist/index.d.ts +91 -20
- package/dist/index.mjs +33 -16
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/filesystem.mjs +2 -1
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/module-3S65MVCM.mjs +2151 -0
- package/dist/partial-words-DTIHO8G4.d.ts +19 -0
- package/dist/partial-words.d.ts +22 -0
- package/dist/partial-words.mjs +17 -0
- package/dist/pattern-Cledccbl.d.ts +18 -0
- package/dist/pattern.d.ts +22 -0
- package/dist/pattern.mjs +12 -0
- package/dist/persistence/durability/checkpoint-worker.d.ts +119 -72
- package/dist/persistence/durability/checkpoint-worker.mjs +51 -18
- package/dist/react.d.ts +279 -183
- package/dist/react.mjs +201 -48
- package/dist/release-BH3DKW3T.mjs +33 -0
- package/dist/replace-CEO5KJJ3.mjs +57 -0
- package/dist/rerank-K7C4WZFG.mjs +60 -0
- package/dist/rerankers/http.d.ts +50 -0
- package/dist/rerankers/http.mjs +104 -0
- package/dist/restore-queue-KQHA7ZV2.mjs +35 -0
- package/dist/runtime-6Y4ZYXOG.mjs +177 -0
- package/dist/{schema-d5Afu03A.d.ts → schema-4W_7tk1f.d.ts} +81 -11
- package/dist/server.d.ts +13 -12
- package/dist/server.mjs +611 -80
- package/dist/snapshot-QGZPODM5.mjs +799 -0
- package/dist/synonyms-CpOAHPa-.d.ts +52 -0
- package/dist/synonyms.d.ts +22 -0
- package/dist/synonyms.mjs +12 -0
- package/dist/{tasks-CH2Dod8w.d.ts → tasks-CwPTz-tP.d.ts} +10 -3
- package/dist/thread-N3IUGUS3.mjs +697 -0
- package/dist/{types-BQDlIvfS.d.ts → types-2qoitTXg.d.ts} +1 -1
- package/dist/{types-D5OwhtsQ.d.ts → types-Cz5okLml.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +46 -4
- package/dist/vector/search-worker.mjs +21 -11
- package/dist/workers/entry.mjs +9 -6
- package/dist/write-U5RI7MAX.mjs +241 -0
- package/package.json +55 -9
- package/dist/chunk-3L4U6EJQ.mjs +0 -49
- package/dist/chunk-IFBKLBGB.mjs +0 -7
- package/dist/chunk-ORBLD3EL.mjs +0 -6
- package/dist/chunk-U7KYW4BA.mjs +0 -135
- package/dist/chunk-ZJ4CSAB2.mjs +0 -13
- package/dist/chunk-ZNZBXMP5.mjs +0 -2117
- package/dist/chunk-ZZT3EAUC.mjs +0 -11168
- package/dist/config-BhldZgaK.d.ts +0 -194
- package/dist/direct-executor-ALAVE7FC.mjs +0 -12
- package/dist/serialization/crc32-worker.d.ts +0 -20
- package/dist/serialization/crc32-worker.mjs +0 -62
- package/dist/simd-DW5AtJ6B.d.ts +0 -41
- package/dist/thread-DYHEQRVY.mjs +0 -402
|
@@ -29,9 +29,9 @@ interface TransportConfig {
|
|
|
29
29
|
connectTimeout: number;
|
|
30
30
|
/** An ordinary request and its reply may take this long. */
|
|
31
31
|
requestTimeout: number;
|
|
32
|
-
/** A replication entry may take this long to reach a replica and come back acknowledged. */
|
|
32
|
+
/** A replication entry, or a batch of them, may take this long to reach a replica and come back acknowledged. */
|
|
33
33
|
replicationTimeout: number;
|
|
34
|
-
/** A
|
|
34
|
+
/** A node waits this long for each next chunk of a snapshot transfer, which moves a partition or an index between nodes, so that the node can receive a transfer of any size while the sender keeps sending. */
|
|
35
35
|
snapshotTimeout: number;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import '../
|
|
1
|
+
import { e as VectorQuantizationMode } from '../schema-4W_7tk1f.js';
|
|
2
|
+
import '../adapters-BQFQ4PRz.js';
|
|
3
|
+
import '../synonyms-CpOAHPa-.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Similarity metric a vector search ranks by.
|
|
@@ -42,6 +42,34 @@ interface OrdinalFilter {
|
|
|
42
42
|
*/
|
|
43
43
|
type GrowableBuffer = SharedArrayBuffer | ArrayBuffer;
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* The distance kernels bound to one memory, which read their operands at byte
|
|
47
|
+
* offsets inside that memory so that a caller measures against a vector where
|
|
48
|
+
* it already lies.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
interface ArenaSimd {
|
|
53
|
+
/** The kernels read every operand out of this memory. */
|
|
54
|
+
memory: WebAssembly.Memory;
|
|
55
|
+
/** Returns the dot product of two float32 vectors at the given byte offsets. */
|
|
56
|
+
dot_product: (ptrA: number, ptrB: number, len: number) => number;
|
|
57
|
+
/** Returns the length of the float32 vector at the given byte offset. */
|
|
58
|
+
magnitude: (ptr: number, len: number) => number;
|
|
59
|
+
/** Returns the squared euclidean distance between two float32 vectors at the given byte offsets. */
|
|
60
|
+
squared_euclidean_distance: (ptrA: number, ptrB: number, len: number) => number;
|
|
61
|
+
/** Returns the integer dot product of two byte code vectors at the given byte offsets. */
|
|
62
|
+
dot_u8: (ptrA: number, ptrB: number, len: number) => number;
|
|
63
|
+
/** Returns the integer squared distance between two byte code vectors at the given byte offsets. */
|
|
64
|
+
sqdist_u8: (ptrA: number, ptrB: number, len: number) => number;
|
|
65
|
+
/** Returns the sum of level products of two 4-bit codes at the given byte offsets, each holding two levels per byte. */
|
|
66
|
+
osq_dot_nibbles_4x4: (ptrA: number, ptrB: number, bytes: number) => number;
|
|
67
|
+
/** Returns the sum of level products of a 1-bit or 2-bit code and a query staged as four bit planes. Each plane spans `planeBytes`, with one bit for each of the code's lowest level bits. */
|
|
68
|
+
osq_dot_bits: (ptrDoc: number, ptrPlanes: number, planeBytes: number, docBits: number) => number;
|
|
69
|
+
/** Returns the sum of level products of two 1-bit codes or two 2-bit codes at the given byte offsets. */
|
|
70
|
+
osq_dot_bits_pair: (ptrA: number, ptrB: number, bytes: number, bits: number) => number;
|
|
71
|
+
}
|
|
72
|
+
|
|
45
73
|
/**
|
|
46
74
|
* This geometry gives the byte offset of every region inside one block. A
|
|
47
75
|
* block begins with one query scratch for each thread slot, and the slots
|
|
@@ -156,6 +184,12 @@ interface SharedVectorStoreHandles {
|
|
|
156
184
|
magnitudes: GrowableBuffer;
|
|
157
185
|
/** This holds one byte per ordinal, which reads 1 where the ordinal holds a live vector. */
|
|
158
186
|
present: GrowableBuffer;
|
|
187
|
+
/** This holds one byte per ordinal, which reads 1 where the graph has yet to place the ordinal's vector. */
|
|
188
|
+
unplaced: GrowableBuffer;
|
|
189
|
+
/** This holds one 32-bit count for each fixed run of ordinals, which counts the unplaced flags that the run holds, so that a reader can skip every run whose count reads 0. */
|
|
190
|
+
unplacedChunks: GrowableBuffer;
|
|
191
|
+
/** This holds one byte per ordinal, which reads 1 where the field has removed the ordinal's document while it keeps the vector. */
|
|
192
|
+
removed: GrowableBuffer;
|
|
159
193
|
/** This holds each ordinal's partition, or a negative marker where the store knows none. */
|
|
160
194
|
partitions: GrowableBuffer;
|
|
161
195
|
/** This holds every document id, UTF-8 encoded end to end in ordinal order. */
|
|
@@ -189,6 +223,8 @@ interface VectorStoreSnapshot {
|
|
|
189
223
|
magnitudes: Float64Array;
|
|
190
224
|
/** This names the document at each ordinal, and it reads `null` where the ordinal holds none. */
|
|
191
225
|
docIds: Array<string | null>;
|
|
226
|
+
/** This lists the ordinals of vectors that an update replaced, and the store keeps each of those vectors so that a search can pass through it until compaction. */
|
|
227
|
+
replacedOrdinals: number[];
|
|
192
228
|
}
|
|
193
229
|
|
|
194
230
|
/**
|
|
@@ -215,6 +251,8 @@ interface SharedGraphHandles {
|
|
|
215
251
|
locks: GrowableBuffer;
|
|
216
252
|
/** This holds one byte per ordinal, which reads 1 once a caller removes the document. */
|
|
217
253
|
tombstones: GrowableBuffer;
|
|
254
|
+
/** This holds one word per ordinal, the number of base-layer lists that hold that ordinal. */
|
|
255
|
+
incoming: GrowableBuffer;
|
|
218
256
|
/** This records the node lock and the graph lock each thread slot holds right now. */
|
|
219
257
|
heldLocks: Int32Array;
|
|
220
258
|
}
|
|
@@ -423,6 +461,8 @@ interface VectorSearchRequest {
|
|
|
423
461
|
efSearch?: number;
|
|
424
462
|
/** The worker re-scores this many times the requested count against full precision, or its own default when absent. */
|
|
425
463
|
oversample?: number;
|
|
464
|
+
/** When present, the worker re-scores only this many times the oversample of the nearest candidates against full precision and keeps the estimated score of the rest, or returns the re-scored candidates alone under a similarity floor. */
|
|
465
|
+
rescoreWindow?: number;
|
|
426
466
|
}
|
|
427
467
|
/**
|
|
428
468
|
* Asks the search worker to answer one nearest-neighbour query from a shared
|
|
@@ -451,6 +491,8 @@ interface VectorOrdinalSearchRequest {
|
|
|
451
491
|
efSearch?: number;
|
|
452
492
|
/** The worker re-scores this many times the requested count against full precision, or its own default when absent. */
|
|
453
493
|
oversample?: number;
|
|
494
|
+
/** When present, the worker re-scores only this many times the oversample of the nearest candidates against full precision and keeps the estimated score of the rest, or returns the re-scored candidates alone under a similarity floor. */
|
|
495
|
+
rescoreWindow?: number;
|
|
454
496
|
}
|
|
455
497
|
/**
|
|
456
498
|
* Every message the engine posts to the search worker.
|
|
@@ -534,4 +576,4 @@ interface VectorWorkerError {
|
|
|
534
576
|
*/
|
|
535
577
|
type VectorWorkerMessage = VectorAckResponse | VectorInsertResponse | VectorSearchResponse | VectorOrdinalSearchResponse | VectorWorkerError;
|
|
536
578
|
|
|
537
|
-
export { ArenaSimd,
|
|
579
|
+
export type { ArenaSimd, BlockGeometry, GraphInsertOutcome, GrowableBuffer, HNSWSnapshot, OrdinalFilter, OsqBits, SharedFieldLoadRequest, SharedGraphHandles, SharedVectorFieldHandles, SharedVectorStoreHandles, VectorAckResponse, VectorBlockHandle, VectorBlockLayout, VectorBlockStorage, VectorCodeBlockLayout, VectorDropRequest, VectorInsertRequest, VectorInsertResponse, VectorLoadRequest, VectorMetric, VectorOrdinalSearchRequest, VectorOrdinalSearchResponse, VectorSearchRequest, VectorSearchResponse, VectorStoreSnapshot, VectorWorkerError, VectorWorkerMessage, VectorWorkerRequest, WorkerCopyCodes, WorkerCopySnapshot };
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { openSharedVectorField,
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
1
|
+
import { openSharedVectorField, createVectorStore } from '../chunk-CVXLLEQ3.mjs';
|
|
2
|
+
import { osqBitsOf, createHNSWIndex, createOsqQuantizer } from '../chunk-LGAMKHA2.mjs';
|
|
3
|
+
import '../chunk-DJHHF2L5.mjs';
|
|
4
|
+
import { osqRecordBytes } from '../chunk-37CD3OKS.mjs';
|
|
5
|
+
import '../chunk-KOKM4PQN.mjs';
|
|
6
|
+
import { MAX_WORKER_COPIES } from '../chunk-GBEEG5AN.mjs';
|
|
7
|
+
import '../chunk-JZVARCRZ.mjs';
|
|
8
|
+
import '../chunk-HMFNFVP7.mjs';
|
|
9
|
+
import '../chunk-R6A773WK.mjs';
|
|
10
|
+
import '../chunk-YTJCGKM4.mjs';
|
|
11
|
+
import '../chunk-RFBLQLLZ.mjs';
|
|
12
|
+
import '../chunk-BWJVNZPR.mjs';
|
|
6
13
|
|
|
7
14
|
// src/vector/worker-copy.ts
|
|
8
15
|
function restoreQuantizer(snapshot, store) {
|
|
@@ -12,10 +19,11 @@ function restoreQuantizer(snapshot, store) {
|
|
|
12
19
|
quantizer.restoreCentroid(snapshot.codes.centroid);
|
|
13
20
|
const recordBytes = osqRecordBytes(snapshot.dimension, bits);
|
|
14
21
|
for (let ordinal = 0; ordinal < snapshot.codes.present.length; ordinal++) {
|
|
15
|
-
if (snapshot.codes.present[ordinal] !== 1) continue;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
if (snapshot.codes.present[ordinal] !== 1 || ordinal >= store.slots) continue;
|
|
23
|
+
quantizer.restoreRecordAtOrdinal(
|
|
24
|
+
ordinal,
|
|
25
|
+
snapshot.codes.records.subarray(ordinal * recordBytes, (ordinal + 1) * recordBytes)
|
|
26
|
+
);
|
|
19
27
|
}
|
|
20
28
|
return quantizer;
|
|
21
29
|
}
|
|
@@ -94,7 +102,8 @@ function handleSearch(request) {
|
|
|
94
102
|
const hits = entry.copy.graph.search(request.query, request.k, request.metric, request.minSimilarity, {
|
|
95
103
|
filter: request.filter,
|
|
96
104
|
efSearch: request.efSearch,
|
|
97
|
-
oversample: request.oversample
|
|
105
|
+
oversample: request.oversample,
|
|
106
|
+
rescoreWindow: request.rescoreWindow
|
|
98
107
|
});
|
|
99
108
|
const docIds = [];
|
|
100
109
|
const scores = new Float64Array(hits.length);
|
|
@@ -115,7 +124,8 @@ function handleSearchOrdinals(request) {
|
|
|
115
124
|
const hits = entry.view.searchOrdinals(request.query, request.k, request.metric, request.minSimilarity, {
|
|
116
125
|
filter: request.filter,
|
|
117
126
|
efSearch: request.efSearch,
|
|
118
|
-
oversample: request.oversample
|
|
127
|
+
oversample: request.oversample,
|
|
128
|
+
rescoreWindow: request.rescoreWindow
|
|
119
129
|
});
|
|
120
130
|
const ordinals = new Uint32Array(hits.length);
|
|
121
131
|
const scores = new Float64Array(hits.length);
|
package/dist/workers/entry.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { startIdleHeapCleanup } from '../chunk-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { startIdleHeapCleanup } from '../chunk-RFVUDM5E.mjs';
|
|
2
|
+
import { isValidWorkerAction } from '../chunk-CQUMNIIG.mjs';
|
|
3
|
+
import { loadVectorCode } from '../chunk-Q6XWVUZX.mjs';
|
|
4
|
+
import { threadSlotOfWorker } from '../chunk-RFBLQLLZ.mjs';
|
|
5
|
+
import '../chunk-L5ORED7V.mjs';
|
|
6
|
+
import { ErrorCodes, NarsilError, isNarsilError } from '../chunk-BWJVNZPR.mjs';
|
|
4
7
|
|
|
5
8
|
// src/workers/action-handler.ts
|
|
6
9
|
function buildErrorResponse(requestId, code, message, details) {
|
|
@@ -18,7 +21,7 @@ async function importBootstrapModule(moduleUrl) {
|
|
|
18
21
|
await import(moduleUrl);
|
|
19
22
|
}
|
|
20
23
|
async function stopServingRequests() {
|
|
21
|
-
const { closeRequestThread } = await import('../thread-
|
|
24
|
+
const { closeRequestThread } = await import('../thread-N3IUGUS3.mjs');
|
|
22
25
|
closeRequestThread();
|
|
23
26
|
}
|
|
24
27
|
function holdsCopies(executor) {
|
|
@@ -49,7 +52,7 @@ function createActionHandler(executor) {
|
|
|
49
52
|
if (!holdsCopies(executor)) {
|
|
50
53
|
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "This executor holds no copies to answer requests from");
|
|
51
54
|
}
|
|
52
|
-
const starting = import('../thread-
|
|
55
|
+
const starting = import('../thread-N3IUGUS3.mjs').then(
|
|
53
56
|
({ serveRequests }) => serveRequests(executor, action.settings)
|
|
54
57
|
);
|
|
55
58
|
serving.start = starting.then(
|
|
@@ -102,7 +105,7 @@ async function setup() {
|
|
|
102
105
|
} catch {
|
|
103
106
|
parentPort = null;
|
|
104
107
|
}
|
|
105
|
-
const { createDirectExecutor } = await import('../direct-executor-
|
|
108
|
+
const [{ createDirectExecutor }] = await Promise.all([import('../direct-executor-ZD64PPEZ.mjs'), loadVectorCode()]);
|
|
106
109
|
const handleAction = createActionHandler(createDirectExecutor({ threadSlot }));
|
|
107
110
|
if (parentPort) {
|
|
108
111
|
const port = parentPort;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { decodeVectorFilePayload, isDead, bytesToVectors } from './chunk-YYQIODMF.mjs';
|
|
2
|
+
import './chunk-37CD3OKS.mjs';
|
|
3
|
+
import { setNestedValue, KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment } from './chunk-XADZPPZI.mjs';
|
|
4
|
+
import { openChecksummedEnvelope, NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND, DOCUMENT_EXPORT_VERSION, DOCUMENT_EXPORT_FORMAT } from './chunk-WVCOCKBU.mjs';
|
|
5
|
+
import './chunk-KWTW6VTG.mjs';
|
|
6
|
+
import './chunk-EMRMGYRE.mjs';
|
|
7
|
+
import './chunk-OZDFA4WC.mjs';
|
|
8
|
+
import './chunk-AV4IJKD2.mjs';
|
|
9
|
+
import { decodeStoredDocument } from './chunk-SP3NM3ZG.mjs';
|
|
10
|
+
import './chunk-VI4R6W25.mjs';
|
|
11
|
+
import './chunk-ZM7KU4YW.mjs';
|
|
12
|
+
import './chunk-LPQOEU5M.mjs';
|
|
13
|
+
import './chunk-HJSN7UYG.mjs';
|
|
14
|
+
import { EXPORT_CHUNK_BYTES } from './chunk-LXWDQLTW.mjs';
|
|
15
|
+
import './chunk-TGP5M5R7.mjs';
|
|
16
|
+
import './chunk-U2BKYEC7.mjs';
|
|
17
|
+
import './chunk-KOKM4PQN.mjs';
|
|
18
|
+
import './chunk-GBEEG5AN.mjs';
|
|
19
|
+
import './chunk-JZVARCRZ.mjs';
|
|
20
|
+
import './chunk-PC2G76VW.mjs';
|
|
21
|
+
import './chunk-WQBCBKY3.mjs';
|
|
22
|
+
import './chunk-OM362BRO.mjs';
|
|
23
|
+
import './chunk-OEYI3KRB.mjs';
|
|
24
|
+
import './chunk-U476IXKQ.mjs';
|
|
25
|
+
import './chunk-E74YLAIG.mjs';
|
|
26
|
+
import './chunk-HMFNFVP7.mjs';
|
|
27
|
+
import './chunk-GES7U2PM.mjs';
|
|
28
|
+
import './chunk-LKOB5COA.mjs';
|
|
29
|
+
import './chunk-46D6JQIG.mjs';
|
|
30
|
+
import './chunk-X5CV2E2B.mjs';
|
|
31
|
+
import './chunk-7X5JST5L.mjs';
|
|
32
|
+
import './chunk-UTG5YNXV.mjs';
|
|
33
|
+
import './chunk-R6A773WK.mjs';
|
|
34
|
+
import './chunk-YTJCGKM4.mjs';
|
|
35
|
+
import './chunk-CQUMNIIG.mjs';
|
|
36
|
+
import './chunk-Q6XWVUZX.mjs';
|
|
37
|
+
import './chunk-RFBLQLLZ.mjs';
|
|
38
|
+
import './chunk-L5ORED7V.mjs';
|
|
39
|
+
import { NarsilError, ErrorCodes } from './chunk-BWJVNZPR.mjs';
|
|
40
|
+
import { decode } from '@msgpack/msgpack';
|
|
41
|
+
|
|
42
|
+
// src/engine/export/json-line.ts
|
|
43
|
+
function refuse(path, kind, docId) {
|
|
44
|
+
throw new NarsilError(
|
|
45
|
+
ErrorCodes.DOC_VALIDATION_FAILED,
|
|
46
|
+
`Document "${docId}" holds ${kind} at "${path || "(document)"}", which a document export cannot carry as JSON`,
|
|
47
|
+
{ docId, field: path }
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function encodeNumber(value, path, target) {
|
|
51
|
+
if (Number.isFinite(value)) return Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
52
|
+
if (!target.tagged) refuse(path, String(value), target.docId);
|
|
53
|
+
return `{"${NUMBER_TAG}":"${String(value)}"}`;
|
|
54
|
+
}
|
|
55
|
+
function encodeDate(value, path, target) {
|
|
56
|
+
const milliseconds = value.getTime();
|
|
57
|
+
if (!target.tagged || Number.isNaN(milliseconds)) refuse(path, "a date", target.docId);
|
|
58
|
+
const seconds = Math.floor(milliseconds / MILLISECONDS_PER_SECOND);
|
|
59
|
+
const nanoseconds = (milliseconds - seconds * MILLISECONDS_PER_SECOND) * NANOSECONDS_PER_MILLISECOND;
|
|
60
|
+
return `{"${DATE_TAG}":[${seconds},${nanoseconds}]}`;
|
|
61
|
+
}
|
|
62
|
+
function encodeBytes(value, path, target) {
|
|
63
|
+
if (!target.tagged) refuse(path, "bytes", target.docId);
|
|
64
|
+
return `{"${BYTES_TAG}":"${encodeBase64(value)}"}`;
|
|
65
|
+
}
|
|
66
|
+
function encodeList(value, path, target) {
|
|
67
|
+
target.parts.push("[");
|
|
68
|
+
for (let at = 0; at < value.length; at++) {
|
|
69
|
+
if (at > 0) target.parts.push(",");
|
|
70
|
+
encodeValue(value[at], `${path}[${at}]`, target);
|
|
71
|
+
}
|
|
72
|
+
target.parts.push("]");
|
|
73
|
+
}
|
|
74
|
+
function encodeMap(value, path, target) {
|
|
75
|
+
const proto = Object.getPrototypeOf(value);
|
|
76
|
+
if (proto !== Object.prototype && proto !== null) refuse(path, "a value other than a plain object", target.docId);
|
|
77
|
+
const entries = Object.entries(value).filter(([, entry]) => entry !== void 0);
|
|
78
|
+
const wrapped = target.tagged && entries.length === 1 && startsWithTagPrefix(entries[0][0]);
|
|
79
|
+
target.parts.push(wrapped ? `{"${OBJECT_TAG}":{` : "{");
|
|
80
|
+
for (let at = 0; at < entries.length; at++) {
|
|
81
|
+
const [key, entry] = entries[at];
|
|
82
|
+
if (at > 0) target.parts.push(",");
|
|
83
|
+
target.parts.push(JSON.stringify(key), ":");
|
|
84
|
+
encodeValue(entry, path === "" ? key : `${path}.${key}`, target);
|
|
85
|
+
}
|
|
86
|
+
target.parts.push(wrapped ? "}}" : "}");
|
|
87
|
+
}
|
|
88
|
+
function encodeValue(value, path, target) {
|
|
89
|
+
if (value === null) {
|
|
90
|
+
target.parts.push("null");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
switch (typeof value) {
|
|
94
|
+
case "string":
|
|
95
|
+
target.parts.push(JSON.stringify(value));
|
|
96
|
+
return;
|
|
97
|
+
case "boolean":
|
|
98
|
+
target.parts.push(value ? "true" : "false");
|
|
99
|
+
return;
|
|
100
|
+
case "number":
|
|
101
|
+
target.parts.push(encodeNumber(value, path, target));
|
|
102
|
+
return;
|
|
103
|
+
case "object":
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
refuse(path, `a ${typeof value}`, target.docId);
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(value)) encodeList(value, path, target);
|
|
109
|
+
else if (value instanceof Date) target.parts.push(encodeDate(value, path, target));
|
|
110
|
+
else if (value instanceof Uint8Array) target.parts.push(encodeBytes(value, path, target));
|
|
111
|
+
else encodeMap(value, path, target);
|
|
112
|
+
}
|
|
113
|
+
function encodeExactJson(value, docId) {
|
|
114
|
+
const target = { docId, tagged: false, parts: [] };
|
|
115
|
+
encodeValue(value, "", target);
|
|
116
|
+
return target.parts.join("");
|
|
117
|
+
}
|
|
118
|
+
function encodeDocumentJson(document, docId) {
|
|
119
|
+
const target = { docId, tagged: true, parts: [] };
|
|
120
|
+
encodeValue(document, "", target);
|
|
121
|
+
return target.parts.join("");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/engine/export/write.ts
|
|
125
|
+
var VECTOR_FILE_ENVELOPE_VERSION = 2;
|
|
126
|
+
var FLOAT32_BYTES = 4;
|
|
127
|
+
async function locateVectors(checkpoint) {
|
|
128
|
+
const located = /* @__PURE__ */ new Map();
|
|
129
|
+
for (const field of checkpoint.manifest.vectors) {
|
|
130
|
+
const byDocId = /* @__PURE__ */ new Map();
|
|
131
|
+
for (const ref of field.files) {
|
|
132
|
+
const { payload } = await openChecksummedEnvelope(await checkpoint.readFile(ref), {
|
|
133
|
+
envelopeFormatVersion: VECTOR_FILE_ENVELOPE_VERSION,
|
|
134
|
+
what: `vector file "${ref.key}"`,
|
|
135
|
+
allowsCompression: false
|
|
136
|
+
});
|
|
137
|
+
const decoded = decodeVectorFilePayload(decode(payload));
|
|
138
|
+
for (let position = 0; position < decoded.docIds.length; position++) {
|
|
139
|
+
if (isDead(ref.dead, position)) continue;
|
|
140
|
+
byDocId.set(decoded.docIds[position], { ref, position, dimension: decoded.dimension });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
located.set(field.fieldPath, byDocId);
|
|
144
|
+
}
|
|
145
|
+
return located;
|
|
146
|
+
}
|
|
147
|
+
async function readVector(checkpoint, location) {
|
|
148
|
+
const width = location.dimension * FLOAT32_BYTES;
|
|
149
|
+
const offset = location.ref.bytes - (location.ref.count - location.position) * width;
|
|
150
|
+
return Array.from(bytesToVectors((await checkpoint.readRange(location.ref, offset, width)).slice()));
|
|
151
|
+
}
|
|
152
|
+
async function readSegment(checkpoint, ref) {
|
|
153
|
+
const { payload } = await openChecksummedEnvelope(await checkpoint.readFile(ref), {
|
|
154
|
+
envelopeFormatVersion: KEYWORD_SEGMENT_ENVELOPE_VERSION,
|
|
155
|
+
what: `segment "${ref.key}"`,
|
|
156
|
+
allowsCompression: true
|
|
157
|
+
});
|
|
158
|
+
return decodeKeywordSegment(payload, false);
|
|
159
|
+
}
|
|
160
|
+
var decoder = new TextDecoder();
|
|
161
|
+
function idAt(contents, ordinal) {
|
|
162
|
+
const ids = contents.arrays.idTable;
|
|
163
|
+
return decoder.decode(ids.blob.subarray(ids.offsets[ordinal], ids.offsets[ordinal + 1]));
|
|
164
|
+
}
|
|
165
|
+
async function winnersOf(checkpoint, partition) {
|
|
166
|
+
const winners = /* @__PURE__ */ new Map();
|
|
167
|
+
for (let at = 0; at < partition.segments.length; at++) {
|
|
168
|
+
const contents = await readSegment(checkpoint, partition.segments[at]);
|
|
169
|
+
for (const docId of contents.tombstones) winners.delete(docId);
|
|
170
|
+
for (let ordinal = 0; ordinal < contents.arrays.documentCount; ordinal++) winners.set(idAt(contents, ordinal), at);
|
|
171
|
+
}
|
|
172
|
+
return winners;
|
|
173
|
+
}
|
|
174
|
+
async function* documentLines(checkpoint) {
|
|
175
|
+
const vectors = await locateVectors(checkpoint);
|
|
176
|
+
for (const partition of checkpoint.manifest.partitions) {
|
|
177
|
+
const winners = await winnersOf(checkpoint, partition);
|
|
178
|
+
for (let at = 0; at < partition.segments.length; at++) {
|
|
179
|
+
const contents = await readSegment(checkpoint, partition.segments[at]);
|
|
180
|
+
const table = contents.arrays.documentTable;
|
|
181
|
+
for (let ordinal = 0; ordinal < contents.arrays.documentCount; ordinal++) {
|
|
182
|
+
const docId = idAt(contents, ordinal);
|
|
183
|
+
if (winners.get(docId) !== at) continue;
|
|
184
|
+
const stored = decodeStoredDocument(
|
|
185
|
+
table.blob.subarray(table.offsets[ordinal], table.offsets[ordinal + 1]),
|
|
186
|
+
table.discardedFields
|
|
187
|
+
);
|
|
188
|
+
const document = { id: docId, ...stored };
|
|
189
|
+
document.id = docId;
|
|
190
|
+
for (const [fieldPath, located] of vectors) {
|
|
191
|
+
const location = located.get(docId);
|
|
192
|
+
if (location !== void 0) setNestedValue(document, fieldPath, await readVector(checkpoint, location));
|
|
193
|
+
}
|
|
194
|
+
yield `${encodeDocumentJson(document, docId)}
|
|
195
|
+
`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async function* exportLines(header, checkpoint) {
|
|
201
|
+
yield `${encodeExactJson({ format: DOCUMENT_EXPORT_FORMAT, version: DOCUMENT_EXPORT_VERSION, index: header }, "")}
|
|
202
|
+
`;
|
|
203
|
+
yield* documentLines(checkpoint);
|
|
204
|
+
}
|
|
205
|
+
function documentExportStream(header, checkpoint) {
|
|
206
|
+
const lines = exportLines(header, checkpoint);
|
|
207
|
+
const encoder = new TextEncoder();
|
|
208
|
+
let released = false;
|
|
209
|
+
const release = () => {
|
|
210
|
+
if (released) return;
|
|
211
|
+
released = true;
|
|
212
|
+
checkpoint.release();
|
|
213
|
+
};
|
|
214
|
+
return new ReadableStream({
|
|
215
|
+
async pull(controller) {
|
|
216
|
+
try {
|
|
217
|
+
let text = "";
|
|
218
|
+
while (text.length < EXPORT_CHUNK_BYTES) {
|
|
219
|
+
const step = await lines.next();
|
|
220
|
+
if (step.done) {
|
|
221
|
+
if (text.length > 0) controller.enqueue(encoder.encode(text));
|
|
222
|
+
release();
|
|
223
|
+
controller.close();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
text += step.value;
|
|
227
|
+
}
|
|
228
|
+
controller.enqueue(encoder.encode(text));
|
|
229
|
+
} catch (error) {
|
|
230
|
+
release();
|
|
231
|
+
controller.error(error);
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
async cancel() {
|
|
235
|
+
release();
|
|
236
|
+
await lines.return(void 0);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export { documentExportStream };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delali/narsil",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1-next.101",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Distributed search engine with full-text, vector, hybrid, and geosearch. One engine, embedded or on a server, with a cross-language .nrsl format.",
|
|
6
6
|
"author": "Delali (https://sondelali.com)",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"browser": "./src/persistence/durability/node-fs.browser.ts",
|
|
28
28
|
"default": "./src/persistence/durability/node-fs.ts"
|
|
29
29
|
},
|
|
30
|
+
"#platform/lock-holder": {
|
|
31
|
+
"browser": "./src/persistence/durability/lock-holder.browser.ts",
|
|
32
|
+
"default": "./src/persistence/durability/lock-holder.ts"
|
|
33
|
+
},
|
|
30
34
|
"#platform/node-worker": {
|
|
31
35
|
"browser": "./src/workers/node-worker.browser.ts",
|
|
32
36
|
"default": "./src/workers/node-worker.ts"
|
|
@@ -35,6 +39,10 @@
|
|
|
35
39
|
"browser": "./src/runtime/heap-statistics.browser.ts",
|
|
36
40
|
"default": "./src/runtime/heap-statistics.ts"
|
|
37
41
|
},
|
|
42
|
+
"#platform/process-limit": {
|
|
43
|
+
"browser": "./src/runtime/process-limit.browser.ts",
|
|
44
|
+
"default": "./src/runtime/process-limit.ts"
|
|
45
|
+
},
|
|
38
46
|
"#platform/idle-heap-cleanup": {
|
|
39
47
|
"browser": "./src/runtime/idle-heap-cleanup.browser.ts",
|
|
40
48
|
"default": "./src/runtime/idle-heap-cleanup.ts"
|
|
@@ -47,9 +55,25 @@
|
|
|
47
55
|
"browser": "./src/vector/native/loader.browser.ts",
|
|
48
56
|
"default": "./src/vector/native/loader.ts"
|
|
49
57
|
},
|
|
58
|
+
"#platform/search-backend-settings": {
|
|
59
|
+
"browser": "./src/engine/search-backend-settings.browser.ts",
|
|
60
|
+
"default": "./src/engine/search-backend-settings.ts"
|
|
61
|
+
},
|
|
50
62
|
"#platform/native-crc32": {
|
|
51
63
|
"browser": "./src/serialization/native-crc32.browser.ts",
|
|
52
64
|
"default": "./src/serialization/native-crc32.ts"
|
|
65
|
+
},
|
|
66
|
+
"#platform/pattern-search": {
|
|
67
|
+
"browser": "./src/core/pattern-index/platform.browser.ts",
|
|
68
|
+
"default": "./src/core/pattern-index/platform.ts"
|
|
69
|
+
},
|
|
70
|
+
"#platform/partial-word-search": {
|
|
71
|
+
"browser": "./src/core/partition/partial-words/platform.browser.ts",
|
|
72
|
+
"default": "./src/core/partition/partial-words/platform.ts"
|
|
73
|
+
},
|
|
74
|
+
"#platform/synonym-search": {
|
|
75
|
+
"browser": "./src/core/synonyms/platform.browser.ts",
|
|
76
|
+
"default": "./src/core/synonyms/platform.ts"
|
|
53
77
|
}
|
|
54
78
|
},
|
|
55
79
|
"sideEffects": false,
|
|
@@ -67,8 +91,11 @@
|
|
|
67
91
|
},
|
|
68
92
|
"scripts": {
|
|
69
93
|
"build": "rm -rf dist && tsup && node scripts/check-browser-bundle.mjs && tsx scripts/api-surface.ts",
|
|
70
|
-
"test": "vitest run --exclude='**/vector/recall.test.ts'",
|
|
94
|
+
"test": "vitest run --exclude='**/vector/recall.test.ts' --exclude='**/e2e/cluster-memory/**' --exclude='**/e2e/cluster-faults/**' --exclude='**/frozen-removal-memory/container-removes.test.ts'",
|
|
95
|
+
"test:cluster": "vitest run src/__tests__/e2e/cluster-memory --no-file-parallelism",
|
|
96
|
+
"test:faults": "vitest run src/__tests__/e2e/cluster-faults --no-file-parallelism",
|
|
71
97
|
"test:etcd": "vitest run src/__tests__/distribution/coordinator/etcd-integration/*.test.ts",
|
|
98
|
+
"test:container-memory": "vitest run src/__tests__/e2e/frozen-removal-memory/container-removes.test.ts",
|
|
72
99
|
"test:watch": "vitest",
|
|
73
100
|
"test:coverage": "vitest run --coverage",
|
|
74
101
|
"test:recall": "vitest run src/__tests__/vector/recall.test.ts",
|
|
@@ -80,6 +107,7 @@
|
|
|
80
107
|
"revisions:record": "tsx scripts/analysis-revisions.ts --record",
|
|
81
108
|
"api": "tsx scripts/api-surface.ts",
|
|
82
109
|
"api:write": "tsx scripts/api-surface.ts --write",
|
|
110
|
+
"bundle-size:write": "rm -rf dist && tsup && node scripts/check-browser-bundle.mjs --update-baseline",
|
|
83
111
|
"lookalikes": "tsx scripts/lookalike-counts.ts",
|
|
84
112
|
"lookalikes:collect": "tsx scripts/lookalike-counts.ts --collect",
|
|
85
113
|
"fold-table": "tsx scripts/fold-table.ts",
|
|
@@ -131,6 +159,22 @@
|
|
|
131
159
|
"import": "./dist/embeddings/openai.mjs",
|
|
132
160
|
"types": "./dist/embeddings/openai.d.ts"
|
|
133
161
|
},
|
|
162
|
+
"./rerankers/http": {
|
|
163
|
+
"import": "./dist/rerankers/http.mjs",
|
|
164
|
+
"types": "./dist/rerankers/http.d.ts"
|
|
165
|
+
},
|
|
166
|
+
"./pattern": {
|
|
167
|
+
"import": "./dist/pattern.mjs",
|
|
168
|
+
"types": "./dist/pattern.d.ts"
|
|
169
|
+
},
|
|
170
|
+
"./partial-words": {
|
|
171
|
+
"import": "./dist/partial-words.mjs",
|
|
172
|
+
"types": "./dist/partial-words.d.ts"
|
|
173
|
+
},
|
|
174
|
+
"./synonyms": {
|
|
175
|
+
"import": "./dist/synonyms.mjs",
|
|
176
|
+
"types": "./dist/synonyms.d.ts"
|
|
177
|
+
},
|
|
134
178
|
"./languages/*": {
|
|
135
179
|
"import": "./dist/languages/*.mjs",
|
|
136
180
|
"types": "./dist/languages/*.d.ts"
|
|
@@ -189,16 +233,18 @@
|
|
|
189
233
|
"@types/react": "19.2.14",
|
|
190
234
|
"@types/react-dom": "19.2.3",
|
|
191
235
|
"@vitest/coverage-v8": "4.0.18",
|
|
236
|
+
"esbuild": "0.28.2",
|
|
192
237
|
"etcd3": "1.1.2",
|
|
193
238
|
"fflate": "0.8.3",
|
|
194
239
|
"jsdom": "28.1.0",
|
|
240
|
+
"re2-wasm": "1.0.2",
|
|
195
241
|
"react": "19.2.4",
|
|
196
242
|
"react-dom": "19.2.4",
|
|
197
243
|
"selfsigned": "5.5.0",
|
|
198
244
|
"tsup": "8.5.1",
|
|
199
245
|
"tsx": "4.21.0",
|
|
200
246
|
"typescript": "5.9.3",
|
|
201
|
-
"uWebSockets.js": "github:uNetworking/uWebSockets.js#
|
|
247
|
+
"uWebSockets.js": "github:uNetworking/uWebSockets.js#ba110e817908b56c61d625b02f367b4ec9cfc8ab",
|
|
202
248
|
"vitest": "4.0.18",
|
|
203
249
|
"wabt": "1.0.39"
|
|
204
250
|
},
|
|
@@ -223,11 +269,11 @@
|
|
|
223
269
|
}
|
|
224
270
|
},
|
|
225
271
|
"optionalDependencies": {
|
|
226
|
-
"@delali/narsil-native-darwin-arm64": "0.
|
|
227
|
-
"@delali/narsil-native-darwin-x64": "0.
|
|
228
|
-
"@delali/narsil-native-linux-arm64": "0.
|
|
229
|
-
"@delali/narsil-native-linux-x64": "0.
|
|
230
|
-
"@delali/narsil-native-win32-arm64": "0.
|
|
231
|
-
"@delali/narsil-native-win32-x64": "0.
|
|
272
|
+
"@delali/narsil-native-darwin-arm64": "0.3.1-next.101",
|
|
273
|
+
"@delali/narsil-native-darwin-x64": "0.3.1-next.101",
|
|
274
|
+
"@delali/narsil-native-linux-arm64": "0.3.1-next.101",
|
|
275
|
+
"@delali/narsil-native-linux-x64": "0.3.1-next.101",
|
|
276
|
+
"@delali/narsil-native-win32-arm64": "0.3.1-next.101",
|
|
277
|
+
"@delali/narsil-native-win32-x64": "0.3.1-next.101"
|
|
232
278
|
}
|
|
233
279
|
}
|
package/dist/chunk-3L4U6EJQ.mjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { NATIVE_CRC32_MIN_BYTES } from './chunk-IFBKLBGB.mjs';
|
|
2
|
-
import * as zlib from 'zlib';
|
|
3
|
-
|
|
4
|
-
var candidate = zlib.crc32;
|
|
5
|
-
var nativeCrc32 = typeof candidate === "function" ? candidate : null;
|
|
6
|
-
|
|
7
|
-
// src/serialization/crc32.ts
|
|
8
|
-
var IEEE_POLYNOMIAL = 3988292384;
|
|
9
|
-
var ALL_BITS = 4294967295;
|
|
10
|
-
var cachedTable = null;
|
|
11
|
-
function buildTable() {
|
|
12
|
-
const table = new Uint32Array(256);
|
|
13
|
-
for (let i = 0; i < 256; i++) {
|
|
14
|
-
let crc = i;
|
|
15
|
-
for (let bit = 0; bit < 8; bit++) {
|
|
16
|
-
crc = crc & 1 ? crc >>> 1 ^ IEEE_POLYNOMIAL : crc >>> 1;
|
|
17
|
-
}
|
|
18
|
-
table[i] = crc;
|
|
19
|
-
}
|
|
20
|
-
return table;
|
|
21
|
-
}
|
|
22
|
-
function getTable() {
|
|
23
|
-
if (cachedTable === null) {
|
|
24
|
-
cachedTable = buildTable();
|
|
25
|
-
}
|
|
26
|
-
return cachedTable;
|
|
27
|
-
}
|
|
28
|
-
function crc322(data) {
|
|
29
|
-
return crc32Final(crc32Update(crc32Init(), data));
|
|
30
|
-
}
|
|
31
|
-
function crc32Init() {
|
|
32
|
-
return ALL_BITS;
|
|
33
|
-
}
|
|
34
|
-
function crc32Update(state, data) {
|
|
35
|
-
if (nativeCrc32 !== null && data.length >= NATIVE_CRC32_MIN_BYTES) {
|
|
36
|
-
return nativeCrc32(data, (state ^ ALL_BITS) >>> 0) ^ ALL_BITS;
|
|
37
|
-
}
|
|
38
|
-
const table = getTable();
|
|
39
|
-
let crc = state;
|
|
40
|
-
for (let i = 0; i < data.length; i++) {
|
|
41
|
-
crc = crc >>> 8 ^ table[(crc ^ data[i]) & 255];
|
|
42
|
-
}
|
|
43
|
-
return crc;
|
|
44
|
-
}
|
|
45
|
-
function crc32Final(state) {
|
|
46
|
-
return (state ^ ALL_BITS) >>> 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { crc322 as crc32, crc32Final, crc32Init, crc32Update, nativeCrc32 };
|
package/dist/chunk-IFBKLBGB.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// src/serialization/constants.ts
|
|
2
|
-
var CHECKSUM_TIMEOUT_MS = 12e4;
|
|
3
|
-
var CHECKSUM_YIELD_CHUNK_BYTES = 4 * 1024 * 1024;
|
|
4
|
-
var NATIVE_CRC32_MIN_BYTES = 16;
|
|
5
|
-
var VALID_HNSW_METRICS = /* @__PURE__ */ new Set(["cosine", "dotProduct", "euclidean"]);
|
|
6
|
-
|
|
7
|
-
export { CHECKSUM_TIMEOUT_MS, CHECKSUM_YIELD_CHUNK_BYTES, NATIVE_CRC32_MIN_BYTES, VALID_HNSW_METRICS };
|