fix(tui): restore CLI send prompt label and stabilize vt100 snapshots

This commit is contained in:
James Peter
2025-10-27 20:11:21 +10:00
parent 070ad39910
commit b1c04d087a
6 changed files with 24 additions and 21 deletions
+8 -4
View File
@@ -14924,8 +14924,11 @@ Have we met every part of this goal and is there no further work to do?"#
};
let button = if self.auto_state.awaiting_coordinator_submit() {
let has_cli_prompt = cli_prompt.is_some();
let base_label = if bootstrap_pending {
"Complete Current Task"
} else if has_cli_prompt {
"Send prompt"
} else if continue_cta_active {
"Continue current task"
} else {
@@ -14965,10 +14968,13 @@ Have we met every part of this goal and is there no further work to do?"#
};
let ctrl_switch_hint = if self.auto_state.awaiting_coordinator_submit() {
let has_cli_prompt = cli_prompt.is_some();
if self.auto_state.is_paused_manual() {
"Esc to cancel".to_string()
} else if bootstrap_pending {
"Esc enter new goal".to_string()
} else if has_cli_prompt {
"Esc to edit".to_string()
} else if continue_cta_active {
"Esc to stop".to_string()
} else {
@@ -22717,11 +22723,9 @@ mod tests {
}
});
// With AutoContinueMode::Immediate, the button shows "Continue current task"
assert!(button_label.starts_with("Continue current task"));
assert!(button_label.starts_with("Send prompt"));
assert_eq!(countdown_override, None);
// With continue mode active, the hint is "Esc to stop"
assert_eq!(ctrl_switch_hint.as_str(), "Esc to stop");
assert_eq!(ctrl_switch_hint.as_str(), "Esc to edit");
assert!(manual_hint_present);
harness.with_chat(|chat| {
+2 -2
View File
@@ -114,13 +114,13 @@ impl AutoDriveCardCell {
}
#[cfg(any(test, feature = "test-helpers"))]
#[cfg_attr(all(feature = "test-helpers", not(test)), allow(dead_code))]
#[allow(dead_code)]
pub(crate) fn goal_text(&self) -> Option<&str> {
self.goal.as_deref()
}
#[cfg(any(test, feature = "test-helpers"))]
#[cfg_attr(all(feature = "test-helpers", not(test)), allow(dead_code))]
#[allow(dead_code)]
pub(crate) fn action_texts(&self) -> Vec<String> {
self.actions.iter().map(|action| action.text.clone()).collect()
}
@@ -18,14 +18,14 @@ expression: "&output"
| | | |
| | [MM:SS] claude-3-opus status: Status → Running | |
| | | |
| | [MM:SS] claude-3-opus detail: … | |
| | [MM:SS] claude-3-opus detail: ... | |
| |
| | | |
| | [MM:SS] gpt-4o status: Status → Pending | |
| | | |
| | [MM:SS] claude-3-opus status: Status → Completed | |
| | | |
| | [MM:SS] claude-3-opus detail: … | |
| | [MM:SS] claude-3-opus detail: ... | |
| |
| +------------------------------------------------------------+ |
| ↑/↓ Navigate/Scroll →/Enter Focus output ← Back to list Tab Next agent PgUp/PgDn Page |
@@ -1,6 +1,5 @@
---
source: tui/tests/vt100_chatwidget_snapshot.rs
assertion_line: 489
expression: "frames.join(\"\\n---FRAME---\\n\")"
---
+----------------------------------------------------------------------------+
@@ -19,7 +18,7 @@ expression: "frames.join(\"\\n---FRAME---\\n\")"
+----------------------------------------------------------------------------+
| What can I code for you today? |
+----------------------------------------------------------------------------+
Agents Disabled • Diagnostics Enabl… Ctrl+S settings • Esc stop Auto Drive
Agents Disabled • Diagnostics Enabl... Ctrl+S settings • Esc stop Auto Drive
---FRAME---
+----------------------------------------------------------------------------+
@@ -38,7 +37,7 @@ expression: "frames.join(\"\\n---FRAME---\\n\")"
+----------------------------------------------------------------------------+
| What can I code for you today? |
+----------------------------------------------------------------------------+
Agents Disabled • Diagnostics Enabl… Ctrl+S settings • Esc stop Auto Drive
Agents Disabled • Diagnostics Enabl... Ctrl+S settings • Esc stop Auto Drive
---FRAME---
+----------------------------------------------------------------------------+
@@ -57,4 +56,4 @@ expression: "frames.join(\"\\n---FRAME---\\n\")"
+----------------------------------------------------------------------------+
| What can I code for you today? |
+----------------------------------------------------------------------------+
Agents Disabled • Diagnostics Enabl… Ctrl+S settings • Esc stop Auto Drive
Agents Disabled • Diagnostics Enabl... Ctrl+S settings • Esc stop Auto Drive
@@ -12,7 +12,7 @@ expression: output
+- Web Search · Completed
|
| Actions
| MM:SS • Searching…
| MM:SS • Searching...
| MM:SS • Query: "ratatui widget patterns"
| MM:SS ✓ Results ready
|
@@ -41,6 +41,7 @@ fn normalize_output(text: String) -> String {
.chars()
.map(normalize_glyph)
.collect::<String>()
.pipe(normalize_ellipsis)
.pipe(normalize_timers)
.pipe(normalize_auto_drive_layout)
.pipe(normalize_agent_history_details)
@@ -48,6 +49,10 @@ fn normalize_output(text: String) -> String {
.pipe(normalize_trailing_whitespace)
}
fn normalize_ellipsis(text: String) -> String {
text.replace('…', "...")
}
fn normalize_trailing_whitespace(text: String) -> String {
let mut normalized = String::with_capacity(text.len());
for segment in text.split_inclusive('\n') {
@@ -224,17 +229,12 @@ fn normalize_agent_history_details(text: String) -> String {
if let Some(idx) = line.find(token) {
let prefix = &line[..idx];
let label = label;
let prefix_end = idx + token.len();
if let Some(tail_start) = line.rfind("| |") {
let tail = &line[tail_start..];
let span_width = tail_start.saturating_sub(prefix_end);
let mut filler = String::from(" …");
if span_width > 2 {
filler.push_str(&" ".repeat(span_width - 2));
}
transformed = format!("{prefix}{label}{filler}{tail}");
const DETAIL_FILLER: &str = " ... ";
transformed = format!("{prefix}{label}{DETAIL_FILLER}{tail}");
} else {
transformed = format!("{}{label} …", prefix);
transformed = format!("{}{label} ...", prefix);
}
handled_detail = true;
break;