fix(tui): keep stream cadence responsive while typing

This commit is contained in:
Brooklyn Nicholson 2026-04-26 04:32:55 -05:00
parent 381121025e
commit bbd950efcf
4 changed files with 19 additions and 13 deletions

View file

@ -2,7 +2,6 @@ import {
REASONING_PULSE_MS,
STREAM_BATCH_MS,
STREAM_IDLE_BATCH_MS,
STREAM_SCROLLING_BATCH_MS,
STREAM_TYPING_BATCH_MS
} from '../config/timing.js'
import type { SessionInterruptResponse, SubagentEventPayload } from '../gatewayTypes.js'
@ -16,7 +15,6 @@ import {
} from '../lib/text.js'
import type { ActiveTool, ActivityItem, Msg, SubagentProgress } from '../types.js'
import { getInteractionMode } from './interactionMode.js'
import { resetFlowOverlays } from './overlayStore.js'
import { pushSnapshot } from './spawnHistoryStore.js'
import { getTurnState, patchTurnState, resetTurnState } from './turnStore.js'
@ -504,15 +502,12 @@ class TurnController {
return
}
const interaction = getInteractionMode()
const delay = interaction === 'scrolling' ? STREAM_SCROLLING_BATCH_MS : interaction === 'typing' ? STREAM_TYPING_BATCH_MS : this.streamDelay
this.streamTimer = setTimeout(() => {
this.streamTimer = null
const raw = this.bufRef.trimStart()
const visible = hasReasoningTag(raw) ? splitReasoning(raw).text : raw
patchTurnState({ streaming: visible })
}, delay)
}, this.streamDelay)
}
startMessage() {