diff --git a/apps/maple-agent/README.md b/apps/maple-agent/README.md index 92200354a..397945a4e 100644 --- a/apps/maple-agent/README.md +++ b/apps/maple-agent/README.md @@ -134,12 +134,14 @@ agent runtime; its desktop Agent page points users to Maple Work. are settings. - The composer spell checks as you type; right-click a word for suggestions or to add it to your dictionary. -- Message queue: Enter during a run queues the message for the next turn, - Ctrl+Enter (Cmd+Enter) steers it into the current turn. The composer has - one button. It is Send, and it becomes Stop while a run is active and the - field is empty. Typing or attaching an image turns it back into Send, and - that click queues. Queued messages can be sent now, edited in the composer - (the message keeps its place in the queue), or removed. +- Message queue: Enter during a run queues the message for the next turn by + default. Settings → General → Steer messages into active runs makes Enter + and Send steer new messages instead; this viewing-computer preference also + applies to remote tasks. Ctrl+Enter (Cmd+Enter) always steers. The composer + has one button. It is Send, and it becomes Stop while a run is active and + the field is empty. Typing or attaching an image turns it back into Send. + Queued messages can be sent now, edited in the composer (ordinary submission + keeps the message's place in the queue), or removed. - Sidebar search filters tasks and projects by name; Escape clears it. - Up and Down in an empty composer recall prompts sent in this window. - Optional composer-only Vim editing provides Normal, Insert, and characterwise diff --git a/apps/maple-agent/app/locales/de/app.ftl b/apps/maple-agent/app/locales/de/app.ftl index fc7f2049f..0b8acca8e 100644 --- a/apps/maple-agent/app/locales/de/app.ftl +++ b/apps/maple-agent/app/locales/de/app.ftl @@ -31,6 +31,8 @@ settings-reduce-motion = Bewegung reduzieren settings-reduce-motion-description = Ladeanzeigen und pulsierende Punkte anhalten und Einblendanimationen überspringen. settings-tool-summaries = Werkzeugaufrufe zusammenfassen settings-tool-summaries-description = Abgeschlossene Werkzeugaufrufe mit langer Ausgabe erhalten eine einzeilige Zusammenfassung auf ihren Karten. +settings-steer-active-run-messages = Nachrichten in aktive Durchläufe steuern +settings-steer-active-run-messages-description = Während eine Aufgabe arbeitet, neue Nachrichten mit Eingabetaste oder Senden in den aktuellen Durchlauf steuern, statt sie für den nächsten Durchlauf einzureihen. settings-composer-vim = Vim-Modus im Eingabefeld settings-composer-vim-description = Normal-, Einfüge- und visuellen Modus im Haupteingabefeld des Chats verwenden. Andere Textfelder bleiben unverändert. settings-application-vim = Vim-Navigation in der gesamten App @@ -1518,6 +1520,7 @@ chat-shrink-composer = Eingabefeld verkleinern chat-expand-composer = Eingabefeld vergrößern chat-stop-run = Ausführung stoppen chat-queue-next-turn = Für nächsten Durchlauf einreihen +chat-steer-current-run = In aktuellen Durchlauf steuern chat-send = Senden chat-model = Modell # The model panel's sections and the badge on a popular model. diff --git a/apps/maple-agent/app/locales/en/app.ftl b/apps/maple-agent/app/locales/en/app.ftl index 84e7d79af..8ad1cd329 100644 --- a/apps/maple-agent/app/locales/en/app.ftl +++ b/apps/maple-agent/app/locales/en/app.ftl @@ -31,6 +31,8 @@ settings-reduce-motion = Reduce motion settings-reduce-motion-description = Hold spinners and pulsing dots still and skip reveal animations. settings-tool-summaries = Summarize tool calls settings-tool-summaries-description = Completed tool calls with long output get a one-line summary on their cards. +settings-steer-active-run-messages = Steer messages into active runs +settings-steer-active-run-messages-description = While a task is working, Enter and Send steer new messages into the current turn instead of queueing them for the next turn. settings-composer-vim = Vim mode in composer settings-composer-vim-description = Use Normal, Insert, and Visual editing modes in the main chat composer. Other text fields stay unchanged. settings-application-vim = Vim navigation across the app @@ -1518,6 +1520,7 @@ chat-shrink-composer = Shrink composer chat-expand-composer = Expand composer chat-stop-run = Stop the run chat-queue-next-turn = Queue for next turn +chat-steer-current-run = Steer into current run chat-send = Send chat-model = Model # The model panel's sections and the badge on a popular model. diff --git a/apps/maple-agent/app/locales/es/app.ftl b/apps/maple-agent/app/locales/es/app.ftl index b7069016e..15a28a154 100644 --- a/apps/maple-agent/app/locales/es/app.ftl +++ b/apps/maple-agent/app/locales/es/app.ftl @@ -32,6 +32,8 @@ settings-reduce-motion = Reducir el movimiento settings-reduce-motion-description = Mantiene estáticos los indicadores de carga y los puntos intermitentes, y omite las animaciones de aparición. settings-tool-summaries = Resumir las llamadas a herramientas settings-tool-summaries-description = Las llamadas a herramientas completadas con resultados largos muestran un resumen de una línea en sus tarjetas. +settings-steer-active-run-messages = Dirigir mensajes a turnos activos +settings-steer-active-run-messages-description = Mientras una tarea está trabajando, Intro y Enviar dirigen los mensajes nuevos al turno actual en lugar de ponerlos en cola para el siguiente turno. settings-composer-vim = Modo Vim en el cuadro de mensaje settings-composer-vim-description = Usa los modos Normal, Insertar y Visual en el cuadro de mensaje principal del chat. Los demás campos de texto no cambian. settings-application-vim = Navegación Vim en toda la aplicación @@ -1413,6 +1415,7 @@ chat-shrink-composer = Reducir cuadro de mensaje chat-expand-composer = Expandir cuadro de mensaje chat-stop-run = Detener ejecución chat-queue-next-turn = Poner en cola para el siguiente turno +chat-steer-current-run = Dirigir al turno actual chat-send = Enviar chat-model = Modelo chat-model-group-capable = Más capaces diff --git a/apps/maple-agent/app/locales/ko/app.ftl b/apps/maple-agent/app/locales/ko/app.ftl index 27e9dc52b..d5bf73448 100644 --- a/apps/maple-agent/app/locales/ko/app.ftl +++ b/apps/maple-agent/app/locales/ko/app.ftl @@ -31,6 +31,8 @@ settings-reduce-motion = 동작 줄이기 settings-reduce-motion-description = 스피너와 깜박이는 점을 멈추고 표시 애니메이션을 생략해요. settings-tool-summaries = 도구 호출 요약 settings-tool-summaries-description = 출력이 긴 완료된 도구 호출은 카드에 한 줄 요약이 표시돼요. +settings-steer-active-run-messages = 실행 중인 턴에 메시지 바로 전달 +settings-steer-active-run-messages-description = 작업이 진행 중일 때 새 메시지를 다음 턴 대기열에 넣지 않고 현재 턴에 바로 전달해요. settings-composer-vim = 메시지 입력창에서 Vim 모드 사용 settings-composer-vim-description = 기본 채팅 메시지 입력창에서 Normal, Insert, Visual 편집 모드를 사용해요. 다른 텍스트 필드는 바뀌지 않아요. settings-application-vim = 앱 전체에서 Vim 탐색 사용 @@ -1467,6 +1469,7 @@ chat-shrink-composer = 메시지 입력창 축소 chat-expand-composer = 메시지 입력창 확대 chat-stop-run = 실행 중지 chat-queue-next-turn = 다음 턴 대기열에 추가 +chat-steer-current-run = 현재 턴에 바로 전달 chat-send = 보내기 chat-model = 모델 # The model panel's sections and the badge on a popular model. diff --git a/apps/maple-agent/app/src/settings.rs b/apps/maple-agent/app/src/settings.rs index b8a99964c..89300bd6f 100644 --- a/apps/maple-agent/app/src/settings.rs +++ b/apps/maple-agent/app/src/settings.rs @@ -87,6 +87,9 @@ pub struct AppSettings { /// Whether completed tool calls get a one-line model summary. #[serde(default = "default_tool_summaries")] pub tool_summaries: bool, + /// Send new messages into an active run instead of queueing them. + #[serde(default)] + pub steer_active_run_messages: bool, /// Enable modal Vim editing only in the main chat composer. #[serde(default)] pub composer_vim_enabled: bool, @@ -296,6 +299,7 @@ impl Default for AppSettings { tool_details: default_tool_details(), new_task_permission_mode: None, tool_summaries: default_tool_summaries(), + steer_active_run_messages: false, composer_vim_enabled: false, application_vim_enabled: false, shortcut_overrides: std::collections::BTreeMap::new(), @@ -1273,6 +1277,28 @@ mod tests { assert!(!settings.composer_vim_enabled); } + #[test] + fn active_run_steering_defaults_to_queue_and_round_trips_through_the_host() { + let settings: AppSettings = serde_json::from_value(serde_json::json!({})).unwrap(); + assert!(!settings.steer_active_run_messages); + + let root = tempfile::tempdir().unwrap(); + let store = + maple_agent::store::Store::open(maple_agent::store::StorePaths::new(root.path())) + .unwrap(); + apply_host_patch( + &store, + None, + &serde_json::json!({"steer_active_run_messages": true}), + ) + .unwrap(); + assert!( + load_host_settings(&store, None) + .unwrap() + .steer_active_run_messages + ); + } + #[test] fn existing_settings_files_default_application_vim_to_off() { let mut json = serde_json::to_value(AppSettings::default()).expect("serialize"); diff --git a/apps/maple-agent/app/src/ui/chat/composer.rs b/apps/maple-agent/app/src/ui/chat/composer.rs index 33c1304e7..d8bf6f6f9 100644 --- a/apps/maple-agent/app/src/ui/chat/composer.rs +++ b/apps/maple-agent/app/src/ui/chat/composer.rs @@ -1438,7 +1438,7 @@ impl ChatScreen { let can_send = !disabled && attachments_ready && (has_text || has_attachments); // One control. Stop only while a run is active and nothing is // waiting to send. Text, or an file that is still being prepared, - // turns it back into Send, which queues behind the run. + // turns it back into Send, which follows the active-run default. let drafting = has_text || has_attachments; let show_stop = running && !self.booting && !pending_create && !drafting; let usage_tray = self @@ -1756,7 +1756,11 @@ impl ChatScreen { let button_label: SharedString = if show_stop { tr("chat-stop-run") } else if running && drafting { - tr("chat-queue-next-turn") + if self.steer_active_run_messages && self.queue_edit.is_none() { + tr("chat-steer-current-run") + } else { + tr("chat-queue-next-turn") + } } else { tr("chat-send") }; diff --git a/apps/maple-agent/app/src/ui/chat/mod.rs b/apps/maple-agent/app/src/ui/chat/mod.rs index 565fa2bdd..0744987c4 100644 --- a/apps/maple-agent/app/src/ui/chat/mod.rs +++ b/apps/maple-agent/app/src/ui/chat/mod.rs @@ -564,6 +564,8 @@ pub struct ChatScreen { composer: Option>, /// Persisted opt-in for modal editing in this composer only. composer_vim_enabled: bool, + /// Whether new messages steer an active run rather than wait in its queue. + steer_active_run_messages: bool, /// Independent, persisted application-level Vim navigation profile. application_vim_enabled: bool, /// Stable-ID semantic selection and count state for application Vim. @@ -1562,6 +1564,7 @@ impl ChatScreen { context_limit: 0, composer: None, composer_vim_enabled: settings.composer_vim_enabled, + steer_active_run_messages: settings.steer_active_run_messages, application_vim_enabled: settings.application_vim_enabled, application_vim: ApplicationVimState::default(), application_focus: None, @@ -3503,6 +3506,7 @@ impl ChatScreen { self.apply_notification_settings(settings); self.summaries_enabled = settings.tool_summaries; self.composer_vim_enabled = settings.composer_vim_enabled; + self.steer_active_run_messages = settings.steer_active_run_messages; if let Some(composer) = self.composer.clone() { composer.update(cx, |input, cx| { input.set_vim_enabled(settings.composer_vim_enabled, cx) @@ -5456,7 +5460,11 @@ impl ChatScreen { model, context_limit, vision_capable, - steer: steer && (run_active || queue_id.is_some()), + // Only new messages follow the viewing computer's default. A + // queue edit keeps its place unless steering was explicit. The + // selected local or remote backend forwards this same request. + steer: (steer || (run_active && queue_id.is_none() && self.steer_active_run_messages)) + && (run_active || queue_id.is_some()), queue_id, attachments: Vec::new(), }; diff --git a/apps/maple-agent/app/src/ui/chat/upload_tests.rs b/apps/maple-agent/app/src/ui/chat/upload_tests.rs index 0bb9cc8ba..dee17b145 100644 --- a/apps/maple-agent/app/src/ui/chat/upload_tests.rs +++ b/apps/maple-agent/app/src/ui/chat/upload_tests.rs @@ -321,6 +321,51 @@ fn slow_upload_keeps_stop_queue_and_steer_operational(cx: &mut TestAppContext) { }); } +#[gpui::test] +fn steer_default_changes_only_new_active_run_messages(cx: &mut TestAppContext) { + let host = UploadHost::new(); + let (chat, cx) = chat_window(&host, cx); + chat.update(cx, |chat, _| chat.steer_active_run_messages = true); + + type_followup(&chat, cx, "steer by default", false); + wait_for(cx, "default steering admission", |_| { + host.requests("send_message").len() == 1 + }); + let steering = host.requests("send_message")[0].clone(); + assert_eq!(steering.params[1]["text"], "steer by default"); + assert_eq!(steering.params[1]["steer"], true); + assert_eq!(steering.params[1]["queueId"], Value::Null); + host.reply(&steering, Ok(json!("run-1"))); + wait_for(cx, "default steering acknowledgement", |cx| { + chat.update(cx, |chat, _| !chat.send_pending()) + }); + + // The preference is only for new messages. Ordinary submission of an + // existing queue edit retains its place, exactly as it does in Queue mode. + chat.update(cx, |chat, cx| { + chat.queue_edit = Some(QueueEdit { + queue_id: "q1".into(), + draft: "draft before editing".into(), + }); + chat.composer + .clone() + .unwrap() + .update(cx, |input, cx| input.set_text("edited queued message", cx)); + chat.send_inner(cx); + }); + wait_for(cx, "queue edit admission", |_| { + host.requests("send_message").len() == 2 + }); + let edited = host.requests("send_message")[1].clone(); + assert_eq!(edited.params[1]["text"], "edited queued message"); + assert_eq!(edited.params[1]["steer"], false); + assert_eq!(edited.params[1]["queueId"], "q1"); + host.reply(&edited, Ok(json!("run-1"))); + wait_for(cx, "queue edit acknowledgement", |cx| { + chat.update(cx, |chat, _| !chat.send_pending()) + }); +} + #[gpui::test] fn uploaded_prompt_waits_for_unknown_text_receipt_without_replaying_text(cx: &mut TestAppContext) { let host = UploadHost::new(); diff --git a/apps/maple-agent/app/src/ui/settings.rs b/apps/maple-agent/app/src/ui/settings.rs index a1b7e076d..24c3bad40 100644 --- a/apps/maple-agent/app/src/ui/settings.rs +++ b/apps/maple-agent/app/src/ui/settings.rs @@ -1563,6 +1563,14 @@ impl SettingsScreen { self.edit_setting(move |settings| settings.tool_summaries = next, cx); } + fn toggle_steer_active_run_messages(&mut self, cx: &mut Context) { + let next = !self.settings.steer_active_run_messages; + self.edit_setting( + move |settings| settings.steer_active_run_messages = next, + cx, + ); + } + fn toggle_composer_vim(&mut self, cx: &mut Context) { let next = !self.settings.composer_vim_enabled; self.edit_setting(move |settings| settings.composer_vim_enabled = next, cx); diff --git a/apps/maple-agent/app/src/ui/settings/general.rs b/apps/maple-agent/app/src/ui/settings/general.rs index 0157f5146..dc317b86e 100644 --- a/apps/maple-agent/app/src/ui/settings/general.rs +++ b/apps/maple-agent/app/src/ui/settings/general.rs @@ -16,6 +16,18 @@ impl SettingsScreen { ) .into_any_element(), ), + self.application_target( + || SettingsTarget::General(GeneralTarget::SteerActiveRunMessages), + localized_toggle_row( + "steer-active-run-messages", + &tr("settings-steer-active-run-messages"), + &tr("settings-steer-active-run-messages-description"), + self.settings.steer_active_run_messages, + cx.listener(|this, _event, _window, cx| { + this.toggle_steer_active_run_messages(cx); + }), + ), + ), ]; let notifications_rows = vec![ self.application_target( diff --git a/apps/maple-agent/app/src/ui/settings/navigation.rs b/apps/maple-agent/app/src/ui/settings/navigation.rs index cc680ca2d..e09ab772d 100644 --- a/apps/maple-agent/app/src/ui/settings/navigation.rs +++ b/apps/maple-agent/app/src/ui/settings/navigation.rs @@ -33,6 +33,7 @@ pub(super) enum SettingsRegion { #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub(super) enum GeneralTarget { Language, + SteerActiveRunMessages, Notifications, PasswordNotificationDetails, ComposerVim, @@ -196,6 +197,7 @@ impl SettingsScreen { match self.section { Section::General => [ GeneralTarget::Language, + GeneralTarget::SteerActiveRunMessages, GeneralTarget::Notifications, GeneralTarget::PasswordNotificationDetails, GeneralTarget::ComposerVim, @@ -553,6 +555,7 @@ impl SettingsScreen { fn activate_general_target(&mut self, target: GeneralTarget, cx: &mut Context) { match target { GeneralTarget::Language => self.toggle_setting_menu(SettingMenu::Language, cx), + GeneralTarget::SteerActiveRunMessages => self.toggle_steer_active_run_messages(cx), GeneralTarget::Notifications => self.toggle_desktop_notifications(cx), GeneralTarget::PasswordNotificationDetails => { self.toggle_password_notification_details(cx); @@ -1260,6 +1263,13 @@ mod tests { Some(&SettingsTarget::General(GeneralTarget::Language)) ); this.move_application_selection(1, 1, window, cx); + assert_eq!( + this.application_vim.target, + Some(SettingsTarget::General( + GeneralTarget::SteerActiveRunMessages + )) + ); + this.move_application_selection(1, 1, window, cx); assert_eq!( this.application_vim.target, Some(SettingsTarget::General(GeneralTarget::Notifications)) diff --git a/apps/maple-agent/app/translation-revisions/de.txt b/apps/maple-agent/app/translation-revisions/de.txt index 0f5431112..170abfac7 100644 --- a/apps/maple-agent/app/translation-revisions/de.txt +++ b/apps/maple-agent/app/translation-revisions/de.txt @@ -361,6 +361,7 @@ chat-status-failed 3aa7979f86ebefa0 chat-status-running 5e43dba3cfc269c8 chat-status-stopped 2adaa7a3d7affb04 chat-status-waiting 9734b0e528982b88 +chat-steer-current-run 08305435ba1930b1 chat-stop 1ef05f0684d0533b chat-stop-recording 9b266308b8bc857c chat-stop-run 7233bc9296bca9c5 @@ -1861,6 +1862,8 @@ settings-speech-speed 7abfaab28291aba5 settings-speech-speed-description 108a3287d8633d34 settings-speech-voice a1bd6f42451aab37 settings-speech-voice-description 6e6cba09626879d8 +settings-steer-active-run-messages 11d0a16e3c2b4c7a +settings-steer-active-run-messages-description 0bf4d597e6510b9d settings-text-size aa4d8e4805ea9511 settings-text-size-description 5cd2782d7f3991c4 settings-theme-label-dark aa6ad56172aedfb3 diff --git a/apps/maple-agent/app/translation-revisions/es.txt b/apps/maple-agent/app/translation-revisions/es.txt index 0f5431112..170abfac7 100644 --- a/apps/maple-agent/app/translation-revisions/es.txt +++ b/apps/maple-agent/app/translation-revisions/es.txt @@ -361,6 +361,7 @@ chat-status-failed 3aa7979f86ebefa0 chat-status-running 5e43dba3cfc269c8 chat-status-stopped 2adaa7a3d7affb04 chat-status-waiting 9734b0e528982b88 +chat-steer-current-run 08305435ba1930b1 chat-stop 1ef05f0684d0533b chat-stop-recording 9b266308b8bc857c chat-stop-run 7233bc9296bca9c5 @@ -1861,6 +1862,8 @@ settings-speech-speed 7abfaab28291aba5 settings-speech-speed-description 108a3287d8633d34 settings-speech-voice a1bd6f42451aab37 settings-speech-voice-description 6e6cba09626879d8 +settings-steer-active-run-messages 11d0a16e3c2b4c7a +settings-steer-active-run-messages-description 0bf4d597e6510b9d settings-text-size aa4d8e4805ea9511 settings-text-size-description 5cd2782d7f3991c4 settings-theme-label-dark aa6ad56172aedfb3 diff --git a/apps/maple-agent/app/translation-revisions/ko.txt b/apps/maple-agent/app/translation-revisions/ko.txt index 0f5431112..170abfac7 100644 --- a/apps/maple-agent/app/translation-revisions/ko.txt +++ b/apps/maple-agent/app/translation-revisions/ko.txt @@ -361,6 +361,7 @@ chat-status-failed 3aa7979f86ebefa0 chat-status-running 5e43dba3cfc269c8 chat-status-stopped 2adaa7a3d7affb04 chat-status-waiting 9734b0e528982b88 +chat-steer-current-run 08305435ba1930b1 chat-stop 1ef05f0684d0533b chat-stop-recording 9b266308b8bc857c chat-stop-run 7233bc9296bca9c5 @@ -1861,6 +1862,8 @@ settings-speech-speed 7abfaab28291aba5 settings-speech-speed-description 108a3287d8633d34 settings-speech-voice a1bd6f42451aab37 settings-speech-voice-description 6e6cba09626879d8 +settings-steer-active-run-messages 11d0a16e3c2b4c7a +settings-steer-active-run-messages-description 0bf4d597e6510b9d settings-text-size aa4d8e4805ea9511 settings-text-size-description 5cd2782d7f3991c4 settings-theme-label-dark aa6ad56172aedfb3