Skip to content

Add Settings Gateway pane for local VocaGateway - #252

Open
jatinkrmalik wants to merge 9 commits into
mainfrom
feat/settings-gateway-pane
Open

Add Settings Gateway pane for local VocaGateway#252
jatinkrmalik wants to merge 9 commits into
mainfrom
feat/settings-gateway-pane

Conversation

@jatinkrmalik

@jatinkrmalik jatinkrmalik commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Settings → Gateway pane so VocaMac can start and stop a local native vocagateway, show status through Pairable/Ready, and present a Pair phone QR once the pairing URL is not loopback.

  • Native-first happy path (resolve vocagateway via /usr/bin/which or common install locations, spawn/stop our child only, health-check 127.0.0.1:8765)
  • Pairable before Ready: QR is available when Gateway is live and the pairing URL is a non-loopback address
  • Decodes /v1/admin/pairing payload client-side for {v,url,token} (payload may be an object or JSON string)
  • Rejects localhost / 127.0.0.1 / ::1 for the QR and surfaces a public URL override (VOCAGATEWAY_PUBLIC_URL when VocaMac starts Gateway)
  • Docker Desktop is a fallback CTA only when the native binary is missing, with clear copy that Docker has no MLX / Apple Silicon native engines
  • Opens Gateway paths under ~/.config/vocagateway (does not treat VocaMac Application Support as the Gateway log source of truth)
  • Menu bar shows Pair phone… when Pairable/Ready (opens Settings → Gateway via notification; avoids fragile MenuBarExtra sheets)
  • Copy frames Gateway as optional companion compute, not on-device

Test plan

  • Open Settings and confirm Gateway appears in the sidebar before About with the server.rack icon
  • Search for gateway / pair / phone / docker / vocagateway and land on the Gateway pane
  • With no binary installed, Start stays disabled and the Docker fallback CTA is visible with no-MLX copy
  • With vocagateway on PATH, Start brings status to Pairable or Ready; Open WebUI works
  • Confirm QR is hidden when pairing URL is loopback; applying a LAN/Tailscale override shows the Pair phone sheet
  • From the menu bar, Pair phone… appears when Pairable and opens Settings Gateway pairing UI
  • Open logs reveals ~/.config/vocagateway, not VocaMac Application Support logs
  • Unit tests: payload decode (string + object), loopback rejection including ::1, SettingsPage includes gateway

Ship an MVP Settings → Gateway tab that starts and stops a local
vocagateway binary, probes health, and shows a Pair phone QR once the
pairing URL is non-loopback. Docker stays a fallback CTA only.
@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for voca-mac canceled.

Name Link
🔨 Latest commit fa1ad16
🔍 Latest deploy log https://app.netlify.com/projects/voca-mac/deploys/6a9cbe32363c970008e093c2

@github-actions github-actions Bot added ci enhancement New feature or request app and removed enhancement New feature or request ci labels Sep 4, 2026
Define GatewayRuntimeStatus, share one process manager, reject
loopback QR URLs consistently, and show Pair phone in the menu
bar when status is Pairable or Ready.
Rename the local Gateway controller to GatewayEmbedController with a
shared singleton for Settings and the menu bar. Decode pairing payload
as object or string, reject loopback QR URLs, open ~/.config/vocagateway
for logs, and surface Pair phone from the tray when Pairable.
@jatinkrmalik
jatinkrmalik marked this pull request as ready for review September 6, 2026 00:29
@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds a Gateway settings pane for discovering, starting, stopping, monitoring, and pairing with a local VocaGateway.

  • Adds native process lifecycle management with escalating child termination and health checks.
  • Adds pairing-payload decoding, public URL validation, and QR presentation.
  • Adds durable Settings navigation and pairing requests from the menu bar.
  • Adds Gateway settings search entries and unit coverage for pairing and settings request state.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
Sources/VocaMac/Services/GatewayEmbedController.swift Adds Gateway discovery, lifecycle control, health checks, pairing retrieval, and an escalating termination path that preserves ownership of a surviving child.
Sources/VocaMac/App/VocaMacApp.swift Extends SettingsWindowManager with durable page-selection and pairing-presentation requests.
Sources/VocaMac/Views/GatewaySettingsTab.swift Adds the Gateway status, process controls, pairing workflow, fallback guidance, and QR sheet.
Sources/VocaMac/Views/SettingsView.swift Integrates the Gateway pane and applies durable settings-page requests.
Sources/VocaMac/Views/MenuBarView.swift Adds Gateway status refresh and durable Pair phone navigation from the menu bar.
Sources/VocaMac/Models/GatewayPairing.swift Adds pairing response decoding, payload generation, and loopback/public URL validation.

Sequence Diagram

sequenceDiagram
    participant Menu as Menu Bar
    participant Manager as SettingsWindowManager
    participant Settings as SettingsView
    participant Gateway as GatewaySettingsTab
    participant Controller as GatewayEmbedController
    Menu->>Manager: open(page: gateway, showPairing: true)
    Manager->>Settings: publish requestedPage
    Settings->>Gateway: render Gateway pane
    Gateway->>Controller: refreshStatus()
    Controller-->>Gateway: Pairable or Ready
    Gateway->>Manager: consume pending pairing
    Gateway-->>Menu: present pairing QR sheet
Loading

Reviews (5): Last reviewed commit: "Wait for exit after SIGINT and escalate ..." | Re-trigger Greptile

Comment thread Sources/VocaMac/Services/GatewayEmbedController.swift
Comment thread Sources/VocaMac/Views/MenuBarView.swift Outdated
On start timeout, terminate the child process so Stop is not required to clear a stranded gateway.
Open Settings Pair phone through durable page and pairing flags instead of delayed notifications.
Comment thread Sources/VocaMac/Views/GatewaySettingsTab.swift Outdated
Do not clear the durable pairing flag when the Gateway pane appears before status refresh. Retry after refresh and when status becomes pairable.
@jatinkrmalik

Copy link
Copy Markdown
Member Author

Re-open to re-trigger CI (App CI did not start on last pushes).

@jatinkrmalik jatinkrmalik reopened this Sep 6, 2026
@jatinkrmalik
jatinkrmalik marked this pull request as draft September 6, 2026 00:53
@jatinkrmalik
jatinkrmalik marked this pull request as ready for review September 6, 2026 00:53
Resolve MenuBarView conflict. Keep Pair phone durable open and main menu bar changes.
Comment thread Sources/VocaMac/Services/GatewayEmbedController.swift Outdated
If refreshStatus finds the process retained but not live after a pairing error, tear it down so Stop is not stuck disabled and Start cannot spawn a second child.
Comment thread Sources/VocaMac/Services/GatewayEmbedController.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant