remove Role::Manager + ManagerSurface + Flavor::Manager — there is only one role: agent
This commit is contained in:
parent
186ee430b5
commit
f56b272a23
8 changed files with 100 additions and 489 deletions
|
|
@ -1744,13 +1744,11 @@ pub const SERVER_NAME: &str = "hyperhive";
|
|||
/// should plan in /state notes instead.
|
||||
pub const ALLOWED_BUILTIN_TOOLS: &[&str] = &["Edit", "Glob", "Grep", "Read", "Write"];
|
||||
|
||||
/// Which MCP tool surface to advertise via `--allowedTools`. The agent
|
||||
/// list is the strict subset of the manager list, so we just thread the
|
||||
/// flavor through.
|
||||
/// Kept for API stability — was two-variant (Agent/Manager) but the manager
|
||||
/// role no longer exists. Only `Agent` remains; everything is perms + caps.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum Flavor {
|
||||
Agent,
|
||||
Manager,
|
||||
}
|
||||
|
||||
/// Env var written by the meta renderer with a comma-separated list of
|
||||
|
|
@ -1800,18 +1798,11 @@ fn allowed_capability_tools() -> Vec<String> {
|
|||
/// token is matched (case-insensitive) against the `ToolGroup` serde names
|
||||
/// (`messaging`, `meta`, `inbox`, `lifecycle`, `approvals`, `scheduling`,
|
||||
/// `diagnostics`, `execution`). Unrecognised tokens are logged and skipped.
|
||||
/// Falls back to the flavor default when the env var is absent or empty.
|
||||
fn effective_tool_groups(flavor: Flavor) -> Vec<hive_sh4re::ToolGroup> {
|
||||
/// Falls back to `AGENT_DEFAULT` when the env var is absent or empty.
|
||||
fn effective_tool_groups() -> Vec<hive_sh4re::ToolGroup> {
|
||||
let raw = match std::env::var(TOOL_GROUPS_ENV) {
|
||||
Ok(v) if !v.trim().is_empty() => v,
|
||||
_ => {
|
||||
// No env var — use the flavor default unchanged.
|
||||
let defaults = match flavor {
|
||||
Flavor::Agent => hive_sh4re::ToolGroup::AGENT_DEFAULT,
|
||||
Flavor::Manager => hive_sh4re::ToolGroup::MANAGER_DEFAULT,
|
||||
};
|
||||
return defaults.to_vec();
|
||||
}
|
||||
_ => return hive_sh4re::ToolGroup::AGENT_DEFAULT.to_vec(),
|
||||
};
|
||||
let mut groups = Vec::new();
|
||||
for token in raw.split(',') {
|
||||
|
|
@ -1829,12 +1820,9 @@ fn effective_tool_groups(flavor: Flavor) -> Vec<hive_sh4re::ToolGroup> {
|
|||
if groups.is_empty() {
|
||||
tracing::warn!(
|
||||
"{TOOL_GROUPS_ENV} set but contained no recognised groups; \
|
||||
falling back to flavor default"
|
||||
falling back to AGENT_DEFAULT"
|
||||
);
|
||||
return match flavor {
|
||||
Flavor::Agent => hive_sh4re::ToolGroup::AGENT_DEFAULT.to_vec(),
|
||||
Flavor::Manager => hive_sh4re::ToolGroup::MANAGER_DEFAULT.to_vec(),
|
||||
};
|
||||
return hive_sh4re::ToolGroup::AGENT_DEFAULT.to_vec();
|
||||
}
|
||||
groups
|
||||
}
|
||||
|
|
@ -1872,8 +1860,8 @@ pub fn allowed_mcp_tools(groups: &[hive_sh4re::ToolGroup]) -> Vec<String> {
|
|||
/// Combined allow-list passed to `--allowedTools` (auto-approve) — covers
|
||||
/// both the built-ins and the MCP surface.
|
||||
#[must_use]
|
||||
pub fn allowed_tools_arg(flavor: Flavor) -> String {
|
||||
let groups = effective_tool_groups(flavor);
|
||||
pub fn allowed_tools_arg() -> String {
|
||||
let groups = effective_tool_groups();
|
||||
// Base built-ins always present.
|
||||
let mut all: Vec<String> = ALLOWED_BUILTIN_TOOLS
|
||||
.iter()
|
||||
|
|
@ -1903,15 +1891,7 @@ pub fn allowed_tools_arg(flavor: Flavor) -> String {
|
|||
/// `WebFetch`/`WebSearch` when the `web_tools` group is active).
|
||||
#[must_use]
|
||||
pub fn builtin_tools_arg() -> String {
|
||||
builtin_tools_arg_for_flavor(Flavor::Agent)
|
||||
}
|
||||
|
||||
/// Flavor-aware variant used by `turn.rs` via `builtin_tools_arg`. Reads
|
||||
/// the effective tool groups for `flavor` so `--tools` matches what
|
||||
/// `--allowedTools` includes for the same session.
|
||||
#[must_use]
|
||||
pub fn builtin_tools_arg_for_flavor(flavor: Flavor) -> String {
|
||||
let groups = effective_tool_groups(flavor);
|
||||
let groups = effective_tool_groups();
|
||||
let mut tools: Vec<&str> = ALLOWED_BUILTIN_TOOLS.to_vec();
|
||||
for group in &groups {
|
||||
for t in group.builtin_tools() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue