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(ssh-p3): Explorer + Editor route to sshFs for SSH projects
enes74d604b01923
diff --git a/src/renderer/components/ExplorerPanel.tsx b/src/renderer/components/ExplorerPanel.tsxindex 9fc0b8576..5a40ff525 100644--- a/src/renderer/components/ExplorerPanel.tsx+++ b/src/renderer/components/ExplorerPanel.tsx@@ -1,7 +1,8 @@-import { useCallback, useEffect, useRef, useState } from 'react'+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'import { createPortal } from 'react-dom'-import type { DirEntry } from '@shared/types'+import type { DirEntry, FsApi } from '@shared/types'import { useProjects } from '../state/projects'+import { sshFs } from '../terminal/ssh-fs'interface ExplorerPanelProps {onClose: () => void@@ -32,6 +33,7 @@ function TreeEntry({entry,path,depth,+ fs,selected,forcedOpen,revealNonce,@@ -42,6 +44,7 @@ function TreeEntry({entry: DirEntrypath: stringdepth: number+ fs: FsApiselected: string | nullforcedOpen: Set<string>revealNonce: number | undefined@@ -59,8 +62,8 @@ function TreeEntry({const expandDir = useCallback(async () => {const next = !opensetOpen(next)- if (next && children === null) setChildren(await window.nodeTerminal.fs.list(path))- }, [open, children, path])+ if (next && children === null) setChildren(await fs.list(path))+ }, [open, children, path, fs])// Reveal: when this directory is force-opened (an ancestor of the reveal target), expand it// ONCE per reveal edge. After the edge, a manual collapse sticks because this effect won't@@ -69,9 +72,9 @@ function TreeEntry({if (!entry.dir || !forcedOpen.has(path)) returnif (revealNonce === lastHonoredRef.current) returnlastHonoredRef.current = revealNonce- if (children === null) void window.nodeTerminal.fs.list(path).then(setChildren)+ if (children === null) void fs.list(path).then(setChildren)setOpen(true)- }, [forcedOpen, path, entry.dir, children, revealNonce])+ }, [forcedOpen, path, entry.dir, children, revealNonce, fs])// Reveal: scroll the selected (target) row into view once it has mounted.useEffect(() => {@@ -118,6 +121,7 @@ function TreeEntry({entry={c}path={`${path}/${c.name}`}depth={depth + 1}+ fs={fs}selected={selected}forcedOpen={forcedOpen}revealNonce={revealNonce}@@ -132,14 +136,23 @@ function TreeEntry({/** Project file explorer — a lazy-loaded tree of the active project's folder.*- * NOTE (Task 6): this Explorer is LOCAL-only. In a remote session the host's root cwd isn't known- * client-side (the local project's `cwd` is the client's), so it can't be pointed at the host- * filesystem yet. Once `canvas:state` carries the host cwd (Task 6), this can switch to- * `remoteFs(connectionId)` (the per-connection `FsApi`) rooted at that path — the Editor already- * proxies over the relay via `data.remote.connectionId`. */+ * SSH projects browse the REMOTE filesystem (rooted at `project.ssh.remoteCwd`, listed via+ * `sshFs(projectId)` over the ControlMaster); local projects use the local fs rooted at `cwd`.+ *+ * NOTE (relay, Task 6): the RELAY path is still local-only — in a relay session the host's root cwd+ * isn't known client-side (the local project's `cwd` is the client's). Once `canvas:state` carries+ * the host cwd, this can also switch to `remoteFs(connectionId)` for relay projects (the Editor+ * already proxies over the relay via `data.remote.connectionId`). */export function ExplorerPanel({ onClose, onOpenFile, reveal }: ExplorerPanelProps) {const project = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId))- const cwd = project?.cwd+ // SSH projects browse the REMOTE filesystem: root at the project's `remoteCwd` and list over the+ // ControlMaster via `sshFs`. Local (and relay) projects keep the local fs rooted at `cwd`.+ const ssh = project?.ssh+ const cwd = ssh ? ssh.remoteCwd : project?.cwd+ const fs = useMemo<FsApi>(+ () => (ssh && project ? sshFs(project.id) : window.nodeTerminal.fs),+ [project?.id, ssh]+ )const [roots, setRoots] = useState<DirEntry[] | null>(null)const [version, setVersion] = useState(0)const [selected, setSelected] = useState<string | null>(null)@@ -147,9 +160,9 @@ export function ExplorerPanel({ onClose, onOpenFile, reveal }: ExplorerPanelPropconst [menu, setMenu] = useState<{ x: number; y: number; path: string } | null>(null)useEffect(() => {- if (cwd) window.nodeTerminal.fs.list(cwd).then(setRoots)+ if (cwd) fs.list(cwd).then(setRoots)else setRoots(null)- }, [cwd, version])+ }, [cwd, version, fs])// Reveal a file: force-open every ancestor directory under cwd, select the file, and// let the matching row scroll itself into view. Only paths inside cwd are revealed.@@ -206,6 +219,7 @@ export function ExplorerPanel({ onClose, onOpenFile, reveal }: ExplorerPanelPropentry={e}path={`${cwd}/${e.name}`}depth={0}+ fs={fs}selected={selected}forcedOpen={forcedOpen}revealNonce={reveal?.nonce}diff --git a/src/renderer/nodes/EditorNode.tsx b/src/renderer/nodes/EditorNode.tsxindex e963bf95b..91a6efcac 100644--- a/src/renderer/nodes/EditorNode.tsx+++ b/src/renderer/nodes/EditorNode.tsx@@ -4,6 +4,8 @@ import { monaco } from '../editor/monaco-setup'import { renderMarkdown } from '../lib/markdown'import { useSettings } from '../state/settings'import { remoteFs } from '../terminal/remote-fs'+import { sshFs } from '../terminal/ssh-fs'+import { useProjects } from '../state/projects'import type { CanvasNode } from '../state/workspace'// Image extensions get a visual preview instead of the Monaco text editor.@@ -37,10 +39,16 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {const [imageDims, setImageDims] = useState('')const [imageError, setImageError] = useState('')const filePath = (data.filePath as string) ?? ''- // In a remote session the node operates on the HOST's filesystem via the relay; otherwise the- // local fs. The `FsApi` shape is identical, so the rest of the component is unchanged.+ // Backend pick (the `FsApi` shape is identical across all three, so the rest of the component is+ // unchanged): a relay session operates on the HOST's filesystem via the relay; an SSH-project+ // editor (`data.sshFs`) on the project's remote fs over the ControlMaster; otherwise the local fs.+ const activeProjectId = useProjects((s) => s.activeProjectId)const connectionId = data.remote?.connectionId- const fs = connectionId ? remoteFs(connectionId) : window.nodeTerminal.fs+ const fs = connectionId+ ? remoteFs(connectionId)+ : data.sshFs && activeProjectId+ ? sshFs(activeProjectId)+ : window.nodeTerminal.fsconst fileName = filePath.split('/').pop() || 'untitled'const ext = fileName.includes('.') ? fileName.split('.').pop()!.toLowerCase() : ''const isImage = ext in IMAGE_MIMEdiff --git a/src/renderer/state/workspace.ts b/src/renderer/state/workspace.tsindex 2a3062765..7dc21accb 100644--- a/src/renderer/state/workspace.ts+++ b/src/renderer/state/workspace.ts@@ -3,6 +3,7 @@ import type { CanvasMutation, CanvasNodeState, NodeKind, Project } from '@sharedimport type { AgentId } from '@shared/agents/config'import { agentConfig } from '@shared/agents/config'import { useSettings } from './settings'+import { useProjects } from './projects'/** Preset color palette — macOS system colors (dark mode). */export const NODE_COLORS = [@@ -70,6 +71,12 @@ export interface NodeData {* (LocalTransport passes `sshRemote` to the PTY), rather than plain `ssh`-on-local-PTY. Persisted.*/sshRemoteTmux?: boolean+ /**+ * editor-only: when true (an editor created in an SSH project), reads/writes/image-previews go to+ * the project's REMOTE filesystem via `sshFs(projectId)` instead of the local fs. Persisted, so an+ * SSH-project editor still routes to the remote fs after reopen.+ */+ sshFs?: boolean[key: string]: unknown}@@ -260,12 +267,20 @@ export function createClaudeNode(return createAgentNode('claude', index, cwd, center)}-/** Creates a code editor node for a file. */+/**+ * Creates a code editor node for a file. When created in an SSH project (the active project has an+ * `ssh` binding), `data.sshFs` is stamped so EditorNode reads/writes over the project's remote fs+ * (`sshFs`) and `filePath` is the remote path — mirroring how `createTerminalNode` stamps+ * `data.sshRemoteTmux`. The SSH binding is read from the projects store (the editor always belongs+ * to the active project), so every open path (Explorer, palette) routes consistently.+ */export function createEditorNode(index: number,filePath: string,center?: { x: number; y: number }): CanvasNode {+ const active = useProjects.getState()+ const isSsh = !!active.getProject(active.activeProjectId)?.sshreturn {id: nextId('editor'),type: 'editor',@@ -277,7 +292,8 @@ export function createEditorNode(title: filePath.split('/').pop() || 'untitled',color: '#6ac4dc',group: null,- filePath+ filePath,+ ...(isSsh ? { sshFs: true } : {})}}}@@ -605,6 +621,7 @@ export function nodeStatesToFlow(states: CanvasNodeState[]): CanvasNode[] {agentId,ssh: n.ssh,sshRemoteTmux: n.sshRemoteTmux,+ sshFs: n.sshFs,worktree: n.worktree}}@@ -659,6 +676,7 @@ export function flowToNodeStates(nodes: CanvasNode[]): CanvasNodeState[] {agentId: n.data.agentId,ssh: n.data.ssh,sshRemoteTmux: n.data.sshRemoteTmux,+ sshFs: n.data.sshFs,worktree: n.data.worktree}})diff --git a/src/shared/types.ts b/src/shared/types.tsindex 9519d91b1..e8013d2b1 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -64,6 +64,8 @@ export interface CanvasNodeState {ssh?: import('./ssh').SshConnection/** When true (SSH-project terminals), the node runs in REMOTE tmux on `ssh` rather than `ssh`-on-local-PTY. */sshRemoteTmux?: boolean+ /** editor-only: when true (SSH-project editors), reads/writes go to the project's remote fs via `sshFs`. */+ sshFs?: boolean// sticky-onlytext?: string// dino-only: best score reached in the T-Rex Runner game.