ExMCP.ACP.Adapters.Codex.Protocol (ex_mcp v1.3.0)

Copy Markdown View Source

Pure native app-server protocol helpers for the Codex ACP adapter.

Owns envelope construction, method names, inbound response classification, and pending-request correlation shapes. The root adapter retains process ownership, Port I/O, and lifecycle state.

Summary

Types

inbound()

@type inbound() ::
  {:response, request_id(), {:ok, term()}}
  | {:response, request_id(), {:error, term()}}
  | {:request, request_id(), String.t(), map()}
  | {:notification, String.t(), map()}
  | :unknown

request_entry()

@type request_entry() :: %{type: request_type(), acp_id: term(), meta: map()}

request_id()

@type request_id() :: integer() | String.t()

request_type()

@type request_type() :: atom()

Functions

classify_inbound(arg1)

@spec classify_inbound(map()) :: inbound()

decode_line(line)

@spec decode_line(String.t()) :: inbound()

encode_error(id, code, message)

@spec encode_error(request_id(), integer(), String.t()) :: iodata()

encode_notification(method, params \\ nil)

@spec encode_notification(String.t(), map() | nil) :: iodata()

encode_request(id, method, params)

@spec encode_request(request_id(), String.t(), map() | nil) :: iodata()

encode_response(id, result)

@spec encode_response(request_id(), term()) :: iodata()

error(id, code, message)

@spec error(request_id(), integer(), String.t()) :: map()

line(message)

@spec line(map()) :: iodata()

method(name)

@spec method(atom()) :: String.t()

methods()

@spec methods() :: %{required(atom()) => String.t()}

next_id(id)

@spec next_id(integer()) :: {integer(), integer()}

notification(method, params \\ nil)

@spec notification(String.t(), map() | nil) :: map()

request(id, method, params)

@spec request(request_id(), String.t(), map() | nil) :: map()

request_entry(type, acp_id, meta \\ %{})

@spec request_entry(request_type(), term(), map()) :: request_entry()

response(id, result)

@spec response(request_id(), term()) :: map()