Skip to content

Architecture

Jackson Sá edited this page Oct 21, 2026 · 1 revision

The cockpit talks to one thing: agentuxd, over its Unix socket ($AGENTUX_SOCKET, else $XDG_RUNTIME_DIR/agentux/agentuxd.sock). It never starts agents itself. System changes (installs, sign-ins, keys, enrollment) go through agentux-setup.

React UI ──DaemonClient──▶ TauriDaemonClient ──invoke──▶ Rust backend ──JSON-RPC──▶ agentuxd
         └─SetupClient──▶ TauriSetupClient ──setup_exec──▶ agentux-setup (allowlisted subcommands)

Code layout

Path What it is
cockpit/src/daemon/types.ts The domain model: projects, runs, steps, sessions, vendor-neutral session events, requests, bus messages, spend, limits
cockpit/src/daemon/client.ts The DaemonClient interface the UI depends on, and createDaemonClient()
cockpit/src/daemon/tauri/ TauriDaemonClient, the API wire types and mapping.ts (API → cockpit)
cockpit/src/daemon/mock/ MockDaemonClient and the scripted scenarios it plays
cockpit/src/setup/ The setup backend interface: catalog types, the command builder, TauriSetupClient, MockSetupClient
cockpit/src/welcome/ The wizard: Welcome.tsx, profiles.ts, ProfileStep, RoleStep, AgentsStep, ToolsStep, GitStep, DoneStep
cockpit/src/components/ Run board, session panel, inbox, bus feed, Agents view, Settings, Remote control, terminal view, status bar
cockpit/src/helper/ The penguin: help content, tour, What's this?, Ask
cockpit/src-tauri/src/daemon/ The socket client, the reconnecting event stream, the daemon_* commands, terminals (one connection each)
cockpit/src-tauri/src/setup.rs The welcome window, --welcome, setup_exec

Components only use DaemonClient; createDaemonClient() picks the implementation.

The connection

  • At startup the frontend probes the daemon. No answer: mock data with a Mock data badge and a banner, and a reload once the daemon is up.
  • The backend keeps one events.subscribe stream and forwards every event as daemon://event. On a disconnect it retries with backoff (0.5 s to 15 s) and resubscribes from the last seq, so nothing is lost; the UI reloads its lists on reconnect.
  • Optional methods (sessions.prompt, bus.post, terminals.*, harnesses.list, limits.*, preferences.*, helper.ask) are probed; on older daemons (-32601) the feature is disabled with the reason shown.
  • Terminals each get their own socket connection (the daemon ties a terminal to the connection that opened it); output arrives as terminal://<stream> events.

Single instance

The cockpit runs once per session (tauri-plugin-single-instance, D-Bus name os.agentux.cockpit.SingleInstance); a second launch focuses the first. The Wayland app_id is agentux-cockpit, matching the desktop file — keep enableGTKAppId off.

Clone this wiki locally