Skip to content

CommandExecParams

Base classes

Name Children Inherits
CodexBaseModel
codexed.models.base
Base model for all Codex API models.

â‹” Inheritance diagram

graph TD
  3368023363["v2_protocol.CommandExecParams"]
  3116041069["base.CodexBaseModel"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  3116041069 --> 3368023363
  3879467795 --> 3116041069
  2751680898 --> 3879467795

🛈 DocStrings

Bases: CodexBaseModel

Run a standalone command (argv vector) in the server sandbox without creating a thread or turn.

The final command/exec response is deferred until the process exits and is sent only after all command/exec/outputDelta notifications for that connection have been emitted.

Source code in src/codexed/models/v2_protocol.py
class CommandExecParams(CodexBaseModel):
    """Run a standalone command (argv vector) in the server sandbox without creating a thread or turn.

    The final `command/exec` response is deferred until the process exits and is sent only after all `command/exec/outputDelta` notifications for that connection have been emitted.
    """

    command: list[str]
    """
    Command argv vector. Empty arrays are rejected.
    """
    cwd: str | None = None
    """
    Optional working directory. Defaults to the server cwd.
    """
    disable_output_cap: bool | None = None
    """
    Disable stdout/stderr capture truncation for this request.

    Cannot be combined with `outputBytesCap`.
    """
    disable_timeout: bool | None = None
    """
    Disable the timeout entirely for this request.

    Cannot be combined with `timeoutMs`.
    """
    env: dict[str, Any] | None = None
    """
    Optional environment overrides merged into the server-computed environment.

    Matching names override inherited values. Set a key to `null` to unset an inherited variable.
    """
    output_bytes_cap: int | None = Field(None, ge=0)
    """
    Optional per-stream stdout/stderr capture cap in bytes.

    When omitted, the server default applies. Cannot be combined with `disableOutputCap`.
    """
    permission_profile: str | None = None
    """
    Optional active permissions profile id for this command.

    Defaults to the user's configured permissions when omitted. Cannot be combined with `sandboxPolicy`.
    """
    process_id: str | None = None
    """
    Optional client-supplied, connection-scoped process id.

    Required for `tty`, `streamStdin`, `streamStdoutStderr`, and follow-up `command/exec/write`, `command/exec/resize`, and `command/exec/terminate` calls. When omitted, buffered execution gets an internal id that is not exposed to the client.
    """
    sandbox_policy: SandboxPolicy | None = None
    """
    Optional sandbox policy for this command.

    Uses the same shape as thread/turn execution sandbox configuration and defaults to the user's configured policy when omitted. Cannot be combined with `permissionProfile`.
    """
    size: CommandExecTerminalSize | None = None
    """
    Optional initial PTY size in character cells. Only valid when `tty` is true.
    """
    stream_stdin: bool | None = None
    """
    Allow follow-up `command/exec/write` requests to write stdin bytes.

    Requires a client-supplied `processId`.
    """
    stream_stdout_stderr: bool | None = None
    """
    Stream stdout/stderr via `command/exec/outputDelta` notifications.

    Streamed bytes are not duplicated into the final response and require a client-supplied `processId`.
    """
    timeout_ms: int | None = None
    """
    Optional timeout in milliseconds.

    When omitted, the server default applies. Cannot be combined with `disableTimeout`.
    """
    tty: bool | None = None
    """
    Enable PTY mode.

    This implies `streamStdin` and `streamStdoutStderr`.
    """

command instance-attribute

command: list[str]

Command argv vector. Empty arrays are rejected.

cwd class-attribute instance-attribute

cwd: str | None = None

Optional working directory. Defaults to the server cwd.

disable_output_cap class-attribute instance-attribute

disable_output_cap: bool | None = None

Disable stdout/stderr capture truncation for this request.

Cannot be combined with outputBytesCap.

disable_timeout class-attribute instance-attribute

disable_timeout: bool | None = None

Disable the timeout entirely for this request.

Cannot be combined with timeoutMs.

env class-attribute instance-attribute

env: dict[str, Any] | None = None

Optional environment overrides merged into the server-computed environment.

Matching names override inherited values. Set a key to null to unset an inherited variable.

output_bytes_cap class-attribute instance-attribute

output_bytes_cap: int | None = Field(None, ge=0)

Optional per-stream stdout/stderr capture cap in bytes.

When omitted, the server default applies. Cannot be combined with disableOutputCap.

permission_profile class-attribute instance-attribute

permission_profile: str | None = None

Optional active permissions profile id for this command.

Defaults to the user's configured permissions when omitted. Cannot be combined with sandboxPolicy.

process_id class-attribute instance-attribute

process_id: str | None = None

Optional client-supplied, connection-scoped process id.

Required for tty, streamStdin, streamStdoutStderr, and follow-up command/exec/write, command/exec/resize, and command/exec/terminate calls. When omitted, buffered execution gets an internal id that is not exposed to the client.

sandbox_policy class-attribute instance-attribute

sandbox_policy: SandboxPolicy | None = None

Optional sandbox policy for this command.

Uses the same shape as thread/turn execution sandbox configuration and defaults to the user's configured policy when omitted. Cannot be combined with permissionProfile.

size class-attribute instance-attribute

size: CommandExecTerminalSize | None = None

Optional initial PTY size in character cells. Only valid when tty is true.

stream_stdin class-attribute instance-attribute

stream_stdin: bool | None = None

Allow follow-up command/exec/write requests to write stdin bytes.

Requires a client-supplied processId.

stream_stdout_stderr class-attribute instance-attribute

stream_stdout_stderr: bool | None = None

Stream stdout/stderr via command/exec/outputDelta notifications.

Streamed bytes are not duplicated into the final response and require a client-supplied processId.

timeout_ms class-attribute instance-attribute

timeout_ms: int | None = None

Optional timeout in milliseconds.

When omitted, the server default applies. Cannot be combined with disableTimeout.

tty class-attribute instance-attribute

tty: bool | None = None

Enable PTY mode.

This implies streamStdin and streamStdoutStderr.

:fa-brands-github: Show source on GitHub