Use agent name as prompt in --agent --chat mode (e.g., "butler>")

Changed run_interactive() parameter from bool to Option<&str> agent_name.
When agent_name is Some, use it as the prompt instead of "g3>".
This commit is contained in:
Dhanji R. Prasanna
2026-01-16 13:58:45 +05:30
parent 2e6bef4b24
commit 1f6a5671b2
4 changed files with 15 additions and 7 deletions

View File

@@ -300,7 +300,7 @@ async fn handle_command(
chat_combined_content, chat_combined_content,
workspace_dir, workspace_dir,
cli.new_session, cli.new_session,
false, // from_agent_mode None, // agent_name (not in agent mode)
) )
.await?; .await?;

View File

@@ -268,7 +268,7 @@ pub async fn run_agent_mode(
combined_content, combined_content,
&workspace_dir, &workspace_dir,
new_session, new_session,
true, // from_agent_mode - skip session resume and verbose welcome Some(agent_name), // agent name for prompt (e.g., "butler>")
) )
.await; .await;
} }

View File

@@ -16,7 +16,8 @@ use crate::task_execution::execute_task_with_retry;
use crate::utils::display_context_progress; use crate::utils::display_context_progress;
/// Run interactive mode with console output. /// Run interactive mode with console output.
/// If `from_agent_mode` is true, skip session resume and verbose welcome (agent_mode already printed context info). /// If `agent_name` is Some, we're in agent+chat mode: skip session resume/verbose welcome,
/// and use the agent name as the prompt (e.g., "butler>").
pub async fn run_interactive<W: UiWriter>( pub async fn run_interactive<W: UiWriter>(
mut agent: Agent<W>, mut agent: Agent<W>,
show_prompt: bool, show_prompt: bool,
@@ -24,9 +25,10 @@ pub async fn run_interactive<W: UiWriter>(
combined_content: Option<String>, combined_content: Option<String>,
workspace_path: &Path, workspace_path: &Path,
new_session: bool, new_session: bool,
from_agent_mode: bool, agent_name: Option<&str>,
) -> Result<()> { ) -> Result<()> {
let output = SimpleOutput::new(); let output = SimpleOutput::new();
let from_agent_mode = agent_name.is_some();
// Check for session continuation (skip if --new-session was passed or coming from agent mode) // Check for session continuation (skip if --new-session was passed or coming from agent mode)
// Agent mode with --chat should start fresh without prompting // Agent mode with --chat should start fresh without prompting
@@ -167,9 +169,15 @@ pub async fn run_interactive<W: UiWriter>(
display_context_progress(&agent, &output); display_context_progress(&agent, &output);
// Adjust prompt based on whether we're in multi-line mode // Adjust prompt based on whether we're in multi-line mode
let prompt = if in_multiline { "... > " } else { "g3> " }; let prompt = if in_multiline {
"... > ".to_string()
} else if let Some(name) = agent_name {
format!("{}> ", name)
} else {
"g3> ".to_string()
};
let readline = rl.readline(prompt); let readline = rl.readline(&prompt);
match readline { match readline {
Ok(line) => { Ok(line) => {
let trimmed = line.trim_end(); let trimmed = line.trim_end();

View File

@@ -218,7 +218,7 @@ async fn run_console_mode(
combined_content, combined_content,
project.workspace(), project.workspace(),
cli.new_session, cli.new_session,
false, // from_agent_mode None, // agent_name (not in agent mode)
) )
.await .await
} }