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
Relationships
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.swiftUI
[Copy all] [Save .jsonl] [Pause capture] [Close].DS.Color.code*tokens).type+subtypebadge, fold/unfold button,[Copy]button.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 byClaudeStreamJSONParserwhen it ingests each line.events() -> [StreamInspectorEntry]— snapshot for rendering.clear(),save(to: URL).Populated during parsing (Wave 2 parser instrumented with a
StreamInspectorHandleoptional).Persistence (optional, Settings-gated)
Settings → Advanced → Persist raw streams— when on, mirror to~/Library/Caches/Relay/sessions/{session_id}.jsonl. Off by default.Activation
DialogueViewtoolbar (secondary, small icon).Acceptance Criteria
Copy allputs the entire session's JSONL on the clipboard.Save .jsonlwrites to a file picker-chosen location.Pause capturefreezes updates; unpause resumes.Relationships