@anuma/sdk 6.19.0 → 6.19.1
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/{chunk-L253L67R.mjs → chunk-GRU24OP4.mjs} +12 -8
- package/dist/expo/index.cjs +12 -8
- package/dist/expo/index.d.mts +3 -2
- package/dist/expo/index.d.ts +3 -2
- package/dist/expo/index.mjs +1 -1
- package/dist/expo/{recall-B3PUQHJK.mjs → recall-PI7FZQNO.mjs} +1 -1
- package/dist/react/{chunk-JRJRRO4P.mjs → chunk-2EEPAOHJ.mjs} +12 -8
- package/dist/react/index.cjs +12 -8
- package/dist/react/index.d.mts +3 -2
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.mjs +1 -1
- package/dist/react/{recall-WPYCG4ED.mjs → recall-D6ODL36R.mjs} +1 -1
- package/dist/server/{chunk-2A6HXY4P.mjs → chunk-SPHKT76E.mjs} +12 -8
- package/dist/server/index.cjs +12 -8
- package/dist/server/index.d.mts +3 -2
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.mjs +1 -1
- package/dist/server/{recall-JPIWNKA7.mjs → recall-NLCZUGXN.mjs} +1 -1
- package/package.json +1 -1
|
@@ -5643,6 +5643,7 @@ function createVaultEmbeddingCache(maxSize = DEFAULT_VAULT_CACHE_SIZE) {
|
|
|
5643
5643
|
}
|
|
5644
5644
|
|
|
5645
5645
|
// src/lib/memoryVault/searchTool.ts
|
|
5646
|
+
var DEFAULT_RERANK_TOP_N = 5;
|
|
5646
5647
|
var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
5647
5648
|
var warnedProgrammaticDecomposeIgnored = false;
|
|
5648
5649
|
function normalizeEventTimeKind(kind) {
|
|
@@ -5873,7 +5874,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
5873
5874
|
let tailSlice = [];
|
|
5874
5875
|
const itemById = new Map(items.map((i) => [i.id, i]));
|
|
5875
5876
|
if (options?.rerank) {
|
|
5876
|
-
const rerankTopN = options.rerankTopN ??
|
|
5877
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
5877
5878
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
5878
5879
|
const headSlice = v2Ranked.slice(0, rerankTopN);
|
|
5879
5880
|
const ceStart = nowMs();
|
|
@@ -5919,9 +5920,12 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
5919
5920
|
}
|
|
5920
5921
|
if (sideLanesAsync.length > 0) {
|
|
5921
5922
|
const headIds = combined.map((r) => r.uniqueId);
|
|
5922
|
-
const
|
|
5923
|
-
const
|
|
5924
|
-
const
|
|
5923
|
+
const tailIds = tailSlice.map((r) => r.uniqueId);
|
|
5924
|
+
const rankedIds = tailIds.length > 0 ? [...headIds, ...tailIds] : headIds;
|
|
5925
|
+
const fused = rrfFuse([rankedIds, rankedIds, ...sideLanesAsync], options?.rrfK);
|
|
5926
|
+
const fusedHead = [...combined, ...tailSlice].map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
|
|
5927
|
+
tailSlice = [];
|
|
5928
|
+
const seen = new Set(fusedHead.map((r) => r.uniqueId));
|
|
5925
5929
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
5926
5930
|
for (const lane of sideLanesAsync) {
|
|
5927
5931
|
for (const id of lane) {
|
|
@@ -5946,7 +5950,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
5946
5950
|
const lambda = options.mmrLambda ?? 0.7;
|
|
5947
5951
|
const mmrTopN = options.mmrTopN ?? 20;
|
|
5948
5952
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
5949
|
-
const mmrCandidates = combined.slice(0, mmrTopN).map((r) => ({
|
|
5953
|
+
const mmrCandidates = [...combined, ...tailSlice].slice(0, mmrTopN).map((r) => ({
|
|
5950
5954
|
id: r.uniqueId,
|
|
5951
5955
|
score: r.similarity,
|
|
5952
5956
|
embedding: itemById2.get(r.uniqueId)?.embedding ?? [],
|
|
@@ -5954,7 +5958,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
5954
5958
|
}));
|
|
5955
5959
|
const picked = applyMMR(mmrCandidates, limit, lambda);
|
|
5956
5960
|
const pickedIds = new Set(picked.map((p) => p.id));
|
|
5957
|
-
const resultMap = new Map(combined.map((r) => [r.uniqueId, r]));
|
|
5961
|
+
const resultMap = new Map([...combined, ...tailSlice].map((r) => [r.uniqueId, r]));
|
|
5958
5962
|
const pickedResults = picked.map((p) => {
|
|
5959
5963
|
const orig = resultMap.get(p.id);
|
|
5960
5964
|
return {
|
|
@@ -6068,7 +6072,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
|
|
|
6068
6072
|
}
|
|
6069
6073
|
}
|
|
6070
6074
|
if (options?.rerank && combined.length > 0) {
|
|
6071
|
-
const rerankTopN = options.rerankTopN ??
|
|
6075
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
6072
6076
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
6073
6077
|
const headSlice = combined.slice(0, rerankTopN);
|
|
6074
6078
|
const tailSlice = combined.slice(rerankTopN);
|
|
@@ -6908,7 +6912,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
6908
6912
|
subQueries = decomp.subQueries;
|
|
6909
6913
|
}
|
|
6910
6914
|
}
|
|
6911
|
-
const { recall: recall2 } = await import("./recall-
|
|
6915
|
+
const { recall: recall2 } = await import("./recall-PI7FZQNO.mjs");
|
|
6912
6916
|
let recallDegraded = [];
|
|
6913
6917
|
const result = await recall2(
|
|
6914
6918
|
query,
|
package/dist/expo/index.cjs
CHANGED
|
@@ -8293,7 +8293,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
8293
8293
|
let tailSlice = [];
|
|
8294
8294
|
const itemById = new Map(items.map((i) => [i.id, i]));
|
|
8295
8295
|
if (options?.rerank) {
|
|
8296
|
-
const rerankTopN = options.rerankTopN ??
|
|
8296
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
8297
8297
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
8298
8298
|
const headSlice = v2Ranked.slice(0, rerankTopN);
|
|
8299
8299
|
const ceStart = nowMs2();
|
|
@@ -8339,9 +8339,12 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
8339
8339
|
}
|
|
8340
8340
|
if (sideLanesAsync.length > 0) {
|
|
8341
8341
|
const headIds = combined.map((r) => r.uniqueId);
|
|
8342
|
-
const
|
|
8343
|
-
const
|
|
8344
|
-
const
|
|
8342
|
+
const tailIds = tailSlice.map((r) => r.uniqueId);
|
|
8343
|
+
const rankedIds = tailIds.length > 0 ? [...headIds, ...tailIds] : headIds;
|
|
8344
|
+
const fused = rrfFuse([rankedIds, rankedIds, ...sideLanesAsync], options?.rrfK);
|
|
8345
|
+
const fusedHead = [...combined, ...tailSlice].map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
|
|
8346
|
+
tailSlice = [];
|
|
8347
|
+
const seen = new Set(fusedHead.map((r) => r.uniqueId));
|
|
8345
8348
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
8346
8349
|
for (const lane of sideLanesAsync) {
|
|
8347
8350
|
for (const id of lane) {
|
|
@@ -8366,7 +8369,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
8366
8369
|
const lambda = options.mmrLambda ?? 0.7;
|
|
8367
8370
|
const mmrTopN = options.mmrTopN ?? 20;
|
|
8368
8371
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
8369
|
-
const mmrCandidates = combined.slice(0, mmrTopN).map((r) => ({
|
|
8372
|
+
const mmrCandidates = [...combined, ...tailSlice].slice(0, mmrTopN).map((r) => ({
|
|
8370
8373
|
id: r.uniqueId,
|
|
8371
8374
|
score: r.similarity,
|
|
8372
8375
|
embedding: itemById2.get(r.uniqueId)?.embedding ?? [],
|
|
@@ -8374,7 +8377,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
8374
8377
|
}));
|
|
8375
8378
|
const picked = applyMMR(mmrCandidates, limit, lambda);
|
|
8376
8379
|
const pickedIds = new Set(picked.map((p) => p.id));
|
|
8377
|
-
const resultMap = new Map(combined.map((r) => [r.uniqueId, r]));
|
|
8380
|
+
const resultMap = new Map([...combined, ...tailSlice].map((r) => [r.uniqueId, r]));
|
|
8378
8381
|
const pickedResults = picked.map((p) => {
|
|
8379
8382
|
const orig = resultMap.get(p.id);
|
|
8380
8383
|
return {
|
|
@@ -8488,7 +8491,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
|
|
|
8488
8491
|
}
|
|
8489
8492
|
}
|
|
8490
8493
|
if (options?.rerank && combined.length > 0) {
|
|
8491
|
-
const rerankTopN = options.rerankTopN ??
|
|
8494
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
8492
8495
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
8493
8496
|
const headSlice = combined.slice(0, rerankTopN);
|
|
8494
8497
|
const tailSlice = combined.slice(rerankTopN);
|
|
@@ -9373,7 +9376,7 @@ ${formatted}`;
|
|
|
9373
9376
|
}
|
|
9374
9377
|
};
|
|
9375
9378
|
}
|
|
9376
|
-
var nowMs2, warnedProgrammaticDecomposeIgnored, SUPERSESSION_SIMILARITY_THRESHOLD, SUPERSESSION_MIN_AGE_GAP_MS, SUPERSESSION_BOOST_FACTOR, SUPERSESSION_MAX_WINDOW, EMBEDDINGS_DEGRADED_EMPTY_NO_LEXICAL;
|
|
9379
|
+
var DEFAULT_RERANK_TOP_N, nowMs2, warnedProgrammaticDecomposeIgnored, SUPERSESSION_SIMILARITY_THRESHOLD, SUPERSESSION_MIN_AGE_GAP_MS, SUPERSESSION_BOOST_FACTOR, SUPERSESSION_MAX_WINDOW, EMBEDDINGS_DEGRADED_EMPTY_NO_LEXICAL;
|
|
9377
9380
|
var init_searchTool = __esm({
|
|
9378
9381
|
"src/lib/memoryVault/searchTool.ts"() {
|
|
9379
9382
|
"use strict";
|
|
@@ -9391,6 +9394,7 @@ var init_searchTool = __esm({
|
|
|
9391
9394
|
init_bm25();
|
|
9392
9395
|
init_decomposeQuery();
|
|
9393
9396
|
init_lruCache();
|
|
9397
|
+
DEFAULT_RERANK_TOP_N = 5;
|
|
9394
9398
|
nowMs2 = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
9395
9399
|
warnedProgrammaticDecomposeIgnored = false;
|
|
9396
9400
|
SUPERSESSION_SIMILARITY_THRESHOLD = 0.7;
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -5375,7 +5375,7 @@ interface MemoryVaultSearchOptions {
|
|
|
5375
5375
|
* When true, switches to the async pipeline (rankFusedVaultMemoriesAsync).
|
|
5376
5376
|
*/
|
|
5377
5377
|
rerank?: boolean;
|
|
5378
|
-
/** Number of CE rerank candidates. Default
|
|
5378
|
+
/** Number of CE rerank candidates. Default 5 ({@link DEFAULT_RERANK_TOP_N}). */
|
|
5379
5379
|
rerankTopN?: number;
|
|
5380
5380
|
/** Multiplicative cross-encoder blend weight. Default 0.1. Only used when `rerank` is true. */
|
|
5381
5381
|
ceWeight?: number;
|
|
@@ -5730,7 +5730,8 @@ interface RecallOptions {
|
|
|
5730
5730
|
* swallowed (diagnostics must never break retrieval). Off unless provided.
|
|
5731
5731
|
*/
|
|
5732
5732
|
onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
|
|
5733
|
-
/** Number of candidates fed to the cross-encoder rerank stage. Default:
|
|
5733
|
+
/** Number of candidates fed to the cross-encoder rerank stage. Default: 5;
|
|
5734
|
+
* was 30 until 2026-08-13 — see anuma-ai/sdk#845. */
|
|
5734
5735
|
rerankTopN?: number;
|
|
5735
5736
|
/** Multiplicative cross-encoder blend weight. Default: 0.1. */
|
|
5736
5737
|
ceWeight?: number;
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -5375,7 +5375,7 @@ interface MemoryVaultSearchOptions {
|
|
|
5375
5375
|
* When true, switches to the async pipeline (rankFusedVaultMemoriesAsync).
|
|
5376
5376
|
*/
|
|
5377
5377
|
rerank?: boolean;
|
|
5378
|
-
/** Number of CE rerank candidates. Default
|
|
5378
|
+
/** Number of CE rerank candidates. Default 5 ({@link DEFAULT_RERANK_TOP_N}). */
|
|
5379
5379
|
rerankTopN?: number;
|
|
5380
5380
|
/** Multiplicative cross-encoder blend weight. Default 0.1. Only used when `rerank` is true. */
|
|
5381
5381
|
ceWeight?: number;
|
|
@@ -5730,7 +5730,8 @@ interface RecallOptions {
|
|
|
5730
5730
|
* swallowed (diagnostics must never break retrieval). Off unless provided.
|
|
5731
5731
|
*/
|
|
5732
5732
|
onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
|
|
5733
|
-
/** Number of candidates fed to the cross-encoder rerank stage. Default:
|
|
5733
|
+
/** Number of candidates fed to the cross-encoder rerank stage. Default: 5;
|
|
5734
|
+
* was 30 until 2026-08-13 — see anuma-ai/sdk#845. */
|
|
5734
5735
|
rerankTopN?: number;
|
|
5735
5736
|
/** Multiplicative cross-encoder blend weight. Default: 0.1. */
|
|
5736
5737
|
ceWeight?: number;
|
package/dist/expo/index.mjs
CHANGED
|
@@ -5927,6 +5927,7 @@ function createVaultEmbeddingCache(maxSize = DEFAULT_VAULT_CACHE_SIZE) {
|
|
|
5927
5927
|
}
|
|
5928
5928
|
|
|
5929
5929
|
// src/lib/memoryVault/searchTool.ts
|
|
5930
|
+
var DEFAULT_RERANK_TOP_N = 5;
|
|
5930
5931
|
var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
5931
5932
|
var warnedProgrammaticDecomposeIgnored = false;
|
|
5932
5933
|
function normalizeEventTimeKind(kind) {
|
|
@@ -6157,7 +6158,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
6157
6158
|
let tailSlice = [];
|
|
6158
6159
|
const itemById = new Map(items.map((i) => [i.id, i]));
|
|
6159
6160
|
if (options?.rerank) {
|
|
6160
|
-
const rerankTopN = options.rerankTopN ??
|
|
6161
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
6161
6162
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
6162
6163
|
const headSlice = v2Ranked.slice(0, rerankTopN);
|
|
6163
6164
|
const ceStart = nowMs();
|
|
@@ -6203,9 +6204,12 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
6203
6204
|
}
|
|
6204
6205
|
if (sideLanesAsync.length > 0) {
|
|
6205
6206
|
const headIds = combined.map((r) => r.uniqueId);
|
|
6206
|
-
const
|
|
6207
|
-
const
|
|
6208
|
-
const
|
|
6207
|
+
const tailIds = tailSlice.map((r) => r.uniqueId);
|
|
6208
|
+
const rankedIds = tailIds.length > 0 ? [...headIds, ...tailIds] : headIds;
|
|
6209
|
+
const fused = rrfFuse([rankedIds, rankedIds, ...sideLanesAsync], options?.rrfK);
|
|
6210
|
+
const fusedHead = [...combined, ...tailSlice].map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
|
|
6211
|
+
tailSlice = [];
|
|
6212
|
+
const seen = new Set(fusedHead.map((r) => r.uniqueId));
|
|
6209
6213
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
6210
6214
|
for (const lane of sideLanesAsync) {
|
|
6211
6215
|
for (const id of lane) {
|
|
@@ -6230,7 +6234,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
6230
6234
|
const lambda = options.mmrLambda ?? 0.7;
|
|
6231
6235
|
const mmrTopN = options.mmrTopN ?? 20;
|
|
6232
6236
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
6233
|
-
const mmrCandidates = combined.slice(0, mmrTopN).map((r) => ({
|
|
6237
|
+
const mmrCandidates = [...combined, ...tailSlice].slice(0, mmrTopN).map((r) => ({
|
|
6234
6238
|
id: r.uniqueId,
|
|
6235
6239
|
score: r.similarity,
|
|
6236
6240
|
embedding: itemById2.get(r.uniqueId)?.embedding ?? [],
|
|
@@ -6238,7 +6242,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
6238
6242
|
}));
|
|
6239
6243
|
const picked = applyMMR(mmrCandidates, limit, lambda);
|
|
6240
6244
|
const pickedIds = new Set(picked.map((p) => p.id));
|
|
6241
|
-
const resultMap = new Map(combined.map((r) => [r.uniqueId, r]));
|
|
6245
|
+
const resultMap = new Map([...combined, ...tailSlice].map((r) => [r.uniqueId, r]));
|
|
6242
6246
|
const pickedResults = picked.map((p) => {
|
|
6243
6247
|
const orig = resultMap.get(p.id);
|
|
6244
6248
|
return {
|
|
@@ -6352,7 +6356,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
|
|
|
6352
6356
|
}
|
|
6353
6357
|
}
|
|
6354
6358
|
if (options?.rerank && combined.length > 0) {
|
|
6355
|
-
const rerankTopN = options.rerankTopN ??
|
|
6359
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
6356
6360
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
6357
6361
|
const headSlice = combined.slice(0, rerankTopN);
|
|
6358
6362
|
const tailSlice = combined.slice(rerankTopN);
|
|
@@ -7192,7 +7196,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
7192
7196
|
subQueries = decomp.subQueries;
|
|
7193
7197
|
}
|
|
7194
7198
|
}
|
|
7195
|
-
const { recall: recall2 } = await import("./recall-
|
|
7199
|
+
const { recall: recall2 } = await import("./recall-D6ODL36R.mjs");
|
|
7196
7200
|
let recallDegraded = [];
|
|
7197
7201
|
const result = await recall2(
|
|
7198
7202
|
query,
|
package/dist/react/index.cjs
CHANGED
|
@@ -8577,7 +8577,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
8577
8577
|
let tailSlice = [];
|
|
8578
8578
|
const itemById = new Map(items.map((i) => [i.id, i]));
|
|
8579
8579
|
if (options?.rerank) {
|
|
8580
|
-
const rerankTopN = options.rerankTopN ??
|
|
8580
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
8581
8581
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
8582
8582
|
const headSlice = v2Ranked.slice(0, rerankTopN);
|
|
8583
8583
|
const ceStart = nowMs2();
|
|
@@ -8623,9 +8623,12 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
8623
8623
|
}
|
|
8624
8624
|
if (sideLanesAsync.length > 0) {
|
|
8625
8625
|
const headIds = combined.map((r) => r.uniqueId);
|
|
8626
|
-
const
|
|
8627
|
-
const
|
|
8628
|
-
const
|
|
8626
|
+
const tailIds = tailSlice.map((r) => r.uniqueId);
|
|
8627
|
+
const rankedIds = tailIds.length > 0 ? [...headIds, ...tailIds] : headIds;
|
|
8628
|
+
const fused = rrfFuse([rankedIds, rankedIds, ...sideLanesAsync], options?.rrfK);
|
|
8629
|
+
const fusedHead = [...combined, ...tailSlice].map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
|
|
8630
|
+
tailSlice = [];
|
|
8631
|
+
const seen = new Set(fusedHead.map((r) => r.uniqueId));
|
|
8629
8632
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
8630
8633
|
for (const lane of sideLanesAsync) {
|
|
8631
8634
|
for (const id of lane) {
|
|
@@ -8650,7 +8653,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
8650
8653
|
const lambda = options.mmrLambda ?? 0.7;
|
|
8651
8654
|
const mmrTopN = options.mmrTopN ?? 20;
|
|
8652
8655
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
8653
|
-
const mmrCandidates = combined.slice(0, mmrTopN).map((r) => ({
|
|
8656
|
+
const mmrCandidates = [...combined, ...tailSlice].slice(0, mmrTopN).map((r) => ({
|
|
8654
8657
|
id: r.uniqueId,
|
|
8655
8658
|
score: r.similarity,
|
|
8656
8659
|
embedding: itemById2.get(r.uniqueId)?.embedding ?? [],
|
|
@@ -8658,7 +8661,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
8658
8661
|
}));
|
|
8659
8662
|
const picked = applyMMR(mmrCandidates, limit, lambda);
|
|
8660
8663
|
const pickedIds = new Set(picked.map((p) => p.id));
|
|
8661
|
-
const resultMap = new Map(combined.map((r) => [r.uniqueId, r]));
|
|
8664
|
+
const resultMap = new Map([...combined, ...tailSlice].map((r) => [r.uniqueId, r]));
|
|
8662
8665
|
const pickedResults = picked.map((p) => {
|
|
8663
8666
|
const orig = resultMap.get(p.id);
|
|
8664
8667
|
return {
|
|
@@ -8772,7 +8775,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
|
|
|
8772
8775
|
}
|
|
8773
8776
|
}
|
|
8774
8777
|
if (options?.rerank && combined.length > 0) {
|
|
8775
|
-
const rerankTopN = options.rerankTopN ??
|
|
8778
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
8776
8779
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
8777
8780
|
const headSlice = combined.slice(0, rerankTopN);
|
|
8778
8781
|
const tailSlice = combined.slice(rerankTopN);
|
|
@@ -9657,7 +9660,7 @@ ${formatted}`;
|
|
|
9657
9660
|
}
|
|
9658
9661
|
};
|
|
9659
9662
|
}
|
|
9660
|
-
var nowMs2, warnedProgrammaticDecomposeIgnored, SUPERSESSION_SIMILARITY_THRESHOLD, SUPERSESSION_MIN_AGE_GAP_MS, SUPERSESSION_BOOST_FACTOR, SUPERSESSION_MAX_WINDOW, EMBEDDINGS_DEGRADED_EMPTY_NO_LEXICAL;
|
|
9663
|
+
var DEFAULT_RERANK_TOP_N, nowMs2, warnedProgrammaticDecomposeIgnored, SUPERSESSION_SIMILARITY_THRESHOLD, SUPERSESSION_MIN_AGE_GAP_MS, SUPERSESSION_BOOST_FACTOR, SUPERSESSION_MAX_WINDOW, EMBEDDINGS_DEGRADED_EMPTY_NO_LEXICAL;
|
|
9661
9664
|
var init_searchTool = __esm({
|
|
9662
9665
|
"src/lib/memoryVault/searchTool.ts"() {
|
|
9663
9666
|
"use strict";
|
|
@@ -9675,6 +9678,7 @@ var init_searchTool = __esm({
|
|
|
9675
9678
|
init_bm25();
|
|
9676
9679
|
init_decomposeQuery();
|
|
9677
9680
|
init_lruCache();
|
|
9681
|
+
DEFAULT_RERANK_TOP_N = 5;
|
|
9678
9682
|
nowMs2 = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
9679
9683
|
warnedProgrammaticDecomposeIgnored = false;
|
|
9680
9684
|
SUPERSESSION_SIMILARITY_THRESHOLD = 0.7;
|
package/dist/react/index.d.mts
CHANGED
|
@@ -6644,7 +6644,7 @@ interface MemoryVaultSearchOptions {
|
|
|
6644
6644
|
* When true, switches to the async pipeline (rankFusedVaultMemoriesAsync).
|
|
6645
6645
|
*/
|
|
6646
6646
|
rerank?: boolean;
|
|
6647
|
-
/** Number of CE rerank candidates. Default
|
|
6647
|
+
/** Number of CE rerank candidates. Default 5 ({@link DEFAULT_RERANK_TOP_N}). */
|
|
6648
6648
|
rerankTopN?: number;
|
|
6649
6649
|
/** Multiplicative cross-encoder blend weight. Default 0.1. Only used when `rerank` is true. */
|
|
6650
6650
|
ceWeight?: number;
|
|
@@ -6999,7 +6999,8 @@ interface RecallOptions {
|
|
|
6999
6999
|
* swallowed (diagnostics must never break retrieval). Off unless provided.
|
|
7000
7000
|
*/
|
|
7001
7001
|
onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
|
|
7002
|
-
/** Number of candidates fed to the cross-encoder rerank stage. Default:
|
|
7002
|
+
/** Number of candidates fed to the cross-encoder rerank stage. Default: 5;
|
|
7003
|
+
* was 30 until 2026-08-13 — see anuma-ai/sdk#845. */
|
|
7003
7004
|
rerankTopN?: number;
|
|
7004
7005
|
/** Multiplicative cross-encoder blend weight. Default: 0.1. */
|
|
7005
7006
|
ceWeight?: number;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -6644,7 +6644,7 @@ interface MemoryVaultSearchOptions {
|
|
|
6644
6644
|
* When true, switches to the async pipeline (rankFusedVaultMemoriesAsync).
|
|
6645
6645
|
*/
|
|
6646
6646
|
rerank?: boolean;
|
|
6647
|
-
/** Number of CE rerank candidates. Default
|
|
6647
|
+
/** Number of CE rerank candidates. Default 5 ({@link DEFAULT_RERANK_TOP_N}). */
|
|
6648
6648
|
rerankTopN?: number;
|
|
6649
6649
|
/** Multiplicative cross-encoder blend weight. Default 0.1. Only used when `rerank` is true. */
|
|
6650
6650
|
ceWeight?: number;
|
|
@@ -6999,7 +6999,8 @@ interface RecallOptions {
|
|
|
6999
6999
|
* swallowed (diagnostics must never break retrieval). Off unless provided.
|
|
7000
7000
|
*/
|
|
7001
7001
|
onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
|
|
7002
|
-
/** Number of candidates fed to the cross-encoder rerank stage. Default:
|
|
7002
|
+
/** Number of candidates fed to the cross-encoder rerank stage. Default: 5;
|
|
7003
|
+
* was 30 until 2026-08-13 — see anuma-ai/sdk#845. */
|
|
7003
7004
|
rerankTopN?: number;
|
|
7004
7005
|
/** Multiplicative cross-encoder blend weight. Default: 0.1. */
|
|
7005
7006
|
ceWeight?: number;
|
package/dist/react/index.mjs
CHANGED
|
@@ -19658,6 +19658,7 @@ function createVaultEmbeddingCache(maxSize = DEFAULT_VAULT_CACHE_SIZE) {
|
|
|
19658
19658
|
}
|
|
19659
19659
|
|
|
19660
19660
|
// src/lib/memoryVault/searchTool.ts
|
|
19661
|
+
var DEFAULT_RERANK_TOP_N = 5;
|
|
19661
19662
|
var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
19662
19663
|
var warnedProgrammaticDecomposeIgnored = false;
|
|
19663
19664
|
function normalizeEventTimeKind(kind) {
|
|
@@ -19888,7 +19889,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
19888
19889
|
let tailSlice = [];
|
|
19889
19890
|
const itemById = new Map(items.map((i) => [i.id, i]));
|
|
19890
19891
|
if (options?.rerank) {
|
|
19891
|
-
const rerankTopN = options.rerankTopN ??
|
|
19892
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
19892
19893
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
19893
19894
|
const headSlice = v2Ranked.slice(0, rerankTopN);
|
|
19894
19895
|
const ceStart = nowMs();
|
|
@@ -19934,9 +19935,12 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
19934
19935
|
}
|
|
19935
19936
|
if (sideLanesAsync.length > 0) {
|
|
19936
19937
|
const headIds = combined.map((r) => r.uniqueId);
|
|
19937
|
-
const
|
|
19938
|
-
const
|
|
19939
|
-
const
|
|
19938
|
+
const tailIds = tailSlice.map((r) => r.uniqueId);
|
|
19939
|
+
const rankedIds = tailIds.length > 0 ? [...headIds, ...tailIds] : headIds;
|
|
19940
|
+
const fused = rrfFuse([rankedIds, rankedIds, ...sideLanesAsync], options?.rrfK);
|
|
19941
|
+
const fusedHead = [...combined, ...tailSlice].map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
|
|
19942
|
+
tailSlice = [];
|
|
19943
|
+
const seen = new Set(fusedHead.map((r) => r.uniqueId));
|
|
19940
19944
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
19941
19945
|
for (const lane of sideLanesAsync) {
|
|
19942
19946
|
for (const id of lane) {
|
|
@@ -19961,7 +19965,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
19961
19965
|
const lambda = options.mmrLambda ?? 0.7;
|
|
19962
19966
|
const mmrTopN = options.mmrTopN ?? 20;
|
|
19963
19967
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
19964
|
-
const mmrCandidates = combined.slice(0, mmrTopN).map((r) => ({
|
|
19968
|
+
const mmrCandidates = [...combined, ...tailSlice].slice(0, mmrTopN).map((r) => ({
|
|
19965
19969
|
id: r.uniqueId,
|
|
19966
19970
|
score: r.similarity,
|
|
19967
19971
|
embedding: itemById2.get(r.uniqueId)?.embedding ?? [],
|
|
@@ -19969,7 +19973,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
19969
19973
|
}));
|
|
19970
19974
|
const picked = applyMMR(mmrCandidates, limit, lambda);
|
|
19971
19975
|
const pickedIds = new Set(picked.map((p) => p.id));
|
|
19972
|
-
const resultMap = new Map(combined.map((r) => [r.uniqueId, r]));
|
|
19976
|
+
const resultMap = new Map([...combined, ...tailSlice].map((r) => [r.uniqueId, r]));
|
|
19973
19977
|
const pickedResults = picked.map((p) => {
|
|
19974
19978
|
const orig = resultMap.get(p.id);
|
|
19975
19979
|
return {
|
|
@@ -20083,7 +20087,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
|
|
|
20083
20087
|
}
|
|
20084
20088
|
}
|
|
20085
20089
|
if (options?.rerank && combined.length > 0) {
|
|
20086
|
-
const rerankTopN = options.rerankTopN ??
|
|
20090
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
20087
20091
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
20088
20092
|
const headSlice = combined.slice(0, rerankTopN);
|
|
20089
20093
|
const tailSlice = combined.slice(rerankTopN);
|
|
@@ -20923,7 +20927,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
20923
20927
|
subQueries = decomp.subQueries;
|
|
20924
20928
|
}
|
|
20925
20929
|
}
|
|
20926
|
-
const { recall: recall2 } = await import("./recall-
|
|
20930
|
+
const { recall: recall2 } = await import("./recall-NLCZUGXN.mjs");
|
|
20927
20931
|
let recallDegraded = [];
|
|
20928
20932
|
const result = await recall2(
|
|
20929
20933
|
query,
|
package/dist/server/index.cjs
CHANGED
|
@@ -22283,7 +22283,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
22283
22283
|
let tailSlice = [];
|
|
22284
22284
|
const itemById = new Map(items.map((i) => [i.id, i]));
|
|
22285
22285
|
if (options?.rerank) {
|
|
22286
|
-
const rerankTopN = options.rerankTopN ??
|
|
22286
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
22287
22287
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
22288
22288
|
const headSlice = v2Ranked.slice(0, rerankTopN);
|
|
22289
22289
|
const ceStart = nowMs2();
|
|
@@ -22329,9 +22329,12 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
22329
22329
|
}
|
|
22330
22330
|
if (sideLanesAsync.length > 0) {
|
|
22331
22331
|
const headIds = combined.map((r) => r.uniqueId);
|
|
22332
|
-
const
|
|
22333
|
-
const
|
|
22334
|
-
const
|
|
22332
|
+
const tailIds = tailSlice.map((r) => r.uniqueId);
|
|
22333
|
+
const rankedIds = tailIds.length > 0 ? [...headIds, ...tailIds] : headIds;
|
|
22334
|
+
const fused = rrfFuse([rankedIds, rankedIds, ...sideLanesAsync], options?.rrfK);
|
|
22335
|
+
const fusedHead = [...combined, ...tailSlice].map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
|
|
22336
|
+
tailSlice = [];
|
|
22337
|
+
const seen = new Set(fusedHead.map((r) => r.uniqueId));
|
|
22335
22338
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
22336
22339
|
for (const lane of sideLanesAsync) {
|
|
22337
22340
|
for (const id of lane) {
|
|
@@ -22356,7 +22359,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
22356
22359
|
const lambda = options.mmrLambda ?? 0.7;
|
|
22357
22360
|
const mmrTopN = options.mmrTopN ?? 20;
|
|
22358
22361
|
const itemById2 = new Map(items.map((i) => [i.id, i]));
|
|
22359
|
-
const mmrCandidates = combined.slice(0, mmrTopN).map((r) => ({
|
|
22362
|
+
const mmrCandidates = [...combined, ...tailSlice].slice(0, mmrTopN).map((r) => ({
|
|
22360
22363
|
id: r.uniqueId,
|
|
22361
22364
|
score: r.similarity,
|
|
22362
22365
|
embedding: itemById2.get(r.uniqueId)?.embedding ?? [],
|
|
@@ -22364,7 +22367,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
|
|
|
22364
22367
|
}));
|
|
22365
22368
|
const picked = applyMMR(mmrCandidates, limit, lambda);
|
|
22366
22369
|
const pickedIds = new Set(picked.map((p) => p.id));
|
|
22367
|
-
const resultMap = new Map(combined.map((r) => [r.uniqueId, r]));
|
|
22370
|
+
const resultMap = new Map([...combined, ...tailSlice].map((r) => [r.uniqueId, r]));
|
|
22368
22371
|
const pickedResults = picked.map((p) => {
|
|
22369
22372
|
const orig = resultMap.get(p.id);
|
|
22370
22373
|
return {
|
|
@@ -22478,7 +22481,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
|
|
|
22478
22481
|
}
|
|
22479
22482
|
}
|
|
22480
22483
|
if (options?.rerank && combined.length > 0) {
|
|
22481
|
-
const rerankTopN = options.rerankTopN ??
|
|
22484
|
+
const rerankTopN = options.rerankTopN ?? DEFAULT_RERANK_TOP_N;
|
|
22482
22485
|
const ceWeight = options.ceWeight ?? 0.1;
|
|
22483
22486
|
const headSlice = combined.slice(0, rerankTopN);
|
|
22484
22487
|
const tailSlice = combined.slice(rerankTopN);
|
|
@@ -23363,7 +23366,7 @@ ${formatted}`;
|
|
|
23363
23366
|
}
|
|
23364
23367
|
};
|
|
23365
23368
|
}
|
|
23366
|
-
var nowMs2, warnedProgrammaticDecomposeIgnored, SUPERSESSION_SIMILARITY_THRESHOLD, SUPERSESSION_MIN_AGE_GAP_MS, SUPERSESSION_BOOST_FACTOR, SUPERSESSION_MAX_WINDOW, EMBEDDINGS_DEGRADED_EMPTY_NO_LEXICAL;
|
|
23369
|
+
var DEFAULT_RERANK_TOP_N, nowMs2, warnedProgrammaticDecomposeIgnored, SUPERSESSION_SIMILARITY_THRESHOLD, SUPERSESSION_MIN_AGE_GAP_MS, SUPERSESSION_BOOST_FACTOR, SUPERSESSION_MAX_WINDOW, EMBEDDINGS_DEGRADED_EMPTY_NO_LEXICAL;
|
|
23367
23370
|
var init_searchTool = __esm({
|
|
23368
23371
|
"src/lib/memoryVault/searchTool.ts"() {
|
|
23369
23372
|
"use strict";
|
|
@@ -23381,6 +23384,7 @@ var init_searchTool = __esm({
|
|
|
23381
23384
|
init_bm25();
|
|
23382
23385
|
init_decomposeQuery();
|
|
23383
23386
|
init_lruCache();
|
|
23387
|
+
DEFAULT_RERANK_TOP_N = 5;
|
|
23384
23388
|
nowMs2 = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
23385
23389
|
warnedProgrammaticDecomposeIgnored = false;
|
|
23386
23390
|
SUPERSESSION_SIMILARITY_THRESHOLD = 0.7;
|
package/dist/server/index.d.mts
CHANGED
|
@@ -5230,7 +5230,7 @@ interface MemoryVaultSearchOptions {
|
|
|
5230
5230
|
* When true, switches to the async pipeline (rankFusedVaultMemoriesAsync).
|
|
5231
5231
|
*/
|
|
5232
5232
|
rerank?: boolean;
|
|
5233
|
-
/** Number of CE rerank candidates. Default
|
|
5233
|
+
/** Number of CE rerank candidates. Default 5 ({@link DEFAULT_RERANK_TOP_N}). */
|
|
5234
5234
|
rerankTopN?: number;
|
|
5235
5235
|
/** Multiplicative cross-encoder blend weight. Default 0.1. Only used when `rerank` is true. */
|
|
5236
5236
|
ceWeight?: number;
|
|
@@ -5585,7 +5585,8 @@ interface RecallOptions {
|
|
|
5585
5585
|
* swallowed (diagnostics must never break retrieval). Off unless provided.
|
|
5586
5586
|
*/
|
|
5587
5587
|
onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
|
|
5588
|
-
/** Number of candidates fed to the cross-encoder rerank stage. Default:
|
|
5588
|
+
/** Number of candidates fed to the cross-encoder rerank stage. Default: 5;
|
|
5589
|
+
* was 30 until 2026-08-13 — see anuma-ai/sdk#845. */
|
|
5589
5590
|
rerankTopN?: number;
|
|
5590
5591
|
/** Multiplicative cross-encoder blend weight. Default: 0.1. */
|
|
5591
5592
|
ceWeight?: number;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -5230,7 +5230,7 @@ interface MemoryVaultSearchOptions {
|
|
|
5230
5230
|
* When true, switches to the async pipeline (rankFusedVaultMemoriesAsync).
|
|
5231
5231
|
*/
|
|
5232
5232
|
rerank?: boolean;
|
|
5233
|
-
/** Number of CE rerank candidates. Default
|
|
5233
|
+
/** Number of CE rerank candidates. Default 5 ({@link DEFAULT_RERANK_TOP_N}). */
|
|
5234
5234
|
rerankTopN?: number;
|
|
5235
5235
|
/** Multiplicative cross-encoder blend weight. Default 0.1. Only used when `rerank` is true. */
|
|
5236
5236
|
ceWeight?: number;
|
|
@@ -5585,7 +5585,8 @@ interface RecallOptions {
|
|
|
5585
5585
|
* swallowed (diagnostics must never break retrieval). Off unless provided.
|
|
5586
5586
|
*/
|
|
5587
5587
|
onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
|
|
5588
|
-
/** Number of candidates fed to the cross-encoder rerank stage. Default:
|
|
5588
|
+
/** Number of candidates fed to the cross-encoder rerank stage. Default: 5;
|
|
5589
|
+
* was 30 until 2026-08-13 — see anuma-ai/sdk#845. */
|
|
5589
5590
|
rerankTopN?: number;
|
|
5590
5591
|
/** Multiplicative cross-encoder blend weight. Default: 0.1. */
|
|
5591
5592
|
ceWeight?: number;
|
package/dist/server/index.mjs
CHANGED