Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 10 additions & 35 deletions crates/chat-cli/src/cli/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ fn trust_all_text() -> String {
ui_text::trust_all_warning()
}

const TOOL_BULLET: &str = " ";
const TOOL_BULLET: &str = "- ";
const CONTINUATION_LINE: &str = " ⋮ ";
const PURPOSE_ARROW: &str = " ↳ ";
const SUCCESS_TICK: &str = " ✓ ";
const ERROR_EXCLAMATION: &str = " ❗ ";
const DELEGATE_NOTIFIER: &str = "[BACKGROUND TASK READY]";
Expand Down Expand Up @@ -1906,19 +1905,19 @@ impl ChatSession {
self.stderr,
StyledText::secondary_fg(),
style::Print("\nAllow this action? Use '"),
StyledText::success_fg(),
StyledText::current_item_fg(),
style::Print("t"),
StyledText::secondary_fg(),
style::Print("' to trust (always allow) this tool for the session. ["),
StyledText::success_fg(),
StyledText::current_item_fg(),
style::Print("y"),
StyledText::secondary_fg(),
style::Print("/"),
StyledText::success_fg(),
StyledText::current_item_fg(),
style::Print("n"),
StyledText::secondary_fg(),
style::Print("/"),
StyledText::success_fg(),
StyledText::current_item_fg(),
style::Print("t"),
StyledText::secondary_fg(),
style::Print("]:\n\n"),
Expand Down Expand Up @@ -2496,12 +2495,8 @@ impl ChatSession {
debug!("tool result output: {:#?}", result);
execute!(
self.stdout,
style::Print(CONTINUATION_LINE),
style::Print(format!(" - Completed in {tool_time}s")),
style::Print("\n"),
StyledText::success_fg(),
style::SetAttribute(Attribute::Bold),
style::Print(format!(" ● Completed in {tool_time}s")),
StyledText::reset(),
)?;
if let Some(tag) = checkpoint_tag {
execute!(
Expand Down Expand Up @@ -3386,35 +3381,15 @@ impl ChatSession {
parent_message_id: None,
};
self.stdout.send(Event::ToolCallStart(tool_call_start))?;
} else {
} else if let Tool::Custom(ref tool) = tool_use.tool {
queue!(
self.stdout,
StyledText::reset(),
style::Print(" from mcp server "),
StyledText::emphasis_fg(),
style::Print(format!(
"🛠️ Using tool: {}{}",
tool_use.tool.display_name(),
if trusted { " (trusted)".dark_green() } else { "".reset() }
)),
style::Print(&tool.server_name),
StyledText::reset(),
)?;
if let Tool::Custom(ref tool) = tool_use.tool {
queue!(
self.stdout,
StyledText::reset(),
style::Print(" from mcp server "),
StyledText::emphasis_fg(),
style::Print(&tool.server_name),
StyledText::reset(),
)?;
}

execute!(
self.stdout,
style::Print("\n"),
style::Print(CONTINUATION_LINE),
style::Print("\n"),
style::Print(TOOL_BULLET)
)?;
}

tool_use
Expand Down
16 changes: 8 additions & 8 deletions crates/chat-cli/src/cli/chat/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ fn bulleted_item<'a, 'b>(
return Err(ErrMode::from_error_kind(i, ErrorKind::Fail));
}

let ws = (space0, alt(("-", "*")), space1).parse_next(i)?.0;
let print = format!("{ws} ");
let (ws, bullet_char, _) = (space0, alt(("-", "*")), space1).parse_next(i)?;
let print = format!("{ws}{bullet_char} ");

queue_newline_or_advance(&mut o, state, print.width())?;
queue(&mut o, style::Print(print))
Expand Down Expand Up @@ -296,7 +296,7 @@ fn code<'a, 'b>(
let out = code.replace("&amp;", "&").replace("&gt;", ">").replace("&lt;", "<");

queue_newline_or_advance(&mut o, state, out.width())?;
queue(&mut o, StyledText::success_fg())?;
queue(&mut o, StyledText::brand_fg())?;
queue(&mut o, style::Print(out))?;
queue(&mut o, StyledText::reset())
}
Expand Down Expand Up @@ -572,7 +572,7 @@ fn codeblock_begin<'a, 'b>(
queue(&mut o, style::Print(format!("{language}\n").bold()))?;
}

queue(&mut o, StyledText::success_fg())?;
queue(&mut o, StyledText::brand_fg())?;

Ok(())
}
Expand Down Expand Up @@ -709,12 +709,12 @@ mod tests {
style::SetAttribute(Attribute::Bold),
style::Print("java\n"),
StyledText::reset_attributes(),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print("hello world!"),
StyledText::reset(),
]);
validate!(code_1, "`print`", [
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print("print"),
StyledText::reset(),
]);
Expand Down Expand Up @@ -756,8 +756,8 @@ mod tests {
style::SetAttribute(Attribute::Bold),
style::Print("# Hello World"),
]);
validate!(bulleted_item_1, "- bullet", [style::Print(" bullet")]);
validate!(bulleted_item_2, "* bullet", [style::Print(" bullet")]);
validate!(bulleted_item_1, "- bullet", [style::Print("- bullet")]);
validate!(bulleted_item_2, "* bullet", [style::Print("* bullet")]);
validate!(numbered_item_1, "1. number", [style::Print("1. number")]);
validate!(blockquote_1, "> hello", [
StyledText::secondary_fg(),
Expand Down
21 changes: 10 additions & 11 deletions crates/chat-cli/src/cli/chat/tools/execute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,24 +158,23 @@ impl ExecuteCommand {
}

pub fn queue_description(&self, output: &mut impl Write) -> Result<()> {
queue!(output, style::Print("I will run the following shell command: "),)?;

// TODO: Could use graphemes for a better heuristic
if self.command.len() > 20 {
queue!(output, style::Print("\n"),)?;
}

queue!(output, style::Print("I will run the following command: "),)?;
queue!(
output,
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(&self.command),
style::Print("\n"),
StyledText::reset(),
style::Print("\n"),
)?;

// Add the summary if available
// Add the summary as purpose if available on a separate line
if let Some(ref summary) = self.summary {
super::display_purpose(Some(summary), output)?;
queue!(
output,
style::Print("Purpose: "),
style::Print(summary),
style::Print("\n"),
)?;
}

queue!(output, style::Print("\n"))?;
Expand Down
36 changes: 17 additions & 19 deletions crates/chat-cli/src/cli/chat/tools/fs_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl FsRead {
queue!(
updates,
style::Print("Batch fs_read operation with "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(self.operations.len()),
StyledText::reset(),
style::Print(" operations:\n")
Expand Down Expand Up @@ -425,7 +425,7 @@ impl FsImage {
queue!(
updates,
style::Print("Reading images: "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(&self.image_paths.join("\n")),
style::Print("\n"),
StyledText::reset(),
Expand Down Expand Up @@ -466,7 +466,7 @@ impl FsLine {
queue!(
updates,
style::Print("Reading file: "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(&self.path),
StyledText::reset(),
style::Print(", "),
Expand All @@ -479,19 +479,19 @@ impl FsLine {
_ if end == line_count => Ok(queue!(
updates,
style::Print("from line "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(start),
StyledText::reset(),
style::Print(" to end of file"),
)?),
_ => Ok(queue!(
updates,
style::Print("from line "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(start),
StyledText::reset(),
style::Print(" to "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(end),
StyledText::reset(),
)?),
Expand Down Expand Up @@ -595,11 +595,11 @@ impl FsSearch {
queue!(
updates,
style::Print("Searching: "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(&self.path),
StyledText::reset(),
style::Print(" for pattern: "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(&self.pattern.to_lowercase()),
StyledText::reset(),
)?;
Expand Down Expand Up @@ -691,7 +691,7 @@ impl FsDirectory {
queue!(
updates,
style::Print("Reading directory: "),
StyledText::success_fg(),
StyledText::brand_fg(),
style::Print(&self.path),
StyledText::reset(),
style::Print(" "),
Expand Down Expand Up @@ -784,16 +784,14 @@ impl FsDirectory {
);
}

super::queue_function_result(
&format!(
"Successfully read directory {} ({} entries)",
&path.display(),
file_count
),
updates,
false,
false,
)?;
// Format the message with brand color for the path
let formatted_message = format!(
"Successfully read directory {} ({} entries)",
StyledText::brand(&path.display().to_string()),
file_count
);

super::queue_function_result(&formatted_message, updates, false, false)?;

Ok(InvokeOutput {
output: OutputKind::Text(result),
Expand Down
Loading
Loading