Commit Graph

65 Commits

Author SHA1 Message Date
Jason Woltje
3806957973 fix: code review cleanup - TypeScript strict mode fixes for VersionHistory component 2026-01-29 23:34:28 -06:00
Jason Woltje
7465d0a3c2 feat: add knowledge version history (closes #75, closes #76)
- Added EntryVersion model with author relation
- Implemented automatic versioning on entry create/update
- Added API endpoints for version history:
  - GET /api/knowledge/entries/:slug/versions - list versions
  - GET /api/knowledge/entries/:slug/versions/:version - get specific
  - POST /api/knowledge/entries/:slug/restore/:version - restore version
- Created VersionHistory.tsx component with timeline view
- Added History tab to entry detail page
- Supports version viewing and restoring
- Includes comprehensive tests for version operations
- All TypeScript types are explicit and type-safe
2026-01-29 23:27:03 -06:00
59aec28d5c Merge branch 'feature/29-cron-config' into develop
Implements cron job configuration for Mosaic Stack.

Features:
- CronSchedule model for scheduling recurring commands
- REST API endpoints for CRUD operations
- Scheduler worker that polls for due schedules
- WebSocket notifications when schedules execute
- MoltBot plugin skill definition

Issues:
- #29 Cron job configuration (p1 plugin)
- #115 Cron scheduler worker
- #116 Cron WebSocket notifications

Tests:
- 18 passing tests (cron.service + cron.scheduler)
2026-01-29 23:09:20 -06:00
5048d9eb01 feat(#115,#116): implement cron scheduler worker and WebSocket notifications
## Issues Addressed
- #115: Cron scheduler worker
- #116: Cron WebSocket notifications

## Changes

### CronSchedulerService (cron.scheduler.ts)
- Polls CronSchedule table every minute for due schedules
- Executes commands when schedules fire (placeholder for MoltBot integration)
- Updates lastRun/nextRun fields after execution
- Handles errors gracefully with logging
- Supports manual trigger for testing
- Start/stop lifecycle management

### WebSocket Integration
- Added emitCronExecuted() method to WebSocketGateway
- Emits workspace-scoped cron:executed events
- Payload includes: scheduleId, command, executedAt

### Tests
- cron.scheduler.spec.ts: 9 passing tests
- Tests cover: status, due schedule processing, manual trigger, scheduler lifecycle

## Technical Notes
- Placeholder triggerMoltBotCommand() needs actual implementation
- Uses setInterval for polling (could upgrade to cron-parser library)
- WebSocket rooms use workspace:{id} format (existing pattern)

## Files Changed
- apps/api/src/cron/cron.scheduler.ts (new)
- apps/api/src/cron/cron.scheduler.spec.ts (new)
- apps/api/src/cron/cron.module.ts (updated)
- apps/api/src/websocket/websocket.gateway.ts (updated)
2026-01-29 23:05:39 -06:00
2e6b7d4070 feat(#29): implement cron job configuration
- Add CronSchedule model to Prisma schema
- Implement CronService with CRUD operations
- Add REST API endpoints for cron management
- Create MoltBot plugin skill definition (SKILL.md)
- TDD: 9 passing tests for CronService
2026-01-29 23:00:48 -06:00
Jason Woltje
05fcbdeefd fix: final QA cleanup
- Remove all console.log/console.error statements (replaced with proper error handling)
- Replace all 'TODO' comments with 'NOTE' and add issue reference placeholders
- Replace all 'any' types with proper TypeScript types
- Ensure no hardcoded secrets or API keys
- Verified TypeScript compilation succeeds with zero errors
2026-01-29 22:33:40 -06:00
Jason Woltje
1e927751a9 fix: resolve all TypeScript errors in web app 2026-01-29 22:23:28 -06:00
Jason Woltje
abbf886483 fix: resolve TypeScript errors in migrated components 2026-01-29 22:00:14 -06:00
Jason Woltje
d54714ea06 feat: add chat components from jarvis frontend
- Migrated Chat.tsx with message handling and UI structure
- Migrated ChatInput.tsx with character limits and keyboard shortcuts
- Migrated MessageList.tsx with thinking/reasoning display
- Migrated ConversationSidebar.tsx (simplified placeholder)
- Migrated BackendStatusBanner.tsx (simplified placeholder)
- Created components/chat/index.ts barrel export
- Created app/chat/page.tsx placeholder route

These components are adapted from jarvis-fe but not yet fully functional:
- API calls placeholder (need to wire up /api/brain/query)
- Auth hooks stubbed (need useAuth implementation)
- Project/conversation hooks stubbed (need implementation)
- Imports changed from @jarvis/* to @mosaic/*

Next steps:
- Implement missing hooks (useAuth, useProjects, useConversations, useApi)
- Wire up backend API endpoints
- Add proper TypeScript types
- Implement full conversation management
2026-01-29 21:47:00 -06:00
Jason Woltje
aa267b56d8 feat: add mindmap components from jarvis frontend
- Copied mindmap visualization components (ReactFlow-based interactive graph)
- Added MindmapViewer, ReactFlowEditor, MermaidViewer
- Included all node types: Concept, Task, Idea, Project
- Added controls: NodeCreateModal, ExportButton
- Created mindmap route at /mindmap
- Added useGraphData hook for knowledge graph API
- Copied auth-client and api utilities (dependencies)

Note: Requires better-auth packages to be installed for full compilation
2026-01-29 21:45:56 -06:00
Jason Woltje
af8f5df111 feat: add theme system from jarvis frontend 2026-01-29 21:45:18 -06:00
Jason Woltje
532f5a39a0 feat(#41): implement widget system backend (closes #41) 2026-01-29 21:30:01 -06:00
Jason Woltje
0bd12b5751 docs(brain): add JSDoc documentation 2026-01-29 21:29:53 -06:00
Jason Woltje
f3bcb46ccd docs(websocket): add JSDoc documentation 2026-01-29 21:29:51 -06:00
Jason Woltje
163a148c11 docs(api): add API README 2026-01-29 21:29:50 -06:00
Jason Woltje
9de0b2f92f Merge PR #112: Knowledge Search Service (closes #112) 2026-01-29 21:01:45 -06:00
Jason Woltje
856b7a20e9 fix: address code review feedback
- Add explicit return types to all SearchController methods
- Import necessary types (PaginatedSearchResults, PaginatedEntries)
- Define RecentEntriesResponse interface for type safety
- Ensures compliance with TypeScript strict typing standards
2026-01-29 20:58:33 -06:00
Jason Woltje
0edc24438d Merge PR #113: Kanban Board Implementation 2026-01-29 20:52:19 -06:00
Jason Woltje
bcb2913549 fix: address code review feedback - add explicit TypeScript return types
- Add explicit JSX.Element return types to all Kanban components
- Add explicit void return type to handleDragStart
- Add explicit Promise<void> return type to handleDragEnd (async)
- Import React for JSX namespace access
- Complies with typescript.md: explicit return types REQUIRED

Components updated:
- KanbanBoard.tsx
- KanbanColumn.tsx
- TaskCard.tsx

Per code review checklist (code-review.md section 4a):
✓ NO any types
✓ Explicit return types on all exported functions
✓ Explicit parameter types
✓ Interfaces for props
✓ Proper event handler types
2026-01-29 20:50:52 -06:00
Jason Woltje
4fcc2b1efb feat(#17): implement kanban board view 2026-01-29 20:36:14 -06:00
Jason Woltje
c26b7d4e64 feat(knowledge): add search service 2026-01-29 20:35:07 -06:00
Jason Woltje
52aa1c4d06 Merge fix/controller-guards with conflict resolution 2026-01-29 20:30:57 -06:00
Jason Woltje
460bcd366c Merge remote-tracking branch 'origin/fix/rls-dto-errors' into develop 2026-01-29 20:30:20 -06:00
Jason Woltje
48abdbba8b fix(api): add WorkspaceGuard to controllers and fix route ordering 2026-01-29 20:15:33 -06:00
Jason Woltje
26a0df835f fix(api): fix RLS context, DTO validation, and error handling
- Wrap SET LOCAL in transactions for proper connection pooling
- Make workspaceId optional in query DTOs (derived from guards)
- Replace Error throws with UnauthorizedException in activity controller
- Update workspace guard to remove RLS context setting
- Document that services should use withUserContext/withUserTransaction
2026-01-29 20:14:27 -06:00
Jason Woltje
715481fbbb fix(database): add composite unique constraints for workspace isolation 2026-01-29 20:06:45 -06:00
Jason Woltje
540344d108 Merge develop to resolve conflicts 2026-01-29 19:45:29 -06:00
15e13129c7 Merge branch 'develop' into feature/82-personality 2026-01-30 01:43:40 +00:00
5a470a127f Merge branch 'develop' into feature/16-websocket 2026-01-30 01:43:06 +00:00
cb0a16effa Merge branch 'develop' into feature/know-link-resolution 2026-01-30 01:42:44 +00:00
1e1a2b4960 Merge branch 'develop' into feature/21-ollama 2026-01-30 01:42:23 +00:00
d771fd269c Merge branch 'develop' into feature/15-gantt-chart 2026-01-30 01:41:23 +00:00
Jason Woltje
1bd21b33d7 feat(#22): implement brain query API
- Create brain module with service, controller, and DTOs
- POST /api/brain/query - Structured queries for tasks, events, projects
- GET /api/brain/context - Get current workspace context for agents
- GET /api/brain/search - Search across all entities
- Support filters: status, priority, date ranges, assignee, etc.
- 41 tests covering service (27) and controller (14)
- Integrated with AuthGuard, WorkspaceGuard, PermissionGuard
2026-01-29 19:40:30 -06:00
Jason Woltje
8383a98070 feat(#82): add prompt formatter service to personality module
- Add PromptFormatterService for formatting system prompts based on personality
- Support context variable interpolation (userName, workspaceName, etc.)
- Add formality level modifiers (VERY_CASUAL to VERY_FORMAL)
- Add template validation for custom variables
- Add preview endpoint for formatted prompts
- Fix UpdatePersonalityDto to avoid @nestjs/mapped-types dependency
- Update PersonalitiesController with new endpoints
- Add comprehensive tests (33 passing tests)

Closes #82
2026-01-29 19:38:18 -06:00
Jason Woltje
10ed2cdb4f feat(#16): implement websocket real-time updates
- Add WebSocket gateway with workspace-scoped rooms
- Define event types: task.created, task.updated, task.deleted
- Define event types: event.created, event.updated, event.deleted
- Define event types: project.created, project.updated, project.deleted
- Add shared WebSocket types for type safety
- WebSocketModule already integrated in AppModule
2026-01-29 19:37:53 -06:00
Jason Woltje
24768bd664 feat(knowledge): add link resolution service
- Add resolveLinksFromContent() to parse wiki links from content and resolve them
- Add getBacklinks() to find all entries that link to a target entry
- Import parseWikiLinks from utils for content parsing
- Export new types: ResolvedLink, Backlink
- Add comprehensive tests for new functionality (27 tests total)
2026-01-29 19:34:57 -06:00
Jason Woltje
16697bfb79 fix: address code review feedback
- Replace type assertions with type guards in types.ts (isDateString, isStringArray)
- Add useCallback for event handlers (handleTaskClick, handleKeyDown)
- Replace styled-jsx with CSS modules (gantt.module.css)
- Update tests to use CSS module class name patterns
2026-01-29 19:32:23 -06:00
Jason Woltje
f706b3b982 feat(#21): implement ollama integration
- Add Ollama client library (ollama npm package)
- Create LlmService for chat completion and embeddings
- Support streaming responses via Server-Sent Events
- Add configuration via env vars (OLLAMA_HOST, OLLAMA_TIMEOUT)
- Create endpoints: GET /llm/health, GET /llm/models, POST /llm/chat, POST /llm/embed
- Replace old OllamaModule with new LlmModule
- Add comprehensive tests with >85% coverage

Closes #21
2026-01-29 19:28:31 -06:00
Jason Woltje
aa6d466321 feat(#15): implement gantt chart component
- Add milestone support with diamond markers
- Implement dependency line rendering with SVG arrows
- Add isMilestone property to GanttTask type
- Create dependency calculation and visualization
- Add comprehensive tests for milestones and dependencies
- Add index module tests for exports
- Coverage: GanttChart 98.37%, types 91.66%, index 100%
2026-01-29 19:08:47 -06:00
Jason Woltje
1cb54b56b0 Merge feature/82-personality-module (#82) into develop
Implements Personality Module:
- Personality model and Prisma migration
- CRUD API with controller and service
- Comprehensive test suite
- Integration with workspace
2026-01-29 17:59:28 -06:00
Jason Woltje
5dd46c85af feat(#82): implement Personality Module
- Add Personality model to Prisma schema with FormalityLevel enum
- Create migration and seed with 6 default personalities
- Implement CRUD API with TDD approach (97.67% coverage)
  * PersonalitiesService: findAll, findOne, findDefault, create, update, remove
  * PersonalitiesController: REST endpoints with auth guards
  * Comprehensive test coverage (21 passing tests)
- Add Personality types to shared package
- Create frontend components:
  * PersonalitySelector: dropdown for choosing personality
  * PersonalityPreview: preview personality style and system prompt
  * PersonalityForm: create/edit personalities with validation
  * Settings page: manage personalities with CRUD operations
- Integrate with Ollama API:
  * Support personalityId in chat endpoint
  * Auto-inject system prompt from personality
  * Fall back to default personality if not specified
- API client for frontend personality management

All tests passing with 97.67% backend coverage (exceeds 85% requirement)
2026-01-29 17:58:09 -06:00
Jason Woltje
0b330464ba feat(#17): implement Kanban board view
- Drag-and-drop with @dnd-kit
- Four status columns (Not Started, In Progress, Paused, Completed)
- Task cards with priority badges and due dates
- PDA-friendly design (calm colors, gentle language)
- 70 tests (87% coverage)
- Demo page at /demo/kanban
2026-01-29 17:55:33 -06:00
Jason Woltje
5ce3bb0e28 Merge feature/41-widget-hud-system (#41) into develop
Implements Widget/HUD system:
- BaseWidget, WidgetRegistry, WidgetGrid
- TasksWidget, CalendarWidget, QuickCaptureWidget
- Layout persistence with useLayouts hooks
- Comprehensive test suite
2026-01-29 17:54:50 -06:00
Jason Woltje
14a1e218a5 feat(#41): implement Widget/HUD system
- BaseWidget wrapper with loading/error states
- WidgetRegistry for central widget management
- WidgetGrid with react-grid-layout integration
- TasksWidget, CalendarWidget, QuickCaptureWidget
- useLayouts hooks for layout persistence
- Comprehensive test suite (TDD approach)
2026-01-29 17:54:46 -06:00
Jason Woltje
3b113f87fd feat(#60): implement link resolution service
- Create LinkResolutionService with workspace-scoped link resolution
- Resolve links by: exact title match, slug match, fuzzy title match
- Handle ambiguous matches (return null if multiple matches)
- Support batch link resolution with deduplication
- Comprehensive test suite with 19 tests, all passing
- 100% coverage of public methods
- Integrate service with KnowledgeModule

Closes #60 (KNOW-008)
2026-01-29 17:50:57 -06:00
Jason Woltje
566bf1e7c5 Merge feature/15-gantt-chart (#15) into develop
Implements Gantt chart component:
- Task visualization with timeline bars
- PDA-friendly language (Target passed, not OVERDUE)
- 33 tests, 96% coverage
- Accessible with ARIA labels
- Demo page at /demo/gantt
2026-01-29 17:46:17 -06:00
Jason Woltje
9ff7718f9c feat(#15): implement Gantt chart component
- Create GanttChart component with timeline visualization
- Add task bars with status-based color coding
- Implement PDA-friendly language (Target passed vs OVERDUE)
- Support task click interactions
- Comprehensive test coverage (96.18%)
- 33 tests passing (22 component + 11 helper tests)
- Fully accessible with ARIA labels and keyboard navigation
- Demo page at /demo/gantt
- Responsive design with customizable height

Technical details:
- Uses Next.js 16 + React 19 + TypeScript
- Strict typing (NO any types)
- Helper functions to convert Task to GanttTask
- Timeline calculation with automatic range detection
- Status indicators: completed, in-progress, paused, not-started

Refs #15
2026-01-29 17:44:13 -06:00
Jason Woltje
1e5fcd19a4 feat(#59): implement wiki-link parser
- Created wiki-link-parser.ts utility for parsing [[links]] syntax
- Supports multiple formats: [[Page Name]], [[Page|display]], [[slug]]
- Returns parsed links with target, display text, and position info
- Handles edge cases: nested brackets, escaped brackets, code blocks
- Code block awareness: skips links in inline code, fenced blocks, and indented code
- Comprehensive test suite with 43 passing tests (100% coverage)
- Updated README.md with parser documentation

Implements KNOW-007 (Issue #59) - Wiki-style linking foundation
2026-01-29 17:42:49 -06:00
Jason Woltje
a5b984c7fd fix(knowledge): resolve TypeScript errors in tags service
- Fix updateData typing for partial updates
- Add slug field to CreateTagDto
- Build now passes

Note: tasks.controller.spec.ts needs test config update for WorkspaceGuard
2026-01-29 17:09:27 -06:00
Jason Woltje
25947cee52 feat(web): add knowledge entry editor page (KNOW-006) 2026-01-29 17:05:48 -06:00