Skip to content

D-17: ThinkingIndicatorView — collapsed-by-default thinking block #267

@kirich1409

Description

@kirich1409

Description

Implement the collapsible ThinkingIndicatorView that surfaces the agent's extended thinking blocks. Collapsed by default; expanding reveals raw monospaced text (not rendered as markdown — thinking is raw reasoning).

Spec: Epic #250 §6 (thinking block behavior); docs/architecture/dialogue-events.md §2 (thinking events), §6.5 (long thinking handling).

Scope

File

MacApp/Packages/AgentChatUI/Sources/AgentChatUI/Messages/ThinkingIndicatorView.swift

Structure

```swift
public struct ThinkingIndicatorView: View {
public init(thinking: Thinking, isStreaming: Bool)
}

public struct Thinking: Equatable, Sendable {
public let text: String // accumulated thinking content
public let tokenCountApprox: Int? // if available
public let elapsedSeconds: TimeInterval?
}
```

  • Header (always visible): SF Symbol "brain" + Thinking… / Thinking (2s · ~420 tokens) + DS.Color.textTertiary text.
  • Streaming indicator: spinner or ellipsis "…" next to "Thinking" when isStreaming == true. Guarded by reduceMotion.
  • Collapsed by default; disclosure chevron on right.
  • Expand → show Thinking.text in monospaced font, inset indent, DS.Color.textSecondary. No markdown rendering.
  • After content_block_stop (streaming = false), header transitions to lightbulb 💡 icon (or SF Symbol lightbulb.fill) with final tokenCount.

A11y

  • .accessibilityLabel: "Agent thinking block, collapsed/expanded, N tokens".
  • Expanded content readable by VoiceOver (raw text).

Acceptance Criteria

  • ThinkingIndicatorView implemented.
  • Collapsed by default; click header expands / collapses with smooth animation (reduceMotion-guarded).
  • Streaming state shown via spinner or ellipsis; transitions to static icon on completion.
  • Token count + elapsed time displayed when available.
  • Expanded content in monospaced font, no markdown.
  • VoiceOver can expand/collapse and read content.
  • Snapshot tests: collapsed, expanded, streaming, completed.
  • DS tokens only.

Relationships

Metadata

Metadata

Assignees

No one assigned

    Labels

    a11yAccessibility: VoiceOver, Dynamic Type, Reduce Motion, etc.complexity:SdialogueDialogue feature — structured chat UI for agent sessionsfrontendwave-3

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions