Commit graph

2000 commits

Author SHA1 Message Date
Nexus Dev
c4c709cd0f docs(phase-23): add validation strategy 2026-04-04 03:55:47 +00:00
Nexus Dev
2fbad4b6c8 docs(23): research brainstormer-flow phase domain 2026-04-04 03:55:47 +00:00
Nexus Dev
e762ddd15c docs(23): fix UI-SPEC spacing — replace 6px/12px with 4px/16px grid values 2026-04-04 03:55:47 +00:00
Nexus Dev
fe61a0bc09 docs(23): UI design contract for brainstormer-flow phase
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 03:55:47 +00:00
Nexus Dev
1f5fae08e2 docs(23): auto-generated context (discuss skipped) 2026-04-04 03:55:47 +00:00
Nexus Dev
36418df0a0 docs(phase-22): mark phase complete — 6/6 plans, 28/28 must-haves verified 2026-04-04 03:55:47 +00:00
Nexus Dev
33f300bf54 docs(22-05): complete final integration plan summary, update state and roadmap
- SUMMARY: virtualized ChatMessageList, fully wired ChatPanel and ChatInput
- STATE: plan 05 complete, phase 22 all 5 plans done, stopped_at updated
- ROADMAP: phase 22 marked Complete (6/6 summaries)
- REQUIREMENTS: PERF-03 marked complete (CHAT-01/08/10/11/12, INPUT-05/06, PERF-02 already complete)
2026-04-04 03:55:47 +00:00
Nexus Dev
8edee91d26 feat(22-05): wire ChatPanel and ChatInput with all Phase 22 features
- ChatPanel integrates useStreamingChat, ChatAgentSelector, ChatStopButton
- Agent routing via resolveAgentFromContent for slash commands and @mentions
- handleEdit: editMessage + truncateMessagesAfter + re-stream with edited content
- handleRetry: finds actual prior user message, truncates from user message onward, re-streams
- Build agentMap from agents for message identity bars
- ChatInput: slash command popover (triggered by / at start of input)
- ChatInput: @mention popover (triggered by @word pattern)
- Input disabled during streaming with 'Waiting for response...' placeholder
- Stop button shown conditionally when isStreaming
- Agent selector in header for per-conversation agent switching
- Remove ScrollArea wrapper (replaced by virtualizer's own scroll in ChatMessageList)
2026-04-04 03:55:47 +00:00
Nexus Dev
954e7819c6 feat(22-05): virtualize ChatMessageList and add chat API edit/truncate methods
- Rewrite ChatMessageList with @tanstack/react-virtual useVirtualizer (estimateSize: 80, overscan: 5)
- Dynamic height measurement via measureElement ref
- Streaming message appended as synthetic __streaming__ entry
- virtualizer.measure() called on streamingContent change (Pitfall 3)
- Jump-to-bottom button when scrolled >200px from bottom
- 3 Skeleton loading placeholders
- Add editMessage, truncateMessagesAfter, deleteMessage to chatApi
- Add postMessageAndStream and savePartialMessage (were missing from prior plan)
- Fix duplicate ChatConversation type exports in packages/shared/src/index.ts (Rule 1 - Bug)
2026-04-04 03:55:47 +00:00
Nexus Dev
724e2b2bd8 feat(22-04): ChatMentionPopover component
- Create ChatMentionPopover (200px, opens upward, agent icon + name + role label)
- Agents filtered by query, max 5 visible, No agents found empty state
- 3 skeleton rows loading state, onOpenAutoFocus prevented for textarea focus
- Include agent-role-colors dependency for worktree build
2026-04-04 03:55:47 +00:00
Nexus Dev
8f0367d0b4 feat(22-04): slash command routing utility and ChatSlashCommandPopover
- Create ui/src/lib/slash-commands.ts with SLASH_COMMANDS (5 commands) and resolveAgentFromContent
- Create ChatSlashCommandPopover (260px, opens upward, /search greyed with Coming soon)
- Add test coverage for routing logic (slash commands, @mentions, fallback)
2026-04-04 03:55:47 +00:00
Nexus Dev
02df3cd1da 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
2026-04-04 03:55:47 +00:00
Nexus Dev
448ab1eea3 docs(22-03): complete message action controls plan — ChatStopButton, ChatMessageActions, ChatMessage edit mode 2026-04-04 03:55:47 +00:00
Nexus Dev
be431c9492 feat(22-03): extend ChatMessage with inline edit mode and action callbacks
- Add id, isAnyStreaming, onEdit, onRetry props to ChatMessageProps
- User messages show edit Pencil on hover via ChatMessageActions
- Edit pencil opens inline textarea with Save/Discard buttons
- Save edit calls onEdit(id, newContent), disabled when textarea empty
- Discard edit reverts to read-only bubble
- Assistant messages show retry RefreshCw via ChatMessageActions
- All edit/retry actions disabled when isAnyStreaming is true
- Update test stubs to reflect new prop surface
2026-04-04 03:55:47 +00:00
Nexus Dev
d88d846b1e feat(22-03): add ChatStopButton and ChatMessageActions components
- ChatStopButton: centered outline button with Square icon and 'Stop generating' label
- ChatMessageActions: edit Pencil for user messages (absolute, group-hover)
- ChatMessageActions: retry RefreshCw for assistant messages (right-aligned, group-hover)
- Both action buttons return null when isStreaming is true
- Proper aria-labels and tooltips on all interactive elements
2026-04-04 03:55:47 +00:00
Nexus Dev
c7887c73ca feat(22-02): ChatAgentSelector component with agent dropdown and role colors
- Create ChatAgentSelector with Popover+Command dropdown
- Show active agent icon, name, and ChevronDown indicator
- 'Select agent' placeholder when no agent selected
- 'No agents configured' empty state via CommandEmpty
- Agent list shows icon, name, and role label per item
- Selection calls onAgentChange and PATCHes conversation via chatApi
- Role-specific colors from agentRoleColors applied to agent icons
- Loading state shows Skeleton placeholder
- Create chat.ts API client with updateConversation supporting agentId
- Create shared types/chat.ts with ChatMessage, ChatConversation types
- Create ChatCodeBlock prerequisite from phase-21 base
- TypeScript compiles clean
2026-04-04 03:55:47 +00:00
Nexus Dev
cf73f3481c feat(22-02): ChatMessageIdentityBar, ChatStreamingCursor, and extended ChatMessage
- Create ChatMessageIdentityBar with agent icon, name, timestamp, and streaming dot
- Create ChatStreamingCursor with animate-cursor-blink and aria-hidden
- Extend ChatMessage with agentName, agentIcon, agentRole, timestamp, isStreaming props
- Wrap assistant messages in group div for hover actions (Plan 03)
- Create agent-role-colors.ts with 11 distinct role colors (light + dark variants)
- Create ChatMarkdownMessage prerequisite from phase-21 base
- All 4 ChatMessageIdentityBar tests pass
2026-04-04 03:55:47 +00:00
Nexus Dev
816945bfb5 docs(22-01): complete SSE streaming endpoint plan 2026-04-04 03:55:47 +00:00
Nexus Dev
0d876ced26 feat(22-01): add useStreamingChat hook, chat API stream method, and unit tests
- Add postMessageAndStream and savePartialMessage to chatApi (fetch ReadableStream for POST SSE)
- Create useStreamingChat hook with startStream, stop, streamingContent, isStreaming
- startTransition wraps token updates to avoid blocking user input (PERF-02)
- AbortController used for stop functionality (CHAT-12)
- stop() saves partial content with [stopped] suffix to DB
- Add @testing-library/react devDependency to enable renderHook testing
- 5 passing unit tests: token accumulation, lifecycle, stop/abort, error, null guard
2026-04-04 03:55:47 +00:00
Nexus Dev
fcc143cc44 feat(22-01): add SSE streaming endpoint and edit/truncate service methods
- Add editMessage, truncateMessagesAfter, streamEcho methods to chatService
- Add POST /conversations/:id/stream SSE endpoint with flushHeaders before loop (PERF-02)
- Add PATCH /conversations/:id/messages/:msgId for message editing
- Add DELETE /conversations/:id/messages/after/:msgId for message truncation
- Import gt from drizzle-orm for createdAt comparison in truncateMessagesAfter
- Guard all res.write() calls with res.writable check (prevents write-after-end)
2026-04-04 03:55:47 +00:00
Nexus Dev
5f646b7d9b docs(22-02): complete agent identity components plan — ChatMessageIdentityBar, ChatAgentSelector, agent-role-colors 2026-04-04 03:55:47 +00:00
Nexus Dev
ce0a2772be docs(22-00): complete Wave 0 foundation plan — migration, types, react-virtual, agent-role-colors, CSS, test stubs 2026-04-04 03:55:47 +00:00
Nexus Dev
b0b849fd62 test(22-00): add Wave 0 test stubs for Phase 22 components and hooks
- useStreamingChat.test.ts (5 todos)
- ChatAgentSelector.test.tsx (5 todos)
- ChatMessage.test.tsx (8 todos)
- ChatSlashCommandPopover.test.tsx (5 todos)
- ChatMentionPopover.test.tsx (4 todos)
- ChatMessageIdentityBar.test.tsx (4 todos)
- ChatMessageList.test.tsx (5 todos)
2026-04-04 03:55:47 +00:00
Nexus Dev
645535195b feat(22-00): DB migration, shared types, react-virtual, agent-role-colors, CSS animation
- Add updatedAt column to chat_messages schema (nullable)
- Create migration 0048_add_chat_messages_updated_at.sql
- Add updatedAt: string | null to ChatMessage shared type
- Install @tanstack/react-virtual in ui workspace
- Create agent-role-colors.ts with 11 distinct themed roles (THEME-03)
- Add agent-role-colors.test.ts (4 tests all passing)
- Add cursor-blink CSS animation with prefers-reduced-motion guard
2026-04-04 03:55:47 +00:00
Nexus Dev
ded9afbaed fix(22): revise plans based on checker feedback 2026-04-04 03:55:47 +00:00
Nexus Dev
9d1a91b4bc docs(22-agent-streaming): create phase plan — 6 plans in 4 waves 2026-04-04 03:55:47 +00:00
Nexus Dev
01bde5398c docs(phase-22): add validation strategy 2026-04-04 03:55:47 +00:00
Nexus Dev
6a5749e985 docs(22): research agent-streaming phase domain 2026-04-04 03:55:47 +00:00
Nexus Dev
3ab0955da9 docs(22): fix UI-SPEC checker blocks — copywriting, typography, spacing, color note
- Replace generic "Save"/"Cancel" with "Save edit"/"Discard edit" in inline edit controls
- Add solution path to agent load error: "Could not load agents. Refresh to try again."
- Eliminate 12px font size by using 13px + text-muted-foreground for slash command descriptions (4 sizes total: 11/13/15/20px)
- Replace gap-1.5 (6px) with gap-2 (8px) in identity bar — multiples-of-4 compliance
- Add theming note on bg-cyan-400 semantic token promotion path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 03:55:47 +00:00
Nexus Dev
cab661688e docs(22): UI design contract for agent-streaming phase
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 03:55:47 +00:00
Nexus Dev
3488815a2b docs(22): auto-generated context (discuss skipped) 2026-04-04 03:55:47 +00:00
Nexus Dev
a6b2e0b695 docs(phase-21): mark phase complete — 7/7 plans, 13/13 must-haves verified 2026-04-04 03:55:47 +00:00
Nexus Dev
17726c4dc3 docs(21-06): complete chat search and Cmd+K gap closure plan
- Add 21-06-SUMMARY.md documenting search filtering and keyboard shortcut
- Advance STATE.md to ready_for_verification, 100% progress
- ROADMAP.md phase 21 marked Complete (7/7 summaries)
2026-04-04 03:55:47 +00:00
Nexus Dev
f6067ed749 feat(21-06): add conversation search input and Cmd+K shortcut
- Add Search/X icons and Input to ChatConversationList with 300ms debounce
- Listen for nexus:focus-chat-search event to focus search input
- Add onSearch handler to useKeyboardShortcuts (fires before input guard)
- Wire Layout Cmd+K to open chat panel and dispatch focus event
2026-04-04 03:55:47 +00:00
Nexus Dev
d6ff48c0f3 feat(21-06): add search and agentId filter to listConversations
- Add ilike import and search/agentId conditions in chatService.listConversations
- Extract search and agentId from req.query in GET /conversations route
- Extend chatApi.listConversations opts with search and agentId params
- Update useChatConversations to accept opts.search and include in queryKey
2026-04-04 03:55:47 +00:00
Nexus Dev
444a3476df docs(21): create gap closure plan for HIST-02 search + INPUT-07 Cmd+K 2026-04-04 03:55:47 +00:00
Nexus Dev
7460061877 docs(21-05): complete chat UI wiring plan — chatApi, TanStack Query hooks, conversation list, message thread
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 03:55:47 +00:00
Nexus Dev
fecab1bcc2 feat(21-05): wire full chat UI with conversation list, message thread, and ChatPanel integration
- Add ChatConversationItem with DropdownMenu actions (Rename, Pin/Unpin, Archive, Delete) and active highlight
- Add ChatConversationList with IntersectionObserver infinite scroll, loading skeletons, delete confirmation dialog, and CRUD handlers
- Add ChatMessageList with auto-scroll-to-bottom on new messages and empty state
- Update ChatPanel to render ChatConversationList (left column) and ChatMessageList (right column); handleSend uses two paths: direct chatApi for new conversations, hook mutation for existing ones
2026-04-04 03:55:47 +00:00
Nexus Dev
c268f2d03e feat(21-05): create chat API client and TanStack Query hooks
- Add ui/src/api/chat.ts with chatApi (7 methods: list/create/get/update/delete conversations + list/post messages)
- Add ui/src/hooks/useChatConversations.ts with useInfiniteQuery + placeholderData + CRUD mutations
- Add ui/src/hooks/useChatMessages.ts with useInfiniteQuery + sendMutation + flattened/reversed messages array
- Fix [Rule 3 - Blocking]: export ChatConversation, ChatMessage, ChatConversationListResponse, ChatMessageListResponse from packages/shared/src/index.ts (types existed in types/chat.ts but were not re-exported at package root)
2026-04-04 03:55:47 +00:00
Nexus Dev
de721ffc05 docs(21-03): complete chat service and REST API plan
- SUMMARY.md created with service/route implementation details
- STATE.md: advanced to plan 5/6, recorded 6min duration, added 3 decisions
- ROADMAP.md: updated phase 21 progress (5/6 summaries)
- REQUIREMENTS.md: marked CHAT-04, CHAT-05, CHAT-06, HIST-05 complete
2026-04-04 03:55:47 +00:00
Nexus Dev
528ad001b5 feat(21-03): add chatRoutes, mount in app.ts, export chat schemas from shared
- chatRoutes factory with 7 REST endpoints for conversations and messages
- All routes gated by assertBoard; company-scoped routes also use assertCompanyAccess
- Mounted as api.use(chatRoutes(db)) after activityRoutes in app.ts
- Export createConversationSchema/updateConversationSchema/createMessageSchema
  from @paperclipai/shared (were missing from main package index)
- 11 vitest route tests passing
2026-04-04 03:55:47 +00:00
Nexus Dev
f4fc4ebf13 docs(21-04): complete chat panel shell plan
- 21-04-SUMMARY.md with task details, deviations, known stubs
- STATE.md: advanced to plan 4, updated progress 67%, added decisions
- ROADMAP.md: phase 21 updated (4/6 summaries)
- REQUIREMENTS.md: INPUT-01 and THEME-01 marked complete
2026-04-04 03:55:47 +00:00
Nexus Dev
036dee3ef1 feat(21-04): create ChatPanel shell and wire into Layout and main.tsx
- ChatPanel: 380px right-side drawer with transition-[width] and hidden md:flex
- Two-column skeleton: 160px conversation list + flex thread area with ChatInput
- Layout: import ChatPanel, MessageSquare, useChatPanel; add chat toggle button
- Layout: useEffect closes PropertiesPanel when chatOpen becomes true
- Layout: ChatPanel rendered before PropertiesPanel in flex row
- main.tsx: ChatPanelProvider wrapping app inside PanelProvider
2026-04-04 03:55:47 +00:00
Nexus Dev
fb423b4d66 feat(21-03): implement chatService with full conversation + message CRUD
- createConversation, listConversations, getConversation, updateConversation
- softDeleteConversation, listMessages, addMessage
- cursor-based pagination with hasMore for both conversations and messages
- Pitfall 3: addMessage bumps conversation updatedAt after insert
- Pitfall 5: addMessage auto-sets title from first user message (IS NULL guard)
- 21 vitest tests passing
2026-04-04 03:55:47 +00:00
Nexus Dev
cbce70a50a feat(21-04): create ChatPanelContext, ChatInput, and ChatMessage components
- ChatPanelContext with localStorage persistence (nexus:chat-panel-open)
- ChatInput with Enter/Shift+Enter/Escape keyboard shortcuts and auto-resize
- ChatMessage renders user bubbles (bg-secondary) and assistant markdown via ChatMarkdownMessage
- ChatInput.test.tsx with 6 passing tests (keyboard shortcuts, max-height, submit state)
2026-04-04 03:55:47 +00:00
Nexus Dev
fde1e0eacb feat(21-02): create ChatCodeBlock and ChatMarkdownMessage components
- ChatMarkdownMessage: renders markdown with rehype-highlight syntax highlighting
- ChatCodeBlock: pre override with language label and copy button (1500ms success state)
- Uses ExtraProps from react-markdown for correct TypeScript types
- All tests pass, TypeScript compiles without errors
2026-04-04 03:55:47 +00:00
Nexus Dev
df44e1eef7 test(21-02): add failing tests for ChatMarkdownMessage and ChatCodeBlock 2026-04-04 03:55:47 +00:00
Nexus Dev
d94879e85b feat(21-02): install rehype-highlight and add hljs theme CSS overrides
- Add rehype-highlight ^7.0.2 to ui/package.json dependencies
- Add highlight.js syntax theme CSS overrides to ui/src/index.css
- Cover Catppuccin Mocha (.dark), Tokyo Night (.theme-tokyo-night), Catppuccin Latte (:root)
2026-04-04 03:55:47 +00:00
Nexus Dev
ecc293a49c test(21-00): add Wave 0 test stubs for chat service, routes, markdown, and input 2026-04-04 03:55:47 +00:00
Nexus Dev
d72ccfbb2c docs(21-02): complete markdown renderer plan — ChatMarkdownMessage, ChatCodeBlock, hljs theme CSS 2026-04-04 03:55:47 +00:00