Skip to content

feat(dashboard-api): add settings, voice runtime, and diagnostics APIs#364

Open
championVisionAI wants to merge 2 commits intoLight-Heart-Labs:mainfrom
championVisionAI:feat/dashboard-api-settings-voice-diagnostics
Open

feat(dashboard-api): add settings, voice runtime, and diagnostics APIs#364
championVisionAI wants to merge 2 commits intoLight-Heart-Labs:mainfrom
championVisionAI:feat/dashboard-api-settings-voice-diagnostics

Conversation

@championVisionAI
Copy link
Contributor

@championVisionAI championVisionAI commented Mar 18, 2026

Summary

This PR adds the missing runtime API contracts used by Dashboard setup/success/voice flows, and backs them with persistence + tests.

Why

Several frontend and integration flows depend on endpoints that were absent in dashboard-api (/api/settings, /api/voice/*, /api/test/*). This created broken UX paths and false-negative health/feature checks.

What Changed

  • Added new runtime router:
    • GET /api/settings
    • GET /api/voice/settings
    • POST /api/voice/settings
    • GET /api/voice/status
    • POST /api/voice/token
    • GET /api/test/{llm|voice|rag|workflows}
  • Wired runtime router into FastAPI app bootstrap.
  • Added tests for:
    • settings payload shape/dynamic fields
    • voice settings default + persistence roundtrip
    • voice status aggregation behavior
    • voice token credential checks + JWT format
    • diagnostics endpoint behavior + unknown-target handling
  • Updated dashboard-api README endpoint docs.

Implementation Notes

  • Voice settings persist to DATA_DIR/config/voice-settings.json.
  • LiveKit token is minted with HS256 using LIVEKIT_API_KEY + LIVEKIT_API_SECRET.
  • Voice status aggregates health for Whisper, TTS, and LiveKit with an available summary boolean.
  • Diagnostics endpoints are intentionally lightweight and UI-friendly.

Testing

  • Added/updated unit tests in tests/test_routers.py.
  • Static compile check passed via python3 -m py_compile.
  • Full pytest run was not possible in this environment because pytest is not installed.

Risk

  • Low to medium: new endpoints only, no migration required.
  • Auth behavior remains consistent with existing protected API routes.

Rollback

  • Revert commit 1738d88 to remove runtime router and restore prior API surface.

Copy link
Collaborator

@Lightheartdevs Lightheartdevs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: REQUEST CHANGES

High: Broad except Exception in _check_livekit

Narrow to aiohttp.ClientError + asyncio.TimeoutError per project convention in helpers.py.

High: New aiohttp.ClientSession created per call

Rest of codebase uses shared session via _get_aio_session() to avoid fd exhaustion. Reuse the shared session.

High: Hard conflict with PR #363

Both PRs add GET /api/settings with incompatible implementations and response shapes. #363 in main.py (richer: services, GPU, model, updates). #364 in routers/runtime.py (slimmer: version, tier, uptime, storage). Cannot both merge. Recommendation: merge the richer payload from #363 into the runtime.py router location from #364.

Medium:

  • Hand-rolled HS256 JWT — document rationale or use PyJWT
  • Silent _read_json exception swallowing — add logger.warning
  • Unrelated tests deleted (status, storage, external-links, service-tokens) — restore or justify
  • _atomic_write_json uses Path.replace() which isn't atomic on Windows

🤖 Reviewed with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants