agent-manager

Portals

Overview

Portals let you access running sessions from a separate terminal — useful for monitoring agents on a remote machine, pairing, or keeping the main UI on one screen while interacting from another.

The portal communicates over a Unix socket at /tmp/agent-manager/portal.sock.

Usage

# Interactive picker — browse sessions, create new ones
agent-manager portal

# Connect directly to a known session
agent-manager portal <session-id>

# Static table of running sessions
agent-manager portal --list
bash

Interactive Picker

  • Use arrow keys to navigate, Enter to select
  • Choose "+ New Session" to start a fresh agent from the portal
  • Press Esc to exit

Once connected, the portal mirrors the session in real-time. Press Ctrl+C to disconnect and return to your shell.

Features

  • Full terminal mirroring — See the exact same output as the main app in real-time
  • Input forwarding — Type commands and interact with the agent as if you were in the main app
  • Scroll support — Mouse wheel, Ctrl+U/Ctrl+D, and PageUp/PageDown all work
  • Connection indicator — The main app shows a icon in the header when a portal client is connected
  • Remote session creation — Start new agent sessions directly from the portal

Protocol

The portal uses newline-delimited JSON over a Unix domain socket.

Client to Server

Message TypeDescription
portal_listRequest list of running sessions
portal_subscribeSubscribe to a session's output
portal_inputForward keyboard input to the session
portal_unsubscribeDisconnect from current session
portal_list_driversRequest available agent drivers
portal_create_sessionCreate a new agent session
portal_scrollScroll the terminal view

Server to Client

Message TypeDescription
portal_sessionsList of running sessions
portal_frameScreen content update
portal_statusSession status change
portal_session_endedSession terminated
portal_errorError message
portal_driversAvailable agent drivers
portal_session_createdNew session created confirmation

Types

interface PortalSessionInfo {
  id: string;
  driverName: string;
  displayName: string;
  cwd: string;
  status: string;
}

interface PortalDriverInfo {
  name: string;
  displayName: string;
  installed: boolean;
}

// Client → Server
type PortalClientMsg =
  | { type: "portal_list" }
  | { type: "portal_subscribe"; sessionId: string }
  | { type: "portal_input"; data: string }
  | { type: "portal_unsubscribe" }
  | { type: "portal_list_drivers" }
  | { type: "portal_create_session"; driverName: string; cwd: string }
  | { type: "portal_scroll"; lines: number }

// Server → Client
type PortalServerMsg =
  | { type: "portal_sessions"; sessions: PortalSessionInfo[] }
  | { type: "portal_frame"; content: ScreenContent; cursor: { x: number; y: number }; cols: number; rows: number }
  | { type: "portal_status"; sessionId: string; status: string }
  | { type: "portal_session_ended"; sessionId: string }
  | { type: "portal_error"; message: string }
  | { type: "portal_drivers"; drivers: PortalDriverInfo[] }
  | { type: "portal_session_created"; sessionId: string }
TypeScript