orcs_app/lib.rs
1//! ORCS Application Layer.
2//!
3//! This crate provides:
4//!
5//! - **[`OrcsApp`]**: High-level application wrapper with HIL integration
6//! - **Re-exports**: Convenient access to all ORCS crates
7//! - **[`AppError`]**: Unified application-level error type
8//!
9//! # Quick Start
10//!
11//! ```ignore
12//! use orcs_app::{OrcsApp, NoOpResolver};
13//!
14//! #[tokio::main]
15//! async fn main() -> anyhow::Result<()> {
16//! let mut app = OrcsApp::builder(NoOpResolver).build().await?;
17//! app.run_interactive().await?;
18//! Ok(())
19//! }
20//! ```
21//!
22//! # Crate Architecture
23//!
24//! ```text
25//! ┌─────────────────────────────────────────────────────────────┐
26//! │ Plugin SDK Layer │
27//! ├─────────────────────────────────────────────────────────────┤
28//! │ orcs-types, orcs-event, orcs-component │
29//! └─────────────────────────────────────────────────────────────┘
30//! ↓
31//! ┌─────────────────────────────────────────────────────────────┐
32//! │ Runtime Layer │
33//! ├─────────────────────────────────────────────────────────────┤
34//! │ orcs-runtime (auth, channel, engine, components, io) │
35//! └─────────────────────────────────────────────────────────────┘
36//! ↓
37//! ┌─────────────────────────────────────────────────────────────┐
38//! │ Application Layer ◄── HERE │
39//! ├─────────────────────────────────────────────────────────────┤
40//! │ orcs-app (OrcsApp + re-exports + AppError) │
41//! └─────────────────────────────────────────────────────────────┘
42//! ↓
43//! ┌─────────────────────────────────────────────────────────────┐
44//! │ Frontend Layer │
45//! ├─────────────────────────────────────────────────────────────┤
46//! │ orcs-cli (uses OrcsApp → interactive mode) │
47//! └─────────────────────────────────────────────────────────────┘
48//! ```
49//!
50//! # Error Handling Strategy
51//!
52//! ```text
53//! Internal Errors (ChannelError, EngineError, etc.)
54//! ↓ From impl
55//! AppError (this crate)
56//! ↓ anyhow::Error / eprintln
57//! CLI output
58//! ```
59
60mod app;
61pub mod builtins;
62mod error;
63mod printer_slot;
64
65pub use app::{OrcsApp, OrcsAppBuilder};
66pub use error::AppError;
67pub use printer_slot::{PrintResult, SharedPrinterSlot};
68
69// Re-export from Plugin SDK Layer
70pub use orcs_component::{
71 Child, Component, ComponentError, Identifiable, Progress, SignalReceiver, Status, StatusDetail,
72 Statusable,
73};
74pub use orcs_event::{EventError, Request, Signal, SignalKind, SignalResponse, DEFAULT_TIMEOUT_MS};
75pub use orcs_types::{
76 ChannelId, ComponentId, ErrorCode, EventId, Principal, PrincipalId, RequestId, SignalScope,
77 TryNew,
78};
79
80// Re-export from Runtime Layer
81pub use orcs_runtime::{
82 priority, Channel, ChannelConfig, ChannelError, ChannelHandle, ChannelRunner, ChannelState,
83 ClientRunner, ComponentHandle, DecoratorConfig, DefaultPolicy, EchoWithHilComponent,
84 EngineError, Event, EventBus, OrcsEngine, OutputReceiver, OutputSender, PermissionChecker,
85 PrivilegeLevel, Session, StateTransition, World, WorldCommand, WorldCommandSender,
86 WorldManager,
87};
88
89// Re-export configuration types
90pub use orcs_runtime::{
91 ComponentsConfig, ConfigError, ConfigLoader, ConfigResolver, EnvOverrides, HilConfig,
92 ModelConfig, NoOpResolver, OrcsConfig, PathsConfig, UiConfig,
93};
94
95// Re-export sandbox types
96pub use orcs_runtime::{ProjectSandbox, SandboxError, SandboxPolicy};
97
98// Re-export work directory type
99pub use orcs_runtime::WorkDir;