@anuma/sdk 6.18.0 → 6.19.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 (30) hide show
  1. package/dist/expo/{chunk-JXN7LD6B.mjs → chunk-L253L67R.mjs} +2 -2
  2. package/dist/expo/{chunk-4Z2X4UYQ.mjs → chunk-WUG6GTHO.mjs} +10 -1
  3. package/dist/expo/{chunk-A2G6TRUK.mjs → chunk-XDBX4FZY.mjs} +1 -1
  4. package/dist/{react/consolidate-7NMKF7UC.mjs → expo/consolidate-XBYKAFKT.mjs} +2 -2
  5. package/dist/expo/index.cjs +12 -2
  6. package/dist/expo/index.d.mts +27 -1
  7. package/dist/expo/index.d.ts +27 -1
  8. package/dist/expo/index.mjs +6 -5
  9. package/dist/expo/{recall-TGRI5MN4.mjs → recall-B3PUQHJK.mjs} +2 -2
  10. package/dist/index.d.mts +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/react/{chunk-7X7BNMGS.mjs → chunk-AVYB5IXC.mjs} +1 -1
  13. package/dist/react/{chunk-TVPCH7ZZ.mjs → chunk-JRJRRO4P.mjs} +2 -2
  14. package/dist/react/{chunk-4Z2X4UYQ.mjs → chunk-WUG6GTHO.mjs} +10 -1
  15. package/dist/{expo/consolidate-ZM5JNULQ.mjs → react/consolidate-URHGJT7I.mjs} +2 -2
  16. package/dist/react/index.cjs +12 -2
  17. package/dist/react/index.d.mts +27 -1
  18. package/dist/react/index.d.ts +27 -1
  19. package/dist/react/index.mjs +6 -5
  20. package/dist/react/{recall-OKNLU335.mjs → recall-WPYCG4ED.mjs} +2 -2
  21. package/dist/server/{chunk-K7H7ICPK.mjs → chunk-2A6HXY4P.mjs} +2 -2
  22. package/dist/server/{chunk-4LPSEROP.mjs → chunk-RKQ4MRS2.mjs} +1 -1
  23. package/dist/server/{chunk-BSCEZOIW.mjs → chunk-YXL5VKCO.mjs} +10 -1
  24. package/dist/server/{consolidate-MSAXASHL.mjs → consolidate-54P6QZKU.mjs} +2 -2
  25. package/dist/server/index.cjs +12 -2
  26. package/dist/server/index.d.mts +27 -1
  27. package/dist/server/index.d.ts +27 -1
  28. package/dist/server/index.mjs +6 -5
  29. package/dist/server/{recall-YXJATOSD.mjs → recall-JPIWNKA7.mjs} +2 -2
  30. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  callPortalJsonCompletion,
3
3
  getLogger
4
- } from "./chunk-4Z2X4UYQ.mjs";
4
+ } from "./chunk-WUG6GTHO.mjs";
5
5
  import {
6
6
  BASE_URL,
7
7
  createClientConfig
@@ -6908,7 +6908,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
6908
6908
  subQueries = decomp.subQueries;
6909
6909
  }
6910
6910
  }
6911
- const { recall: recall2 } = await import("./recall-TGRI5MN4.mjs");
6911
+ const { recall: recall2 } = await import("./recall-B3PUQHJK.mjs");
6912
6912
  let recallDegraded = [];
6913
6913
  const result = await recall2(
6914
6914
  query,
@@ -172,7 +172,16 @@ async function callPortalJsonCompletion(req) {
172
172
  ...reinforce && { reinforceJsonContract: true }
173
173
  } : reinforce ? { ...req, reinforceJsonContract: true } : req;
174
174
  const outcome = await attemptPortalJson(attemptReq, endpoint);
175
- if (outcome.kind === "ok") return outcome.value;
175
+ if (outcome.kind === "ok") {
176
+ req.onAttempt?.({ attempt, ok: true });
177
+ return outcome.value;
178
+ }
179
+ req.onAttempt?.({
180
+ attempt,
181
+ ok: false,
182
+ reason: outcome.code,
183
+ ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus }
184
+ });
176
185
  lastFailure = {
177
186
  reason: outcome.code,
178
187
  ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus },
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getLogger
3
- } from "./chunk-4Z2X4UYQ.mjs";
3
+ } from "./chunk-WUG6GTHO.mjs";
4
4
 
5
5
  // src/lib/pii/patterns.ts
6
6
  function luhnCheck(digits) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  notifyConsolidationFallback,
3
3
  resolvePiiRedactor
4
- } from "./chunk-7X7BNMGS.mjs";
4
+ } from "./chunk-XDBX4FZY.mjs";
5
5
  import {
6
6
  callPortalJsonCompletion
7
- } from "./chunk-4Z2X4UYQ.mjs";
7
+ } from "./chunk-WUG6GTHO.mjs";
8
8
  import "./chunk-GYKJOWEO.mjs";
9
9
 
10
10
  // src/lib/memory/consolidate.ts
@@ -6261,7 +6261,16 @@ async function callPortalJsonCompletion(req) {
6261
6261
  ...reinforce && { reinforceJsonContract: true }
6262
6262
  } : reinforce ? { ...req, reinforceJsonContract: true } : req;
6263
6263
  const outcome = await attemptPortalJson(attemptReq, endpoint);
6264
- if (outcome.kind === "ok") return outcome.value;
6264
+ if (outcome.kind === "ok") {
6265
+ req.onAttempt?.({ attempt, ok: true });
6266
+ return outcome.value;
6267
+ }
6268
+ req.onAttempt?.({
6269
+ attempt,
6270
+ ok: false,
6271
+ reason: outcome.code,
6272
+ ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus }
6273
+ });
6265
6274
  lastFailure = {
6266
6275
  reason: outcome.code,
6267
6276
  ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus },
@@ -16861,7 +16870,8 @@ Extract durable user facts.`,
16861
16870
  ...options.maxAttempts !== void 0 && { maxAttempts: options.maxAttempts },
16862
16871
  ...options.timeoutMs !== void 0 && { timeoutMs: options.timeoutMs },
16863
16872
  ...options.totalTimeoutMs !== void 0 && { totalTimeoutMs: options.totalTimeoutMs },
16864
- ...options.backoffMs && { backoffMs: options.backoffMs }
16873
+ ...options.backoffMs && { backoffMs: options.backoffMs },
16874
+ ...options.onAttempt && { onAttempt: options.onAttempt }
16865
16875
  });
16866
16876
  if (parsed === null) {
16867
16877
  options.onExhaustedEmpty?.(failure ?? { reason: "empty-content", attempts: 1 });
@@ -5002,7 +5002,7 @@ interface EntityOperationsContext {
5002
5002
  *
5003
5003
  * @public
5004
5004
  */
5005
- type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
5005
+ type TaskType = "title" | "commit_message" | "memory_extract" | "memory_import_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
5006
5006
 
5007
5007
  /**
5008
5008
  * Shared portal LLM call for the memory pipeline.
@@ -5099,6 +5099,26 @@ type PortalLlmFailureReason =
5099
5099
  | "null-completion"
5100
5100
  /** `totalTimeoutMs` was spent before the next attempt could run. */
5101
5101
  | "time-budget-exhausted";
5102
+ /**
5103
+ * One attempt of a {@link callPortalJsonCompletion} call, reported to
5104
+ * `onAttempt` as it settles — success included. The wire-level diagnostic the
5105
+ * give-up hook cannot provide: a call that succeeds on its third try returns a
5106
+ * value and fires no `onFailure`, yet it cost three completions and its first
5107
+ * two answers were unusable. Extraction quality regressions have hidden in
5108
+ * exactly that shape (a prompt change that made the model answer `NONE` first,
5109
+ * JSON on retry), so the extraction eval gates on the first-attempt clean rate.
5110
+ *
5111
+ * @public
5112
+ */
5113
+ interface PortalLlmAttempt {
5114
+ /** 1-based attempt index. */
5115
+ attempt: number;
5116
+ /** Whether this attempt produced a parseable JSON value. */
5117
+ ok: boolean;
5118
+ /** Classification when `ok` is false. */
5119
+ reason?: PortalLlmFailureReason;
5120
+ httpStatus?: number;
5121
+ }
5102
5122
  /**
5103
5123
  * A give-up report: the classified {@link PortalLlmFailureReason} plus the
5104
5124
  * little context worth carrying into telemetry. Both extra fields are bounded
@@ -6278,6 +6298,12 @@ interface ExtractFactsOptions extends PortalLlmAuth {
6278
6298
  * (i.e. redaction silently eating facts) is alarmable.
6279
6299
  */
6280
6300
  onCandidatesDropped?: () => void;
6301
+ /**
6302
+ * Per-attempt wire diagnostic, forwarded to {@link callPortalJsonCompletion}.
6303
+ * The extraction eval gates on it (first-attempt clean rate); production
6304
+ * callers may leave it unset.
6305
+ */
6306
+ onAttempt?: (attempt: PortalLlmAttempt) => void;
6281
6307
  }
6282
6308
  /**
6283
6309
  * Stage 1 — call the LLM to extract candidate facts from the recent
@@ -5002,7 +5002,7 @@ interface EntityOperationsContext {
5002
5002
  *
5003
5003
  * @public
5004
5004
  */
5005
- type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
5005
+ type TaskType = "title" | "commit_message" | "memory_extract" | "memory_import_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
5006
5006
 
5007
5007
  /**
5008
5008
  * Shared portal LLM call for the memory pipeline.
@@ -5099,6 +5099,26 @@ type PortalLlmFailureReason =
5099
5099
  | "null-completion"
5100
5100
  /** `totalTimeoutMs` was spent before the next attempt could run. */
5101
5101
  | "time-budget-exhausted";
5102
+ /**
5103
+ * One attempt of a {@link callPortalJsonCompletion} call, reported to
5104
+ * `onAttempt` as it settles — success included. The wire-level diagnostic the
5105
+ * give-up hook cannot provide: a call that succeeds on its third try returns a
5106
+ * value and fires no `onFailure`, yet it cost three completions and its first
5107
+ * two answers were unusable. Extraction quality regressions have hidden in
5108
+ * exactly that shape (a prompt change that made the model answer `NONE` first,
5109
+ * JSON on retry), so the extraction eval gates on the first-attempt clean rate.
5110
+ *
5111
+ * @public
5112
+ */
5113
+ interface PortalLlmAttempt {
5114
+ /** 1-based attempt index. */
5115
+ attempt: number;
5116
+ /** Whether this attempt produced a parseable JSON value. */
5117
+ ok: boolean;
5118
+ /** Classification when `ok` is false. */
5119
+ reason?: PortalLlmFailureReason;
5120
+ httpStatus?: number;
5121
+ }
5102
5122
  /**
5103
5123
  * A give-up report: the classified {@link PortalLlmFailureReason} plus the
5104
5124
  * little context worth carrying into telemetry. Both extra fields are bounded
@@ -6278,6 +6298,12 @@ interface ExtractFactsOptions extends PortalLlmAuth {
6278
6298
  * (i.e. redaction silently eating facts) is alarmable.
6279
6299
  */
6280
6300
  onCandidatesDropped?: () => void;
6301
+ /**
6302
+ * Per-attempt wire diagnostic, forwarded to {@link callPortalJsonCompletion}.
6303
+ * The extraction eval gates on it (first-attempt clean rate); production
6304
+ * callers may leave it unset.
6305
+ */
6306
+ onAttempt?: (attempt: PortalLlmAttempt) => void;
6281
6307
  }
6282
6308
  /**
6283
6309
  * Stage 1 — call the LLM to extract candidate facts from the recent
@@ -133,7 +133,7 @@ import {
133
133
  upsertMessageOp,
134
134
  useEncryption,
135
135
  vaultMemoryToStored
136
- } from "./chunk-JXN7LD6B.mjs";
136
+ } from "./chunk-L253L67R.mjs";
137
137
  import {
138
138
  PII_PATTERNS,
139
139
  PiiRedactor,
@@ -141,7 +141,7 @@ import {
141
141
  isPiiRedactor,
142
142
  notifyConsolidationFallback,
143
143
  resolvePiiRedactor
144
- } from "./chunk-A2G6TRUK.mjs";
144
+ } from "./chunk-XDBX4FZY.mjs";
145
145
  import {
146
146
  INTERNAL_FLOW_MARKER,
147
147
  callPortalJsonCompletion,
@@ -157,7 +157,7 @@ import {
157
157
  taskTypeHeader,
158
158
  validateEndpointOverride,
159
159
  withInternalFlowMarker
160
- } from "./chunk-4Z2X4UYQ.mjs";
160
+ } from "./chunk-WUG6GTHO.mjs";
161
161
  import {
162
162
  BASE_URL,
163
163
  MCP_R2_DOMAIN,
@@ -6893,7 +6893,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
6893
6893
  content: m.content,
6894
6894
  similarity: m.similarity
6895
6895
  }));
6896
- const { consolidateMemory: doConsolidate } = await import("./consolidate-ZM5JNULQ.mjs");
6896
+ const { consolidateMemory: doConsolidate } = await import("./consolidate-XBYKAFKT.mjs");
6897
6897
  const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
6898
6898
  if (decision.action === "create") return null;
6899
6899
  if (decision.action === "supersede" && decision.content) {
@@ -7135,7 +7135,8 @@ Extract durable user facts.`,
7135
7135
  ...options.maxAttempts !== void 0 && { maxAttempts: options.maxAttempts },
