fix: use non-interactive agent cli modes
This commit is contained in:
parent
1756e6e14a
commit
52fd2cfbef
5 changed files with 24 additions and 5 deletions
|
|
@ -186,7 +186,7 @@ pub async fn improve_agent_prompt(
|
|||
) -> Result<String, AppError> {
|
||||
let request = build_prompt_improvement_request(&name, &role, &tool, &custom_prompt);
|
||||
let working_dir = std::env::temp_dir().to_string_lossy().to_string();
|
||||
let args: Vec<String> = Vec::new();
|
||||
let args = tool.to_non_interactive_args();
|
||||
|
||||
let improved = agent_runtime::run_agent_command(
|
||||
tool.to_command(),
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ pub async fn send_live_message(
|
|||
);
|
||||
|
||||
let prompt = build_live_prompt(&project, &history, content);
|
||||
let args: Vec<String> = Vec::new();
|
||||
let args = agent.tool.to_non_interactive_args();
|
||||
let placeholder_agent_message = {
|
||||
let db = state
|
||||
.db
|
||||
|
|
|
|||
|
|
@ -64,6 +64,13 @@ impl AgentTool {
|
|||
AgentTool::ClaudeCode => "claude",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_non_interactive_args(&self) -> Vec<String> {
|
||||
match self {
|
||||
AgentTool::Codex => vec!["exec".to_string(), "-".to_string()],
|
||||
AgentTool::ClaudeCode => vec!["-p".to_string()],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
@ -288,6 +295,18 @@ mod tests {
|
|||
assert!(!found.is_default);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_non_interactive_args_match_cli_expectations() {
|
||||
assert_eq!(
|
||||
AgentTool::Codex.to_non_interactive_args(),
|
||||
vec!["exec".to_string(), "-".to_string()]
|
||||
);
|
||||
assert_eq!(
|
||||
AgentTool::ClaudeCode.to_non_interactive_args(),
|
||||
vec!["-p".to_string()]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_update_default_agent_allows_prompt_only() {
|
||||
let conn = setup();
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ async fn process_ticket(
|
|||
build_analyst_prompt(&ticket, &project),
|
||||
&analyst_agent.custom_prompt,
|
||||
);
|
||||
let analyst_args: Vec<String> = Vec::new();
|
||||
let analyst_args = analyst_agent.tool.to_non_interactive_args();
|
||||
let analyst_result = run_cli_command(
|
||||
analyst_agent.tool.to_command(),
|
||||
&analyst_args,
|
||||
|
|
@ -451,7 +451,7 @@ async fn process_ticket(
|
|||
build_developer_prompt(&ticket, &project, &analyst_report, &wt_path),
|
||||
&developer_agent.custom_prompt,
|
||||
);
|
||||
let developer_args: Vec<String> = Vec::new();
|
||||
let developer_args = developer_agent.tool.to_non_interactive_args();
|
||||
let developer_result = run_cli_command(
|
||||
developer_agent.tool.to_command(),
|
||||
&developer_args,
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ async fn process_next_task(
|
|||
emit_status(app_handle, &task.project_id, &task.id, "running", None);
|
||||
|
||||
let prompt = build_task_prompt(&task, &project);
|
||||
let args: Vec<String> = Vec::new();
|
||||
let args = agent.tool.to_non_interactive_args();
|
||||
let result = agent_runtime::run_agent_command(
|
||||
agent.tool.to_command(),
|
||||
&args,
|
||||
|
|
|
|||
Loading…
Reference in a new issue