Compress session continuation prompt to single line
- Combine session info and resume prompt on one line - Show result inline after user input (y/n) - Green '... resuming ... [done]' on successful resume - Dark grey '... starting fresh' when declining - Yellow '... failed: <error>' on restore failure
This commit is contained in:
@@ -34,13 +34,14 @@ pub async fn run_interactive<W: UiWriter>(
|
|||||||
// Agent mode with --chat should start fresh without prompting
|
// Agent mode with --chat should start fresh without prompting
|
||||||
if !new_session && !from_agent_mode {
|
if !new_session && !from_agent_mode {
|
||||||
if let Ok(Some(continuation)) = g3_core::load_continuation() {
|
if let Ok(Some(continuation)) = g3_core::load_continuation() {
|
||||||
output.print("");
|
// Print session info and prompt on same line (no newline)
|
||||||
output.print(&format!(
|
print!(
|
||||||
" >> session in progress: {} | {:.1}% used",
|
"\n >> session in progress: {} | {:.1}% used | resume? [y/n] ",
|
||||||
&continuation.session_id[..continuation.session_id.len().min(20)],
|
&continuation.session_id[..continuation.session_id.len().min(20)],
|
||||||
continuation.context_percentage
|
continuation.context_percentage
|
||||||
));
|
);
|
||||||
output.print(" > resume? [Y/n] ");
|
use std::io::Write;
|
||||||
|
std::io::stdout().flush()?;
|
||||||
|
|
||||||
// Read user input
|
// Read user input
|
||||||
let mut input = String::new();
|
let mut input = String::new();
|
||||||
@@ -51,24 +52,23 @@ pub async fn run_interactive<W: UiWriter>(
|
|||||||
// Resume the session
|
// Resume the session
|
||||||
match agent.restore_from_continuation(&continuation) {
|
match agent.restore_from_continuation(&continuation) {
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
output.print("✅ Full context restored from previous session");
|
// Print bold green [done]
|
||||||
|
println!("{}... resuming ... [done]{}", SetForegroundColor(Color::Green), ResetColor);
|
||||||
}
|
}
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
output.print("✅ Session resumed with summary (context was > 80%)");
|
println!("{}... resuming ... [done]{}", SetForegroundColor(Color::Green), ResetColor);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
output.print(&format!("⚠️ Could not restore session: {}", e));
|
println!("{}... failed: {}{}", SetForegroundColor(Color::Yellow), e, ResetColor);
|
||||||
output.print("Starting fresh session instead.");
|
|
||||||
// Clear the invalid continuation
|
// Clear the invalid continuation
|
||||||
let _ = g3_core::clear_continuation();
|
let _ = g3_core::clear_continuation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// User declined, clear the continuation
|
// User declined, clear the continuation
|
||||||
output.print("🧹 Starting fresh session...");
|
println!("{}... starting fresh{}", SetForegroundColor(Color::DarkGrey), ResetColor);
|
||||||
let _ = g3_core::clear_continuation();
|
let _ = g3_core::clear_continuation();
|
||||||
}
|
}
|
||||||
output.print("");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user