feat: TTY/PTY support for interactive processes (#58) #59
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_tty2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
tty: truespawn with a pseudo-terminal/api/jobs/{id}/ptybridges browser/CLI to the PTY master FDzinit attach <job_id>command with raw mode and Ctrl+P,Ctrl+Q detachDetails
Clean reimplementation of issue #58 on the current job-based architecture (the old
development_ttybranch diverged too far to merge).Phase 1 — PTY Infrastructure:
ActionSpecgainstty: bool(serde default, no DB migration needed)PtyRegistryholds master FDs keyed by job_id, with resize (TIOCSWINSZ) supportrun_job_piped()(original) vsrun_job_with_pty()(openpty + setsid + TIOCSCTTY)Phase 2 — WebSocket endpoint:
GET /api/jobs/{id}/ptyvalidates PTY exists, upgrades to WebSocket{"resize":{"cols":N,"rows":M}})Phase 3 — UI integration:
terminal.jsmodule:openTerminal(jobId)/closeTerminal(jobId)Phase 4 — CLI attach:
zinit attach <job_id>connects WebSocket over Unix socketTest plan
cargo build --workspacecompiles (verified)tty: true, script: "/bin/bash"→ process runs with PTYzinit attach <job_id>enters interactive sessiontty: falsejobs work unchanged🤖 Generated with Claude Code
Implement PTY allocation, WebSocket bridging, UI terminal, and CLI attach so interactive processes (shells, TUI apps) can run under zinit supervision and be attached to live. Key changes: - ActionSpec gains `tty: bool` field (serde default, no migration) - PtyRegistry holds master FDs keyed by job ID with resize support - Executor branches into piped vs PTY spawning paths - WebSocket endpoint at /api/jobs/{id}/pty bridges PTY I/O - zinit_ui proxies WebSocket and renders xterm.js terminal - CLI `zinit attach <job_id>` with raw mode and Ctrl+P,Q detach Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>