Skip to main content

Module session

Module session 

Source
Expand description

domain::acp::session — the session lifecycle request / response types.

Source of truth: crates/protocol-droid-schema/spec/acp/v1.25.0/schema.json under $defs.NewSessionRequest, $defs.LoadSessionRequest, $defs.ListSessionsRequest, $defs.DeleteSessionRequest, $defs.ResumeSessionRequest, $defs.CloseSessionRequest, $defs.PromptRequest, $defs.CancelNotification, $defs.LogoutRequest, and the matching *Response types.

§What this module ships

The 9 agent-side methods the v1.25.0 meta.json lists (13 agent methods total — the 4 session/set_* and authenticate methods are intentionally deferred to keep this commit’s surface focused) plus the CancelNotification and the auxiliary value objects the request / response bodies share: SessionId, StopReason, McpServer (and its three variants), EnvVariable, HttpHeader, and SessionInfo.

§Why request / response types in the same module

The schema pairs each request with its response; a module-per-type layout would scatter the round-trip across files. The application::acp dispatcher will route by method name and pair the request with its response in one place, so the consumer sees a single import.

§Why a single SessionId newtype

Every session-scoped request carries sessionId. A String would compile, but a SessionId makes the API self-documenting (fn load(req: LoadSessionRequest) vs fn load(req: LoadSessionRequest, id: &str)) and lets the future per-revision codec narrow the type (a hypothetical SessionId::Uuid variant) without rewriting every call site.

Structs§

CancelNotification
session/cancel notification. Cancels the in-flight prompt. A notification has no response; the consumer does not await a reply.
CloseSessionRequest
session/close request. Closes an active session without deleting it.
CloseSessionResponse
session/close response. Currently empty; the struct exists so a future field the schema adds does not break the consumer.
DeleteSessionRequest
session/delete request. Removes a session from the agent’s store.
DeleteSessionResponse
session/delete response. Currently empty; the struct exists so a future field the schema adds does not break the consumer.
EnvVariable
An environment variable to set on a launched process. The schema’s EnvVariable is just a (name, value) pair.
HttpHeader
An HTTP header to set when making requests to a remote MCP server. The schema’s HttpHeader is just a (name, value) pair.
ListSessionsRequest
session/list request. Enumerates sessions.
ListSessionsResponse
session/list response. A page of sessions plus the cursor for the next page.
LoadSessionRequest
session/load request. Loads an existing session.
LoadSessionResponse
session/load response.
LogoutRequest
logout request. Terminates the auth session.
LogoutResponse
logout response. Currently empty; the struct exists so a future field the schema adds does not break the consumer.
McpServerHttp
HTTP transport configuration for MCP.
McpServerSse
SSE transport configuration for MCP.
McpServerStdio
Stdio transport configuration for MCP. All agents MUST support this transport.
NewSessionRequest
session/new request. Creates a new session.
NewSessionResponse
session/new response.
PromptRequest
session/prompt request. Sends a user turn to the agent.
PromptResponse
session/prompt response. Carries the reason the turn ended.
ResumeSessionRequest
session/resume request. Resumes a previously closed session.
ResumeSessionResponse
session/resume response.
SessionConfigOption
A session configuration option. The agent advertises the set of options the consumer can set via SetSessionConfigOptionRequest.
SessionId
A unique identifier for a conversation session.
SessionInfo
Information about a single session, returned by session/list.
SessionMode
A single session mode. The agent advertises the set of modes the session can switch between via SessionModeState::available_modes.
SessionModeId
A unique identifier for a session mode.
SessionModeState
The set of session modes the agent supports, plus the mode that is currently active. Returned by session/new and session/load when the agent supports session modes.

Enums§

McpServer
Configuration for connecting to an MCP server.
StopReason
Why an agent stopped processing a prompt turn.