@anuma/sdk 6.19.0 → 6.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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-M53NXLZS.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-M53NXLZS.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-M3KBKU74.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-X5EZQFGR.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-X5EZQFGR.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.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -166,7 +166,7 @@
166
166
  "homepage": "https://github.com/anuma-ai/sdk#readme",
167
167
  "packageManager": "pnpm@10.23.0",
168
168
  "dependencies": {
169
- "@anuma/portal": "1.0.0-next.20260815023541",
169
+ "@anuma/portal": "1.0.0-next.20260901170209",
170
170
  "@babel/parser": "^7.29.2",
171
171
  "@babel/types": "^7.29.0",
172
172
  "ai": "6.0.202",