@@ -18,6 +18,7 @@ import type { TUIState } from '../tui-state';
1818import type {
1919 AppState ,
2020 BackgroundAgentMetadata ,
21+ BackgroundAgentStatusPhase ,
2122 ToolResultBlockData ,
2223 TranscriptEntry ,
2324} from '../types' ;
@@ -513,14 +514,15 @@ export class SessionReplayRenderer {
513514 } ) ;
514515 return ;
515516 case 'completion' :
516- this . host . appendTranscriptEntry (
517- replayEntry (
517+ this . host . appendTranscriptEntry ( {
518+ ... replayEntry (
518519 context ,
519520 'assistant' ,
520521 buildGoalCompletionMessage ( record . snapshot ) ,
521522 'markdown' ,
522523 ) ,
523- ) ;
524+ goalCompletionData : true ,
525+ } ) ;
524526 return ;
525527 case 'lifecycle' : {
526528 const lifecycleChange : GoalReplayLifecycleChange = { ...change , kind : 'lifecycle' } ;
@@ -735,26 +737,15 @@ export class SessionReplayRenderer {
735737 ? undefined
736738 : task . thinkingEffort ,
737739 } ;
738- let status = formatBackgroundAgentTranscript (
739- origin . status === 'completed' ? 'completed' : 'failed' ,
740- meta ,
741- ) ;
742- if ( origin . status === 'lost' ) {
743- status = {
744- ...status ,
745- headline : status . headline . replace ( ' failed in background' , ' lost in background' ) ,
746- } ;
747- } else if ( origin . status === 'killed' ) {
748- status = {
749- ...status ,
750- headline : status . headline . replace ( ' failed in background' , ' stopped' ) ,
751- } ;
752- } else if ( origin . status === 'timed_out' ) {
753- status = {
754- ...status ,
755- headline : status . headline . replace ( ' failed in background' , ' timed out' ) ,
756- } ;
757- }
740+ const phase : BackgroundAgentStatusPhase =
741+ origin . status === 'completed' ||
742+ origin . status === 'failed' ||
743+ origin . status === 'lost' ||
744+ origin . status === 'killed' ||
745+ origin . status === 'timed_out'
746+ ? origin . status
747+ : 'failed' ;
748+ const status = formatBackgroundAgentTranscript ( phase , meta ) ;
758749 this . host . appendTranscriptEntry ( {
759750 ...replayEntry ( context , 'status' , status . headline , 'plain' ) ,
760751 detail : status . detail ,
0 commit comments