@anthropic-ai/claude-agent-sdk 0.2.84 → 0.2.86

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/embed.js CHANGED
@@ -20,7 +20,7 @@
20
20
  // 2. At runtime, extractFromBunfs() copies it to a temp directory so it can be
21
21
  // spawned as a subprocess (child processes cannot access the parent's $bunfs)
22
22
 
23
- import { extractFromBunfs } from './extractFromBunfs.js'
24
23
  import embeddedCliPath from './cli.js' with { type: 'file' }
24
+ import { extractFromBunfs } from './extractFromBunfs.js'
25
25
 
26
26
  export default extractFromBunfs(embeddedCliPath)
@@ -5,16 +5,16 @@
5
5
  // Separated from embed.js so the logic is testable without Bun-specific
6
6
  // `import ... with { type: 'file' }` syntax.
7
7
 
8
+ import { createHash } from 'crypto'
8
9
  import {
9
- readFileSync,
10
- writeFileSync,
11
- mkdirSync,
12
10
  chmodSync,
11
+ mkdirSync,
12
+ readFileSync,
13
13
  renameSync,
14
+ writeFileSync,
14
15
  } from 'fs'
15
- import { join } from 'path'
16
16
  import { tmpdir } from 'os'
17
- import { createHash } from 'crypto'
17
+ import { join } from 'path'
18
18
 
