claude_cli+codemode: MCP prompt points at codemode; MCP tools listed first in codemode
This commit is contained in:
1 parent
93bd2693c5
commit
fa0ff339f6
4 files changed
+26
-4
No files matched your search
@@ -474,6 +474,10 @@ fn pricing(model: &str) -> Option<hx_ai::Pricing> {
|
||||
static COMPAT: std::sync::OnceLock<hx_ai::openai_compat::Config> = std::sync::OnceLock::new();
|
||||
/// `codemode` from config: also offer the codemode tool to claude.
|
||||
static CODEMODE: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
/// claude_cli sees only `codemode` (via `hx mcp-serve`), so MCP tools are script-only.
|
||||
fn via_codemode() -> bool {
|
||||
CLAUDE_CLI.get().is_some() && CODEMODE.get().copied().unwrap_or(false)
|
||||
}
|
||||
/// `claude_cli` from config: extra args for the `claude` binary.
|
||||
static CLAUDE_CLI: std::sync::OnceLock<Vec<String>> = std::sync::OnceLock::new();
|
||||
|
||||
@@ -917,7 +921,7 @@ async fn main() -> Result<()> {
|
||||
mcp.wait_all(std::time::Duration::from_secs(1)).await;
|
||||
trace("mcp");
|
||||
mcp.register(&mut agent.tools);
|
||||
let idx = mcp.system_prompt();
|
||||
let idx = mcp.system_prompt_for(via_codemode());
|
||||
if !idx.is_empty() {
|
||||
agent.append_system(&idx);
|
||||
}
|
||||
@@ -1151,7 +1155,7 @@ async fn main() -> Result<()> {
|
||||
.unwrap_or(context::DEFAULT_PROMPT),
|
||||
context::prompt_tail(&context::hx_home(), &cwd)
|
||||
);
|
||||
let idx = mcp.system_prompt();
|
||||
let idx = mcp.system_prompt_for(via_codemode());
|
||||
if !idx.is_empty() {
|
||||
sys.push_str("\n\n");
|
||||
sys.push_str(&idx);
|
||||
|
||||
Reference in new issue
Block a user