@@ -20,7 +20,7 @@ import {
2020 formatAskUserQuestionAnswers ,
2121} from "../core/ask-user-question" ;
2222import { PermissionPrompt , type PermissionPromptResult } from "./PermissionPrompt" ;
23- import { buildExitSummaryText } from "../exit-summary" ;
23+ import { buildExitSummaryText , buildResumeHintText } from "../exit-summary" ;
2424import { RawMode , useRawModeContext } from "../contexts" ;
2525import { renderMessageToStdout } from "../components/MessageView/utils" ;
2626import {
@@ -290,22 +290,40 @@ function App({ projectRoot, initialPrompt, resumeSessionId, onRestart }: AppProp
290290 } , [ sessionManager ] ) ;
291291
292292 writeRef . current = write ;
293- const handlePrompt = useCallback (
294- async ( submission : PromptSubmission ) => {
295- if ( submission . command === "exit" ) {
296- setIsExiting ( true ) ;
297- setTimeout ( ( ) => {
298- const activeSessionId = sessionManager . getActiveSessionId ( ) ;
299- const session = activeSessionId ? sessionManager . getSession ( activeSessionId ) : null ;
300- const summary = buildExitSummaryText ( { session, sessionId : activeSessionId ?? undefined } ) ;
301- process . stdout . write ( "\n" ) ;
293+ const handleExit = useCallback (
294+ ( { showCommand, showSummary } : { showCommand : boolean ; showSummary : boolean } ) => {
295+ setIsExiting ( true ) ;
296+ setTimeout ( ( ) => {
297+ const activeSessionId = sessionManager . getActiveSessionId ( ) ;
298+ const session = activeSessionId ? sessionManager . getSession ( activeSessionId ) : null ;
299+ const resumeHint = buildResumeHintText ( activeSessionId ?? undefined ) ;
300+
301+ process . stdout . write ( "\n" ) ;
302+ if ( showCommand ) {
302303 process . stdout . write ( chalk . rgb ( 34 , 154 , 195 ) ( "> /exit " ) ) ;
303304 process . stdout . write ( "\n\n" ) ;
305+ }
306+ if ( showSummary ) {
307+ const summary = buildExitSummaryText ( { session, sessionId : activeSessionId ?? undefined } ) ;
304308 process . stdout . write ( summary ) ;
305309 process . stdout . write ( "\n\n" ) ;
306- sessionManager . dispose ( ) ;
307- exit ( ) ;
308- } , 0 ) ;
310+ }
311+ if ( resumeHint ) {
312+ process . stdout . write ( resumeHint ) ;
313+ process . stdout . write ( "\n" ) ;
314+ }
315+
316+ sessionManager . dispose ( ) ;
317+ exit ( ) ;
318+ } , 0 ) ;
319+ } ,
320+ [ exit , sessionManager ]
321+ ) ;
322+
323+ const handlePrompt = useCallback (
324+ async ( submission : PromptSubmission ) => {
325+ if ( submission . command === "exit" ) {
326+ handleExit ( { showCommand : true , showSummary : true } ) ;
309327 return ;
310328 }
311329 if ( submission . command === "new" ) {
@@ -400,7 +418,7 @@ function App({ projectRoot, initialPrompt, resumeSessionId, onRestart }: AppProp
400418 [
401419 sessionManager ,
402420 pendingPermissionReply ,
403- exit ,
421+ handleExit ,
404422 onRestart ,
405423 refreshSkills ,
406424 refreshSessionsList ,
@@ -477,6 +495,10 @@ function App({ projectRoot, initialPrompt, resumeSessionId, onRestart }: AppProp
477495 [ handlePrompt ]
478496 ) ;
479497
498+ const handleExitShortcut = useCallback ( ( ) => {
499+ handleExit ( { showCommand : false , showSummary : false } ) ;
500+ } , [ handleExit ] ) ;
501+
480502 const reloadActiveSessionView = useCallback (
481503 ( sessionId : string ) : void => {
482504 resetStaticView ( loadVisibleMessages ( sessionManager , sessionId ) , { clearScreen : true } ) ;
@@ -959,6 +981,7 @@ function App({ projectRoot, initialPrompt, resumeSessionId, onRestart }: AppProp
959981 onRawModeChange = { handleRawModeChange }
960982 onInterrupt = { handleInterrupt }
961983 onToggleProcessStdout = { handleToggleProcessStdout }
984+ onExitShortcut = { handleExitShortcut }
962985 placeholder = "Type your message..."
963986 statusLineSegments = { statusLineSegments }
964987 statusLineSeparator = { resolvedSettings . statusline . separator }
0 commit comments