Skip to content

fix: Enable clipboard copy/paste in dashboard terminals - #44

Merged
waleedkadous merged 3 commits into
mainfrom
fix-clipboard-issue-42
Dec 5, 2025
Merged

waleedkadous merged 3 commits into
mainfrom
fix-clipboard-issue-42

Conversation

@waleedkadous

Copy link
Copy Markdown
Contributor

Summary

Fixes GitHub issue #42: Cannot cut and paste from terminals.

Root cause: ttyd terminals embedded in iframes lacked clipboard permissions. The browser's Permissions Policy blocks clipboard access for cross-origin iframes by default.

Changes

1. Dashboard templates - Added clipboard permissions to iframes

  • codev/templates/dashboard-split.html (lines 784, 898)
  • codev/templates/dashboard.html (lines 91, 122)
  • codev-skeleton/templates/dashboard-split.html (lines 784, 898)
  • codev-skeleton/templates/dashboard.html (lines 91, 122)

2. ttyd configurations - Added rightClickSelectsWord=true

  • agent-farm/src/commands/start.ts:120
  • agent-farm/src/commands/util.ts:95
  • agent-farm/src/commands/spawn.ts:254,301,616
  • agent-farm/src/servers/dashboard-server.ts:346

3. Regression tests

Added agent-farm/src/__tests__/clipboard.test.ts with 9 tests:

  • 4 tests verify all dashboard HTML templates have clipboard permissions
  • 5 tests verify all ttyd spawn locations include rightClickSelectsWord

Test plan

  • All 44 unit tests pass (35 existing + 9 new)
  • TypeScript compiles without errors
  • Manual testing: verify Cmd+C/Cmd+V works in dashboard terminals

Resolves: #42

Fixes GitHub issue #42.

Root cause: ttyd terminals embedded in iframes lacked clipboard permissions.

Changes:
1. Add allow="clipboard-read; clipboard-write" to all iframe elements in
   the dashboard templates to grant clipboard access via Permissions Policy
2. Add rightClickSelectsWord=true option to ttyd for better UX - this is
   standard behavior in macOS applications

Files changed:
- codev/templates/dashboard-split.html (iframe permissions)
- codev-skeleton/templates/dashboard-split.html (iframe permissions)
- agent-farm/src/commands/start.ts (ttyd option)
- agent-farm/src/commands/util.ts (ttyd option)
- agent-farm/src/servers/dashboard-server.ts (ttyd option)

Resolves: #42
- Add clipboard permissions to non-split dashboard.html (codev + skeleton)
- Add rightClickSelectsWord to spawn.ts builder/shell/worktree functions

Addresses review feedback on PR #43
- Test that all dashboard HTML templates include clipboard permissions
- Test that all ttyd spawn locations include rightClickSelectsWord
- Prevents regression of issue #42 fix

9 new tests added, all passing (44 total)
@waleedkadous

Copy link
Copy Markdown
Contributor Author

3-Way Review Synthesis (Claude + Codex + Gemini)

Verdict: ✅ APPROVE

All three reviewers approve this PR.

What's good:

  • Correct use of allow="clipboard-read; clipboard-write" for iframe permissions
  • rightClickSelectsWord=true added to all ttyd spawn locations
  • Comprehensive test coverage in clipboard.test.ts
  • Both codev/ and codev-skeleton/ templates updated
  • All spawn.ts locations covered (builder, shell, worktree)

Recommendation before merge:
Complete manual testing to verify clipboard operations work in real browsers:

  1. Start dashboard: ./codev/bin/agent-farm start
  2. Test Cmd+C/Cmd+V in terminals
  3. Test right-click word selection
  4. Verify in both architect and builder terminals

Ready to merge once manual testing confirms functionality.


🤖 Synthesized from Claude Code, Codex, and Gemini reviews

@waleedkadous
waleedkadous merged commit b6dc841 into main Dec 5, 2025
@waleedkadous
waleedkadous deleted the fix-clipboard-issue-42 branch January 8, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot cut and paste from terminals

1 participant