docs(24-03): complete integration wiring plan — SUMMARY, STATE, ROADMAP updated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nexus Dev 2026-04-01 22:41:26 +00:00
parent ce037c235c
commit f12c07ef47
3 changed files with 144 additions and 12 deletions

View file

@ -13,7 +13,7 @@
- [x] **Phase 21: Chat Foundation** — Persistent conversation storage, sidebar, CRUD, markdown rendering, theme integration, keyboard shortcuts (completed 2026-04-01)
- [x] **Phase 22: Agent Streaming** — Real-time streaming via SSE/WebSocket, agent selector, agent identity on messages, stop/edit/regenerate, slash commands and @mentions (completed 2026-04-01)
- [x] **Phase 23: Brainstormer Flow** — Brainstormer agent persona, structured questioning flow, spec generation, PM handoff, task creation from chat, agent status updates in chat (completed 2026-04-01)
- [ ] **Phase 24: Search, History & Branching** — Full-text search across all conversations, export, conversation branching, message bookmarks
- [x] **Phase 24: Search, History & Branching** — Full-text search across all conversations, export, conversation branching, message bookmarks (completed 2026-04-01)
- [ ] **Phase 25: File System** — Local file storage with dual scoping, libSQL tracking, inline preview, download, agent-generated files, git versioning, placeholder tracking
- [ ] **Phase 26: PWA & Performance** — Service worker, Web App Manifest, responsive mobile layout, push notifications, install prompt, performance targets
@ -94,13 +94,13 @@ Plans:
2. User can bookmark any message and later filter or navigate to bookmarked messages
3. Editing a message that already has a response creates a new branch; both the original and the new branch are preserved and the user can switch between them
4. User can export any conversation as a Markdown file or as a JSON file containing all messages and metadata
**Plans:** 3/4 plans executed
**Plans:** 4/4 plans complete
Plans:
- [x] 24-00-PLAN.md — DB migrations (branch columns, tsvector+GIN, bookmarks table), shared types, Wave 0 test stubs
- [x] 24-01-PLAN.md — Server: search, bookmark, branch, export service methods and Express routes
- [x] 24-02-PLAN.md — UI: ChatSearchDialog, ChatMessageBookmark, ChatBookmarkList, ChatBranchSelector, API client, hooks
- [ ] 24-03-PLAN.md — Wiring: ChatPanel integration, CommandPalette search item, scroll-to-message, bookmark toggle, branch-on-edit
- [x] 24-03-PLAN.md — Wiring: ChatPanel integration, CommandPalette search item, scroll-to-message, bookmark toggle, branch-on-edit
**UI hint**: yes
@ -214,6 +214,6 @@ All 65 v1 requirements are mapped to exactly one phase. No orphans.
| 21. Chat Foundation | v1.3 | 7/7 | Complete | 2026-04-01 |
| 22. Agent Streaming | v1.3 | 6/6 | Complete | 2026-04-01 |
| 23. Brainstormer Flow | v1.3 | 4/4 | Complete | 2026-04-01 |
| 24. Search, History & Branching | v1.3 | 3/4 | In Progress| |
| 24. Search, History & Branching | v1.3 | 4/4 | Complete | 2026-04-01 |
| 25. File System | v1.3 | 0/? | Not started | - |
| 26. PWA & Performance | v1.3 | 0/? | Not started | - |

View file

