@anuma/sdk 6.10.0 → 6.12.0

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.
@@ -5439,6 +5439,9 @@ async function decomposeQuery(query, options) {
5439
5439
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
5440
5440
  model: options.model ?? DEFAULT_MODEL,
5441
5441
  systemPrompt: SYSTEM_PROMPT,
5442
+ // The query itself rides the user turn below, so SYSTEM_PROMPT is the whole
5443
+ // fixed instruction — which is what lets the portal own it outright.
5444
+ taskType: "memory_decompose",
5442
5445
  // Wrap the bare query in a task framing so the model treats it as
5443
5446
  // input to classify, not as a question to answer conversationally.
5444
5447
  // Bare-query inputs caused Anthropic models to respond with prose
@@ -5553,9 +5556,9 @@ function recencyMultiplier(updatedAt, opts = {}) {
5553
5556
  const updatedMs = updatedAt.getTime();
5554
5557
  if (!Number.isFinite(updatedMs)) return noDate;
5555
5558
  const now = opts.now ?? /* @__PURE__ */ new Date();
5556
- const nowMs2 = now.getTime();
5557
- if (!Number.isFinite(nowMs2)) return noDate;
5558
- const ageDays = Math.max(0, (nowMs2 - updatedMs) / DAY_MS);
5559
+ const nowMs3 = now.getTime();
5560
+ if (!Number.isFinite(nowMs3)) return noDate;
5561
+ const ageDays = Math.max(0, (nowMs3 - updatedMs) / DAY_MS);
5559
5562
  const perYearDecay = opts.perYearDecay ?? DEFAULT_PER_YEAR_DECAY;
5560
5563
  const floor = opts.floor ?? DEFAULT_FLOOR;
5561
5564
  const decay = perYearDecay * (ageDays / 365);
@@ -5901,6 +5904,7 @@ function createVaultEmbeddingCache(maxSize = DEFAULT_VAULT_CACHE_SIZE) {
5901
5904
  }
5902
5905
 
5903
5906
  // src/lib/memoryVault/searchTool.ts
5907
+ var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
5904
5908
  var warnedProgrammaticDecomposeIgnored = false;
5905
5909
  function normalizeEventTimeKind(kind) {
5906
5910
  return kind === "point" || kind === "range" || kind === "ongoing" ? kind : null;
@@ -6133,6 +6137,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
6133
6137
  const rerankTopN = options.rerankTopN ?? 30;
6134
6138
  const ceWeight = options.ceWeight ?? 0.1;
6135
6139
  const headSlice = v2Ranked.slice(0, rerankTopN);
6140
+ const ceStart = nowMs();
6136
6141
  try {
6137
6142
  const reranked = await rerankPairs(
6138
6143
  query,
@@ -6160,6 +6165,8 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
6160
6165
  getLogger().warn("[memory/search] cross-encoder rerank failed; using V2 ranking", err);
6161
6166
  }
6162
6167
  combined = v2Ranked;
6168
+ } finally {
6169
+ if (options.rerankStats) options.rerankStats.ms += nowMs() - ceStart;
6163
6170
  }
6164
6171
  } else {
6165
6172
  combined = v2Ranked;
@@ -6326,6 +6333,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
6326
6333
  const ceWeight = options.ceWeight ?? 0.1;
6327
6334
  const headSlice = combined.slice(0, rerankTopN);
6328
6335
  const tailSlice = combined.slice(rerankTopN);
6336
+ const ceStart = nowMs();
6329
6337
  try {
6330
6338
  const reranked = await rerankPairs(
6331
6339
  originalQuery,
@@ -6353,6 +6361,8 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
6353
6361
  err
6354
6362
  );
6355
6363
  }
6364
+ } finally {
6365
+ if (options.rerankStats) options.rerankStats.ms += nowMs() - ceStart;
6356
6366
  }
6357
6367
  }
6358
6368
  if (options?.mmr) {
@@ -6479,11 +6489,13 @@ async function buildProjectedCorpus(query, vaultCtx, embeddingOptions, cache, qu
6479
6489
  rowsDecrypted: 0
6480
6490
  };
6481
6491
  }
6492
+ const queryEmbedStart = nowMs();
6482
6493
  const queryEmbedding = await embedQueryOrDegrade(
6483
6494
  query,
6484
6495
  embeddingOptions,
6485
6496
  opts.onEmbeddingDegraded
6486
6497
  );
6498
+ if (opts.embedStats) opts.embedStats.queryMs += nowMs() - queryEmbedStart;
6487
6499
  const embeddingsDegraded = queryEmbedding.length === 0;
6488
6500
  const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
6489
6501
  const vectored = [];
@@ -6536,6 +6548,7 @@ async function buildProjectedCorpus(query, vaultCtx, embeddingOptions, cache, qu
6536
6548
  const laneRows = laneFetched.filter((m) => !isEncrypted(m.content));
6537
6549
  if (laneRows.length > 0) {
6538
6550
  let laneVecs;
6551
+ if (opts.embedStats) opts.embedStats.rowsEmbedded += laneRows.length;
6539
6552
  try {
6540
6553
  laneVecs = await generateEmbeddings(
6541
6554
  laneRows.map((m) => m.content),
@@ -6614,6 +6627,10 @@ async function buildProjectedCorpus(query, vaultCtx, embeddingOptions, cache, qu
6614
6627
  async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache, searchOptions) {
6615
6628
  if (!query || typeof query !== "string") {
6616
6629
  return {
6630
+ // Nothing was read and nothing was embedded — the short-circuit fires
6631
+ // before either.
6632
+ queryEmbedMs: 0,
6633
+ rowsEmbedded: 0,
6617
6634
  memories: [],
6618
6635
  embeddedItems: [],
6619
6636
  queryEmbedding: [],
@@ -6646,6 +6663,7 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6646
6663
  embeddingsUnavailable = true;
6647
6664
  embeddingFailure = true;
6648
6665
  };
6666
+ const embedStats = { queryMs: 0, rowsEmbedded: 0 };
6649
6667
  if (searchOptions?.decryptLast) {
6650
6668
  const forceIncludeIds = [
6651
6669
  ...searchOptions.entityRanking ?? [],
@@ -6657,7 +6675,8 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6657
6675
  admitFloor: ADMIT_FLOOR,
6658
6676
  unembeddedCap: UNEMBEDDED_CAP,
6659
6677
  ...forceIncludeIds.length > 0 && { forceIncludeIds },
6660
- onEmbeddingDegraded
6678
+ onEmbeddingDegraded,
6679
+ embedStats
6661
6680
  });
6662
6681
  if (corpus.vaultSize === 0) {
6663
6682
  return {
@@ -6668,7 +6687,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6668
6687
  embeddingsUnavailable: false,
6669
6688
  embeddingFailure: false,
6670
6689
  decryptLast: true,
6671
- rowsDecrypted: corpus.rowsDecrypted
6690
+ rowsDecrypted: corpus.rowsDecrypted,
6691
+ queryEmbedMs: embedStats.queryMs,
6692
+ rowsEmbedded: embedStats.rowsEmbedded
6672
6693
  };
6673
6694
  }
6674
6695
  ({ memories, embeddedItems, queryEmbedding, vaultSize } = corpus);
@@ -6685,7 +6706,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6685
6706
  decryptLast: true,
6686
6707
  // Rows WERE decrypt-attempted even though none came back readable — that
6687
6708
  // is the whole point of reporting attempts rather than successes.
6688
- rowsDecrypted: corpus.rowsDecrypted
6709
+ rowsDecrypted: corpus.rowsDecrypted,
6710
+ queryEmbedMs: embedStats.queryMs,
6711
+ rowsEmbedded: embedStats.rowsEmbedded
6689
6712
  };
6690
6713
  }
6691
6714
  } else {
@@ -6710,10 +6733,14 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6710
6733
  embeddingsUnavailable: false,
6711
6734
  embeddingFailure: false,
6712
6735
  decryptLast: false,
6713
- rowsDecrypted: loaded.length
6736
+ rowsDecrypted: loaded.length,
6737
+ queryEmbedMs: embedStats.queryMs,
6738
+ rowsEmbedded: embedStats.rowsEmbedded
6714
6739
  };
6715
6740
  }
6741
+ const legacyEmbedStart = nowMs();
6716
6742
  queryEmbedding = await embedQueryOrDegrade(query, embeddingOptions, onEmbeddingDegraded);
6743
+ embedStats.queryMs += nowMs() - legacyEmbedStart;
6717
6744
  const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
6718
6745
  const uncachedTexts = [];
6719
6746
  const uncachedIndices = [];
@@ -6747,6 +6774,7 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6747
6774
  }
6748
6775
  if (uncachedTexts.length > 0) {
6749
6776
  let newEmbeddings;
6777
+ embedStats.rowsEmbedded += uncachedTexts.length;
6750
6778
  try {
6751
6779
  newEmbeddings = await generateEmbeddings(uncachedTexts, embeddingOptions);
6752
6780
  } catch (err) {
@@ -6790,6 +6818,8 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6790
6818
  embeddingsUnavailable = true;
6791
6819
  }
6792
6820
  return {
6821
+ queryEmbedMs: embedStats.queryMs,
6822
+ rowsEmbedded: embedStats.rowsEmbedded,
6793
6823
  memories,
6794
6824
  embeddedItems,
6795
6825
  queryEmbedding,
@@ -6840,11 +6870,15 @@ async function rankPreparedVaultCandidates(query, prepared, embeddingOptions, se
6840
6870
  results: results2,
6841
6871
  vaultSize: out.vaultSize,
6842
6872
  reranked: out.reranked ?? false,
6873
+ // Read straight off the shared stats object rather than being passed in at
6874
+ // each call site: every return in this function funnels through here, so a
6875
+ // path added later reports the CE bill without having to remember to.
6876
+ rerankMs: rerankStats.ms,
6843
6877
  hadV2Head: out.hadV2Head ?? false,
6844
6878
  embeddingsUnavailable
6845
6879
  };
6846
6880
  };
6847
- const rerankStats = { applied: false };
6881
+ const rerankStats = { applied: false, ms: 0 };
6848
6882
  const useFusion = searchOptions?.useFusion ?? true;
6849
6883
  const tuning = {
6850
6884
  ...searchOptions?.recencyAlpha !== void 0 && { recencyAlpha: searchOptions.recencyAlpha },
@@ -6963,13 +6997,16 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
6963
6997
  results: [],
6964
6998
  vaultSize: 0,
6965
6999
  reranked: false,
7000
+ rerankMs: 0,
6966
7001
  hadV2Head: false,
6967
7002
  embeddingsUnavailable: false,
6968
7003
  rankedOnCosine: false,
6969
7004
  // No storage read happened, so nothing was decrypted; report the path the
6970
7005
  // caller asked for so this turn is still attributable.
6971
7006
  decryptLast: !!searchOptions?.decryptLast,
6972
- rowsDecrypted: 0
7007
+ rowsDecrypted: 0,
7008
+ queryEmbedMs: 0,
7009
+ rowsEmbedded: 0
6973
7010
  };
6974
7011
  }
6975
7012
  if (searchOptions?.decompose === "llm" && normalizeSubQueries(searchOptions.subQueries).length < 2 && !warnedProgrammaticDecomposeIgnored) {
@@ -6990,11 +7027,14 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
6990
7027
  results: [],
6991
7028
  vaultSize: 0,
6992
7029
  reranked: false,
7030
+ rerankMs: 0,
6993
7031
  hadV2Head: false,
6994
7032
  embeddingsUnavailable: prepared.embeddingsUnavailable,
6995
7033
  rankedOnCosine: false,
6996
7034
  decryptLast: prepared.decryptLast,
6997
- rowsDecrypted: prepared.rowsDecrypted
7035
+ rowsDecrypted: prepared.rowsDecrypted,
7036
+ queryEmbedMs: prepared.queryEmbedMs,
7037
+ rowsEmbedded: prepared.rowsEmbedded
6998
7038
  };
6999
7039
  }
7000
7040
  if (prepared.memories.length === 0) {
@@ -7002,11 +7042,14 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
7002
7042
  results: [],
7003
7043
  vaultSize: prepared.vaultSize,
7004
7044
  reranked: false,
7045
+ rerankMs: 0,
7005
7046
  hadV2Head: false,
7006
7047
  embeddingsUnavailable: prepared.embeddingsUnavailable,
7007
7048
  rankedOnCosine: false,
7008
7049
  decryptLast: prepared.decryptLast,
7009
- rowsDecrypted: prepared.rowsDecrypted
7050
+ rowsDecrypted: prepared.rowsDecrypted,
7051
+ queryEmbedMs: prepared.queryEmbedMs,
7052
+ rowsEmbedded: prepared.rowsEmbedded
7010
7053
  };
7011
7054
  }
