Commit 841ee87
authored
Add 'auto' to PermissionMode type (#785)
## Summary
Adds `"auto"` to the `PermissionMode` Literal type, bringing the Python
SDK to parity with the TypeScript SDK (v0.2.91) and the CLI's
`EXTERNAL_PERMISSION_MODES`.
## Problem
The CLI binary (v2.1.90+) and the TypeScript SDK (v0.2.91) both support
`"auto"` as a valid permission mode, but the Python SDK's
`PermissionMode` type doesn't include it. Users who set
`permission_mode="auto"` get a type error even though the underlying CLI
accepts it.
## Changes
- `src/claude_agent_sdk/types.py`: Added `"auto"` to `PermissionMode =
Literal[...]`
- `tests/test_types.py`: Added test case for `permission_mode="auto"` in
`test_claude_code_options_with_permission_mode`
## Verification
- Confirmed `'auto'` is in `EXTERNAL_PERMISSION_MODES` in the CLI source
(`src/types/permissions.ts`)
- Confirmed TypeScript SDK v0.2.91 already added `'auto'` to its public
`PermissionMode` type
- The Python SDK passes `permission_mode` as `--permission-mode <value>`
to the CLI subprocess with no SDK-side validation — this is purely a
type annotation fix1 parent 13f65c8 commit 841ee87
4 files changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| |||
0 commit comments