Create the agent detail page showing full output and interaction controls.
Layout
1. Header: Agent name/ID, status badge, task link (if associated), cost, elapsed time
2. Action bar:
- Message input + Send button (for idle agents) — POST to daemon's /agents/:id/send
- Stop button (for running agents) — POST to daemon's /agents/:id/stop
- "Send to review" button (for idle/completed agents with a worktree)
3. Event stream: Full agent output, live-updating via htmx polling
- Thinking blocks: Collapsible, shown with 💭 icon, italic, muted color. Default collapsed.
- Tool calls: 🔧 icon, tool name in accent color, args preview. Expandable to show full args.
- Tool results: 📋 icon, tool name, truncated result. Expandable to show full result.
- Text output: 💬 icon, full text content from assistant messages.
- Errors: ❌ icon, red text.
- Turn boundaries: Horizontal divider with turn number and cumulative cost.
- Steering messages: 🎯 icon, shown when user sent guidance.
4. Sidebar/tabs (on wider screens):
- Diff tab:
git diff of worktree - Files tab: file browser for worktree directory
Event Parsing
The daemon logs pi JSONL events to /var/log/agentd/<run-id>/pi.log. Parse these events similar to Pipeline/Web.hs parseEventLog but with more detail:
- Show thinking content (currently truncated to 200 chars in pipeline — show full, collapsible)
- Show complete tool call arguments (not just summary)
- Show complete tool results (not just truncated)
- Parse
message_start, message_update, message_end, turn_start, turn_end, agent_start, agent_end
HTMX
- Event stream div:
hx-get="/agents/:id/events" hx-trigger="every 3s" when agent is running/idle - Stop polling when agent is completed/failed (HTTP 286 pattern from pipeline)
- Message form:
hx-post="/agents/:id/send" with hx-swap="none" (no DOM update needed)
Collapsible Thinking
Use <details><summary> for collapsible thinking blocks:
<details class="ev-thinking">
<summary>💭 thinking...</summary>
<div class="ev-thinking-content">Full thinking text here...</div>
</details>
Ava verified: shipped as part of commit b05c4976 'agents web ui: interactive agent interface'. /agents endpoint live on beryllium and returns 200. Moving to Verified.