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(canvas): WebNode (webview) for URLs + local html; enable webviewTag
enesc3c313a2308e
diff --git a/src/main/index.ts b/src/main/index.tsindex 3d1cd4951..155ca3060 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -125,7 +125,10 @@ function createWindow(): BrowserWindow {preload: join(__dirname, '../preload/index.js'),contextIsolation: true,nodeIntegration: false,- sandbox: false+ sandbox: false,+ // Enables the <webview> tag used by WebNode (embedded content stays locked down —+ // no nodeintegration is set on the webview element itself).+ webviewTag: true}})diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex ff6552bf7..c752857d4 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -22,6 +22,7 @@ import { EditorNode } from '../nodes/EditorNode'import { DiffNode } from '../nodes/DiffNode'import { DinoNode } from '../nodes/DinoNode'import VideoNode from '../nodes/VideoNode'+import WebNode from '../nodes/WebNode'import { withNodeBoundary } from '../components/NodeBoundary'import { Dock } from '../components/Dock'import { TabBar } from '../components/TabBar'@@ -113,6 +114,7 @@ import {createStickyNode,createTerminalNode,createVideoNode,+ createWebNode,isVideoFile,duplicateNode,flowToNodeStates,@@ -251,7 +253,8 @@ export function Canvas() {subagent: withNodeBoundary(SubagentNode),loop: withNodeBoundary(LoopNode),dino: withNodeBoundary(DinoNode),- video: withNodeBoundary(VideoNode)+ video: withNodeBoundary(VideoNode),+ web: withNodeBoundary(WebNode)}),[])@@ -1077,6 +1080,17 @@ export function Canvas() {[setNodes, markDirty, viewCenter])+ const addWebView = useCallback(+ (center?: { x: number; y: number }) => {+ const input = window.prompt('Open web view — enter a URL:')+ const url = input?.trim()+ if (!url) return+ setNodes((ns) => [...ns, createWebNode(ns.length, { url }, center ?? viewCenter())])+ markDirty()+ },+ [setNodes, markDirty, viewCenter]+ )+const addAgentNode = useCallback((agentId: AgentId, center?: { x: number; y: number }, groupId?: string) => {const project = useProjects.getState().getProject(activeProjectId)@@ -2435,6 +2449,7 @@ export function Canvas() {{ id: 'new-sticky', label: 'New sticky note', icon: <IconNote />, run: () => addSticky() },{ id: 'new-dino', label: 'New dino game', icon: <IconDino />, run: () => addDino() },{ id: 'open-file', label: 'Open file…', icon: <IconEditor />, run: () => void openFileDialog() },+ { id: 'open-web', label: 'Open web view…', icon: <IconRemote />, run: () => addWebView() },...useSshServers.getState().servers.map((srv): Command => ({id: `new-remote-${srv.id}`,@@ -2506,6 +2521,7 @@ export function Canvas() {addAgentNode,addSticky,addDino,+ addWebView,openFileDialog,addProject,fitView,diff --git a/src/renderer/electron-webview.d.ts b/src/renderer/electron-webview.d.tsnew file mode 100644index 000000000..4877eefd5--- /dev/null+++ b/src/renderer/electron-webview.d.ts@@ -0,0 +1,15 @@+// Ambient declaration for Electron's `<webview>` tag so TSX recognizes it as an intrinsic+// element. Kept minimal (just `src`); the tag is deliberately used without `nodeintegration`+// so the embedded content stays sandboxed.+import type React from 'react'++declare global {+ namespace JSX {+ interface IntrinsicElements {+ webview: React.DetailedHTMLProps<+ React.HTMLAttributes<HTMLElement> & { src?: string },+ HTMLElement+ >+ }+ }+}diff --git a/src/renderer/nodes/WebNode.tsx b/src/renderer/nodes/WebNode.tsxnew file mode 100644index 000000000..bf7f9c0f0--- /dev/null+++ b/src/renderer/nodes/WebNode.tsx@@ -0,0 +1,80 @@+import { useEffect, useState } from 'react'+import { NodeResizer, useReactFlow, type NodeProps } from '@xyflow/react'+import type { CanvasNode } from '../state/workspace'++/**+ * A web view node. When `data.url` is set it loads that live URL; otherwise it serves the+ * local html at `data.filePath` over the `nt-media://` protocol (allowlisted on mount via+ * `media.allow`). Rendered in an Electron `<webview>` kept locked down (no `nodeintegration`).+ * The frame/header mirror {@link VideoNode}/EditorNode for consistent drag/resize/close behavior.+ */+export default function WebNode({ id, data, selected }: NodeProps<CanvasNode>) {+ const { deleteElements } = useReactFlow()+ const [src, setSrc] = useState('')+ const [error, setError] = useState('')+ const url = (data.url as string) ?? ''+ const filePath = (data.filePath as string) ?? ''+ const title = (data.title as string) || url || filePath.split('/').pop() || 'web'++ useEffect(() => {+ let alive = true+ if (url) {+ setSrc(url)+ } else if (filePath) {+ window.nodeTerminal.media+ .allow(filePath)+ .then((mediaUrl) => {+ if (alive) setSrc(mediaUrl)+ })+ .catch(() => {+ if (alive) setError('Couldn’t load this page.')+ })+ }+ return () => {+ alive = false+ }+ }, [url, filePath])++ return (+ <div+ className={`term-node web-node${selected ? ' selected' : ''}`}+ style={{ borderTopColor: data.color }}+ >+ <NodeResizer minWidth={320} minHeight={200} isVisible={selected} color={data.color} />++ <div className="term-node__header">+ <span className="term-node__title-text" title={url || filePath}>+ {title}+ </span>+ <span className="term-node__spacer" />+ {url && (+ <button+ className="term-node__close"+ title="Open in browser"+ onClick={() => window.nodeTerminal.shell.openExternal(url)}+ >+ ↗+ </button>+ )}+ <button+ className="term-node__close"+ title="Close"+ onClick={() => deleteElements({ nodes: [{ id }] })}+ >+ ×+ </button>+ </div>++ <div className="editor-node__body">+ <div className="editor-node__image nodrag nowheel">+ {src ? (+ // eslint-disable-next-line react/no-unknown-property+ <webview src={src} style={{ width: '100%', height: '100%' }} />+ ) : (+ <span className="editor-node__loading">{error || 'No source'}</span>+ )}+ </div>+ </div>+ </div>+ )+}