@anuma/sdk 3.9.5 → 3.9.6

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.
@@ -4485,24 +4485,25 @@ function tokenize(text) {
4485
4485
  if (!m) return [];
4486
4486
  return m.filter((t) => !STOPWORDS.has(t));
4487
4487
  }
4488
- function scoreBM25(query, items) {
4489
- const queryTerms = tokenize(query);
4490
- if (queryTerms.length === 0 || items.length === 0) return /* @__PURE__ */ new Map();
4488
+ function prepareBM25Corpus(items) {
4489
+ const ids = items.map((i) => i.id);
4491
4490
  const docTokens = items.map((i) => tokenize(i.content));
4492
4491
  const docLens = docTokens.map((t) => t.length);
4493
- const avgdl = docLens.reduce((a, b) => a + b, 0) / docLens.length;
4494
- const queryTermSet = new Set(queryTerms);
4492
+ const avgdl = docLens.length ? docLens.reduce((a, b) => a + b, 0) / docLens.length : 0;
4495
4493
  const df = /* @__PURE__ */ new Map();
4496
4494
  for (const tokens of docTokens) {
4497
- const seen = /* @__PURE__ */ new Set();
4498
- for (const t of tokens) {
4499
- if (queryTermSet.has(t)) seen.add(t);
4500
- }
4495
+ const seen = new Set(tokens);
4501
4496
  for (const t of seen) df.set(t, (df.get(t) ?? 0) + 1);
4502
4497
  }
4503
- const N = items.length;
4498
+ return { ids, docTokens, docLens, avgdl, df, n: items.length };
4499
+ }
4500
+ function scoreBM25Prepared(query, corpus) {
4501
+ const queryTerms = tokenize(query);
4504
4502
  const scores = /* @__PURE__ */ new Map();
4505
- for (let i = 0; i < items.length; i++) {
4503
+ if (queryTerms.length === 0 || corpus.n === 0) return scores;
4504
+ const queryTermSet = new Set(queryTerms);
4505
+ const { ids, docTokens, docLens, avgdl, df, n: N } = corpus;
4506
+ for (let i = 0; i < N; i++) {
4506
4507
  const tokens = docTokens[i];
4507
4508
  const dl = docLens[i];
4508
4509
  if (dl === 0) continue;
@@ -4518,10 +4519,15 @@ function scoreBM25(query, items) {
4518
4519
  const tfNorm = f * (K1 + 1) / (f + K1 * (1 - B + B * dl / avgdl));
4519
4520
  score += idf * tfNorm;
4520
4521
  }
4521
- scores.set(items[i].id, score);
4522
+ scores.set(ids[i], score);
4522
4523
  }
4523
4524
  return scores;
4524
4525
  }
4526
+ function scoreBM25(query, items) {
4527
+ if (items.length === 0) return /* @__PURE__ */ new Map();
4528
+ if (tokenize(query).length === 0) return /* @__PURE__ */ new Map();
4529
+ return scoreBM25Prepared(query, prepareBM25Corpus(items));
4530
+ }
4525
4531
 
4526
4532
  // src/lib/memoryVault/decomposeQuery.ts
4527
4533
  var DEFAULT_MODEL = "inclusionai/ling-2.6-flash";
@@ -4776,7 +4782,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
4776
4782
  }
4777
4783
  });
4778
4784
  const baseIds = new Set(baseRanked.map((r) => r.uniqueId));
