mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 01:04:42 +00:00
feat: add raw session args/opts for agent passthrough
This commit is contained in:
parent
375d73e4cb
commit
2f26f76d9b
14 changed files with 365 additions and 37 deletions
|
|
@ -25,16 +25,32 @@ amp --print --output-format stream-json --dangerously-skip-permissions "prompt"
|
|||
amp --continue SESSION_ID "follow up"
|
||||
```
|
||||
|
||||
### Key CLI Flags
|
||||
### Custom Args (CLI Flags)
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--print` | Output mode (non-interactive) |
|
||||
| `--output-format stream-json` | JSONL streaming output |
|
||||
| `--dangerously-skip-permissions` | Skip permission prompts |
|
||||
| `--continue SESSION_ID` | Resume existing session |
|
||||
| `--model MODEL` | Specify model |
|
||||
| `--toolbox TOOLBOX` | Toolbox configuration |
|
||||
#### Core Flags
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `--print` | bool | Output mode (non-interactive) |
|
||||
| `--execute` | bool | Alternative output mode (some versions) |
|
||||
| `--output-format stream-json` | string | JSONL streaming output |
|
||||
| `--model MODEL` | string | Specify model to use |
|
||||
| `--continue SESSION_ID` | string | Resume existing session |
|
||||
|
||||
#### Permission Flags
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `--dangerously-skip-permissions` | bool | Skip all permission prompts |
|
||||
|
||||
#### Configuration Flags
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `--toolbox NAME` | string | Toolbox configuration to use |
|
||||
| `--mcp-config FILE` | path | Path to MCP configuration file |
|
||||
|
||||
**Note:** Amp CLI flags vary by version. The daemon uses flag detection (`amp --help`) to determine which flags are supported before invocation.
|
||||
|
||||
## Credential Discovery
|
||||
|
||||
|
|
|
|||
|
|
@ -71,17 +71,42 @@ claude \
|
|||
"PROMPT"
|
||||
```
|
||||
|
||||
### Arguments
|
||||
### Core Arguments
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--print` | Output mode |
|
||||
| `--print` | Output mode (non-interactive) |
|
||||
| `--output-format stream-json` | Newline-delimited JSON streaming |
|
||||
| `--verbose` | Verbose output |
|
||||
| `--dangerously-skip-permissions` | Skip permission prompts |
|
||||
| `--resume SESSION_ID` | Resume existing session |
|
||||
| `--model MODEL_ID` | Specify model (e.g., `claude-sonnet-4-20250514`) |
|
||||
| `--permission-mode plan` | Plan mode (read-only exploration) |
|
||||
| `--permission-mode MODE` | Permission mode (`plan`, `acceptEdits`) |
|
||||
|
||||
### Custom Args (Session Configuration)
|
||||
|
||||
These flags can be passed to customize agent behavior at session start:
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `--max-turns N` | int | Maximum number of agent turns before stopping |
|
||||
| `--system-prompt TEXT` | string | Custom system prompt (replaces default) |
|
||||
| `--append-system-prompt TEXT` | string | Text to append to the system prompt |
|
||||
| `--allowed-tools TOOLS` | string (comma-sep) | Comma-separated list of allowed tools |
|
||||
| `--disallowed-tools TOOLS` | string (comma-sep) | Comma-separated list of disallowed tools |
|
||||
| `--mcp-server NAME` | string | Add an MCP server by name |
|
||||
| `--timeout-secs N` | int | Timeout in seconds (overrides default 300s) |
|
||||
| `--profile NAME` | string | Use a specific configuration profile |
|
||||
|
||||
### Streaming Input Mode Flags
|
||||
|
||||
When using `--input-format stream-json` for streaming input:
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--input-format stream-json` | Accept streaming JSON input via stdin |
|
||||
| `--permission-prompt-tool stdio` | Handle permission prompts via stdio |
|
||||
| `--include-partial-messages` | Include partial message events in output |
|
||||
|
||||
### Environment Variables
|
||||
|
||||
|
|
|
|||
|
|
@ -41,17 +41,54 @@ codex exec --dangerously-bypass-approvals-and-sandbox "prompt"
|
|||
codex exec resume --last # Resume previous session
|
||||
```
|
||||
|
||||
### Key CLI Flags
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--json` | Print events to stdout as JSONL |
|
||||
| `-m, --model MODEL` | Model to use |
|
||||
| `-s, --sandbox MODE` | `read-only`, `workspace-write`, `danger-full-access` |
|
||||
| `--full-auto` | Auto-approve with workspace-write sandbox |
|
||||
| `--dangerously-bypass-approvals-and-sandbox` | Skip all prompts (dangerous) |
|
||||
| `-C, --cd DIR` | Working directory |
|
||||
| `-o, --output-last-message FILE` | Write final response to file |
|
||||
| `--output-schema FILE` | JSON Schema for structured output |
|
||||
### Custom Args (CLI Flags)
|
||||
|
||||
#### Core Flags
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `-m, --model MODEL` | string | Model to use (e.g., `o3`, `gpt-4o`) |
|
||||
| `--json` | bool | Print events to stdout as JSONL |
|
||||
| `-C, --cd DIR` | path | Working directory for the agent |
|
||||
| `-o, --output-last-message FILE` | path | Write final response to file |
|
||||
|
||||
#### Permission & Sandbox Flags
|
||||
|
||||
| Flag | Type | Values | Description |
|
||||
|------|------|--------|-------------|
|
||||
| `-s, --sandbox MODE` | enum | `read-only`, `workspace-write`, `danger-full-access` | Sandbox policy for shell commands |
|
||||
| `-a, --ask-for-approval POLICY` | enum | `untrusted`, `on-failure`, `on-request`, `never` | When to require human approval |
|
||||
| `--full-auto` | bool | - | Convenience alias: `-a on-request --sandbox workspace-write` |
|
||||
| `--dangerously-bypass-approvals-and-sandbox` | bool | - | Skip all prompts and sandboxing (DANGEROUS) |
|
||||
|
||||
#### Configuration Overrides
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `-c, --config key=value` | string | Override config values (parsed as TOML) |
|
||||
| `-p, --profile NAME` | string | Use a configuration profile from config.toml |
|
||||
| `--enable FEATURE` | string | Enable a feature flag (repeatable) |
|
||||
| `--disable FEATURE` | string | Disable a feature flag (repeatable) |
|
||||
|
||||
Config override examples:
|
||||
```bash
|
||||
codex -c model="o3"
|
||||
codex -c 'sandbox_permissions=["disk-full-read-access"]'
|
||||
codex -c shell_environment_policy.inherit=all
|
||||
```
|
||||
|
||||
#### Additional Capabilities
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `-i, --image FILE` | path[] | Attach image(s) to the initial prompt (repeatable) |
|
||||
| `--add-dir DIR` | path[] | Additional directories that should be writable (repeatable) |
|
||||
| `--search` | bool | Enable live web search via `web_search` tool |
|
||||
| `--output-schema FILE` | path | JSON Schema file for structured output |
|
||||
| `--skip-git-repo-check` | bool | Allow running outside a Git repository |
|
||||
| `--oss` | bool | Use local open source model provider (LM Studio/Ollama) |
|
||||
| `--local-provider PROVIDER` | enum | `lmstudio`, `ollama`, `ollama-chat` |
|
||||
| `--color COLOR` | enum | `always`, `never`, `auto` |
|
||||
|
||||
### Session Management
|
||||
```bash
|
||||
|
|
@ -140,6 +177,41 @@ Codex App Server uses JSON-RPC 2.0 over JSONL/stdin/stdout (no port required).
|
|||
- `thread/start` → starts a new thread
|
||||
- `turn/start` → sends user input for a thread
|
||||
|
||||
### Custom Args (JSON-RPC Parameters)
|
||||
|
||||
#### `thread/start` Parameters
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `approval_policy` | enum | `Never`, `Untrusted` - when to ask for approval |
|
||||
| `sandbox` | enum | `ReadOnly`, `DangerFullAccess` - sandbox mode |
|
||||
| `model` | string | Model to use for this thread |
|
||||
| `cwd` | string | Working directory |
|
||||
|
||||
#### `turn/start` Parameters
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `thread_id` | string | Thread ID from `thread/start` response |
|
||||
| `input` | array | User input (e.g., `[{ "type": "text", "text": "..." }]`) |
|
||||
| `approval_policy` | enum | Override approval policy for this turn |
|
||||
| `sandbox_policy` | enum | Override sandbox policy for this turn |
|
||||
| `model` | string | Override model for this turn |
|
||||
| `cwd` | string | Override working directory |
|
||||
| `effort` | string | Reasoning effort level |
|
||||
| `output_schema` | object | JSON Schema for structured output |
|
||||
| `summary` | string | Summary context for the turn |
|
||||
| `collaboration_mode` | string | Collaboration mode (if supported) |
|
||||
|
||||
#### App Server CLI Flags
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-c, --config key=value` | Override config (same as interactive mode) |
|
||||
| `--enable FEATURE` | Enable feature flag |
|
||||
| `--disable FEATURE` | Disable feature flag |
|
||||
| `--analytics-default-enabled` | Enable analytics by default (for first-party use) |
|
||||
|
||||
### Event Notifications (examples)
|
||||
|
||||
```json
|
||||
|
|
|
|||
|
|
@ -34,18 +34,40 @@ opencode run -s SESSION_ID "prompt" # Continue specific session
|
|||
opencode run -f file1.ts -f file2.ts "review these files"
|
||||
```
|
||||
|
||||
### Key CLI Flags
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--format json` | Output raw JSON events (for parsing) |
|
||||
| `-m, --model PROVIDER/MODEL` | Model in format `provider/model` |
|
||||
| `--agent AGENT` | Agent to use (`build`, `plan`) |
|
||||
| `-c, --continue` | Continue last session |
|
||||
| `-s, --session ID` | Continue specific session |
|
||||
| `-f, --file FILE` | Attach file(s) to message |
|
||||
| `--attach URL` | Attach to running server |
|
||||
| `--port PORT` | Local server port |
|
||||
| `--variant VARIANT` | Reasoning effort (e.g., `high`, `max`) |
|
||||
### Custom Args (CLI Flags)
|
||||
|
||||
#### Core Flags
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `-m, --model PROVIDER/MODEL` | string | Model in format `provider/model` (e.g., `anthropic/claude-sonnet-4-20250514`) |
|
||||
| `--agent AGENT` | string | Agent to use (`build`, `plan`, or custom agent ID) |
|
||||
| `--format FORMAT` | enum | `default` (formatted) or `json` (raw JSON events) |
|
||||
| `--variant VARIANT` | string | Reasoning effort level (e.g., `high`, `max`, `minimal`) |
|
||||
|
||||
#### Session Flags
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `-c, --continue` | bool | Continue the last session |
|
||||
| `-s, --session ID` | string | Continue a specific session by ID |
|
||||
| `--title TEXT` | string | Title for the session (uses truncated prompt if omitted) |
|
||||
| `--share` | bool | Share the session publicly |
|
||||
|
||||
#### Input/Output Flags
|
||||
|
||||
| Flag | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `-f, --file FILE` | path[] | Attach file(s) to message (repeatable) |
|
||||
| `--attach URL` | string | Attach to a running OpenCode server (e.g., `http://localhost:4096`) |
|
||||
| `--port PORT` | int | Port for the local server (random if not specified) |
|
||||
|
||||
#### Debugging Flags
|
||||
|
||||
| Flag | Type | Values | Description |
|
||||
|------|------|--------|-------------|
|
||||
| `--log-level LEVEL` | enum | `DEBUG`, `INFO`, `WARN`, `ERROR` | Log verbosity level |
|
||||
| `--print-logs` | bool | - | Print logs to stderr |
|
||||
|
||||
### Headless Server Mode
|
||||
```bash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue