feat(exec): add shell command execution endpoint
All checks were successful
python-syntax / syntax-check (push) Successful in 8s
python-syntax / syntax-check (pull_request) Successful in 4s

This commit is contained in:
2026-04-05 20:18:07 +02:00
parent bb247aaad2
commit 930cdd2887
5 changed files with 176 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ x-clickthrough-token: <token>
## `GET /health`
Returns status and runtime safety flags.
Returns status and runtime safety flags, including `exec` capability config.
## `GET /screen`
@@ -143,6 +143,28 @@ Hotkey:
}
```
## `POST /exec`
Execute a shell command on the host running Clickthrough.
```json
{
"command": "Get-Process | Select-Object -First 5",
"shell": "powershell",
"timeout_s": 20,
"cwd": "C:/Users/Paul",
"dry_run": false
}
```
Notes:
- `shell` supports `powershell`, `bash`, `cmd`
- if `shell` is omitted, server uses `CLICKTHROUGH_EXEC_DEFAULT_SHELL`
- output is truncated based on `CLICKTHROUGH_EXEC_MAX_OUTPUT_CHARS`
- endpoint can be disabled with `CLICKTHROUGH_EXEC_ENABLED=false`
Response includes `stdout`, `stderr`, `exit_code`, timeout state, and execution metadata.
## `POST /batch`
Runs multiple `action` payloads sequentially.