7136
7136
  ...options.timeoutMs !== void 0 && { timeoutMs: options.timeoutMs },
7137
7137
  ...options.totalTimeoutMs !== void 0 && { totalTimeoutMs: options.totalTimeoutMs },
7138
- ...options.backoffMs && { backoffMs: options.backoffMs }
7138
+ ...options.backoffMs && { backoffMs: options.backoffMs },
7139
+ ...options.onAttempt && { onAttempt: options.onAttempt }
7139
7140
  });
7140
7141
  if (parsed === null) {
7141
7142
  options.onExhaustedEmpty?.(failure ?? { reason: "empty-content", attempts: 1 });
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-JXN7LD6B.mjs";
4
- import "./chunk-4Z2X4UYQ.mjs";
3
+ } from "./chunk-L253L67R.mjs";
4
+ import "./chunk-WUG6GTHO.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
7
7
  recall
package/dist/index.d.mts CHANGED
@@ -8951,7 +8951,7 @@ declare function decryptConversationTitle(encryptedTitle: string, address: strin
8951
8951
  *
8952
8952
  * @public
8953
8953
  */
8954
- type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
8954
+ type TaskType = "title" | "commit_message" | "memory_extract" | "memory_import_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
8955
8955
  /**
8956
8956
  * HTTP header naming the Class-B task a request performs.
8957
8957
  *
package/dist/index.d.ts CHANGED
@@ -8951,7 +8951,7 @@ declare function decryptConversationTitle(encryptedTitle: string, address: strin
8951
8951
  *
8952
8952
  * @public
8953
8953
  */
8954
- type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
8954
+ type TaskType = "title" | "commit_message" | "memory_extract" | "memory_import_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
8955
8955
  /**
8956
8956
  * HTTP header naming the Class-B task a request performs.
8957
8957
  *
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getLogger
3
- } from "./chunk-4Z2X4UYQ.mjs";
3
+ } from "./chunk-WUG6GTHO.mjs";
4
4
 
5
5
  // src/lib/pii/patterns.ts
6
6
  function luhnCheck(digits) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  callPortalJsonCompletion,
3
3
  getLogger
4
- } from "./chunk-4Z2X4UYQ.mjs";
4
+ } from "./chunk-WUG6GTHO.mjs";
5
5
  import {
6
6
  BASE_URL,
7
7
  createClientConfig
@@ -7192,7 +7192,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
7192
7192
  subQueries = decomp.subQueries;
7193
7193
  }
7194
7194
  }
7195
- const { recall: recall2 } = await import("./recall-OKNLU335.mjs");
7195
+ const { recall: recall2 } = await import("./recall-WPYCG4ED.mjs");
7196
7196
  let recallDegraded = [];
7197
7197
  const result = await recall2(
7198
7198
  query,
@@ -172,7 +172,16 @@ async function callPortalJsonCompletion(req) {
172
172
  ...reinforce && { reinforceJsonContract: true }
173
173
  } : reinforce ? { ...req, reinforceJsonContract: true } : req;
174
174
  const outcome = await attemptPortalJson(attemptReq, endpoint);
175
- if (outcome.kind === "ok") return outcome.value;
175
+ if (outcome.kind === "ok") {
176
+ req.onAttempt?.({ attempt, ok: true });
177
+ return outcome.value;
178
+ }
179
+ req.onAttempt?.({
180
+ attempt,
181
+ ok: false,
182
+ reason: outcome.code,
183
+ ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus }
184
+ });
176
185
  lastFailure = {
177
186
  reason: outcome.code,
178
187
  ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus },
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  notifyConsolidationFallback,
3
3
  resolvePiiRedactor
4
- } from "./chunk-A2G6TRUK.mjs";
4
+ } from "./chunk-AVYB5IXC.mjs";
5
5
  import {
6
6
  callPortalJsonCompletion
7
- } from "./chunk-4Z2X4UYQ.mjs";
7
+ } from "./chunk-WUG6GTHO.mjs";
8
8
  import "./chunk-GYKJOWEO.mjs";
9
9
 
10
10
  // src/lib/memory/consolidate.ts
@@ -6545,7 +6545,16 @@ async function callPortalJsonCompletion(req) {
6545
6545
  ...reinforce && { reinforceJsonContract: true }
6546
6546
  } : reinforce ? { ...req, reinforceJsonContract: true } : req;
6547
6547
  const outcome = await attemptPortalJson(attemptReq, endpoint);
6548
- if (outcome.kind === "ok") return outcome.value;
6548
+ if (outcome.kind === "ok") {
6549
+ req.onAttempt?.({ attempt, ok: true });
6550
+ return outcome.value;
6551
+ }
6552
+ req.onAttempt?.({
6553
+ attempt,
6554
+ ok: false,
6555
+ reason: outcome.code,
6556
+ ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus }
6557
+ });
6549
6558
  lastFailure = {
6550
6559
  reason: outcome.code,
6551
6560
  ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus },
@@ -18159,7 +18168,8 @@ Extract durable user facts.`,
18159
18168
  ...options.maxAttempts !== void 0 && { maxAttempts: options.maxAttempts },
18160
18169
  ...options.timeoutMs !== void 0 && { timeoutMs: options.timeoutMs },
18161
18170
  ...options.totalTimeoutMs !== void 0 && { totalTimeoutMs: options.totalTimeoutMs },
18162
- ...options.backoffMs && { backoffMs: options.backoffMs }
18171
+ ...options.backoffMs && { backoffMs: options.backoffMs },
18172
+ ...options.onAttempt && { onAttempt: options.onAttempt }
18163
18173
  });
18164
18174
  if (parsed === null) {
18165
18175
  options.onExhaustedEmpty?.(failure ?? { reason: "empty-content", attempts: 1 });
@@ -6271,7 +6271,7 @@ declare function getEntitiesByMemoryIdsOp(ctx: EntityOperationsContext, memoryId
6271
6271
  *
6272
6272
  * @public
6273
6273
  */
6274
- type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
6274
+ type TaskType = "title" | "commit_message" | "memory_extract" | "memory_import_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
6275
6275
 
6276
6276
  /**
6277
6277
  * Shared portal LLM call for the memory pipeline.
@@ -6368,6 +6368,26 @@ type PortalLlmFailureReason =
6368
6368
  | "null-completion"
6369
6369
  /** `totalTimeoutMs` was spent before the next attempt could run. */
6370
6370
  | "time-budget-exhausted";
6371
+ /**
6372
+ * One attempt of a {@link callPortalJsonCompletion} call, reported to
6373
+ * `onAttempt` as it settles — success included. The wire-level diagnostic the
6374
+ * give-up hook cannot provide: a call that succeeds on its third try returns a
6375
+ * value and fires no `onFailure`, yet it cost three completions and its first
6376
+ * two answers were unusable. Extraction quality regressions have hidden in
6377
+ * exactly that shape (a prompt change that made the model answer `NONE` first,
6378
+ * JSON on retry), so the extraction eval gates on the first-attempt clean rate.
6379
+ *
6380
+ * @public
6381
+ */
6382
+ interface PortalLlmAttempt {
6383
+ /** 1-based attempt index. */
6384
+ attempt: number;
6385
+ /** Whether this attempt produced a parseable JSON value. */
6386
+ ok: boolean;
6387
+ /** Classification when `ok` is false. */
6388
+ reason?: PortalLlmFailureReason;
6389
+ httpStatus?: number;
6390
+ }
6371
6391
  /**
6372
6392
  * A give-up report: the classified {@link PortalLlmFailureReason} plus the
6373
6393
  * little context worth carrying into telemetry. Both extra fields are bounded
@@ -7547,6 +7567,12 @@ interface ExtractFactsOptions extends PortalLlmAuth {
7547
7567
  * (i.e. redaction silently eating facts) is alarmable.
7548
7568
  */
7549
7569
  onCandidatesDropped?: () => void;
7570
+ /**
7571
+ * Per-attempt wire diagnostic, forwarded to {@link callPortalJsonCompletion}.
7572
+ * The extraction eval gates on it (first-attempt clean rate); production
7573
+ * callers may leave it unset.
7574
+ */
7575
+ onAttempt?: (attempt: PortalLlmAttempt) => void;
7550
7576
  }
