feat(tui): add usage overlay and sidebar for displaying usage statistics and tasks
feat(tui): implement status bar with connection and turn state indicators feat(tui): create workflow panel for agent status and progress visualization feat(web): introduce web frontend interface with static file serving feat(ws): add WebSocket interface for real-time communication and session management
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
//! 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;
|
||||
|
||||
/// Access tier for subagent tool permissions.
|
||||
///
|
||||
/// Tiers are cumulative: `Write` includes everything in `Read`, and `Full`
|
||||
/// includes everything in `Write`.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum AccessTier {
|
||||
/// Read-only: search, read, glob, utility tools (no mutations).
|
||||
Read,
|
||||
/// Read + Write: above plus write, edit, delete, git, memory.
|
||||
Write,
|
||||
/// Full: above plus bash, shell, LSP, workflow, plan tools.
|
||||
Full,
|
||||
}
|
||||
|
||||
/// 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"
|
||||
| "lsp_connect"
|
||||
| "lsp_disconnect"
|
||||
| "lsp_hover"
|
||||
| "lsp_completion"
|
||||
| "lsp_definition"
|
||||
| "lsp_references"
|
||||
| "lsp_diagnostics"
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
|
||||
AccessTier::Full => all, // everything
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user