@@ -33,6 +33,8 @@ import type { EventBus, SafetyMode } from "@devagent/runtime";
3333
3434export const TUI_HELP_MESSAGE = "Commands: /clear (reset), /continue (resume work), /sessions (history), /exit (quit) │ Embedded shortcuts can appear anywhere: /review, /simplify │ Shift+Enter or Option+Enter for newline │ Shift+Tab toggles safety mode" ;
3535export const ITERATION_LIMIT_NOTICE = "Iteration limit exhausted. Type /continue to proceed." ;
36+ const EMPTY_RESPONSE_NOTICE = "Model returned no final response. Type /continue to retry, or switch provider/model if it repeats." ;
37+ const ABORTED_NOTICE = "Run stopped before completion. Type /continue to retry from the current session." ;
3638
3739// ─── Types ──────────────────────────────────────────────────
3840
@@ -183,6 +185,11 @@ async function completeSuccessfulQueryTurn(query: string, context: QueryRunConte
183185 context . flushThinking ( ) ;
184186 context . flushGroup ( ) ;
185187 appendQueryResult ( result , context ) ;
188+ const turnStatus = result . status === "success"
189+ ? "completed"
190+ : result . status === "budget_exceeded"
191+ ? "budget_exceeded"
192+ : "error" ;
186193 context . completeTurn (
187194 context . nextId ( "summary" ) ,
188195 makeTurnSummaryPart ( {
@@ -191,20 +198,28 @@ async function completeSuccessfulQueryTurn(query: string, context: QueryRunConte
191198 cost : context . refs . costAccum . current ,
192199 elapsedMs : Date . now ( ) - context . refs . turnStart . current ,
193200 } ) ,
194- { status : result . status === "budget_exceeded" ? "budget_exceeded" : "completed" , finishedAt : Date . now ( ) } ,
201+ { status : turnStatus , finishedAt : Date . now ( ) } ,
195202 ) ;
196203}
197204
198205function appendQueryResult ( result : InteractiveQueryResult , context : QueryRunContext ) : void {
199206 if ( result . lastText ) {
200207 context . appendTurnPart ( context . nextId ( "final" ) , makeFinalOutputPart ( result . lastText ) ) ;
201208 }
202- if ( result . status === "budget_exceeded" ) {
203- context . appendTurnPart ( context . nextId ( "budget" ) , makeInfoPart ( "status" , [ ITERATION_LIMIT_NOTICE ] ) ) ;
204- context . addToast ( ITERATION_LIMIT_NOTICE , "warning" ) ;
209+ const notice = noticeForQueryStatus ( result . status ) ;
210+ if ( notice ) {
211+ context . appendTurnPart ( context . nextId ( "status" ) , makeInfoPart ( "status" , [ notice ] ) ) ;
212+ context . addToast ( notice , "warning" ) ;
205213 }
206214}
207215
216+ function noticeForQueryStatus ( status : InteractiveQueryResult [ "status" ] ) : string | null {
217+ if ( status === "budget_exceeded" ) return ITERATION_LIMIT_NOTICE ;
218+ if ( status === "empty_response" ) return EMPTY_RESPONSE_NOTICE ;
219+ if ( status === "aborted" ) return ABORTED_NOTICE ;
220+ return null ;
221+ }
222+
208223function completeFailedQueryTurn ( err : unknown , context : QueryRunContext ) : void {
209224 context . appendTurnPart (
210225 context . nextId ( "error" ) ,
0 commit comments