@anthropic-ai/claude-code 2.1.45 → 2.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/bun.lock +9 -8
  2. package/cli.js +10188 -5589
  3. package/package.json +10 -9
  4. package/sdk-tools.d.ts +717 -2
package/sdk-tools.d.ts CHANGED
@@ -27,7 +27,226 @@ export type ToolInputSchemas =
27
27
  | WebFetchInput
28
28
  | WebSearchInput
29
29
  | AskUserQuestionInput
30
- | ConfigInput;
30
+ | ConfigInput
31
+ | EnterWorktreeInput
32
+ | ToolOutputSchemas;
33
+ export type ToolOutputSchemas =
34
+ | AgentOutput
35
+ | BashOutput
36
+ | ExitPlanModeOutput
37
+ | FileEditOutput
38
+ | FileReadOutput
39
+ | FileWriteOutput
40
+ | GlobOutput
41
+ | GrepOutput
42
+ | TaskStopOutput
43
+ | ListMcpResourcesOutput
44
+ | McpOutput
45
+ | NotebookEditOutput
46
+ | ReadMcpResourceOutput
47
+ | TodoWriteOutput
48
+ | WebFetchOutput
49
+ | WebSearchOutput
50
+ | AskUserQuestionOutput
51
+ | ConfigOutput
52
+ | EnterWorktreeOutput;
53
+ export type AgentOutput =
54
+ | {
55
+ agentId: string;
56
+ content: {
57
+ type: "text";
58
+ text: string;
59
+ }[];
60
+ totalToolUseCount: number;
61
+ totalDurationMs: number;
62
+ totalTokens: number;
63
+ usage: {
64
+ input_tokens: number;
65
+ output_tokens: number;
66
+ cache_creation_input_tokens: number | null;
67
+ cache_read_input_tokens: number | null;
68
+ server_tool_use: {
69
+ web_search_requests: number;
70
+ web_fetch_requests: number;
71
+ } | null;
72
+ service_tier: ("standard" | "priority" | "batch") | null;
73
+ cache_creation: {
74
+ ephemeral_1h_input_tokens: number;
75
+ ephemeral_5m_input_tokens: number;
76
+ } | null;
77
+ };
78
+ status: "completed";
79
+ prompt: string;
80
+ }
81
+ | {
82
+ status: "async_launched";
83
+ /**
84
+ * The ID of the async agent
85
+ */
86
+ agentId: string;
87
+ /**
88
+ * The description of the task
89
+ */
90
+ description: string;
91
+ /**
92
+ * The prompt for the agent
93
+ */
94
+ prompt: string;
95
+ /**
96
+ * Path to the output file for checking agent progress
97
+ */
98
+ outputFile: string;
99
+ /**
100
+ * Whether the calling agent has Read/Bash tools to check progress
101
+ */
102
+ canReadOutputFile?: boolean;
103
+ }
104
+ | {
105
+ status: "sub_agent_entered";
106
+ description: string;
107
+ message: string;
108
+ };
109
+ export type FileReadOutput =
110
+ | {
111
+ type: "text";
112
+ file: {
113
+ /**
114
+ * The path to the file that was read
115
+ */
116
+ filePath: string;
117
+ /**
118
+ * The content of the file
119
+ */
120
+ content: string;
121
+ /**
122
+ * Number of lines in the returned content
123
+ */
124
+ numLines: number;
125
+ /**
126
+ * The starting line number
127
+ */
128
+ startLine: number;
129
+ /**
130
+ * Total number of lines in the file
131
+ */
132
+ totalLines: number;
133
+ };
134
+ }
135
+ | {
136
+ type: "image";
137
+ file: {
138
+ /**
139
+ * Base64-encoded image data
140
+ */
141
+ base64: string;
142
+ /**
143
+ * The MIME type of the image
144
+ */
145
+ type: "image/jpeg" | "image/png" | "image/gif" | "image/webp";
146
+ /**
147
+ * Original file size in bytes
148
+ */
149
+ originalSize: number;
150
+ /**
151
+ * Image dimension info for coordinate mapping
152
+ */
153
+ dimensions?: {
154
+ /**
155
+ * Original image width in pixels
156
+ */
157
+ originalWidth?: number;
158
+ /**
159
+ * Original image height in pixels
160
+ */
161
+ originalHeight?: number;
162
+ /**
163
+ * Displayed image width in pixels (after resizing)
164
+ */
165
+ displayWidth?: number;
166
+ /**
167
+ * Displayed image height in pixels (after resizing)
168
+ */
169
+ displayHeight?: number;
170
+ };
171
+ };
172
+ }
173
+ | {
174
+ type: "notebook";
175
+ file: {
176
+ /**
177
+ * The path to the notebook file
178
+ */
179
+ filePath: string;
180
+ /**
181
+ * Array of notebook cells
182
+ */
183
+ cells: unknown[];
184
+ };
185
+ }
186
+ | {
187
+ type: "pdf";
188
+ file: {
189
+ /**
190
+ * The path to the PDF file
191
+ */
192
+ filePath: string;
193
+ /**
194
+ * Base64-encoded PDF data
195
+ */
196
+ base64: string;
197
+ /**
198
+ * Original file size in bytes
199
+ */
200
+ originalSize: number;
201
+ };
202
+ }
203
+ | {
204
+ type: "parts";
205
+ file: {
206
+ /**
207
+ * The path to the PDF file
208
+ */
209
+ filePath: string;
210
+ /**
211
+ * Original file size in bytes
212
+ */
213
+ originalSize: number;
214
+ /**
215
+ * Number of pages extracted
216
+ */
217
+ count: number;
218
+ /**
219
+ * Directory containing extracted page images
220
+ */
221
+ outputDir: string;
222
+ };
223
+ };
224
+ export type ListMcpResourcesOutput = {
225
+ /**
226
+ * Resource URI
227
+ */
228
+ uri: string;
229
+ /**
230
+ * Resource name
231
+ */
232
+ name: string;
233
+ /**
234
+ * MIME type of the resource
235
+ */
236
+ mimeType?: string;
237
+ /**
238
+ * Resource description
239
+ */
240
+ description?: string;
241
+ /**
242
+ * Server that provides this resource
243
+ */
244
+ server: string;
245
+ }[];
246
+ /**
247
+ * MCP tool execution result
248
+ */
249
+ export type McpOutput = string;
31
250
 