7551
7577
  /**
7552
7578
  * Stage 1 — call the LLM to extract candidate facts from the recent
@@ -6271,7 +6271,7 @@ declare function getEntitiesByMemoryIdsOp(ctx: EntityOperationsContext, memoryId
6271
6271
  *
6272
6272
  * @public
6273
6273
  */
6274
- type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
6274
+ type TaskType = "title" | "commit_message" | "memory_extract" | "memory_import_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
6275
6275
 
6276
6276
  /**
6277
6277
  * Shared portal LLM call for the memory pipeline.
@@ -6368,6 +6368,26 @@ type PortalLlmFailureReason =
6368
6368
  | "null-completion"
6369
6369
  /** `totalTimeoutMs` was spent before the next attempt could run. */
6370
6370
  | "time-budget-exhausted";
6371
+ /**
6372
+ * One attempt of a {@link callPortalJsonCompletion} call, reported to
6373
+ * `onAttempt` as it settles — success included. The wire-level diagnostic the
6374
+ * give-up hook cannot provide: a call that succeeds on its third try returns a
6375
+ * value and fires no `onFailure`, yet it cost three completions and its first
6376
+ * two answers were unusable. Extraction quality regressions have hidden in
6377
+ * exactly that shape (a prompt change that made the model answer `NONE` first,
6378
+ * JSON on retry), so the extraction eval gates on the first-attempt clean rate.
6379
+ *
6380
+ * @public
6381
+ */
6382
+ interface PortalLlmAttempt {
6383
+ /** 1-based attempt index. */
6384
+ attempt: number;
6385
+ /** Whether this attempt produced a parseable JSON value. */
6386
+ ok: boolean;
6387
+ /** Classification when `ok` is false. */
6388
+ reason?: PortalLlmFailureReason;
6389
+ httpStatus?: number;
6390
+ }
6371
6391
  /**
6372
6392
  * A give-up report: the classified {@link PortalLlmFailureReason} plus the
6373
6393
  * little context worth carrying into telemetry. Both extra fields are bounded
@@ -7547,6 +7567,12 @@ interface ExtractFactsOptions extends PortalLlmAuth {
7547
7567
  * (i.e. redaction silently eating facts) is alarmable.
7548
7568
  */
