diff --git a/packages/coding-agent/example.txt b/packages/coding-agent/example.txt index 03c4844a..db239d22 100644 --- a/packages/coding-agent/example.txt +++ b/packages/coding-agent/example.txt @@ -10,8 +10,8 @@ The woodland creatures gazed in wonder as it flashed past them like a streak of At the clearing's edge, there also dwelled an exceptionally lazy dog. This contented dog much preferred snoozing in the golden sunshine to any kind of adventure. -One day, the fox challenged the dog to a race across the meadow. -The dog yawned and declined, saying "Why rush when you can rest?" +One fateful morning, the fox challenged the dog to an epic race across the meadow. +The dog yawned deeply and declined, saying "Why rush around when you can rest peacefully?" The fox laughed and zipped away, exploring distant hills and valleys. The dog simply rolled over and continued its peaceful slumber. diff --git a/packages/coding-agent/src/tui/assistant-message.ts b/packages/coding-agent/src/tui/assistant-message.ts index 4a4af2b4..b245e90e 100644 --- a/packages/coding-agent/src/tui/assistant-message.ts +++ b/packages/coding-agent/src/tui/assistant-message.ts @@ -34,31 +34,40 @@ export class AssistantMessageComponent extends Container { // Clear content container this.contentContainer.clear(); + // Check if there's any actual content (text or thinking) + let hasContent = false; + // Render content in order for (const content of message.content) { if (content.type === "text" && content.text.trim()) { // Assistant text messages with no background - trim the text // Set paddingY=0 to avoid extra spacing before tool executions this.contentContainer.addChild(new Markdown(content.text.trim(), undefined, undefined, undefined, 1, 0)); + hasContent = true; } else if (content.type === "thinking" && content.thinking.trim()) { // Thinking traces in dark gray italic // Apply styling to entire block so wrapping preserves it const thinkingText = chalk.gray.italic(content.thinking); this.contentContainer.addChild(new Text(thinkingText, 1, 0)); this.contentContainer.addChild(new Spacer(1)); + hasContent = true; } } // Check if aborted - show after partial content if (message.stopReason === "aborted") { this.contentContainer.addChild(new Text(chalk.red("Aborted"))); + hasContent = true; } else if (message.stopReason === "error") { const errorMsg = message.errorMessage || "Unknown error"; this.contentContainer.addChild(new Text(chalk.red(`Error: ${errorMsg}`))); + hasContent = true; } - // Update stats - this.updateStats(message.usage); + // Only update stats if there's actual content (not just tool calls) + if (hasContent) { + this.updateStats(message.usage); + } } updateStats(usage: any): void {