4ac21d1a3a
feat( #170 ): Implement mosaic-bridge module for Discord
...
Created the mosaic-bridge module to enable Discord integration for
chat-based control of Mosaic Stack. This module provides the foundation
for receiving commands via Discord and forwarding them to the stitcher
for job orchestration.
Key Features:
- Discord bot connection and authentication
- Command parsing (@mosaic fix, status, cancel, verbose, quiet, help)
- Thread management for job updates
- Chat provider interface for future platform extensibility
- Noise management (low/medium/high verbosity levels)
Implementation Details:
- Created IChatProvider interface for platform abstraction
- Implemented DiscordService with Discord.js
- Basic command parsing (detailed parsing in #171 )
- Thread creation for job-specific updates
- Configuration via environment variables
Commands Supported:
- @mosaic fix <issue> - Start job for issue
- @mosaic status <job> - Get job status (placeholder)
- @mosaic cancel <job> - Cancel running job (placeholder)
- @mosaic verbose <job> - Stream full logs (placeholder)
- @mosaic quiet - Reduce notifications (placeholder)
- @mosaic help - Show available commands
Testing:
- 23/23 tests passing (TDD approach)
- Unit tests for Discord service
- Module integration tests
- 100% coverage of critical paths
Quality Gates:
- Typecheck: PASSED
- Lint: PASSED
- Build: PASSED
- Tests: PASSED (23/23)
Environment Variables:
- DISCORD_BOT_TOKEN - Bot authentication token
- DISCORD_GUILD_ID - Server/Guild ID (optional)
- DISCORD_CONTROL_CHANNEL_ID - Channel for commands
Files Created:
- apps/api/src/bridge/bridge.module.ts
- apps/api/src/bridge/discord/discord.service.ts
- apps/api/src/bridge/interfaces/chat-provider.interface.ts
- apps/api/src/bridge/index.ts
- Full test coverage
Dependencies Added:
- discord.js@latest
Next Steps:
- Issue #171 : Implement detailed command parsing
- Issue #172 : Add Herald integration for job updates
- Future: Add Slack, Matrix support via IChatProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-02-01 21:26:40 -06:00
e23c09f1f2
feat( #157 ): Set up webhook receiver endpoint
...
Implement FastAPI webhook receiver for Gitea issue assignment events
with HMAC SHA256 signature verification and event routing.
Implementation details:
- FastAPI application with /webhook/gitea POST endpoint
- HMAC SHA256 signature verification in security.py
- Event routing for assigned, unassigned, closed actions
- Comprehensive logging for all webhook events
- Health check endpoint at /health
- Docker containerization with health checks
- 91% test coverage (exceeds 85% requirement)
TDD workflow followed:
- Wrote 16 tests first (RED phase)
- Implemented features to pass tests (GREEN phase)
- All tests passing with 91% coverage
- Type checking with mypy: success
- Linting with ruff: success
Files created:
- apps/coordinator/src/main.py - FastAPI application
- apps/coordinator/src/webhook.py - Webhook handlers
- apps/coordinator/src/security.py - HMAC verification
- apps/coordinator/src/config.py - Configuration management
- apps/coordinator/tests/ - Comprehensive test suite
- apps/coordinator/Dockerfile - Production container
- apps/coordinator/pyproject.toml - Python project config
Configuration:
- Updated .env.example with GITEA_WEBHOOK_SECRET
- Updated docker-compose.yml with coordinator service
Testing:
- 16 unit and integration tests
- Security tests for signature verification
- Event handler tests for all supported actions
- Health check endpoint tests
- All tests passing with 91% coverage
This unblocks issue #158 (issue parser).
Fixes #157
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-01 17:41:46 -06:00
de3f3b9204
feat( #156 ): Create coordinator bot user documentation and setup scripts
...
Add comprehensive documentation and automated scripts for setting up the mosaic
coordinator bot user in Gitea. This enables the coordinator system to manage
issue assignments, comments, and orchestration.
Changes:
- docs/1-getting-started/3-configuration/4-gitea-coordinator.md: Complete setup guide
* Step-by-step bot user creation via UI and API
* Repository permission configuration
* API token generation and storage
* Comprehensive testing procedures
* Security best practices and troubleshooting
- scripts/coordinator/create-gitea-bot.sh: Automated bot creation script
* Creates mosaic bot user with proper configuration
* Sets up repository permissions
* Generates API token
* Tests authentication
* Provides credential output for secure storage
- scripts/coordinator/test-gitea-bot.sh: Bot functionality test suite
* Tests authentication
* Verifies repository access
* Tests issue operations (read, list, assign, comment)
* Validates label management
* Confirms all required permissions
- scripts/coordinator/README.md: Scripts usage documentation
* Workflow guides
* Configuration reference
* Troubleshooting section
* Token rotation procedures
- .env.example: Added Gitea coordinator configuration template
* GITEA_URL, GITEA_BOT_USERNAME, GITEA_BOT_TOKEN
* GITEA_BOT_PASSWORD, GITEA_REPO_OWNER, GITEA_REPO_NAME
* Security notes for credential storage
All acceptance criteria met:
✓ Documentation for bot user creation
✓ Automated setup script
✓ Testing procedures and scripts
✓ Configuration templates
✓ Security best practices
✓ Troubleshooting guide
Addresses Milestone: M4.1-Coordinator
Relates to: #140 , #157 , #158
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-01 17:32:03 -06:00
cb0948214e
feat(auth): Configure Authentik OIDC integration with better-auth
...
ci/woodpecker/push/woodpecker Pipeline was successful
- Add genericOAuth plugin to auth.config.ts with Authentik provider
- Fix LoginButton to use /auth/signin/authentik (not /auth/callback/)
- Add production URLs to trustedOrigins
- Update .env.example with correct redirect URI documentation
Redirect URI for Authentik: https://api.mosaicstack.dev/auth/callback/authentik
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-31 18:11:32 -06:00
Jason Woltje
3ec2059470
feat: add semantic search with pgvector ( closes #68 , #69 , #70 )
...
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/pr/woodpecker Pipeline failed
Issues resolved:
- #68 : pgvector Setup
* Added pgvector vector index migration for knowledge_embeddings
* Vector index uses HNSW algorithm with cosine distance
* Optimized for 1536-dimension OpenAI embeddings
- #69 : Embedding Generation Pipeline
* Created EmbeddingService with OpenAI integration
* Automatic embedding generation on entry create/update
* Batch processing endpoint for existing entries
* Async generation to avoid blocking API responses
* Content preparation with title weighting
- #70 : Semantic Search API
* POST /api/knowledge/search/semantic - pure vector search
* POST /api/knowledge/search/hybrid - RRF combined search
* POST /api/knowledge/embeddings/batch - batch generation
* Comprehensive test coverage
* Full documentation in docs/SEMANTIC_SEARCH.md
Technical details:
- Uses OpenAI text-embedding-3-small model (1536 dims)
- HNSW index for O(log n) similarity search
- Reciprocal Rank Fusion for hybrid search
- Graceful degradation when OpenAI not configured
- Async embedding generation for performance
Configuration:
- Added OPENAI_API_KEY to .env.example
- Optional feature - disabled if API key not set
- Falls back to keyword search in hybrid mode
2026-01-30 15:19:13 -06:00
Jason Woltje
90abe2a9b2
feat: add knowledge module caching layer ( closes #79 )
2026-01-30 00:05:52 -06:00
Jason Woltje
973502f26e
feat(#37-41): Add domains, ideas, relationships, agents, widgets schema
...
Schema additions for issues #37-41:
New models:
- Domain (#37 ): Life domains (work, marriage, homelab, etc.)
- Idea (#38 ): Brain dumps with pgvector embeddings
- Relationship (#39 ): Generic entity linking (blocks, depends_on)
- Agent (#40 ): ClawdBot agent tracking with metrics
- AgentSession (#40 ): Conversation session tracking
- WidgetDefinition (#41 ): HUD widget registry
- UserLayout (#41 ): Per-user dashboard configuration
Updated models:
- Task, Event, Project: Added domainId foreign key
- User, Workspace: Added new relations
New enums:
- IdeaStatus: CAPTURED, PROCESSING, ACTIONABLE, ARCHIVED, DISCARDED
- RelationshipType: BLOCKS, BLOCKED_BY, DEPENDS_ON, etc.
- AgentStatus: IDLE, WORKING, WAITING, ERROR, TERMINATED
- EntityType: Added IDEA, DOMAIN
Migration: 20260129182803_add_domains_ideas_agents_widgets
2026-01-29 12:29:21 -06:00
Jason Woltje
6a038d093b
feat( #4 ): Implement Authentik OIDC authentication with BetterAuth
...
- Integrated BetterAuth library for modern authentication
- Added Session, Account, and Verification database tables
- Created complete auth module with service, controller, guards, and decorators
- Implemented shared authentication types in @mosaic/shared package
- Added comprehensive test coverage (26 tests passing)
- Documented type sharing strategy for monorepo
- Updated environment configuration with OIDC and JWT settings
Key architectural decisions:
- BetterAuth over Passport.js for better TypeScript support
- Separation of User (DB entity) vs AuthUser (client-safe subset)
- Shared types package to prevent FE/BE drift
- Factory pattern for auth config to use shared Prisma instance
Ready for frontend integration (Issue #6 ).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
Fixes #4
2026-01-28 17:26:34 -06:00
Jason Woltje
99afde4f99
feat( #2 ): Implement PostgreSQL 17 + pgvector database schema
...
Establishes multi-tenant database layer with vector similarity search for AI-powered memory features. Includes Docker infrastructure, Prisma ORM integration, NestJS services, and shared types across the monorepo.
Key changes:
- Docker: PostgreSQL 17 + pgvector v0.7.4, Valkey cache
- Schema: 8 models (User, Workspace, Task, Event, Project, ActivityLog, MemoryEmbedding) with RLS preparation
- NestJS: PrismaModule, DatabaseModule, EmbeddingsService
- Shared: Type-safe enums, constants, and database types
Fixes #2
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-01-28 16:06:34 -06:00
Jason Woltje
92e20b1686
feat( #1 ): Set up monorepo scaffold with pnpm workspaces + TurboRepo
...
Implements the foundational project structure including:
- pnpm workspaces configuration
- TurboRepo for build orchestration
- NestJS 11.1.12 API (apps/api)
- Next.js 16.1.6 web app (apps/web)
- Shared packages (config, shared, ui)
- TypeScript strict mode configuration
- ESLint + Prettier setup
- Vitest for unit testing (19 passing tests)
Fixes #1
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-28 13:31:33 -06:00