You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(remote): add built-in remote management HTTP server
Motivation
----------
Switching AI providers currently requires opening the desktop CC Switch
app. When working on a headless machine or wanting to switch from a
phone, there is no way to do so without a separate script that bypasses
the app's state management, causing race conditions.
Approach
--------
Add a lightweight Axum HTTP server embedded in the Tauri desktop app.
The server provides a mobile-friendly Web UI and REST API for provider
switching, directly calling ProviderService::switch() to ensure backfill
and state consistency.
Backend (Rust):
- remote/mod.rs: RemoteServer with start/stop lifecycle, SSE broadcast
channel, and Tailscale IP detection (resolves binary from known paths
to avoid macOS GUI app PATH limitations).
- remote/handlers.rs: 7 Axum endpoints — HTML page, provider list,
switch, current, SSE events, health check, and icon with dynamic SVG
coloring.
- remote/html.rs: Embedded single-page dark-theme HTML UI with
EventSource for real-time SSE updates.
- commands/remote.rs: Tauri commands for start/stop server, check
Tailscale availability, and query Tailscale IP.
- Integration points in lib.rs (startup), tray.rs, provider.rs,
failover.rs, failover_switch.rs to broadcast SSE on provider switch.
Frontend (React):
- RemoteSettings.tsx: Settings UI with enable toggle (immediate
start/stop), port input (stops server on change, user re-enables to
apply), Tailscale toggle with pre-flight availability check (disabled
when server is off), Tailscale IP display, and live status indicator.
- i18n translations for en/zh/ja.
Result
------
Users can now switch providers from any browser on the local network.
Default: http://localhost:4000. With Tailscale enabled, accessible from
mobile devices at the displayed Tailscale URL. Server is fully
manageable from the settings page without app restart.
17 files changed, +1172 -1 lines.
0 commit comments