docs(22-00): complete Wave 0 foundation plan — migration, types, react-virtual, agent-role-colors, CSS, test stubs

This commit is contained in:
Nexus Dev 2026-04-01 18:08:53 +00:00
parent b0b849fd62
commit ce0a2772be
4 changed files with 143 additions and 16 deletions

View file

@ -71,7 +71,7 @@
- [x] **THEME-01** — Chat interface respects the Nexus theme system (Catppuccin Mocha, Tokyo Night, Catppuccin Latte)
- [x] **THEME-02** — Code blocks use theme-appropriate syntax highlighting colors
- [ ] **THEME-03** — Agent avatars/colors are visually distinguishable in all three themes
- [x] **THEME-03** — Agent avatars/colors are visually distinguishable in all three themes
### Performance (5)
@ -162,7 +162,7 @@ The following are explicitly deferred:
| PWA-08 | Phase 26 | Pending |
| THEME-01 | Phase 21 | Complete |
| THEME-02 | Phase 21 | Complete |
| THEME-03 | Phase 22 | Pending |
| THEME-03 | Phase 22 | Complete |
| PERF-01 | Phase 26 | Pending |
| PERF-02 | Phase 22 | Pending |
| PERF-03 | Phase 22 | Pending |

View file

@ -55,10 +55,10 @@ 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:** 6 plans
**Plans:** 1/6 plans executed
Plans:
- [ ] 22-00-PLAN.md — Wave 0: DB migration, shared types, install virtualizer, agent-role-colors, CSS, test stubs
- [x] 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
@ -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/? | Not started | - |
| 22. Agent Streaming | v1.3 | 1/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

@ -2,15 +2,15 @@
gsd_state_version: 1.0
milestone: v1.3
milestone_name: milestone
status: verifying
stopped_at: Completed 21-chat-foundation-21-06-PLAN.md
last_updated: "2026-04-01T17:20:34.099Z"
status: executing
stopped_at: Completed 22-agent-streaming-22-00-PLAN.md
last_updated: "2026-04-01T18:08:37.459Z"
last_activity: 2026-04-01
progress:
total_phases: 6
completed_phases: 1
total_plans: 7
completed_plans: 7
total_plans: 13
completed_plans: 8
percent: 0
---
@ -21,13 +21,13 @@ progress:
See: .planning/PROJECT.md (updated 2026-03-30)
**Core value:** Fresh onboard asks for ONE thing (root directory), auto-creates PM + Engineer, drops you in dashboard — no corporate language anywhere.
**Current focus:** Phase 21 — chat-foundation
**Current focus:** Phase 22 — agent-streaming
## Current Position
Phase: 22
Plan: Not started
Status: Phase complete — ready for verification
Phase: 22 (agent-streaming) — EXECUTING
Plan: 2 of 6
Status: Ready to execute
Last activity: 2026-04-01
Progress: [░░░░░░░░░░] 0%
@ -66,6 +66,7 @@ Progress: [░░░░░░░░░░] 0%
| Phase 21-chat-foundation P03 | 6 | 2 tasks | 6 files |
| Phase 21-chat-foundation P05 | 4 | 3 tasks | 8 files |
| Phase 21-chat-foundation P06 | 10min | 2 tasks | 7 files |
| Phase 22-agent-streaming P00 | 8min | 2 tasks | 14 files |
## Accumulated Context
@ -97,6 +98,8 @@ Recent decisions affecting current work:
- [Phase 21-chat-foundation]: messages array in useChatMessages flattened from pages and reversed so display is chronological (API returns desc by createdAt)
- [Phase 21-chat-foundation]: Custom window event (nexus:focus-chat-search) used instead of forwardRef drilling to focus search input from Cmd+K
- [Phase 21-chat-foundation]: Cmd+K handler placed before input-guard early return in useKeyboardShortcuts so it fires globally even from input/textarea
- [Phase 22-agent-streaming]: THEME-03: 11 agent roles each have unique Tailwind color — pm=blue, engineer=violet, ceo=amber, general=slate, designer=pink, qa=orange, researcher=teal, devops=emerald, cto=indigo, cmo=rose, cfo=cyan
- [Phase 22-agent-streaming]: updatedAt on chat_messages is nullable (no .notNull()) — existing rows will have null until updated, prevents data migration requirement
### Pending Todos
@ -109,6 +112,6 @@ None yet.
## Session Continuity
Last session: 2026-04-01T17:16:25.958Z
Stopped at: Completed 21-chat-foundation-21-06-PLAN.md
Last session: 2026-04-01T18:08:37.456Z
Stopped at: Completed 22-agent-streaming-22-00-PLAN.md
Resume file: None

View file

