subagents: add availableToSubagents opt-in toggle for extraMcpServers

This commit is contained in:
damocles 2026-09-13 13:18:27 +02:00 committed by mara
commit 16eec3c314
14 changed files with 356 additions and 84 deletions

View file

@ -1,4 +1,4 @@
//! The one per-agent path this daemon needs.
//! The per-agent paths this daemon needs.
use std::path::PathBuf;
@ -13,3 +13,28 @@ pub fn agent_socket() -> PathBuf {
PathBuf::from,
)
}
/// Durable state directory for the current agent. Same resolution as
/// `hive-agent`'s own `paths::state_dir` — reads `HYPERHIVE_STATE_DIR`
/// (always injected via `systemd.globalEnvironment` by the meta flake),
/// falling back to the `HIVE_LABEL`-derived pattern for dev/test
/// environments where the env var may not be set. Copied rather than shared
/// with `hive-agent` (a binary crate with no lib target) — a five-line env
/// read isn't worth a crate dependency to dedupe.
#[must_use]
pub fn state_dir() -> PathBuf {
if let Some(p) = std::env::var_os("HYPERHIVE_STATE_DIR") {
return PathBuf::from(p);
}
let label = std::env::var("HIVE_LABEL").unwrap_or_default();
PathBuf::from(format!("/agents/{label}/state"))
}
/// Harness-internal scratch dir this daemon writes its own generated
/// subagent `--mcp-config` file into (see `crate::mcp_config`). Delegates to
/// the shared resolver so this and `hive-agent`'s own harness dir always
/// agree on the same path.
#[must_use]
pub fn harness_dir() -> PathBuf {
hive_agent_sock::paths::harness_dir()
}