@anuma/sdk 3.11.5 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2400,6 +2400,7 @@ type HandlersNonceResponse = {
2400
2400
  type HandlersNotificationDeviceResponse = {
2401
2401
  app_version?: string;
2402
2402
  id?: number;
2403
+ locale?: string;
2403
2404
  platform?: string;
2404
2405
  token?: string;
2405
2406
  };
@@ -2572,6 +2573,11 @@ type HandlersRefreshRequest = {
2572
2573
  };
2573
2574
  type HandlersRegisterDeviceRequest = {
2574
2575
  app_version?: string;
2576
+ /**
2577
+ * Locale is the optional BCP-47 language tag of the device (e.g.
2578
+ * "en-US"); used for announcement-campaign locale segmentation.
2579
+ */
2580
+ locale?: string;
2575
2581
  platform?: string;
2576
2582
  token?: string;
2577
2583
  };
@@ -8106,10 +8112,6 @@ type PostApiV1NotificationsDevicesErrors = {
8106
8112
  * Forbidden
8107
8113
  */
8108
8114
  403: ResponseErrorResponse;
8109
- /**
8110
- * Conflict
8111
- */
8112
- 409: ResponseErrorResponse;
8113
8115
  /**
8114
8116
  * Internal Server Error
8115
8117
  */
@@ -10736,7 +10738,7 @@ declare const postApiV1Moderate: <ThrowOnError extends boolean = false>(options:
10736
10738
  /**
10737
10739
  * Register push-notification device
10738
10740
  *
10739
- * Stores an Expo push token so the portal can later deliver push notifications to this device. Idempotent — re-posting the same token refreshes the row.
10741
+ * Stores an Expo push token so the portal can later deliver push notifications to this device. Idempotent — re-posting the same token refreshes the row and bumps its last-seen timestamp. A token previously registered by a different account is reassigned to the caller (an Expo token identifies a physical device). Accounts keep at most 10 devices; the least recently seen are evicted.
10740
10742
  */
10741
10743
  declare const postApiV1NotificationsDevices: <ThrowOnError extends boolean = false>(options: Options<PostApiV1NotificationsDevicesData, ThrowOnError>) => RequestResult<PostApiV1NotificationsDevicesResponses, PostApiV1NotificationsDevicesErrors, ThrowOnError>;
10742
10744
  /**
@@ -2400,6 +2400,7 @@ type HandlersNonceResponse = {
2400
2400
  type HandlersNotificationDeviceResponse = {
2401
2401
  app_version?: string;
2402
2402
  id?: number;
2403
+ locale?: string;
2403
2404
  platform?: string;
2404
2405
  token?: string;
2405
2406
  };
@@ -2572,6 +2573,11 @@ type HandlersRefreshRequest = {
2572
2573
  };
2573
2574
  type HandlersRegisterDeviceRequest = {
2574
2575
  app_version?: string;
2576
+ /**
2577
+ * Locale is the optional BCP-47 language tag of the device (e.g.
2578
+ * "en-US"); used for announcement-campaign locale segmentation.
2579
+ */
2580
+ locale?: string;
2575
2581
  platform?: string;
2576
2582
  token?: string;
2577
2583
  };
@@ -8106,10 +8112,6 @@ type PostApiV1NotificationsDevicesErrors = {
8106
8112
  * Forbidden
8107
8113
  */
8108
8114
  403: ResponseErrorResponse;
8109
- /**
8110
- * Conflict
8111
- */
8112
- 409: ResponseErrorResponse;
8113
8115
  /**
8114
8116
  * Internal Server Error
8115
8117
  */
@@ -10736,7 +10738,7 @@ declare const postApiV1Moderate: <ThrowOnError extends boolean = false>(options:
10736
10738
  /**
10737
10739
  * Register push-notification device
10738
10740
  *
10739
- * Stores an Expo push token so the portal can later deliver push notifications to this device. Idempotent — re-posting the same token refreshes the row.
10741
+ * Stores an Expo push token so the portal can later deliver push notifications to this device. Idempotent — re-posting the same token refreshes the row and bumps its last-seen timestamp. A token previously registered by a different account is reassigned to the caller (an Expo token identifies a physical device). Accounts keep at most 10 devices; the least recently seen are evicted.
10740
10742
  */
10741
10743
  declare const postApiV1NotificationsDevices: <ThrowOnError extends boolean = false>(options: Options<PostApiV1NotificationsDevicesData, ThrowOnError>) => RequestResult<PostApiV1NotificationsDevicesResponses, PostApiV1NotificationsDevicesErrors, ThrowOnError>;
10742
10744
  /**
@@ -11786,13 +11786,18 @@ Executing tool: ${toolInfo}
11786
11786
  }
11787
11787
  const truncatedToNothing = (acc) => acc.finishReason === "length" && acc.toolCalls.size === 0 && acc.content.trim() === "";
11788
11788
  const TRUNCATION_ERROR = "Model response was truncated at the output-token limit before it produced any usable content or tool call. Retry with a higher `maxOutputTokens`, or prompt for fewer/smaller tool calls per turn.";
11789
+ const terminalStateOf = (acc) => ({
11790
+ ...acc.finishReason !== void 0 && { finishReason: acc.finishReason },
11791
+ finalToolCallCount: acc.toolCalls.size
11792
+ });
11789
11793
  if (toolIteration > 0) {
11790
11794
  if (truncatedToNothing(currentAccumulator)) {
11791
11795
  await fireRunError({ error: TRUNCATION_ERROR, stage: "model" });
11792
11796
  return {
11793
11797
  data: buildResponseFinal(currentAccumulator),
11794
11798
  error: TRUNCATION_ERROR,
11795
- toolsChecksum: currentAccumulator.toolsChecksum
11799
+ toolsChecksum: currentAccumulator.toolsChecksum,
11800
+ terminalState: terminalStateOf(currentAccumulator)
11796
11801
  };
11797
11802
  }
11798
11803
  const finalResponse = buildResponseFinal(currentAccumulator);
@@ -11805,7 +11810,8 @@ Executing tool: ${toolInfo}
11805
11810
  data: finalResponse,
11806
11811
  error: null,
11807
11812
  toolsChecksum: currentAccumulator.toolsChecksum,
11808
- autoExecutedToolResults: accumulatedToolResults
11813
+ autoExecutedToolResults: accumulatedToolResults,
11814
+ terminalState: terminalStateOf(currentAccumulator)
11809
11815
  };
11810
11816
  }
11811
11817
  if (truncatedToNothing(accumulator)) {
@@ -11813,7 +11819,8 @@ Executing tool: ${toolInfo}
11813
11819
  return {
11814
11820
  data: response,
11815
11821
  error: TRUNCATION_ERROR,
11816
- toolsChecksum: accumulator.toolsChecksum
11822
+ toolsChecksum: accumulator.toolsChecksum,
11823
+ terminalState: terminalStateOf(accumulator)
11817
11824
  };
11818
11825
  }
11819
11826
  if (onFinish) onFinish(response);
@@ -11824,7 +11831,8 @@ Executing tool: ${toolInfo}
11824
11831
  return {
11825
11832
  data: response,
11826
11833
  error: null,
11827
- toolsChecksum: accumulator.toolsChecksum
11834
+ toolsChecksum: accumulator.toolsChecksum,
11835
+ terminalState: terminalStateOf(accumulator)
11828
11836
  };
11829
11837
  } catch (err) {
11830
11838
  if (isAbortError(err)) {
@@ -2429,6 +2429,32 @@ type StepFinishEvent = {
2429
2429
  outputTokens?: number;
2430
2430
  };
2431
2431
  };
2432
+ /**
2433
+ * Terminal state of the LAST model response in the turn, normalized to the
2434
+ * completions vocabulary (`"stop"` | `"length"` | `"tool_calls"` | provider-
2435
+ * specific values). `undefined` when the stream carried no finish reason at all.
2436
+ *
2437
+ * Exposed because neither response shape reliably carries it out to a caller.
2438
+ * The Responses API shape has no field for it — `LlmapiResponseResponse` declares
2439
+ * neither `status` nor `incomplete_details` — so `buildFinalResponse` cannot
2440
+ * surface truncation there even though the loop detected it (`responses.ts`
2441
+ * normalizes it onto the accumulator). Completions does expose
2442
+ * `choices[0].finish_reason`, but omits `tool_calls` entirely when there are
2443
+ * none, so a caller sniffing the response cannot tell "no tool calls" from
2444
+ * "field absent".
2445
+ *
2446
+ * The loop already knows both, unambiguously and identically for either API.
2447
+ * Reporting them here means callers and test harnesses stop reverse-engineering
2448
+ * them from a response shape that cannot answer. See anuma-ai/sdk#805.
2449
+ */
2450
+ type RunTerminalState = {
2451
+ /** Normalized finish reason of the final response. `"length"` means the output
2452
+ * ceiling cut it off; anything else means the model stopped on its own. */
2453
+ finishReason?: string;
2454
+ /** Tool calls the final response carried. `0` is meaningful — combined with
2455
+ * empty content it identifies a turn that ended having produced nothing. */
2456
+ finalToolCallCount: number;
2457
+ };
2432
2458
  type RunToolLoopResult = {
2433
2459
  data: ApiResponse;
2434
2460
  error: null;
@@ -2436,6 +2462,8 @@ type RunToolLoopResult = {
2436
2462
  toolsChecksum?: string;
2437
2463
  /** Results from tools that were auto-executed by the SDK */
2438
2464
  autoExecutedToolResults?: AutoExecutedToolResult[];
2465
+ /** Terminal state of the final model response. See {@link RunTerminalState}. */
2466
+ terminalState?: RunTerminalState;
2439
2467
  } | {
2440
2468
  data: ApiResponse | null;
2441
2469
  error: string;
@@ -2447,6 +2475,18 @@ type RunToolLoopResult = {
2447
2475
  detached?: true;
2448
2476
  /** Non-null only when `resumable` was true AND an inference id was captured before detach. */
2449
2477
  resume?: StreamResumeHandle | null;
2478
+ /**
2479
+ * Terminal state of the final model response, when the failure is one the
2480
+ * loop diagnosed FROM that response — today, the truncated-to-nothing
2481
+ * error. See {@link RunTerminalState}.
2482
+ *
2483
+ * Absent on failures that never got a terminal response to read (transport
2484
+ * errors, detach, an SSE failure mid-stream), which is why it stays
2485
+ * optional here. Present on the truncation error specifically because that
2486
+ * is where it is most diagnostic: a caller can branch on
2487
+ * `finishReason === "length"` instead of matching the error string.
2488
+ */
2489
+ terminalState?: RunTerminalState;
2450
2490
  };
2451
2491
  /** Capability header: tells the portal this client can resume a detached stream. Pinned with zeta-chain/ai-portal#1139. */
2452
2492
  declare const STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
@@ -5299,7 +5339,8 @@ interface RetainOptions {
5299
5339
  * Returns `action: 'suppressed'` with the matched `tombstoneId`.
5300
5340
  */
5301
5341
  respectTombstones?: boolean;
5302
- /** Cosine similarity threshold for auto-merge. Default: 0.85. */
5342
+ /** Cosine similarity threshold for auto-merge. Default: 0.8
5343
+ * (`DEFAULT_AUTO_MERGE_THRESHOLD` in retain.ts — the source of truth). */
5303
5344
  autoMergeThreshold?: number;
5304
5345
  /**
5305
5346
  * When provided, runs an LLM-based consolidation pass against the top-K
@@ -5327,9 +5368,13 @@ interface RetainOptions {
5327
5368
  */
5328
5369
  piiRedaction?: boolean | PiiRedactor;
5329
5370
  };
5330
- /** Cosine similarity floor for the consolidator candidate set. Default: 0.65. */
5371
+ /** Cosine similarity floor for the consolidator candidate set. Default: 0.55
5372
+ * (`DEFAULT_CONSOLIDATE_THRESHOLD` in retain.ts — the source of truth). */
5331
5373
  consolidateThreshold?: number;
5332
- /** Top-K consolidation candidates to feed the LLM. Default: 5. */
5374
+ /** Top-K consolidation candidates to feed the LLM. Default: 20
5375
+ * (`DEFAULT_CONSOLIDATE_TOP_K` in retain.ts — the source of truth). Widened
5376
+ * from 5 so a value change can find and retire ALL stale duplicates of the
5377
+ * old value in one pass, not just the nearest few. */
5333
5378
  consolidateTopK?: number;
5334
5379
  /**
5335
5380
  * W6 temporal lane — when the event in this fact occurred. Persisted to
@@ -2429,6 +2429,32 @@ type StepFinishEvent = {
2429
2429
  outputTokens?: number;
2430
2430
  };
2431
2431
  };
2432
+ /**
2433
+ * Terminal state of the LAST model response in the turn, normalized to the
2434
+ * completions vocabulary (`"stop"` | `"length"` | `"tool_calls"` | provider-
2435
+ * specific values). `undefined` when the stream carried no finish reason at all.
2436
+ *
2437
+ * Exposed because neither response shape reliably carries it out to a caller.
2438
+ * The Responses API shape has no field for it — `LlmapiResponseResponse` declares
2439
+ * neither `status` nor `incomplete_details` — so `buildFinalResponse` cannot
2440
+ * surface truncation there even though the loop detected it (`responses.ts`
2441
+ * normalizes it onto the accumulator). Completions does expose
2442
+ * `choices[0].finish_reason`, but omits `tool_calls` entirely when there are
2443
+ * none, so a caller sniffing the response cannot tell "no tool calls" from
2444
+ * "field absent".
2445
+ *
2446
+ * The loop already knows both, unambiguously and identically for either API.
2447
+ * Reporting them here means callers and test harnesses stop reverse-engineering
2448
+ * them from a response shape that cannot answer. See anuma-ai/sdk#805.
2449
+ */
2450
+ type RunTerminalState = {
2451
+ /** Normalized finish reason of the final response. `"length"` means the output
2452
+ * ceiling cut it off; anything else means the model stopped on its own. */
2453
+ finishReason?: string;
2454
+ /** Tool calls the final response carried. `0` is meaningful — combined with
2455
+ * empty content it identifies a turn that ended having produced nothing. */
2456
+ finalToolCallCount: number;
2457
+ };
2432
2458
  type RunToolLoopResult = {
2433
2459
  data: ApiResponse;
2434
2460
  error: null;
@@ -2436,6 +2462,8 @@ type RunToolLoopResult = {
2436
2462
  toolsChecksum?: string;
2437
2463
  /** Results from tools that were auto-executed by the SDK */
2438
2464
  autoExecutedToolResults?: AutoExecutedToolResult[];
2465
+ /** Terminal state of the final model response. See {@link RunTerminalState}. */
2466
+ terminalState?: RunTerminalState;
2439
2467
  } | {
2440
2468
  data: ApiResponse | null;
2441
2469
  error: string;
@@ -2447,6 +2475,18 @@ type RunToolLoopResult = {
2447
2475
  detached?: true;
2448
2476
  /** Non-null only when `resumable` was true AND an inference id was captured before detach. */
2449
2477
  resume?: StreamResumeHandle | null;
2478
+ /**
2479
+ * Terminal state of the final model response, when the failure is one the
2480
+ * loop diagnosed FROM that response — today, the truncated-to-nothing
2481
+ * error. See {@link RunTerminalState}.
2482
+ *
2483
+ * Absent on failures that never got a terminal response to read (transport
2484
+ * errors, detach, an SSE failure mid-stream), which is why it stays
2485
+ * optional here. Present on the truncation error specifically because that
2486
+ * is where it is most diagnostic: a caller can branch on
2487
+ * `finishReason === "length"` instead of matching the error string.
2488
+ */
2489
+ terminalState?: RunTerminalState;
2450
2490
  };
2451
2491
  /** Capability header: tells the portal this client can resume a detached stream. Pinned with zeta-chain/ai-portal#1139. */
2452
2492
  declare const STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
@@ -5299,7 +5339,8 @@ interface RetainOptions {
5299
5339
  * Returns `action: 'suppressed'` with the matched `tombstoneId`.
5300
5340
  */
5301
5341
  respectTombstones?: boolean;
5302
- /** Cosine similarity threshold for auto-merge. Default: 0.85. */
5342
+ /** Cosine similarity threshold for auto-merge. Default: 0.8
5343
+ * (`DEFAULT_AUTO_MERGE_THRESHOLD` in retain.ts — the source of truth). */
5303
5344
  autoMergeThreshold?: number;
5304
5345
  /**
5305
5346
  * When provided, runs an LLM-based consolidation pass against the top-K
@@ -5327,9 +5368,13 @@ interface RetainOptions {
5327
5368
  */
5328
5369
  piiRedaction?: boolean | PiiRedactor;
5329
5370
  };
5330
- /** Cosine similarity floor for the consolidator candidate set. Default: 0.65. */
5371
+ /** Cosine similarity floor for the consolidator candidate set. Default: 0.55
5372
+ * (`DEFAULT_CONSOLIDATE_THRESHOLD` in retain.ts — the source of truth). */
5331
5373
  consolidateThreshold?: number;
5332
- /** Top-K consolidation candidates to feed the LLM. Default: 5. */
5374
+ /** Top-K consolidation candidates to feed the LLM. Default: 20
5375
+ * (`DEFAULT_CONSOLIDATE_TOP_K` in retain.ts — the source of truth). Widened
5376
+ * from 5 so a value change can find and retire ALL stale duplicates of the
5377
+ * old value in one pass, not just the nearest few. */
5333
5378
  consolidateTopK?: number;
5334
5379
  /**
5335
5380
  * W6 temporal lane — when the event in this fact occurred. Persisted to
@@ -3389,13 +3389,18 @@ Executing tool: ${toolInfo}
3389
3389
  }
3390
3390
  const truncatedToNothing = (acc) => acc.finishReason === "length" && acc.toolCalls.size === 0 && acc.content.trim() === "";
3391
3391
  const TRUNCATION_ERROR = "Model response was truncated at the output-token limit before it produced any usable content or tool call. Retry with a higher `maxOutputTokens`, or prompt for fewer/smaller tool calls per turn.";
3392
+ const terminalStateOf = (acc) => ({
3393
+ ...acc.finishReason !== void 0 && { finishReason: acc.finishReason },
3394
+ finalToolCallCount: acc.toolCalls.size
3395
+ });
3392
3396
  if (toolIteration > 0) {
3393
3397
  if (truncatedToNothing(currentAccumulator)) {
3394
3398
  await fireRunError({ error: TRUNCATION_ERROR, stage: "model" });
3395
3399
  return {
3396
3400
  data: buildResponseFinal(currentAccumulator),
3397
3401
  error: TRUNCATION_ERROR,
3398
- toolsChecksum: currentAccumulator.toolsChecksum
3402
+ toolsChecksum: currentAccumulator.toolsChecksum,
3403
+ terminalState: terminalStateOf(currentAccumulator)
3399
3404
  };
3400
3405
  }
3401
3406
  const finalResponse = buildResponseFinal(currentAccumulator);
@@ -3408,7 +3413,8 @@ Executing tool: ${toolInfo}
3408
3413
  data: finalResponse,
3409
3414
  error: null,
3410
3415
  toolsChecksum: currentAccumulator.toolsChecksum,
3411
- autoExecutedToolResults: accumulatedToolResults
3416
+ autoExecutedToolResults: accumulatedToolResults,
3417
+ terminalState: terminalStateOf(currentAccumulator)
3412
3418
  };
3413
3419
  }
3414
3420
  if (truncatedToNothing(accumulator)) {
@@ -3416,7 +3422,8 @@ Executing tool: ${toolInfo}
3416
3422
  return {
3417
3423
  data: response,
3418
3424
  error: TRUNCATION_ERROR,
3419
- toolsChecksum: accumulator.toolsChecksum
3425
+ toolsChecksum: accumulator.toolsChecksum,
3426
+ terminalState: terminalStateOf(accumulator)
3420
3427
  };
3421
3428
  }
3422
3429
  if (onFinish) onFinish(response);
@@ -3427,7 +3434,8 @@ Executing tool: ${toolInfo}
3427
3434
  return {
3428
3435
  data: response,
3429
3436
  error: null,
3430
- toolsChecksum: accumulator.toolsChecksum
3437
+ toolsChecksum: accumulator.toolsChecksum,
3438
+ terminalState: terminalStateOf(accumulator)
3431
3439
  };
3432
3440
  } catch (err) {
3433
3441
  if (isAbortError(err)) {
@@ -12164,13 +12164,18 @@ Executing tool: ${toolInfo}
12164
12164
  }
12165
12165
  const truncatedToNothing = (acc) => acc.finishReason === "length" && acc.toolCalls.size === 0 && acc.content.trim() === "";
12166
12166
  const TRUNCATION_ERROR = "Model response was truncated at the output-token limit before it produced any usable content or tool call. Retry with a higher `maxOutputTokens`, or prompt for fewer/smaller tool calls per turn.";
12167
+ const terminalStateOf = (acc) => ({
12168
+ ...acc.finishReason !== void 0 && { finishReason: acc.finishReason },
12169
+ finalToolCallCount: acc.toolCalls.size
12170
+ });
12167
12171
  if (toolIteration > 0) {
12168
12172
  if (truncatedToNothing(currentAccumulator)) {
12169
12173
  await fireRunError({ error: TRUNCATION_ERROR, stage: "model" });
12170
12174
  return {
12171
12175
  data: buildResponseFinal(currentAccumulator),
12172
12176
  error: TRUNCATION_ERROR,
12173
- toolsChecksum: currentAccumulator.toolsChecksum
12177
+ toolsChecksum: currentAccumulator.toolsChecksum,
12178
+ terminalState: terminalStateOf(currentAccumulator)
12174
12179
  };
12175
12180
  }
12176
12181
  const finalResponse = buildResponseFinal(currentAccumulator);
@@ -12183,7 +12188,8 @@ Executing tool: ${toolInfo}
12183
12188
  data: finalResponse,
12184
12189
  error: null,
12185
12190
  toolsChecksum: currentAccumulator.toolsChecksum,
12186
- autoExecutedToolResults: accumulatedToolResults
12191
+ autoExecutedToolResults: accumulatedToolResults,
12192
+ terminalState: terminalStateOf(currentAccumulator)
12187
12193
  };
12188
12194
  }
12189
12195
  if (truncatedToNothing(accumulator)) {
@@ -12191,7 +12197,8 @@ Executing tool: ${toolInfo}
12191
12197
  return {
12192
12198
  data: response,
12193
12199
  error: TRUNCATION_ERROR,
12194
- toolsChecksum: accumulator.toolsChecksum
12200
+ toolsChecksum: accumulator.toolsChecksum,
12201
+ terminalState: terminalStateOf(accumulator)
12195
12202
  };
12196
12203
  }
12197
12204
  if (onFinish) onFinish(response);
@@ -12202,7 +12209,8 @@ Executing tool: ${toolInfo}
12202
12209
  return {
12203
12210
  data: response,
12204
12211
  error: null,
12205
- toolsChecksum: accumulator.toolsChecksum
12212
+ toolsChecksum: accumulator.toolsChecksum,
12213
+ terminalState: terminalStateOf(accumulator)
12206
12214
  };
12207
12215
  } catch (err) {
12208
12216
  if (isAbortError(err)) {
@@ -6612,7 +6612,8 @@ interface RetainOptions {
6612
6612
  * Returns `action: 'suppressed'` with the matched `tombstoneId`.
6613
6613
  */
6614
6614
  respectTombstones?: boolean;
6615
- /** Cosine similarity threshold for auto-merge. Default: 0.85. */
6615
+ /** Cosine similarity threshold for auto-merge. Default: 0.8
6616
+ * (`DEFAULT_AUTO_MERGE_THRESHOLD` in retain.ts — the source of truth). */
6616
6617
  autoMergeThreshold?: number;
6617
6618
  /**
6618
6619
  * When provided, runs an LLM-based consolidation pass against the top-K
@@ -6640,9 +6641,13 @@ interface RetainOptions {
6640
6641
  */
6641
6642
  piiRedaction?: boolean | PiiRedactor;
6642
6643
  };
6643
- /** Cosine similarity floor for the consolidator candidate set. Default: 0.65. */
6644
+ /** Cosine similarity floor for the consolidator candidate set. Default: 0.55
6645
+ * (`DEFAULT_CONSOLIDATE_THRESHOLD` in retain.ts — the source of truth). */
6644
6646
  consolidateThreshold?: number;
6645
- /** Top-K consolidation candidates to feed the LLM. Default: 5. */
6647
+ /** Top-K consolidation candidates to feed the LLM. Default: 20
6648
+ * (`DEFAULT_CONSOLIDATE_TOP_K` in retain.ts — the source of truth). Widened
6649
+ * from 5 so a value change can find and retire ALL stale duplicates of the
6650
+ * old value in one pass, not just the nearest few. */
6646
6651
  consolidateTopK?: number;
6647
6652
  /**
6648
6653
  * W6 temporal lane — when the event in this fact occurred. Persisted to
@@ -6612,7 +6612,8 @@ interface RetainOptions {
6612
6612
  * Returns `action: 'suppressed'` with the matched `tombstoneId`.
6613
6613
  */
6614
6614
  respectTombstones?: boolean;
6615
- /** Cosine similarity threshold for auto-merge. Default: 0.85. */
6615
+ /** Cosine similarity threshold for auto-merge. Default: 0.8
6616
+ * (`DEFAULT_AUTO_MERGE_THRESHOLD` in retain.ts — the source of truth). */
6616
6617
  autoMergeThreshold?: number;
6617
6618
  /**
6618
6619
  * When provided, runs an LLM-based consolidation pass against the top-K
@@ -6640,9 +6641,13 @@ interface RetainOptions {
6640
6641
  */
6641
6642
  piiRedaction?: boolean | PiiRedactor;
6642
6643
  };
6643
- /** Cosine similarity floor for the consolidator candidate set. Default: 0.65. */
6644
+ /** Cosine similarity floor for the consolidator candidate set. Default: 0.55
6645
+ * (`DEFAULT_CONSOLIDATE_THRESHOLD` in retain.ts — the source of truth). */
6644
6646
  consolidateThreshold?: number;
6645
- /** Top-K consolidation candidates to feed the LLM. Default: 5. */
6647
+ /** Top-K consolidation candidates to feed the LLM. Default: 20
6648
+ * (`DEFAULT_CONSOLIDATE_TOP_K` in retain.ts — the source of truth). Widened
6649
+ * from 5 so a value change can find and retire ALL stale duplicates of the
6650
+ * old value in one pass, not just the nearest few. */
6646
6651
  consolidateTopK?: number;
6647
6652
  /**
6648
6653
  * W6 temporal lane — when the event in this fact occurred. Persisted to
@@ -3266,13 +3266,18 @@ Executing tool: ${toolInfo}
3266
3266
  }
3267
3267
  const truncatedToNothing = (acc) => acc.finishReason === "length" && acc.toolCalls.size === 0 && acc.content.trim() === "";
3268
3268
  const TRUNCATION_ERROR = "Model response was truncated at the output-token limit before it produced any usable content or tool call. Retry with a higher `maxOutputTokens`, or prompt for fewer/smaller tool calls per turn.";
3269
+ const terminalStateOf = (acc) => ({
3270
+ ...acc.finishReason !== void 0 && { finishReason: acc.finishReason },
3271
+ finalToolCallCount: acc.toolCalls.size
3272
+ });
3269
3273
  if (toolIteration > 0) {
3270
3274
  if (truncatedToNothing(currentAccumulator)) {
3271
3275
  await fireRunError({ error: TRUNCATION_ERROR, stage: "model" });
3272
3276
  return {
3273
3277
  data: buildResponseFinal(currentAccumulator),
3274
3278
  error: TRUNCATION_ERROR,
3275
- toolsChecksum: currentAccumulator.toolsChecksum
3279
+ toolsChecksum: currentAccumulator.toolsChecksum,
3280
+ terminalState: terminalStateOf(currentAccumulator)
3276
3281
  };
3277
3282
  }
3278
3283
  const finalResponse = buildResponseFinal(currentAccumulator);
@@ -3285,7 +3290,8 @@ Executing tool: ${toolInfo}
3285
3290
  data: finalResponse,
3286
3291
  error: null,
3287
3292
  toolsChecksum: currentAccumulator.toolsChecksum,
3288
- autoExecutedToolResults: accumulatedToolResults
3293
+ autoExecutedToolResults: accumulatedToolResults,
3294
+ terminalState: terminalStateOf(currentAccumulator)
3289
3295
  };
3290
3296
  }
3291
3297
  if (truncatedToNothing(accumulator)) {
@@ -3293,7 +3299,8 @@ Executing tool: ${toolInfo}
3293
3299
  return {
3294
3300
  data: response,
3295
3301
  error: TRUNCATION_ERROR,
3296
- toolsChecksum: accumulator.toolsChecksum
3302
+ toolsChecksum: accumulator.toolsChecksum,
3303
+ terminalState: terminalStateOf(accumulator)
3297
3304
  };
3298
3305
  }
3299
3306
  if (onFinish) onFinish(response);
@@ -3304,7 +3311,8 @@ Executing tool: ${toolInfo}
3304
3311
  return {
3305
3312
  data: response,
3306
3313
  error: null,
3307
- toolsChecksum: accumulator.toolsChecksum
3314
+ toolsChecksum: accumulator.toolsChecksum,
3315
+ terminalState: terminalStateOf(accumulator)
3308
3316
  };
3309
3317
  } catch (err) {
3310
3318
  if (isAbortError(err)) {
@@ -35092,13 +35092,18 @@ Executing tool: ${toolInfo}
35092
35092
  }
35093
35093
  const truncatedToNothing = (acc) => acc.finishReason === "length" && acc.toolCalls.size === 0 && acc.content.trim() === "";
35094
35094
  const TRUNCATION_ERROR = "Model response was truncated at the output-token limit before it produced any usable content or tool call. Retry with a higher `maxOutputTokens`, or prompt for fewer/smaller tool calls per turn.";
35095
+ const terminalStateOf = (acc) => ({
35096
+ ...acc.finishReason !== void 0 && { finishReason: acc.finishReason },
35097
+ finalToolCallCount: acc.toolCalls.size
35098
+ });
35095
35099
  if (toolIteration > 0) {
35096
35100
  if (truncatedToNothing(currentAccumulator)) {
35097
35101
  await fireRunError({ error: TRUNCATION_ERROR, stage: "model" });
35098
35102
  return {
35099
35103
  data: buildResponseFinal(currentAccumulator),
35100
35104
  error: TRUNCATION_ERROR,
35101
- toolsChecksum: currentAccumulator.toolsChecksum
35105
+ toolsChecksum: currentAccumulator.toolsChecksum,
35106
+ terminalState: terminalStateOf(currentAccumulator)
35102
35107
  };
35103
35108
  }
35104
35109
  const finalResponse = buildResponseFinal(currentAccumulator);
@@ -35111,7 +35116,8 @@ Executing tool: ${toolInfo}
35111
35116
  data: finalResponse,
35112
35117
  error: null,
35113
35118
  toolsChecksum: currentAccumulator.toolsChecksum,
35114
- autoExecutedToolResults: accumulatedToolResults
35119
+ autoExecutedToolResults: accumulatedToolResults,
35120
+ terminalState: terminalStateOf(currentAccumulator)
35115
35121
  };
35116
35122
  }
35117
35123
  if (truncatedToNothing(accumulator)) {
@@ -35119,7 +35125,8 @@ Executing tool: ${toolInfo}
35119
35125
  return {
35120
35126
  data: response,
35121
35127
  error: TRUNCATION_ERROR,
35122
- toolsChecksum: accumulator.toolsChecksum
35128
+ toolsChecksum: accumulator.toolsChecksum,
35129
+ terminalState: terminalStateOf(accumulator)
35123
35130
  };
35124
35131
  }
35125
35132
  if (onFinish) onFinish(response);
@@ -35130,7 +35137,8 @@ Executing tool: ${toolInfo}
35130
35137
  return {
35131
35138
  data: response,
35132
35139
  error: null,
35133
- toolsChecksum: accumulator.toolsChecksum
35140
+ toolsChecksum: accumulator.toolsChecksum,
35141
+ terminalState: terminalStateOf(accumulator)
35134
35142
  };
35135
35143
  } catch (err) {
35136
35144
  if (isAbortError(err)) {
@@ -2423,6 +2423,32 @@ type RunToolLoopOptions = {
2423
2423
  */
2424
2424
  hooks?: RunHooks | RunHooks[];
2425
2425
  };
2426
+ /**
2427
+ * Terminal state of the LAST model response in the turn, normalized to the
2428
+ * completions vocabulary (`"stop"` | `"length"` | `"tool_calls"` | provider-
2429
+ * specific values). `undefined` when the stream carried no finish reason at all.
2430
+ *
2431
+ * Exposed because neither response shape reliably carries it out to a caller.
2432
+ * The Responses API shape has no field for it — `LlmapiResponseResponse` declares
2433
+ * neither `status` nor `incomplete_details` — so `buildFinalResponse` cannot
2434
+ * surface truncation there even though the loop detected it (`responses.ts`
2435
+ * normalizes it onto the accumulator). Completions does expose
2436
+ * `choices[0].finish_reason`, but omits `tool_calls` entirely when there are
2437
+ * none, so a caller sniffing the response cannot tell "no tool calls" from
2438
+ * "field absent".
2439
+ *
2440
+ * The loop already knows both, unambiguously and identically for either API.
2441
+ * Reporting them here means callers and test harnesses stop reverse-engineering
2442
+ * them from a response shape that cannot answer. See anuma-ai/sdk#805.
2443
+ */
2444
+ type RunTerminalState = {
2445
+ /** Normalized finish reason of the final response. `"length"` means the output
2446
+ * ceiling cut it off; anything else means the model stopped on its own. */
2447
+ finishReason?: string;
2448
+ /** Tool calls the final response carried. `0` is meaningful — combined with
2449
+ * empty content it identifies a turn that ended having produced nothing. */
2450
+ finalToolCallCount: number;
2451
+ };
2426
2452
  type RunToolLoopResult = {
2427
2453
  data: ApiResponse;
2428
2454
  error: null;
@@ -2430,6 +2456,8 @@ type RunToolLoopResult = {
2430
2456
  toolsChecksum?: string;
2431
2457
  /** Results from tools that were auto-executed by the SDK */
2432
2458
  autoExecutedToolResults?: AutoExecutedToolResult[];
2459
+ /** Terminal state of the final model response. See {@link RunTerminalState}. */
2460
+ terminalState?: RunTerminalState;
2433
2461
  } | {
2434
2462
  data: ApiResponse | null;
2435
2463
  error: string;
@@ -2441,6 +2469,18 @@ type RunToolLoopResult = {
2441
2469
  detached?: true;
2442
2470
  /** Non-null only when `resumable` was true AND an inference id was captured before detach. */
2443
2471
  resume?: StreamResumeHandle | null;
2472
+ /**
2473
+ * Terminal state of the final model response, when the failure is one the
2474
+ * loop diagnosed FROM that response — today, the truncated-to-nothing
2475
+ * error. See {@link RunTerminalState}.
2476
+ *
2477
+ * Absent on failures that never got a terminal response to read (transport
2478
+ * errors, detach, an SSE failure mid-stream), which is why it stays
2479
+ * optional here. Present on the truncation error specifically because that
2480
+ * is where it is most diagnostic: a caller can branch on
2481
+ * `finishReason === "length"` instead of matching the error string.
2482
+ */
2483
+ terminalState?: RunTerminalState;
2444
2484
  };
2445
2485
  /** Capability header: tells the portal this client can resume a detached stream. Pinned with zeta-chain/ai-portal#1139. */
2446
2486
  declare const STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
@@ -5231,7 +5271,8 @@ interface RetainOptions {
5231
5271
  * Returns `action: 'suppressed'` with the matched `tombstoneId`.
5232
5272
  */
5233
5273
  respectTombstones?: boolean;
5234
- /** Cosine similarity threshold for auto-merge. Default: 0.85. */
5274
+ /** Cosine similarity threshold for auto-merge. Default: 0.8
5275
+ * (`DEFAULT_AUTO_MERGE_THRESHOLD` in retain.ts — the source of truth). */
5235
5276
  autoMergeThreshold?: number;
5236
5277
  /**
5237
5278
  * When provided, runs an LLM-based consolidation pass against the top-K
@@ -5259,9 +5300,13 @@ interface RetainOptions {
5259
5300
  */
5260
5301
  piiRedaction?: boolean | PiiRedactor;
5261
5302
  };
5262
- /** Cosine similarity floor for the consolidator candidate set. Default: 0.65. */
5303
+ /** Cosine similarity floor for the consolidator candidate set. Default: 0.55
5304
+ * (`DEFAULT_CONSOLIDATE_THRESHOLD` in retain.ts — the source of truth). */
5263
5305
  consolidateThreshold?: number;
5264
- /** Top-K consolidation candidates to feed the LLM. Default: 5. */
5306
+ /** Top-K consolidation candidates to feed the LLM. Default: 20
5307
+ * (`DEFAULT_CONSOLIDATE_TOP_K` in retain.ts — the source of truth). Widened
5308
+ * from 5 so a value change can find and retire ALL stale duplicates of the
5309
+ * old value in one pass, not just the nearest few. */
5265
5310
  consolidateTopK?: number;
5266
5311
  /**
5267
5312
  * W6 temporal lane — when the event in this fact occurred. Persisted to
@@ -9294,4 +9339,4 @@ declare function sanitizeQuotes(s: string): string;
9294
9339
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
9295
9340
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
9296
9341
 
9297
- 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, 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 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 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, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, 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 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, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, 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, 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, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, 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 };
9342
+ 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, 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 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 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, 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 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, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, 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, 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, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, 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 };
@@ -2423,6 +2423,32 @@ type RunToolLoopOptions = {
2423
2423
  */
2424
2424
  hooks?: RunHooks | RunHooks[];
2425
2425
  };
2426
+ /**
2427
+ * Terminal state of the LAST model response in the turn, normalized to the
2428
+ * completions vocabulary (`"stop"` | `"length"` | `"tool_calls"` | provider-
2429
+ * specific values). `undefined` when the stream carried no finish reason at all.
2430
+ *
2431
+ * Exposed because neither response shape reliably carries it out to a caller.
2432
+ * The Responses API shape has no field for it — `LlmapiResponseResponse` declares
2433
+ * neither `status` nor `incomplete_details` — so `buildFinalResponse` cannot
2434
+ * surface truncation there even though the loop detected it (`responses.ts`
2435
+ * normalizes it onto the accumulator). Completions does expose
2436
+ * `choices[0].finish_reason`, but omits `tool_calls` entirely when there are
2437
+ * none, so a caller sniffing the response cannot tell "no tool calls" from
2438
+ * "field absent".
2439
+ *
2440
+ * The loop already knows both, unambiguously and identically for either API.
2441
+ * Reporting them here means callers and test harnesses stop reverse-engineering
2442
+ * them from a response shape that cannot answer. See anuma-ai/sdk#805.
2443
+ */
2444
+ type RunTerminalState = {
2445
+ /** Normalized finish reason of the final response. `"length"` means the output
2446
+ * ceiling cut it off; anything else means the model stopped on its own. */
2447
+ finishReason?: string;
2448
+ /** Tool calls the final response carried. `0` is meaningful — combined with
2449
+ * empty content it identifies a turn that ended having produced nothing. */
2450
+ finalToolCallCount: number;
2451
+ };
2426
2452
  type RunToolLoopResult = {
2427
2453
  data: ApiResponse;
2428
2454
  error: null;
@@ -2430,6 +2456,8 @@ type RunToolLoopResult = {
2430
2456
  toolsChecksum?: string;
2431
2457
  /** Results from tools that were auto-executed by the SDK */
2432
2458
  autoExecutedToolResults?: AutoExecutedToolResult[];
2459
+ /** Terminal state of the final model response. See {@link RunTerminalState}. */
2460
+ terminalState?: RunTerminalState;
2433
2461
  } | {
2434
2462
  data: ApiResponse | null;
2435
2463
  error: string;
@@ -2441,6 +2469,18 @@ type RunToolLoopResult = {
2441
2469
  detached?: true;
2442
2470
  /** Non-null only when `resumable` was true AND an inference id was captured before detach. */
2443
2471
  resume?: StreamResumeHandle | null;
2472
+ /**
2473
+ * Terminal state of the final model response, when the failure is one the
2474
+ * loop diagnosed FROM that response — today, the truncated-to-nothing
2475
+ * error. See {@link RunTerminalState}.
2476
+ *
2477
+ * Absent on failures that never got a terminal response to read (transport
2478
+ * errors, detach, an SSE failure mid-stream), which is why it stays
2479
+ * optional here. Present on the truncation error specifically because that
2480
+ * is where it is most diagnostic: a caller can branch on
2481
+ * `finishReason === "length"` instead of matching the error string.
2482
+ */
2483
+ terminalState?: RunTerminalState;
2444
2484
  };
2445
2485
  /** Capability header: tells the portal this client can resume a detached stream. Pinned with zeta-chain/ai-portal#1139. */
2446
2486
  declare const STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
@@ -5231,7 +5271,8 @@ interface RetainOptions {
5231
5271
  * Returns `action: 'suppressed'` with the matched `tombstoneId`.
5232
5272
  */
5233
5273
  respectTombstones?: boolean;
5234
- /** Cosine similarity threshold for auto-merge. Default: 0.85. */
5274
+ /** Cosine similarity threshold for auto-merge. Default: 0.8
5275
+ * (`DEFAULT_AUTO_MERGE_THRESHOLD` in retain.ts — the source of truth). */
5235
5276
  autoMergeThreshold?: number;
5236
5277
  /**
5237
5278
  * When provided, runs an LLM-based consolidation pass against the top-K
@@ -5259,9 +5300,13 @@ interface RetainOptions {
5259
5300
  */
5260
5301
  piiRedaction?: boolean | PiiRedactor;
5261
5302
  };
5262
- /** Cosine similarity floor for the consolidator candidate set. Default: 0.65. */
5303
+ /** Cosine similarity floor for the consolidator candidate set. Default: 0.55
5304
+ * (`DEFAULT_CONSOLIDATE_THRESHOLD` in retain.ts — the source of truth). */
5263
5305
  consolidateThreshold?: number;
5264
- /** Top-K consolidation candidates to feed the LLM. Default: 5. */
5306
+ /** Top-K consolidation candidates to feed the LLM. Default: 20
5307
+ * (`DEFAULT_CONSOLIDATE_TOP_K` in retain.ts — the source of truth). Widened
5308
+ * from 5 so a value change can find and retire ALL stale duplicates of the
5309
+ * old value in one pass, not just the nearest few. */
5265
5310
  consolidateTopK?: number;
5266
5311
  /**
5267
5312
  * W6 temporal lane — when the event in this fact occurred. Persisted to
@@ -9294,4 +9339,4 @@ declare function sanitizeQuotes(s: string): string;
9294
9339
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
9295
9340
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
9296
9341
 
9297
- 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, 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 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 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, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, 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 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, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, 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, 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, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, 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 };
9342
+ 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, 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 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 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, 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 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, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, 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, 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, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, 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 };
@@ -12329,13 +12329,18 @@ Executing tool: ${toolInfo}
12329
12329
  }
12330
12330
  const truncatedToNothing = (acc) => acc.finishReason === "length" && acc.toolCalls.size === 0 && acc.content.trim() === "";
12331
12331
  const TRUNCATION_ERROR = "Model response was truncated at the output-token limit before it produced any usable content or tool call. Retry with a higher `maxOutputTokens`, or prompt for fewer/smaller tool calls per turn.";
12332
+ const terminalStateOf = (acc) => ({
12333
+ ...acc.finishReason !== void 0 && { finishReason: acc.finishReason },
12334
+ finalToolCallCount: acc.toolCalls.size
12335
+ });
12332
12336
  if (toolIteration > 0) {
12333
12337
  if (truncatedToNothing(currentAccumulator)) {
12334
12338
  await fireRunError({ error: TRUNCATION_ERROR, stage: "model" });
12335
12339
  return {
12336
12340
  data: buildResponseFinal(currentAccumulator),
12337
12341
  error: TRUNCATION_ERROR,
12338
- toolsChecksum: currentAccumulator.toolsChecksum
12342
+ toolsChecksum: currentAccumulator.toolsChecksum,
12343
+ terminalState: terminalStateOf(currentAccumulator)
12339
12344
  };
12340
12345
  }
12341
12346
  const finalResponse = buildResponseFinal(currentAccumulator);
@@ -12348,7 +12353,8 @@ Executing tool: ${toolInfo}
12348
12353
  data: finalResponse,
12349
12354
  error: null,
12350
12355
  toolsChecksum: currentAccumulator.toolsChecksum,
12351
- autoExecutedToolResults: accumulatedToolResults
12356
+ autoExecutedToolResults: accumulatedToolResults,
12357
+ terminalState: terminalStateOf(currentAccumulator)
12352
12358
  };
12353
12359
  }
12354
12360
  if (truncatedToNothing(accumulator)) {
@@ -12356,7 +12362,8 @@ Executing tool: ${toolInfo}
12356
12362
  return {
12357
12363
  data: response,
12358
12364
  error: TRUNCATION_ERROR,
12359
- toolsChecksum: accumulator.toolsChecksum
12365
+ toolsChecksum: accumulator.toolsChecksum,
12366
+ terminalState: terminalStateOf(accumulator)
12360
12367
  };
12361
12368
  }
12362
12369
  if (onFinish) onFinish(response);
@@ -12367,7 +12374,8 @@ Executing tool: ${toolInfo}
12367
12374
  return {
12368
12375
  data: response,
12369
12376
  error: null,
12370
- toolsChecksum: accumulator.toolsChecksum
12377
+ toolsChecksum: accumulator.toolsChecksum,
12378
+ terminalState: terminalStateOf(accumulator)
12371
12379
  };
12372
12380
  } catch (err) {
12373
12381
  if (isAbortError(err)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "3.11.5",
3
+ "version": "3.12.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -157,7 +157,7 @@
157
157
  "homepage": "https://github.com/anuma-ai/sdk#readme",
158
158
  "packageManager": "pnpm@10.23.0",
159
159
  "dependencies": {
160
- "@anuma/portal": "1.0.0-next.20260726011521",
160
+ "@anuma/portal": "1.0.0-next.20260727223242",
161
161
  "@babel/parser": "^7.29.2",
162
162
  "@babel/types": "^7.29.0",
163
163
  "ai": "6.0.202",