Codex.AppServer (Codex SDK v0.7.2)

Copy Markdown View Source

App-server transport for stateful, bidirectional communication with Codex.

Summary

Functions

Lists available apps/connectors.

Lists collaboration mode presets (experimental).

Writes stdin to a running command execution session.

Reads config requirements enforced by the server (if any).

Writes a skills config entry enabling or disabling a skill by path.

Returns an unsupported error. The thread/compact API was removed in upstream codex app-server. Context compaction now happens automatically server-side.

Types

connect_opts()

@type connect_opts() :: [
  init_timeout_ms: pos_integer(),
  client_name: String.t(),
  client_title: String.t(),
  client_version: String.t()
]

connection()

@type connection() :: pid()

Functions

alive?(conn)

@spec alive?(connection()) :: boolean()

apps_list(conn, opts \\ [])

@spec apps_list(
  connection(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Lists available apps/connectors.

collaboration_mode_list(conn)

@spec collaboration_mode_list(connection()) :: {:ok, map()} | {:error, term()}

Lists collaboration mode presets (experimental).

command_exec(conn, command, opts \\ [])

@spec command_exec(connection(), [String.t()], keyword()) ::
  {:ok, map()} | {:error, term()}

command_write_stdin(conn, process_id, stdin, opts \\ [])

@spec command_write_stdin(connection(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Writes stdin to a running command execution session.

config_batch_write(conn, edits, opts \\ [])

@spec config_batch_write(connection(), [map()], keyword()) ::
  {:ok, map()} | {:error, term()}

config_read(conn, opts \\ [])

@spec config_read(
  connection(),
  keyword()
) :: {:ok, map()} | {:error, term()}

config_requirements(conn)

@spec config_requirements(connection()) :: {:ok, map()} | {:error, term()}

Reads config requirements enforced by the server (if any).

config_write(conn, key_path, value, opts \\ [])

@spec config_write(connection(), String.t(), term(), keyword()) ::
  {:ok, map()} | {:error, term()}

connect(codex_opts, opts \\ [])

@spec connect(Codex.Options.t(), connect_opts()) ::
  {:ok, connection()} | {:error, term()}

disconnect(conn)

@spec disconnect(connection()) :: :ok

feedback_upload(conn, opts)

@spec feedback_upload(
  connection(),
  keyword()
) :: {:ok, map()} | {:error, term()}

fuzzy_file_search(conn, query, opts \\ [])

@spec fuzzy_file_search(connection(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

model_list(conn, opts \\ [])

@spec model_list(
  connection(),
  keyword()
) :: {:ok, map()} | {:error, term()}

respond(conn, id, result)

@spec respond(connection(), String.t() | integer(), map()) :: :ok | {:error, term()}

review_start(conn, thread_id, target, opts \\ [])

@spec review_start(connection(), String.t(), term(), keyword()) ::
  {:ok, map()} | {:error, term()}

skills_config_write(conn, path, enabled)

@spec skills_config_write(connection(), String.t(), boolean()) ::
  {:ok, map()} | {:error, term()}

Writes a skills config entry enabling or disabling a skill by path.

skills_list(conn, opts \\ [])

@spec skills_list(
  connection(),
  keyword()
) :: {:ok, map()} | {:error, term()}

subscribe(conn, opts \\ [])

@spec subscribe(
  connection(),
  keyword()
) :: :ok | {:error, term()}

thread_archive(conn, thread_id)

@spec thread_archive(connection(), String.t()) :: :ok | {:error, term()}

thread_compact(conn, thread_id)

This function is deprecated. thread/compact API removed upstream; compaction is now automatic.
@spec thread_compact(connection(), String.t()) :: {:error, {:unsupported, String.t()}}

Returns an unsupported error. The thread/compact API was removed in upstream codex app-server. Context compaction now happens automatically server-side.

Deprecation Notice

This function is retained for API compatibility but will always return an error. Remove calls to this function from your code.

thread_fork(conn, thread_id, params \\ %{})

@spec thread_fork(connection(), String.t(), map() | keyword()) ::
  {:ok, map()} | {:error, term()}

thread_list(conn, opts \\ [])

@spec thread_list(
  connection(),
  keyword()
) :: {:ok, map()} | {:error, term()}

thread_loaded_list(conn, opts \\ [])

@spec thread_loaded_list(
  connection(),
  keyword()
) :: {:ok, map()} | {:error, term()}

thread_read(conn, thread_id, opts \\ [])

@spec thread_read(connection(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

thread_resume(conn, thread_id, params \\ %{})

@spec thread_resume(connection(), String.t(), map() | keyword()) ::
  {:ok, map()} | {:error, term()}

thread_rollback(conn, thread_id, num_turns)

@spec thread_rollback(connection(), String.t(), pos_integer()) ::
  {:ok, map()} | {:error, term()}

thread_start(conn, params \\ %{})

@spec thread_start(connection(), map() | keyword()) :: {:ok, map()} | {:error, term()}

turn_interrupt(conn, thread_id, turn_id)

@spec turn_interrupt(connection(), String.t(), String.t()) :: :ok | {:error, term()}

turn_start(conn, thread_id, input, opts \\ [])

@spec turn_start(connection(), String.t(), String.t() | [map()], keyword()) ::
  {:ok, map()} | {:error, term()}

unsubscribe(conn)

@spec unsubscribe(connection()) :: :ok