codex

    Codex SDK, with some useful tools for building AI applications.

    AI
    Download zip
    Version
    0.151.0
    License
    Apache-2.0
    Last updated
    3 days ago
    Downloads
    31

    Dependencies

    #MoonBit Codex SDK

    This is the Codex SDK for MoonBit, ported from the TypeScript SDK.

    The SDK communicates with Codex by spawning it in non-interactive mode using codex exec. The target Codex version is codex-cli 0.150.1.

    Codex must be installed and available on your PATH. If not, install with:

    pnpm install -g @openai/codex@0.150.1

    #Usage

    The simplest way to use Codex is to create a @codex.Codex and start a @codex.Thread. Then create a @codex.Turn from the thread using @codex.Thread::run. By default, the OPENAI_API_KEY environment variable is read.

    If you are already paid ChatGPT users, you can run the code below directly

    ///|
    #skip
    async test {
    let codex = @codex.Codex::new()
    let thread = codex.start_thread()
    let turn = thread.run("Hello, what model are you using?")
    // I’m `GPT-5.2`, running inside the Codex CLI harness in your repo (`/Users/../codex-sdk`).
    println(turn.final_response)
    println(turn.items.to_json().stringify())
    println(turn.usage.to_json().stringify())
    }

    ///|
    #skip
    async test {
    let codex = @codex.Codex::new(
    options=@codex.CodexOptions::new(base_url="https://openrouter.ai/api/v1"),
    )
    let thread = codex.start_thread(
    options=@codex.ThreadOptions::new(model="anthropic/claude-sonnet-4.5"),
    )
    let turn = thread.run("Hello?")
    println(turn.final_response)
    println(turn.items.to_json().stringify())
    println(turn.usage.to_json().stringify())
    }

    For incremental usage, import the @generator package and use @codex.Thread::run_streamed.

    ///|
    #skip
    async test {
    let codex = @codex.Codex::new(
    options=@codex.CodexOptions::new(base_url="https://openrouter.ai/api/v1"),
    )
    let thread = codex.start_thread(
    options=@codex.ThreadOptions::new(model="anthropic/claude-sonnet-4.5"),
    )
    @async.with_task_group(tg => {
    let streamed_turn = thread.run_streamed("Hello?", tg)
    while streamed_turn.events.next() is Some(event) {
    println(event.to_json().stringify())
    }
    }) catch {
    e => println(e)
    }
    }

    #Architecture Overview

    #Process boundary and transport

    The MoonBit SDK is a thin but strongly typed wrapper around codex exec:

    1. @codex.CodexExec::run spawns the CLI with --experimental-json, automatically wiring API endpoint overrides, API keys, sandbox flags, working directory overrides, and thread resumption arguments.
    2. The CLI's JSONL stream is fed through @generator.AsyncGenerator so the SDK can yield events as soon as they arrive. This keeps Codex long-running commands responsive while avoiding blocking MoonBit's async runtime.
    3. Each line is decoded into the rich @codex.Event / @codex.ThreadItem hierarchy (events.mbt and items.mbt), which means MoonBit callers never manipulate raw JSON.

    The native JSON event parser targets the codex-cli 0.150.1 non-interactive event stream, checked against the upstream openai/codex release tag rust-v0.150.1. Usage includes prompt-cache writes when reported by the CLI, while older CLIs that omit that counter decode it as zero.

    The Codex/Thread/Turn trio mirrors the CLI lifecycle: a Codex holds process-level configuration, a Thread models a Codex conversation, and a Turn captures the completed response plus token usage metrics.

    #Thread lifecycle and safety

    • Thread::run_streamed owns the async generator returned by CodexExec::run. The method updates the cached thread id when ThreadStarted surfaces, so a later Thread::run call automatically resumes the same conversation.
    • Thread::run is implemented on top of the streaming primitive. It drains the generator, records AgentMessageItem content as the Turn.final_response, retains the full item history for post-processing (e.g., capturing diffs or tool invocations), and surfaces TurnFailed by raising an error after draining the iterator to prevent resource leaks.
    • Structured cleanup exists everywhere a temporary artifact is created; for example, @codex::create_output_schema_file creates /tmp/codex-output-schema-* directories and ensures they are removed even when errors occur.

    #Events, items, and observability

    The CLI emits high-level telemetry that is mirrored by the SDK:

    • Event::ThreadStarted, TurnStarted, TurnCompleted, and TurnFailed make it trivial to instrument throughput, retries, and token usage.
    • ThreadItem variants capture everything the agent does: CommandExecutionItem surfaces shell commands with exit codes, FileChangeItem contains per-file diffs, McpToolCallItem shows MCP tool usage, and TodoListItem exposes the agent's internal plan.
    • All enums (sandbox mode, approval mode, command status, etc.) expose ToJson/FromJson so you can persist structured logs or forward them to observability backends without lossy string manipulation.

    #Structured output and schema enforcement

    TurnOptions.output_schema accepts an arbitrary JSON schema. When provided, Thread::run / run_streamed transparently:

    1. Creates a temporary schema file on disk.
    2. Passes --output-schema /tmp/.../schema.json to the CLI.
    3. Deletes the schema file after the turn completes or fails (even if exceptions arise).

    This makes it safe to require JSON output without managing files yourself. The final assistant message still flows through ThreadItem::AgentMessageItem, so you can parse it with @json.parse once the turn completes.

    #Configuration layers

    • CodexOptions sets global API concerns (binary override, base URL, API key) once per process.
    • ThreadOptions controls per-thread concerns such as the model, sandbox levels (read-only, workspace-write, danger-full-access), working directory routing, and Git safety checks.
    • TurnOptions tunes per-turn behavior, currently focusing on structured output but intentionally keeping room for future features (e.g., custom completion criteria). Because configuration objects implement ToJson/FromJson, they can be marshalled into other systems (task schedulers, Codex automation) without reimplementing serialization.

    #Advanced Usage Patterns

    #Instrument streaming events

    You can subscribe to the event stream for telemetry, custom retry logic, or UI overlays without waiting for a completed turn:

    ///|
    #skip
    async test {
    let codex = @codex.Codex::new()
    let thread = codex.start_thread()
    @async.with_task_group(tg => {
    let turn = thread.run_streamed("Summarize today's commits", tg)
    while turn.events.next() is Some(event) {
    match event {
    ItemStarted(item) => println("started: \{item.to_json().stringify()}")
    ItemCompleted(AgentMessageItem(text~, ..)) =>
    println("assistant: \{text}")
    TurnCompleted(usage) =>
    println("tokens in/out: \{usage.input_tokens}/\{usage.output_tokens}")
    TurnFailed(error) => fail("codex turn failed: \{error.message}")
    _ => ()
    }
    }
    })
    }

    #Enforce structured responses

    The temporary-schema mechanism lets you demand JSON (or any schema-valid structure) without extra boilerplate:

    ///|
    #skip
    async test {
    let codex = @codex.Codex::new()
    let thread = codex.start_thread()
    let turn = thread.run(
    "Plan the next refactor as JSON",
    turn_options=@codex.TurnOptions::new(output_schema={
    "type": "object",
    "properties": {
    "summary": { "type": "string" },
    "files_to_touch": { "type": "array", "items": { "type": "string" } },
    },
    "required": ["summary", "files_to_touch"],
    "additionalProperties": false, // required to be supplied as valid schema
    }),
    )
    println(turn.final_response)
    let plan_json = @json.parse(turn.final_response)
    println(plan_json.stringify(indent=2))
    }

    These primitives compose cleanly with your own orchestration layers, since everything in the SDK is expressed as plain MoonBit structs and async functions.

    #Connect to Codex app-server

    The app-server surface is separate from codex exec --experimental-json. It runs as a persistent JSON-RPC process. Prefer Codex::with_app_server_session for app integrations: the SDK owns the task group, starts the app-server process, sends the required initialize request plus initialized notification, runs the shared notification pump, and closes stdin when your callback returns.

    The SDK starts the process through codex app-server --listen stdio://, using CodexOptions::codex_path_override or AppServerOptions::executable_path_override when you need a non-default Codex CLI path. Request handlers are async, so approval flows may do I/O before returning a JSON-RPC response.

    The session is the ergonomic concurrency layer:

    • start_thread and resume_thread return thread handles that own their thread id.
    • Session-level RPCs such as plugin_list, marketplace_add, config_read, and fs_read_file are available directly on the session without exposing the raw shared event stream.
    • CodexAppThread::run_streamed starts a turn and returns a per-turn stream. It registers the stream before sending turn/start, so early notifications are not lost while the RPC response is in flight.
    • Turn-scoped server requests, such as approvals and user-input requests, are routed to the handler passed to the thread's streamed turn.
    • Thread-scoped server requests fall back to the handler set on the thread.
    • Session-level server requests fall back to the optional request_handler passed to with_app_server_session.
    • next_global_event on the session receives non-turn or unregistered app-server notifications.

    Because app-server carries more than turn-stream events, request handling is kept on a separate channel from notifications. When a notification is semantically the same as the existing exec stream, use AppServerEvent::thread_event to bridge it back to Event.

    For lower-level integrations, Codex::with_app_server exposes the raw CodexAppConnection. Its next_event method is a shared connection-level stream: use a single consumer and fan events out yourself if multiple turns are active.

    The typed app-server surface targets the stable v2 schema shipped with Codex 0.150.1. It includes current initialize capabilities, rich text/image/audio inputs, client message ids, thread sources and sections, newer reasoning levels, and the latest approval metadata. Set experimental_api=true in AppInitializeCapabilities to opt into experimental methods and fields.

    CodexAppSession::request and CodexAppConnection::request expose every app-server method as raw JSON when a dedicated typed convenience method is not available. Likewise, unrecognized notifications and server requests are delivered as AppRawNotification and AppRawServerRequest; handlers can reply with AppRawServerResponse, or reject one with AppRawServerError. This keeps additions in the release protocol usable without silently discarding them.

    The shared request transport automatically retries the app-server's retryable -32001 overload response with bounded exponential backoff.

    The real app-server e2e test is marked #skip because it uses the local Codex CLI and can make authenticated model requests. It reads skills/list and runs a tiny streamed hello turn. Run it explicitly with moon test app_server_e2e_test.mbt --include-skipped. Set CODEX_SDK_E2E_CODEX_PATH when testing a non-default binary, and CODEX_SDK_E2E_MODEL when testing a specific model.

    ///|
    #skip
    async test {
    @codex.Codex::new().with_app_server_session(async fn(session) {
    let _ = session.plugin_list(@codex.AppPluginListParams::{
    cwds: None,
    marketplace_kinds: None,
    })
    let thread = session.start_thread()
    let review_thread = session.start_thread()
    let turn_input = [@codex.AppUserInput::AppInputText(text="hello")]
    let turn = thread.run_streamed(turn_input, request_handler=fn(request) {
    match request.details {
    @codex.AppServerRequestDetails::AppCommandExecutionApprovalRequest(_) =>
    @codex.AppServerResponse::AppCommandExecutionApprovalResponse(
    decision=@codex.AppCommandExecutionApprovalDecision::AppCommandDecline,
    )
    @codex.AppServerRequestDetails::AppFileChangeApprovalRequest(_) =>
    @codex.AppServerResponse::AppFileChangeApprovalResponse(
    decision=@codex.AppFileChangeApprovalDecision::AppFileChangeDecline,
    )
    @codex.AppServerRequestDetails::AppToolRequestUserInputRequest(_) =>
    @codex.AppServerResponse::AppToolRequestUserInputResponse(answers={})
    @codex.AppServerRequestDetails::AppDynamicToolCallRequest(_) =>
    @codex.AppServerResponse::AppDynamicToolCallResponse(
    content_items=[
    @codex.AppDynamicToolCallOutputContentItem::AppDynamicToolCallOutputText(
    text="declined",
    ),
    ],
    success=false,
    )
    @codex.AppServerRequestDetails::AppPermissionsRequestApprovalRequest(_) =>
    @codex.AppServerResponse::AppPermissionsRequestApprovalResponse(
    permissions=@codex.AppGrantedPermissionProfile::{
    network: None,
    file_system: None,
    },
    scope=@codex.AppPermissionGrantScope::AppPermissionGrantTurn,
    strict_auto_review=None,
    )
    @codex.AppServerRequestDetails::AppChatgptAuthTokensRefreshRequest(_) =>
    @codex.AppServerResponse::AppChatgptAuthTokensRefreshResponse(
    access_token="",
    chatgpt_account_id="",
    chatgpt_plan_type=None,
    )
    @codex.AppServerRequestDetails::AppAttestationGenerateRequest(_) =>
    @codex.AppServerResponse::AppAttestationGenerateResponse(token="")
    @codex.AppServerRequestDetails::AppMcpServerElicitationRequest(_) =>
    @codex.AppServerResponse::AppMcpServerElicitationResponse(
    action=@codex.AppMcpServerElicitationAction::AppMcpElicitationDecline,
    content=None,
    meta=None,
    )
    @codex.AppServerRequestDetails::AppRawServerRequest(..) =>
    @codex.AppServerResponse::AppRawServerResponse({})
    }
    })
    let review_turn = review_thread.run_streamed([
    @codex.AppUserInput::AppInputText(text="review this"),
    ])

    while turn.next() is Some(event) {
    match event.thread_event() {
    Some(@codex.Event::ItemStarted(item)) =>
    println(item.to_json().stringify())
    _ => ()
    }
    }
    review_turn.close()

    while session.next_global_event() is Some(event) {
    ignore(event)
    }
    })
    }

    ///|
    #skip
    async test {
    @codex.Codex::new().with_app_server(async fn(connection) {
    while connection.next_event() is Some(event) {
    ignore(event)
    }
    })
    }

    AppServerRequestHandler

    type AppServerRequestHandler = async (AppServerRequest) -> AppServerResponse

    Input

    type Input = Array[UserInput]

    An input to send to the agent.

    AppAccount

    pub enum AppAccount {
    AppAccountApiKey
    AppAccountChatGPT(email~ : String, plan_type~ : AppPlanType)
    AppAccountAmazonBedrock
    } derive(
    Debug
    )

    AppAccountLoginStartResponse

    pub enum AppAccountLoginStartResponse {
    AppAccountLoginApiKey
    AppAccountLoginChatGPT(login_id~ : String, auth_url~ : String)
    AppAccountLoginChatGPTDeviceCode(login_id~ : String, verification_url~ : String, user_code~ : String)
    AppAccountLoginChatGPTAuthTokens
    } derive(
    Debug
    )

    AppAccountRateLimitsReadResponse

    pub struct AppAccountRateLimitsReadResponse {
    rate_limits : AppRateLimitSnapshot
    rate_limits_by_limit_id : Map[String, AppRateLimitSnapshot]?
    } derive(
    Debug
    )

    AppAccountReadParams

    pub(all) struct AppAccountReadParams {
    refresh_token : Bool
    } derive(
    Debug
    )

    AppAccountReadResponse

    pub struct AppAccountReadResponse {
    account : AppAccount?
    requires_openai_auth : Bool
    } derive(
    Debug
    )

    AppAddCreditsNudgeEmailStatus

    pub enum AppAddCreditsNudgeEmailStatus {
    AppAddCreditsNudgeSent
    AppAddCreditsNudgeCooldownActive
    } derive(
    Debug
    )

    AppAddCreditsNudgeKind

    pub(all) enum AppAddCreditsNudgeKind {
    AppNudgeCredits
    AppNudgeUsageLimit
    } derive(
    Debug
    )

    AppAdditionalFileSystemPermissions

    pub(all) struct AppAdditionalFileSystemPermissions {
    read : ArrayView[String]?
    write : ArrayView[String]?
    glob_scan_max_depth : UInt64?
    entries : ArrayView[AppFileSystemSandboxEntry]?
    } derive(
    Debug
    )

    AppAdditionalNetworkPermissions

    pub(all) struct AppAdditionalNetworkPermissions {
    enabled : Bool?
    } derive(
    Debug
    )

    AppAnalyticsConfig

    pub struct AppAnalyticsConfig {
    enabled : Bool?
    additional : Map[String, Json]
    // private fields
    } derive(
    Debug
    )

    AppApprovalPolicy

    pub(all) enum AppApprovalPolicy {
    AppApprovalUntrusted
    AppApprovalOnFailure
    AppApprovalOnRequest
    AppApprovalNever
    AppApprovalGranular(sandbox_approval~ : Bool, rules~ : Bool, skill_approval~ : Bool, request_permissions~ : Bool, mcp_elicitations~ : Bool)
    } derive(
    Debug
    )

    AppApprovalsReviewer

    pub(all) enum AppApprovalsReviewer {
    AppReviewerUser
    AppReviewerAutoReview
    AppReviewerGuardianSubagent
    } derive(
    Debug
    )

    AppAppsDefaultConfig

    pub struct AppAppsDefaultConfig {
    enabled : Bool
    destructive_enabled : Bool
    open_world_enabled : Bool
    } derive(
    Debug
    )

    AppAttestationGenerateRequest

    pub(all) struct AppAttestationGenerateRequest {
    // private fields
    } derive(
    Debug
    )

    AppAuthMode

    pub enum AppAuthMode {
    AppAuthApiKey
    AppAuthChatGPT
    AppAuthChatGPTAuthTokens
    AppAuthAgentIdentity
    } derive(
    Debug
    )

    AppAutoReviewDecisionSource

    pub(all) enum AppAutoReviewDecisionSource {
    AppAutoReviewDecisionAgent
    } derive(
    Debug
    )

    AppByteRange

    pub(all) struct AppByteRange {
    start : UInt64
    end : UInt64
    } derive(
    Debug
    )

    AppCancelLoginAccountParams

    pub(all) struct AppCancelLoginAccountParams {
    login_id : String
    } derive(
    Debug
    )

    AppCancelLoginAccountStatus

    pub enum AppCancelLoginAccountStatus {
    AppCancelLoginCanceled
    AppCancelLoginNotFound
    } derive(
    Debug
    )

    AppChatgptAuthTokensRefreshReason

    pub(all) enum AppChatgptAuthTokensRefreshReason {
    AppChatgptAuthTokensUnauthorized
    } derive(
    Debug
    )

    AppChatgptAuthTokensRefreshRequest

    pub(all) struct AppChatgptAuthTokensRefreshRequest {
    reason : AppChatgptAuthTokensRefreshReason
    previous_account_id : String?
    // private fields
    } derive(
    Debug
    )

    AppClientInfo

    pub(all) struct AppClientInfo {
    name : String
    title : String?
    version : String
    } derive(
    Debug
    )

    AppCodexErrorInfo

    pub enum AppCodexErrorInfo {
    AppContextWindowExceeded
    AppUsageLimitExceeded
    AppServerOverloaded
    AppCyberPolicy
    AppHttpConnectionFailed(http_status_code~ : Int?)
    AppResponseStreamConnectionFailed(http_status_code~ : Int?)
    AppInternalServerError
    AppUnauthorized
    AppBadRequest
    AppThreadRollbackFailed
    AppSandboxError
    AppResponseStreamDisconnected(http_status_code~ : Int?)
    AppResponseTooManyFailedAttempts(http_status_code~ : Int?)
    AppActiveTurnNotSteerable(turn_kind~ : AppNonSteerableTurnKind)
    AppCodexOtherError
    } derive(
    Debug
    )

    AppCollaborationModeKind

    pub(all) enum AppCollaborationModeKind {
    AppCollaborationPlan
    AppCollaborationDefault
    } derive(
    Debug
    )

    AppCollaborationModeMask

    pub(all) struct AppCollaborationModeMask {
    name : String
    mode : AppCollaborationModeKind?
    model : String?
    reasoning_effort : AppReasoningEffort?
    } derive(
    Debug
    )

    AppCommandAction

    pub enum AppCommandAction {
    AppCommandReadAction(command~ : String, name~ : String, path~ : String)
    AppCommandListFilesAction(command~ : String, path~ : String?)
    AppCommandSearchAction(command~ : String, query~ : String?, path~ : String?)
    AppCommandUnknownAction(command~ : String)
    } derive(
    Debug
    )

    AppCommandExecParams

    pub(all) struct AppCommandExecParams {
    command : Array[String]
    process_id : String?
    tty : Bool?
    stream_stdin : Bool?
    stream_stdout_stderr : Bool?
    output_bytes_cap : UInt64?
    disable_output_cap : Bool?
    disable_timeout : Bool?
    timeout_ms : Int64?
    cwd : String?
    env : Map[String, String?]?
    size : AppCommandExecTerminalSize?
    sandbox_policy : AppSandboxPolicy?
    } derive(
    Debug
    )

    AppCommandExecProcessParams

    pub(all) struct AppCommandExecProcessParams {
    process_id : String
    } derive(
    Debug
    )

    AppCommandExecResizeParams

    pub(all) struct AppCommandExecResizeParams {
    process_id : String
    size : AppCommandExecTerminalSize
    } derive(
    Debug
    )

    AppCommandExecResponse

    pub struct AppCommandExecResponse {
    exit_code : Int
    stdout : String
    stderr : String
    } derive(
    Debug
    )

    AppCommandExecTerminalSize

    pub(all) struct AppCommandExecTerminalSize {
    rows : UInt16
    cols : UInt16
    } derive(
    Debug
    )

    AppCommandExecWriteParams

    pub(all) struct AppCommandExecWriteParams {
    process_id : String
    delta_base64 : String?
    close_stdin : Bool?
    } derive(
    Debug
    )

    AppCommandExecutionApprovalDecision

    pub(all) enum AppCommandExecutionApprovalDecision {
    AppCommandAccept
    AppCommandAcceptForSession
    AppCommandDecline
    AppCommandCancel
    AppCommandAcceptWithExecpolicyAmendment(ArrayView[String])
    AppCommandApplyNetworkPolicyAmendment(AppNetworkPolicyAmendment)
    } derive(
    Debug
    )

    AppCommandExecutionApprovalKind

    pub(all) enum AppCommandExecutionApprovalKind {
    AppCommandApprovalCommand
    AppCommandApprovalWriteStdin
    } derive(
    Debug
    )

    AppCommandExecutionApprovalRequest

    pub(all) struct AppCommandExecutionApprovalRequest {
    kind : AppCommandExecutionApprovalKind
    thread_id : String
    turn_id : String
    item_id : String
    started_at_ms : Int64
    approval_id : String?
    environment_id : String?
    reason : String?
    network_approval_context : AppNetworkApprovalContext?
    command : String?
    cwd : String?
    command_actions : ArrayView[AppCommandAction]?
    proposed_execpolicy_amendment : ArrayView[String]?
    proposed_network_policy_amendments : ArrayView[AppNetworkPolicyAmendment]?
    // private fields
    } derive(
    Debug
    )

    AppConfigBatchWriteParams

    pub(all) struct AppConfigBatchWriteParams {
    edits : Array[AppConfigEdit]
    file_path : String?
    expected_version : String?
    reload_user_config : Bool?
    } derive(
    Debug
    )

    AppConfigBatchWriteResponse

    pub struct AppConfigBatchWriteResponse {
    status : AppConfigWriteStatus
    version : String
    file_path : String
    overridden_metadata : AppConfigOverriddenMetadata?
    } derive(
    Debug
    )

    AppConfigEdit

    pub(all) struct AppConfigEdit {
    key_path : String
    value : Json
    merge_strategy : AppMergeStrategy
    } derive(
    Debug
    )

    AppConfigLayer

    pub struct AppConfigLayer {
    name : AppConfigLayerSource
    version : String
    config : Json
    disabled_reason : String?
    } derive(
    Debug
    )

    AppConfigLayerMetadata

    pub struct AppConfigLayerMetadata {
    name : AppConfigLayerSource
    version : String
    } derive(
    Debug
    )

    AppConfigLayerSource

    pub enum AppConfigLayerSource {
    AppConfigLayerMdm(domain~ : String, key~ : String)
    AppConfigLayerSystem(file~ : String)
    AppConfigLayerUser(file~ : String)
    AppConfigLayerProject(dot_codex_folder~ : String)
    AppConfigLayerSessionFlags
    AppConfigLayerLegacyManagedConfigTomlFromFile(file~ : String)
    AppConfigLayerLegacyManagedConfigTomlFromMdm
    } derive(
    Debug
    )

    AppConfigOverriddenMetadata

    pub struct AppConfigOverriddenMetadata {
    message : String
    overriding_layer : AppConfigLayerMetadata
    effective_value : Json
    } derive(
    Debug
    )

    AppConfigReadParams

    pub struct AppConfigReadParams {
    include_layers : Bool
    cwd : String?
    } derive(
    Debug
    )

    AppConfigReadParams::new

    fn AppConfigReadParams::new(include_layers : Bool, cwd? : String) -> AppConfigReadParams

    AppConfigRequirements

    pub struct AppConfigRequirements {
    allowed_approval_policies : ArrayView[AppApprovalPolicy]?
    allowed_sandbox_modes : ArrayView[SandboxMode]?
    allowed_web_search_modes : ArrayView[AppWebSearchMode]?
    allow_managed_hooks_only : Bool?
    feature_requirements : Map[String, Bool]?
    enforce_residency : AppResidencyRequirement?
    } derive(
    Debug
    )

    AppConfigRequirementsReadResponse

    pub struct AppConfigRequirementsReadResponse {
    requirements : AppConfigRequirements?
    } derive(
    Debug
    )

    AppConfigSnapshot

    pub struct AppConfigSnapshot {
    model : String?
    review_model : String?
    model_context_window : Int64?
    model_auto_compact_token_limit : Int64?
    model_provider : String?
    approval_policy : AppApprovalPolicy?
    approvals_reviewer : AppApprovalsReviewer?
    sandbox_mode : SandboxMode?
    sandbox_workspace_write : AppSandboxWorkspaceWrite?
    forced_chatgpt_workspace_id : String?
    forced_login_method : AppForcedLoginMethod?
    web_search : AppWebSearchMode?
    tools : AppConfigToolsV2?
    profile : String?
    profiles : Map[String, AppProfileV2]
    instructions : String?
    developer_instructions : String?
    compact_prompt : String?
    model_reasoning_effort : AppReasoningEffort?
    model_reasoning_summary : AppReasoningSummary?
    model_verbosity : AppModelVerbosity?
    service_tier : String?
    analytics : AppAnalyticsConfig?
    apps : AppAppsConfig?
    additional : Map[String, Json]
    // private fields
    } derive(
    Debug
    )

    AppConfigToolsV2

    pub struct AppConfigToolsV2 {
    web_search : AppWebSearchToolConfig?
    view_image : Bool?
    } derive(
    Debug
    )

    AppConfigValueWriteParams

    pub(all) struct AppConfigValueWriteParams {
    key_path : String
    value : Json
    merge_strategy : AppMergeStrategy
    file_path : String?
    expected_version : String?
    } derive(
    Debug
    )

    AppConfigValueWriteResponse

    pub struct AppConfigValueWriteResponse {
    status : AppConfigWriteStatus
    version : String
    file_path : String
    overridden_metadata : AppConfigOverriddenMetadata?
    } derive(
    Debug
    )

    AppConfigWriteStatus

    pub enum AppConfigWriteStatus {
    AppConfigWriteOk
    AppConfigWriteOkOverridden
    } derive(
    Debug
    )

    AppConnectorConfig

    pub struct AppConnectorConfig {
    enabled : Bool
    destructive_enabled : Bool?
    open_world_enabled : Bool?
    default_tools_approval_mode : AppToolApproval?
    default_tools_enabled : Bool?
    tools : AppToolsConfig?
    } derive(
    Debug
    )

    AppConversationGitInfo

    pub struct AppConversationGitInfo {
    sha : String?
    branch : String?
    origin_url : String?
    } derive(
    Debug
    )

    AppCreditsSnapshot

    pub struct AppCreditsSnapshot {
    has_credits : Bool
    unlimited : Bool
    balance : String?
    } derive(
    Debug
    )

    AppCursorLimitParams

    pub(all) struct AppCursorLimitParams {
    cursor : String?
    limit : UInt?
    } derive(
    Debug
    )

    AppDynamicToolCallOutputContentItem

    pub(all) enum AppDynamicToolCallOutputContentItem {
    AppDynamicToolCallOutputText(text~ : String)
    AppDynamicToolCallOutputImage(image_url~ : String)
    } derive(
    Debug
    )

    AppDynamicToolCallRequest

    pub(all) struct AppDynamicToolCallRequest {
    thread_id : String
    turn_id : String
    call_id : String
    tool_namespace : String?
    tool : String
    arguments : Json
    // private fields
    } derive(
    Debug
    )

    AppExperimentalFeature

    pub struct AppExperimentalFeature {
    name : String
    stage : AppExperimentalFeatureStage
    display_name : String?
    description : String?
    announcement : String?
    enabled : Bool
    default_enabled : Bool
    } derive(
    Debug
    )

    AppExperimentalFeatureEnablementSetParams

    pub(all) struct AppExperimentalFeatureEnablementSetParams {
    enablement : Map[String, Bool]
    } derive(
    Debug
    )

    AppExperimentalFeatureEnablementSetResponse

    pub struct AppExperimentalFeatureEnablementSetResponse {
    enablement : Map[String, Bool]
    } derive(
    Debug
    )

    AppExperimentalFeatureListResponse

    pub struct AppExperimentalFeatureListResponse {
    data : ArrayView[AppExperimentalFeature]
    next_cursor : String?
    } derive(
    Debug
    )

    AppExperimentalFeatureStage

    pub enum AppExperimentalFeatureStage {
    AppFeatureBeta
    AppFeatureUnderDevelopment
    AppFeatureStable
    AppFeatureDeprecated
    AppFeatureRemoved
    } derive(
    Debug
    )

    AppExternalAgentConfigDetectParams

    pub(all) struct AppExternalAgentConfigDetectParams {
    include_home : Bool?
    cwds : Array[String]?
    } derive(
    Debug
    )

    AppExternalAgentConfigImportParams

    pub(all) struct AppExternalAgentConfigImportParams {
    migration_items : Array[AppExternalAgentConfigMigrationItem]
    } derive(
    Debug
    )

    AppExternalAgentConfigMigrationItem

    pub(all) struct AppExternalAgentConfigMigrationItem {
    item_type : AppExternalAgentConfigMigrationItemType
    description : String
    cwd : String?
    details : AppMigrationDetails?
    } derive(
    Debug
    )

    AppExternalAgentConfigMigrationItemType

    pub(all) enum AppExternalAgentConfigMigrationItemType {
    AppMigrationAgentsMd
    AppMigrationConfig
    AppMigrationSkills
    AppMigrationPlugins
    AppMigrationMcpServerConfig
    AppMigrationSubagents
    AppMigrationHooks
    AppMigrationCommands
    AppMigrationSessions
    } derive(
    Debug
    )

    AppFeedbackUploadParams

    pub(all) struct AppFeedbackUploadParams {
    classification : String
    reason : String?
    thread_id : String?
    include_logs : Bool
    extra_log_files : Array[String]?
    tags : Map[String, String]?
    } derive(
    Debug
    )

    AppFeedbackUploadResponse

    pub struct AppFeedbackUploadResponse {
    thread_id : String
    } derive(
    Debug
    )

    AppFileChangeApprovalDecision

    pub(all) enum AppFileChangeApprovalDecision {
    AppFileChangeAccept
    AppFileChangeAcceptForSession
    AppFileChangeDecline
    AppFileChangeCancel
    } derive(
    Debug
    )

    AppFileChangeApprovalRequest

    pub(all) struct AppFileChangeApprovalRequest {
    thread_id : String
    turn_id : String
    item_id : String
    started_at_ms : Int64
    reason : String?
    grant_root : String?
    // private fields
    } derive(
    Debug
    )

    AppFileSystemAccessMode

    pub(all) enum AppFileSystemAccessMode {
    AppFileSystemReadAccess
    AppFileSystemWriteAccess
    AppFileSystemNoAccess
    } derive(
    Debug
    )

    AppFileSystemPath

    pub(all) enum AppFileSystemPath {
    AppFileSystemAbsolutePath(path~ : String)
    AppFileSystemGlobPattern(pattern~ : String)
    AppFileSystemSpecialPath(value~ : AppFileSystemSpecialPath)
    } derive(
    Debug
    )

    AppFileSystemSpecialPath

    pub(all) enum AppFileSystemSpecialPath {
    AppFileSystemRoot
    AppFileSystemMinimal
    AppFileSystemProjectRoots(subpath~ : String?)
    AppFileSystemTmpdir
    AppFileSystemSlashTmp
    AppFileSystemUnknown(path~ : String, subpath~ : String?)
    } derive(
    Debug
    )

    AppForcedLoginMethod

    pub enum AppForcedLoginMethod {
    AppForcedLoginChatGPT
    AppForcedLoginApi
    } derive(
    Debug
    )

    AppFsCopyParams

    pub(all) struct AppFsCopyParams {
    source_path : String
    destination_path : String
    recursive : Bool?
    } derive(
    Debug
    )

    AppFsCreateDirectoryParams

    pub(all) struct AppFsCreateDirectoryParams {
    path : String
    recursive : Bool?
    } derive(
    Debug
    )

    AppFsGetMetadataResponse

    pub struct AppFsGetMetadataResponse {
    is_directory : Bool
    is_file : Bool
    is_symlink : Bool
    created_at_ms : Int64
    modified_at_ms : Int64
    } derive(
    Debug
    )

    AppFsPathParams

    pub(all) struct AppFsPathParams {
    path : String
    } derive(
    Debug
    )

    AppFsReadDirectoryEntry

    pub struct AppFsReadDirectoryEntry {
    file_name : String
    is_directory : Bool
    is_file : Bool
    } derive(
    Debug
    )

    AppFsReadFileResponse

    pub struct AppFsReadFileResponse {
    data_base64 : String
    } derive(
    Debug
    )

    AppFsRemoveParams

    pub(all) struct AppFsRemoveParams {
    path : String
    recursive : Bool?
    force : Bool?
    } derive(
    Debug
    )

    AppFsUnwatchParams

    pub(all) struct AppFsUnwatchParams {
    watch_id : String
    } derive(
    Debug
    )

    AppFsWatchParams

    pub(all) struct AppFsWatchParams {
    watch_id : String
    path : String
    } derive(
    Debug
    )

    AppFsWatchResponse

    pub struct AppFsWatchResponse {
    path : String
    } derive(
    Debug
    )

    AppFsWriteFileParams

    pub(all) struct AppFsWriteFileParams {
    path : String
    data_base64 : String
    } derive(
    Debug
    )

    AppFuzzyFileSearchMatchType

    pub enum AppFuzzyFileSearchMatchType {
    AppFuzzyFile
    AppFuzzyDirectory
    } derive(
    Debug
    )

    AppFuzzyFileSearchParams

    pub(all) struct AppFuzzyFileSearchParams {
    query : String
    roots : Array[String]
    cancellation_token : String?
    } derive(
    Debug
    )

    AppFuzzyFileSearchResult

    pub struct AppFuzzyFileSearchResult {
    root : String
    path : String
    match_type : AppFuzzyFileSearchMatchType
    file_name : String
    score : UInt
    indices : ArrayView[UInt]?
    } derive(
    Debug
    )

    AppFuzzyFileSearchSessionStartParams

    pub(all) struct AppFuzzyFileSearchSessionStartParams {
    session_id : String
    roots : Array[String]
    } derive(
    Debug
    )

    AppFuzzyFileSearchSessionStopParams

    pub(all) struct AppFuzzyFileSearchSessionStopParams {
    session_id : String
    } derive(
    Debug
    )

    AppFuzzyFileSearchSessionUpdateParams

    pub(all) struct AppFuzzyFileSearchSessionUpdateParams {
    session_id : String
    query : String
    } derive(
    Debug
    )

    AppGuardianApprovalReview

    pub(all) struct AppGuardianApprovalReview {
    status : AppGuardianApprovalReviewStatus
    risk_level : AppGuardianRiskLevel?
    user_authorization : AppGuardianUserAuthorization?
    rationale : String?
    } derive(
    Debug
    )

    AppGuardianApprovalReviewAction

    pub(all) enum AppGuardianApprovalReviewAction {
    AppGuardianCommandAction(source~ : AppGuardianCommandSource, command~ : String, cwd~ : String)
    AppGuardianExecveAction(source~ : AppGuardianCommandSource, program~ : String, argv~ : ArrayView[String], cwd~ : String)
    AppGuardianApplyPatchAction(cwd~ : String, files~ : ArrayView[String])
    AppGuardianNetworkAccessAction(target~ : String, host~ : String, protocol~ : AppNetworkApprovalProtocol, port~ : UInt)
    AppGuardianMcpToolCallAction(server~ : String, tool_name~ : String, connector_id~ : String?, connector_name~ : String?, tool_title~ : String?)
    AppGuardianRequestPermissionsAction(reason~ : String?, permissions~ : AppRequestPermissionProfile)
    } derive(
    Debug
    )

    AppGuardianApprovalReviewStatus

    pub(all) enum AppGuardianApprovalReviewStatus {
    AppGuardianReviewInProgress
    AppGuardianReviewApproved
    AppGuardianReviewDenied
    AppGuardianReviewTimedOut
    AppGuardianReviewAborted
    } derive(
    Debug
    )

    AppGuardianCommandSource

    pub(all) enum AppGuardianCommandSource {
    AppGuardianCommandSourceShell
    AppGuardianCommandSourceUnifiedExec
    } derive(
    Debug
    )

    AppGuardianRiskLevel

    pub(all) enum AppGuardianRiskLevel {
    AppGuardianRiskLow
    AppGuardianRiskMedium
    AppGuardianRiskHigh
    AppGuardianRiskCritical
    } derive(
    Debug
    )

    AppGuardianUserAuthorization

    pub(all) enum AppGuardianUserAuthorization {
    AppGuardianUserAuthorizationUnknown
    AppGuardianUserAuthorizationLow
    AppGuardianUserAuthorizationMedium
    AppGuardianUserAuthorizationHigh
    } derive(
    Debug
    )

    AppHookErrorInfo

    pub struct AppHookErrorInfo {
    path : String
    message : String
    } derive(
    Debug
    )

    AppHookEventName

    pub enum AppHookEventName {
    AppHookPreToolUse
    AppHookPermissionRequest
    AppHookPostToolUse
    AppHookPreCompact
    AppHookPostCompact
    AppHookSessionStart
    AppHookUserPromptSubmit
    AppHookStop
    } derive(
    Debug
    )

    AppHookExecutionMode

    pub(all) enum AppHookExecutionMode {
    AppHookSyncExecution
    AppHookAsyncExecution
    } derive(
    Debug
    )

    AppHookHandlerType

    pub enum AppHookHandlerType {
    AppHookCommandHandler
    AppHookPromptHandler
    AppHookAgentHandler
    } derive(
    Debug
    )

    AppHookMetadata

    pub struct AppHookMetadata {
    key : String
    event_name : AppHookEventName
    handler_type : AppHookHandlerType
    matcher : String?
    command : String?
    timeout_sec : UInt64
    status_message : String?
    source_path : String
    source : AppHookSource
    plugin_id : String?
    display_order : Int64
    enabled : Bool
    is_managed : Bool
    current_hash : String
    trust_status : AppHookTrustStatus
    // private fields
    } derive(
    Debug
    )

    AppHookOutputEntry

    pub(all) struct AppHookOutputEntry {
    kind : AppHookOutputEntryKind
    text : String
    } derive(
    Debug
    )

    AppHookOutputEntryKind

    pub(all) enum AppHookOutputEntryKind {
    AppHookOutputWarning
    AppHookOutputStop
    AppHookOutputFeedback
    AppHookOutputContext
    AppHookOutputError
    } derive(
    Debug
    )

    AppHookPromptFragment

    pub struct AppHookPromptFragment {
    text : String
    hook_run_id : String
    } derive(
    Debug
    )

    AppHookRunStatus

    pub(all) enum AppHookRunStatus {
    AppHookRunning
    AppHookCompleted
    AppHookFailed
    AppHookBlocked
    AppHookStopped
    } derive(
    Debug
    )

    AppHookRunSummary

    pub(all) struct AppHookRunSummary {
    id : String
    event_name : AppHookEventName
    handler_type : AppHookHandlerType
    execution_mode : AppHookExecutionMode
    scope : AppHookScope
    source_path : String
    source : AppHookSource
    display_order : Int64
    status : AppHookRunStatus
    status_message : String?
    started_at : Int64
    completed_at : Int64?
    duration_ms : Int64?
    entries : ArrayView[AppHookOutputEntry]
    } derive(
    Debug
    )

    AppHookScope

    pub(all) enum AppHookScope {
    AppHookThreadScope
    AppHookTurnScope
    } derive(
    Debug
    )

    AppHookSource

    pub enum AppHookSource {
    AppHookSystemSource
    AppHookUserSource
    AppHookProjectSource
    AppHookMdmSource
    AppHookSessionFlagsSource
    AppHookPluginSource
    AppHookCloudRequirementsSource
    AppHookLegacyManagedConfigFileSource
    AppHookLegacyManagedConfigMdmSource
    AppHookUnknownSource
    } derive(
    Debug
    )

    AppHookTrustStatus

    pub enum AppHookTrustStatus {
    AppHookManagedTrust
    AppHookUntrusted
    AppHookTrusted
    AppHookModified
    } derive(
    Debug
    )

    AppHooksListEntry

    pub struct AppHooksListEntry {
    cwd : String
    hooks : ArrayView[AppHookMetadata]
    warnings : ArrayView[String]
    errors : ArrayView[AppHookErrorInfo]
    } derive(
    Debug
    )

    AppHooksListParams

    pub(all) struct AppHooksListParams {
    cwds : Array[String]?
    } derive(
    Debug
    )

    AppImageDetail

    pub(all) enum AppImageDetail {
    AppImageAuto
    AppImageLow
    AppImageHigh
    AppImageOriginal
    } derive(
    Debug
    )

    Requested fidelity for image inputs.

    AppInfo

    pub struct AppInfo {
    id : String
    name : String
    description : String?
    is_accessible : Bool
    is_enabled : Bool
    plugin_display_names : ArrayView[String]
    // private fields
    } derive(
    Debug
    )

    AppInitializeCapabilities

    pub(all) struct AppInitializeCapabilities {
    experimental_api : Bool
    request_attestation : Bool
    mcp_server_openai_form_elicitation : Bool?
    opt_out_notification_methods : Array[String]?
    extensions : Map[String, Json]?
    } derive(
    Debug
    )

    AppInitializeCapabilities::new

    fn AppInitializeCapabilities::new(experimental_api? : Bool, request_attestation? : Bool, mcp_server_openai_form_elicitation? : Bool, opt_out_notification_methods? : Array[String], extensions? : Map[String, Json]) -> AppInitializeCapabilities

    AppInitializeParams

    pub(all) struct AppInitializeParams {
    client_info : AppClientInfo
    capabilities : AppInitializeCapabilities?
    } derive(
    Debug
    )

    AppInitializeResponse

    pub struct AppInitializeResponse {
    user_agent : String
    codex_home : String
    platform_family : String
    platform_os : String
    } derive(
    Debug
    )

    AppInputModality

    pub(all) enum AppInputModality {
    AppTextModality
    AppImageModality
    } derive(
    Debug
    )

    AppListParams

    pub struct AppListParams {
    cursor : String?
    limit : UInt?
    thread_id : String?
    force_refetch : Bool?
    } derive(
    Debug
    )

    AppListParams::new

    fn AppListParams::new(cursor? : String, limit? : UInt, thread_id? : String, force_refetch? : Bool) -> AppListParams

    AppListResponse

    pub struct AppListResponse {
    data : ArrayView[AppInfo]
    next_cursor : String?
    } derive(
    Debug
    )

    AppLoginAccountParams

    pub(all) enum AppLoginAccountParams {
    AppLoginApiKey(api_key~ : String)
    AppLoginChatGPT(codex_streamlined_login~ : Bool?)
    AppLoginChatGPTDeviceCode
    AppLoginChatGPTAuthTokens(access_token~ : String, chatgpt_account_id~ : String, chatgpt_plan_type~ : String?)
    } derive(
    Debug
    )

    AppMarketplaceAddParams

    pub(all) struct AppMarketplaceAddParams {
    source : String
    ref_name : String?
    sparse_paths : Array[String]?
    } derive(
    Debug
    )

    AppMarketplaceAddResponse

    pub struct AppMarketplaceAddResponse {
    marketplace_name : String
    installed_root : String
    already_added : Bool
    } derive(
    Debug
    )

    AppMarketplaceInterface

    pub struct AppMarketplaceInterface {
    display_name : String?
    // private fields
    } derive(
    Debug
    )

    AppMarketplaceLoadErrorInfo

    pub struct AppMarketplaceLoadErrorInfo {
    marketplace_path : String
    message : String
    } derive(
    Debug
    )

    AppMarketplaceRemoveParams

    pub(all) struct AppMarketplaceRemoveParams {
    marketplace_name : String
    } derive(
    Debug
    )

    AppMarketplaceRemoveResponse

    pub struct AppMarketplaceRemoveResponse {
    marketplace_name : String
    installed_root : String?
    } derive(
    Debug
    )

    AppMarketplaceUpgradeErrorInfo

    pub struct AppMarketplaceUpgradeErrorInfo {
    marketplace_name : String
    message : String
    } derive(
    Debug
    )

    AppMarketplaceUpgradeParams

    pub(all) struct AppMarketplaceUpgradeParams {
    marketplace_name : String?
    } derive(
    Debug
    )

    AppMarketplaceUpgradeResponse

    pub struct AppMarketplaceUpgradeResponse {
    selected_marketplaces : ArrayView[String]
    upgraded_roots : ArrayView[String]
    errors : ArrayView[AppMarketplaceUpgradeErrorInfo]
    } derive(
    Debug
    )

    AppMcpAuthStatus

    pub enum AppMcpAuthStatus {
    AppMcpUnsupported
    AppMcpNotLoggedIn
    AppMcpBearerToken
    AppMcpOAuth
    } derive(
    Debug
    )

    AppMcpElicitationBooleanSchema

    pub(all) struct AppMcpElicitationBooleanSchema {
    title : String?
    description : String?
    default : Bool?
    } derive(
    Debug
    )

    AppMcpElicitationConstOption

    pub(all) struct AppMcpElicitationConstOption {
    const_value : String
    title : String
    } derive(
    Debug
    )

    AppMcpElicitationNumberSchema

    pub(all) struct AppMcpElicitationNumberSchema {
    number_type : AppMcpElicitationNumberType
    title : String?
    description : String?
    minimum : Double?
    maximum : Double?
    default : Double?
    } derive(
    Debug
    )

    AppMcpElicitationNumberType

    pub(all) enum AppMcpElicitationNumberType {
    AppMcpElicitationNumberTypeNumber
    AppMcpElicitationNumberTypeInteger
    } derive(
    Debug
    )

    AppMcpElicitationObjectType

    pub(all) enum AppMcpElicitationObjectType {
    AppMcpElicitationObject
    } derive(
    Debug
    )

    AppMcpElicitationPrimitiveSchema

    pub(all) enum AppMcpElicitationPrimitiveSchema {
    AppMcpElicitationString(AppMcpElicitationStringSchema)
    AppMcpElicitationNumber(AppMcpElicitationNumberSchema)
    AppMcpElicitationBoolean(AppMcpElicitationBooleanSchema)
    AppMcpElicitationStringEnum(AppMcpElicitationStringEnumSchema)
    AppMcpElicitationTitledStringEnum(AppMcpElicitationTitledStringEnumSchema)
    AppMcpElicitationUntitledMultiSelect(AppMcpElicitationUntitledMultiSelectSchema)
    AppMcpElicitationTitledMultiSelect(AppMcpElicitationTitledMultiSelectSchema)
    } derive(
    Debug
    )

    AppMcpElicitationSchema

    pub(all) struct AppMcpElicitationSchema {
    schema_uri : String?
    object_type : AppMcpElicitationObjectType
    properties : Map[String, AppMcpElicitationPrimitiveSchema]
    required : ArrayView[String]?
    } derive(
    Debug
    )

    AppMcpElicitationStringEnumSchema

    pub(all) struct AppMcpElicitationStringEnumSchema {
    title : String?
    description : String?
    enum_values : ArrayView[String]
    enum_names : ArrayView[String]?
    default : String?
    } derive(
    Debug
    )

    AppMcpElicitationStringFormat

    pub(all) enum AppMcpElicitationStringFormat {
    AppMcpElicitationEmailFormat
    AppMcpElicitationUriFormat
    AppMcpElicitationDateFormat
    AppMcpElicitationDateTimeFormat
    } derive(
    Debug
    )

    AppMcpElicitationStringSchema

    pub(all) struct AppMcpElicitationStringSchema {
    title : String?
    description : String?
    min_length : UInt?
    max_length : UInt?
    format : AppMcpElicitationStringFormat?
    default : String?
    } derive(
    Debug
    )

    AppMcpElicitationTitledMultiSelectSchema

    pub(all) struct AppMcpElicitationTitledMultiSelectSchema {
    title : String?
    description : String?
    min_items : UInt64?
    max_items : UInt64?
    items : AppMcpElicitationTitledEnumItems
    default : ArrayView[String]?
    } derive(
    Debug
    )

    AppMcpElicitationTitledStringEnumSchema

    pub(all) struct AppMcpElicitationTitledStringEnumSchema {
    title : String?
    description : String?
    one_of : ArrayView[AppMcpElicitationConstOption]
    default : String?
    } derive(
    Debug
    )

    AppMcpElicitationUntitledEnumItems

    pub(all) struct AppMcpElicitationUntitledEnumItems {
    enum_values : ArrayView[String]
    } derive(
    Debug
    )

    AppMcpElicitationUntitledMultiSelectSchema

    pub(all) struct AppMcpElicitationUntitledMultiSelectSchema {
    title : String?
    description : String?
    min_items : UInt64?
    max_items : UInt64?
    items : AppMcpElicitationUntitledEnumItems
    default : ArrayView[String]?
    } derive(
    Debug
    )

    AppMcpResource

    pub struct AppMcpResource {
    annotations : Json?
    description : String?
    mime_type : String?
    name : String
    size : Int64?
    title : String?
    uri : String
    icons : ArrayView[Json]?
    meta : Json?
    } derive(
    Debug
    )

    AppMcpResourceContent

    pub enum AppMcpResourceContent {
    AppMcpTextResourceContent(uri~ : String, mime_type~ : String?, text~ : String, meta~ : Json?)
    AppMcpBlobResourceContent(uri~ : String, mime_type~ : String?, blob~ : String, meta~ : Json?)
    } derive(
    Debug
    )

    AppMcpResourceReadParams

    pub(all) struct AppMcpResourceReadParams {
    thread_id : String?
    server : String
    uri : String
    } derive(
    Debug
    )

    AppMcpResourceTemplate

    pub struct AppMcpResourceTemplate {
    annotations : Json?
    uri_template : String
    name : String
    title : String?
    description : String?
    mime_type : String?
    } derive(
    Debug
    )

    AppMcpServerElicitationAction

    pub(all) enum AppMcpServerElicitationAction {
    AppMcpElicitationAccept
    AppMcpElicitationDecline
    AppMcpElicitationCancel
    } derive(
    Debug
    )

    AppMcpServerElicitationContent

    pub(all) enum AppMcpServerElicitationContent {
    AppMcpElicitationForm(meta~ : Json?, message~ : String, requested_schema~ : AppMcpElicitationSchema)
    AppMcpElicitationOpenAIForm(meta~ : Json?, message~ : String, requested_schema~ : Json)
    AppMcpElicitationUrl(meta~ : Json?, message~ : String, url~ : String, elicitation_id~ : String)
    } derive(
    Debug
    )

    AppMcpServerElicitationRequest

    pub(all) struct AppMcpServerElicitationRequest {
    thread_id : String
    turn_id : String?
    server_name : String
    elicitation : AppMcpServerElicitationContent
    // private fields
    } derive(
    Debug
    )

    AppMcpServerOauthLoginParams

    pub(all) struct AppMcpServerOauthLoginParams {
    name : String
    scopes : Array[String]?
    timeout_secs : Int64?
    } derive(
    Debug
    )

    AppMcpServerOauthLoginResponse

    pub struct AppMcpServerOauthLoginResponse {
    authorization_url : String
    } derive(
    Debug
    )

    AppMcpServerStartupState

    pub enum AppMcpServerStartupState {
    AppMcpServerStarting
    AppMcpServerReady
    AppMcpServerFailed
    AppMcpServerCancelled
    } derive(
    Debug
    )

    AppMcpServerStatus

    pub struct AppMcpServerStatus {
    name : String
    tools : Map[String, AppMcpTool]
    resources : ArrayView[AppMcpResource]
    resource_templates : ArrayView[AppMcpResourceTemplate]
    auth_status : AppMcpAuthStatus
    } derive(
    Debug
    )

    AppMcpServerStatusDetail

    pub(all) enum AppMcpServerStatusDetail {
    AppMcpServerStatusFull
    AppMcpServerStatusToolsAndAuthOnly
    } derive(
    Debug
    )

    AppMcpServerStatusListParams

    pub(all) struct AppMcpServerStatusListParams {
    cursor : String?
    limit : UInt?
    detail : AppMcpServerStatusDetail?
    } derive(
    Debug
    )

    AppMcpServerStatusListResponse

    pub struct AppMcpServerStatusListResponse {
    data : ArrayView[AppMcpServerStatus]
    next_cursor : String?
    } derive(
    Debug
    )

    AppMcpServerToolCallParams

    pub(all) struct AppMcpServerToolCallParams {
    thread_id : String
    server : String
    tool : String
    arguments : Json?
    meta : Json?
    } derive(
    Debug
    )

    AppMcpServerToolCallResponse

    pub struct AppMcpServerToolCallResponse {
    content : ArrayView[Json]
    structured_content : Json?
    is_error : Bool?
    meta : Json?
    } derive(
    Debug
    )

    AppMcpTool

    pub struct AppMcpTool {
    name : String
    title : String?
    description : String?
    input_schema : Json
    output_schema : Json?
    annotations : Json?
    icons : ArrayView[Json]?
    meta : Json?
    } derive(
    Debug
    )

    AppMemoryCitationEntry

    pub struct AppMemoryCitationEntry {
    path : String
    line_start : UInt
    line_end : UInt
    note : String
    } derive(
    Debug
    )

    AppMergeStrategy

    pub(all) enum AppMergeStrategy {
    AppMergeReplace
    AppMergeUpsert
    } derive(
    Debug
    )

    AppMessagePhase

    pub enum AppMessagePhase {
    AppMessageCommentary
    AppMessageFinalAnswer
    } derive(
    Debug
    )

    AppMockExperimentalMethodParams

    pub(all) struct AppMockExperimentalMethodParams {
    value : String?
    } derive(
    Debug
    )

    AppMockExperimentalMethodResponse

    pub(all) struct AppMockExperimentalMethodResponse {
    echoed : String?
    } derive(
    Debug
    )

    AppModel

    pub struct AppModel {
    id : String
    model : String
    upgrade : String?
    upgrade_info : AppModelUpgradeInfo?
    availability_nux : AppModelAvailabilityNux?
    display_name : String
    description : String
    model_specialty : String?
    hidden : Bool
    supported_reasoning_efforts : ArrayView[AppReasoningEffortOption]
    default_reasoning_effort : AppReasoningEffort
    input_modalities : ArrayView[AppInputModality]
    supports_personality : Bool
    multi_agent_version : AppMultiAgentVersion?
    additional_speed_tiers : ArrayView[String]
    service_tiers : ArrayView[AppModelServiceTier]
    default_service_tier : String?
    is_default : Bool
    // private fields
    } derive(
    Debug
    )

    AppModelAvailabilityNux

    pub struct AppModelAvailabilityNux {
    message : String
    } derive(
    Debug
    )

    AppModelListParams

    pub struct AppModelListParams {
    cursor : String?
    limit : UInt?
    include_hidden : Bool?
    } derive(
    Debug
    )

    Parameters for the app-server model/list request.

    AppModelListParams::new

    fn AppModelListParams::new(cursor? : String, limit? : UInt, include_hidden? : Bool) -> AppModelListParams

    AppModelListResponse

    pub struct AppModelListResponse {
    data : ArrayView[AppModel]
    next_cursor : String?
    } derive(
    Debug
    )

    AppModelProviderCapabilitiesReadResponse

    pub struct AppModelProviderCapabilitiesReadResponse {
    namespace_tools : Bool
    image_generation : Bool
    web_search : Bool
    } derive(
    Debug
    )

    AppModelRerouteReason

    pub(all) enum AppModelRerouteReason {
    AppModelRerouteHighRiskCyberActivity
    } derive(
    Debug
    )

    AppModelServiceTier

    pub struct AppModelServiceTier {
    id : String
    name : String
    description : String
    } derive(
    Debug
    )

    AppModelUpgradeInfo

    pub struct AppModelUpgradeInfo {
    model : String
    upgrade_copy : String?
    model_link : String?
    migration_markdown : String?
    } derive(
    Debug
    )

    AppModelVerbosity

    pub enum AppModelVerbosity {
    AppVerbosityLow
    AppVerbosityMedium
    AppVerbosityHigh
    } derive(
    Debug
    )

    AppModelVerification

    pub(all) enum AppModelVerification {
    AppModelVerificationTrustedAccessForCyber
    } derive(
    Debug
    )

    AppMultiAgentVersion

    pub(all) enum AppMultiAgentVersion {
    AppMultiAgentDisabled
    AppMultiAgentV1
    AppMultiAgentV2
    AppMultiAgentCustom(String)
    } derive(
    Debug
    )

    Multi-agent runtime advertised by a Codex model.

    AppNamedMigration

    pub(all) struct AppNamedMigration {
    name : String
    } derive(
    Debug
    )

    AppNetworkAccess

    pub(all) enum AppNetworkAccess {
    AppNetworkRestricted
    AppNetworkEnabled
    } derive(
    Debug
    )

    AppNetworkApprovalContext

    pub struct AppNetworkApprovalContext {
    host : String
    protocol : AppNetworkApprovalProtocol
    } derive(
    Debug
    )

    AppNetworkApprovalProtocol

    pub enum AppNetworkApprovalProtocol {
    AppNetworkApprovalHttp
    AppNetworkApprovalHttps
    AppNetworkApprovalSocks5Tcp
    AppNetworkApprovalSocks5Udp
    } derive(
    Debug
    )

    AppNetworkPolicyRuleAction

    pub(all) enum AppNetworkPolicyRuleAction {
    AppNetworkPolicyAllow
    AppNetworkPolicyDeny
    } derive(
    Debug
    )

    AppNonSteerableTurnKind

    pub enum AppNonSteerableTurnKind {
    AppNonSteerableReview
    AppNonSteerableCompact
    } derive(
    Debug
    )

    AppNullableInt64

    pub(all) enum AppNullableInt64 {
    AppNullableInt64Null
    AppNullableInt64Value(Int64)
    } derive(
    Debug
    )

    AppNullableString

    pub(all) enum AppNullableString {
    AppNullableStringNull
    AppNullableStringValue(String)
    } derive(
    Debug
    )

    AppOutputStream

    pub enum AppOutputStream {
    AppStdout
    AppStderr
    } derive(
    Debug
    )

    AppPermissionGrantScope

    pub(all) enum AppPermissionGrantScope {
    AppPermissionGrantTurn
    AppPermissionGrantSession
    } derive(
    Debug
    )

    AppPermissionsRequestApprovalRequest

    pub(all) struct AppPermissionsRequestApprovalRequest {
    thread_id : String
    turn_id : String
    item_id : String
    environment_id : String?
    started_at_ms : Int64
    cwd : String
    reason : String?
    permissions : AppRequestPermissionProfile
    // private fields
    } derive(
    Debug
    )

    AppPersonality

    pub(all) enum AppPersonality {
    AppNoPersonality
    AppFriendlyPersonality
    AppPragmaticPersonality
    } derive(
    Debug
    )

    AppPlanType

    pub enum AppPlanType {
    AppPlanFree
    AppPlanGo
    AppPlanPlus
    AppPlanPro
    AppPlanProlite
    AppPlanTeam
    AppPlanSelfServeBusinessUsageBased
    AppPlanBusiness
    AppPlanEnterpriseCbpUsageBased
    AppPlanEnterprise
    AppPlanEdu
    AppPlanUnknown
    } derive(
    Debug
    )

    AppPluginAuthPolicy

    pub enum AppPluginAuthPolicy {
    AppPluginAuthOnInstall
    AppPluginAuthOnUse
    } derive(
    Debug
    )

    AppPluginDetail

    pub struct AppPluginDetail {
    marketplace_name : String
    marketplace_path : String?
    summary : AppPluginSummary
    description : String?
    skills : ArrayView[AppSkillSummary]
    apps : ArrayView[AppSummary]
    mcp_servers : ArrayView[String]
    // private fields
    } derive(
    Debug
    )

    AppPluginInstallParams

    pub(all) struct AppPluginInstallParams {
    marketplace_path : String?
    remote_marketplace_name : String?
    plugin_name : String
    } derive(
    Debug
    )

    AppPluginInstallPolicy

    pub enum AppPluginInstallPolicy {
    AppPluginInstallNotAvailable
    AppPluginInstallAvailable
    AppPluginInstallInstalledByDefault
    } derive(
    Debug
    )

    AppPluginInstallResponse

    pub struct AppPluginInstallResponse {
    auth_policy : AppPluginAuthPolicy
    apps_needing_auth : ArrayView[AppSummary]
    } derive(
    Debug
    )

    AppPluginInterface

    pub struct AppPluginInterface {
    display_name : String?
    short_description : String?
    long_description : String?
    developer_name : String?
    category : String?
    capabilities : ArrayView[String]
    website_url : String?
    privacy_policy_url : String?
    terms_of_service_url : String?
    default_prompt : ArrayView[String]?
    brand_color : String?
    composer_icon : String?
    composer_icon_url : String?
    logo : String?
    logo_url : String?
    screenshots : ArrayView[String]
    screenshot_urls : ArrayView[String]
    // private fields
    } derive(
    Debug
    )

    AppPluginListMarketplaceKind

    pub(all) enum AppPluginListMarketplaceKind {
    AppPluginMarketplaceLocal
    AppPluginMarketplaceWorkspaceDirectory
    AppPluginMarketplaceSharedWithMe
    } derive(
    Debug
    )

    AppPluginListParams

    pub(all) struct AppPluginListParams {
    cwds : Array[String]?
    marketplace_kinds : Array[AppPluginListMarketplaceKind]?
    } derive(
    Debug
    )

    AppPluginListResponse

    pub struct AppPluginListResponse {
    marketplaces : ArrayView[AppPluginMarketplaceEntry]
    marketplace_load_errors : ArrayView[AppMarketplaceLoadErrorInfo]
    featured_plugin_ids : ArrayView[String]
    } derive(
    Debug
    )

    AppPluginMarketplaceEntry

    pub struct AppPluginMarketplaceEntry {
    name : String
    path : String?
    interface : AppMarketplaceInterface?
    plugins : ArrayView[AppPluginSummary]
    // private fields
    } derive(
    Debug
    )

    AppPluginReadParams

    pub(all) struct AppPluginReadParams {
    marketplace_path : String?
    remote_marketplace_name : String?
    plugin_name : String
    } derive(
    Debug
    )

    AppPluginSource

    pub enum AppPluginSource {
    AppPluginSourceLocal(path~ : String)
    AppPluginSourceGit(url~ : String, path~ : String?, ref_name~ : String?, sha~ : String?)
    AppPluginSourceRemote
    } derive(
    Debug
    )

    AppPluginSummary

    pub struct AppPluginSummary {
    id : String
    name : String
    source : AppPluginSource
    installed : Bool
    enabled : Bool
    install_policy : AppPluginInstallPolicy
    auth_policy : AppPluginAuthPolicy
    interface : AppPluginInterface?
    // private fields
    } derive(
    Debug
    )

    AppPluginUninstallParams

    pub(all) struct AppPluginUninstallParams {
    plugin_id : String
    } derive(
    Debug
    )

    AppPluginsMigration

    pub(all) struct AppPluginsMigration {
    marketplace_name : String
    plugin_names : ArrayView[String]
    } derive(
    Debug
    )

    AppProfileV2

    pub struct AppProfileV2 {
    model : String?
    model_provider : String?
    approval_policy : AppApprovalPolicy?
    approvals_reviewer : AppApprovalsReviewer?
    service_tier : String?
    model_reasoning_effort : AppReasoningEffort?
    model_reasoning_summary : AppReasoningSummary?
    model_verbosity : AppModelVerbosity?
    web_search : AppWebSearchMode?
    tools : AppConfigToolsV2?
    chatgpt_base_url : String?
    additional : Map[String, Json]
    // private fields
    } derive(
    Debug
    )

    AppRateLimitReachedType

    pub enum AppRateLimitReachedType {
    AppRateLimitReached
    AppWorkspaceOwnerCreditsDepleted
    AppWorkspaceMemberCreditsDepleted
    AppWorkspaceOwnerUsageLimitReached
    AppWorkspaceMemberUsageLimitReached
    } derive(
    Debug
    )

    AppRateLimitSnapshot

    pub struct AppRateLimitSnapshot {
    limit_id : String?
    limit_name : String?
    primary : AppRateLimitWindow?
    secondary : AppRateLimitWindow?
    credits : AppCreditsSnapshot?
    plan_type : AppPlanType?
    rate_limit_reached_type : AppRateLimitReachedType?
    // private fields
    } derive(
    Debug
    )

    AppRateLimitWindow

    pub struct AppRateLimitWindow {
    used_percent : Int
    window_duration_mins : Int64?
    resets_at : Int64?
    } derive(
    Debug
    )

    AppRealtimeConversationVersion

    pub(all) enum AppRealtimeConversationVersion {
    AppRealtimeConversationV1
    AppRealtimeConversationV2
    } derive(
    Debug
    )

    AppRealtimeOutputModality

    pub(all) enum AppRealtimeOutputModality {
    AppRealtimeText
    AppRealtimeAudio
    } derive(
    Debug
    )

    AppRealtimeVoice

    pub(all) enum AppRealtimeVoice {
    AppRealtimeVoiceAlloy
    AppRealtimeVoiceArbor
    AppRealtimeVoiceAsh
    AppRealtimeVoiceBallad
    AppRealtimeVoiceBreeze
    AppRealtimeVoiceCedar
    AppRealtimeVoiceCoral
    AppRealtimeVoiceCove
    AppRealtimeVoiceEcho
    AppRealtimeVoiceEmber
    AppRealtimeVoiceJuniper
    AppRealtimeVoiceMaple
    AppRealtimeVoiceMarin
    AppRealtimeVoiceSage
    AppRealtimeVoiceShimmer
    AppRealtimeVoiceSol
    AppRealtimeVoiceSpruce
    AppRealtimeVoiceVale
    AppRealtimeVoiceVerse
    } derive(
    Debug
    )

    AppReasoningEffort

    pub(all) enum AppReasoningEffort {
    AppEffortNone
    AppEffortMinimal
    AppEffortLow
    AppEffortMedium
    AppEffortHigh
    AppEffortXhigh
    AppEffortMax
    AppEffortUltra
    AppEffortCustom(String)
    } derive(
    Debug
    )

    AppReasoningEffortOption

    pub struct AppReasoningEffortOption {
    reasoning_effort : AppReasoningEffort
    description : String
    } derive(
    Debug
    )

    AppReasoningSummary

    pub(all) enum AppReasoningSummary {
    AppSummaryAuto
    AppSummaryConcise
    AppSummaryDetailed
    AppSummaryNone
    } derive(
    Debug
    )

    AppRemoteControlConnectionStatus

    pub(all) enum AppRemoteControlConnectionStatus {
    AppRemoteControlDisabled
    AppRemoteControlConnecting
    AppRemoteControlConnected
    AppRemoteControlErrored
    } derive(
    Debug
    )

    AppRequestId

    pub enum AppRequestId {
    StringId(String)
    IntId(Int64)
    } derive(Eq,
    Debug
    )

    JSON-RPC request id used by the Codex app server protocol.

    AppResidencyRequirement

    pub enum AppResidencyRequirement {
    AppResidencyUs
    } derive(
    Debug
    )

    AppResponseContentItem

    pub(all) enum AppResponseContentItem {
    AppResponseInputText(text~ : String)
    AppResponseInputImage(image_url~ : String, detail~ : AppResponseImageDetail?)
    AppResponseOutputText(text~ : String)
    } derive(
    Debug
    )

    AppResponseFunctionCallOutputBody

    pub(all) enum AppResponseFunctionCallOutputBody {
    AppResponseFunctionOutputText(String)
    AppResponseFunctionOutputContentItems(ArrayView[AppResponseFunctionCallOutputContentItem])
    } derive(
    Debug
    )

    AppResponseFunctionCallOutputContentItem

    pub(all) enum AppResponseFunctionCallOutputContentItem {
    AppResponseFunctionOutputInputText(text~ : String)
    AppResponseFunctionOutputInputImage(image_url~ : String, detail~ : AppResponseImageDetail?)
    } derive(
    Debug
    )

    AppResponseImageDetail

    pub(all) enum AppResponseImageDetail {
    AppResponseImageAuto
    AppResponseImageLow
    AppResponseImageHigh
    AppResponseImageOriginal
    } derive(
    Debug
    )

    AppResponseItem

    pub(all) enum AppResponseItem {
    AppResponseMessage(role~ : String, content~ : ArrayView[AppResponseContentItem], phase~ : AppResponseMessagePhase?)
    AppResponseReasoning(summary~ : ArrayView[AppResponseReasoningSummary], content~ : ArrayView[AppResponseReasoningContent]?, encrypted_content~ : String?)
    AppResponseLocalShellCall(call_id~ : String?, status~ : AppResponseLocalShellStatus, action~ : AppResponseLocalShellAction)
    AppResponseFunctionCall(name~ : String, tool_namespace~ : String?, arguments~ : String, call_id~ : String)
    AppResponseToolSearchCall(call_id~ : String?, status~ : String?, execution~ : String, arguments~ : Json)
    AppResponseFunctionCallOutput(call_id~ : String, output~ : AppResponseFunctionCallOutputBody)
    AppResponseCustomToolCall(status~ : String?, call_id~ : String, name~ : String, input~ : String)
    AppResponseCustomToolCallOutput(call_id~ : String, name~ : String?, output~ : AppResponseFunctionCallOutputBody)
    AppResponseToolSearchOutput(call_id~ : String?, status~ : String, execution~ : String, tools~ : ArrayView[Json])
    AppResponseWebSearchCall(status~ : String?, action~ : AppResponseWebSearchAction?)
    AppResponseImageGenerationCall(id~ : String, status~ : String, revised_prompt~ : String?, result~ : String)
    AppResponseCompaction(encrypted_content~ : String)
    AppResponseContextCompaction(encrypted_content~ : String?)
    AppResponseOther
    } derive(
    Debug
    )

    AppResponseLocalShellAction

    pub(all) struct AppResponseLocalShellAction {
    command : ArrayView[String]
    timeout_ms : UInt64?
    working_directory : String?
    env : Map[String, String]?
    user : String?
    } derive(
    Debug
    )

    AppResponseLocalShellStatus

    pub(all) enum AppResponseLocalShellStatus {
    AppResponseLocalShellCompleted
    AppResponseLocalShellInProgress
    AppResponseLocalShellIncomplete
    } derive(
    Debug
    )

    AppResponseMessagePhase

    pub(all) enum AppResponseMessagePhase {
    AppResponseCommentary
    AppResponseFinalAnswer
    } derive(
    Debug
    )

    AppResponseReasoningContent

    pub(all) enum AppResponseReasoningContent {
    AppResponseReasoningText(text~ : String)
    AppResponseReasoningPlainText(text~ : String)
    } derive(
    Debug
    )

    AppResponseReasoningSummary

    pub(all) struct AppResponseReasoningSummary {
    text : String
    } derive(
    Debug
    )

    AppResponseWebSearchAction

    pub(all) enum AppResponseWebSearchAction {
    AppResponseWebSearchSearch(query~ : String?, queries~ : ArrayView[String]?)
    AppResponseWebSearchOpenPage(url~ : String?)
    AppResponseWebSearchFindInPage(url~ : String?, pattern~ : String?)
    AppResponseWebSearchOther
    } derive(
    Debug
    )

    AppReviewDelivery

    pub(all) enum AppReviewDelivery {
    AppReviewInline
    AppReviewDetached
    } derive(
    Debug
    )

    AppReviewStartParams

    pub(all) struct AppReviewStartParams {
    thread_id : String
    target : AppReviewTarget
    delivery : AppReviewDelivery?
    } derive(
    Debug
    )

    AppReviewStartResponse

    pub struct AppReviewStartResponse {
    turn : AppTurn
    review_thread_id : String
    } derive(
    Debug
    )

    AppReviewTarget

    pub(all) enum AppReviewTarget {
    AppReviewUncommittedChanges
    AppReviewBaseBranch(branch~ : String)
    AppReviewCommit(sha~ : String, title~ : String?)
    AppReviewCustom(instructions~ : String)
    } derive(
    Debug
    )

    AppSandboxPolicy

    pub(all) enum AppSandboxPolicy {
    AppDangerFullAccess
    AppReadOnly(network_access~ : Bool)
    AppExternalSandbox(network_access~ : AppNetworkAccess)
    AppWorkspaceWrite(writable_roots~ : Array[String], network_access~ : Bool, exclude_tmpdir_env_var~ : Bool, exclude_slash_tmp~ : Bool)
    } derive(
    Debug
    )

    AppSandboxWorkspaceWrite

    pub struct AppSandboxWorkspaceWrite {
    writable_roots : ArrayView[String]
    network_access : Bool
    exclude_tmpdir_env_var : Bool
    exclude_slash_tmp : Bool
    } derive(
    Debug
    )

    AppSendAddCreditsNudgeEmailParams

    pub(all) struct AppSendAddCreditsNudgeEmailParams {
    kind : AppAddCreditsNudgeKind
    } derive(
    Debug
    )

    AppServerEvent

    pub enum AppServerEvent {
    AppRawNotification(rpc_method~ : String, params~ : Json?)
    AppThreadStarted(AppThread)
    AppThreadStatusChanged(thread_id~ : String, status~ : AppThreadStatus)
    AppThreadArchived(thread_id~ : String)
    AppThreadUnarchived(thread_id~ : String)
    AppThreadClosed(thread_id~ : String)
    AppSkillsChanged
    AppThreadNameUpdated(thread_id~ : String, thread_name~ : String?)
    AppThreadGoalUpdated(thread_id~ : String, turn_id~ : String?, goal~ : AppThreadGoal)
    AppThreadGoalCleared(thread_id~ : String)
    AppTurnStarted(thread_id~ : String, turn~ : AppTurn)
    AppHookStarted(thread_id~ : String, turn_id~ : String?, run~ : AppHookRunSummary)
    AppTurnCompleted(thread_id~ : String, turn~ : AppTurn)
    AppHookCompleted(thread_id~ : String, turn_id~ : String?, run~ : AppHookRunSummary)
    AppTurnDiffUpdated(thread_id~ : String, turn_id~ : String, diff~ : String)
    AppTurnPlanUpdated(thread_id~ : String, turn_id~ : String, explanation~ : String?, plan~ : ArrayView[AppTurnPlanStep])
    AppTurnError(thread_id~ : String, turn_id~ : String, error~ : AppTurnError, will_retry~ : Bool)
    AppItemStarted(AppThreadItemEvent)
    AppItemGuardianApprovalReviewStarted(thread_id~ : String, turn_id~ : String, started_at_ms~ : Int64, review_id~ : String, target_item_id~ : String?, review~ : AppGuardianApprovalReview, action~ : AppGuardianApprovalReviewAction)
    AppItemGuardianApprovalReviewCompleted(thread_id~ : String, turn_id~ : String, started_at_ms~ : Int64, completed_at_ms~ : Int64, review_id~ : String, target_item_id~ : String?, decision_source~ : AppAutoReviewDecisionSource, review~ : AppGuardianApprovalReview, action~ : AppGuardianApprovalReviewAction)
    AppItemCompleted(AppThreadItemEvent)
    AppRawResponseItemCompleted(thread_id~ : String, turn_id~ : String, item~ : AppResponseItem)
    AppAgentMessageDelta(thread_id~ : String, turn_id~ : String, item_id~ : String, delta~ : String)
    AppPlanDelta(thread_id~ : String, turn_id~ : String, item_id~ : String, delta~ : String)
    AppCommandExecOutputDelta(process_id~ : String, stream~ : AppOutputStream, delta_base64~ : String, cap_reached~ : Bool)
    AppCommandExecutionOutputDelta(thread_id~ : String, turn_id~ : String, item_id~ : String, delta~ : String)
    AppTerminalInteraction(thread_id~ : String, turn_id~ : String, item_id~ : String, process_id~ : String, stdin~ : String)
    AppFileChangeOutputDelta(thread_id~ : String, turn_id~ : String, item_id~ : String, delta~ : String)
    AppFileChangePatchUpdated(thread_id~ : String, turn_id~ : String, item_id~ : String, changes~ : ArrayView[AppThreadFileUpdateChange])
    AppServerRequestResolved(thread_id~ : String, request_id~ : AppRequestId)
    AppMcpToolCallProgress(thread_id~ : String, turn_id~ : String, item_id~ : String, message~ : String)
    AppMcpServerOauthLoginCompleted(name~ : String, success~ : Bool, error~ : String?)
    AppMcpServerStatusUpdated(name~ : String, status~ : AppMcpServerStartupState, error~ : String?)
    AppAccountUpdated(auth_mode~ : AppAuthMode?, plan_type~ : AppPlanType?)
    AppAccountRateLimitsUpdated(rate_limits~ : AppRateLimitSnapshot)
    AppAppListUpdated(data~ : ArrayView[AppInfo])
    AppRemoteControlStatusChanged(status~ : AppRemoteControlConnectionStatus, installation_id~ : String, environment_id~ : String?)
    AppExternalAgentConfigImportCompleted
    AppFsChanged(watch_id~ : String, changed_paths~ : ArrayView[String])
    AppContextCompacted(thread_id~ : String, turn_id~ : String)
    AppFuzzyFileSearchSessionUpdated(session_id~ : String, query~ : String, files~ : ArrayView[AppFuzzyFileSearchResult])
    AppFuzzyFileSearchSessionCompleted(session_id~ : String)
    AppReasoningSummaryTextDelta(thread_id~ : String, turn_id~ : String, item_id~ : String, delta~ : String, summary_index~ : Int64)
    AppReasoningSummaryPartAdded(thread_id~ : String, turn_id~ : String, item_id~ : String, summary_index~ : Int64)
    AppReasoningTextDelta(thread_id~ : String, turn_id~ : String, item_id~ : String, delta~ : String, content_index~ : Int64)
    AppWindowsWorldWritableWarning(sample_paths~ : ArrayView[String], extra_count~ : UInt64, failed_scan~ : Bool)
    AppWindowsSandboxSetupCompleted(mode~ : AppWindowsSandboxSetupMode, success~ : Bool, error~ : String?)
    AppAccountLoginCompleted(login_id~ : String?, success~ : Bool, error~ : String?)
    AppModelRerouted(thread_id~ : String, turn_id~ : String, from_model~ : String, to_model~ : String, reason~ : AppModelRerouteReason)
    AppModelVerification(thread_id~ : String, turn_id~ : String, verifications~ : ArrayView[AppModelVerification])
    AppWarning(thread_id~ : String?, message~ : String)
    AppGuardianWarning(thread_id~ : String, message~ : String)
    AppDeprecationNotice(summary~ : String, details~ : String?)
    AppConfigWarning(summary~ : String, details~ : String?, path~ : String?, range~ : AppTextRange?)
    AppThreadTokenUsageUpdated(thread_id~ : String, turn_id~ : String, token_usage~ : AppThreadTokenUsage)
    AppThreadRealtimeStarted(thread_id~ : String, realtime_session_id~ : String?, version~ : AppRealtimeConversationVersion)
    AppThreadRealtimeItemAdded(thread_id~ : String, item~ : Json)
    AppThreadRealtimeTranscriptDelta(thread_id~ : String, role~ : String, delta~ : String)
    AppThreadRealtimeTranscriptDone(thread_id~ : String, role~ : String, text~ : String)
    AppThreadRealtimeOutputAudioDelta(thread_id~ : String, audio~ : AppThreadRealtimeAudioChunk)
    AppThreadRealtimeSdp(thread_id~ : String, sdp~ : String)
    AppThreadRealtimeError(thread_id~ : String, message~ : String)
    AppThreadRealtimeClosed(thread_id~ : String, reason~ : String?)
    } derive(
    Debug
    )

    App-server event. This is intentionally broader than the existing exec Event.

    AppServerEvent::thread_event

    fn AppServerEvent::thread_event(self : AppServerEvent) -> Event?

    Convert app-server notifications that exactly match existing exec stream semantics.

    AppServerOptions

    pub struct AppServerOptions {
    executable_path_override : String?
    client_info : AppClientInfo?
    capabilities : AppInitializeCapabilities?
    } derive(Default)

    AppServerOptions::new

    fn AppServerOptions::new(executable_path_override? : String, client_info? : AppClientInfo, capabilities? : AppInitializeCapabilities) -> AppServerOptions

    AppServerRequest

    pub struct AppServerRequest {
    details : AppServerRequestDetails
    // private fields
    } derive(
    Debug
    )

    Server-initiated app-server request.

    AppServerRequestDetails

    pub enum AppServerRequestDetails {
    AppCommandExecutionApprovalRequest(AppCommandExecutionApprovalRequest)
    AppFileChangeApprovalRequest(AppFileChangeApprovalRequest)
    AppToolRequestUserInputRequest(AppToolRequestUserInputRequest)
    AppDynamicToolCallRequest(AppDynamicToolCallRequest)
    AppPermissionsRequestApprovalRequest(AppPermissionsRequestApprovalRequest)
    AppChatgptAuthTokensRefreshRequest(AppChatgptAuthTokensRefreshRequest)
    AppAttestationGenerateRequest(AppAttestationGenerateRequest)
    AppMcpServerElicitationRequest(AppMcpServerElicitationRequest)
    AppRawServerRequest(rpc_method~ : String, params~ : Json?)
    } derive(
    Debug
    )

    AppServerResponse

    pub(all) enum AppServerResponse {
    AppCommandExecutionApprovalResponse(decision~ : AppCommandExecutionApprovalDecision)
    AppFileChangeApprovalResponse(decision~ : AppFileChangeApprovalDecision)
    AppToolRequestUserInputResponse(answers~ : Map[String, AppToolRequestUserInputAnswer])
    AppDynamicToolCallResponse(content_items~ : ArrayView[AppDynamicToolCallOutputContentItem], success~ : Bool)
    AppPermissionsRequestApprovalResponse(permissions~ : AppGrantedPermissionProfile, scope~ : AppPermissionGrantScope, strict_auto_review~ : Bool?)
    AppChatgptAuthTokensRefreshResponse(access_token~ : String, chatgpt_account_id~ : String, chatgpt_plan_type~ : String?)
    AppAttestationGenerateResponse(token~ : String)
    AppMcpServerElicitationResponse(action~ : AppMcpServerElicitationAction, content~ : Json?, meta~ : Json?)
    AppRawServerResponse(Json)
    AppRawServerError(code~ : Int64, message~ : String, data~ : Json?)
    } derive(
    Debug
    )

    AppSessionMigration

    pub(all) struct AppSessionMigration {
    path : String
    cwd : String
    title : String?
    } derive(
    Debug
    )

    AppSessionSource

    pub enum AppSessionSource {
    AppSessionCli
    AppSessionVsCode
    AppSessionExec
    AppSessionAppServer
    AppSessionCustom(String)
    AppSessionSubAgent(AppSubAgentSource)
    AppSessionUnknown
    } derive(
    Debug
    )

    AppSkillErrorInfo

    pub struct AppSkillErrorInfo {
    path : String
    message : String
    } derive(
    Debug
    )

    AppSkillInterface

    pub struct AppSkillInterface {
    display_name : String?
    short_description : String?
    icon_small : String?
    icon_large : String?
    brand_color : String?
    default_prompt : String?
    } derive(
    Debug
    )

    AppSkillMetadata

    pub struct AppSkillMetadata {
    name : String
    description : String
    short_description : String?
    interface : AppSkillInterface?
    dependencies : AppSkillDependencies?
    path : String
    scope : AppSkillScope
    enabled : Bool
    } derive(
    Debug
    )

    AppSkillScope

    pub enum AppSkillScope {
    AppSkillScopeUser
    AppSkillScopeRepo
    AppSkillScopeSystem
    AppSkillScopeAdmin
    } derive(
    Debug
    )

    AppSkillSummary

    pub struct AppSkillSummary {
    name : String
    description : String
    short_description : String?
    interface : AppSkillInterface?
    path : String?
    enabled : Bool
    } derive(
    Debug
    )

    AppSkillToolDependency

    pub struct AppSkillToolDependency {
    dep_type : String
    value : String
    description : String?
    transport : String?
    command : String?
    url : String?
    } derive(
    Debug
    )

    AppSkillsConfigWriteParams

    pub(all) struct AppSkillsConfigWriteParams {
    path : String?
    name : String?
    enabled : Bool
    } derive(
    Debug
    )

    AppSkillsConfigWriteResponse

    pub struct AppSkillsConfigWriteResponse {
    effective_enabled : Bool
    } derive(
    Debug
    )

    AppSkillsListParams

    pub struct AppSkillsListParams {
    cwds : Array[String]?
    force_reload : Bool?
    } derive(
    Debug
    )

    AppSkillsListParams::new

    fn AppSkillsListParams::new(cwds? : Array[String], force_reload? : Bool) -> AppSkillsListParams

    AppSortDirection

    pub(all) enum AppSortDirection {
    SortAsc
    SortDesc
    } derive(
    Debug
    )

    AppSubAgentSource

    pub enum AppSubAgentSource {
    AppSubAgentReview
    AppSubAgentCompact
    AppSubAgentThreadSpawn(parent_thread_id~ : String, depth~ : Int, agent_path~ : String?, agent_nickname~ : String?, agent_role~ : String?)
    AppSubAgentMemoryConsolidation
    AppSubAgentOther(String)
    } derive(
    Debug
    )

    AppSummary

    pub struct AppSummary {
    id : String
    name : String
    description : String?
    install_url : String?
    needs_auth : Bool
    } derive(
    Debug
    )

    AppTextElement

    pub(all) struct AppTextElement {
    byte_range : AppByteRange
    placeholder : String?
    } derive(
    Debug
    )

    AppTextPosition

    pub(all) struct AppTextPosition {
    line : UInt64
    column : UInt64
    } derive(
    Debug
    )

    AppThread

    pub struct AppThread {
    id : String
    session_id : String
    forked_from_id : String?
    parent_thread_id : String?
    preview : String
    ephemeral : Bool
    section : AppThreadSection?
    section_entered_at : Int64?
    project_id : String?
    model_provider : String
    created_at : Int64
    updated_at : Int64
    recency_at : Int64?
    status : AppThreadStatus
    path : String?
    cwd : String
    cli_version : String
    source : AppSessionSource
    thread_source : String?
    agent_nickname : String?
    agent_role : String?
    git_info : AppConversationGitInfo?
    name : String?
    turns : ArrayView[AppTurn]
    // private fields
    } derive(
    Debug
    )

    AppThreadActiveFlag

    pub enum AppThreadActiveFlag {
    AppThreadWaitingOnApproval
    AppThreadWaitingOnUserInput
    } derive(
    Debug
    )

    AppThreadApproveGuardianDeniedActionParams

    pub(all) struct AppThreadApproveGuardianDeniedActionParams {
    thread_id : String
    event : Json
    } derive(
    Debug
    )

    AppThreadCollabAgentState

    pub struct AppThreadCollabAgentState {
    status : AppThreadCollabAgentStatus
    message : String?
    } derive(
    Debug
    )

    AppThreadCollabAgentStatus

    pub enum AppThreadCollabAgentStatus {
    AppThreadCollabAgentPendingInit
    AppThreadCollabAgentRunning
    AppThreadCollabAgentInterrupted
    AppThreadCollabAgentCompleted
    AppThreadCollabAgentErrored
    AppThreadCollabAgentShutdown
    AppThreadCollabAgentNotFound
    } derive(
    Debug
    )

    AppThreadCollabAgentTool

    pub enum AppThreadCollabAgentTool {
    AppThreadCollabSpawnAgent
    AppThreadCollabSendInput
    AppThreadCollabResumeAgent
    AppThreadCollabWait
    AppThreadCollabCloseAgent
    } derive(
    Debug
    )

    AppThreadCollabAgentToolCallStatus

    pub enum AppThreadCollabAgentToolCallStatus {
    AppThreadCollabInProgress
    AppThreadCollabCompleted
    AppThreadCollabFailed
    } derive(
    Debug
    )

    AppThreadCommandExecutionSource

    pub enum AppThreadCommandExecutionSource {
    AppThreadCommandSourceAgent
    AppThreadCommandSourceUserShell
    AppThreadCommandSourceUnifiedExecStartup
    AppThreadCommandSourceUnifiedExecInteraction
    } derive(
    Debug
    )

    AppThreadCommandExecutionStatus

    pub enum AppThreadCommandExecutionStatus {
    AppThreadCommandInProgress
    AppThreadCommandCompleted
    AppThreadCommandFailed
    AppThreadCommandDeclined
    } derive(
    Debug
    )

    AppThreadDynamicToolCallStatus

    pub enum AppThreadDynamicToolCallStatus {
    AppThreadDynamicInProgress
    AppThreadDynamicCompleted
    AppThreadDynamicFailed
    } derive(
    Debug
    )

    AppThreadElicitationCounterParams

    pub(all) struct AppThreadElicitationCounterParams {
    thread_id : String
    } derive(
    Debug
    )

    AppThreadElicitationCounterResponse

    pub(all) struct AppThreadElicitationCounterResponse {
    count : UInt64
    paused : Bool
    } derive(
    Debug
    )

    AppThreadFileUpdateChange

    pub struct AppThreadFileUpdateChange {
    path : String
    kind : AppThreadPatchChangeKind
    diff : String
    } derive(
    Debug
    )

    AppThreadForkParams

    pub(all) struct AppThreadForkParams {
    thread_id : String
    last_turn_id : String?
    model : String?
    model_provider : String?
    service_tier : AppNullableString?
    cwd : String?
    approval_policy : AppApprovalPolicy?
    approvals_reviewer : AppApprovalsReviewer?
    sandbox : SandboxMode?
    config : Map[String, Json]?
    base_instructions : String?
    developer_instructions : String?
    ephemeral : Bool?
    thread_source : String?
    } derive(
    Debug
    )

    AppThreadForkResponse

    pub struct AppThreadForkResponse {
    thread : AppThread
    model : String
    model_provider : String
    service_tier : String?
    cwd : String
    instruction_sources : ArrayView[String]
    approval_policy : AppApprovalPolicy
    approvals_reviewer : AppApprovalsReviewer
    sandbox : AppSandboxPolicy
    reasoning_effort : AppReasoningEffort?
    } derive(
    Debug
    )

    AppThreadGoal

    pub(all) struct AppThreadGoal {
    thread_id : String
    objective : String
    status : AppThreadGoalStatus
    token_budget : Int64?
    tokens_used : Int64
    time_used_seconds : Int64
    created_at : Int64
    updated_at : Int64
    } derive(
    Debug
    )

    AppThreadGoalClearResponse

    pub(all) struct AppThreadGoalClearResponse {
    cleared : Bool
    } derive(
    Debug
    )

    AppThreadGoalSetParams

    pub(all) struct AppThreadGoalSetParams {
    thread_id : String
    objective : String?
    status : AppThreadGoalStatus?
    token_budget : AppNullableInt64?
    } derive(
    Debug
    )

    AppThreadGoalStatus

    pub(all) enum AppThreadGoalStatus {
    AppThreadGoalActive
    AppThreadGoalPaused
    AppThreadGoalBudgetLimited
    AppThreadGoalComplete
    } derive(
    Debug
    )

    AppThreadIdParams

    pub struct AppThreadIdParams {
    thread_id : String
    } derive(
    Debug
    )

    AppThreadIdParams::new

    fn AppThreadIdParams::new(thread_id : String) -> AppThreadIdParams

    AppThreadInjectItemsParams

    pub(all) struct AppThreadInjectItemsParams {
    thread_id : String
    items : Array[Json]
    } derive(
    Debug
    )

    AppThreadItem

    pub enum AppThreadItem {
    AppThreadUserMessageItem(id~ : String, content~ : ArrayView[AppThreadUserInput])
    AppThreadHookPromptItem(id~ : String, fragments~ : ArrayView[AppHookPromptFragment])
    AppThreadAgentMessageItem(id~ : String, text~ : String, phase~ : AppMessagePhase?, memory_citation~ : AppMemoryCitation?)
    AppThreadPlanItem(id~ : String, text~ : String)
    AppThreadReasoningItem(id~ : String, summary~ : ArrayView[String], content~ : ArrayView[String])
    AppThreadCommandExecutionItem(id~ : String, command~ : String, cwd~ : String, process_id~ : String?, source~ : AppThreadCommandExecutionSource, status~ : AppThreadCommandExecutionStatus, command_actions~ : ArrayView[AppCommandAction], aggregated_output~ : String?, exit_code~ : Int?, duration_ms~ : Int64?)
    AppThreadFileChangeItem(id~ : String, changes~ : ArrayView[AppThreadFileUpdateChange], status~ : AppThreadPatchApplyStatus)
    AppThreadMcpToolCallItem(id~ : String, server~ : String, tool~ : String, status~ : AppThreadMcpToolCallStatus, arguments~ : Json, mcp_app_resource_uri~ : String?, result~ : AppThreadMcpToolCallResult?, error~ : AppThreadMcpToolCallError?, duration_ms~ : Int64?)
    AppThreadDynamicToolCallItem(id~ : String, tool_namespace~ : String?, tool~ : String, arguments~ : Json, status~ : AppThreadDynamicToolCallStatus, content_items~ : ArrayView[AppDynamicToolCallOutputContentItem]?, success~ : Bool?, duration_ms~ : Int64?)
    AppThreadCollabAgentToolCallItem(id~ : String, tool~ : AppThreadCollabAgentTool, status~ : AppThreadCollabAgentToolCallStatus, sender_thread_id~ : String, receiver_thread_ids~ : ArrayView[String], prompt~ : String?, model~ : String?, reasoning_effort~ : AppReasoningEffort?, agents_states~ : Map[String, AppThreadCollabAgentState])
    AppThreadWebSearchItem(id~ : String, query~ : String, action~ : AppWebSearchAction?)
    AppThreadImageViewItem(id~ : String, path~ : String)
    AppThreadImageGenerationItem(id~ : String, status~ : String, revised_prompt~ : String?, result~ : String, saved_path~ : String?)
    AppThreadEnteredReviewModeItem(id~ : String, review~ : String)
    AppThreadExitedReviewModeItem(id~ : String, review~ : String)
    AppThreadContextCompactionItem(id~ : String)
    } derive(
    Debug
    )

    AppThreadItemEvent

    pub struct AppThreadItemEvent {
    thread_id : String
    turn_id : String
    app_item : AppThreadItem
    item : ThreadItem?
    raw_item : Json
    timestamp_ms : Int64
    } derive(
    Debug
    )

    AppThreadListCwd

    pub(all) enum AppThreadListCwd {
    OneCwd(String)
    ManyCwds(Array[String])
    } derive(
    Debug
    )

    AppThreadListParams

    pub struct AppThreadListParams {
    cursor : String?
    limit : UInt?
    sort_key : AppThreadSortKey?
    sort_direction : AppSortDirection?
    model_providers : Array[String]?
    source_kinds : Array[AppThreadSourceKind]?
    archived : Bool?
    cwd : AppThreadListCwd?
    use_state_db_only : Bool?
    search_term : String?
    } derive(
    Debug
    )

    Parameters for the app-server thread/list request.

    AppThreadListParams::new

    fn AppThreadListParams::new(cursor? : String, limit? : UInt, sort_key? : AppThreadSortKey, sort_direction? : AppSortDirection, model_providers? : Array[String], source_kinds? : Array[AppThreadSourceKind], archived? : Bool, cwd? : AppThreadListCwd, use_state_db_only? : Bool, search_term? : String) -> AppThreadListParams

    AppThreadListResponse

    pub struct AppThreadListResponse {
    data : ArrayView[AppThread]
    next_cursor : String?
    backwards_cursor : String?
    } derive(
    Debug
    )

    AppThreadLoadedListParams

    pub struct AppThreadLoadedListParams {
    cursor : String?
    limit : UInt?
    } derive(
    Debug
    )

    AppThreadLoadedListParams::new

    fn AppThreadLoadedListParams::new(cursor? : String, limit? : UInt) -> AppThreadLoadedListParams

    AppThreadLoadedListResponse

    pub struct AppThreadLoadedListResponse {
    data : ArrayView[String]
    next_cursor : String?
    } derive(
    Debug
    )

    AppThreadMcpToolCallError

    pub struct AppThreadMcpToolCallError {
    message : String
    } derive(
    Debug
    )

    AppThreadMcpToolCallResult

    pub struct AppThreadMcpToolCallResult {
    content : ArrayView[Json]
    structured_content : Json?
    meta : Json?
    } derive(
    Debug
    )

    AppThreadMcpToolCallStatus

    pub enum AppThreadMcpToolCallStatus {
    AppThreadMcpInProgress
    AppThreadMcpCompleted
    AppThreadMcpFailed
    } derive(
    Debug
    )

    AppThreadMemoryMode

    pub(all) enum AppThreadMemoryMode {
    AppThreadMemoryEnabled
    AppThreadMemoryDisabled
    } derive(
    Debug
    )

    AppThreadMemoryModeSetParams

    pub(all) struct AppThreadMemoryModeSetParams {
    thread_id : String
    mode : AppThreadMemoryMode
    } derive(
    Debug
    )

    AppThreadMetadataGitInfoUpdateParams

    pub(all) struct AppThreadMetadataGitInfoUpdateParams {
    sha : AppNullableString?
    branch : AppNullableString?
    origin_url : AppNullableString?
    } derive(
    Debug
    )

    AppThreadMetadataUpdateParams

    pub(all) struct AppThreadMetadataUpdateParams {
    thread_id : String
    git_info : AppThreadMetadataGitInfoUpdateParams?
    } derive(
    Debug
    )

    AppThreadMetadataUpdateResponse

    pub struct AppThreadMetadataUpdateResponse {
    thread : AppThread
    } derive(
    Debug
    )

    AppThreadPatchApplyStatus

    pub enum AppThreadPatchApplyStatus {
    AppThreadPatchInProgress
    AppThreadPatchCompleted
    AppThreadPatchFailed
    AppThreadPatchDeclined
    } derive(
    Debug
    )

    AppThreadPatchChangeKind

    pub enum AppThreadPatchChangeKind {
    AppThreadPatchAdd
    AppThreadPatchDelete
    AppThreadPatchUpdate(move_path~ : String?)
    } derive(
    Debug
    )

    AppThreadReadParams

    pub struct AppThreadReadParams {
    thread_id : String
    include_turns : Bool
    } derive(
    Debug
    )

    Parameters for the app-server thread/read request.

    AppThreadReadParams::new

    fn AppThreadReadParams::new(thread_id : String, include_turns : Bool) -> AppThreadReadParams

    AppThreadRealtimeAppendAudioParams

    pub(all) struct AppThreadRealtimeAppendAudioParams {
    thread_id : String
    audio : AppThreadRealtimeAudioChunk
    } derive(
    Debug
    )

    AppThreadRealtimeAppendTextParams

    pub(all) struct AppThreadRealtimeAppendTextParams {
    thread_id : String
    text : String
    } derive(
    Debug
    )

    AppThreadRealtimeAudioChunk

    pub(all) struct AppThreadRealtimeAudioChunk {
    data : String
    sample_rate : UInt
    num_channels : UInt
    samples_per_channel : UInt?
    item_id : String?
    } derive(
    Debug
    )

    AppThreadRealtimeListVoicesResponse

    pub(all) struct AppThreadRealtimeListVoicesResponse {
    voices : AppRealtimeVoicesList
    } derive(
    Debug
    )

    AppThreadRealtimeStartParams

    pub(all) struct AppThreadRealtimeStartParams {
    thread_id : String
    output_modality : AppRealtimeOutputModality
    prompt : AppNullableString?
    realtime_session_id : String?
    transport : AppThreadRealtimeStartTransport?
    voice : AppRealtimeVoice?
    } derive(
    Debug
    )

    AppThreadRealtimeStartTransport

    pub(all) enum AppThreadRealtimeStartTransport {
    AppThreadRealtimeWebsocket
    AppThreadRealtimeWebrtc(sdp~ : String)
    } derive(
    Debug
    )

    AppThreadResumeParams

    pub struct AppThreadResumeParams {
    thread_id : String
    model : String?
    model_provider : String?
    service_tier : AppNullableString?
    cwd : String?
    approval_policy : AppApprovalPolicy?
    approvals_reviewer : AppApprovalsReviewer?
    sandbox : SandboxMode?
    config : Map[String, Json]?
    base_instructions : String?
    developer_instructions : String?
    personality : AppPersonality?
    } derive(
    Debug
    )

    AppThreadResumeParams::new

    fn AppThreadResumeParams::new(thread_id : String, model? : String, model_provider? : String, service_tier? : AppNullableString, cwd? : String, approval_policy? : AppApprovalPolicy, approvals_reviewer? : AppApprovalsReviewer, sandbox? : SandboxMode, config? : Map[String, Json], base_instructions? : String, developer_instructions? : String, personality? : AppPersonality) -> AppThreadResumeParams

    AppThreadResumeResponse

    pub struct AppThreadResumeResponse {
    thread : AppThread
    model : String
    model_provider : String
    service_tier : String?
    cwd : String
    instruction_sources : ArrayView[String]
    approval_policy : AppApprovalPolicy
    approvals_reviewer : AppApprovalsReviewer
    sandbox : AppSandboxPolicy
    reasoning_effort : AppReasoningEffort?
    } derive(
    Debug
    )

    AppThreadRollbackParams

    pub(all) struct AppThreadRollbackParams {
    thread_id : String
    num_turns : UInt
    } derive(
    Debug
    )

    AppThreadSection

    pub(all) struct AppThreadSection {
    id : String
    name : String
    appearance : AppThreadSectionAppearance?
    } derive(
    Debug
    )

    AppThreadSectionAppearance

    pub(all) struct AppThreadSectionAppearance {
    icon : String?
    color : String?
    } derive(
    Debug
    )

    AppThreadSectionAppearanceUpdate

    pub(all) enum AppThreadSectionAppearanceUpdate {
    AppClearThreadSectionAppearance
    AppSetThreadSectionAppearance(AppThreadSectionAppearance)
    } derive(
    Debug
    )

    AppThreadSectionCreateParams

    pub(all) struct AppThreadSectionCreateParams {
    name : String
    appearance : AppThreadSectionAppearanceUpdate?
    } derive(
    Debug
    )

    AppThreadSectionCreateParams::new

    AppThreadSectionDeleteParams

    pub(all) struct AppThreadSectionDeleteParams {
    section_id : String
    } derive(
    Debug
    )

    AppThreadSectionListParams

    pub(all) struct AppThreadSectionListParams {
    cursor : String?
    limit : UInt?
    } derive(Default,
    Debug
    )

    AppThreadSectionListParams::new

    fn AppThreadSectionListParams::new(cursor? : String, limit? : UInt) -> AppThreadSectionListParams

    AppThreadSectionListResponse

    pub struct AppThreadSectionListResponse {
    data : ArrayView[AppThreadSection]
    next_cursor : String?
    } derive(
    Debug
    )

    AppThreadSectionMoveParams

    pub(all) struct AppThreadSectionMoveParams {
    thread_id : String
    section_id : AppNullableString
    before_thread_id : AppNullableString?
    } derive(
    Debug
    )

    AppThreadSectionUpdateParams

    pub(all) struct AppThreadSectionUpdateParams {
    section_id : String
    name : String
    appearance : AppThreadSectionAppearanceUpdate?
    } derive(
    Debug
    )

    AppThreadSetNameParams

    pub struct AppThreadSetNameParams {
    thread_id : String
    name : String
    } derive(
    Debug
    )

    AppThreadSetNameParams::new

    fn AppThreadSetNameParams::new(thread_id : String, name : String) -> AppThreadSetNameParams

    AppThreadShellCommandParams

    pub(all) struct AppThreadShellCommandParams {
    thread_id : String
    command : String
    } derive(
    Debug
    )

    AppThreadSortKey

    pub(all) enum AppThreadSortKey {
    ThreadCreatedAt
    ThreadUpdatedAt
    } derive(
    Debug
    )

    AppThreadSourceKind

    pub(all) enum AppThreadSourceKind {
    SourceCli
    SourceVscode
    SourceExec
    SourceAppServer
    SourceSubAgent
    SourceSubAgentReview
    SourceSubAgentCompact
    SourceSubAgentThreadSpawn
    SourceSubAgentOther
    SourceUnknown
    } derive(
    Debug
    )

    AppThreadStartParams

    pub struct AppThreadStartParams {
    model : String?
    model_provider : String?
    service_tier : AppNullableString?
    cwd : String?
    approval_policy : AppApprovalPolicy?
    approvals_reviewer : AppApprovalsReviewer?
    sandbox : SandboxMode?
    config : Map[String, Json]?
    service_name : String?
    base_instructions : String?
    developer_instructions : String?
    personality : AppPersonality?
    ephemeral : Bool?
    session_start_source : AppThreadStartSource?
    thread_source : String?
    } derive(
    Debug
    )

    Parameters for the app-server thread/start request.

    AppThreadStartParams::new

    fn AppThreadStartParams::new(model? : String, model_provider? : String, service_tier? : AppNullableString, cwd? : String, approval_policy? : AppApprovalPolicy, approvals_reviewer? : AppApprovalsReviewer, sandbox? : SandboxMode, config? : Map[String, Json], service_name? : String, base_instructions? : String, developer_instructions? : String, personality? : AppPersonality, ephemeral? : Bool, session_start_source? : AppThreadStartSource, thread_source? : String) -> AppThreadStartParams

    AppThreadStartResponse

    pub struct AppThreadStartResponse {
    thread : AppThread
    model : String
    model_provider : String
    service_tier : String?
    cwd : String
    instruction_sources : ArrayView[String]
    approval_policy : AppApprovalPolicy
    approvals_reviewer : AppApprovalsReviewer
    sandbox : AppSandboxPolicy
    reasoning_effort : AppReasoningEffort?
    } derive(
    Debug
    )

    AppThreadStartSource

    pub(all) enum AppThreadStartSource {
    AppThreadStartup
    AppThreadClear
    } derive(
    Debug
    )

    AppThreadStatus

    pub enum AppThreadStatus {
    ThreadNotLoaded
    ThreadIdle
    ThreadSystemError
    ThreadActive(active_flags~ : ArrayView[AppThreadActiveFlag])
    } derive(
    Debug
    )

    AppThreadTokenUsage

    pub struct AppThreadTokenUsage {
    total : AppTokenUsageBreakdown
    last : AppTokenUsageBreakdown
    model_context_window : Int64?
    } derive(
    Debug
    )

    AppThreadTurnsListParams

    pub(all) struct AppThreadTurnsListParams {
    thread_id : String
    cursor : String?
    limit : UInt?
    sort_direction : AppSortDirection?
    } derive(
    Debug
    )

    AppThreadTurnsListResponse

    pub(all) struct AppThreadTurnsListResponse {
    data : ArrayView[AppTurn]
    next_cursor : String?
    backwards_cursor : String?
    } derive(
    Debug
    )

    AppThreadUnsubscribeStatus

    pub(all) enum AppThreadUnsubscribeStatus {
    AppThreadNotLoaded
    AppThreadNotSubscribed
    AppThreadUnsubscribed
    } derive(
    Debug
    )

    AppThreadUserInput

    pub enum AppThreadUserInput {
    AppThreadInputText(text~ : String, text_elements~ : ArrayView[AppTextElement])
    AppThreadInputImage(url~ : String, detail~ : AppImageDetail?)
    AppThreadInputLocalImage(path~ : String, detail~ : AppImageDetail?)
    AppThreadInputAudio(url~ : String)
    AppThreadInputLocalAudio(path~ : String)
    AppThreadInputSkill(name~ : String, path~ : String)
    AppThreadInputMention(name~ : String, path~ : String)
    } derive(
    Debug
    )

    AppTokenUsageBreakdown

    pub struct AppTokenUsageBreakdown {
    total_tokens : Int64
    input_tokens : Int64
    cached_input_tokens : Int64
    output_tokens : Int64
    reasoning_output_tokens : Int64
    } derive(
    Debug
    )

    AppToolApproval

    pub enum AppToolApproval {
    AppToolApprovalAuto
    AppToolApprovalPrompt
    AppToolApprovalApprove
    } derive(
    Debug
    )

    AppToolConfig

    pub struct AppToolConfig {
    enabled : Bool?
    approval_mode : AppToolApproval?
    } derive(
    Debug
    )

    AppToolRequestUserInputAnswer

    pub(all) struct AppToolRequestUserInputAnswer {
    answers : ArrayView[String]
    } derive(ToJson,
    Debug
    )

    AppToolRequestUserInputOption

    pub(all) struct AppToolRequestUserInputOption {
    label : String
    description : String
    } derive(
    Debug
    ,
    FromJson
    )

    AppToolRequestUserInputQuestion

    pub(all) struct AppToolRequestUserInputQuestion {
    id : String
    header : String
    question : String
    is_other : Bool
    is_secret : Bool
    options : ArrayView[AppToolRequestUserInputOption]?
    } derive(
    Debug
    )

    AppToolRequestUserInputRequest

    pub(all) struct AppToolRequestUserInputRequest {
    thread_id : String
    turn_id : String
    item_id : String
    questions : ArrayView[AppToolRequestUserInputQuestion]
    is_blocking : Bool
    auto_resolution_ms : Int64?
    // private fields
    } derive(
    Debug
    )

    AppTurn

    pub struct AppTurn {
    id : String
    items : ArrayView[AppThreadItem]
    status : AppTurnStatus
    error : AppTurnError?
    started_at : Int64?
    completed_at : Int64?
    duration_ms : Int64?
    // private fields
    } derive(
    Debug
    )

    AppTurnError

    pub struct AppTurnError {
    message : String
    codex_error_info : AppCodexErrorInfo?
    additional_details : String?
    // private fields
    } derive(
    Debug
    )

    AppTurnInterruptParams

    pub struct AppTurnInterruptParams {
    thread_id : String
    turn_id : String
    } derive(
    Debug
    )

    Parameters for the app-server turn/interrupt request.

    AppTurnInterruptParams::new

    fn AppTurnInterruptParams::new(thread_id : String, turn_id : String) -> AppTurnInterruptParams

    AppTurnPlanStep

    pub(all) struct AppTurnPlanStep {
    step : String
    status : AppTurnPlanStepStatus
    } derive(
    Debug
    )

    AppTurnPlanStepStatus

    pub(all) enum AppTurnPlanStepStatus {
    AppTurnPlanPending
    AppTurnPlanInProgress
    AppTurnPlanCompleted
    } derive(
    Debug
    )

    AppTurnStartOptions

    pub struct AppTurnStartOptions {
    client_user_message_id : String?
    cwd : String?
    approval_policy : AppApprovalPolicy?
    approvals_reviewer : AppApprovalsReviewer?
    sandbox_policy : AppSandboxPolicy?
    model : String?
    service_tier : AppNullableString?
    effort : AppReasoningEffort?
    summary : AppReasoningSummary?
    personality : AppPersonality?
    output_schema : Json?
    } derive(Default,
    Debug
    )

    AppTurnStartOptions::new

    fn AppTurnStartOptions::new(client_user_message_id? : String, cwd? : String, approval_policy? : AppApprovalPolicy, approvals_reviewer? : AppApprovalsReviewer, sandbox_policy? : AppSandboxPolicy, model? : String, service_tier? : AppNullableString, effort? : AppReasoningEffort, summary? : AppReasoningSummary, personality? : AppPersonality, output_schema? : Json) -> AppTurnStartOptions

    AppTurnStartParams

    pub struct AppTurnStartParams {
    thread_id : String
    client_user_message_id : String?
    input : Array[AppUserInput]
    cwd : String?
    approval_policy : AppApprovalPolicy?
    approvals_reviewer : AppApprovalsReviewer?
    sandbox_policy : AppSandboxPolicy?
    model : String?
    service_tier : AppNullableString?
    effort : AppReasoningEffort?
    summary : AppReasoningSummary?
    personality : AppPersonality?
    output_schema : Json?
    } derive(
    Debug
    )

    Parameters for the app-server turn/start request.

    AppTurnStartParams::new

    fn AppTurnStartParams::new(thread_id : String, input : Array[AppUserInput], client_user_message_id? : String, cwd? : String, approval_policy? : AppApprovalPolicy, approvals_reviewer? : AppApprovalsReviewer, sandbox_policy? : AppSandboxPolicy, model? : String, service_tier? : AppNullableString, effort? : AppReasoningEffort, summary? : AppReasoningSummary, personality? : AppPersonality, output_schema? : Json) -> AppTurnStartParams

    AppTurnStatus

    pub enum AppTurnStatus {
    AppTurnCompletedStatus
    AppTurnInterruptedStatus
    AppTurnFailedStatus
    AppTurnInProgressStatus
    } derive(Eq,
    Debug
    )

    AppTurnSteerParams

    pub struct AppTurnSteerParams {
    thread_id : String
    client_user_message_id : String?
    input : Array[AppUserInput]
    expected_turn_id : String
    } derive(
    Debug
    )

    AppTurnSteerParams::new

    fn AppTurnSteerParams::new(thread_id : String, input : Array[AppUserInput], expected_turn_id : String, client_user_message_id? : String) -> AppTurnSteerParams

    AppTurnSteerResponse

    pub struct AppTurnSteerResponse {
    turn_id : String
    } derive(
    Debug
    )

    AppTurnStream

    pub struct AppTurnStream {
    thread_id : String
    turn_id : String
    // private fields
    }

    AppTurnStream::close

    fn AppTurnStream::close(self : AppTurnStream) -> Unit

    Close this client-side turn stream without interrupting the server-side turn.

    AppTurnStream::interrupt

    async fn AppTurnStream::interrupt(self : AppTurnStream) -> Unit

    Interrupt the server-side turn and close this client-side stream.

    AppTurnStream::next

    async fn AppTurnStream::next(self : AppTurnStream) -> AppServerEvent?

    Receive the next event for this turn.

    AppUserInput

    pub(all) enum AppUserInput {
    AppInputText(text~ : String)
    AppInputTextWithElements(text~ : String, text_elements~ : Array[AppTextElement])
    AppInputImage(url~ : String)
    AppInputImageWithDetail(url~ : String, detail~ : AppImageDetail)
    AppInputLocalImage(path~ : String)
    AppInputLocalImageWithDetail(path~ : String, detail~ : AppImageDetail)
    AppInputAudio(url~ : String)
    AppInputLocalAudio(path~ : String)
    AppInputSkill(name~ : String, path~ : String)
    AppInputMention(name~ : String, path~ : String)
    } derive(
    Debug
    )

    AppWebSearchAction

    pub enum AppWebSearchAction {
    AppWebSearchActionSearch(query~ : String?, queries~ : ArrayView[String]?)
    AppWebSearchActionOpenPage(url~ : String?)
    AppWebSearchActionFindInPage(url~ : String?, pattern~ : String?)
    AppWebSearchActionOther
    } derive(
    Debug
    )

    AppWebSearchContextSize

    pub enum AppWebSearchContextSize {
    AppWebSearchContextLow
    AppWebSearchContextMedium
    AppWebSearchContextHigh
    } derive(
    Debug
    )

    AppWebSearchLocation

    pub struct AppWebSearchLocation {
    country : String?
    region : String?
    city : String?
    timezone : String?
    } derive(
    Debug
    )

    AppWebSearchMode

    pub enum AppWebSearchMode {
    AppWebSearchDisabled
    AppWebSearchCached
    AppWebSearchLive
    } derive(
    Debug
    )

    AppWebSearchToolConfig

    pub struct AppWebSearchToolConfig {
    context_size : AppWebSearchContextSize?
    allowed_domains : ArrayView[String]?
    location : AppWebSearchLocation?
    } derive(
    Debug
    )

    AppWindowsSandboxSetupMode

    pub(all) enum AppWindowsSandboxSetupMode {
    AppWindowsSandboxElevated
    AppWindowsSandboxUnelevated
    } derive(
    Debug
    )

    AppWindowsSandboxSetupStartParams

    pub(all) struct AppWindowsSandboxSetupStartParams {
    mode : AppWindowsSandboxSetupMode
    cwd : String?
    } derive(
    Debug
    )

    AppWindowsSandboxSetupStartResponse

    pub struct AppWindowsSandboxSetupStartResponse {
    started : Bool
    } derive(
    Debug
    )

    ApprovalMode

    pub(all) enum ApprovalMode {
    Never
    OnRequest
    OnFailure
    Untrusted
    }

    Approval mode for actions that require user consent.

    Codex

    type Codex

    Codex is the main class for interacting with the Codex agent.

    Use the start_thread() method to start a new thread or resume_thread() to resume a previously started thread.

    Codex::new

    fn Codex::new(options? : CodexOptions) -> Codex

    Create a new Codex instance.

    Arguments

    • options - Optional configuration for the Codex client

    Returns

    A new Codex instance

    Codex::resume_thread

    fn Codex::resume_thread(self : Codex, id : String, options? : ThreadOptions) -> Thread

    Resumes a conversation with an agent based on the thread id. Threads are persisted in ~/.codex/sessions.

    Arguments

    • id - The id of the thread to resume
    • options - Optional configuration for the thread

    Returns

    A new thread instance

    Codex::start_thread

    fn Codex::start_thread(self : Codex, options? : ThreadOptions) -> Thread

    Starts a new conversation with an agent.

    Arguments

    • options - Optional configuration for the thread

    Returns

    A new thread instance

    Codex::with_app_server

    async fn[R] Codex::with_app_server(self : Codex, options? : AppServerOptions, request_handler? : async (AppServerRequest) -> AppServerResponse, body : async (CodexAppConnection) -> R) -> R

    Run a scoped Codex app-server connection.

    This is the app-server entry point. It creates a task group for the app-server process, writer pump, and reader pump, performs the bootstrap handshake, then closes the send side when the callback returns or raises.

    Codex::with_app_server_session

    async fn[R] Codex::with_app_server_session(self : Codex, options? : AppServerOptions, request_handler? : async (AppServerRequest) -> AppServerResponse, body : async (CodexAppSession) -> R) -> R

    Run a scoped Codex app-server session.

    The session is the ergonomic app-server layer. It owns the shared notification stream, routes turn-scoped events into per-turn streams, and routes server-initiated requests to turn-scoped handlers before falling back to the optional session-level request handler.

    CodexAppConnection

    type CodexAppConnection

    CodexAppConnection::account_login_cancel

    Call account/login/cancel.

    CodexAppConnection::account_login_start

    Call account/login/start.

    CodexAppConnection::account_logout

    async fn CodexAppConnection::account_logout(self : CodexAppConnection) -> Unit

    Call account/logout.

    CodexAppConnection::account_rate_limits_read

    async fn CodexAppConnection::account_rate_limits_read(self : CodexAppConnection) -> AppAccountRateLimitsReadResponse

    Call account/rateLimits/read.

    CodexAppConnection::account_read

    Call account/read.

    CodexAppConnection::account_send_add_credits_nudge_email

    Call account/sendAddCreditsNudgeEmail.

    CodexAppConnection::app_list

    async fn CodexAppConnection::app_list(self : CodexAppConnection, params? : AppListParams) -> AppListResponse

    Call app/list.

    CodexAppConnection::collaboration_mode_list

    async fn CodexAppConnection::collaboration_mode_list(self : CodexAppConnection) -> AppCollaborationModeListResponse

    CodexAppConnection::command_exec

    Call command/exec.

    CodexAppConnection::command_exec_resize

    async fn CodexAppConnection::command_exec_resize(self : CodexAppConnection, params : AppCommandExecResizeParams) -> Unit

    Call command/exec/resize.

    CodexAppConnection::command_exec_terminate

    async fn CodexAppConnection::command_exec_terminate(self : CodexAppConnection, params : AppCommandExecProcessParams) -> Unit

    Call command/exec/terminate.

    CodexAppConnection::command_exec_write

    async fn CodexAppConnection::command_exec_write(self : CodexAppConnection, params : AppCommandExecWriteParams) -> Unit

    Call command/exec/write.

    CodexAppConnection::config_batch_write

    Call config/batchWrite.

    CodexAppConnection::config_mcp_server_reload

    async fn CodexAppConnection::config_mcp_server_reload(self : CodexAppConnection) -> Unit

    Call config/mcpServer/reload.

    CodexAppConnection::config_read

    Call config/read.

    CodexAppConnection::config_requirements_read

    async fn CodexAppConnection::config_requirements_read(self : CodexAppConnection) -> AppConfigRequirementsReadResponse

    Call configRequirements/read.

    CodexAppConnection::config_value_write

    Call config/value/write.

    CodexAppConnection::experimental_feature_enablement_set

    Call experimentalFeature/enablement/set.

    CodexAppConnection::experimental_feature_list

    async fn CodexAppConnection::experimental_feature_list(self : CodexAppConnection, params : AppCursorLimitParams) -> AppExperimentalFeatureListResponse

    Call experimentalFeature/list.

    CodexAppConnection::external_agent_config_detect

    Call externalAgentConfig/detect.

    CodexAppConnection::external_agent_config_import

    async fn CodexAppConnection::external_agent_config_import(self : CodexAppConnection, params : AppExternalAgentConfigImportParams) -> Unit

    Call externalAgentConfig/import.

    CodexAppConnection::feedback_upload

    Call feedback/upload.

    CodexAppConnection::fs_copy

    async fn CodexAppConnection::fs_copy(self : CodexAppConnection, params : AppFsCopyParams) -> Unit

    Call fs/copy.

    CodexAppConnection::fs_create_directory

    async fn CodexAppConnection::fs_create_directory(self : CodexAppConnection, params : AppFsCreateDirectoryParams) -> Unit

    Call fs/createDirectory.

    CodexAppConnection::fs_get_metadata

    async fn CodexAppConnection::fs_get_metadata(self : CodexAppConnection, params : AppFsPathParams) -> AppFsGetMetadataResponse

    Call fs/getMetadata.

    CodexAppConnection::fs_read_directory

    async fn CodexAppConnection::fs_read_directory(self : CodexAppConnection, params : AppFsPathParams) -> AppFsReadDirectoryResponse

    Call fs/readDirectory.

    CodexAppConnection::fs_read_file

    Call fs/readFile.

    CodexAppConnection::fs_remove

    async fn CodexAppConnection::fs_remove(self : CodexAppConnection, params : AppFsRemoveParams) -> Unit

    Call fs/remove.

    CodexAppConnection::fs_unwatch

    async fn CodexAppConnection::fs_unwatch(self : CodexAppConnection, params : AppFsUnwatchParams) -> Unit

    Call fs/unwatch.

    CodexAppConnection::fs_watch

    Call fs/watch.

    CodexAppConnection::fs_write_file

    async fn CodexAppConnection::fs_write_file(self : CodexAppConnection, params : AppFsWriteFileParams) -> Unit

    Call fs/writeFile.

    Call fuzzyFileSearch.

    CodexAppConnection::fuzzy_file_search_session_start

    async fn CodexAppConnection::fuzzy_file_search_session_start(self : CodexAppConnection, params : AppFuzzyFileSearchSessionStartParams) -> Unit

    CodexAppConnection::fuzzy_file_search_session_stop

    async fn CodexAppConnection::fuzzy_file_search_session_stop(self : CodexAppConnection, params : AppFuzzyFileSearchSessionStopParams) -> Unit

    CodexAppConnection::fuzzy_file_search_session_update

    async fn CodexAppConnection::fuzzy_file_search_session_update(self : CodexAppConnection, params : AppFuzzyFileSearchSessionUpdateParams) -> Unit

    CodexAppConnection::hooks_list

    Call hooks/list.

    CodexAppConnection::marketplace_add

    Call marketplace/add.

    CodexAppConnection::marketplace_remove

    Call marketplace/remove.

    CodexAppConnection::marketplace_upgrade

    Call marketplace/upgrade.

    CodexAppConnection::mcp_server_oauth_login

    Call mcpServer/oauth/login.

    CodexAppConnection::mcp_server_resource_read

    Call mcpServer/resource/read.

    CodexAppConnection::mcp_server_status_list

    Call mcpServerStatus/list.

    CodexAppConnection::mcp_server_tool_call

    Call mcpServer/tool/call.

    CodexAppConnection::memory_reset

    async fn CodexAppConnection::memory_reset(self : CodexAppConnection) -> Unit

    CodexAppConnection::mock_experimental_method

    CodexAppConnection::model_list

    Call model/list.

    CodexAppConnection::model_provider_capabilities_read

    async fn CodexAppConnection::model_provider_capabilities_read(self : CodexAppConnection) -> AppModelProviderCapabilitiesReadResponse

    Call modelProvider/capabilities/read.

    CodexAppConnection::next_event

    async fn CodexAppConnection::next_event(self : CodexAppConnection) -> AppServerEvent?

    Receive the next server notification from the app server.

    CodexAppConnection::notify

    async fn CodexAppConnection::notify(self : CodexAppConnection, rpc_method : String, params? : Json) -> Unit

    Send one app-server JSON-RPC notification.

    CodexAppConnection::plugin_install

    Call plugin/install.

    CodexAppConnection::plugin_list

    Call plugin/list.

    CodexAppConnection::plugin_read

    Call plugin/read.

    CodexAppConnection::plugin_uninstall

    async fn CodexAppConnection::plugin_uninstall(self : CodexAppConnection, params : AppPluginUninstallParams) -> Unit

    Call plugin/uninstall.

    CodexAppConnection::request

    async fn CodexAppConnection::request(self : CodexAppConnection, rpc_method : String, params? : Json) -> Json

    Send an arbitrary app-server request and return its raw JSON result.

    This is the complete, forward-compatible protocol escape hatch. Prefer a typed method when one is available.

    CodexAppConnection::review_start

    Call review/start.

    CodexAppConnection::skills_config_write

    Call skills/config/write.

    CodexAppConnection::skills_list

    Call skills/list.

    CodexAppConnection::thread_approve_guardian_denied_action

    async fn CodexAppConnection::thread_approve_guardian_denied_action(self : CodexAppConnection, params : AppThreadApproveGuardianDeniedActionParams) -> Unit

    Call thread/approveGuardianDeniedAction.

    CodexAppConnection::thread_archive

    async fn CodexAppConnection::thread_archive(self : CodexAppConnection, params : AppThreadIdParams) -> Unit

    Call thread/archive.

    CodexAppConnection::thread_background_terminals_clean

    async fn CodexAppConnection::thread_background_terminals_clean(self : CodexAppConnection, params : AppThreadIdParams) -> Unit

    CodexAppConnection::thread_compact_start

    async fn CodexAppConnection::thread_compact_start(self : CodexAppConnection, params : AppThreadIdParams) -> Unit

    Call thread/compact/start.

    CodexAppConnection::thread_decrement_elicitation

    CodexAppConnection::thread_delete

    async fn CodexAppConnection::thread_delete(self : CodexAppConnection, params : AppThreadIdParams) -> Unit

    CodexAppConnection::thread_fork

    Call thread/fork.

    CodexAppConnection::thread_goal_clear

    CodexAppConnection::thread_goal_get

    CodexAppConnection::thread_goal_set

    CodexAppConnection::thread_increment_elicitation

    CodexAppConnection::thread_inject_items

    async fn CodexAppConnection::thread_inject_items(self : CodexAppConnection, params : AppThreadInjectItemsParams) -> Unit

    Call thread/inject_items.

    CodexAppConnection::thread_list

    Call thread/list.

    CodexAppConnection::thread_loaded_list

    Call thread/loaded/list.

    CodexAppConnection::thread_memory_mode_set

    async fn CodexAppConnection::thread_memory_mode_set(self : CodexAppConnection, params : AppThreadMemoryModeSetParams) -> Unit

    CodexAppConnection::thread_metadata_update

    Call thread/metadata/update.

    CodexAppConnection::thread_read

    Call thread/read.

    CodexAppConnection::thread_realtime_append_audio

    async fn CodexAppConnection::thread_realtime_append_audio(self : CodexAppConnection, params : AppThreadRealtimeAppendAudioParams) -> Unit

    CodexAppConnection::thread_realtime_append_text

    async fn CodexAppConnection::thread_realtime_append_text(self : CodexAppConnection, params : AppThreadRealtimeAppendTextParams) -> Unit

    CodexAppConnection::thread_realtime_list_voices

    async fn CodexAppConnection::thread_realtime_list_voices(self : CodexAppConnection) -> AppThreadRealtimeListVoicesResponse

    CodexAppConnection::thread_realtime_start

    async fn CodexAppConnection::thread_realtime_start(self : CodexAppConnection, params : AppThreadRealtimeStartParams) -> Unit

    CodexAppConnection::thread_realtime_stop

    async fn CodexAppConnection::thread_realtime_stop(self : CodexAppConnection, params : AppThreadIdParams) -> Unit

    CodexAppConnection::thread_resume

    Call thread/resume.

    CodexAppConnection::thread_rollback

    Call thread/rollback.

    CodexAppConnection::thread_section_create

    CodexAppConnection::thread_section_delete

    async fn CodexAppConnection::thread_section_delete(self : CodexAppConnection, params : AppThreadSectionDeleteParams) -> Unit

    CodexAppConnection::thread_section_list

    CodexAppConnection::thread_section_move

    async fn CodexAppConnection::thread_section_move(self : CodexAppConnection, params : AppThreadSectionMoveParams) -> Unit

    CodexAppConnection::thread_section_update

    CodexAppConnection::thread_set_name

    async fn CodexAppConnection::thread_set_name(self : CodexAppConnection, params : AppThreadSetNameParams) -> Unit

    Call thread/name/set.

    CodexAppConnection::thread_shell_command

    async fn CodexAppConnection::thread_shell_command(self : CodexAppConnection, params : AppThreadShellCommandParams) -> Unit

    Call thread/shellCommand.

    CodexAppConnection::thread_start

    Call thread/start.

    CodexAppConnection::thread_turns_list

    CodexAppConnection::thread_unarchive

    async fn CodexAppConnection::thread_unarchive(self : CodexAppConnection, params : AppThreadIdParams) -> AppThreadReadResponse

    Call thread/unarchive.

    CodexAppConnection::thread_unsubscribe

    Call thread/unsubscribe.

    CodexAppConnection::turn_interrupt

    async fn CodexAppConnection::turn_interrupt(self : CodexAppConnection, params : AppTurnInterruptParams) -> Unit

    Call turn/interrupt.

    CodexAppConnection::turn_start

    Call turn/start.

    CodexAppConnection::turn_steer

    Call turn/steer.

    CodexAppConnection::windows_sandbox_setup_start

    Call windowsSandbox/setupStart.

    CodexAppSession

    pub struct CodexAppSession {
    // private fields
    }

    CodexAppSession::account_login_cancel

    CodexAppSession::account_login_start

    async fn CodexAppSession::account_login_start(self : CodexAppSession, params : AppLoginAccountParams) -> AppAccountLoginStartResponse

    CodexAppSession::account_logout

    async fn CodexAppSession::account_logout(self : CodexAppSession) -> Unit

    CodexAppSession::account_rate_limits_read

    async fn CodexAppSession::account_rate_limits_read(self : CodexAppSession) -> AppAccountRateLimitsReadResponse

    CodexAppSession::account_read

    CodexAppSession::account_send_add_credits_nudge_email

    async fn CodexAppSession::account_send_add_credits_nudge_email(self : CodexAppSession, params : AppSendAddCreditsNudgeEmailParams) -> AppAccountSendAddCreditsNudgeEmailResponse

    CodexAppSession::app_list

    async fn CodexAppSession::app_list(self : CodexAppSession, params? : AppListParams) -> AppListResponse

    CodexAppSession::collaboration_mode_list

    async fn CodexAppSession::collaboration_mode_list(self : CodexAppSession) -> AppCollaborationModeListResponse

    CodexAppSession::command_exec

    CodexAppSession::command_exec_resize

    async fn CodexAppSession::command_exec_resize(self : CodexAppSession, params : AppCommandExecResizeParams) -> Unit

    CodexAppSession::command_exec_terminate

    async fn CodexAppSession::command_exec_terminate(self : CodexAppSession, params : AppCommandExecProcessParams) -> Unit

    CodexAppSession::command_exec_write

    async fn CodexAppSession::command_exec_write(self : CodexAppSession, params : AppCommandExecWriteParams) -> Unit

    CodexAppSession::config_batch_write

    CodexAppSession::config_mcp_server_reload

    async fn CodexAppSession::config_mcp_server_reload(self : CodexAppSession) -> Unit

    CodexAppSession::config_read

    CodexAppSession::config_requirements_read

    async fn CodexAppSession::config_requirements_read(self : CodexAppSession) -> AppConfigRequirementsReadResponse

    CodexAppSession::config_value_write

    CodexAppSession::experimental_feature_enablement_set

    CodexAppSession::experimental_feature_list

    async fn CodexAppSession::experimental_feature_list(self : CodexAppSession, params : AppCursorLimitParams) -> AppExperimentalFeatureListResponse

    CodexAppSession::external_agent_config_detect

    CodexAppSession::external_agent_config_import

    async fn CodexAppSession::external_agent_config_import(self : CodexAppSession, params : AppExternalAgentConfigImportParams) -> Unit

    CodexAppSession::feedback_upload

    CodexAppSession::fs_copy

    async fn CodexAppSession::fs_copy(self : CodexAppSession, params : AppFsCopyParams) -> Unit

    CodexAppSession::fs_create_directory

    async fn CodexAppSession::fs_create_directory(self : CodexAppSession, params : AppFsCreateDirectoryParams) -> Unit

    CodexAppSession::fs_get_metadata

    async fn CodexAppSession::fs_get_metadata(self : CodexAppSession, params : AppFsPathParams) -> AppFsGetMetadataResponse

    CodexAppSession::fs_read_directory

    async fn CodexAppSession::fs_read_directory(self : CodexAppSession, params : AppFsPathParams) -> AppFsReadDirectoryResponse

    CodexAppSession::fs_read_file

    async fn CodexAppSession::fs_read_file(self : CodexAppSession, params : AppFsPathParams) -> AppFsReadFileResponse

    CodexAppSession::fs_remove

    async fn CodexAppSession::fs_remove(self : CodexAppSession, params : AppFsRemoveParams) -> Unit

    CodexAppSession::fs_unwatch

    async fn CodexAppSession::fs_unwatch(self : CodexAppSession, params : AppFsUnwatchParams) -> Unit

    CodexAppSession::fs_watch

    async fn CodexAppSession::fs_watch(self : CodexAppSession, params : AppFsWatchParams) -> AppFsWatchResponse

    CodexAppSession::fs_write_file

    async fn CodexAppSession::fs_write_file(self : CodexAppSession, params : AppFsWriteFileParams) -> Unit

    CodexAppSession::fuzzy_file_search_session_start

    async fn CodexAppSession::fuzzy_file_search_session_start(self : CodexAppSession, params : AppFuzzyFileSearchSessionStartParams) -> Unit

    CodexAppSession::fuzzy_file_search_session_stop

    async fn CodexAppSession::fuzzy_file_search_session_stop(self : CodexAppSession, params : AppFuzzyFileSearchSessionStopParams) -> Unit

    CodexAppSession::fuzzy_file_search_session_update

    async fn CodexAppSession::fuzzy_file_search_session_update(self : CodexAppSession, params : AppFuzzyFileSearchSessionUpdateParams) -> Unit

    CodexAppSession::hooks_list

    CodexAppSession::marketplace_add

    CodexAppSession::marketplace_remove

    CodexAppSession::marketplace_upgrade

    CodexAppSession::mcp_server_oauth_login

    CodexAppSession::mcp_server_resource_read

    async fn CodexAppSession::mcp_server_resource_read(self : CodexAppSession, params : AppMcpResourceReadParams) -> AppMcpServerResourceReadResponse

    CodexAppSession::mcp_server_status_list

    CodexAppSession::mcp_server_tool_call

    CodexAppSession::memory_reset

    async fn CodexAppSession::memory_reset(self : CodexAppSession) -> Unit

    CodexAppSession::mock_experimental_method

    CodexAppSession::model_list

    async fn CodexAppSession::model_list(self : CodexAppSession, params? : AppModelListParams) -> AppModelListResponse

    CodexAppSession::model_provider_capabilities_read

    async fn CodexAppSession::model_provider_capabilities_read(self : CodexAppSession) -> AppModelProviderCapabilitiesReadResponse

    CodexAppSession::next_global_event

    async fn CodexAppSession::next_global_event(self : CodexAppSession) -> AppServerEvent?

    Receive the next non-turn or unregistered app-server event.

    CodexAppSession::notify

    async fn CodexAppSession::notify(self : CodexAppSession, rpc_method : String, params? : Json) -> Unit

    Send an arbitrary app-server notification.

    CodexAppSession::plugin_install

    CodexAppSession::plugin_list

    CodexAppSession::plugin_read

    CodexAppSession::plugin_uninstall

    async fn CodexAppSession::plugin_uninstall(self : CodexAppSession, params : AppPluginUninstallParams) -> Unit

    CodexAppSession::request

    async fn CodexAppSession::request(self : CodexAppSession, rpc_method : String, params? : Json) -> Json

    Send an arbitrary app-server request and return its raw JSON result. Prefer a typed session method when one is available.

    CodexAppSession::resume_thread

    async fn CodexAppSession::resume_thread(self : CodexAppSession, params : AppThreadResumeParams, request_handler? : async (AppServerRequest) -> AppServerResponse) -> CodexAppThread

    CodexAppSession::review_start

    CodexAppSession::skills_config_write

    CodexAppSession::skills_list

    async fn CodexAppSession::skills_list(self : CodexAppSession, params? : AppSkillsListParams) -> AppSkillsListResponse

    CodexAppSession::start_thread

    async fn CodexAppSession::start_thread(self : CodexAppSession, params? : AppThreadStartParams, request_handler? : async (AppServerRequest) -> AppServerResponse) -> CodexAppThread

    CodexAppSession::thread_approve_guardian_denied_action

    async fn CodexAppSession::thread_approve_guardian_denied_action(self : CodexAppSession, params : AppThreadApproveGuardianDeniedActionParams) -> Unit

    CodexAppSession::thread_archive

    async fn CodexAppSession::thread_archive(self : CodexAppSession, params : AppThreadIdParams) -> Unit

    CodexAppSession::thread_background_terminals_clean

    async fn CodexAppSession::thread_background_terminals_clean(self : CodexAppSession, params : AppThreadIdParams) -> Unit

    CodexAppSession::thread_compact_start

    async fn CodexAppSession::thread_compact_start(self : CodexAppSession, params : AppThreadIdParams) -> Unit

    CodexAppSession::thread_decrement_elicitation

    CodexAppSession::thread_delete

    async fn CodexAppSession::thread_delete(self : CodexAppSession, params : AppThreadIdParams) -> Unit

    CodexAppSession::thread_fork

    CodexAppSession::thread_goal_clear

    async fn CodexAppSession::thread_goal_clear(self : CodexAppSession, params : AppThreadIdParams) -> AppThreadGoalClearResponse

    CodexAppSession::thread_goal_get

    async fn CodexAppSession::thread_goal_get(self : CodexAppSession, params : AppThreadIdParams) -> AppThreadGoalGetResponse

    CodexAppSession::thread_goal_set

    CodexAppSession::thread_increment_elicitation

    CodexAppSession::thread_inject_items

    async fn CodexAppSession::thread_inject_items(self : CodexAppSession, params : AppThreadInjectItemsParams) -> Unit

    CodexAppSession::thread_list

    async fn CodexAppSession::thread_list(self : CodexAppSession, params? : AppThreadListParams) -> AppThreadListResponse

    CodexAppSession::thread_loaded_list

    CodexAppSession::thread_memory_mode_set

    async fn CodexAppSession::thread_memory_mode_set(self : CodexAppSession, params : AppThreadMemoryModeSetParams) -> Unit

    CodexAppSession::thread_metadata_update

    CodexAppSession::thread_read

    CodexAppSession::thread_realtime_append_audio

    async fn CodexAppSession::thread_realtime_append_audio(self : CodexAppSession, params : AppThreadRealtimeAppendAudioParams) -> Unit

    CodexAppSession::thread_realtime_append_text

    async fn CodexAppSession::thread_realtime_append_text(self : CodexAppSession, params : AppThreadRealtimeAppendTextParams) -> Unit

    CodexAppSession::thread_realtime_list_voices

    async fn CodexAppSession::thread_realtime_list_voices(self : CodexAppSession) -> AppThreadRealtimeListVoicesResponse

    CodexAppSession::thread_realtime_start

    async fn CodexAppSession::thread_realtime_start(self : CodexAppSession, params : AppThreadRealtimeStartParams) -> Unit

    CodexAppSession::thread_realtime_stop

    async fn CodexAppSession::thread_realtime_stop(self : CodexAppSession, params : AppThreadIdParams) -> Unit

    CodexAppSession::thread_resume

    CodexAppSession::thread_rollback

    CodexAppSession::thread_section_create

    async fn CodexAppSession::thread_section_create(self : CodexAppSession, params : AppThreadSectionCreateParams) -> AppThreadSectionResponse

    CodexAppSession::thread_section_delete

    async fn CodexAppSession::thread_section_delete(self : CodexAppSession, params : AppThreadSectionDeleteParams) -> Unit

    CodexAppSession::thread_section_list

    CodexAppSession::thread_section_move

    async fn CodexAppSession::thread_section_move(self : CodexAppSession, params : AppThreadSectionMoveParams) -> Unit

    CodexAppSession::thread_section_update

    async fn CodexAppSession::thread_section_update(self : CodexAppSession, params : AppThreadSectionUpdateParams) -> AppThreadSectionResponse

    CodexAppSession::thread_set_name

    async fn CodexAppSession::thread_set_name(self : CodexAppSession, params : AppThreadSetNameParams) -> Unit

    CodexAppSession::thread_shell_command

    async fn CodexAppSession::thread_shell_command(self : CodexAppSession, params : AppThreadShellCommandParams) -> Unit

    CodexAppSession::thread_start

    async fn CodexAppSession::thread_start(self : CodexAppSession, params? : AppThreadStartParams) -> AppThreadStartResponse

    CodexAppSession::thread_turns_list

    CodexAppSession::thread_unarchive

    async fn CodexAppSession::thread_unarchive(self : CodexAppSession, params : AppThreadIdParams) -> AppThreadReadResponse

    CodexAppSession::thread_unsubscribe

    async fn CodexAppSession::thread_unsubscribe(self : CodexAppSession, params : AppThreadIdParams) -> AppThreadUnsubscribeResponse

    CodexAppSession::turn_interrupt

    async fn CodexAppSession::turn_interrupt(self : CodexAppSession, params : AppTurnInterruptParams) -> Unit

    CodexAppSession::turn_start

    CodexAppSession::turn_steer

    CodexAppSession::windows_sandbox_setup_start

    CodexAppThread

    pub struct CodexAppThread {
    thread : AppThread
    model : String
    model_provider : String
    service_tier : String?
    cwd : String
    instruction_sources : ArrayView[String]
    approval_policy : AppApprovalPolicy
    approvals_reviewer : AppApprovalsReviewer
    sandbox : AppSandboxPolicy
    reasoning_effort : AppReasoningEffort?
    // private fields
    }

    CodexAppThread::id

    fn CodexAppThread::id(self : CodexAppThread) -> String

    CodexAppThread::read

    async fn CodexAppThread::read(self : CodexAppThread, include_turns? : Bool) -> AppThreadReadResponse

    CodexAppThread::run_streamed

    async fn CodexAppThread::run_streamed(self : CodexAppThread, input : Array[AppUserInput], options? : AppTurnStartOptions, request_handler? : async (AppServerRequest) -> AppServerResponse) -> AppTurnStream

    Start a turn on this thread and return a turn-scoped event stream.

    CodexAppThread::set_request_handler

    fn CodexAppThread::set_request_handler(self : CodexAppThread, request_handler? : async (AppServerRequest) -> AppServerResponse) -> Unit

    Set or clear the thread-scoped fallback request handler.

    CodexAppThread::start_turn

    async fn CodexAppThread::start_turn(self : CodexAppThread, input : Array[AppUserInput], options? : AppTurnStartOptions) -> AppTurnStartResponse

    CodexOptions

    type CodexOptions derive(Default)

    Options for configuring the Codex client.

    CodexOptions::new

    fn CodexOptions::new(codex_path_override? : String, base_url? : String, api_key? : String, config? : Map[String, Json], config_overrides? : Array[String], env? : Map[String, String]) -> CodexOptions

    CollabAgentState

    pub struct CollabAgentState {
    status : CollabAgentStatus
    message : String?
    } derive(
    Debug
    )

    CollabAgentStatus

    pub enum CollabAgentStatus {
    PendingInit
    Running
    Interrupted
    Completed
    Errored
    Shutdown
    NotFound
    } derive(
    Debug
    )

    The status of a collab agent.

    CollabTool

    pub enum CollabTool {
    SpawnAgent
    SendInput
    ResumeAgent
    Wait
    CloseAgent
    } derive(
    Debug
    )

    Supported collab tools.
    impl Show for CollabTool

    CollabToolCallStatus

    pub enum CollabToolCallStatus {
    InProgress
    Completed
    Failed
    } derive(
    Debug
    )

    CommandExecutionStatus

    pub enum CommandExecutionStatus {
    InProgress
    Completed
    Failed
    Declined
    } derive(
    Debug
    )

    Event

    pub enum Event {
    ThreadStarted(thread_id~ : String)
    TurnStarted
    TurnCompleted(Usage)
    TurnFailed(ThreadError)
    ItemStarted(ThreadItem)
    ItemUpdated(ThreadItem)
    ItemCompleted(ThreadItem)
    ThreadErrorEvent(String)
    }

    FileUpdateChange

    pub struct FileUpdateChange {
    path : String
    kind : PatchChangeKind
    } derive(ToJson,
    Debug
    ,
    FromJson
    )

    A set of file changes by the agent.

    McpToolCallResult

    pub struct McpToolCallResult {
    content : Array[Json]
    meta : Json?
    structured_content : Json
    } derive(
    Debug
    )

    McpToolCallStatus

    pub enum McpToolCallStatus {
    InProgress
    Completed
    Failed
    } derive(
    Debug
    )

    The status of an MCP tool call.

    ModelReasoningEffort

    pub(all) enum ModelReasoningEffort {
    Minimal
    Low
    Medium
    High
    Xhigh
    Max
    Ultra
    }

    PatchApplyStatus

    pub enum PatchApplyStatus {
    InProgress
    Completed
    Failed
    } derive(
    Debug
    )

    The status of a file change.

    PatchChangeKind

    pub enum PatchChangeKind {
    Add
    Delete
    Update
    } derive(
    Debug
    )

    Indicates the type of the file change.

    SandboxMode

    pub(all) enum SandboxMode {
    ReadOnly
    WorkspaceWrite
    DangerFullAccess
    } derive(
    Debug
    )

    Sandbox mode that controls the level of access the agent has.
    impl Show for SandboxMode

    StreamedTurn

    #alias(RunStreamedResult)
    pub struct StreamedTurn {
    events :
    AsyncGenerator
    [Event]
    }

    The result of the run_streamed method.

    Thread

    type Thread

    Represent a thread of conversation with the agent. One thread can have multiple consecutive turns.

    Thread::id

    fn Thread::id(self : Thread) -> String?

    Returns the ID of the thread. Populated after the first turn starts.

    Thread::run

    async fn Thread::run(self : Thread, prompt : String, extra_input? : Array[UserInput], turn_options? : TurnOptions) -> Turn

    Provides the input to the agent and returns the completed turn.

    Arguments

    • input - The user input/prompt to send to the agent
    • turn_options - Options for configuring this turn

    Returns

    A Turn containing all items, the final response, and usage information

    Thread::run_streamed

    async fn[G] Thread::run_streamed(self : Thread, prompt : String, extra_input? : Array[UserInput], turn_options? : TurnOptions, taskgroup :
    TaskGroup
    [G]) -> StreamedTurn

    Provides the input to the agent and streams events as they are produced during the turn.

    Arguments

    • input - The user input/prompt to send to the agent
    • turn_options - Options for configuring this turn
    • taskgroup - The TaskGroup to run the streaming generator in

    Returns

    A StreamedTurn containing an async iterator of events

    ThreadError

    pub struct ThreadError {
    message : String
    } derive(ToJson,
    FromJson
    )

    ThreadItem

    pub enum ThreadItem {
    AgentMessageItem(id~ : String, text~ : String)
    ReasoningItem(id~ : String, text~ : String)
    CommandExecutionItem(id~ : String, command~ : String, aggregated_output~ : String, exit_code~ : Int?, status~ : CommandExecutionStatus)
    FileChangeItem(id~ : String, changes~ : Array[FileUpdateChange], status~ : PatchApplyStatus)
    McpToolCallItem(id~ : String, server~ : String, tool~ : String, status~ : McpToolCallStatus, arguments~ : Json?, result~ : Result[McpToolCallResult, String]?)
    CollabToolCallItem(id~ : String, tool~ : CollabTool, sender_thread_id~ : String, receiver_thread_ids~ : Array[String], prompt~ : String?, agents_states~ : Map[String, CollabAgentState], status~ : CollabToolCallStatus)
    WebSearchItem(id~ : String, query~ : String)
    TodoListItem(id~ : String, items~ : Array[TodoItem])
    ErrorItem(id~ : String, message~ : String)
    } derive(
    Debug
    )

    ThreadOptions

    type ThreadOptions derive(Default)

    Options for configuring a thread.

    ThreadOptions::new

    fn ThreadOptions::new(model? : String, thread_source? : String, sandbox_mode? : SandboxMode, working_directory? : String, skip_git_repo_check? : Bool, model_reasoning_effort? : ModelReasoningEffort, network_access_enabled? : Bool, web_search_enabled? : Bool, web_search_mode? : WebSearchMode, approval_policy? : ApprovalMode, additional_directories? : Array[String]) -> ThreadOptions

    TodoItem

    pub struct TodoItem {
    text : String
    completed : Bool
    } derive(ToJson,
    Debug
    ,
    FromJson
    )

    An item in the agent's to-do list.
    impl Show for TodoItem

    Turn

    #alias(RunResult)
    pub struct Turn {
    items : Array[ThreadItem]
    final_response : String
    usage : Usage?
    }

    Completed turn.

    TurnOptions

    type TurnOptions derive(Default)

    Options for configuring a turn.

    TurnOptions::new

    fn TurnOptions::new(output_schema? : Json) -> TurnOptions

    Params:
    • output_schema - JSON schema describing the expected agent output

    Usage

    pub struct Usage {
    input_tokens : Int
    cached_input_tokens : Int
    cache_write_input_tokens : Int
    output_tokens : Int
    reasoning_output_tokens : Int
    } derive(
    Debug
    )

    Describes the usage of tokens during a turn.
    impl ToJson for Usage

    UserInput

    pub(all) enum UserInput {
    Text(String)
    LocalImage(path~ : String)
    }

    WebSearchMode

    pub(all) enum WebSearchMode {
    Disabled
    Cached
    Live
    }

    Web search behavior for Codex turns.