3 Commits
Author SHA1 Message Date
Juan Denis 899dac99b5 refactor(agents): centralize remote command dispatch 2026-08-18 03:05:32 -04:00
Juan DenisandClaude Opus 4.7 7d55a9c05d Add panel-driven cloudflared login flow
Users had to SSH in to run `cloudflared tunnel login` before any of
the Tunnels tab worked. Wire up the OAuth flow so the panel can
trigger it and surface the auth URL for the user to open from their
own browser.

Agent:
- New cloudflared.LoginEvent + Manager.Login() that spawns the
  process, regex-matches the dash.cloudflare.com/argotunnel URL on
  stdout/stderr, and watches cert.pem in parallel as a reliable
  completion signal. 15-minute hard ceiling.
- New cloudflared:login action returns {job_id, channel} immediately;
  the goroutine emits start → status (with auth_url) → done events
  on the job channel.
- Non-linux stub returns "unsupported".
- jobs.HasTerminated() helper so handler shutdown paths can avoid
  double-emitting the terminator.

Panel:
- POST /servers/<id>/cloudflared/login + RemoteCloudflaredService.login
- ApiService.startRemoteCloudflaredLogin

Frontend:
- CloudflaredTab gains a "Login to Cloudflare" CTA when not authed.
  Click → starts the agent flow, joins the job's Socket.IO room,
  listens for the auth_url event, and renders an Open-in-Browser
  button. Once the agent emits done, refreshes capabilities + status
  + tunnel list automatically — the rest of the tab unlocks itself.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 05:52:11 -04:00
Juan Denis 8ddd60f83d Add Cloudflared tunnel management
Introduce Cloudflare Tunnel management end-to-end.

Highlights:
- Add agent/internal/cloudflared package (Manager interface, Linux impl, non-Linux stub) to shell out to cloudflared and detect auth via cert.pem.
- Wire cloudflared Manager into the agent and register cloudflared:* handlers for status/list/create/route/delete.
- Extend protocol.Capabilities and agent payloads with runtimes detection and a cloudflared capability; implement runtime version probes.
- Add backend API endpoints and RemoteCloudflaredService that forward cloudflared actions to agents; update agent registry to store runtimes.
- Frontend: new CloudflaredTab UI, API client methods for remote cloudflared operations, styles, and UX tweaks (plus minor component/class refinements in LogViewer, ProcessTable, FileManager, StyleGuide, terminal styles).

Purpose: allow the panel to manage Cloudflare named tunnels by delegating commands to the agent's cloudflared CLI, while surfacing binary/auth state (install vs authenticated) and detected language runtimes.
2026-05-01 02:26:15 -04:00