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.

fix(ssh): advertise OSC 52 clipboard cap on the remote tmux (terminal-overrides Ms) + comment fix (final-review)

enesd6ed24615992
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index 2d07ee011..5a46674f0 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -248,8 +248,9 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasN
// OSC 52 clipboard write: the remote tmux (set-clipboard on) emits OSC 52 on copy; route the
// decoded text to the Mac clipboard. WRITE-ONLY — `parseOsc52` returns null for a `?` read
// query so a remote program can never read the local clipboard. Returning true swallows the
- // sequence (also the read query). Local tmux uses pbcopy → emits no OSC 52, so this is a no-op
- // for local terminals.
+ // sequence (also the read query). This is additive: the local tmux conf also has set-clipboard
+ // on, so local tmux DOES emit OSC 52 and this handler fires too — a harmless redundant write of
+ // the same selection (pbcopy already wrote it), NOT a no-op.
term.parser.registerOscHandler(52, (data) => {
const text = parseOsc52(data)
if (text !== null) window.nodeTerminal.clipboard.writeText(text)
diff --git a/src/shared/ssh.test.ts b/src/shared/ssh.test.ts
index 58f15b2a3..6512ee6f9 100644
--- a/src/shared/ssh.test.ts
+++ b/src/shared/ssh.test.ts
@@ -139,6 +139,10 @@ describe('remoteTmuxConf', () => {
expect(c).toContain('copy-pipe-and-cancel')
expect(c).not.toContain('pbcopy')
})
+ it('advertises the OSC 52 clipboard-set capability via terminal-overrides (Ms)', () => {
+ expect(c).toContain('terminal-overrides')
+ expect(c).toContain('Ms=')
+ })
it('floors history-limit at 1000', () => {
expect(remoteTmuxConf(10)).toContain('set -g history-limit 1000')
expect(remoteTmuxConf(50000)).toContain('set -g history-limit 50000')
diff --git a/src/shared/ssh.ts b/src/shared/ssh.ts
index 85395326b..ef0be543f 100644
--- a/src/shared/ssh.ts
+++ b/src/shared/ssh.ts
@@ -92,6 +92,7 @@ set -sg escape-time 10
set -g destroy-unattached off
setw -g aggressive-resize on
set -g set-clipboard on
+set -ag terminal-overrides ',xterm*:Ms=\\E]52;%p1%s;%p2%s\\007'
bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
bind -T copy-mode DoubleClick1Pane send-keys -X select-word \\; send-keys -X copy-pipe-and-cancel