19
19
  /**
20
20
  * If `embeddedPath` is inside Bun's $bunfs virtual filesystem, extract it to a
package/manifest.json CHANGED
@@ -1,46 +1,46 @@
1
1
  {
2
- "version": "2.1.84",
3
- "buildDate": "2026-03-25T23:54:35Z",
2
+ "version": "2.1.86",
3
+ "buildDate": "2026-03-27T20:34:42Z",
4
4
  "platforms": {
5
5
  "darwin-arm64": {
6
6
  "binary": "claude",
7
- "checksum": "c02d911ff13f8ceccb1f6662bf211f3cd9f29d5a46f031c3cc40654eb759aa29",
8
- "size": 203606768
7
+ "checksum": "76fafee995269784b1bf80b514c3b354394288fb794bed01ef20168874e088ea",
8
+ "size": 196638704
9
9
  },
10
10
  "darwin-x64": {
11
11
  "binary": "claude",
12
- "checksum": "da5ed2ee1b0bcf65c2088e79bc65388ec85edc41041fc6ca7c27330f2e201085",
13
- "size": 205199952
12
+ "checksum": "de96f6966648ecd93c345fab4b3be944e93ba4140f1cda7fe45ffed93133b67e",
13
+ "size": 198132816
14
14
  },
15
15
  "linux-arm64": {
16
16
  "binary": "claude",
17
- "checksum": "5c868174b44439e51c74ff084c306856c41779615250d5bbdaa5d10056362814",
18
- "size": 235473472
17
+ "checksum": "c04aebe3de140679b4cce158812d6f011b7e9c483496ccb0472cf38cc1714afe",
18
+ "size": 228461120
19
19
  },
20
20
  "linux-x64": {
21
21
  "binary": "claude",
22
- "checksum": "c6872aa8db94f303bc6a4482664e40d3288dfc989c89ba268473ed32e3055878",
23
- "size": 235657856
22
+ "checksum": "adce02c5f94a85b6ca231c8aeef533707597cd387e8934776455b87d10a3051b",
23
+ "size": 228280960
24
24
  },
25
25
  "linux-arm64-musl": {
26
26
  "binary": "claude",
27
- "checksum": "6e42aee87a00ab8e6fb3db3fc409ab969f12758bacc2a0c9f622d8e97445a0a8",
28
- "size": 228592064
27
+ "checksum": "ded1933ce0f2bb55156b397fa622ca2782caa48ed99ed117ee20481f638e0293",
28
+ "size": 221579712
29
29
  },
30
30
  "linux-x64-musl": {
31
31
  "binary": "claude",
32
- "checksum": "0109e76af6261f6fd37ae1deefc7ee3bc58b0ad786086d198a981275979c549a",
33
- "size": 230283712
32
+ "checksum": "fb86c40f52a39c71393db93b9fa5f5c048be67c5a087a03e35e1e304c127c8c5",
33
+ "size": 222906816
34
34
  },
35
35
  "win32-x64": {
36
36
  "binary": "claude.exe",
37
- "checksum": "64b28630ec4f4aaa6cc0e225379cf59cdb95828cbb4ce700a0ae4401b1999ecd",
38
- "size": 245196960
37
+ "checksum": "9b9281621d0d5aa4aba3e3e9c5a6efdfe37a897fb9ba33a87e4562ec9df6453f",
38
+ "size": 238222496
39
39
  },
40
40
  "win32-arm64": {
41
41
  "binary": "claude.exe",
42
- "checksum": "e7f5d18d470f0345ee18bb368f8ea7d43e791e17f0de7b69cdc40e42a9a9398e",
43
- "size": 241350304
42
+ "checksum": "4f6eaa82b5eefd79b1ed56d6d6ffa3229c508c974f51ae43b6c38f5e2fdafe5f",
43
+ "size": 234785440
44
44
  }
45
45
  }
46
46
  }
package/manifest.zst.json CHANGED
@@ -1,54 +1,54 @@
1
1
  {
2
- "version": "2.1.84",
3
- "buildDate": "2026-03-25T23:54:36Z",
2
+ "version": "2.1.86",
3
+ "buildDate": "2026-03-27T20:34:43Z",
4
4
  "platforms": {
5
5
  "darwin-arm64": {
6
6
  "binary": "claude.zst",
7
- "checksum": "a0e577c1ca84302c5de1e6498d047149ba44a710ea51ff303986fd47f1c0eb83",
8
- "size": 43366416,
7
+ "checksum": "fe4d250299ff4789e4c3a1172c97720c62fefed52496b66652325815fec58949",
8
+ "size": 40735714,
9
9
  "bundle": {
10
- "checksum": "4111e9be5214eb3e2e97d7fc133dbb13b51fc8978fff23d26578021fa84b7c30",
11
- "size": 43377661
10
+ "checksum": "0315d453553df95189f14ddfb15d7d0d9df97121673cc685bb3b1bdcfe0214fb",
11
+ "size": 40733484
12
12
  }
13
13
  },
14
14
  "darwin-x64": {
15
15
  "binary": "claude.zst",
16
- "checksum": "d852a6245edfb235dd73bdffef79012ab18ee075ef3ded5abf602b17812bc82a",
17
- "size": 45050362,
16
+ "checksum": "8b1ef96634369e58cd480276c030a55c39bd66cb33b703a5f35c818a922c4d69",
17
+ "size": 42395229,
18
18
  "bundle": {
19
- "checksum": "10bcd37cb20f82861ed710292821927d7f8e1549ca1dbc9e248769409c62f22b",
20
- "size": 45050626
19
+ "checksum": "4fe4d244397a50ccb33f2a3600cc342f0f6ec1731983c748ec6ebe8b57342488",
20
+ "size": 42396667
21
21
  }
22
22
  },
23
23
  "linux-arm64": {
24
24
  "binary": "claude.zst",
25
- "checksum": "fb0a0db9e8ceb414563fe776b9035b0827548d8e94bfab23f5c58a63d9c5f7b4",
26
- "size": 53002601
25
+ "checksum": "480cf52b5380fb9013902fe893ec58553f848f34bd979788f20106ff0ee61b1b",
26
+ "size": 50420732
27
27
  },
28
28
  "linux-x64": {
29
29
  "binary": "claude.zst",
30
- "checksum": "8476f46fb0422be1fc2cafe82c1b4b51226c07b5b73b40dd40b203cc5c8ad90a",
31
- "size": 53582657
30
+ "checksum": "0866db2a7ef4ccaad987f834639770299a9a740ed82a5cc53eb2db304e881986",
31
+ "size": 50935311
32
32
  },
33
33
  "linux-arm64-musl": {
34
34
  "binary": "claude.zst",
35
- "checksum": "7523be8411a2fef9bb4d93c59707d5497f5bf8229fb528fbc9ba5fc146480dee",
36
- "size": 51604167
35
+ "checksum": "05e6b45654b57c6cd26e80157c8112f0d24abfee053c0aa926b297ec608fcd78",
36
+ "size": 49030009
37
37
  },
38
38
  "linux-x64-musl": {
39
39
  "binary": "claude.zst",
40
- "checksum": "e670e1468f01946a822d1526276f2f9de566987d89bbd52186a505f88763714f",
41
- "size": 52327014
40
+ "checksum": "5154b2d20634a180b6d7b4e74afcf87125663d6fe5ccfc0553a6a6dd6e7b17ab",
41
+ "size": 49670272
42
42
  },
43
43
  "win32-x64": {
44
44
  "binary": "claude.exe.zst",
45
- "checksum": "e83814324697073fe6462eafcca9c354af1dc22e9689e5f3c0788dd1021ef414",
46
- "size": 55192345
45
+ "checksum": "a231ea48462175772d5af60bb13b70ef1f0748f63e426edf05f0b50d88c70e6c",
46
+ "size": 52576784
47
47
  },
48
48
  "win32-arm64": {
49
49
  "binary": "claude.exe.zst",
50
- "checksum": "dc7c0d74e5ae0704c4745d350f0afc5c2044b4b3fe553fb808252b9f2957af87",
51
- "size": 53246192
50
+ "checksum": "d566cde2014177d00862b66dc971121cf4569e11f7763ce28e5f34132308cb73",
51
+ "size": 50754734
52
52
  }
53
53
  }
54
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/claude-agent-sdk",
3
- "version": "0.2.84",
3
+ "version": "0.2.86",
4
4
  "main": "sdk.mjs",
5
5
  "types": "sdk.d.ts",
6
6
  "exports": {
@@ -47,7 +47,10 @@
47
47
  "automation",
48
48
  "code-generation"
49
49
  ],
50
- "dependencies": {},
50
+ "dependencies": {
51
+ "@anthropic-ai/sdk": "^0.74.0",
52
+ "@modelcontextprotocol/sdk": "^1.27.1"
53
+ },
51
54
  "peerDependencies": {
52
55
  "zod": "^4.0.0"
53
56
  },
@@ -62,5 +65,5 @@
62
65
  "@img/sharp-win32-arm64": "^0.34.2",
63
66
  "@img/sharp-win32-x64": "^0.34.2"
64
67
  },
65
- "claudeCodeVersion": "2.1.84"
68
+ "claudeCodeVersion": "2.1.86"
66
69
  }
package/sdk-tools.d.ts CHANGED
@@ -23,10 +23,6 @@ export type ToolInputSchemas =
23
23
  | McpInput
24
24
  | NotebookEditInput
25
25
  | ReadMcpResourceInput
26
- | SubscribeMcpResourceInput
27
- | UnsubscribeMcpResourceInput
28
- | SubscribePollingInput
29
- | UnsubscribePollingInput
30
26
  | TodoWriteInput
31
27
  | WebFetchInput
32
28
  | WebSearchInput
@@ -49,10 +45,6 @@ export type ToolOutputSchemas =
49
45
  | McpOutput
50
46
  | NotebookEditOutput
51
47
  | ReadMcpResourceOutput
52
- | SubscribeMcpResourceOutput
53
- | UnsubscribeMcpResourceOutput
54
- | SubscribePollingOutput
55
- | UnsubscribePollingOutput
56
48
  | TodoWriteOutput
57
49
  | WebFetchOutput
58
50
  | WebSearchOutput
@@ -226,6 +218,15 @@ export type FileReadOutput =
226
218
  */
