feat(ai): add Claude Code CLI provider
This commit is contained in:
1 parent
89fca90dbc
commit
d3947d246c
28 files changed
+1723
-176
No files matched your search
@@ -101,7 +101,7 @@ pub async fn run_agent_loop(
|
||||
let contract_system_prompt = augment_system_prompt_with_task_contract(system_prompt, task_contract, is_agent_mode);
|
||||
let system_prompt = contract_system_prompt.as_str();
|
||||
|
||||
if matches!(config.provider, AiProvider::CodexCli) {
|
||||
if matches!(config.provider, AiProvider::CodexCli | AiProvider::ClaudeCodeCli) {
|
||||
let connection_name = {
|
||||
let configs = agent_ctx.state.configs.read().await;
|
||||
configs
|
||||
@@ -109,24 +109,27 @@ pub async fn run_agent_loop(
|
||||
.map(|config| config.name.clone())
|
||||
.unwrap_or_else(|| agent_ctx.connection_id.clone())
|
||||
};
|
||||
let options = crate::ai_cli_agent::CliAgentRunOptions {
|
||||
connection_id: agent_ctx.connection_id.clone(),
|
||||
connection_name,
|
||||
database: agent_ctx.database.clone(),
|
||||
agent_mode: is_agent_mode,
|
||||
allow_writes: agent_ctx.sql_permissions.allow_writes,
|
||||
allow_dangerous: agent_ctx.sql_permissions.allow_dangerous,
|
||||
mcp_server_command: agent_ctx.cli_mcp_server_command.clone(),
|
||||
};
|
||||
if matches!(config.provider, AiProvider::ClaudeCodeCli) {
|
||||
let prompt = crate::ai_claude_code_cli::build_claude_code_prompt(
|
||||
system_prompt,
|
||||
messages,
|
||||
agent_ctx.sql_permissions.allow_writes,
|
||||
);
|
||||
return crate::ai_claude_code_cli::run_claude_code_agent(config, &prompt, options, cancelled, on_event)
|
||||
.await;
|
||||
}
|
||||
let prompt =
|
||||
crate::ai_codex_cli::build_codex_prompt(system_prompt, messages, agent_ctx.sql_permissions.allow_writes);
|
||||
return crate::ai_codex_cli::run_codex_agent(
|
||||
config,
|
||||
&prompt,
|
||||
crate::ai_codex_cli::CodexRunOptions {
|
||||
connection_id: agent_ctx.connection_id.clone(),
|
||||
connection_name,
|
||||
database: agent_ctx.database.clone(),
|
||||
agent_mode: is_agent_mode,
|
||||
allow_writes: agent_ctx.sql_permissions.allow_writes,
|
||||
allow_dangerous: agent_ctx.sql_permissions.allow_dangerous,
|
||||
mcp_server_command: agent_ctx.cli_mcp_server_command.clone(),
|
||||
},
|
||||
cancelled,
|
||||
on_event,
|
||||
)
|
||||
.await;
|
||||
return crate::ai_codex_cli::run_codex_agent(config, &prompt, options, cancelled, on_event).await;
|
||||
}
|
||||
|
||||
// Auto-degrade: providers without function calling fall back to text-only completion.
|
||||
|
||||
Reference in new issue
Block a user