32
251
  export interface AgentInput {
33
252
  /**
@@ -69,7 +288,7 @@ export interface AgentInput {
69
288
  /**
70
289
  * Permission mode for spawned teammate (e.g., "plan" to require plan approval).
71
290
  */
72
- mode?: "acceptEdits" | "bypassPermissions" | "default" | "delegate" | "dontAsk" | "plan";
291
+ mode?: "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "plan";
73
292
  }
74
293
  export interface BashInput {
75
294
  /**
@@ -1560,3 +1779,499 @@ export interface ConfigInput {
1560
1779
  */
1561
1780
  value?: string | boolean | number;
1562
1781
  }
1782
+ export interface EnterWorktreeInput {
1783
+ /**
1784
+ * Optional name for the worktree. A random name is generated if not provided.
1785
+ */
1786
+ name?: string;
1787
+ }
1788
+ export interface BashOutput {
1789
+ /**
1790
+ * The standard output of the command
1791
+ */
1792
+ stdout: string;
1793
+ /**
1794
+ * The standard error output of the command
1795
+ */
1796
+ stderr: string;
1797
+ /**
1798
+ * Path to raw output file for large MCP tool outputs
1799
+ */
1800
+ rawOutputPath?: string;
1801
+ /**
1802
+ * Whether the command was interrupted
1803
+ */
1804
+ interrupted: boolean;
1805
+ /**
1806
+ * Flag to indicate if stdout contains image data
1807
+ */
1808
+ isImage?: boolean;
1809
+ /**
1810
+ * ID of the background task if command is running in background
1811
+ */
1812
+ backgroundTaskId?: string;
1813
+ /**
1814
+ * True if the user manually backgrounded the command with Ctrl+B
1815
+ */
1816
+ backgroundedByUser?: boolean;
1817
+ /**
1818
+ * Flag to indicate if sandbox mode was overridden
1819
+ */
1820
+ dangerouslyDisableSandbox?: boolean;
1821
+ /**
1822
+ * Semantic interpretation for non-error exit codes with special meaning
1823
+ */
1824
+ returnCodeInterpretation?: string;
1825
+ /**
1826
+ * Whether the command is expected to produce no output on success
1827
+ */
1828
+ noOutputExpected?: boolean;
1829
+ /**
1830
+ * Structured content blocks
1831
+ */
1832
+ structuredContent?: unknown[];
1833
+ /**
1834
+ * Path to the persisted full output in tool-results dir (set when output is too large for inline)
1835
+ */
1836
+ persistedOutputPath?: string;
1837
+ /**
1838
+ * Total size of the output in bytes (set when output is too large for inline)
1839
+ */
1840
+ persistedOutputSize?: number;
1841
+ }
1842
+ export interface ExitPlanModeOutput {
1843
+ /**
1844
+ * The plan that was presented to the user
1845
+ */
1846
+ plan: string | null;
1847
+ isAgent: boolean;
1848
+ /**
1849
+ * The file path where the plan was saved
1850
+ */
1851
+ filePath?: string;
1852
+ /**
1853
+ * Whether the plan was pushed to a remote session
1854
+ */
1855
+ pushToRemote?: boolean;
1856
+ /**
1857
+ * The remote session ID
1858
+ */
1859
+ remoteSessionId?: string;
1860
+ /**
1861
+ * The remote session URL
1862
+ */
1863
+ remoteSessionUrl?: string;
1864
+ /**
1865
+ * Whether the Task tool is available in the current context
1866
+ */
1867
+ hasTaskTool?: boolean;
1868
+ /**
1869
+ * When true, the teammate has sent a plan approval request to the team leader
1870
+ */
1871
+ awaitingLeaderApproval?: boolean;
1872
+ /**
1873
+ * Unique identifier for the plan approval request
1874
+ */
1875
+ requestId?: string;
1876
+ }
1877
+ export interface FileEditOutput {
1878
+ /**
1879
+ * The file path that was edited
1880
+ */
1881
+ filePath: string;
1882
+ /**
1883
+ * The original string that was replaced
1884
+ */
1885
+ oldString: string;
1886
+ /**
1887
+ * The new string that replaced it
1888
+ */
1889
+ newString: string;
1890
+ /**
1891
+ * The original file contents before editing
1892
+ */
1893
+ originalFile: string;
1894
+ /**
1895
+ * Diff patch showing the changes
1896
+ */
1897
+ structuredPatch: {
1898
+ oldStart: number;
1899
+ oldLines: number;
1900
+ newStart: number;
1901
+ newLines: number;
1902
+ lines: string[];
1903
+ }[];
1904
+ /**
1905
+ * Whether the user modified the proposed changes
1906
+ */
1907
+ userModified: boolean;
1908
+ /**
1909
+ * Whether all occurrences were replaced
1910
+ */
1911
+ replaceAll: boolean;
1912
+ gitDiff?: {
1913
+ filename: string;
1914
+ status: "modified" | "added";
1915
+ additions: number;
1916
+ deletions: number;
1917
+ changes: number;
1918
+ patch: string;
1919
+ };
1920
+ }
1921
+ export interface FileWriteOutput {
1922
+ /**
1923
+ * Whether a new file was created or an existing file was updated
1924
+ */
1925
+ type: "create" | "update";
1926
+ /**
1927
+ * The path to the file that was written
1928
+ */
1929
+ filePath: string;
1930
+ /**
1931
+ * The content that was written to the file
1932
+ */
1933
+ content: string;
1934
+ /**
1935
+ * Diff patch showing the changes
1936
+ */
1937
+ structuredPatch: {
1938
+ oldStart: number;
1939
+ oldLines: number;
1940
+ newStart: number;
1941
+ newLines: number;
1942
+ lines: string[];
1943
+ }[];
1944
+ /**
1945
+ * The original file content before the write (null for new files)
1946
+ */
1947
+ originalFile: string | null;
1948
+ gitDiff?: {
1949
+ filename: string;
1950
+ status: "modified" | "added";
1951
+ additions: number;
1952
+ deletions: number;
1953
+ changes: number;
1954
+ patch: string;
1955
+ };
1956
+ }
1957
+ export interface GlobOutput {
1958
+ /**
1959
+ * Time taken to execute the search in milliseconds
1960
+ */
1961
+ durationMs: number;
1962
+ /**
1963
+ * Total number of files found
1964
+ */
1965
+ numFiles: number;
1966
+ /**
1967
+ * Array of file paths that match the pattern
1968
+ */
1969
+ filenames: string[];
1970
+ /**
1971
+ * Whether results were truncated (limited to 100 files)
1972
+ */
1973
+ truncated: boolean;
1974
+ }
1975
+ export interface GrepOutput {
1976
+ mode?: "content" | "files_with_matches" | "count";
1977
+ numFiles: number;
1978
+ filenames: string[];
1979
+ content?: string;
1980
+ numLines?: number;
1981
+ numMatches?: number;
1982
+ appliedLimit?: number;
1983
+ appliedOffset?: number;
1984
+ }
1985
+ export interface TaskStopOutput {
1986
+ /**
1987
+ * Status message about the operation
1988
+ */
1989
+ message: string;
1990
+ /**
1991
+ * The ID of the task that was stopped
1992
+ */
1993
+ task_id: string;
1994
+ /**
1995
+ * The type of the task that was stopped
1996
+ */
1997
+ task_type: string;
1998
+ /**
1999
+ * The command or description of the stopped task
2000
+ */
2001
+ command?: string;
2002
+ }
2003
+ export interface NotebookEditOutput {
2004
+ /**
2005
+ * The new source code that was written to the cell
2006
+ */
2007
+ new_source: string;
2008
+ /**
2009
+ * The ID of the cell that was edited
2010
+ */
2011
+ cell_id?: string;
2012
+ /**
2013
+ * The type of the cell
2014
+ */
2015
+ cell_type: "code" | "markdown";
2016
+ /**
2017
+ * The programming language of the notebook
2018
+ */
2019
+ language: string;
2020
+ /**
2021
+ * The edit mode that was used
2022
+ */
2023
+ edit_mode: string;
2024
+ /**
2025
+ * Error message if the operation failed
2026
+ */
2027
+ error?: string;
2028
+ /**
2029
+ * The path to the notebook file
2030
+ */
2031
+ notebook_path: string;
2032
+ /**
2033
+ * The original notebook content before modification
2034
+ */
2035
+ original_file: string;
2036
+ /**
2037
+ * The updated notebook content after modification
2038
+ */
2039
+ updated_file: string;
2040
+ }
2041
+ export interface ReadMcpResourceOutput {
2042
+ contents: {
2043
+ /**
2044
+ * Resource URI
2045
+ */
2046
+ uri: string;
2047
+ /**
2048
+ * MIME type of the content
2049
+ */
2050
+ mimeType?: string;
2051
+ /**
2052
+ * Text content of the resource
2053
+ */
2054
+ text?: string;
2055
+ }[];
2056
+ }
2057
+ export interface TodoWriteOutput {
2058
+ /**
2059
+ * The todo list before the update
2060
+ */
2061
+ oldTodos: {
2062
+ content: string;
2063
+ status: "pending" | "in_progress" | "completed";
2064
+ activeForm: string;
2065
+ }[];
2066
+ /**
2067
+ * The todo list after the update
2068
+ */
2069
+ newTodos: {
2070
+ content: string;
2071
+ status: "pending" | "in_progress" | "completed";
2072
+ activeForm: string;
2073
+ }[];
2074
+ }
2075
+ export interface WebFetchOutput {
2076
+ /**
2077
+ * Size of the fetched content in bytes
2078
+ */
2079
+ bytes: number;
2080
+ /**
2081
+ * HTTP response code
2082
+ */
2083
+ code: number;
2084
+ /**
2085
+ * HTTP response code text
2086
+ */
2087
+ codeText: string;
2088
+ /**
2089
+ * Processed result from applying the prompt to the content
2090
+ */
2091
+ result: string;
2092
+ /**
2093
+ * Time taken to fetch and process the content
2094
+ */
2095
+ durationMs: number;
2096
+ /**
2097
+ * The URL that was fetched
2098
+ */
2099
+ url: string;
2100
+ }
2101
+ export interface WebSearchOutput {
2102
+ /**
2103
+ * The search query that was executed
2104
+ */
2105
+ query: string;
2106
+ /**
2107
+ * Search results and/or text commentary from the model
2108
+ */
2109
+ results: (
2110
+ | {
2111
+ /**
2112
+ * ID of the tool use
2113
+ */
2114
+ tool_use_id: string;
2115
+ /**
2116
+ * Array of search hits
2117
+ */
2118
+ content: {
2119
+ /**
2120
+ * The title of the search result
2121
+ */
2122
+ title: string;
2123
+ /**
2124
+ * The URL of the search result
2125
+ */
2126
+ url: string;
2127
+ }[];
2128
+ }
2129
+ | string
2130
+ )[];
2131
+ /**
2132
+ * Time taken to complete the search operation
2133
+ */
2134
+ durationSeconds: number;
2135
+ }
2136
+ export interface AskUserQuestionOutput {
2137
+ /**
2138
+ * The questions that were asked
2139
+ */
2140
+ questions: {
2141
+ /**
2142
+ * The complete question to ask the user. Should be clear, specific, and end with a question mark. Example: "Which library should we use for date formatting?" If multiSelect is true, phrase it accordingly, e.g. "Which features do you want to enable?"
2143
+ */
2144
+ question: string;
2145
+ /**
2146
+ * Very short label displayed as a chip/tag (max 12 chars). Examples: "Auth method", "Library", "Approach".
2147
+ */
2148
+ header: string;
2149
+ /**
2150
+ * The available choices for this question. Must have 2-4 options. Each option should be a distinct, mutually exclusive choice (unless multiSelect is enabled). There should be no 'Other' option, that will be provided automatically.
2151
+ *
2152
+ * @minItems 2
2153
+ * @maxItems 4
2154
+ */
2155
+ options:
2156
+ | [
2157
+ {
2158
+ /**
2159
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2160
+ */
2161
+ label: string;
2162
+ /**
2163
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2164
+ */
2165
+ description: string;
2166
+ },
2167
+ {
2168
+ /**
2169
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2170
+ */
2171
+ label: string;
2172
+ /**
2173
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2174
+ */
2175
+ description: string;
2176
+ }
2177
+ ]
2178
+ | [
2179
+ {
2180
+ /**
2181
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2182
+ */
2183
+ label: string;
2184
+ /**
2185
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2186
+ */
2187
+ description: string;
2188
+ },
2189
+ {
2190
+ /**
2191
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2192
+ */
2193
+ label: string;
2194
+ /**
2195
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2196
+ */
2197
+ description: string;
2198
+ },
2199
+ {
2200
+ /**
2201
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2202
+ */
2203
+ label: string;
2204
+ /**
2205
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2206
+ */
2207
+ description: string;
2208
+ }
2209
+ ]
2210
+ | [
2211
+ {
2212
+ /**
2213
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2214
+ */
2215
+ label: string;
2216
+ /**
2217
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2218
+ */
2219
+ description: string;
2220
+ },
2221
+ {
2222
+ /**
2223
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2224
+ */
2225
+ label: string;
2226
+ /**
2227
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2228
+ */
2229
+ description: string;
2230
+ },
2231
+ {
2232
+ /**
2233
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2234
+ */
2235
+ label: string;
2236
+ /**
2237
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2238
+ */
2239
+ description: string;
2240
+ },
2241
+ {
2242
+ /**
2243
+ * The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.
2244
+ */
2245
+ label: string;
2246
+ /**
2247
+ * Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications.
2248
+ */
2249
+ description: string;
2250
+ }
2251
+ ];
2252
+ /**
2253
+ * Set to true to allow the user to select multiple options instead of just one. Use when choices are not mutually exclusive.
2254
+ */
2255
+ multiSelect: boolean;
2256
+ }[];
2257
+ /**
2258
+ * The answers provided by the user (question text -> answer string; multi-select answers are comma-separated)
2259
+ */
2260
+ answers: {
2261
+ [k: string]: string;
2262
+ };
2263
+ }
2264
+ export interface ConfigOutput {
2265
+ success: boolean;
2266
+ operation?: "get" | "set";
2267
+ setting?: string;
2268
+ value?: unknown;
2269
+ previousValue?: unknown;
2270
+ newValue?: unknown;
2271
+ error?: string;
2272
+ }
2273
+ export interface EnterWorktreeOutput {
2274
+ worktreePath: string;
2275
+ worktreeBranch: string;
2276
+ message: string;
2277
+ }