Skip to content

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.

feat(canvas-control): rename verb — agents can retitle any node (groups too)

enesb5164f0be31d
diff --git a/src/main/canvas-control-core.test.ts b/src/main/canvas-control-core.test.ts
index 83111dd89..d15882828 100644
--- a/src/main/canvas-control-core.test.ts
+++ b/src/main/canvas-control-core.test.ts
@@ -58,6 +58,16 @@ describe('parseControlRequest', () => {
args: { nodes: 'a', edge: 'left' }
})
})
+ it('rename requires --node and --title, and is not destructive', () => {
+ expect(parseControlRequest('rename', {})).toEqual({ error: 'rename requires --node <id>' })
+ expect(parseControlRequest('rename', { node: 'n1' })).toEqual({ error: 'rename requires --title' })
+ expect(parseControlRequest('rename', { node: 'n1', title: 'Feature Development' })).toEqual({
+ verb: 'rename',
+ args: { node: 'n1', title: 'Feature Development' }
+ })
+ expect(isDestructiveVerb('rename')).toBe(false)
+ })
+
it('spawn-team requires --team and none of the layout verbs are destructive', () => {
expect(parseControlRequest('spawn-team', {})).toEqual({ error: 'spawn-team requires --team <json>' })
expect(parseControlRequest('spawn-team', { team: '[]' })).toEqual({ verb: 'spawn-team', args: { team: '[]' } })
diff --git a/src/main/canvas-control-core.ts b/src/main/canvas-control-core.ts
index 28c2302df..e066118d6 100644
--- a/src/main/canvas-control-core.ts
+++ b/src/main/canvas-control-core.ts
@@ -14,6 +14,7 @@ export type ControlVerb =
| 'arrange'
| 'align'
| 'spawn-team'
+ | 'rename'
| 'write'
| 'close'
@@ -34,6 +35,7 @@ const VERBS: ControlVerb[] = [
'arrange',
'align',
'spawn-team',
+ 'rename',
'write',
'close'
]
@@ -65,6 +67,8 @@ export function parseControlRequest(
if (v === 'align' && !args.nodes) return { error: 'align requires --nodes <id,id>' }
if (v === 'align' && !args.edge) return { error: 'align requires --edge' }
if (v === 'spawn-team' && !args.team) return { error: 'spawn-team requires --team <json>' }
+ if (v === 'rename' && !args.node) return { error: 'rename requires --node <id>' }
+ if (v === 'rename' && !args.title) return { error: 'rename requires --title' }
return { verb: v, args }
}
@@ -106,7 +110,7 @@ var args = {}
for (var i = 1; i < argv.length; i++) {
if (argv[i].slice(0, 2) === '--') { args[argv[i].slice(2)] = argv[i + 1] || ''; i++ }
else if (!args.path && (verb === 'show-image' || verb === 'show-video')) { args.path = argv[i] }
- else if (!args.node && (verb === 'write' || verb === 'close')) { args.node = argv[i] }
+ else if (!args.node && (verb === 'write' || verb === 'close' || verb === 'rename')) { args.node = argv[i] }
}
var ep = endpoint()
diff --git a/src/main/canvas-control.ts b/src/main/canvas-control.ts
index a5455061a..0dc00da4f 100644
--- a/src/main/canvas-control.ts
+++ b/src/main/canvas-control.ts
@@ -68,6 +68,7 @@ Verbs:
- \`spawn-team --label "Frontend Team" --team '[{"title":"UI","prompt":"...","agent":"claude"}]'\` —
open one agent per role (each prompt starts that member working), arrange them in a grid,
wrap them in a labeled group, and connect each to you. Max 8 roles per call.
+- \`rename --node <id> --title "New Name"\` — rename any node (terminals, groups, stickies…).
- \`write --node <id> --text "..."\` — type text into a terminal node. (Asks the user to confirm.)
- \`close --node <id>\` — close a node. (Asks the user to confirm.)
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 50d612ffc..68acffbed 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -2818,6 +2818,27 @@ export function Canvas() {
})
return
}
+ case 'rename': {
+ const id = args.node ?? ''
+ const title = (args.title ?? '').trim()
+ const target = nodesRef.current.find((nd) => nd.id === id)
+ if (!target) {
+ reply({ ok: false, error: `rename: no node with id ${id}` })
+ return
+ }
+ // Same semantics as renameSession: an explicit rename takes ownership of the
+ // name (titleAuto off) and mirrors it into a rename-capable agent's session.
+ setNodes((ns) =>
+ ns.map((nd) => (nd.id === id ? { ...nd, data: { ...nd.data, title, titleAuto: false } } : nd))
+ )
+ markDirty()
+ const agentId = target.data.agentId as AgentId | undefined
+ if (agentId && canRename(agentId)) {
+ void window.nodeTerminal.pty.sendText(id, `/rename ${title}`)
+ }
+ reply({ ok: true, message: `renamed ${id} to "${title}"` })
+ return
+ }
case 'write': {
if (!args.node) {
reply({ ok: false, error: 'write requires --node' })
@@ -3265,15 +3286,8 @@ export function Canvas() {
const folder = await window.nodeTerminal.dialog.selectFolder()
if (!folder) return
commitActiveToStore()
- // A folder maps to one project: reuse the existing one (with its nodes) if present.
- const existing = useProjects.getState().projects.find((p) => p.cwd === folder)
- if (existing) {
- useProjects.getState().setActive(existing.id)
- } else {
- const name = folder.split('/').filter(Boolean).pop() || 'Project'
- const project = useProjects.getState().addProject(name, folder)
- useProjects.getState().setActive(project.id)
- }
+ // A folder maps to one project: reuse (and reopen, if closed) the existing one, or create.
+ useProjects.getState().openFolderProject(folder)
void writeDisk()
}, [commitActiveToStore, writeDisk])