Skip to content

feat(comparator): rebuild as real terminal workspace with PTY shells#67

Merged
siracusa5 merged 3 commits intomainfrom
feat/comparator-v3.1
Mar 30, 2026
Merged

feat(comparator): rebuild as real terminal workspace with PTY shells#67
siracusa5 merged 3 commits intomainfrom
feat/comparator-v3.1

Conversation

@siracusa5
Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the old comparator (~6,400 lines, 43 files) with a real terminal workspace built on portable-pty + xterm.js
  • Each terminal is a live login shell with the user's zsh config, bidirectional I/O, and responsive CSS Grid layout
  • Invoke dialog launches harnesses in interactive mode for full TUI with live streaming output (matching Auto-Claude/Aperant UX)

Architecture

  • Rust: PTY lifecycle (create/destroy/write/resize), get_cwd, harness detection for claude/agent/copilot/codex
  • React: TerminalPanel (xterm.js), TerminalGrid (responsive CSS Grid), InvokeDialog (harness/model/prompt picker), TerminalToolbar
  • Hook: useTerminals with Tauri event wiring (terminal://output, terminal://exit)
  • Harness definitions: TypeScript command builder (harness-definitions.ts) with verified CLI invocations and shellQuote() utility

Supported harnesses (interactive mode, live streaming)

Harness Command Detection
Claude Code claude 'prompt' --model M claude --version
Cursor Agent agent 'prompt' --model M agent --version
GitHub Copilot copilot -i 'prompt' --model M copilot --version
Codex CLI codex 'prompt' --model M codex --version

Test plan

  • 596 JS tests pass (39 files) including new harness-definitions, useTerminals, InvokeDialog, TerminalGrid, TerminalPanel, TerminalToolbar tests
  • 43 Rust tests pass including serde wire-format contract tests (prevents field name mismatches between Rust events and JS listeners)
  • Visual testing: real zsh prompt renders, keyboard input works, Claude Code streams live TUI output
  • CI validation

🤖 Generated with Claude Code

siracusa5 and others added 3 commits March 30, 2026 12:56
Replace the old comparator (~6,400 lines, 43 files) with a real terminal
workspace built on portable-pty + xterm.js. Each terminal is a live login
shell with the user's zsh config, bidirectional I/O, and responsive grid.

Architecture:
- Rust: PTY lifecycle (create/destroy/write/resize), harness detection
- React: TerminalPanel (xterm.js), TerminalGrid (CSS Grid), InvokeDialog
- Hook: useTerminals with Tauri event wiring (terminal://output, exit)
- Harness defs: TypeScript command builder with verified CLI invocations

Supported harnesses (interactive mode, live streaming TUI):
- Claude Code: claude 'prompt' --model MODEL
- Cursor Agent: agent 'prompt' --model MODEL
- GitHub Copilot: copilot -i 'prompt' --model MODEL
- Codex CLI: codex 'prompt' --model MODEL

Key fixes during development:
- serde camelCase mismatch between Rust events and JS listeners
- Missing get_cwd command for terminal working directory
- Grid rows need explicit 1fr for proper terminal sizing
- Shell quoting moved to TypeScript for testability

Tests: 596 JS tests (39 files), 43 Rust tests including serde
wire-format contract tests to prevent field name mismatches.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Cap rawChunks at 5000 entries to prevent unbounded memory growth (W1)
- Use sessionsRef for createTerminal capacity guard and invokeAll to
  avoid stale closures over sessions state (W3, S2)
- Clean up PTY sessions on hook unmount to prevent orphaned processes (W5)
- Restrict Tauri shell capabilities for agent/copilot/codex to
  --version only instead of arbitrary args (W7)
- Simplify rawChunks effect dependency to just length (W8)
- Add ARIA labels to icon buttons and dialog, htmlFor/id on form fields (S5)
- Add security note on write_terminal trust boundary (C1)
- Fix Copilot invocation: use -i flag for interactive mode (verified from docs)
- Use interactive mode (no -p) for all harnesses — full TUI with live streaming

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@siracusa5 siracusa5 merged commit d97ec24 into main Mar 30, 2026
6 checks passed
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.

1 participant