Skip to main content

orcs_runtime/io/
mod.rs

1//! I/O abstraction for Human interaction.
2//!
3//! This module provides the View layer abstraction for ORCS,
4//! enabling pluggable I/O backends (Console, WebSocket, etc.).
5//!
6//! # Architecture
7//!
8//! ```text
9//! ┌─────────────────────────────────────────────────────────────────┐
10//! │                         View Layer                              │
11//! │  Console, WebSocket, GUI, etc.                                  │
12//! │  ┌─────────────────┐              ┌─────────────────┐          │
13//! │  │  IOInputHandle  │              │ IOOutputHandle  │          │
14//! │  │   (send input)  │              │ (receive output)│          │
15//! │  └────────┬────────┘              └────────▲────────┘          │
16//! └───────────┼────────────────────────────────┼────────────────────┘
17//!             │ IOInput                        │ IOOutput
18//!             ▼                                │
19//! ┌───────────────────────────────────────────────────────────────┐
20//! │                       Bridge Layer                             │
21//! │  ┌─────────────────────────────────────────────────────────┐  │
22//! │  │                        IOPort                            │  │
23//! │  │  input_rx ◄── IOInput                                    │  │
24//! │  │  output_tx ──► IOOutput                                  │  │
25//! │  └─────────────────────────────────────────────────────────┘  │
26//! │                              │                                  │
27//! │                  IOBridge (Bridge)                              │
28//! │                              │                                  │
29//! │                    Signal / Request                             │
30//! └───────────────────────────────────────────────────────────────┘
31//!                                │
32//!                                ▼
33//! ┌───────────────────────────────────────────────────────────────┐
34//! │                       Model Layer                              │
35//! │                        EventBus                                │
36//! └───────────────────────────────────────────────────────────────┘
37//! ```
38//!
39//! # Module Structure
40//!
41//! - `types` - IO types ([`IOInput`], [`IOOutput`], [`OutputStyle`])
42//! - `port` - IO port and handles ([`IOPort`], [`IOInputHandle`], [`IOOutputHandle`])
43//! - `input` - Input commands ([`InputCommand`])
44//! - `parser` - Input parsing ([`InputParser`])
45//! - `console` - Console I/O ([`Console`], [`ConsoleInputReader`])
46//! - `renderer` - Console rendering ([`ConsoleRenderer`])
47//!
48//! # Example
49//!
50//! ```
51//! use orcs_runtime::io::{IOPort, IOInput, IOOutput, OutputStyle};
52//! use orcs_types::ChannelId;
53//!
54//! // Create IO port
55//! let channel_id = ChannelId::new();
56//! let (port, input_handle, output_handle) = IOPort::with_defaults(channel_id);
57//!
58//! // View layer uses handles
59//! // Bridge layer (IOBridge) uses port
60//! ```
61
62mod console;
63mod input;
64mod parser;
65mod port;
66mod renderer;
67mod types;
68
69// Types (View layer contract)
70pub use types::{IOInput, IOOutput, InputContext, OutputStyle};
71
72// Port (Bridge layer)
73pub use port::{IOInputHandle, IOOutputHandle, IOPort, DEFAULT_BUFFER_SIZE};
74
75// Console (View layer - complete terminal I/O)
76pub use console::{setup_ctrlc_handler, Console, ConsoleInputReader};
77pub use renderer::ConsoleRenderer;
78
79// Input parsing
80pub use input::InputCommand;
81pub use parser::InputParser;