feat(tui): add /app desktop handoff (#25638)

This commit is contained in:
Felipe Coury authored and GitHub committed 2026-06-03 20:30:15 -03:00
1 parent 8285cd278b
commit 80b65e9945
12 files changed
+244 -1

No files matched your search

@@ -202,6 +202,16 @@ impl ChatWidget {
SlashCommand::Fork => {
self.app_event_tx.send(AppEvent::ForkCurrentSession);
}
SlashCommand::App => {
let Some(thread_id) = self.thread_id else {
self.add_error_message(
"Session is still starting; try /app again in a moment.".to_string(),
);
return;
};
self.app_event_tx
.send(AppEvent::OpenDesktopThread { thread_id });
}
SlashCommand::Init => {
let init_target = self.config.cwd.join(DEFAULT_AGENTS_MD_FILENAME);
if init_target.exists() {
@@ -974,6 +984,7 @@ impl ChatWidget {
| SlashCommand::Raw
| SlashCommand::Vim
| SlashCommand::Diff
| SlashCommand::App
| SlashCommand::Rename
| SlashCommand::TestApproval => QueueDrain::Continue,
SlashCommand::Feedback
@@ -0,0 +1,5 @@
---
source: tui/src/chatwidget/tests/slash_commands.rs
expression: "lines_to_single_string(&cells[0])"
---
■ Session is still starting; try /app again in a moment.
@@ -2052,6 +2052,36 @@ async fn slash_fork_requests_current_fork() {
assert_matches!(rx.try_recv(), Ok(AppEvent::ForkCurrentSession));
}
#[tokio::test]
async fn slash_app_requests_desktop_handoff() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
let thread_id = ThreadId::new();
chat.thread_id = Some(thread_id);
chat.dispatch_command(SlashCommand::App);
assert_matches!(
rx.try_recv(),
Ok(AppEvent::OpenDesktopThread {
thread_id: actual_thread_id,
}) if actual_thread_id == thread_id
);
}
#[tokio::test]
async fn slash_app_without_thread_id_shows_starting_error() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.dispatch_command(SlashCommand::App);
let cells = drain_insert_history(&mut rx);
assert_eq!(cells.len(), 1, "expected app startup error");
assert_chatwidget_snapshot!(
"slash_app_without_thread_id_shows_starting_error",
lines_to_single_string(&cells[0])
);
}
#[tokio::test]
async fn slash_rollout_displays_current_path() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;