//! IPC co-process dispatcher for the `mcptest exec --connection-server`
//! mode.
//!
//! Why this lives in `mcptest-core`: ADR-0018 commits v1.0 to a library-
//! shaped engine. The exec mode is implemented in the CLI but the
//! request/response shapes and the dispatcher loop are pure transport-
//! free logic that the SDK contract depends on. Keeping the IPC types
//! and dispatcher in core lets the CLI plug stdin/stdout pipes into
//! [`run`] and the integration tests plug a pair of channels in instead.
//!
//! ## Public surface
//!
//! - [`protocol`]: newline-delimited JSON-RPC 2.0 envelope types plus the
//!   set of method names the SDK can call.
//! - [`dispatcher`]: the request router. Translates each IPC method into
//!   one call against an [`McpBackend`].
//! - [`session`]: top-level lifecycle loop that reads envelopes from an
//!   inbound stream, hands each to the dispatcher, and writes responses
//!   to an outbound stream.
//! - [`McpBackend`]: the contract the CLI side implements (real MCP
//!   connection) and the test side fakes (in-memory stub).

#![allow(clippy::module_inception)]

pub mod dispatcher;
pub mod protocol;
pub mod session;

pub use dispatcher::{Dispatcher, McpBackend};
pub use protocol::{
    error_codes, HandshakeParams, HandshakeReply, IpcError, IpcMethod, IpcRequest, IpcResponse,
    IpcResponseBody, COPROCESS_PROTOCOL_VERSION, IPC_VERSION,
};
pub use session::{run, SessionOptions};
