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): route git() + commit-message over the master for SSH projects
enes6f9a7855b862
diff --git a/src/main/commit-message.ts b/src/main/commit-message.tsindex 9bcc68032..dcc816042 100644--- a/src/main/commit-message.ts+++ b/src/main/commit-message.ts@@ -3,6 +3,7 @@ import fs from 'fs'import os from 'os'import { promisify } from 'util'import type { GitResult, Settings } from '../shared/types'+import { resolveGitRemote, runRemoteGit } from './remote-ssh/remote-git'const run = promisify(execFile)@@ -45,6 +46,13 @@ function resolveBinary(name: string): string | null {}async function git(cwd: string, args: string[]): Promise<string> {+ // SSH projects read the staged diff over the project's ControlMaster (the agent spawn stays+ // local). Local path is untouched when no remote owns this cwd.+ const ref = resolveGitRemote(cwd)+ if (ref) {+ const r = await runRemoteGit(ref, cwd, args, 50 * 1024 * 1024)+ return r.ok ? r.out : ''+ }try {const { stdout } = await run('git', args, { cwd, maxBuffer: 50 * 1024 * 1024 })return stdoutdiff --git a/src/main/git-service.ts b/src/main/git-service.tsindex 7558b7186..4d51f1281 100644--- a/src/main/git-service.ts+++ b/src/main/git-service.ts@@ -9,6 +9,7 @@ import type { GitFileChange, GitResult, GitStatus } from '../shared/types'import { loadGitHistoryFromExecutor } from '../shared/git-history'import * as worktreeOps from '../shared/worktree-ops'import type { GitHistoryOptions, GitHistoryResult } from '../shared/git-history'+import { resolveGitRemote, runRemoteGit } from './remote-ssh/remote-git'const run = promisify(execFile)@@ -63,6 +64,14 @@ interface Exec {}async function git(cwd: string, args: string[]): Promise<Exec> {+ // SSH projects route every pure-git op over the project's ControlMaster. runRemoteGit returns+ // the same { ok, out, err } shape, so the rest of GitService is transport-agnostic. Local path+ // (and gh ops) are untouched when no remote owns this cwd.+ const ref = resolveGitRemote(cwd)+ if (ref) {+ const r = await runRemoteGit(ref, cwd, args, 20 * 1024 * 1024)+ return { ok: r.ok, out: r.out, err: r.err }+ }try {const { stdout } = await run('git', args, { cwd, env: GIT_ENV, maxBuffer: 20 * 1024 * 1024 })return { ok: true, out: stdout.replace(/\n$/, ''), err: '' }diff --git a/src/main/index.ts b/src/main/index.tsindex 401f2d59a..bb1e3f04c 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -37,6 +37,7 @@ import { initLicense } from './license'import { initRemoteHost } from './remote/host-service'import { initRemoteClient } from './remote/client-service'import { initSshProject } from './remote-ssh/ssh-project'+import { setGitRemoteResolver } from './remote-ssh/remote-git'import { SshFs } from './ssh-fs'// Dev-only: NT_MULTI lets a SECOND instance run (host + client testing on one machine) with an@@ -533,6 +534,9 @@ app.whenReady().then(async () => {initRemoteHost(win, ptyManager)initRemoteClient(win, { isPackaged: app.isPackaged })sshProjectManager = initSshProject(win)+ // Route git-service + commit-message git ops over the project's master when the cwd belongs to a+ // connected SSH project; returns undefined for local cwds so the local path is byte-identical.+ setGitRemoteResolver((cwd) => sshProjectManager?.refForRemoteCwd(cwd))app.on('activate', () => {if (BrowserWindow.getAllWindows().length === 0) createWindow()diff --git a/src/main/remote-ssh/ssh-project.ts b/src/main/remote-ssh/ssh-project.tsindex df7217a32..8c5c52620 100644--- a/src/main/remote-ssh/ssh-project.ts+++ b/src/main/remote-ssh/ssh-project.ts@@ -279,8 +279,8 @@ export function initSshProject(win: BrowserWindow): SshProjectManager {if (!win.isDestroyed()) win.webContents.send(IPC.sshProjectStatus, e)}})- ipcMain.handle(IPC.sshConnectProject, (_e, projectId: string, conn: SshConnection) =>- mgr.connect(projectId, conn)+ ipcMain.handle(IPC.sshConnectProject, (_e, projectId: string, conn: SshConnection, remoteCwd?: string) =>+ mgr.connect(projectId, conn, remoteCwd))ipcMain.handle(IPC.sshDisconnectProject, (_e, projectId: string) => mgr.disconnect(projectId))ipcMain.handle(IPC.sshKillSessions, (_e, projectId: string, nodeIds: string[]) =>diff --git a/src/preload/index.ts b/src/preload/index.tsindex b9186c219..ceff5766d 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -85,7 +85,8 @@ const api: NodeTerminalApi = {importCandidates: () => ipcRenderer.invoke(IPC.sshImport)},sshProject: {- connect: (projectId, conn) => ipcRenderer.invoke(IPC.sshConnectProject, projectId, conn),+ connect: (projectId, conn, remoteCwd) =>+ ipcRenderer.invoke(IPC.sshConnectProject, projectId, conn, remoteCwd),disconnect: (projectId) => ipcRenderer.invoke(IPC.sshDisconnectProject, projectId),killSessions: (projectId, nodeIds) =>ipcRenderer.invoke(IPC.sshKillSessions, projectId, nodeIds),diff --git a/src/shared/types.ts b/src/shared/types.tsindex a34d0a512..348beacb5 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -325,7 +325,8 @@ export interface SshProjectApi {/** Open (or reuse) the ControlMaster for an SSH project; resolves once connected. */connect(projectId: string,- server: import('./ssh').SshConnection+ server: import('./ssh').SshConnection,+ remoteCwd?: string): Promise<{ controlPath: string; hookEndpointPath?: string }>/** Tear down the master (remote tmux is unaffected). */disconnect(projectId: string): Promise<void>