docs(22-04): complete slash command and mention popover plan

- Create 22-04-SUMMARY.md
- Update STATE.md with plan completion, metrics, decisions
- Update ROADMAP.md plan progress (5/6 summaries)
- Mark requirements INPUT-05, INPUT-06 complete
This commit is contained in:
Nexus Dev 2026-04-01 18:29:24 +00:00
parent 448ab1eea3
commit 02df3cd1da
4 changed files with 128 additions and 16 deletions

View file

@ -33,8 +33,8 @@
- [ ] **INPUT-02** — File/image upload via drag-and-drop or button with inline preview before sending
- [ ] **INPUT-03** — Paste image from clipboard directly into the chat input
- [ ] **INPUT-04** — Voice input via Whisper (when local AI is enabled): record button with transcription preview before sending
- [ ] **INPUT-05** — Slash commands: `/brainstorm`, `/ask-pm`, `/ask-engineer`, `/task`, `/search`
- [ ] **INPUT-06**`@mention` agents: type `@engineer` to route a message to a specific agent
- [x] **INPUT-05** — Slash commands: `/brainstorm`, `/ask-pm`, `/ask-engineer`, `/task`, `/search`
- [x] **INPUT-06**`@mention` agents: type `@engineer` to route a message to a specific agent
- [x] **INPUT-07** — Keyboard shortcuts: Enter to send, Shift+Enter for newline, Cmd+K for search, Escape to cancel
### Agent Integration (7)
@ -136,8 +136,8 @@ The following are explicitly deferred:
| INPUT-02 | Phase 25 | Pending |
| INPUT-03 | Phase 25 | Pending |
| INPUT-04 | Phase 25 | Pending |
| INPUT-05 | Phase 22 | Pending |
| INPUT-06 | Phase 22 | Pending |
| INPUT-05 | Phase 22 | Complete |
| INPUT-06 | Phase 22 | Complete |
| INPUT-07 | Phase 21 | Complete |
| AGENT-01 | Phase 23 | Pending |
| AGENT-02 | Phase 23 | Pending |

View file

