Hapus seluruh pipeline LSP (client, manager, provisioner, dan 7 tool lsp_*) dari codebase: - apps/infrastructure/src/lsp/ (client.rs, manager.rs, provisioner/*) - apps/infrastructure/src/tools/lsp/ (connect, disconnect, diagnostics, hover, completion, definition, references) - ToolCtx/ToolCtxBuilder: hapus field lsp_manager - Daemon state: hapus lsp_manager, lsp_provision_msgs, shutdown_lsp - Registry: hapus registrasi 7 tool lsp_* - Settings: hapus lsp_auto_provision + lsp_languages - Agent definitions: hapus lsp_* dari allowed tools coder/reviewer - Cargo: hapus dependency lsp-types (workspace + infra) - Update dokumentasi mod + arch_audit forbidden list Verifikasi: cargo check/clippy/test semua hijau (54 test), tidak ada referensi lsp_* tersisa di luar CHANGELOG.
138 lines
4.4 KiB
Rust
138 lines
4.4 KiB
Rust
//! # Zesdex Infrastructure Layer
|
|
//!
|
|
//! ALL concrete implementations of domain repository traits, application port
|
|
//! traits, and platform services. This is the outermost ring of the Clean
|
|
//! Architecture onion — it depends on `zesdex-domain` and `zesdex-application`
|
|
//! but NEVER on interface/presentation crates.
|
|
//!
|
|
//! ## Architecture
|
|
//!
|
|
//! ```text
|
|
//! src/
|
|
//! ├── lib.rs — Foundational types + re-exports
|
|
//! ├── utils.rs — CastOr, write_json_atomic, slugify
|
|
//! ├── persistence/ — Repository implementations (IAM, CMS, SQLite)
|
|
//! ├── auth/ — JWT, Argon2, OAuth loopback
|
|
//! ├── llm/ — LLM provider HTTP client
|
|
//! ├── ipc/ — Unix-socket IPC protocol
|
|
//! ├── mcp/ — Model Context Protocol bridge
|
|
//! ├── bgbash/ — Background bash job management
|
|
//! ├── tools/ — All 37 agent-invocable tools
|
|
//! ├── subagent/ — Subagent spawning & execution engine
|
|
//! ├── workflow/ — Hive-mind orchestration engine
|
|
//! ├── review/ — Post-edit auto-review subagent
|
|
//! ├── guard/ — Tool-gate access control
|
|
//! └── middleware/ — Axum HTTP middleware (auth, cors, rate-limit)
|
|
//! ```
|
|
|
|
pub mod auth;
|
|
pub mod best_practice;
|
|
pub mod bgbash;
|
|
pub mod guard;
|
|
pub mod ipc;
|
|
pub mod llm;
|
|
pub mod mcp;
|
|
pub mod middleware;
|
|
pub mod persistence;
|
|
pub mod subagent;
|
|
pub mod tools;
|
|
pub mod utils;
|
|
pub mod workflow;
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Re-exports from domain
|
|
// ---------------------------------------------------------------------------
|
|
pub use zesdex_domain::*;
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Foundation types — these replace `crate::app::state::*` references
|
|
// from the legacy backend code.
|
|
// ---------------------------------------------------------------------------
|
|
|
|
use std::path::PathBuf;
|
|
use std::sync::Arc;
|
|
|
|
// Which kind of caller (main agent vs. subagent vs. reviewer) is
|
|
// invoking a tool, used to scope permissions and tag log/output paths.
|
|
// ---------------------------------------------------------------------------
|
|
// TurnEvent & runtime types have been moved to zesdex_domain::agent
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Tool types — needed by all tool modules
|
|
// ---------------------------------------------------------------------------
|
|
|
|
pub use tools::{GraduatedCheck, Tool, ToolCtx, ToolCtxBuilder};
|
|
|
|
// Re-export commonly needed types at the crate root
|
|
pub use zesdex_domain::core::{ChatMessage, Role, Store, ToolCallResult, UsageStats};
|
|
|
|
/// A shared, async-writable cache of directory entries, used to avoid
|
|
/// re-reading a directory every render frame.
|
|
#[derive(Clone)]
|
|
pub struct DirCache {
|
|
entries: Arc<tokio::sync::RwLock<Vec<PathBuf>>>,
|
|
}
|
|
|
|
impl DirCache {
|
|
/// Create an empty directory cache.
|
|
pub fn new() -> Self {
|
|
DirCache {
|
|
entries: Arc::new(tokio::sync::RwLock::new(Vec::new())),
|
|
}
|
|
}
|
|
|
|
/// Replace the cached directory entries.
|
|
pub async fn set(&self, paths: Vec<PathBuf>) {
|
|
let mut w = self.entries.write().await;
|
|
*w = paths;
|
|
}
|
|
}
|
|
|
|
impl Default for DirCache {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
/// A shared, whole-workspace file-path index used for `@file` mention
|
|
/// autocomplete.
|
|
#[derive(Clone)]
|
|
pub struct MentionIndex {
|
|
entries: Arc<std::sync::RwLock<Vec<String>>>,
|
|
}
|
|
|
|
impl MentionIndex {
|
|
/// Create an empty mention index.
|
|
pub fn new() -> Self {
|
|
MentionIndex {
|
|
entries: Arc::new(std::sync::RwLock::new(Vec::new())),
|
|
}
|
|
}
|
|
|
|
/// Replace the entire index with a new set of file paths.
|
|
pub fn set(&self, paths: Vec<String>) {
|
|
if let Ok(mut w) = self.entries.write() {
|
|
*w = paths;
|
|
}
|
|
}
|
|
|
|
/// Append a single file path to the index.
|
|
pub fn push(&self, path: String) {
|
|
if let Ok(mut w) = self.entries.write() {
|
|
w.push(path);
|
|
}
|
|
}
|
|
|
|
/// Return a copy of all indexed paths.
|
|
pub fn snapshot(&self) -> Vec<String> {
|
|
self.entries.read().map(|r| r.clone()).unwrap_or_default()
|
|
}
|
|
}
|
|
|
|
impl Default for MentionIndex {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|