///|
/// Stable JSON-RPC envelope and error surface.
pub using @jsonrpc {
JSON_RPC_VERSION,
jsonrpc_decode,
jsonrpc_decode_int64,
jsonrpc_decode_json,
jsonrpc_encode,
jsonrpc_to_json,
type JsonRpcCodecError,
type JsonRpcError,
type JsonRpcErrorCode,
type JsonRpcFailure,
type JsonRpcId,
type JsonRpcMessage,
type JsonRpcNotification,
type JsonRpcRequest,
type JsonRpcResponse,
type JsonRpcSuccess,
type RequestId,
type ResponseId,
}
///|
/// Stable ACP v1 wire data, its typed codecs, and the pure session-update
/// consumer fold. Low-level map/path helpers from the protocol implementation
/// remain package-local to the protocol package; callers use the domain codecs
/// and the fold below.
pub using @protocol {
agent_auth_capabilities_from_json,
agent_auth_capabilities_to_json,
agent_capabilities_from_json,
agent_capabilities_to_json,
agent_mcp_capabilities_from_json,
agent_mcp_capabilities_to_json,
agent_prompt_capabilities_from_json,
agent_prompt_capabilities_to_json,
agent_session_capabilities_from_json,
agent_session_capabilities_to_json,
annotations_from_json,
annotations_to_json,
audio_content_from_json,
audio_content_to_json,
auth_method_from_json,
auth_method_to_json,
authenticate_params_from_json,
authenticate_params_to_json,
authenticate_result_from_json,
authenticate_result_to_json,
available_command_input_from_json,
available_command_input_to_json,
available_commands_update_from_json,
available_commands_update_to_json,
blob_resource_contents_from_json,
blob_resource_contents_to_json,
capability_marker_from_json,
capability_marker_to_json,
client_capabilities_from_json,
client_capabilities_to_json,
client_config_option_capabilities_from_json,
client_config_option_capabilities_to_json,
client_elicitation_capabilities_from_json,
client_elicitation_capabilities_to_json,
client_file_system_capabilities_from_json,
client_file_system_capabilities_to_json,
client_session_capabilities_from_json,
client_session_capabilities_to_json,
config_option_update_from_json,
config_option_update_to_json,
content_block_from_json,
content_block_to_json,
content_chunk_from_json,
content_chunk_to_json,
content_from_json,
content_to_json,
cost_from_json,
cost_to_json,
current_mode_update_from_json,
current_mode_update_to_json,
diff_from_json,
diff_to_json,
elicitation_complete_params_from_json,
elicitation_complete_params_to_json,
elicitation_create_params_from_json,
elicitation_create_params_to_json,
elicitation_create_result_from_json,
elicitation_create_result_to_json,
embedded_resource_from_json,
embedded_resource_resource_from_json,
embedded_resource_resource_to_json,
embedded_resource_to_json,
image_content_from_json,
image_content_to_json,
implementation_from_json,
implementation_to_json,
initialize_params_from_json,
initialize_params_to_json,
initialize_result_from_json,
initialize_result_to_json,
logout_params_from_json,
logout_params_to_json,
logout_result_from_json,
logout_result_to_json,
mcp_server_from_json,
mcp_server_to_json,
permission_option_from_json,
permission_option_to_json,
plan_entry_from_json,
plan_entry_to_json,
plan_from_json,
plan_to_json,
read_text_file_params_from_json,
read_text_file_params_to_json,
read_text_file_result_from_json,
read_text_file_result_to_json,
request_permission_outcome_from_json,
request_permission_outcome_to_json,
request_permission_request_from_json,
request_permission_request_to_json,
request_permission_response_from_json,
request_permission_response_to_json,
resource_link_from_json,
resource_link_to_json,
selected_permission_outcome_from_json,
selected_permission_outcome_to_json,
session_config_option_category_from_json,
session_config_option_category_to_json,
session_config_option_from_json,
session_config_option_to_json,
session_config_select_group_from_json,
session_config_select_group_to_json,
session_config_select_option_from_json,
session_config_select_option_to_json,
session_config_select_options_from_json,
session_config_select_options_to_json,
session_info_from_json,
session_info_to_json,
session_info_update_from_json,
session_info_update_to_json,
session_update_fold,
session_update_from_json,
session_update_to_json,
terminal_create_params_from_json,
terminal_create_params_to_json,
terminal_create_result_from_json,
terminal_create_result_to_json,
terminal_from_json,
terminal_kill_params_from_json,
terminal_kill_params_to_json,
terminal_kill_result_from_json,
terminal_kill_result_to_json,
terminal_output_params_from_json,
terminal_output_params_to_json,
terminal_output_result_from_json,
terminal_output_result_to_json,
terminal_release_params_from_json,
terminal_release_params_to_json,
terminal_release_result_from_json,
terminal_release_result_to_json,
terminal_to_json,
terminal_wait_for_exit_params_from_json,
terminal_wait_for_exit_params_to_json,
terminal_wait_for_exit_result_from_json,
terminal_wait_for_exit_result_to_json,
text_content_from_json,
text_content_to_json,
text_resource_contents_from_json,
text_resource_contents_to_json,
tool_call_content_from_json,
tool_call_content_to_json,
tool_call_from_json,
tool_call_location_from_json,
tool_call_location_to_json,
tool_call_to_json,
tool_call_update_from_json,
tool_call_update_to_json,
unstructured_command_input_from_json,
unstructured_command_input_to_json,
usage_update_from_json,
usage_update_to_json,
write_text_file_params_from_json,
write_text_file_params_to_json,
write_text_file_result_from_json,
write_text_file_result_to_json,
type AgentAuthCapabilities,
type AgentCapabilities,
type AgentMcpCapabilities,
type AgentPromptCapabilities,
type AgentSessionCapabilities,
type Annotations,
type AudioContent,
type AuthMethod,
type AuthenticateParams,
type AuthenticateResult,
type AvailableCommand,
type AvailableCommandInput,
type AvailableCommandsUpdate,
type BlobResourceContents,
type CapabilityMarker,
type ClientAuthCapabilities,
type ClientCapabilities,
type ClientConfigOptionCapabilities,
type ClientElicitationCapabilities,
type ClientFileSystemCapabilities,
type ClientSessionCapabilities,
type ConfigOptionUpdate,
type Content,
type ContentBlock,
type ContentChunk,
type Cost,
type CurrentModeUpdate,
type Diff,
type ElicitationAction,
type ElicitationCompleteParams,
type ElicitationCreateParams,
type ElicitationCreateResult,
type ElicitationFormParams,
type ElicitationScope,
type ElicitationUrlParams,
type EmbeddedResource,
type EmbeddedResourceResource,
type ImageContent,
type Implementation,
type InitializeParams,
type InitializeResult,
type LogoutParams,
type LogoutResult,
type McpEnvVariable,
type McpHttpHeader,
type McpServer,
type McpServerHttp,
type McpServerSse,
type McpServerStdio,
type PermissionOption,
type PermissionOptionKind,
type Plan,
type PlanEntry,
type PlanEntryPriority,
type PlanEntryStatus,
type ProtocolDecodeError,
type ProtocolNullable,
type ReadTextFileParams,
type ReadTextFileResult,
type RequestPermissionOutcome,
type RequestPermissionRequest,
type RequestPermissionResponse,
type ResourceLink,
type Role,
type SelectedPermissionOutcome,
type SessionConfigBoolean,
type SessionConfigOption,
type SessionConfigOptionCategory,
type SessionConfigOptionKind,
type SessionConfigSelect,
type SessionConfigSelectGroup,
type SessionConfigSelectOption,
type SessionConfigSelectOptions,
type SessionInfo,
type SessionInfoUpdate,
type SessionUpdate,
type SessionUpdateFold,
type SessionUpdateFoldError,
type SessionUpdateMessage,
type Terminal,
type TerminalCreateParams,
type TerminalCreateResult,
type TerminalEnvVariable,
type TerminalExitStatus,
type TerminalKillParams,
type TerminalKillResult,
type TerminalOutputParams,
type TerminalOutputResult,
type TerminalReleaseParams,
type TerminalReleaseResult,
type TerminalWaitForExitParams,
type TerminalWaitForExitResult,
type TextContent,
type TextResourceContents,
type ToolCall,
type ToolCallContent,
type ToolCallLocation,
type ToolCallStatus,
type ToolCallUpdate,
type ToolKind,
type UnstructuredCommandInput,
type UsageUpdate,
type WriteTextFileParams,
type WriteTextFileResult,
type ElicitationId,
type MessageId,
type PermissionOptionId,
type SessionConfigGroupId,
type SessionConfigId,
type SessionConfigValueId,
type SessionId,
type SessionModeId,
type TerminalId,
type ToolCallId,
}
///|
/// Session lifecycle, mode, configuration, and prompt wire data.
pub using @session {
cancel_params_from_json,
cancel_params_to_json,
close_session_params_from_json,
close_session_params_to_json,
close_session_result_from_json,
close_session_result_to_json,
delete_session_params_from_json,
delete_session_params_to_json,
delete_session_result_from_json,
delete_session_result_to_json,
list_sessions_params_from_json,
list_sessions_params_to_json,
list_sessions_result_from_json,
list_sessions_result_to_json,
load_session_params_from_json,
load_session_params_to_json,
load_session_result_from_json,
load_session_result_to_json,
new_session_params_from_json,
new_session_params_to_json,
new_session_result_from_json,
new_session_result_to_json,
prompt_params_from_json,
prompt_params_to_json,
prompt_result_from_json,
prompt_result_to_json,
resume_session_params_from_json,
resume_session_params_to_json,
resume_session_result_from_json,
resume_session_result_to_json,
session_mode_from_json,
session_mode_state_from_json,
session_mode_state_to_json,
session_mode_to_json,
session_update_params_from_json,
session_update_params_to_json,
set_session_config_option_params_from_json,
set_session_config_option_params_to_json,
set_session_config_option_result_from_json,
set_session_config_option_result_to_json,
set_session_mode_params_from_json,
set_session_mode_params_to_json,
set_session_mode_result_from_json,
set_session_mode_result_to_json,
type CancelParams,
type CloseSessionParams,
type CloseSessionResult,
type DeleteSessionParams,
type DeleteSessionResult,
type ListSessionsParams,
type ListSessionsResult,
type LoadSessionParams,
type LoadSessionResult,
type NewSessionParams,
type NewSessionResult,
type PromptParams,
type PromptResult,
type ResumeSessionParams,
type ResumeSessionResult,
type SessionConfigValue,
type SessionMode,
type SessionModeState,
type SessionUpdateParams,
type SetSessionConfigOptionParams,
type SetSessionConfigOptionResult,
type SetSessionModeParams,
type SetSessionModeResult,
type StopReason,
}
///|
/// Typed method surfaces for both protocol directions.
pub using @agent_message {
decode_agent_notification,
decode_agent_request,
type AgentMessageError,
type AgentNotification,
type AgentRequest,
}
///|
pub using @client_message {
decode_client_notification,
decode_client_request,
type ClientMessageError,
type ClientNotification,
type ClientRequest,
}
///|
/// Agent composition, endpoint, and outbound context APIs together with the
/// initial adapter-state constructor the facade runners require as
/// `initial_state`. Adapter admission, completion, and invocation internals
/// intentionally remain in the agent package.
pub using @agent {
agent_adapter_state_new,
agent_auth_service,
agent_context,
agent_endpoint_from_spec,
agent_runtime_owner_port,
agent_runtime_run,
agent_serve_stdio,
agent_serve_stdio_with_outbound,
agent_session_service,
agent_spec,
agent_support,
type AgentAdapterState,
type AgentAuthService,
type AgentAuthenticateHandler,
type AgentCancelHandler,
type AgentCloseSessionHandler,
type AgentContext,
type AgentContextError,
type AgentContextNotificationBroker,
type AgentContextRequestBroker,
type AgentDeleteSessionHandler,
type AgentListSessionsHandler,
type AgentLoadSessionHandler,
type AgentLogoutHandler,
type AgentNewSessionHandler,
type AgentOutboundReply,
type AgentPromptHandler,
type AgentResumeSessionHandler,
type AgentSessionService,
type AgentSetConfigOptionHandler,
type AgentSetModeHandler,
type AgentSpec,
type AgentSupport,
type AgentEndpoint,
}
///|
/// Agent-side protocol handshake state. The config value and the fresh-state
/// constructor are the facade seam for building the `initial_state` value the
/// agent runners accept. Reducer events, commands, and steps intentionally
/// remain in the agent protocol package.
pub using @agent_protocol {
agent_protocol_state_new,
type AgentProtocolConfig,
type AgentProtocolState,
}
///|
/// Client composition, endpoint, and typed connection APIs together with the
/// initial adapter-state constructor the facade runners require as
/// `initial_state`. Adapter admission, completion, and invocation internals
/// intentionally remain in the client package.
pub using @client {
client_adapter_state_new,
client_connect_process,
client_connection,
client_elicitation_service,
client_file_system_service,
client_program,
client_program_from,
client_runtime_owner_port,
client_runtime_run,
client_session_service,
client_spec,
client_terminal_service,
type ClientAdapterState,
type ClientConnection,
type ClientConnectionError,
type ClientElicitationCompleteHandler,
type ClientElicitationFormHandler,
type ClientElicitationService,
type ClientElicitationUrlHandler,
type ClientFileSystemService,
type ClientNotificationBroker,
type ClientProgram,
type ClientReadTextFileHandler,
type ClientReply,
type ClientRequestBroker,
type ClientRequestPermissionHandler,
type ClientSessionService,
type ClientSessionUpdateHandler,
type ClientSpec,
type ClientTerminalCreateHandler,
type ClientTerminalKillHandler,
type ClientTerminalOutputHandler,
type ClientTerminalReleaseHandler,
type ClientTerminalService,
type ClientTerminalWaitForExitHandler,
type ClientWriteTextFileHandler,
type ClientEndpoint,
}
///|
/// Client-side protocol readiness state. The awaiting-ready and ready
/// constructors are the facade seam for building the `initial_state` value
/// the client runners accept. Reducer events, commands, and steps
/// intentionally remain in the client protocol package.
pub using @client_protocol {
client_protocol_state_new,
client_protocol_state_ready,
type ClientProtocolState,
}
///|
/// Typed broker wiring that binds the Agent outbound context and the Client
/// connection facade onto the engine-level outbound channel. Codec details
/// stay inside the broker package.
pub using @broker {agent_context_over_channel, client_connection_over_channel}
///|
/// Owner-loop runner seam. The public runners are the only connection loop
/// entry points exposed by the stable facade; both drive the same single
/// reader/writer/reducer engine. The owner state machine itself
/// (`RuntimeOwner` values and its admit/execute/spawn/cancel/close/complete
/// transitions) is engine-internal and stays unexported; only the runner
/// functions, the outbound channel, the owner port, and the types a port
/// implementor must name are re-exported here. Reducer steps and the legacy
/// handler runner remain package-internal.
pub using @connection {
connection_runtime_run_owner,
connection_runtime_run_owner_with_outbound,
type RuntimeOwnerCommand,
type RuntimeOwnerEffect,
type RuntimeOwnerLocalPlan,
type RuntimeOwnerNotificationAdmission,
type RuntimeOwnerNotificationCompletion,
type RuntimeOwnerPort,
type RuntimeOwnerRequestAdmission,
type RuntimeOwnerRequestCompletion,
type RuntimeOwnerTask,
type RuntimeOutboundChannel,
}
///|
/// Canonical composition and handler failures.
pub using @acp_error {
type AgentCompositionError,
type ClientCompositionError,
type HandlerError,
}
///|
/// Native runtime ports and bounded-runtime configuration. The runtime
/// implementation itself remains below this facade; the two real I/O port
/// constructors (`runtime_stdio_ports` for serving this process's stdio,
/// `runtime_process_ports` for driving a spawned agent subprocess) and the
/// default stderr trace sink are the composition-root seams. The
/// `RuntimeProcessPorts` fields expose the underlying `moonbitlang/async`
/// process handles, so facade consumers of those fields depend on that
/// package themselves.
pub using @runtime {
runtime_default_options,
runtime_process_ports,
runtime_request_id_text,
runtime_stderr_trace,
runtime_stdio_ports,
runtime_trace_event,
runtime_validate_options,
type RuntimeError,
type RuntimeHandlerPort,
type RuntimeHandlerResult,
type RuntimeOptions,
type RuntimePorts,
type RuntimeProcessPorts,
type RuntimeReaderPort,
type RuntimeTraceEvent,
type RuntimeWriterPort,
}
///|
/// Newline framing is stable; the stdio transport adapter is intentionally
/// not exported until the native process lifecycle is complete.
pub using @transport {
framing_feed,
framing_finish,
framing_state,
type FramingError,
type FramingState,
type FramingStep,
}
///|
/// The fixed stable v1 method manifest.
pub using @method {
acp_v1_method_manifest,
type AcpV1Method,
type AcpV1MethodDirection,
type AcpV1MethodKind,
}