story-kit: start 86_story_show_live_activity_status_instead_of_static_thinking_indicator_in_chat

This commit is contained in:
Dave
2026-02-24 11:53:56 +00:00
parent 831555043b
commit d2abdb9440

View File

@@ -0,0 +1,34 @@
---
name: "Show live activity status instead of static thinking indicator in chat"
---
# Story 86: Show live activity status instead of static thinking indicator in chat
## User Story
As a user chatting with Claude in the web UI, I want to see what the agent is actually doing (reading files, running commands, etc.) instead of a static "thinking" message, so the application feels responsive and I can follow along.
## Acceptance Criteria
- [ ] When the agent is executing a tool call, the thinking indicator updates to show the tool name and a short summary (e.g. "Reading file: src/main.rs", "Running command: cargo test")
- [ ] The status updates in place without adding new chat bubbles
- [ ] When the agent is between tool calls (actually thinking), it shows "Thinking..."
- [ ] The status text is derived from the streaming events already coming over the WebSocket
- [ ] No new server-side changes needed if the stream already contains tool use events; otherwise add a lightweight status event type
- [ ] Activity indicators must work for Claude Code PTY sessions (used by agents), not just API-based LLM providers. The Claude Code provider must parse tool activity from the stream-json output and forward it via the same on_activity callback used by the Anthropic provider.
## Notes
Previous implementation (now reverted to upcoming) only wired up activity events for the Anthropic API provider. The Claude Code provider in `claude_code.rs` was left with no `on_activity` callback — it only streams text tokens. Since agents use Claude Code, the web UI showed no activity during agent work.
### Implementation hints for the Claude Code provider
1. Add an `on_activity` callback parameter to `ClaudeCodeProvider::chat_stream()` (matching the Anthropic provider signature)
2. In `handle_stream_event()`, parse tool names from Claude Code's stream-json output (tool activity events are already in the stream, just currently ignored — only text deltas are extracted)
3. Call the `on_activity` callback when a tool use event is detected
4. In `chat.rs`, pass the `on_activity` closure to the Claude Code path (same as the Anthropic path already does)
5. `ws.rs` will then send `ToolActivity` WebSocket messages to the frontend — no frontend changes needed
## Out of Scope
- TBD