From f41381651c298f8d81faa91fe516fc88b6aae3d4 Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Thu, 1 May 2025 17:00:35 -0700 Subject: [PATCH 01/11] add hooks in /context --- crates/q_chat/src/lib.rs | 131 +++++++++++++++++++++++++-------------- 1 file changed, 85 insertions(+), 46 deletions(-) diff --git a/crates/q_chat/src/lib.rs b/crates/q_chat/src/lib.rs index d96d352a20..2c51ebd76a 100644 --- a/crates/q_chat/src/lib.rs +++ b/crates/q_chat/src/lib.rs @@ -1643,6 +1643,9 @@ impl ChatContext { if let Some(context_manager) = &mut self.conversation_state.context_manager { match subcommand { command::ContextSubcommand::Show { expand } => { + fn map_chat_error(e: ErrReport) -> ChatError { + ChatError::Custom(e.to_string().into()) + } // Display global context execute!( self.output, @@ -1682,6 +1685,26 @@ impl ChatContext { } } + queue!( + self.output, + style::SetAttribute(Attribute::Bold), + style::SetForegroundColor(Color::DarkYellow), + style::Print("\n 🔧 Hooks:\n") + )?; + Self::print_hook_section( + &mut self.output, + &context_manager.global_config.hooks, + HookTrigger::ConversationStart, + ) + .map_err(map_chat_error)?; + + Self::print_hook_section( + &mut self.output, + &context_manager.global_config.hooks, + HookTrigger::PerPrompt, + ) + .map_err(map_chat_error)?; + // Display profile context execute!( self.output, @@ -1721,6 +1744,26 @@ impl ChatContext { execute!(self.output, style::Print("\n"))?; } + queue!( + self.output, + style::SetAttribute(Attribute::Bold), + style::SetForegroundColor(Color::DarkYellow), + style::Print(" 🔧 Hooks:\n") + )?; + Self::print_hook_section( + &mut self.output, + &context_manager.profile_config.hooks, + HookTrigger::ConversationStart, + ) + .map_err(map_chat_error)?; + Self::print_hook_section( + &mut self.output, + &context_manager.profile_config.hooks, + HookTrigger::PerPrompt, + ) + .map_err(map_chat_error)?; + execute!(self.output, style::Print("\n"))?; + if global_context_files.is_empty() && profile_context_files.is_empty() { execute!( self.output, @@ -2049,48 +2092,6 @@ impl ChatContext { }, } } else { - fn print_hook_section( - output: &mut impl Write, - hooks: &HashMap, - trigger: HookTrigger, - ) -> Result<()> { - let section = match trigger { - HookTrigger::ConversationStart => "Conversation Start", - HookTrigger::PerPrompt => "Per Prompt", - }; - let hooks: Vec<(&String, &Hook)> = - hooks.iter().filter(|(_, h)| h.trigger == trigger).collect(); - - queue!( - output, - style::SetForegroundColor(Color::Cyan), - style::Print(format!(" {section}:\n")), - style::SetForegroundColor(Color::Reset), - )?; - - if hooks.is_empty() { - queue!( - output, - style::SetForegroundColor(Color::DarkGrey), - style::Print(" \n"), - style::SetForegroundColor(Color::Reset) - )?; - } else { - for (name, hook) in hooks { - if hook.disabled { - queue!( - output, - style::SetForegroundColor(Color::DarkGrey), - style::Print(format!(" {} (disabled)\n", name)), - style::SetForegroundColor(Color::Reset) - )?; - } else { - queue!(output, style::Print(format!(" {}\n", name)),)?; - } - } - } - Ok(()) - } queue!( self.output, style::SetAttribute(Attribute::Bold), @@ -2099,13 +2100,13 @@ impl ChatContext { style::SetAttribute(Attribute::Reset), )?; - print_hook_section( + Self::print_hook_section( &mut self.output, &context_manager.global_config.hooks, HookTrigger::ConversationStart, ) .map_err(map_chat_error)?; - print_hook_section( + Self::print_hook_section( &mut self.output, &context_manager.global_config.hooks, HookTrigger::PerPrompt, @@ -2120,13 +2121,13 @@ impl ChatContext { style::SetAttribute(Attribute::Reset), )?; - print_hook_section( + Self::print_hook_section( &mut self.output, &context_manager.profile_config.hooks, HookTrigger::ConversationStart, ) .map_err(map_chat_error)?; - print_hook_section( + Self::print_hook_section( &mut self.output, &context_manager.profile_config.hooks, HookTrigger::PerPrompt, @@ -2703,6 +2704,44 @@ impl ChatContext { }) } + fn print_hook_section(output: &mut impl Write, hooks: &HashMap, trigger: HookTrigger) -> Result<()> { + let section = match trigger { + HookTrigger::ConversationStart => "Conversation Start", + HookTrigger::PerPrompt => "Per Prompt", + }; + let hooks: Vec<(&String, &Hook)> = hooks.iter().filter(|(_, h)| h.trigger == trigger).collect(); + + queue!( + output, + style::SetForegroundColor(Color::Cyan), + style::Print(format!(" {section}:\n")), + style::SetForegroundColor(Color::Reset), + )?; + + if hooks.is_empty() { + queue!( + output, + style::SetForegroundColor(Color::DarkGrey), + style::Print(" \n"), + style::SetForegroundColor(Color::Reset) + )?; + } else { + for (name, hook) in hooks { + if hook.disabled { + queue!( + output, + style::SetForegroundColor(Color::DarkGrey), + style::Print(format!(" {} (disabled)\n", name)), + style::SetForegroundColor(Color::Reset) + )?; + } else { + queue!(output, style::Print(format!(" {}\n", name)),)?; + } + } + } + Ok(()) + } + async fn tool_use_execute(&mut self, mut tool_uses: Vec) -> Result { // Verify tools have permissions. for (index, tool) in tool_uses.iter_mut().enumerate() { From 5277b3d1bfccadabf057d876cd9108f8298bbb5a Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Thu, 1 May 2025 17:31:13 -0700 Subject: [PATCH 02/11] add summary in /context --- crates/q_chat/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/q_chat/src/lib.rs b/crates/q_chat/src/lib.rs index 2c51ebd76a..023d9fb677 100644 --- a/crates/q_chat/src/lib.rs +++ b/crates/q_chat/src/lib.rs @@ -1841,6 +1841,9 @@ impl ChatContext { style::Print(format!("\nTotal: ~{} tokens\n\n", total_tokens)), )?; + self.compact_history(Some(tool_uses.clone()), pending_tool_index, None, true, false) + .await?; + execute!(self.output, style::Print("\n"))?; } }, From 78fa9df0a6ce44f19f1b1d32c0b4fce22368a26c Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Fri, 2 May 2025 13:26:54 -0700 Subject: [PATCH 03/11] include in --expand --- crates/q_chat/src/lib.rs | 88 +++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 38 deletions(-) diff --git a/crates/q_chat/src/lib.rs b/crates/q_chat/src/lib.rs index 023d9fb677..a612d37345 100644 --- a/crates/q_chat/src/lib.rs +++ b/crates/q_chat/src/lib.rs @@ -1685,25 +1685,27 @@ impl ChatContext { } } - queue!( - self.output, - style::SetAttribute(Attribute::Bold), - style::SetForegroundColor(Color::DarkYellow), - style::Print("\n 🔧 Hooks:\n") - )?; - Self::print_hook_section( - &mut self.output, - &context_manager.global_config.hooks, - HookTrigger::ConversationStart, - ) - .map_err(map_chat_error)?; + if expand { + queue!( + self.output, + style::SetAttribute(Attribute::Bold), + style::SetForegroundColor(Color::DarkYellow), + style::Print("\n 🔧 Hooks:\n") + )?; + Self::print_hook_section( + &mut self.output, + &context_manager.global_config.hooks, + HookTrigger::ConversationStart, + ) + .map_err(map_chat_error)?; - Self::print_hook_section( - &mut self.output, - &context_manager.global_config.hooks, - HookTrigger::PerPrompt, - ) - .map_err(map_chat_error)?; + Self::print_hook_section( + &mut self.output, + &context_manager.global_config.hooks, + HookTrigger::PerPrompt, + ) + .map_err(map_chat_error)?; + } // Display profile context execute!( @@ -1744,25 +1746,27 @@ impl ChatContext { execute!(self.output, style::Print("\n"))?; } - queue!( - self.output, - style::SetAttribute(Attribute::Bold), - style::SetForegroundColor(Color::DarkYellow), - style::Print(" 🔧 Hooks:\n") - )?; - Self::print_hook_section( - &mut self.output, - &context_manager.profile_config.hooks, - HookTrigger::ConversationStart, - ) - .map_err(map_chat_error)?; - Self::print_hook_section( - &mut self.output, - &context_manager.profile_config.hooks, - HookTrigger::PerPrompt, - ) - .map_err(map_chat_error)?; - execute!(self.output, style::Print("\n"))?; + if expand { + queue!( + self.output, + style::SetAttribute(Attribute::Bold), + style::SetForegroundColor(Color::DarkYellow), + style::Print(" 🔧 Hooks:\n") + )?; + Self::print_hook_section( + &mut self.output, + &context_manager.profile_config.hooks, + HookTrigger::ConversationStart, + ) + .map_err(map_chat_error)?; + Self::print_hook_section( + &mut self.output, + &context_manager.profile_config.hooks, + HookTrigger::PerPrompt, + ) + .map_err(map_chat_error)?; + execute!(self.output, style::Print("\n"))?; + } if global_context_files.is_empty() && profile_context_files.is_empty() { execute!( @@ -1841,8 +1845,16 @@ impl ChatContext { style::Print(format!("\nTotal: ~{} tokens\n\n", total_tokens)), )?; - self.compact_history(Some(tool_uses.clone()), pending_tool_index, None, true, false) + if expand { + self.compact_history( + Some(tool_uses.clone()), + pending_tool_index, + None, + true, + false, + ) .await?; + } execute!(self.output, style::Print("\n"))?; } From da2a89f34ba20362a13a19999468fdbbbfa8d32b Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Fri, 2 May 2025 15:42:04 -0700 Subject: [PATCH 04/11] update /context show --expand words --- crates/q_chat/src/command.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/q_chat/src/command.rs b/crates/q_chat/src/command.rs index 43d07f1169..59b0253449 100644 --- a/crates/q_chat/src/command.rs +++ b/crates/q_chat/src/command.rs @@ -180,7 +180,8 @@ impl ContextSubcommand { help Show an explanation for the context command show [--expand] Display the context rule configuration and matched files - --expand: Print out each matched file's content + --expand: Print out each matched file's content, + along with the conversation summaries and hook configurations add [--global] [--force] <> Add context rules (filenames or glob patterns) From cf0d810293e87cffc65417820cf0e4ce40bbadba Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Mon, 5 May 2025 13:47:33 -0700 Subject: [PATCH 05/11] show available summary instead regenerate it --- crates/q_chat/src/conversation_state.rs | 4 +++ crates/q_chat/src/lib.rs | 39 ++++++++++++++++++++----- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/crates/q_chat/src/conversation_state.rs b/crates/q_chat/src/conversation_state.rs index e3ab5f17a5..07fb199d9e 100644 --- a/crates/q_chat/src/conversation_state.rs +++ b/crates/q_chat/src/conversation_state.rs @@ -135,6 +135,10 @@ impl ConversationState { } } + pub fn latest_summary(&self) -> Option<&str> { + self.latest_summary.as_deref() + } + pub fn history(&self) -> &VecDeque<(UserMessage, AssistantMessage)> { &self.history } diff --git a/crates/q_chat/src/lib.rs b/crates/q_chat/src/lib.rs index a612d37345..83bcabadf2 100644 --- a/crates/q_chat/src/lib.rs +++ b/crates/q_chat/src/lib.rs @@ -1846,14 +1846,37 @@ impl ChatContext { )?; if expand { - self.compact_history( - Some(tool_uses.clone()), - pending_tool_index, - None, - true, - false, - ) - .await?; + let existing_summary = + self.conversation_state.latest_summary().map(|s| s.to_owned()); + if let Some(summary) = existing_summary { + // Add a border around the summary for better visual separation + let terminal_width = self.terminal_width(); + let border = "═".repeat(terminal_width.min(80)); + execute!( + self.output, + style::Print("\n"), + style::SetForegroundColor(Color::Cyan), + style::Print(&border), + style::Print("\n"), + style::SetAttribute(Attribute::Bold), + style::Print(" CONVERSATION SUMMARY"), + style::Print("\n"), + style::Print(&border), + style::SetAttribute(Attribute::Reset), + style::Print("\n\n"), + style::Print(&summary), + style::Print("\n\n") + )?; + } else { + self.compact_history( + Some(tool_uses.clone()), + pending_tool_index, + None, + true, + false, + ) + .await?; + } } execute!(self.output, style::Print("\n"))?; From c2d8cb1220fa1a68b40289cba03589c6e1743146 Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Mon, 5 May 2025 13:47:55 -0700 Subject: [PATCH 06/11] rename hooks --- crates/q_chat/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/q_chat/src/lib.rs b/crates/q_chat/src/lib.rs index 83bcabadf2..010251fa6d 100644 --- a/crates/q_chat/src/lib.rs +++ b/crates/q_chat/src/lib.rs @@ -2744,8 +2744,8 @@ impl ChatContext { fn print_hook_section(output: &mut impl Write, hooks: &HashMap, trigger: HookTrigger) -> Result<()> { let section = match trigger { - HookTrigger::ConversationStart => "Conversation Start", - HookTrigger::PerPrompt => "Per Prompt", + HookTrigger::ConversationStart => "On Session Start", + HookTrigger::PerPrompt => "Per User Message", }; let hooks: Vec<(&String, &Hook)> = hooks.iter().filter(|(_, h)| h.trigger == trigger).collect(); From dcedc5aa42b144fc260758451522ed4c4e79cb4e Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Mon, 5 May 2025 14:22:36 -0700 Subject: [PATCH 07/11] revise --- crates/q_chat/src/command.rs | 4 ++-- crates/q_chat/src/lib.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/q_chat/src/command.rs b/crates/q_chat/src/command.rs index 59b0253449..8a0261e3b4 100644 --- a/crates/q_chat/src/command.rs +++ b/crates/q_chat/src/command.rs @@ -180,8 +180,8 @@ impl ContextSubcommand { help Show an explanation for the context command show [--expand] Display the context rule configuration and matched files - --expand: Print out each matched file's content, - along with the conversation summaries and hook configurations + --expand: Print out each matched file's content, hook + configurations and last conversation summary add [--global] [--force] <> Add context rules (filenames or glob patterns) diff --git a/crates/q_chat/src/lib.rs b/crates/q_chat/src/lib.rs index 010251fa6d..66c4316aff 100644 --- a/crates/q_chat/src/lib.rs +++ b/crates/q_chat/src/lib.rs @@ -1845,13 +1845,12 @@ impl ChatContext { style::Print(format!("\nTotal: ~{} tokens\n\n", total_tokens)), )?; + // Show last cached conversation summary if available, otherwise regenerate it if expand { - let existing_summary = - self.conversation_state.latest_summary().map(|s| s.to_owned()); - if let Some(summary) = existing_summary { - // Add a border around the summary for better visual separation - let terminal_width = self.terminal_width(); - let border = "═".repeat(terminal_width.min(80)); + if let Some(summary) = + self.conversation_state.latest_summary().map(|s| s.to_owned()) + { + let border = "═".repeat(self.terminal_width().min(80)); execute!( self.output, style::Print("\n"), @@ -2742,6 +2741,7 @@ impl ChatContext { }) } + // Prints hook configuration grouped by trigger: conversation sesiion start or per user message fn print_hook_section(output: &mut impl Write, hooks: &HashMap, trigger: HookTrigger) -> Result<()> { let section = match trigger { HookTrigger::ConversationStart => "On Session Start", From 3a96cec309472a41ca0e18c76bdb1237388195e7 Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Wed, 7 May 2025 13:53:54 -0700 Subject: [PATCH 08/11] cr --- crates/chat-cli/src/cli/chat/mod.rs | 148 +++++++++++++--------------- 1 file changed, 68 insertions(+), 80 deletions(-) diff --git a/crates/chat-cli/src/cli/chat/mod.rs b/crates/chat-cli/src/cli/chat/mod.rs index 064d5e18eb..bd5c930917 100644 --- a/crates/chat-cli/src/cli/chat/mod.rs +++ b/crates/chat-cli/src/cli/chat/mod.rs @@ -1621,14 +1621,14 @@ impl ChatContext { style::SetForegroundColor(Color::DarkYellow), style::Print("\n 🔧 Hooks:\n") )?; - Self::print_hook_section( + print_hook_section( &mut self.output, &context_manager.global_config.hooks, HookTrigger::ConversationStart, ) .map_err(map_chat_error)?; - Self::print_hook_section( + print_hook_section( &mut self.output, &context_manager.global_config.hooks, HookTrigger::PerPrompt, @@ -1682,13 +1682,13 @@ impl ChatContext { style::SetForegroundColor(Color::DarkYellow), style::Print(" 🔧 Hooks:\n") )?; - Self::print_hook_section( + print_hook_section( &mut self.output, &context_manager.profile_config.hooks, HookTrigger::ConversationStart, ) .map_err(map_chat_error)?; - Self::print_hook_section( + print_hook_section( &mut self.output, &context_manager.profile_config.hooks, HookTrigger::PerPrompt, @@ -1773,42 +1773,30 @@ impl ChatContext { self.output, style::Print(format!("\nTotal: ~{} tokens\n\n", total_tokens)), )?; + } - // Show last cached conversation summary if available, otherwise regenerate it - if expand { - if let Some(summary) = - self.conversation_state.latest_summary().map(|s| s.to_owned()) - { - let border = "═".repeat(self.terminal_width().min(80)); - execute!( - self.output, - style::Print("\n"), - style::SetForegroundColor(Color::Cyan), - style::Print(&border), - style::Print("\n"), - style::SetAttribute(Attribute::Bold), - style::Print(" CONVERSATION SUMMARY"), - style::Print("\n"), - style::Print(&border), - style::SetAttribute(Attribute::Reset), - style::Print("\n\n"), - style::Print(&summary), - style::Print("\n\n") - )?; - } else { - self.compact_history( - Some(tool_uses.clone()), - pending_tool_index, - None, - true, - false, - ) - .await?; - } + // Show last cached conversation summary if available, otherwise regenerate it + if expand { + if let Some(summary) = self.conversation_state.latest_summary().map(|s| s.to_owned()) { + let border = "═".repeat(self.terminal_width().min(80)); + execute!( + self.output, + style::Print("\n"), + style::SetForegroundColor(Color::Cyan), + style::Print(&border), + style::Print("\n"), + style::SetAttribute(Attribute::Bold), + style::Print(" CONVERSATION SUMMARY"), + style::Print("\n"), + style::Print(&border), + style::SetAttribute(Attribute::Reset), + style::Print("\n\n"), + style::Print(&summary), + style::Print("\n\n") + )?; } - - execute!(self.output, style::Print("\n"))?; } + execute!(self.output, style::Print("\n"))?; }, command::ContextSubcommand::Add { global, force, paths } => { match context_manager.add_paths(paths.clone(), global, force).await { @@ -2066,13 +2054,13 @@ impl ChatContext { style::SetAttribute(Attribute::Reset), )?; - Self::print_hook_section( + print_hook_section( &mut self.output, &context_manager.global_config.hooks, HookTrigger::ConversationStart, ) .map_err(map_chat_error)?; - Self::print_hook_section( + print_hook_section( &mut self.output, &context_manager.global_config.hooks, HookTrigger::PerPrompt, @@ -2087,13 +2075,13 @@ impl ChatContext { style::SetAttribute(Attribute::Reset), )?; - Self::print_hook_section( + print_hook_section( &mut self.output, &context_manager.profile_config.hooks, HookTrigger::ConversationStart, ) .map_err(map_chat_error)?; - Self::print_hook_section( + print_hook_section( &mut self.output, &context_manager.profile_config.hooks, HookTrigger::PerPrompt, @@ -2670,45 +2658,6 @@ impl ChatContext { }) } - // Prints hook configuration grouped by trigger: conversation sesiion start or per user message - fn print_hook_section(output: &mut impl Write, hooks: &HashMap, trigger: HookTrigger) -> Result<()> { - let section = match trigger { - HookTrigger::ConversationStart => "On Session Start", - HookTrigger::PerPrompt => "Per User Message", - }; - let hooks: Vec<(&String, &Hook)> = hooks.iter().filter(|(_, h)| h.trigger == trigger).collect(); - - queue!( - output, - style::SetForegroundColor(Color::Cyan), - style::Print(format!(" {section}:\n")), - style::SetForegroundColor(Color::Reset), - )?; - - if hooks.is_empty() { - queue!( - output, - style::SetForegroundColor(Color::DarkGrey), - style::Print(" \n"), - style::SetForegroundColor(Color::Reset) - )?; - } else { - for (name, hook) in hooks { - if hook.disabled { - queue!( - output, - style::SetForegroundColor(Color::DarkGrey), - style::Print(format!(" {} (disabled)\n", name)), - style::SetForegroundColor(Color::Reset) - )?; - } else { - queue!(output, style::Print(format!(" {}\n", name)),)?; - } - } - } - Ok(()) - } - async fn tool_use_execute(&mut self, mut tool_uses: Vec) -> Result { // Verify tools have permissions. for (index, tool) in tool_uses.iter_mut().enumerate() { @@ -3329,6 +3278,45 @@ impl ChatContext { } } +/// Prints hook configuration grouped by trigger: conversation sesiion start or per user message +fn print_hook_section(output: &mut impl Write, hooks: &HashMap, trigger: HookTrigger) -> Result<()> { + let section = match trigger { + HookTrigger::ConversationStart => "On Session Start", + HookTrigger::PerPrompt => "Per User Message", + }; + let hooks: Vec<(&String, &Hook)> = hooks.iter().filter(|(_, h)| h.trigger == trigger).collect(); + + queue!( + output, + style::SetForegroundColor(Color::Cyan), + style::Print(format!(" {section}:\n")), + style::SetForegroundColor(Color::Reset), + )?; + + if hooks.is_empty() { + queue!( + output, + style::SetForegroundColor(Color::DarkGrey), + style::Print(" \n"), + style::SetForegroundColor(Color::Reset) + )?; + } else { + for (name, hook) in hooks { + if hook.disabled { + queue!( + output, + style::SetForegroundColor(Color::DarkGrey), + style::Print(format!(" {} (disabled)\n", name)), + style::SetForegroundColor(Color::Reset) + )?; + } else { + queue!(output, style::Print(format!(" {}\n", name)),)?; + } + } + } + Ok(()) +} + #[derive(Debug)] struct ToolUseEventBuilder { pub conversation_id: String, From 922b4d41b33f30e3dac17bb7c020caab7936ac70 Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Wed, 7 May 2025 14:03:38 -0700 Subject: [PATCH 09/11] fmt --- crates/chat-cli/src/cli/chat/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/chat-cli/src/cli/chat/mod.rs b/crates/chat-cli/src/cli/chat/mod.rs index bd5c930917..fb4c16c6de 100644 --- a/crates/chat-cli/src/cli/chat/mod.rs +++ b/crates/chat-cli/src/cli/chat/mod.rs @@ -1773,6 +1773,8 @@ impl ChatContext { self.output, style::Print(format!("\nTotal: ~{} tokens\n\n", total_tokens)), )?; + + execute!(self.output, style::Print("\n"))?; } // Show last cached conversation summary if available, otherwise regenerate it @@ -1792,11 +1794,10 @@ impl ChatContext { style::SetAttribute(Attribute::Reset), style::Print("\n\n"), style::Print(&summary), - style::Print("\n\n") + style::Print("\n\n\n") )?; } } - execute!(self.output, style::Print("\n"))?; }, command::ContextSubcommand::Add { global, force, paths } => { match context_manager.add_paths(paths.clone(), global, force).await { From 7939d193ba6689889d527b29667bd3e22c1f43c0 Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Wed, 7 May 2025 14:09:08 -0700 Subject: [PATCH 10/11] cr --- crates/chat-cli/src/cli/chat/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/chat-cli/src/cli/chat/mod.rs b/crates/chat-cli/src/cli/chat/mod.rs index fb4c16c6de..25224a2b07 100644 --- a/crates/chat-cli/src/cli/chat/mod.rs +++ b/crates/chat-cli/src/cli/chat/mod.rs @@ -1779,7 +1779,7 @@ impl ChatContext { // Show last cached conversation summary if available, otherwise regenerate it if expand { - if let Some(summary) = self.conversation_state.latest_summary().map(|s| s.to_owned()) { + if let Some(summary) = self.conversation_state.latest_summary() { let border = "═".repeat(self.terminal_width().min(80)); execute!( self.output, From 2ed035f612699e001799b0664bb7bc848feacbe7 Mon Sep 17 00:00:00 2001 From: YIFAN LIU Date: Wed, 7 May 2025 14:11:08 -0700 Subject: [PATCH 11/11] fix typo --- crates/chat-cli/src/cli/chat/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/chat-cli/src/cli/chat/mod.rs b/crates/chat-cli/src/cli/chat/mod.rs index 25224a2b07..b63e793432 100644 --- a/crates/chat-cli/src/cli/chat/mod.rs +++ b/crates/chat-cli/src/cli/chat/mod.rs @@ -3279,7 +3279,7 @@ impl ChatContext { } } -/// Prints hook configuration grouped by trigger: conversation sesiion start or per user message +/// Prints hook configuration grouped by trigger: conversation session start or per user message fn print_hook_section(output: &mut impl Write, hooks: &HashMap, trigger: HookTrigger) -> Result<()> { let section = match trigger { HookTrigger::ConversationStart => "On Session Start",