Files
zesdex/apps/infrastructure/src/subagent/division.rs
T
asepharyana 93f3c2a357 feat: hapus fitur LSP bawaan (language server protocol)
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.
2026-08-27 22:38:21 +07:00

73 lines
2.3 KiB
Rust

//! Subagent division — access-tier tool filtering for subagent permissions.
//!
//! Flow: the calling code picks an `AccessTier` → `tools_for()` returns the
//! subset of all built-in tools allowed at that tier → those tools are passed
//! to `engine::run_agent` for the subagent's tool-execution loop.
use crate::tools::Tool;
pub use zesdex_domain::subagent::AccessTier;
/// Filter the available tools to match the given access tier.
///
/// Flow: `all_tools()` → filter by tier → return owned `Vec<Box<dyn Tool>>`.
///
/// Read tier: non-mutating introspection and utility tools only.
/// Write tier: everything except dangerous system/network/process tools.
/// Full tier: all 37 tools.
pub fn tools_for(access: &AccessTier) -> Vec<Box<dyn Tool>> {
let all = crate::tools::all_tools();
match access {
AccessTier::Read => all
.into_iter()
.filter(|t| {
let name = t.name();
matches!(
name,
"read"
| "grep"
| "glob"
| "pong"
| "todowrite"
| "todofinish"
| "dir_list"
| "dir_cache_update"
| "cd"
| "remember"
| "recall"
| "forget"
)
})
.collect(),
AccessTier::Write => all
.into_iter()
.filter(|t| {
let name = t.name();
!matches!(
name,
"bash"
| "bash_output"
| "bash_kill"
| "git_operator"
| "git_worktree"
| "git_cred"
| "shell"
| "workflow_run"
| "note_finding"
| "read_findings"
| "hive_mind"
| "spawn_agents"
| "spawn_pipeline"
| "plan_enter"
| "plan_ready"
| "sequential_think"
)
})
.collect(),
AccessTier::Full => all, // everything
}
}