codeforge-dev 1.5.8 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/.devcontainer/.env +4 -5
  2. package/.devcontainer/.env.example +29 -0
  3. package/.devcontainer/.gitignore +8 -0
  4. package/.devcontainer/.secrets.example +12 -0
  5. package/.devcontainer/CHANGELOG.md +186 -0
  6. package/.devcontainer/CLAUDE.md +108 -21
  7. package/.devcontainer/README.md +173 -57
  8. package/.devcontainer/config/defaults/keybindings.json +5 -0
  9. package/.devcontainer/config/{main-system-prompt.md → defaults/main-system-prompt.md} +135 -2
  10. package/.devcontainer/config/{settings.json → defaults/settings.json} +25 -6
  11. package/.devcontainer/config/file-manifest.json +20 -0
  12. package/.devcontainer/devcontainer.json +38 -2
  13. package/.devcontainer/docs/configuration-reference.md +90 -0
  14. package/.devcontainer/docs/keybindings.md +100 -0
  15. package/.devcontainer/docs/optional-features.md +129 -0
  16. package/.devcontainer/docs/plugins.md +154 -0
  17. package/.devcontainer/docs/troubleshooting.md +128 -0
  18. package/.devcontainer/features/README.md +21 -7
  19. package/.devcontainer/features/agent-browser/install.sh +6 -0
  20. package/.devcontainer/features/ast-grep/install.sh +6 -0
  21. package/.devcontainer/features/biome/README.md +27 -0
  22. package/.devcontainer/features/biome/install.sh +6 -0
  23. package/.devcontainer/features/ccburn/README.md +60 -0
  24. package/.devcontainer/features/ccburn/devcontainer-feature.json +38 -0
  25. package/.devcontainer/features/ccburn/install.sh +180 -0
  26. package/.devcontainer/features/ccstatusline/README.md +22 -21
  27. package/.devcontainer/features/ccstatusline/devcontainer-feature.json +6 -1
  28. package/.devcontainer/features/ccstatusline/install.sh +55 -16
  29. package/.devcontainer/features/ccusage/install.sh +6 -0
  30. package/.devcontainer/features/claude-monitor/install.sh +6 -0
  31. package/.devcontainer/features/dprint/README.md +30 -0
  32. package/.devcontainer/features/dprint/devcontainer-feature.json +18 -0
  33. package/.devcontainer/features/dprint/install.sh +131 -0
  34. package/.devcontainer/features/hadolint/README.md +35 -0
  35. package/.devcontainer/features/hadolint/devcontainer-feature.json +13 -0
  36. package/.devcontainer/features/hadolint/install.sh +86 -0
  37. package/.devcontainer/features/lsp-servers/devcontainer-feature.json +5 -0
  38. package/.devcontainer/features/lsp-servers/install.sh +7 -0
  39. package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +6 -1
  40. package/.devcontainer/features/mcp-qdrant/install.sh +13 -6
  41. package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +6 -1
  42. package/.devcontainer/features/mcp-reasoner/install.sh +8 -1
  43. package/.devcontainer/features/notify-hook/devcontainer-feature.json +5 -0
  44. package/.devcontainer/features/notify-hook/install.sh +7 -0
  45. package/.devcontainer/features/ruff/README.md +26 -0
  46. package/.devcontainer/features/ruff/devcontainer-feature.json +21 -0
  47. package/.devcontainer/features/ruff/install.sh +74 -0
  48. package/.devcontainer/features/shellcheck/README.md +38 -0
  49. package/.devcontainer/features/shellcheck/devcontainer-feature.json +13 -0
  50. package/.devcontainer/features/shellcheck/install.sh +24 -0
  51. package/.devcontainer/features/shfmt/README.md +37 -0
  52. package/.devcontainer/features/shfmt/devcontainer-feature.json +13 -0
  53. package/.devcontainer/features/shfmt/install.sh +85 -0
  54. package/.devcontainer/features/splitrail/devcontainer-feature.json +5 -0
  55. package/.devcontainer/features/splitrail/install.sh +7 -0
  56. package/.devcontainer/features/tmux/install.sh +8 -0
  57. package/.devcontainer/features/tree-sitter/install.sh +6 -0
  58. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +3 -10
  59. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +1 -1
  60. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
  61. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +133 -13
  62. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +1 -1
  63. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +4 -5
  64. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
  65. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +477 -78
  66. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/.claude-plugin/plugin.json +1 -1
  67. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/AGENT-REDIRECTION.md +226 -0
  68. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/REVIEW-RUBRIC.md +440 -0
  69. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +207 -0
  70. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/bash-exec.md +173 -0
  71. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/claude-guide.md +146 -0
  72. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +2 -0
  73. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +250 -0
  74. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +246 -0
  75. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +237 -0
  76. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +134 -0
  77. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/git-archaeologist.md +242 -0
  78. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +201 -0
  79. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/perf-profiler.md +265 -0
  80. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +213 -0
  81. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/researcher.md +195 -0
  82. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/security-auditor.md +289 -0
  83. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +297 -0
  84. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/statusline-config.md +188 -0
  85. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +248 -0
  86. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +51 -0
  87. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/advisory-test-runner.cpython-314.pyc +0 -0
  88. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/collect-edited-files.cpython-314.pyc +0 -0
  89. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/commit-reminder.cpython-314.pyc +0 -0
  90. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/git-state-injector.cpython-314.pyc +0 -0
  91. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/guard-readonly-bash.cpython-314.pyc +0 -0
  92. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/redirect-builtin-agents.cpython-314.pyc +0 -0
  93. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/skill-suggester.cpython-314.pyc +0 -0
  94. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/syntax-validator.cpython-314.pyc +0 -0
  95. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/ticket-linker.cpython-314.pyc +0 -0
  96. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/todo-harvester.cpython-314.pyc +0 -0
  97. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/verify-no-regression.cpython-314.pyc +0 -0
  98. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/verify-tests-pass.cpython-314.pyc +0 -0
  99. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/advisory-test-runner.py +174 -0
  100. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/collect-edited-files.py +8 -6
  101. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/commit-reminder.py +90 -0
  102. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/git-state-injector.py +114 -0
  103. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/guard-readonly-bash.py +611 -0
  104. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/redirect-builtin-agents.py +83 -0
  105. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/skill-suggester.py +146 -2
  106. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/syntax-validator.py +9 -4
  107. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/ticket-linker.py +137 -0
  108. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/todo-harvester.py +130 -0
  109. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/verify-no-regression.py +221 -0
  110. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/verify-tests-pass.py +176 -0
  111. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/SKILL.md +224 -0
  112. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/error-handling.md +166 -0
  113. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/rest-conventions.md +215 -0
  114. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/SKILL.md +211 -0
  115. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/references/language-patterns.md +327 -0
  116. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/claude-agent-sdk/SKILL.md +599 -0
  117. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/claude-agent-sdk/references/sdk-typescript-reference.md +954 -0
  118. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/SKILL.md +134 -0
  119. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/ecosystem-commands.md +264 -0
  120. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/license-compliance.md +80 -0
  121. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/SKILL.md +153 -0
  122. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/api-doc-templates.md +221 -0
  123. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/docstring-formats.md +296 -0
  124. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/SKILL.md +276 -0
  125. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/references/advanced-commands.md +332 -0
  126. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/references/investigation-playbooks.md +319 -0
  127. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/SKILL.md +150 -0
  128. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/javascript-migrations.md +179 -0
  129. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/python-migrations.md +141 -0
  130. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/SKILL.md +341 -0
  131. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/references/interpreting-results.md +235 -0
  132. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/references/tool-commands.md +395 -0
  133. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/SKILL.md +344 -0
  134. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/references/safe-transformations.md +247 -0
  135. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/references/smell-catalog.md +332 -0
  136. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/SKILL.md +277 -0
  137. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/references/owasp-patterns.md +269 -0
  138. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/references/secrets-patterns.md +253 -0
  139. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +320 -0
  140. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/references/criteria-patterns.md +245 -0
  141. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/references/ears-templates.md +239 -0
  142. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/__pycache__/block-dangerous.cpython-314.pyc +0 -0
  143. package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +1 -1
  144. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
  145. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected.py +40 -39
  146. package/.devcontainer/scripts/check-setup.sh +72 -0
  147. package/.devcontainer/scripts/setup-aliases.sh +51 -6
  148. package/.devcontainer/scripts/setup-auth.sh +74 -0
  149. package/.devcontainer/scripts/setup-config.sh +112 -20
  150. package/.devcontainer/scripts/setup-plugins.sh +38 -46
  151. package/.devcontainer/scripts/setup-projects.sh +175 -0
  152. package/.devcontainer/scripts/setup-symlink-claude.sh +36 -0
  153. package/.devcontainer/scripts/setup-update-claude.sh +19 -8
  154. package/.devcontainer/scripts/setup.sh +49 -14
  155. package/README.md +23 -190
  156. package/package.json +1 -1
  157. package/setup.js +245 -71
  158. package/.devcontainer/features/claude-code/README.md +0 -498
  159. package/.devcontainer/features/claude-code/config/settings.json +0 -36
  160. package/.devcontainer/features/claude-code/config/system-prompt.md +0 -118
  161. package/.devcontainer/features/claude-code/config/world-building-sp.md +0 -1432
  162. package/.devcontainer/features/claude-code/devcontainer-feature.json +0 -42
  163. package/.devcontainer/features/claude-code/install.sh +0 -466
  164. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/.claude-plugin/plugin.json +0 -7
  165. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/hooks/hooks.json +0 -17
  166. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/.claude-plugin/plugin.json +0 -6
  167. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/config/planning-instructions.md +0 -14
  168. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/functional-conjuring-map.md +0 -989
  169. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/hooks/hooks.json +0 -33
  170. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/__pycache__/post-enhance-task.cpython-314.pyc +0 -0
  171. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhance-planning.py +0 -71
  172. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-plan.sh +0 -68
  173. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-task.sh +0 -120
  174. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-plan.py +0 -133
  175. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-task.py +0 -253
  176. package/.devcontainer/scripts/setup-irie-claude.sh +0 -32
