diff --git a/.planning/REQUIREMENTS.md b/.planning/REQUIREMENTS.md index 7f683944..7dcaa06b 100644 --- a/.planning/REQUIREMENTS.md +++ b/.planning/REQUIREMENTS.md @@ -21,8 +21,8 @@ - [ ] **CHAT-07** — Full-text search across all conversations - [x] **CHAT-08** — Agent selector: switch which agent you are talking to mid-conversation or per-conversation - [ ] **CHAT-09** — System message indicator: when the Brainstormer hands off to PM, or PM delegates to Engineer, the handoff is visible in chat -- [ ] **CHAT-10** — Message editing: edit a previous message and regenerate the response -- [ ] **CHAT-11** — Response regeneration: retry button on any assistant message +- [x] **CHAT-10** — Message editing: edit a previous message and regenerate the response +- [x] **CHAT-11** — Response regeneration: retry button on any assistant message - [x] **CHAT-12** — Stop generation: cancel button available while a response is streaming - [ ] **CHAT-13** — Message reactions / bookmarks: mark important messages for later reference - [ ] **CHAT-14** — Conversation branching: editing a mid-conversation message creates a branch; both branches are preserved @@ -127,8 +127,8 @@ The following are explicitly deferred: | CHAT-07 | Phase 24 | Pending | | CHAT-08 | Phase 22 | Complete | | CHAT-09 | Phase 23 | Pending | -| CHAT-10 | Phase 22 | Pending | -| CHAT-11 | Phase 22 | Pending | +| CHAT-10 | Phase 22 | Complete | +| CHAT-11 | Phase 22 | Complete | | CHAT-12 | Phase 22 | Complete | | CHAT-13 | Phase 24 | Pending | | CHAT-14 | Phase 24 | Pending | diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index a8187d18..c3eff45d 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -55,13 +55,13 @@ Plans: 4. User can click Stop to cancel an in-progress streaming response 5. User can edit a previous message to regenerate the response, or click Retry on any existing assistant message; conversations with 1,000+ messages scroll without jank via a virtualized list 6. Slash commands (`/brainstorm`, `/ask-pm`, `/ask-engineer`, `/task`, `/search`) route messages to the correct agent; `@mention` syntax routes to the named agent -**Plans:** 0/6 plans executed +**Plans:** 4/6 plans executed Plans: -- [ ] 22-00-PLAN.md — Wave 0: DB migration, shared types, install virtualizer, agent-role-colors, CSS, test stubs -- [ ] 22-01-PLAN.md — SSE streaming endpoint + useStreamingChat hook -- [ ] 22-02-PLAN.md — Agent identity bar, streaming cursor, agent selector -- [ ] 22-03-PLAN.md — Edit/retry/stop message action controls +- [x] 22-00-PLAN.md — Wave 0: DB migration, shared types, install virtualizer, agent-role-colors, CSS, test stubs +- [x] 22-01-PLAN.md — SSE streaming endpoint + useStreamingChat hook +- [x] 22-02-PLAN.md — Agent identity bar, streaming cursor, agent selector +- [x] 22-03-PLAN.md — Edit/retry/stop message action controls - [ ] 22-04-PLAN.md — Slash commands and @mention popovers - [ ] 22-05-PLAN.md — Virtualized message list + full ChatPanel integration **UI hint**: yes @@ -231,7 +231,7 @@ All 65 v1 requirements are mapped to exactly one phase. No orphans. | Phase | Milestone | Plans Complete | Status | Completed | |-------|-----------|----------------|--------|-----------| | 21. Chat Foundation | v1.3 | 7/7 | Complete | 2026-04-01 | -| 22. Agent Streaming | v1.3 | 0/6 | Planned | | +| 22. Agent Streaming | v1.3 | 4/6 | In Progress| | | 23. Brainstormer Flow | v1.3 | 0/? | Not started | - | | 24. Search, History & Branching | v1.3 | 0/? | Not started | - | | 25. File System | v1.3 | 0/? | Not started | - | diff --git a/.planning/STATE.md b/.planning/STATE.md index 12df1dd0..587ae48a 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -3,14 +3,14 @@ gsd_state_version: 1.0 milestone: v1.3 milestone_name: milestone status: verifying -stopped_at: Completed 22-agent-streaming-22-01-PLAN.md -last_updated: "2026-04-01T18:12:02.505Z" +stopped_at: Completed 22-agent-streaming-22-03-PLAN.md +last_updated: "2026-04-01T18:26:18.923Z" last_activity: 2026-04-01 progress: total_phases: 6 completed_phases: 1 total_plans: 13 - completed_plans: 7 + completed_plans: 11 percent: 0 --- @@ -67,6 +67,7 @@ Progress: [░░░░░░░░░░] 0% | Phase 21-chat-foundation P05 | 4 | 3 tasks | 8 files | | Phase 21-chat-foundation P06 | 10min | 2 tasks | 7 files | | Phase 22-agent-streaming P01 | 6min | 2 tasks | 6 files | +| Phase 22-agent-streaming P03 | 3 | 2 tasks | 4 files | ## Accumulated Context @@ -101,6 +102,7 @@ Recent decisions affecting current work: - [Phase 22-agent-streaming]: Use fetch ReadableStream instead of EventSource for POST SSE streaming endpoint - [Phase 22-agent-streaming]: streamEcho stub yields word-by-word with 50ms delay; Phase 23 replaces with real LLM adapter - [Phase 22-agent-streaming]: Partial content on stop saved with [stopped] suffix via chatApi.savePartialMessage +- [Phase 22-agent-streaming]: isAnyStreaming prop (not isStreaming) distinguishes global streaming state for disabling edit/retry globally in ChatMessage ### Pending Todos @@ -113,6 +115,6 @@ None yet. ## Session Continuity -Last session: 2026-04-01T18:12:02.502Z -Stopped at: Completed 22-agent-streaming-22-01-PLAN.md +Last session: 2026-04-01T18:26:18.920Z +Stopped at: Completed 22-agent-streaming-22-03-PLAN.md Resume file: None diff --git a/.planning/phases/22-agent-streaming/22-03-SUMMARY.md b/.planning/phases/22-agent-streaming/22-03-SUMMARY.md new file mode 100644 index 00000000..01b294d3 --- /dev/null +++ b/.planning/phases/22-agent-streaming/22-03-SUMMARY.md @@ -0,0 +1,96 @@ +--- +phase: 22-agent-streaming +plan: "03" +subsystem: ui +tags: [react, streaming, chat, edit, retry, stop-button, tooltips] + +# Dependency graph +requires: + - phase: 22-02 + provides: ChatMessage with agentName/identity bar, ChatStreamingCursor, group-hover div wrapper + +provides: + - ChatStopButton component (centered outline button with Square icon) + - ChatMessageActions component (edit Pencil for user, retry RefreshCw for assistant) + - ChatMessage extended with inline edit mode, isAnyStreaming, onEdit/onRetry callbacks + +affects: + - 22-04 (ChatPanel integration — will wire onEdit/onRetry/stop callbacks) + - Any component that renders ChatMessage + +# Tech tracking +tech-stack: + added: [] + patterns: + - group-hover pattern for hover-triggered action buttons on chat bubbles + - isAnyStreaming gate — passes to ChatMessageActions to globally disable edit/retry during streaming + - inline edit mode with useState(isEditing) + useState(editValue) in ChatMessage + +key-files: + created: + - ui/src/components/ChatStopButton.tsx + - ui/src/components/ChatMessageActions.tsx + modified: + - ui/src/components/ChatMessage.tsx + - ui/src/components/ChatMessage.test.tsx + +key-decisions: + - "isAnyStreaming prop added to ChatMessage (not isStreaming) — distinguishes 'this msg is streaming' from 'any msg is streaming' for disabling global edit/retry" + - "ChatMessageActions returns null when isStreaming — clean conditional render, no CSS toggling" + +patterns-established: + - "Pattern: group-hover action buttons — parent div has 'group' class, action buttons use 'hidden group-hover:flex' to show on hover" + - "Pattern: inline edit mode — useState(isEditing) in ChatMessage; textarea pre-filled with content; Save calls onEdit(id, newContent)" + +requirements-completed: [CHAT-10, CHAT-11, CHAT-12] + +# Metrics +duration: 3min +completed: 2026-04-01 +--- + +# Phase 22 Plan 03: Message Action Controls Summary + +**Edit/retry/stop controls wired to ChatMessage — user messages get inline edit textarea, assistant messages get retry RefreshCw, stop button component ready for ChatPanel.** + +## Performance + +- **Duration:** ~3 min +- **Started:** 2026-04-01T18:22:48Z +- **Completed:** 2026-04-01T18:25:20Z +- **Tasks:** 2 completed +- **Files modified:** 4 + +## Accomplishments + +- ChatStopButton: centered outline button with Square (filled) icon, border-t container, aria-label for accessibility +- ChatMessageActions: Pencil edit at top-right of user bubble (absolute, group-hover), RefreshCw retry below assistant message (right-aligned, group-hover); both hidden when isStreaming +- ChatMessage extended with inline edit mode (textarea + Save/Discard), isAnyStreaming global gate, onEdit/onRetry callback props + +## Task Commits + +Each task was committed atomically: + +1. **Task 1: ChatStopButton and ChatMessageActions components** - `ddf071c7` (feat) +2. **Task 2: Extend ChatMessage with inline edit mode and wire action callbacks** - `3d86f62a` (feat) + +**Plan metadata:** (docs commit below) + +## Files Created/Modified + +- `ui/src/components/ChatStopButton.tsx` - Stop generation button, centered, variant="outline" size="sm", Square icon +- `ui/src/components/ChatMessageActions.tsx` - Edit/retry action buttons with Tooltip, aria-labels, group-hover visibility +- `ui/src/components/ChatMessage.tsx` - Extended with id, isAnyStreaming, onEdit, onRetry; inline edit textarea mode +- `ui/src/components/ChatMessage.test.tsx` - Updated test stubs; 1 passing export test + 10 todos + +## Deviations from Plan + +None - plan executed exactly as written. + +## Self-Check: PASSED + +- `ui/src/components/ChatStopButton.tsx` — exists +- `ui/src/components/ChatMessageActions.tsx` — exists +- `ui/src/components/ChatMessage.tsx` — exists (modified) +- `ddf071c7` — confirmed in git log +- `3d86f62a` — confirmed in git log