Skip to content

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.

feat(browser): browser node kind + factory + serializer

enes8c3df2b56613
diff --git a/src/renderer/state/workspace.browser.test.ts b/src/renderer/state/workspace.browser.test.ts
new file mode 100644
index 000000000..a4b791ecf
--- /dev/null
+++ b/src/renderer/state/workspace.browser.test.ts
@@ -0,0 +1,16 @@
+import { describe, it, expect } from 'vitest'
+import { createBrowserNode, nodeStatesToFlow, flowToNodeStates } from './workspace'
+
+describe('browser node', () => {
+ it('createBrowserNode carries kind browser + url', () => {
+ const n = createBrowserNode(0, 'https://example.com')
+ expect(n.type).toBe('browser')
+ expect(n.data.url).toBe('https://example.com')
+ })
+
+ it('round-trips browser kind + url through both serializers', () => {
+ const round = nodeStatesToFlow(flowToNodeStates([createBrowserNode(0, 'https://a.dev')]))
+ const b = round.find((n) => n.type === 'browser')!
+ expect(b.data.url).toBe('https://a.dev')
+ })
+})
diff --git a/src/renderer/state/workspace.ts b/src/renderer/state/workspace.ts
index 7dccb7d79..161e0c656 100644
--- a/src/renderer/state/workspace.ts
+++ b/src/renderer/state/workspace.ts
@@ -23,6 +23,7 @@ const DIFF_SIZE = { width: 860, height: 500 }
const DINO_SIZE = { width: 600, height: 200 }
const VIDEO_SIZE = { width: 640, height: 420 }
const WEB_SIZE = { width: 720, height: 520 }
+const BROWSER_SIZE = { width: 800, height: 560 }
/** Height of a node when collapsed (header only). */
export const COLLAPSED_HEIGHT = 40
@@ -365,6 +366,29 @@ export function createWebNode(
}
}
+/** Creates a navigable browser node (Electron <webview>) starting at `url` ('' = blank). */
+export function createBrowserNode(
+ index: number,
+ url: string,
+ center?: { x: number; y: number }
+): CanvasNode {
+ const title = url ? url.replace(/^https?:\/\//, '').slice(0, 40) : 'Browser'
+ return {
+ id: nextId('browser'),
+ type: 'browser',
+ position: placeAt(center, index, BROWSER_SIZE.width, BROWSER_SIZE.height),
+ width: BROWSER_SIZE.width,
+ height: BROWSER_SIZE.height,
+ style: { width: BROWSER_SIZE.width, height: BROWSER_SIZE.height },
+ data: {
+ title,
+ color: '#0a84ff',
+ group: null,
+ ...(url ? { url } : {})
+ }
+ }
+}
+
/** Creates a diff editor node for a changed file (relative path + repo cwd). */
export function createDiffNode(
index: number,
@@ -712,11 +736,13 @@ export function flowToNodeStates(nodes: CanvasNode[]): CanvasNodeState[] {
? DIFF_SIZE
: kind === 'video'
? VIDEO_SIZE
- : kind === 'web'
- ? WEB_SIZE
- : kind === 'dino'
- ? DINO_SIZE
- : TERMINAL_SIZE
+ : kind === 'browser'
+ ? BROWSER_SIZE
+ : kind === 'web'
+ ? WEB_SIZE
+ : kind === 'dino'
+ ? DINO_SIZE
+ : TERMINAL_SIZE
return nodes
// Remote terminals are transient to a live relay connection — never persist them (their
// connectionId is dead after a restart, and they'd otherwise reattach to a stray local tmux).
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 9e79d0f27..c060f3640 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -38,7 +38,7 @@ export interface PtyCreateResult {
}
// 'subagent' and 'loop' are render-only (ephemeral hook-driven viz) and never persisted.
-export type NodeKind = 'terminal' | 'sticky' | 'group' | 'editor' | 'diff' | 'video' | 'web' | 'subagent' | 'loop' | 'dino'
+export type NodeKind = 'terminal' | 'sticky' | 'group' | 'editor' | 'diff' | 'video' | 'web' | 'browser' | 'subagent' | 'loop' | 'dino'
/** Persisted state of a single canvas node (terminal, sticky note, group frame, or editor). */
export interface CanvasNodeState {
@@ -324,7 +324,9 @@ export const DEFAULT_SETTINGS: Settings = {
gitAutoFetch: true,
notifyConsentAsked: false,
customAgents: [],
- disabledAgents: [],
+ // New users see only Claude in the Add menus; Codex/Gemini are opt-in (re-enable in Settings).
+ // Existing users keep whatever they've saved (their persisted disabledAgents overrides this).
+ disabledAgents: ['codex', 'gemini'],
defaultAgent: 'claude',
telemetryEnabled: false
}