Files
IdeA/crates/domain/src/lib.rs

93 lines
3.1 KiB
Rust

//! # IdeA — Domain layer
//!
//! The **pure** hexagonal core (ARCHITECTURE.md §1.4, §3, §4, §7). It contains:
//!
//! - **Entities & value objects** with invariants enforced by validating
//! constructors (`new`/`try_new` returning `Result`),
//! - the **pure layout logic** (`split`/`merge`/`resize`/`move` as immutable
//! `&LayoutTree -> Result<LayoutTree, LayoutError>` functions),
//! - **ports** (traits) the infrastructure implements,
//! - **domain events** and **errors**.
//!
//! ## Dependency rule
//!
//! This crate depends on **no I/O**: no `tokio`, no `std::fs`, no
//! `std::process`, no `git2`/`portable-pty`/`russh`. The only third-party
//! dependencies are `uuid`, `serde` (allowed solely to derive (de)serialisation
//! of *persisted* domain types — a metier format constraint, not I/O),
//! `thiserror`, and `async-trait`.
//!
//! ## Async strategy for ports
//!
//! I/O-touching ports (`PtyPort`, `FileSystem`, `ProcessSpawner`, `RemoteHost`,
//! the stores, `GitPort`) are `#[async_trait]`. They are injected as
//! `Arc<dyn Port>` trait objects at the composition root, which native
//! `async fn`-in-trait does not yet support dyn-compatibly without boxing;
//! `async_trait` boxes the returned future and keeps the ports object-safe.
//! Non-blocking ports (`Clock`, `IdGenerator`, `EventBus`, `AgentRuntime`)
//! remain plain synchronous traits. See [`ports`] for details.
#![forbid(unsafe_code)]
#![warn(missing_docs)]
pub mod agent;
pub mod error;
pub mod events;
pub mod git;
pub mod ids;
pub mod layout;
pub mod markdown;
pub mod ports;
pub mod profile;
pub mod project;
pub mod remote;
pub mod skill;
pub mod template;
pub mod terminal;
mod validation;
// ---------------------------------------------------------------------------
// Curated re-exports for ergonomic downstream use.
// ---------------------------------------------------------------------------
pub use error::DomainError;
pub use ids::{
AgentId, LayoutId, NodeId, ProfileId, ProjectId, SessionId, SkillId, TabId, TemplateId,
WindowId,
};
pub use project::{Project, ProjectPath};
pub use agent::{Agent, AgentManifest, AgentOrigin, ManifestEntry};
pub use skill::{Skill, SkillRef, SkillScope};
pub use template::{AgentTemplate, TemplateVersion};
pub use profile::{AgentProfile, ContextInjection};
pub use markdown::MarkdownDoc;
pub use remote::{RemoteKind, RemoteRef, SshAuth};
pub use terminal::{PtySize, SessionKind, SessionStatus, TerminalSession};
pub use git::GitRepository;
pub use layout::{
Direction, GridCell, GridContainer, LayoutError, LayoutNode, LayoutTree, LeafCell,
SplitContainer, Tab, WeightedChild, Window, Workspace,
};
pub use events::DomainEvent;
pub use ports::{
AgentContextStore, AgentRuntime, Clock, ContextInjectionPlan, DirEntry, EventBus, EventStream,
ExitStatus, FileSystem, FsError, GitCommitInfo, GitError, GitFileStatus, GitPort, GraphCommit,
IdGenerator, Output, OutputStream, PreparedContext, ProcessError, ProcessSpawner, ProfileStore,
ProjectStore, PtyError, PtyHandle, PtyPort, RemoteError, RemoteHost, RemotePath, RuntimeError,
SpawnSpec, StoreError, TemplateStore,
};