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-p4): Source Control + Diff nodes operate on the remote repo for SSH projects
enes09abf6514af7
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 4c2f9533f..a11fd9c43 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -505,7 +505,7 @@ export function Canvas() {// switch back to a connected project is a no-op. Remote tmux is unaffected by the master.if (project.ssh) {window.nodeTerminal.sshProject- .connect(project.id, project.ssh.server)+ .connect(project.id, project.ssh.server, project.ssh.remoteCwd).then(({ controlPath, hookEndpointPath }) =>useSshConn.getState().setConn(project.id, { controlPath, hookEndpointPath }))@@ -977,7 +977,10 @@ export function Canvas() {/** Open a git diff editor node for a changed file (from Source Control). */const openDiff = useCallback((relPath: string, staged: boolean) => {- const cwd = useProjects.getState().getProject(activeProjectId)?.cwd+ const project = useProjects.getState().getProject(activeProjectId)+ // SSH project: the diff node operates on the remote repo, so its cwd must be the exact+ // remoteCwd (the git remote registry matches by exact string; same value passed to connect).+ const cwd = project?.ssh?.remoteCwd ?? project?.cwdif (!cwd) returnsetNodes((ns) => [...ns, createDiffNode(ns.length, cwd, relPath, staged, viewCenter())])markDirty()@@ -988,7 +991,8 @@ export function Canvas() {/** Open a parent↔commit diff node for a file from the history graph. */const openCommitDiff = useCallback((relPath: string, commitOid: string) => {- const cwd = useProjects.getState().getProject(activeProjectId)?.cwd+ const project = useProjects.getState().getProject(activeProjectId)+ const cwd = project?.ssh?.remoteCwd ?? project?.cwdif (!cwd) returnsetNodes((ns) => [...ns, createDiffNode(ns.length, cwd, relPath, false, viewCenter(), commitOid)])markDirty()diff --git a/src/renderer/components/SourceControlPanel.tsx b/src/renderer/components/SourceControlPanel.tsxindex 4340857e5..12ffa5e8b 100644--- a/src/renderer/components/SourceControlPanel.tsx+++ b/src/renderer/components/SourceControlPanel.tsx@@ -44,7 +44,11 @@ export function SourceControlPanel({onExplainCommit}: SourceControlPanelProps) {const project = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId))- const cwd = project?.cwd+ // SSH project: git ops run on the remote repo over the master, so the cwd is the project's+ // exact remoteCwd (the remote-git registry matches by exact string — must not be transformed).+ // Local projects are byte-identical (the SSH branch fires only when `project.ssh` is set).+ const isSsh = !!project?.ssh+ const cwd = project?.ssh?.remoteCwd ?? project?.cwdconst [status, setStatus] = useState<GitStatus | null>(null)// Commit message + AI-generate state live in a per-repo store (keyed by cwd), so closing the// panel mid-generation neither discards the message nor abandons the run — reopening shows it.@@ -188,7 +192,11 @@ export function SourceControlPanel({*/const renderRemoteAction = () => {if (!status) return null+ // gh-based "Publish to GitHub" is local-only: gh isn't bridged over the SSH master yet, so+ // SSH projects hide it (a future follow-up could detect remote gh). Plain git push/pull/sync+ // below still route remotely via the chokepoint.if (!status.hasRemote) {+ if (isSsh) return nullreturn (<buttonclassName="scm-sync"diff --git a/src/renderer/nodes/DiffNode.tsx b/src/renderer/nodes/DiffNode.tsxindex acdb57e8f..8e4dc2ca8 100644--- a/src/renderer/nodes/DiffNode.tsx+++ b/src/renderer/nodes/DiffNode.tsx@@ -2,6 +2,8 @@ import { useEffect, useRef } from 'react'import { NodeResizer, useReactFlow, type NodeProps } from '@xyflow/react'import { monaco } from '../editor/monaco-setup'import { useSettings } from '../state/settings'+import { useProjects } from '../state/projects'+import { sshFs } from '../terminal/ssh-fs'import type { CanvasNode } from '../state/workspace'/**@@ -26,6 +28,14 @@ export function DiffNode({ id, data, selected }: NodeProps<CanvasNode>) {const git = window.nodeTerminal.gitconst abs = `${cwd}/${rel}`+ // SSH project: `git.showFile` already routes remotely (Task 2 chokepoint), but the working-tree+ // side is a raw fs read — for an SSH project (active project has `ssh`) read it over the master+ // via sshFs (the node's cwd is already the remoteCwd). Local projects use the local fs unchanged.+ const projState = useProjects.getState()+ const sshProjectId = projState.getProject(projState.activeProjectId)?.ssh+ ? projState.activeProjectId+ : null+ const workingFs = sshProjectId ? sshFs(sshProjectId) : window.nodeTerminal.fs// commit mode: parent (<oid>^) vs commit (<oid>). staged: HEAD vs index. unstaged: index vs working.const origP = commitOid? git.showFile(cwd, `${commitOid}^`, rel)@@ -36,7 +46,7 @@ export function DiffNode({ id, data, selected }: NodeProps<CanvasNode>) {? git.showFile(cwd, commitOid, rel): staged? git.showFile(cwd, '', rel)- : window.nodeTerminal.fs.read(abs)+ : workingFs.read(abs)Promise.all([origP, modP]).then(([orig, mod]) => {if (disposed) return