@delali/narsil 0.3.1-next.131 → 0.3.1-next.141
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/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/analysis-change-HQUT2Z3I.mjs +43 -0
- package/dist/analysis-change-entry-TZTG4AZB.mjs +1 -0
- package/dist/browser/analysis-change-JPV775LR.mjs +900 -0
- package/dist/browser/analysis-change-entry-7HR4LWL3.mjs +1 -0
- package/dist/browser/{chunk-UDGB2MWT.mjs → chunk-35B42UFM.mjs} +4 -0
- package/dist/browser/chunk-3ZBJYAS4.mjs +19 -0
- package/dist/browser/{chunk-2Y3CO4EQ.mjs → chunk-5DB2VDGI.mjs} +1149 -1853
- package/dist/browser/chunk-6RHTAVZX.mjs +656 -0
- package/dist/browser/chunk-CCOAOO73.mjs +86 -0
- package/dist/browser/{chunk-AIIJDWMG.mjs → chunk-D33A5VMU.mjs} +16 -16
- package/dist/browser/{chunk-VBBLTD7O.mjs → chunk-HKX2G6WH.mjs} +1520 -2159
- package/dist/browser/{chunk-NSCSR6MA.mjs → chunk-KTOK275N.mjs} +606 -830
- package/dist/browser/{chunk-D7WQF6DV.mjs → chunk-LVY2LI35.mjs} +2 -2
- package/dist/browser/chunk-MVM33ZUL.mjs +993 -0
- package/dist/browser/chunk-MWUK3DA5.mjs +2634 -0
- package/dist/browser/{chunk-VEGHFP2P.mjs → chunk-MZI3TEOW.mjs} +4 -2
- package/dist/browser/chunk-OIZS5KIX.mjs +6 -0
- package/dist/browser/chunk-R4WUDZQV.mjs +176 -0
- package/dist/browser/{chunk-M5UAAXGU.mjs → chunk-TCLEOZ4P.mjs} +3 -3
- package/dist/browser/chunk-VFYMPCOV.mjs +212 -0
- package/dist/browser/chunk-WCFCHIBB.mjs +177 -0
- package/dist/browser/chunk-XNWPP5NS.mjs +21 -0
- package/dist/browser/chunk-ZEV26AQ6.mjs +270 -0
- package/dist/browser/cold-module-MJMKNUYJ.mjs +745 -0
- package/dist/browser/{durability-wiring-FNZSRH4N.mjs → durability-wiring-SNOWIT6Z.mjs} +370 -95
- package/dist/browser/import-TLB2A5LJ.mjs +9 -0
- package/dist/browser/module-BUFNZMEU.mjs +12 -0
- package/dist/browser/{module-4HIMOQM5.mjs → module-BVP4TKZU.mjs} +397 -109
- package/dist/browser/{phrase-module-WESYVU7K.mjs → phrase-module-HGVBO24W.mjs} +1 -1
- package/dist/{restore-queue-JAMNRC6T.mjs → browser/restore-queue-ONYNYUDE.mjs} +8 -2
- package/dist/browser/{runtime-3X7ZJ5T3.mjs → runtime-VEUH674B.mjs} +2 -2
- package/dist/browser/{snapshot-V7VF6BN6.mjs → snapshot-QXBKHJAG.mjs} +135 -183
- package/dist/browser/{write-YIC2MKRY.mjs → write-WHFBDWQS.mjs} +64 -90
- package/dist/{capabilities-B6WxrWxt.d.ts → capabilities-BCdUwK_L.d.ts} +10 -3
- package/dist/chunk-46NZOPHS.mjs +21 -0
- package/dist/{chunk-JT3YZGCE.mjs → chunk-5WYVUPGD.mjs} +3 -188
- package/dist/chunk-6SNBQESJ.mjs +214 -0
- package/dist/{chunk-2C3WXBQS.mjs → chunk-74XB2SXI.mjs} +1 -1
- package/dist/chunk-7AUASRE7.mjs +653 -0
- package/dist/{chunk-NMXRXFGZ.mjs → chunk-AST3SHFA.mjs} +27 -25
- package/dist/chunk-BOJZGUS6.mjs +177 -0
- package/dist/{chunk-T4OFG4IQ.mjs → chunk-BRUUBXCB.mjs} +92 -17
- package/dist/{chunk-5LX6MOIB.mjs → chunk-C3YDYX6C.mjs} +1 -1
- package/dist/chunk-CZQ33DLW.mjs +78 -0
- package/dist/{chunk-4GDLFDPZ.mjs → chunk-DD2673TX.mjs} +3 -2
- package/dist/{chunk-EUCX5K74.mjs → chunk-DQNKVOJ2.mjs} +65 -65
- package/dist/{chunk-RNSC4NFI.mjs → chunk-EEBCDP36.mjs} +3 -1
- package/dist/chunk-FOCV4CBZ.mjs +87 -0
- package/dist/{chunk-HCGJKDZV.mjs → chunk-GLZHNSGB.mjs} +1 -1
- package/dist/chunk-GWOS5DYC.mjs +2637 -0
- package/dist/{chunk-PATMDIMN.mjs → chunk-HJJWY6PT.mjs} +1 -1
- package/dist/{chunk-CZ7ISLXA.mjs → chunk-HNHCNTVG.mjs} +4 -0
- package/dist/{chunk-Y2U5VVWX.mjs → chunk-ICW45TTU.mjs} +1 -1
- package/dist/{chunk-TGHNXN7W.mjs → chunk-IO5F7ZBE.mjs} +261 -948
- package/dist/{chunk-P36MUFEJ.mjs → chunk-JDDXV6UF.mjs} +2 -1
- package/dist/{chunk-7OIQ2SIO.mjs → chunk-KEIYVZUX.mjs} +5 -5
- package/dist/{chunk-PU6SKH7O.mjs → chunk-KGOXHLLZ.mjs} +7 -3
- package/dist/{chunk-WVRDRLIC.mjs → chunk-KZL72VTC.mjs} +70 -18
- package/dist/chunk-L76W3IZJ.mjs +193 -0
- package/dist/{chunk-2JWNJSNE.mjs → chunk-LA4WNDHL.mjs} +88 -801
- package/dist/{chunk-ZR4VM4A6.mjs → chunk-N37VMC62.mjs} +1 -18
- package/dist/{chunk-JJ6EUMXB.mjs → chunk-NJJCPFXN.mjs} +2 -2
- package/dist/chunk-NN33CZRE.mjs +86 -0
- package/dist/{chunk-2WBY4Y4M.mjs → chunk-NOT5QOHU.mjs} +1 -1
- package/dist/{chunk-D5TFRB5G.mjs → chunk-NPNK57CA.mjs} +1 -1
- package/dist/chunk-NRUXBYPH.mjs +121 -0
- package/dist/{chunk-6SSVIW7Y.mjs → chunk-O4LJQI4G.mjs} +31 -5
- package/dist/{chunk-UJWGQIXU.mjs → chunk-QHPYS427.mjs} +1 -0
- package/dist/{chunk-F6AAXI7T.mjs → chunk-RHKRTYGO.mjs} +13 -4
- package/dist/{chunk-2SEL6SBS.mjs → chunk-RKAVHNRW.mjs} +2 -2
- package/dist/{chunk-RCMNL7RI.mjs → chunk-SBMAWTRG.mjs} +41 -4
- package/dist/chunk-SRJBFG2T.mjs +881 -0
- package/dist/{chunk-X5CNUKD5.mjs → chunk-TNBIK2LQ.mjs} +1663 -1652
- package/dist/{chunk-NNO7CO3A.mjs → chunk-UIKN2OTQ.mjs} +1 -1
- package/dist/chunk-UUZCQQG2.mjs +209 -0
- package/dist/{chunk-6M6SDH3S.mjs → chunk-VEFN6X6Q.mjs} +8 -8
- package/dist/chunk-VJEGOELZ.mjs +177 -0
- package/dist/chunk-W2COJ5AH.mjs +148 -0
- package/dist/{chunk-RWESFSJI.mjs → chunk-WJGO5PGV.mjs} +317 -174
- package/dist/{chunk-7X5JST5L.mjs → chunk-WNBRW4Q2.mjs} +16 -2
- package/dist/{chunk-SZGRYEIC.mjs → chunk-XS2VM7UE.mjs} +3 -3
- package/dist/{chunk-Y4BVTQ53.mjs → chunk-XZ3SRNDJ.mjs} +25 -64
- package/dist/{chunk-K77FJXKS.mjs → chunk-YHUTF6EA.mjs} +474 -93
- package/dist/{chunk-OGLV4I3L.mjs → chunk-YLNSJQLX.mjs} +12 -7
- package/dist/{chunk-SOHMMNCH.mjs → chunk-Z4HFMYNX.mjs} +32 -27
- package/dist/{chunk-5W7AEVTH.mjs → chunk-ZMBFWQXN.mjs} +2 -2
- package/dist/{chunk-2MKX2SCO.mjs → chunk-ZPWS2SKJ.mjs} +297 -274
- package/dist/{chunk-7XY6VD7B.mjs → chunk-ZSWHPKGM.mjs} +1 -1
- package/dist/{client-gNAfaHcE.d.ts → client-B12YFALP.d.ts} +18 -3
- package/dist/client.d.ts +7 -7
- package/dist/client.mjs +11 -1
- package/dist/cold-module-4X7WJCFM.mjs +783 -0
- package/dist/{config-D1cDv3sE.d.ts → config-BhZxIeb1.d.ts} +10 -1
- package/dist/{config-CmYJO34X.d.ts → config-CIG5yDyg.d.ts} +2 -2
- package/dist/{direct-executor-HQ4QVDX7.mjs → direct-executor-7XOQ7VQP.mjs} +14 -14
- 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 +24 -8
- package/dist/distribution.mjs +982 -211
- package/dist/{durability-wiring-S7OX2MAI.mjs → durability-wiring-324D2DDD.mjs} +362 -94
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-m_Ddr1bz.d.ts → engine-CtzbHOmG.d.ts} +64 -7
- package/dist/import-OOBUW3RR.mjs +44 -0
- package/dist/{index-HYnqS1SE.d.ts → index-DsEurhSl.d.ts} +1 -1
- package/dist/index.browser.mjs +5 -5
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +22 -22
- package/dist/{long-query-thread-BSL25PD6.mjs → long-query-thread-4SW7RWDE.mjs} +15 -15
- package/dist/{module-2E4XYSGT.mjs → module-DXSJ5LT2.mjs} +378 -87
- package/dist/module-IYPLWHGC.mjs +48 -0
- package/dist/paged-partition-archive-HFP45PLU.mjs +269 -0
- package/dist/partial-words.mjs +5 -5
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +16 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +28 -26
- package/dist/{phrase-module-JERF2IDG.mjs → phrase-module-5QHBD2VJ.mjs} +1 -1
- package/dist/react.d.ts +9 -9
- package/dist/react.mjs +4 -0
- package/dist/{rerank-DMMT4FZA.mjs → rerank-KTLC3E6N.mjs} +5 -5
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{browser/restore-queue-GEZ54CA5.mjs → restore-queue-FEYAC4SB.mjs} +8 -2
- package/dist/{runtime-7MLQ7J64.mjs → runtime-DYV75DCB.mjs} +6 -6
- package/dist/{schema-BTXbHCqA.d.ts → schema-B-Runv0n.d.ts} +7 -0
- package/dist/server.d.ts +12 -10
- package/dist/server.mjs +54 -21
- package/dist/{snapshot-DOQLGGEX.mjs → snapshot-CGM65VCD.mjs} +101 -197
- package/dist/synonyms.mjs +6 -4
- package/dist/{tasks-Co8HfRD7.d.ts → tasks-CjRJRGTb.d.ts} +26 -8
- package/dist/{thread-SKO7CN3R.mjs → thread-KGNAIKPD.mjs} +14 -14
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +6 -5
- package/dist/workers/entry.mjs +8 -8
- package/dist/{write-ZKR7SNRT.mjs → write-2DZPEQL2.mjs} +82 -107
- package/openapi.json +114 -6
- package/package.json +12 -8
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND } from './chunk-WCFCHIBB.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-35B42UFM.mjs';
|
|
3
|
+
|
|
4
|
+
// src/engine/export/json-line.ts
|
|
5
|
+
function refuse(path, kind, docId) {
|
|
6
|
+
throw new NarsilError(
|
|
7
|
+
ErrorCodes.DOC_VALIDATION_FAILED,
|
|
8
|
+
`Document "${docId}" holds ${kind} at "${path || "(document)"}", which a document export cannot carry as JSON`,
|
|
9
|
+
{ docId, field: path }
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
function encodeNumber(value, path, target) {
|
|
13
|
+
if (Number.isFinite(value)) return Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
14
|
+
if (!target.tagged) refuse(path, String(value), target.docId);
|
|
15
|
+
return `{"${NUMBER_TAG}":"${String(value)}"}`;
|
|
16
|
+
}
|
|
17
|
+
function encodeDate(value, path, target) {
|
|
18
|
+
const milliseconds = value.getTime();
|
|
19
|
+
if (!target.tagged || Number.isNaN(milliseconds)) refuse(path, "a date", target.docId);
|
|
20
|
+
const seconds = Math.floor(milliseconds / MILLISECONDS_PER_SECOND);
|
|
21
|
+
const nanoseconds = (milliseconds - seconds * MILLISECONDS_PER_SECOND) * NANOSECONDS_PER_MILLISECOND;
|
|
22
|
+
return `{"${DATE_TAG}":[${seconds},${nanoseconds}]}`;
|
|
23
|
+
}
|
|
24
|
+
function encodeBytes(value, path, target) {
|
|
25
|
+
if (!target.tagged) refuse(path, "bytes", target.docId);
|
|
26
|
+
return `{"${BYTES_TAG}":"${encodeBase64(value)}"}`;
|
|
27
|
+
}
|
|
28
|
+
function encodeList(value, path, target) {
|
|
29
|
+
target.parts.push("[");
|
|
30
|
+
for (let at = 0; at < value.length; at++) {
|
|
31
|
+
if (at > 0) target.parts.push(",");
|
|
32
|
+
encodeValue(value[at], `${path}[${at}]`, target);
|
|
33
|
+
}
|
|
34
|
+
target.parts.push("]");
|
|
35
|
+
}
|
|
36
|
+
function encodeMap(value, path, target) {
|
|
37
|
+
const proto = Object.getPrototypeOf(value);
|
|
38
|
+
if (proto !== Object.prototype && proto !== null) refuse(path, "a value other than a plain object", target.docId);
|
|
39
|
+
const entries = Object.entries(value).filter(([, entry]) => entry !== void 0);
|
|
40
|
+
const wrapped = target.tagged && entries.length === 1 && startsWithTagPrefix(entries[0][0]);
|
|
41
|
+
target.parts.push(wrapped ? `{"${OBJECT_TAG}":{` : "{");
|
|
42
|
+
for (let at = 0; at < entries.length; at++) {
|
|
43
|
+
const [key, entry] = entries[at];
|
|
44
|
+
if (at > 0) target.parts.push(",");
|
|
45
|
+
target.parts.push(JSON.stringify(key), ":");
|
|
46
|
+
encodeValue(entry, path === "" ? key : `${path}.${key}`, target);
|
|
47
|
+
}
|
|
48
|
+
target.parts.push(wrapped ? "}}" : "}");
|
|
49
|
+
}
|
|
50
|
+
function encodeValue(value, path, target) {
|
|
51
|
+
if (value === null) {
|
|
52
|
+
target.parts.push("null");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
switch (typeof value) {
|
|
56
|
+
case "string":
|
|
57
|
+
target.parts.push(JSON.stringify(value));
|
|
58
|
+
return;
|
|
59
|
+
case "boolean":
|
|
60
|
+
target.parts.push(value ? "true" : "false");
|
|
61
|
+
return;
|
|
62
|
+
case "number":
|
|
63
|
+
target.parts.push(encodeNumber(value, path, target));
|
|
64
|
+
return;
|
|
65
|
+
case "object":
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
refuse(path, `a ${typeof value}`, target.docId);
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(value)) encodeList(value, path, target);
|
|
71
|
+
else if (value instanceof Date) target.parts.push(encodeDate(value, path, target));
|
|
72
|
+
else if (value instanceof Uint8Array) target.parts.push(encodeBytes(value, path, target));
|
|
73
|
+
else encodeMap(value, path, target);
|
|
74
|
+
}
|
|
75
|
+
function encodeExactJson(value, docId) {
|
|
76
|
+
const target = { docId, tagged: false, parts: [] };
|
|
77
|
+
encodeValue(value, "", target);
|
|
78
|
+
return target.parts.join("");
|
|
79
|
+
}
|
|
80
|
+
function encodeDocumentJson(document, docId) {
|
|
81
|
+
const target = { docId, tagged: true, parts: [] };
|
|
82
|
+
encodeValue(document, "", target);
|
|
83
|
+
return target.parts.join("");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { encodeDocumentJson, encodeExactJson };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
1
|
+
import { NarsilError, ErrorCodes } from './chunk-35B42UFM.mjs';
|
|
2
2
|
|
|
3
3
|
// src/serialization/constants.ts
|
|
4
4
|
var CHECKSUM_YIELD_CHUNK_BYTES = 4 * 1024 * 1024;
|
|
@@ -351,21 +351,6 @@ var COMPACTION_ABSOLUTE_THRESHOLD = 1e3;
|
|
|
351
351
|
var DEFAULT_EF_SEARCH = 50;
|
|
352
352
|
var NEAREST_LINK_FALLBACK_HOSTS = 4;
|
|
353
353
|
|
|
354
|
-
// src/workers/thread-slot.ts
|
|
355
|
-
var goneThreadSlots = /* @__PURE__ */ new Set();
|
|
356
|
-
function threadSlotOfWorker(workerId) {
|
|
357
|
-
return workerId + 1;
|
|
358
|
-
}
|
|
359
|
-
function noteThreadSlotLive(threadSlot) {
|
|
360
|
-
goneThreadSlots.delete(threadSlot);
|
|
361
|
-
}
|
|
362
|
-
function noteThreadSlotGone(threadSlot) {
|
|
363
|
-
goneThreadSlots.add(threadSlot);
|
|
364
|
-
}
|
|
365
|
-
function threadSlotGone(threadSlot) {
|
|
366
|
-
return goneThreadSlots.has(threadSlot);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
354
|
// src/vector/constants.ts
|
|
370
355
|
var WASM_PAGE_BYTES = 65536;
|
|
371
356
|
var MAX_WASM_PAGES = 65536;
|
|
@@ -399,6 +384,21 @@ var OSQ_REFINE_ROUNDS = 5;
|
|
|
399
384
|
var OSQ_REFINE_TOLERANCE = 1e-8;
|
|
400
385
|
var MIN_OVERSAMPLE = 1;
|
|
401
386
|
|
|
387
|
+
// src/workers/thread-slot.ts
|
|
388
|
+
var goneThreadSlots = /* @__PURE__ */ new Set();
|
|
389
|
+
function threadSlotOfWorker(workerId) {
|
|
390
|
+
return workerId + 1;
|
|
391
|
+
}
|
|
392
|
+
function noteThreadSlotLive(threadSlot) {
|
|
393
|
+
goneThreadSlots.delete(threadSlot);
|
|
394
|
+
}
|
|
395
|
+
function noteThreadSlotGone(threadSlot) {
|
|
396
|
+
goneThreadSlots.add(threadSlot);
|
|
397
|
+
}
|
|
398
|
+
function threadSlotGone(threadSlot) {
|
|
399
|
+
return goneThreadSlots.has(threadSlot);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
402
|
// src/workers/constants.ts
|
|
403
403
|
var WORKER_YOUNG_GENERATION_MB = 24;
|
|
404
404
|
var MIN_WORKER_COUNT = 2;
|