@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.
@@ -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 ?? 30;
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 fused = rrfFuse([headIds, headIds, ...sideLanesAsync], options?.rrfK);
5923
- const fusedHead = combined.map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
5924
- const seen = new Set(combined.map((r) => r.uniqueId));
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 ?? 30;
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-B3PUQHJK.mjs");
6915
+ const { recall: recall2 } = await import("./recall-PI7FZQNO.mjs");
6912
6916
  let recallDegraded = [];
6913
6917
  const result = await recall2(
6914
6918
  query,
@@ -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 ?? 30;
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 fused = rrfFuse([headIds, headIds, ...sideLanesAsync], options?.rrfK);
8343
- const fusedHead = combined.map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
8344
- const seen = new Set(combined.map((r) => r.uniqueId));
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 ?? 30;
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;
@@ -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 30. */
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: 30. */
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;
@@ -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 30. */
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: 30. */
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;
@@ -133,7 +133,7 @@ import {
133
133
  upsertMessageOp,
134
134
  useEncryption,
135
135
  vaultMemoryToStored
136
- } from "./chunk-L253L67R.mjs";
136
+ } from "./chunk-GRU24OP4.mjs";
137
137
  import {
138
138
  PII_PATTERNS,
139
139
  PiiRedactor,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-L253L67R.mjs";
3
+ } from "./chunk-GRU24OP4.mjs";
4
4
  import "./chunk-WUG6GTHO.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -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 ?? 30;
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 fused = rrfFuse([headIds, headIds, ...sideLanesAsync], options?.rrfK);
6207
- const fusedHead = combined.map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
6208
- const seen = new Set(combined.map((r) => r.uniqueId));
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 ?? 30;
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-WPYCG4ED.mjs");
7199
+ const { recall: recall2 } = await import("./recall-D6ODL36R.mjs");
7196
7200
  let recallDegraded = [];
7197
7201
  const result = await recall2(
7198
7202
  query,
@@ -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 ?? 30;
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 fused = rrfFuse([headIds, headIds, ...sideLanesAsync], options?.rrfK);
8627
- const fusedHead = combined.map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
8628
- const seen = new Set(combined.map((r) => r.uniqueId));
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 ?? 30;
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;
@@ -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 30. */
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: 30. */
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;
@@ -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 30. */
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: 30. */
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;
@@ -179,7 +179,7 @@ import {
179
179
  updateVaultMemoryOp,
180
180
  useEncryption,
181
181
  vaultMemoryToStored
182
- } from "./chunk-JRJRRO4P.mjs";
182
+ } from "./chunk-2EEPAOHJ.mjs";
183
183
  import {
184
184
  PiiRedactor,
185
185
  createStreamingDeAnonymizer,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-JRJRRO4P.mjs";
3
+ } from "./chunk-2EEPAOHJ.mjs";
4
4
  import "./chunk-WUG6GTHO.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -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 ?? 30;
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 fused = rrfFuse([headIds, headIds, ...sideLanesAsync], options?.rrfK);
19938
- const fusedHead = combined.map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
19939
- const seen = new Set(combined.map((r) => r.uniqueId));
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 ?? 30;
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-JPIWNKA7.mjs");
20930
+ const { recall: recall2 } = await import("./recall-NLCZUGXN.mjs");
20927
20931
  let recallDegraded = [];
20928
20932
  const result = await recall2(
20929
20933
  query,
@@ -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 ?? 30;
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 fused = rrfFuse([headIds, headIds, ...sideLanesAsync], options?.rrfK);
22333
- const fusedHead = combined.map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
22334
- const seen = new Set(combined.map((r) => r.uniqueId));
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 ?? 30;
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;
@@ -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 30. */
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: 30. */
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;
@@ -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 30. */
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: 30. */
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;
@@ -141,7 +141,7 @@ import {
141
141
  updateVaultMemoryOp,
142
142
  upsertMessageOp,
143
143
  vaultMemoryToStored
144
- } from "./chunk-2A6HXY4P.mjs";
144
+ } from "./chunk-SPHKT76E.mjs";
145
145
  import {
146
146
  createStreamingDeAnonymizer,
147
147
  notifyConsolidationFallback,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-2A6HXY4P.mjs";
3
+ } from "./chunk-SPHKT76E.mjs";
4
4
  import "./chunk-YXL5VKCO.mjs";
5
5
  import "./chunk-3RPGXXPZ.mjs";
6
6
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "6.19.0",
3
+ "version": "6.19.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",