refactor(mcp): split claude launch-config layer into mcp_config.rs
This commit is contained in:
parent
e1e3bda94a
commit
90af3e8d0b
7 changed files with 466 additions and 444 deletions
|
|
@ -12,7 +12,7 @@ use hive_claude::{Config, InfiniteSession, PercentPolicy, Sink};
|
|||
use serde_json::Value;
|
||||
|
||||
use crate::events::{Bus, LiveEvent};
|
||||
use crate::mcp;
|
||||
use crate::mcp_config;
|
||||
|
||||
// Hive-enforced claude settings ship at `/etc/claude-code/managed-settings.json`
|
||||
// (wired in `nix/templates/harness-base.nix` from the `prompts/claude-settings.json`
|
||||
|
|
@ -121,7 +121,7 @@ pub async fn write_mcp_config(socket: &Path) -> Result<PathBuf> {
|
|||
let exe = std::env::current_exe()
|
||||
.ok()
|
||||
.map_or_else(|| "hive".into(), |p| p.display().to_string());
|
||||
let body = mcp::render_claude_config(&exe, socket);
|
||||
let body = mcp_config::render_claude_config(&exe, socket);
|
||||
tokio::fs::write(&path, body).await?;
|
||||
tracing::info!(path = %path.display(), "wrote claude MCP config");
|
||||
Ok(path)
|
||||
|
|
@ -236,7 +236,8 @@ fn compact_percent() -> u8 {
|
|||
if env_u64("HIVE_COMPACT_WATERMARK_TOKENS") == Some(0) {
|
||||
return 0;
|
||||
}
|
||||
let pct = env_u64("HIVE_COMPACT_WATERMARK_PERCENT").unwrap_or(u64::from(DEFAULT_COMPACT_PERCENT));
|
||||
let pct =
|
||||
env_u64("HIVE_COMPACT_WATERMARK_PERCENT").unwrap_or(u64::from(DEFAULT_COMPACT_PERCENT));
|
||||
u8::try_from(pct.min(100)).unwrap_or(DEFAULT_COMPACT_PERCENT)
|
||||
}
|
||||
|
||||
|
|
@ -515,8 +516,8 @@ fn claude_config(bus: &Bus, files: &TurnFiles) -> Config {
|
|||
system_prompt_file: Some(files.system_prompt.clone()),
|
||||
mcp_config: Some(files.mcp_config.clone()),
|
||||
strict_mcp_config: true,
|
||||
tools: Some(mcp::builtin_tools_arg()),
|
||||
allowed_tools: Some(mcp::allowed_tools_arg()),
|
||||
tools: Some(mcp_config::builtin_tools_arg()),
|
||||
allowed_tools: Some(mcp_config::allowed_tools_arg()),
|
||||
add_dirs,
|
||||
..Config::default()
|
||||
}
|
||||
|
|
@ -631,4 +632,3 @@ fn archive_session(bus: &Bus) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue