Sandbox command -- run a command inside the Codex sandbox.
Wraps codex sandbox [OPTIONS] [COMMAND]....
The platform is no longer part of the invocation. Codex used to take it
as a subcommand (codex sandbox macos -- ls); as of codex-cli 0.14x the
command is flat and the platform is inferred from the host, so
new/1 takes the command directly. See #56.
Usage
config = CodexWrapper.Config.new()
sandbox =
CodexWrapper.Commands.Sandbox.new("ls")
|> CodexWrapper.Commands.Sandbox.arg("-la")
{:ok, output} = CodexWrapper.Commands.Sandbox.execute(sandbox, config)Sandbox state
The sandbox-state options configure what the sandboxed process can
reach. They are independent of the :permission_profile, which selects
a named profile from the Codex config:
CodexWrapper.Commands.Sandbox.new("pytest")
|> CodexWrapper.Commands.Sandbox.permission_profile("ci")
|> CodexWrapper.Commands.Sandbox.sandbox_state_readable_root("/usr/share")
|> CodexWrapper.Commands.Sandbox.sandbox_state_disable_network()
Summary
Functions
Add an argument to the sandboxed command.
Add multiple arguments to the sandboxed command.
Build the argument list for this command.
Working directory for the sandboxed command (--cd).
Execute the sandbox command synchronously.
Create a sandbox command for the given command.
Select a named permission profile (--permission-profile).
Disable network access inside the sandbox (--sandbox-state-disable-network).
Path to a sandbox state JSON file (--sandbox-state-json).
Grant read access to a root (--sandbox-state-readable-root).
Types
Functions
Add an argument to the sandboxed command.
Add multiple arguments to the sandboxed command.
Build the argument list for this command.
Working directory for the sandboxed command (--cd).
Distinct from Config's :working_dir, which sets the subprocess cwd.
@spec execute(t(), CodexWrapper.Config.t()) :: {:ok, String.t()} | {:error, term()}
Execute the sandbox command synchronously.
Create a sandbox command for the given command.
Select a named permission profile (--permission-profile).
Disable network access inside the sandbox (--sandbox-state-disable-network).
Path to a sandbox state JSON file (--sandbox-state-json).
Grant read access to a root (--sandbox-state-readable-root).
Accumulates: call once per root.