CodexWrapper.ExecResume (CodexWrapper v0.4.0)

Copy Markdown View Source

ExecResume command -- resume an existing session non-interactively.

Wraps codex exec resume [session_id] [prompt] with the full set of CLI flags.

Usage

config = CodexWrapper.Config.new(working_dir: "/path/to/project")

# Resume the most recent session
exec = CodexWrapper.ExecResume.new()
  |> CodexWrapper.ExecResume.last()
  |> CodexWrapper.ExecResume.prompt("continue with tests")

{:ok, result} = CodexWrapper.ExecResume.execute(exec, config)

# Resume a specific session by ID
exec = CodexWrapper.ExecResume.new()
  |> CodexWrapper.ExecResume.session_id("abc-123")
  |> CodexWrapper.ExecResume.prompt("add error handling")

{:ok, result} = CodexWrapper.ExecResume.execute(exec, config)

Summary

Functions

Show all sessions (disables cwd filtering).

Add a config override (key=value).

Bypass all approvals and sandbox. Use with extreme caution.

Run enabled hooks without requiring persisted hook trust. Use with extreme caution.

Disable a feature.

Enable a feature.

Enable ephemeral mode (no session persistence).

Execute the command synchronously, returning a parsed %Result{}.

Execute the command with --json and return a list of parsed %JsonLineEvent{}.

Enable full-auto mode.

Do not load user or project execpolicy .rules files.

Do not load $CODEX_HOME/config.toml.

Add an image path.

Enable JSON output.

Resume the most recent session.

Set the model.

Create a new exec resume command.

Set the output-last-message path.

Set the continuation prompt.

Set the sandbox mode.

Set the session ID to resume.

Skip the git repo check.

Execute the command and return a lazy Stream of %JsonLineEvent{}.

Error out when config.toml contains fields this Codex version does not recognize.

Types

sandbox_mode()

@type sandbox_mode() :: :read_only | :workspace_write | :danger_full_access

t()

@type t() :: %CodexWrapper.ExecResume{
  all: boolean(),
  config_overrides: [String.t()],
  dangerously_bypass_approvals_and_sandbox: boolean(),
  dangerously_bypass_hook_trust: boolean(),
  disabled_features: [String.t()],
  enabled_features: [String.t()],
  ephemeral: boolean(),
  full_auto: boolean(),
  ignore_rules: boolean(),
  ignore_user_config: boolean(),
  images: [String.t()],
  json: boolean(),
  last: boolean(),
  model: String.t() | nil,
  output_last_message: String.t() | nil,
  prompt: String.t() | nil,
  sandbox: sandbox_mode() | nil,
  session_id: String.t() | nil,
  skip_git_repo_check: boolean(),
  strict_config: boolean()
}

Functions

all(e)

@spec all(t()) :: t()

Show all sessions (disables cwd filtering).

config(e, kv)

@spec config(t(), String.t()) :: t()

Add a config override (key=value).

dangerously_bypass_approvals_and_sandbox(e)

@spec dangerously_bypass_approvals_and_sandbox(t()) :: t()

Bypass all approvals and sandbox. Use with extreme caution.

dangerously_bypass_hook_trust(e)

@spec dangerously_bypass_hook_trust(t()) :: t()

Run enabled hooks without requiring persisted hook trust. Use with extreme caution.

Hook trust is what stops a repository from running arbitrary commands the user never approved. Only appropriate for automation that already vets where its hooks come from.

disable(e, feature)

@spec disable(t(), String.t()) :: t()

Disable a feature.

enable(e, feature)

@spec enable(t(), String.t()) :: t()

Enable a feature.

ephemeral(e)

@spec ephemeral(t()) :: t()

Enable ephemeral mode (no session persistence).

execute(exec, config)

@spec execute(t(), CodexWrapper.Config.t()) ::
  {:ok, CodexWrapper.Result.t()} | {:error, term()}

Execute the command synchronously, returning a parsed %Result{}.

execute_json(exec, config)

@spec execute_json(t(), CodexWrapper.Config.t()) ::
  {:ok, [CodexWrapper.JsonLineEvent.t()]} | {:error, term()}

Execute the command with --json and return a list of parsed %JsonLineEvent{}.

Forces --json on the command, runs synchronously, then parses each NDJSON line from stdout.

full_auto(e)

@spec full_auto(t()) :: t()

Enable full-auto mode.

Deprecated upstream. Emits -c sandbox_mode="workspace-write", the config-key form of what the Codex CLI now tells you to use in place of --full-auto. An explicit sandbox/2 call is more specific and wins over this.

ignore_rules(e)

@spec ignore_rules(t()) :: t()

Do not load user or project execpolicy .rules files.

ignore_user_config(e)

@spec ignore_user_config(t()) :: t()

Do not load $CODEX_HOME/config.toml.

Auth still resolves through CODEX_HOME; only the config file is skipped. Pair with config/2 overrides for a run that does not pick up the developer's personal settings.

image(e, path)

@spec image(t(), String.t()) :: t()

Add an image path.

json(e)

@spec json(t()) :: t()

Enable JSON output.

last(e)

@spec last(t()) :: t()

Resume the most recent session.

model(e, model)

@spec model(t(), String.t()) :: t()

Set the model.

new()

@spec new() :: t()

Create a new exec resume command.

output_last_message(e, path)

@spec output_last_message(t(), String.t()) :: t()

Set the output-last-message path.

prompt(e, prompt)

@spec prompt(t(), String.t()) :: t()

Set the continuation prompt.

sandbox(e, mode)

@spec sandbox(t(), sandbox_mode()) :: t()

Set the sandbox mode.

Emits -c sandbox_mode="<mode>" rather than --sandbox <mode>: the flag is accepted by codex exec only, and codex exec resume rejects it with unexpected argument. The config key is the supported equivalent and takes the same three values.

session_id(e, id)

@spec session_id(t(), String.t()) :: t()

Set the session ID to resume.

skip_git_repo_check(e)

@spec skip_git_repo_check(t()) :: t()

Skip the git repo check.

stream(exec, config)

@spec stream(t(), CodexWrapper.Config.t()) :: Enumerable.t()

Execute the command and return a lazy Stream of %JsonLineEvent{}.

Reads NDJSON output line-by-line through the configured CodexWrapper.Runner. Forces --json on the command.

strict_config(e)

@spec strict_config(t()) :: t()

Error out when config.toml contains fields this Codex version does not recognize.

Turns a silently-ignored typo in a config file into a failed run, which is usually what a programmatic caller wants.