Skip to content

fix(web): terminal OSC 52 copies reach the client clipboard - #1790

Merged
donjor merged 1 commit into
hyprwsfrom
t3/terminal-osc52-clipboard
Oct 20, 2026
Merged

donjor merged 1 commit into
hyprwsfrom
t3/terminal-osc52-clipboard

Conversation

@donjor-agent

@donjor-agent donjor-agent Bot commented Oct 20, 2026

Copy link
Copy Markdown

🤖 claude/anthropic claude-opus-5-5 (high)

Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode y both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

  • Live OSC 52 writes from a terminal land in the focused client's clipboard
  • Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

Change

osc52Clipboard.fork.ts scans live terminal output for OSC 52 and calls navigator.clipboard.writeText.

  • Terminators: BEL and ST
  • Split chunks: buffered, 1 MiB cap
  • Reset replay: clears state, never copies
  • ? read query: ignored, never answered
  • Shared sessions: focused viewer only

ThreadTerminalDrawer.tsx gains two zmux-estate/osc52-clipboard fork-hook lines.
Retire when upstream pingdotgg/t3code#8361 lands.

Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

Verification

Dev app in the T3 Browser panel, a throwaway tmux server with set-clipboard on, and a spy on navigator.clipboard.writeText.

Before (hook reverted): copy-mode selection, then y: no clipboard write.

before: copy-mode selection, no clipboard write

After: copy-mode selection, then y: writeText("yanked-from-tmux-copy-mode") resolves.

after: copy-mode selection copied

The clipboard is not visible on screen; the spy output is the proof.

  • Direct printf OSC 52: copied
  • tmux copy-mode y: copied
  • tmux mouse drag-select: copied
  • Drag without focus: write refused, swallowed
  • Hook reverted, same y: no write
  • vp test run osc52 test → exit 0
  • vp run typecheck (apps/web) → exit 0
  • vp run fork:ci → exit 0
  • Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes

@rsi-pr-agent

rsi-pr-agent Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🧩 Effect Service Conventions 0c3fb15 ✅ clear

No findings.

🕐 20 Oct 00:23 UTC ⏱️ <1 min 🤖 gpt-6.1-sol 🪙 42.2K

⚠️ Not verified: Static diff review only; tests and typecheck not rerun.

Details
Head Result Time Check
0c3fb15 ✅ clear <1 min run
e3d4d83 ✅ clear <1 min run

@rsi-pr-agent

rsi-pr-agent Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🧩 UI Consistency 0c3fb15 ✅ clear

No findings.

🕐 20 Oct 00:24 UTC ⏱️ <1 min 🤖 gpt-6.1-sol 🪙 33K

Details
Head Result Time Check
0c3fb15 ✅ clear <1 min run
e3d4d83 ✅ clear <1 min run

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
@donjor
donjor force-pushed the t3/terminal-osc52-clipboard branch from e3d4d83 to 0c3fb15 Compare October 20, 2026 00:22
@donjor
donjor merged commit a850018 into hyprws Oct 20, 2026
12 checks passed
@donjor
donjor deleted the t3/terminal-osc52-clipboard branch October 20, 2026 00:35
donjor added a commit that referenced this pull request Oct 20, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
donjor added a commit that referenced this pull request Oct 20, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
donjor added a commit that referenced this pull request Oct 20, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
donjor added a commit that referenced this pull request Oct 20, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
donjor added a commit that referenced this pull request Oct 20, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
donjor added a commit that referenced this pull request Oct 21, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
donjor added a commit that referenced this pull request Oct 21, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
donjor added a commit that referenced this pull request Oct 21, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
donjor added a commit that referenced this pull request Oct 21, 2026
## Problem

Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.

Closes #1789

- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply

## Change

`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.

- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only

`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.

## Scope and approval

Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.

## Verification

Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.

**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

![before: copy-mode selection, no clipboard write](https://github.com/user-attachments/assets/b4e7906b-b4e6-46b6-8990-cd642b2d0acd)

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

![after: copy-mode selection copied](https://github.com/user-attachments/assets/fec9eaac-7216-4d91-8503-7f40a3adf763)

The clipboard is not visible on screen; the spy output is the proof.

- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback

The Browser panel has its own clipboard, so the desktop clipboard was not read back.

Claude Opus 5.5 via Claude Code in T3 Code.

## Fork trailers

Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <38745786+donjor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal copy via OSC 52 never reaches the client clipboard [📡#305]

1 participant