@@ -1403,6 +1403,27 @@ function workShownAsFinalAnswerOnly(
14031403 ) ;
14041404}
14051405
1406+ function deriveInFlightSteerAnswerIds ( entries : ReadonlyArray < TimelineEntry > ) : ReadonlySet < string > {
1407+ const ids = new Set < string > ( ) ;
1408+ let awaitingReply = false ;
1409+ let candidate : string | null = null ;
1410+ for ( const entry of entries ) {
1411+ if ( entry . kind === "work" && entry . entry . itemType === "reasoning" ) continue ;
1412+ const reply = entry . kind === "message" && entry . message . role === "assistant" ? entry : null ;
1413+ if ( candidate !== null && reply !== null ) ids . add ( candidate ) ;
1414+ candidate = null ;
1415+ if ( timelineEntryIsSteer ( entry ) ) {
1416+ awaitingReply = true ;
1417+ } else if ( entry . kind === "message" && entry . message . role === "user" ) {
1418+ awaitingReply = false ;
1419+ } else if ( reply !== null && awaitingReply ) {
1420+ candidate = reply . message . id ;
1421+ awaitingReply = false ;
1422+ }
1423+ }
1424+ return ids ;
1425+ }
1426+
14061427export function liveAnswerPreview ( entries : ReadonlyArray < TimelineEntry > ) : string | null {
14071428 const boundary = lastResponseBoundaryIndex ( entries ) ;
14081429 for ( let index = entries . length - 1 ; index > boundary ; index -= 1 ) {
@@ -1441,6 +1462,7 @@ function timelineRowEntries(
14411462 : null ;
14421463 const answeringFrom = answering ? lastResponseBoundaryIndex ( entries ) + 1 : entries . length ;
14431464 const terminalIds = deriveTerminalAssistantMessageIds ( entries ) ;
1465+ const steerAnswerIds = deriveInFlightSteerAnswerIds ( entries ) ;
14441466 shown = entries . filter ( ( entry , index ) => {
14451467 if ( entry . kind !== "message" ) {
14461468 return workShownAsFinalAnswerOnly ( entry , input . pendingApprovalRequestIds ) ;
@@ -1449,7 +1471,7 @@ function timelineRowEntries(
14491471 return (
14501472 message . role !== "assistant" ||
14511473 message . id === input . revealedMessageId ||
1452- ( terminalIds . has ( message . id ) &&
1474+ ( ( terminalIds . has ( message . id ) || steerAnswerIds . has ( message . id ) ) &&
14531475 index < answeringFrom &&
14541476 ( answeringRunId === null || message . runId !== answeringRunId ) )
14551477 ) ;
@@ -1472,6 +1494,7 @@ function deriveTimelineTurnFolds(
14721494 | "revealedMessageId"
14731495 > ,
14741496) {
1497+ if ( input . toolCallVisibility === "zen" ) return new Map < string , TurnFold > ( ) ;
14751498 const timelineEntries = timelineRowEntries ( input ) ;
14761499 const unsettledRunId = deriveUnsettledRunId ( input . latestRun ?? null , input . runningRunId ?? null ) ;
14771500 const failedRunIds = failedTimelineRunIds ( timelineEntries , input . latestRun ?? null ) ;
@@ -1556,15 +1579,18 @@ export function deriveMessagesTimelineRows(input: {
15561579 isWorking : input . isWorking ,
15571580 } ) ;
15581581 const runlessWorkActive = input . isWorking && input . runlessWorkActive === true ;
1559- const foldsByAnchorEntryId = deriveTurnFolds ( {
1560- timelineEntries : timelineEntries ,
1561- terminalAssistantMessageIds,
1562- latestRun : input . latestRun ?? null ,
1563- unfoldedRunIds : new Set ( [ ...activeVisualResponseRunIds , ...failedRunIds ] ) ,
1564- runlessWorkActive,
1565- liveSubagentEntryIds,
1566- completeSupersededReplyEntryIds : completeSupersededReplyIds ,
1567- } ) ;
1582+ const foldsByAnchorEntryId =
1583+ input . toolCallVisibility === "zen"
1584+ ? new Map < string , TurnFold > ( )
1585+ : deriveTurnFolds ( {
1586+ timelineEntries : timelineEntries ,
1587+ terminalAssistantMessageIds,
1588+ latestRun : input . latestRun ?? null ,
1589+ unfoldedRunIds : new Set ( [ ...activeVisualResponseRunIds , ...failedRunIds ] ) ,
1590+ runlessWorkActive,
1591+ liveSubagentEntryIds,
1592+ completeSupersededReplyEntryIds : completeSupersededReplyIds ,
1593+ } ) ;
15681594 const timelineEntryById = new Map ( timelineEntries . map ( ( entry ) => [ entry . id , entry ] ) ) ;
15691595 const collapsedEntryIds = new Set < string > ( ) ;
15701596 const collapsedFoldMemberIds = new Set < string > ( ) ;
0 commit comments