@makerbi/openclaude 0.13.0 → 0.14.2
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/LICENSE +29 -29
- package/README.md +373 -373
- package/bin/import-specifier.mjs +13 -13
- package/bin/import-specifier.test.mjs +13 -13
- package/bin/openclaude +97 -32
- package/dist/cli.mjs +14552 -9030
- package/dist/sdk.mjs +8806 -5158
- package/package.json +170 -170
- package/src/entrypoints/sdk/coreTypes.generated.ts +2355 -2355
- package/src/entrypoints/sdk.d.ts +555 -555
|
@@ -1,2355 +1,2355 @@
|
|
|
1
|
-
// AUTO-GENERATED — do not edit manually.
|
|
2
|
-
// Regenerate with: bun scripts/generate-sdk-types.ts
|
|
3
|
-
//
|
|
4
|
-
// Generated from Zod schemas in coreSchemas.ts
|
|
5
|
-
|
|
6
|
-
export type ModelUsage = {
|
|
7
|
-
inputTokens: number
|
|
8
|
-
outputTokens: number
|
|
9
|
-
cacheReadInputTokens: number
|
|
10
|
-
cacheCreationInputTokens: number
|
|
11
|
-
webSearchRequests: number
|
|
12
|
-
costUSD: number
|
|
13
|
-
contextWindow: number
|
|
14
|
-
maxOutputTokens: number
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type OutputFormatType = "json_schema"
|
|
18
|
-
|
|
19
|
-
export type BaseOutputFormat = {
|
|
20
|
-
type: "json_schema"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type JsonSchemaOutputFormat = {
|
|
24
|
-
type: "json_schema"
|
|
25
|
-
schema: Record<string, unknown>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type OutputFormat = {
|
|
29
|
-
type: "json_schema"
|
|
30
|
-
schema: Record<string, unknown>
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type ApiKeySource = "user" | "project" | "org" | "temporary" | "oauth" | "none"
|
|
34
|
-
|
|
35
|
-
/** Config scope for settings. */
|
|
36
|
-
export type ConfigScope = "local" | "user" | "project"
|
|
37
|
-
|
|
38
|
-
export type SdkBeta = "context-1m-2025-08-07"
|
|
39
|
-
|
|
40
|
-
/** Claude decides when and how much to think (Opus 4.6+). */
|
|
41
|
-
export type ThinkingAdaptive = {
|
|
42
|
-
type: "adaptive"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Fixed thinking token budget (older models) */
|
|
46
|
-
export type ThinkingEnabled = {
|
|
47
|
-
type: "enabled"
|
|
48
|
-
budgetTokens?: number
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** No extended thinking */
|
|
52
|
-
export type ThinkingDisabled = {
|
|
53
|
-
type: "disabled"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens. */
|
|
57
|
-
export type ThinkingConfig = ({
|
|
58
|
-
type: "adaptive"
|
|
59
|
-
}) | ({
|
|
60
|
-
type: "enabled"
|
|
61
|
-
budgetTokens?: number
|
|
62
|
-
}) | ({
|
|
63
|
-
type: "disabled"
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
export type McpStdioServerConfig = {
|
|
67
|
-
type?: "stdio"
|
|
68
|
-
command: string
|
|
69
|
-
args?: string[]
|
|
70
|
-
env?: Record<string, string>
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export type McpSSEServerConfig = {
|
|
74
|
-
type: "sse"
|
|
75
|
-
url: string
|
|
76
|
-
headers?: Record<string, string>
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export type McpHttpServerConfig = {
|
|
80
|
-
type: "http"
|
|
81
|
-
url: string
|
|
82
|
-
headers?: Record<string, string>
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export type McpSdkServerConfig = {
|
|
86
|
-
type: "sdk"
|
|
87
|
-
name: string
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export type McpServerConfigForProcessTransport = ({
|
|
91
|
-
type?: "stdio"
|
|
92
|
-
command: string
|
|
93
|
-
args?: string[]
|
|
94
|
-
env?: Record<string, string>
|
|
95
|
-
}) | ({
|
|
96
|
-
type: "sse"
|
|
97
|
-
url: string
|
|
98
|
-
headers?: Record<string, string>
|
|
99
|
-
}) | ({
|
|
100
|
-
type: "http"
|
|
101
|
-
url: string
|
|
102
|
-
headers?: Record<string, string>
|
|
103
|
-
}) | ({
|
|
104
|
-
type: "sdk"
|
|
105
|
-
name: string
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
export type McpClaudeAIProxyServerConfig = {
|
|
109
|
-
type: "claudeai-proxy"
|
|
110
|
-
url: string
|
|
111
|
-
id: string
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export type McpServerStatusConfig = (({
|
|
115
|
-
type?: "stdio"
|
|
116
|
-
command: string
|
|
117
|
-
args?: string[]
|
|
118
|
-
env?: Record<string, string>
|
|
119
|
-
}) | ({
|
|
120
|
-
type: "sse"
|
|
121
|
-
url: string
|
|
122
|
-
headers?: Record<string, string>
|
|
123
|
-
}) | ({
|
|
124
|
-
type: "http"
|
|
125
|
-
url: string
|
|
126
|
-
headers?: Record<string, string>
|
|
127
|
-
}) | ({
|
|
128
|
-
type: "sdk"
|
|
129
|
-
name: string
|
|
130
|
-
})) | ({
|
|
131
|
-
type: "claudeai-proxy"
|
|
132
|
-
url: string
|
|
133
|
-
id: string
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
/** Status information for an MCP server connection. */
|
|
137
|
-
export type McpServerStatus = {
|
|
138
|
-
name: string
|
|
139
|
-
status: "connected" | "failed" | "needs-auth" | "pending" | "disabled"
|
|
140
|
-
serverInfo?: {
|
|
141
|
-
name: string
|
|
142
|
-
version: string
|
|
143
|
-
}
|
|
144
|
-
error?: string
|
|
145
|
-
config?: (({
|
|
146
|
-
type?: "stdio"
|
|
147
|
-
command: string
|
|
148
|
-
args?: string[]
|
|
149
|
-
env?: Record<string, string>
|
|
150
|
-
}) | ({
|
|
151
|
-
type: "sse"
|
|
152
|
-
url: string
|
|
153
|
-
headers?: Record<string, string>
|
|
154
|
-
}) | ({
|
|
155
|
-
type: "http"
|
|
156
|
-
url: string
|
|
157
|
-
headers?: Record<string, string>
|
|
158
|
-
}) | ({
|
|
159
|
-
type: "sdk"
|
|
160
|
-
name: string
|
|
161
|
-
})) | ({
|
|
162
|
-
type: "claudeai-proxy"
|
|
163
|
-
url: string
|
|
164
|
-
id: string
|
|
165
|
-
})
|
|
166
|
-
scope?: string
|
|
167
|
-
tools?: {
|
|
168
|
-
name: string
|
|
169
|
-
description?: string
|
|
170
|
-
annotations?: {
|
|
171
|
-
readOnly?: boolean
|
|
172
|
-
destructive?: boolean
|
|
173
|
-
openWorld?: boolean
|
|
174
|
-
}
|
|
175
|
-
}[]
|
|
176
|
-
capabilities?: {
|
|
177
|
-
experimental?: Record<string, unknown>
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** Result of a setMcpServers operation. */
|
|
182
|
-
export type McpSetServersResult = {
|
|
183
|
-
added: string[]
|
|
184
|
-
removed: string[]
|
|
185
|
-
errors: Record<string, string>
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export type PermissionUpdateDestination = "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
189
|
-
|
|
190
|
-
export type PermissionBehavior = "allow" | "deny" | "ask"
|
|
191
|
-
|
|
192
|
-
export type PermissionRuleValue = {
|
|
193
|
-
toolName: string
|
|
194
|
-
ruleContent?: string
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export type PermissionUpdate = ({
|
|
198
|
-
type: "addRules"
|
|
199
|
-
rules: {
|
|
200
|
-
toolName: string
|
|
201
|
-
ruleContent?: string
|
|
202
|
-
}[]
|
|
203
|
-
behavior: "allow" | "deny" | "ask"
|
|
204
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
205
|
-
}) | ({
|
|
206
|
-
type: "replaceRules"
|
|
207
|
-
rules: {
|
|
208
|
-
toolName: string
|
|
209
|
-
ruleContent?: string
|
|
210
|
-
}[]
|
|
211
|
-
behavior: "allow" | "deny" | "ask"
|
|
212
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
213
|
-
}) | ({
|
|
214
|
-
type: "removeRules"
|
|
215
|
-
rules: {
|
|
216
|
-
toolName: string
|
|
217
|
-
ruleContent?: string
|
|
218
|
-
}[]
|
|
219
|
-
behavior: "allow" | "deny" | "ask"
|
|
220
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
221
|
-
}) | ({
|
|
222
|
-
type: "setMode"
|
|
223
|
-
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
224
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
225
|
-
}) | ({
|
|
226
|
-
type: "addDirectories"
|
|
227
|
-
directories: string[]
|
|
228
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
229
|
-
}) | ({
|
|
230
|
-
type: "removeDirectories"
|
|
231
|
-
directories: string[]
|
|
232
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
/** Classification of this permission decision for telemetry. SDK hosts that prompt users (desktop apps, IDEs) should set this to reflect what actually happened: user_temporary for allow-once, user_permanent for always-allow (both the click and later cache hits), user_reject for deny. If unset, the CLI infers conservatively (temporary for allow, reject for deny). The vocabulary matches tool_decision OTel events (monitoring-usage docs). */
|
|
236
|
-
export type PermissionDecisionClassification = "user_temporary" | "user_permanent" | "user_reject"
|
|
237
|
-
|
|
238
|
-
export type PermissionResult = ({
|
|
239
|
-
behavior: "allow"
|
|
240
|
-
updatedInput?: Record<string, unknown>
|
|
241
|
-
updatedPermissions?: ({
|
|
242
|
-
type: "addRules"
|
|
243
|
-
rules: {
|
|
244
|
-
toolName: string
|
|
245
|
-
ruleContent?: string
|
|
246
|
-
}[]
|
|
247
|
-
behavior: "allow" | "deny" | "ask"
|
|
248
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
249
|
-
}) | ({
|
|
250
|
-
type: "replaceRules"
|
|
251
|
-
rules: {
|
|
252
|
-
toolName: string
|
|
253
|
-
ruleContent?: string
|
|
254
|
-
}[]
|
|
255
|
-
behavior: "allow" | "deny" | "ask"
|
|
256
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
257
|
-
}) | ({
|
|
258
|
-
type: "removeRules"
|
|
259
|
-
rules: {
|
|
260
|
-
toolName: string
|
|
261
|
-
ruleContent?: string
|
|
262
|
-
}[]
|
|
263
|
-
behavior: "allow" | "deny" | "ask"
|
|
264
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
265
|
-
}) | ({
|
|
266
|
-
type: "setMode"
|
|
267
|
-
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
268
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
269
|
-
}) | ({
|
|
270
|
-
type: "addDirectories"
|
|
271
|
-
directories: string[]
|
|
272
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
273
|
-
}) | ({
|
|
274
|
-
type: "removeDirectories"
|
|
275
|
-
directories: string[]
|
|
276
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
277
|
-
})[]
|
|
278
|
-
toolUseID?: string
|
|
279
|
-
decisionClassification?: "user_temporary" | "user_permanent" | "user_reject"
|
|
280
|
-
}) | ({
|
|
281
|
-
behavior: "deny"
|
|
282
|
-
message: string
|
|
283
|
-
interrupt?: boolean
|
|
284
|
-
toolUseID?: string
|
|
285
|
-
decisionClassification?: "user_temporary" | "user_permanent" | "user_reject"
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
/** Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. */
|
|
289
|
-
export type PermissionMode = "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
290
|
-
|
|
291
|
-
export type HookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "PermissionDenied" | "Setup" | "TeammateIdle" | "TaskCreated" | "TaskCompleted" | "Elicitation" | "ElicitationResult" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "InstructionsLoaded" | "CwdChanged" | "FileChanged"
|
|
292
|
-
|
|
293
|
-
export type BaseHookInput = {
|
|
294
|
-
session_id: string
|
|
295
|
-
transcript_path: string
|
|
296
|
-
cwd: string
|
|
297
|
-
permission_mode?: string
|
|
298
|
-
agent_id?: string
|
|
299
|
-
agent_type?: string
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export type PreToolUseHookInput = {
|
|
303
|
-
session_id: string
|
|
304
|
-
transcript_path: string
|
|
305
|
-
cwd: string
|
|
306
|
-
permission_mode?: string
|
|
307
|
-
agent_id?: string
|
|
308
|
-
agent_type?: string
|
|
309
|
-
} & {
|
|
310
|
-
hook_event_name: "PreToolUse"
|
|
311
|
-
tool_name: string
|
|
312
|
-
tool_input: unknown
|
|
313
|
-
tool_use_id: string
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
export type PostToolUseHookInput = {
|
|
317
|
-
session_id: string
|
|
318
|
-
transcript_path: string
|
|
319
|
-
cwd: string
|
|
320
|
-
permission_mode?: string
|
|
321
|
-
agent_id?: string
|
|
322
|
-
agent_type?: string
|
|
323
|
-
} & {
|
|
324
|
-
hook_event_name: "PostToolUse"
|
|
325
|
-
tool_name: string
|
|
326
|
-
tool_input: unknown
|
|
327
|
-
tool_response: unknown
|
|
328
|
-
tool_use_id: string
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export type PostToolUseFailureHookInput = {
|
|
332
|
-
session_id: string
|
|
333
|
-
transcript_path: string
|
|
334
|
-
cwd: string
|
|
335
|
-
permission_mode?: string
|
|
336
|
-
agent_id?: string
|
|
337
|
-
agent_type?: string
|
|
338
|
-
} & {
|
|
339
|
-
hook_event_name: "PostToolUseFailure"
|
|
340
|
-
tool_name: string
|
|
341
|
-
tool_input: unknown
|
|
342
|
-
tool_use_id: string
|
|
343
|
-
error: string
|
|
344
|
-
is_interrupt?: boolean
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
export type PermissionDeniedHookInput = {
|
|
348
|
-
session_id: string
|
|
349
|
-
transcript_path: string
|
|
350
|
-
cwd: string
|
|
351
|
-
permission_mode?: string
|
|
352
|
-
agent_id?: string
|
|
353
|
-
agent_type?: string
|
|
354
|
-
} & {
|
|
355
|
-
hook_event_name: "PermissionDenied"
|
|
356
|
-
tool_name: string
|
|
357
|
-
tool_input: unknown
|
|
358
|
-
tool_use_id: string
|
|
359
|
-
reason: string
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export type NotificationHookInput = {
|
|
363
|
-
session_id: string
|
|
364
|
-
transcript_path: string
|
|
365
|
-
cwd: string
|
|
366
|
-
permission_mode?: string
|
|
367
|
-
agent_id?: string
|
|
368
|
-
agent_type?: string
|
|
369
|
-
} & {
|
|
370
|
-
hook_event_name: "Notification"
|
|
371
|
-
message: string
|
|
372
|
-
title?: string
|
|
373
|
-
notification_type: string
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
export type UserPromptSubmitHookInput = {
|
|
377
|
-
session_id: string
|
|
378
|
-
transcript_path: string
|
|
379
|
-
cwd: string
|
|
380
|
-
permission_mode?: string
|
|
381
|
-
agent_id?: string
|
|
382
|
-
agent_type?: string
|
|
383
|
-
} & {
|
|
384
|
-
hook_event_name: "UserPromptSubmit"
|
|
385
|
-
prompt: string
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
export type SessionStartHookInput = {
|
|
389
|
-
session_id: string
|
|
390
|
-
transcript_path: string
|
|
391
|
-
cwd: string
|
|
392
|
-
permission_mode?: string
|
|
393
|
-
agent_id?: string
|
|
394
|
-
agent_type?: string
|
|
395
|
-
} & {
|
|
396
|
-
hook_event_name: "SessionStart"
|
|
397
|
-
source: "startup" | "resume" | "clear" | "compact"
|
|
398
|
-
agent_type?: string
|
|
399
|
-
model?: string
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
export type SessionEndHookInput = {
|
|
403
|
-
session_id: string
|
|
404
|
-
transcript_path: string
|
|
405
|
-
cwd: string
|
|
406
|
-
permission_mode?: string
|
|
407
|
-
agent_id?: string
|
|
408
|
-
agent_type?: string
|
|
409
|
-
} & {
|
|
410
|
-
hook_event_name: "SessionEnd"
|
|
411
|
-
reason: "clear" | "resume" | "logout" | "prompt_input_exit" | "other" | "bypass_permissions_disabled"
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
export type StopHookInput = {
|
|
415
|
-
session_id: string
|
|
416
|
-
transcript_path: string
|
|
417
|
-
cwd: string
|
|
418
|
-
permission_mode?: string
|
|
419
|
-
agent_id?: string
|
|
420
|
-
agent_type?: string
|
|
421
|
-
} & {
|
|
422
|
-
hook_event_name: "Stop"
|
|
423
|
-
stop_hook_active: boolean
|
|
424
|
-
last_assistant_message?: string
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
export type StopFailureHookInput = {
|
|
428
|
-
session_id: string
|
|
429
|
-
transcript_path: string
|
|
430
|
-
cwd: string
|
|
431
|
-
permission_mode?: string
|
|
432
|
-
agent_id?: string
|
|
433
|
-
agent_type?: string
|
|
434
|
-
} & {
|
|
435
|
-
hook_event_name: "StopFailure"
|
|
436
|
-
error: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
437
|
-
error_details?: string
|
|
438
|
-
last_assistant_message?: string
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
export type SubagentStartHookInput = {
|
|
442
|
-
session_id: string
|
|
443
|
-
transcript_path: string
|
|
444
|
-
cwd: string
|
|
445
|
-
permission_mode?: string
|
|
446
|
-
agent_id?: string
|
|
447
|
-
agent_type?: string
|
|
448
|
-
} & {
|
|
449
|
-
hook_event_name: "SubagentStart"
|
|
450
|
-
agent_id: string
|
|
451
|
-
agent_type: string
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
export type SubagentStopHookInput = {
|
|
455
|
-
session_id: string
|
|
456
|
-
transcript_path: string
|
|
457
|
-
cwd: string
|
|
458
|
-
permission_mode?: string
|
|
459
|
-
agent_id?: string
|
|
460
|
-
agent_type?: string
|
|
461
|
-
} & {
|
|
462
|
-
hook_event_name: "SubagentStop"
|
|
463
|
-
stop_hook_active: boolean
|
|
464
|
-
agent_id: string
|
|
465
|
-
agent_transcript_path: string
|
|
466
|
-
agent_type: string
|
|
467
|
-
last_assistant_message?: string
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
export type PreCompactHookInput = {
|
|
471
|
-
session_id: string
|
|
472
|
-
transcript_path: string
|
|
473
|
-
cwd: string
|
|
474
|
-
permission_mode?: string
|
|
475
|
-
agent_id?: string
|
|
476
|
-
agent_type?: string
|
|
477
|
-
} & {
|
|
478
|
-
hook_event_name: "PreCompact"
|
|
479
|
-
trigger: "manual" | "auto"
|
|
480
|
-
custom_instructions: string | null
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
export type PostCompactHookInput = {
|
|
484
|
-
session_id: string
|
|
485
|
-
transcript_path: string
|
|
486
|
-
cwd: string
|
|
487
|
-
permission_mode?: string
|
|
488
|
-
agent_id?: string
|
|
489
|
-
agent_type?: string
|
|
490
|
-
} & {
|
|
491
|
-
hook_event_name: "PostCompact"
|
|
492
|
-
trigger: "manual" | "auto"
|
|
493
|
-
compact_summary: string
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
export type PermissionRequestHookInput = {
|
|
497
|
-
session_id: string
|
|
498
|
-
transcript_path: string
|
|
499
|
-
cwd: string
|
|
500
|
-
permission_mode?: string
|
|
501
|
-
agent_id?: string
|
|
502
|
-
agent_type?: string
|
|
503
|
-
} & {
|
|
504
|
-
hook_event_name: "PermissionRequest"
|
|
505
|
-
tool_name: string
|
|
506
|
-
tool_input: unknown
|
|
507
|
-
permission_suggestions?: ({
|
|
508
|
-
type: "addRules"
|
|
509
|
-
rules: {
|
|
510
|
-
toolName: string
|
|
511
|
-
ruleContent?: string
|
|
512
|
-
}[]
|
|
513
|
-
behavior: "allow" | "deny" | "ask"
|
|
514
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
515
|
-
}) | ({
|
|
516
|
-
type: "replaceRules"
|
|
517
|
-
rules: {
|
|
518
|
-
toolName: string
|
|
519
|
-
ruleContent?: string
|
|
520
|
-
}[]
|
|
521
|
-
behavior: "allow" | "deny" | "ask"
|
|
522
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
523
|
-
}) | ({
|
|
524
|
-
type: "removeRules"
|
|
525
|
-
rules: {
|
|
526
|
-
toolName: string
|
|
527
|
-
ruleContent?: string
|
|
528
|
-
}[]
|
|
529
|
-
behavior: "allow" | "deny" | "ask"
|
|
530
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
531
|
-
}) | ({
|
|
532
|
-
type: "setMode"
|
|
533
|
-
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
534
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
535
|
-
}) | ({
|
|
536
|
-
type: "addDirectories"
|
|
537
|
-
directories: string[]
|
|
538
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
539
|
-
}) | ({
|
|
540
|
-
type: "removeDirectories"
|
|
541
|
-
directories: string[]
|
|
542
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
543
|
-
})[]
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
export type SetupHookInput = {
|
|
547
|
-
session_id: string
|
|
548
|
-
transcript_path: string
|
|
549
|
-
cwd: string
|
|
550
|
-
permission_mode?: string
|
|
551
|
-
agent_id?: string
|
|
552
|
-
agent_type?: string
|
|
553
|
-
} & {
|
|
554
|
-
hook_event_name: "Setup"
|
|
555
|
-
trigger: "init" | "maintenance"
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
export type TeammateIdleHookInput = {
|
|
559
|
-
session_id: string
|
|
560
|
-
transcript_path: string
|
|
561
|
-
cwd: string
|
|
562
|
-
permission_mode?: string
|
|
563
|
-
agent_id?: string
|
|
564
|
-
agent_type?: string
|
|
565
|
-
} & {
|
|
566
|
-
hook_event_name: "TeammateIdle"
|
|
567
|
-
teammate_name: string
|
|
568
|
-
team_name: string
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
export type TaskCreatedHookInput = {
|
|
572
|
-
session_id: string
|
|
573
|
-
transcript_path: string
|
|
574
|
-
cwd: string
|
|
575
|
-
permission_mode?: string
|
|
576
|
-
agent_id?: string
|
|
577
|
-
agent_type?: string
|
|
578
|
-
} & {
|
|
579
|
-
hook_event_name: "TaskCreated"
|
|
580
|
-
task_id: string
|
|
581
|
-
task_subject: string
|
|
582
|
-
task_description?: string
|
|
583
|
-
teammate_name?: string
|
|
584
|
-
team_name?: string
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
export type TaskCompletedHookInput = {
|
|
588
|
-
session_id: string
|
|
589
|
-
transcript_path: string
|
|
590
|
-
cwd: string
|
|
591
|
-
permission_mode?: string
|
|
592
|
-
agent_id?: string
|
|
593
|
-
agent_type?: string
|
|
594
|
-
} & {
|
|
595
|
-
hook_event_name: "TaskCompleted"
|
|
596
|
-
task_id: string
|
|
597
|
-
task_subject: string
|
|
598
|
-
task_description?: string
|
|
599
|
-
teammate_name?: string
|
|
600
|
-
team_name?: string
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
/** Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog. */
|
|
604
|
-
export type ElicitationHookInput = {
|
|
605
|
-
session_id: string
|
|
606
|
-
transcript_path: string
|
|
607
|
-
cwd: string
|
|
608
|
-
permission_mode?: string
|
|
609
|
-
agent_id?: string
|
|
610
|
-
agent_type?: string
|
|
611
|
-
} & {
|
|
612
|
-
hook_event_name: "Elicitation"
|
|
613
|
-
mcp_server_name: string
|
|
614
|
-
message: string
|
|
615
|
-
mode?: "form" | "url"
|
|
616
|
-
url?: string
|
|
617
|
-
elicitation_id?: string
|
|
618
|
-
requested_schema?: Record<string, unknown>
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
/** Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server. */
|
|
622
|
-
export type ElicitationResultHookInput = {
|
|
623
|
-
session_id: string
|
|
624
|
-
transcript_path: string
|
|
625
|
-
cwd: string
|
|
626
|
-
permission_mode?: string
|
|
627
|
-
agent_id?: string
|
|
628
|
-
agent_type?: string
|
|
629
|
-
} & {
|
|
630
|
-
hook_event_name: "ElicitationResult"
|
|
631
|
-
mcp_server_name: string
|
|
632
|
-
elicitation_id?: string
|
|
633
|
-
mode?: "form" | "url"
|
|
634
|
-
action: "accept" | "decline" | "cancel"
|
|
635
|
-
content?: Record<string, unknown>
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
export type ConfigChangeHookInput = {
|
|
639
|
-
session_id: string
|
|
640
|
-
transcript_path: string
|
|
641
|
-
cwd: string
|
|
642
|
-
permission_mode?: string
|
|
643
|
-
agent_id?: string
|
|
644
|
-
agent_type?: string
|
|
645
|
-
} & {
|
|
646
|
-
hook_event_name: "ConfigChange"
|
|
647
|
-
source: "user_settings" | "project_settings" | "local_settings" | "policy_settings" | "skills"
|
|
648
|
-
file_path?: string
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
export type InstructionsLoadedHookInput = {
|
|
652
|
-
session_id: string
|
|
653
|
-
transcript_path: string
|
|
654
|
-
cwd: string
|
|
655
|
-
permission_mode?: string
|
|
656
|
-
agent_id?: string
|
|
657
|
-
agent_type?: string
|
|
658
|
-
} & {
|
|
659
|
-
hook_event_name: "InstructionsLoaded"
|
|
660
|
-
file_path: string
|
|
661
|
-
memory_type: "User" | "Project" | "Local" | "Managed"
|
|
662
|
-
load_reason: "session_start" | "nested_traversal" | "path_glob_match" | "include" | "compact"
|
|
663
|
-
globs?: string[]
|
|
664
|
-
trigger_file_path?: string
|
|
665
|
-
parent_file_path?: string
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
export type WorktreeCreateHookInput = {
|
|
669
|
-
session_id: string
|
|
670
|
-
transcript_path: string
|
|
671
|
-
cwd: string
|
|
672
|
-
permission_mode?: string
|
|
673
|
-
agent_id?: string
|
|
674
|
-
agent_type?: string
|
|
675
|
-
} & {
|
|
676
|
-
hook_event_name: "WorktreeCreate"
|
|
677
|
-
name: string
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
export type WorktreeRemoveHookInput = {
|
|
681
|
-
session_id: string
|
|
682
|
-
transcript_path: string
|
|
683
|
-
cwd: string
|
|
684
|
-
permission_mode?: string
|
|
685
|
-
agent_id?: string
|
|
686
|
-
agent_type?: string
|
|
687
|
-
} & {
|
|
688
|
-
hook_event_name: "WorktreeRemove"
|
|
689
|
-
worktree_path: string
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
export type CwdChangedHookInput = {
|
|
693
|
-
session_id: string
|
|
694
|
-
transcript_path: string
|
|
695
|
-
cwd: string
|
|
696
|
-
permission_mode?: string
|
|
697
|
-
agent_id?: string
|
|
698
|
-
agent_type?: string
|
|
699
|
-
} & {
|
|
700
|
-
hook_event_name: "CwdChanged"
|
|
701
|
-
old_cwd: string
|
|
702
|
-
new_cwd: string
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
export type FileChangedHookInput = {
|
|
706
|
-
session_id: string
|
|
707
|
-
transcript_path: string
|
|
708
|
-
cwd: string
|
|
709
|
-
permission_mode?: string
|
|
710
|
-
agent_id?: string
|
|
711
|
-
agent_type?: string
|
|
712
|
-
} & {
|
|
713
|
-
hook_event_name: "FileChanged"
|
|
714
|
-
file_path: string
|
|
715
|
-
event: "change" | "add" | "unlink"
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
export type HookInput = ({
|
|
719
|
-
session_id: string
|
|
720
|
-
transcript_path: string
|
|
721
|
-
cwd: string
|
|
722
|
-
permission_mode?: string
|
|
723
|
-
agent_id?: string
|
|
724
|
-
agent_type?: string
|
|
725
|
-
} & {
|
|
726
|
-
hook_event_name: "PreToolUse"
|
|
727
|
-
tool_name: string
|
|
728
|
-
tool_input: unknown
|
|
729
|
-
tool_use_id: string
|
|
730
|
-
}) | ({
|
|
731
|
-
session_id: string
|
|
732
|
-
transcript_path: string
|
|
733
|
-
cwd: string
|
|
734
|
-
permission_mode?: string
|
|
735
|
-
agent_id?: string
|
|
736
|
-
agent_type?: string
|
|
737
|
-
} & {
|
|
738
|
-
hook_event_name: "PostToolUse"
|
|
739
|
-
tool_name: string
|
|
740
|
-
tool_input: unknown
|
|
741
|
-
tool_response: unknown
|
|
742
|
-
tool_use_id: string
|
|
743
|
-
}) | ({
|
|
744
|
-
session_id: string
|
|
745
|
-
transcript_path: string
|
|
746
|
-
cwd: string
|
|
747
|
-
permission_mode?: string
|
|
748
|
-
agent_id?: string
|
|
749
|
-
agent_type?: string
|
|
750
|
-
} & {
|
|
751
|
-
hook_event_name: "PostToolUseFailure"
|
|
752
|
-
tool_name: string
|
|
753
|
-
tool_input: unknown
|
|
754
|
-
tool_use_id: string
|
|
755
|
-
error: string
|
|
756
|
-
is_interrupt?: boolean
|
|
757
|
-
}) | ({
|
|
758
|
-
session_id: string
|
|
759
|
-
transcript_path: string
|
|
760
|
-
cwd: string
|
|
761
|
-
permission_mode?: string
|
|
762
|
-
agent_id?: string
|
|
763
|
-
agent_type?: string
|
|
764
|
-
} & {
|
|
765
|
-
hook_event_name: "PermissionDenied"
|
|
766
|
-
tool_name: string
|
|
767
|
-
tool_input: unknown
|
|
768
|
-
tool_use_id: string
|
|
769
|
-
reason: string
|
|
770
|
-
}) | ({
|
|
771
|
-
session_id: string
|
|
772
|
-
transcript_path: string
|
|
773
|
-
cwd: string
|
|
774
|
-
permission_mode?: string
|
|
775
|
-
agent_id?: string
|
|
776
|
-
agent_type?: string
|
|
777
|
-
} & {
|
|
778
|
-
hook_event_name: "Notification"
|
|
779
|
-
message: string
|
|
780
|
-
title?: string
|
|
781
|
-
notification_type: string
|
|
782
|
-
}) | ({
|
|
783
|
-
session_id: string
|
|
784
|
-
transcript_path: string
|
|
785
|
-
cwd: string
|
|
786
|
-
permission_mode?: string
|
|
787
|
-
agent_id?: string
|
|
788
|
-
agent_type?: string
|
|
789
|
-
} & {
|
|
790
|
-
hook_event_name: "UserPromptSubmit"
|
|
791
|
-
prompt: string
|
|
792
|
-
}) | ({
|
|
793
|
-
session_id: string
|
|
794
|
-
transcript_path: string
|
|
795
|
-
cwd: string
|
|
796
|
-
permission_mode?: string
|
|
797
|
-
agent_id?: string
|
|
798
|
-
agent_type?: string
|
|
799
|
-
} & {
|
|
800
|
-
hook_event_name: "SessionStart"
|
|
801
|
-
source: "startup" | "resume" | "clear" | "compact"
|
|
802
|
-
agent_type?: string
|
|
803
|
-
model?: string
|
|
804
|
-
}) | ({
|
|
805
|
-
session_id: string
|
|
806
|
-
transcript_path: string
|
|
807
|
-
cwd: string
|
|
808
|
-
permission_mode?: string
|
|
809
|
-
agent_id?: string
|
|
810
|
-
agent_type?: string
|
|
811
|
-
} & {
|
|
812
|
-
hook_event_name: "SessionEnd"
|
|
813
|
-
reason: "clear" | "resume" | "logout" | "prompt_input_exit" | "other" | "bypass_permissions_disabled"
|
|
814
|
-
}) | ({
|
|
815
|
-
session_id: string
|
|
816
|
-
transcript_path: string
|
|
817
|
-
cwd: string
|
|
818
|
-
permission_mode?: string
|
|
819
|
-
agent_id?: string
|
|
820
|
-
agent_type?: string
|
|
821
|
-
} & {
|
|
822
|
-
hook_event_name: "Stop"
|
|
823
|
-
stop_hook_active: boolean
|
|
824
|
-
last_assistant_message?: string
|
|
825
|
-
}) | ({
|
|
826
|
-
session_id: string
|
|
827
|
-
transcript_path: string
|
|
828
|
-
cwd: string
|
|
829
|
-
permission_mode?: string
|
|
830
|
-
agent_id?: string
|
|
831
|
-
agent_type?: string
|
|
832
|
-
} & {
|
|
833
|
-
hook_event_name: "StopFailure"
|
|
834
|
-
error: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
835
|
-
error_details?: string
|
|
836
|
-
last_assistant_message?: string
|
|
837
|
-
}) | ({
|
|
838
|
-
session_id: string
|
|
839
|
-
transcript_path: string
|
|
840
|
-
cwd: string
|
|
841
|
-
permission_mode?: string
|
|
842
|
-
agent_id?: string
|
|
843
|
-
agent_type?: string
|
|
844
|
-
} & {
|
|
845
|
-
hook_event_name: "SubagentStart"
|
|
846
|
-
agent_id: string
|
|
847
|
-
agent_type: string
|
|
848
|
-
}) | ({
|
|
849
|
-
session_id: string
|
|
850
|
-
transcript_path: string
|
|
851
|
-
cwd: string
|
|
852
|
-
permission_mode?: string
|
|
853
|
-
agent_id?: string
|
|
854
|
-
agent_type?: string
|
|
855
|
-
} & {
|
|
856
|
-
hook_event_name: "SubagentStop"
|
|
857
|
-
stop_hook_active: boolean
|
|
858
|
-
agent_id: string
|
|
859
|
-
agent_transcript_path: string
|
|
860
|
-
agent_type: string
|
|
861
|
-
last_assistant_message?: string
|
|
862
|
-
}) | ({
|
|
863
|
-
session_id: string
|
|
864
|
-
transcript_path: string
|
|
865
|
-
cwd: string
|
|
866
|
-
permission_mode?: string
|
|
867
|
-
agent_id?: string
|
|
868
|
-
agent_type?: string
|
|
869
|
-
} & {
|
|
870
|
-
hook_event_name: "PreCompact"
|
|
871
|
-
trigger: "manual" | "auto"
|
|
872
|
-
custom_instructions: string | null
|
|
873
|
-
}) | ({
|
|
874
|
-
session_id: string
|
|
875
|
-
transcript_path: string
|
|
876
|
-
cwd: string
|
|
877
|
-
permission_mode?: string
|
|
878
|
-
agent_id?: string
|
|
879
|
-
agent_type?: string
|
|
880
|
-
} & {
|
|
881
|
-
hook_event_name: "PostCompact"
|
|
882
|
-
trigger: "manual" | "auto"
|
|
883
|
-
compact_summary: string
|
|
884
|
-
}) | ({
|
|
885
|
-
session_id: string
|
|
886
|
-
transcript_path: string
|
|
887
|
-
cwd: string
|
|
888
|
-
permission_mode?: string
|
|
889
|
-
agent_id?: string
|
|
890
|
-
agent_type?: string
|
|
891
|
-
} & {
|
|
892
|
-
hook_event_name: "PermissionRequest"
|
|
893
|
-
tool_name: string
|
|
894
|
-
tool_input: unknown
|
|
895
|
-
permission_suggestions?: ({
|
|
896
|
-
type: "addRules"
|
|
897
|
-
rules: {
|
|
898
|
-
toolName: string
|
|
899
|
-
ruleContent?: string
|
|
900
|
-
}[]
|
|
901
|
-
behavior: "allow" | "deny" | "ask"
|
|
902
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
903
|
-
}) | ({
|
|
904
|
-
type: "replaceRules"
|
|
905
|
-
rules: {
|
|
906
|
-
toolName: string
|
|
907
|
-
ruleContent?: string
|
|
908
|
-
}[]
|
|
909
|
-
behavior: "allow" | "deny" | "ask"
|
|
910
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
911
|
-
}) | ({
|
|
912
|
-
type: "removeRules"
|
|
913
|
-
rules: {
|
|
914
|
-
toolName: string
|
|
915
|
-
ruleContent?: string
|
|
916
|
-
}[]
|
|
917
|
-
behavior: "allow" | "deny" | "ask"
|
|
918
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
919
|
-
}) | ({
|
|
920
|
-
type: "setMode"
|
|
921
|
-
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
922
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
923
|
-
}) | ({
|
|
924
|
-
type: "addDirectories"
|
|
925
|
-
directories: string[]
|
|
926
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
927
|
-
}) | ({
|
|
928
|
-
type: "removeDirectories"
|
|
929
|
-
directories: string[]
|
|
930
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
931
|
-
})[]
|
|
932
|
-
}) | ({
|
|
933
|
-
session_id: string
|
|
934
|
-
transcript_path: string
|
|
935
|
-
cwd: string
|
|
936
|
-
permission_mode?: string
|
|
937
|
-
agent_id?: string
|
|
938
|
-
agent_type?: string
|
|
939
|
-
} & {
|
|
940
|
-
hook_event_name: "Setup"
|
|
941
|
-
trigger: "init" | "maintenance"
|
|
942
|
-
}) | ({
|
|
943
|
-
session_id: string
|
|
944
|
-
transcript_path: string
|
|
945
|
-
cwd: string
|
|
946
|
-
permission_mode?: string
|
|
947
|
-
agent_id?: string
|
|
948
|
-
agent_type?: string
|
|
949
|
-
} & {
|
|
950
|
-
hook_event_name: "TeammateIdle"
|
|
951
|
-
teammate_name: string
|
|
952
|
-
team_name: string
|
|
953
|
-
}) | ({
|
|
954
|
-
session_id: string
|
|
955
|
-
transcript_path: string
|
|
956
|
-
cwd: string
|
|
957
|
-
permission_mode?: string
|
|
958
|
-
agent_id?: string
|
|
959
|
-
agent_type?: string
|
|
960
|
-
} & {
|
|
961
|
-
hook_event_name: "TaskCreated"
|
|
962
|
-
task_id: string
|
|
963
|
-
task_subject: string
|
|
964
|
-
task_description?: string
|
|
965
|
-
teammate_name?: string
|
|
966
|
-
team_name?: string
|
|
967
|
-
}) | ({
|
|
968
|
-
session_id: string
|
|
969
|
-
transcript_path: string
|
|
970
|
-
cwd: string
|
|
971
|
-
permission_mode?: string
|
|
972
|
-
agent_id?: string
|
|
973
|
-
agent_type?: string
|
|
974
|
-
} & {
|
|
975
|
-
hook_event_name: "TaskCompleted"
|
|
976
|
-
task_id: string
|
|
977
|
-
task_subject: string
|
|
978
|
-
task_description?: string
|
|
979
|
-
teammate_name?: string
|
|
980
|
-
team_name?: string
|
|
981
|
-
}) | ({
|
|
982
|
-
session_id: string
|
|
983
|
-
transcript_path: string
|
|
984
|
-
cwd: string
|
|
985
|
-
permission_mode?: string
|
|
986
|
-
agent_id?: string
|
|
987
|
-
agent_type?: string
|
|
988
|
-
} & {
|
|
989
|
-
hook_event_name: "Elicitation"
|
|
990
|
-
mcp_server_name: string
|
|
991
|
-
message: string
|
|
992
|
-
mode?: "form" | "url"
|
|
993
|
-
url?: string
|
|
994
|
-
elicitation_id?: string
|
|
995
|
-
requested_schema?: Record<string, unknown>
|
|
996
|
-
}) | ({
|
|
997
|
-
session_id: string
|
|
998
|
-
transcript_path: string
|
|
999
|
-
cwd: string
|
|
1000
|
-
permission_mode?: string
|
|
1001
|
-
agent_id?: string
|
|
1002
|
-
agent_type?: string
|
|
1003
|
-
} & {
|
|
1004
|
-
hook_event_name: "ElicitationResult"
|
|
1005
|
-
mcp_server_name: string
|
|
1006
|
-
elicitation_id?: string
|
|
1007
|
-
mode?: "form" | "url"
|
|
1008
|
-
action: "accept" | "decline" | "cancel"
|
|
1009
|
-
content?: Record<string, unknown>
|
|
1010
|
-
}) | ({
|
|
1011
|
-
session_id: string
|
|
1012
|
-
transcript_path: string
|
|
1013
|
-
cwd: string
|
|
1014
|
-
permission_mode?: string
|
|
1015
|
-
agent_id?: string
|
|
1016
|
-
agent_type?: string
|
|
1017
|
-
} & {
|
|
1018
|
-
hook_event_name: "ConfigChange"
|
|
1019
|
-
source: "user_settings" | "project_settings" | "local_settings" | "policy_settings" | "skills"
|
|
1020
|
-
file_path?: string
|
|
1021
|
-
}) | ({
|
|
1022
|
-
session_id: string
|
|
1023
|
-
transcript_path: string
|
|
1024
|
-
cwd: string
|
|
1025
|
-
permission_mode?: string
|
|
1026
|
-
agent_id?: string
|
|
1027
|
-
agent_type?: string
|
|
1028
|
-
} & {
|
|
1029
|
-
hook_event_name: "InstructionsLoaded"
|
|
1030
|
-
file_path: string
|
|
1031
|
-
memory_type: "User" | "Project" | "Local" | "Managed"
|
|
1032
|
-
load_reason: "session_start" | "nested_traversal" | "path_glob_match" | "include" | "compact"
|
|
1033
|
-
globs?: string[]
|
|
1034
|
-
trigger_file_path?: string
|
|
1035
|
-
parent_file_path?: string
|
|
1036
|
-
}) | ({
|
|
1037
|
-
session_id: string
|
|
1038
|
-
transcript_path: string
|
|
1039
|
-
cwd: string
|
|
1040
|
-
permission_mode?: string
|
|
1041
|
-
agent_id?: string
|
|
1042
|
-
agent_type?: string
|
|
1043
|
-
} & {
|
|
1044
|
-
hook_event_name: "WorktreeCreate"
|
|
1045
|
-
name: string
|
|
1046
|
-
}) | ({
|
|
1047
|
-
session_id: string
|
|
1048
|
-
transcript_path: string
|
|
1049
|
-
cwd: string
|
|
1050
|
-
permission_mode?: string
|
|
1051
|
-
agent_id?: string
|
|
1052
|
-
agent_type?: string
|
|
1053
|
-
} & {
|
|
1054
|
-
hook_event_name: "WorktreeRemove"
|
|
1055
|
-
worktree_path: string
|
|
1056
|
-
}) | ({
|
|
1057
|
-
session_id: string
|
|
1058
|
-
transcript_path: string
|
|
1059
|
-
cwd: string
|
|
1060
|
-
permission_mode?: string
|
|
1061
|
-
agent_id?: string
|
|
1062
|
-
agent_type?: string
|
|
1063
|
-
} & {
|
|
1064
|
-
hook_event_name: "CwdChanged"
|
|
1065
|
-
old_cwd: string
|
|
1066
|
-
new_cwd: string
|
|
1067
|
-
}) | ({
|
|
1068
|
-
session_id: string
|
|
1069
|
-
transcript_path: string
|
|
1070
|
-
cwd: string
|
|
1071
|
-
permission_mode?: string
|
|
1072
|
-
agent_id?: string
|
|
1073
|
-
agent_type?: string
|
|
1074
|
-
} & {
|
|
1075
|
-
hook_event_name: "FileChanged"
|
|
1076
|
-
file_path: string
|
|
1077
|
-
event: "change" | "add" | "unlink"
|
|
1078
|
-
})
|
|
1079
|
-
|
|
1080
|
-
export type AsyncHookJSONOutput = {
|
|
1081
|
-
async: true
|
|
1082
|
-
asyncTimeout?: number
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
export type PreToolUseHookSpecificOutput = {
|
|
1086
|
-
hookEventName: "PreToolUse"
|
|
1087
|
-
permissionDecision?: "allow" | "deny" | "ask"
|
|
1088
|
-
permissionDecisionReason?: string
|
|
1089
|
-
updatedInput?: Record<string, unknown>
|
|
1090
|
-
additionalContext?: string
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
export type UserPromptSubmitHookSpecificOutput = {
|
|
1094
|
-
hookEventName: "UserPromptSubmit"
|
|
1095
|
-
additionalContext?: string
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
export type SessionStartHookSpecificOutput = {
|
|
1099
|
-
hookEventName: "SessionStart"
|
|
1100
|
-
additionalContext?: string
|
|
1101
|
-
initialUserMessage?: string
|
|
1102
|
-
watchPaths?: string[]
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
export type SetupHookSpecificOutput = {
|
|
1106
|
-
hookEventName: "Setup"
|
|
1107
|
-
additionalContext?: string
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
export type SubagentStartHookSpecificOutput = {
|
|
1111
|
-
hookEventName: "SubagentStart"
|
|
1112
|
-
additionalContext?: string
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
export type PostToolUseHookSpecificOutput = {
|
|
1116
|
-
hookEventName: "PostToolUse"
|
|
1117
|
-
additionalContext?: string
|
|
1118
|
-
updatedMCPToolOutput?: unknown
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
export type PostToolUseFailureHookSpecificOutput = {
|
|
1122
|
-
hookEventName: "PostToolUseFailure"
|
|
1123
|
-
additionalContext?: string
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
export type PermissionDeniedHookSpecificOutput = {
|
|
1127
|
-
hookEventName: "PermissionDenied"
|
|
1128
|
-
retry?: boolean
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
export type NotificationHookSpecificOutput = {
|
|
1132
|
-
hookEventName: "Notification"
|
|
1133
|
-
additionalContext?: string
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
export type PermissionRequestHookSpecificOutput = {
|
|
1137
|
-
hookEventName: "PermissionRequest"
|
|
1138
|
-
decision: ({
|
|
1139
|
-
behavior: "allow"
|
|
1140
|
-
updatedInput?: Record<string, unknown>
|
|
1141
|
-
updatedPermissions?: ({
|
|
1142
|
-
type: "addRules"
|
|
1143
|
-
rules: {
|
|
1144
|
-
toolName: string
|
|
1145
|
-
ruleContent?: string
|
|
1146
|
-
}[]
|
|
1147
|
-
behavior: "allow" | "deny" | "ask"
|
|
1148
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1149
|
-
}) | ({
|
|
1150
|
-
type: "replaceRules"
|
|
1151
|
-
rules: {
|
|
1152
|
-
toolName: string
|
|
1153
|
-
ruleContent?: string
|
|
1154
|
-
}[]
|
|
1155
|
-
behavior: "allow" | "deny" | "ask"
|
|
1156
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1157
|
-
}) | ({
|
|
1158
|
-
type: "removeRules"
|
|
1159
|
-
rules: {
|
|
1160
|
-
toolName: string
|
|
1161
|
-
ruleContent?: string
|
|
1162
|
-
}[]
|
|
1163
|
-
behavior: "allow" | "deny" | "ask"
|
|
1164
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1165
|
-
}) | ({
|
|
1166
|
-
type: "setMode"
|
|
1167
|
-
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1168
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1169
|
-
}) | ({
|
|
1170
|
-
type: "addDirectories"
|
|
1171
|
-
directories: string[]
|
|
1172
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1173
|
-
}) | ({
|
|
1174
|
-
type: "removeDirectories"
|
|
1175
|
-
directories: string[]
|
|
1176
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1177
|
-
})[]
|
|
1178
|
-
}) | ({
|
|
1179
|
-
behavior: "deny"
|
|
1180
|
-
message?: string
|
|
1181
|
-
interrupt?: boolean
|
|
1182
|
-
})
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
export type CwdChangedHookSpecificOutput = {
|
|
1186
|
-
hookEventName: "CwdChanged"
|
|
1187
|
-
watchPaths?: string[]
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
export type FileChangedHookSpecificOutput = {
|
|
1191
|
-
hookEventName: "FileChanged"
|
|
1192
|
-
watchPaths?: string[]
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
/** Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request. */
|
|
1196
|
-
export type ElicitationHookSpecificOutput = {
|
|
1197
|
-
hookEventName: "Elicitation"
|
|
1198
|
-
action?: "accept" | "decline" | "cancel"
|
|
1199
|
-
content?: Record<string, unknown>
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
/** Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server. */
|
|
1203
|
-
export type ElicitationResultHookSpecificOutput = {
|
|
1204
|
-
hookEventName: "ElicitationResult"
|
|
1205
|
-
action?: "accept" | "decline" | "cancel"
|
|
1206
|
-
content?: Record<string, unknown>
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
/** Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead. */
|
|
1210
|
-
export type WorktreeCreateHookSpecificOutput = {
|
|
1211
|
-
hookEventName: "WorktreeCreate"
|
|
1212
|
-
worktreePath: string
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
export type SyncHookJSONOutput = {
|
|
1216
|
-
continue?: boolean
|
|
1217
|
-
suppressOutput?: boolean
|
|
1218
|
-
stopReason?: string
|
|
1219
|
-
decision?: "approve" | "block"
|
|
1220
|
-
systemMessage?: string
|
|
1221
|
-
reason?: string
|
|
1222
|
-
hookSpecificOutput?: ({
|
|
1223
|
-
hookEventName: "PreToolUse"
|
|
1224
|
-
permissionDecision?: "allow" | "deny" | "ask"
|
|
1225
|
-
permissionDecisionReason?: string
|
|
1226
|
-
updatedInput?: Record<string, unknown>
|
|
1227
|
-
additionalContext?: string
|
|
1228
|
-
}) | ({
|
|
1229
|
-
hookEventName: "UserPromptSubmit"
|
|
1230
|
-
additionalContext?: string
|
|
1231
|
-
}) | ({
|
|
1232
|
-
hookEventName: "SessionStart"
|
|
1233
|
-
additionalContext?: string
|
|
1234
|
-
initialUserMessage?: string
|
|
1235
|
-
watchPaths?: string[]
|
|
1236
|
-
}) | ({
|
|
1237
|
-
hookEventName: "Setup"
|
|
1238
|
-
additionalContext?: string
|
|
1239
|
-
}) | ({
|
|
1240
|
-
hookEventName: "SubagentStart"
|
|
1241
|
-
additionalContext?: string
|
|
1242
|
-
}) | ({
|
|
1243
|
-
hookEventName: "PostToolUse"
|
|
1244
|
-
additionalContext?: string
|
|
1245
|
-
updatedMCPToolOutput?: unknown
|
|
1246
|
-
}) | ({
|
|
1247
|
-
hookEventName: "PostToolUseFailure"
|
|
1248
|
-
additionalContext?: string
|
|
1249
|
-
}) | ({
|
|
1250
|
-
hookEventName: "PermissionDenied"
|
|
1251
|
-
retry?: boolean
|
|
1252
|
-
}) | ({
|
|
1253
|
-
hookEventName: "Notification"
|
|
1254
|
-
additionalContext?: string
|
|
1255
|
-
}) | ({
|
|
1256
|
-
hookEventName: "PermissionRequest"
|
|
1257
|
-
decision: ({
|
|
1258
|
-
behavior: "allow"
|
|
1259
|
-
updatedInput?: Record<string, unknown>
|
|
1260
|
-
updatedPermissions?: ({
|
|
1261
|
-
type: "addRules"
|
|
1262
|
-
rules: {
|
|
1263
|
-
toolName: string
|
|
1264
|
-
ruleContent?: string
|
|
1265
|
-
}[]
|
|
1266
|
-
behavior: "allow" | "deny" | "ask"
|
|
1267
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1268
|
-
}) | ({
|
|
1269
|
-
type: "replaceRules"
|
|
1270
|
-
rules: {
|
|
1271
|
-
toolName: string
|
|
1272
|
-
ruleContent?: string
|
|
1273
|
-
}[]
|
|
1274
|
-
behavior: "allow" | "deny" | "ask"
|
|
1275
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1276
|
-
}) | ({
|
|
1277
|
-
type: "removeRules"
|
|
1278
|
-
rules: {
|
|
1279
|
-
toolName: string
|
|
1280
|
-
ruleContent?: string
|
|
1281
|
-
}[]
|
|
1282
|
-
behavior: "allow" | "deny" | "ask"
|
|
1283
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1284
|
-
}) | ({
|
|
1285
|
-
type: "setMode"
|
|
1286
|
-
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1287
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1288
|
-
}) | ({
|
|
1289
|
-
type: "addDirectories"
|
|
1290
|
-
directories: string[]
|
|
1291
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1292
|
-
}) | ({
|
|
1293
|
-
type: "removeDirectories"
|
|
1294
|
-
directories: string[]
|
|
1295
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1296
|
-
})[]
|
|
1297
|
-
}) | ({
|
|
1298
|
-
behavior: "deny"
|
|
1299
|
-
message?: string
|
|
1300
|
-
interrupt?: boolean
|
|
1301
|
-
})
|
|
1302
|
-
}) | ({
|
|
1303
|
-
hookEventName: "Elicitation"
|
|
1304
|
-
action?: "accept" | "decline" | "cancel"
|
|
1305
|
-
content?: Record<string, unknown>
|
|
1306
|
-
}) | ({
|
|
1307
|
-
hookEventName: "ElicitationResult"
|
|
1308
|
-
action?: "accept" | "decline" | "cancel"
|
|
1309
|
-
content?: Record<string, unknown>
|
|
1310
|
-
}) | ({
|
|
1311
|
-
hookEventName: "CwdChanged"
|
|
1312
|
-
watchPaths?: string[]
|
|
1313
|
-
}) | ({
|
|
1314
|
-
hookEventName: "FileChanged"
|
|
1315
|
-
watchPaths?: string[]
|
|
1316
|
-
}) | ({
|
|
1317
|
-
hookEventName: "WorktreeCreate"
|
|
1318
|
-
worktreePath: string
|
|
1319
|
-
})
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
export type HookJSONOutput = ({
|
|
1323
|
-
async: true
|
|
1324
|
-
asyncTimeout?: number
|
|
1325
|
-
}) | ({
|
|
1326
|
-
continue?: boolean
|
|
1327
|
-
suppressOutput?: boolean
|
|
1328
|
-
stopReason?: string
|
|
1329
|
-
decision?: "approve" | "block"
|
|
1330
|
-
systemMessage?: string
|
|
1331
|
-
reason?: string
|
|
1332
|
-
hookSpecificOutput?: ({
|
|
1333
|
-
hookEventName: "PreToolUse"
|
|
1334
|
-
permissionDecision?: "allow" | "deny" | "ask"
|
|
1335
|
-
permissionDecisionReason?: string
|
|
1336
|
-
updatedInput?: Record<string, unknown>
|
|
1337
|
-
additionalContext?: string
|
|
1338
|
-
}) | ({
|
|
1339
|
-
hookEventName: "UserPromptSubmit"
|
|
1340
|
-
additionalContext?: string
|
|
1341
|
-
}) | ({
|
|
1342
|
-
hookEventName: "SessionStart"
|
|
1343
|
-
additionalContext?: string
|
|
1344
|
-
initialUserMessage?: string
|
|
1345
|
-
watchPaths?: string[]
|
|
1346
|
-
}) | ({
|
|
1347
|
-
hookEventName: "Setup"
|
|
1348
|
-
additionalContext?: string
|
|
1349
|
-
}) | ({
|
|
1350
|
-
hookEventName: "SubagentStart"
|
|
1351
|
-
additionalContext?: string
|
|
1352
|
-
}) | ({
|
|
1353
|
-
hookEventName: "PostToolUse"
|
|
1354
|
-
additionalContext?: string
|
|
1355
|
-
updatedMCPToolOutput?: unknown
|
|
1356
|
-
}) | ({
|
|
1357
|
-
hookEventName: "PostToolUseFailure"
|
|
1358
|
-
additionalContext?: string
|
|
1359
|
-
}) | ({
|
|
1360
|
-
hookEventName: "PermissionDenied"
|
|
1361
|
-
retry?: boolean
|
|
1362
|
-
}) | ({
|
|
1363
|
-
hookEventName: "Notification"
|
|
1364
|
-
additionalContext?: string
|
|
1365
|
-
}) | ({
|
|
1366
|
-
hookEventName: "PermissionRequest"
|
|
1367
|
-
decision: ({
|
|
1368
|
-
behavior: "allow"
|
|
1369
|
-
updatedInput?: Record<string, unknown>
|
|
1370
|
-
updatedPermissions?: ({
|
|
1371
|
-
type: "addRules"
|
|
1372
|
-
rules: {
|
|
1373
|
-
toolName: string
|
|
1374
|
-
ruleContent?: string
|
|
1375
|
-
}[]
|
|
1376
|
-
behavior: "allow" | "deny" | "ask"
|
|
1377
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1378
|
-
}) | ({
|
|
1379
|
-
type: "replaceRules"
|
|
1380
|
-
rules: {
|
|
1381
|
-
toolName: string
|
|
1382
|
-
ruleContent?: string
|
|
1383
|
-
}[]
|
|
1384
|
-
behavior: "allow" | "deny" | "ask"
|
|
1385
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1386
|
-
}) | ({
|
|
1387
|
-
type: "removeRules"
|
|
1388
|
-
rules: {
|
|
1389
|
-
toolName: string
|
|
1390
|
-
ruleContent?: string
|
|
1391
|
-
}[]
|
|
1392
|
-
behavior: "allow" | "deny" | "ask"
|
|
1393
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1394
|
-
}) | ({
|
|
1395
|
-
type: "setMode"
|
|
1396
|
-
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1397
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1398
|
-
}) | ({
|
|
1399
|
-
type: "addDirectories"
|
|
1400
|
-
directories: string[]
|
|
1401
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1402
|
-
}) | ({
|
|
1403
|
-
type: "removeDirectories"
|
|
1404
|
-
directories: string[]
|
|
1405
|
-
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1406
|
-
})[]
|
|
1407
|
-
}) | ({
|
|
1408
|
-
behavior: "deny"
|
|
1409
|
-
message?: string
|
|
1410
|
-
interrupt?: boolean
|
|
1411
|
-
})
|
|
1412
|
-
}) | ({
|
|
1413
|
-
hookEventName: "Elicitation"
|
|
1414
|
-
action?: "accept" | "decline" | "cancel"
|
|
1415
|
-
content?: Record<string, unknown>
|
|
1416
|
-
}) | ({
|
|
1417
|
-
hookEventName: "ElicitationResult"
|
|
1418
|
-
action?: "accept" | "decline" | "cancel"
|
|
1419
|
-
content?: Record<string, unknown>
|
|
1420
|
-
}) | ({
|
|
1421
|
-
hookEventName: "CwdChanged"
|
|
1422
|
-
watchPaths?: string[]
|
|
1423
|
-
}) | ({
|
|
1424
|
-
hookEventName: "FileChanged"
|
|
1425
|
-
watchPaths?: string[]
|
|
1426
|
-
}) | ({
|
|
1427
|
-
hookEventName: "WorktreeCreate"
|
|
1428
|
-
worktreePath: string
|
|
1429
|
-
})
|
|
1430
|
-
})
|
|
1431
|
-
|
|
1432
|
-
export type PromptRequestOption = {
|
|
1433
|
-
key: string
|
|
1434
|
-
label: string
|
|
1435
|
-
description?: string
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
export type PromptRequest = {
|
|
1439
|
-
prompt: string
|
|
1440
|
-
message: string
|
|
1441
|
-
options: {
|
|
1442
|
-
key: string
|
|
1443
|
-
label: string
|
|
1444
|
-
description?: string
|
|
1445
|
-
}[]
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
export type PromptResponse = {
|
|
1449
|
-
prompt_response: string
|
|
1450
|
-
selected: string
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
/** Information about an available skill (invoked via /command syntax). */
|
|
1454
|
-
export type SlashCommand = {
|
|
1455
|
-
name: string
|
|
1456
|
-
description: string
|
|
1457
|
-
argumentHint: string
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
/** Information about an available subagent that can be invoked via the Task tool. */
|
|
1461
|
-
export type AgentInfo = {
|
|
1462
|
-
name: string
|
|
1463
|
-
description: string
|
|
1464
|
-
model?: string
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
/** Information about an available model. */
|
|
1468
|
-
export type ModelInfo = {
|
|
1469
|
-
value: string
|
|
1470
|
-
displayName: string
|
|
1471
|
-
description: string
|
|
1472
|
-
supportsEffort?: boolean
|
|
1473
|
-
supportedEffortLevels?: "low" | "medium" | "high" | "max"[]
|
|
1474
|
-
supportsAdaptiveThinking?: boolean
|
|
1475
|
-
supportsFastMode?: boolean
|
|
1476
|
-
supportsAutoMode?: boolean
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
/** Information about the logged in user's account. */
|
|
1480
|
-
export type AccountInfo = {
|
|
1481
|
-
email?: string
|
|
1482
|
-
organization?: string
|
|
1483
|
-
subscriptionType?: string
|
|
1484
|
-
tokenSource?: string
|
|
1485
|
-
apiKeySource?: string
|
|
1486
|
-
apiProvider?: "firstParty" | "bedrock" | "vertex" | "foundry"
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
export type AgentMcpServerSpec = string | (Record<string, ({
|
|
1490
|
-
type?: "stdio"
|
|
1491
|
-
command: string
|
|
1492
|
-
args?: string[]
|
|
1493
|
-
env?: Record<string, string>
|
|
1494
|
-
}) | ({
|
|
1495
|
-
type: "sse"
|
|
1496
|
-
url: string
|
|
1497
|
-
headers?: Record<string, string>
|
|
1498
|
-
}) | ({
|
|
1499
|
-
type: "http"
|
|
1500
|
-
url: string
|
|
1501
|
-
headers?: Record<string, string>
|
|
1502
|
-
}) | ({
|
|
1503
|
-
type: "sdk"
|
|
1504
|
-
name: string
|
|
1505
|
-
})>)
|
|
1506
|
-
|
|
1507
|
-
/** Definition for a custom subagent that can be invoked via the Agent tool. */
|
|
1508
|
-
export type AgentDefinition = {
|
|
1509
|
-
description: string
|
|
1510
|
-
tools?: string[]
|
|
1511
|
-
disallowedTools?: string[]
|
|
1512
|
-
prompt: string
|
|
1513
|
-
model?: string
|
|
1514
|
-
mcpServers?: string | (Record<string, ({
|
|
1515
|
-
type?: "stdio"
|
|
1516
|
-
command: string
|
|
1517
|
-
args?: string[]
|
|
1518
|
-
env?: Record<string, string>
|
|
1519
|
-
}) | ({
|
|
1520
|
-
type: "sse"
|
|
1521
|
-
url: string
|
|
1522
|
-
headers?: Record<string, string>
|
|
1523
|
-
}) | ({
|
|
1524
|
-
type: "http"
|
|
1525
|
-
url: string
|
|
1526
|
-
headers?: Record<string, string>
|
|
1527
|
-
}) | ({
|
|
1528
|
-
type: "sdk"
|
|
1529
|
-
name: string
|
|
1530
|
-
})>)[]
|
|
1531
|
-
criticalSystemReminder_EXPERIMENTAL?: string
|
|
1532
|
-
skills?: string[]
|
|
1533
|
-
initialPrompt?: string
|
|
1534
|
-
maxTurns?: number
|
|
1535
|
-
background?: boolean
|
|
1536
|
-
memory?: "user" | "project" | "local"
|
|
1537
|
-
effort?: "low" | "medium" | "high" | "max" | number
|
|
1538
|
-
permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
/** Source for loading filesystem-based settings. 'user' - Global user settings (~/.claude/settings.json). 'project' - Project settings (.claude/settings.json). 'local' - Local settings (.claude/settings.local.json). */
|
|
1542
|
-
export type SettingSource = "user" | "project" | "local"
|
|
1543
|
-
|
|
1544
|
-
/** Configuration for loading a plugin. */
|
|
1545
|
-
export type SdkPluginConfig = {
|
|
1546
|
-
type: "local"
|
|
1547
|
-
path: string
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
/** Result of a rewindFiles operation. */
|
|
1551
|
-
export type RewindFilesResult = {
|
|
1552
|
-
canRewind: boolean
|
|
1553
|
-
error?: string
|
|
1554
|
-
filesChanged?: string[]
|
|
1555
|
-
insertions?: number
|
|
1556
|
-
deletions?: number
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
export type SDKAssistantMessageError = "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
1560
|
-
|
|
1561
|
-
export type SDKStatus = "compacting" | null
|
|
1562
|
-
|
|
1563
|
-
export type SDKUserMessage = {
|
|
1564
|
-
type: "user"
|
|
1565
|
-
message: Record<string, unknown> & { role: "user", content: string | Array<unknown> }
|
|
1566
|
-
parent_tool_use_id: string | null
|
|
1567
|
-
isSynthetic?: boolean
|
|
1568
|
-
tool_use_result?: unknown
|
|
1569
|
-
priority?: "now" | "next" | "later"
|
|
1570
|
-
timestamp?: string
|
|
1571
|
-
uuid?: string
|
|
1572
|
-
session_id?: string
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
export type SDKUserMessageReplay = {
|
|
1576
|
-
type: "user"
|
|
1577
|
-
message: Record<string, unknown> & { role: "user", content: string | Array<unknown> }
|
|
1578
|
-
parent_tool_use_id: string | null
|
|
1579
|
-
isSynthetic?: boolean
|
|
1580
|
-
tool_use_result?: unknown
|
|
1581
|
-
priority?: "now" | "next" | "later"
|
|
1582
|
-
timestamp?: string
|
|
1583
|
-
uuid: string
|
|
1584
|
-
session_id: string
|
|
1585
|
-
isReplay: true
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
/** Rate limit information for claude.ai subscription users. */
|
|
1589
|
-
export type SDKRateLimitInfo = {
|
|
1590
|
-
status: "allowed" | "allowed_warning" | "rejected"
|
|
1591
|
-
resetsAt?: number
|
|
1592
|
-
rateLimitType?: "five_hour" | "seven_day" | "seven_day_opus" | "seven_day_sonnet" | "overage"
|
|
1593
|
-
utilization?: number
|
|
1594
|
-
overageStatus?: "allowed" | "allowed_warning" | "rejected"
|
|
1595
|
-
overageResetsAt?: number
|
|
1596
|
-
overageDisabledReason?: "overage_not_provisioned" | "org_level_disabled" | "org_level_disabled_until" | "out_of_credits" | "seat_tier_level_disabled" | "member_level_disabled" | "seat_tier_zero_credit_limit" | "group_zero_credit_limit" | "member_zero_credit_limit" | "org_service_level_disabled" | "org_service_zero_credit_limit" | "no_limits_configured" | "unknown"
|
|
1597
|
-
isUsingOverage?: boolean
|
|
1598
|
-
surpassedThreshold?: number
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
export type SDKAssistantMessage = {
|
|
1602
|
-
type: "assistant"
|
|
1603
|
-
message: Record<string, unknown> & { role: "assistant", content: Array<unknown> }
|
|
1604
|
-
parent_tool_use_id: string | null
|
|
1605
|
-
error?: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
1606
|
-
uuid: string
|
|
1607
|
-
session_id: string
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
/** Rate limit event emitted when rate limit info changes. */
|
|
1611
|
-
export type SDKRateLimitEvent = {
|
|
1612
|
-
type: "rate_limit_event"
|
|
1613
|
-
rate_limit_info: {
|
|
1614
|
-
status: "allowed" | "allowed_warning" | "rejected"
|
|
1615
|
-
resetsAt?: number
|
|
1616
|
-
rateLimitType?: "five_hour" | "seven_day" | "seven_day_opus" | "seven_day_sonnet" | "overage"
|
|
1617
|
-
utilization?: number
|
|
1618
|
-
overageStatus?: "allowed" | "allowed_warning" | "rejected"
|
|
1619
|
-
overageResetsAt?: number
|
|
1620
|
-
overageDisabledReason?: "overage_not_provisioned" | "org_level_disabled" | "org_level_disabled_until" | "out_of_credits" | "seat_tier_level_disabled" | "member_level_disabled" | "seat_tier_zero_credit_limit" | "group_zero_credit_limit" | "member_zero_credit_limit" | "org_service_level_disabled" | "org_service_zero_credit_limit" | "no_limits_configured" | "unknown"
|
|
1621
|
-
isUsingOverage?: boolean
|
|
1622
|
-
surpassedThreshold?: number
|
|
1623
|
-
}
|
|
1624
|
-
uuid: string
|
|
1625
|
-
session_id: string
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
/** @internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed. */
|
|
1629
|
-
export type SDKStreamlinedTextMessage = {
|
|
1630
|
-
type: "streamlined_text"
|
|
1631
|
-
text: string
|
|
1632
|
-
session_id: string
|
|
1633
|
-
uuid: string
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
/** @internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string. */
|
|
1637
|
-
export type SDKStreamlinedToolUseSummaryMessage = {
|
|
1638
|
-
type: "streamlined_tool_use_summary"
|
|
1639
|
-
tool_summary: string
|
|
1640
|
-
session_id: string
|
|
1641
|
-
uuid: string
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
export type SDKPermissionDenial = {
|
|
1645
|
-
tool_name: string
|
|
1646
|
-
tool_use_id: string
|
|
1647
|
-
tool_input: Record<string, unknown>
|
|
1648
|
-
}
|
|
1649
|
-
|
|
1650
|
-
export type SDKResultSuccess = {
|
|
1651
|
-
type: "result"
|
|
1652
|
-
subtype: "success"
|
|
1653
|
-
duration_ms: number
|
|
1654
|
-
duration_api_ms: number
|
|
1655
|
-
is_error: boolean
|
|
1656
|
-
num_turns: number
|
|
1657
|
-
result: string
|
|
1658
|
-
stop_reason: string | null
|
|
1659
|
-
total_cost_usd: number
|
|
1660
|
-
usage: Record<string, number>
|
|
1661
|
-
modelUsage: Record<string, {
|
|
1662
|
-
inputTokens: number
|
|
1663
|
-
outputTokens: number
|
|
1664
|
-
cacheReadInputTokens: number
|
|
1665
|
-
cacheCreationInputTokens: number
|
|
1666
|
-
webSearchRequests: number
|
|
1667
|
-
costUSD: number
|
|
1668
|
-
contextWindow: number
|
|
1669
|
-
maxOutputTokens: number
|
|
1670
|
-
}>
|
|
1671
|
-
permission_denials: {
|
|
1672
|
-
tool_name: string
|
|
1673
|
-
tool_use_id: string
|
|
1674
|
-
tool_input: Record<string, unknown>
|
|
1675
|
-
}[]
|
|
1676
|
-
structured_output?: unknown
|
|
1677
|
-
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1678
|
-
uuid: string
|
|
1679
|
-
session_id: string
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
export type SDKResultError = {
|
|
1683
|
-
type: "result"
|
|
1684
|
-
subtype: "error_during_execution" | "error_max_turns" | "error_max_budget_usd" | "error_max_structured_output_retries"
|
|
1685
|
-
duration_ms: number
|
|
1686
|
-
duration_api_ms: number
|
|
1687
|
-
is_error: boolean
|
|
1688
|
-
num_turns: number
|
|
1689
|
-
stop_reason: string | null
|
|
1690
|
-
total_cost_usd: number
|
|
1691
|
-
usage: Record<string, number>
|
|
1692
|
-
modelUsage: Record<string, {
|
|
1693
|
-
inputTokens: number
|
|
1694
|
-
outputTokens: number
|
|
1695
|
-
cacheReadInputTokens: number
|
|
1696
|
-
cacheCreationInputTokens: number
|
|
1697
|
-
webSearchRequests: number
|
|
1698
|
-
costUSD: number
|
|
1699
|
-
contextWindow: number
|
|
1700
|
-
maxOutputTokens: number
|
|
1701
|
-
}>
|
|
1702
|
-
permission_denials: {
|
|
1703
|
-
tool_name: string
|
|
1704
|
-
tool_use_id: string
|
|
1705
|
-
tool_input: Record<string, unknown>
|
|
1706
|
-
}[]
|
|
1707
|
-
errors: string[]
|
|
1708
|
-
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1709
|
-
uuid: string
|
|
1710
|
-
session_id: string
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
export type SDKResultMessage = ({
|
|
1714
|
-
type: "result"
|
|
1715
|
-
subtype: "success"
|
|
1716
|
-
duration_ms: number
|
|
1717
|
-
duration_api_ms: number
|
|
1718
|
-
is_error: boolean
|
|
1719
|
-
num_turns: number
|
|
1720
|
-
result: string
|
|
1721
|
-
stop_reason: string | null
|
|
1722
|
-
total_cost_usd: number
|
|
1723
|
-
usage: Record<string, number>
|
|
1724
|
-
modelUsage: Record<string, {
|
|
1725
|
-
inputTokens: number
|
|
1726
|
-
outputTokens: number
|
|
1727
|
-
cacheReadInputTokens: number
|
|
1728
|
-
cacheCreationInputTokens: number
|
|
1729
|
-
webSearchRequests: number
|
|
1730
|
-
costUSD: number
|
|
1731
|
-
contextWindow: number
|
|
1732
|
-
maxOutputTokens: number
|
|
1733
|
-
}>
|
|
1734
|
-
permission_denials: {
|
|
1735
|
-
tool_name: string
|
|
1736
|
-
tool_use_id: string
|
|
1737
|
-
tool_input: Record<string, unknown>
|
|
1738
|
-
}[]
|
|
1739
|
-
structured_output?: unknown
|
|
1740
|
-
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1741
|
-
uuid: string
|
|
1742
|
-
session_id: string
|
|
1743
|
-
}) | ({
|
|
1744
|
-
type: "result"
|
|
1745
|
-
subtype: "error_during_execution" | "error_max_turns" | "error_max_budget_usd" | "error_max_structured_output_retries"
|
|
1746
|
-
duration_ms: number
|
|
1747
|
-
duration_api_ms: number
|
|
1748
|
-
is_error: boolean
|
|
1749
|
-
num_turns: number
|
|
1750
|
-
stop_reason: string | null
|
|
1751
|
-
total_cost_usd: number
|
|
1752
|
-
usage: Record<string, number>
|
|
1753
|
-
modelUsage: Record<string, {
|
|
1754
|
-
inputTokens: number
|
|
1755
|
-
outputTokens: number
|
|
1756
|
-
cacheReadInputTokens: number
|
|
1757
|
-
cacheCreationInputTokens: number
|
|
1758
|
-
webSearchRequests: number
|
|
1759
|
-
costUSD: number
|
|
1760
|
-
contextWindow: number
|
|
1761
|
-
maxOutputTokens: number
|
|
1762
|
-
}>
|
|
1763
|
-
permission_denials: {
|
|
1764
|
-
tool_name: string
|
|
1765
|
-
tool_use_id: string
|
|
1766
|
-
tool_input: Record<string, unknown>
|
|
1767
|
-
}[]
|
|
1768
|
-
errors: string[]
|
|
1769
|
-
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1770
|
-
uuid: string
|
|
1771
|
-
session_id: string
|
|
1772
|
-
})
|
|
1773
|
-
|
|
1774
|
-
export type SDKSystemMessage = {
|
|
1775
|
-
type: "system"
|
|
1776
|
-
subtype: "init"
|
|
1777
|
-
agents?: string[]
|
|
1778
|
-
apiKeySource: "user" | "project" | "org" | "temporary" | "oauth" | "none"
|
|
1779
|
-
betas?: string[]
|
|
1780
|
-
claude_code_version: string
|
|
1781
|
-
cwd: string
|
|
1782
|
-
tools: string[]
|
|
1783
|
-
mcp_servers: {
|
|
1784
|
-
name: string
|
|
1785
|
-
status: string
|
|
1786
|
-
}[]
|
|
1787
|
-
model: string
|
|
1788
|
-
permissionMode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1789
|
-
slash_commands: string[]
|
|
1790
|
-
output_style: string
|
|
1791
|
-
skills: string[]
|
|
1792
|
-
plugins: {
|
|
1793
|
-
name: string
|
|
1794
|
-
path: string
|
|
1795
|
-
source?: string
|
|
1796
|
-
}[]
|
|
1797
|
-
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1798
|
-
uuid: string
|
|
1799
|
-
session_id: string
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
export type SDKPartialAssistantMessage = {
|
|
1803
|
-
type: "stream_event"
|
|
1804
|
-
event: Record<string, unknown>
|
|
1805
|
-
parent_tool_use_id: string | null
|
|
1806
|
-
uuid: string
|
|
1807
|
-
session_id: string
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
export type SDKCompactBoundaryMessage = {
|
|
1811
|
-
type: "system"
|
|
1812
|
-
subtype: "compact_boundary"
|
|
1813
|
-
compact_metadata: {
|
|
1814
|
-
trigger: "manual" | "auto"
|
|
1815
|
-
pre_tokens: number
|
|
1816
|
-
preserved_segment?: {
|
|
1817
|
-
head_uuid: string
|
|
1818
|
-
anchor_uuid: string
|
|
1819
|
-
tail_uuid: string
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
uuid: string
|
|
1823
|
-
session_id: string
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
|
-
export type SDKStatusMessage = {
|
|
1827
|
-
type: "system"
|
|
1828
|
-
subtype: "status"
|
|
1829
|
-
status: "compacting" | null
|
|
1830
|
-
permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1831
|
-
uuid: string
|
|
1832
|
-
session_id: string
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
/** @internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes. */
|
|
1836
|
-
export type SDKPostTurnSummaryMessage = {
|
|
1837
|
-
type: "system"
|
|
1838
|
-
subtype: "post_turn_summary"
|
|
1839
|
-
summarizes_uuid: string
|
|
1840
|
-
status_category: "blocked" | "waiting" | "completed" | "review_ready" | "failed"
|
|
1841
|
-
status_detail: string
|
|
1842
|
-
is_noteworthy: boolean
|
|
1843
|
-
title: string
|
|
1844
|
-
description: string
|
|
1845
|
-
recent_action: string
|
|
1846
|
-
needs_action: string
|
|
1847
|
-
artifact_urls: string[]
|
|
1848
|
-
uuid: string
|
|
1849
|
-
session_id: string
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
/** Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response. */
|
|
1853
|
-
export type SDKAPIRetryMessage = {
|
|
1854
|
-
type: "system"
|
|
1855
|
-
subtype: "api_retry"
|
|
1856
|
-
attempt: number
|
|
1857
|
-
max_retries: number
|
|
1858
|
-
retry_delay_ms: number
|
|
1859
|
-
error_status: number | null
|
|
1860
|
-
error: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
1861
|
-
uuid: string
|
|
1862
|
-
session_id: string
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
/** Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript. */
|
|
1866
|
-
export type SDKLocalCommandOutputMessage = {
|
|
1867
|
-
type: "system"
|
|
1868
|
-
subtype: "local_command_output"
|
|
1869
|
-
content: string
|
|
1870
|
-
uuid: string
|
|
1871
|
-
session_id: string
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
export type SDKHookStartedMessage = {
|
|
1875
|
-
type: "system"
|
|
1876
|
-
subtype: "hook_started"
|
|
1877
|
-
hook_id: string
|
|
1878
|
-
hook_name: string
|
|
1879
|
-
hook_event: string
|
|
1880
|
-
uuid: string
|
|
1881
|
-
session_id: string
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
export type SDKHookProgressMessage = {
|
|
1885
|
-
type: "system"
|
|
1886
|
-
subtype: "hook_progress"
|
|
1887
|
-
hook_id: string
|
|
1888
|
-
hook_name: string
|
|
1889
|
-
hook_event: string
|
|
1890
|
-
stdout: string
|
|
1891
|
-
stderr: string
|
|
1892
|
-
output: string
|
|
1893
|
-
uuid: string
|
|
1894
|
-
session_id: string
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
export type SDKHookResponseMessage = {
|
|
1898
|
-
type: "system"
|
|
1899
|
-
subtype: "hook_response"
|
|
1900
|
-
hook_id: string
|
|
1901
|
-
hook_name: string
|
|
1902
|
-
hook_event: string
|
|
1903
|
-
output: string
|
|
1904
|
-
stdout: string
|
|
1905
|
-
stderr: string
|
|
1906
|
-
exit_code?: number
|
|
1907
|
-
outcome: "success" | "error" | "cancelled"
|
|
1908
|
-
uuid: string
|
|
1909
|
-
session_id: string
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
export type SDKToolProgressMessage = {
|
|
1913
|
-
type: "tool_progress"
|
|
1914
|
-
tool_use_id: string
|
|
1915
|
-
tool_name: string
|
|
1916
|
-
parent_tool_use_id: string | null
|
|
1917
|
-
elapsed_time_seconds: number
|
|
1918
|
-
task_id?: string
|
|
1919
|
-
uuid: string
|
|
1920
|
-
session_id: string
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
export type SDKAuthStatusMessage = {
|
|
1924
|
-
type: "auth_status"
|
|
1925
|
-
isAuthenticating: boolean
|
|
1926
|
-
output: string[]
|
|
1927
|
-
error?: string
|
|
1928
|
-
uuid: string
|
|
1929
|
-
session_id: string
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
export type SDKFilesPersistedEvent = {
|
|
1933
|
-
type: "system"
|
|
1934
|
-
subtype: "files_persisted"
|
|
1935
|
-
files: {
|
|
1936
|
-
filename: string
|
|
1937
|
-
file_id: string
|
|
1938
|
-
}[]
|
|
1939
|
-
failed: {
|
|
1940
|
-
filename: string
|
|
1941
|
-
error: string
|
|
1942
|
-
}[]
|
|
1943
|
-
processed_at: string
|
|
1944
|
-
uuid: string
|
|
1945
|
-
session_id: string
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
export type SDKTaskNotificationMessage = {
|
|
1949
|
-
type: "system"
|
|
1950
|
-
subtype: "task_notification"
|
|
1951
|
-
task_id: string
|
|
1952
|
-
tool_use_id?: string
|
|
1953
|
-
status: "completed" | "failed" | "stopped"
|
|
1954
|
-
output_file: string
|
|
1955
|
-
summary: string
|
|
1956
|
-
usage?: {
|
|
1957
|
-
total_tokens: number
|
|
1958
|
-
tool_uses: number
|
|
1959
|
-
duration_ms: number
|
|
1960
|
-
}
|
|
1961
|
-
uuid: string
|
|
1962
|
-
session_id: string
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
export type SDKTaskStartedMessage = {
|
|
1966
|
-
type: "system"
|
|
1967
|
-
subtype: "task_started"
|
|
1968
|
-
task_id: string
|
|
1969
|
-
tool_use_id?: string
|
|
1970
|
-
description: string
|
|
1971
|
-
task_type?: string
|
|
1972
|
-
workflow_name?: string
|
|
1973
|
-
prompt?: string
|
|
1974
|
-
uuid: string
|
|
1975
|
-
session_id: string
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
export type SDKTaskProgressMessage = {
|
|
1979
|
-
type: "system"
|
|
1980
|
-
subtype: "task_progress"
|
|
1981
|
-
task_id: string
|
|
1982
|
-
tool_use_id?: string
|
|
1983
|
-
description: string
|
|
1984
|
-
usage: {
|
|
1985
|
-
total_tokens: number
|
|
1986
|
-
tool_uses: number
|
|
1987
|
-
duration_ms: number
|
|
1988
|
-
}
|
|
1989
|
-
last_tool_name?: string
|
|
1990
|
-
summary?: string
|
|
1991
|
-
uuid: string
|
|
1992
|
-
session_id: string
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
/** Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal. */
|
|
1996
|
-
export type SDKSessionStateChangedMessage = {
|
|
1997
|
-
type: "system"
|
|
1998
|
-
subtype: "session_state_changed"
|
|
1999
|
-
state: "idle" | "running" | "requires_action"
|
|
2000
|
-
uuid: string
|
|
2001
|
-
session_id: string
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
export type SDKToolUseSummaryMessage = {
|
|
2005
|
-
type: "tool_use_summary"
|
|
2006
|
-
summary: string
|
|
2007
|
-
preceding_tool_use_ids: string[]
|
|
2008
|
-
uuid: string
|
|
2009
|
-
session_id: string
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
/** Emitted when an MCP server confirms that a URL-mode elicitation is complete. */
|
|
2013
|
-
export type SDKElicitationCompleteMessage = {
|
|
2014
|
-
type: "system"
|
|
2015
|
-
subtype: "elicitation_complete"
|
|
2016
|
-
mcp_server_name: string
|
|
2017
|
-
elicitation_id: string
|
|
2018
|
-
uuid: string
|
|
2019
|
-
session_id: string
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
/** Predicted next user prompt, emitted after each turn when promptSuggestions is enabled. */
|
|
2023
|
-
export type SDKPromptSuggestionMessage = {
|
|
2024
|
-
type: "prompt_suggestion"
|
|
2025
|
-
suggestion: string
|
|
2026
|
-
uuid: string
|
|
2027
|
-
session_id: string
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
/** Session metadata returned by listSessions and getSessionInfo. */
|
|
2031
|
-
export type SDKSessionInfo = {
|
|
2032
|
-
sessionId: string
|
|
2033
|
-
summary: string
|
|
2034
|
-
lastModified: number
|
|
2035
|
-
fileSize?: number
|
|
2036
|
-
customTitle?: string
|
|
2037
|
-
firstPrompt?: string
|
|
2038
|
-
gitBranch?: string
|
|
2039
|
-
cwd?: string
|
|
2040
|
-
tag?: string
|
|
2041
|
-
createdAt?: number
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
export type SDKMessage = ({
|
|
2045
|
-
type: "assistant"
|
|
2046
|
-
message: Record<string, unknown> & { role: "assistant", content: Array<unknown> }
|
|
2047
|
-
parent_tool_use_id: string | null
|
|
2048
|
-
error?: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
2049
|
-
uuid: string
|
|
2050
|
-
session_id: string
|
|
2051
|
-
}) | ({
|
|
2052
|
-
type: "user"
|
|
2053
|
-
message: Record<string, unknown> & { role: "user", content: string | Array<unknown> }
|
|
2054
|
-
parent_tool_use_id: string | null
|
|
2055
|
-
isSynthetic?: boolean
|
|
2056
|
-
tool_use_result?: unknown
|
|
2057
|
-
priority?: "now" | "next" | "later"
|
|
2058
|
-
timestamp?: string
|
|
2059
|
-
uuid?: string
|
|
2060
|
-
session_id?: string
|
|
2061
|
-
}) | ({
|
|
2062
|
-
type: "user"
|
|
2063
|
-
message: Record<string, unknown> & { role: "user", content: string | Array<unknown> }
|
|
2064
|
-
parent_tool_use_id: string | null
|
|
2065
|
-
isSynthetic?: boolean
|
|
2066
|
-
tool_use_result?: unknown
|
|
2067
|
-
priority?: "now" | "next" | "later"
|
|
2068
|
-
timestamp?: string
|
|
2069
|
-
uuid: string
|
|
2070
|
-
session_id: string
|
|
2071
|
-
isReplay: true
|
|
2072
|
-
}) | (({
|
|
2073
|
-
type: "result"
|
|
2074
|
-
subtype: "success"
|
|
2075
|
-
duration_ms: number
|
|
2076
|
-
duration_api_ms: number
|
|
2077
|
-
is_error: boolean
|
|
2078
|
-
num_turns: number
|
|
2079
|
-
result: string
|
|
2080
|
-
stop_reason: string | null
|
|
2081
|
-
total_cost_usd: number
|
|
2082
|
-
usage: Record<string, number>
|
|
2083
|
-
modelUsage: Record<string, {
|
|
2084
|
-
inputTokens: number
|
|
2085
|
-
outputTokens: number
|
|
2086
|
-
cacheReadInputTokens: number
|
|
2087
|
-
cacheCreationInputTokens: number
|
|
2088
|
-
webSearchRequests: number
|
|
2089
|
-
costUSD: number
|
|
2090
|
-
contextWindow: number
|
|
2091
|
-
maxOutputTokens: number
|
|
2092
|
-
}>
|
|
2093
|
-
permission_denials: {
|
|
2094
|
-
tool_name: string
|
|
2095
|
-
tool_use_id: string
|
|
2096
|
-
tool_input: Record<string, unknown>
|
|
2097
|
-
}[]
|
|
2098
|
-
structured_output?: unknown
|
|
2099
|
-
fast_mode_state?: "off" | "cooldown" | "on"
|
|
2100
|
-
uuid: string
|
|
2101
|
-
session_id: string
|
|
2102
|
-
}) | ({
|
|
2103
|
-
type: "result"
|
|
2104
|
-
subtype: "error_during_execution" | "error_max_turns" | "error_max_budget_usd" | "error_max_structured_output_retries"
|
|
2105
|
-
duration_ms: number
|
|
2106
|
-
duration_api_ms: number
|
|
2107
|
-
is_error: boolean
|
|
2108
|
-
num_turns: number
|
|
2109
|
-
stop_reason: string | null
|
|
2110
|
-
total_cost_usd: number
|
|
2111
|
-
usage: Record<string, number>
|
|
2112
|
-
modelUsage: Record<string, {
|
|
2113
|
-
inputTokens: number
|
|
2114
|
-
outputTokens: number
|
|
2115
|
-
cacheReadInputTokens: number
|
|
2116
|
-
cacheCreationInputTokens: number
|
|
2117
|
-
webSearchRequests: number
|
|
2118
|
-
costUSD: number
|
|
2119
|
-
contextWindow: number
|
|
2120
|
-
maxOutputTokens: number
|
|
2121
|
-
}>
|
|
2122
|
-
permission_denials: {
|
|
2123
|
-
tool_name: string
|
|
2124
|
-
tool_use_id: string
|
|
2125
|
-
tool_input: Record<string, unknown>
|
|
2126
|
-
}[]
|
|
2127
|
-
errors: string[]
|
|
2128
|
-
fast_mode_state?: "off" | "cooldown" | "on"
|
|
2129
|
-
uuid: string
|
|
2130
|
-
session_id: string
|
|
2131
|
-
})) | ({
|
|
2132
|
-
type: "system"
|
|
2133
|
-
subtype: "init"
|
|
2134
|
-
agents?: string[]
|
|
2135
|
-
apiKeySource: "user" | "project" | "org" | "temporary" | "oauth" | "none"
|
|
2136
|
-
betas?: string[]
|
|
2137
|
-
claude_code_version: string
|
|
2138
|
-
cwd: string
|
|
2139
|
-
tools: string[]
|
|
2140
|
-
mcp_servers: {
|
|
2141
|
-
name: string
|
|
2142
|
-
status: string
|
|
2143
|
-
}[]
|
|
2144
|
-
model: string
|
|
2145
|
-
permissionMode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
2146
|
-
slash_commands: string[]
|
|
2147
|
-
output_style: string
|
|
2148
|
-
skills: string[]
|
|
2149
|
-
plugins: {
|
|
2150
|
-
name: string
|
|
2151
|
-
path: string
|
|
2152
|
-
source?: string
|
|
2153
|
-
}[]
|
|
2154
|
-
fast_mode_state?: "off" | "cooldown" | "on"
|
|
2155
|
-
uuid: string
|
|
2156
|
-
session_id: string
|
|
2157
|
-
}) | ({
|
|
2158
|
-
type: "stream_event"
|
|
2159
|
-
event: Record<string, unknown>
|
|
2160
|
-
parent_tool_use_id: string | null
|
|
2161
|
-
uuid: string
|
|
2162
|
-
session_id: string
|
|
2163
|
-
}) | ({
|
|
2164
|
-
type: "system"
|
|
2165
|
-
subtype: "compact_boundary"
|
|
2166
|
-
compact_metadata: {
|
|
2167
|
-
trigger: "manual" | "auto"
|
|
2168
|
-
pre_tokens: number
|
|
2169
|
-
preserved_segment?: {
|
|
2170
|
-
head_uuid: string
|
|
2171
|
-
anchor_uuid: string
|
|
2172
|
-
tail_uuid: string
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
uuid: string
|
|
2176
|
-
session_id: string
|
|
2177
|
-
}) | ({
|
|
2178
|
-
type: "system"
|
|
2179
|
-
subtype: "status"
|
|
2180
|
-
status: "compacting" | null
|
|
2181
|
-
permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
2182
|
-
uuid: string
|
|
2183
|
-
session_id: string
|
|
2184
|
-
}) | ({
|
|
2185
|
-
type: "system"
|
|
2186
|
-
subtype: "api_retry"
|
|
2187
|
-
attempt: number
|
|
2188
|
-
max_retries: number
|
|
2189
|
-
retry_delay_ms: number
|
|
2190
|
-
error_status: number | null
|
|
2191
|
-
error: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
2192
|
-
uuid: string
|
|
2193
|
-
session_id: string
|
|
2194
|
-
}) | ({
|
|
2195
|
-
type: "system"
|
|
2196
|
-
subtype: "local_command_output"
|
|
2197
|
-
content: string
|
|
2198
|
-
uuid: string
|
|
2199
|
-
session_id: string
|
|
2200
|
-
}) | ({
|
|
2201
|
-
type: "system"
|
|
2202
|
-
subtype: "hook_started"
|
|
2203
|
-
hook_id: string
|
|
2204
|
-
hook_name: string
|
|
2205
|
-
hook_event: string
|
|
2206
|
-
uuid: string
|
|
2207
|
-
session_id: string
|
|
2208
|
-
}) | ({
|
|
2209
|
-
type: "system"
|
|
2210
|
-
subtype: "hook_progress"
|
|
2211
|
-
hook_id: string
|
|
2212
|
-
hook_name: string
|
|
2213
|
-
hook_event: string
|
|
2214
|
-
stdout: string
|
|
2215
|
-
stderr: string
|
|
2216
|
-
output: string
|
|
2217
|
-
uuid: string
|
|
2218
|
-
session_id: string
|
|
2219
|
-
}) | ({
|
|
2220
|
-
type: "system"
|
|
2221
|
-
subtype: "hook_response"
|
|
2222
|
-
hook_id: string
|
|
2223
|
-
hook_name: string
|
|
2224
|
-
hook_event: string
|
|
2225
|
-
output: string
|
|
2226
|
-
stdout: string
|
|
2227
|
-
stderr: string
|
|
2228
|
-
exit_code?: number
|
|
2229
|
-
outcome: "success" | "error" | "cancelled"
|
|
2230
|
-
uuid: string
|
|
2231
|
-
session_id: string
|
|
2232
|
-
}) | ({
|
|
2233
|
-
type: "tool_progress"
|
|
2234
|
-
tool_use_id: string
|
|
2235
|
-
tool_name: string
|
|
2236
|
-
parent_tool_use_id: string | null
|
|
2237
|
-
elapsed_time_seconds: number
|
|
2238
|
-
task_id?: string
|
|
2239
|
-
uuid: string
|
|
2240
|
-
session_id: string
|
|
2241
|
-
}) | ({
|
|
2242
|
-
type: "auth_status"
|
|
2243
|
-
isAuthenticating: boolean
|
|
2244
|
-
output: string[]
|
|
2245
|
-
error?: string
|
|
2246
|
-
uuid: string
|
|
2247
|
-
session_id: string
|
|
2248
|
-
}) | ({
|
|
2249
|
-
type: "system"
|
|
2250
|
-
subtype: "task_notification"
|
|
2251
|
-
task_id: string
|
|
2252
|
-
tool_use_id?: string
|
|
2253
|
-
status: "completed" | "failed" | "stopped"
|
|
2254
|
-
output_file: string
|
|
2255
|
-
summary: string
|
|
2256
|
-
usage?: {
|
|
2257
|
-
total_tokens: number
|
|
2258
|
-
tool_uses: number
|
|
2259
|
-
duration_ms: number
|
|
2260
|
-
}
|
|
2261
|
-
uuid: string
|
|
2262
|
-
session_id: string
|
|
2263
|
-
}) | ({
|
|
2264
|
-
type: "system"
|
|
2265
|
-
subtype: "task_started"
|
|
2266
|
-
task_id: string
|
|
2267
|
-
tool_use_id?: string
|
|
2268
|
-
description: string
|
|
2269
|
-
task_type?: string
|
|
2270
|
-
workflow_name?: string
|
|
2271
|
-
prompt?: string
|
|
2272
|
-
uuid: string
|
|
2273
|
-
session_id: string
|
|
2274
|
-
}) | ({
|
|
2275
|
-
type: "system"
|
|
2276
|
-
subtype: "task_progress"
|
|
2277
|
-
task_id: string
|
|
2278
|
-
tool_use_id?: string
|
|
2279
|
-
description: string
|
|
2280
|
-
usage: {
|
|
2281
|
-
total_tokens: number
|
|
2282
|
-
tool_uses: number
|
|
2283
|
-
duration_ms: number
|
|
2284
|
-
}
|
|
2285
|
-
last_tool_name?: string
|
|
2286
|
-
summary?: string
|
|
2287
|
-
uuid: string
|
|
2288
|
-
session_id: string
|
|
2289
|
-
}) | ({
|
|
2290
|
-
type: "system"
|
|
2291
|
-
subtype: "session_state_changed"
|
|
2292
|
-
state: "idle" | "running" | "requires_action"
|
|
2293
|
-
uuid: string
|
|
2294
|
-
session_id: string
|
|
2295
|
-
}) | ({
|
|
2296
|
-
type: "system"
|
|
2297
|
-
subtype: "files_persisted"
|
|
2298
|
-
files: {
|
|
2299
|
-
filename: string
|
|
2300
|
-
file_id: string
|
|
2301
|
-
}[]
|
|
2302
|
-
failed: {
|
|
2303
|
-
filename: string
|
|
2304
|
-
error: string
|
|
2305
|
-
}[]
|
|
2306
|
-
processed_at: string
|
|
2307
|
-
uuid: string
|
|
2308
|
-
session_id: string
|
|
2309
|
-
}) | ({
|
|
2310
|
-
type: "tool_use_summary"
|
|
2311
|
-
summary: string
|
|
2312
|
-
preceding_tool_use_ids: string[]
|
|
2313
|
-
uuid: string
|
|
2314
|
-
session_id: string
|
|
2315
|
-
}) | ({
|
|
2316
|
-
type: "rate_limit_event"
|
|
2317
|
-
rate_limit_info: {
|
|
2318
|
-
status: "allowed" | "allowed_warning" | "rejected"
|
|
2319
|
-
resetsAt?: number
|
|
2320
|
-
rateLimitType?: "five_hour" | "seven_day" | "seven_day_opus" | "seven_day_sonnet" | "overage"
|
|
2321
|
-
utilization?: number
|
|
2322
|
-
overageStatus?: "allowed" | "allowed_warning" | "rejected"
|
|
2323
|
-
overageResetsAt?: number
|
|
2324
|
-
overageDisabledReason?: "overage_not_provisioned" | "org_level_disabled" | "org_level_disabled_until" | "out_of_credits" | "seat_tier_level_disabled" | "member_level_disabled" | "seat_tier_zero_credit_limit" | "group_zero_credit_limit" | "member_zero_credit_limit" | "org_service_level_disabled" | "org_service_zero_credit_limit" | "no_limits_configured" | "unknown"
|
|
2325
|
-
isUsingOverage?: boolean
|
|
2326
|
-
surpassedThreshold?: number
|
|
2327
|
-
}
|
|
2328
|
-
uuid: string
|
|
2329
|
-
session_id: string
|
|
2330
|
-
}) | ({
|
|
2331
|
-
type: "system"
|
|
2332
|
-
subtype: "elicitation_complete"
|
|
2333
|
-
mcp_server_name: string
|
|
2334
|
-
elicitation_id: string
|
|
2335
|
-
uuid: string
|
|
2336
|
-
session_id: string
|
|
2337
|
-
}) | ({
|
|
2338
|
-
type: "prompt_suggestion"
|
|
2339
|
-
suggestion: string
|
|
2340
|
-
uuid: string
|
|
2341
|
-
session_id: string
|
|
2342
|
-
}) | ({
|
|
2343
|
-
type: "permission_request"
|
|
2344
|
-
request_id: string
|
|
2345
|
-
tool_name: string
|
|
2346
|
-
tool_use_id: string
|
|
2347
|
-
input: Record<string, unknown>
|
|
2348
|
-
uuid: string
|
|
2349
|
-
session_id: string
|
|
2350
|
-
})
|
|
2351
|
-
|
|
2352
|
-
/** Fast mode state: off, in cooldown after rate limit, or actively enabled. */
|
|
2353
|
-
export type FastModeState = "off" | "cooldown" | "on"
|
|
2354
|
-
|
|
2355
|
-
export type ExitReason = "clear" | "resume" | "logout" | "prompt_input_exit" | "other" | "bypass_permissions_disabled"
|
|
1
|
+
// AUTO-GENERATED — do not edit manually.
|
|
2
|
+
// Regenerate with: bun scripts/generate-sdk-types.ts
|
|
3
|
+
//
|
|
4
|
+
// Generated from Zod schemas in coreSchemas.ts
|
|
5
|
+
|
|
6
|
+
export type ModelUsage = {
|
|
7
|
+
inputTokens: number
|
|
8
|
+
outputTokens: number
|
|
9
|
+
cacheReadInputTokens: number
|
|
10
|
+
cacheCreationInputTokens: number
|
|
11
|
+
webSearchRequests: number
|
|
12
|
+
costUSD: number
|
|
13
|
+
contextWindow: number
|
|
14
|
+
maxOutputTokens: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type OutputFormatType = "json_schema"
|
|
18
|
+
|
|
19
|
+
export type BaseOutputFormat = {
|
|
20
|
+
type: "json_schema"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type JsonSchemaOutputFormat = {
|
|
24
|
+
type: "json_schema"
|
|
25
|
+
schema: Record<string, unknown>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type OutputFormat = {
|
|
29
|
+
type: "json_schema"
|
|
30
|
+
schema: Record<string, unknown>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ApiKeySource = "user" | "project" | "org" | "temporary" | "oauth" | "none"
|
|
34
|
+
|
|
35
|
+
/** Config scope for settings. */
|
|
36
|
+
export type ConfigScope = "local" | "user" | "project"
|
|
37
|
+
|
|
38
|
+
export type SdkBeta = "context-1m-2025-08-07"
|
|
39
|
+
|
|
40
|
+
/** Claude decides when and how much to think (Opus 4.6+). */
|
|
41
|
+
export type ThinkingAdaptive = {
|
|
42
|
+
type: "adaptive"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Fixed thinking token budget (older models) */
|
|
46
|
+
export type ThinkingEnabled = {
|
|
47
|
+
type: "enabled"
|
|
48
|
+
budgetTokens?: number
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** No extended thinking */
|
|
52
|
+
export type ThinkingDisabled = {
|
|
53
|
+
type: "disabled"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens. */
|
|
57
|
+
export type ThinkingConfig = ({
|
|
58
|
+
type: "adaptive"
|
|
59
|
+
}) | ({
|
|
60
|
+
type: "enabled"
|
|
61
|
+
budgetTokens?: number
|
|
62
|
+
}) | ({
|
|
63
|
+
type: "disabled"
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
export type McpStdioServerConfig = {
|
|
67
|
+
type?: "stdio"
|
|
68
|
+
command: string
|
|
69
|
+
args?: string[]
|
|
70
|
+
env?: Record<string, string>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type McpSSEServerConfig = {
|
|
74
|
+
type: "sse"
|
|
75
|
+
url: string
|
|
76
|
+
headers?: Record<string, string>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type McpHttpServerConfig = {
|
|
80
|
+
type: "http"
|
|
81
|
+
url: string
|
|
82
|
+
headers?: Record<string, string>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type McpSdkServerConfig = {
|
|
86
|
+
type: "sdk"
|
|
87
|
+
name: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type McpServerConfigForProcessTransport = ({
|
|
91
|
+
type?: "stdio"
|
|
92
|
+
command: string
|
|
93
|
+
args?: string[]
|
|
94
|
+
env?: Record<string, string>
|
|
95
|
+
}) | ({
|
|
96
|
+
type: "sse"
|
|
97
|
+
url: string
|
|
98
|
+
headers?: Record<string, string>
|
|
99
|
+
}) | ({
|
|
100
|
+
type: "http"
|
|
101
|
+
url: string
|
|
102
|
+
headers?: Record<string, string>
|
|
103
|
+
}) | ({
|
|
104
|
+
type: "sdk"
|
|
105
|
+
name: string
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
export type McpClaudeAIProxyServerConfig = {
|
|
109
|
+
type: "claudeai-proxy"
|
|
110
|
+
url: string
|
|
111
|
+
id: string
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type McpServerStatusConfig = (({
|
|
115
|
+
type?: "stdio"
|
|
116
|
+
command: string
|
|
117
|
+
args?: string[]
|
|
118
|
+
env?: Record<string, string>
|
|
119
|
+
}) | ({
|
|
120
|
+
type: "sse"
|
|
121
|
+
url: string
|
|
122
|
+
headers?: Record<string, string>
|
|
123
|
+
}) | ({
|
|
124
|
+
type: "http"
|
|
125
|
+
url: string
|
|
126
|
+
headers?: Record<string, string>
|
|
127
|
+
}) | ({
|
|
128
|
+
type: "sdk"
|
|
129
|
+
name: string
|
|
130
|
+
})) | ({
|
|
131
|
+
type: "claudeai-proxy"
|
|
132
|
+
url: string
|
|
133
|
+
id: string
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
/** Status information for an MCP server connection. */
|
|
137
|
+
export type McpServerStatus = {
|
|
138
|
+
name: string
|
|
139
|
+
status: "connected" | "failed" | "needs-auth" | "pending" | "disabled"
|
|
140
|
+
serverInfo?: {
|
|
141
|
+
name: string
|
|
142
|
+
version: string
|
|
143
|
+
}
|
|
144
|
+
error?: string
|
|
145
|
+
config?: (({
|
|
146
|
+
type?: "stdio"
|
|
147
|
+
command: string
|
|
148
|
+
args?: string[]
|
|
149
|
+
env?: Record<string, string>
|
|
150
|
+
}) | ({
|
|
151
|
+
type: "sse"
|
|
152
|
+
url: string
|
|
153
|
+
headers?: Record<string, string>
|
|
154
|
+
}) | ({
|
|
155
|
+
type: "http"
|
|
156
|
+
url: string
|
|
157
|
+
headers?: Record<string, string>
|
|
158
|
+
}) | ({
|
|
159
|
+
type: "sdk"
|
|
160
|
+
name: string
|
|
161
|
+
})) | ({
|
|
162
|
+
type: "claudeai-proxy"
|
|
163
|
+
url: string
|
|
164
|
+
id: string
|
|
165
|
+
})
|
|
166
|
+
scope?: string
|
|
167
|
+
tools?: {
|
|
168
|
+
name: string
|
|
169
|
+
description?: string
|
|
170
|
+
annotations?: {
|
|
171
|
+
readOnly?: boolean
|
|
172
|
+
destructive?: boolean
|
|
173
|
+
openWorld?: boolean
|
|
174
|
+
}
|
|
175
|
+
}[]
|
|
176
|
+
capabilities?: {
|
|
177
|
+
experimental?: Record<string, unknown>
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Result of a setMcpServers operation. */
|
|
182
|
+
export type McpSetServersResult = {
|
|
183
|
+
added: string[]
|
|
184
|
+
removed: string[]
|
|
185
|
+
errors: Record<string, string>
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export type PermissionUpdateDestination = "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
189
|
+
|
|
190
|
+
export type PermissionBehavior = "allow" | "deny" | "ask"
|
|
191
|
+
|
|
192
|
+
export type PermissionRuleValue = {
|
|
193
|
+
toolName: string
|
|
194
|
+
ruleContent?: string
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export type PermissionUpdate = ({
|
|
198
|
+
type: "addRules"
|
|
199
|
+
rules: {
|
|
200
|
+
toolName: string
|
|
201
|
+
ruleContent?: string
|
|
202
|
+
}[]
|
|
203
|
+
behavior: "allow" | "deny" | "ask"
|
|
204
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
205
|
+
}) | ({
|
|
206
|
+
type: "replaceRules"
|
|
207
|
+
rules: {
|
|
208
|
+
toolName: string
|
|
209
|
+
ruleContent?: string
|
|
210
|
+
}[]
|
|
211
|
+
behavior: "allow" | "deny" | "ask"
|
|
212
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
213
|
+
}) | ({
|
|
214
|
+
type: "removeRules"
|
|
215
|
+
rules: {
|
|
216
|
+
toolName: string
|
|
217
|
+
ruleContent?: string
|
|
218
|
+
}[]
|
|
219
|
+
behavior: "allow" | "deny" | "ask"
|
|
220
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
221
|
+
}) | ({
|
|
222
|
+
type: "setMode"
|
|
223
|
+
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
224
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
225
|
+
}) | ({
|
|
226
|
+
type: "addDirectories"
|
|
227
|
+
directories: string[]
|
|
228
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
229
|
+
}) | ({
|
|
230
|
+
type: "removeDirectories"
|
|
231
|
+
directories: string[]
|
|
232
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
/** Classification of this permission decision for telemetry. SDK hosts that prompt users (desktop apps, IDEs) should set this to reflect what actually happened: user_temporary for allow-once, user_permanent for always-allow (both the click and later cache hits), user_reject for deny. If unset, the CLI infers conservatively (temporary for allow, reject for deny). The vocabulary matches tool_decision OTel events (monitoring-usage docs). */
|
|
236
|
+
export type PermissionDecisionClassification = "user_temporary" | "user_permanent" | "user_reject"
|
|
237
|
+
|
|
238
|
+
export type PermissionResult = ({
|
|
239
|
+
behavior: "allow"
|
|
240
|
+
updatedInput?: Record<string, unknown>
|
|
241
|
+
updatedPermissions?: ({
|
|
242
|
+
type: "addRules"
|
|
243
|
+
rules: {
|
|
244
|
+
toolName: string
|
|
245
|
+
ruleContent?: string
|
|
246
|
+
}[]
|
|
247
|
+
behavior: "allow" | "deny" | "ask"
|
|
248
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
249
|
+
}) | ({
|
|
250
|
+
type: "replaceRules"
|
|
251
|
+
rules: {
|
|
252
|
+
toolName: string
|
|
253
|
+
ruleContent?: string
|
|
254
|
+
}[]
|
|
255
|
+
behavior: "allow" | "deny" | "ask"
|
|
256
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
257
|
+
}) | ({
|
|
258
|
+
type: "removeRules"
|
|
259
|
+
rules: {
|
|
260
|
+
toolName: string
|
|
261
|
+
ruleContent?: string
|
|
262
|
+
}[]
|
|
263
|
+
behavior: "allow" | "deny" | "ask"
|
|
264
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
265
|
+
}) | ({
|
|
266
|
+
type: "setMode"
|
|
267
|
+
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
268
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
269
|
+
}) | ({
|
|
270
|
+
type: "addDirectories"
|
|
271
|
+
directories: string[]
|
|
272
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
273
|
+
}) | ({
|
|
274
|
+
type: "removeDirectories"
|
|
275
|
+
directories: string[]
|
|
276
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
277
|
+
})[]
|
|
278
|
+
toolUseID?: string
|
|
279
|
+
decisionClassification?: "user_temporary" | "user_permanent" | "user_reject"
|
|
280
|
+
}) | ({
|
|
281
|
+
behavior: "deny"
|
|
282
|
+
message: string
|
|
283
|
+
interrupt?: boolean
|
|
284
|
+
toolUseID?: string
|
|
285
|
+
decisionClassification?: "user_temporary" | "user_permanent" | "user_reject"
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
/** Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. */
|
|
289
|
+
export type PermissionMode = "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
290
|
+
|
|
291
|
+
export type HookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "PermissionDenied" | "Setup" | "TeammateIdle" | "TaskCreated" | "TaskCompleted" | "Elicitation" | "ElicitationResult" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "InstructionsLoaded" | "CwdChanged" | "FileChanged"
|
|
292
|
+
|
|
293
|
+
export type BaseHookInput = {
|
|
294
|
+
session_id: string
|
|
295
|
+
transcript_path: string
|
|
296
|
+
cwd: string
|
|
297
|
+
permission_mode?: string
|
|
298
|
+
agent_id?: string
|
|
299
|
+
agent_type?: string
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export type PreToolUseHookInput = {
|
|
303
|
+
session_id: string
|
|
304
|
+
transcript_path: string
|
|
305
|
+
cwd: string
|
|
306
|
+
permission_mode?: string
|
|
307
|
+
agent_id?: string
|
|
308
|
+
agent_type?: string
|
|
309
|
+
} & {
|
|
310
|
+
hook_event_name: "PreToolUse"
|
|
311
|
+
tool_name: string
|
|
312
|
+
tool_input: unknown
|
|
313
|
+
tool_use_id: string
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export type PostToolUseHookInput = {
|
|
317
|
+
session_id: string
|
|
318
|
+
transcript_path: string
|
|
319
|
+
cwd: string
|
|
320
|
+
permission_mode?: string
|
|
321
|
+
agent_id?: string
|
|
322
|
+
agent_type?: string
|
|
323
|
+
} & {
|
|
324
|
+
hook_event_name: "PostToolUse"
|
|
325
|
+
tool_name: string
|
|
326
|
+
tool_input: unknown
|
|
327
|
+
tool_response: unknown
|
|
328
|
+
tool_use_id: string
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export type PostToolUseFailureHookInput = {
|
|
332
|
+
session_id: string
|
|
333
|
+
transcript_path: string
|
|
334
|
+
cwd: string
|
|
335
|
+
permission_mode?: string
|
|
336
|
+
agent_id?: string
|
|
337
|
+
agent_type?: string
|
|
338
|
+
} & {
|
|
339
|
+
hook_event_name: "PostToolUseFailure"
|
|
340
|
+
tool_name: string
|
|
341
|
+
tool_input: unknown
|
|
342
|
+
tool_use_id: string
|
|
343
|
+
error: string
|
|
344
|
+
is_interrupt?: boolean
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export type PermissionDeniedHookInput = {
|
|
348
|
+
session_id: string
|
|
349
|
+
transcript_path: string
|
|
350
|
+
cwd: string
|
|
351
|
+
permission_mode?: string
|
|
352
|
+
agent_id?: string
|
|
353
|
+
agent_type?: string
|
|
354
|
+
} & {
|
|
355
|
+
hook_event_name: "PermissionDenied"
|
|
356
|
+
tool_name: string
|
|
357
|
+
tool_input: unknown
|
|
358
|
+
tool_use_id: string
|
|
359
|
+
reason: string
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export type NotificationHookInput = {
|
|
363
|
+
session_id: string
|
|
364
|
+
transcript_path: string
|
|
365
|
+
cwd: string
|
|
366
|
+
permission_mode?: string
|
|
367
|
+
agent_id?: string
|
|
368
|
+
agent_type?: string
|
|
369
|
+
} & {
|
|
370
|
+
hook_event_name: "Notification"
|
|
371
|
+
message: string
|
|
372
|
+
title?: string
|
|
373
|
+
notification_type: string
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export type UserPromptSubmitHookInput = {
|
|
377
|
+
session_id: string
|
|
378
|
+
transcript_path: string
|
|
379
|
+
cwd: string
|
|
380
|
+
permission_mode?: string
|
|
381
|
+
agent_id?: string
|
|
382
|
+
agent_type?: string
|
|
383
|
+
} & {
|
|
384
|
+
hook_event_name: "UserPromptSubmit"
|
|
385
|
+
prompt: string
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export type SessionStartHookInput = {
|
|
389
|
+
session_id: string
|
|
390
|
+
transcript_path: string
|
|
391
|
+
cwd: string
|
|
392
|
+
permission_mode?: string
|
|
393
|
+
agent_id?: string
|
|
394
|
+
agent_type?: string
|
|
395
|
+
} & {
|
|
396
|
+
hook_event_name: "SessionStart"
|
|
397
|
+
source: "startup" | "resume" | "clear" | "compact"
|
|
398
|
+
agent_type?: string
|
|
399
|
+
model?: string
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export type SessionEndHookInput = {
|
|
403
|
+
session_id: string
|
|
404
|
+
transcript_path: string
|
|
405
|
+
cwd: string
|
|
406
|
+
permission_mode?: string
|
|
407
|
+
agent_id?: string
|
|
408
|
+
agent_type?: string
|
|
409
|
+
} & {
|
|
410
|
+
hook_event_name: "SessionEnd"
|
|
411
|
+
reason: "clear" | "resume" | "logout" | "prompt_input_exit" | "other" | "bypass_permissions_disabled"
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export type StopHookInput = {
|
|
415
|
+
session_id: string
|
|
416
|
+
transcript_path: string
|
|
417
|
+
cwd: string
|
|
418
|
+
permission_mode?: string
|
|
419
|
+
agent_id?: string
|
|
420
|
+
agent_type?: string
|
|
421
|
+
} & {
|
|
422
|
+
hook_event_name: "Stop"
|
|
423
|
+
stop_hook_active: boolean
|
|
424
|
+
last_assistant_message?: string
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export type StopFailureHookInput = {
|
|
428
|
+
session_id: string
|
|
429
|
+
transcript_path: string
|
|
430
|
+
cwd: string
|
|
431
|
+
permission_mode?: string
|
|
432
|
+
agent_id?: string
|
|
433
|
+
agent_type?: string
|
|
434
|
+
} & {
|
|
435
|
+
hook_event_name: "StopFailure"
|
|
436
|
+
error: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
437
|
+
error_details?: string
|
|
438
|
+
last_assistant_message?: string
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export type SubagentStartHookInput = {
|
|
442
|
+
session_id: string
|
|
443
|
+
transcript_path: string
|
|
444
|
+
cwd: string
|
|
445
|
+
permission_mode?: string
|
|
446
|
+
agent_id?: string
|
|
447
|
+
agent_type?: string
|
|
448
|
+
} & {
|
|
449
|
+
hook_event_name: "SubagentStart"
|
|
450
|
+
agent_id: string
|
|
451
|
+
agent_type: string
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export type SubagentStopHookInput = {
|
|
455
|
+
session_id: string
|
|
456
|
+
transcript_path: string
|
|
457
|
+
cwd: string
|
|
458
|
+
permission_mode?: string
|
|
459
|
+
agent_id?: string
|
|
460
|
+
agent_type?: string
|
|
461
|
+
} & {
|
|
462
|
+
hook_event_name: "SubagentStop"
|
|
463
|
+
stop_hook_active: boolean
|
|
464
|
+
agent_id: string
|
|
465
|
+
agent_transcript_path: string
|
|
466
|
+
agent_type: string
|
|
467
|
+
last_assistant_message?: string
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export type PreCompactHookInput = {
|
|
471
|
+
session_id: string
|
|
472
|
+
transcript_path: string
|
|
473
|
+
cwd: string
|
|
474
|
+
permission_mode?: string
|
|
475
|
+
agent_id?: string
|
|
476
|
+
agent_type?: string
|
|
477
|
+
} & {
|
|
478
|
+
hook_event_name: "PreCompact"
|
|
479
|
+
trigger: "manual" | "auto"
|
|
480
|
+
custom_instructions: string | null
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export type PostCompactHookInput = {
|
|
484
|
+
session_id: string
|
|
485
|
+
transcript_path: string
|
|
486
|
+
cwd: string
|
|
487
|
+
permission_mode?: string
|
|
488
|
+
agent_id?: string
|
|
489
|
+
agent_type?: string
|
|
490
|
+
} & {
|
|
491
|
+
hook_event_name: "PostCompact"
|
|
492
|
+
trigger: "manual" | "auto"
|
|
493
|
+
compact_summary: string
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export type PermissionRequestHookInput = {
|
|
497
|
+
session_id: string
|
|
498
|
+
transcript_path: string
|
|
499
|
+
cwd: string
|
|
500
|
+
permission_mode?: string
|
|
501
|
+
agent_id?: string
|
|
502
|
+
agent_type?: string
|
|
503
|
+
} & {
|
|
504
|
+
hook_event_name: "PermissionRequest"
|
|
505
|
+
tool_name: string
|
|
506
|
+
tool_input: unknown
|
|
507
|
+
permission_suggestions?: ({
|
|
508
|
+
type: "addRules"
|
|
509
|
+
rules: {
|
|
510
|
+
toolName: string
|
|
511
|
+
ruleContent?: string
|
|
512
|
+
}[]
|
|
513
|
+
behavior: "allow" | "deny" | "ask"
|
|
514
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
515
|
+
}) | ({
|
|
516
|
+
type: "replaceRules"
|
|
517
|
+
rules: {
|
|
518
|
+
toolName: string
|
|
519
|
+
ruleContent?: string
|
|
520
|
+
}[]
|
|
521
|
+
behavior: "allow" | "deny" | "ask"
|
|
522
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
523
|
+
}) | ({
|
|
524
|
+
type: "removeRules"
|
|
525
|
+
rules: {
|
|
526
|
+
toolName: string
|
|
527
|
+
ruleContent?: string
|
|
528
|
+
}[]
|
|
529
|
+
behavior: "allow" | "deny" | "ask"
|
|
530
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
531
|
+
}) | ({
|
|
532
|
+
type: "setMode"
|
|
533
|
+
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
534
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
535
|
+
}) | ({
|
|
536
|
+
type: "addDirectories"
|
|
537
|
+
directories: string[]
|
|
538
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
539
|
+
}) | ({
|
|
540
|
+
type: "removeDirectories"
|
|
541
|
+
directories: string[]
|
|
542
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
543
|
+
})[]
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export type SetupHookInput = {
|
|
547
|
+
session_id: string
|
|
548
|
+
transcript_path: string
|
|
549
|
+
cwd: string
|
|
550
|
+
permission_mode?: string
|
|
551
|
+
agent_id?: string
|
|
552
|
+
agent_type?: string
|
|
553
|
+
} & {
|
|
554
|
+
hook_event_name: "Setup"
|
|
555
|
+
trigger: "init" | "maintenance"
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export type TeammateIdleHookInput = {
|
|
559
|
+
session_id: string
|
|
560
|
+
transcript_path: string
|
|
561
|
+
cwd: string
|
|
562
|
+
permission_mode?: string
|
|
563
|
+
agent_id?: string
|
|
564
|
+
agent_type?: string
|
|
565
|
+
} & {
|
|
566
|
+
hook_event_name: "TeammateIdle"
|
|
567
|
+
teammate_name: string
|
|
568
|
+
team_name: string
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export type TaskCreatedHookInput = {
|
|
572
|
+
session_id: string
|
|
573
|
+
transcript_path: string
|
|
574
|
+
cwd: string
|
|
575
|
+
permission_mode?: string
|
|
576
|
+
agent_id?: string
|
|
577
|
+
agent_type?: string
|
|
578
|
+
} & {
|
|
579
|
+
hook_event_name: "TaskCreated"
|
|
580
|
+
task_id: string
|
|
581
|
+
task_subject: string
|
|
582
|
+
task_description?: string
|
|
583
|
+
teammate_name?: string
|
|
584
|
+
team_name?: string
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export type TaskCompletedHookInput = {
|
|
588
|
+
session_id: string
|
|
589
|
+
transcript_path: string
|
|
590
|
+
cwd: string
|
|
591
|
+
permission_mode?: string
|
|
592
|
+
agent_id?: string
|
|
593
|
+
agent_type?: string
|
|
594
|
+
} & {
|
|
595
|
+
hook_event_name: "TaskCompleted"
|
|
596
|
+
task_id: string
|
|
597
|
+
task_subject: string
|
|
598
|
+
task_description?: string
|
|
599
|
+
teammate_name?: string
|
|
600
|
+
team_name?: string
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/** Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog. */
|
|
604
|
+
export type ElicitationHookInput = {
|
|
605
|
+
session_id: string
|
|
606
|
+
transcript_path: string
|
|
607
|
+
cwd: string
|
|
608
|
+
permission_mode?: string
|
|
609
|
+
agent_id?: string
|
|
610
|
+
agent_type?: string
|
|
611
|
+
} & {
|
|
612
|
+
hook_event_name: "Elicitation"
|
|
613
|
+
mcp_server_name: string
|
|
614
|
+
message: string
|
|
615
|
+
mode?: "form" | "url"
|
|
616
|
+
url?: string
|
|
617
|
+
elicitation_id?: string
|
|
618
|
+
requested_schema?: Record<string, unknown>
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server. */
|
|
622
|
+
export type ElicitationResultHookInput = {
|
|
623
|
+
session_id: string
|
|
624
|
+
transcript_path: string
|
|
625
|
+
cwd: string
|
|
626
|
+
permission_mode?: string
|
|
627
|
+
agent_id?: string
|
|
628
|
+
agent_type?: string
|
|
629
|
+
} & {
|
|
630
|
+
hook_event_name: "ElicitationResult"
|
|
631
|
+
mcp_server_name: string
|
|
632
|
+
elicitation_id?: string
|
|
633
|
+
mode?: "form" | "url"
|
|
634
|
+
action: "accept" | "decline" | "cancel"
|
|
635
|
+
content?: Record<string, unknown>
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export type ConfigChangeHookInput = {
|
|
639
|
+
session_id: string
|
|
640
|
+
transcript_path: string
|
|
641
|
+
cwd: string
|
|
642
|
+
permission_mode?: string
|
|
643
|
+
agent_id?: string
|
|
644
|
+
agent_type?: string
|
|
645
|
+
} & {
|
|
646
|
+
hook_event_name: "ConfigChange"
|
|
647
|
+
source: "user_settings" | "project_settings" | "local_settings" | "policy_settings" | "skills"
|
|
648
|
+
file_path?: string
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export type InstructionsLoadedHookInput = {
|
|
652
|
+
session_id: string
|
|
653
|
+
transcript_path: string
|
|
654
|
+
cwd: string
|
|
655
|
+
permission_mode?: string
|
|
656
|
+
agent_id?: string
|
|
657
|
+
agent_type?: string
|
|
658
|
+
} & {
|
|
659
|
+
hook_event_name: "InstructionsLoaded"
|
|
660
|
+
file_path: string
|
|
661
|
+
memory_type: "User" | "Project" | "Local" | "Managed"
|
|
662
|
+
load_reason: "session_start" | "nested_traversal" | "path_glob_match" | "include" | "compact"
|
|
663
|
+
globs?: string[]
|
|
664
|
+
trigger_file_path?: string
|
|
665
|
+
parent_file_path?: string
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
export type WorktreeCreateHookInput = {
|
|
669
|
+
session_id: string
|
|
670
|
+
transcript_path: string
|
|
671
|
+
cwd: string
|
|
672
|
+
permission_mode?: string
|
|
673
|
+
agent_id?: string
|
|
674
|
+
agent_type?: string
|
|
675
|
+
} & {
|
|
676
|
+
hook_event_name: "WorktreeCreate"
|
|
677
|
+
name: string
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export type WorktreeRemoveHookInput = {
|
|
681
|
+
session_id: string
|
|
682
|
+
transcript_path: string
|
|
683
|
+
cwd: string
|
|
684
|
+
permission_mode?: string
|
|
685
|
+
agent_id?: string
|
|
686
|
+
agent_type?: string
|
|
687
|
+
} & {
|
|
688
|
+
hook_event_name: "WorktreeRemove"
|
|
689
|
+
worktree_path: string
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
export type CwdChangedHookInput = {
|
|
693
|
+
session_id: string
|
|
694
|
+
transcript_path: string
|
|
695
|
+
cwd: string
|
|
696
|
+
permission_mode?: string
|
|
697
|
+
agent_id?: string
|
|
698
|
+
agent_type?: string
|
|
699
|
+
} & {
|
|
700
|
+
hook_event_name: "CwdChanged"
|
|
701
|
+
old_cwd: string
|
|
702
|
+
new_cwd: string
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export type FileChangedHookInput = {
|
|
706
|
+
session_id: string
|
|
707
|
+
transcript_path: string
|
|
708
|
+
cwd: string
|
|
709
|
+
permission_mode?: string
|
|
710
|
+
agent_id?: string
|
|
711
|
+
agent_type?: string
|
|
712
|
+
} & {
|
|
713
|
+
hook_event_name: "FileChanged"
|
|
714
|
+
file_path: string
|
|
715
|
+
event: "change" | "add" | "unlink"
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
export type HookInput = ({
|
|
719
|
+
session_id: string
|
|
720
|
+
transcript_path: string
|
|
721
|
+
cwd: string
|
|
722
|
+
permission_mode?: string
|
|
723
|
+
agent_id?: string
|
|
724
|
+
agent_type?: string
|
|
725
|
+
} & {
|
|
726
|
+
hook_event_name: "PreToolUse"
|
|
727
|
+
tool_name: string
|
|
728
|
+
tool_input: unknown
|
|
729
|
+
tool_use_id: string
|
|
730
|
+
}) | ({
|
|
731
|
+
session_id: string
|
|
732
|
+
transcript_path: string
|
|
733
|
+
cwd: string
|
|
734
|
+
permission_mode?: string
|
|
735
|
+
agent_id?: string
|
|
736
|
+
agent_type?: string
|
|
737
|
+
} & {
|
|
738
|
+
hook_event_name: "PostToolUse"
|
|
739
|
+
tool_name: string
|
|
740
|
+
tool_input: unknown
|
|
741
|
+
tool_response: unknown
|
|
742
|
+
tool_use_id: string
|
|
743
|
+
}) | ({
|
|
744
|
+
session_id: string
|
|
745
|
+
transcript_path: string
|
|
746
|
+
cwd: string
|
|
747
|
+
permission_mode?: string
|
|
748
|
+
agent_id?: string
|
|
749
|
+
agent_type?: string
|
|
750
|
+
} & {
|
|
751
|
+
hook_event_name: "PostToolUseFailure"
|
|
752
|
+
tool_name: string
|
|
753
|
+
tool_input: unknown
|
|
754
|
+
tool_use_id: string
|
|
755
|
+
error: string
|
|
756
|
+
is_interrupt?: boolean
|
|
757
|
+
}) | ({
|
|
758
|
+
session_id: string
|
|
759
|
+
transcript_path: string
|
|
760
|
+
cwd: string
|
|
761
|
+
permission_mode?: string
|
|
762
|
+
agent_id?: string
|
|
763
|
+
agent_type?: string
|
|
764
|
+
} & {
|
|
765
|
+
hook_event_name: "PermissionDenied"
|
|
766
|
+
tool_name: string
|
|
767
|
+
tool_input: unknown
|
|
768
|
+
tool_use_id: string
|
|
769
|
+
reason: string
|
|
770
|
+
}) | ({
|
|
771
|
+
session_id: string
|
|
772
|
+
transcript_path: string
|
|
773
|
+
cwd: string
|
|
774
|
+
permission_mode?: string
|
|
775
|
+
agent_id?: string
|
|
776
|
+
agent_type?: string
|
|
777
|
+
} & {
|
|
778
|
+
hook_event_name: "Notification"
|
|
779
|
+
message: string
|
|
780
|
+
title?: string
|
|
781
|
+
notification_type: string
|
|
782
|
+
}) | ({
|
|
783
|
+
session_id: string
|
|
784
|
+
transcript_path: string
|
|
785
|
+
cwd: string
|
|
786
|
+
permission_mode?: string
|
|
787
|
+
agent_id?: string
|
|
788
|
+
agent_type?: string
|
|
789
|
+
} & {
|
|
790
|
+
hook_event_name: "UserPromptSubmit"
|
|
791
|
+
prompt: string
|
|
792
|
+
}) | ({
|
|
793
|
+
session_id: string
|
|
794
|
+
transcript_path: string
|
|
795
|
+
cwd: string
|
|
796
|
+
permission_mode?: string
|
|
797
|
+
agent_id?: string
|
|
798
|
+
agent_type?: string
|
|
799
|
+
} & {
|
|
800
|
+
hook_event_name: "SessionStart"
|
|
801
|
+
source: "startup" | "resume" | "clear" | "compact"
|
|
802
|
+
agent_type?: string
|
|
803
|
+
model?: string
|
|
804
|
+
}) | ({
|
|
805
|
+
session_id: string
|
|
806
|
+
transcript_path: string
|
|
807
|
+
cwd: string
|
|
808
|
+
permission_mode?: string
|
|
809
|
+
agent_id?: string
|
|
810
|
+
agent_type?: string
|
|
811
|
+
} & {
|
|
812
|
+
hook_event_name: "SessionEnd"
|
|
813
|
+
reason: "clear" | "resume" | "logout" | "prompt_input_exit" | "other" | "bypass_permissions_disabled"
|
|
814
|
+
}) | ({
|
|
815
|
+
session_id: string
|
|
816
|
+
transcript_path: string
|
|
817
|
+
cwd: string
|
|
818
|
+
permission_mode?: string
|
|
819
|
+
agent_id?: string
|
|
820
|
+
agent_type?: string
|
|
821
|
+
} & {
|
|
822
|
+
hook_event_name: "Stop"
|
|
823
|
+
stop_hook_active: boolean
|
|
824
|
+
last_assistant_message?: string
|
|
825
|
+
}) | ({
|
|
826
|
+
session_id: string
|
|
827
|
+
transcript_path: string
|
|
828
|
+
cwd: string
|
|
829
|
+
permission_mode?: string
|
|
830
|
+
agent_id?: string
|
|
831
|
+
agent_type?: string
|
|
832
|
+
} & {
|
|
833
|
+
hook_event_name: "StopFailure"
|
|
834
|
+
error: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
835
|
+
error_details?: string
|
|
836
|
+
last_assistant_message?: string
|
|
837
|
+
}) | ({
|
|
838
|
+
session_id: string
|
|
839
|
+
transcript_path: string
|
|
840
|
+
cwd: string
|
|
841
|
+
permission_mode?: string
|
|
842
|
+
agent_id?: string
|
|
843
|
+
agent_type?: string
|
|
844
|
+
} & {
|
|
845
|
+
hook_event_name: "SubagentStart"
|
|
846
|
+
agent_id: string
|
|
847
|
+
agent_type: string
|
|
848
|
+
}) | ({
|
|
849
|
+
session_id: string
|
|
850
|
+
transcript_path: string
|
|
851
|
+
cwd: string
|
|
852
|
+
permission_mode?: string
|
|
853
|
+
agent_id?: string
|
|
854
|
+
agent_type?: string
|
|
855
|
+
} & {
|
|
856
|
+
hook_event_name: "SubagentStop"
|
|
857
|
+
stop_hook_active: boolean
|
|
858
|
+
agent_id: string
|
|
859
|
+
agent_transcript_path: string
|
|
860
|
+
agent_type: string
|
|
861
|
+
last_assistant_message?: string
|
|
862
|
+
}) | ({
|
|
863
|
+
session_id: string
|
|
864
|
+
transcript_path: string
|
|
865
|
+
cwd: string
|
|
866
|
+
permission_mode?: string
|
|
867
|
+
agent_id?: string
|
|
868
|
+
agent_type?: string
|
|
869
|
+
} & {
|
|
870
|
+
hook_event_name: "PreCompact"
|
|
871
|
+
trigger: "manual" | "auto"
|
|
872
|
+
custom_instructions: string | null
|
|
873
|
+
}) | ({
|
|
874
|
+
session_id: string
|
|
875
|
+
transcript_path: string
|
|
876
|
+
cwd: string
|
|
877
|
+
permission_mode?: string
|
|
878
|
+
agent_id?: string
|
|
879
|
+
agent_type?: string
|
|
880
|
+
} & {
|
|
881
|
+
hook_event_name: "PostCompact"
|
|
882
|
+
trigger: "manual" | "auto"
|
|
883
|
+
compact_summary: string
|
|
884
|
+
}) | ({
|
|
885
|
+
session_id: string
|
|
886
|
+
transcript_path: string
|
|
887
|
+
cwd: string
|
|
888
|
+
permission_mode?: string
|
|
889
|
+
agent_id?: string
|
|
890
|
+
agent_type?: string
|
|
891
|
+
} & {
|
|
892
|
+
hook_event_name: "PermissionRequest"
|
|
893
|
+
tool_name: string
|
|
894
|
+
tool_input: unknown
|
|
895
|
+
permission_suggestions?: ({
|
|
896
|
+
type: "addRules"
|
|
897
|
+
rules: {
|
|
898
|
+
toolName: string
|
|
899
|
+
ruleContent?: string
|
|
900
|
+
}[]
|
|
901
|
+
behavior: "allow" | "deny" | "ask"
|
|
902
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
903
|
+
}) | ({
|
|
904
|
+
type: "replaceRules"
|
|
905
|
+
rules: {
|
|
906
|
+
toolName: string
|
|
907
|
+
ruleContent?: string
|
|
908
|
+
}[]
|
|
909
|
+
behavior: "allow" | "deny" | "ask"
|
|
910
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
911
|
+
}) | ({
|
|
912
|
+
type: "removeRules"
|
|
913
|
+
rules: {
|
|
914
|
+
toolName: string
|
|
915
|
+
ruleContent?: string
|
|
916
|
+
}[]
|
|
917
|
+
behavior: "allow" | "deny" | "ask"
|
|
918
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
919
|
+
}) | ({
|
|
920
|
+
type: "setMode"
|
|
921
|
+
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
922
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
923
|
+
}) | ({
|
|
924
|
+
type: "addDirectories"
|
|
925
|
+
directories: string[]
|
|
926
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
927
|
+
}) | ({
|
|
928
|
+
type: "removeDirectories"
|
|
929
|
+
directories: string[]
|
|
930
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
931
|
+
})[]
|
|
932
|
+
}) | ({
|
|
933
|
+
session_id: string
|
|
934
|
+
transcript_path: string
|
|
935
|
+
cwd: string
|
|
936
|
+
permission_mode?: string
|
|
937
|
+
agent_id?: string
|
|
938
|
+
agent_type?: string
|
|
939
|
+
} & {
|
|
940
|
+
hook_event_name: "Setup"
|
|
941
|
+
trigger: "init" | "maintenance"
|
|
942
|
+
}) | ({
|
|
943
|
+
session_id: string
|
|
944
|
+
transcript_path: string
|
|
945
|
+
cwd: string
|
|
946
|
+
permission_mode?: string
|
|
947
|
+
agent_id?: string
|
|
948
|
+
agent_type?: string
|
|
949
|
+
} & {
|
|
950
|
+
hook_event_name: "TeammateIdle"
|
|
951
|
+
teammate_name: string
|
|
952
|
+
team_name: string
|
|
953
|
+
}) | ({
|
|
954
|
+
session_id: string
|
|
955
|
+
transcript_path: string
|
|
956
|
+
cwd: string
|
|
957
|
+
permission_mode?: string
|
|
958
|
+
agent_id?: string
|
|
959
|
+
agent_type?: string
|
|
960
|
+
} & {
|
|
961
|
+
hook_event_name: "TaskCreated"
|
|
962
|
+
task_id: string
|
|
963
|
+
task_subject: string
|
|
964
|
+
task_description?: string
|
|
965
|
+
teammate_name?: string
|
|
966
|
+
team_name?: string
|
|
967
|
+
}) | ({
|
|
968
|
+
session_id: string
|
|
969
|
+
transcript_path: string
|
|
970
|
+
cwd: string
|
|
971
|
+
permission_mode?: string
|
|
972
|
+
agent_id?: string
|
|
973
|
+
agent_type?: string
|
|
974
|
+
} & {
|
|
975
|
+
hook_event_name: "TaskCompleted"
|
|
976
|
+
task_id: string
|
|
977
|
+
task_subject: string
|
|
978
|
+
task_description?: string
|
|
979
|
+
teammate_name?: string
|
|
980
|
+
team_name?: string
|
|
981
|
+
}) | ({
|
|
982
|
+
session_id: string
|
|
983
|
+
transcript_path: string
|
|
984
|
+
cwd: string
|
|
985
|
+
permission_mode?: string
|
|
986
|
+
agent_id?: string
|
|
987
|
+
agent_type?: string
|
|
988
|
+
} & {
|
|
989
|
+
hook_event_name: "Elicitation"
|
|
990
|
+
mcp_server_name: string
|
|
991
|
+
message: string
|
|
992
|
+
mode?: "form" | "url"
|
|
993
|
+
url?: string
|
|
994
|
+
elicitation_id?: string
|
|
995
|
+
requested_schema?: Record<string, unknown>
|
|
996
|
+
}) | ({
|
|
997
|
+
session_id: string
|
|
998
|
+
transcript_path: string
|
|
999
|
+
cwd: string
|
|
1000
|
+
permission_mode?: string
|
|
1001
|
+
agent_id?: string
|
|
1002
|
+
agent_type?: string
|
|
1003
|
+
} & {
|
|
1004
|
+
hook_event_name: "ElicitationResult"
|
|
1005
|
+
mcp_server_name: string
|
|
1006
|
+
elicitation_id?: string
|
|
1007
|
+
mode?: "form" | "url"
|
|
1008
|
+
action: "accept" | "decline" | "cancel"
|
|
1009
|
+
content?: Record<string, unknown>
|
|
1010
|
+
}) | ({
|
|
1011
|
+
session_id: string
|
|
1012
|
+
transcript_path: string
|
|
1013
|
+
cwd: string
|
|
1014
|
+
permission_mode?: string
|
|
1015
|
+
agent_id?: string
|
|
1016
|
+
agent_type?: string
|
|
1017
|
+
} & {
|
|
1018
|
+
hook_event_name: "ConfigChange"
|
|
1019
|
+
source: "user_settings" | "project_settings" | "local_settings" | "policy_settings" | "skills"
|
|
1020
|
+
file_path?: string
|
|
1021
|
+
}) | ({
|
|
1022
|
+
session_id: string
|
|
1023
|
+
transcript_path: string
|
|
1024
|
+
cwd: string
|
|
1025
|
+
permission_mode?: string
|
|
1026
|
+
agent_id?: string
|
|
1027
|
+
agent_type?: string
|
|
1028
|
+
} & {
|
|
1029
|
+
hook_event_name: "InstructionsLoaded"
|
|
1030
|
+
file_path: string
|
|
1031
|
+
memory_type: "User" | "Project" | "Local" | "Managed"
|
|
1032
|
+
load_reason: "session_start" | "nested_traversal" | "path_glob_match" | "include" | "compact"
|
|
1033
|
+
globs?: string[]
|
|
1034
|
+
trigger_file_path?: string
|
|
1035
|
+
parent_file_path?: string
|
|
1036
|
+
}) | ({
|
|
1037
|
+
session_id: string
|
|
1038
|
+
transcript_path: string
|
|
1039
|
+
cwd: string
|
|
1040
|
+
permission_mode?: string
|
|
1041
|
+
agent_id?: string
|
|
1042
|
+
agent_type?: string
|
|
1043
|
+
} & {
|
|
1044
|
+
hook_event_name: "WorktreeCreate"
|
|
1045
|
+
name: string
|
|
1046
|
+
}) | ({
|
|
1047
|
+
session_id: string
|
|
1048
|
+
transcript_path: string
|
|
1049
|
+
cwd: string
|
|
1050
|
+
permission_mode?: string
|
|
1051
|
+
agent_id?: string
|
|
1052
|
+
agent_type?: string
|
|
1053
|
+
} & {
|
|
1054
|
+
hook_event_name: "WorktreeRemove"
|
|
1055
|
+
worktree_path: string
|
|
1056
|
+
}) | ({
|
|
1057
|
+
session_id: string
|
|
1058
|
+
transcript_path: string
|
|
1059
|
+
cwd: string
|
|
1060
|
+
permission_mode?: string
|
|
1061
|
+
agent_id?: string
|
|
1062
|
+
agent_type?: string
|
|
1063
|
+
} & {
|
|
1064
|
+
hook_event_name: "CwdChanged"
|
|
1065
|
+
old_cwd: string
|
|
1066
|
+
new_cwd: string
|
|
1067
|
+
}) | ({
|
|
1068
|
+
session_id: string
|
|
1069
|
+
transcript_path: string
|
|
1070
|
+
cwd: string
|
|
1071
|
+
permission_mode?: string
|
|
1072
|
+
agent_id?: string
|
|
1073
|
+
agent_type?: string
|
|
1074
|
+
} & {
|
|
1075
|
+
hook_event_name: "FileChanged"
|
|
1076
|
+
file_path: string
|
|
1077
|
+
event: "change" | "add" | "unlink"
|
|
1078
|
+
})
|
|
1079
|
+
|
|
1080
|
+
export type AsyncHookJSONOutput = {
|
|
1081
|
+
async: true
|
|
1082
|
+
asyncTimeout?: number
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
export type PreToolUseHookSpecificOutput = {
|
|
1086
|
+
hookEventName: "PreToolUse"
|
|
1087
|
+
permissionDecision?: "allow" | "deny" | "ask"
|
|
1088
|
+
permissionDecisionReason?: string
|
|
1089
|
+
updatedInput?: Record<string, unknown>
|
|
1090
|
+
additionalContext?: string
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
export type UserPromptSubmitHookSpecificOutput = {
|
|
1094
|
+
hookEventName: "UserPromptSubmit"
|
|
1095
|
+
additionalContext?: string
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
export type SessionStartHookSpecificOutput = {
|
|
1099
|
+
hookEventName: "SessionStart"
|
|
1100
|
+
additionalContext?: string
|
|
1101
|
+
initialUserMessage?: string
|
|
1102
|
+
watchPaths?: string[]
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
export type SetupHookSpecificOutput = {
|
|
1106
|
+
hookEventName: "Setup"
|
|
1107
|
+
additionalContext?: string
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
export type SubagentStartHookSpecificOutput = {
|
|
1111
|
+
hookEventName: "SubagentStart"
|
|
1112
|
+
additionalContext?: string
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
export type PostToolUseHookSpecificOutput = {
|
|
1116
|
+
hookEventName: "PostToolUse"
|
|
1117
|
+
additionalContext?: string
|
|
1118
|
+
updatedMCPToolOutput?: unknown
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
export type PostToolUseFailureHookSpecificOutput = {
|
|
1122
|
+
hookEventName: "PostToolUseFailure"
|
|
1123
|
+
additionalContext?: string
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
export type PermissionDeniedHookSpecificOutput = {
|
|
1127
|
+
hookEventName: "PermissionDenied"
|
|
1128
|
+
retry?: boolean
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
export type NotificationHookSpecificOutput = {
|
|
1132
|
+
hookEventName: "Notification"
|
|
1133
|
+
additionalContext?: string
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
export type PermissionRequestHookSpecificOutput = {
|
|
1137
|
+
hookEventName: "PermissionRequest"
|
|
1138
|
+
decision: ({
|
|
1139
|
+
behavior: "allow"
|
|
1140
|
+
updatedInput?: Record<string, unknown>
|
|
1141
|
+
updatedPermissions?: ({
|
|
1142
|
+
type: "addRules"
|
|
1143
|
+
rules: {
|
|
1144
|
+
toolName: string
|
|
1145
|
+
ruleContent?: string
|
|
1146
|
+
}[]
|
|
1147
|
+
behavior: "allow" | "deny" | "ask"
|
|
1148
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1149
|
+
}) | ({
|
|
1150
|
+
type: "replaceRules"
|
|
1151
|
+
rules: {
|
|
1152
|
+
toolName: string
|
|
1153
|
+
ruleContent?: string
|
|
1154
|
+
}[]
|
|
1155
|
+
behavior: "allow" | "deny" | "ask"
|
|
1156
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1157
|
+
}) | ({
|
|
1158
|
+
type: "removeRules"
|
|
1159
|
+
rules: {
|
|
1160
|
+
toolName: string
|
|
1161
|
+
ruleContent?: string
|
|
1162
|
+
}[]
|
|
1163
|
+
behavior: "allow" | "deny" | "ask"
|
|
1164
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1165
|
+
}) | ({
|
|
1166
|
+
type: "setMode"
|
|
1167
|
+
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1168
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1169
|
+
}) | ({
|
|
1170
|
+
type: "addDirectories"
|
|
1171
|
+
directories: string[]
|
|
1172
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1173
|
+
}) | ({
|
|
1174
|
+
type: "removeDirectories"
|
|
1175
|
+
directories: string[]
|
|
1176
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1177
|
+
})[]
|
|
1178
|
+
}) | ({
|
|
1179
|
+
behavior: "deny"
|
|
1180
|
+
message?: string
|
|
1181
|
+
interrupt?: boolean
|
|
1182
|
+
})
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
export type CwdChangedHookSpecificOutput = {
|
|
1186
|
+
hookEventName: "CwdChanged"
|
|
1187
|
+
watchPaths?: string[]
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
export type FileChangedHookSpecificOutput = {
|
|
1191
|
+
hookEventName: "FileChanged"
|
|
1192
|
+
watchPaths?: string[]
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/** Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request. */
|
|
1196
|
+
export type ElicitationHookSpecificOutput = {
|
|
1197
|
+
hookEventName: "Elicitation"
|
|
1198
|
+
action?: "accept" | "decline" | "cancel"
|
|
1199
|
+
content?: Record<string, unknown>
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
/** Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server. */
|
|
1203
|
+
export type ElicitationResultHookSpecificOutput = {
|
|
1204
|
+
hookEventName: "ElicitationResult"
|
|
1205
|
+
action?: "accept" | "decline" | "cancel"
|
|
1206
|
+
content?: Record<string, unknown>
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
/** Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead. */
|
|
1210
|
+
export type WorktreeCreateHookSpecificOutput = {
|
|
1211
|
+
hookEventName: "WorktreeCreate"
|
|
1212
|
+
worktreePath: string
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
export type SyncHookJSONOutput = {
|
|
1216
|
+
continue?: boolean
|
|
1217
|
+
suppressOutput?: boolean
|
|
1218
|
+
stopReason?: string
|
|
1219
|
+
decision?: "approve" | "block"
|
|
1220
|
+
systemMessage?: string
|
|
1221
|
+
reason?: string
|
|
1222
|
+
hookSpecificOutput?: ({
|
|
1223
|
+
hookEventName: "PreToolUse"
|
|
1224
|
+
permissionDecision?: "allow" | "deny" | "ask"
|
|
1225
|
+
permissionDecisionReason?: string
|
|
1226
|
+
updatedInput?: Record<string, unknown>
|
|
1227
|
+
additionalContext?: string
|
|
1228
|
+
}) | ({
|
|
1229
|
+
hookEventName: "UserPromptSubmit"
|
|
1230
|
+
additionalContext?: string
|
|
1231
|
+
}) | ({
|
|
1232
|
+
hookEventName: "SessionStart"
|
|
1233
|
+
additionalContext?: string
|
|
1234
|
+
initialUserMessage?: string
|
|
1235
|
+
watchPaths?: string[]
|
|
1236
|
+
}) | ({
|
|
1237
|
+
hookEventName: "Setup"
|
|
1238
|
+
additionalContext?: string
|
|
1239
|
+
}) | ({
|
|
1240
|
+
hookEventName: "SubagentStart"
|
|
1241
|
+
additionalContext?: string
|
|
1242
|
+
}) | ({
|
|
1243
|
+
hookEventName: "PostToolUse"
|
|
1244
|
+
additionalContext?: string
|
|
1245
|
+
updatedMCPToolOutput?: unknown
|
|
1246
|
+
}) | ({
|
|
1247
|
+
hookEventName: "PostToolUseFailure"
|
|
1248
|
+
additionalContext?: string
|
|
1249
|
+
}) | ({
|
|
1250
|
+
hookEventName: "PermissionDenied"
|
|
1251
|
+
retry?: boolean
|
|
1252
|
+
}) | ({
|
|
1253
|
+
hookEventName: "Notification"
|
|
1254
|
+
additionalContext?: string
|
|
1255
|
+
}) | ({
|
|
1256
|
+
hookEventName: "PermissionRequest"
|
|
1257
|
+
decision: ({
|
|
1258
|
+
behavior: "allow"
|
|
1259
|
+
updatedInput?: Record<string, unknown>
|
|
1260
|
+
updatedPermissions?: ({
|
|
1261
|
+
type: "addRules"
|
|
1262
|
+
rules: {
|
|
1263
|
+
toolName: string
|
|
1264
|
+
ruleContent?: string
|
|
1265
|
+
}[]
|
|
1266
|
+
behavior: "allow" | "deny" | "ask"
|
|
1267
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1268
|
+
}) | ({
|
|
1269
|
+
type: "replaceRules"
|
|
1270
|
+
rules: {
|
|
1271
|
+
toolName: string
|
|
1272
|
+
ruleContent?: string
|
|
1273
|
+
}[]
|
|
1274
|
+
behavior: "allow" | "deny" | "ask"
|
|
1275
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1276
|
+
}) | ({
|
|
1277
|
+
type: "removeRules"
|
|
1278
|
+
rules: {
|
|
1279
|
+
toolName: string
|
|
1280
|
+
ruleContent?: string
|
|
1281
|
+
}[]
|
|
1282
|
+
behavior: "allow" | "deny" | "ask"
|
|
1283
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1284
|
+
}) | ({
|
|
1285
|
+
type: "setMode"
|
|
1286
|
+
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1287
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1288
|
+
}) | ({
|
|
1289
|
+
type: "addDirectories"
|
|
1290
|
+
directories: string[]
|
|
1291
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1292
|
+
}) | ({
|
|
1293
|
+
type: "removeDirectories"
|
|
1294
|
+
directories: string[]
|
|
1295
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1296
|
+
})[]
|
|
1297
|
+
}) | ({
|
|
1298
|
+
behavior: "deny"
|
|
1299
|
+
message?: string
|
|
1300
|
+
interrupt?: boolean
|
|
1301
|
+
})
|
|
1302
|
+
}) | ({
|
|
1303
|
+
hookEventName: "Elicitation"
|
|
1304
|
+
action?: "accept" | "decline" | "cancel"
|
|
1305
|
+
content?: Record<string, unknown>
|
|
1306
|
+
}) | ({
|
|
1307
|
+
hookEventName: "ElicitationResult"
|
|
1308
|
+
action?: "accept" | "decline" | "cancel"
|
|
1309
|
+
content?: Record<string, unknown>
|
|
1310
|
+
}) | ({
|
|
1311
|
+
hookEventName: "CwdChanged"
|
|
1312
|
+
watchPaths?: string[]
|
|
1313
|
+
}) | ({
|
|
1314
|
+
hookEventName: "FileChanged"
|
|
1315
|
+
watchPaths?: string[]
|
|
1316
|
+
}) | ({
|
|
1317
|
+
hookEventName: "WorktreeCreate"
|
|
1318
|
+
worktreePath: string
|
|
1319
|
+
})
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
export type HookJSONOutput = ({
|
|
1323
|
+
async: true
|
|
1324
|
+
asyncTimeout?: number
|
|
1325
|
+
}) | ({
|
|
1326
|
+
continue?: boolean
|
|
1327
|
+
suppressOutput?: boolean
|
|
1328
|
+
stopReason?: string
|
|
1329
|
+
decision?: "approve" | "block"
|
|
1330
|
+
systemMessage?: string
|
|
1331
|
+
reason?: string
|
|
1332
|
+
hookSpecificOutput?: ({
|
|
1333
|
+
hookEventName: "PreToolUse"
|
|
1334
|
+
permissionDecision?: "allow" | "deny" | "ask"
|
|
1335
|
+
permissionDecisionReason?: string
|
|
1336
|
+
updatedInput?: Record<string, unknown>
|
|
1337
|
+
additionalContext?: string
|
|
1338
|
+
}) | ({
|
|
1339
|
+
hookEventName: "UserPromptSubmit"
|
|
1340
|
+
additionalContext?: string
|
|
1341
|
+
}) | ({
|
|
1342
|
+
hookEventName: "SessionStart"
|
|
1343
|
+
additionalContext?: string
|
|
1344
|
+
initialUserMessage?: string
|
|
1345
|
+
watchPaths?: string[]
|
|
1346
|
+
}) | ({
|
|
1347
|
+
hookEventName: "Setup"
|
|
1348
|
+
additionalContext?: string
|
|
1349
|
+
}) | ({
|
|
1350
|
+
hookEventName: "SubagentStart"
|
|
1351
|
+
additionalContext?: string
|
|
1352
|
+
}) | ({
|
|
1353
|
+
hookEventName: "PostToolUse"
|
|
1354
|
+
additionalContext?: string
|
|
1355
|
+
updatedMCPToolOutput?: unknown
|
|
1356
|
+
}) | ({
|
|
1357
|
+
hookEventName: "PostToolUseFailure"
|
|
1358
|
+
additionalContext?: string
|
|
1359
|
+
}) | ({
|
|
1360
|
+
hookEventName: "PermissionDenied"
|
|
1361
|
+
retry?: boolean
|
|
1362
|
+
}) | ({
|
|
1363
|
+
hookEventName: "Notification"
|
|
1364
|
+
additionalContext?: string
|
|
1365
|
+
}) | ({
|
|
1366
|
+
hookEventName: "PermissionRequest"
|
|
1367
|
+
decision: ({
|
|
1368
|
+
behavior: "allow"
|
|
1369
|
+
updatedInput?: Record<string, unknown>
|
|
1370
|
+
updatedPermissions?: ({
|
|
1371
|
+
type: "addRules"
|
|
1372
|
+
rules: {
|
|
1373
|
+
toolName: string
|
|
1374
|
+
ruleContent?: string
|
|
1375
|
+
}[]
|
|
1376
|
+
behavior: "allow" | "deny" | "ask"
|
|
1377
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1378
|
+
}) | ({
|
|
1379
|
+
type: "replaceRules"
|
|
1380
|
+
rules: {
|
|
1381
|
+
toolName: string
|
|
1382
|
+
ruleContent?: string
|
|
1383
|
+
}[]
|
|
1384
|
+
behavior: "allow" | "deny" | "ask"
|
|
1385
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1386
|
+
}) | ({
|
|
1387
|
+
type: "removeRules"
|
|
1388
|
+
rules: {
|
|
1389
|
+
toolName: string
|
|
1390
|
+
ruleContent?: string
|
|
1391
|
+
}[]
|
|
1392
|
+
behavior: "allow" | "deny" | "ask"
|
|
1393
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1394
|
+
}) | ({
|
|
1395
|
+
type: "setMode"
|
|
1396
|
+
mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1397
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1398
|
+
}) | ({
|
|
1399
|
+
type: "addDirectories"
|
|
1400
|
+
directories: string[]
|
|
1401
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1402
|
+
}) | ({
|
|
1403
|
+
type: "removeDirectories"
|
|
1404
|
+
directories: string[]
|
|
1405
|
+
destination: "userSettings" | "projectSettings" | "localSettings" | "session" | "cliArg"
|
|
1406
|
+
})[]
|
|
1407
|
+
}) | ({
|
|
1408
|
+
behavior: "deny"
|
|
1409
|
+
message?: string
|
|
1410
|
+
interrupt?: boolean
|
|
1411
|
+
})
|
|
1412
|
+
}) | ({
|
|
1413
|
+
hookEventName: "Elicitation"
|
|
1414
|
+
action?: "accept" | "decline" | "cancel"
|
|
1415
|
+
content?: Record<string, unknown>
|
|
1416
|
+
}) | ({
|
|
1417
|
+
hookEventName: "ElicitationResult"
|
|
1418
|
+
action?: "accept" | "decline" | "cancel"
|
|
1419
|
+
content?: Record<string, unknown>
|
|
1420
|
+
}) | ({
|
|
1421
|
+
hookEventName: "CwdChanged"
|
|
1422
|
+
watchPaths?: string[]
|
|
1423
|
+
}) | ({
|
|
1424
|
+
hookEventName: "FileChanged"
|
|
1425
|
+
watchPaths?: string[]
|
|
1426
|
+
}) | ({
|
|
1427
|
+
hookEventName: "WorktreeCreate"
|
|
1428
|
+
worktreePath: string
|
|
1429
|
+
})
|
|
1430
|
+
})
|
|
1431
|
+
|
|
1432
|
+
export type PromptRequestOption = {
|
|
1433
|
+
key: string
|
|
1434
|
+
label: string
|
|
1435
|
+
description?: string
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
export type PromptRequest = {
|
|
1439
|
+
prompt: string
|
|
1440
|
+
message: string
|
|
1441
|
+
options: {
|
|
1442
|
+
key: string
|
|
1443
|
+
label: string
|
|
1444
|
+
description?: string
|
|
1445
|
+
}[]
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
export type PromptResponse = {
|
|
1449
|
+
prompt_response: string
|
|
1450
|
+
selected: string
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/** Information about an available skill (invoked via /command syntax). */
|
|
1454
|
+
export type SlashCommand = {
|
|
1455
|
+
name: string
|
|
1456
|
+
description: string
|
|
1457
|
+
argumentHint: string
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/** Information about an available subagent that can be invoked via the Task tool. */
|
|
1461
|
+
export type AgentInfo = {
|
|
1462
|
+
name: string
|
|
1463
|
+
description: string
|
|
1464
|
+
model?: string
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
/** Information about an available model. */
|
|
1468
|
+
export type ModelInfo = {
|
|
1469
|
+
value: string
|
|
1470
|
+
displayName: string
|
|
1471
|
+
description: string
|
|
1472
|
+
supportsEffort?: boolean
|
|
1473
|
+
supportedEffortLevels?: "low" | "medium" | "high" | "max"[]
|
|
1474
|
+
supportsAdaptiveThinking?: boolean
|
|
1475
|
+
supportsFastMode?: boolean
|
|
1476
|
+
supportsAutoMode?: boolean
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
/** Information about the logged in user's account. */
|
|
1480
|
+
export type AccountInfo = {
|
|
1481
|
+
email?: string
|
|
1482
|
+
organization?: string
|
|
1483
|
+
subscriptionType?: string
|
|
1484
|
+
tokenSource?: string
|
|
1485
|
+
apiKeySource?: string
|
|
1486
|
+
apiProvider?: "firstParty" | "bedrock" | "vertex" | "foundry"
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
export type AgentMcpServerSpec = string | (Record<string, ({
|
|
1490
|
+
type?: "stdio"
|
|
1491
|
+
command: string
|
|
1492
|
+
args?: string[]
|
|
1493
|
+
env?: Record<string, string>
|
|
1494
|
+
}) | ({
|
|
1495
|
+
type: "sse"
|
|
1496
|
+
url: string
|
|
1497
|
+
headers?: Record<string, string>
|
|
1498
|
+
}) | ({
|
|
1499
|
+
type: "http"
|
|
1500
|
+
url: string
|
|
1501
|
+
headers?: Record<string, string>
|
|
1502
|
+
}) | ({
|
|
1503
|
+
type: "sdk"
|
|
1504
|
+
name: string
|
|
1505
|
+
})>)
|
|
1506
|
+
|
|
1507
|
+
/** Definition for a custom subagent that can be invoked via the Agent tool. */
|
|
1508
|
+
export type AgentDefinition = {
|
|
1509
|
+
description: string
|
|
1510
|
+
tools?: string[]
|
|
1511
|
+
disallowedTools?: string[]
|
|
1512
|
+
prompt: string
|
|
1513
|
+
model?: string
|
|
1514
|
+
mcpServers?: string | (Record<string, ({
|
|
1515
|
+
type?: "stdio"
|
|
1516
|
+
command: string
|
|
1517
|
+
args?: string[]
|
|
1518
|
+
env?: Record<string, string>
|
|
1519
|
+
}) | ({
|
|
1520
|
+
type: "sse"
|
|
1521
|
+
url: string
|
|
1522
|
+
headers?: Record<string, string>
|
|
1523
|
+
}) | ({
|
|
1524
|
+
type: "http"
|
|
1525
|
+
url: string
|
|
1526
|
+
headers?: Record<string, string>
|
|
1527
|
+
}) | ({
|
|
1528
|
+
type: "sdk"
|
|
1529
|
+
name: string
|
|
1530
|
+
})>)[]
|
|
1531
|
+
criticalSystemReminder_EXPERIMENTAL?: string
|
|
1532
|
+
skills?: string[]
|
|
1533
|
+
initialPrompt?: string
|
|
1534
|
+
maxTurns?: number
|
|
1535
|
+
background?: boolean
|
|
1536
|
+
memory?: "user" | "project" | "local"
|
|
1537
|
+
effort?: "low" | "medium" | "high" | "max" | number
|
|
1538
|
+
permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** Source for loading filesystem-based settings. 'user' - Global user settings (~/.claude/settings.json). 'project' - Project settings (.claude/settings.json). 'local' - Local settings (.claude/settings.local.json). */
|
|
1542
|
+
export type SettingSource = "user" | "project" | "local"
|
|
1543
|
+
|
|
1544
|
+
/** Configuration for loading a plugin. */
|
|
1545
|
+
export type SdkPluginConfig = {
|
|
1546
|
+
type: "local"
|
|
1547
|
+
path: string
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
/** Result of a rewindFiles operation. */
|
|
1551
|
+
export type RewindFilesResult = {
|
|
1552
|
+
canRewind: boolean
|
|
1553
|
+
error?: string
|
|
1554
|
+
filesChanged?: string[]
|
|
1555
|
+
insertions?: number
|
|
1556
|
+
deletions?: number
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
export type SDKAssistantMessageError = "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
1560
|
+
|
|
1561
|
+
export type SDKStatus = "compacting" | null
|
|
1562
|
+
|
|
1563
|
+
export type SDKUserMessage = {
|
|
1564
|
+
type: "user"
|
|
1565
|
+
message: Record<string, unknown> & { role: "user", content: string | Array<unknown> }
|
|
1566
|
+
parent_tool_use_id: string | null
|
|
1567
|
+
isSynthetic?: boolean
|
|
1568
|
+
tool_use_result?: unknown
|
|
1569
|
+
priority?: "now" | "next" | "later"
|
|
1570
|
+
timestamp?: string
|
|
1571
|
+
uuid?: string
|
|
1572
|
+
session_id?: string
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
export type SDKUserMessageReplay = {
|
|
1576
|
+
type: "user"
|
|
1577
|
+
message: Record<string, unknown> & { role: "user", content: string | Array<unknown> }
|
|
1578
|
+
parent_tool_use_id: string | null
|
|
1579
|
+
isSynthetic?: boolean
|
|
1580
|
+
tool_use_result?: unknown
|
|
1581
|
+
priority?: "now" | "next" | "later"
|
|
1582
|
+
timestamp?: string
|
|
1583
|
+
uuid: string
|
|
1584
|
+
session_id: string
|
|
1585
|
+
isReplay: true
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/** Rate limit information for claude.ai subscription users. */
|
|
1589
|
+
export type SDKRateLimitInfo = {
|
|
1590
|
+
status: "allowed" | "allowed_warning" | "rejected"
|
|
1591
|
+
resetsAt?: number
|
|
1592
|
+
rateLimitType?: "five_hour" | "seven_day" | "seven_day_opus" | "seven_day_sonnet" | "overage"
|
|
1593
|
+
utilization?: number
|
|
1594
|
+
overageStatus?: "allowed" | "allowed_warning" | "rejected"
|
|
1595
|
+
overageResetsAt?: number
|
|
1596
|
+
overageDisabledReason?: "overage_not_provisioned" | "org_level_disabled" | "org_level_disabled_until" | "out_of_credits" | "seat_tier_level_disabled" | "member_level_disabled" | "seat_tier_zero_credit_limit" | "group_zero_credit_limit" | "member_zero_credit_limit" | "org_service_level_disabled" | "org_service_zero_credit_limit" | "no_limits_configured" | "unknown"
|
|
1597
|
+
isUsingOverage?: boolean
|
|
1598
|
+
surpassedThreshold?: number
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
export type SDKAssistantMessage = {
|
|
1602
|
+
type: "assistant"
|
|
1603
|
+
message: Record<string, unknown> & { role: "assistant", content: Array<unknown> }
|
|
1604
|
+
parent_tool_use_id: string | null
|
|
1605
|
+
error?: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
1606
|
+
uuid: string
|
|
1607
|
+
session_id: string
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/** Rate limit event emitted when rate limit info changes. */
|
|
1611
|
+
export type SDKRateLimitEvent = {
|
|
1612
|
+
type: "rate_limit_event"
|
|
1613
|
+
rate_limit_info: {
|
|
1614
|
+
status: "allowed" | "allowed_warning" | "rejected"
|
|
1615
|
+
resetsAt?: number
|
|
1616
|
+
rateLimitType?: "five_hour" | "seven_day" | "seven_day_opus" | "seven_day_sonnet" | "overage"
|
|
1617
|
+
utilization?: number
|
|
1618
|
+
overageStatus?: "allowed" | "allowed_warning" | "rejected"
|
|
1619
|
+
overageResetsAt?: number
|
|
1620
|
+
overageDisabledReason?: "overage_not_provisioned" | "org_level_disabled" | "org_level_disabled_until" | "out_of_credits" | "seat_tier_level_disabled" | "member_level_disabled" | "seat_tier_zero_credit_limit" | "group_zero_credit_limit" | "member_zero_credit_limit" | "org_service_level_disabled" | "org_service_zero_credit_limit" | "no_limits_configured" | "unknown"
|
|
1621
|
+
isUsingOverage?: boolean
|
|
1622
|
+
surpassedThreshold?: number
|
|
1623
|
+
}
|
|
1624
|
+
uuid: string
|
|
1625
|
+
session_id: string
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
/** @internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed. */
|
|
1629
|
+
export type SDKStreamlinedTextMessage = {
|
|
1630
|
+
type: "streamlined_text"
|
|
1631
|
+
text: string
|
|
1632
|
+
session_id: string
|
|
1633
|
+
uuid: string
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
/** @internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string. */
|
|
1637
|
+
export type SDKStreamlinedToolUseSummaryMessage = {
|
|
1638
|
+
type: "streamlined_tool_use_summary"
|
|
1639
|
+
tool_summary: string
|
|
1640
|
+
session_id: string
|
|
1641
|
+
uuid: string
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
export type SDKPermissionDenial = {
|
|
1645
|
+
tool_name: string
|
|
1646
|
+
tool_use_id: string
|
|
1647
|
+
tool_input: Record<string, unknown>
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
export type SDKResultSuccess = {
|
|
1651
|
+
type: "result"
|
|
1652
|
+
subtype: "success"
|
|
1653
|
+
duration_ms: number
|
|
1654
|
+
duration_api_ms: number
|
|
1655
|
+
is_error: boolean
|
|
1656
|
+
num_turns: number
|
|
1657
|
+
result: string
|
|
1658
|
+
stop_reason: string | null
|
|
1659
|
+
total_cost_usd: number
|
|
1660
|
+
usage: Record<string, number>
|
|
1661
|
+
modelUsage: Record<string, {
|
|
1662
|
+
inputTokens: number
|
|
1663
|
+
outputTokens: number
|
|
1664
|
+
cacheReadInputTokens: number
|
|
1665
|
+
cacheCreationInputTokens: number
|
|
1666
|
+
webSearchRequests: number
|
|
1667
|
+
costUSD: number
|
|
1668
|
+
contextWindow: number
|
|
1669
|
+
maxOutputTokens: number
|
|
1670
|
+
}>
|
|
1671
|
+
permission_denials: {
|
|
1672
|
+
tool_name: string
|
|
1673
|
+
tool_use_id: string
|
|
1674
|
+
tool_input: Record<string, unknown>
|
|
1675
|
+
}[]
|
|
1676
|
+
structured_output?: unknown
|
|
1677
|
+
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1678
|
+
uuid: string
|
|
1679
|
+
session_id: string
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
export type SDKResultError = {
|
|
1683
|
+
type: "result"
|
|
1684
|
+
subtype: "error_during_execution" | "error_max_turns" | "error_max_budget_usd" | "error_max_structured_output_retries"
|
|
1685
|
+
duration_ms: number
|
|
1686
|
+
duration_api_ms: number
|
|
1687
|
+
is_error: boolean
|
|
1688
|
+
num_turns: number
|
|
1689
|
+
stop_reason: string | null
|
|
1690
|
+
total_cost_usd: number
|
|
1691
|
+
usage: Record<string, number>
|
|
1692
|
+
modelUsage: Record<string, {
|
|
1693
|
+
inputTokens: number
|
|
1694
|
+
outputTokens: number
|
|
1695
|
+
cacheReadInputTokens: number
|
|
1696
|
+
cacheCreationInputTokens: number
|
|
1697
|
+
webSearchRequests: number
|
|
1698
|
+
costUSD: number
|
|
1699
|
+
contextWindow: number
|
|
1700
|
+
maxOutputTokens: number
|
|
1701
|
+
}>
|
|
1702
|
+
permission_denials: {
|
|
1703
|
+
tool_name: string
|
|
1704
|
+
tool_use_id: string
|
|
1705
|
+
tool_input: Record<string, unknown>
|
|
1706
|
+
}[]
|
|
1707
|
+
errors: string[]
|
|
1708
|
+
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1709
|
+
uuid: string
|
|
1710
|
+
session_id: string
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
export type SDKResultMessage = ({
|
|
1714
|
+
type: "result"
|
|
1715
|
+
subtype: "success"
|
|
1716
|
+
duration_ms: number
|
|
1717
|
+
duration_api_ms: number
|
|
1718
|
+
is_error: boolean
|
|
1719
|
+
num_turns: number
|
|
1720
|
+
result: string
|
|
1721
|
+
stop_reason: string | null
|
|
1722
|
+
total_cost_usd: number
|
|
1723
|
+
usage: Record<string, number>
|
|
1724
|
+
modelUsage: Record<string, {
|
|
1725
|
+
inputTokens: number
|
|
1726
|
+
outputTokens: number
|
|
1727
|
+
cacheReadInputTokens: number
|
|
1728
|
+
cacheCreationInputTokens: number
|
|
1729
|
+
webSearchRequests: number
|
|
1730
|
+
costUSD: number
|
|
1731
|
+
contextWindow: number
|
|
1732
|
+
maxOutputTokens: number
|
|
1733
|
+
}>
|
|
1734
|
+
permission_denials: {
|
|
1735
|
+
tool_name: string
|
|
1736
|
+
tool_use_id: string
|
|
1737
|
+
tool_input: Record<string, unknown>
|
|
1738
|
+
}[]
|
|
1739
|
+
structured_output?: unknown
|
|
1740
|
+
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1741
|
+
uuid: string
|
|
1742
|
+
session_id: string
|
|
1743
|
+
}) | ({
|
|
1744
|
+
type: "result"
|
|
1745
|
+
subtype: "error_during_execution" | "error_max_turns" | "error_max_budget_usd" | "error_max_structured_output_retries"
|
|
1746
|
+
duration_ms: number
|
|
1747
|
+
duration_api_ms: number
|
|
1748
|
+
is_error: boolean
|
|
1749
|
+
num_turns: number
|
|
1750
|
+
stop_reason: string | null
|
|
1751
|
+
total_cost_usd: number
|
|
1752
|
+
usage: Record<string, number>
|
|
1753
|
+
modelUsage: Record<string, {
|
|
1754
|
+
inputTokens: number
|
|
1755
|
+
outputTokens: number
|
|
1756
|
+
cacheReadInputTokens: number
|
|
1757
|
+
cacheCreationInputTokens: number
|
|
1758
|
+
webSearchRequests: number
|
|
1759
|
+
costUSD: number
|
|
1760
|
+
contextWindow: number
|
|
1761
|
+
maxOutputTokens: number
|
|
1762
|
+
}>
|
|
1763
|
+
permission_denials: {
|
|
1764
|
+
tool_name: string
|
|
1765
|
+
tool_use_id: string
|
|
1766
|
+
tool_input: Record<string, unknown>
|
|
1767
|
+
}[]
|
|
1768
|
+
errors: string[]
|
|
1769
|
+
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1770
|
+
uuid: string
|
|
1771
|
+
session_id: string
|
|
1772
|
+
})
|
|
1773
|
+
|
|
1774
|
+
export type SDKSystemMessage = {
|
|
1775
|
+
type: "system"
|
|
1776
|
+
subtype: "init"
|
|
1777
|
+
agents?: string[]
|
|
1778
|
+
apiKeySource: "user" | "project" | "org" | "temporary" | "oauth" | "none"
|
|
1779
|
+
betas?: string[]
|
|
1780
|
+
claude_code_version: string
|
|
1781
|
+
cwd: string
|
|
1782
|
+
tools: string[]
|
|
1783
|
+
mcp_servers: {
|
|
1784
|
+
name: string
|
|
1785
|
+
status: string
|
|
1786
|
+
}[]
|
|
1787
|
+
model: string
|
|
1788
|
+
permissionMode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1789
|
+
slash_commands: string[]
|
|
1790
|
+
output_style: string
|
|
1791
|
+
skills: string[]
|
|
1792
|
+
plugins: {
|
|
1793
|
+
name: string
|
|
1794
|
+
path: string
|
|
1795
|
+
source?: string
|
|
1796
|
+
}[]
|
|
1797
|
+
fast_mode_state?: "off" | "cooldown" | "on"
|
|
1798
|
+
uuid: string
|
|
1799
|
+
session_id: string
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
export type SDKPartialAssistantMessage = {
|
|
1803
|
+
type: "stream_event"
|
|
1804
|
+
event: Record<string, unknown>
|
|
1805
|
+
parent_tool_use_id: string | null
|
|
1806
|
+
uuid: string
|
|
1807
|
+
session_id: string
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
export type SDKCompactBoundaryMessage = {
|
|
1811
|
+
type: "system"
|
|
1812
|
+
subtype: "compact_boundary"
|
|
1813
|
+
compact_metadata: {
|
|
1814
|
+
trigger: "manual" | "auto"
|
|
1815
|
+
pre_tokens: number
|
|
1816
|
+
preserved_segment?: {
|
|
1817
|
+
head_uuid: string
|
|
1818
|
+
anchor_uuid: string
|
|
1819
|
+
tail_uuid: string
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
uuid: string
|
|
1823
|
+
session_id: string
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
export type SDKStatusMessage = {
|
|
1827
|
+
type: "system"
|
|
1828
|
+
subtype: "status"
|
|
1829
|
+
status: "compacting" | null
|
|
1830
|
+
permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
1831
|
+
uuid: string
|
|
1832
|
+
session_id: string
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
/** @internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes. */
|
|
1836
|
+
export type SDKPostTurnSummaryMessage = {
|
|
1837
|
+
type: "system"
|
|
1838
|
+
subtype: "post_turn_summary"
|
|
1839
|
+
summarizes_uuid: string
|
|
1840
|
+
status_category: "blocked" | "waiting" | "completed" | "review_ready" | "failed"
|
|
1841
|
+
status_detail: string
|
|
1842
|
+
is_noteworthy: boolean
|
|
1843
|
+
title: string
|
|
1844
|
+
description: string
|
|
1845
|
+
recent_action: string
|
|
1846
|
+
needs_action: string
|
|
1847
|
+
artifact_urls: string[]
|
|
1848
|
+
uuid: string
|
|
1849
|
+
session_id: string
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
/** Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response. */
|
|
1853
|
+
export type SDKAPIRetryMessage = {
|
|
1854
|
+
type: "system"
|
|
1855
|
+
subtype: "api_retry"
|
|
1856
|
+
attempt: number
|
|
1857
|
+
max_retries: number
|
|
1858
|
+
retry_delay_ms: number
|
|
1859
|
+
error_status: number | null
|
|
1860
|
+
error: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
1861
|
+
uuid: string
|
|
1862
|
+
session_id: string
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/** Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript. */
|
|
1866
|
+
export type SDKLocalCommandOutputMessage = {
|
|
1867
|
+
type: "system"
|
|
1868
|
+
subtype: "local_command_output"
|
|
1869
|
+
content: string
|
|
1870
|
+
uuid: string
|
|
1871
|
+
session_id: string
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
export type SDKHookStartedMessage = {
|
|
1875
|
+
type: "system"
|
|
1876
|
+
subtype: "hook_started"
|
|
1877
|
+
hook_id: string
|
|
1878
|
+
hook_name: string
|
|
1879
|
+
hook_event: string
|
|
1880
|
+
uuid: string
|
|
1881
|
+
session_id: string
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
export type SDKHookProgressMessage = {
|
|
1885
|
+
type: "system"
|
|
1886
|
+
subtype: "hook_progress"
|
|
1887
|
+
hook_id: string
|
|
1888
|
+
hook_name: string
|
|
1889
|
+
hook_event: string
|
|
1890
|
+
stdout: string
|
|
1891
|
+
stderr: string
|
|
1892
|
+
output: string
|
|
1893
|
+
uuid: string
|
|
1894
|
+
session_id: string
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
export type SDKHookResponseMessage = {
|
|
1898
|
+
type: "system"
|
|
1899
|
+
subtype: "hook_response"
|
|
1900
|
+
hook_id: string
|
|
1901
|
+
hook_name: string
|
|
1902
|
+
hook_event: string
|
|
1903
|
+
output: string
|
|
1904
|
+
stdout: string
|
|
1905
|
+
stderr: string
|
|
1906
|
+
exit_code?: number
|
|
1907
|
+
outcome: "success" | "error" | "cancelled"
|
|
1908
|
+
uuid: string
|
|
1909
|
+
session_id: string
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
export type SDKToolProgressMessage = {
|
|
1913
|
+
type: "tool_progress"
|
|
1914
|
+
tool_use_id: string
|
|
1915
|
+
tool_name: string
|
|
1916
|
+
parent_tool_use_id: string | null
|
|
1917
|
+
elapsed_time_seconds: number
|
|
1918
|
+
task_id?: string
|
|
1919
|
+
uuid: string
|
|
1920
|
+
session_id: string
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
export type SDKAuthStatusMessage = {
|
|
1924
|
+
type: "auth_status"
|
|
1925
|
+
isAuthenticating: boolean
|
|
1926
|
+
output: string[]
|
|
1927
|
+
error?: string
|
|
1928
|
+
uuid: string
|
|
1929
|
+
session_id: string
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
export type SDKFilesPersistedEvent = {
|
|
1933
|
+
type: "system"
|
|
1934
|
+
subtype: "files_persisted"
|
|
1935
|
+
files: {
|
|
1936
|
+
filename: string
|
|
1937
|
+
file_id: string
|
|
1938
|
+
}[]
|
|
1939
|
+
failed: {
|
|
1940
|
+
filename: string
|
|
1941
|
+
error: string
|
|
1942
|
+
}[]
|
|
1943
|
+
processed_at: string
|
|
1944
|
+
uuid: string
|
|
1945
|
+
session_id: string
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
export type SDKTaskNotificationMessage = {
|
|
1949
|
+
type: "system"
|
|
1950
|
+
subtype: "task_notification"
|
|
1951
|
+
task_id: string
|
|
1952
|
+
tool_use_id?: string
|
|
1953
|
+
status: "completed" | "failed" | "stopped"
|
|
1954
|
+
output_file: string
|
|
1955
|
+
summary: string
|
|
1956
|
+
usage?: {
|
|
1957
|
+
total_tokens: number
|
|
1958
|
+
tool_uses: number
|
|
1959
|
+
duration_ms: number
|
|
1960
|
+
}
|
|
1961
|
+
uuid: string
|
|
1962
|
+
session_id: string
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
export type SDKTaskStartedMessage = {
|
|
1966
|
+
type: "system"
|
|
1967
|
+
subtype: "task_started"
|
|
1968
|
+
task_id: string
|
|
1969
|
+
tool_use_id?: string
|
|
1970
|
+
description: string
|
|
1971
|
+
task_type?: string
|
|
1972
|
+
workflow_name?: string
|
|
1973
|
+
prompt?: string
|
|
1974
|
+
uuid: string
|
|
1975
|
+
session_id: string
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
export type SDKTaskProgressMessage = {
|
|
1979
|
+
type: "system"
|
|
1980
|
+
subtype: "task_progress"
|
|
1981
|
+
task_id: string
|
|
1982
|
+
tool_use_id?: string
|
|
1983
|
+
description: string
|
|
1984
|
+
usage: {
|
|
1985
|
+
total_tokens: number
|
|
1986
|
+
tool_uses: number
|
|
1987
|
+
duration_ms: number
|
|
1988
|
+
}
|
|
1989
|
+
last_tool_name?: string
|
|
1990
|
+
summary?: string
|
|
1991
|
+
uuid: string
|
|
1992
|
+
session_id: string
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
/** Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal. */
|
|
1996
|
+
export type SDKSessionStateChangedMessage = {
|
|
1997
|
+
type: "system"
|
|
1998
|
+
subtype: "session_state_changed"
|
|
1999
|
+
state: "idle" | "running" | "requires_action"
|
|
2000
|
+
uuid: string
|
|
2001
|
+
session_id: string
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
export type SDKToolUseSummaryMessage = {
|
|
2005
|
+
type: "tool_use_summary"
|
|
2006
|
+
summary: string
|
|
2007
|
+
preceding_tool_use_ids: string[]
|
|
2008
|
+
uuid: string
|
|
2009
|
+
session_id: string
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
/** Emitted when an MCP server confirms that a URL-mode elicitation is complete. */
|
|
2013
|
+
export type SDKElicitationCompleteMessage = {
|
|
2014
|
+
type: "system"
|
|
2015
|
+
subtype: "elicitation_complete"
|
|
2016
|
+
mcp_server_name: string
|
|
2017
|
+
elicitation_id: string
|
|
2018
|
+
uuid: string
|
|
2019
|
+
session_id: string
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
/** Predicted next user prompt, emitted after each turn when promptSuggestions is enabled. */
|
|
2023
|
+
export type SDKPromptSuggestionMessage = {
|
|
2024
|
+
type: "prompt_suggestion"
|
|
2025
|
+
suggestion: string
|
|
2026
|
+
uuid: string
|
|
2027
|
+
session_id: string
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
/** Session metadata returned by listSessions and getSessionInfo. */
|
|
2031
|
+
export type SDKSessionInfo = {
|
|
2032
|
+
sessionId: string
|
|
2033
|
+
summary: string
|
|
2034
|
+
lastModified: number
|
|
2035
|
+
fileSize?: number
|
|
2036
|
+
customTitle?: string
|
|
2037
|
+
firstPrompt?: string
|
|
2038
|
+
gitBranch?: string
|
|
2039
|
+
cwd?: string
|
|
2040
|
+
tag?: string
|
|
2041
|
+
createdAt?: number
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
export type SDKMessage = ({
|
|
2045
|
+
type: "assistant"
|
|
2046
|
+
message: Record<string, unknown> & { role: "assistant", content: Array<unknown> }
|
|
2047
|
+
parent_tool_use_id: string | null
|
|
2048
|
+
error?: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
2049
|
+
uuid: string
|
|
2050
|
+
session_id: string
|
|
2051
|
+
}) | ({
|
|
2052
|
+
type: "user"
|
|
2053
|
+
message: Record<string, unknown> & { role: "user", content: string | Array<unknown> }
|
|
2054
|
+
parent_tool_use_id: string | null
|
|
2055
|
+
isSynthetic?: boolean
|
|
2056
|
+
tool_use_result?: unknown
|
|
2057
|
+
priority?: "now" | "next" | "later"
|
|
2058
|
+
timestamp?: string
|
|
2059
|
+
uuid?: string
|
|
2060
|
+
session_id?: string
|
|
2061
|
+
}) | ({
|
|
2062
|
+
type: "user"
|
|
2063
|
+
message: Record<string, unknown> & { role: "user", content: string | Array<unknown> }
|
|
2064
|
+
parent_tool_use_id: string | null
|
|
2065
|
+
isSynthetic?: boolean
|
|
2066
|
+
tool_use_result?: unknown
|
|
2067
|
+
priority?: "now" | "next" | "later"
|
|
2068
|
+
timestamp?: string
|
|
2069
|
+
uuid: string
|
|
2070
|
+
session_id: string
|
|
2071
|
+
isReplay: true
|
|
2072
|
+
}) | (({
|
|
2073
|
+
type: "result"
|
|
2074
|
+
subtype: "success"
|
|
2075
|
+
duration_ms: number
|
|
2076
|
+
duration_api_ms: number
|
|
2077
|
+
is_error: boolean
|
|
2078
|
+
num_turns: number
|
|
2079
|
+
result: string
|
|
2080
|
+
stop_reason: string | null
|
|
2081
|
+
total_cost_usd: number
|
|
2082
|
+
usage: Record<string, number>
|
|
2083
|
+
modelUsage: Record<string, {
|
|
2084
|
+
inputTokens: number
|
|
2085
|
+
outputTokens: number
|
|
2086
|
+
cacheReadInputTokens: number
|
|
2087
|
+
cacheCreationInputTokens: number
|
|
2088
|
+
webSearchRequests: number
|
|
2089
|
+
costUSD: number
|
|
2090
|
+
contextWindow: number
|
|
2091
|
+
maxOutputTokens: number
|
|
2092
|
+
}>
|
|
2093
|
+
permission_denials: {
|
|
2094
|
+
tool_name: string
|
|
2095
|
+
tool_use_id: string
|
|
2096
|
+
tool_input: Record<string, unknown>
|
|
2097
|
+
}[]
|
|
2098
|
+
structured_output?: unknown
|
|
2099
|
+
fast_mode_state?: "off" | "cooldown" | "on"
|
|
2100
|
+
uuid: string
|
|
2101
|
+
session_id: string
|
|
2102
|
+
}) | ({
|
|
2103
|
+
type: "result"
|
|
2104
|
+
subtype: "error_during_execution" | "error_max_turns" | "error_max_budget_usd" | "error_max_structured_output_retries"
|
|
2105
|
+
duration_ms: number
|
|
2106
|
+
duration_api_ms: number
|
|
2107
|
+
is_error: boolean
|
|
2108
|
+
num_turns: number
|
|
2109
|
+
stop_reason: string | null
|
|
2110
|
+
total_cost_usd: number
|
|
2111
|
+
usage: Record<string, number>
|
|
2112
|
+
modelUsage: Record<string, {
|
|
2113
|
+
inputTokens: number
|
|
2114
|
+
outputTokens: number
|
|
2115
|
+
cacheReadInputTokens: number
|
|
2116
|
+
cacheCreationInputTokens: number
|
|
2117
|
+
webSearchRequests: number
|
|
2118
|
+
costUSD: number
|
|
2119
|
+
contextWindow: number
|
|
2120
|
+
maxOutputTokens: number
|
|
2121
|
+
}>
|
|
2122
|
+
permission_denials: {
|
|
2123
|
+
tool_name: string
|
|
2124
|
+
tool_use_id: string
|
|
2125
|
+
tool_input: Record<string, unknown>
|
|
2126
|
+
}[]
|
|
2127
|
+
errors: string[]
|
|
2128
|
+
fast_mode_state?: "off" | "cooldown" | "on"
|
|
2129
|
+
uuid: string
|
|
2130
|
+
session_id: string
|
|
2131
|
+
})) | ({
|
|
2132
|
+
type: "system"
|
|
2133
|
+
subtype: "init"
|
|
2134
|
+
agents?: string[]
|
|
2135
|
+
apiKeySource: "user" | "project" | "org" | "temporary" | "oauth" | "none"
|
|
2136
|
+
betas?: string[]
|
|
2137
|
+
claude_code_version: string
|
|
2138
|
+
cwd: string
|
|
2139
|
+
tools: string[]
|
|
2140
|
+
mcp_servers: {
|
|
2141
|
+
name: string
|
|
2142
|
+
status: string
|
|
2143
|
+
}[]
|
|
2144
|
+
model: string
|
|
2145
|
+
permissionMode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
2146
|
+
slash_commands: string[]
|
|
2147
|
+
output_style: string
|
|
2148
|
+
skills: string[]
|
|
2149
|
+
plugins: {
|
|
2150
|
+
name: string
|
|
2151
|
+
path: string
|
|
2152
|
+
source?: string
|
|
2153
|
+
}[]
|
|
2154
|
+
fast_mode_state?: "off" | "cooldown" | "on"
|
|
2155
|
+
uuid: string
|
|
2156
|
+
session_id: string
|
|
2157
|
+
}) | ({
|
|
2158
|
+
type: "stream_event"
|
|
2159
|
+
event: Record<string, unknown>
|
|
2160
|
+
parent_tool_use_id: string | null
|
|
2161
|
+
uuid: string
|
|
2162
|
+
session_id: string
|
|
2163
|
+
}) | ({
|
|
2164
|
+
type: "system"
|
|
2165
|
+
subtype: "compact_boundary"
|
|
2166
|
+
compact_metadata: {
|
|
2167
|
+
trigger: "manual" | "auto"
|
|
2168
|
+
pre_tokens: number
|
|
2169
|
+
preserved_segment?: {
|
|
2170
|
+
head_uuid: string
|
|
2171
|
+
anchor_uuid: string
|
|
2172
|
+
tail_uuid: string
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
uuid: string
|
|
2176
|
+
session_id: string
|
|
2177
|
+
}) | ({
|
|
2178
|
+
type: "system"
|
|
2179
|
+
subtype: "status"
|
|
2180
|
+
status: "compacting" | null
|
|
2181
|
+
permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk"
|
|
2182
|
+
uuid: string
|
|
2183
|
+
session_id: string
|
|
2184
|
+
}) | ({
|
|
2185
|
+
type: "system"
|
|
2186
|
+
subtype: "api_retry"
|
|
2187
|
+
attempt: number
|
|
2188
|
+
max_retries: number
|
|
2189
|
+
retry_delay_ms: number
|
|
2190
|
+
error_status: number | null
|
|
2191
|
+
error: "authentication_failed" | "billing_error" | "rate_limit" | "invalid_request" | "server_error" | "unknown" | "max_output_tokens"
|
|
2192
|
+
uuid: string
|
|
2193
|
+
session_id: string
|
|
2194
|
+
}) | ({
|
|
2195
|
+
type: "system"
|
|
2196
|
+
subtype: "local_command_output"
|
|
2197
|
+
content: string
|
|
2198
|
+
uuid: string
|
|
2199
|
+
session_id: string
|
|
2200
|
+
}) | ({
|
|
2201
|
+
type: "system"
|
|
2202
|
+
subtype: "hook_started"
|
|
2203
|
+
hook_id: string
|
|
2204
|
+
hook_name: string
|
|
2205
|
+
hook_event: string
|
|
2206
|
+
uuid: string
|
|
2207
|
+
session_id: string
|
|
2208
|
+
}) | ({
|
|
2209
|
+
type: "system"
|
|
2210
|
+
subtype: "hook_progress"
|
|
2211
|
+
hook_id: string
|
|
2212
|
+
hook_name: string
|
|
2213
|
+
hook_event: string
|
|
2214
|
+
stdout: string
|
|
2215
|
+
stderr: string
|
|
2216
|
+
output: string
|
|
2217
|
+
uuid: string
|
|
2218
|
+
session_id: string
|
|
2219
|
+
}) | ({
|
|
2220
|
+
type: "system"
|
|
2221
|
+
subtype: "hook_response"
|
|
2222
|
+
hook_id: string
|
|
2223
|
+
hook_name: string
|
|
2224
|
+
hook_event: string
|
|
2225
|
+
output: string
|
|
2226
|
+
stdout: string
|
|
2227
|
+
stderr: string
|
|
2228
|
+
exit_code?: number
|
|
2229
|
+
outcome: "success" | "error" | "cancelled"
|
|
2230
|
+
uuid: string
|
|
2231
|
+
session_id: string
|
|
2232
|
+
}) | ({
|
|
2233
|
+
type: "tool_progress"
|
|
2234
|
+
tool_use_id: string
|
|
2235
|
+
tool_name: string
|
|
2236
|
+
parent_tool_use_id: string | null
|
|
2237
|
+
elapsed_time_seconds: number
|
|
2238
|
+
task_id?: string
|
|
2239
|
+
uuid: string
|
|
2240
|
+
session_id: string
|
|
2241
|
+
}) | ({
|
|
2242
|
+
type: "auth_status"
|
|
2243
|
+
isAuthenticating: boolean
|
|
2244
|
+
output: string[]
|
|
2245
|
+
error?: string
|
|
2246
|
+
uuid: string
|
|
2247
|
+
session_id: string
|
|
2248
|
+
}) | ({
|
|
2249
|
+
type: "system"
|
|
2250
|
+
subtype: "task_notification"
|
|
2251
|
+
task_id: string
|
|
2252
|
+
tool_use_id?: string
|
|
2253
|
+
status: "completed" | "failed" | "stopped"
|
|
2254
|
+
output_file: string
|
|
2255
|
+
summary: string
|
|
2256
|
+
usage?: {
|
|
2257
|
+
total_tokens: number
|
|
2258
|
+
tool_uses: number
|
|
2259
|
+
duration_ms: number
|
|
2260
|
+
}
|
|
2261
|
+
uuid: string
|
|
2262
|
+
session_id: string
|
|
2263
|
+
}) | ({
|
|
2264
|
+
type: "system"
|
|
2265
|
+
subtype: "task_started"
|
|
2266
|
+
task_id: string
|
|
2267
|
+
tool_use_id?: string
|
|
2268
|
+
description: string
|
|
2269
|
+
task_type?: string
|
|
2270
|
+
workflow_name?: string
|
|
2271
|
+
prompt?: string
|
|
2272
|
+
uuid: string
|
|
2273
|
+
session_id: string
|
|
2274
|
+
}) | ({
|
|
2275
|
+
type: "system"
|
|
2276
|
+
subtype: "task_progress"
|
|
2277
|
+
task_id: string
|
|
2278
|
+
tool_use_id?: string
|
|
2279
|
+
description: string
|
|
2280
|
+
usage: {
|
|
2281
|
+
total_tokens: number
|
|
2282
|
+
tool_uses: number
|
|
2283
|
+
duration_ms: number
|
|
2284
|
+
}
|
|
2285
|
+
last_tool_name?: string
|
|
2286
|
+
summary?: string
|
|
2287
|
+
uuid: string
|
|
2288
|
+
session_id: string
|
|
2289
|
+
}) | ({
|
|
2290
|
+
type: "system"
|
|
2291
|
+
subtype: "session_state_changed"
|
|
2292
|
+
state: "idle" | "running" | "requires_action"
|
|
2293
|
+
uuid: string
|
|
2294
|
+
session_id: string
|
|
2295
|
+
}) | ({
|
|
2296
|
+
type: "system"
|
|
2297
|
+
subtype: "files_persisted"
|
|
2298
|
+
files: {
|
|
2299
|
+
filename: string
|
|
2300
|
+
file_id: string
|
|
2301
|
+
}[]
|
|
2302
|
+
failed: {
|
|
2303
|
+
filename: string
|
|
2304
|
+
error: string
|
|
2305
|
+
}[]
|
|
2306
|
+
processed_at: string
|
|
2307
|
+
uuid: string
|
|
2308
|
+
session_id: string
|
|
2309
|
+
}) | ({
|
|
2310
|
+
type: "tool_use_summary"
|
|
2311
|
+
summary: string
|
|
2312
|
+
preceding_tool_use_ids: string[]
|
|
2313
|
+
uuid: string
|
|
2314
|
+
session_id: string
|
|
2315
|
+
}) | ({
|
|
2316
|
+
type: "rate_limit_event"
|
|
2317
|
+
rate_limit_info: {
|
|
2318
|
+
status: "allowed" | "allowed_warning" | "rejected"
|
|
2319
|
+
resetsAt?: number
|
|
2320
|
+
rateLimitType?: "five_hour" | "seven_day" | "seven_day_opus" | "seven_day_sonnet" | "overage"
|
|
2321
|
+
utilization?: number
|
|
2322
|
+
overageStatus?: "allowed" | "allowed_warning" | "rejected"
|
|
2323
|
+
overageResetsAt?: number
|
|
2324
|
+
overageDisabledReason?: "overage_not_provisioned" | "org_level_disabled" | "org_level_disabled_until" | "out_of_credits" | "seat_tier_level_disabled" | "member_level_disabled" | "seat_tier_zero_credit_limit" | "group_zero_credit_limit" | "member_zero_credit_limit" | "org_service_level_disabled" | "org_service_zero_credit_limit" | "no_limits_configured" | "unknown"
|
|
2325
|
+
isUsingOverage?: boolean
|
|
2326
|
+
surpassedThreshold?: number
|
|
2327
|
+
}
|
|
2328
|
+
uuid: string
|
|
2329
|
+
session_id: string
|
|
2330
|
+
}) | ({
|
|
2331
|
+
type: "system"
|
|
2332
|
+
subtype: "elicitation_complete"
|
|
2333
|
+
mcp_server_name: string
|
|
2334
|
+
elicitation_id: string
|
|
2335
|
+
uuid: string
|
|
2336
|
+
session_id: string
|
|
2337
|
+
}) | ({
|
|
2338
|
+
type: "prompt_suggestion"
|
|
2339
|
+
suggestion: string
|
|
2340
|
+
uuid: string
|
|
2341
|
+
session_id: string
|
|
2342
|
+
}) | ({
|
|
2343
|
+
type: "permission_request"
|
|
2344
|
+
request_id: string
|
|
2345
|
+
tool_name: string
|
|
2346
|
+
tool_use_id: string
|
|
2347
|
+
input: Record<string, unknown>
|
|
2348
|
+
uuid: string
|
|
2349
|
+
session_id: string
|
|
2350
|
+
})
|
|
2351
|
+
|
|
2352
|
+
/** Fast mode state: off, in cooldown after rate limit, or actively enabled. */
|
|
2353
|
+
export type FastModeState = "off" | "cooldown" | "on"
|
|
2354
|
+
|
|
2355
|
+
export type ExitReason = "clear" | "resume" | "logout" | "prompt_input_exit" | "other" | "bypass_permissions_disabled"
|