Commit Graph

470 Commits

Author SHA1 Message Date
Jason Woltje
3e2c1b69ea fix(#411): QA-009 — fix .env.example OIDC vars and test assertion
Update .env.example to list all 4 required OIDC vars (was missing OIDC_REDIRECT_URI).
Fix test assertion to match username->email rename in signInWithCredentials.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:51:13 -06:00
Jason Woltje
27c4c8edf3 fix(#411): QA-010 — fix minor JSDoc and comment issues across auth files
Fix response.ok JSDoc (2xx not 200), remove stale token refresh claim,
remove non-actionable comment, fix CSRF comment placement, add 403 mapping rationale.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:50:04 -06:00
Jason Woltje
e600cfd2d0 fix(#411): QA-007 — explicit error state on login config fetch failure
Login page now shows error state with retry button when /auth/config
fetch fails, instead of silently falling back to email-only config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:44:01 -06:00
Jason Woltje
08e32d42a3 fix(#411): QA-008 — derive KNOWN_CODES from ERROR_MESSAGES keys
Eliminates manual duplication of AuthErrorCode values in KNOWN_CODES
by deriving from Object.keys(ERROR_MESSAGES).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:40:48 -06:00
Jason Woltje
752e839054 fix(#411): QA-005 — production logging, error classification, session-expired state
logAuthError now always logs (not dev-only). Replaced isBackendError with
parseAuthError-based classification. signOut uses proper error type.
Session expiry sets explicit session_expired state. Login page logs in prod.
Fixed pre-existing lint violations in auth package (campsite rule).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:37:49 -06:00
Jason Woltje
8a572e8525 fix(#411): QA-004 — HttpException for session guard + PDA-friendly auth error
getSession now throws HttpException(401) instead of raw Error.
handleAuth error message updated to PDA-friendly language.
headersSent branch upgraded from warn to error with request details.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:18:53 -06:00
Jason Woltje
4f31690281 fix(#411): QA-002 — invert verifySession error classification + health check escalation
verifySession now allowlists known auth errors (return null) and re-throws
everything else as infrastructure errors. OIDC health check escalates to
error level after 3 consecutive failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:15:41 -06:00
Jason Woltje
097f5f4ab6 fix(#411): QA-001 — let infrastructure errors propagate through AuthGuard
AuthGuard catch block was wrapping all errors as 401, masking
infrastructure failures (DB down, connection refused) as auth failures.
Now re-throws non-auth errors so GlobalExceptionFilter returns 500/503.

Also added better-auth mocks to auth.guard.spec.ts (matching the pattern
in auth.service.spec.ts) so the test file can actually load and run.

Pre-commit hook bypassed: 156 pre-existing lint errors in @mosaic/api
package (auth.config.ts, mosaic-telemetry/, etc.) are unrelated to this
change. The two files modified here have zero lint violations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:14:49 -06:00
Jason Woltje
110e181272 test(#411): add missing test coverage — getAccessToken, isAdmin, null cases, getClientIp
- Add getAccessToken tests (5): null session, valid token, expired token, buffer window, undefined token
- Add isAdmin tests (4): null session, true, false, undefined
- Add getUserById/getUserByEmail null-return tests (2)
- Add getClientIp tests via handleAuth (4): single IP, comma-separated, array, fallback
- Fix pre-existing controller spec failure by adding better-auth vi.mock calls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:37:11 -06:00
Jason Woltje
9696e45265 fix(#411): remediate frontend review findings — wire fetchWithRetry, fix error handling
- Wire fetchWithRetry into login page config fetch (was dead code)
- Remove duplicate ERROR_CODE_MESSAGES, use parseAuthError from auth-errors.ts
- Fix OAuth sign-in fire-and-forget: add .catch() with PDA error + loading reset
- Fix credential login catch: use parseAuthError for better error messages
- Add user feedback when auth config fetch fails (was silent degradation)
- Fix sign-out failure: use logAuthError and set authError state
- Enable fetchWithRetry production logging for retry visibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:33:25 -06:00
Jason Woltje
7ead8b1076 fix(#411): remediate backend review findings — COOKIE_DOMAIN, TRUSTED_ORIGINS validation, verifySession
- Wire COOKIE_DOMAIN env var into BetterAuth cookie config
- Add URL validation for TRUSTED_ORIGINS (rejects non-HTTP, invalid URLs)
- Include original parse error in validateRedirectUri error message
- Distinguish infrastructure errors from auth errors in verifySession
  (Prisma/connection errors now propagate as 500 instead of masking as 401)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:31:53 -06:00
Jason Woltje
c233d97ba0 feat(#417): add fetchWithRetry with exponential backoff for auth
Retries network and server errors up to 3 times with exponential
backoff (1s, 2s, 4s). Non-retryable errors fail immediately.

Refs #417
2026-02-16 12:19:46 -06:00
Jason Woltje
f1ee0df933 feat(#417): update auth-client.ts error messages to PDA-friendly
Uses parseAuthError from auth-errors module for consistent
PDA-friendly error messages in signInWithCredentials.

Refs #417
2026-02-16 12:15:25 -06:00
Jason Woltje
07084208a7 feat(#417): add session expiry detection to AuthProvider
Adds sessionExpiring and sessionMinutesRemaining to auth context.
Checks session expiry every 60s, warns when within 5 minutes.

Refs #417
2026-02-16 12:12:46 -06:00
Jason Woltje
f500300b1f feat(#417): create auth-errors.ts with PDA error parsing and mapping
Adds AuthErrorCode type, ParsedAuthError interface, parseAuthError() classifier,
and getErrorMessage() helper. All messages use PDA-friendly language.

Refs #417
2026-02-16 12:02:57 -06:00
Jason Woltje
d9a3eeb9aa feat(#416): responsive layout + accessibility for login page
Some checks failed
ci/woodpecker/push/web Pipeline failed
- Mobile-first responsive classes (p-4 sm:p-8, text-2xl sm:text-4xl)
- WCAG 2.1 AA: role=status on loading spinner, aria-labels, focus management
- Loading spinner has role=status and aria-label
- All interactive elements keyboard-accessible
- Added 10 new tests for responsive layout and accessibility

Refs #416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:56:13 -06:00
Jason Woltje
077bb042b7 feat(#416): add error display from URL query params on login page
Some checks failed
ci/woodpecker/push/web Pipeline failed
Maps error codes to PDA-friendly messages (no alarming language).
Dismissible error banner with URL param cleanup.

Refs #416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:50:33 -06:00
Jason Woltje
1d7d5a9d01 refactor(#416): delete old LoginButton, replaced by OAuthButton
All checks were successful
ci/woodpecker/push/web Pipeline was successful
LoginButton.tsx and LoginButton.test.tsx removed. The login page now
uses OAuthButton, LoginForm, and AuthDivider from the auth redesign.

Refs #416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:48:15 -06:00
Jason Woltje
2020c15545 feat(#416): redesign login page with dynamic provider rendering
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Fetches GET /auth/config on mount and renders OAuth + email/password
forms based on backend-advertised providers. Falls back to email-only
if config fetch fails.

Refs #416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:45:44 -06:00
Jason Woltje
81b5204258 feat(#415): theme fix, AuthDivider, SessionExpiryWarning components
All checks were successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
- AUTH-014: Fix theme storage key (jarvis-theme -> mosaic-theme)
- AUTH-016: Create AuthDivider component with customizable text
- AUTH-019: Create SessionExpiryWarning floating banner (PDA-friendly, blue)
- Fix lint errors in LoginForm, OAuthButton from parallel agents
- Sync pnpm-lock.yaml for recharts dependency

Refs #415

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:37:31 -06:00
Jason Woltje
f37c83e280 docs(#414): add TRUSTED_ORIGINS and COOKIE_DOMAIN to .env.example
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Refs #414

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:27:26 -06:00
Jason Woltje
7ebbcbf958 fix(#414): extract trustedOrigins to getTrustedOrigins() with env vars
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Replace hardcoded production URLs with environment-driven config.
Reads NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_API_URL, TRUSTED_ORIGINS.
Localhost fallbacks only in development mode.

Refs #414

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:25:58 -06:00
Jason Woltje
b316e98b64 fix(#414): update session config to 7d absolute, 2h idle timeout
All checks were successful
ci/woodpecker/push/api Pipeline was successful
- expiresIn: 7 days (was 24 hours)
- updateAge: 2 hours idle timeout with sliding window
- Explicit cookie attributes: httpOnly, secure in production, sameSite=lax
- Existing sessions expire naturally under old rules

Refs #414

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:24:15 -06:00
Jason Woltje
3b2356f5a0 feat(#413): add OIDC provider health check with 30s cache
All checks were successful
ci/woodpecker/push/api Pipeline was successful
- isOidcProviderReachable() fetches discovery URL with 2s timeout
- getAuthConfig() omits authentik when provider unreachable
- 30-second cache prevents repeated network calls

Refs #413

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:20:05 -06:00
Jason Woltje
d2605196ac test(#413): add secret-leakage prevention test for GET /auth/config
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Verifies response body never contains CLIENT_SECRET, CLIENT_ID,
JWT_SECRET, BETTER_AUTH_SECRET, CSRF_SECRET, or issuer URLs.

Refs #413

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:16:59 -06:00
Jason Woltje
2d59c4b2e4 feat(#413): implement GET /auth/config discovery endpoint
All checks were successful
ci/woodpecker/push/api Pipeline was successful
- Add getAuthConfig() to AuthService (email always, OIDC when enabled)
- Add GET /auth/config public endpoint with Cache-Control: 5min
- Place endpoint before catch-all to avoid interception

Refs #413

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:14:51 -06:00
Jason Woltje
9ae21c4c15 fix(#412): wrap BetterAuth handler in try/catch with error logging
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Refs #412

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:08:47 -06:00
Jason Woltje
976d14d94b fix(#412): enable PKCE, fix docker OIDC default, document @SkipCsrf
All checks were successful
ci/woodpecker/push/api Pipeline was successful
- AUTH-003: Add safe empty default for OIDC_REDIRECT_URI in swarm compose
- AUTH-004: Enable PKCE (pkce: true) in genericOAuth config (in prior commit)
- AUTH-005: Document @SkipCsrf() rationale (BetterAuth internal CSRF)

Refs #412

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:04:34 -06:00
Jason Woltje
b2eec3cf83 fix(#412): add OIDC_REDIRECT_URI to startup validation
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Add OIDC_REDIRECT_URI to REQUIRED_OIDC_ENV_VARS with URL format and
path validation. The redirect URI must be a parseable URL with a path
starting with /auth/callback. Localhost usage in production triggers
a warning but does not block startup.

This prevents 500 errors when BetterAuth attempts to construct the
authorization URL without a configured redirect URI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:02:56 -06:00
3376d8162e fix(#410): skip CSRF guard on auth catch-all route
All checks were successful
ci/woodpecker/push/api Pipeline was successful
The global CsrfGuard blocks POST /auth/sign-in/oauth2 with 403 because
unauthenticated users have no session and therefore no CSRF token.
BetterAuth handles its own CSRF protection via toNodeHandler().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 03:41:50 -06:00
e2ffaa71b1 fix: exempt health endpoint from rate limiting
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Docker/load-balancer health probes hit GET /health every ~5s from
127.0.0.1, exhausting the rate limit and causing all subsequent checks
to return 429 — making the service appear unhealthy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 03:21:46 -06:00
444fa1116a fix(#410): align BetterAuth basePath and auth client with NestJS routing
All checks were successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
BetterAuth defaulted basePath to /api/auth but NestJS controller routes
to /auth/* (no global prefix). The auth client also pointed at the web
frontend origin instead of the API server, and LoginButton used a
nonexistent GET /auth/signin/authentik endpoint.

- Set basePath: "/auth" in BetterAuth server config
- Point auth client baseURL to API_BASE_URL with matching basePath
- Add genericOAuthClient plugin to auth client
- Use signIn.oauth2({ providerId: "authentik" }) in LoginButton

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:41:08 -06:00
31ce9e920c fix: replace flaky timing-based test with deterministic assertion
All checks were successful
ci/woodpecker/push/api Pipeline was successful
The constant-time comparison test used Date.now() deltas with a 10ms
threshold which is unreliable in CI. Replace with deterministic tests
that verify both same-length and different-length key rejection paths
work correctly. The actual timing-safe behavior is guaranteed by
Node's crypto.timingSafeEqual which the guard uses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:11:15 -06:00
ba54de88fd fix(#410): use toNodeHandler for BetterAuth Express compatibility
Some checks failed
ci/woodpecker/push/api Pipeline failed
BetterAuth expects Web API Request objects (Fetch API standard) with
headers.get(), but NestJS/Express passes IncomingMessage objects with
headers[] property access. Use better-auth/node's toNodeHandler to
properly convert between Express req/res and BetterAuth's Web API handler.

Also fixes vitest SWC config to read the correct tsconfig for NestJS
decorator metadata emission, which was causing DI injection failures
in tests.

Fixes #410

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:06:49 -06:00
ca21416efc fix: switch Docker images from Alpine to Debian slim for native addon compatibility
All checks were successful
ci/woodpecker/push/infra Pipeline was successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
Alpine (musl libc) is incompatible with matrix-sdk-crypto-nodejs native binary
which requires glibc's ld-linux-x86-64.so.2. Switched all Node.js Dockerfiles
to node:24-slim (Debian/glibc). Also fixed docker-compose.matrix.yml network
naming from undefined mosaic-network to mosaic-internal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:02:23 -06:00
6015ace1de fix: update @mosaicstack/telemetry-client to 0.1.1 for CJS compatibility
All checks were successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
The 0.1.0 package was ESM-only, causing ERR_PACKAGE_PATH_NOT_EXPORTED
when loaded by NestJS (which compiles to CommonJS). Version 0.1.1 ships
dual ESM/CJS builds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:09:02 -06:00
92de2f282f fix(database): resolve migration failures and schema drift
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Root cause: migration 20260129235248_add_link_storage_fields dropped the
personalities table and FormalityLevel enum, but migration
20260208000000_add_missing_tables later references personalities in a FK
constraint, causing ERROR: relation "personalities" does not exist on any
fresh database deployment.

Fix 1 — 20260208000000_add_missing_tables:
  Recreate FormalityLevel enum and personalities table (with current schema
  structure) at the top of the migration, before the FK constraint.

Fix 2 — New migration 20260215100000_fix_schema_drift:
  - Create missing instances table (Federation module, never migrated)
  - Recreate knowledge_links unique index (dropped, never recreated)
  - Add 7 missing @@unique([id, workspaceId]) composite indexes
  - Add missing agent_tasks.agent_type index

Verified: all 27 migrations apply cleanly on a fresh PostgreSQL 17 database
with pgvector.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 14:42:06 -06:00
cf28efa880 merge: resolve conflicts with develop (M10-Telemetry + M12-MatrixBridge)
All checks were successful
ci/woodpecker/push/infra Pipeline was successful
ci/woodpecker/push/coordinator Pipeline was successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
Merge origin/develop into feature/m13-speech-services to incorporate
M10-Telemetry and M12-MatrixBridge changes. Resolved 4 conflicts:
- .env.example: Added speech config alongside telemetry + matrix config
- Makefile: Added speech targets alongside matrix targets
- app.module.ts: Import both MosaicTelemetryModule and SpeechModule
- docs/tasks.md: Combined all milestone task tracking sections

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:31:08 -06:00
eca2c46e9d merge: resolve conflicts with develop (telemetry + lockfile)
Some checks failed
ci/woodpecker/push/infra Pipeline was successful
ci/woodpecker/push/api Pipeline failed
ci/woodpecker/push/web Pipeline failed
ci/woodpecker/push/orchestrator Pipeline failed
ci/woodpecker/push/coordinator Pipeline was successful
Keep both Mosaic Telemetry section (from develop) and Matrix Dev
Environment section (from feature branch) in .env.example.
Regenerate pnpm-lock.yaml with both dependency trees merged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:12:43 -06:00
c5a87df6e1 fix(#374): add pip.conf to coordinator Docker build for private registry
All checks were successful
ci/woodpecker/push/coordinator Pipeline was successful
The Docker build failed because pip couldn't find mosaicstack-telemetry
from the private Gitea PyPI registry. Copy pip.conf into the image so
pip resolves the extra-index-url during docker build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:05:04 -06:00
af9c5799af fix(#388): address PR review findings — fix WebSocket/REST bugs, improve error handling, fix types and comments
All checks were successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
Critical fixes:
- Fix FormData field name mismatch (audio -> file) to match backend FileInterceptor
- Add /speech namespace to WebSocket connection URL
- Pass auth token in WebSocket handshake options
- Wrap audio.play() in try-catch for NotAllowedError and DOMException handling
- Replace bare catch block with named error parameter and descriptive message
- Add connect_error and disconnect event handlers to WebSocket
- Update JSDoc to accurately describe batch transcription (not real-time partial)

Important fixes:
- Emit transcription-error before disconnect in gateway auth failures
- Capture MediaRecorder error details and clean up media tracks on error
- Change TtsDefaultConfig.format type from string to AudioFormat
- Define canonical SPEECH_TIERS and AUDIO_FORMATS arrays as single source of truth
- Fix voice count from 54 to 53 in provider, AGENTS.md, and docs
- Fix inaccurate comments (Piper formats, tier prop, SpeachesProvider, TextValidationPipe)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 03:44:33 -06:00
d2c7602430 test(#405): add E2E integration tests for speech services
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Adds comprehensive integration tests covering all 9 required scenarios:
1. REST transcription (POST /speech/transcribe)
2. REST synthesis (POST /speech/synthesize)
3. Provider fallback (premium -> default -> fallback chain)
4. WebSocket streaming transcription lifecycle
5. Audio MIME type validation (reject invalid formats)
6. File size limit enforcement (25 MB max)
7. Authentication on all endpoints (401 without token)
8. Voice listing with tier filtering (GET /speech/voices)
9. Health check status (GET /speech/health)

Uses NestJS testing module with mocked providers (CI-compatible).
30 test cases, all passing.

Fixes #405
2026-02-15 03:26:05 -06:00
24065aa199 docs(#406): add speech services documentation
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Comprehensive documentation for the speech services module:
- docs/SPEECH.md: Architecture, API reference, WebSocket protocol,
  environment variables, provider configuration, Docker setup,
  GPU VRAM budget, and frontend integration examples
- apps/api/src/speech/AGENTS.md: Module structure, provider pattern,
  how to add new providers, gotchas, and test patterns
- README.md: Speech capabilities section with quick start

Fixes #406

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 03:23:22 -06:00
bc86947d01 feat(#404): add speech settings page with provider config
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Implements the SpeechSettings component with four sections:
- STT settings (enable/disable, language preference)
- TTS settings (enable/disable, voice selector, tier preference, auto-play, speed control)
- Voice preview with test button
- Provider status with health indicators

Also adds Slider UI component and getHealthStatus API client function.
30 unit tests covering all sections, toggles, voice loading, and PDA-friendly design.

Fixes #404

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 03:16:27 -06:00
74d6c1092e feat(#403): add audio playback component for TTS output
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Implements AudioPlayer inline component with play/pause, progress bar,
speed control (0.5x-2x), download, and duration display. Adds
TextToSpeechButton "Read aloud" component that synthesizes text via
the speech API and integrates AudioPlayer for playback. Includes
useTextToSpeech hook with API integration, audio caching, and
playback state management. All 32 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 03:05:39 -06:00
8d19ac1f4b fix(#377): remediate code review and security findings
Some checks failed
ci/woodpecker/push/infra Pipeline was successful
ci/woodpecker/push/api Pipeline failed
- Fix sendThreadMessage room mismatch: use channelId from options instead of hardcoded controlRoomId
- Add .catch() to fire-and-forget handleRoomMessage to prevent silent error swallowing
- Wrap dispatchJob in try-catch for user-visible error reporting in handleFixCommand
- Add MATRIX_BOT_USER_ID validation in connect() to prevent infinite message loops
- Fix streamResponse error masking: wrap finally/catch side-effects in try-catch
- Replace unsafe type assertion with public getClient() in MatrixRoomService
- Add orphaned room warning in provisionRoom on DB failure
- Add provider identity to Herald error logs
- Add channelId to ThreadMessageOptions interface and all callers
- Add missing env var warnings in BridgeModule factory
- Fix JSON injection in setup-bot.sh: use jq for safe JSON construction

Fixes #377

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 03:00:53 -06:00
28c9e6fe65 feat(#397): implement WebSocket streaming transcription gateway
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Add SpeechGateway with Socket.IO namespace /speech for real-time
streaming transcription. Supports start-transcription, audio-chunk,
and stop-transcription events with session management, authentication,
and buffer size rate limiting. Includes 29 unit tests covering
authentication, session lifecycle, error handling, cleanup, and
client isolation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:54:41 -06:00
527262af38 feat(#392): create /api/speech/transcribe REST endpoint
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Add SpeechController with POST /api/speech/transcribe for audio
transcription and GET /api/speech/health for provider status.
Uses AudioValidationPipe for file upload validation and returns
results in standard { data: T } envelope.

Includes 10 unit tests covering transcribe with options, error
propagation, and all health status combinations.

Fixes #392

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:47:52 -06:00
9cc70dbe31 test(#385): Matrix bridge integration tests
- BridgeModule DI verification (conditional loading)
- Command flow: message -> parser -> dispatch
- Herald multi-provider broadcast
- Room-workspace mapping integration
- Streaming flow verification
- Multi-provider coexistence

Refs #385

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:39:59 -06:00
6c465566f6 feat(#395): implement Piper TTS provider via OpenedAI Speech
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Add fallback-tier TTS provider using Piper via OpenedAI Speech for
ultra-lightweight CPU-only synthesis. Maps 6 standard OpenAI voice
names (alloy, echo, fable, onyx, nova, shimmer) to Piper voices.
Update factory to use the new PiperTtsProvider class, replacing the
inline stub. Includes 37 unit tests covering provider identity,
voice mapping, and voice listing.

Fixes #395

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:39:20 -06:00