@anuma/sdk 3.11.2 → 3.11.4

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.
@@ -6545,7 +6545,20 @@ type RecallDegradation =
6545
6545
  "rerank-unavailable"
6546
6546
  /** `budget: 'high'` requested but no `decomposeOptions`, so query
6547
6547
  * decomposition was skipped and the budget downgraded to mid. */
6548
- | "decompose-unavailable";
6548
+ | "decompose-unavailable"
6549
+ /** There was no usable cosine lane, so results were ranked on BM25 (lexical)
6550
+ * alone: either the query embedding failed (or came back empty), or no
6551
+ * candidate had a vector to score against it because the row (re)embed failed.
6552
+ * Also set when the chunk lane — cosine-only, with no lexical equivalent — was
6553
+ * skipped for the same reason. The embeddings provider is a single upstream
6554
+ * with no fallback, so this is a whole-provider outage rather than a per-item
6555
+ * miss — expect a quality drop, not a total loss.
6556
+ *
6557
+ * NOT set for a partial failure that leaves cosine running (a sub-query embed
6558
+ * failing back to the single-query path, or a row batch failing while other
6559
+ * rows keep usable vectors) — those are logged, not reported, so this stays a
6560
+ * reliable outage signal rather than a general embedding-error counter. */
6561
+ | "embeddings-unavailable";
6549
6562
  /**
6550
6563
  * Per-call recall observability payload (see {@link RecallOptions.onDiagnostics}).
6551
6564
  * All timings are wall-clock milliseconds. Lane counts are post-dedupe,
@@ -6545,7 +6545,20 @@ type RecallDegradation =
6545
6545
  "rerank-unavailable"
6546
6546
  /** `budget: 'high'` requested but no `decomposeOptions`, so query
6547
6547
  * decomposition was skipped and the budget downgraded to mid. */
6548
- | "decompose-unavailable";
6548
+ | "decompose-unavailable"
6549
+ /** There was no usable cosine lane, so results were ranked on BM25 (lexical)
6550
+ * alone: either the query embedding failed (or came back empty), or no
6551
+ * candidate had a vector to score against it because the row (re)embed failed.
6552
+ * Also set when the chunk lane — cosine-only, with no lexical equivalent — was
6553
+ * skipped for the same reason. The embeddings provider is a single upstream
6554
+ * with no fallback, so this is a whole-provider outage rather than a per-item
6555
+ * miss — expect a quality drop, not a total loss.
6556
+ *
6557
+ * NOT set for a partial failure that leaves cosine running (a sub-query embed
6558
+ * failing back to the single-query path, or a row batch failing while other
6559
+ * rows keep usable vectors) — those are logged, not reported, so this stays a
6560
+ * reliable outage signal rather than a general embedding-error counter. */
6561
+ | "embeddings-unavailable";
6549
6562
  /**
6550
6563
  * Per-call recall observability payload (see {@link RecallOptions.onDiagnostics}).
6551
6564
  * All timings are wall-clock milliseconds. Lane counts are post-dedupe,
@@ -5,11 +5,14 @@ import {
5
5
  DEFAULT_MIN_CHUNK_SIZE,
6
6
  DEFAULT_MIN_CONTENT_LENGTH,
7
7
  DEFAULT_VAULT_CACHE_SIZE,
8
+ EMBEDDINGS_DEGRADED_EMPTY,
8
9
  ENTITY_FANOUT,
9
10
  ENTITY_KINDS,
10
11
  LRUCache,
11
12
  MAX_HOPS,
12
13
  NODE_BUDGET,
14
+ RECALL_MAX_LIMIT,
15
+ RECALL_TOOL_NAME,
13
16
  RerankerUnavailableError,
14
17
  TOPICS_EXTRACTION_VERSION,
15
18
  TREND_RECENT_WINDOW_DAYS,
@@ -156,7 +159,7 @@ import {
156
159
  updateVaultMemoryOp,
157
160
  useEncryption,
158
161
  vaultMemoryToStored
159
- } from "./chunk-LAFUCS4U.mjs";
162
+ } from "./chunk-L2QRTJII.mjs";
160
163
  import {
161
164
  PiiRedactor,
162
165
  createStreamingDeAnonymizer,
@@ -7241,6 +7244,11 @@ async function retain(content, ctx, options = {}) {
7241
7244
  ...options.folderId !== void 0 && { folderId: options.folderId }
7242
7245
  }
7243
7246
  );
7247
+ if (prepared.embeddingFailure || prepared.embeddingsUnavailable) {
7248
+ throw new Error(
7249
+ "retain: embeddings unavailable \u2014 refusing to auto-merge against an inert cosine lane, which would create a duplicate instead of merging into the existing memory. Retry when embeddings recover, or pass enableAutoMerge: false to force a create."
7250
+ );
7251
+ }
7244
7252
  if (options.consolidateOptions) {
7245
7253
  const outcome = await tryConsolidate(trimmed, ctx, options, prepared);
7246
7254
  if (outcome) {
@@ -8473,10 +8481,6 @@ function rankProfileCandidates(inputs, now = Date.now(), options = {}) {
8473
8481
  return ranked;
8474
8482
  }
8475
8483
 
8476
- // src/lib/memory/recallConstants.ts
8477
- var RECALL_TOOL_NAME = "recall_memory";
8478
- var RECALL_MAX_LIMIT = 50;
8479
-
8480
8484
  // src/lib/memory/recallTool.ts
8481
8485
  var DEFAULT_LIMIT = 8;
8482
8486
  var DEFAULT_BUDGET = "low";
@@ -8627,7 +8631,11 @@ function createRecallTool(ctx, toolOptions, callbacks) {
8627
8631
  conversationMemories += effectiveLimit;
8628
8632
  let surfaced = 0;
8629
8633
  try {
8634
+ let recallDegraded = [];
8630
8635
  const recallOpts = {
8636
+ onDiagnostics: (d) => {
8637
+ recallDegraded = d.degraded;
8638
+ },
8631
8639
  types: defaultTypes,
8632
8640
  limit: effectiveLimit,
8633
8641
  budget: defaultBudget,
@@ -8659,6 +8667,9 @@ function createRecallTool(ctx, toolOptions, callbacks) {
8659
8667
  }
8660
8668
  }
8661
8669
  surfaced = result.memories.length;
8670
+ if (result.memories.length === 0 && recallDegraded.includes("embeddings-unavailable")) {
8671
+ return EMBEDDINGS_DEGRADED_EMPTY;
8672
+ }
8662
8673
  const formatted = formatRecallResult(result.memories);
8663
8674
  return truncatedByBudget && surfaced > 0 ? `${formatted}
8664
8675
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-LAFUCS4U.mjs";
3
+ } from "./chunk-L2QRTJII.mjs";
4
4
  import "./chunk-ILAWDQDE.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {