diff --git a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts index e546ce640e..f1f0c306bc 100644 --- a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts +++ b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts @@ -4,7 +4,7 @@ import { createGatewayEventHandler } from '../app/createGatewayEventHandler.js' import { resetOverlayState } from '../app/overlayStore.js' import { turnController } from '../app/turnController.js' import { resetTurnState } from '../app/turnStore.js' -import { resetUiState } from '../app/uiStore.js' +import { patchUiState, resetUiState } from '../app/uiStore.js' import { estimateTokensRough } from '../lib/text.js' import type { Msg } from '../types.js' @@ -47,6 +47,7 @@ describe('createGatewayEventHandler', () => { resetUiState() resetTurnState() turnController.fullReset() + patchUiState({ showReasoning: true }) }) it('persists completed tool rows when message.complete lands immediately after tool.complete', () => { diff --git a/ui-tui/src/app/createGatewayEventHandler.ts b/ui-tui/src/app/createGatewayEventHandler.ts index e728f8bbd0..699a3794de 100644 --- a/ui-tui/src/app/createGatewayEventHandler.ts +++ b/ui-tui/src/app/createGatewayEventHandler.ts @@ -266,7 +266,7 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev: case 'tool.complete': turnController.recordToolComplete(ev.payload.tool_id, ev.payload.name, ev.payload.error, ev.payload.summary) - if (ev.payload.inline_diff) { + if (ev.payload.inline_diff && getUiState().inlineDiffs) { sys(ev.payload.inline_diff) } diff --git a/ui-tui/src/app/turnController.ts b/ui-tui/src/app/turnController.ts index 73d0571734..de57b2dd05 100644 --- a/ui-tui/src/app/turnController.ts +++ b/ui-tui/src/app/turnController.ts @@ -11,7 +11,7 @@ import type { ActiveTool, ActivityItem, Msg, SubagentProgress } from '../types.j import { resetOverlayState } from './overlayStore.js' import { patchTurnState, resetTurnState } from './turnStore.js' -import { patchUiState } from './uiStore.js' +import { getUiState, patchUiState } from './uiStore.js' const INTERRUPT_COOLDOWN_MS = 1500 const ACTIVITY_LIMIT = 8 @@ -226,10 +226,17 @@ class TurnController { } this.bufRef = rendered ?? this.bufRef + text - this.scheduleStreaming() + + if (getUiState().streaming) { + this.scheduleStreaming() + } } recordReasoningAvailable(text: string) { + if (!getUiState().showReasoning) { + return + } + const incoming = text.trim() if (!incoming || this.reasoningText.trim()) { @@ -242,6 +249,10 @@ class TurnController { } recordReasoningDelta(text: string) { + if (!getUiState().showReasoning) { + return + } + this.reasoningText += text this.scheduleReasoning() this.pulseReasoningStreaming() diff --git a/ui-tui/src/components/appChrome.tsx b/ui-tui/src/components/appChrome.tsx index ed6f914c96..2f5f807dec 100644 --- a/ui-tui/src/components/appChrome.tsx +++ b/ui-tui/src/components/appChrome.tsx @@ -99,6 +99,7 @@ export function StatusRule({ usage, bgCount, sessionStartedAt, + showCost, voiceLabel, t }: StatusRuleProps) { @@ -136,6 +137,9 @@ export function StatusRule({ ) : null} {voiceLabel ? │ {voiceLabel} : null} {bgCount > 0 ? │ {bgCount} bg : null} + {showCost && typeof usage.cost_usd === 'number' ? ( + │ ${usage.cost_usd.toFixed(4)} + ) : null} @@ -285,6 +289,7 @@ interface StatusRuleProps { cwdLabel: string model: string sessionStartedAt?: number | null + showCost: boolean status: string statusColor: string t: Theme diff --git a/ui-tui/src/components/appLayout.tsx b/ui-tui/src/components/appLayout.tsx index 26d8e4b0a9..f13adf1bbd 100644 --- a/ui-tui/src/components/appLayout.tsx +++ b/ui-tui/src/components/appLayout.tsx @@ -190,6 +190,7 @@ const ComposerPane = memo(function ComposerPane({ cwdLabel={status.cwdLabel} model={ui.info?.model?.split('/').pop() ?? ''} sessionStartedAt={status.sessionStartedAt} + showCost={ui.showCost} status={ui.status} statusColor={status.statusColor} t={ui.theme} diff --git a/ui-tui/src/types.ts b/ui-tui/src/types.ts index ab7d7efab9..32e99983ac 100644 --- a/ui-tui/src/types.ts +++ b/ui-tui/src/types.ts @@ -68,6 +68,7 @@ export interface Usage { context_max?: number context_percent?: number context_used?: number + cost_usd?: number input: number output: number total: number