diff --git a/crates/mcp-servers/src/coding/tools/bash/mod.rs b/crates/mcp-servers/src/coding/tools/bash/mod.rs index 23b54c0a0..8c917bf5e 100644 --- a/crates/mcp-servers/src/coding/tools/bash/mod.rs +++ b/crates/mcp-servers/src/coding/tools/bash/mod.rs @@ -118,7 +118,7 @@ pub async fn execute_command( process_group.kill(); let _ = tokio::time::timeout(Duration::from_secs(5), &mut child_task).await; let display_meta = ToolDisplayMeta::new( - "Run command", + "Ran", format!("{} (exit -1, timed out)", truncate(&args.command, 40)), ); return Ok(BashOutput { @@ -145,8 +145,7 @@ pub async fn execute_command( let stdout = String::from_utf8_lossy(&output.stdout); let stderr = String::from_utf8_lossy(&output.stderr); let exit_code = output.status.code().unwrap_or(-1); - let display_meta = - ToolDisplayMeta::new("Run command", format!("{} (exit {exit_code})", truncate(&args.command, 40))); + let display_meta = ToolDisplayMeta::new("Ran", format!("{} (exit {exit_code})", truncate(&args.command, 40))); Ok(BashOutput { output: format!("{stdout}{stderr}"), exit_code, killed: false, meta: Some(display_meta.into()) }) } diff --git a/crates/wisp/src/conversation/tool_view.rs b/crates/wisp/src/conversation/tool_view.rs index 286525be3..0b6dbf581 100644 --- a/crates/wisp/src/conversation/tool_view.rs +++ b/crates/wisp/src/conversation/tool_view.rs @@ -164,7 +164,7 @@ fn tool_line( if let Some(command_lines) = &command_lines && let Some(first) = command_lines.first() { - line.push_span(Span::styled(" ", Style::new().bg(theme.background))); + line.push_span(Span::raw(" ")); line.spans.extend(styled_code_line(first.clone(), theme).spans); } line.spans.extend(suffix); @@ -186,9 +186,6 @@ fn tool_line( } fn styled_code_line(mut line: Line<'static>, theme: &Theme) -> Line<'static> { - line.style = line.style.patch(Style::new().fg(theme.code_fg).bg(theme.code_bg)); - for span in &mut line.spans { - span.style = span.style.patch(Style::new().bg(theme.code_bg)); - } + line.style = line.style.patch(Style::new().fg(theme.code_fg)); line } diff --git a/crates/wisp/tests/tui/conversation.rs b/crates/wisp/tests/tui/conversation.rs index 22b47eadb..61999086b 100644 --- a/crates/wisp/tests/tui/conversation.rs +++ b/crates/wisp/tests/tui/conversation.rs @@ -471,12 +471,12 @@ fn completed_bash_tool_renders_the_command_with_shell_syntax_highlighting() { assert!(text.contains(&format!("Bash {command}")), "command should share the tool row: {text:?}"); let command_start = u16::try_from(text[..text.find(command).expect("command position")].width()).unwrap(); let gap = conversation.cell((conversation.area.left() + command_start - 1, row)).expect("gap before command"); - assert_eq!(gap.bg, ui.app().theme().background, "the gap should use the normal background"); + assert_eq!(gap.bg, Color::Reset, "the gap should not set a background"); let cells = (command_start..command_start + u16::try_from(command.width()).unwrap()) .filter_map(|offset| conversation.cell((conversation.area.left() + offset, row))) .filter(|cell| cell.symbol() != " ") .collect::>(); - assert!(cells.iter().all(|cell| cell.bg == ui.app().theme().code_bg), "command should use the code background"); + assert!(cells.iter().all(|cell| cell.bg == Color::Reset), "command should sit on the terminal background"); let keyword = cells.iter().find(|cell| cell.symbol() == "i").expect("if keyword"); let variable = cells.iter().find(|cell| cell.symbol() == "$").expect("shell variable"); assert_ne!(keyword.fg, variable.fg, "shell keywords and variables should use distinct token colors"); @@ -500,7 +500,7 @@ fn bash_tool_keeps_highlighting_after_title_and_display_metadata_updates() { ui.acp_event(session_update(acp::SessionUpdate::ToolCallUpdate( acp::ToolCallUpdate::new( "bash-1".to_string(), - acp::ToolCallUpdateFields::new().title("Run command").status(acp::ToolCallStatus::Completed), + acp::ToolCallUpdateFields::new().title("Ran").status(acp::ToolCallStatus::Completed), ) .meta(update_meta), ))); @@ -509,11 +509,11 @@ fn bash_tool_keeps_highlighting_after_title_and_display_metadata_updates() { let viewport = ui.viewport_text(); assert!( - viewport.contains("Run command cargo test (exit 0)"), - "result and command should share the tool row: {viewport}" + viewport.contains("Ran cargo test (exit 0)") && !viewport.contains("Run command"), + "a finished bash call should read as completed: {viewport}" ); assert_eq!(viewport.matches(command).count(), 1, "the command should render exactly once: {viewport}"); - assert!(has_cell(&ui.conversation(), "c", |cell| cell.bg == ui.app().theme().code_bg)); + assert!(!has_cell(&ui.conversation(), "c", |cell| cell.bg == ui.app().theme().code_bg)); } #[test] diff --git a/crates/wisp/tests/tui/subagents.rs b/crates/wisp/tests/tui/subagents.rs index fbce67ddc..d86fecb8b 100644 --- a/crates/wisp/tests/tui/subagents.rs +++ b/crates/wisp/tests/tui/subagents.rs @@ -179,12 +179,12 @@ fn completed_sub_agent_bash_tool_renders_a_highlighted_command() { assert!(text.contains(&format!("bash {command}")), "command should share the tool row: {text:?}"); let command_start = u16::try_from(text[..text.find(command).expect("command position")].width()).unwrap(); let gap = conversation.cell((conversation.area.left() + command_start - 1, row)).expect("gap before command"); - assert_eq!(gap.bg, ui.app().theme().background, "the gap should use the normal background"); + assert_eq!(gap.bg, Color::Reset, "the gap should not set a background"); let cells = (command_start..command_start + u16::try_from(command.width()).unwrap()) .filter_map(|offset| conversation.cell((conversation.area.left() + offset, row))) .filter(|cell| cell.symbol() != " ") .collect::>(); - assert!(cells.iter().all(|cell| cell.bg == ui.app().theme().code_bg), "command should use the code background"); + assert!(cells.iter().all(|cell| cell.bg == Color::Reset), "command should sit on the terminal background"); let keyword = cells.iter().find(|cell| cell.symbol() == "i").expect("if keyword"); let variable = cells.iter().find(|cell| cell.symbol() == "$").expect("shell variable"); assert_ne!(keyword.fg, variable.fg, "shell keywords and variables should use distinct token colors");