@anuma/sdk 10.5.1 → 10.5.2
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/expo/index.cjs +13 -16
- package/dist/expo/index.mjs +13 -16
- package/dist/react/index.cjs +13 -16
- package/dist/react/index.mjs +13 -16
- package/dist/server/index.cjs +13 -16
- package/dist/server/index.mjs +13 -16
- package/package.json +1 -1
package/dist/expo/index.cjs
CHANGED
|
@@ -21405,12 +21405,16 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
21405
21405
|
const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
21406
21406
|
const uncachedTexts = [];
|
|
21407
21407
|
const uncachedIndices = [];
|
|
21408
|
+
const resolvedVectors = /* @__PURE__ */ new Map();
|
|
21408
21409
|
let staleReembedCount = 0;
|
|
21409
21410
|
for (let i = 0; queryEmbedding.length > 0 && i < memories.length; i++) {
|
|
21410
21411
|
const content = memories[i].content;
|
|
21411
21412
|
const memoryId = memories[i].uniqueId;
|
|
21412
21413
|
const cached = cachedRowVector(cache, memoryId, memories[i].updatedAt, content);
|
|
21413
|
-
if (cached && cached.length === queryEmbedding.length)
|
|
21414
|
+
if (cached && cached.length === queryEmbedding.length) {
|
|
21415
|
+
resolvedVectors.set(memoryId, cached);
|
|
21416
|
+
continue;
|
|
21417
|
+
}
|
|
21414
21418
|
if (cached) cache.delete(memoryId);
|
|
21415
21419
|
const storedModel = memories[i].embeddingModel;
|
|
21416
21420
|
const modelCompatible = (storedModel ?? currentModel) === currentModel;
|
|
@@ -21418,13 +21422,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
21418
21422
|
try {
|
|
21419
21423
|
const parsed = JSON.parse(memories[i].embedding);
|
|
21420
21424
|
if (Array.isArray(parsed) && parsed.length === queryEmbedding.length) {
|
|
21421
|
-
|
|
21422
|
-
|
|
21423
|
-
|
|
21424
|
-
Float32Array.from(parsed),
|
|
21425
|
-
memories[i].updatedAt,
|
|
21426
|
-
content
|
|
21427
|
-
);
|
|
21425
|
+
const vector2 = Float32Array.from(parsed);
|
|
21426
|
+
resolvedVectors.set(memoryId, vector2);
|
|
21427
|
+
cacheRowVector(cache, memoryId, vector2, memories[i].updatedAt, content);
|
|
21428
21428
|
continue;
|
|
21429
21429
|
}
|
|
21430
21430
|
} catch {
|
|
@@ -21457,20 +21457,17 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
21457
21457
|
}
|
|
21458
21458
|
if (newEmbeddings) {
|
|
21459
21459
|
for (let j = 0; j < uncachedTexts.length; j++) {
|
|
21460
|
-
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
memories[uncachedIndices[j]].updatedAt,
|
|
21465
|
-
memories[uncachedIndices[j]].content
|
|
21466
|
-
);
|
|
21460
|
+
const memory = memories[uncachedIndices[j]];
|
|
21461
|
+
const vector2 = Float32Array.from(newEmbeddings[j]);
|
|
21462
|
+
resolvedVectors.set(memory.uniqueId, vector2);
|
|
21463
|
+
cacheRowVector(cache, memory.uniqueId, vector2, memory.updatedAt, memory.content);
|
|
21467
21464
|
}
|
|
21468
21465
|
}
|
|
21469
21466
|
}
|
|
21470
21467
|
embeddedItems = memories.map((m) => ({
|
|
21471
21468
|
id: m.uniqueId,
|
|
21472
21469
|
content: m.content,
|
|
21473
|
-
embedding:
|
|
21470
|
+
embedding: resolvedVectors.get(m.uniqueId) ?? [],
|
|
21474
21471
|
createdAt: m.createdAt,
|
|
21475
21472
|
updatedAt: m.updatedAt,
|
|
21476
21473
|
proofCount: m.proofCount,
|
package/dist/expo/index.mjs
CHANGED
|
@@ -19712,12 +19712,16 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
19712
19712
|
const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
19713
19713
|
const uncachedTexts = [];
|
|
19714
19714
|
const uncachedIndices = [];
|
|
19715
|
+
const resolvedVectors = /* @__PURE__ */ new Map();
|
|
19715
19716
|
let staleReembedCount = 0;
|
|
19716
19717
|
for (let i = 0; queryEmbedding.length > 0 && i < memories.length; i++) {
|
|
19717
19718
|
const content = memories[i].content;
|
|
19718
19719
|
const memoryId = memories[i].uniqueId;
|
|
19719
19720
|
const cached = cachedRowVector(cache, memoryId, memories[i].updatedAt, content);
|
|
19720
|
-
if (cached && cached.length === queryEmbedding.length)
|
|
19721
|
+
if (cached && cached.length === queryEmbedding.length) {
|
|
19722
|
+
resolvedVectors.set(memoryId, cached);
|
|
19723
|
+
continue;
|
|
19724
|
+
}
|
|
19721
19725
|
if (cached) cache.delete(memoryId);
|
|
19722
19726
|
const storedModel = memories[i].embeddingModel;
|
|
19723
19727
|
const modelCompatible = (storedModel ?? currentModel) === currentModel;
|
|
@@ -19725,13 +19729,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
19725
19729
|
try {
|
|
19726
19730
|
const parsed = JSON.parse(memories[i].embedding);
|
|
19727
19731
|
if (Array.isArray(parsed) && parsed.length === queryEmbedding.length) {
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
Float32Array.from(parsed),
|
|
19732
|
-
memories[i].updatedAt,
|
|
19733
|
-
content
|
|
19734
|
-
);
|
|
19732
|
+
const vector2 = Float32Array.from(parsed);
|
|
19733
|
+
resolvedVectors.set(memoryId, vector2);
|
|
19734
|
+
cacheRowVector(cache, memoryId, vector2, memories[i].updatedAt, content);
|
|
19735
19735
|
continue;
|
|
19736
19736
|
}
|
|
19737
19737
|
} catch {
|
|
@@ -19764,20 +19764,17 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
19764
19764
|
}
|
|
19765
19765
|
if (newEmbeddings) {
|
|
19766
19766
|
for (let j = 0; j < uncachedTexts.length; j++) {
|
|
19767
|
-
|
|
19768
|
-
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
memories[uncachedIndices[j]].updatedAt,
|
|
19772
|
-
memories[uncachedIndices[j]].content
|
|
19773
|
-
);
|
|
19767
|
+
const memory = memories[uncachedIndices[j]];
|
|
19768
|
+
const vector2 = Float32Array.from(newEmbeddings[j]);
|
|
19769
|
+
resolvedVectors.set(memory.uniqueId, vector2);
|
|
19770
|
+
cacheRowVector(cache, memory.uniqueId, vector2, memory.updatedAt, memory.content);
|
|
19774
19771
|
}
|
|
19775
19772
|
}
|
|
19776
19773
|
}
|
|
19777
19774
|
embeddedItems = memories.map((m) => ({
|
|
19778
19775
|
id: m.uniqueId,
|
|
19779
19776
|
content: m.content,
|
|
19780
|
-
embedding:
|
|
19777
|
+
embedding: resolvedVectors.get(m.uniqueId) ?? [],
|
|
19781
19778
|
createdAt: m.createdAt,
|
|
19782
19779
|
updatedAt: m.updatedAt,
|
|
19783
19780
|
proofCount: m.proofCount,
|
package/dist/react/index.cjs
CHANGED
|
@@ -23709,12 +23709,16 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
23709
23709
|
const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
23710
23710
|
const uncachedTexts = [];
|
|
23711
23711
|
const uncachedIndices = [];
|
|
23712
|
+
const resolvedVectors = /* @__PURE__ */ new Map();
|
|
23712
23713
|
let staleReembedCount = 0;
|
|
23713
23714
|
for (let i = 0; queryEmbedding.length > 0 && i < memories.length; i++) {
|
|
23714
23715
|
const content = memories[i].content;
|
|
23715
23716
|
const memoryId = memories[i].uniqueId;
|
|
23716
23717
|
const cached = cachedRowVector(cache, memoryId, memories[i].updatedAt, content);
|
|
23717
|
-
if (cached && cached.length === queryEmbedding.length)
|
|
23718
|
+
if (cached && cached.length === queryEmbedding.length) {
|
|
23719
|
+
resolvedVectors.set(memoryId, cached);
|
|
23720
|
+
continue;
|
|
23721
|
+
}
|
|
23718
23722
|
if (cached) cache.delete(memoryId);
|
|
23719
23723
|
const storedModel = memories[i].embeddingModel;
|
|
23720
23724
|
const modelCompatible = (storedModel ?? currentModel) === currentModel;
|
|
@@ -23722,13 +23726,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
23722
23726
|
try {
|
|
23723
23727
|
const parsed = JSON.parse(memories[i].embedding);
|
|
23724
23728
|
if (Array.isArray(parsed) && parsed.length === queryEmbedding.length) {
|
|
23725
|
-
|
|
23726
|
-
|
|
23727
|
-
|
|
23728
|
-
Float32Array.from(parsed),
|
|
23729
|
-
memories[i].updatedAt,
|
|
23730
|
-
content
|
|
23731
|
-
);
|
|
23729
|
+
const vector2 = Float32Array.from(parsed);
|
|
23730
|
+
resolvedVectors.set(memoryId, vector2);
|
|
23731
|
+
cacheRowVector(cache, memoryId, vector2, memories[i].updatedAt, content);
|
|
23732
23732
|
continue;
|
|
23733
23733
|
}
|
|
23734
23734
|
} catch {
|
|
@@ -23761,20 +23761,17 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
23761
23761
|
}
|
|
23762
23762
|
if (newEmbeddings) {
|
|
23763
23763
|
for (let j = 0; j < uncachedTexts.length; j++) {
|
|
23764
|
-
|
|
23765
|
-
|
|
23766
|
-
|
|
23767
|
-
|
|
23768
|
-
memories[uncachedIndices[j]].updatedAt,
|
|
23769
|
-
memories[uncachedIndices[j]].content
|
|
23770
|
-
);
|
|
23764
|
+
const memory = memories[uncachedIndices[j]];
|
|
23765
|
+
const vector2 = Float32Array.from(newEmbeddings[j]);
|
|
23766
|
+
resolvedVectors.set(memory.uniqueId, vector2);
|
|
23767
|
+
cacheRowVector(cache, memory.uniqueId, vector2, memory.updatedAt, memory.content);
|
|
23771
23768
|
}
|
|
23772
23769
|
}
|
|
23773
23770
|
}
|
|
23774
23771
|
embeddedItems = memories.map((m) => ({
|
|
23775
23772
|
id: m.uniqueId,
|
|
23776
23773
|
content: m.content,
|
|
23777
|
-
embedding:
|
|
23774
|
+
embedding: resolvedVectors.get(m.uniqueId) ?? [],
|
|
23778
23775
|
createdAt: m.createdAt,
|
|
23779
23776
|
updatedAt: m.updatedAt,
|
|
23780
23777
|
proofCount: m.proofCount,
|
package/dist/react/index.mjs
CHANGED
|
@@ -21809,12 +21809,16 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
21809
21809
|
const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
21810
21810
|
const uncachedTexts = [];
|
|
21811
21811
|
const uncachedIndices = [];
|
|
21812
|
+
const resolvedVectors = /* @__PURE__ */ new Map();
|
|
21812
21813
|
let staleReembedCount = 0;
|
|
21813
21814
|
for (let i = 0; queryEmbedding.length > 0 && i < memories.length; i++) {
|
|
21814
21815
|
const content = memories[i].content;
|
|
21815
21816
|
const memoryId = memories[i].uniqueId;
|
|
21816
21817
|
const cached = cachedRowVector(cache, memoryId, memories[i].updatedAt, content);
|
|
21817
|
-
if (cached && cached.length === queryEmbedding.length)
|
|
21818
|
+
if (cached && cached.length === queryEmbedding.length) {
|
|
21819
|
+
resolvedVectors.set(memoryId, cached);
|
|
21820
|
+
continue;
|
|
21821
|
+
}
|
|
21818
21822
|
if (cached) cache.delete(memoryId);
|
|
21819
21823
|
const storedModel = memories[i].embeddingModel;
|
|
21820
21824
|
const modelCompatible = (storedModel ?? currentModel) === currentModel;
|
|
@@ -21822,13 +21826,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
21822
21826
|
try {
|
|
21823
21827
|
const parsed = JSON.parse(memories[i].embedding);
|
|
21824
21828
|
if (Array.isArray(parsed) && parsed.length === queryEmbedding.length) {
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
Float32Array.from(parsed),
|
|
21829
|
-
memories[i].updatedAt,
|
|
21830
|
-
content
|
|
21831
|
-
);
|
|
21829
|
+
const vector2 = Float32Array.from(parsed);
|
|
21830
|
+
resolvedVectors.set(memoryId, vector2);
|
|
21831
|
+
cacheRowVector(cache, memoryId, vector2, memories[i].updatedAt, content);
|
|
21832
21832
|
continue;
|
|
21833
21833
|
}
|
|
21834
21834
|
} catch {
|
|
@@ -21861,20 +21861,17 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
21861
21861
|
}
|
|
21862
21862
|
if (newEmbeddings) {
|
|
21863
21863
|
for (let j = 0; j < uncachedTexts.length; j++) {
|
|
21864
|
-
|
|
21865
|
-
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
memories[uncachedIndices[j]].updatedAt,
|
|
21869
|
-
memories[uncachedIndices[j]].content
|
|
21870
|
-
);
|
|
21864
|
+
const memory = memories[uncachedIndices[j]];
|
|
21865
|
+
const vector2 = Float32Array.from(newEmbeddings[j]);
|
|
21866
|
+
resolvedVectors.set(memory.uniqueId, vector2);
|
|
21867
|
+
cacheRowVector(cache, memory.uniqueId, vector2, memory.updatedAt, memory.content);
|
|
21871
21868
|
}
|
|
21872
21869
|
}
|
|
21873
21870
|
}
|
|
21874
21871
|
embeddedItems = memories.map((m) => ({
|
|
21875
21872
|
id: m.uniqueId,
|
|
21876
21873
|
content: m.content,
|
|
21877
|
-
embedding:
|
|
21874
|
+
embedding: resolvedVectors.get(m.uniqueId) ?? [],
|
|
21878
21875
|
createdAt: m.createdAt,
|
|
21879
21876
|
updatedAt: m.updatedAt,
|
|
21880
21877
|
proofCount: m.proofCount,
|
package/dist/server/index.cjs
CHANGED
|
@@ -33056,12 +33056,16 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
33056
33056
|
const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
33057
33057
|
const uncachedTexts = [];
|
|
33058
33058
|
const uncachedIndices = [];
|
|
33059
|
+
const resolvedVectors = /* @__PURE__ */ new Map();
|
|
33059
33060
|
let staleReembedCount = 0;
|
|
33060
33061
|
for (let i = 0; queryEmbedding.length > 0 && i < memories.length; i++) {
|
|
33061
33062
|
const content = memories[i].content;
|
|
33062
33063
|
const memoryId = memories[i].uniqueId;
|
|
33063
33064
|
const cached = cachedRowVector(cache, memoryId, memories[i].updatedAt, content);
|
|
33064
|
-
if (cached && cached.length === queryEmbedding.length)
|
|
33065
|
+
if (cached && cached.length === queryEmbedding.length) {
|
|
33066
|
+
resolvedVectors.set(memoryId, cached);
|
|
33067
|
+
continue;
|
|
33068
|
+
}
|
|
33065
33069
|
if (cached) cache.delete(memoryId);
|
|
33066
33070
|
const storedModel = memories[i].embeddingModel;
|
|
33067
33071
|
const modelCompatible = (storedModel ?? currentModel) === currentModel;
|
|
@@ -33069,13 +33073,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
33069
33073
|
try {
|
|
33070
33074
|
const parsed = JSON.parse(memories[i].embedding);
|
|
33071
33075
|
if (Array.isArray(parsed) && parsed.length === queryEmbedding.length) {
|
|
33072
|
-
|
|
33073
|
-
|
|
33074
|
-
|
|
33075
|
-
Float32Array.from(parsed),
|
|
33076
|
-
memories[i].updatedAt,
|
|
33077
|
-
content
|
|
33078
|
-
);
|
|
33076
|
+
const vector = Float32Array.from(parsed);
|
|
33077
|
+
resolvedVectors.set(memoryId, vector);
|
|
33078
|
+
cacheRowVector(cache, memoryId, vector, memories[i].updatedAt, content);
|
|
33079
33079
|
continue;
|
|
33080
33080
|
}
|
|
33081
33081
|
} catch {
|
|
@@ -33108,20 +33108,17 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
33108
33108
|
}
|
|
33109
33109
|
if (newEmbeddings) {
|
|
33110
33110
|
for (let j = 0; j < uncachedTexts.length; j++) {
|
|
33111
|
-
|
|
33112
|
-
|
|
33113
|
-
|
|
33114
|
-
|
|
33115
|
-
memories[uncachedIndices[j]].updatedAt,
|
|
33116
|
-
memories[uncachedIndices[j]].content
|
|
33117
|
-
);
|
|
33111
|
+
const memory = memories[uncachedIndices[j]];
|
|
33112
|
+
const vector = Float32Array.from(newEmbeddings[j]);
|
|
33113
|
+
resolvedVectors.set(memory.uniqueId, vector);
|
|
33114
|
+
cacheRowVector(cache, memory.uniqueId, vector, memory.updatedAt, memory.content);
|
|
33118
33115
|
}
|
|
33119
33116
|
}
|
|
33120
33117
|
}
|
|
33121
33118
|
embeddedItems = memories.map((m) => ({
|
|
33122
33119
|
id: m.uniqueId,
|
|
33123
33120
|
content: m.content,
|
|
33124
|
-
embedding:
|
|
33121
|
+
embedding: resolvedVectors.get(m.uniqueId) ?? [],
|
|
33125
33122
|
createdAt: m.createdAt,
|
|
33126
33123
|
updatedAt: m.updatedAt,
|
|
33127
33124
|
proofCount: m.proofCount,
|
package/dist/server/index.mjs
CHANGED
|
@@ -31294,12 +31294,16 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
31294
31294
|
const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
31295
31295
|
const uncachedTexts = [];
|
|
31296
31296
|
const uncachedIndices = [];
|
|
31297
|
+
const resolvedVectors = /* @__PURE__ */ new Map();
|
|
31297
31298
|
let staleReembedCount = 0;
|
|
31298
31299
|
for (let i = 0; queryEmbedding.length > 0 && i < memories.length; i++) {
|
|
31299
31300
|
const content = memories[i].content;
|
|
31300
31301
|
const memoryId = memories[i].uniqueId;
|
|
31301
31302
|
const cached = cachedRowVector(cache, memoryId, memories[i].updatedAt, content);
|
|
31302
|
-
if (cached && cached.length === queryEmbedding.length)
|
|
31303
|
+
if (cached && cached.length === queryEmbedding.length) {
|
|
31304
|
+
resolvedVectors.set(memoryId, cached);
|
|
31305
|
+
continue;
|
|
31306
|
+
}
|
|
31303
31307
|
if (cached) cache.delete(memoryId);
|
|
31304
31308
|
const storedModel = memories[i].embeddingModel;
|
|
31305
31309
|
const modelCompatible = (storedModel ?? currentModel) === currentModel;
|
|
@@ -31307,13 +31311,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
31307
31311
|
try {
|
|
31308
31312
|
const parsed = JSON.parse(memories[i].embedding);
|
|
31309
31313
|
if (Array.isArray(parsed) && parsed.length === queryEmbedding.length) {
|
|
31310
|
-
|
|
31311
|
-
|
|
31312
|
-
|
|
31313
|
-
Float32Array.from(parsed),
|
|
31314
|
-
memories[i].updatedAt,
|
|
31315
|
-
content
|
|
31316
|
-
);
|
|
31314
|
+
const vector = Float32Array.from(parsed);
|
|
31315
|
+
resolvedVectors.set(memoryId, vector);
|
|
31316
|
+
cacheRowVector(cache, memoryId, vector, memories[i].updatedAt, content);
|
|
31317
31317
|
continue;
|
|
31318
31318
|
}
|
|
31319
31319
|
} catch {
|
|
@@ -31346,20 +31346,17 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
|
|
|
31346
31346
|
}
|
|
31347
31347
|
if (newEmbeddings) {
|
|
31348
31348
|
for (let j = 0; j < uncachedTexts.length; j++) {
|
|
31349
|
-
|
|
31350
|
-
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
memories[uncachedIndices[j]].updatedAt,
|
|
31354
|
-
memories[uncachedIndices[j]].content
|
|
31355
|
-
);
|
|
31349
|
+
const memory = memories[uncachedIndices[j]];
|
|
31350
|
+
const vector = Float32Array.from(newEmbeddings[j]);
|
|
31351
|
+
resolvedVectors.set(memory.uniqueId, vector);
|
|
31352
|
+
cacheRowVector(cache, memory.uniqueId, vector, memory.updatedAt, memory.content);
|
|
31356
31353
|
}
|
|
31357
31354
|
}
|
|
31358
31355
|
}
|
|
31359
31356
|
embeddedItems = memories.map((m) => ({
|
|
31360
31357
|
id: m.uniqueId,
|
|
31361
31358
|
content: m.content,
|
|
31362
|
-
embedding:
|
|
31359
|
+
embedding: resolvedVectors.get(m.uniqueId) ?? [],
|
|
31363
31360
|
createdAt: m.createdAt,
|
|
31364
31361
|
updatedAt: m.updatedAt,
|
|
31365
31362
|
proofCount: m.proofCount,
|