@ -55,14 +55,14 @@ 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:** 4/6 plans executed
**Plans:** 5/6 plans executed
Plans:
- [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
- [x] 22-04-PLAN.md — Slash commands and @mention popovers
- [ ] 22-05-PLAN.md — Virtualized message list + full ChatPanel integration
**UI hint**: yes
@ -79,10 +79,10 @@ Plans:
**Plans:** 6 plans
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 | 4/6 | In Progress| |
| 22. Agent Streaming | v1.3 | 5/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 | - |

View file

@ -3,14 +3,14 @@ gsd_state_version: 1.0
milestone: v1.3
milestone_name: milestone
status: verifying
stopped_at: Completed 22-agent-streaming-22-03-PLAN.md
last_updated: "2026-04-01T18:26:18.923Z"
stopped_at: Completed 22-agent-streaming-22-04-PLAN.md
last_updated: "2026-04-01T18:29:07.906Z"
last_activity: 2026-04-01
progress:
total_phases: 6
completed_phases: 1
total_plans: 13
completed_plans: 11
completed_plans: 12
percent: 0
---
@ -68,6 +68,7 @@ Progress: [░░░░░░░░░░] 0%
| 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 |
| Phase 22-agent-streaming P04 | 4min | 2 tasks | 5 files |
## Accumulated Context
@ -103,6 +104,7 @@ Recent decisions affecting current work:
- [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
- [Phase 22-agent-streaming]: /search disabled with Coming soon; resolveAgentFromContent routes slash > @mention > active agent
### Pending Todos
@ -115,6 +117,6 @@ None yet.
## Session Continuity
Last session: 2026-04-01T18:26:18.920Z
Stopped at: Completed 22-agent-streaming-22-03-PLAN.md
Last session: 2026-04-01T18:29:07.903Z
Stopped at: Completed 22-agent-streaming-22-04-PLAN.md
Resume file: None

View file

@ -0,0 +1,110 @@
---
phase: 22-agent-streaming
plan: "04"
subsystem: ui
tags: [react, slash-commands, mention, popover, shadcn, routing]
# Dependency graph
requires:
- phase: 22-00
provides: agent-role-colors, AgentRole type, Wave 0 test stubs
- phase: 22-02
provides: AgentIcon component from AgentIconPicker
provides:
- ChatSlashCommandPopover component (260px, opens upward, 5 slash commands)
- ChatMentionPopover component (200px, opens upward, agent autocomplete)
- slash-commands.ts utility with SLASH_COMMANDS and resolveAgentFromContent
affects: [22-05, ChatInput wiring plan]
# Tech tracking
tech-stack:
added: []
patterns:
- "Popover with side=top opens popovers upward anchored to textarea"
- "onOpenAutoFocus prevented to preserve textarea focus during popover interaction"
- "resolveAgentFromContent: slash command priority > @mention priority > active agent fallback"
- "Disabled commands shown with opacity-50 and (Coming soon) suffix"
key-files:
created:
- ui/src/lib/slash-commands.ts
- ui/src/components/ChatSlashCommandPopover.tsx
- ui/src/components/ChatSlashCommandPopover.test.tsx
- ui/src/components/ChatMentionPopover.tsx
- ui/src/components/ChatMentionPopover.test.tsx
modified: []
key-decisions:
- "/search command defined with routesTo: null and disabled: true — displayed greyed with Coming soon suffix per UI spec"
- "resolveAgentFromContent prioritizes slash commands over @mentions, falls back to activeAgentId"
- "ChatMentionPopover limits display to 5 agents (slice(0,5)) with scroll container"
- "// @vitest-environment jsdom pragma added to component tests for JSX dynamic import support"
patterns-established:
- "Slash command routing: SLASH_COMMANDS array + resolveAgentFromContent function for agent routing from message content"
- "Popover autocomplete pattern: Popover > PopoverTrigger asChild > PopoverContent (side=top, onOpenAutoFocus prevented)"
requirements-completed: [INPUT-05, INPUT-06]
# Metrics
duration: 4min
completed: 2026-04-01
---
# Phase 22 Plan 04: Slash Command and @Mention Popovers Summary
**Slash command routing table (5 commands, /search disabled) and agent @mention autocomplete popover — both standalone, wired into ChatInput in plan 05.**
## Performance
- **Duration:** 4 min
- **Started:** 2026-04-01T18:23:41Z
- **Completed:** 2026-04-01T18:27:49Z
- **Tasks:** 2 completed
- **Files modified:** 5
## Accomplishments
- Created `slash-commands.ts` with `SLASH_COMMANDS` (5 entries) and `resolveAgentFromContent` routing function that prioritizes slash commands over @mentions over active agent fallback
- Created `ChatSlashCommandPopover` — 260px popover opening upward with command list; /search greyed with "Coming soon" per UI spec
- Created `ChatMentionPopover` — 200px popover opening upward showing agent icon + name + role label, filtered by query, max 5 agents, loading skeleton, empty state
## Task Commits
1. **Task 1: Slash command routing utility and ChatSlashCommandPopover** - `99d01d9e` (feat)
2. **Task 2: ChatMentionPopover component** - `a3bb02c5` (feat)
## Files Created/Modified
- `ui/src/lib/slash-commands.ts` — SLASH_COMMANDS array and resolveAgentFromContent routing utility
- `ui/src/components/ChatSlashCommandPopover.tsx` — 260px slash command popover with cmdk Command component
- `ui/src/components/ChatSlashCommandPopover.test.tsx` — routing logic tests (5 pass) + export smoke test
- `ui/src/components/ChatMentionPopover.tsx` — 200px agent mention autocomplete with icon/name/role rows
- `ui/src/components/ChatMentionPopover.test.tsx` — export smoke test + 4 todo items for future wiring tests
- `ui/src/lib/agent-role-colors.ts` — dependency copy for worktree build (exists in phase-22 branch from plan 22-00)
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Added jsdom pragma to component tests**
- **Found during:** Task 1 test verification
- **Issue:** Dynamic `import()` of JSX component failed with `react/jsx-dev-runtime` error in node test environment
- **Fix:** Added `// @vitest-environment jsdom` pragma to both test files, matching existing pattern in ChatAgentSelector.test.tsx
- **Files modified:** ChatSlashCommandPopover.test.tsx, ChatMentionPopover.test.tsx
- **Commit:** 99d01d9e
**2. [Rule 3 - Blocking] Added agent-role-colors.ts to worktree**
- **Found during:** Task 2 implementation
- **Issue:** Worktree branch lacks phase-22-00 foundation files; ChatMentionPopover imports agent-role-colors which didn't exist in worktree
- **Fix:** Created agent-role-colors.ts with identical content to phase-22 branch version
- **Files modified:** ui/src/lib/agent-role-colors.ts (new file, already exists on phase-22 branch)
- **Commit:** a3bb02c5
- **Note:** When cherry-picked to gsd/phase-22-agent-streaming, this will be a no-op (file already exists with same content)
## Known Stubs
- `ChatMentionPopover.test.tsx`: 4 `it.todo()` items for render/interaction tests — per plan spec, wiring tests deferred until ChatInput integration in plan 22-05
- `ChatSlashCommandPopover.test.tsx` component test section: export smoke test only — render/interaction tests deferred per plan spec
## Self-Check: PASSED