7549
7569
  onCandidatesDropped?: () => void;
7570
+ /**
7571
+ * Per-attempt wire diagnostic, forwarded to {@link callPortalJsonCompletion}.
7572
+ * The extraction eval gates on it (first-attempt clean rate); production
7573
+ * callers may leave it unset.
7574
+ */
7575
+ onAttempt?: (attempt: PortalLlmAttempt) => void;
7550
7576
  }
7551
7577
  /**
7552
7578
  * Stage 1 — call the LLM to extract candidate facts from the recent
@@ -179,14 +179,14 @@ import {
179
179
  updateVaultMemoryOp,
180
180
  useEncryption,
181
181
  vaultMemoryToStored
182
- } from "./chunk-TVPCH7ZZ.mjs";
182
+ } from "./chunk-JRJRRO4P.mjs";
183
183
  import {
184
184
  PiiRedactor,
185
185
  createStreamingDeAnonymizer,
186
186
  isPiiRedactor,
187
187
  notifyConsolidationFallback,
188
188
  resolvePiiRedactor
189
- } from "./chunk-7X7BNMGS.mjs";
189
+ } from "./chunk-AVYB5IXC.mjs";
190
190
  import {
191
191
  INTERNAL_FLOW_MARKER,
192
192
  callPortalJsonCompletion,
@@ -202,7 +202,7 @@ import {
202
202
  taskTypeHeader,
203
203
  validateEndpointOverride,
204
204
  withInternalFlowMarker
205
- } from "./chunk-4Z2X4UYQ.mjs";
205
+ } from "./chunk-WUG6GTHO.mjs";
206
206
  import {
207
207
  BASE_URL,
208
208
  MCP_R2_DOMAIN,
@@ -7711,7 +7711,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
7711
7711
  content: m.content,
7712
7712
  similarity: m.similarity
7713
7713
  }));
7714
- const { consolidateMemory: doConsolidate } = await import("./consolidate-7NMKF7UC.mjs");
7714
+ const { consolidateMemory: doConsolidate } = await import("./consolidate-URHGJT7I.mjs");
7715
7715
  const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
7716
7716
  if (decision.action === "create") return null;
7717
7717
  if (decision.action === "supersede" && decision.content) {
@@ -7953,7 +7953,8 @@ Extract durable user facts.`,
7953
7953
  ...options.maxAttempts !== void 0 && { maxAttempts: options.maxAttempts },
7954
7954
  ...options.timeoutMs !== void 0 && { timeoutMs: options.timeoutMs },
7955
7955
  ...options.totalTimeoutMs !== void 0 && { totalTimeoutMs: options.totalTimeoutMs },
7956
- ...options.backoffMs && { backoffMs: options.backoffMs }
7956
+ ...options.backoffMs && { backoffMs: options.backoffMs },
7957
+ ...options.onAttempt && { onAttempt: options.onAttempt }
7957
7958
  });
7958
7959
  if (parsed === null) {
7959
7960
  options.onExhaustedEmpty?.(failure ?? { reason: "empty-content", attempts: 1 });
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-TVPCH7ZZ.mjs";
4
- import "./chunk-4Z2X4UYQ.mjs";
3
+ } from "./chunk-JRJRRO4P.mjs";
4
+ import "./chunk-WUG6GTHO.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
7
7
  recall
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  callPortalJsonCompletion,
3
3
  getLogger
4
- } from "./chunk-BSCEZOIW.mjs";
4
+ } from "./chunk-YXL5VKCO.mjs";
5
5
  import {
6
6
  BASE_URL,
7
7
  __commonJS,
@@ -20923,7 +20923,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
20923
20923
  subQueries = decomp.subQueries;
20924
20924
  }
20925
20925
  }
20926
- const { recall: recall2 } = await import("./recall-YXJATOSD.mjs");
20926
+ const { recall: recall2 } = await import("./recall-JPIWNKA7.mjs");
20927
20927
  let recallDegraded = [];
20928
20928
  const result = await recall2(
20929
20929
  query,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getLogger
3
- } from "./chunk-BSCEZOIW.mjs";
3
+ } from "./chunk-YXL5VKCO.mjs";
4
4
 
5
5
  // src/lib/pii/patterns.ts
6
6
  function luhnCheck(digits) {
@@ -159,7 +159,16 @@ async function callPortalJsonCompletion(req) {
159
159
  ...reinforce && { reinforceJsonContract: true }
160
160
  } : reinforce ? { ...req, reinforceJsonContract: true } : req;
161
161
  const outcome = await attemptPortalJson(attemptReq, endpoint);
162
- if (outcome.kind === "ok") return outcome.value;
162
+ if (outcome.kind === "ok") {
163
+ req.onAttempt?.({ attempt, ok: true });
164
+ return outcome.value;
165
+ }
166
+ req.onAttempt?.({
167
+ attempt,
168
+ ok: false,
169
+ reason: outcome.code,
170
+ ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus }
171
+ });
163
172
  lastFailure = {
164
173
  reason: outcome.code,
165
174
  ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus },
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  notifyConsolidationFallback,
3
3
  resolvePiiRedactor
4
- } from "./chunk-4LPSEROP.mjs";
4
+ } from "./chunk-RKQ4MRS2.mjs";
5
5
  import {
6
6
  callPortalJsonCompletion
7
- } from "./chunk-BSCEZOIW.mjs";
7
+ } from "./chunk-YXL5VKCO.mjs";
8
8
  import "./chunk-3RPGXXPZ.mjs";
9
9
 
10
10
  // src/lib/memory/consolidate.ts
@@ -20704,7 +20704,16 @@ async function callPortalJsonCompletion(req) {
20704
20704
  ...reinforce && { reinforceJsonContract: true }
20705
20705
  } : reinforce ? { ...req, reinforceJsonContract: true } : req;
20706
20706
  const outcome = await attemptPortalJson(attemptReq, endpoint);
20707
- if (outcome.kind === "ok") return outcome.value;
20707
+ if (outcome.kind === "ok") {
20708
+ req.onAttempt?.({ attempt, ok: true });
20709
+ return outcome.value;
20710
+ }
20711
+ req.onAttempt?.({
20712
+ attempt,
20713
+ ok: false,
20714
+ reason: outcome.code,
20715
+ ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus }
20716
+ });
20708
20717
  lastFailure = {
20709
20718
  reason: outcome.code,
20710
20719
  ...outcome.httpStatus !== void 0 && { httpStatus: outcome.httpStatus },
@@ -29772,7 +29781,8 @@ Extract durable user facts.`,
29772
29781
  ...options.maxAttempts !== void 0 && { maxAttempts: options.maxAttempts },
29773
29782
  ...options.timeoutMs !== void 0 && { timeoutMs: options.timeoutMs },
29774
29783
  ...options.totalTimeoutMs !== void 0 && { totalTimeoutMs: options.totalTimeoutMs },
29775
- ...options.backoffMs && { backoffMs: options.backoffMs }
29784
+ ...options.backoffMs && { backoffMs: options.backoffMs },
29785
+ ...options.onAttempt && { onAttempt: options.onAttempt }
29776
29786
  });
29777
29787
  if (parsed === null) {
29778
29788
  options.onExhaustedEmpty?.(failure ?? { reason: "empty-content", attempts: 1 });
@@ -4766,7 +4766,7 @@ interface EntityOperationsContext {
4766
4766
  *
4767
4767
  * @public
4768
4768
  */
4769
- type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
4769
+ type TaskType = "title" | "commit_message" | "memory_extract" | "memory_import_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
4770
4770
 
4771
4771
  /**
4772
4772
  * Shared portal LLM call for the memory pipeline.
@@ -4863,6 +4863,26 @@ type PortalLlmFailureReason =
4863
4863
  | "null-completion"
4864
4864
  /** `totalTimeoutMs` was spent before the next attempt could run. */
4865
4865
  | "time-budget-exhausted";
4866
+ /**
4867
+ * One attempt of a {@link callPortalJsonCompletion} call, reported to
4868
+ * `onAttempt` as it settles — success included. The wire-level diagnostic the
4869
+ * give-up hook cannot provide: a call that succeeds on its third try returns a
4870
+ * value and fires no `onFailure`, yet it cost three completions and its first
4871
+ * two answers were unusable. Extraction quality regressions have hidden in
4872
+ * exactly that shape (a prompt change that made the model answer `NONE` first,
4873
+ * JSON on retry), so the extraction eval gates on the first-attempt clean rate.
4874
+ *
4875
+ * @public
4876
+ */
4877
+ interface PortalLlmAttempt {
4878
+ /** 1-based attempt index. */
4879
+ attempt: number;
4880
+ /** Whether this attempt produced a parseable JSON value. */
4881
+ ok: boolean;
4882
+ /** Classification when `ok` is false. */
4883
+ reason?: PortalLlmFailureReason;
4884
+ httpStatus?: number;
4885
+ }
4866
4886
  /**
4867
4887
  * A give-up report: the classified {@link PortalLlmFailureReason} plus the
4868
4888
  * little context worth carrying into telemetry. Both extra fields are bounded
@@ -6133,6 +6153,12 @@ interface ExtractFactsOptions extends PortalLlmAuth {
6133
6153
  * (i.e. redaction silently eating facts) is alarmable.
6134
6154
  */
6135
6155
  onCandidatesDropped?: () => void;
6156
+ /**
6157
+ * Per-attempt wire diagnostic, forwarded to {@link callPortalJsonCompletion}.
6158
+ * The extraction eval gates on it (first-attempt clean rate); production
6159
+ * callers may leave it unset.
6160
+ */
6161
+ onAttempt?: (attempt: PortalLlmAttempt) => void;
6136
6162
  }
6137
6163
  /**
6138
6164
  * Stage 1 — call the LLM to extract candidate facts from the recent
@@ -4766,7 +4766,7 @@ interface EntityOperationsContext {
4766
4766
  *
4767
4767
  * @public
4768
4768
  */
4769
- type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
4769
+ type TaskType = "title" | "commit_message" | "memory_extract" | "memory_import_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
4770
4770
 
4771
4771
  /**
4772
4772
  * Shared portal LLM call for the memory pipeline.
@@ -4863,6 +4863,26 @@ type PortalLlmFailureReason =
4863
4863
  | "null-completion"
4864
4864
  /** `totalTimeoutMs` was spent before the next attempt could run. */
4865
4865
  | "time-budget-exhausted";
4866
+ /**
4867
+ * One attempt of a {@link callPortalJsonCompletion} call, reported to
4868
+ * `onAttempt` as it settles — success included. The wire-level diagnostic the
4869
+ * give-up hook cannot provide: a call that succeeds on its third try returns a
4870
+ * value and fires no `onFailure`, yet it cost three completions and its first
4871
+ * two answers were unusable. Extraction quality regressions have hidden in
4872
+ * exactly that shape (a prompt change that made the model answer `NONE` first,
4873
+ * JSON on retry), so the extraction eval gates on the first-attempt clean rate.
4874
+ *
4875
+ * @public
4876
+ */
4877
+ interface PortalLlmAttempt {
4878
+ /** 1-based attempt index. */
4879
+ attempt: number;
4880
+ /** Whether this attempt produced a parseable JSON value. */
4881
+ ok: boolean;
4882
+ /** Classification when `ok` is false. */
4883
+ reason?: PortalLlmFailureReason;
4884
+ httpStatus?: number;
4885
+ }
4866
4886
  /**
4867
4887
  * A give-up report: the classified {@link PortalLlmFailureReason} plus the
4868
4888
  * little context worth carrying into telemetry. Both extra fields are bounded
@@ -6133,6 +6153,12 @@ interface ExtractFactsOptions extends PortalLlmAuth {
6133
6153
  * (i.e. redaction silently eating facts) is alarmable.
6134
6154
  */
6135
6155
  onCandidatesDropped?: () => void;
6156
+ /**
6157
+ * Per-attempt wire diagnostic, forwarded to {@link callPortalJsonCompletion}.
6158
+ * The extraction eval gates on it (first-attempt clean rate); production
6159
+ * callers may leave it unset.
6160
+ */
6161
+ onAttempt?: (attempt: PortalLlmAttempt) => void;
6136
6162
  }
6137
6163
  /**
6138
6164
  * Stage 1 — call the LLM to extract candidate facts from the recent
@@ -141,12 +141,12 @@ import {
141
141
  updateVaultMemoryOp,
142
142
  upsertMessageOp,
143
143
  vaultMemoryToStored
144
- } from "./chunk-K7H7ICPK.mjs";
144
+ } from "./chunk-2A6HXY4P.mjs";
145
145
  import {
146
146
  createStreamingDeAnonymizer,
147
147
  notifyConsolidationFallback,
148
148
  resolvePiiRedactor
149
- } from "./chunk-4LPSEROP.mjs";
149
+ } from "./chunk-RKQ4MRS2.mjs";
150
150
  import {
151
151
  INTERNAL_FLOW_MARKER,
152
152
  callPortalJsonCompletion,
@@ -159,7 +159,7 @@ import {
159
159
  taskTypeHeader,
160
160
  validateEndpointOverride,
161
161
  withInternalFlowMarker
162
- } from "./chunk-BSCEZOIW.mjs";
162
+ } from "./chunk-YXL5VKCO.mjs";
163
163
  import {
164
164
  BASE_URL,
165
165
  __commonJS,
@@ -5743,7 +5743,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
5743
5743
  content: m.content,
5744
5744
  similarity: m.similarity
5745
5745
  }));
5746
- const { consolidateMemory: doConsolidate } = await import("./consolidate-MSAXASHL.mjs");
5746
+ const { consolidateMemory: doConsolidate } = await import("./consolidate-54P6QZKU.mjs");
5747
5747
  const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
5748
5748
  if (decision.action === "create") return null;
5749
5749
  if (decision.action === "supersede" && decision.content) {
@@ -5985,7 +5985,8 @@ Extract durable user facts.`,
5985
5985
  ...options.maxAttempts !== void 0 && { maxAttempts: options.maxAttempts },
5986
5986
  ...options.timeoutMs !== void 0 && { timeoutMs: options.timeoutMs },
5987
5987
  ...options.totalTimeoutMs !== void 0 && { totalTimeoutMs: options.totalTimeoutMs },
5988
- ...options.backoffMs && { backoffMs: options.backoffMs }
5988
+ ...options.backoffMs && { backoffMs: options.backoffMs },
5989
+ ...options.onAttempt && { onAttempt: options.onAttempt }
5989
5990
  });
5990
5991
  if (parsed === null) {
5991
5992
  options.onExhaustedEmpty?.(failure ?? { reason: "empty-content", attempts: 1 });
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-K7H7ICPK.mjs";
4
- import "./chunk-BSCEZOIW.mjs";
3
+ } from "./chunk-2A6HXY4P.mjs";
4
+ import "./chunk-YXL5VKCO.mjs";
5
5
  import "./chunk-3RPGXXPZ.mjs";
6
6
  export {
7
7
  recall
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "6.18.0",
3
+ "version": "6.19.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",