@ -2,15 +2,15 @@
gsd_state_version: 1.0
milestone: v1.3
milestone_name: milestone
status: executing
stopped_at: Completed 24-search-history-branching-24-02-PLAN.md
last_updated: "2026-04-01T22:34:30.283Z"
status: verifying
stopped_at: Completed 24-search-history-branching-24-03-PLAN.md
last_updated: "2026-04-01T22:41:16.961Z"
last_activity: 2026-04-01
progress:
total_phases: 6
completed_phases: 3
completed_phases: 4
total_plans: 21
completed_plans: 20
completed_plans: 21
percent: 100
---
@ -27,7 +27,7 @@ See: .planning/PROJECT.md (updated 2026-03-30)
Phase: 24 (search-history-branching) — EXECUTING
Plan: 4 of 4
Status: Ready to execute
Status: Phase complete — ready for verification
Last activity: 2026-04-01
Progress: [██████████] 100%
@ -77,6 +77,7 @@ Progress: [██████████] 100%
| Phase 24-search-history-branching P00 | 5 | 2 tasks | 9 files |
| Phase 24-search-history-branching P01 | 12 | 2 tasks | 2 files |
| Phase 24-search-history-branching P02 | 3min | 2 tasks | 7 files |
| Phase 24-search-history-branching P03 | 4 | 3 tasks | 7 files |
## Accumulated Context
@ -128,6 +129,9 @@ Recent decisions affecting current work:
- [Phase 24-search-history-branching]: Used HighlightedText React component instead of innerHTML for term highlighting — eliminates XSS surface
- [Phase 24-search-history-branching]: exportConversation returns URL string (not fetch call) since server sends file download via browser navigation
- [Phase 24-search-history-branching]: shouldFilter=false pattern on Command for server-side FTS — all future search dialogs should follow this
- [Phase 24-search-history-branching]: Custom event nexus:open-chat-search routes search trigger through CommandPalette without Cmd+K conflict
- [Phase 24-search-history-branching]: Branch-on-edit checks editedIdx < messages.length - 1 before calling branchConversation
- [Phase 24-search-history-branching]: bookmarkedMessageIds as Set<string> for O(1) lookup rebuilt from useChatBookmarks per-conversation data
### Pending Todos
@ -140,6 +144,6 @@ None yet.
## Session Continuity
Last session: 2026-04-01T22:34:30.280Z
Stopped at: Completed 24-search-history-branching-24-02-PLAN.md
Last session: 2026-04-01T22:41:16.958Z
Stopped at: Completed 24-search-history-branching-24-03-PLAN.md
Resume file: None

View file

@ -0,0 +1,128 @@
---
phase: 24-search-history-branching
plan: "03"
subsystem: ui
tags: [chat, search, bookmarks, branching, export, integration]
dependency_graph:
requires: ["24-01", "24-02"]
provides: ["CHAT-07", "CHAT-13", "CHAT-14", "HIST-04", "HIST-07", "HIST-08", "HIST-09", "HIST-10", "HIST-11", "HIST-12", "PERF-04"]
affects: ["ChatPanel", "ChatPanelContext", "ChatMessage", "ChatMessageList", "CommandPalette"]
tech_stack:
added: []
patterns:
- "Custom window event (nexus:open-chat-search) for decoupled search trigger from CommandPalette"
- "useChatBookmarks + useToggleBookmark for bookmark state management in ChatPanel"
- "virtualizer.scrollToIndex for programmatic scroll-to-message"
- "Branch-on-edit: branchConversation called when editing messages with subsequent replies"
key_files:
created: []
modified:
- ui/src/context/ChatPanelContext.tsx
- ui/src/components/ChatPanel.tsx
- ui/src/components/ChatMessageList.tsx
- ui/src/components/ChatMessageActions.tsx
- ui/src/components/ChatMessage.tsx
- ui/src/components/CommandPalette.tsx
- ui/src/components/ChatConversationList.tsx
decisions:
- "Custom event nexus:open-chat-search routes search trigger through CommandPalette without Cmd+K conflict (Pitfall 3)"
- "Branch-on-edit checks for subsequent messages (editedIdx < messages.length - 1) before branching"
- "bookmarkedMessageIds as Set<string> for O(1) lookup; rebuilt from useChatBookmarks per-conversation data"
- "ChatMessageBookmark receives empty string placeholders for messageId/conversationId since parent manages state"
- "GitBranch indicator shown via relative positioning overlay on ChatConversationList items with parentConversationId"
metrics:
duration: "4 minutes"
completed_date: "2026-04-01"
tasks_completed: 3
files_modified: 7
---
# Phase 24 Plan 03: Integration Wiring Summary
**One-liner:** Full Phase 24 integration — FTS search via Cmd+K, scroll-to-message, bookmark toggles on all messages, branch-on-edit with branch selector, and Markdown export wired into ChatPanel.
## Tasks Completed
| Task | Name | Commit | Files |
|------|------|--------|-------|
| 1 | ChatPanelContext + ChatPanel wiring (search, branch, export, scroll-to) | 183869d8 | ChatPanelContext.tsx, ChatPanel.tsx, ChatMessageList.tsx, CommandPalette.tsx, ChatConversationList.tsx |
| 2 | ChatMessage + ChatMessageActions bookmark integration | 2b526e78 | ChatMessage.tsx, ChatMessageActions.tsx |
| 3 | Verify complete Phase 24 functionality | auto-approved | (build verification only) |
## What Was Built
### ChatPanelContext — scrollToMessageId
Added `scrollToMessageId: string | null` and `setScrollToMessageId` to the context interface and provider. Allows any component to request scroll navigation to a specific message ID.
### CommandPalette — "Search chat messages"
Added a new command item with value `search-chat` in the Actions group. On select it dispatches `new CustomEvent("nexus:open-chat-search")` then closes the palette. This avoids Cmd+K conflicts by routing through the existing palette pattern.
### ChatPanel — full integration
- Listens for `nexus:open-chat-search` event to open `ChatSearchDialog`
- `onNavigate` callback calls `setActiveConversationId` + `setScrollToMessageId` + closes dialog
- Fetches branches via `useQuery(["chat", "branches", activeConversationId])` and renders `ChatBranchSelector` above message list when branches exist
- Bookmark header button toggles `ChatBookmarkList` in a bounded panel (maxHeight 200px)
- `ChatBookmarkList.onNavigate` wired identically to search navigation
- Export button (Download icon) calls `window.location.href = chatApi.exportConversation(id, "markdown")`
- `handleEdit` detects subsequent messages (`editedIdx < messages.length - 1`) and calls `chatApi.branchConversation` first, then switches to the new branch before re-streaming
- All edit/retry paths invalidate `["chat", "search"]` queries
- `useChatBookmarks(companyId, activeConversationId)` + `useToggleBookmark()` manage bookmark state
- `bookmarkedMessageIds` built as `Set<string>` for O(1) lookup; passed through `ChatMessageList` to each `ChatMessage`
### ChatMessageList — scroll-to-message
- Imports `useChatPanel()` to read `scrollToMessageId` and `setScrollToMessageId`
- `useEffect` on `scrollToMessageId`: finds message index in `displayMessages`, calls `virtualizer.scrollToIndex(index, { align: "center" })`, resets to null
- Added `onBookmark` and `bookmarkedMessageIds` props, threaded into each `ChatMessage`
### ChatMessage — bookmark props
- Added `onBookmark?: (messageId: string) => void` and `isBookmarked?: boolean` to props
- Threads to `ChatMessageActions` for both user and assistant roles
- System/specialized messages (spec_card, handoff, task_created, status_update) are unaffected
### ChatMessageActions — bookmark button
- Added `onBookmark?: () => void` and `isBookmarked?: boolean` props
- Renders `ChatMessageBookmark` as the last action for user messages (inside hover group) and assistant messages (inside hover group)
- System messages return null as before
### ChatConversationList — branch indicators
- Imported `GitBranch` from lucide-react
- Branch conversations (where `parentConversationId` is non-null) get a `GitBranch` icon overlaid via absolute positioning and `pl-4` indent on the conversation item
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] Task 1 and Task 2 implemented in same compilation pass**
- **Found during:** Task 1 build
- **Issue:** TypeScript rejected `onBookmark`/`isBookmarked` props passed from `ChatMessageList` to `ChatMessage` because `ChatMessage` didn't have those props yet (Task 2). Build failed.
- **Fix:** Applied Task 2 (ChatMessage + ChatMessageActions props) before committing Task 1, then committed them as separate logical commits after the build passed.
- **Files modified:** ChatMessage.tsx, ChatMessageActions.tsx
- **Commits:** Task 1: 183869d8, Task 2: 2b526e78
**2. [Rule 1 - Bug] ChatMessageActions assistant section had conflicting Tailwind classes**
- **Found during:** Task 2 implementation review
- **Issue:** Original rewrite had `hidden group-hover:flex` on wrapper div — conflicting visibility classes. The correct pattern (per existing codebase) is `hidden group-hover:inline-flex` on individual buttons.
- **Fix:** Used `hidden group-hover:inline-flex` on buttons/inner wrappers, kept `flex` on container.
- **Files modified:** ChatMessageActions.tsx
- **Commit:** 2b526e78
## Known Stubs
None — all navigation, bookmark toggle, branch creation, and export are fully wired to real API calls.
## Self-Check: PASSED
Files verified:
- ui/src/context/ChatPanelContext.tsx — FOUND
- ui/src/components/ChatPanel.tsx — FOUND
- ui/src/components/ChatMessageList.tsx — FOUND
- ui/src/components/ChatMessage.tsx — FOUND
- ui/src/components/ChatMessageActions.tsx — FOUND
- ui/src/components/CommandPalette.tsx — FOUND
- ui/src/components/ChatConversationList.tsx — FOUND
Commits verified:
- 183869d8 — FOUND (Task 1)
- 2b526e78 — FOUND (Task 2)
Build: pnpm --filter @paperclipai/ui build — PASSED