@anthropic-ai/claude-agent-sdk 0.3.210 → 0.3.212

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.
package/sdk.d.ts CHANGED
@@ -1463,7 +1463,7 @@ export declare type Options = {
1463
1463
  * Enable beta features. Currently supported:
1464
1464
  * - `'context-1m-2025-08-07'` - Enable 1M token context window (Sonnet 4/4.5 only)
1465
1465
  *
1466
- * @see https://docs.anthropic.com/en/api/beta-headers
1466
+ * @see https://platform.claude.com/docs/en/api/beta-headers
1467
1467
  */
1468
1468
  betas?: SdkBeta[];
1469
1469
  /**
@@ -1607,7 +1607,7 @@ export declare type Options = {
1607
1607
  *
1608
1608
  * When set, takes precedence over the deprecated `maxThinkingTokens`.
1609
1609
  *
1610
- * @see https://docs.anthropic.com/en/docs/build-with-claude/adaptive-thinking
1610
+ * @see https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking
1611
1611
  */
1612
1612
  thinking?: ThinkingConfig;
1613
1613
  /**
@@ -1620,7 +1620,7 @@ export declare type Options = {
1620
1620
  * - `'xhigh'` — Deeper than high (Fable 5, Opus 4.7+, Sonnet 5)
1621
1621
  * - `'max'` — Maximum effort (Fable 5, Opus 4.6+, Sonnet 4.6+)
1622
1622
  *
1623
- * @see https://docs.anthropic.com/en/docs/build-with-claude/effort
1623
+ * @see https://platform.claude.com/docs/en/build-with-claude/effort
1624
1624
  */
1625
1625
  effort?: EffortLevel;
1626
1626
  /**
@@ -1813,7 +1813,7 @@ export declare type Options = {
1813
1813
  * }
1814
1814
  * ```
1815
1815
  *
1816
- * @see https://docs.anthropic.com/en/docs/claude-code/settings#sandbox-settings
1816
+ * @see https://code.claude.com/docs/en/settings#sandbox-settings
1817
1817
  */
1818
1818
  sandbox?: SandboxSettings;
1819
1819
  /**
@@ -2014,6 +2014,15 @@ export declare type Options = {
2014
2014
  spawnClaudeCodeProcess?: (options: SpawnOptions) => SpawnedProcess;
2015
2015
  };
2016
2016
 
2017
+ /**
2018
+ * Emitted on the same severity:'error' path as the usage-limit bucket, but
2019
+ * the condition is an org policy, not an exhausted limit — consumers route
2020
+ * these to org-disabled presentation, never the usage-limit card.
2021
+ *
2022
+ * @alpha
2023
+ */
2024
+ export declare const ORG_POLICY_LIMIT_PREFIXES: readonly ["This service is disabled for your org"];
2025
+
2017
2026
  export declare type OutputFormat = JsonSchemaOutputFormat;
2018
2027
 
2019
2028
  export declare type OutputFormatType = 'json_schema';
@@ -2799,6 +2808,10 @@ export declare type SDKAssistantMessage = {
2799
2808
  uuid: UUID;
2800
2809
  session_id: string;
2801
2810
  request_id?: string;
2811
+ /**
2812
+ * This turn continued the preceding truncated assistant turn inside its trailing signed thinking block (max-output-tokens recovery). Its thinking signatures are cumulative over that preceding thinking-only turn, so a history replayed through the bridge must carry this flag back for the normalizer to keep the run's prefix on the wire. Wrapper-level sibling — never inside `message.content` — so it is not replayed to the model.
2813
+ */
2814
+ resumed_from_incomplete_thinking?: true;
2802
2815
  /**
2803
2816
  * Wire uuids of previously-delivered messages that this message replaces (refusal-fallback supersede). The list can include tombstoned tool_result frames from the refused leg, not only assistant frames. Evict the named messages on arrival and treat this frame as their canonical replacement. Idempotent with the end-of-turn model_refusal_fallback notice, whose retracted_message_uuids remains the complete audit record for the turn.
2804
2817
  */
@@ -2812,7 +2825,10 @@ export declare type SDKAssistantMessage = {
2812
2825
  */
2813
2826
  task_description?: string;
2814
2827
 
2815
-
2828
+ /**
2829
+ * ISO timestamp of when this content block finished on the originating process. One API assistant turn may produce several assistant messages sharing a message.id, each with its own timestamp. Uses the originating host's clock, so it's for display only; do not order messages by this field. Older emitters omit it; consumers should fall back to receive time.
2830
+ */
2831
+ timestamp?: string;
2816
2832
 
2817
2833
 
2818
2834
 
@@ -3421,7 +3437,7 @@ declare type SDKControlListModelsRequest = {
3421
3437
  };
3422
3438
 
3423
3439
  /**
3424
- * Invokes an MCP tool via the subprocess MCP client without a model turn. No permission check (control channel is trusted, same as other subtypes). SDK-type MCP servers (config.type === "sdk") are rejected — they are caller-provided, so the caller can invoke them directly without the subprocess round-trip. Result content passes through the same processing as model-turn MCP calls. Session expiry is not retried automatically; callers can mcp_reconnect and retry. UrlElicitationRequired (-32042) tries Elicitation hooks; if no hook resolves, the call errors with the URL in the message — open it out-of-band, then retry mcp_call. STAGED calls (input_files/output_files declared) additionally stage lane rows in/out around the call — see the input_files describe. Staged failures come back as a success-subtype response whose staging field carries a typed error_code; subtype:error is emitted only when the call could not be attempted at all (server not connected, kill switch, dispatch failure) and means nothing ran. Standard RPC semantics: a redelivered request_id supersedes the in-flight run (it is aborted and its response suppressed — exactly one response per request_id); conversion is idempotent, so re-running is safe. Cancellable via control_cancel_request.
3440
+ * Invokes an MCP tool via the subprocess MCP client without a model turn. No permission check (control channel is trusted, same as other subtypes). SDK-type MCP servers (config.type === "sdk") are rejected — they are caller-provided, so the caller can invoke them directly without the subprocess round-trip. Result content passes through the same processing as model-turn MCP calls. Session expiry is not retried automatically; callers can mcp_reconnect and retry. UrlElicitationRequired (-32042) tries Elicitation hooks; if no hook resolves, the call errors with the URL in the message — open it out-of-band, then retry mcp_call. STAGED calls (input_files/output_files declared) additionally stage lane rows in/out around the call — see the input_files describe. Staged failures come back as a success-subtype response whose staging field carries a typed error_code; subtype:error is emitted only when the call could not be attempted at all (server not connected, kill switch, dispatch failure) and means nothing ran. A target server that is not yet connected is brought up on demand: dispatch runs the deferred plugin/MCP startup resolution (the work a first model turn would have done) and waits up to 30s — shortened by expires_at when that is sooner — for the server to connect before answering "MCP server not connected", so a dispatch that races plugin startup (e.g. after an idle-wake reattach) succeeds instead of failing until a turn runs. Standard RPC semantics: a redelivered request_id supersedes the in-flight run (it is aborted and its response suppressed — exactly one response per request_id); conversion is idempotent, so re-running is safe. Cancellable via control_cancel_request.
3425
3441
  */
3426
3442
  declare type SDKControlMcpCallRequest = {
3427
3443
  subtype: 'mcp_call';
@@ -6126,6 +6142,10 @@ export declare interface Settings {
6126
6142
  * Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point.
6127
6143
  */
6128
6144
  feedbackSurveyRate?: number;
6145
+ /**
6146
+ * Model-drafted feedback (the SendFeedback tool). "notify" (default) shows a one-line notice when a draft is queued; "quiet" shows only the footer counter; "off" disables the tool entirely so drafts are never queued.
6147
+ */
6148
+ feedbackDrafts?: 'notify' | 'quiet' | 'off';
6129
6149
  /**
6130
6150
  * Whether to show tips in the spinner
6131
6151
  */
@@ -6505,6 +6525,12 @@ export declare interface SpawnedProcess {
6505
6525
  readonly killed: boolean;
6506
6526
  /** Exit code if the process has exited, null otherwise */
6507
6527
  readonly exitCode: number | null;
6528
+ /**
6529
+ * Signal that terminated the process, if any. Optional: ChildProcess
6530
+ * provides it; custom spawners may omit it (signal exits then read as
6531
+ * still-running until their 'exit' event delivers the signal).
6532
+ */
6533
+ readonly signalCode?: NodeJS.Signals | null;
6508
6534
  /**
6509
6535
  * Kill the process with the given signal
6510
6536
  * @param signal - The signal to send (e.g., 'SIGTERM', 'SIGKILL')
@@ -6514,6 +6540,11 @@ export declare interface SpawnedProcess {
6514
6540
  * Register a callback for when the process exits
6515
6541
  * @param event - Must be 'exit'
6516
6542
  * @param listener - Callback receiving exit code and signal
6543
+ *
6544
+ * ProcessTransport's built-in local spawn delivers this only after the
6545
+ * child's stderr has also closed (bounded by a short grace), so exit
6546
+ * consumers see a complete stderr tail in exit errors. Custom
6547
+ * `spawnClaudeCodeProcess` implementations emit plain process exit.
6517
6548
  */
6518
6549
  on(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): void;
6519
6550
  /**
@@ -6838,6 +6869,33 @@ export declare interface Transport {
6838
6869
  [Symbol.dispose]?(): void;
6839
6870
  }
6840
6871
 
6872
+ /**
6873
+ * Messages meaning "a usage limit was genuinely reached" — the error-path
6874
+ * outputs of getLimitReachedText (rateLimitMessages.ts) and
6875
+ * getFableCreditsRequiredContent (api/errors.ts).
6876
+ *
6877
+ * @alpha
6878
+ */
6879
+ export declare const USAGE_LIMIT_ERROR_PREFIXES: readonly ["You've hit your", "You've reached your", "You're out of usage credits", "Your org is out of usage · add funds to continue", "Your org is out of usage · contact your admin", "Your seat type doesn't include usage credits", "Your seat type doesn't include usage", "Your usage allocation has been disabled by your admin", "Your group's usage limit is set to $0", "Fable 5 requires usage credits", "You're out of extra usage", "Your seat type doesn't include extra usage"];
6880
+
6881
+ /**
6882
+ * Overage-transition notifications ("now drawing from credits"). Toast only;
6883
+ * these never arrive as API errors.
6884
+ *
6885
+ * @alpha
6886
+ */
6887
+ export declare const USAGE_TRANSITION_PREFIXES: readonly ["You're now using usage credits", "You're now using your usage allocation", "Now using your usage allocation", "Now using usage credits", "You're now using extra usage", "Now using extra usage"];
6888
+
6889
+ /**
6890
+ * Approaching-limit warnings (severity:'warning'). Footer/toast only; these
6891
+ * never arrive as API errors. ("Approaching …" early warnings are
6892
+ * deliberately unregistered — they render in the footer without
6893
+ * <RateLimitMessage> styling; see the generator-coverage tests.)
6894
+ *
6895
+ * @alpha
6896
+ */
6897
+ export declare const USAGE_WARNING_PREFIXES: readonly ["You've used", "You're close to"];
6898
+
6841
6899
  /**
6842
6900
  * A `request_user_dialog` control request from the CLI, asking the SDK
6843
6901
  * consumer to render a blocking dialog and return the user's choice.