App-server transport for stateful, bidirectional communication with Codex.
Summary
Types
Options for launching and initializing a managed codex app-server child process.
Functions
Lists available apps/connectors.
Lists collaboration mode presets (experimental).
Writes bytes to a running command/exec session.
Backwards-compatible alias for command_exec_write/3 using raw stdin text.
Reads config requirements enforced by the server (if any).
Starts a supervised codex app-server subprocess and completes the initialize handshake.
Connects to a remote websocket-backed app-server endpoint and completes the
initialize handshake.
Copies a file or directory via the app-server filesystem API.
Creates a directory via the app-server filesystem API.
Fetches file or directory metadata via the app-server filesystem API.
Lists directory entries via the app-server filesystem API.
Reads a file via the app-server filesystem API, returning a base64 payload.
Removes a file or directory via the app-server filesystem API.
Writes base64-encoded file contents via the app-server filesystem API.
Installs a plugin via the app-server plugin API and returns the raw response map.
Installs a plugin via the app-server plugin API and parses the response into
Codex.Protocol.Plugin.InstallResponse.
Lists plugin marketplaces via the app-server plugin API and returns the raw response map.
Lists plugin marketplaces via the app-server plugin API and parses the response
into Codex.Protocol.Plugin.ListResponse.
Reads plugin details from a marketplace entry via the app-server plugin API and returns the raw response map.
Reads plugin details from a marketplace entry via the app-server plugin API
and parses the response into Codex.Protocol.Plugin.ReadResponse.
Uninstalls a plugin via the app-server plugin API and returns the raw response map.
Uninstalls a plugin via the app-server plugin API and parses the response into
Codex.Protocol.Plugin.UninstallResponse.
Sends an app-server request and parses the response with a typed response module.
Writes a skills config entry enabling or disabling a skill by path.
Starts server-side context compaction for a thread.
Explicit alias for thread_compact/2.
Runs a thread-bound shell command via the app-server ! workflow.
Types
@type connect_opts() :: [ init_timeout_ms: pos_integer(), client_name: String.t(), client_title: String.t(), client_version: String.t(), experimental_api: boolean(), execution_surface: CliSubprocessCore.ExecutionSurface.t() | map() | keyword(), cwd: String.t(), process_env: map() | keyword(), env: map() | keyword(), oauth: keyword() ]
Options for launching and initializing a managed codex app-server child process.
cwd and process_env / env apply to the child process itself. Per-thread working
directories still belong on thread/start, thread/resume, or Codex.Thread.Options.
@type connect_remote_opts() :: [ init_timeout_ms: pos_integer(), client_name: String.t(), client_title: String.t(), client_version: String.t(), experimental_api: boolean(), auth_token: String.t(), auth_token_env: String.t(), cwd: String.t(), process_env: map() | keyword(), env: map() | keyword(), oauth: keyword() ]
@type connection() :: pid()
Functions
@spec alive?(connection()) :: boolean()
@spec apps_list( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
Lists available apps/connectors.
@spec collaboration_mode_list(connection()) :: {:ok, map()} | {:error, term()}
Lists collaboration mode presets (experimental).
@spec command_exec(connection(), [String.t()], keyword()) :: {:ok, map()} | {:error, term()}
@spec command_exec_terminate(connection(), String.t()) :: {:ok, map()} | {:error, term()}
@spec command_exec_write(connection(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Writes bytes to a running command/exec session.
@spec command_write_stdin(connection(), String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Backwards-compatible alias for command_exec_write/3 using raw stdin text.
@spec config_batch_write(connection(), [map()], keyword()) :: {:ok, map()} | {:error, term()}
@spec config_read( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
@spec config_requirements(connection()) :: {:ok, map()} | {:error, term()}
Reads config requirements enforced by the server (if any).
@spec connect(Codex.Options.t(), connect_opts()) :: {:ok, connection()} | {:error, term()}
Starts a supervised codex app-server subprocess and completes the initialize handshake.
Use cwd and process_env (or the env alias) when the app-server child must run with an
isolated working directory or CODEX_HOME without mutating the caller's shell environment.
@spec connect_remote(String.t(), connect_remote_opts()) :: {:ok, connection()} | {:error, term()}
Connects to a remote websocket-backed app-server endpoint and completes the
initialize handshake.
@spec disconnect(connection()) :: :ok
@spec experimental_feature_enablement_set(connection(), map() | keyword()) :: {:ok, map()} | {:error, term()}
@spec experimental_feature_list( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
@spec external_agent_config_detect( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
@spec external_agent_config_import(connection(), [map()]) :: {:ok, map()} | {:error, term()}
@spec feedback_upload( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
Copies a file or directory via the app-server filesystem API.
@spec fs_create_directory(connection(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Creates a directory via the app-server filesystem API.
@spec fs_get_metadata(connection(), String.t()) :: {:ok, map()} | {:error, term()}
Fetches file or directory metadata via the app-server filesystem API.
@spec fs_read_directory(connection(), String.t()) :: {:ok, map()} | {:error, term()}
Lists directory entries via the app-server filesystem API.
@spec fs_read_file(connection(), String.t()) :: {:ok, map()} | {:error, term()}
Reads a file via the app-server filesystem API, returning a base64 payload.
@spec fs_remove(connection(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Removes a file or directory via the app-server filesystem API.
@spec fs_write_file(connection(), String.t(), String.t()) :: {:ok, map()} | {:error, term()}
Writes base64-encoded file contents via the app-server filesystem API.
@spec fuzzy_file_search(connection(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
@spec fuzzy_file_search_session_start(connection(), String.t(), [String.t()]) :: {:ok, map()} | {:error, term()}
@spec fuzzy_file_search_session_stop(connection(), String.t()) :: {:ok, map()} | {:error, term()}
@spec fuzzy_file_search_session_update(connection(), String.t(), String.t()) :: {:ok, map()} | {:error, term()}
@spec model_list( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
@spec plugin_install(connection(), String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Installs a plugin via the app-server plugin API and returns the raw response map.
For typed structs, use plugin_install_typed/4.
@spec plugin_install_typed(connection(), String.t(), String.t(), keyword()) :: {:ok, Codex.Protocol.Plugin.InstallResponse.t()} | {:error, term()}
Installs a plugin via the app-server plugin API and parses the response into
Codex.Protocol.Plugin.InstallResponse.
The raw plugin_install/4 wrapper remains available and still returns the
original map payload.
@spec plugin_list( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
Lists plugin marketplaces via the app-server plugin API and returns the raw response map.
For typed structs, use plugin_list_typed/2.
@spec plugin_list_typed( connection(), keyword() ) :: {:ok, Codex.Protocol.Plugin.ListResponse.t()} | {:error, term()}
Lists plugin marketplaces via the app-server plugin API and parses the response
into Codex.Protocol.Plugin.ListResponse.
The raw plugin_list/2 wrapper remains available and still returns the
original map payload.
@spec plugin_read(connection(), String.t(), String.t()) :: {:ok, map()} | {:error, term()}
Reads plugin details from a marketplace entry via the app-server plugin API and returns the raw response map.
For typed structs, use plugin_read_typed/3.
@spec plugin_read_typed(connection(), String.t(), String.t()) :: {:ok, Codex.Protocol.Plugin.ReadResponse.t()} | {:error, term()}
Reads plugin details from a marketplace entry via the app-server plugin API
and parses the response into Codex.Protocol.Plugin.ReadResponse.
The raw plugin_read/3 wrapper remains available and still returns the
original map payload.
@spec plugin_uninstall(connection(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Uninstalls a plugin via the app-server plugin API and returns the raw response map.
For typed structs, use plugin_uninstall_typed/3.
@spec plugin_uninstall_typed(connection(), String.t(), keyword()) :: {:ok, Codex.Protocol.Plugin.UninstallResponse.t()} | {:error, term()}
Uninstalls a plugin via the app-server plugin API and parses the response into
Codex.Protocol.Plugin.UninstallResponse.
The raw plugin_uninstall/3 wrapper remains available and still returns the
original map payload.
@spec request_typed( connection(), String.t(), map() | keyword() | struct() | nil, module(), keyword() ) :: {:ok, struct()} | {:error, term()}
Sends an app-server request and parses the response with a typed response module.
When params is a typed params struct, the struct module's to_map/1 is used
for wire encoding. For the typed plugin APIs, plain maps and keywords are
normalized through the matching Codex.Protocol.Plugin.*Params module before
the request is sent.
@spec respond(connection(), String.t() | integer(), map()) :: :ok | {:error, term()}
@spec skills_config_write(connection(), String.t(), boolean()) :: {:ok, map()} | {:error, term()}
Writes a skills config entry enabling or disabling a skill by path.
@spec skills_list( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
@spec skills_remote_export(connection(), String.t()) :: {:ok, map()} | {:error, term()}
@spec skills_remote_list( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
@spec subscribe( connection(), keyword() ) :: :ok | {:error, term()}
@spec thread_archive(connection(), String.t()) :: :ok | {:error, term()}
@spec thread_compact(connection(), String.t()) :: {:ok, map()} | {:error, term()}
Starts server-side context compaction for a thread.
@spec thread_compact_start(connection(), String.t()) :: {:ok, map()} | {:error, term()}
Explicit alias for thread_compact/2.
@spec thread_list( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
@spec thread_loaded_list( connection(), keyword() ) :: {:ok, map()} | {:error, term()}
@spec thread_name_set(connection(), String.t(), String.t()) :: {:ok, map()} | {:error, term()}
@spec thread_read(connection(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
@spec thread_realtime_append_text(connection(), String.t(), String.t()) :: {:ok, map()} | {:error, term()}
@spec thread_realtime_stop(connection(), String.t()) :: {:ok, map()} | {:error, term()}
@spec thread_rollback(connection(), String.t(), pos_integer()) :: {:ok, map()} | {:error, term()}
@spec thread_shell_command(connection(), String.t(), String.t()) :: {:ok, map()} | {:error, term()}
Runs a thread-bound shell command via the app-server ! workflow.
@spec thread_start(connection(), map() | keyword()) :: {:ok, map()} | {:error, term()}
@spec thread_unarchive(connection(), String.t()) :: {:ok, map()} | {:error, term()}
@spec thread_unsubscribe(connection(), String.t()) :: {:ok, map()} | {:error, term()}
@spec turn_interrupt(connection(), String.t(), String.t()) :: :ok | {:error, term()}
@spec unsubscribe(connection()) :: :ok