4779
- const bm25Scores = scoreBM25(
4785
+ const bm25Scores = options?.preparedBM25Corpus ? scoreBM25Prepared(query, options.preparedBM25Corpus) : scoreBM25(
4780
4786
  query,
4781
4787
  items.map((i) => ({ id: i.id, content: i.content }))
4782
4788
  );
@@ -4973,7 +4979,11 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
4973
4979
  const limit = options?.limit ?? 5;
4974
4980
  const perFacetTopN = options?.perFacetTopN ?? 10;
4975
4981
  if (items.length === 0 || subQueries.length === 0) return [];
4982
+ const preparedBM25Corpus = prepareBM25Corpus(
4983
+ items.map((i) => ({ id: i.id, content: i.content }))
4984
+ );
4976
4985
  const facetTuning = {
4986
+ preparedBM25Corpus,
4977
4987
  ...options?.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
4978
4988
  ...options?.recency && { recency: options.recency },
4979
4989
  ...options?.supersessionBoost !== void 0 && {
@@ -5648,7 +5658,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
5648
5658
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
5649
5659
  );
5650
5660
  }
5651
- const { recall: recall2 } = await import("./recall-I5AZFOUM.mjs");
5661
+ const { recall: recall2 } = await import("./recall-JA6SOQRR.mjs");
5652
5662
  const result = await recall2(
5653
5663
  query,
5654
5664
  { vaultCtx, embeddingOptions, vaultCache: cache },
@@ -8,7 +8,7 @@ import {
8
8
  import "./chunk-GYKJOWEO.mjs";
9
9
 
10
10
  // src/lib/memory/consolidate.ts
11
- var DEFAULT_MODEL = "inclusionai/ling-2.6-flash";
11
+ var DEFAULT_CONSOLIDATION_MODEL = "inclusionai/ling-2.6-flash";
12
12
  var DEFAULT_CONSOLIDATE_ATTEMPTS = 3;
13
13
  var DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS = 2e4;
14
14
  var SYSTEM_PROMPT = `You consolidate a new memory against existing memories from the same user.
@@ -70,7 +70,7 @@ ${candidateText}`;
70
70
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
71
71
  ...options.getToken !== void 0 && { getToken: options.getToken },
72
72
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
73
- model: options.model ?? DEFAULT_MODEL,
73
+ model: options.model ?? DEFAULT_CONSOLIDATION_MODEL,
74
74
  systemPrompt: SYSTEM_PROMPT,
75
75
  userMessage,
76
76
  tag: "memory/consolidate",
@@ -147,5 +147,6 @@ function validate(parsed, newContent, validIds) {
147
147
  return { action: "update", targetId, content: c };
148
148
  }
149
149
  export {
150
+ DEFAULT_CONSOLIDATION_MODEL,
150
151
  consolidateMemory
151
152
  };
@@ -5568,24 +5568,25 @@ function tokenize(text12) {
5568
5568
  if (!m) return [];
5569
5569
  return m.filter((t) => !STOPWORDS.has(t));
5570
5570
  }
5571
- function scoreBM25(query, items) {
5572
- const queryTerms = tokenize(query);
5573
- if (queryTerms.length === 0 || items.length === 0) return /* @__PURE__ */ new Map();
5571
+ function prepareBM25Corpus(items) {
5572
+ const ids = items.map((i) => i.id);
5574
5573
  const docTokens = items.map((i) => tokenize(i.content));
5575
5574
  const docLens = docTokens.map((t) => t.length);
5576
- const avgdl = docLens.reduce((a, b) => a + b, 0) / docLens.length;
5577
- const queryTermSet = new Set(queryTerms);
5575
+ const avgdl = docLens.length ? docLens.reduce((a, b) => a + b, 0) / docLens.length : 0;
5578
5576
  const df = /* @__PURE__ */ new Map();
5579
5577
  for (const tokens of docTokens) {
5580
- const seen = /* @__PURE__ */ new Set();
5581
- for (const t of tokens) {
5582
- if (queryTermSet.has(t)) seen.add(t);
5583
- }
5578
+ const seen = new Set(tokens);
5584
5579
  for (const t of seen) df.set(t, (df.get(t) ?? 0) + 1);
5585
5580
  }
5586
- const N = items.length;
5581
+ return { ids, docTokens, docLens, avgdl, df, n: items.length };
5582
+ }
5583
+ function scoreBM25Prepared(query, corpus) {
5584
+ const queryTerms = tokenize(query);
5587
5585
  const scores = /* @__PURE__ */ new Map();
5588
- for (let i = 0; i < items.length; i++) {
5586
+ if (queryTerms.length === 0 || corpus.n === 0) return scores;
5587
+ const queryTermSet = new Set(queryTerms);
5588
+ const { ids, docTokens, docLens, avgdl, df, n: N } = corpus;
5589
+ for (let i = 0; i < N; i++) {
5589
5590
  const tokens = docTokens[i];
5590
5591
  const dl = docLens[i];
5591
5592
  if (dl === 0) continue;
@@ -5601,10 +5602,15 @@ function scoreBM25(query, items) {
5601
5602
  const tfNorm = f * (K1 + 1) / (f + K1 * (1 - B + B * dl / avgdl));
5602
5603
  score += idf * tfNorm;
5603
5604
  }
5604
- scores.set(items[i].id, score);
5605
+ scores.set(ids[i], score);
5605
5606
  }
5606
5607
  return scores;
5607
5608
  }
5609
+ function scoreBM25(query, items) {
5610
+ if (items.length === 0) return /* @__PURE__ */ new Map();
5611
+ if (tokenize(query).length === 0) return /* @__PURE__ */ new Map();
5612
+ return scoreBM25Prepared(query, prepareBM25Corpus(items));
5613
+ }
5608
5614
  var K1, B, TOKEN_RE, STOPWORDS;
5609
5615
  var init_bm25 = __esm({
5610
5616
  "src/lib/memoryVault/bm25.ts"() {
@@ -6925,7 +6931,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
6925
6931
  }
6926
6932
  });
6927
6933
  const baseIds = new Set(baseRanked.map((r) => r.uniqueId));
6928
- const bm25Scores = scoreBM25(
6934
+ const bm25Scores = options?.preparedBM25Corpus ? scoreBM25Prepared(query, options.preparedBM25Corpus) : scoreBM25(
6929
6935
  query,
6930
6936
  items.map((i) => ({ id: i.id, content: i.content }))
6931
6937
  );
@@ -7122,7 +7128,11 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
7122
7128
  const limit = options?.limit ?? 5;
7123
7129
  const perFacetTopN = options?.perFacetTopN ?? 10;
7124
7130
  if (items.length === 0 || subQueries.length === 0) return [];
7131
+ const preparedBM25Corpus = prepareBM25Corpus(
7132
+ items.map((i) => ({ id: i.id, content: i.content }))
7133
+ );
7125
7134
  const facetTuning = {
7135
+ preparedBM25Corpus,
7126
7136
  ...options?.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
7127
7137
  ...options?.recency && { recency: options.recency },
7128
7138
  ...options?.supersessionBoost !== void 0 && {
@@ -7868,6 +7878,7 @@ var init_searchTool = __esm({
7868
7878
  // src/lib/memory/consolidate.ts
7869
7879
  var consolidate_exports = {};
7870
7880
  __export(consolidate_exports, {
7881
+ DEFAULT_CONSOLIDATION_MODEL: () => DEFAULT_CONSOLIDATION_MODEL,
7871
7882
  consolidateMemory: () => consolidateMemory
7872
7883
  });
7873
7884
  async function consolidateMemory(newContent, candidates, options) {
@@ -7896,7 +7907,7 @@ ${candidateText}`;
7896
7907
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
7897
7908
  ...options.getToken !== void 0 && { getToken: options.getToken },
7898
7909
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
7899
- model: options.model ?? DEFAULT_MODEL3,
7910
+ model: options.model ?? DEFAULT_CONSOLIDATION_MODEL,
7900
7911
  systemPrompt: SYSTEM_PROMPT3,
7901
7912
  userMessage,
7902
7913
  tag: "memory/consolidate",
@@ -7972,14 +7983,14 @@ function validate2(parsed, newContent, validIds) {
7972
7983
  if (!targetId || !validIds.has(targetId)) return null;
7973
7984
  return { action: "update", targetId, content: c };
7974
7985
  }
7975
- var DEFAULT_MODEL3, DEFAULT_CONSOLIDATE_ATTEMPTS, DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS, SYSTEM_PROMPT3;
7986
+ var DEFAULT_CONSOLIDATION_MODEL, DEFAULT_CONSOLIDATE_ATTEMPTS, DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS, SYSTEM_PROMPT3;
7976
7987
  var init_consolidate = __esm({
7977
7988
  "src/lib/memory/consolidate.ts"() {
7978
7989
  "use strict";
7979
7990
  init_logger();
7980
7991
  init_redactor();
7981
7992
  init_portalLlm();
7982
- DEFAULT_MODEL3 = "inclusionai/ling-2.6-flash";
7993
+ DEFAULT_CONSOLIDATION_MODEL = "inclusionai/ling-2.6-flash";
7983
7994
  DEFAULT_CONSOLIDATE_ATTEMPTS = 3;
7984
7995
  DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS = 2e4;
7985
7996
  SYSTEM_PROMPT3 = `You consolidate a new memory against existing memories from the same user.
@@ -15513,7 +15524,7 @@ function classifyDecay(m, now, policy) {
15513
15524
  init_logger();
15514
15525
  init_redactor();
15515
15526
  init_portalLlm();
15516
- var DEFAULT_MODEL4 = "inclusionai/ling-2.6-flash";
15527
+ var DEFAULT_MODEL3 = "inclusionai/ling-2.6-flash";
15517
15528
  var DEFAULT_ATTEMPTS2 = 2;
15518
15529
  var DEFAULT_TOTAL_TIMEOUT_MS2 = 12e3;
15519
15530
  var MAX_CONTENT_CHARS = 400;
@@ -15552,7 +15563,7 @@ function createLlmDecayClassifier(options) {
15552
15563
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
15553
15564
  ...options.getToken !== void 0 && { getToken: options.getToken },
15554
15565
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
15555
- model: options.model ?? DEFAULT_MODEL4,
15566
+ model: options.model ?? DEFAULT_MODEL3,
15556
15567
  systemPrompt: SYSTEM_PROMPT5,
15557
15568
  userMessage: `Memory content:
15558
15569
  ${safe}
@@ -15985,7 +15996,7 @@ init_logger();
15985
15996
  init_portalLlm();
15986
15997
  init_recall();
15987
15998
  var DEFAULT_BASE_URL2 = BASE_URL;
15988
- var DEFAULT_MODEL5 = "anthropic/claude-sonnet-4-6";
15999
+ var DEFAULT_MODEL4 = "anthropic/claude-sonnet-4-6";
15989
16000
  var DEFAULT_MAX_TOKENS = 4096;
15990
16001
  var REQUEST_TIMEOUT_MS = 6e4;
15991
16002
  var DEFAULT_SYSTEM_PROMPT = `You are a personal assistant with access to the user's memory. Answer the user's question using the supplied memories as evidence.
@@ -16017,7 +16028,7 @@ async function reflect(query, ctx, options) {
16017
16028
  const evidence = recalledMemories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
16018
16029
  ${m.content}`).join("\n\n");
16019
16030
  const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL2;
16020
- const model = options.llmModel ?? DEFAULT_MODEL5;
16031
+ const model = options.llmModel ?? DEFAULT_MODEL4;
16021
16032
  const wantsStructured = !!options.responseSchema;
16022
16033
  const sendResponseFormat = wantsStructured && supportsResponseFormat(model, "json_schema");
16023
16034
  const basePrompt = options.systemPrompt ?? DEFAULT_SYSTEM_PROMPT;
@@ -110,7 +110,7 @@ import {
110
110
  upsertMessageOp,
111
111
  useEncryption,
112
112
  vaultMemoryToStored
113
- } from "./chunk-HXBDHRKJ.mjs";
113
+ } from "./chunk-FFB4CDPC.mjs";
114
114
  import {
115
115
  PII_PATTERNS,
116
116
  PiiRedactor,
@@ -6598,7 +6598,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
6598
6598
  content: m.content,
6599
6599
  similarity: m.similarity
6600
6600
  }));
6601
- const { consolidateMemory: doConsolidate } = await import("./consolidate-HKN32P5W.mjs");
6601
+ const { consolidateMemory: doConsolidate } = await import("./consolidate-NC5DOC5J.mjs");
6602
6602
  const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
6603
6603
  if (decision.action === "create") return null;
6604
6604
  if (decision.action === "supersede" && decision.content) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-IWR7BNER.mjs";
3
+ } from "./chunk-FFB4CDPC.mjs";
4
4
  import "./chunk-BOY27A2C.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -4786,24 +4786,25 @@ function tokenize(text) {
4786
4786
  if (!m) return [];
4787
4787
  return m.filter((t) => !STOPWORDS.has(t));
4788
4788
  }
4789
- function scoreBM25(query, items) {
4790
- const queryTerms = tokenize(query);
4791
- if (queryTerms.length === 0 || items.length === 0) return /* @__PURE__ */ new Map();
4789
+ function prepareBM25Corpus(items) {
4790
+ const ids = items.map((i) => i.id);
4792
4791
  const docTokens = items.map((i) => tokenize(i.content));
4793
4792
  const docLens = docTokens.map((t) => t.length);
4794
- const avgdl = docLens.reduce((a, b) => a + b, 0) / docLens.length;
4795
- const queryTermSet = new Set(queryTerms);
4793
+ const avgdl = docLens.length ? docLens.reduce((a, b) => a + b, 0) / docLens.length : 0;
4796
4794
  const df = /* @__PURE__ */ new Map();
4797
4795
  for (const tokens of docTokens) {
4798
- const seen = /* @__PURE__ */ new Set();
4799
- for (const t of tokens) {
4800
- if (queryTermSet.has(t)) seen.add(t);
4801
- }
4796
+ const seen = new Set(tokens);
4802
4797
  for (const t of seen) df.set(t, (df.get(t) ?? 0) + 1);
4803
4798
  }
4804
- const N = items.length;
4799
+ return { ids, docTokens, docLens, avgdl, df, n: items.length };
4800
+ }
4801
+ function scoreBM25Prepared(query, corpus) {
4802
+ const queryTerms = tokenize(query);
4805
4803
  const scores = /* @__PURE__ */ new Map();
4806
- for (let i = 0; i < items.length; i++) {
4804
+ if (queryTerms.length === 0 || corpus.n === 0) return scores;
4805
+ const queryTermSet = new Set(queryTerms);
4806
+ const { ids, docTokens, docLens, avgdl, df, n: N } = corpus;
4807
+ for (let i = 0; i < N; i++) {
4807
4808
  const tokens = docTokens[i];
4808
4809
  const dl = docLens[i];
4809
4810
  if (dl === 0) continue;
@@ -4819,10 +4820,15 @@ function scoreBM25(query, items) {
4819
4820
  const tfNorm = f * (K1 + 1) / (f + K1 * (1 - B + B * dl / avgdl));
4820
4821
  score += idf * tfNorm;
4821
4822
  }
4822
- scores.set(items[i].id, score);
4823
+ scores.set(ids[i], score);
4823
4824
  }
4824
4825
  return scores;
4825
4826
  }
4827
+ function scoreBM25(query, items) {
4828
+ if (items.length === 0) return /* @__PURE__ */ new Map();
4829
+ if (tokenize(query).length === 0) return /* @__PURE__ */ new Map();
4830
+ return scoreBM25Prepared(query, prepareBM25Corpus(items));
4831
+ }
4826
4832
 
4827
4833
  // src/lib/memoryVault/decomposeQuery.ts
4828
4834
  var DEFAULT_MODEL = "inclusionai/ling-2.6-flash";
@@ -5077,7 +5083,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
5077
5083
  }
5078
5084
  });
5079
5085
  const baseIds = new Set(baseRanked.map((r) => r.uniqueId));
5080
- const bm25Scores = scoreBM25(
5086
+ const bm25Scores = options?.preparedBM25Corpus ? scoreBM25Prepared(query, options.preparedBM25Corpus) : scoreBM25(
5081
5087
  query,
5082
5088
  items.map((i) => ({ id: i.id, content: i.content }))
5083
5089
  );
@@ -5274,7 +5280,11 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
5274
5280
  const limit = options?.limit ?? 5;
5275
5281
  const perFacetTopN = options?.perFacetTopN ?? 10;
5276
5282
  if (items.length === 0 || subQueries.length === 0) return [];
5283
+ const preparedBM25Corpus = prepareBM25Corpus(
5284
+ items.map((i) => ({ id: i.id, content: i.content }))
5285
+ );
5277
5286
  const facetTuning = {
5287
+ preparedBM25Corpus,
5278
5288
  ...options?.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
5279
5289
  ...options?.recency && { recency: options.recency },
5280
5290
  ...options?.supersessionBoost !== void 0 && {
@@ -5949,7 +5959,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
5949
5959
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
5950
5960
  );
5951
5961
  }
5952
- const { recall: recall2 } = await import("./recall-7NVXMANO.mjs");
5962
+ const { recall: recall2 } = await import("./recall-ELUJPQQB.mjs");
5953
5963
  const result = await recall2(
5954
5964
  query,
5955
5965
  { vaultCtx, embeddingOptions, vaultCache: cache },
@@ -8,7 +8,7 @@ import {
8
8
  import "./chunk-GYKJOWEO.mjs";
9
9
 
10
10
  // src/lib/memory/consolidate.ts
11
- var DEFAULT_MODEL = "inclusionai/ling-2.6-flash";
11
+ var DEFAULT_CONSOLIDATION_MODEL = "inclusionai/ling-2.6-flash";
12
12
  var DEFAULT_CONSOLIDATE_ATTEMPTS = 3;
13
13
  var DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS = 2e4;
14
14
  var SYSTEM_PROMPT = `You consolidate a new memory against existing memories from the same user.
@@ -70,7 +70,7 @@ ${candidateText}`;
70
70
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
71
71
  ...options.getToken !== void 0 && { getToken: options.getToken },
72
72
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
73
- model: options.model ?? DEFAULT_MODEL,
73
+ model: options.model ?? DEFAULT_CONSOLIDATION_MODEL,
74
74
  systemPrompt: SYSTEM_PROMPT,
75
75
  userMessage,
76
76
  tag: "memory/consolidate",
@@ -147,5 +147,6 @@ function validate(parsed, newContent, validIds) {
147
147
  return { action: "update", targetId, content: c };
148
148
  }
149
149
  export {
150
+ DEFAULT_CONSOLIDATION_MODEL,
150
151
  consolidateMemory
151
152
  };
@@ -5869,24 +5869,25 @@ function tokenize(text12) {
5869
5869
  if (!m) return [];
5870
5870
  return m.filter((t) => !STOPWORDS.has(t));
5871
5871
  }
5872
- function scoreBM25(query, items) {
5873
- const queryTerms = tokenize(query);
5874
- if (queryTerms.length === 0 || items.length === 0) return /* @__PURE__ */ new Map();
5872
+ function prepareBM25Corpus(items) {
5873
+ const ids = items.map((i) => i.id);
5875
5874
  const docTokens = items.map((i) => tokenize(i.content));
5876
5875
  const docLens = docTokens.map((t) => t.length);
5877
- const avgdl = docLens.reduce((a, b) => a + b, 0) / docLens.length;
5878
- const queryTermSet = new Set(queryTerms);
5876
+ const avgdl = docLens.length ? docLens.reduce((a, b) => a + b, 0) / docLens.length : 0;
5879
5877
  const df = /* @__PURE__ */ new Map();
5880
5878
  for (const tokens of docTokens) {
5881
- const seen = /* @__PURE__ */ new Set();
5882
- for (const t of tokens) {
5883
- if (queryTermSet.has(t)) seen.add(t);
5884
- }
5879
+ const seen = new Set(tokens);
5885
5880
  for (const t of seen) df.set(t, (df.get(t) ?? 0) + 1);
5886
5881
  }
5887
- const N = items.length;
5882
+ return { ids, docTokens, docLens, avgdl, df, n: items.length };
5883
+ }
5884
+ function scoreBM25Prepared(query, corpus) {
5885
+ const queryTerms = tokenize(query);
5888
5886
  const scores = /* @__PURE__ */ new Map();
5889
- for (let i = 0; i < items.length; i++) {
5887
+ if (queryTerms.length === 0 || corpus.n === 0) return scores;
5888
+ const queryTermSet = new Set(queryTerms);
5889
+ const { ids, docTokens, docLens, avgdl, df, n: N } = corpus;
5890
+ for (let i = 0; i < N; i++) {
5890
5891
  const tokens = docTokens[i];
5891
5892
  const dl = docLens[i];
5892
5893
  if (dl === 0) continue;
@@ -5902,10 +5903,15 @@ function scoreBM25(query, items) {
5902
5903
  const tfNorm = f * (K1 + 1) / (f + K1 * (1 - B + B * dl / avgdl));
5903
5904
  score += idf * tfNorm;
5904
5905
  }
5905
- scores.set(items[i].id, score);
5906
+ scores.set(ids[i], score);
5906
5907
  }
5907
5908
  return scores;
5908
5909
  }
5910
+ function scoreBM25(query, items) {
5911
+ if (items.length === 0) return /* @__PURE__ */ new Map();
5912
+ if (tokenize(query).length === 0) return /* @__PURE__ */ new Map();
5913
+ return scoreBM25Prepared(query, prepareBM25Corpus(items));
5914
+ }
5909
5915
  var K1, B, TOKEN_RE, STOPWORDS;
5910
5916
  var init_bm25 = __esm({
5911
5917
  "src/lib/memoryVault/bm25.ts"() {
@@ -7226,7 +7232,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
7226
7232
  }
7227
7233
  });
7228
7234
  const baseIds = new Set(baseRanked.map((r) => r.uniqueId));
7229
- const bm25Scores = scoreBM25(
7235
+ const bm25Scores = options?.preparedBM25Corpus ? scoreBM25Prepared(query, options.preparedBM25Corpus) : scoreBM25(
7230
7236
  query,
7231
7237
  items.map((i) => ({ id: i.id, content: i.content }))
7232
7238
  );
@@ -7423,7 +7429,11 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
7423
7429
  const limit = options?.limit ?? 5;
7424
7430
  const perFacetTopN = options?.perFacetTopN ?? 10;
7425
7431
  if (items.length === 0 || subQueries.length === 0) return [];
7432
+ const preparedBM25Corpus = prepareBM25Corpus(
7433
+ items.map((i) => ({ id: i.id, content: i.content }))
7434
+ );
7426
7435
  const facetTuning = {
7436
+ preparedBM25Corpus,
7427
7437
  ...options?.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
7428
7438
  ...options?.recency && { recency: options.recency },
7429
7439
  ...options?.supersessionBoost !== void 0 && {
@@ -8169,6 +8179,7 @@ var init_searchTool = __esm({
8169
8179
  // src/lib/memory/consolidate.ts
8170
8180
  var consolidate_exports = {};
8171
8181
  __export(consolidate_exports, {
8182
+ DEFAULT_CONSOLIDATION_MODEL: () => DEFAULT_CONSOLIDATION_MODEL,
8172
8183
  consolidateMemory: () => consolidateMemory
8173
8184
  });
8174
8185
  async function consolidateMemory(newContent, candidates, options) {
@@ -8197,7 +8208,7 @@ ${candidateText}`;
8197
8208
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
8198
8209
  ...options.getToken !== void 0 && { getToken: options.getToken },
8199
8210
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
8200
- model: options.model ?? DEFAULT_MODEL3,
8211
+ model: options.model ?? DEFAULT_CONSOLIDATION_MODEL,
8201
8212
  systemPrompt: SYSTEM_PROMPT3,
8202
8213
  userMessage,
8203
8214
  tag: "memory/consolidate",
@@ -8273,14 +8284,14 @@ function validate2(parsed, newContent, validIds) {
8273
8284
  if (!targetId || !validIds.has(targetId)) return null;
8274
8285
  return { action: "update", targetId, content: c };
8275
8286
  }
8276
- var DEFAULT_MODEL3, DEFAULT_CONSOLIDATE_ATTEMPTS, DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS, SYSTEM_PROMPT3;
8287
+ var DEFAULT_CONSOLIDATION_MODEL, DEFAULT_CONSOLIDATE_ATTEMPTS, DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS, SYSTEM_PROMPT3;
8277
8288
  var init_consolidate = __esm({
8278
8289
  "src/lib/memory/consolidate.ts"() {
8279
8290
  "use strict";
8280
8291
  init_logger();
8281
8292
  init_redactor();
8282
8293
  init_portalLlm();
8283
- DEFAULT_MODEL3 = "inclusionai/ling-2.6-flash";
8294
+ DEFAULT_CONSOLIDATION_MODEL = "inclusionai/ling-2.6-flash";
8284
8295
  DEFAULT_CONSOLIDATE_ATTEMPTS = 3;
8285
8296
  DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS = 2e4;
8286
8297
  SYSTEM_PROMPT3 = `You consolidate a new memory against existing memories from the same user.
@@ -16830,7 +16841,7 @@ function classifyDecay(m, now, policy) {
16830
16841
  init_logger();
16831
16842
  init_redactor();
16832
16843
  init_portalLlm();
16833
- var DEFAULT_MODEL4 = "inclusionai/ling-2.6-flash";
16844
+ var DEFAULT_MODEL3 = "inclusionai/ling-2.6-flash";
16834
16845
  var DEFAULT_ATTEMPTS2 = 2;
16835
16846
  var DEFAULT_TOTAL_TIMEOUT_MS2 = 12e3;
16836
16847
  var MAX_CONTENT_CHARS = 400;
@@ -16869,7 +16880,7 @@ function createLlmDecayClassifier(options) {
16869
16880
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
16870
16881
  ...options.getToken !== void 0 && { getToken: options.getToken },
16871
16882
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
16872
- model: options.model ?? DEFAULT_MODEL4,
16883
+ model: options.model ?? DEFAULT_MODEL3,
16873
16884
  systemPrompt: SYSTEM_PROMPT5,
16874
16885
  userMessage: `Memory content:
16875
16886
  ${safe}
@@ -17302,7 +17313,7 @@ init_logger();
17302
17313
  init_portalLlm();
17303
17314
  init_recall();
17304
17315
  var DEFAULT_BASE_URL2 = BASE_URL;
17305
- var DEFAULT_MODEL5 = "anthropic/claude-sonnet-4-6";
17316
+ var DEFAULT_MODEL4 = "anthropic/claude-sonnet-4-6";
17306
17317
  var DEFAULT_MAX_TOKENS = 4096;
17307
17318
  var REQUEST_TIMEOUT_MS = 6e4;
17308
17319
  var DEFAULT_SYSTEM_PROMPT = `You are a personal assistant with access to the user's memory. Answer the user's question using the supplied memories as evidence.
@@ -17334,7 +17345,7 @@ async function reflect(query, ctx, options) {
17334
17345
  const evidence = recalledMemories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
17335
17346
  ${m.content}`).join("\n\n");
17336
17347
  const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL2;
17337
- const model = options.llmModel ?? DEFAULT_MODEL5;
17348
+ const model = options.llmModel ?? DEFAULT_MODEL4;
17338
17349
  const wantsStructured = !!options.responseSchema;
17339
17350
  const sendResponseFormat = wantsStructured && supportsResponseFormat(model, "json_schema");
17340
17351
  const basePrompt = options.systemPrompt ?? DEFAULT_SYSTEM_PROMPT;
@@ -155,7 +155,7 @@ import {
155
155
  updateVaultMemoryOp,
156
156
  useEncryption,
157
157
  vaultMemoryToStored
158
- } from "./chunk-IWR7BNER.mjs";
158
+ } from "./chunk-YGCJX5YW.mjs";
159
159
  import {
160
160
  PiiRedactor,
161
161
  createStreamingDeAnonymizer,
@@ -7415,7 +7415,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
7415
7415
  content: m.content,
7416
7416
  similarity: m.similarity
7417
7417
  }));
7418
- const { consolidateMemory: doConsolidate } = await import("./consolidate-7UUX56GM.mjs");
7418
+ const { consolidateMemory: doConsolidate } = await import("./consolidate-54UWIMP6.mjs");
7419
7419
  const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
7420
7420
  if (decision.action === "create") return null;
7421
7421
  if (decision.action === "supersede" && decision.content) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-HXBDHRKJ.mjs";
3
+ } from "./chunk-YGCJX5YW.mjs";
4
4
  import "./chunk-BOY27A2C.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -18676,24 +18676,25 @@ function tokenize(text) {
18676
18676
  if (!m) return [];
18677
18677
  return m.filter((t) => !STOPWORDS.has(t));
18678
18678
  }
18679
- function scoreBM25(query, items) {
18680
- const queryTerms = tokenize(query);
18681
- if (queryTerms.length === 0 || items.length === 0) return /* @__PURE__ */ new Map();
18679
+ function prepareBM25Corpus(items) {
18680
+ const ids = items.map((i) => i.id);
18682
18681
  const docTokens = items.map((i) => tokenize(i.content));
18683
18682
  const docLens = docTokens.map((t) => t.length);
18684
- const avgdl = docLens.reduce((a, b) => a + b, 0) / docLens.length;
18685
- const queryTermSet = new Set(queryTerms);
18683
+ const avgdl = docLens.length ? docLens.reduce((a, b) => a + b, 0) / docLens.length : 0;
18686
18684
  const df = /* @__PURE__ */ new Map();
18687
18685
  for (const tokens of docTokens) {
18688
- const seen = /* @__PURE__ */ new Set();
18689
- for (const t of tokens) {
18690
- if (queryTermSet.has(t)) seen.add(t);
18691
- }
18686
+ const seen = new Set(tokens);
18692
18687
  for (const t of seen) df.set(t, (df.get(t) ?? 0) + 1);
18693
18688
  }
18694
- const N = items.length;
18689
+ return { ids, docTokens, docLens, avgdl, df, n: items.length };
18690
+ }
18691
+ function scoreBM25Prepared(query, corpus) {
18692
+ const queryTerms = tokenize(query);
18695
18693
  const scores = /* @__PURE__ */ new Map();
18696
- for (let i = 0; i < items.length; i++) {
18694
+ if (queryTerms.length === 0 || corpus.n === 0) return scores;
18695
+ const queryTermSet = new Set(queryTerms);
18696
+ const { ids, docTokens, docLens, avgdl, df, n: N } = corpus;
18697
+ for (let i = 0; i < N; i++) {
18697
18698
  const tokens = docTokens[i];
18698
18699
  const dl = docLens[i];
18699
18700
  if (dl === 0) continue;
@@ -18709,10 +18710,15 @@ function scoreBM25(query, items) {
18709
18710
  const tfNorm = f * (K1 + 1) / (f + K1 * (1 - B + B * dl / avgdl));
18710
18711
  score += idf * tfNorm;
18711
18712
  }
18712
- scores.set(items[i].id, score);
18713
+ scores.set(ids[i], score);
18713
18714
  }
18714
18715
  return scores;
18715
18716
  }
18717
+ function scoreBM25(query, items) {
18718
+ if (items.length === 0) return /* @__PURE__ */ new Map();
18719
+ if (tokenize(query).length === 0) return /* @__PURE__ */ new Map();
18720
+ return scoreBM25Prepared(query, prepareBM25Corpus(items));
18721
+ }
18716
18722
 
18717
18723
  // src/lib/memoryVault/decomposeQuery.ts
18718
18724
  var DEFAULT_MODEL = "inclusionai/ling-2.6-flash";
@@ -18967,7 +18973,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
18967
18973
  }
18968
18974
  });
18969
18975
  const baseIds = new Set(baseRanked.map((r) => r.uniqueId));
18970
- const bm25Scores = scoreBM25(
18976
+ const bm25Scores = options?.preparedBM25Corpus ? scoreBM25Prepared(query, options.preparedBM25Corpus) : scoreBM25(
18971
18977
  query,
18972
18978
  items.map((i) => ({ id: i.id, content: i.content }))
18973
18979
  );
@@ -19164,7 +19170,11 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
19164
19170
  const limit = options?.limit ?? 5;
19165
19171
  const perFacetTopN = options?.perFacetTopN ?? 10;
19166
19172
  if (items.length === 0 || subQueries.length === 0) return [];
19173
+ const preparedBM25Corpus = prepareBM25Corpus(
19174
+ items.map((i) => ({ id: i.id, content: i.content }))
19175
+ );
19167
19176
  const facetTuning = {
19177
+ preparedBM25Corpus,
19168
19178
  ...options?.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
19169
19179
  ...options?.recency && { recency: options.recency },
19170
19180
  ...options?.supersessionBoost !== void 0 && {
@@ -19839,7 +19849,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
19839
19849
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
19840
19850
  );
19841
19851
  }
19842
- const { recall: recall2 } = await import("./recall-RVRZ4RQT.mjs");
19852
+ const { recall: recall2 } = await import("./recall-VZO4USXK.mjs");
19843
19853
  const result = await recall2(
19844
19854
  query,
19845
19855
  { vaultCtx, embeddingOptions, vaultCache: cache },
@@ -8,7 +8,7 @@ import {
8
8
  import "./chunk-3RPGXXPZ.mjs";
9
9
 
10
10
  // src/lib/memory/consolidate.ts
11
- var DEFAULT_MODEL = "inclusionai/ling-2.6-flash";
11
+ var DEFAULT_CONSOLIDATION_MODEL = "inclusionai/ling-2.6-flash";
12
12
  var DEFAULT_CONSOLIDATE_ATTEMPTS = 3;
13
13
  var DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS = 2e4;
14
14
  var SYSTEM_PROMPT = `You consolidate a new memory against existing memories from the same user.
@@ -70,7 +70,7 @@ ${candidateText}`;
70
70
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
71
71
  ...options.getToken !== void 0 && { getToken: options.getToken },
72
72
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
73
- model: options.model ?? DEFAULT_MODEL,
73
+ model: options.model ?? DEFAULT_CONSOLIDATION_MODEL,
74
74
  systemPrompt: SYSTEM_PROMPT,
75
75
  userMessage,
76
76
  tag: "memory/consolidate",
@@ -147,5 +147,6 @@ function validate(parsed, newContent, validIds) {
147
147
  return { action: "update", targetId, content: c };
148
148
  }
149
149
  export {
150
+ DEFAULT_CONSOLIDATION_MODEL,
150
151
  consolidateMemory
151
152
  };
@@ -19494,24 +19494,25 @@ function tokenize(text12) {
19494
19494
  if (!m) return [];
19495
19495
  return m.filter((t) => !STOPWORDS.has(t));
19496
19496
  }
19497
- function scoreBM25(query, items) {
19498
- const queryTerms = tokenize(query);
19499
- if (queryTerms.length === 0 || items.length === 0) return /* @__PURE__ */ new Map();
19497
+ function prepareBM25Corpus(items) {
19498
+ const ids = items.map((i) => i.id);
19500
19499
  const docTokens = items.map((i) => tokenize(i.content));
19501
19500
  const docLens = docTokens.map((t) => t.length);
19502
- const avgdl = docLens.reduce((a, b) => a + b, 0) / docLens.length;
19503
- const queryTermSet = new Set(queryTerms);
19501
+ const avgdl = docLens.length ? docLens.reduce((a, b) => a + b, 0) / docLens.length : 0;
19504
19502
  const df = /* @__PURE__ */ new Map();
19505
19503
  for (const tokens of docTokens) {
19506
- const seen = /* @__PURE__ */ new Set();
19507
- for (const t of tokens) {
19508
- if (queryTermSet.has(t)) seen.add(t);
19509
- }
19504
+ const seen = new Set(tokens);
19510
19505
  for (const t of seen) df.set(t, (df.get(t) ?? 0) + 1);
19511
19506
  }
19512
- const N = items.length;
19507
+ return { ids, docTokens, docLens, avgdl, df, n: items.length };
19508
+ }
19509
+ function scoreBM25Prepared(query, corpus) {
19510
+ const queryTerms = tokenize(query);
19513
19511
  const scores = /* @__PURE__ */ new Map();
19514
- for (let i = 0; i < items.length; i++) {
19512
+ if (queryTerms.length === 0 || corpus.n === 0) return scores;
19513
+ const queryTermSet = new Set(queryTerms);
19514
+ const { ids, docTokens, docLens, avgdl, df, n: N } = corpus;
19515
+ for (let i = 0; i < N; i++) {
19515
19516
  const tokens = docTokens[i];
19516
19517
  const dl = docLens[i];
19517
19518
  if (dl === 0) continue;
@@ -19527,10 +19528,15 @@ function scoreBM25(query, items) {
19527
19528
  const tfNorm = f * (K1 + 1) / (f + K1 * (1 - B + B * dl / avgdl));
19528
19529
  score += idf * tfNorm;
19529
19530
  }
19530
- scores.set(items[i].id, score);
19531
+ scores.set(ids[i], score);
19531
19532
  }
19532
19533
  return scores;
19533
19534
  }
19535
+ function scoreBM25(query, items) {
19536
+ if (items.length === 0) return /* @__PURE__ */ new Map();
19537
+ if (tokenize(query).length === 0) return /* @__PURE__ */ new Map();
19538
+ return scoreBM25Prepared(query, prepareBM25Corpus(items));
19539
+ }
19534
19540
  var K1, B, TOKEN_RE, STOPWORDS;
19535
19541
  var init_bm25 = __esm({
19536
19542
  "src/lib/memoryVault/bm25.ts"() {
@@ -21098,7 +21104,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
21098
21104
  }
21099
21105
  });
21100
21106
  const baseIds = new Set(baseRanked.map((r) => r.uniqueId));
21101
- const bm25Scores = scoreBM25(
21107
+ const bm25Scores = options?.preparedBM25Corpus ? scoreBM25Prepared(query, options.preparedBM25Corpus) : scoreBM25(
21102
21108
  query,
21103
21109
  items.map((i) => ({ id: i.id, content: i.content }))
21104
21110
  );
@@ -21295,7 +21301,11 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
21295
21301
  const limit = options?.limit ?? 5;
21296
21302
  const perFacetTopN = options?.perFacetTopN ?? 10;
21297
21303
  if (items.length === 0 || subQueries.length === 0) return [];
21304
+ const preparedBM25Corpus = prepareBM25Corpus(
21305
+ items.map((i) => ({ id: i.id, content: i.content }))
21306
+ );
21298
21307
  const facetTuning = {
21308
+ preparedBM25Corpus,
21299
21309
  ...options?.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
21300
21310
  ...options?.recency && { recency: options.recency },
21301
21311
  ...options?.supersessionBoost !== void 0 && {
@@ -22693,6 +22703,7 @@ var init_redactor = __esm({
22693
22703
  // src/lib/memory/consolidate.ts
22694
22704
  var consolidate_exports = {};
22695
22705
  __export(consolidate_exports, {
22706
+ DEFAULT_CONSOLIDATION_MODEL: () => DEFAULT_CONSOLIDATION_MODEL,
22696
22707
  consolidateMemory: () => consolidateMemory
22697
22708
  });
22698
22709
  async function consolidateMemory(newContent, candidates, options) {
@@ -22721,7 +22732,7 @@ ${candidateText}`;
22721
22732
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
22722
22733
  ...options.getToken !== void 0 && { getToken: options.getToken },
22723
22734
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
22724
- model: options.model ?? DEFAULT_MODEL3,
22735
+ model: options.model ?? DEFAULT_CONSOLIDATION_MODEL,
22725
22736
  systemPrompt: SYSTEM_PROMPT3,
22726
22737
  userMessage,
22727
22738
  tag: "memory/consolidate",
@@ -22797,14 +22808,14 @@ function validate2(parsed, newContent, validIds) {
22797
22808
  if (!targetId || !validIds.has(targetId)) return null;
22798
22809
  return { action: "update", targetId, content: c };
22799
22810
  }
22800
- var DEFAULT_MODEL3, DEFAULT_CONSOLIDATE_ATTEMPTS, DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS, SYSTEM_PROMPT3;
22811
+ var DEFAULT_CONSOLIDATION_MODEL, DEFAULT_CONSOLIDATE_ATTEMPTS, DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS, SYSTEM_PROMPT3;
22801
22812
  var init_consolidate = __esm({
22802
22813
  "src/lib/memory/consolidate.ts"() {
22803
22814
  "use strict";
22804
22815
  init_logger();
22805
22816
  init_redactor();
22806
22817
  init_portalLlm();
22807
- DEFAULT_MODEL3 = "inclusionai/ling-2.6-flash";
22818
+ DEFAULT_CONSOLIDATION_MODEL = "inclusionai/ling-2.6-flash";
22808
22819
  DEFAULT_CONSOLIDATE_ATTEMPTS = 3;
22809
22820
  DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS = 2e4;
22810
22821
  SYSTEM_PROMPT3 = `You consolidate a new memory against existing memories from the same user.
@@ -28669,7 +28680,7 @@ function classifyDecay(m, now, policy) {
28669
28680
  init_logger();
28670
28681
  init_redactor();
28671
28682
  init_portalLlm();
28672
- var DEFAULT_MODEL4 = "inclusionai/ling-2.6-flash";
28683
+ var DEFAULT_MODEL3 = "inclusionai/ling-2.6-flash";
28673
28684
  var DEFAULT_ATTEMPTS2 = 2;
28674
28685
  var DEFAULT_TOTAL_TIMEOUT_MS2 = 12e3;
28675
28686
  var MAX_CONTENT_CHARS = 400;
@@ -28708,7 +28719,7 @@ function createLlmDecayClassifier(options) {
28708
28719
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
28709
28720
  ...options.getToken !== void 0 && { getToken: options.getToken },
28710
28721
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
28711
- model: options.model ?? DEFAULT_MODEL4,
28722
+ model: options.model ?? DEFAULT_MODEL3,
28712
28723
  systemPrompt: SYSTEM_PROMPT5,
28713
28724
  userMessage: `Memory content:
28714
28725
  ${safe}
@@ -29141,7 +29152,7 @@ init_logger();
29141
29152
  init_portalLlm();
29142
29153
  init_recall();
29143
29154
  var DEFAULT_BASE_URL2 = BASE_URL;
29144
- var DEFAULT_MODEL5 = "anthropic/claude-sonnet-4-6";
29155
+ var DEFAULT_MODEL4 = "anthropic/claude-sonnet-4-6";
29145
29156
  var DEFAULT_MAX_TOKENS = 4096;
29146
29157
  var REQUEST_TIMEOUT_MS = 6e4;
29147
29158
  var DEFAULT_SYSTEM_PROMPT = `You are a personal assistant with access to the user's memory. Answer the user's question using the supplied memories as evidence.
@@ -29173,7 +29184,7 @@ async function reflect(query, ctx, options) {
29173
29184
  const evidence = recalledMemories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
29174
29185
  ${m.content}`).join("\n\n");
29175
29186
  const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL2;
29176
- const model = options.llmModel ?? DEFAULT_MODEL5;
29187
+ const model = options.llmModel ?? DEFAULT_MODEL4;
29177
29188
  const wantsStructured = !!options.responseSchema;
29178
29189
  const sendResponseFormat = wantsStructured && supportsResponseFormat(model, "json_schema");
29179
29190
  const basePrompt = options.systemPrompt ?? DEFAULT_SYSTEM_PROMPT;
@@ -127,7 +127,7 @@ import {
127
127
  updateVaultMemoryOp,
128
128
  upsertMessageOp,
129
129
  vaultMemoryToStored
130
- } from "./chunk-UU2F523R.mjs";
130
+ } from "./chunk-FXS3EUKX.mjs";
131
131
  import {
132
132
  createStreamingDeAnonymizer,
133
133
  resolvePiiRedactor
@@ -5499,7 +5499,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
5499
5499
  content: m.content,
5500
5500
  similarity: m.similarity
5501
5501
  }));
5502
- const { consolidateMemory: doConsolidate } = await import("./consolidate-BKLNVH5Y.mjs");
5502
+ const { consolidateMemory: doConsolidate } = await import("./consolidate-YCD45CXO.mjs");
5503
5503
  const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
5504
5504
  if (decision.action === "create") return null;
5505
5505
  if (decision.action === "supersede" && decision.content) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-UU2F523R.mjs";
3
+ } from "./chunk-FXS3EUKX.mjs";
4
4
  import "./chunk-MIXEASUP.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": "3.9.5",
3
+ "version": "3.9.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",