7012
7055
  const ranked = await rankPreparedVaultCandidates(
@@ -7019,7 +7062,9 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
7019
7062
  ...ranked,
7020
7063
  rankedOnCosine: !ranked.embeddingsUnavailable,
7021
7064
  decryptLast: prepared.decryptLast,
7022
- rowsDecrypted: prepared.rowsDecrypted
7065
+ rowsDecrypted: prepared.rowsDecrypted,
7066
+ queryEmbedMs: prepared.queryEmbedMs,
7067
+ rowsEmbedded: prepared.rowsEmbedded
7023
7068
  };
7024
7069
  }
7025
7070
  async function searchVaultMemories(query, vaultCtx, embeddingOptions, cache, searchOptions) {
@@ -7124,7 +7169,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
7124
7169
  subQueries = decomp.subQueries;
7125
7170
  }
7126
7171
  }
7127
- const { recall: recall2 } = await import("./recall-FWILZSFH.mjs");
7172
+ const { recall: recall2 } = await import("./recall-QUWN7DJ7.mjs");
7128
7173
  let recallDegraded = [];
7129
7174
  const result = await recall2(
7130
7175
  query,
@@ -7377,29 +7422,29 @@ async function traverseGraphLane(query, entityCtx, options = {}) {
7377
7422
  var DEFAULT_REFINER_MODEL = "inclusionai/ling-2.6-flash";
7378
7423
  var DEFAULT_REFINER_ATTEMPTS = 1;
7379
7424
  var DEFAULT_REFINER_TOTAL_TIMEOUT_MS = 8e3;
7425
+ var REFINER_SYSTEM_PROMPT = `You help a memory-retrieval system decide which related topics to explore.
7426
+
7427
+ Given a user's question and a numbered list of candidate topics/entities linked to memories found so far, pick the ones most likely to lead to memories that help ANSWER the question. Never return more than the maximum the user turn asks for. Prefer topics semantically related to the question; ignore incidental ones.
7428
+
7429
+ Output strict JSON, no prose: { "expand": [<entity names to expand, verbatim from the list>] }`;
7380
7430
  function createLlmNeighborRefiner(options) {
7381
7431
  return {
7382
7432
  async refine(query, candidates, limit) {
7383
7433
  if (candidates.length === 0) return [];
7384
7434
  const numbered = candidates.map((name, i) => `[${i + 1}] ${name}`).join("\n");
7385
- const systemPrompt = `You help a memory-retrieval system decide which related topics to explore.
7386
-
7387
- Given a user's question and a numbered list of candidate topics/entities linked to memories found so far, pick the ones most likely to lead to memories that help ANSWER the question. Choose at most ${limit}. Prefer topics semantically related to the question; ignore incidental ones.
7388
-
7389
- Output strict JSON, no prose: { "expand": [<entity names to expand, verbatim from the list>] }`;
7390
7435
  const parsed = await callPortalJsonCompletion({
7391
7436
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
7392
7437
  ...options.getToken !== void 0 && { getToken: options.getToken },
7393
7438
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
7394
7439
  taskType: "memory_graph",
7395
7440
  model: options.model ?? DEFAULT_REFINER_MODEL,
7396
- systemPrompt,
7441
+ systemPrompt: REFINER_SYSTEM_PROMPT,
7397
7442
  userMessage: `Question: ${query}
7398
7443
 
7399
7444
  Candidate topics:
7400
7445
  ${numbered}
7401
7446
 
7402
- Which should be expanded?`,
7447
+ Which should be expanded? Choose at most ${limit}.`,
7403
7448
  tag: "memory/graph-refine",
7404
7449
  maxAttempts: options.maxAttempts ?? DEFAULT_REFINER_ATTEMPTS,
7405
7450
  totalTimeoutMs: options.totalTimeoutMs ?? DEFAULT_REFINER_TOTAL_TIMEOUT_MS,
@@ -7664,7 +7709,7 @@ function scoreEventTimeOverlap(memoryStart, memoryEnd, memoryKind, window2) {
7664
7709
  var DEFAULT_LIMIT = 8;
7665
7710
  var DEFAULT_BUDGET = "low";
7666
7711
  var DEFAULT_FACT_MIN_SCORE = 0.1;
7667
- var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
7712
+ var nowMs2 = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
7668
7713
  var DEFAULT_CHUNK_MIN_SCORE = 0.5;
7669
7714
  function flagsForBudget(budget) {
7670
7715
  switch (budget) {
@@ -7697,7 +7742,7 @@ async function recall(query, ctx, options = {}) {
7697
7742
  const flags = flagsForBudget(usedBudget);
7698
7743
  const normalizedFacets = normalizeSubQueries(options.subQueries);
7699
7744
  const subQueries = normalizedFacets.length >= 2 ? normalizedFacets : void 0;
7700
- const t0 = nowMs();
7745
+ const t0 = nowMs2();
7701
7746
  let prepMs = 0;
7702
7747
  let factLaneMs = 0;
7703
7748
  let chunkLaneMs = 0;
@@ -7706,6 +7751,9 @@ async function recall(query, ctx, options = {}) {
7706
7751
  const chunkResults = [];
7707
7752
  let vaultSize;
7708
7753
  let didRerank = false;
7754
+ let rerankMs = 0;
7755
+ let queryEmbedMs = 0;
7756
+ let vaultRowsEmbedded;
7709
7757
  let hadV2Head = false;
7710
7758
  let embeddingsUnavailable = false;
7711
7759
  let chunkEmbedFailed = false;
@@ -7730,12 +7778,15 @@ async function recall(query, ctx, options = {}) {
7730
7778
  ...vaultSize !== void 0 && { vaultSize },
7731
7779
  ...decryptLastRan !== void 0 && { decryptLast: decryptLastRan },
7732
7780
  ...vaultRowsDecrypted !== void 0 && { vaultRowsDecrypted },
7781
+ ...vaultRowsEmbedded !== void 0 && { vaultRowsEmbedded },
7733
7782
  factCount: factResults.length,
7734
7783
  chunkCount: chunkResults.length,
7735
7784
  timings: {
7736
- total: nowMs() - t0,
7785
+ total: nowMs2() - t0,
7737
7786
  prep: prepMs,
7738
7787
  factLane: factLaneMs,
7788
+ rerank: rerankMs,
7789
+ queryEmbed: queryEmbedMs,
7739
7790
  chunkLane: chunkLaneMs,
7740
7791
  fuse: fuseMs
7741
7792
  },
@@ -7753,7 +7804,7 @@ async function recall(query, ctx, options = {}) {
7753
7804
  const needsChunkEmbedding = types.includes("chunk") && ctx.storageCtx;
7754
7805
  const wantsTemporal = types.includes("fact") && ctx.vaultCtx;
7755
7806
  const graphRefiner = flags.traverse && options.graphRefine && options.decomposeOptions ? createLlmNeighborRefiner(options.decomposeOptions) : void 0;
7756
- const prepStart = nowMs();
7807
+ const prepStart = nowMs2();
7757
7808
  const [queryEmbedding, entityRanking, temporalRanking] = await Promise.all([
7758
7809
  // The chunk lane is cosine-only — `searchChunksOp` needs a real vector, and
7759
7810
  // there is no lexical fallback for it — so an embeddings outage must SKIP the
@@ -7791,14 +7842,17 @@ async function recall(query, ctx, options = {}) {
7791
7842
  ),
7792
7843
  wantsTemporal ? safeLane("temporal", () => buildTemporalLaneRanking(query, ctx.vaultCtx, options.now)) : Promise.resolve([])
7793
7844
  ]);
7794
- prepMs = nowMs() - prepStart;
7845
+ prepMs = nowMs2() - prepStart;
7795
7846
  if (types.includes("fact") && ctx.vaultCtx && ctx.vaultCache) {
7796
- const factStart = nowMs();
7847
+ const factStart = nowMs2();
7797
7848
  const vaultMinScore = options.minScore ?? DEFAULT_FACT_MIN_SCORE;
7798
7849
  const {
7799
7850
  results,
7800
7851
  vaultSize: size,
7801
7852
  reranked,
7853
+ rerankMs: factRerankMs,
7854
+ queryEmbedMs: factQueryEmbedMs,
7855
+ rowsEmbedded: factRowsEmbedded,
7802
7856
  hadV2Head: v2Head,
7803
7857
  embeddingsUnavailable: factEmbeddingsUnavailable,
7804
7858
  rankedOnCosine: factRankedOnCosine,
@@ -7857,16 +7911,19 @@ async function recall(query, ctx, options = {}) {
7857
7911
  );
7858
7912
  vaultSize = size;
7859
7913
  didRerank = reranked;
7914
+ rerankMs = factRerankMs;
7915
+ queryEmbedMs = factQueryEmbedMs;
7916
+ vaultRowsEmbedded = factRowsEmbedded;
7860
7917
  hadV2Head = v2Head;
7861
7918
  if (factEmbeddingsUnavailable) embeddingsUnavailable = true;
7862
7919
  factLaneRankedOnCosine = factRankedOnCosine;
7863
7920
  decryptLastRan = factDecryptLast;
7864
7921
  vaultRowsDecrypted = factRowsDecrypted;
7865
- factLaneMs = nowMs() - factStart;
7922
+ factLaneMs = nowMs2() - factStart;
7866
7923
  }
7867
7924
  if (chunkEmbedFailed && !factLaneRankedOnCosine) embeddingsUnavailable = true;
7868
7925
  if (types.includes("chunk") && ctx.storageCtx && queryEmbedding) {
7869
- const chunkStart = nowMs();
7926
+ const chunkStart = nowMs2();
7870
7927
  const chunkMinScore = options.minScore ?? DEFAULT_CHUNK_MIN_SCORE;
7871
7928
  const results = await searchChunksOp(ctx.storageCtx, queryEmbedding, {
7872
7929
  limit: types.includes("fact") ? Math.max(limit * 2, 16) : limit,
@@ -7883,9 +7940,9 @@ async function recall(query, ctx, options = {}) {
7883
7940
  (r) => r.chunkText.trim()
7884
7941
  )
7885
7942
  );
7886
- chunkLaneMs = nowMs() - chunkStart;
7943
+ chunkLaneMs = nowMs2() - chunkStart;
7887
7944
  }
7888
- const fuseStart = nowMs();
7945
+ const fuseStart = nowMs2();
7889
7946
  if (types.length === 1 || factResults.length === 0 || chunkResults.length === 0) {
7890
7947
  const memories2 = [
7891
7948
  ...factResults.map((r) => toFactMemory(r, options.now)),
@@ -7893,7 +7950,7 @@ async function recall(query, ctx, options = {}) {
7893
7950
  ];
7894
7951
  memories2.sort((a, b) => b.score - a.score);
7895
7952
  const candidateCount = factResults.length + chunkResults.length;
7896
- fuseMs = nowMs() - fuseStart;
7953
+ fuseMs = nowMs2() - fuseStart;
7897
7954
  emitDiagnostics(candidateCount);
7898
7955
  return {
7899
7956
  memories: memories2.slice(0, limit),
@@ -7948,7 +8005,7 @@ async function recall(query, ctx, options = {}) {
7948
8005
  suppressed = next;
7949
8006
  memories = selectWith(suppressed);
7950
8007
  }
7951
- fuseMs = nowMs() - fuseStart;
8008
+ fuseMs = nowMs2() - fuseStart;
7952
8009
  emitDiagnostics(byId.size);
7953
8010
  return {
7954
8011
  memories,