//! alktty: Terminal session protocol for the `alk/tty` ALPN. //! //! Producer/consumer protocol crate on top of alkcall channels. Two //! halves (per alkcall's protocol-crate pattern): //! //! - **Producer half** — [`adapter::TtyAdapter`] (direct `alk/tty` //! ALPN via `ProtocolHandler`) + [`channels`] (registers the //! `channels/tty/sub` open op via `ChannelCore::register_openable` //! for the `alk/channels` multiplexed path). //! - **Consumer half** — [`session::TtySession`] (typed client wrapper //! around the wire protocol, with `connect_direct` and //! `open_via_channels` constructors). //! //! Two-carriage wire format (ADR-052): a JSON negotiation frame, then //! raw chunks (`[stream_type: u8][length: u32 be][payload]`). //! Backend-agnostic via the [`backend::TtyBackend`] trait (ADR-053). //! Depends on alkcall (ADR-057 — the negotiation framing is //! self-contained; alkcall's `EventEnvelope` framing is not reused). //! //! # WASM target //! //! The default crate (no features) compiles to //! `wasm32-unknown-unknown`. The [`local`] module is feature-gated //! and non-wasm by design (`portable-pty` + `tokio::process` need a //! real OS). Downstream TS/Python adapters compile the protocol //! layer in a sandbox; the local-process backend runs on a real OS. //! //! # Local backend //! //! The local backend ([`local::LocalTtyBackend`]) is gated behind the //! `local` feature. It implements [`backend::TtyBackend`] via //! `portable_pty` (PTY mode, terminal semantics) and //! `tokio::process::Command` (pipe mode, the runner case). The //! blocking→async bridge for PTY mode uses three dedicated std //! threads feeding tokio mpsc/oneshot channels (REQ-TTY-01). //! //! # Assembly pattern //! //! ```ignore //! let mut backends = std::collections::HashMap::new(); //! backends.insert( //! "local".into(), //! std::sync::Arc::new(alktty::local::LocalTtyBackend::new()) //! as std::sync::Arc, //! ); //! let tty_adapter = alktty::adapter::TtyAdapter::new(backends); //! ``` pub mod adapter; pub mod backend; pub mod channels; pub mod control; pub mod negotiation; pub mod session; pub mod wire; #[cfg(feature = "local")] pub mod local;