PromptCapabilities::none() -> PromptCapabilitiesNothing supported: no images, no audio, no embedded context.
Every public function, type and trait, generated from the sources and their documentation. Three packages: the protocol itself, and the two server transports.
moonacp203 itemsThe protocol, its types, and the contracts on both sides.
PromptCapabilities::none() -> PromptCapabilitiesNothing supported: no images, no audio, no embedded context.
McpCapabilities::none() -> McpCapabilitiesNo MCP transport supported.
SessionCapabilities::none() -> SessionCapabilitiesNo session method beyond session/new.
AgentAuthCapabilities::none() -> AgentAuthCapabilitiesNo authentication step offered.
AgentCapabilities::none() -> AgentCapabilitiesAn agent that supports only session/new and session/prompt.
FileSystemCapabilities::none() -> FileSystemCapabilitiesNo file access granted.
ClientAuthCapabilities::none() -> ClientAuthCapabilitiesNo terminal authentication offered by the client.
ClientSessionCapabilities::none() -> ClientSessionCapabilitiesNo supplementary session features.
ElicitationCapabilities::none() -> ElicitationCapabilitiesNo elicitation kind supported.
ClientCapabilities::none() -> ClientCapabilitiesA client that reads and writes nothing, runs nothing, and answers no ask.
Implementation::new(name : String, version : String) -> ImplementationA name and a version, which is all the protocol asks for.
ConfigCategory::to_string(self : ConfigCategory) -> StringThe name the category travels as.
ConfigCategory::of(name : String) -> ConfigCategoryThe category with that name; unknown names are kept as they came.
connect(client : &Client, frames : &@peer.Frames) -> ConnWires a client to a transport. The caller runs the returned connection, which is what delivers updates and answers the agent's calls.
Conn::run(self : Conn) -> UnitTakes messages in until the other side goes away. Updates reach the client from here, so it has to run in a task of its own while the other tasks call the agent.
Conn::call( self : Conn, name : String, params : Json, ) -> Json raise RefusedA call the protocol does not name: send it raw and read the answer raw.
Conn::notify( self : Conn, name : String, params : Json, ) -> Unit raise RefusedA notice the protocol does not name.
Conn::initialize( self : Conn, request : Initialize, ) -> Initialized raise RefusedNegotiates the version and trades capabilities. Call it once, before anything else.
Conn::authenticate( self : Conn, request : Authenticate, ) -> Unit raise RefusedRuns one of the agent's authentication methods.
Conn::logout(self : Conn) -> Unit raise RefusedDrops whatever authenticate established.
Conn::new_session( self : Conn, request : NewSession, ) -> SessionStarted raise RefusedStarts a session and returns what the agent says about it: identifier, modes, options.
Conn::load_session( self : Conn, request : LoadSession, ) -> SessionStarted raise RefusedReopens a session; the updates that replay its history arrive on run.
Conn::resume_session( self : Conn, request : ResumeSession, ) -> SessionStarted raise RefusedReattaches to a live session without replaying anything.
Conn::list_sessions( self : Conn, request : ListSessions, ) -> SessionList raise RefusedThe sessions the agent remembers, one page at a time.
Conn::delete_session( self : Conn, request : DeleteSession, ) -> Unit raise RefusedForgets a session.
Conn::close_session( self : Conn, request : CloseSession, ) -> Unit raise RefusedEnds a running session, as if session/cancel had been sent.
Conn::set_mode( self : Conn, request : SetMode, ) -> Unit raise RefusedSwitches the session's mode.
Conn::set_config_option( self : Conn, request : SetConfigOption, ) -> Array[ConfigOption] raise RefusedSets one configuration option and returns the whole list, as the protocol requires.
Conn::prompt( self : Conn, request : Prompt, ) -> PromptResult raise RefusedSends one turn and waits for its answer. Updates arrive through the client's update while this
waits, because the connection is being run in another task.
Conn::cancel( self : Conn, session_id : String, ) -> Unit raise RefusedAsks the agent to stop the turn running in a session. A notice: nothing comes back, and the turn
answers Cancelled on its own.
Conn::client(self : Conn) -> &ClientThe client this connection feeds.
Role::to_string(self : Role) -> StringThe name the role travels as.
Role::of(name : String) -> Role?The role with that name, or None.
TerminalRef::new(terminal_id : String) -> TerminalRefA reference to a terminal, as a tool call embeds it.
StringFormat::to_string(self : StringFormat) -> StringThe name the format travels as.
StringFormat::of(name : String) -> StringFormat?The format with that name, or None.
parse_error: Int32 = -32700The text is not JSON.
invalid_request: Int32 = -32600The value is not a valid message.
method_not_found: Int32 = -32601Nobody handles that method.
invalid_params: Int32 = -32602The parameters are not what the method takes.
internal_error: Int32 = -32603The handler failed for its own reasons.
request_cancelled: Int32 = -32800The caller asked for the work to stop.
authentication_required: Int32 = -32000The client has to authenticate before this method works.
resource_not_found: Int32 = -32002A path, a session or a resource named in the request does not exist.
Refused::new(code : Int32, message : String, data? : Json) -> RefusedAn error object with a code of your choosing.
Refused::code(self : Refused) -> Int32The code this failure travels as.
Refused::message(self : Refused) -> StringWhat the other side reads.
Refused::data(self : Refused) -> Json?Anything else attached to the failure.
Refused::failure(self : Refused) -> @moonjrpc.FailureThe wire form of a failure.
failure_of(error : Error) -> @moonjrpc.FailureTurns anything a handler raised into the error object to send: the wire code is kept, and
anything that is not a Refused becomes -32603 with no detail, because what a handler trips
over is not the caller's to read.
refused_of(failure : @moonjrpc.Failure) -> RefusedThe reverse, for a call that came back with an error object.
protocol_version: Int32 = 1The protocol version this library speaks. It only changes when the protocol breaks.
Initialized::new() -> InitializedA first answer for an agent that supports nothing beyond session/new: the version, no
capabilities, no authentication.
StopReason::to_string(self : StopReason) -> StringThe name the reason travels as.
StopReason::of(name : String) -> StopReason?The reason with that name, or None.
serve(agent : &Agent, frames : &@peer.Frames) -> @peer.PeerServes an agent over any transport: the caller runs the returned peer. Messages are answered in the order they arrive, and batches are refused, because the protocol has none.
Session::id(self : Session) -> StringThe session's identifier, the one the client sent with session/new.
Session::update( self : Session, update : SessionUpdate, ) -> Unit raise RefusedSends one update. Updates are notifications, so they are never answered and never fail the turn
by themselves; the connection going away raises Closed.
Session::request_permission( self : Session, ask : Permission, ) -> Outcome raise RefusedAsks the user to allow a tool call. The client answers with the option it picked, or Cancelled
when the prompt was dismissed; a client that never answers blocks the turn, so keep the ask in
the turn's own task.
Session::read_text_file( self : Session, path : String, line? : Int64, limit? : Int64, ) -> String raise RefusedReads a text file through the client, sliced from line when one is given.
Session::write_text_file( self : Session, path : String, content : String, ) -> Unit raise RefusedWrites a text file through the client.
Session::terminal( self : Session, command : String, args? : Array[String], env? : Array[EnvVariable], cwd? : String, output_byte_limit? : Int64, ) -> Terminal raise RefusedRuns a command in a terminal the client owns. The returned handle reads, waits for, kills and releases it.
Session::elicit( self : Session, ask : Elicitation, ) -> Answer raise RefusedAsks the user for a few fields or for a visit to a URL. The ask is scoped to this session, and to the tool call it came from when one is given.
Terminal::id(self : Terminal) -> StringThe identifier the client gave this terminal.
Terminal::output(self : Terminal) -> TerminalOutput raise RefusedEverything the command has printed so far.
Terminal::wait(self : Terminal) -> ExitStatus raise RefusedWaits for the command to exit and reports how it did.
Terminal::kill(self : Terminal) -> Unit raise RefusedStops the command without giving the terminal back.
Terminal::release(self : Terminal) -> Unit raise RefusedGives the terminal back. The client may reuse it for the next command.
Terminal::reference(self : Terminal) -> TerminalRefThe terminal as a tool call refers to it, for ToolCallContent.
PlanEntryPriority::to_string(self : PlanEntryPriority) -> StringThe name the priority travels as.
PlanEntryPriority::of(name : String) -> PlanEntryPriority?The priority with that name, or None.
PlanEntryStatus::to_string(self : PlanEntryStatus) -> StringThe name the status travels as.
PlanEntryStatus::of(name : String) -> PlanEntryStatus?The status with that name, or None.
Severity::to_string(self : Severity) -> StringThe name the severity travels as.
Severity::of(name : String) -> SeverityThe severity with that name; unknown names are kept as they came.
CompactionStatus::to_string(self : CompactionStatus) -> StringThe name the state travels as.
CompactionStatus::of(name : String) -> CompactionStatusThe state with that name; unknown names are kept as they came.
ToolKind::to_string(self : ToolKind) -> StringThe name the kind travels as.
ToolKind::of(name : String) -> ToolKind?The kind with that name, or None.
ToolCallStatus::to_string(self : ToolCallStatus) -> StringThe name the status travels as.
ToolCallStatus::of(name : String) -> ToolCallStatus?The status with that name, or None.
PermissionOptionKind::to_string(self : PermissionOptionKind) -> StringThe name the option kind travels as.
PermissionOptionKind::of(name : String) -> PermissionOptionKind?The option kind with that name, or None.
RefusedWhat a handler raises, and what the other side's error object becomes when a call fails. A
variant's code is the JSON-RPC code it travels as: Refused(code~, ..) carries the wire code
itself, Unsupported is -32601, Malformed is -32602.
PromptCapabilitiesContent kinds the agent accepts inside a prompt.
McpCapabilitiesMCP transports the agent can connect to.
SessionCapabilitiesSession methods beyond session/new. Each flag is a promise to answer that method.
AgentAuthCapabilitiesAuthentication the agent offers.
AgentCapabilitiesEverything the agent says it can do, sent back from initialize.
FileSystemCapabilitiesFiles the client lets the agent read and write on its behalf.
ClientAuthCapabilitiesWhether the client runs terminal commands for the agent.
ClientSessionCapabilitiesThe client's support for supplementary session features.
ElicitationCapabilitiesElicitation kinds the client can show.
ClientCapabilitiesEverything the client says it can do, sent with initialize.
ImplementationA name and version, for the log and the about box.
AuthMethodAn authentication method the agent offers, one of two shapes tagged by type on the wire; the
agent-driven one carries no tag.
AuthMethodTerminalThe client runs a command to authenticate.
AuthMethodAgentThe agent runs the flow itself once authenticate is called.
ReadTextFileA text file to read.
FileTextWhat a read returns.
WriteTextFileA text file to write, whole.
TerminalCommandA command to run in a new terminal.
TerminalOpenedThe identifier of the terminal the client opened.
TerminalRequestNames an existing terminal, for terminal/output, terminal/wait_for_exit, terminal/kill and
terminal/release.
ExitStatusHow a command ended.
TerminalOutputWhat a terminal has printed so far, and whether it has exited.
SessionModeOne mode the agent can work in.
SessionModesThe modes on offer and the one in force.
ConfigCategoryWhat a configuration option is about, so a client can place it. Unknown categories are kept.
ConfigChoiceOne value of a dropdown.
ConfigGroupChoices under a heading.
ConfigChoicesThe choices of a dropdown, flat or grouped. The two are told apart by whether the first entry
carries group.
ConfigValueWhat a configuration option holds: a picked value or a switch.
ConfigOptionOne entry of the session configuration picker.
SessionStartedWhat session/new and its siblings answer with.
SetConfigOptionsThe whole option list after one of them changed.
ConnA connection to an agent, from the editor's side. run takes messages in; the methods here send
them out and wait for their answers.
RoleWho a piece of content is for.
AnnotationsHints for how a client shows a piece of content.
TextContentText the model reads or writes.
ImageContentAn image, base64 in data.
AudioContentAudio, base64 in data.
ResourceLinkA resource the client can read, named by URI rather than by value.
TextResourceResource contents carried as text.
BlobResourceResource contents carried as base64 in blob.
ResourceEither kind of embedded resource contents, told apart by text against blob.
EmbeddedResourceA resource carried by value inside a message.
ContentBlockOne displayable piece of a prompt or of a tool's output, tagged by type on the wire.
ContentA standard content block wrapped for a tool call's output.
DiffA file edit, given as the whole file before and after.
TerminalRefA reference to a terminal the client opened, embedded in a tool call.
ToolCallContentWhat a tool call produced, tagged by type on the wire.
ToolCallLocationA place in the workspace a tool touched.
StringFormatA string field's format hint.
EnumOptionOne titled choice of a string field.
TextFieldA field the user types into.
NumberFieldA field for a fractional number.
IntegerFieldA field for a whole number.
BooleanFieldA field for yes or no.
ChoiceItemsWhat a multi-select offers: bare values or titled ones.
MultiSelectFieldA field for picking several of a set.
FieldOne field of a form, tagged by type on the wire. A kind the protocol does not define yet is
kept as it came so a client can still show it.
ElicitationSchemaThe form to render.
ElicitScopeWhich request an elicitation belongs to: a session's turn, or a bare JSON-RPC request.
FormRequestA form for the user to fill in.
UrlRequestA link the user follows.
ElicitationAn ask, tagged by mode on the wire.
AnswerWhat the user did with the ask. content holds one value per field, of whatever type the field
asked for, so it stays raw.
HttpHeaderOne header sent to an MCP server.
EnvVariableOne environment variable for a spawned MCP server.
McpHttpAn MCP server reached over HTTP.
McpSseAn MCP server reached over the older HTTP plus SSE transport.
McpStdioAn MCP server the client is to launch as a child process.
McpServerAn MCP server a session may use. The wire tells the two HTTP shapes apart by type; the stdio
shape carries no tag at all.
InitializeOpens the conversation: versions and capabilities, once per connection.
InitializedThe answer to initialize.
AuthenticateNames one of the methods from initialize.
NewSessionStarts a conversation. The working directory is where the agent reads and writes.
LoadSessionReopens a session and replays its history as updates.
ResumeSessionReattaches to a session without replaying its history.
ListSessionsAsks for the sessions the agent remembers.
SessionInfoOne row of session/list.
SessionListThe page of sessions, and the cursor for the next one.
DeleteSessionRemoves a session from what session/list returns.
CloseSessionEnds a session that is still running.
SetModePicks a mode.
ConfigValueIdSets a configuration option. The wire has two shapes, a value id or a boolean, told apart by
type.
SetConfigOptionSets one configuration option.
PromptOne turn of the conversation.
StopReasonWhy the agent stopped.
PromptResultThe answer to a prompt: why the turn ended.
CancelStops whatever turn is running in a session. A notification, so it is never answered.
SessionOne session, as the agent sees it inside prompt. Everything here is a call to the client:
updates, permission, files, terminals, elicitation.
TerminalA command running in a terminal the client owns. Holding one is not owning a process: release
hands the terminal back, and the exit status is only known after wait.
ContentChunkOne streamed item of content.
PlanEntryPriorityHow urgent a plan entry is.
PlanEntryStatusHow far a plan entry got.
PlanEntryOne step of the agent's plan.
PlanThe whole plan, replacing whatever came before.
CommandInputThe text typed after a command's name, offered to the user as a hint.
AvailableCommandA slash command the user may type.
AvailableCommandsThe command list, replacing whatever came before.
ModeChangedThe session's mode changed.
SessionInfoChangedThe session's metadata changed; only the fields that changed are present.
CostWhat the turn cost, in whatever currency the agent bills in.
UsageHow much of the context window the conversation fills.
SeverityHow loud a notice is. Unknown severities are kept as they came.
NoticeSomething to tell the user that is not part of the conversation.
CompactionStatusWhere a context compaction got to. Unknown states are kept as they came.
CompactionA compaction, created the first time its identifier is seen and updated after that.
CompactionSummaryOne more block of a compaction's retained summary.
SessionUpdateEverything the agent may tell the client mid-turn, tagged by sessionUpdate on the wire.
SessionNotificationOne update as it travels: the session it belongs to and the update itself.
ToolKindWhat kind of thing a tool does, for a client that wants to pick an icon.
ToolCallStatusHow far a tool call got.
ToolCallA tool call the model has asked for.
ToolCallUpdateA later change to a tool call: only what changed is present.
PermissionOptionKindWhat choosing an option means, so a client can group the buttons.
PermissionOptionOne button in a permission prompt.
PermissionThe ask the agent makes: run this tool call, and here is what the user may choose.
OutcomeWhat came back: one option chosen, or the ask dismissed.
(open) trait AgentThe agent side. Implement what the agent can do and leave the rest: initialize and
new_session and prompt are the three every agent has, the others have defaults that report
themselves as unsupported.
(open) trait ClientThe client side. update is the only method the protocol requires; the rest exist so the agent
can ask for them, and a client that leaves one out answers -32601 when the agent asks.
moonacp/stdio5 itemsServing an agent on the process's own streams.
serve_stdio(agent : &@moonacp.Agent) -> UnitRuns an agent on the process's own stdin and stdout until the client closes stdin. This is the transport an editor uses when it launches an agent: one JSON-RPC message per line, nothing else on stdout, diagnostics on stderr.
spawn( client : &@moonacp.Client, command : Array[String], args? : Array[String], env? : Map[String, String], cwd? : StringView, ) -> ChildStarts command with args and connects to it as a client. The command is an absolute path or
something the system can find on PATH; the first array element is the program.
Child::conn(self : Child) -> @moonacp.ConnThe connection to the child, runnable and callable.
Child::close(self : Child) -> UnitCloses the child's input, which is how an agent learns the client is done: it finishes what it
is doing and exits. The read side ends with it, so a task blocked on run comes back.
ChildA child process speaking the protocol on its pipes.
moonacp/asgi3 itemsServing an agent over HTTP streams and a WebSocket.
to_asgi( agent : &@moonacp.Agent, path~ : String = "/acp", hosts? : Array[String], limits~ : Limits = limits, ) -> @moonasgi.AsgiAppServes an agent over ASGI: one path, four verbs, and a WebSocket upgrade. Nothing is global, so several agents can be mounted side by side.
limits: Limits =The defaults: 1 MiB bodies, 256 buffered messages per stream, a keepalive every 15 seconds, and
half a minute for initialize.
LimitsThe transport's bounds.