claude_cli: permission prompts via --permission-prompt-tool, bridged to the hx TUI
This commit is contained in:
1 parent
b06c06ad80
commit
0032a5a952
8 files changed
+248
-46
No files matched your search
@@ -367,7 +367,11 @@ fn provider(k: Kind) -> hx_ai::Result<Arc<dyn Provider>> {
|
||||
let c =
|
||||
hx_ai::claude_cli::ClaudeCli::new(CLAUDE_CLI.get().cloned().unwrap_or_default());
|
||||
Arc::new(match std::env::current_exe() {
|
||||
Ok(e) => c.with_mcp(e.to_string_lossy().into(), vec!["mcp-serve".into()]),
|
||||
Ok(e) => c.with_mcp(
|
||||
e.to_string_lossy().into(),
|
||||
vec!["mcp-serve".into()],
|
||||
serde_json::json!({ hx_core::approve::ENV: hx_core::approve::sock_path() }),
|
||||
),
|
||||
Err(_) => c,
|
||||
})
|
||||
}
|
||||
@@ -607,6 +611,9 @@ async fn main() -> Result<()> {
|
||||
));
|
||||
let mut reg = hx_core::tool::Registry::default();
|
||||
reg.add(hx_lens::LspTool::new(mgr.clone()));
|
||||
if let Some(p) = std::env::var_os(hx_core::approve::ENV) {
|
||||
reg.add(hx_core::approve::Approve(p.into()));
|
||||
}
|
||||
let cx = ToolCtx {
|
||||
cwd,
|
||||
state: Default::default(),
|
||||
@@ -891,6 +898,13 @@ async fn main() -> Result<()> {
|
||||
if cli.mode == Mode::Json && cli.print.is_none() {
|
||||
anyhow::bail!("--mode json needs -p <prompt>");
|
||||
}
|
||||
if CLAUDE_CLI.get().is_some() {
|
||||
// claude asks here (via `hx mcp-serve`) before running its tools
|
||||
let (p, cx) = (hx_core::approve::sock_path(), agent.cx.clone());
|
||||
tokio::spawn(async move {
|
||||
let _ = hx_core::approve::serve(&p, cx).await;
|
||||
});
|
||||
}
|
||||
let Some(prompt) = cli.print else {
|
||||
hx_tui::run(hx_tui::Setup {
|
||||
agent,
|
||||
|
||||
Reference in new issue
Block a user