@anuma/sdk 6.7.2 → 6.8.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.
Files changed (32) hide show
  1. package/dist/{react/chunk-B5UPJRCU.mjs → expo/chunk-CJ32HO6Q.mjs} +62 -11
  2. package/dist/expo/{chunk-VOMDHMKH.mjs → chunk-OUFITMDL.mjs} +1 -1
  3. package/dist/expo/{chunk-2YHVYDEL.mjs → chunk-YO5UXOC4.mjs} +3 -2
  4. package/dist/{react/consolidate-ZCGS7QUA.mjs → expo/consolidate-4BMNVOL4.mjs} +3 -2
  5. package/dist/expo/index.cjs +101 -18
  6. package/dist/expo/index.d.mts +105 -2
  7. package/dist/expo/index.d.ts +105 -2
  8. package/dist/expo/index.mjs +34 -10
  9. package/dist/expo/{recall-M3JVFTZL.mjs → recall-IEKVX4JL.mjs} +2 -2
  10. package/dist/index.cjs +10 -0
  11. package/dist/index.d.mts +49 -1
  12. package/dist/index.d.ts +49 -1
  13. package/dist/index.mjs +8 -0
  14. package/dist/{expo/chunk-B5UPJRCU.mjs → react/chunk-CJ32HO6Q.mjs} +62 -11
  15. package/dist/react/{chunk-2ARMO2NN.mjs → chunk-DY5VGC6K.mjs} +1 -1
  16. package/dist/react/{chunk-S6WPXD5N.mjs → chunk-POCLKALT.mjs} +3 -2
  17. package/dist/{expo/consolidate-TWE6OSSZ.mjs → react/consolidate-5TP3J6BY.mjs} +3 -2
  18. package/dist/react/index.cjs +101 -18
  19. package/dist/react/index.d.mts +105 -2
  20. package/dist/react/index.d.ts +105 -2
  21. package/dist/react/index.mjs +34 -10
  22. package/dist/react/{recall-ROEK55FJ.mjs → recall-B2AIAPCM.mjs} +2 -2
  23. package/dist/server/{chunk-TD7SMY7C.mjs → chunk-FS6DNUNT.mjs} +3 -2
  24. package/dist/server/{chunk-VHWLLYKO.mjs → chunk-KF5OU4IN.mjs} +62 -11
  25. package/dist/server/{chunk-CR5P3YIK.mjs → chunk-MEQ2PAEX.mjs} +1 -1
  26. package/dist/server/{consolidate-FWYK5KXB.mjs → consolidate-QDWEYFTZ.mjs} +3 -2
  27. package/dist/server/index.cjs +101 -18
  28. package/dist/server/index.d.mts +105 -2
  29. package/dist/server/index.d.ts +105 -2
  30. package/dist/server/index.mjs +34 -10
  31. package/dist/server/{recall-CGDEW2LQ.mjs → recall-2GAPE2XH.mjs} +2 -2
  32. package/package.json +1 -1
@@ -17132,6 +17132,18 @@ var init_internalFlowMarker = __esm({
17132
17132
  }
17133
17133
  });
17134
17134
 
17135
+ // src/lib/taskType.ts
17136
+ function taskTypeHeader(taskType) {
17137
+ return taskType ? { [TASK_TYPE_HEADER]: taskType } : {};
17138
+ }
17139
+ var TASK_TYPE_HEADER;
17140
+ var init_taskType = __esm({
17141
+ "src/lib/taskType.ts"() {
17142
+ "use strict";
17143
+ TASK_TYPE_HEADER = "X-Anuma-Task-Type";
17144
+ }
17145
+ });
17146
+
17135
17147
  // src/lib/db/entities/types.ts
17136
17148
  function normalizeEntityName(name) {
17137
17149
  return name.trim().toLowerCase();
@@ -20617,9 +20629,15 @@ async function callPortalJsonCompletion(req) {
20617
20629
  const maxAttempts = Math.max(1, req.maxAttempts ?? 3);
20618
20630
  const startedAt = Date.now();
20619
20631
  const overBudget = () => req.totalTimeoutMs !== void 0 && Date.now() - startedAt >= req.totalTimeoutMs;
20632
+ let lastFailure;
20633
+ const giveUp = () => {
20634
+ req.onFailure?.(lastFailure ?? { reason: "network", attempts: maxAttempts });
20635
+ return null;
20636
+ };
20620
20637
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
20621
20638
  if (attempt > 1 && overBudget()) {
20622
20639
  log.warn(`[${req.tag}] over time budget before attempt ${attempt}, giving up`);
20640
+ lastFailure = { reason: "time-budget-exhausted", attempts: attempt - 1 };
20623
20641
  break;
20624
20642
  }
20625
20643
  const attemptReq = req.totalTimeoutMs !== void 0 ? {
@@ -20631,9 +20649,14 @@ async function callPortalJsonCompletion(req) {
20631
20649
  } : req;
20632
20650
  const outcome = await attemptPortalJson(attemptReq, endpoint);
20633
20651
  if (outcome.kind === "ok") return outcome.value;
20652
+ lastFailure = {
20653
+ reason: outcome.code,
20654
+ ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus },
20655
+ attempts: attempt
20656
+ };
20634
20657
  if (outcome.kind === "terminal") {
20635
20658
  log.warn(`[${req.tag}] ${outcome.reason}`);
20636
- return null;
20659
+ return giveUp();
20637
20660
  }
20638
20661
  if (attempt >= maxAttempts) {
20639
20662
  log.warn(`[${req.tag}] ${outcome.reason} \u2014 attempt ${attempt}/${maxAttempts}, giving up`);
@@ -20645,19 +20668,21 @@ async function callPortalJsonCompletion(req) {
20645
20668
  log.warn(
20646
20669
  `[${req.tag}] ${outcome.reason} \u2014 attempt ${attempt}/${maxAttempts}, over time budget, giving up`
20647
20670
  );
20671
+ lastFailure = { reason: "time-budget-exhausted", attempts: attempt };
20648
20672
  break;
20649
20673
  }
20650
20674
  log.warn(`[${req.tag}] ${outcome.reason} \u2014 attempt ${attempt}/${maxAttempts}, retrying`);
20651
20675
  if (delay > 0) await sleep(delay);
20652
20676
  }
20653
- return null;
20677
+ return giveUp();
20654
20678
  }
20655
20679
  async function attemptPortalJson(req, endpoint) {
20656
20680
  const baseUrl = req.baseUrl ?? defaultBaseUrl();
20657
20681
  const fetchImpl = req.fetchFn ?? fetch;
20658
20682
  const timeoutMs = req.timeoutMs ?? 6e4;
20659
20683
  const authHeaders = await resolvePortalAuthHeaders(req, req.tag);
20660
- if (authHeaders === null) return { kind: "terminal", reason: "auth unavailable (no token)" };
20684
+ if (authHeaders === null)
20685
+ return { kind: "terminal", code: "auth-unavailable", reason: "auth unavailable (no token)" };
20661
20686
  const isAnthropic = req.model.startsWith("anthropic/");
20662
20687
  const prefill = isAnthropic ? "{" : "";
20663
20688
  const messages = [
@@ -20684,37 +20709,67 @@ async function attemptPortalJson(req, endpoint) {
20684
20709
  try {
20685
20710
  response = await fetchImpl(`${baseUrl}${endpoint}`, {
20686
20711
  method: "POST",
20687
- headers: { ...authHeaders, "Content-Type": "application/json" },
20712
+ // Attached HERE, at the one transport every background memory op shares, so
20713
+ // a new flow gets the provenance by construction rather than by remembering.
20714
+ headers: {
20715
+ ...authHeaders,
20716
+ ...taskTypeHeader(req.taskType),
20717
+ "Content-Type": "application/json"
20718
+ },
20688
20719
  body: JSON.stringify(requestBody),
20689
20720
  signal: controller.signal
20690
20721
  });
20691
20722
  } catch (err) {
20692
20723
  clearTimeout(timer);
20693
- return { kind: "retryable", reason: `fetch failed: ${err.message}` };
20724
+ return {
20725
+ kind: "retryable",
20726
+ code: "network",
20727
+ reason: `fetch failed: ${err.message}`
20728
+ };
20694
20729
  }
20695
20730
  if (!response.ok) {
20696
20731
  clearTimeout(timer);
20697
20732
  const reason = `portal returned ${response.status}`;
20698
20733
  if (response.status === 401) {
20699
20734
  const tokenAuth = !req.apiKey && !!req.getToken;
20700
- return tokenAuth ? { kind: "retryable", reason: `${reason} (token may be expired; refreshing)` } : { kind: "terminal", reason };
20701
- }
20702
- if (!isRetryableStatus(response.status)) return { kind: "terminal", reason };
20735
+ return tokenAuth ? {
20736
+ kind: "retryable",
20737
+ code: "http-retryable",
20738
+ reason: `${reason} (token may be expired; refreshing)`,
20739
+ httpStatus: response.status
20740
+ } : { kind: "terminal", code: "http-terminal", reason, httpStatus: response.status };
20741
+ }
20742
+ if (!isRetryableStatus(response.status))
20743
+ return { kind: "terminal", code: "http-terminal", reason, httpStatus: response.status };
20703
20744
  const retryAfterMs = parseRetryAfterMs(response.headers.get("retry-after"));
20704
- return retryAfterMs !== null ? { kind: "retryable", reason, retryAfterMs } : { kind: "retryable", reason };
20745
+ return {
20746
+ kind: "retryable",
20747
+ code: "http-retryable",
20748
+ reason,
20749
+ httpStatus: response.status,
20750
+ ...retryAfterMs !== null && { retryAfterMs }
20751
+ };
20705
20752
  }
20706
20753
  let body;
20707
20754
  try {
20708
20755
  body = await response.json();
20709
20756
  } catch (err) {
20710
20757
  clearTimeout(timer);
20711
- return { kind: "retryable", reason: `response body parse failed: ${err.message}` };
20758
+ return {
20759
+ kind: "retryable",
20760
+ code: "body-parse-failed",
20761
+ reason: `response body parse failed: ${err.message}`
20762
+ };
20712
20763
  }
20713
20764
  clearTimeout(timer);
20714
20765
  logPortalUsage(body, req.tag);
20715
20766
  const rawContent = extractCompletionContent(body);
20716
20767
  if (!rawContent) {
20717
- return { kind: "retryable", reason: "portal response had no completion content" };
20768
+ return {
20769
+ kind: "retryable",
20770
+ code: "empty-content",
20771
+ reason: "portal response had no completion content"
20772
+ };
20718
20773
  }
20719
20774
  const looksLikeContinuation = prefill && /^\s*"/.test(rawContent);
20720
20775
  const content = looksLikeContinuation ? prefill + rawContent : rawContent;
@@ -20725,11 +20780,12 @@ async function attemptPortalJson(req, endpoint) {
20725
20780
  } catch (err) {
20726
20781
  return {
20727
20782
  kind: "retryable",
20783
+ code: "invalid-json",
20728
20784
  reason: `completion was not valid JSON: ${err.message}`
20729
20785
  };
20730
20786
  }
20731
20787
  if (value === null) {
20732
- return { kind: "retryable", reason: "completion parsed to null" };
20788
+ return { kind: "retryable", code: "null-completion", reason: "completion parsed to null" };
20733
20789
  }
20734
20790
  return { kind: "ok", value };
20735
20791
  }
@@ -20806,6 +20862,7 @@ var init_portalLlm = __esm({
20806
20862
  init_endpointOverride();
20807
20863
  init_internalFlowMarker();
20808
20864
  init_logger();
20865
+ init_taskType();
20809
20866
  RESPONSE_FORMAT_OK = /* @__PURE__ */ new Set(["openai", "inclusionai", "deepseek"]);
20810
20867
  RESPONSE_SCHEMA_OK = /* @__PURE__ */ new Set(["openai"]);
20811
20868
  RETRYABLE_HTTP = /* @__PURE__ */ new Set([408, 409, 425, 429]);
@@ -21139,6 +21196,7 @@ Output strict JSON, no prose: { "expand": [<entity names to expand, verbatim fro
21139
21196
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
21140
21197
  ...options.getToken !== void 0 && { getToken: options.getToken },
21141
21198
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
21199
+ taskType: "memory_graph",
21142
21200
  model: options.model ?? DEFAULT_REFINER_MODEL,
21143
21201
  systemPrompt,
21144
21202
  userMessage: `Question: ${query}
@@ -23874,6 +23932,7 @@ ${candidateText}`;
23874
23932
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
23875
23933
  ...options.getToken !== void 0 && { getToken: options.getToken },
23876
23934
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
23935
+ taskType: "memory_consolidate",
23877
23936
  model: options.model ?? DEFAULT_CONSOLIDATION_MODEL,
23878
23937
  systemPrompt: SYSTEM_PROMPT3,
23879
23938
  userMessage,
@@ -26748,6 +26807,7 @@ init_types2();
26748
26807
  init_clientConfig();
26749
26808
  init_internalFlowMarker();
26750
26809
  init_logger();
26810
+ init_taskType();
26751
26811
  var DEFAULT_SUMMARY_TOKEN_THRESHOLD = 4e3;
26752
26812
  var DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES = 4;
26753
26813
  var DEFAULT_SUMMARY_MODEL = "cerebras/qwen-3-235b-a22b-instruct-2507";
@@ -26934,7 +26994,12 @@ async function callSummarizationLlm(prompt, model, token, baseUrl) {
26934
26994
  method: "POST",
26935
26995
  headers: {
26936
26996
  "Content-Type": "application/json",
26937
- Authorization: `Bearer ${token}`
26997
+ Authorization: `Bearer ${token}`,
26998
+ // Names the task so the portal can own this prompt server-side instead of
26999
+ // trusting the one we build. Summarization is the archetypal Class-B flow:
27000
+ // one fixed purpose, no conversation, and today its instructions are ours
27001
+ // to reword.
27002
+ ...taskTypeHeader("summarize")
26938
27003
  },
26939
27004
  body: JSON.stringify({
26940
27005
  model,
@@ -28777,6 +28842,7 @@ async function classifyInjectionCandidates(candidates, options) {
28777
28842
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
28778
28843
  ...options.getToken !== void 0 && { getToken: options.getToken },
28779
28844
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
28845
+ taskType: "memory_injection_check",
28780
28846
  model: options.model ?? DEFAULT_MODEL2,
28781
28847
  systemPrompt: SYSTEM_PROMPT2,
28782
28848
  userMessage: `Candidate facts:
@@ -29478,10 +29544,15 @@ async function extractFacts(messages, options) {
29478
29544
  }
29479
29545
  const transcript = transcriptLines.join("\n");
29480
29546
  const today = formatLocalDate(options.now ?? Date.now());
29547
+ let failure;
29481
29548
  const parsed = await callPortalJsonCompletion({
29549
+ onFailure: (f) => {
29550
+ failure = f;
29551
+ },
29482
29552
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
29483
29553
  ...options.getToken !== void 0 && { getToken: options.getToken },
29484
29554
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
29555
+ taskType: "memory_extract",
29485
29556
  ...options.endpointOverride !== void 0 && {
29486
29557
  endpointOverride: options.endpointOverride
29487
29558
  },
@@ -29501,7 +29572,7 @@ Extract durable user facts.`,
29501
29572
  ...options.backoffMs && { backoffMs: options.backoffMs }
29502
29573
  });
29503
29574
  if (parsed === null) {
29504
- options.onExhaustedEmpty?.();
29575
+ options.onExhaustedEmpty?.(failure ?? { reason: "empty-content", attempts: 1 });
29505
29576
  return [];
29506
29577
  }
29507
29578
  const fallbackSourceId = [...messages].reverse().find((m) => m.role === "user")?.id;
@@ -29545,14 +29616,16 @@ async function extractAndRetain(messages, retainCtx, options) {
29545
29616
  ...resolvedConsolidatePii !== void 0 && { piiRedaction: resolvedConsolidatePii }
29546
29617
  } : void 0;
29547
29618
  let exhaustedEmpty = false;
29619
+ let exhaustedFailure;
29548
29620
  let droppedAfterRedaction = false;
29549
29621
  const callerOnExhaustedEmpty = options.extract.onExhaustedEmpty;
29550
29622
  const callerOnCandidatesDropped = options.extract.onCandidatesDropped;
29551
29623
  const candidates = await extractFacts(messages, {
29552
29624
  ...options.extract,
29553
- onExhaustedEmpty: () => {
29625
+ onExhaustedEmpty: (failure) => {
29554
29626
  exhaustedEmpty = true;
29555
- callerOnExhaustedEmpty?.();
29627
+ exhaustedFailure = failure;
29628
+ callerOnExhaustedEmpty?.(failure);
29556
29629
  },
29557
29630
  onCandidatesDropped: () => {
29558
29631
  droppedAfterRedaction = true;
@@ -29671,12 +29744,19 @@ async function extractAndRetain(messages, retainCtx, options) {
29671
29744
  results,
29672
29745
  failedCount: failedWrites,
29673
29746
  outcome,
29674
- quarantined: quarantinedInfo
29747
+ quarantined: quarantinedInfo,
29748
+ // Only meaningful alongside `outcome: "empty-after-retry"`. Returned as well
29749
+ // as pushed through the callback so a consumer that only inspects the result
29750
+ // (rather than wiring a hook) can still report WHY.
29751
+ ...exhaustedFailure !== void 0 && { failure: exhaustedFailure }
29675
29752
  };
29676
29753
  }
29754
+ var UTTERANCE_ECHO_RE = /^(?:said|says|asked|answered|replied|guessed|typed)\s*:\s*(?:'[^']*'|"[^"]*"|‘[^’]*’|“[^”]*”)[\s.!?]*$/iu;
29677
29755
  function isLowSignalContent(content, ownNames) {
29678
- const normalized = content.trim().replace(/[.!?]+$/, "").toLowerCase();
29756
+ const trimmed = content.trim();
29757
+ const normalized = trimmed.replace(/[.!?]+$/, "").toLowerCase();
29679
29758
  if (normalized.length < MIN_CONTENT_LENGTH) return true;
29759
+ if (UTTERANCE_ECHO_RE.test(trimmed)) return true;
29680
29760
  if (ownNames.some(
29681
29761
  (n) => normalized === n.trim().replace(/[.!?]+$/, "").toLowerCase()
29682
29762
  )) {
@@ -30041,6 +30121,7 @@ function createLlmDecayClassifier(options) {
30041
30121
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
30042
30122
  ...options.getToken !== void 0 && { getToken: options.getToken },
30043
30123
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
30124
+ taskType: "memory_decay",
30044
30125
  model: options.model ?? DEFAULT_MODEL3,
30045
30126
  systemPrompt: SYSTEM_PROMPT5,
30046
30127
  userMessage: `Memory content:
@@ -31198,6 +31279,7 @@ When a memory refers to one of these, reuse the EXACT existing name (same spelli
31198
31279
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
31199
31280
  ...options.getToken !== void 0 && { getToken: options.getToken },
31200
31281
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
31282
+ taskType: "memory_topic",
31201
31283
  ...options.endpointOverride !== void 0 && {
31202
31284
  endpointOverride: options.endpointOverride
31203
31285
  },
@@ -31391,6 +31473,7 @@ ${evidence}`);
31391
31473
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
31392
31474
  ...options.getToken !== void 0 && { getToken: options.getToken },
31393
31475
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
31476
+ taskType: "memory_verify_support",
31394
31477
  model: options.model ?? DEFAULT_MODEL5,
31395
31478
  systemPrompt: SYSTEM_PROMPT7,
31396
31479
  userMessage: `Stored facts and their sources:
@@ -4680,6 +4680,44 @@ interface EntityOperationsContext {
4680
4680
  allowUnscopedRows?: boolean;
4681
4681
  }
4682
4682
 
4683
+ /**
4684
+ * Shared portal LLM call for the memory pipeline.
4685
+ *
4686
+ * The three LLM-driven steps (`extractFacts`, `consolidateMemory`,
4687
+ * `decomposeQuery`) share the same shape: POST to `/api/v1/chat/completions`
4688
+ * with a system+user prompt and `response_format: json_object`, parse
4689
+ * `choices[0].message.content` as JSON, validate, return null on any failure.
4690
+ * This helper owns the fetch+timeout+parse+log boilerplate so each caller
4691
+ * stays focused on its prompt and validator.
4692
+ *
4693
+ * PROMPT CACHING. The portal inserts explicit prompt-cache breakpoints only for
4694
+ * `anthropic/` models. Its request schema does carry OpenAI's
4695
+ * `prompt_cache_key`, but that is a routing hint for OpenAI's own implicit
4696
+ * cache rather than a switch that enables caching, and we deliberately don't
4697
+ * send it: the memory pipeline runs open-weights models by default (gpt-oss for
4698
+ * extraction/topics, ling for consolidation), and this module already has one
4699
+ * hard lesson about OpenAI-standard fields a non-OpenAI provider hard-400s on
4700
+ * (`response_format`, below). Revisit only with a verified per-provider gate.
4701
+ *
4702
+ * So on the models this pipeline actually uses, the only cache that can hit is
4703
+ * the provider's own implicit prefix cache — which makes prefix stability the
4704
+ * one lever a caller controls. Messages are assembled system-first (below), so
4705
+ * every caller must pass a CONSTANT `systemPrompt` and keep all per-call
4706
+ * material in `userMessage`: a single interpolated timestamp, id, or count in a
4707
+ * system prompt shifts every byte after it and misses the cache on every
4708
+ * request thereafter. The memory callers are regression-gated on that property
4709
+ * in `promptPrefixStability.test.ts`.
4710
+ *
4711
+ * Whether those implicit caches hit is observable: each successful response
4712
+ * logs the portal's reported token counts at debug level, including
4713
+ * `portal.cached_tokens` (the prompt tokens the provider served from cache —
4714
+ * the portal omits the field when there was no hit). See {@link logPortalUsage}.
4715
+ *
4716
+ * There is no batch/async-bulk route on the portal, so a backfill or reindex
4717
+ * has no discounted-throughput path either; its only levers are the same stable
4718
+ * prefix and caller-side batching (e.g. topicExtract's 10-memories-per-call).
4719
+ */
4720
+
4683
4721
  /**
4684
4722
  * Auth for portal LLM calls (extraction, consolidation, decomposition,
4685
4723
  * reflection). Mirrors `memoryEngine`'s `EmbeddingOptions` dual-auth:
@@ -4698,6 +4736,60 @@ interface PortalLlmAuth {
4698
4736
  /** Function to get an auth token (e.g., Privy's getIdentityToken). Token is sent as `Authorization: Bearer`. */
4699
4737
  getToken?: () => Promise<string | null>;
4700
4738
  }
4739
+ /**
4740
+ * Why a portal JSON completion gave up, as a STABLE low-cardinality code.
4741
+ *
4742
+ * The retry loop has always classified its failures precisely, but only as an
4743
+ * interpolated `reason` string for `log.warn` — and prod ships no SDK log
4744
+ * (sdk#883), so in production every one of these collapsed into a single
4745
+ * `empty-after-retry` with no way to tell them apart. That is what made the
4746
+ * 2026-08-11 audit need a Prometheus cross-check to discover that the portal
4747
+ * was returning HTTP 200 with an empty body on ~60% of extraction turns.
4748
+ *
4749
+ * Codes are deliberately an enum, not the `reason` string: the strings embed
4750
+ * status codes and error messages, so they are unbounded and useless as an
4751
+ * analytics property. Keep this list SHORT and stable — it is a telemetry
4752
+ * contract, and a value added here has to mean the same thing in six months.
4753
+ *
4754
+ * @public
4755
+ */
4756
+ type PortalLlmFailureReason =
4757
+ /** No usable credential — `getToken` returned null or threw. Terminal. */
4758
+ "auth-unavailable"
4759
+ /** Non-retryable HTTP status (400/403/404, or 401 on the static-apiKey path). */
4760
+ | "http-terminal"
4761
+ /** Retryable status (408/409/425/429/5xx) that never succeeded. */
4762
+ | "http-retryable"
4763
+ /** Network error or the per-attempt timeout aborted the fetch. */
4764
+ | "network"
4765
+ /** HTTP 200 but the envelope itself wasn't JSON. */
4766
+ | "body-parse-failed"
4767
+ /**
4768
+ * HTTP 200 with NO completion content. The reasoning-class failure mode:
4769
+ * the model spends its budget on unreturned thinking and answers empty.
4770
+ */
4771
+ | "empty-content"
4772
+ /** Content present, but no parseable JSON in it (prose, a clarifying question). */
4773
+ | "invalid-json"
4774
+ /** Content parsed to a literal `null`, which is never a valid response. */
4775
+ | "null-completion"
4776
+ /** `totalTimeoutMs` was spent before the next attempt could run. */
4777
+ | "time-budget-exhausted";
4778
+ /**
4779
+ * A give-up report: the classified {@link PortalLlmFailureReason} plus the
4780
+ * little context worth carrying into telemetry. Both extra fields are bounded
4781
+ * (a status code, a small attempt count), so both are safe as event properties.
4782
+ *
4783
+ * @public
4784
+ */
4785
+ interface PortalLlmFailure {
4786
+ /** Stable code for the last failure observed. */
4787
+ reason: PortalLlmFailureReason;
4788
+ /** HTTP status, when the failure was an HTTP one. */
4789
+ httpStatus?: number;
4790
+ /** How many attempts ran before giving up (1-based, ≥ 1). */
4791
+ attempts: number;
4792
+ }
4701
4793
 
4702
4794
  /**
4703
4795
  * Optional LLM injection classifier — Tier-0 security second layer (PR5).
@@ -5893,8 +5985,14 @@ interface ExtractFactsOptions extends PortalLlmAuth {
5893
5985
  * `{candidates: []}` "nothing durable here". Lets callers distinguish a
5894
5986
  * silently-degrading extractor from quiet turns (the two are otherwise
5895
5987
  * indistinguishable). See {@link extractAndRetain}'s `outcome`.
5988
+ *
5989
+ * Receives the classified {@link PortalLlmFailure}. Knowing THAT extraction
5990
+ * failed was not enough: the 2026-08-11 audit found ~60% of production turns
5991
+ * ending here and had to cross-check Prometheus to learn that the cause was
5992
+ * HTTP-200-with-empty-body rather than the 403 everyone assumed. Forward
5993
+ * `failure.reason` into analytics so the next such question is a query.
5896
5994
  */
5897
- onExhaustedEmpty?: () => void;
5995
+ onExhaustedEmpty?: (failure: PortalLlmFailure) => void;
5898
5996
  /**
5899
5997
  * Called when the extractor DID produce candidates but PII de-anonymization
5900
5998
  * dropped every one of them — the model mangled its placeholders (so they
@@ -6017,6 +6115,11 @@ declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: Ret
6017
6115
  * "extracted but held for review".
6018
6116
  */
6019
6117
  quarantined: QuarantinedMemoryInfo[];
6118
+ /**
6119
+ * Present only when `outcome` is `empty-after-retry` — the classified cause of
6120
+ * the give-up, so "extraction is failing" can be reported as *why* it failed.
6121
+ */
6122
+ failure?: PortalLlmFailure;
6020
6123
  }>;
6021
6124
 
6022
6125
  /**
@@ -10275,4 +10378,4 @@ declare function sanitizeQuotes(s: string): string;
10275
10378
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
10276
10379
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
10277
10380
 
10278
- export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LlmTokenUsage, MAX_HOPS, MAX_MESSAGES_PER_SUMMARIZATION, MEDIUM_TTL_MS, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, Message, type MessageChunk, type MessageFeedback, type MessageOrigin, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type PublishedPhotoMemory, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunTerminalState, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, type SynthesizeProfileOptions, TOOL_CATALOG, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, VaultMemory, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, capHopsForDensity, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessageOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultMemoryOp, getVideosOp, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, onKeyAvailable, parseMedia, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serverPlatformStorage, setMemoryVisibilityOp, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, summaryToSystemMessage, supersedeVaultMemoryOp, synthesizeProfile, toolSetSystemPrompts, traverseGraphLane, ttlForType, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp, verifyMemoriesForPublish };
10381
+ export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LlmTokenUsage, MAX_HOPS, MAX_MESSAGES_PER_SUMMARIZATION, MEDIUM_TTL_MS, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, Message, type MessageChunk, type MessageFeedback, type MessageOrigin, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type PublishedPhotoMemory, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunTerminalState, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, type SynthesizeProfileOptions, TOOL_CATALOG, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, VaultMemory, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, capHopsForDensity, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessageOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultMemoryOp, getVideosOp, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, onKeyAvailable, parseMedia, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serverPlatformStorage, setMemoryVisibilityOp, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, summaryToSystemMessage, supersedeVaultMemoryOp, synthesizeProfile, toolSetSystemPrompts, traverseGraphLane, ttlForType, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp, verifyMemoriesForPublish };