Documentation
¶
Overview ¶
Package codex will hold the Codex-CLI specific Spawner implementation.
Phase 6 work — placeholder folder so the agent/claude · agent/codex · agent/gemini sibling layout is established now.
Reference (agents-design.md §4.6):
- Streaming flag: `--json`
- Format: JSONL
- Resume: `codex resume <UUID>` (session ID lives in ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl)
- Hook: PermissionRequest (gate phase 3 — codex variant)
When implemented, mirror the agent/claude layout: spawn.go for the Spawner + process struct, separate test using a fake spawner via the agent.Process interface.
Package codex implements provider.Spawner for OpenAI's Codex CLI.
The codex CLI is the second AI runtime wick supports after claude. It follows a similar headless-streaming model — long-lived subprocess, one prompt per stdin envelope, streamed JSON responses — but the argv shape and approval-flag semantics differ enough to need their own spawner rather than parameterising claude's.
Hook integration (PreToolUse) is supported by codex but is still coarser than claude's: only "simple" shell commands fire the hook. That difference is surfaced via the capability registry, not here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Spawner ¶
type Spawner struct {
Binary string // empty → "codex"
// AskForApproval mirrors codex's --ask-for-approval flag. The
// canonical "skip the terminal approval prompt" value is "never";
// leave empty to let codex use its own default. Set ONLY when there
// is no gate to fall back on — for non-interactive channels (Slack /
// HTTP) where no human can answer a prompt. When the gate is active,
// leave this empty: bypass modes generally skip PreToolUse hooks
// (verify per release), which would silently disable the gate.
AskForApproval string
// ExtraArgs is appended after the canonical headless flags, before
// any caller-supplied ResumeID. Useful for tests / debugging.
ExtraArgs []string
}
Spawner spawns the real `codex` CLI binary in non-interactive `codex exec`-style mode.
Binary defaults to `codex` (PATH lookup); operators can override via the Binary field for non-standard installs (npm-bin paths, custom builds).
func (Spawner) Spawn ¶
Spawn starts the subprocess.
Argv shape (target — verify against `codex --help` of the installed version since OpenAI revises this surface frequently):
codex exec
[--sandbox workspace-write]
[--ask-for-approval <mode>]
[--resume <id>]
`codex exec` is the non-interactive entry point. `--sandbox workspace-write` keeps file mutations scoped to the spawn cwd, matching wick's expectation that one session = one workspace.
ResumeID is forwarded as `--resume <id>` when present; an empty ResumeID starts a fresh codex session.
TODO(codex 0.129+): confirm the exact flag names by running `codex exec --help` on the user's installed binary and adjust if the CLI has renamed --sandbox / --ask-for-approval (it has happened across minor releases).