227
219
  outputDir: string;
228
220
  };
221
+ }
222
+ | {
223
+ type: "file_unchanged";
224
+ file: {
225
+ /**
226
+ * The path to the file
227
+ */
228
+ filePath: string;
229
+ };
229
230
  };
230
231
  export type ListMcpResourcesOutput = {
231
232
  /**
@@ -519,80 +520,6 @@ export interface ReadMcpResourceInput {
519
520
  */
520
521
  uri: string;
521
522
  }
522
- export interface SubscribeMcpResourceInput {
523
- /**
524
- * The MCP server name
525
- */
526
- server: string;
527
- /**
528
- * The resource URI to subscribe to
529
- */
530
- uri: string;
531
- /**
532
- * Optional reason for subscribing (included in update notifications)
533
- */
534
- reason?: string;
535
- }
536
- export interface UnsubscribeMcpResourceInput {
537
- /**
538
- * The MCP server name
539
- */
540
- server?: string;
541
- /**
542
- * The resource URI to unsubscribe from
543
- */
544
- uri?: string;
545
- /**
546
- * The subscription ID to unsubscribe
547
- */
548
- subscriptionId?: string;
549
- }
550
- export interface SubscribePollingInput {
551
- /**
552
- * The type of subscription: "tool" to poll a tool, "resource" to poll a resource URI
553
- */
554
- type: "tool" | "resource";
555
- /**
556
- * The MCP server name
557
- */
558
- server: string;
559
- /**
560
- * The tool to call periodically (required when type is "tool")
561
- */
562
- toolName?: string;
563
- /**
564
- * Arguments to pass to the tool on each call
565
- */
566
- arguments?: {
567
- [k: string]: unknown;
568
- };
569
- /**
570
- * The resource URI to poll (required when type is "resource")
571
- */
572
- uri?: string;
573
- /**
574
- * Polling interval in milliseconds (minimum 1000ms, default 5000ms)
575
- */
576
- intervalMs: number;
577
- /**
578
- * Optional reason for subscribing (included in change notifications)
579
- */
580
- reason?: string;
581
- }
582
- export interface UnsubscribePollingInput {
583
- /**
584
- * The subscription ID to unsubscribe
585
- */
586
- subscriptionId?: string;
587
- /**
588
- * The MCP server name
589
- */
590
- server?: string;
591
- /**
592
- * The target to unsubscribe (tool name for tool subscriptions, URI for resource subscriptions)
593
- */
594
- target?: string;
595
- }
596
523
  export interface TodoWriteInput {
597
524
  /**
598
525
  * The updated todo list
@@ -2507,38 +2434,6 @@ export interface ReadMcpResourceOutput {
2507
2434
  blobSavedTo?: string;
2508
2435
  }[];
2509
2436
  }
2510
- export interface SubscribeMcpResourceOutput {
2511
- /**
2512
- * Whether the subscription was successful
2513
- */
2514
- subscribed: boolean;
2515
- /**
2516
- * Unique identifier for this subscription
2517
- */
2518
- subscriptionId: string;
2519
- }
2520
- export interface UnsubscribeMcpResourceOutput {
2521
- /**
2522
- * Whether the unsubscription was successful
2523
- */
2524
- unsubscribed: boolean;
2525
- }
2526
- export interface SubscribePollingOutput {
2527
- /**
2528
- * Whether the subscription was successful
2529
- */
2530
- subscribed: boolean;
2531
- /**
2532
- * Unique identifier for this subscription
2533
- */
2534
- subscriptionId: string;
2535
- }
2536
- export interface UnsubscribePollingOutput {
2537
- /**
2538
- * Whether the unsubscription was successful
2539
- */
2540
- unsubscribed: boolean;
2541
- }
2542
2437
  export interface TodoWriteOutput {
2543
2438
  /**
2544
2439
  * The todo list before the update
package/sdk.d.ts CHANGED
@@ -197,10 +197,10 @@ declare type ControlResponse = {
197
197
 
198
198
  declare namespace coreTypes {
199
199
  export {
200
- SandboxSettings,
201
- SandboxNetworkConfig,
202
200
  SandboxFilesystemConfig,
203
201
  SandboxIgnoreViolations,
202
+ SandboxNetworkConfig,
203
+ SandboxSettings,
204
204
  NonNullableUsage,
205
205
  HOOK_EVENTS,
206
206
  EXIT_REASONS,
@@ -1577,6 +1577,20 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
1577
1577
  * @returns Array of MCP server statuses (connected, failed, needs-auth, pending)
1578
1578
  */
1579
1579
  mcpServerStatus(): Promise<McpServerStatus[]>;
1580
+ /**
1581
+ * Get a breakdown of current context window usage by category
1582
+ * (system prompt, tools, messages, MCP tools, memory files, etc.).
1583
+ *
1584
+ * @returns Context usage breakdown including token counts per category and total usage
1585
+ */
1586
+ getContextUsage(): Promise<SDKControlGetContextUsageResponse>;
1587
+ /**
1588
+ * Reload plugins from disk and return the refreshed commands, agents,
1589
+ * plugins, and MCP server status.
1590
+ *
1591
+ * @returns The refreshed session components after plugin reload
1592
+ */
1593
+ reloadPlugins(): Promise<SDKControlReloadPluginsResponse>;
1580
1594
  /**
1581
1595
  * Get information about the authenticated account.
1582
1596
  *
@@ -1608,6 +1622,7 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
1608
1622
 
1609
1623
 
1610
1624
 
1625
+
1611
1626
  /**
1612
1627
  * Reconnect an MCP server by name.
1613
1628
  * Throws on failure.
@@ -1851,6 +1866,106 @@ declare type SDKControlElicitationRequest = {
1851
1866
  requested_schema?: Record<string, unknown>;
1852
1867
  };
1853
1868
 
1869
+ /**
1870
+ * Requests a breakdown of current context window usage by category.
1871
+ */
1872
+ declare type SDKControlGetContextUsageRequest = {
1873
+ subtype: 'get_context_usage';
1874
+ };
1875
+
1876
+ /**
1877
+ * Breakdown of current context window usage by category (system prompt, tools, messages, etc.).
1878
+ */
1879
+ export declare type SDKControlGetContextUsageResponse = {
1880
+ categories: {
1881
+ name: string;
1882
+ tokens: number;
1883
+ color: string;
1884
+ isDeferred?: boolean;
1885
+ }[];
1886
+ totalTokens: number;
1887
+ maxTokens: number;
1888
+ rawMaxTokens: number;
1889
+ percentage: number;
1890
+ gridRows: {
1891
+ color: string;
1892
+ isFilled: boolean;
1893
+ categoryName: string;
1894
+ tokens: number;
1895
+ percentage: number;
1896
+ squareFullness: number;
1897
+ }[][];
1898
+ model: string;
1899
+ memoryFiles: {
1900
+ path: string;
1901
+ type: string;
1902
+ tokens: number;
1903
+ }[];
1904
+ mcpTools: {
1905
+ name: string;
1906
+ serverName: string;
1907
+ tokens: number;
1908
+ isLoaded?: boolean;
1909
+ }[];
1910
+ deferredBuiltinTools?: {
1911
+ name: string;
1912
+ tokens: number;
1913
+ isLoaded: boolean;
1914
+ }[];
1915
+ systemTools?: {
1916
+ name: string;
1917
+ tokens: number;
1918
+ }[];
1919
+ systemPromptSections?: {
1920
+ name: string;
1921
+ tokens: number;
1922
+ }[];
1923
+ agents: {
1924
+ agentType: string;
1925
+ source: string;
1926
+ tokens: number;
1927
+ }[];
1928
+ slashCommands?: {
1929
+ totalCommands: number;
1930
+ includedCommands: number;
1931
+ tokens: number;
1932
+ };
1933
+ skills?: {
1934
+ totalSkills: number;
1935
+ includedSkills: number;
1936
+ tokens: number;
1937
+ skillFrontmatter: {
1938
+ name: string;
1939
+ source: string;
1940
+ tokens: number;
1941
+ }[];
1942
+ };
1943
+ autoCompactThreshold?: number;
1944
+ isAutoCompactEnabled: boolean;
1945
+ messageBreakdown?: {
1946
+ toolCallTokens: number;
1947
+ toolResultTokens: number;
1948
+ attachmentTokens: number;
1949
+ assistantMessageTokens: number;
1950
+ userMessageTokens: number;
1951
+ toolCallsByType: {
1952
+ name: string;
1953
+ callTokens: number;
1954
+ resultTokens: number;
1955
+ }[];
1956
+ attachmentsByType: {
1957
+ name: string;
1958
+ tokens: number;
1959
+ }[];
1960
+ };
1961
+ apiUsage: {
1962
+ input_tokens: number;
1963
+ output_tokens: number;
1964
+ cache_creation_input_tokens: number;
1965
+ cache_read_input_tokens: number;
1966
+ } | null;
1967
+ };
1968
+
1854
1969
  /**
1855
1970
  * Returns the effective merged settings and the raw per-source settings.
1856
1971
  */
@@ -1876,7 +1991,7 @@ declare type SDKControlInitializeRequest = {
1876
1991
  /**
1877
1992
  * Response from session initialization with available commands, models, and account info.
1878
1993
  */
1879
- declare type SDKControlInitializeResponse = {
1994
+ export declare type SDKControlInitializeResponse = {
1880
1995
  commands: coreTypes.SlashCommand[];
1881
1996
  agents: coreTypes.AgentInfo[];
1882
1997
  output_style: string;
@@ -1955,13 +2070,35 @@ declare type SDKControlPermissionRequest = {
1955
2070
  description?: string;
1956
2071
  };
1957
2072
 
2073
+ /**
2074
+ * Reloads plugins from disk and returns the refreshed session components.
2075
+ */
2076
+ declare type SDKControlReloadPluginsRequest = {
2077
+ subtype: 'reload_plugins';
2078
+ };
2079
+
2080
+ /**
2081
+ * Refreshed commands, agents, plugins, and MCP server status after reload.
2082
+ */
2083
+ export declare type SDKControlReloadPluginsResponse = {
2084
+ commands: coreTypes.SlashCommand[];
2085
+ agents: coreTypes.AgentInfo[];
2086
+ plugins: {
2087
+ name: string;
2088
+ path: string;
2089
+ source?: string;
2090
+ }[];
2091
+ mcpServers: coreTypes.McpServerStatus[];
2092
+ error_count: number;
2093
+ };
2094
+
1958
2095
  export declare type SDKControlRequest = {
1959
2096
  type: 'control_request';
1960
2097
  request_id: string;
1961
2098
  request: SDKControlRequestInner;
1962
2099
  };
1963
2100
 
1964
- declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlMcpStatusRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlChannelEnableRequest | SDKControlEndSessionRequest | SDKControlMcpAuthenticateRequest | SDKControlMcpClearAuthRequest | SDKControlMcpOAuthCallbackUrlRequest | SDKControlClaudeAuthenticateRequest | SDKControlClaudeOAuthCallbackRequest | SDKControlClaudeOAuthWaitForCompletionRequest | SDKControlRemoteControlRequest | SDKControlSetProactiveRequest | SDKControlGenerateSessionTitleRequest | SDKControlSideQuestionRequest | SDKControlStopTaskRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlElicitationRequest;
2101
+ declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlReloadPluginsRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlChannelEnableRequest | SDKControlEndSessionRequest | SDKControlMcpAuthenticateRequest | SDKControlMcpClearAuthRequest | SDKControlMcpOAuthCallbackUrlRequest | SDKControlClaudeAuthenticateRequest | SDKControlClaudeOAuthCallbackRequest | SDKControlClaudeOAuthWaitForCompletionRequest | SDKControlRemoteControlRequest | SDKControlSetProactiveRequest | SDKControlGenerateSessionTitleRequest | SDKControlSideQuestionRequest | SDKControlStopTaskRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlElicitationRequest;
1965
2102
 
1966
2103
  export declare type SDKControlResponse = {
1967
2104
  type: 'control_response';
@@ -2503,7 +2640,7 @@ export declare type SDKUserMessage = {
2503
2640
  */
2504
2641
  timestamp?: string;
2505
2642
  uuid?: UUID;
2506
- session_id: string;
2643
+ session_id?: string;
2507
2644
  };
2508
2645
 
2509
2646
  export declare type SDKUserMessageReplay = {
@@ -2751,6 +2888,10 @@ export declare interface Settings {
2751
2888
  * Shell command to execute
2752
2889
  */
2753
2890
  command: string;
2891
+ /**
2892
+ * Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.
2893
+ */
2894
+ if?: string;
2754
2895
  /**
2755
2896
  * Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash.
2756
2897
  */
@@ -2784,6 +2925,10 @@ export declare interface Settings {
2784
2925
  * Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.
2785
2926
  */
2786
2927
  prompt: string;
2928
+ /**
2929
+ * Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.
2930
+ */
2931
+ if?: string;
2787
2932
  /**
2788
2933
  * Timeout in seconds for this specific prompt evaluation
2789
2934
  */
@@ -2809,6 +2954,10 @@ export declare interface Settings {
2809
2954
  * Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.
2810
2955
  */
2811
2956
  prompt: string;
2957
+ /**
2958
+ * Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.
2959
+ */
2960
+ if?: string;
2812
2961
  /**
2813
2962
  * Timeout in seconds for agent execution (default 60)
2814
2963
  */
@@ -2834,6 +2983,10 @@ export declare interface Settings {
2834
2983
  * URL to POST the hook input JSON to
2835
2984
  */
2836
2985
  url: string;
2986
+ /**
2987
+ * Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.
2988
+ */
2989
+ if?: string;
2837
2990
  /**
2838
2991
  * Timeout in seconds for this specific request
2839
2992
  */
@@ -3885,7 +4038,7 @@ export declare interface SpawnOptions {
3885
4038
  signal: AbortSignal;
3886
4039
  }
3887
4040
 
3888
- declare type StdoutMessage = coreTypes.SDKMessage | coreTypes.SDKStreamlinedTextMessage | coreTypes.SDKStreamlinedToolUseSummaryMessage | SDKControlResponse | SDKControlRequest | SDKControlCancelRequest | SDKKeepAliveMessage;
4041
+ declare type StdoutMessage = coreTypes.SDKMessage | coreTypes.SDKStreamlinedTextMessage | coreTypes.SDKStreamlinedToolUseSummaryMessage | coreTypes.SDKPostTurnSummaryMessage | SDKControlResponse | SDKControlRequest | SDKControlCancelRequest | SDKKeepAliveMessage;
3889
4042
 
3890
4043
  export declare type StopFailureHookInput = BaseHookInput & {
3891
4044
  hook_event_name: 'StopFailure';
@@ -3999,6 +4152,7 @@ export declare type ThinkingEnabled = {
3999
4152
  export declare function tool<Schema extends AnyZodRawShape>(_name: string, _description: string, _inputSchema: Schema, _handler: (args: InferShape<Schema>, extra: unknown) => Promise<CallToolResult>, _extras?: {
4000
4153
  annotations?: ToolAnnotations;
4001
4154
  searchHint?: string;
4155
+ alwaysLoad?: boolean;
4002
4156
  }): SdkMcpToolDefinition<Schema>;
4003
4157
 
4004
4158
  /**