Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(agents): user-defined custom agents in Settings
enesd2f59559568a
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 713e45da9..228263cfd 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -1094,6 +1094,13 @@ export function Canvas() {onClick: () => addAgentNode(aid, at)})),+ ...useSettings.getState().settings.customAgents.map(+ (c): MenuItem => ({+ label: `New ${c.label}`,+ icon: <IconTerminal />,+ onClick: () => addAgentNode(c.id, at)+ })+ ),{ label: 'New sticky note', icon: <IconNote />, onClick: () => addSticky(at) },{ label: 'Open file…', icon: <IconEditor />, onClick: () => void openFileDialog(at) },{ type: 'separator' },@@ -1402,6 +1409,14 @@ export function Canvas() {run: () => addAgentNode(aid)})),+ ...useSettings.getState().settings.customAgents.map(+ (c): Command => ({+ id: `new-${c.id}`,+ label: `New ${c.label}`,+ icon: <IconTerminal />,+ run: () => addAgentNode(c.id)+ })+ ),{ id: 'new-sticky', label: 'New sticky note', icon: <IconNote />, run: () => addSticky() },{ id: 'open-file', label: 'Open file…', icon: <IconEditor />, run: () => void openFileDialog() },{ id: 'new-project', label: 'New project', icon: <IconProject />, run: () => addProject() },diff --git a/src/renderer/components/Dock.tsx b/src/renderer/components/Dock.tsxindex db7ec8d7c..aced3806f 100644--- a/src/renderer/components/Dock.tsx+++ b/src/renderer/components/Dock.tsx@@ -1,6 +1,7 @@import { useState } from 'react'import claudeIcon from '../assets/claude.svg'import { AGENT_CONFIG, BUILTIN_AGENT_IDS, type AgentId } from '@shared/agents/config'+import { useSettings } from '../state/settings'interface DockProps {dirty: boolean@@ -40,6 +41,7 @@ export function Dock({onZoomOut}: DockProps) {const [menuOpen, setMenuOpen] = useState(false)+ const customAgents = useSettings((s) => s.settings.customAgents)const pick = (fn: () => void) => () => {fn()@@ -63,6 +65,12 @@ export function Dock({<span>{AGENT_CONFIG[aid].label}</span></button>))}+ {customAgents.map((c) => (+ <button key={c.id} onClick={pick(() => onAddAgent(c.id))}>+ <TerminalIcon />+ <span>New {c.label}</span>+ </button>+ ))}<button onClick={pick(onAddSticky)}><NoteIcon /><span>Sticky Note</span>diff --git a/src/renderer/components/SettingsPanel.tsx b/src/renderer/components/SettingsPanel.tsxindex 18fe38e2f..e706f36cd 100644--- a/src/renderer/components/SettingsPanel.tsx+++ b/src/renderer/components/SettingsPanel.tsx@@ -2,6 +2,8 @@ import { useEffect, useState } from 'react'import { createPortal } from 'react-dom'import { useSettings } from '../state/settings'import { NODE_COLORS } from '../state/workspace'+import type { CustomAgent } from '@shared/types'+import type { PromptInjectionMode } from '@shared/agents/config'interface SettingsPanelProps {onClose: () => void@@ -17,6 +19,24 @@ export function SettingsPanel({ onClose }: SettingsPanelProps) {void window.nodeTerminal.updates.getVersion().then(setVersion)}, [])+ const customAgents = settings.customAgents+ const patchAgent = (id: string, patch: Partial<CustomAgent>) =>+ update({ customAgents: customAgents.map((a) => (a.id === id ? { ...a, ...patch } : a)) })+ const removeAgent = (id: string) =>+ update({ customAgents: customAgents.filter((a) => a.id !== id) })+ const addAgent = () =>+ update({+ customAgents: [+ ...customAgents,+ {+ id: 'custom:' + crypto.randomUUID(),+ label: 'Custom agent',+ launchCmd: '',+ promptInjectionMode: 'argv'+ }+ ]+ })+return createPortal(<div className="drawer-overlay" onClick={onClose}><aside className="drawer" onClick={(e) => e.stopPropagation()}>@@ -135,6 +155,57 @@ export function SettingsPanel({ onClose }: SettingsPanelProps) {</label></section>+ <section>+ <h3>Custom agents</h3>+ <p className="set-note">+ Bring your own agent CLI. Custom agents launch in a terminal and show process /+ title status only (no hooks, branch, or loop).+ </p>+ {customAgents.map((agent) => (+ <div key={agent.id} className="set-agent">+ <label className="set-row">+ <span>Label</span>+ <input+ type="text"+ placeholder="e.g. Aider"+ value={agent.label}+ onChange={(e) => patchAgent(agent.id, { label: e.target.value })}+ />+ </label>+ <label className="set-row">+ <span>Launch command</span>+ <input+ type="text"+ placeholder="e.g. aider"+ value={agent.launchCmd}+ onChange={(e) => patchAgent(agent.id, { launchCmd: e.target.value })}+ />+ </label>+ <label className="set-row">+ <span>Prompt injection</span>+ <select+ value={agent.promptInjectionMode}+ onChange={(e) =>+ patchAgent(agent.id, {+ promptInjectionMode: e.target.value as PromptInjectionMode+ })+ }+ >+ <option value="argv">argv</option>+ <option value="flag-prompt">flag-prompt</option>+ <option value="stdin-after-start">stdin-after-start</option>+ </select>+ </label>+ <button className="set-btn" onClick={() => removeAgent(agent.id)}>+ Remove+ </button>+ </div>+ ))}+ <button className="set-btn" onClick={addAgent}>+ Add agent+ </button>+ </section>+<section><h3>Appearance</h3><div className="set-row">diff --git a/src/renderer/state/workspace.ts b/src/renderer/state/workspace.tsindex bf556f8d5..7e4e5b85e 100644--- a/src/renderer/state/workspace.ts+++ b/src/renderer/state/workspace.ts@@ -2,6 +2,7 @@ import type { Node } from '@xyflow/react'import type { CanvasNodeState, NodeKind, Project } from '@shared/types'import type { AgentId } from '@shared/agents/config'import { agentConfig } from '@shared/agents/config'+import { useSettings } from './settings'/** Preset color palette — macOS system colors (dark mode). */export const NODE_COLORS = [@@ -107,11 +108,24 @@ export function claudeLaunchCommand(): string {return bridgeConfigPath ? `claude --mcp-config "${bridgeConfigPath}"` : 'claude'}+/**+ * Resolves an agent's label/color/launch command. Builtins come from the static config;+ * custom agents are looked up by id in the settings store. Falls back to the id itself for+ * unknown agents so a node still spawns something sensible.+ */+function resolveAgent(agentId: AgentId): { label: string; color: string; launchCmd: string } {+ const builtin = agentConfig(agentId)+ if (builtin) return { label: builtin.label, color: builtin.color, launchCmd: builtin.launchCmd }+ const custom = useSettings.getState().settings.customAgents.find((c) => c.id === agentId)+ if (custom) return { label: custom.label, color: '#888888', launchCmd: custom.launchCmd }+ return { label: agentId, color: '#888888', launchCmd: agentId }+}+/*** Creates a terminal node that launches the given agent on open. Title, color, and the- * launch command come from the agent config; the node carries `agentId` so the rest of the- * app (hooks, capabilities, UI) can branch on it. For `claude` we use `claudeLaunchCommand()`- * which appends the Session Bridge `--mcp-config` (Claude-only).+ * launch command come from the resolved agent config (builtin or custom); the node carries+ * `agentId` so the rest of the app (hooks, capabilities, UI) can branch on it. For `claude`+ * we use `claudeLaunchCommand()` which appends the Session Bridge `--mcp-config` (Claude-only).*/export function createAgentNode(agentId: AgentId,@@ -119,10 +133,8 @@ export function createAgentNode(cwd?: string,center?: { x: number; y: number }): CanvasNode {- const cfg = agentConfig(agentId)- const label = cfg?.label ?? agentId- const color = cfg?.color ?? '#888888'- const initialCommand = agentId === 'claude' ? claudeLaunchCommand() : cfg?.launchCmd ?? agentId+ const { label, color, launchCmd } = resolveAgent(agentId)+ const initialCommand = agentId === 'claude' ? claudeLaunchCommand() : launchCmdreturn {id: nextId('term'),type: 'terminal',diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex de7dfd30e..50b1b06c3 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -1694,6 +1694,13 @@ body,font-size: 13px;}+.set-agent {+ border: 1px solid var(--border);+ border-radius: 8px;+ padding: 4px 10px 8px;+ margin: 8px 0;+}+.set-textarea {width: 100%;min-height: 54px;diff --git a/src/shared/types.ts b/src/shared/types.tsindex cf09c6ad3..6b910ce4f 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -1,7 +1,7 @@// Types shared across the main, preload, and renderer processes.import type { NormalizedAgentEvent } from './agents/normalize'-import type { AgentId } from './agents/config'+import type { AgentId, PromptInjectionMode } from './agents/config'export interface PtyCreateOptions {shell?: string@@ -170,6 +170,16 @@ export interface FsApi {write(filePath: string, content: string): Promise<boolean>}+/** A user-defined agent (BYO CLI). In no capability list, so it gets only spawn ++ * terminal-title + process status (no hooks/branch/loop/bridge). */+export interface CustomAgent {+ /** Stable id of the form 'custom:<uuid>'. Used as the node's agentId. */+ id: string+ label: string+ launchCmd: string+ promptInjectionMode: PromptInjectionMode+}+/** User-configurable application settings (settings.json). */export interface Settings {fontSize: number@@ -197,6 +207,8 @@ export interface Settings {notifyOnClaudeDone: boolean/** Whether the one-time notification consent prompt has been shown. */notifyConsentAsked: boolean+ /** User-defined agents (BYO CLI) appended to the Add menus. */+ customAgents: CustomAgent[]}export const DEFAULT_SETTINGS: Settings = {@@ -216,7 +228,8 @@ export const DEFAULT_SETTINGS: Settings = {commitExtraPrompt: '',seenShortcuts: false,notifyOnClaudeDone: true,- notifyConsentAsked: false+ notifyConsentAsked: false,+ customAgents: []}export interface SettingsApi {