Lanjutan audit alur AI agent (round 2), mengisi celah yang tersisa dari
perpbaikan paralel tool di loop utama (74b1ad4) agar lebih mirip Claude Code.
- feat(subagent): eksekusi batch tool read-only paralel di subagent engine
(engine.rs). Tool::run sinkron, jadi pakai scoped OS thread (bounded
window 8); hasil dipertahankan dalam urutan panggilan asli. Batch dengan
tool mutating jatuh balik ke jalur sequential aman.
- feat(agent): auto-load AGENTS.md/CLAUDE.md/.cursorrules ke system prompt
tiap turn (seperti Claude Code load AGENTS.md saat startup). Fungsi
main_agent_prompt_with_project_context menempel blok PROJECT CONTEXT;
dibaca dari workspace root pertama & dibatasi 12k char.
- feat(prompt): arahan VERIFY AFTER EDIT — setelah edit/write, agent wajib
jalankan cargo check/clippy/test (atau lint/test sesuai stack) via bash
sebelum mengakhiri turn; perbaiki error yang terlihat, jangan klaim
'compiles/works' tanpa hasil nyata.
- feat(infra): build_rich_context kini membaca AGENTS.md & CLAUDE.md juga
(untuk explore_codebase/scout).
- test: +3 subagent engine (order paralel, kecepatan konkuren, fallback
mutating), +2 domain prompt (konteks proyek & fallback kosong).
67 lines
2.7 KiB
Rust
67 lines
2.7 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 agent;
|
|
pub mod auth;
|
|
pub mod cms;
|
|
pub mod core;
|
|
pub mod error;
|
|
pub mod subagent;
|
|
pub mod workflow;
|
|
|
|
// 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, OAuthRepository, OAuthService, OAuthToken,
|
|
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, Store,
|
|
StreamEvent, StreamOptions, 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::defaults::*;
|
|
pub use agent::progress::AgentProgress;
|
|
pub use agent::prompt::{
|
|
compaction_prompt, main_agent_prompt, main_agent_prompt_with_project_context,
|
|
subagent_directive,
|
|
};
|
|
pub use subagent::*;
|
|
pub use workflow::*;
|