//! ACP (Agent-Client Protocol) connector module
//!
//! This module provides a complete connector implementation for the Agent-Client Protocol,
//! which is a standardized protocol for communicating with AI agents.
//!
//! # Architecture
//!
//! The ACP connector consists of multiple layers:
//!
//! ## Transport Layer (`transport`)
//! Provides low-level communication mechanisms:
//! - **StdioTransport**: Line-delimited JSON over stdin/stdout (for spawned processes)
//! - **HttpTransport**: HTTP POST for requests + SSE for notifications
//!
//! ## Protocol Layer (`protocol`)
//! Provides JSON-RPC request/response correlation:
//! - **ProtocolHandler**: Correlates requests with responses by ID
//! - Request timeout handling (default 30s)
//! - Notification routing (server-initiated messages)
//! - Helper functions for building ACP messages
//!
//! ## Configuration (`config`)
//! Configuration types for connector creation:
//! - **AcpConfig**: Main configuration struct
//! - **TransportKind**: Transport selection (Stdio vs HTTP)
//! - **RetryConfig**: Reconnection behavior
//!
//! ## Error Handling (`error`)
//! Error types for all connector operations:
//! - **AcpError**: Comprehensive error enum
//! - **AcpResult**: Result type alias
//!
//! ## State Management (`state`)
//! Internal state tracking:
//! - **InternalState**: Thread-safe state container
//! - **SessionInfo**: Session metadata
//!
//! ## Connector Implementation (`connector`)
//! Main connector implementation:
//! - **AcpConnector**: Implements `Connector` trait
//! - Background task for event processing
//! - Automatic reconnection with exponential backoff
//!
//! # Usage
//!
//! ```no_run
//! use dirigent_core::connectors::acp::{AcpConnector, AcpConfig};
//! use dirigent_core::connectors::Connector;
//!
//! # async fn example() -> anyhow::Result<()> {
//! // Create connector config
//! let config = AcpConfig::stdio("dirigate", vec!["serve".to_string(), "--stdio".to_string()]);
//!
//! // Create connector
//! let connector = AcpConnector::new(
//!     "acp-1".to_string(),
//!     uuid::Uuid::now_v7(),
//!     "ACP Agent".to_string(),
//!     config,
//! )?;
//!
//! // Start background task
//! let task_handle = connector.start_task().await;
//!
//! // Subscribe to events
//! let mut events = connector.subscribe();
//!
//! // Send commands
//! let cmd_tx = connector.command_tx();
//! // ... use connector ...
//!
//! // Stop connector
//! connector.stop();
//! task_handle.await?;
//! # Ok(())
//! # }
//! ```

pub mod config;
pub mod connector;
pub mod error;
pub mod idle_detector;
pub mod logging;
pub mod protocol;
pub mod state;
pub mod title_utils;
pub mod transport;

// Re-export main types for convenience
pub use config::{features, AcpConfig, RetryConfig, TransportKind};
pub use connector::AcpConnector;
pub use error::{AcpError, AcpResult};
pub use logging::AcpProtocolLogger;
pub use protocol::{
    build_initialize_request, build_session_cancel_request, build_session_load_request,
    build_session_new_request, build_session_prompt_request, ProtocolError, ProtocolHandler,
    ProtocolResult, RequestId,
};
pub use state::{InternalState, SessionInfo, SessionStatus};
pub use transport::{AcpTransport, HttpTransport, StdioTransport, TransportResult};
