feat: add main features
Agents for developpement added + frontend add + backend added. Git viewer created + agent and template creator + layout and project creator
This commit is contained in:
35
crates/application/src/terminal/mod.rs
Normal file
35
crates/application/src/terminal/mod.rs
Normal file
@ -0,0 +1,35 @@
|
||||
//! Terminal use cases (ARCHITECTURE §6, L3).
|
||||
//!
|
||||
//! Each use case is a struct carrying its ports as `Arc<dyn Port>` and exposing a
|
||||
//! single `execute(input) -> Result<output, AppError>` method (**Single
|
||||
//! Responsibility**). They talk **only** to the [`domain::ports::PtyPort`] (plus
|
||||
//! the [`domain::ports::EventBus`] for `OpenTerminal`); the composition root
|
||||
//! injects the concrete [`infrastructure::PortablePtyAdapter`].
|
||||
//!
|
||||
//! - [`OpenTerminal`] — resolve the cwd, spawn a PTY, create a
|
||||
//! [`domain::TerminalSession`], register the live handle, publish an event.
|
||||
//! - [`WriteToTerminal`] — forward bytes (keystrokes) to a PTY.
|
||||
//! - [`ResizeTerminal`] — resize a PTY.
|
||||
//! - [`CloseTerminal`] — kill a PTY and forget its handle.
|
||||
//!
|
||||
//! # Where the active-session registry lives, and why
|
||||
//!
|
||||
//! The domain [`PtyPort`] is *handle-oriented*: `spawn` returns a
|
||||
//! [`domain::ports::PtyHandle`] that every later call (`write`/`resize`/`kill`)
|
||||
//! must reference. Something has to remember, per [`SessionId`], the live
|
||||
//! `PtyHandle` (and the `TerminalSession` snapshot) between IPC calls. That state
|
||||
//! is **not domain state** (it is the in-flight wiring of an I/O resource), and
|
||||
//! it must not live in the adapter alone (other use cases need to address a
|
||||
//! session by id). It therefore lives in [`TerminalSessions`], an **application
|
||||
//! service** injected into the terminal use cases (and held in the composition
|
||||
//! root behind an `Arc`). This keeps the domain pure and the registry shared,
|
||||
//! testable, and transport-agnostic.
|
||||
|
||||
mod registry;
|
||||
mod usecases;
|
||||
|
||||
pub use registry::TerminalSessions;
|
||||
pub use usecases::{
|
||||
CloseTerminal, CloseTerminalInput, CloseTerminalOutput, OpenTerminal, OpenTerminalInput,
|
||||
OpenTerminalOutput, ResizeTerminal, ResizeTerminalInput, WriteToTerminal, WriteToTerminalInput,
|
||||
};
|
||||
Reference in New Issue
Block a user