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): create a new remote folder from the SSH project browser
enes4a206baabe8a
diff --git a/src/main/remote-ssh/control-master.test.ts b/src/main/remote-ssh/control-master.test.tsindex 533d95ff2..1f8a2323b 100644--- a/src/main/remote-ssh/control-master.test.ts+++ b/src/main/remote-ssh/control-master.test.ts@@ -8,6 +8,7 @@ import {remoteCapturePaneArgs,remoteTmuxPtyArgs,listDirArgs,+ mkDirArgs,RMT_TMUX_SOCKET,hookForwardArgs,hookForwardCancelArgs,@@ -17,6 +18,12 @@ import {const conn = { host: 'h.example.com', user: 'deploy', port: 2222, identityFile: '/k/id' }+describe('mkDirArgs', () => {+ it('mkdir -p the quoted remote path, leaving a leading ~ unquoted', () => {+ expect(mkDirArgs(conn, '/s.sock', '~/new dir').join(' ')).toContain(`mkdir -p ~/'new dir'`)+ })+})+describe('controlPathFor', () => {it('returns a SHORT, space-free socket path under ~/.nodeterm/ssh-cm (not the long/spaced userData)', () => {// Regression: macOS userData is `~/Library/Application Support/<app>` — too long for a unixdiff --git a/src/main/remote-ssh/control-master.ts b/src/main/remote-ssh/control-master.tsindex 216bba75b..e99d64a67 100644--- a/src/main/remote-ssh/control-master.ts+++ b/src/main/remote-ssh/control-master.ts@@ -83,6 +83,11 @@ export function listDirArgs(conn: SshConnection, controlPath: string, path: strireturn childArgs(conn, controlPath, `ls -1Ap ${quoteRemotePath(path)}`)}+/** Create a remote directory (and any missing parents). `quoteRemotePath` keeps a leading `~`. */+export function mkDirArgs(conn: SshConnection, controlPath: string, path: string): string[] {+ return childArgs(conn, controlPath, `mkdir -p ${quoteRemotePath(path)}`)+}+/*** Reverse-forward the local hook server's loopback TCP port to a remote unix socket over the* existing master (`ssh -O forward -R <remoteSock>:127.0.0.1:<hookPort>`), so remote hook scriptsdiff --git a/src/main/remote-ssh/ssh-project.ts b/src/main/remote-ssh/ssh-project.tsindex c86f23c37..8ff6741e2 100644--- a/src/main/remote-ssh/ssh-project.ts+++ b/src/main/remote-ssh/ssh-project.ts@@ -9,6 +9,7 @@ import {controlPathFor,masterArgs,listDirArgs,+ mkDirArgs,exitMasterArgs,checkMasterArgs,remoteTmuxKillArgs,@@ -142,6 +143,14 @@ export class SshProjectManager {return { path: dir, dirs: parseLsDirs(stdout) }}+ /** Create a remote directory (mkdir -p). Returns false when not connected or the mkdir fails. */+ async makeDir(projectId: string, dir: string): Promise<boolean> {+ const c = this.conns.get(projectId)+ if (!c) return false+ const { code } = await this.r.run(mkDirArgs(c.conn, c.controlPath, dir))+ return code === 0+ }+/*** Authoritatively end the given nodes' REMOTE tmux sessions over the project's live master.* Called on project delete BEFORE disconnect, so the remote `nt-<id>` sessions are killed@@ -258,5 +267,6 @@ export function initSshProject(win: BrowserWindow): SshProjectManager {mgr.killSessions(projectId, nodeIds))ipcMain.handle(IPC.sshListDir, (_e, projectId: string, dir: string) => mgr.listDir(projectId, dir))+ ipcMain.handle(IPC.sshMkdir, (_e, projectId: string, dir: string) => mgr.makeDir(projectId, dir))return mgr}diff --git a/src/preload/index.ts b/src/preload/index.tsindex b564d3aa2..b9186c219 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -90,6 +90,7 @@ const api: NodeTerminalApi = {killSessions: (projectId, nodeIds) =>ipcRenderer.invoke(IPC.sshKillSessions, projectId, nodeIds),listDir: (projectId, dir) => ipcRenderer.invoke(IPC.sshListDir, projectId, dir),+ mkdir: (projectId, dir) => ipcRenderer.invoke(IPC.sshMkdir, projectId, dir),onStatus: (cb) => {const h = (_e: unknown, e: unknown) => cb(e as never)ipcRenderer.on(IPC.sshProjectStatus, h)diff --git a/src/renderer/components/SshProjectDialog.tsx b/src/renderer/components/SshProjectDialog.tsxindex 0122ea563..0807f0b41 100644--- a/src/renderer/components/SshProjectDialog.tsx+++ b/src/renderer/components/SshProjectDialog.tsx@@ -60,6 +60,10 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDialconst [path, setPath] = useState('~')const [dirs, setDirs] = useState<string[]>([])const [error, setError] = useState('')+ // Inline "new folder" creation in the browse step.+ const [creating, setCreating] = useState(false)+ const [newName, setNewName] = useState('')+ const [mkdirErr, setMkdirErr] = useState('')// Stable id for the temporary browse master, generated once.const browseIdRef = useRef(`ssh-browse-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`)const connectedRef = useRef(false)@@ -94,6 +98,22 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDialsetDirs(res.dirs)}, [])+ // Create a folder under the current path on the remote, then navigate into it.+ const createFolder = useCallback(async () => {+ const name = newName.trim()+ if (!name) return+ setMkdirErr('')+ const full = `${path.replace(/\/+$/, '')}/${name}`+ const ok = await window.nodeTerminal.sshProject.mkdir(browseIdRef.current, full)+ if (!ok) {+ setMkdirErr('Could not create the folder.')+ return+ }+ setCreating(false)+ setNewName('')+ await list(full)+ }, [newName, path, list])+const connect = useCallback(async (srv: SshServer) => {setServer(srv)@@ -230,13 +250,68 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial>↑ Up</button>+ <button+ className="confirm__btn"+ style={{ padding: '3px 9px' }}+ onClick={() => {+ setMkdirErr('')+ setNewName('')+ setCreating(true)+ }}+ >+ + New folder+ </button><spantitle={path}- style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}+ style={{+ flex: 1,+ minWidth: 0,+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap'+ }}>{path}</span></div>+ {creating && (+ <div style={{ display: 'flex', gap: 8, margin: '0 0 8px' }}>+ <input+ autoFocus+ value={newName}+ placeholder="Folder name"+ onChange={(e) => setNewName(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') void createFolder()+ else if (e.key === 'Escape') {+ setCreating(false)+ setNewName('')+ setMkdirErr('')+ }+ }}+ style={{ flex: 1, minWidth: 0 }}+ />+ <button className="confirm__btn primary" style={{ padding: '3px 9px' }} onClick={() => void createFolder()}>+ Create+ </button>+ <button+ className="confirm__btn"+ style={{ padding: '3px 9px' }}+ onClick={() => {+ setCreating(false)+ setNewName('')+ setMkdirErr('')+ }}+ >+ Cancel+ </button>+ </div>+ )}+ {mkdirErr && (+ <p className="confirm__msg" style={{ color: 'var(--danger, #e5534b)', margin: '0 0 8px', fontSize: 12 }}>+ {mkdirErr}+ </p>+ )}<divstyle={{maxHeight: 240,diff --git a/src/shared/ipc.ts b/src/shared/ipc.tsindex 935fee970..d2f4b5a4d 100644--- a/src/shared/ipc.ts+++ b/src/shared/ipc.ts@@ -68,6 +68,7 @@ export const IPC = {sshDisconnectProject: 'ssh:disconnect-project',sshKillSessions: 'ssh:kill-sessions',sshListDir: 'ssh:list-dir',+ sshMkdir: 'ssh:mkdir',sshFsList: 'sshFs:list',sshFsRead: 'sshFs:read',sshFsReadBinary: 'sshFs:read-binary',diff --git a/src/shared/types.ts b/src/shared/types.tsindex e8013d2b1..a34d0a512 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -123,6 +123,12 @@ export interface Project {nodes: CanvasNodeState[]/** Bridge links between Claude nodes (optional; absent in pre-bridge files). */bridges?: BridgeLink[]+ /**+ * Closed projects are hidden from the tab bar but kept on disk with all their nodes (and their+ * tmux sessions left running) so they can be reopened from the start screen's "Recently closed"+ * list. Absent/false = an open tab. A closed project never becomes `activeProjectId`.+ */+ closed?: boolean}/** The full workspace written to / read from disk. */@@ -332,6 +338,8 @@ export interface SshProjectApi {killSessions(projectId: string, nodeIds: string[]): Promise<void>/** List remote sub-directories of `path` (default ~). */listDir(projectId: string, path: string): Promise<{ path: string; dirs: string[] }>+ /** Create a remote directory (mkdir -p). Resolves false when not connected or the mkdir fails. */+ mkdir(projectId: string, path: string): Promise<boolean>onStatus(cb: (e: { projectId: string; status: SshProjectStatus; error?: string }) => void): () => void}