Skip to content

D-19: Stream Inspector debug panel (⌘⌥R) #269

@kirich1409

Description

@kirich1409

Description

Implement the debug panel that reveals the raw JSONL stream for the current Dialogue session — essential for reproducing parsing bugs, schema drift reports, and general support.

Spec: docs/architecture/dialogue-events.md §8 (Stream Inspector).

Scope

File

MacApp/Packages/AgentChatUI/Sources/AgentChatUI/Debug/StreamInspectorView.swift

UI

  • Overlay sheet: 80% window height.
  • Header: "Stream Inspector · {session_id short}" + buttons [Copy all] [Save .jsonl] [Pause capture] [Close].
  • List: raw JSONL lines in arrival order; monospaced; JSON syntax-highlighted via simple regex tokenizer (keys, strings, numbers, booleans, nulls — using DS.Color.code* tokens).
  • Per line: arrival timestamp, type + subtype badge, fold/unfold button, [Copy] button.
  • Filter bar above list: type multiselect (system / assistant / user / result / stream_event), subtype text search, event-name search (within stream_event).
  • Bottom meta: total events: N · bytes: K · unknown: M · parse_errors: P.

State store

StreamInspectorStore — actor holding circular buffer of 1000 raw events per session. API:

  • append(rawLine: String, timestamp: Date) — called by ClaudeStreamJSONParser when it ingests each line.
  • events() -> [StreamInspectorEntry] — snapshot for rendering.
  • clear(), save(to: URL).

Populated during parsing (Wave 2 parser instrumented with a StreamInspectorHandle optional).

Persistence (optional, Settings-gated)

Settings → Advanced → Persist raw streams — when on, mirror to ~/Library/Caches/Relay/sessions/{session_id}.jsonl. Off by default.

Activation

  • Keyboard: ⌘⌥R opens inspector for current session.
  • Debug menu item.
  • Accessible from DialogueView toolbar (secondary, small icon).

Acceptance Criteria

  • Inspector opens on ⌘⌥R and shows the live stream of current session.
  • Raw JSONL lines display in order, timestamped, JSON syntax-highlighted.
  • Filters work: by type, subtype, event name.
  • Copy all puts the entire session's JSONL on the clipboard.
  • Save .jsonl writes to a file picker-chosen location.
  • Pause capture freezes updates; unpause resumes.
  • Settings toggle for persistence works; persistence file created when on.
  • No measurable perf impact on session when inspector not open (buffer-only growth, no view cost).
  • VoiceOver-navigable; keyboard-navigable.

Relationships

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions