feat(tui): anchor todo panel above streaming output
This commit is contained in:
@@ -81,6 +81,9 @@ describe('createGatewayEventHandler', () => {
|
|||||||
|
|
||||||
expect(finalText).toBeDefined()
|
expect(finalText).toBeDefined()
|
||||||
expect(trail).toMatchObject({ kind: 'trail', role: 'system', todos, todoIncomplete: true })
|
expect(trail).toMatchObject({ kind: 'trail', role: 'system', todos, todoIncomplete: true })
|
||||||
|
// Todo archive must sit ABOVE the final assistant text so the panel
|
||||||
|
// doesn't visibly jump across the final answer at end-of-turn.
|
||||||
|
expect(appended.indexOf(trail!)).toBeLessThan(appended.indexOf(finalText!))
|
||||||
expect(getTurnState().todos).toEqual([])
|
expect(getTurnState().todos).toEqual([])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -537,9 +537,14 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:
|
|||||||
const { finalMessages, finalText, wasInterrupted } = turnController.recordMessageComplete(ev.payload ?? {})
|
const { finalMessages, finalText, wasInterrupted } = turnController.recordMessageComplete(ev.payload ?? {})
|
||||||
|
|
||||||
if (!wasInterrupted) {
|
if (!wasInterrupted) {
|
||||||
|
// Archive the todo list FIRST so it sits above the final assistant
|
||||||
|
// text in the transcript — same position it held during streaming.
|
||||||
|
// Otherwise the panel would visibly jump from "above live answer" to
|
||||||
|
// "below final answer" at message.complete.
|
||||||
|
archiveTodosAtTurnEnd().forEach(appendMessage)
|
||||||
|
|
||||||
const msgs: Msg[] = finalMessages.length ? finalMessages : [{ role: 'assistant', text: finalText }]
|
const msgs: Msg[] = finalMessages.length ? finalMessages : [{ role: 'assistant', text: finalText }]
|
||||||
msgs.forEach(appendMessage)
|
msgs.forEach(appendMessage)
|
||||||
archiveTodosAtTurnEnd().forEach(appendMessage)
|
|
||||||
|
|
||||||
if (bellOnComplete && stdout?.isTTY) {
|
if (bellOnComplete && stdout?.isTTY) {
|
||||||
stdout.write('\x07')
|
stdout.write('\x07')
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ const TranscriptPane = memo(function TranscriptPane({
|
|||||||
|
|
||||||
{transcript.virtualHistory.bottomSpacer > 0 ? <Box height={transcript.virtualHistory.bottomSpacer} /> : null}
|
{transcript.virtualHistory.bottomSpacer > 0 ? <Box height={transcript.virtualHistory.bottomSpacer} /> : null}
|
||||||
|
|
||||||
|
<LiveTodoPanel />
|
||||||
|
|
||||||
<StreamingAssistant
|
<StreamingAssistant
|
||||||
cols={composer.cols}
|
cols={composer.cols}
|
||||||
compact={ui.compact}
|
compact={ui.compact}
|
||||||
@@ -67,8 +69,6 @@ const TranscriptPane = memo(function TranscriptPane({
|
|||||||
progress={progress}
|
progress={progress}
|
||||||
sections={ui.sections}
|
sections={ui.sections}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LiveTodoPanel />
|
|
||||||
</Box>
|
</Box>
|
||||||
</ScrollBox>
|
</ScrollBox>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user