diff --git a/src-tauri/src/ai_agents.rs b/src-tauri/src/ai_agents.rs index 59454843..9b0bebae 100644 --- a/src-tauri/src/ai_agents.rs +++ b/src-tauri/src/ai_agents.rs @@ -12,19 +12,14 @@ pub enum AiAgentId { Pi, } -#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)] #[serde(rename_all = "snake_case")] pub enum AiAgentPermissionMode { + #[default] Safe, PowerUser, } -impl Default for AiAgentPermissionMode { - fn default() -> Self { - Self::Safe - } -} - #[derive(Debug, Clone, Serialize)] pub struct AiAgentAvailability { pub installed: bool, diff --git a/src-tauri/src/opencode_cli.rs b/src-tauri/src/opencode_cli.rs index 176aea3f..b22b43fd 100644 --- a/src-tauri/src/opencode_cli.rs +++ b/src-tauri/src/opencode_cli.rs @@ -30,7 +30,7 @@ fn run_agent_stream_with_binary( where F: FnMut(AiAgentStreamEvent), { - let mut command = crate::opencode_config::build_command(&binary, &request)?; + let mut command = crate::opencode_config::build_command(binary, &request)?; let mut child = command .spawn() .map_err(|error| format!("Failed to spawn opencode: {error}"))?; diff --git a/src-tauri/src/opencode_events_tests.rs b/src-tauri/src/opencode_events_tests.rs index 520bad67..c2633028 100644 --- a/src-tauri/src/opencode_events_tests.rs +++ b/src-tauri/src/opencode_events_tests.rs @@ -41,13 +41,9 @@ fn assert_tool_pair(events: &[AiAgentStreamEvent], expected: ToolExpectation<'_> fn parse_line_reports_read_errors_and_skips_blank_or_invalid_lines() { let mut events = Vec::new(); - let read_error = parse_line( - Err(std::io::Error::new( - std::io::ErrorKind::Other, - "broken pipe", - )), - &mut |event| events.push(event), - ); + let read_error = parse_line(Err(std::io::Error::other("broken pipe")), &mut |event| { + events.push(event) + }); let blank = parse_line(Ok(" ".into()), &mut |event| events.push(event)); let invalid = parse_line(Ok("not json".into()), &mut |event| events.push(event)); diff --git a/src-tauri/src/pi_cli.rs b/src-tauri/src/pi_cli.rs index 9f13df13..2b83a86c 100644 --- a/src-tauri/src/pi_cli.rs +++ b/src-tauri/src/pi_cli.rs @@ -34,7 +34,7 @@ where .prefix("tolaria-pi-agent-") .tempdir() .map_err(|error| format!("Failed to create Pi config directory: {error}"))?; - let mut command = crate::pi_config::build_command(&binary, &request, agent_dir.path())?; + let mut command = crate::pi_config::build_command(binary, &request, agent_dir.path())?; let mut child = command .spawn() .map_err(|error| format!("Failed to spawn pi: {error}"))?; diff --git a/src-tauri/src/pi_events_tests.rs b/src-tauri/src/pi_events_tests.rs index 6a12fc56..c84faec8 100644 --- a/src-tauri/src/pi_events_tests.rs +++ b/src-tauri/src/pi_events_tests.rs @@ -4,13 +4,9 @@ use super::*; fn parse_line_reports_read_errors_and_skips_blank_or_invalid_lines() { let mut events = Vec::new(); - let read_error = parse_line( - Err(std::io::Error::new( - std::io::ErrorKind::Other, - "broken pipe", - )), - &mut |event| events.push(event), - ); + let read_error = parse_line(Err(std::io::Error::other("broken pipe")), &mut |event| { + events.push(event) + }); let blank = parse_line(Ok(" ".into()), &mut |event| events.push(event)); let invalid = parse_line(Ok("not json".into()), &mut |event| events.push(event));