@@ -0,0 +1,954 @@
1
+ # Claude Agent SDK — TypeScript Reference
2
+
3
+ Complete TypeScript API reference for `@anthropic-ai/claude-agent-sdk`.
4
+
5
+ Source: [platform.claude.com/docs/en/agent-sdk/typescript](https://platform.claude.com/docs/en/agent-sdk/typescript)
6
+
7
+ ---
8
+
9
+ ## Functions
10
+
11
+ ### `query()`
12
+
13
+ The primary function. Creates an async generator that streams SDK messages.
14
+
15
+ ```typescript
16
+ function query({
17
+ prompt,
18
+ options
19
+ }: {
20
+ prompt: string | AsyncIterable<SDKUserMessage>;
21
+ options?: Options;
22
+ }): Query
23
+ ```
24
+
25
+ | Parameter | Type | Description |
26
+ |-----------|------|-------------|
27
+ | `prompt` | `string \| AsyncIterable<SDKUserMessage>` | Input prompt as string or async iterable for streaming mode |
28
+ | `options` | `Options` | Optional configuration object |
29
+
30
+ Returns a `Query` object extending `AsyncGenerator<SDKMessage, void>` with control methods.
31
+
32
+ ### `tool()`
33
+
34
+ Creates a type-safe MCP tool definition with Zod schema validation.
35
+
36
+ ```typescript
37
+ function tool<Schema extends ZodRawShape>(
38
+ name: string,
39
+ description: string,
40
+ inputSchema: Schema,
41
+ handler: (args: z.infer<ZodObject<Schema>>, extra: unknown) => Promise<CallToolResult>
42
+ ): SdkMcpToolDefinition<Schema>
43
+ ```
44
+
45
+ | Parameter | Type | Description |
46
+ |-----------|------|-------------|
47
+ | `name` | `string` | Tool name |
48
+ | `description` | `string` | What the tool does |
49
+ | `inputSchema` | `Schema extends ZodRawShape` | Zod schema for input parameters |
50
+ | `handler` | `(args, extra) => Promise<CallToolResult>` | Async handler function |
51
+
52
+ ### `createSdkMcpServer()`
53
+
54
+ Creates an in-process MCP server instance.
55
+
56
+ ```typescript
57
+ function createSdkMcpServer(options: {
58
+ name: string;
59
+ version?: string;
60
+ tools?: Array<SdkMcpToolDefinition<any>>;
61
+ }): McpSdkServerConfigWithInstance
62
+ ```
63
+
64
+ | Parameter | Type | Description |
65
+ |-----------|------|-------------|
66
+ | `options.name` | `string` | MCP server name |
67
+ | `options.version` | `string` | Optional version string |
68
+ | `options.tools` | `Array<SdkMcpToolDefinition>` | Tool definitions created with `tool()` |
69
+
70
+ ---
71
+
72
+ ## Full Options Interface
73
+
74
+ All configuration fields for `query()`.
75
+
76
+ | Property | Type | Default | Description |
77
+ |----------|------|---------|-------------|
78
+ | `abortController` | `AbortController` | `new AbortController()` | Controller for cancelling operations |
79
+ | `additionalDirectories` | `string[]` | `[]` | Additional directories Claude can access |
80
+ | `agents` | `Record<string, AgentDefinition>` | `undefined` | Programmatically define subagents |
81
+ | `allowDangerouslySkipPermissions` | `boolean` | `false` | Required when using `permissionMode: 'bypassPermissions'` |
82
+ | `allowedTools` | `string[]` | All tools | List of allowed tool names |
83
+ | `betas` | `SdkBeta[]` | `[]` | Beta features (e.g., `['context-1m-2025-08-07']`) |
84
+ | `canUseTool` | `CanUseTool` | `undefined` | Custom permission callback |
85
+ | `continue` | `boolean` | `false` | Continue the most recent conversation |
86
+ | `cwd` | `string` | `process.cwd()` | Current working directory |
87
+ | `disallowedTools` | `string[]` | `[]` | Tools removed from model context |
88
+ | `enableFileCheckpointing` | `boolean` | `false` | Enable file change tracking for rewinding |
89
+ | `env` | `Dict<string>` | `process.env` | Environment variables |
90
+ | `executable` | `'bun' \| 'deno' \| 'node'` | Auto-detected | JavaScript runtime |
91
+ | `executableArgs` | `string[]` | `[]` | Arguments to pass to the runtime |
92
+ | `extraArgs` | `Record<string, string \| null>` | `{}` | Additional arguments |
93
+ | `fallbackModel` | `string` | `undefined` | Model to use if primary fails |
94
+ | `forkSession` | `boolean` | `false` | Fork to a new session ID when resuming |
95
+ | `hooks` | `Partial<Record<HookEvent, HookCallbackMatcher[]>>` | `{}` | Hook callbacks for lifecycle events |
96
+ | `includePartialMessages` | `boolean` | `false` | Include streaming token events |
97
+ | `maxBudgetUsd` | `number` | `undefined` | Maximum budget in USD |
98
+ | `maxThinkingTokens` | `number` | `undefined` | Maximum tokens for thinking |
99
+ | `maxTurns` | `number` | `undefined` | Maximum conversation turns |
100
+ | `mcpServers` | `Record<string, McpServerConfig>` | `{}` | MCP server configurations |
101
+ | `model` | `string` | Default from CLI | Claude model to use |
102
+ | `outputFormat` | `{ type: 'json_schema', schema: JSONSchema }` | `undefined` | Structured output schema |
103
+ | `pathToClaudeCodeExecutable` | `string` | Uses built-in | Path to Claude Code executable |
104
+ | `permissionMode` | `PermissionMode` | `'default'` | Permission behavior preset |
105
+ | `permissionPromptToolName` | `string` | `undefined` | MCP tool name for permission prompts |
106
+ | `plugins` | `SdkPluginConfig[]` | `[]` | Load custom plugins from local paths |
107
+ | `resume` | `string` | `undefined` | Session ID to resume |
108
+ | `resumeSessionAt` | `string` | `undefined` | Resume at a specific message UUID |
109
+ | `sandbox` | `SandboxSettings` | `undefined` | Sandbox configuration |
110
+ | `settingSources` | `SettingSource[]` | `[]` (no settings) | Filesystem settings to load |
111
+ | `stderr` | `(data: string) => void` | `undefined` | Callback for stderr output |
112
+ | `strictMcpConfig` | `boolean` | `false` | Enforce strict MCP validation |
113
+ | `systemPrompt` | `string \| { type: 'preset'; preset: 'claude_code'; append?: string }` | `undefined` (minimal) | System prompt config |
114
+ | `tools` | `string[] \| { type: 'preset'; preset: 'claude_code' }` | `undefined` | Tool configuration |
115
+
116
+ ---
117
+
118
+ ## Query Object
119
+
120
+ The `Query` extends `AsyncGenerator<SDKMessage, void>` with control methods:
121
+
122
+ ```typescript
123
+ interface Query extends AsyncGenerator<SDKMessage, void> {
124
+ interrupt(): Promise<void>;
125
+ rewindFiles(userMessageUuid: string): Promise<void>;
126
+ setPermissionMode(mode: PermissionMode): Promise<void>;
127
+ setModel(model?: string): Promise<void>;
128
+ setMaxThinkingTokens(maxThinkingTokens: number | null): Promise<void>;
129
+ supportedCommands(): Promise<SlashCommand[]>;
130
+ supportedModels(): Promise<ModelInfo[]>;
131
+ mcpServerStatus(): Promise<McpServerStatus[]>;
132
+ accountInfo(): Promise<AccountInfo>;
133
+ }
134
+ ```
135
+
136
+ | Method | Description |
137
+ |--------|-------------|
138
+ | `interrupt()` | Interrupts the query (streaming input mode only) |
139
+ | `rewindFiles(uuid)` | Restores files to state at specified message. Requires `enableFileCheckpointing: true` |
140
+ | `setPermissionMode(mode)` | Changes permission mode at runtime (streaming input mode only) |
141
+ | `setModel(model)` | Changes model at runtime (streaming input mode only) |
142
+ | `setMaxThinkingTokens(n)` | Changes max thinking tokens (streaming input mode only) |
143
+ | `supportedCommands()` | Returns available slash commands |
144
+ | `supportedModels()` | Returns available models with display info |
145
+ | `mcpServerStatus()` | Returns status of connected MCP servers |
146
+ | `accountInfo()` | Returns account information |
147
+
148
+ ---
149
+
150
+ ## SDKMessage Types
151
+
152
+ ### SDKMessage Union
153
+
154
+ ```typescript
155
+ type SDKMessage =
156
+ | SDKAssistantMessage
157
+ | SDKUserMessage
158
+ | SDKUserMessageReplay
159
+ | SDKResultMessage
160
+ | SDKSystemMessage
161
+ | SDKPartialAssistantMessage
162
+ | SDKCompactBoundaryMessage;
163
+ ```
164
+
165
+ ### SDKSystemMessage
166
+
167
+ First message emitted — contains session metadata.
168
+
169
+ ```typescript
170
+ type SDKSystemMessage = {
171
+ type: "system";
172
+ subtype: "init";
173
+ uuid: UUID;
174
+ session_id: string;
175
+ apiKeySource: ApiKeySource;
176
+ cwd: string;
177
+ tools: string[];
178
+ mcp_servers: { name: string; status: string }[];
179
+ model: string;
180
+ permissionMode: PermissionMode;
181
+ slash_commands: string[];
182
+ output_style: string;
183
+ };
184
+ ```
185
+
186
+ ### SDKAssistantMessage
187
+
188
+ Agent output — text, tool calls, thinking.
189
+
190
+ ```typescript
191
+ type SDKAssistantMessage = {
192
+ type: "assistant";
193
+ uuid: UUID;
194
+ session_id: string;
195
+ message: APIAssistantMessage; // From Anthropic SDK
196
+ parent_tool_use_id: string | null;
197
+ };
198
+ ```
199
+
200
+ ### SDKUserMessage
201
+
202
+ Tool results fed back to the model.
203
+
204
+ ```typescript
205
+ type SDKUserMessage = {
206
+ type: "user";
207
+ uuid?: UUID;
208
+ session_id: string;
209
+ message: APIUserMessage; // From Anthropic SDK
210
+ parent_tool_use_id: string | null;
211
+ };
212
+ ```
213
+
214
+ ### SDKResultMessage
215
+
216
+ Final message — outcome, cost, usage. Two subtypes:
217
+
218
+ ```typescript
219
+ // Success
220
+ type SDKResultSuccess = {
221
+ type: "result";
222
+ subtype: "success";
223
+ uuid: UUID;
224
+ session_id: string;
225
+ duration_ms: number;
226
+ duration_api_ms: number;
227
+ is_error: boolean;
228
+ num_turns: number;
229
+ result: string;
230
+ total_cost_usd: number;
231
+ usage: NonNullableUsage;
232
+ modelUsage: { [modelName: string]: ModelUsage };
233
+ permission_denials: SDKPermissionDenial[];
234
+ structured_output?: unknown;
235
+ };
236
+
237
+ // Error variants
238
+ type SDKResultError = {
239
+ type: "result";
240
+ subtype:
241
+ | "error_max_turns"
242
+ | "error_during_execution"
243
+ | "error_max_budget_usd"
244
+ | "error_max_structured_output_retries";
245
+ uuid: UUID;
246
+ session_id: string;
247
+ duration_ms: number;
248
+ duration_api_ms: number;
249
+ is_error: boolean;
250
+ num_turns: number;
251
+ total_cost_usd: number;
252
+ usage: NonNullableUsage;
253
+ modelUsage: { [modelName: string]: ModelUsage };
254
+ permission_denials: SDKPermissionDenial[];
255
+ errors: string[];
256
+ };
257
+
258
+ type SDKResultMessage = SDKResultSuccess | SDKResultError;
259
+ ```
260
+
261
+ ### SDKPartialAssistantMessage
262
+
263
+ Streaming token events. Only emitted when `includePartialMessages: true`.
264
+
265
+ ```typescript
266
+ type SDKPartialAssistantMessage = {
267
+ type: "stream_event";
268
+ event: RawMessageStreamEvent; // From Anthropic SDK
269
+ parent_tool_use_id: string | null;
270
+ uuid: UUID;
271
+ session_id: string;
272
+ };
273
+ ```
274
+
275
+ ### SDKCompactBoundaryMessage
276
+
277
+ Emitted when context compaction occurs.
278
+
279
+ ```typescript
280
+ type SDKCompactBoundaryMessage = {
281
+ type: "system";
282
+ subtype: "compact_boundary";
283
+ uuid: UUID;
284
+ session_id: string;
285
+ compact_metadata: {
286
+ trigger: "manual" | "auto";
287
+ pre_tokens: number;
288
+ };
289
+ };
290
+ ```
291
+
292
+ ### SDKPermissionDenial
293
+
294
+ ```typescript
295
+ type SDKPermissionDenial = {
296
+ tool_name: string;
297
+ tool_use_id: string;
298
+ tool_input: ToolInput;
299
+ };
300
+ ```
301
+
302
+ ---
303
+
304
+ ## canUseTool Callback
305
+
306
+ ### CanUseTool Type
307
+
308
+ ```typescript
309
+ type CanUseTool = (
310
+ toolName: string,
311
+ input: ToolInput,
312
+ options: {
313
+ signal: AbortSignal;
314
+ suggestions?: PermissionUpdate[];
315
+ }
316
+ ) => Promise<PermissionResult>;
317
+ ```
318
+
319
+ ### PermissionResult
320
+
321
+ ```typescript
322
+ type PermissionResult =
323
+ | {
324
+ behavior: "allow";
325
+ updatedInput: ToolInput;
326
+ updatedPermissions?: PermissionUpdate[];
327
+ }
328
+ | {
329
+ behavior: "deny";
330
+ message: string;
331
+ interrupt?: boolean;
332
+ };
333
+ ```
334
+
335
+ ### Examples
336
+
337
+ ```typescript
338
+ // Allow with modified input
339
+ return {
340
+ behavior: "allow",
341
+ updatedInput: { ...input, timeout: 30000 }, // enforce timeout
342
+ };
343
+
344
+ // Deny with explanation
345
+ return {
346
+ behavior: "deny",
347
+ message: "Write access to /etc is not permitted",
348
+ };
349
+
350
+ // Deny and stop the entire query
351
+ return {
352
+ behavior: "deny",
353
+ message: "Security violation detected",
354
+ interrupt: true,
355
+ };
356
+
357
+ // Allow and update permission rules for future calls
358
+ return {
359
+ behavior: "allow",
360
+ updatedInput: input,
361
+ updatedPermissions: [
362
+ {
363
+ type: "addRules",
364
+ rules: [{ toolName: "Bash", ruleContent: "git *" }],
365
+ behavior: "allow",
366
+ destination: "session",
367
+ },
368
+ ],
369
+ };
370
+ ```
371
+
372
+ ---
373
+
374
+ ## Custom MCP Tools
375
+
376
+ ### createSdkMcpServer + tool
377
+
378
+ ```typescript
379
+ import { createSdkMcpServer, tool } from "@anthropic-ai/claude-agent-sdk";
380
+ import { z } from "zod";
381
+
382
+ const server = createSdkMcpServer({
383
+ name: "my-tools",
384
+ version: "1.0.0",
385
+ tools: [
386
+ tool(
387
+ "lookup_user",
388
+ "Look up a user by email",
389
+ { email: z.string().email() },
390
+ async ({ email }) => ({
391
+ content: [{ type: "text", text: JSON.stringify({ id: 1, email }) }],
392
+ })
393
+ ),
394
+ ],
395
+ });
396
+
397
+ // Pass to query
398
+ const messages = query({
399
+ prompt: "Look up user alice@example.com",
400
+ options: { mcpServers: { users: server } },
401
+ });
402
+ ```
403
+
404
+ ### McpServerConfig Variants
405
+
406
+ ```typescript
407
+ // stdio — spawns a subprocess
408
+ type McpStdioServerConfig = {
409
+ type?: "stdio";
410
+ command: string;
411
+ args?: string[];
412
+ env?: Record<string, string>;
413
+ };
414
+
415
+ // SSE — connects to a running server
416
+ type McpSSEServerConfig = {
417
+ type: "sse";
418
+ url: string;
419
+ headers?: Record<string, string>;
420
+ };
421
+
422
+ // HTTP — streamable HTTP transport
423
+ type McpHttpServerConfig = {
424
+ type: "http";
425
+ url: string;
426
+ headers?: Record<string, string>;
427
+ };
428
+
429
+ // SDK — in-process server (from createSdkMcpServer)
430
+ type McpSdkServerConfigWithInstance = {
431
+ type: "sdk";
432
+ name: string;
433
+ instance: McpServer;
434
+ };
435
+
436
+ type McpServerConfig =
437
+ | McpStdioServerConfig
438
+ | McpSSEServerConfig
439
+ | McpHttpServerConfig
440
+ | McpSdkServerConfigWithInstance;
441
+ ```
442
+
443
+ ---
444
+
445
+ ## Hook Types
446
+
447
+ ### HookEvent
448
+
449
+ ```typescript
450
+ type HookEvent =
451
+ | "PreToolUse"
452
+ | "PostToolUse"
453
+ | "PostToolUseFailure"
454
+ | "Notification"
455
+ | "UserPromptSubmit"
456
+ | "SessionStart"
457
+ | "SessionEnd"
458
+ | "Stop"
459
+ | "SubagentStart"
460
+ | "SubagentStop"
461
+ | "PreCompact"
462
+ | "PermissionRequest";
463
+ ```
464
+
465
+ ### HookCallback
466
+
467
+ ```typescript
468
+ type HookCallback = (
469
+ input: HookInput,
470
+ toolUseID: string | undefined,
471
+ options: { signal: AbortSignal }
472
+ ) => Promise<HookJSONOutput>;
473
+ ```
474
+
475
+ ### HookCallbackMatcher
476
+
477
+ ```typescript
478
+ interface HookCallbackMatcher {
479
+ matcher?: string; // Regex pattern for tool name matching
480
+ hooks: HookCallback[];
481
+ }
482
+ ```
483
+
484
+ ### HookInput Variants
485
+
486
+ All hook inputs extend `BaseHookInput`:
487
+
488
+ ```typescript
489
+ type BaseHookInput = {
490
+ session_id: string;
491
+ transcript_path: string;
492
+ cwd: string;
493
+ permission_mode?: string;
494
+ };
495
+ ```
496
+
497
+ | Hook Event | Additional Fields |
498
+ |------------|-------------------|
499
+ | `PreToolUse` | `tool_name: string`, `tool_input: unknown` |
500
+ | `PostToolUse` | `tool_name: string`, `tool_input: unknown`, `tool_response: unknown` |
501
+ | `PostToolUseFailure` | `tool_name: string`, `tool_input: unknown`, `error: string`, `is_interrupt?: boolean` |
502
+ | `Notification` | `message: string`, `title?: string` |
503
+ | `UserPromptSubmit` | `prompt: string` |
504
+ | `SessionStart` | `source: 'startup' \| 'resume' \| 'clear' \| 'compact'` |
505
+ | `SessionEnd` | `reason: ExitReason` |
506
+ | `Stop` | `stop_hook_active: boolean` |
507
+ | `SubagentStart` | `agent_id: string`, `agent_type: string` |
508
+ | `SubagentStop` | `stop_hook_active: boolean` |
509
+ | `PreCompact` | `trigger: 'manual' \| 'auto'`, `custom_instructions: string \| null` |
510
+ | `PermissionRequest` | `tool_name: string`, `tool_input: unknown`, `permission_suggestions?: PermissionUpdate[]` |
511
+
512
+ ### HookJSONOutput
513
+
514
+ ```typescript
515
+ type HookJSONOutput = AsyncHookJSONOutput | SyncHookJSONOutput;
516
+
517
+ // For long-running hooks
518
+ type AsyncHookJSONOutput = {
519
+ async: true;
520
+ asyncTimeout?: number;
521
+ };
522
+
523
+ // Standard hook output
524
+ type SyncHookJSONOutput = {
525
+ continue?: boolean;
526
+ suppressOutput?: boolean;
527
+ stopReason?: string;
528
+ decision?: "approve" | "block";
529
+ systemMessage?: string;
530
+ reason?: string;
531
+ hookSpecificOutput?:
532
+ | {
533
+ hookEventName: "PreToolUse";
534
+ permissionDecision?: "allow" | "deny" | "ask";
535
+ permissionDecisionReason?: string;
536
+ updatedInput?: Record<string, unknown>;
537
+ }
538
+ | {
539
+ hookEventName: "UserPromptSubmit";
540
+ additionalContext?: string;
541
+ }
542
+ | {
543
+ hookEventName: "SessionStart";
544
+ additionalContext?: string;
545
+ }
546
+ | {
547
+ hookEventName: "PostToolUse";
548
+ additionalContext?: string;
549
+ };
550
+ };
551
+ ```
552
+
553
+ ---
554
+
555
+ ## Sandbox Configuration
556
+
557
+ ### SandboxSettings
558
+
559
+ ```typescript
560
+ type SandboxSettings = {
561
+ enabled?: boolean;
562
+ autoAllowBashIfSandboxed?: boolean;
563
+ excludedCommands?: string[];
564
+ allowUnsandboxedCommands?: boolean;
565
+ network?: NetworkSandboxSettings;
566
+ ignoreViolations?: SandboxIgnoreViolations;
567
+ enableWeakerNestedSandbox?: boolean;
568
+ };
569
+ ```
570
+
571
+ | Property | Type | Default | Description |
572
+ |----------|------|---------|-------------|
573
+ | `enabled` | `boolean` | `false` | Enable sandbox mode |
574
+ | `autoAllowBashIfSandboxed` | `boolean` | `false` | Auto-approve bash when sandboxed |
575
+ | `excludedCommands` | `string[]` | `[]` | Commands that always bypass sandbox (no model involvement) |
576
+ | `allowUnsandboxedCommands` | `boolean` | `false` | Model can request unsandboxed execution via `dangerouslyDisableSandbox` |
577
+ | `network` | `NetworkSandboxSettings` | `undefined` | Network sandbox config |
578
+ | `ignoreViolations` | `SandboxIgnoreViolations` | `undefined` | Violations to ignore |
579
+ | `enableWeakerNestedSandbox` | `boolean` | `false` | Weaker nested sandbox for compatibility |
580
+
581
+ ### NetworkSandboxSettings
582
+
583
+ ```typescript
584
+ type NetworkSandboxSettings = {
585
+ allowLocalBinding?: boolean;
586
+ allowUnixSockets?: string[];
587
+ allowAllUnixSockets?: boolean;
588
+ httpProxyPort?: number;
589
+ socksProxyPort?: number;
590
+ };
591
+ ```
592
+
593
+ ### SandboxIgnoreViolations
594
+
595
+ ```typescript
596
+ type SandboxIgnoreViolations = {
597
+ file?: string[];
598
+ network?: string[];
599
+ };
600
+ ```
601
+
602
+ **`excludedCommands` vs `allowUnsandboxedCommands`:**
603
+ - `excludedCommands`: Static list, always bypasses sandbox, no model involvement
604
+ - `allowUnsandboxedCommands`: Model decides at runtime via `dangerouslyDisableSandbox: true`, falls back to `canUseTool`
605
+
606
+ ---
607
+
608
+ ## Tool Input Types
609
+
610
+ ### ToolInput Union
611
+
612
+ ```typescript
613
+ type ToolInput =
614
+ | AgentInput
615
+ | AskUserQuestionInput
616
+ | BashInput
617
+ | BashOutputInput
618
+ | FileEditInput
619
+ | FileReadInput
620
+ | FileWriteInput
621
+ | GlobInput
622
+ | GrepInput
623
+ | KillShellInput
624
+ | NotebookEditInput
625
+ | WebFetchInput
626
+ | WebSearchInput
627
+ | TodoWriteInput
628
+ | ExitPlanModeInput
629
+ | ListMcpResourcesInput
630
+ | ReadMcpResourceInput;
631
+ ```
632
+
633
+ ### Key Tool Input Types
634
+
635
+ ```typescript
636
+ // Task (AgentInput)
637
+ interface AgentInput {
638
+ description: string; // Short (3-5 word) task description
639
+ prompt: string; // The task for the agent
640
+ subagent_type: string; // Type of specialized agent
641
+ }
642
+
643
+ // Bash
644
+ interface BashInput {
645
+ command: string;
646
+ timeout?: number; // ms, max 600000
647
+ description?: string;
648
+ run_in_background?: boolean;
649
+ }
650
+
651
+ // Edit
652
+ interface FileEditInput {
653
+ file_path: string; // Absolute path
654
+ old_string: string; // Text to replace
655
+ new_string: string; // Replacement text
656
+ replace_all?: boolean; // Default false
657
+ }
658
+
659
+ // Read
660
+ interface FileReadInput {
661
+ file_path: string;
662
+ offset?: number; // Start line
663
+ limit?: number; // Number of lines
664
+ }
665
+
666
+ // Write
667
+ interface FileWriteInput {
668
+ file_path: string;
669
+ content: string;
670
+ }
671
+
672
+ // Glob
673
+ interface GlobInput {
674
+ pattern: string;
675
+ path?: string; // Defaults to cwd
676
+ }
677
+
678
+ // Grep
679
+ interface GrepInput {
680
+ pattern: string;
681
+ path?: string;
682
+ glob?: string;
683
+ type?: string;
684
+ output_mode?: "content" | "files_with_matches" | "count";
685
+ "-i"?: boolean;
686
+ "-n"?: boolean;
687
+ "-B"?: number;
688
+ "-A"?: number;
689
+ "-C"?: number;
690
+ head_limit?: number;
691
+ multiline?: boolean;
692
+ }
693
+
694
+ // WebFetch
695
+ interface WebFetchInput {
696
+ url: string;
697
+ prompt: string;
698
+ }
699
+
700
+ // WebSearch
701
+ interface WebSearchInput {
702
+ query: string;
703
+ allowed_domains?: string[];
704
+ blocked_domains?: string[];
705
+ }
706
+ ```
707
+
708
+ ---
709
+
710
+ ## Tool Output Types
711
+
712
+ ### Key Tool Output Types
713
+
714
+ ```typescript
715
+ // Task
716
+ interface TaskOutput {
717
+ result: string;
718
+ usage?: { input_tokens: number; output_tokens: number; cache_creation_input_tokens?: number; cache_read_input_tokens?: number };
719
+ total_cost_usd?: number;
720
+ duration_ms?: number;
721
+ }
722
+
723
+ // Bash
724
+ interface BashOutput {
725
+ output: string;
726
+ exitCode: number;
727
+ killed?: boolean; // Timeout
728
+ shellId?: string; // Background processes
729
+ }
730
+
731
+ // Edit
732
+ interface EditOutput {
733
+ message: string;
734
+ replacements: number;
735
+ file_path: string;
736
+ }
737
+
738
+ // Read
739
+ interface TextFileOutput {
740
+ content: string;
741
+ total_lines: number;
742
+ lines_returned: number;
743
+ }
744
+
745
+ // Write
746
+ interface WriteOutput {
747
+ message: string;
748
+ bytes_written: number;
749
+ file_path: string;
750
+ }
751
+
752
+ // Glob
753
+ interface GlobOutput {
754
+ matches: string[];
755
+ count: number;
756
+ search_path: string;
757
+ }
758
+
759
+ // Grep (content mode)
760
+ interface GrepContentOutput {
761
+ matches: Array<{ file: string; line_number?: number; line: string; before_context?: string[]; after_context?: string[] }>;
762
+ total_matches: number;
763
+ }
764
+ ```
765
+
766
+ ---
767
+
768
+ ## Cost Tracking
769
+
770
+ ### SDKResultMessage Cost Fields
771
+
772
+ | Field | Type | Description |
773
+ |-------|------|-------------|
774
+ | `total_cost_usd` | `number` | Total cost in USD |
775
+ | `duration_ms` | `number` | Total duration including tool execution |
776
+ | `duration_api_ms` | `number` | Time spent on API calls only |
777
+ | `num_turns` | `number` | Number of agentic turns |
778
+ | `usage` | `NonNullableUsage` | Aggregate token usage |
779
+ | `modelUsage` | `{ [model: string]: ModelUsage }` | Per-model breakdown |
780
+
781
+ ### ModelUsage
782
+
783
+ ```typescript
784
+ type ModelUsage = {
785
+ inputTokens: number;
786
+ outputTokens: number;
787
+ cacheReadInputTokens: number;
788
+ cacheCreationInputTokens: number;
789
+ webSearchRequests: number;
790
+ costUSD: number;
791
+ contextWindow: number;
792
+ };
793
+ ```
794
+
795
+ ### NonNullableUsage
796
+
797
+ ```typescript
798
+ type NonNullableUsage = {
799
+ input_tokens: number;
800
+ output_tokens: number;
801
+ cache_creation_input_tokens: number;
802
+ cache_read_input_tokens: number;
803
+ };
804
+ ```
805
+
806
+ ---
807
+
808
+ ## Other Types
809
+
810
+ ### AgentDefinition
811
+
812
+ ```typescript
813
+ type AgentDefinition = {
814
+ description: string;
815
+ tools?: string[];
816
+ prompt: string;
817
+ model?: "sonnet" | "opus" | "haiku" | "inherit";
818
+ };
819
+ ```
820
+
821
+ ### PermissionMode
822
+
823
+ ```typescript
824
+ type PermissionMode = "default" | "acceptEdits" | "bypassPermissions" | "plan";
825
+ ```
826
+
827
+ ### SettingSource
828
+
829
+ ```typescript
830
+ type SettingSource = "user" | "project" | "local";
831
+ ```
832
+
833
+ | Value | Location | Description |
834
+ |-------|----------|-------------|
835
+ | `"user"` | `~/.claude/settings.json` | Global user settings |
836
+ | `"project"` | `.claude/settings.json` | Shared project settings (version controlled) |
837
+ | `"local"` | `.claude/settings.local.json` | Local project settings (gitignored) |
838
+
839
+ **Precedence** (highest to lowest): local > project > user. Programmatic options always override filesystem settings.
840
+
841
+ ### PermissionUpdate
842
+
843
+ ```typescript
844
+ type PermissionUpdate =
845
+ | { type: "addRules"; rules: PermissionRuleValue[]; behavior: PermissionBehavior; destination: PermissionUpdateDestination }
846
+ | { type: "replaceRules"; rules: PermissionRuleValue[]; behavior: PermissionBehavior; destination: PermissionUpdateDestination }
847
+ | { type: "removeRules"; rules: PermissionRuleValue[]; behavior: PermissionBehavior; destination: PermissionUpdateDestination }
848
+ | { type: "setMode"; mode: PermissionMode; destination: PermissionUpdateDestination }
849
+ | { type: "addDirectories"; directories: string[]; destination: PermissionUpdateDestination }
850
+ | { type: "removeDirectories"; directories: string[]; destination: PermissionUpdateDestination };
851
+ ```
852
+
853
+ ### PermissionBehavior
854
+
855
+ ```typescript
856
+ type PermissionBehavior = "allow" | "deny" | "ask";
857
+ ```
858
+
859
+ ### PermissionUpdateDestination
860
+
861
+ ```typescript
862
+ type PermissionUpdateDestination = "userSettings" | "projectSettings" | "localSettings" | "session";
863
+ ```
864
+
865
+ ### PermissionRuleValue
866
+
867
+ ```typescript
868
+ type PermissionRuleValue = {
869
+ toolName: string;
870
+ ruleContent?: string;
871
+ };
872
+ ```
873
+
874
+ ### SdkBeta
875
+
876
+ ```typescript
877
+ type SdkBeta = "context-1m-2025-08-07";
878
+ ```
879
+
880
+ | Value | Description | Compatible Models |
881
+ |-------|-------------|-------------------|
882
+ | `"context-1m-2025-08-07"` | 1M token context window | Claude Opus 4.6, Claude Sonnet 4.5, Claude Sonnet 4 |
883
+
884
+ ### SdkPluginConfig
885
+
886
+ ```typescript
887
+ type SdkPluginConfig = {
888
+ type: "local";
889
+ path: string;
890
+ };
891
+ ```
892
+
893
+ ### SlashCommand
894
+
895
+ ```typescript
896
+ type SlashCommand = {
897
+ name: string;
898
+ description: string;
899
+ argumentHint: string;
900
+ };
901
+ ```
902
+
903
+ ### ModelInfo
904
+
905
+ ```typescript
906
+ type ModelInfo = {
907
+ value: string;
908
+ displayName: string;
909
+ description: string;
910
+ };
911
+ ```
912
+
913
+ ### McpServerStatus
914
+
915
+ ```typescript
916
+ type McpServerStatus = {
917
+ name: string;
918
+ status: "connected" | "failed" | "needs-auth" | "pending";
919
+ serverInfo?: { name: string; version: string };
920
+ };
921
+ ```
922
+
923
+ ### AccountInfo
924
+
925
+ ```typescript
926
+ type AccountInfo = {
927
+ email?: string;
928
+ organization?: string;
929
+ subscriptionType?: string;
930
+ tokenSource?: string;
931
+ apiKeySource?: string;
932
+ };
933
+ ```
934
+
935
+ ### ApiKeySource
936
+
937
+ ```typescript
938
+ type ApiKeySource = "user" | "project" | "org" | "temporary";
939
+ ```
940
+
941
+ ### CallToolResult
942
+
943
+ ```typescript
944
+ type CallToolResult = {
945
+ content: Array<{ type: "text" | "image" | "resource"; [key: string]: unknown }>;
946
+ isError?: boolean;
947
+ };
948
+ ```
949
+
950
+ ### AbortError
951
+
952
+ ```typescript
953
+ class AbortError extends Error {}
954
+ ```