Pure native RPC protocol helpers for the Pi ACP adapter.
Owns NDJSON envelope construction, command type names, inbound response classification, and request-id correlation shapes. The root adapter retains process ownership, Port I/O, and lifecycle state.
Summary
Types
@type command() :: String.t()
@type control_entry() :: %{ rpc_id: request_id(), kind: control_kind(), group_id: String.t() }
@type control_kind() :: atom()
@type inbound() :: {:response, request_id(), {:ok, map()}} | {:response, request_id(), {:error, map()}} | {:event, String.t(), map()} | :unknown
@type request_id() :: String.t()
Functions
@spec control_entry(request_id(), control_kind(), String.t()) :: control_entry()
@spec encode_request(request_id(), String.t(), map()) :: String.t()
@spec next_prompt_id(integer()) :: {request_id(), integer()}
@spec prompt_id(integer()) :: request_id()
@spec request(request_id(), String.t(), map()) :: map()
@spec rpc_id(integer()) :: request_id()