-
Notifications
You must be signed in to change notification settings - Fork 913
Open
Labels
Description
The PermissionHandler.approve_all static method in types.py uses -> dict as its return type, but SessionConfig.on_permission_request expects a callable returning PermissionRequestResult. This causes a type checker error when using the SDK's own built-in handler:
Invalid argument to key "on_permission_request" with declared type
`(PermissionRequest, dict[str, str]) -> PermissionRequestResult | Awaitable[PermissionRequestResult]`
on TypedDict `SessionConfig`: value of type `def approve_all(request: Any, invocation: Any) -> dict[Unknown, Unknown]`
Current code:
class PermissionHandler:
@staticmethod
def approve_all(request: Any, invocation: Any) -> dict:
return {"kind": "approved"}Suggested change:
class PermissionHandler:
@staticmethod
def approve_all(request: PermissionRequest, invocation: dict[str, str]) -> PermissionRequestResult:
return {"kind": "approved"}Both types are already defined in the same file. The runtime behavior is unchanged, this is purely a type annotation fix.
SDK version: 0.1.29
Happy to pr, just let me know.
Reactions are currently unavailable