Skip to content

fix: use PermissionUpdate and PermissionMode types in control protocol#692

Closed
frankgoldfish wants to merge 1 commit intoanthropics:mainfrom
frankgoldfish:fix/control-protocol-type-annotations
Closed

fix: use PermissionUpdate and PermissionMode types in control protocol#692
frankgoldfish wants to merge 1 commit intoanthropics:mainfrom
frankgoldfish:fix/control-protocol-type-annotations

Conversation

@frankgoldfish
Copy link
Copy Markdown

Summary

Resolves two TODO comments in src/claude_agent_sdk/types.py by replacing placeholder Any/str types with the proper types that are already defined in the same file.

Changes

SDKControlPermissionRequest.permission_suggestions

# Before
permission_suggestions: list[Any] | None  # TODO: Add PermissionUpdate type here

# After
permission_suggestions: list[PermissionUpdate] | None

SDKControlSetPermissionModeRequest.mode

# Before
mode: str  # TODO: Add PermissionMode

# After
mode: PermissionMode

Why

Both PermissionUpdate (dataclass, lines 72–124) and PermissionMode (Literal type alias, line 18) are already defined in types.py. Using them here improves type safety and IDE auto-complete for SDK consumers without any runtime behaviour change.

Test plan

  • PermissionUpdate and PermissionMode are imported/defined earlier in the same file — no circular imports
  • No runtime behaviour change (TypedDict fields are not enforced at runtime in Python)
  • Mypy/pyright will now correctly flag mismatched values passed to these fields

🤖 Generated with Claude Code

SDKControlPermissionRequest.permission_suggestions was typed as list[Any]
and SDKControlSetPermissionModeRequest.mode was typed as str, even though
both PermissionUpdate and PermissionMode are already defined in this module.
Resolve two TODO comments by using the proper types.
@frankgoldfish
Copy link
Copy Markdown
Author

Closing this PR — found that PR #624 already addresses this issue. Apologies for the duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant