Documentation
¶
Overview ¶
Package codex implements adapters.HarnessAdapter for the Codex CLI.
Phase 3-c prototype: the goal is to validate that adapters.HarnessAdapter composes for a non-claude harness, not to reach feature parity with the claude adapter. Run() forks `codex exec` with signal forwarding and exit normalisation; session persistence, payload_patch.json writes and boid task notify integration are deliberately left out (see docs/plans/agent-aware-boid.md Phase 3-c).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter implements adapters.HarnessAdapter for the Codex CLI.
func (*Adapter) Bindings ¶
Bindings declares the host bind-mounts codex.Adapter.Run() needs inside the sandbox.
Phase 4 PR3 (docs/plans/home-workspace-volume.md) retires every entry this method used to return: the rw ~/.codex state dir, the resolved `codex` binary's parent dir (PATH), the ro ~/.volta shim tree, and the per- embedded-skill ~/.local/share/boid/skills/<name> -> ~/.claude/skills/<name> binds. All of that state now lives directly in the sandbox's $HOME, which Runner.Dispatch (internal/dispatcher/workspace_home.go) bind-mounts from a persistent per-workspace home directory instead of a fresh tmpfs — so ~/.codex, ~/.volta etc. simply already exist at those paths without any adapter-declared bind. The codex CLI binary itself is expected to be installed into that same workspace home by the workspace's init.sh (see the plan doc's init.sh 契約 section); a missing binary now fails fast with an explicit message from Run() (run.go) instead of silently falling back to a bind that no longer exists.
Embedded skills are synced into the workspace home's ~/.claude/skills/ by skills.DeployAll (internal/skills/deploy.go), called from Runner.Dispatch right after the workspace home is resolved — copy-based distribution replaces the bind-mount this method used to declare per skill.
The HarnessAdapter interface still requires this method; returning an empty slice keeps the contract satisfied for any future $HOME-independent bind a harness might need.
func (*Adapter) Run ¶
Run forks codex. Interactive vs non-interactive is keyed off rc.TaskID: session jobs (JobKindSession) carry no task and are user-initiated, so they land in interactive TUI mode; hook jobs carry a BOID_TASK_ID and fall through to non-interactive `codex exec`. This mirrors how the claude adapter discriminates JobKindSession from JobKindHook via rc.TaskID == "".
Other responsibilities mirror the claude / opencode adapters: signal forwarding via sigutil, exit code normalisation for daemon-initiated stops, PWD strip on the child env, and cmd.Dir as the source of truth for the workdir.
Session persistence and payload_patch.json writes are deliberately NOT wired here — see docs/plans/multi-harness-production.md for the explicit non-goals (interactive sessions are run-and-done, no resume yet).