@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.
@@ -5155,6 +5155,9 @@ async function decomposeQuery(query, options) {
5155
5155
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
5156
5156
  model: options.model ?? DEFAULT_MODEL,
5157
5157
  systemPrompt: SYSTEM_PROMPT,
5158
+ // The query itself rides the user turn below, so SYSTEM_PROMPT is the whole
5159
+ // fixed instruction — which is what lets the portal own it outright.
5160
+ taskType: "memory_decompose",
5158
5161
  // Wrap the bare query in a task framing so the model treats it as
5159
5162
  // input to classify, not as a question to answer conversationally.
5160
5163
  // Bare-query inputs caused Anthropic models to respond with prose
@@ -5269,9 +5272,9 @@ function recencyMultiplier(updatedAt, opts = {}) {
5269
5272
  const updatedMs = updatedAt.getTime();
5270
5273
  if (!Number.isFinite(updatedMs)) return noDate;
5271
5274
  const now = opts.now ?? /* @__PURE__ */ new Date();
5272
- const nowMs2 = now.getTime();
5273
- if (!Number.isFinite(nowMs2)) return noDate;
5274
- const ageDays = Math.max(0, (nowMs2 - updatedMs) / DAY_MS);
5275
+ const nowMs3 = now.getTime();
5276
+ if (!Number.isFinite(nowMs3)) return noDate;
5277
+ const ageDays = Math.max(0, (nowMs3 - updatedMs) / DAY_MS);
5275
5278
  const perYearDecay = opts.perYearDecay ?? DEFAULT_PER_YEAR_DECAY;
5276
5279
  const floor = opts.floor ?? DEFAULT_FLOOR;
5277
5280
  const decay = perYearDecay * (ageDays / 365);
@@ -5617,6 +5620,7 @@ function createVaultEmbeddingCache(maxSize = DEFAULT_VAULT_CACHE_SIZE) {
5617
5620
  }
5618
5621
 
5619
5622
  // src/lib/memoryVault/searchTool.ts
5623
+ var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
5620
5624
  var warnedProgrammaticDecomposeIgnored = false;
5621
5625
  function normalizeEventTimeKind(kind) {
5622
5626
  return kind === "point" || kind === "range" || kind === "ongoing" ? kind : null;
@@ -5849,6 +5853,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
5849
5853
  const rerankTopN = options.rerankTopN ?? 30;
5850
5854
  const ceWeight = options.ceWeight ?? 0.1;
5851
5855
  const headSlice = v2Ranked.slice(0, rerankTopN);
5856
+ const ceStart = nowMs();
5852
5857
  try {
5853
5858
  const reranked = await rerankPairs(
5854
5859
  query,
@@ -5876,6 +5881,8 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
5876
5881
  getLogger().warn("[memory/search] cross-encoder rerank failed; using V2 ranking", err);
5877
5882
  }
5878
5883
  combined = v2Ranked;
5884
+ } finally {
5885
+ if (options.rerankStats) options.rerankStats.ms += nowMs() - ceStart;
5879
5886
  }
5880
5887
  } else {
5881
5888
  combined = v2Ranked;
@@ -6042,6 +6049,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
6042
6049
  const ceWeight = options.ceWeight ?? 0.1;
6043
6050
  const headSlice = combined.slice(0, rerankTopN);
6044
6051
  const tailSlice = combined.slice(rerankTopN);
6052
+ const ceStart = nowMs();
6045
6053
  try {
6046
6054
  const reranked = await rerankPairs(
6047
6055
  originalQuery,
@@ -6069,6 +6077,8 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
6069
6077
  err
6070
6078
  );
6071
6079
  }
6080
+ } finally {
6081
+ if (options.rerankStats) options.rerankStats.ms += nowMs() - ceStart;
6072
6082
  }
6073
6083
  }
6074
6084
  if (options?.mmr) {
@@ -6195,11 +6205,13 @@ async function buildProjectedCorpus(query, vaultCtx, embeddingOptions, cache, qu
6195
6205
  rowsDecrypted: 0
6196
6206
  };
6197
6207
  }
6208
+ const queryEmbedStart = nowMs();
6198
6209
  const queryEmbedding = await embedQueryOrDegrade(
6199
6210
  query,
6200
6211
  embeddingOptions,
6201
6212
  opts.onEmbeddingDegraded
6202
6213
  );
6214
+ if (opts.embedStats) opts.embedStats.queryMs += nowMs() - queryEmbedStart;
6203
6215
  const embeddingsDegraded = queryEmbedding.length === 0;
6204
6216
  const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
6205
6217
  const vectored = [];
@@ -6252,6 +6264,7 @@ async function buildProjectedCorpus(query, vaultCtx, embeddingOptions, cache, qu
6252
6264
  const laneRows = laneFetched.filter((m) => !isEncrypted(m.content));
6253
6265
  if (laneRows.length > 0) {
6254
6266
  let laneVecs;
6267
+ if (opts.embedStats) opts.embedStats.rowsEmbedded += laneRows.length;
6255
6268
  try {
6256
6269
  laneVecs = await generateEmbeddings(
6257
6270
  laneRows.map((m) => m.content),
@@ -6330,6 +6343,10 @@ async function buildProjectedCorpus(query, vaultCtx, embeddingOptions, cache, qu
6330
6343
  async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache, searchOptions) {
6331
6344
  if (!query || typeof query !== "string") {
6332
6345
  return {
6346
+ // Nothing was read and nothing was embedded — the short-circuit fires
6347
+ // before either.
6348
+ queryEmbedMs: 0,
6349
+ rowsEmbedded: 0,
6333
6350
  memories: [],
6334
6351
  embeddedItems: [],
6335
6352
  queryEmbedding: [],
@@ -6362,6 +6379,7 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6362
6379
  embeddingsUnavailable = true;
6363
6380
  embeddingFailure = true;
6364
6381
  };
6382
+ const embedStats = { queryMs: 0, rowsEmbedded: 0 };
6365
6383
  if (searchOptions?.decryptLast) {
6366
6384
  const forceIncludeIds = [
6367
6385
  ...searchOptions.entityRanking ?? [],
@@ -6373,7 +6391,8 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6373
6391
  admitFloor: ADMIT_FLOOR,
6374
6392
  unembeddedCap: UNEMBEDDED_CAP,
6375
6393
  ...forceIncludeIds.length > 0 && { forceIncludeIds },
6376
- onEmbeddingDegraded
6394
+ onEmbeddingDegraded,
6395
+ embedStats
6377
6396
  });
6378
6397
  if (corpus.vaultSize === 0) {
6379
6398
  return {
@@ -6384,7 +6403,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6384
6403
  embeddingsUnavailable: false,
6385
6404
  embeddingFailure: false,
6386
6405
  decryptLast: true,
6387
- rowsDecrypted: corpus.rowsDecrypted
6406
+ rowsDecrypted: corpus.rowsDecrypted,
6407
+ queryEmbedMs: embedStats.queryMs,
6408
+ rowsEmbedded: embedStats.rowsEmbedded
6388
6409
  };
6389
6410
  }
6390
6411
  ({ memories, embeddedItems, queryEmbedding, vaultSize } = corpus);
@@ -6401,7 +6422,9 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6401
6422
  decryptLast: true,
6402
6423
  // Rows WERE decrypt-attempted even though none came back readable — that
6403
6424
  // is the whole point of reporting attempts rather than successes.
6404
- rowsDecrypted: corpus.rowsDecrypted
6425
+ rowsDecrypted: corpus.rowsDecrypted,
6426
+ queryEmbedMs: embedStats.queryMs,
6427
+ rowsEmbedded: embedStats.rowsEmbedded
6405
6428
  };
6406
6429
  }
6407
6430
  } else {
@@ -6426,10 +6449,14 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6426
6449
  embeddingsUnavailable: false,
6427
6450
  embeddingFailure: false,
6428
6451
  decryptLast: false,
6429
- rowsDecrypted: loaded.length
6452
+ rowsDecrypted: loaded.length,
6453
+ queryEmbedMs: embedStats.queryMs,
6454
+ rowsEmbedded: embedStats.rowsEmbedded
6430
6455
  };
6431
6456
  }
6457
+ const legacyEmbedStart = nowMs();
6432
6458
  queryEmbedding = await embedQueryOrDegrade(query, embeddingOptions, onEmbeddingDegraded);
6459
+ embedStats.queryMs += nowMs() - legacyEmbedStart;
6433
6460
  const currentModel = embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
6434
6461
  const uncachedTexts = [];
6435
6462
  const uncachedIndices = [];
@@ -6463,6 +6490,7 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6463
6490
  }
6464
6491
  if (uncachedTexts.length > 0) {
6465
6492
  let newEmbeddings;
6493
+ embedStats.rowsEmbedded += uncachedTexts.length;
6466
6494
  try {
6467
6495
  newEmbeddings = await generateEmbeddings(uncachedTexts, embeddingOptions);
6468
6496
  } catch (err) {
@@ -6506,6 +6534,8 @@ async function prepareVaultCandidates(query, vaultCtx, embeddingOptions, cache,
6506
6534
  embeddingsUnavailable = true;
6507
6535
  }
6508
6536
  return {
6537
+ queryEmbedMs: embedStats.queryMs,
6538
+ rowsEmbedded: embedStats.rowsEmbedded,
6509
6539
  memories,
6510
6540
  embeddedItems,
6511
6541
  queryEmbedding,
@@ -6556,11 +6586,15 @@ async function rankPreparedVaultCandidates(query, prepared, embeddingOptions, se
6556
6586
  results: results2,
6557
6587
  vaultSize: out.vaultSize,
6558
6588
  reranked: out.reranked ?? false,
6589
+ // Read straight off the shared stats object rather than being passed in at
6590
+ // each call site: every return in this function funnels through here, so a
6591
+ // path added later reports the CE bill without having to remember to.
6592
+ rerankMs: rerankStats.ms,
6559
6593
  hadV2Head: out.hadV2Head ?? false,
6560
6594
  embeddingsUnavailable
6561
6595
  };
6562
6596
  };
6563
- const rerankStats = { applied: false };
6597
+ const rerankStats = { applied: false, ms: 0 };
6564
6598
  const useFusion = searchOptions?.useFusion ?? true;
6565
6599
  const tuning = {
6566
6600
  ...searchOptions?.recencyAlpha !== void 0 && { recencyAlpha: searchOptions.recencyAlpha },
@@ -6679,13 +6713,16 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
6679
6713
  results: [],
6680
6714
  vaultSize: 0,
6681
6715
  reranked: false,
6716
+ rerankMs: 0,
6682
6717
  hadV2Head: false,
6683
6718
  embeddingsUnavailable: false,
6684
6719
  rankedOnCosine: false,
6685
6720
  // No storage read happened, so nothing was decrypted; report the path the
6686
6721
  // caller asked for so this turn is still attributable.
6687
6722
  decryptLast: !!searchOptions?.decryptLast,
6688
- rowsDecrypted: 0
6723
+ rowsDecrypted: 0,
6724
+ queryEmbedMs: 0,
6725
+ rowsEmbedded: 0
6689
6726
  };
6690
6727
  }
6691
6728
  if (searchOptions?.decompose === "llm" && normalizeSubQueries(searchOptions.subQueries).length < 2 && !warnedProgrammaticDecomposeIgnored) {
@@ -6706,11 +6743,14 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
6706
6743
  results: [],
6707
6744
  vaultSize: 0,
6708
6745
  reranked: false,
6746
+ rerankMs: 0,
6709
6747
  hadV2Head: false,
6710
6748
  embeddingsUnavailable: prepared.embeddingsUnavailable,
6711
6749
  rankedOnCosine: false,
6712
6750
  decryptLast: prepared.decryptLast,
6713
- rowsDecrypted: prepared.rowsDecrypted
6751
+ rowsDecrypted: prepared.rowsDecrypted,
6752
+ queryEmbedMs: prepared.queryEmbedMs,
6753
+ rowsEmbedded: prepared.rowsEmbedded
6714
6754
  };
6715
6755
  }
6716
6756
  if (prepared.memories.length === 0) {
@@ -6718,11 +6758,14 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
6718
6758
  results: [],
6719
6759
  vaultSize: prepared.vaultSize,
6720
6760
  reranked: false,
6761
+ rerankMs: 0,
6721
6762
  hadV2Head: false,
6722
6763
  embeddingsUnavailable: prepared.embeddingsUnavailable,
6723
6764
  rankedOnCosine: false,
6724
6765
  decryptLast: prepared.decryptLast,
6725
- rowsDecrypted: prepared.rowsDecrypted
6766
+ rowsDecrypted: prepared.rowsDecrypted,
6767
+ queryEmbedMs: prepared.queryEmbedMs,
6768
+ rowsEmbedded: prepared.rowsEmbedded
6726
6769
  };
6727
6770
  }
6728
6771
  const ranked = await rankPreparedVaultCandidates(
@@ -6735,7 +6778,9 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
6735
6778
  ...ranked,
6736
6779
  rankedOnCosine: !ranked.embeddingsUnavailable,
6737
6780
  decryptLast: prepared.decryptLast,
6738
- rowsDecrypted: prepared.rowsDecrypted
6781
+ rowsDecrypted: prepared.rowsDecrypted,
6782
+ queryEmbedMs: prepared.queryEmbedMs,
6783
+ rowsEmbedded: prepared.rowsEmbedded
6739
6784
  };
6740
6785
  }
6741
6786
  async function searchVaultMemories(query, vaultCtx, embeddingOptions, cache, searchOptions) {
@@ -6840,7 +6885,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
6840
6885
  subQueries = decomp.subQueries;
6841
6886
  }
6842
6887
  }
6843
- const { recall: recall2 } = await import("./recall-WIB7RQQZ.mjs");
6888
+ const { recall: recall2 } = await import("./recall-PIATJ336.mjs");
6844
6889
  let recallDegraded = [];
6845
6890
  const result = await recall2(
6846
6891
  query,
@@ -7093,29 +7138,29 @@ async function traverseGraphLane(query, entityCtx, options = {}) {
7093
7138
  var DEFAULT_REFINER_MODEL = "inclusionai/ling-2.6-flash";
7094
7139
  var DEFAULT_REFINER_ATTEMPTS = 1;
7095
7140
  var DEFAULT_REFINER_TOTAL_TIMEOUT_MS = 8e3;
7141
+ var REFINER_SYSTEM_PROMPT = `You help a memory-retrieval system decide which related topics to explore.
7142
+
7143
+ 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.
7144
+
7145
+ Output strict JSON, no prose: { "expand": [<entity names to expand, verbatim from the list>] }`;
7096
7146
  function createLlmNeighborRefiner(options) {
7097
7147
  return {
7098
7148
  async refine(query, candidates, limit) {
7099
7149
  if (candidates.length === 0) return [];
7100
7150
  const numbered = candidates.map((name, i) => `[${i + 1}] ${name}`).join("\n");
7101
- const systemPrompt = `You help a memory-retrieval system decide which related topics to explore.
7102
-
7103
- 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.
7104
-
7105
- Output strict JSON, no prose: { "expand": [<entity names to expand, verbatim from the list>] }`;
7106
7151
  const parsed = await callPortalJsonCompletion({
7107
7152
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
7108
7153
  ...options.getToken !== void 0 && { getToken: options.getToken },
7109
7154
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
7110
7155
  taskType: "memory_graph",
7111
7156
  model: options.model ?? DEFAULT_REFINER_MODEL,
7112
- systemPrompt,
7157
+ systemPrompt: REFINER_SYSTEM_PROMPT,
7113
7158
  userMessage: `Question: ${query}
7114
7159
 
7115
7160
  Candidate topics:
7116
7161
  ${numbered}
7117
7162
 
7118
- Which should be expanded?`,
7163
+ Which should be expanded? Choose at most ${limit}.`,
7119
7164
  tag: "memory/graph-refine",
7120
7165
  maxAttempts: options.maxAttempts ?? DEFAULT_REFINER_ATTEMPTS,
7121
7166
  totalTimeoutMs: options.totalTimeoutMs ?? DEFAULT_REFINER_TOTAL_TIMEOUT_MS,
@@ -7380,7 +7425,7 @@ function scoreEventTimeOverlap(memoryStart, memoryEnd, memoryKind, window2) {
7380
7425
  var DEFAULT_LIMIT = 8;
7381
7426
  var DEFAULT_BUDGET = "low";
7382
7427
  var DEFAULT_FACT_MIN_SCORE = 0.1;
7383
- var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
7428
+ var nowMs2 = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
7384
7429
  var DEFAULT_CHUNK_MIN_SCORE = 0.5;
7385
7430
  function flagsForBudget(budget) {
7386
7431
  switch (budget) {
@@ -7413,7 +7458,7 @@ async function recall(query, ctx, options = {}) {
7413
7458
  const flags = flagsForBudget(usedBudget);
7414
7459
  const normalizedFacets = normalizeSubQueries(options.subQueries);
7415
7460
  const subQueries = normalizedFacets.length >= 2 ? normalizedFacets : void 0;
7416
- const t0 = nowMs();
7461
+ const t0 = nowMs2();
7417
7462
  let prepMs = 0;
7418
7463
  let factLaneMs = 0;
7419
7464
  let chunkLaneMs = 0;
@@ -7422,6 +7467,9 @@ async function recall(query, ctx, options = {}) {
7422
7467
  const chunkResults = [];
7423
7468
  let vaultSize;
7424
7469
  let didRerank = false;
7470
+ let rerankMs = 0;
7471
+ let queryEmbedMs = 0;
7472
+ let vaultRowsEmbedded;
7425
7473
  let hadV2Head = false;
7426
7474
  let embeddingsUnavailable = false;
7427
7475
  let chunkEmbedFailed = false;
@@ -7446,12 +7494,15 @@ async function recall(query, ctx, options = {}) {
7446
7494
  ...vaultSize !== void 0 && { vaultSize },
7447
7495
  ...decryptLastRan !== void 0 && { decryptLast: decryptLastRan },
7448
7496
  ...vaultRowsDecrypted !== void 0 && { vaultRowsDecrypted },
7497
+ ...vaultRowsEmbedded !== void 0 && { vaultRowsEmbedded },
7449
7498
  factCount: factResults.length,
7450
7499
  chunkCount: chunkResults.length,
7451
7500
  timings: {
7452
- total: nowMs() - t0,
7501
+ total: nowMs2() - t0,
7453
7502
  prep: prepMs,
7454
7503
  factLane: factLaneMs,
7504
+ rerank: rerankMs,
7505
+ queryEmbed: queryEmbedMs,
7455
7506
  chunkLane: chunkLaneMs,
7456
7507
  fuse: fuseMs
7457
7508
  },
@@ -7469,7 +7520,7 @@ async function recall(query, ctx, options = {}) {
7469
7520
  const needsChunkEmbedding = types.includes("chunk") && ctx.storageCtx;
7470
7521
  const wantsTemporal = types.includes("fact") && ctx.vaultCtx;
7471
7522
  const graphRefiner = flags.traverse && options.graphRefine && options.decomposeOptions ? createLlmNeighborRefiner(options.decomposeOptions) : void 0;
7472
- const prepStart = nowMs();
7523
+ const prepStart = nowMs2();
7473
7524
  const [queryEmbedding, entityRanking, temporalRanking] = await Promise.all([
7474
7525
  // The chunk lane is cosine-only — `searchChunksOp` needs a real vector, and
7475
7526
  // there is no lexical fallback for it — so an embeddings outage must SKIP the
@@ -7507,14 +7558,17 @@ async function recall(query, ctx, options = {}) {
7507
7558
  ),
7508
7559
  wantsTemporal ? safeLane("temporal", () => buildTemporalLaneRanking(query, ctx.vaultCtx, options.now)) : Promise.resolve([])
7509
7560
  ]);
7510
- prepMs = nowMs() - prepStart;
7561
+ prepMs = nowMs2() - prepStart;
7511
7562
  if (types.includes("fact") && ctx.vaultCtx && ctx.vaultCache) {
7512
- const factStart = nowMs();
7563
+ const factStart = nowMs2();
7513
7564
  const vaultMinScore = options.minScore ?? DEFAULT_FACT_MIN_SCORE;
7514
7565
  const {
7515
7566
  results,
7516
7567
  vaultSize: size,
7517
7568
  reranked,
7569
+ rerankMs: factRerankMs,
7570
+ queryEmbedMs: factQueryEmbedMs,
7571
+ rowsEmbedded: factRowsEmbedded,
7518
7572
  hadV2Head: v2Head,
7519
7573
  embeddingsUnavailable: factEmbeddingsUnavailable,
7520
7574
  rankedOnCosine: factRankedOnCosine,
@@ -7573,16 +7627,19 @@ async function recall(query, ctx, options = {}) {
7573
7627
  );
7574
7628
  vaultSize = size;
7575
7629
  didRerank = reranked;
7630
+ rerankMs = factRerankMs;
7631
+ queryEmbedMs = factQueryEmbedMs;
7632
+ vaultRowsEmbedded = factRowsEmbedded;
7576
7633
  hadV2Head = v2Head;
7577
7634
  if (factEmbeddingsUnavailable) embeddingsUnavailable = true;
7578
7635
  factLaneRankedOnCosine = factRankedOnCosine;
7579
7636
  decryptLastRan = factDecryptLast;
7580
7637
  vaultRowsDecrypted = factRowsDecrypted;
7581
- factLaneMs = nowMs() - factStart;
7638
+ factLaneMs = nowMs2() - factStart;
7582
7639
  }
7583
7640
  if (chunkEmbedFailed && !factLaneRankedOnCosine) embeddingsUnavailable = true;
7584
7641
  if (types.includes("chunk") && ctx.storageCtx && queryEmbedding) {
7585
- const chunkStart = nowMs();
7642
+ const chunkStart = nowMs2();
7586
7643
  const chunkMinScore = options.minScore ?? DEFAULT_CHUNK_MIN_SCORE;
7587
7644
  const results = await searchChunksOp(ctx.storageCtx, queryEmbedding, {
7588
7645
  limit: types.includes("fact") ? Math.max(limit * 2, 16) : limit,
@@ -7599,9 +7656,9 @@ async function recall(query, ctx, options = {}) {
7599
7656
  (r) => r.chunkText.trim()
7600
7657
  )
7601
7658
  );
7602
- chunkLaneMs = nowMs() - chunkStart;
7659
+ chunkLaneMs = nowMs2() - chunkStart;
7603
7660
  }
7604
- const fuseStart = nowMs();
7661
+ const fuseStart = nowMs2();
7605
7662
  if (types.length === 1 || factResults.length === 0 || chunkResults.length === 0) {
7606
7663
  const memories2 = [
7607
7664
  ...factResults.map((r) => toFactMemory(r, options.now)),
@@ -7609,7 +7666,7 @@ async function recall(query, ctx, options = {}) {
7609
7666
  ];
7610
7667
  memories2.sort((a, b) => b.score - a.score);
7611
7668
  const candidateCount = factResults.length + chunkResults.length;
7612
- fuseMs = nowMs() - fuseStart;
7669
+ fuseMs = nowMs2() - fuseStart;
7613
7670
  emitDiagnostics(candidateCount);
7614
7671
  return {
7615
7672
  memories: memories2.slice(0, limit),
@@ -7664,7 +7721,7 @@ async function recall(query, ctx, options = {}) {
7664
7721
  suppressed = next;
7665
7722
  memories = selectWith(suppressed);
7666
7723
  }
7667
- fuseMs = nowMs() - fuseStart;
7724
+ fuseMs = nowMs2() - fuseStart;
7668
7725
  emitDiagnostics(byId.size);
7669
7726
  return {
7670
7727
  memories,