@delali/narsil 0.3.0 → 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
package/dist/chunk-U7KYW4BA.mjs
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR } from './chunk-UXNWQZST.mjs';
|
|
2
|
-
import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-3LHGNRYE.mjs';
|
|
3
|
-
import { NarsilError, ErrorCodes } from './chunk-USKFU7J5.mjs';
|
|
4
|
-
import { encode, decode } from '@msgpack/msgpack';
|
|
5
|
-
|
|
6
|
-
var INDEX_CONFIG_PREFIX = "_narsil/index/";
|
|
7
|
-
var INDEX_CONFIG_SUFFIX = "/config";
|
|
8
|
-
function truncateForDisplay(value) {
|
|
9
|
-
const str = String(value);
|
|
10
|
-
if (str.length > 100) {
|
|
11
|
-
return `${str.slice(0, 100)}...`;
|
|
12
|
-
}
|
|
13
|
-
return str;
|
|
14
|
-
}
|
|
15
|
-
function validateIndexName(indexName) {
|
|
16
|
-
if (indexName.length === 0 || indexName.length > MAX_INDEX_NAME_LENGTH) {
|
|
17
|
-
throw new NarsilError(
|
|
18
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
19
|
-
`Index name must be between 1 and ${MAX_INDEX_NAME_LENGTH} characters`,
|
|
20
|
-
{ indexName: truncateForDisplay(indexName) }
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
if (indexName.includes("\0") || indexName.includes("/") || indexName.includes("\\") || indexName.includes("..")) {
|
|
24
|
-
throw new NarsilError(
|
|
25
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
26
|
-
"Index name contains forbidden characters (/, \\, .., or null bytes)",
|
|
27
|
-
{ indexName: truncateForDisplay(indexName) }
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
if (!INDEX_NAME_PATTERN.test(indexName)) {
|
|
31
|
-
throw new NarsilError(
|
|
32
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
33
|
-
"Index name must start with an alphanumeric character and contain only alphanumeric characters, hyphens, underscores, or dots",
|
|
34
|
-
{ indexName: truncateForDisplay(indexName) }
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function isValidInteger(value) {
|
|
39
|
-
return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
|
|
40
|
-
}
|
|
41
|
-
function indexConfigKey(indexName) {
|
|
42
|
-
return `${INDEX_CONFIG_PREFIX}${indexName}${INDEX_CONFIG_SUFFIX}`;
|
|
43
|
-
}
|
|
44
|
-
function isRecord(value) {
|
|
45
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
46
|
-
}
|
|
47
|
-
function validateDecodedMetadata(decoded, indexName) {
|
|
48
|
-
if (!isRecord(decoded)) {
|
|
49
|
-
throw new NarsilError(
|
|
50
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
51
|
-
`Index metadata for '${indexName}' is not an object`,
|
|
52
|
-
{ indexName }
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
if (typeof decoded.indexUuid !== "string" || decoded.indexUuid.length === 0 || decoded.indexUuid.length > 128) {
|
|
56
|
-
throw new NarsilError(
|
|
57
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
58
|
-
`Index metadata for '${indexName}' has invalid indexUuid`,
|
|
59
|
-
{ indexName, received: truncateForDisplay(decoded.indexUuid) }
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
if (typeof decoded.indexName !== "string") {
|
|
63
|
-
throw new NarsilError(
|
|
64
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
65
|
-
`Index metadata for '${indexName}' has invalid indexName`,
|
|
66
|
-
{ indexName, received: truncateForDisplay(decoded.indexName) }
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
if (!isValidInteger(decoded.partitionCount) || decoded.partitionCount <= 0 || decoded.partitionCount > MAX_PARTITION_COUNT) {
|
|
70
|
-
throw new NarsilError(
|
|
71
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
72
|
-
`Index metadata for '${indexName}' has invalid partitionCount (must be an integer between 1 and ${MAX_PARTITION_COUNT})`,
|
|
73
|
-
{ indexName, partitionCount: truncateForDisplay(decoded.partitionCount) }
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
if (!isValidInteger(decoded.replicationFactor) || decoded.replicationFactor < 0 || decoded.replicationFactor > MAX_REPLICATION_FACTOR) {
|
|
77
|
-
throw new NarsilError(
|
|
78
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
79
|
-
`Index metadata for '${indexName}' has invalid replicationFactor (must be an integer between 0 and ${MAX_REPLICATION_FACTOR})`,
|
|
80
|
-
{ indexName, replicationFactor: truncateForDisplay(decoded.replicationFactor) }
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
if (!isRecord(decoded.constraints)) {
|
|
84
|
-
throw new NarsilError(
|
|
85
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
86
|
-
`Index metadata for '${indexName}' has invalid constraints`,
|
|
87
|
-
{ indexName }
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
const constraints = decoded.constraints;
|
|
91
|
-
if (constraints.maxShardsPerNode !== void 0 && constraints.maxShardsPerNode !== null && typeof constraints.maxShardsPerNode !== "number") {
|
|
92
|
-
throw new NarsilError(
|
|
93
|
-
ErrorCodes.CONTROLLER_METADATA_INVALID,
|
|
94
|
-
`Index metadata for '${indexName}' has invalid maxShardsPerNode (must be a number or null)`,
|
|
95
|
-
{ indexName, maxShardsPerNode: truncateForDisplay(constraints.maxShardsPerNode) }
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
indexUuid: decoded.indexUuid,
|
|
100
|
-
indexName: decoded.indexName,
|
|
101
|
-
partitionCount: decoded.partitionCount,
|
|
102
|
-
replicationFactor: decoded.replicationFactor,
|
|
103
|
-
constraints: {
|
|
104
|
-
zoneAwareness: constraints.zoneAwareness === true,
|
|
105
|
-
zoneAttribute: typeof constraints.zoneAttribute === "string" ? constraints.zoneAttribute : "zone",
|
|
106
|
-
maxShardsPerNode: typeof constraints.maxShardsPerNode === "number" ? constraints.maxShardsPerNode : null
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
async function putIndexMetadata(coordinator, metadata) {
|
|
111
|
-
validateIndexName(metadata.indexName);
|
|
112
|
-
const key = indexConfigKey(metadata.indexName);
|
|
113
|
-
const encoded = encode(metadata);
|
|
114
|
-
const bytes = new Uint8Array(encoded);
|
|
115
|
-
if (await coordinator.compareAndSet(key, null, bytes)) {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
const current = await coordinator.get(key);
|
|
119
|
-
if (current === null || current.byteLength > 0) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
return coordinator.compareAndSet(key, current, bytes);
|
|
123
|
-
}
|
|
124
|
-
async function getIndexMetadata(coordinator, indexName) {
|
|
125
|
-
validateIndexName(indexName);
|
|
126
|
-
const key = indexConfigKey(indexName);
|
|
127
|
-
const raw = await coordinator.get(key);
|
|
128
|
-
if (raw === null || raw.byteLength === 0) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
const decoded = decode(raw);
|
|
132
|
-
return validateDecodedMetadata(decoded, indexName);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export { getIndexMetadata, indexConfigKey, putIndexMetadata, validateIndexName };
|
package/dist/chunk-ZJ4CSAB2.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/vector/osq/constants.ts
|
|
2
|
-
var OSQ_GRID = { 1: 0.798, 2: 1.493, 4: 2.514, 8: 3.922 };
|
|
3
|
-
var OSQ_STEPS = { 1: 1, 2: 3, 4: 15, 8: 255 };
|
|
4
|
-
var OSQ_QUERY_BITS = { 1: 4, 2: 4, 4: 4, 8: 8 };
|
|
5
|
-
var OSQ_LAMBDA = 0.1;
|
|
6
|
-
var OSQ_REFINE_ROUNDS = 5;
|
|
7
|
-
var OSQ_REFINE_TOLERANCE = 1e-8;
|
|
8
|
-
var DEFAULT_OVERSAMPLE_BY_BITS = { 1: 3, 2: 3, 4: 2, 8: 2 };
|
|
9
|
-
var DEFAULT_OSQ4_NARROW_OVERSAMPLE = 5;
|
|
10
|
-
var OSQ4_NARROW_DIMENSION_LIMIT = 1024;
|
|
11
|
-
var MIN_OVERSAMPLE = 1;
|
|
12
|
-
|
|
13
|
-
export { DEFAULT_OSQ4_NARROW_OVERSAMPLE, DEFAULT_OVERSAMPLE_BY_BITS, MIN_OVERSAMPLE, OSQ4_NARROW_DIMENSION_LIMIT, OSQ_GRID, OSQ_LAMBDA, OSQ_QUERY_BITS, OSQ_REFINE_ROUNDS, OSQ_REFINE_TOLERANCE, OSQ_STEPS };
|