@anuma/sdk 7.0.2 → 7.0.3-next.20261014203930
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 +69 -50
- package/dist/expo/index.d.mts +1 -1
- package/dist/expo/index.d.ts +1 -1
- package/dist/expo/index.mjs +69 -50
- package/dist/react/index.cjs +82 -53
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.mjs +82 -53
- package/dist/server/index.cjs +52 -39
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.mjs +52 -39
- package/package.json +1 -1
package/dist/expo/index.cjs
CHANGED
|
@@ -19342,44 +19342,48 @@ async function recall(query, ctx, options = {}) {
|
|
|
19342
19342
|
embeddingOptions,
|
|
19343
19343
|
ctx.vaultCache,
|
|
19344
19344
|
searchOptions
|
|
19345
|
-
)))(
|
|
19346
|
-
|
|
19347
|
-
|
|
19348
|
-
|
|
19349
|
-
|
|
19350
|
-
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
|
|
19355
|
-
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19345
|
+
)))(
|
|
19346
|
+
query,
|
|
19347
|
+
{
|
|
19348
|
+
limit: types.includes("chunk") ? Math.max(limit * 2, 16) : limit,
|
|
19349
|
+
minSimilarity: vaultMinScore,
|
|
19350
|
+
useFusion: true,
|
|
19351
|
+
rerank: flags.rerank,
|
|
19352
|
+
...options.rerankTopN !== void 0 && { rerankTopN: options.rerankTopN },
|
|
19353
|
+
...options.ceWeight !== void 0 && { ceWeight: options.ceWeight },
|
|
19354
|
+
...options.rerankLoadTimeoutMs !== void 0 && {
|
|
19355
|
+
rerankLoadTimeoutMs: options.rerankLoadTimeoutMs
|
|
19356
|
+
},
|
|
19357
|
+
...options.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
|
|
19358
|
+
...options.recency && { recency: options.recency },
|
|
19359
|
+
...options.mmr !== void 0 && { mmr: options.mmr },
|
|
19360
|
+
...options.supersessionBoost !== void 0 && {
|
|
19361
|
+
supersessionBoost: options.supersessionBoost
|
|
19362
|
+
},
|
|
19363
|
+
...options.supersessionWindow !== void 0 && {
|
|
19364
|
+
supersessionWindow: options.supersessionWindow
|
|
19365
|
+
},
|
|
19366
|
+
...options.proofCountAlpha !== void 0 && {
|
|
19367
|
+
proofCountAlpha: options.proofCountAlpha
|
|
19368
|
+
},
|
|
19369
|
+
...options.bm25AdmissionDivisor !== void 0 && {
|
|
19370
|
+
bm25AdmissionDivisor: options.bm25AdmissionDivisor
|
|
19371
|
+
},
|
|
19372
|
+
...options.rrfK !== void 0 && { rrfK: options.rrfK },
|
|
19373
|
+
...options.decryptLast !== void 0 && { decryptLast: options.decryptLast },
|
|
19374
|
+
...subQueries && { subQueries },
|
|
19375
|
+
...options.scopes && { scopes: options.scopes },
|
|
19376
|
+
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
19377
|
+
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
19378
|
+
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
19379
|
+
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
19380
|
+
...entityRanking.length > 0 && { entityRanking },
|
|
19381
|
+
...temporalRanking.length > 0 && { temporalRanking },
|
|
19382
|
+
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
19383
|
+
queryEmbedTotalTimeoutMs
|
|
19369
19384
|
},
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
...subQueries && { subQueries },
|
|
19373
|
-
...options.scopes && { scopes: options.scopes },
|
|
19374
|
-
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
19375
|
-
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
19376
|
-
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
19377
|
-
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
19378
|
-
...entityRanking.length > 0 && { entityRanking },
|
|
19379
|
-
...temporalRanking.length > 0 && { temporalRanking },
|
|
19380
|
-
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
19381
|
-
queryEmbedTotalTimeoutMs
|
|
19382
|
-
});
|
|
19385
|
+
options.embeddingCache
|
|
19386
|
+
);
|
|
19383
19387
|
factResults.push(
|
|
19384
19388
|
...dedupeBy(
|
|
19385
19389
|
results,
|
|
@@ -20526,10 +20530,19 @@ function createLocalMemoryStore(options) {
|
|
|
20526
20530
|
retainOptions
|
|
20527
20531
|
),
|
|
20528
20532
|
factSource: {
|
|
20529
|
-
search: (query, searchOptions) => searchVaultMemoriesWithSize(
|
|
20533
|
+
search: (query, searchOptions, embeddingCache) => searchVaultMemoriesWithSize(
|
|
20530
20534
|
query,
|
|
20531
20535
|
vaultCtx,
|
|
20532
|
-
{
|
|
20536
|
+
{
|
|
20537
|
+
...options.embeddingOptions,
|
|
20538
|
+
taskType: "memory_recall_embed",
|
|
20539
|
+
...embeddingCache && !options.embeddingOptions.cache && {
|
|
20540
|
+
cache: maskScopedEmbeddingCache(
|
|
20541
|
+
embeddingCache,
|
|
20542
|
+
Boolean(options.embeddingOptions.maskInput)
|
|
20543
|
+
)
|
|
20544
|
+
}
|
|
20545
|
+
},
|
|
20533
20546
|
vaultCache,
|
|
20534
20547
|
searchOptions
|
|
20535
20548
|
),
|
|
@@ -21161,7 +21174,7 @@ function stored(row) {
|
|
|
21161
21174
|
function createRemoteMemoryPipeline(options) {
|
|
21162
21175
|
const { persistence, embeddingOptions } = options;
|
|
21163
21176
|
const model = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
21164
|
-
const operation = (mode) => {
|
|
21177
|
+
const operation = (mode, queryOptions = embeddingOptions) => {
|
|
21165
21178
|
const rejectUndecryptable = (failed) => {
|
|
21166
21179
|
if (!failed.length) return;
|
|
21167
21180
|
if (mode === "retain")
|
|
@@ -21192,7 +21205,7 @@ function createRemoteMemoryPipeline(options) {
|
|
|
21192
21205
|
const start = Date.now();
|
|
21193
21206
|
const budgetMs = search.queryEmbedTotalTimeoutMs ?? 8e3;
|
|
21194
21207
|
const embed = (texts) => generateEmbeddings(texts, {
|
|
21195
|
-
...
|
|
21208
|
+
...queryOptions,
|
|
21196
21209
|
taskType: mode === "retain" ? "memory_retain_embed" : "memory_recall_embed",
|
|
21197
21210
|
totalTimeoutMs: budgetMs
|
|
21198
21211
|
});
|
|
@@ -21212,7 +21225,11 @@ function createRemoteMemoryPipeline(options) {
|
|
|
21212
21225
|
}
|
|
21213
21226
|
};
|
|
21214
21227
|
const [primary, facetEmbeddings] = await Promise.all([
|
|
21215
|
-
search.queryEmbedding ??
|
|
21228
|
+
search.queryEmbedding ?? (mode === "recall" && queryOptions.cache ? generateEmbedding(query, {
|
|
21229
|
+
...queryOptions,
|
|
21230
|
+
taskType: "memory_recall_embed",
|
|
21231
|
+
totalTimeoutMs: budgetMs
|
|
21232
|
+
}) : embed([query]).then((vectors2) => vectors2[0])),
|
|
21216
21233
|
embedFacets()
|
|
21217
21234
|
]);
|
|
21218
21235
|
const queryEmbedding = storedVector(primary);
|
|
@@ -21436,15 +21453,17 @@ function createRemoteMemoryPipeline(options) {
|
|
|
21436
21453
|
const factSource = {
|
|
21437
21454
|
graphRanking: options.graphRanking,
|
|
21438
21455
|
temporalRanking: options.temporalRanking,
|
|
21439
|
-
search: async (text14, searchOptions) => {
|
|
21440
|
-
const
|
|
21456
|
+
search: async (text14, searchOptions, embeddingCache) => {
|
|
21457
|
+
const queryOptions = {
|
|
21458
|
+
...embeddingOptions,
|
|
21459
|
+
taskType: "memory_recall_embed",
|
|
21460
|
+
...embeddingCache && !embeddingOptions.cache && {
|
|
21461
|
+
cache: maskScopedEmbeddingCache(embeddingCache, Boolean(embeddingOptions.maskInput))
|
|
21462
|
+
}
|
|
21463
|
+
};
|
|
21464
|
+
const { prepare } = operation("recall", queryOptions);
|
|
21441
21465
|
const prepared = await prepare(text14, searchOptions);
|
|
21442
|
-
const ranked = await rankPreparedVaultCandidates(
|
|
21443
|
-
text14,
|
|
21444
|
-
prepared,
|
|
21445
|
-
{ ...embeddingOptions, taskType: "memory_recall_embed" },
|
|
21446
|
-
searchOptions
|
|
21447
|
-
);
|
|
21466
|
+
const ranked = await rankPreparedVaultCandidates(text14, prepared, queryOptions, searchOptions);
|
|
21448
21467
|
return {
|
|
21449
21468
|
...ranked,
|
|
21450
21469
|
rankedOnCosine: prepared.memories.length > 0 && !prepared.embeddingsUnavailable,
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -4508,7 +4508,7 @@ interface RecallOptions {
|
|
|
4508
4508
|
}
|
|
4509
4509
|
/** A fact source supplies bounded candidates; recall owns ranking and result handling. */
|
|
4510
4510
|
interface RecallFactSource {
|
|
4511
|
-
search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
4511
|
+
search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
4512
4512
|
graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
|
|
4513
4513
|
temporalRanking: (query: string, now?: number) => Promise<string[]>;
|
|
4514
4514
|
}
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -4508,7 +4508,7 @@ interface RecallOptions {
|
|
|
4508
4508
|
}
|
|
4509
4509
|
/** A fact source supplies bounded candidates; recall owns ranking and result handling. */
|
|
4510
4510
|
interface RecallFactSource {
|
|
4511
|
-
search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
4511
|
+
search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
4512
4512
|
graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
|
|
4513
4513
|
temporalRanking: (query: string, now?: number) => Promise<string[]>;
|
|
4514
4514
|
}
|
package/dist/expo/index.mjs
CHANGED
|
@@ -17715,44 +17715,48 @@ async function recall(query, ctx, options = {}) {
|
|
|
17715
17715
|
embeddingOptions,
|
|
17716
17716
|
ctx.vaultCache,
|
|
17717
17717
|
searchOptions
|
|
17718
|
-
)))(
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
17734
|
-
|
|
17735
|
-
|
|
17736
|
-
|
|
17737
|
-
|
|
17738
|
-
|
|
17739
|
-
|
|
17740
|
-
|
|
17741
|
-
|
|
17718
|
+
)))(
|
|
17719
|
+
query,
|
|
17720
|
+
{
|
|
17721
|
+
limit: types.includes("chunk") ? Math.max(limit * 2, 16) : limit,
|
|
17722
|
+
minSimilarity: vaultMinScore,
|
|
17723
|
+
useFusion: true,
|
|
17724
|
+
rerank: flags.rerank,
|
|
17725
|
+
...options.rerankTopN !== void 0 && { rerankTopN: options.rerankTopN },
|
|
17726
|
+
...options.ceWeight !== void 0 && { ceWeight: options.ceWeight },
|
|
17727
|
+
...options.rerankLoadTimeoutMs !== void 0 && {
|
|
17728
|
+
rerankLoadTimeoutMs: options.rerankLoadTimeoutMs
|
|
17729
|
+
},
|
|
17730
|
+
...options.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
|
|
17731
|
+
...options.recency && { recency: options.recency },
|
|
17732
|
+
...options.mmr !== void 0 && { mmr: options.mmr },
|
|
17733
|
+
...options.supersessionBoost !== void 0 && {
|
|
17734
|
+
supersessionBoost: options.supersessionBoost
|
|
17735
|
+
},
|
|
17736
|
+
...options.supersessionWindow !== void 0 && {
|
|
17737
|
+
supersessionWindow: options.supersessionWindow
|
|
17738
|
+
},
|
|
17739
|
+
...options.proofCountAlpha !== void 0 && {
|
|
17740
|
+
proofCountAlpha: options.proofCountAlpha
|
|
17741
|
+
},
|
|
17742
|
+
...options.bm25AdmissionDivisor !== void 0 && {
|
|
17743
|
+
bm25AdmissionDivisor: options.bm25AdmissionDivisor
|
|
17744
|
+
},
|
|
17745
|
+
...options.rrfK !== void 0 && { rrfK: options.rrfK },
|
|
17746
|
+
...options.decryptLast !== void 0 && { decryptLast: options.decryptLast },
|
|
17747
|
+
...subQueries && { subQueries },
|
|
17748
|
+
...options.scopes && { scopes: options.scopes },
|
|
17749
|
+
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
17750
|
+
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
17751
|
+
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
17752
|
+
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
17753
|
+
...entityRanking.length > 0 && { entityRanking },
|
|
17754
|
+
...temporalRanking.length > 0 && { temporalRanking },
|
|
17755
|
+
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
17756
|
+
queryEmbedTotalTimeoutMs
|
|
17742
17757
|
},
|
|
17743
|
-
|
|
17744
|
-
|
|
17745
|
-
...subQueries && { subQueries },
|
|
17746
|
-
...options.scopes && { scopes: options.scopes },
|
|
17747
|
-
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
17748
|
-
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
17749
|
-
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
17750
|
-
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
17751
|
-
...entityRanking.length > 0 && { entityRanking },
|
|
17752
|
-
...temporalRanking.length > 0 && { temporalRanking },
|
|
17753
|
-
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
17754
|
-
queryEmbedTotalTimeoutMs
|
|
17755
|
-
});
|
|
17758
|
+
options.embeddingCache
|
|
17759
|
+
);
|
|
17756
17760
|
factResults.push(
|
|
17757
17761
|
...dedupeBy(
|
|
17758
17762
|
results,
|
|
@@ -18891,10 +18895,19 @@ function createLocalMemoryStore(options) {
|
|
|
18891
18895
|
retainOptions
|
|
18892
18896
|
),
|
|
18893
18897
|
factSource: {
|
|
18894
|
-
search: (query, searchOptions) => searchVaultMemoriesWithSize(
|
|
18898
|
+
search: (query, searchOptions, embeddingCache) => searchVaultMemoriesWithSize(
|
|
18895
18899
|
query,
|
|
18896
18900
|
vaultCtx,
|
|
18897
|
-
{
|
|
18901
|
+
{
|
|
18902
|
+
...options.embeddingOptions,
|
|
18903
|
+
taskType: "memory_recall_embed",
|
|
18904
|
+
...embeddingCache && !options.embeddingOptions.cache && {
|
|
18905
|
+
cache: maskScopedEmbeddingCache(
|
|
18906
|
+
embeddingCache,
|
|
18907
|
+
Boolean(options.embeddingOptions.maskInput)
|
|
18908
|
+
)
|
|
18909
|
+
}
|
|
18910
|
+
},
|
|
18898
18911
|
vaultCache,
|
|
18899
18912
|
searchOptions
|
|
18900
18913
|
),
|
|
@@ -19524,7 +19537,7 @@ function stored(row) {
|
|
|
19524
19537
|
function createRemoteMemoryPipeline(options) {
|
|
19525
19538
|
const { persistence, embeddingOptions } = options;
|
|
19526
19539
|
const model = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
19527
|
-
const operation = (mode) => {
|
|
19540
|
+
const operation = (mode, queryOptions = embeddingOptions) => {
|
|
19528
19541
|
const rejectUndecryptable = (failed) => {
|
|
19529
19542
|
if (!failed.length) return;
|
|
19530
19543
|
if (mode === "retain")
|
|
@@ -19555,7 +19568,7 @@ function createRemoteMemoryPipeline(options) {
|
|
|
19555
19568
|
const start = Date.now();
|
|
19556
19569
|
const budgetMs = search.queryEmbedTotalTimeoutMs ?? 8e3;
|
|
19557
19570
|
const embed = (texts) => generateEmbeddings(texts, {
|
|
19558
|
-
...
|
|
19571
|
+
...queryOptions,
|
|
19559
19572
|
taskType: mode === "retain" ? "memory_retain_embed" : "memory_recall_embed",
|
|
19560
19573
|
totalTimeoutMs: budgetMs
|
|
19561
19574
|
});
|
|
@@ -19575,7 +19588,11 @@ function createRemoteMemoryPipeline(options) {
|
|
|
19575
19588
|
}
|
|
19576
19589
|
};
|
|
19577
19590
|
const [primary, facetEmbeddings] = await Promise.all([
|
|
19578
|
-
search.queryEmbedding ??
|
|
19591
|
+
search.queryEmbedding ?? (mode === "recall" && queryOptions.cache ? generateEmbedding(query, {
|
|
19592
|
+
...queryOptions,
|
|
19593
|
+
taskType: "memory_recall_embed",
|
|
19594
|
+
totalTimeoutMs: budgetMs
|
|
19595
|
+
}) : embed([query]).then((vectors2) => vectors2[0])),
|
|
19579
19596
|
embedFacets()
|
|
19580
19597
|
]);
|
|
19581
19598
|
const queryEmbedding = storedVector(primary);
|
|
@@ -19799,15 +19816,17 @@ function createRemoteMemoryPipeline(options) {
|
|
|
19799
19816
|
const factSource = {
|
|
19800
19817
|
graphRanking: options.graphRanking,
|
|
19801
19818
|
temporalRanking: options.temporalRanking,
|
|
19802
|
-
search: async (text14, searchOptions) => {
|
|
19803
|
-
const
|
|
19819
|
+
search: async (text14, searchOptions, embeddingCache) => {
|
|
19820
|
+
const queryOptions = {
|
|
19821
|
+
...embeddingOptions,
|
|
19822
|
+
taskType: "memory_recall_embed",
|
|
19823
|
+
...embeddingCache && !embeddingOptions.cache && {
|
|
19824
|
+
cache: maskScopedEmbeddingCache(embeddingCache, Boolean(embeddingOptions.maskInput))
|
|
19825
|
+
}
|
|
19826
|
+
};
|
|
19827
|
+
const { prepare } = operation("recall", queryOptions);
|
|
19804
19828
|
const prepared = await prepare(text14, searchOptions);
|
|
19805
|
-
const ranked = await rankPreparedVaultCandidates(
|
|
19806
|
-
text14,
|
|
19807
|
-
prepared,
|
|
19808
|
-
{ ...embeddingOptions, taskType: "memory_recall_embed" },
|
|
19809
|
-
searchOptions
|
|
19810
|
-
);
|
|
19829
|
+
const ranked = await rankPreparedVaultCandidates(text14, prepared, queryOptions, searchOptions);
|
|
19811
19830
|
return {
|
|
19812
19831
|
...ranked,
|
|
19813
19832
|
rankedOnCosine: prepared.memories.length > 0 && !prepared.embeddingsUnavailable,
|
package/dist/react/index.cjs
CHANGED
|
@@ -21646,44 +21646,48 @@ async function recall(query, ctx, options = {}) {
|
|
|
21646
21646
|
embeddingOptions,
|
|
21647
21647
|
ctx.vaultCache,
|
|
21648
21648
|
searchOptions
|
|
21649
|
-
)))(
|
|
21650
|
-
|
|
21651
|
-
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21655
|
-
|
|
21656
|
-
|
|
21657
|
-
|
|
21658
|
-
|
|
21659
|
-
|
|
21660
|
-
|
|
21661
|
-
|
|
21662
|
-
|
|
21663
|
-
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
|
|
21667
|
-
|
|
21668
|
-
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
|
|
21672
|
-
|
|
21649
|
+
)))(
|
|
21650
|
+
query,
|
|
21651
|
+
{
|
|
21652
|
+
limit: types.includes("chunk") ? Math.max(limit * 2, 16) : limit,
|
|
21653
|
+
minSimilarity: vaultMinScore,
|
|
21654
|
+
useFusion: true,
|
|
21655
|
+
rerank: flags.rerank,
|
|
21656
|
+
...options.rerankTopN !== void 0 && { rerankTopN: options.rerankTopN },
|
|
21657
|
+
...options.ceWeight !== void 0 && { ceWeight: options.ceWeight },
|
|
21658
|
+
...options.rerankLoadTimeoutMs !== void 0 && {
|
|
21659
|
+
rerankLoadTimeoutMs: options.rerankLoadTimeoutMs
|
|
21660
|
+
},
|
|
21661
|
+
...options.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
|
|
21662
|
+
...options.recency && { recency: options.recency },
|
|
21663
|
+
...options.mmr !== void 0 && { mmr: options.mmr },
|
|
21664
|
+
...options.supersessionBoost !== void 0 && {
|
|
21665
|
+
supersessionBoost: options.supersessionBoost
|
|
21666
|
+
},
|
|
21667
|
+
...options.supersessionWindow !== void 0 && {
|
|
21668
|
+
supersessionWindow: options.supersessionWindow
|
|
21669
|
+
},
|
|
21670
|
+
...options.proofCountAlpha !== void 0 && {
|
|
21671
|
+
proofCountAlpha: options.proofCountAlpha
|
|
21672
|
+
},
|
|
21673
|
+
...options.bm25AdmissionDivisor !== void 0 && {
|
|
21674
|
+
bm25AdmissionDivisor: options.bm25AdmissionDivisor
|
|
21675
|
+
},
|
|
21676
|
+
...options.rrfK !== void 0 && { rrfK: options.rrfK },
|
|
21677
|
+
...options.decryptLast !== void 0 && { decryptLast: options.decryptLast },
|
|
21678
|
+
...subQueries && { subQueries },
|
|
21679
|
+
...options.scopes && { scopes: options.scopes },
|
|
21680
|
+
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
21681
|
+
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
21682
|
+
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
21683
|
+
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
21684
|
+
...entityRanking.length > 0 && { entityRanking },
|
|
21685
|
+
...temporalRanking.length > 0 && { temporalRanking },
|
|
21686
|
+
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
21687
|
+
queryEmbedTotalTimeoutMs
|
|
21673
21688
|
},
|
|
21674
|
-
|
|
21675
|
-
|
|
21676
|
-
...subQueries && { subQueries },
|
|
21677
|
-
...options.scopes && { scopes: options.scopes },
|
|
21678
|
-
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
21679
|
-
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
21680
|
-
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
21681
|
-
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
21682
|
-
...entityRanking.length > 0 && { entityRanking },
|
|
21683
|
-
...temporalRanking.length > 0 && { temporalRanking },
|
|
21684
|
-
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
21685
|
-
queryEmbedTotalTimeoutMs
|
|
21686
|
-
});
|
|
21689
|
+
options.embeddingCache
|
|
21690
|
+
);
|
|
21687
21691
|
factResults.push(
|
|
21688
21692
|
...dedupeBy(
|
|
21689
21693
|
results,
|
|
@@ -22830,10 +22834,19 @@ function createLocalMemoryStore(options) {
|
|
|
22830
22834
|
retainOptions
|
|
22831
22835
|
),
|
|
22832
22836
|
factSource: {
|
|
22833
|
-
search: (query, searchOptions) => searchVaultMemoriesWithSize(
|
|
22837
|
+
search: (query, searchOptions, embeddingCache) => searchVaultMemoriesWithSize(
|
|
22834
22838
|
query,
|
|
22835
22839
|
vaultCtx,
|
|
22836
|
-
{
|
|
22840
|
+
{
|
|
22841
|
+
...options.embeddingOptions,
|
|
22842
|
+
taskType: "memory_recall_embed",
|
|
22843
|
+
...embeddingCache && !options.embeddingOptions.cache && {
|
|
22844
|
+
cache: maskScopedEmbeddingCache(
|
|
22845
|
+
embeddingCache,
|
|
22846
|
+
Boolean(options.embeddingOptions.maskInput)
|
|
22847
|
+
)
|
|
22848
|
+
}
|
|
22849
|
+
},
|
|
22837
22850
|
vaultCache,
|
|
22838
22851
|
searchOptions
|
|
22839
22852
|
),
|
|
@@ -23465,7 +23478,7 @@ function stored(row) {
|
|
|
23465
23478
|
function createRemoteMemoryPipeline(options) {
|
|
23466
23479
|
const { persistence, embeddingOptions } = options;
|
|
23467
23480
|
const model = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
23468
|
-
const operation = (mode) => {
|
|
23481
|
+
const operation = (mode, queryOptions = embeddingOptions) => {
|
|
23469
23482
|
const rejectUndecryptable = (failed) => {
|
|
23470
23483
|
if (!failed.length) return;
|
|
23471
23484
|
if (mode === "retain")
|
|
@@ -23496,7 +23509,7 @@ function createRemoteMemoryPipeline(options) {
|
|
|
23496
23509
|
const start = Date.now();
|
|
23497
23510
|
const budgetMs = search.queryEmbedTotalTimeoutMs ?? 8e3;
|
|
23498
23511
|
const embed = (texts) => generateEmbeddings(texts, {
|
|
23499
|
-
...
|
|
23512
|
+
...queryOptions,
|
|
23500
23513
|
taskType: mode === "retain" ? "memory_retain_embed" : "memory_recall_embed",
|
|
23501
23514
|
totalTimeoutMs: budgetMs
|
|
23502
23515
|
});
|
|
@@ -23516,7 +23529,11 @@ function createRemoteMemoryPipeline(options) {
|
|
|
23516
23529
|
}
|
|
23517
23530
|
};
|
|
23518
23531
|
const [primary, facetEmbeddings] = await Promise.all([
|
|
23519
|
-
search.queryEmbedding ??
|
|
23532
|
+
search.queryEmbedding ?? (mode === "recall" && queryOptions.cache ? generateEmbedding(query, {
|
|
23533
|
+
...queryOptions,
|
|
23534
|
+
taskType: "memory_recall_embed",
|
|
23535
|
+
totalTimeoutMs: budgetMs
|
|
23536
|
+
}) : embed([query]).then((vectors2) => vectors2[0])),
|
|
23520
23537
|
embedFacets()
|
|
23521
23538
|
]);
|
|
23522
23539
|
const queryEmbedding = storedVector(primary);
|
|
@@ -23740,15 +23757,17 @@ function createRemoteMemoryPipeline(options) {
|
|
|
23740
23757
|
const factSource = {
|
|
23741
23758
|
graphRanking: options.graphRanking,
|
|
23742
23759
|
temporalRanking: options.temporalRanking,
|
|
23743
|
-
search: async (text14, searchOptions) => {
|
|
23744
|
-
const
|
|
23760
|
+
search: async (text14, searchOptions, embeddingCache) => {
|
|
23761
|
+
const queryOptions = {
|
|
23762
|
+
...embeddingOptions,
|
|
23763
|
+
taskType: "memory_recall_embed",
|
|
23764
|
+
...embeddingCache && !embeddingOptions.cache && {
|
|
23765
|
+
cache: maskScopedEmbeddingCache(embeddingCache, Boolean(embeddingOptions.maskInput))
|
|
23766
|
+
}
|
|
23767
|
+
};
|
|
23768
|
+
const { prepare } = operation("recall", queryOptions);
|
|
23745
23769
|
const prepared = await prepare(text14, searchOptions);
|
|
23746
|
-
const ranked = await rankPreparedVaultCandidates(
|
|
23747
|
-
text14,
|
|
23748
|
-
prepared,
|
|
23749
|
-
{ ...embeddingOptions, taskType: "memory_recall_embed" },
|
|
23750
|
-
searchOptions
|
|
23751
|
-
);
|
|
23770
|
+
const ranked = await rankPreparedVaultCandidates(text14, prepared, queryOptions, searchOptions);
|
|
23752
23771
|
return {
|
|
23753
23772
|
...ranked,
|
|
23754
23773
|
rankedOnCosine: prepared.memories.length > 0 && !prepared.embeddingsUnavailable,
|
|
@@ -32027,7 +32046,7 @@ function useChatMedia(options) {
|
|
|
32027
32046
|
[mediaCtx, getImageDimensions, mcpR2Domain]
|
|
32028
32047
|
);
|
|
32029
32048
|
const storeUserFilesInOPFS = (0, import_react5.useCallback)(
|
|
32030
|
-
async (files, address, conversationId) => {
|
|
32049
|
+
async (files, address, conversationId, maxFileSizeBytes) => {
|
|
32031
32050
|
const canUseOPFS = isOPFSSupported() && hasEncryptionKey(address);
|
|
32032
32051
|
let encryptionKey;
|
|
32033
32052
|
if (canUseOPFS) {
|
|
@@ -32069,6 +32088,9 @@ function useChatMedia(options) {
|
|
|
32069
32088
|
clearTimeout(timeoutId);
|
|
32070
32089
|
}
|
|
32071
32090
|
}
|
|
32091
|
+
if (maxFileSizeBytes !== void 0 && blob.size > maxFileSizeBytes) {
|
|
32092
|
+
continue;
|
|
32093
|
+
}
|
|
32072
32094
|
size = blob.size;
|
|
32073
32095
|
dimensions = await getImageDimensions(blob);
|
|
32074
32096
|
await writeEncryptedFile(mediaId, blob, encryptionKey, {
|
|
@@ -33709,8 +33731,15 @@ function useChatStorage(options) {
|
|
|
33709
33731
|
messagesToSend = attachFileContextToLastUserMessage(messagesToSend, currentTurnFileText);
|
|
33710
33732
|
}
|
|
33711
33733
|
let userFileIds = [];
|
|
33712
|
-
|
|
33713
|
-
|
|
33734
|
+
const maxFileSizeBytes = fileProcessingOptions?.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE_BYTES;
|
|
33735
|
+
const storableFiles = filesForStorage?.filter((file) => file.size <= maxFileSizeBytes);
|
|
33736
|
+
if (storableFiles && storableFiles.length > 0 && walletAddress && isEncryptionReady()) {
|
|
33737
|
+
userFileIds = await storeUserFilesInOPFS(
|
|
33738
|
+
storableFiles,
|
|
33739
|
+
walletAddress,
|
|
33740
|
+
convId,
|
|
33741
|
+
maxFileSizeBytes
|
|
33742
|
+
);
|
|
33714
33743
|
}
|
|
33715
33744
|
const userMsgOpts = {
|
|
33716
33745
|
conversationId: convId,
|
package/dist/react/index.d.mts
CHANGED
|
@@ -5021,7 +5021,7 @@ interface RecallOptions {
|
|
|
5021
5021
|
}
|
|
5022
5022
|
/** A fact source supplies bounded candidates; recall owns ranking and result handling. */
|
|
5023
5023
|
interface RecallFactSource {
|
|
5024
|
-
search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
5024
|
+
search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
5025
5025
|
graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
|
|
5026
5026
|
temporalRanking: (query: string, now?: number) => Promise<string[]>;
|
|
5027
5027
|
}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -5021,7 +5021,7 @@ interface RecallOptions {
|
|
|
5021
5021
|
}
|
|
5022
5022
|
/** A fact source supplies bounded candidates; recall owns ranking and result handling. */
|
|
5023
5023
|
interface RecallFactSource {
|
|
5024
|
-
search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
5024
|
+
search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
5025
5025
|
graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
|
|
5026
5026
|
temporalRanking: (query: string, now?: number) => Promise<string[]>;
|
|
5027
5027
|
}
|
package/dist/react/index.mjs
CHANGED
|
@@ -19811,44 +19811,48 @@ async function recall(query, ctx, options = {}) {
|
|
|
19811
19811
|
embeddingOptions,
|
|
19812
19812
|
ctx.vaultCache,
|
|
19813
19813
|
searchOptions
|
|
19814
|
-
)))(
|
|
19815
|
-
|
|
19816
|
-
|
|
19817
|
-
|
|
19818
|
-
|
|
19819
|
-
|
|
19820
|
-
|
|
19821
|
-
|
|
19822
|
-
|
|
19823
|
-
|
|
19824
|
-
|
|
19825
|
-
|
|
19826
|
-
|
|
19827
|
-
|
|
19828
|
-
|
|
19829
|
-
|
|
19830
|
-
|
|
19831
|
-
|
|
19832
|
-
|
|
19833
|
-
|
|
19834
|
-
|
|
19835
|
-
|
|
19836
|
-
|
|
19837
|
-
|
|
19814
|
+
)))(
|
|
19815
|
+
query,
|
|
19816
|
+
{
|
|
19817
|
+
limit: types.includes("chunk") ? Math.max(limit * 2, 16) : limit,
|
|
19818
|
+
minSimilarity: vaultMinScore,
|
|
19819
|
+
useFusion: true,
|
|
19820
|
+
rerank: flags.rerank,
|
|
19821
|
+
...options.rerankTopN !== void 0 && { rerankTopN: options.rerankTopN },
|
|
19822
|
+
...options.ceWeight !== void 0 && { ceWeight: options.ceWeight },
|
|
19823
|
+
...options.rerankLoadTimeoutMs !== void 0 && {
|
|
19824
|
+
rerankLoadTimeoutMs: options.rerankLoadTimeoutMs
|
|
19825
|
+
},
|
|
19826
|
+
...options.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
|
|
19827
|
+
...options.recency && { recency: options.recency },
|
|
19828
|
+
...options.mmr !== void 0 && { mmr: options.mmr },
|
|
19829
|
+
...options.supersessionBoost !== void 0 && {
|
|
19830
|
+
supersessionBoost: options.supersessionBoost
|
|
19831
|
+
},
|
|
19832
|
+
...options.supersessionWindow !== void 0 && {
|
|
19833
|
+
supersessionWindow: options.supersessionWindow
|
|
19834
|
+
},
|
|
19835
|
+
...options.proofCountAlpha !== void 0 && {
|
|
19836
|
+
proofCountAlpha: options.proofCountAlpha
|
|
19837
|
+
},
|
|
19838
|
+
...options.bm25AdmissionDivisor !== void 0 && {
|
|
19839
|
+
bm25AdmissionDivisor: options.bm25AdmissionDivisor
|
|
19840
|
+
},
|
|
19841
|
+
...options.rrfK !== void 0 && { rrfK: options.rrfK },
|
|
19842
|
+
...options.decryptLast !== void 0 && { decryptLast: options.decryptLast },
|
|
19843
|
+
...subQueries && { subQueries },
|
|
19844
|
+
...options.scopes && { scopes: options.scopes },
|
|
19845
|
+
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
19846
|
+
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
19847
|
+
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
19848
|
+
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
19849
|
+
...entityRanking.length > 0 && { entityRanking },
|
|
19850
|
+
...temporalRanking.length > 0 && { temporalRanking },
|
|
19851
|
+
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
19852
|
+
queryEmbedTotalTimeoutMs
|
|
19838
19853
|
},
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
...subQueries && { subQueries },
|
|
19842
|
-
...options.scopes && { scopes: options.scopes },
|
|
19843
|
-
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
19844
|
-
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
19845
|
-
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
19846
|
-
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
19847
|
-
...entityRanking.length > 0 && { entityRanking },
|
|
19848
|
-
...temporalRanking.length > 0 && { temporalRanking },
|
|
19849
|
-
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
19850
|
-
queryEmbedTotalTimeoutMs
|
|
19851
|
-
});
|
|
19854
|
+
options.embeddingCache
|
|
19855
|
+
);
|
|
19852
19856
|
factResults.push(
|
|
19853
19857
|
...dedupeBy(
|
|
19854
19858
|
results,
|
|
@@ -20987,10 +20991,19 @@ function createLocalMemoryStore(options) {
|
|
|
20987
20991
|
retainOptions
|
|
20988
20992
|
),
|
|
20989
20993
|
factSource: {
|
|
20990
|
-
search: (query, searchOptions) => searchVaultMemoriesWithSize(
|
|
20994
|
+
search: (query, searchOptions, embeddingCache) => searchVaultMemoriesWithSize(
|
|
20991
20995
|
query,
|
|
20992
20996
|
vaultCtx,
|
|
20993
|
-
{
|
|
20997
|
+
{
|
|
20998
|
+
...options.embeddingOptions,
|
|
20999
|
+
taskType: "memory_recall_embed",
|
|
21000
|
+
...embeddingCache && !options.embeddingOptions.cache && {
|
|
21001
|
+
cache: maskScopedEmbeddingCache(
|
|
21002
|
+
embeddingCache,
|
|
21003
|
+
Boolean(options.embeddingOptions.maskInput)
|
|
21004
|
+
)
|
|
21005
|
+
}
|
|
21006
|
+
},
|
|
20994
21007
|
vaultCache,
|
|
20995
21008
|
searchOptions
|
|
20996
21009
|
),
|
|
@@ -21620,7 +21633,7 @@ function stored(row) {
|
|
|
21620
21633
|
function createRemoteMemoryPipeline(options) {
|
|
21621
21634
|
const { persistence, embeddingOptions } = options;
|
|
21622
21635
|
const model = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
21623
|
-
const operation = (mode) => {
|
|
21636
|
+
const operation = (mode, queryOptions = embeddingOptions) => {
|
|
21624
21637
|
const rejectUndecryptable = (failed) => {
|
|
21625
21638
|
if (!failed.length) return;
|
|
21626
21639
|
if (mode === "retain")
|
|
@@ -21651,7 +21664,7 @@ function createRemoteMemoryPipeline(options) {
|
|
|
21651
21664
|
const start = Date.now();
|
|
21652
21665
|
const budgetMs = search.queryEmbedTotalTimeoutMs ?? 8e3;
|
|
21653
21666
|
const embed = (texts) => generateEmbeddings(texts, {
|
|
21654
|
-
...
|
|
21667
|
+
...queryOptions,
|
|
21655
21668
|
taskType: mode === "retain" ? "memory_retain_embed" : "memory_recall_embed",
|
|
21656
21669
|
totalTimeoutMs: budgetMs
|
|
21657
21670
|
});
|
|
@@ -21671,7 +21684,11 @@ function createRemoteMemoryPipeline(options) {
|
|
|
21671
21684
|
}
|
|
21672
21685
|
};
|
|
21673
21686
|
const [primary, facetEmbeddings] = await Promise.all([
|
|
21674
|
-
search.queryEmbedding ??
|
|
21687
|
+
search.queryEmbedding ?? (mode === "recall" && queryOptions.cache ? generateEmbedding(query, {
|
|
21688
|
+
...queryOptions,
|
|
21689
|
+
taskType: "memory_recall_embed",
|
|
21690
|
+
totalTimeoutMs: budgetMs
|
|
21691
|
+
}) : embed([query]).then((vectors2) => vectors2[0])),
|
|
21675
21692
|
embedFacets()
|
|
21676
21693
|
]);
|
|
21677
21694
|
const queryEmbedding = storedVector(primary);
|
|
@@ -21895,15 +21912,17 @@ function createRemoteMemoryPipeline(options) {
|
|
|
21895
21912
|
const factSource = {
|
|
21896
21913
|
graphRanking: options.graphRanking,
|
|
21897
21914
|
temporalRanking: options.temporalRanking,
|
|
21898
|
-
search: async (text14, searchOptions) => {
|
|
21899
|
-
const
|
|
21915
|
+
search: async (text14, searchOptions, embeddingCache) => {
|
|
21916
|
+
const queryOptions = {
|
|
21917
|
+
...embeddingOptions,
|
|
21918
|
+
taskType: "memory_recall_embed",
|
|
21919
|
+
...embeddingCache && !embeddingOptions.cache && {
|
|
21920
|
+
cache: maskScopedEmbeddingCache(embeddingCache, Boolean(embeddingOptions.maskInput))
|
|
21921
|
+
}
|
|
21922
|
+
};
|
|
21923
|
+
const { prepare } = operation("recall", queryOptions);
|
|
21900
21924
|
const prepared = await prepare(text14, searchOptions);
|
|
21901
|
-
const ranked = await rankPreparedVaultCandidates(
|
|
21902
|
-
text14,
|
|
21903
|
-
prepared,
|
|
21904
|
-
{ ...embeddingOptions, taskType: "memory_recall_embed" },
|
|
21905
|
-
searchOptions
|
|
21906
|
-
);
|
|
21925
|
+
const ranked = await rankPreparedVaultCandidates(text14, prepared, queryOptions, searchOptions);
|
|
21907
21926
|
return {
|
|
21908
21927
|
...ranked,
|
|
21909
21928
|
rankedOnCosine: prepared.memories.length > 0 && !prepared.embeddingsUnavailable,
|
|
@@ -30170,7 +30189,7 @@ function useChatMedia(options) {
|
|
|
30170
30189
|
[mediaCtx, getImageDimensions, mcpR2Domain]
|
|
30171
30190
|
);
|
|
30172
30191
|
const storeUserFilesInOPFS = useCallback4(
|
|
30173
|
-
async (files, address, conversationId) => {
|
|
30192
|
+
async (files, address, conversationId, maxFileSizeBytes) => {
|
|
30174
30193
|
const canUseOPFS = isOPFSSupported() && hasEncryptionKey(address);
|
|
30175
30194
|
let encryptionKey;
|
|
30176
30195
|
if (canUseOPFS) {
|
|
@@ -30212,6 +30231,9 @@ function useChatMedia(options) {
|
|
|
30212
30231
|
clearTimeout(timeoutId);
|
|
30213
30232
|
}
|
|
30214
30233
|
}
|
|
30234
|
+
if (maxFileSizeBytes !== void 0 && blob.size > maxFileSizeBytes) {
|
|
30235
|
+
continue;
|
|
30236
|
+
}
|
|
30215
30237
|
size = blob.size;
|
|
30216
30238
|
dimensions = await getImageDimensions(blob);
|
|
30217
30239
|
await writeEncryptedFile(mediaId, blob, encryptionKey, {
|
|
@@ -31852,8 +31874,15 @@ function useChatStorage(options) {
|
|
|
31852
31874
|
messagesToSend = attachFileContextToLastUserMessage(messagesToSend, currentTurnFileText);
|
|
31853
31875
|
}
|
|
31854
31876
|
let userFileIds = [];
|
|
31855
|
-
|
|
31856
|
-
|
|
31877
|
+
const maxFileSizeBytes = fileProcessingOptions?.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE_BYTES;
|
|
31878
|
+
const storableFiles = filesForStorage?.filter((file) => file.size <= maxFileSizeBytes);
|
|
31879
|
+
if (storableFiles && storableFiles.length > 0 && walletAddress && isEncryptionReady()) {
|
|
31880
|
+
userFileIds = await storeUserFilesInOPFS(
|
|
31881
|
+
storableFiles,
|
|
31882
|
+
walletAddress,
|
|
31883
|
+
convId,
|
|
31884
|
+
maxFileSizeBytes
|
|
31885
|
+
);
|
|
31857
31886
|
}
|
|
31858
31887
|
const userMsgOpts = {
|
|
31859
31888
|
conversationId: convId,
|
package/dist/server/index.cjs
CHANGED
|
@@ -34583,44 +34583,48 @@ async function recall(query, ctx, options = {}) {
|
|
|
34583
34583
|
embeddingOptions,
|
|
34584
34584
|
ctx.vaultCache,
|
|
34585
34585
|
searchOptions
|
|
34586
|
-
)))(
|
|
34587
|
-
|
|
34588
|
-
|
|
34589
|
-
|
|
34590
|
-
|
|
34591
|
-
|
|
34592
|
-
|
|
34593
|
-
|
|
34594
|
-
|
|
34595
|
-
|
|
34596
|
-
|
|
34597
|
-
|
|
34598
|
-
|
|
34599
|
-
|
|
34600
|
-
|
|
34601
|
-
|
|
34602
|
-
|
|
34603
|
-
|
|
34604
|
-
|
|
34605
|
-
|
|
34606
|
-
|
|
34607
|
-
|
|
34608
|
-
|
|
34609
|
-
|
|
34586
|
+
)))(
|
|
34587
|
+
query,
|
|
34588
|
+
{
|
|
34589
|
+
limit: types.includes("chunk") ? Math.max(limit * 2, 16) : limit,
|
|
34590
|
+
minSimilarity: vaultMinScore,
|
|
34591
|
+
useFusion: true,
|
|
34592
|
+
rerank: flags.rerank,
|
|
34593
|
+
...options.rerankTopN !== void 0 && { rerankTopN: options.rerankTopN },
|
|
34594
|
+
...options.ceWeight !== void 0 && { ceWeight: options.ceWeight },
|
|
34595
|
+
...options.rerankLoadTimeoutMs !== void 0 && {
|
|
34596
|
+
rerankLoadTimeoutMs: options.rerankLoadTimeoutMs
|
|
34597
|
+
},
|
|
34598
|
+
...options.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
|
|
34599
|
+
...options.recency && { recency: options.recency },
|
|
34600
|
+
...options.mmr !== void 0 && { mmr: options.mmr },
|
|
34601
|
+
...options.supersessionBoost !== void 0 && {
|
|
34602
|
+
supersessionBoost: options.supersessionBoost
|
|
34603
|
+
},
|
|
34604
|
+
...options.supersessionWindow !== void 0 && {
|
|
34605
|
+
supersessionWindow: options.supersessionWindow
|
|
34606
|
+
},
|
|
34607
|
+
...options.proofCountAlpha !== void 0 && {
|
|
34608
|
+
proofCountAlpha: options.proofCountAlpha
|
|
34609
|
+
},
|
|
34610
|
+
...options.bm25AdmissionDivisor !== void 0 && {
|
|
34611
|
+
bm25AdmissionDivisor: options.bm25AdmissionDivisor
|
|
34612
|
+
},
|
|
34613
|
+
...options.rrfK !== void 0 && { rrfK: options.rrfK },
|
|
34614
|
+
...options.decryptLast !== void 0 && { decryptLast: options.decryptLast },
|
|
34615
|
+
...subQueries && { subQueries },
|
|
34616
|
+
...options.scopes && { scopes: options.scopes },
|
|
34617
|
+
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
34618
|
+
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
34619
|
+
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
34620
|
+
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
34621
|
+
...entityRanking.length > 0 && { entityRanking },
|
|
34622
|
+
...temporalRanking.length > 0 && { temporalRanking },
|
|
34623
|
+
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
34624
|
+
queryEmbedTotalTimeoutMs
|
|
34610
34625
|
},
|
|
34611
|
-
|
|
34612
|
-
|
|
34613
|
-
...subQueries && { subQueries },
|
|
34614
|
-
...options.scopes && { scopes: options.scopes },
|
|
34615
|
-
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
34616
|
-
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
34617
|
-
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
34618
|
-
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
34619
|
-
...entityRanking.length > 0 && { entityRanking },
|
|
34620
|
-
...temporalRanking.length > 0 && { temporalRanking },
|
|
34621
|
-
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
34622
|
-
queryEmbedTotalTimeoutMs
|
|
34623
|
-
});
|
|
34626
|
+
options.embeddingCache
|
|
34627
|
+
);
|
|
34624
34628
|
factResults.push(
|
|
34625
34629
|
...dedupeBy(
|
|
34626
34630
|
results,
|
|
@@ -35767,10 +35771,19 @@ function createLocalMemoryStore(options) {
|
|
|
35767
35771
|
retainOptions
|
|
35768
35772
|
),
|
|
35769
35773
|
factSource: {
|
|
35770
|
-
search: (query, searchOptions) => searchVaultMemoriesWithSize(
|
|
35774
|
+
search: (query, searchOptions, embeddingCache) => searchVaultMemoriesWithSize(
|
|
35771
35775
|
query,
|
|
35772
35776
|
vaultCtx,
|
|
35773
|
-
{
|
|
35777
|
+
{
|
|
35778
|
+
...options.embeddingOptions,
|
|
35779
|
+
taskType: "memory_recall_embed",
|
|
35780
|
+
...embeddingCache && !options.embeddingOptions.cache && {
|
|
35781
|
+
cache: maskScopedEmbeddingCache(
|
|
35782
|
+
embeddingCache,
|
|
35783
|
+
Boolean(options.embeddingOptions.maskInput)
|
|
35784
|
+
)
|
|
35785
|
+
}
|
|
35786
|
+
},
|
|
35774
35787
|
vaultCache,
|
|
35775
35788
|
searchOptions
|
|
35776
35789
|
),
|
package/dist/server/index.d.mts
CHANGED
|
@@ -4187,7 +4187,7 @@ interface RecallOptions {
|
|
|
4187
4187
|
}
|
|
4188
4188
|
/** A fact source supplies bounded candidates; recall owns ranking and result handling. */
|
|
4189
4189
|
interface RecallFactSource {
|
|
4190
|
-
search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
4190
|
+
search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
4191
4191
|
graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
|
|
4192
4192
|
temporalRanking: (query: string, now?: number) => Promise<string[]>;
|
|
4193
4193
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -4187,7 +4187,7 @@ interface RecallOptions {
|
|
|
4187
4187
|
}
|
|
4188
4188
|
/** A fact source supplies bounded candidates; recall owns ranking and result handling. */
|
|
4189
4189
|
interface RecallFactSource {
|
|
4190
|
-
search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
4190
|
+
search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
|
|
4191
4191
|
graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
|
|
4192
4192
|
temporalRanking: (query: string, now?: number) => Promise<string[]>;
|
|
4193
4193
|
}
|
package/dist/server/index.mjs
CHANGED
|
@@ -32866,44 +32866,48 @@ async function recall(query, ctx, options = {}) {
|
|
|
32866
32866
|
embeddingOptions,
|
|
32867
32867
|
ctx.vaultCache,
|
|
32868
32868
|
searchOptions
|
|
32869
|
-
)))(
|
|
32870
|
-
|
|
32871
|
-
|
|
32872
|
-
|
|
32873
|
-
|
|
32874
|
-
|
|
32875
|
-
|
|
32876
|
-
|
|
32877
|
-
|
|
32878
|
-
|
|
32879
|
-
|
|
32880
|
-
|
|
32881
|
-
|
|
32882
|
-
|
|
32883
|
-
|
|
32884
|
-
|
|
32885
|
-
|
|
32886
|
-
|
|
32887
|
-
|
|
32888
|
-
|
|
32889
|
-
|
|
32890
|
-
|
|
32891
|
-
|
|
32892
|
-
|
|
32869
|
+
)))(
|
|
32870
|
+
query,
|
|
32871
|
+
{
|
|
32872
|
+
limit: types.includes("chunk") ? Math.max(limit * 2, 16) : limit,
|
|
32873
|
+
minSimilarity: vaultMinScore,
|
|
32874
|
+
useFusion: true,
|
|
32875
|
+
rerank: flags.rerank,
|
|
32876
|
+
...options.rerankTopN !== void 0 && { rerankTopN: options.rerankTopN },
|
|
32877
|
+
...options.ceWeight !== void 0 && { ceWeight: options.ceWeight },
|
|
32878
|
+
...options.rerankLoadTimeoutMs !== void 0 && {
|
|
32879
|
+
rerankLoadTimeoutMs: options.rerankLoadTimeoutMs
|
|
32880
|
+
},
|
|
32881
|
+
...options.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
|
|
32882
|
+
...options.recency && { recency: options.recency },
|
|
32883
|
+
...options.mmr !== void 0 && { mmr: options.mmr },
|
|
32884
|
+
...options.supersessionBoost !== void 0 && {
|
|
32885
|
+
supersessionBoost: options.supersessionBoost
|
|
32886
|
+
},
|
|
32887
|
+
...options.supersessionWindow !== void 0 && {
|
|
32888
|
+
supersessionWindow: options.supersessionWindow
|
|
32889
|
+
},
|
|
32890
|
+
...options.proofCountAlpha !== void 0 && {
|
|
32891
|
+
proofCountAlpha: options.proofCountAlpha
|
|
32892
|
+
},
|
|
32893
|
+
...options.bm25AdmissionDivisor !== void 0 && {
|
|
32894
|
+
bm25AdmissionDivisor: options.bm25AdmissionDivisor
|
|
32895
|
+
},
|
|
32896
|
+
...options.rrfK !== void 0 && { rrfK: options.rrfK },
|
|
32897
|
+
...options.decryptLast !== void 0 && { decryptLast: options.decryptLast },
|
|
32898
|
+
...subQueries && { subQueries },
|
|
32899
|
+
...options.scopes && { scopes: options.scopes },
|
|
32900
|
+
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
32901
|
+
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
32902
|
+
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
32903
|
+
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
32904
|
+
...entityRanking.length > 0 && { entityRanking },
|
|
32905
|
+
...temporalRanking.length > 0 && { temporalRanking },
|
|
32906
|
+
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
32907
|
+
queryEmbedTotalTimeoutMs
|
|
32893
32908
|
},
|
|
32894
|
-
|
|
32895
|
-
|
|
32896
|
-
...subQueries && { subQueries },
|
|
32897
|
-
...options.scopes && { scopes: options.scopes },
|
|
32898
|
-
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
32899
|
-
...options.factTypes?.length && { factTypes: options.factTypes },
|
|
32900
|
-
...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
|
|
32901
|
-
...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
|
|
32902
|
-
...entityRanking.length > 0 && { entityRanking },
|
|
32903
|
-
...temporalRanking.length > 0 && { temporalRanking },
|
|
32904
|
-
...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
|
|
32905
|
-
queryEmbedTotalTimeoutMs
|
|
32906
|
-
});
|
|
32909
|
+
options.embeddingCache
|
|
32910
|
+
);
|
|
32907
32911
|
factResults.push(
|
|
32908
32912
|
...dedupeBy(
|
|
32909
32913
|
results,
|
|
@@ -34042,10 +34046,19 @@ function createLocalMemoryStore(options) {
|
|
|
34042
34046
|
retainOptions
|
|
34043
34047
|
),
|
|
34044
34048
|
factSource: {
|
|
34045
|
-
search: (query, searchOptions) => searchVaultMemoriesWithSize(
|
|
34049
|
+
search: (query, searchOptions, embeddingCache) => searchVaultMemoriesWithSize(
|
|
34046
34050
|
query,
|
|
34047
34051
|
vaultCtx,
|
|
34048
|
-
{
|
|
34052
|
+
{
|
|
34053
|
+
...options.embeddingOptions,
|
|
34054
|
+
taskType: "memory_recall_embed",
|
|
34055
|
+
...embeddingCache && !options.embeddingOptions.cache && {
|
|
34056
|
+
cache: maskScopedEmbeddingCache(
|
|
34057
|
+
embeddingCache,
|
|
34058
|
+
Boolean(options.embeddingOptions.maskInput)
|
|
34059
|
+
)
|
|
34060
|
+
}
|
|
34061
|
+
},
|
|
34049
34062
|
vaultCache,
|
|
34050
34063
|
searchOptions
|
|
34051
34064
|
),
|