Skip to content

Commit 5ce669c

Browse files
Ameen-Alamclaude
andauthored
fix(types): tighten permission_suggestions type in SDKControlPermissionRequest (#955)
## Problem `SDKControlPermissionRequest.permission_suggestions` is typed as `list[Any] | None`, which suppresses all type-checking on every consumer of that field. The wire protocol delivers raw JSON objects for each suggestion (plain dicts), so `Any` was a placeholder with no enforcement. This was noted in a TODO comment added alongside the original field declaration. ## Fix Replace `list[Any] | None` with `list[dict[str, Any]] | None` on `permission_suggestions` in `SDKControlPermissionRequest` and remove the TODO comment. The wire shape is raw JSON objects — `dict[str, Any]` accurately reflects that. Consumers that call `PermissionUpdate.from_dict(s)` on each item now get proper type-checking on the input to that call. No runtime behaviour changes. ## Tests - `mypy src/`: clean (no new errors) - `ruff check src/ tests/`: clean - `pytest tests/`: 745 passed, 5 skipped — same baseline as `main` Closes #957. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6bbad5f commit 5ce669c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/claude_agent_sdk/types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,8 +1942,7 @@ class SDKControlPermissionRequest(TypedDict):
19421942
subtype: Literal["can_use_tool"]
19431943
tool_name: str
19441944
input: dict[str, Any]
1945-
# TODO: Add PermissionUpdate type here
1946-
permission_suggestions: list[Any] | None
1945+
permission_suggestions: list[dict[str, Any]] | None
19471946
blocked_path: str | None
19481947
decision_reason: NotRequired[str]
19491948
title: NotRequired[str]

0 commit comments

Comments
 (0)