feat(tty-local): initialize alknet-tty-local sibling crate (ADR-054)

Create crates/alknet-tty-local with Cargo.toml (alknet-tty workspace dep,
portable-pty, libc unix-only, tokio, bytes, futures-core, tracing,
thiserror), src/lib.rs with module declarations and LocalTtyBackend
re-export, and skeleton module files (pty, pipe, backend) with doc
comments and TODO markers. Add the crate to the workspace members list.
This commit is contained in:
glm-5.2 committed 2026-07-07 14:16:10 +00:00
1 parent 00320c2943
commit 2022a5496a
7 files changed
+229

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
[package]
name = "alknet-tty-local"
version.workspace = true
edition.workspace = true
license.workspace = true
description = "Local TTY backend for alknet-tty: LocalTtyBackend via portable_pty (PTY mode) and std::process::Command (pipe/runner mode)"
repository.workspace = true
[lib]
name = "alknet_tty_local"
[dependencies]
alknet-tty = { path = "../alknet-tty" }
portable-pty = "0.8"
tokio = { version = "1", features = ["full"] }
bytes = "1"
futures-core = "0.3"
tracing = "0.1"
thiserror = "2"
[target.'cfg(unix)'.dependencies]
libc = "0.2"
+16
View File
@@ -0,0 +1,16 @@
//! `LocalTtyBackend`: the `TtyBackend` implementation for local processes.
//!
//! `allocate()` branches on `TtyParams::terminal`: `Some(TerminalParams)`
//! selects PTY mode (this crate's `pty` module); `None` selects pipe mode
//! (the runner case, this crate's `pipe` module). One backend serves both
//! (ADR-054).
// TODO: implement
/// Local TTY backend: implements `alknet_tty::TtyBackend` for local processes.
///
/// `allocate()` branches on `TtyParams::terminal`: `Some(TerminalParams)`
/// selects PTY mode (this crate's `pty` module); `None` selects pipe mode
/// (the runner case, this crate's `pipe` module). One backend serves both
/// (ADR-054).
pub struct LocalTtyBackend;
+13
View File
@@ -0,0 +1,13 @@
//! alknet-tty-local: Local TTY backend for alknet-tty.
//!
//! `LocalTtyBackend` implements `alknet_tty::TtyBackend` via `portable_pty`
//! (PTY mode, terminal semantics) and `std::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).
//! Signal forwarding targets the foreground process group (REQ-TTY-02).
pub mod backend;
pub mod pipe;
pub mod pty;
pub use backend::LocalTtyBackend;
+8
View File
@@ -0,0 +1,8 @@
//! Pipe mode for `LocalTtyBackend`: `tokio::process`-backed runner sessions.
//!
//! Spawns the command with `Stdio::piped()` for stdin/stdout/stderr, exposes
//! tokio-native `AsyncRead`/`AsyncWrite` (no std-thread bridge needed),
//! `PipeControl` (no-op resize, `libc::kill(pid, sig)` signal), and the
//! ADR-056 kill guard on the `exit_code` future.
// TODO: implement
+9
View File
@@ -0,0 +1,9 @@
//! PTY mode for `LocalTtyBackend`: `portable_pty`-backed terminal sessions.
//!
//! Implements the blocking→async bridge (REQ-TTY-01) via three dedicated
//! std threads (reader, writer, waiter) feeding tokio mpsc/oneshot channels,
//! `PtyControl` for resize/signal, REQ-TTY-02 process-group signal
//! forwarding (`libc::kill(-pgid, sig)`), and the ADR-056 kill guard on the
//! `exit_code` future.
// TODO: implement