Skip to content

Commit 5cc3857

Browse files
committed
feat: support "exit" as a keyword to quit the session
Typing "exit" in the TUI now terminates the session immediately, equivalent to the /exit slash command. The check is case-insensitive and whitespace-trimmed, and runs before slash command parsing so it works even when the agent is busy.
1 parent 2efd1bb commit 5cc3857

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pkg/tui/page/chat/chat.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,12 @@ func (p *chatPage) cancelStream(showCancelMessage bool) tea.Cmd {
624624
// handleSendMsg handles incoming messages from the editor, either processing
625625
// them immediately or queuing them if the agent is busy.
626626
func (p *chatPage) handleSendMsg(msg msgtypes.SendMsg) (layout.Model, tea.Cmd) {
627+
// Handle "exit" as a special keyword to quit the session immediately,
628+
// equivalent to the /exit slash command.
629+
if strings.TrimSpace(strings.ToLower(msg.Content)) == "exit" {
630+
return p, core.CmdHandler(msgtypes.ExitSessionMsg{})
631+
}
632+
627633
// Predefined slash commands (e.g., /yolo, /exit, /compact) execute immediately
628634
// even while the agent is working - they're UI commands that don't interrupt the stream.
629635
// Custom agent commands (defined in config) should still be queued.

0 commit comments

Comments
 (0)