mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 05:02:11 +00:00
feat: add Claude adapter improvements for HITL support (#30)
* feat: add Claude adapter improvements for HITL support - Add question and permission handling for Claude sessions - Add Claude sender channel for interactive communication - Add stream event and control request handling - Update agent compatibility documentation * fix: restore Claude HITL streaming input and permission handling - Add streaming_input field to SpawnOptions for Claude stdin streaming - Enable --input-format stream-json, --permission-prompt-tool stdio flags - Pipe stdin for Claude (not just Codex) in spawn_streaming - Update Claude capabilities: permissions, questions, tool_calls, tool_results, streaming_deltas - Fix permission mode normalization to respect user's choice instead of forcing bypass - Add acceptEdits permission mode support - Add libc dependency for is_running_as_root check
This commit is contained in:
parent
c7d6482fd4
commit
0ee60920c8
7 changed files with 513 additions and 67 deletions
|
|
@ -160,6 +160,36 @@ Claude conflates agent mode and permission mode - `plan` is a permission restric
|
|||
| `plan` | `--permission-mode plan` | Read-only, must ExitPlanMode to execute |
|
||||
| `bypassPermissions` | `--dangerously-skip-permissions` | Skip all permission checks |
|
||||
|
||||
### Root Restrictions
|
||||
|
||||
**Claude refuses to run with `--dangerously-skip-permissions` when running as root (uid 0).**
|
||||
|
||||
This is a security measure built into Claude Code. When running as root:
|
||||
- The CLI outputs: `--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`
|
||||
- The process exits immediately without executing
|
||||
|
||||
This affects container environments (Docker, Daytona, E2B, etc.) which commonly run as root.
|
||||
|
||||
**Workarounds:**
|
||||
1. Run as a non-root user in the container
|
||||
2. Use `default` permission mode (but this requires interactive approval)
|
||||
3. Use `acceptEdits` mode for file operations (still requires Bash approval)
|
||||
|
||||
### Headless Permission Behavior
|
||||
|
||||
When permissions are denied in headless mode (`--print --output-format stream-json`):
|
||||
|
||||
1. Claude emits a `tool_use` event for the tool (e.g., Write, Bash)
|
||||
2. A `user` event follows with `tool_result` containing `is_error: true`
|
||||
3. Error message: `"Claude requested permissions to X, but you haven't granted it yet."`
|
||||
4. Final `result` event includes `permission_denials` array listing all denied tools
|
||||
|
||||
```json
|
||||
{"type":"assistant","message":{"content":[{"type":"tool_use","name":"Write","input":{...}}]}}
|
||||
{"type":"user","message":{"content":[{"type":"tool_result","is_error":true,"content":"Claude requested permissions to write to /tmp/test.txt, but you haven't granted it yet."}]}}
|
||||
{"type":"result","permission_denials":[{"tool_name":"Write","tool_use_id":"...","tool_input":{...}}]}
|
||||
```
|
||||
|
||||
### Subagent Types
|
||||
|
||||
Claude supports spawning subagents via the `Task` tool with `subagent_type`:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue