From 0b5acd2ec1421a5f3ef949c8ac51771d8a34cd8c Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Wed, 25 Feb 2026 19:49:04 -0600 Subject: [PATCH] docs: initialize MS19 Chat & Terminal mission planning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update PRD: Coolify → Portainer, add MS18 completion, add MS19 FRs/acceptance criteria - New MISSION-MANIFEST.md for MS19-ChatTerminal mission - New TASKS.md with 12-task breakdown (~250K token estimate) - New scratchpad for MS19 mission - Archive MS18 TASKS.md to docs/tasks/ - Gitea milestone MS19-ChatTerminal created, issues #508-#512 Co-Authored-By: Claude Opus 4.6 --- docs/MISSION-MANIFEST.md | 83 ++++++------ docs/PRD.md | 121 ++++++++++++++---- docs/TASKS.md | 75 +++++++---- .../ms19-chat-terminal-20260225.md | 88 +++++++++++++ docs/tasks/MS18-ThemeWidgets-tasks.md | 34 +++++ 5 files changed, 312 insertions(+), 89 deletions(-) create mode 100644 docs/scratchpads/ms19-chat-terminal-20260225.md create mode 100644 docs/tasks/MS18-ThemeWidgets-tasks.md diff --git a/docs/MISSION-MANIFEST.md b/docs/MISSION-MANIFEST.md index 8aeb5d0..86ee372 100644 --- a/docs/MISSION-MANIFEST.md +++ b/docs/MISSION-MANIFEST.md @@ -1,65 +1,72 @@ -# Mission Manifest — MS18 Theme & Widget System +# Mission Manifest — MS19 Chat & Terminal System > Persistent document tracking full mission scope, status, and session history. > Updated by the orchestrator at each phase transition and milestone completion. ## Mission -**ID:** ms18-theme-widgets-20260223 -**Statement:** Implement MS18 (Theme & Widget System) — multi-theme package system, customizable widget dashboard, WYSIWYG knowledge editor, and enhanced Kanban filtering -**Phase:** Complete -**Current Milestone:** MS18-ThemeWidgets -**Progress:** 1 / 1 milestones -**Status:** complete -**Last Updated:** 2026-02-24T03:00Z +**ID:** ms19-chat-terminal-20260225 +**Statement:** Implement MS19 (Chat & Terminal System) — real terminal with PTY backend, chat streaming, master chat polish, project-level orchestrator chat, and agent output integration +**Phase:** Planning +**Current Milestone:** MS19-ChatTerminal +**Progress:** 0 / 1 milestones +**Status:** planning +**Last Updated:** 2026-02-25T20:00Z ## Success Criteria -1. Theme system supports 5+ themes (dark, light, + 3 additional built-in) -2. Themes are defined as TypeScript packages with CSS variable overrides -3. Theme selection UI in Settings with live preview swatches -4. UserPreference.theme persists selected theme across sessions -5. Dashboard uses customizable WidgetGrid (drag, resize, add, remove widgets) -6. Widget picker UI allows browsing and adding widgets from registry -7. Per-widget configuration dialog (data source, filters, colors) -8. Layout save/load/rename via UserLayout API -9. WYSIWYG editor (Tiptap) for knowledge entries with toolbar -10. Markdown ↔ rich text round-trip (import/export) -11. Kanban board supports project-level and user-level filtering -12. Kanban filter bar: project, assignee, priority, search -13. All features support all themes (dark/light + new themes) -14. Lint, typecheck, and tests pass -15. Deployed and smoke-tested at mosaic.woltje.com +1. Terminal panel has real xterm.js with PTY backend via WebSocket +2. Terminal supports multiple named sessions (create/close/rename tabs) +3. Terminal sessions persist in PostgreSQL and recover on reconnect +4. Chat streaming renders tokens in real-time via SSE +5. Master chat sidebar accessible from any page (Cmd+Shift+J / Cmd+K) +6. Master chat supports model selection, temperature, conversation management +7. Project-level chat can trigger orchestrator actions (/spawn, /status, /jobs) +8. Agent output from orchestrator viewable in terminal tabs +9. All features support all 5 themes (Dark, Light, Nord, Dracula, Solarized) +10. Lint, typecheck, and tests pass +11. Deployed and smoke-tested at mosaic.woltje.com + +## Existing Infrastructure + +Key components already built that MS19 builds upon: + +| Component | Status | Location | +| --------------------------------- | ------------------- | ------------------------------------ | +| ChatOverlay + ConversationSidebar | ~95% complete | `apps/web/src/components/chat/` | +| LLM Controller with SSE | Working | `apps/api/src/llm/` | +| WebSocket Gateway | Production | `apps/api/src/websocket/` | +| TerminalPanel UI (mock) | UI-only, no backend | `apps/web/src/components/terminal/` | +| Orchestrator proxy routes | Working | `apps/web/src/app/api/orchestrator/` | +| Speech Gateway (pattern ref) | Production | `apps/api/src/speech/` | +| Ideas API (chat persistence) | Working | `apps/api/src/ideas/` | ## Milestones -| # | ID | Name | Status | Branch | Issue | Started | Completed | -| --- | ---- | --------------------- | -------- | ------------------------- | ------------------------ | ---------- | ---------- | -| 1 | MS18 | Theme & Widget System | complete | per-task feature branches | #487,#488,#489,#490,#491 | 2026-02-23 | 2026-02-23 | +| # | ID | Name | Status | Branch | Issue | Started | Completed | +| --- | ---- | ---------------------- | -------- | ------------------------- | ------------------------ | ---------- | --------- | +| 1 | MS19 | Chat & Terminal System | planning | per-task feature branches | #508,#509,#510,#511,#512 | 2026-02-25 | — | ## Deployment -| Target | URL | Method | -| ------- | ----------------- | -------------- | -| Coolify | mosaic.woltje.com | CI/CD pipeline | +| Target | URL | Method | +| --------- | ----------------- | --------------------------- | +| Portainer | mosaic.woltje.com | CI/CD pipeline (Woodpecker) | ## Token Budget | Metric | Value | | ------ | ----------------- | -| Budget | ~500K (estimated) | -| Used | ~200K | +| Budget | ~300K (estimated) | +| Used | ~0K | | Mode | normal | ## Session History -| Session | Runtime | Started | Duration | Ended Reason | Last Task | -| ------- | --------------- | ----------------- | -------- | ------------ | ----------------------------- | -| S1 | Claude Opus 4.6 | 2026-02-23T13:30Z | ~2h | context | Planning (PLAN-001) | -| S2 | Claude Opus 4.6 | 2026-02-23T14:00Z | ~3h | context | THM-001–003 (themes) | -| S3 | Claude Opus 4.6 | 2026-02-23T17:00Z | ~3h | context | WDG-001–005, EDT-001–002 | -| S4 | Claude Opus 4.6 | 2026-02-24T02:00Z | ~1h | complete | KBN-001, VER-001–003, DOC-001 | +| Session | Runtime | Started | Duration | Ended Reason | Last Task | +| ------- | --------------- | ----------------- | -------- | ------------ | ------------------- | +| S1 | Claude Opus 4.6 | 2026-02-25T20:00Z | — | — | Planning (PLAN-001) | ## Scratchpad -Path: `docs/scratchpads/ms18-theme-widgets-20260223.md` +Path: `docs/scratchpads/ms19-chat-terminal-20260225.md` diff --git a/docs/PRD.md b/docs/PRD.md index fcab895..0c35748 100644 --- a/docs/PRD.md +++ b/docs/PRD.md @@ -50,7 +50,7 @@ Dashboard polish, task ingestion pipeline, agent cycle visibility, deploy + smok - Dashboard widgets wired to real API data (ActivityFeed, DashboardMetrics, OrchestratorSessions) - WebSocket emits for job status/progress/step events - Dashboard auto-refresh with polling + progress bars + step status indicators -- Deployed to Coolify at mosaic.woltje.com, auth working via Authentik +- Deployed to mosaic.woltje.com, auth working via Authentik - Release tag v0.1.0 ### MS16+MS17-PagesDataIntegration (v0.1.1) — Complete @@ -69,6 +69,31 @@ All pages built + wired to real API data. PRs #470-484 (15 PRs). Issues #466-469 - All 5125 tests passing, CI pipeline #585 green - Deployed and smoke-tested at mosaic.woltje.com +### MS18-ThemeWidgets (v0.1.2) — Complete + +Theme package system, widget registry, WYSIWYG editor, Kanban filtering. PRs #493-505. Issues #487-491. + +- 5 built-in themes (Dark, Light, Nord, Dracula, Solarized) as TypeScript theme packages +- ThemeProvider with dynamic CSS variable application and instant switching +- Theme selection UI in Settings with live preview swatches +- Widget definition registry with configurable sizing and schemas +- WidgetGrid dashboard with drag-and-drop layout (react-grid-layout) +- Widget picker drawer for adding widgets from registry +- Per-widget configuration dialog driven by configSchema +- Layout save/load/rename/delete via UserLayout API +- Tiptap WYSIWYG editor for knowledge entries with toolbar +- Markdown round-trip (import/export) +- Kanban board filtering by project, assignee, priority, search with URL persistence +- 1,195 web tests, 3,243 API tests passing + +### Bugfix: API Global Prefix (post-MS18) — Complete + +PR #507. Fixed systemic 404 on all data endpoints. + +- Added `setGlobalPrefix("api")` to NestJS with exclusions for /health and /auth/\* +- Normalized 6 federation controllers to remove redundant api/ prefix +- Fixed rollup CVE (GHSA-mw96-cpmx-2vgc) via pnpm override + ## Scope ### In Scope (MS16+MS17 — Pages & Data Integration) @@ -98,7 +123,7 @@ This is the active mission scope. MS16 (Pages) and MS17 (Backend Integration) ar 18. Team management with shared data spaces and chat rooms (MS20) 19. RBAC for file access, resources, models (MS20) 20. Federation: master-master and master-slave with key exchange (MS21) -21. Federation testing: 3 instances on Coolify (woltje.com domain) (MS21) +21. Federation testing: 3 instances on Portainer (woltje.com domain) (MS21) 22. Agent task mapping configuration: system-level defaults, user-level overrides (MS22) 23. Telemetry: opt-out, customizable endpoint, sanitized data (MS22) 24. File manager with WYSIWYG editing: system/user/project levels (MS18) @@ -113,7 +138,7 @@ This is the active mission scope. MS16 (Pages) and MS17 (Backend Integration) ar 1. Mobile native app 2. Third-party marketplace for themes/widgets (initial implementation is local package management only) -3. Production deployment to non-Coolify targets +3. Mobile native app deployment targets 4. Calendar system redesign (existing calendar implementation is retained) ## User/Stakeholder Requirements @@ -257,21 +282,40 @@ This is the active mission scope. MS16 (Pages) and MS17 (Backend Integration) ar - All pages must render real data from backend APIs - **Status: COMPLETE (MS16+MS17) — PRs #473-#476. 238+ lines of mock data removed.** -### FR-016: Theme System (Future — MS18) +### FR-016: Theme System (MS18) — COMPLETE -- Support multiple themes beyond default dark/light -- Themes are installable packages from Mosaic Stack repo -- Theme installation and selection from Settings page -- ASSUMPTION: Initial implementation supports dark/light from reference design. Multi-theme package system is a future milestone. Rationale: Foundation must be solid before extensibility. +- 5 built-in themes (Dark, Light, Nord, Dracula, Solarized) as TypeScript theme packages +- ThemeProvider loads themes dynamically, applies CSS variables, instant switching +- Theme selection UI in Settings with live preview swatches +- UserPreference.theme persists selection across sessions +- **Status: COMPLETE (MS18) — PRs #493-495** -### FR-017: Terminal Panel (Future — MS19) +### FR-017: Terminal Panel (MS19) - Bottom drawer panel, toggleable from header and sidebar -- Multiple tabs (Orchestrator, Shell, Build) +- Real xterm.js terminal with PTY backend via WebSocket +- Multiple tabs: shell sessions, orchestrator agent output, build logs +- Terminal session persistence (create/close/rename tabs) - Smart terminal operating at project/orchestrator level -- Global terminal for system interaction +- ASSUMPTION: Terminal backend uses node-pty for PTY management, communicating via WebSocket namespace (/terminal). Rationale: node-pty is the standard for Node.js terminal emulation, used by VS Code. +- ASSUMPTION: Terminal sessions are workspace-scoped and stored in PostgreSQL for recovery. Rationale: Consistent with existing workspace isolation pattern. -### FR-018: Settings Configuration (Future — MS20) +### FR-018: Chat Streaming & Master Chat (MS19) + +- Complete SSE streaming for token-by-token chat rendering +- Master chat sidebar (ChatOverlay) polish: model selector, conversation search, keyboard shortcuts +- Chat persistence via Ideas API (already implemented) +- ASSUMPTION: Chat streaming uses existing SSE infrastructure in LLM controller. Frontend needs streamChatMessage() completion. Rationale: Backend SSE is already working, only frontend wiring is missing. + +### FR-019: Project-Level Orchestrator Chat (MS19) + +- Chat context scoped to active project +- Can trigger orchestrator actions: spawn agent, check status, view jobs +- Command prefix system (/spawn, /status, /jobs) parsed in chat +- Agent output viewable in terminal tabs +- ASSUMPTION: Orchestrator commands route through existing web proxy (/api/orchestrator/\*) to orchestrator service. Rationale: Proxy routes already exist and handle auth. + +### FR-020: Settings Configuration (Future — MS20) - All environment variables configurable via UI - Minimal launch env vars, rest configurable dynamically @@ -324,17 +368,46 @@ This is the active mission scope. MS16 (Pages) and MS17 (Backend Integration) ar 27. ~~Lint, typecheck, and tests pass~~ DONE 28. ~~Deployed and smoke-tested at mosaic.woltje.com~~ DONE +### MS18 — Theme & Widget System — COMPLETE + +29. ~~5+ themes with live preview and instant switching~~ DONE +30. ~~Theme selection UI in Settings with swatches~~ DONE +31. ~~UserPreference.theme persists across sessions~~ DONE +32. ~~WidgetGrid dashboard with drag/resize/add/remove~~ DONE +33. ~~Widget picker UI from registry~~ DONE +34. ~~Per-widget configuration dialog~~ DONE +35. ~~Layout save/load/rename/delete via API~~ DONE +36. ~~Tiptap WYSIWYG editor for knowledge entries~~ DONE +37. ~~Markdown round-trip (import/export)~~ DONE +38. ~~Kanban filtering by project, assignee, priority, search~~ DONE +39. ~~All features support all themes~~ DONE +40. ~~Lint, typecheck, tests pass~~ DONE + +### MS19 — Chat & Terminal + +41. Terminal panel has real xterm.js with PTY backend +42. Terminal supports multiple named sessions (tabs) +43. Terminal sessions persist and recover on reconnect +44. Chat streaming renders tokens in real-time (SSE) +45. Master chat sidebar accessible from any page (Cmd+Shift+J) +46. Master chat supports model selection and conversation management +47. Project-level chat can trigger orchestrator actions +48. Agent output viewable in terminal tabs +49. All features support all themes +50. Lint, typecheck, tests pass +51. Deployed and smoke-tested + ### Full Project (All Milestones) -29. jarvis user logs in via Authentik, has admin access to all pages -30. jarvis-user has standard access at lower permission level -31. Break-glass user has access without Authentik -32. Three Mosaic Stack instances on Coolify with federation testing -33. Playwright tests confirm all pages, functions, theming work -34. No errors during site navigation -35. API documented via Swagger with proper auth gating -36. Telemetry working locally with wide-event logging -37. Mosaic Telemetry properly reporting to telemetry endpoint +52. jarvis user logs in via Authentik, has admin access to all pages +53. jarvis-user has standard access at lower permission level +54. Break-glass user has access without Authentik +55. Three Mosaic Stack instances on Portainer with federation testing +56. Playwright tests confirm all pages, functions, theming work +57. No errors during site navigation +58. API documented via Swagger with proper auth gating +59. Telemetry working locally with wide-event logging +60. Mosaic Telemetry properly reporting to telemetry endpoint ## Constraints and Dependencies @@ -343,7 +416,7 @@ This is the active mission scope. MS16 (Pages) and MS17 (Backend Integration) ar 3. BetterAuth for authentication — must maintain existing auth flow 4. Authentik as IdP at auth.diversecanvas.com — must remain operational 5. PostgreSQL 17 with Prisma — all settings stored in DB -6. Coolify for deployment — 3 instances needed for federation testing +6. Portainer for deployment — 3 instances needed for federation testing 7. packages/ui is shared across apps — changes affect all consumers 8. Backend API modules already exist for all page data needs — no new API endpoints required for MS16+MS17 scope @@ -380,6 +453,8 @@ These 19 NestJS modules are already implemented with Prisma and available for fr | Credentials | `/api/credentials` | Encrypted storage | | Brain/AI | `/api/brain` | Query/search | | WebSocket | Real-time | Event broadcasting | +| LLM | `/api/llm/chat` | Chat + SSE streaming | +| Orchestrator Proxy | `/api/orchestrator/*` | Agent mgmt proxy | | Telemetry | Internal | Logging/monitoring | ## Testing and Verification @@ -400,7 +475,7 @@ These 19 NestJS modules are already implemented with Prisma and available for fr | MS15-DashboardShell | 0.0.15 | Design system + app shell + dashboard page | COMPLETE | | Go-Live MVP | 0.1.0 | Dashboard polish, ingestion, agent visibility, deploy | COMPLETE | | MS16+MS17-PagesDataIntegration | 0.1.1 | All pages built + wired to real API data | COMPLETE | -| MS18-ThemeWidgets | 0.1.2 | Theme package system, widget registry, dashboard customization | COMPLETE | +| MS18-ThemeWidgets | 0.1.2 | Theme package system, widget registry, WYSIWYG, Kanban filtering | COMPLETE | | MS19-ChatTerminal | 0.1.x | Global terminal, project chat, master chat session | NOT STARTED | | MS20-MultiTenant | 0.2.0 | Multi-tenant, teams, RBAC, RLS enforcement, break-glass auth | NOT STARTED | | MS21-Federation | 0.2.x | Federation (M-M, M-S), 3 instances, key exchange, data separation | NOT STARTED | diff --git a/docs/TASKS.md b/docs/TASKS.md index 585e8ca..49922f3 100644 --- a/docs/TASKS.md +++ b/docs/TASKS.md @@ -1,34 +1,53 @@ -# Tasks — MS18 Theme & Widget System +# Tasks — MS19 Chat & Terminal System > Single-writer: orchestrator only. Workers read but never modify. -| id | status | description | issue | repo | branch | depends_on | blocks | agent | started_at | completed_at | estimate | used | notes | -| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ---- | -------------------------------- | ------------------------------------------------------ | ------------------------------------------- | ------------ | ---------- | ------------ | -------- | ---- | ------------------------------------------------------------------------------------ | -| TW-PLAN-001 | done | Plan MS18 task breakdown, create milestone + issues, populate TASKS.md | — | — | — | | TW-THM-001,TW-WDG-001,TW-EDT-001,TW-KBN-001 | orchestrator | 2026-02-23 | 2026-02-23 | 15K | ~12K | Planning complete, all artifacts committed | -| TW-THM-001 | done | Theme architecture — Create theme definition interface, theme registry, and 5 built-in themes (Dark, Light, Nord, Dracula, Solarized) as TS files | #487 | web | feat/ms18-theme-architecture | TW-PLAN-001 | TW-THM-002,TW-THM-003 | worker | 2026-02-23 | 2026-02-23 | 30K | ~15K | PR #493 merged | -| TW-THM-002 | done | ThemeProvider upgrade — Load themes dynamically from registry, apply CSS variables, support instant theme switching without page reload | #487 | web | feat/ms18-theme-provider-upgrade | TW-THM-001 | TW-THM-003,TW-VER-002 | worker | 2026-02-23 | 2026-02-23 | 25K | ~12K | PR #494 merged | -| TW-THM-003 | done | Theme selection UI — Settings page section with theme browser, live preview swatches, persist selection to UserPreference.theme via API | #487 | web | feat/ms18-theme-selection-ui | TW-THM-001,TW-THM-002 | TW-VER-002 | worker | 2026-02-23 | 2026-02-23 | 25K | ~10K | PR #495 merged | -| TW-WDG-001 | done | Widget definition seeding — Seed 7 existing widgets into widget_definitions table with correct sizing constraints and configSchema | #488 | api | feat/ms18-widget-seed | TW-PLAN-001 | TW-WDG-002 | worker | 2026-02-23 | 2026-02-23 | 15K | ~8K | PR #496 merged | -| TW-WDG-002 | done | Dashboard → WidgetGrid migration — Replace hardcoded dashboard layout with WidgetGrid, load/save layout via UserLayout API, default layout on first visit | #488 | web | feat/ms18-widget-grid-migration | TW-WDG-001 | TW-WDG-003,TW-WDG-004,TW-WDG-005 | worker | 2026-02-23 | 2026-02-23 | 40K | ~20K | PR #497 merged | -| TW-WDG-003 | done | Widget picker UI — Drawer/dialog to browse available widgets from registry, preview size/description, add to dashboard | #488 | web | feat/ms18-widget-picker | TW-WDG-002 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 25K | ~12K | PR #498 merged | -| TW-WDG-004 | done | Widget configuration UI — Per-widget settings dialog using configSchema, configure data source/filters/colors/title | #488 | web | feat/ms18-layout-management | TW-WDG-002 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 30K | ~8K | PR #499 merged (bundled with WDG-005) | -| TW-WDG-005 | done | Layout management UI — Save/rename/switch/delete layouts, reset to default. UI controls in dashboard header area | #488 | web | feat/ms18-layout-management | TW-WDG-002 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 20K | ~8K | PR #499 merged (bundled with WDG-004) | -| TW-EDT-001 | done | Tiptap integration — Install @tiptap/react + extensions, build KnowledgeEditor component with toolbar (headings, bold, italic, lists, code, links, tables) | #489 | web | feat/ms18-tiptap-editor | TW-PLAN-001 | TW-EDT-002 | worker | 2026-02-23 | 2026-02-23 | 35K | ~12K | PR #500 merged | -| TW-EDT-002 | done | Markdown round-trip + File Manager integration — Import markdown to Tiptap, export to markdown + HTML. Replace textarea in knowledge create/edit | #489 | web | feat/ms18-markdown-roundtrip | TW-EDT-001 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 30K | ~10K | PR #501 merged | -| TW-KBN-001 | done | Kanban filtering — Add filter bar (project, assignee, priority, search). Support project-level and user-level views. URL param persistence | #490 | web | feat/ms18-kanban-filtering | TW-PLAN-001 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 30K | ~10K | PR #502 merged | -| TW-VER-001 | done | Tests — Unit tests for new components, update existing tests, fix any regressions | #491 | web | feat/ms18-verification-tests | TW-WDG-003,TW-WDG-004,TW-WDG-005,TW-EDT-002,TW-KBN-001 | TW-VER-002,TW-DOC-001 | worker | 2026-02-23 | 2026-02-23 | 25K | ~8K | PR #503 merged; 20 new tests (1195 total) | -| TW-VER-002 | done | Theme verification — Verify all 5 themes render correctly on all pages, no broken colors/contrast issues | #491 | web | — | TW-THM-003,TW-VER-001 | TW-DOC-001 | orchestrator | 2026-02-23 | 2026-02-23 | 15K | ~3K | All themes validated; gantt.css has 3 pre-existing hardcoded colors (not MS18 scope) | -| TW-DOC-001 | done | Documentation updates — TASKS.md, manifest, scratchpad, PRD status updates | #491 | — | feat/ms18-doc-verification | TW-VER-001,TW-VER-002 | TW-VER-003 | orchestrator | 2026-02-23 | 2026-02-23 | 10K | ~5K | PR #504 merged | -| TW-VER-003 | done | Deploy to Coolify + smoke test — Deploy, verify themes/widgets/editor/kanban all functional, auth working, no console errors | #491 | — | — | TW-DOC-001 | | orchestrator | 2026-02-23 | 2026-02-23 | 15K | ~5K | Deployed, HTTP 200, login page renders, no console errors | +| id | status | description | issue | repo | branch | depends_on | blocks | agent | started_at | completed_at | estimate | used | notes | +| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ------- | ------------------------------ | ----------------------------------------------- | ----------------------------------------------- | ------------ | ---------- | ------------ | -------- | ---- | ---------------------------------------------------------------- | +| CT-PLAN-001 | done | Plan MS19 task breakdown, create milestone + issues, populate TASKS.md | — | — | — | | CT-TERM-001,CT-TERM-002,CT-CHAT-001,CT-CHAT-002 | orchestrator | 2026-02-25 | 2026-02-25 | 15K | ~15K | Planning complete | +| CT-TERM-001 | not-started | Terminal WebSocket gateway & PTY session service — NestJS gateway (namespace: /terminal), node-pty spawn/kill/resize, workspace-scoped rooms, auth via token | #508 | api | feat/ms19-terminal-gateway | CT-PLAN-001 | CT-TERM-003,CT-TERM-004,CT-ORCH-002 | | | | 30K | | Follow speech gateway pattern | +| CT-TERM-002 | not-started | Terminal session persistence — Prisma model (TerminalSession: id, workspaceId, name, status, createdAt, closedAt), migration, CRUD service | #508 | api | feat/ms19-terminal-persistence | CT-PLAN-001 | CT-TERM-004 | | | | 15K | | | +| CT-TERM-003 | not-started | xterm.js integration — Replace mock TerminalPanel with real xterm.js, WebSocket connection to /terminal namespace, resize handling, copy/paste, theme support | #509 | web | feat/ms19-xterm-integration | CT-TERM-001 | CT-TERM-004 | | | | 30K | | Install @xterm/xterm + @xterm/addon-fit + @xterm/addon-web-links | +| CT-TERM-004 | not-started | Terminal tab management — Multiple named sessions, create/close/rename tabs, tab switching, session list from API, reconnect on page reload | #509 | web | feat/ms19-terminal-tabs | CT-TERM-001,CT-TERM-002,CT-TERM-003 | CT-VER-001 | | | | 20K | | | +| CT-CHAT-001 | not-started | Complete SSE chat streaming — Wire streamChatMessage() in frontend, token-by-token rendering in MessageList, streaming state indicators, abort/cancel support | #510 | web | feat/ms19-chat-streaming | CT-PLAN-001 | CT-CHAT-002,CT-ORCH-001 | | | | 25K | | Backend SSE already works, frontend TODO | +| CT-CHAT-002 | not-started | Master chat polish — Model selector dropdown, temperature/params config, conversation search in sidebar, keyboard shortcut improvements, empty state design | #510 | web | feat/ms19-chat-polish | CT-CHAT-001 | CT-VER-001 | | | | 15K | | ChatOverlay ~95% done, needs finishing touches | +| CT-ORCH-001 | not-started | Project-level orchestrator chat — Chat context scoped to project, command prefix parsing (/spawn, /status, /jobs, /kill), route commands through orchestrator proxy, display structured responses | #511 | web | feat/ms19-orchestrator-chat | CT-CHAT-001 | CT-ORCH-002,CT-VER-001 | | | | 30K | | Uses existing /api/orchestrator/\* proxy | +| CT-ORCH-002 | not-started | Agent output in terminal — View orchestrator agent sessions as terminal tabs, stream agent stdout/stderr via SSE (/agents/events), agent lifecycle indicators (spawning/running/done) | #511 | web | feat/ms19-agent-terminal | CT-TERM-001,CT-ORCH-001 | CT-VER-001 | | | | 25K | | Orchestrator already has SSE at /agents/events | +| CT-VER-001 | not-started | Unit tests — Tests for terminal gateway, xterm component, chat streaming, orchestrator chat, agent terminal integration | #512 | web,api | feat/ms19-tests | CT-TERM-004,CT-CHAT-002,CT-ORCH-001,CT-ORCH-002 | CT-DOC-001 | | | | 20K | | | +| CT-DOC-001 | not-started | Documentation updates — TASKS.md, manifest, scratchpad, PRD status updates | #512 | — | — | CT-VER-001 | CT-VER-002 | orchestrator | | | 10K | | | +| CT-VER-002 | not-started | Deploy + smoke test — Deploy to Portainer, verify terminal, chat streaming, orchestrator chat, agent output all functional | #512 | — | — | CT-DOC-001 | | orchestrator | | | 15K | | | ## Summary -| Metric | Value | -| ------------- | ---------------------- | -| Total tasks | 16 | -| Completed | 16 (all tasks) | -| In Progress | 0 | -| Remaining | 0 | -| PRs merged | #493–#505 | -| Issues closed | #487, #488, #489, #490 | -| Milestone | MS18-ThemeWidgets | +| Metric | Value | +| --------------- | ----------------- | +| Total tasks | 12 | +| Completed | 1 (planning) | +| In Progress | 0 | +| Remaining | 11 | +| Estimated total | ~250K tokens | +| Milestone | MS19-ChatTerminal | + +## Dependency Graph + +``` +PLAN-001 ──┬──→ TERM-001 ──┬──→ TERM-003 ──→ TERM-004 ──→ VER-001 ──→ DOC-001 ──→ VER-002 + │ │ ↑ + │ └──→ ORCH-002 ───────┘ + │ ↑ + ├──→ TERM-002 ────────→ TERM-004 + │ + ├──→ CHAT-001 ──┬──→ CHAT-002 ──→ VER-001 + │ │ + │ └──→ ORCH-001 ──→ ORCH-002 + │ + └──→ CHAT-002 (also depends on CHAT-001) +``` + +## Parallel Execution Opportunities + +- **Wave 1** (after PLAN-001): TERM-001 + TERM-002 + CHAT-001 can run in parallel (3 independent tracks) +- **Wave 2**: TERM-003 (after TERM-001) + CHAT-002 (after CHAT-001) + ORCH-001 (after CHAT-001) can overlap +- **Wave 3**: TERM-004 (after TERM-001+002+003) + ORCH-002 (after TERM-001+ORCH-001) +- **Wave 4**: VER-001 (after all implementation) +- **Wave 5**: DOC-001 → VER-002 (sequential) diff --git a/docs/scratchpads/ms19-chat-terminal-20260225.md b/docs/scratchpads/ms19-chat-terminal-20260225.md new file mode 100644 index 0000000..52244a4 --- /dev/null +++ b/docs/scratchpads/ms19-chat-terminal-20260225.md @@ -0,0 +1,88 @@ +# Mission Scratchpad — MS19 Chat & Terminal System + +> Append-only log. NEVER delete entries. NEVER overwrite sections. +> This is the orchestrator's working memory across sessions. + +## Original Mission Prompt + +``` +Plan MS19+, update mission artifacts for Coolify → Portainer transition. +MS18 is complete. Coolify deprecated, Portainer migration in progress with another agent. +``` + +## Planning Decisions + +### 2026-02-25 — Infrastructure Assessment + +**Existing chat infrastructure (~95% complete):** + +- ChatOverlay.tsx, ConversationSidebar.tsx, ChatInput.tsx, MessageList.tsx +- useChat hook with conversation management and LLM interaction +- Backend LLM controller with SSE streaming support +- Providers: Ollama, Claude, OpenAI +- Chat persistence via Ideas API + +**Existing terminal infrastructure (UI-only):** + +- TerminalPanel.tsx with tabs, rich output styling, animations +- No backend connection — purely mock UI + +**Existing orchestrator infrastructure:** + +- Orchestrator service (NestJS, port 3002) with agent spawn/kill/status +- SSE stream at /agents/events for real-time agent status +- Web proxy routes at /api/orchestrator/\* +- Coordinator integration in API for job tracking + +**Key pattern reference:** + +- Speech gateway (`apps/api/src/speech/speech.gateway.ts`) shows namespace WebSocket pattern with session management + +### 2026-02-25 — Architecture Decisions + +**Decision: node-pty for terminal backend** + +- Standard PTY management for Node.js (used by VS Code) +- Spawns real shell processes (bash/zsh) +- Handles resize, input/output streams +- WebSocket namespace /terminal for communication + +**Decision: Terminal sessions in PostgreSQL** + +- Consistent with workspace isolation pattern +- Prisma model: TerminalSession (id, workspaceId, name, status, createdAt, closedAt) +- Sessions survive page reload, recover on reconnect + +**Decision: SSE for chat streaming (not WebSocket)** + +- Backend already has SSE setup in LLM controller +- Only frontend wiring missing (streamChatMessage() is TODO) +- SSE is simpler and sufficient for unidirectional token streaming + +**Decision: Orchestrator commands as chat prefixes** + +- /spawn, /status, /jobs, /kill parsed in frontend +- Route through existing /api/orchestrator/\* proxy +- Display structured responses inline in chat + +### 2026-02-25 — Portainer Migration + +**Context:** Coolify has been deprecated and shut down. Infrastructure migration to Portainer is being handled by another agent. All deployment references updated from Coolify to Portainer in PRD and mission manifest. + +**Impact on MS19:** + +- Deployment target is now Portainer (was Coolify) +- No code changes needed — only infrastructure config +- Smoke testing blocked until Portainer stack is running + +## Session Log + +### S1 — 2026-02-25 + +- Read mission state (MS18 complete, all 16 tasks done) +- Explored codebase for MS19 infrastructure (chat, terminal, WebSocket, orchestrator) +- Updated PRD: Coolify → Portainer, added MS18 completion, added MS19 FRs and acceptance criteria +- Created new MISSION-MANIFEST.md for MS19+ mission +- Created TASKS.md with 12-task breakdown (~250K token estimate) +- Created this scratchpad +- Archived MS18 TASKS.md to docs/tasks/MS18-ThemeWidgets-tasks.md diff --git a/docs/tasks/MS18-ThemeWidgets-tasks.md b/docs/tasks/MS18-ThemeWidgets-tasks.md new file mode 100644 index 0000000..585e8ca --- /dev/null +++ b/docs/tasks/MS18-ThemeWidgets-tasks.md @@ -0,0 +1,34 @@ +# Tasks — MS18 Theme & Widget System + +> Single-writer: orchestrator only. Workers read but never modify. + +| id | status | description | issue | repo | branch | depends_on | blocks | agent | started_at | completed_at | estimate | used | notes | +| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ---- | -------------------------------- | ------------------------------------------------------ | ------------------------------------------- | ------------ | ---------- | ------------ | -------- | ---- | ------------------------------------------------------------------------------------ | +| TW-PLAN-001 | done | Plan MS18 task breakdown, create milestone + issues, populate TASKS.md | — | — | — | | TW-THM-001,TW-WDG-001,TW-EDT-001,TW-KBN-001 | orchestrator | 2026-02-23 | 2026-02-23 | 15K | ~12K | Planning complete, all artifacts committed | +| TW-THM-001 | done | Theme architecture — Create theme definition interface, theme registry, and 5 built-in themes (Dark, Light, Nord, Dracula, Solarized) as TS files | #487 | web | feat/ms18-theme-architecture | TW-PLAN-001 | TW-THM-002,TW-THM-003 | worker | 2026-02-23 | 2026-02-23 | 30K | ~15K | PR #493 merged | +| TW-THM-002 | done | ThemeProvider upgrade — Load themes dynamically from registry, apply CSS variables, support instant theme switching without page reload | #487 | web | feat/ms18-theme-provider-upgrade | TW-THM-001 | TW-THM-003,TW-VER-002 | worker | 2026-02-23 | 2026-02-23 | 25K | ~12K | PR #494 merged | +| TW-THM-003 | done | Theme selection UI — Settings page section with theme browser, live preview swatches, persist selection to UserPreference.theme via API | #487 | web | feat/ms18-theme-selection-ui | TW-THM-001,TW-THM-002 | TW-VER-002 | worker | 2026-02-23 | 2026-02-23 | 25K | ~10K | PR #495 merged | +| TW-WDG-001 | done | Widget definition seeding — Seed 7 existing widgets into widget_definitions table with correct sizing constraints and configSchema | #488 | api | feat/ms18-widget-seed | TW-PLAN-001 | TW-WDG-002 | worker | 2026-02-23 | 2026-02-23 | 15K | ~8K | PR #496 merged | +| TW-WDG-002 | done | Dashboard → WidgetGrid migration — Replace hardcoded dashboard layout with WidgetGrid, load/save layout via UserLayout API, default layout on first visit | #488 | web | feat/ms18-widget-grid-migration | TW-WDG-001 | TW-WDG-003,TW-WDG-004,TW-WDG-005 | worker | 2026-02-23 | 2026-02-23 | 40K | ~20K | PR #497 merged | +| TW-WDG-003 | done | Widget picker UI — Drawer/dialog to browse available widgets from registry, preview size/description, add to dashboard | #488 | web | feat/ms18-widget-picker | TW-WDG-002 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 25K | ~12K | PR #498 merged | +| TW-WDG-004 | done | Widget configuration UI — Per-widget settings dialog using configSchema, configure data source/filters/colors/title | #488 | web | feat/ms18-layout-management | TW-WDG-002 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 30K | ~8K | PR #499 merged (bundled with WDG-005) | +| TW-WDG-005 | done | Layout management UI — Save/rename/switch/delete layouts, reset to default. UI controls in dashboard header area | #488 | web | feat/ms18-layout-management | TW-WDG-002 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 20K | ~8K | PR #499 merged (bundled with WDG-004) | +| TW-EDT-001 | done | Tiptap integration — Install @tiptap/react + extensions, build KnowledgeEditor component with toolbar (headings, bold, italic, lists, code, links, tables) | #489 | web | feat/ms18-tiptap-editor | TW-PLAN-001 | TW-EDT-002 | worker | 2026-02-23 | 2026-02-23 | 35K | ~12K | PR #500 merged | +| TW-EDT-002 | done | Markdown round-trip + File Manager integration — Import markdown to Tiptap, export to markdown + HTML. Replace textarea in knowledge create/edit | #489 | web | feat/ms18-markdown-roundtrip | TW-EDT-001 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 30K | ~10K | PR #501 merged | +| TW-KBN-001 | done | Kanban filtering — Add filter bar (project, assignee, priority, search). Support project-level and user-level views. URL param persistence | #490 | web | feat/ms18-kanban-filtering | TW-PLAN-001 | TW-VER-001 | worker | 2026-02-23 | 2026-02-23 | 30K | ~10K | PR #502 merged | +| TW-VER-001 | done | Tests — Unit tests for new components, update existing tests, fix any regressions | #491 | web | feat/ms18-verification-tests | TW-WDG-003,TW-WDG-004,TW-WDG-005,TW-EDT-002,TW-KBN-001 | TW-VER-002,TW-DOC-001 | worker | 2026-02-23 | 2026-02-23 | 25K | ~8K | PR #503 merged; 20 new tests (1195 total) | +| TW-VER-002 | done | Theme verification — Verify all 5 themes render correctly on all pages, no broken colors/contrast issues | #491 | web | — | TW-THM-003,TW-VER-001 | TW-DOC-001 | orchestrator | 2026-02-23 | 2026-02-23 | 15K | ~3K | All themes validated; gantt.css has 3 pre-existing hardcoded colors (not MS18 scope) | +| TW-DOC-001 | done | Documentation updates — TASKS.md, manifest, scratchpad, PRD status updates | #491 | — | feat/ms18-doc-verification | TW-VER-001,TW-VER-002 | TW-VER-003 | orchestrator | 2026-02-23 | 2026-02-23 | 10K | ~5K | PR #504 merged | +| TW-VER-003 | done | Deploy to Coolify + smoke test — Deploy, verify themes/widgets/editor/kanban all functional, auth working, no console errors | #491 | — | — | TW-DOC-001 | | orchestrator | 2026-02-23 | 2026-02-23 | 15K | ~5K | Deployed, HTTP 200, login page renders, no console errors | + +## Summary + +| Metric | Value | +| ------------- | ---------------------- | +| Total tasks | 16 | +| Completed | 16 (all tasks) | +| In Progress | 0 | +| Remaining | 0 | +| PRs merged | #493–#505 | +| Issues closed | #487, #488, #489, #490 | +| Milestone | MS18-ThemeWidgets | -- 2.49.1