Skip to main content

gate4agent/
lib.rs

1//! gate4agent — Universal wrapper for CLI agents (Claude Code, Codex, Gemini, OpenCode).
2//!
3//! Two transport modes:
4//! - Pipe mode: NDJSON-streaming pipe sessions (Claude, Codex, Gemini, OpenCode)
5//! - PTY mirror: spawns agent in real PTY, captures raw output, vt100 parsing
6//!
7//! All modes produce `AgentEvent` values on a `tokio::sync::broadcast` channel.
8//!
9//! # Entry points
10//!
11//! - [`TransportSession`] — thin dispatch router: pipe or PTY
12//! - [`PipeSession`] — direct pipe session entry point (restored for 0.1.x compatibility)
13//! - [`pty::PtySession::spawn`] — PTY mirror mode (unchanged)
14//! - [`MultiCliManager`] — high-level session manager for the chart app
15
16pub use core::error::AgentError;
17pub use core::types::{AgentEvent, CliTool, SessionConfig};
18pub use transport::{SpawnOptions, TransportSession};
19pub use pipe::{PipeSession, PipeProcessOptions, ClaudeOptions};
20
21pub mod core;
22pub mod transport;
23pub mod pty;
24pub mod pipe;
25pub mod rpc;
26pub mod history;
27pub mod manager;
28pub mod daemon;
29
30pub use rpc::{
31    RpcSession, RpcSessionOptions, RpcSessionError,
32    HostHandler, RejectAllHandler, MethodRouter,
33    RpcId, RpcRequest, RpcResponse, RpcError, RpcNotification,
34    classify_line,
35};
36pub use manager::{MultiCliManager, ManagerConfig, InstanceId, InstanceMode};
37pub use pty::snapshot::{
38    AgentCli, AgentRenderSnapshot, AgentSnapshotMode, BuddyArt, ChatMessage, ChatRole, TermCell, TermGrid,
39};
40pub use history::{HistoryReader, SessionMeta, reader_for};
41
42pub(crate) mod utils;
43
44pub use daemon::{DaemonSession, DaemonConfig, DaemonType, DaemonAuth};