pub mod client;
pub mod jsonrpc;
pub mod sdk_protocol_version;
pub mod session;
pub mod types;
pub use client::CopilotClient;
pub use session::{
CopilotSession, HooksHandlerFn, PermissionHandlerFn, Subscription, ToolHandler,
UserInputHandlerFn,
};
pub use types::*;
#[derive(Debug, thiserror::Error)]
pub enum CopilotError {
#[error("JSON-RPC error {code}: {message}")]
JsonRpc {
code: i32,
message: String,
data: Option<serde_json::Value>,
},
#[error("Serialization error: {0}")]
Serialization(String),
#[error("Connection closed")]
ConnectionClosed,
#[error("Request timed out after {0}ms")]
Timeout(u64),
#[error("I/O error: {0}")]
Io(String),
#[error("Protocol error: {0}")]
Protocol(String),
#[error("Client not connected. Call start() first.")]
NotConnected,
#[error("Configuration error: {0}")]
Configuration(String),
#[error("Process spawn error: {0}")]
ProcessSpawn(String),
#[error("Connection error: {0}")]
Connection(String),
#[error("SDK protocol version mismatch: expected {expected}, server reports {actual:?}")]
ProtocolMismatch {
expected: u32,
actual: Option<u32>,
},
#[error("Session error: {0}")]
SessionError(String),
#[error("No handler: {0}")]
NoHandler(String),
}