@ -0,0 +1,124 @@
---
phase: 22-agent-streaming
plan: "00"
subsystem: database, ui, testing
tags: [drizzle, tailwind, tanstack-virtual, vitest, chat, agent-roles]
# Dependency graph
requires:
- phase: 21-chat-foundation
provides: chat_messages schema, ChatMessage type, existing chat UI components
provides:
- updatedAt column on chat_messages table (migration 0048)
- updatedAt field on ChatMessage shared type
- @tanstack/react-virtual installed in ui workspace
- agentRoleColors utility with 11 distinct themed role colors (THEME-03)
- agentRoleColorDefault fallback
- cursor-blink CSS animation with reduced-motion guard
- 7 Wave 0 test stub files for Phase 22 components/hooks
affects: [22-01, 22-02, 22-03, 22-04, 22-05]
# Tech tracking
tech-stack:
added: ["@tanstack/react-virtual"]
patterns: ["agent-role-colors utility (Record<AgentRole, string> with light+dark variants)", "it.todo() Wave 0 test scaffolding (established in Phase 21)"]
key-files:
created:
- packages/db/src/migrations/0048_add_chat_messages_updated_at.sql
- ui/src/lib/agent-role-colors.ts
- ui/src/lib/agent-role-colors.test.ts
- ui/src/hooks/useStreamingChat.test.ts
- ui/src/components/ChatAgentSelector.test.tsx
- ui/src/components/ChatMessage.test.tsx
- ui/src/components/ChatSlashCommandPopover.test.tsx
- ui/src/components/ChatMentionPopover.test.tsx
- ui/src/components/ChatMessageIdentityBar.test.tsx
- ui/src/components/ChatMessageList.test.tsx
modified:
- packages/db/src/schema/chat_messages.ts
- packages/shared/src/types/chat.ts
- ui/src/index.css
- ui/package.json
key-decisions:
- "THEME-03: 11 agent roles each assigned a unique Tailwind color class — pm=blue, engineer=violet, ceo=amber, general=slate, designer=pink, qa=orange, researcher=teal, devops=emerald, cto=indigo, cmo=rose, cfo=cyan"
- "updatedAt on chat_messages is nullable (no .notNull()) — existing rows will have null until updated"
patterns-established:
- "agentRoleColors pattern: Record<AgentRole, string> with 'text-X-600 dark:text-X-400' dual-variant format, mirrors status-colors.ts convention"
- "CSS animation pattern: @keyframes + .animate-* class + @media prefers-reduced-motion guard"
requirements-completed: [THEME-03]
# Metrics
duration: 8min
completed: 2026-04-01
---
# Phase 22 Plan 00: Wave 0 Foundation Summary
**DB migration adding updated_at to chat_messages, ChatMessage type update, @tanstack/react-virtual install, 11-role agent-role-colors utility (THEME-03), cursor-blink CSS animation, and 7 Wave 0 test stubs**
## Performance
- **Duration:** 8 min
- **Started:** 2026-04-01T18:05:00Z
- **Completed:** 2026-04-01T18:13:00Z
- **Tasks:** 2
- **Files modified:** 14
## Accomplishments
- chat_messages schema and migration 0048 add nullable updated_at column
- @tanstack/react-virtual installed and ChatMessage type updated with updatedAt: string | null
- agent-role-colors.ts covers all 11 AgentRole values with visually distinct colors (THEME-03 — no two roles share a color), tested with 4-test suite
- cursor-blink CSS animation with prefers-reduced-motion guard added to index.css
- 7 test stub files created covering all Phase 22 components and hooks
## Task Commits
Each task was committed atomically:
1. **Task 1: DB migration, shared types, react-virtual, agent-role-colors, CSS animation** - `96b27119` (feat)
2. **Task 2: Wave 0 test stubs for Phase 22 components/hooks** - `baba7e3a` (test)
## Files Created/Modified
- `packages/db/src/migrations/0048_add_chat_messages_updated_at.sql` - ALTER TABLE to add updated_at with DEFAULT now()
- `packages/db/src/schema/chat_messages.ts` - Added updatedAt column (nullable timestamp)
- `packages/shared/src/types/chat.ts` - Added updatedAt: string | null to ChatMessage interface
- `ui/package.json` - Added @tanstack/react-virtual dependency
- `ui/src/lib/agent-role-colors.ts` - Record<AgentRole, string> with 11 distinct light+dark color pairs
- `ui/src/lib/agent-role-colors.test.ts` - 4 tests: coverage, dark variants, default, uniqueness
- `ui/src/index.css` - cursor-blink keyframes + .animate-cursor-blink + reduced-motion guard
- `ui/src/hooks/useStreamingChat.test.ts` - 5 it.todo() stubs
- `ui/src/components/ChatAgentSelector.test.tsx` - 5 it.todo() stubs
- `ui/src/components/ChatMessage.test.tsx` - 8 it.todo() stubs
- `ui/src/components/ChatSlashCommandPopover.test.tsx` - 5 it.todo() stubs
- `ui/src/components/ChatMentionPopover.test.tsx` - 4 it.todo() stubs
- `ui/src/components/ChatMessageIdentityBar.test.tsx` - 4 it.todo() stubs
- `ui/src/components/ChatMessageList.test.tsx` - 5 it.todo() stubs
## Decisions Made
- THEME-03: Each of the 11 roles gets a unique hue family — pm=blue, engineer=violet, ceo=amber, general=slate, designer=pink, qa=orange, researcher=teal, devops=emerald, cto=indigo, cmo=rose, cfo=cyan. Previous plans had duplicates (ceo+general yellow, etc.) which this corrects.
- updatedAt nullable (no .notNull()): existing rows left as null until touched, prevents data migration requirement.
## Deviations from Plan
None - plan executed exactly as written.
## Issues Encountered
None — all acceptance criteria met on first attempt. TypeScript type check passes clean.
## Known Stubs
None — test stubs are intentional Wave 0 scaffolding (it.todo pattern), not data stubs. All 7 stub files will be implemented in Plans 22-01 through 22-05.
## Next Phase Readiness
- All Wave 0 foundations in place for Phase 22 Plans 01-05
- agent-role-colors.ts ready for ChatMessageIdentityBar (Plan 22-03)
- @tanstack/react-virtual ready for ChatMessageList virtualization (Plan 22-04)
- cursor-blink animation ready for ChatStreamingCursor (Plan 22-02)
- DB migration 0048 ready for server-side streaming response inclusion of updatedAt
---
*Phase: 22-agent-streaming*
*Completed: 2026-04-01*