- Add AppStateRest as the central state struct for managing TUI state. - Implement InputState for handling user input, autocomplete, and history. - Create MiscState to manage overlays, notifications, and editor state. - Introduce ScrollState for viewport scrolling functionality. - Develop TranscriptCache for efficient message rendering in the chat pane. - Implement SimpleAgent and SimpleWorkflowEngine for agent lifecycle management. - Add helper functions for managing effort levels and token counting. - Organize state-related modules for better maintainability and clarity.
64 lines
2.6 KiB
Rust
64 lines
2.6 KiB
Rust
//! # Zesdex Domain Layer
|
|
//!
|
|
//! Pure domain entities, value objects, repository traits, and service traits
|
|
//! for the Zesdex application. This crate has **zero framework dependencies**
|
|
//! — it depends only on serialization (`serde`), timestamping (`chrono`),
|
|
//! identity (`uuid`), and a few other narrowly-scoped utilities.
|
|
//!
|
|
//! ## Architecture
|
|
//!
|
|
//! ```text
|
|
//! apps/domain
|
|
//! ├── core/ Shared domain entities (Conversation, Message, Provider,
|
|
//! │ Store, ToolCall, ToolResult, Usage)
|
|
//! ├── auth/ Authentication domain (Session, SessionId, SessionLock,
|
|
//! │ OAuth, commands, errors, repository/service traits)
|
|
//! ├── cms/ CMS domain (AppConfig, Conversation, EditLog, Memory,
|
|
//! │ Settings, commands, errors, repository/service traits)
|
|
//! └── error.rs Unified DomainError type
|
|
//! ```
|
|
//!
|
|
//! ## Key Design Principle
|
|
//!
|
|
//! All types are pure Rust structs and enums with `serde` derives. No I/O,
|
|
//! no framework imports, no side effects. All persistence is expressed
|
|
//! through repository traits that infrastructure adapters implement.
|
|
|
|
pub mod auth;
|
|
pub mod cms;
|
|
pub mod core;
|
|
pub mod error;
|
|
pub mod agent;
|
|
pub mod workflow;
|
|
pub mod subagent;
|
|
|
|
// Re-export all public items from each module for ergonomic imports.
|
|
// Consumers can do `use zesdex_domain::*` for common types.
|
|
pub use auth::{
|
|
IamSession, NewSession, OAuthConfig, OAuthToken, OAuthRepository, OAuthService,
|
|
RepositoryError as AuthRepositoryError, ServiceError as AuthServiceError, Session,
|
|
SessionId, SessionLock, SessionLockRepository, SessionRepository, SessionService,
|
|
};
|
|
pub use cms::{
|
|
AppConfig, AppConfigRepository, Conversation as CmsConversation,
|
|
ConversationRepository, ConversationService, EditLog, EditLogEntry,
|
|
EditLogRepository, InternetMode, Memory, MemoryRepository, MemoryService,
|
|
ModelRole, NewMemory, ProviderConfig, RepositoryError as CmsRepositoryError,
|
|
ServiceError as CmsServiceError, Settings, SettingsFlags, SettingsPatch,
|
|
SettingsRepository, SettingsService,
|
|
};
|
|
pub use core::{
|
|
ChatMessage, ChatRequest, ChatResponse, Choice, Conversation, Delta, Role,
|
|
SseParser, StreamEvent, StreamOptions, Store, TokenUsage, ToolCall,
|
|
ToolCallResult, ToolDef, ToolFunction, ToolFunctionDef, UsageStats,
|
|
};
|
|
pub use error::DomainError;
|
|
|
|
// Agent module top-level items (TurnEvent, SessionRuntime, etc.)
|
|
pub use agent::*;
|
|
// Sub-module items need explicit re-exports
|
|
pub use agent::progress::AgentProgress;
|
|
pub use agent::prompt::{compaction_prompt, main_agent_prompt, subagent_directive};
|
|
pub use workflow::*;
|
|
pub use subagent::*;
|