Commit graph

4 commits

Author SHA1 Message Date
Kashyap Murali
4f4fcfe3f3
feat: Full TypeScript SDK compatibility for tool permissions
- Align PermissionResult structure with TypeScript SDK
  - Add PermissionResultAllow with updatedInput and updatedPermissions
  - Add PermissionResultDeny with message and interrupt flag
  - Remove misleading ToolPermissionResponse alias (no actual backward compat)

- Add PermissionUpdate types matching TypeScript
  - PermissionUpdate with all update types
  - PermissionRuleValue for rule definitions
  - PermissionUpdateDestination and PermissionBehavior literals

- Update all tests and examples to use new types
- Update Query handler to properly handle Allow/Deny variants

Breaking change: Callbacks must now return PermissionResultAllow or
PermissionResultDeny instead of the old ToolPermissionResponse format.

This ensures full compatibility with TypeScript SDK's permission system.
2025-09-03 09:05:51 -07:00
Kashyap Murali
4f78e10691
refactor: Align with TypeScript SDK naming conventions
- Rename tool_permission_callback to can_use_tool in ClaudeCodeOptions
- Rename ToolPermissionCallback type to CanUseTool
- Update all references in examples and tests
- Remove dict backward compatibility (already done by user)

Addresses PR review comments for better SDK consistency
2025-09-02 19:40:57 -07:00
Kashyap Murali
15afcff044
fix: Remove duplicate get_server_info method and fix linting issues 2025-09-02 16:17:00 -07:00
Kashyap Murali
a774031c34
feat: Add tool permission and hook callbacks support
- Added ToolPermissionCallback type for controlling tool execution
- Added HookCallback type for intercepting tool events
- Added callbacks to ClaudeCodeOptions
- Thread callbacks through InternalClient and ClaudeSDKClient to Query
- Updated Query to handle tool permission requests with new types
- Support both ToolPermissionResponse and dict returns for compatibility
- Added example demonstrating permission control and input modification
- Added comprehensive tests for callbacks functionality
- Fixed NotRequired import for Python 3.11+ compatibility
2025-09-02 15:35:39 -07:00