rename nudge to steer

This commit is contained in:
Charles Cunningham
2026-03-02 16:14:31 -08:00
parent 5a548d14b1
commit 85321ce850
6 changed files with 76 additions and 76 deletions
+4 -4
View File
@@ -172,7 +172,7 @@ pub(crate) struct BottomPane {
/// When a status row exists, this summary is mirrored inline in that row;
/// when no status row exists, it renders as its own footer row.
unified_exec_footer: UnifiedExecFooter,
/// Preview of pending nudges and queued drafts shown above the composer.
/// Preview of pending steers and queued drafts shown above the composer.
pending_input_preview: PendingInputPreview,
/// Inactive threads with pending approval requests.
pending_thread_approvals: PendingThreadApprovals,
@@ -773,9 +773,9 @@ impl BottomPane {
pub(crate) fn set_pending_input_preview(
&mut self,
queued: Vec<String>,
pending_nudges: Vec<String>,
pending_steers: Vec<String>,
) {
self.pending_input_preview.pending_nudges = pending_nudges;
self.pending_input_preview.pending_steers = pending_steers;
self.pending_input_preview.messages = queued;
self.request_redraw();
}
@@ -1020,7 +1020,7 @@ impl BottomPane {
}
let has_pending_thread_approvals = !self.pending_thread_approvals.is_empty();
let has_pending_input = !self.pending_input_preview.messages.is_empty()
|| !self.pending_input_preview.pending_nudges.is_empty();
|| !self.pending_input_preview.pending_steers.is_empty();
let has_status_or_footer =
self.status.is_some() || !self.unified_exec_footer.is_empty();
let has_inline_previews = has_pending_thread_approvals || has_pending_input;
@@ -10,15 +10,15 @@ use crate::render::renderable::Renderable;
use crate::wrapping::RtOptions;
use crate::wrapping::adaptive_wrap_lines;
/// Widget that displays pending nudges plus user messages queued while a turn is in progress.
/// Widget that displays pending steers plus user messages queued while a turn is in progress.
///
/// The widget shows pending nudges first, then queued user messages. It only
/// The widget shows pending steers first, then queued user messages. It only
/// shows the edit hint at the bottom (e.g. "⌥ + ↑ edit") when there are actual
/// queued user messages to pop back into the composer. Because some terminals
/// intercept certain modifier-key combinations, the displayed binding is
/// configurable via [`set_edit_binding`](Self::set_edit_binding).
pub(crate) struct PendingInputPreview {
pub pending_nudges: Vec<String>,
pub pending_steers: Vec<String>,
pub messages: Vec<String>,
/// Key combination rendered in the hint line. Defaults to Alt+Up but may
/// be overridden for terminals where that chord is unavailable.
@@ -28,7 +28,7 @@ pub(crate) struct PendingInputPreview {
impl PendingInputPreview {
pub(crate) fn new() -> Self {
Self {
pending_nudges: Vec::new(),
pending_steers: Vec::new(),
messages: Vec::new(),
edit_binding: key_hint::alt(KeyCode::Up),
}
@@ -42,17 +42,17 @@ impl PendingInputPreview {
}
fn as_renderable(&self, width: u16) -> Box<dyn Renderable> {
if (self.pending_nudges.is_empty() && self.messages.is_empty()) || width < 4 {
if (self.pending_steers.is_empty() && self.messages.is_empty()) || width < 4 {
return Box::new(());
}
let mut lines = vec![];
for nudge in &self.pending_nudges {
for steer in &self.pending_steers {
let wrapped = adaptive_wrap_lines(
nudge
steer
.lines()
.map(|line| format!("pending nudge: {line}").dim()),
.map(|line| format!("pending steer: {line}").dim()),
RtOptions::new(width as usize)
.initial_indent(Line::from(" ! ".dim()))
.subsequent_indent(Line::from(" ")),
@@ -227,22 +227,22 @@ mod tests {
}
#[test]
fn render_one_pending_nudge() {
fn render_one_pending_steer() {
let mut queue = PendingInputPreview::new();
queue.pending_nudges.push("Implement the plan.".to_string());
queue.pending_steers.push("Implement the plan.".to_string());
let width = 48;
let height = queue.desired_height(width);
let mut buf = Buffer::empty(Rect::new(0, 0, width, height));
queue.render(Rect::new(0, 0, width, height), &mut buf);
assert_snapshot!("render_one_pending_nudge", format!("{buf:?}"));
assert_snapshot!("render_one_pending_steer", format!("{buf:?}"));
}
#[test]
fn render_pending_nudges_above_queued_messages() {
fn render_pending_steers_above_queued_messages() {
let mut queue = PendingInputPreview::new();
queue.pending_nudges.push("Implement the plan.".to_string());
queue.pending_steers.push("Implement the plan.".to_string());
queue
.pending_nudges
.pending_steers
.push("Summarize the diff after the tool call.".to_string());
queue.messages.push("Queued follow-up question".to_string());
let width = 52;
@@ -250,7 +250,7 @@ mod tests {
let mut buf = Buffer::empty(Rect::new(0, 0, width, height));
queue.render(Rect::new(0, 0, width, height), &mut buf);
assert_snapshot!(
"render_pending_nudges_above_queued_messages",
"render_pending_steers_above_queued_messages",
format!("{buf:?}")
);
}
@@ -1,11 +1,11 @@
---
source: tui/src/bottom_pane/queued_user_messages.rs
source: tui/src/bottom_pane/pending_input_preview.rs
expression: "format!(\"{buf:?}\")"
---
Buffer {
area: Rect { x: 0, y: 0, width: 48, height: 1 },
content: [
" ! pending nudge: Implement the plan. ",
" ! pending steer: Implement the plan. ",
],
styles: [
x: 0, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
@@ -1,12 +1,12 @@
---
source: tui/src/bottom_pane/queued_user_messages.rs
source: tui/src/bottom_pane/pending_input_preview.rs
expression: "format!(\"{buf:?}\")"
---
Buffer {
area: Rect { x: 0, y: 0, width: 52, height: 5 },
content: [
" ! pending nudge: Implement the plan. ",
" ! pending nudge: Summarize the diff after the tool",
" ! pending steer: Implement the plan. ",
" ! pending steer: Summarize the diff after the tool",
" call. ",
" ↳ Queued follow-up question ",
" ⌥ + ↑ edit ",
+16 -16
View File
@@ -620,11 +620,11 @@ pub(crate) struct ChatWidget {
suppress_session_configured_redraw: bool,
// User messages queued while a turn is in progress
queued_user_messages: VecDeque<UserMessage>,
// Nudges already submitted to core but not yet committed into history.
// Steers already submitted to core but not yet committed into history.
//
// The bottom pane shows these above queued drafts until core records the
// corresponding user message and emits the matching raw response item.
pending_nudges: VecDeque<RenderedUserMessageEvent>,
pending_steers: VecDeque<RenderedUserMessageEvent>,
/// Terminal-appropriate keybinding for popping the most-recently queued
/// message back into the composer. Determined once at construction time via
/// [`queued_message_edit_binding_for_terminal`] and propagated to
@@ -2937,7 +2937,7 @@ impl ChatWidget {
thread_name: None,
forked_from: None,
queued_user_messages: VecDeque::new(),
pending_nudges: VecDeque::new(),
pending_steers: VecDeque::new(),
queued_message_edit_binding,
show_welcome_banner: is_first_run,
startup_tooltip_override,
@@ -3121,7 +3121,7 @@ impl ChatWidget {
plan_delta_buffer: String::new(),
plan_item_active: false,
queued_user_messages: VecDeque::new(),
pending_nudges: VecDeque::new(),
pending_steers: VecDeque::new(),
queued_message_edit_binding,
show_welcome_banner: is_first_run,
startup_tooltip_override,
@@ -3286,7 +3286,7 @@ impl ChatWidget {
thread_name: None,
forked_from: None,
queued_user_messages: VecDeque::new(),
pending_nudges: VecDeque::new(),
pending_steers: VecDeque::new(),
queued_message_edit_binding,
show_welcome_banner: false,
startup_tooltip_override: None,
@@ -3462,10 +3462,10 @@ impl ChatWidget {
else {
return;
};
let should_preview_as_pending_nudge = self.is_session_configured()
let should_preview_as_pending_steer = self.is_session_configured()
&& self.bottom_pane.is_task_running()
&& !self.is_review_mode;
if should_preview_as_pending_nudge {
if should_preview_as_pending_steer {
self.submit_user_message_internal(user_message, false);
} else if self.is_session_configured() {
// Submitted is only emitted when steer is enabled.
@@ -4252,7 +4252,7 @@ impl ChatWidget {
} else {
None
};
let pending_nudge =
let pending_steer =
(!render_in_history).then(|| Self::rendered_user_message_event_from_inputs(&items));
let personality = self
.config
@@ -4293,8 +4293,8 @@ impl ChatWidget {
});
}
if let Some(pending_nudge) = pending_nudge {
self.pending_nudges.push_back(pending_nudge);
if let Some(pending_steer) = pending_steer {
self.pending_steers.push_back(pending_steer);
self.refresh_pending_input_preview();
}
@@ -4558,8 +4558,8 @@ impl ChatWidget {
&& let EventMsg::UserMessage(user_message) = item.as_legacy_event()
{
let rendered = Self::rendered_user_message_event_from_event(&user_message);
let should_render = if self.pending_nudges.front() == Some(&rendered) {
self.pending_nudges.pop_front();
let should_render = if self.pending_steers.front() == Some(&rendered) {
self.pending_steers.pop_front();
self.refresh_pending_input_preview();
true
} else {
@@ -4783,13 +4783,13 @@ impl ChatWidget {
.iter()
.map(|m| m.text.clone())
.collect();
let pending_nudges: Vec<String> = self
.pending_nudges
let pending_steers: Vec<String> = self
.pending_steers
.iter()
.map(|nudge| nudge.message().to_string())
.map(|steer| steer.message().to_string())
.collect();
self.bottom_pane
.set_pending_input_preview(messages, pending_nudges);
.set_pending_input_preview(messages, pending_steers);
}
pub(crate) fn set_pending_thread_approvals(&mut self, threads: Vec<String>) {
+36 -36
View File
@@ -1709,7 +1709,7 @@ async fn make_chatwidget_manual(
show_welcome_banner: true,
startup_tooltip_override: None,
queued_user_messages: VecDeque::new(),
pending_nudges: VecDeque::new(),
pending_steers: VecDeque::new(),
queued_message_edit_binding: crate::key_hint::alt(KeyCode::Up),
suppress_session_configured_redraw: false,
pending_notification: None,
@@ -3470,7 +3470,7 @@ async fn unified_exec_begin_restores_working_status_snapshot() {
}
#[tokio::test]
async fn steer_enter_uses_pending_nudges_while_plan_stream_is_active() {
async fn steer_enter_uses_pending_steers_while_plan_stream_is_active() {
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
chat.thread_id = Some(ThreadId::new());
chat.set_feature_enabled(Feature::CollaborationModes, true);
@@ -3488,9 +3488,9 @@ async fn steer_enter_uses_pending_nudges_while_plan_stream_is_active() {
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Plan);
assert!(chat.queued_user_messages.is_empty());
assert_eq!(chat.pending_nudges.len(), 1);
assert_eq!(chat.pending_steers.len(), 1);
assert_eq!(
chat.pending_nudges.front().unwrap().message(),
chat.pending_steers.front().unwrap().message(),
"queued submission"
);
match next_submit_op(&mut op_rx) {
@@ -3507,14 +3507,14 @@ async fn steer_enter_uses_pending_nudges_while_plan_stream_is_active() {
chat.handle_codex_event(raw_user_message_event("queued submission"));
assert!(chat.pending_nudges.is_empty());
assert!(chat.pending_steers.is_empty());
let inserted = drain_insert_history(&mut rx);
assert_eq!(inserted.len(), 1);
assert!(lines_to_single_string(&inserted[0]).contains("queued submission"));
}
#[tokio::test]
async fn steer_enter_uses_pending_nudges_while_turn_is_running_without_streaming() {
async fn steer_enter_uses_pending_steers_while_turn_is_running_without_streaming() {
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
chat.thread_id = Some(ThreadId::new());
chat.on_task_started();
@@ -3524,9 +3524,9 @@ async fn steer_enter_uses_pending_nudges_while_turn_is_running_without_streaming
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
assert!(chat.queued_user_messages.is_empty());
assert_eq!(chat.pending_nudges.len(), 1);
assert_eq!(chat.pending_steers.len(), 1);
assert_eq!(
chat.pending_nudges.front().unwrap().message(),
chat.pending_steers.front().unwrap().message(),
"queued while running"
);
match next_submit_op(&mut op_rx) {
@@ -3537,14 +3537,14 @@ async fn steer_enter_uses_pending_nudges_while_turn_is_running_without_streaming
chat.handle_codex_event(raw_user_message_event("queued while running"));
assert!(chat.pending_nudges.is_empty());
assert!(chat.pending_steers.is_empty());
let inserted = drain_insert_history(&mut rx);
assert_eq!(inserted.len(), 1);
assert!(lines_to_single_string(&inserted[0]).contains("queued while running"));
}
#[tokio::test]
async fn steer_enter_uses_pending_nudges_while_final_answer_stream_is_active() {
async fn steer_enter_uses_pending_steers_while_final_answer_stream_is_active() {
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
chat.thread_id = Some(ThreadId::new());
chat.on_task_started();
@@ -3560,9 +3560,9 @@ async fn steer_enter_uses_pending_nudges_while_final_answer_stream_is_active() {
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
assert!(chat.queued_user_messages.is_empty());
assert_eq!(chat.pending_nudges.len(), 1);
assert_eq!(chat.pending_steers.len(), 1);
assert_eq!(
chat.pending_nudges.front().unwrap().message(),
chat.pending_steers.front().unwrap().message(),
"queued while streaming"
);
match next_submit_op(&mut op_rx) {
@@ -3573,14 +3573,14 @@ async fn steer_enter_uses_pending_nudges_while_final_answer_stream_is_active() {
chat.handle_codex_event(raw_user_message_event("queued while streaming"));
assert!(chat.pending_nudges.is_empty());
assert!(chat.pending_steers.is_empty());
let inserted = drain_insert_history(&mut rx);
assert_eq!(inserted.len(), 1);
assert!(lines_to_single_string(&inserted[0]).contains("queued while streaming"));
}
#[tokio::test]
async fn failed_pending_nudge_submit_does_not_add_pending_preview() {
async fn failed_pending_steer_submit_does_not_add_pending_preview() {
let (mut chat, mut rx, op_rx) = make_chatwidget_manual(None).await;
chat.thread_id = Some(ThreadId::new());
chat.on_task_started();
@@ -3593,13 +3593,13 @@ async fn failed_pending_nudge_submit_does_not_add_pending_preview() {
);
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
assert!(chat.pending_nudges.is_empty());
assert!(chat.pending_steers.is_empty());
assert!(chat.queued_user_messages.is_empty());
assert!(drain_insert_history(&mut rx).is_empty());
}
#[tokio::test]
async fn raw_response_item_with_canonicalized_user_payload_clears_pending_nudge() {
async fn raw_response_item_with_canonicalized_user_payload_clears_pending_steer() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
let items = vec![
UserInput::Text {
@@ -3611,7 +3611,7 @@ async fn raw_response_item_with_canonicalized_user_payload_clears_pending_nudge(
text_elements: vec![TextElement::new((1..6).into(), Some("world".to_string()))],
},
];
chat.pending_nudges
chat.pending_steers
.push_back(ChatWidget::rendered_user_message_event_from_inputs(&items));
chat.refresh_pending_input_preview();
@@ -3620,7 +3620,7 @@ async fn raw_response_item_with_canonicalized_user_payload_clears_pending_nudge(
items,
));
assert!(chat.pending_nudges.is_empty());
assert!(chat.pending_steers.is_empty());
let inserted = drain_insert_history(&mut rx);
assert_eq!(inserted.len(), 1);
assert!(lines_to_single_string(&inserted[0]).contains("hello world"));
@@ -3670,16 +3670,16 @@ async fn live_legacy_agent_message_after_item_completed_does_not_duplicate_assis
}
#[tokio::test]
async fn raw_response_item_only_pops_front_pending_nudge() {
async fn raw_response_item_only_pops_front_pending_steer() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
chat.pending_nudges
chat.pending_steers
.push_back(ChatWidget::rendered_user_message_event_from_inputs(&[
UserInput::Text {
text: "first".to_string(),
text_elements: Vec::new(),
},
]));
chat.pending_nudges
chat.pending_steers
.push_back(ChatWidget::rendered_user_message_event_from_inputs(&[
UserInput::Text {
text: "second".to_string(),
@@ -3690,16 +3690,16 @@ async fn raw_response_item_only_pops_front_pending_nudge() {
chat.handle_codex_event(raw_user_message_event("other"));
assert_eq!(chat.pending_nudges.len(), 2);
assert_eq!(chat.pending_nudges.front().unwrap().message(), "first");
assert_eq!(chat.pending_steers.len(), 2);
assert_eq!(chat.pending_steers.front().unwrap().message(), "first");
let inserted = drain_insert_history(&mut rx);
assert_eq!(inserted.len(), 1);
assert!(lines_to_single_string(&inserted[0]).contains("other"));
chat.handle_codex_event(raw_user_message_event("first"));
assert_eq!(chat.pending_nudges.len(), 1);
assert_eq!(chat.pending_nudges.front().unwrap().message(), "second");
assert_eq!(chat.pending_steers.len(), 1);
assert_eq!(chat.pending_steers.front().unwrap().message(), "second");
let inserted = drain_insert_history(&mut rx);
assert_eq!(inserted.len(), 1);
assert!(lines_to_single_string(&inserted[0]).contains("first"));
@@ -3722,13 +3722,13 @@ async fn steer_enter_during_final_stream_preserves_follow_up_prompts_in_order()
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
assert!(chat.queued_user_messages.is_empty());
assert_eq!(chat.pending_nudges.len(), 2);
assert_eq!(chat.pending_steers.len(), 2);
assert_eq!(
chat.pending_nudges.front().unwrap().message(),
chat.pending_steers.front().unwrap().message(),
"first follow-up"
);
assert_eq!(
chat.pending_nudges.back().unwrap().message(),
chat.pending_steers.back().unwrap().message(),
"second follow-up"
);
@@ -3758,9 +3758,9 @@ async fn steer_enter_during_final_stream_preserves_follow_up_prompts_in_order()
chat.handle_codex_event(raw_user_message_event("first follow-up"));
assert_eq!(chat.pending_nudges.len(), 1);
assert_eq!(chat.pending_steers.len(), 1);
assert_eq!(
chat.pending_nudges.front().unwrap().message(),
chat.pending_steers.front().unwrap().message(),
"second follow-up"
);
let first_insert = drain_insert_history(&mut rx);
@@ -3769,14 +3769,14 @@ async fn steer_enter_during_final_stream_preserves_follow_up_prompts_in_order()
chat.handle_codex_event(raw_user_message_event("second follow-up"));
assert!(chat.pending_nudges.is_empty());
assert!(chat.pending_steers.is_empty());
let second_insert = drain_insert_history(&mut rx);
assert_eq!(second_insert.len(), 1);
assert!(lines_to_single_string(&second_insert[0]).contains("second follow-up"));
}
#[tokio::test]
async fn manual_interrupt_keeps_pending_nudges_pending_until_core_commits_them() {
async fn manual_interrupt_keeps_pending_steers_pending_until_core_commits_them() {
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
chat.thread_id = Some(ThreadId::new());
chat.on_task_started();
@@ -3789,7 +3789,7 @@ async fn manual_interrupt_keeps_pending_nudges_pending_until_core_commits_them()
);
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
assert_eq!(chat.pending_nudges.len(), 1);
assert_eq!(chat.pending_steers.len(), 1);
match next_submit_op(&mut op_rx) {
Op::UserTurn { items, .. } => assert_eq!(
items,
@@ -3804,16 +3804,16 @@ async fn manual_interrupt_keeps_pending_nudges_pending_until_core_commits_them()
chat.on_interrupted_turn(TurnAbortReason::Interrupted);
assert_eq!(chat.pending_nudges.len(), 1);
assert_eq!(chat.pending_steers.len(), 1);
assert_eq!(
chat.pending_nudges.front().unwrap().message(),
chat.pending_steers.front().unwrap().message(),
"queued while streaming"
);
assert_no_submit_op(&mut op_rx);
chat.handle_codex_event(raw_user_message_event("queued while streaming"));
assert!(chat.pending_nudges.is_empty());
assert!(chat.pending_steers.is_empty());
let inserted = drain_insert_history(&mut rx);
assert_eq!(inserted.len(), 2);
assert!(lines_to_single_string(&inserted[1]).contains("queued while streaming"));