[OneDev #11] research: interactive terminal driver app — TUI controller for scripted/automated shell workflows #18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from OneDev issue #11 (id 35277)
Original project: internal-joseph
Original state: Open
Original submitterId: 5
Original submitDate: 2026-04-10T16:44:10.771+00:00
Original lastActivity: {'date': '2026-04-24T21:24:45.415+00:00', 'description': 'commented', 'userId': 5}
Original fields:
Idea
A TUI-first app that drives terminal sessions interactively — think a structured interface layered over a pty that lets you compose, inspect, and replay shell interactions. Could serve as an interactive front-end for automation scripts, command sequences, or remote session control with human-in-the-loop override capability.
Why
Pure automation is brittle; pure interactive is slow. A driver layer gives you the best of both — run scripted sequences but pause, inspect, and intervene at any step. Potentially useful for client onboarding scripts, diagnostic runbooks, or guided multi-step ops.
Open questions
Imported from OneDev comment id 243 on issue #11
Original userId: 5
Original date: 2026-04-10T17:35:16.422+00:00
Research findings — interactive terminal driver / TUI controller
Landscape: key tools and trade-offs
Classic automation:
interact()(hands control to human mid-script) andautoexpect(records a session, emits a script). No Windows.SpawnSSH,SpawnSSHPTY) — relevant to the PCT SSH-first model. No TUI layer, no Windows ConPTY. Last significant update 2020.ActiveState/termtest/conpty. Best for automated testing rather than presenting a TUI.Session recording/replay:
.castJSON. Replay only, no pause-and-intervene.tmux scripting:
runme.dev — Markdown-as-runbook tool. Code blocks become executable steps with a TUI and CLI. No human-in-the-loop override mid-step, no Windows ConPTY. Worth cribbing the runbook schema from.
Human-in-the-loop patterns
Three patterns exist in the wild:
a.
interact()escape hatch (pexpect/Expect) — automation runs, then at a decision point the library hands stdin/stdout to the human. Human types, presses a hotkey to return control. Simple on Linux, not portable to Windows, no visual chrome.b. Approval-gate at step boundary — each step is discrete; script pauses between steps for human confirmation. This is the current Station wizard model. Works well and is Windows-compatible because no pty is needed — just waits for Enter.
c. Tmux pane capture + AI read-react loop — AI reads pane, decides what to send, human can intervene by physically typing. Not formally structured — no "pause requested" signal, just race conditions.
The gap: no structured, cross-platform tool exists that defines a runbook with named breakpoints, presents the human with context ("step 3 is about to run
Set-ExecutionPolicy; approve?"), captures human edits to parameters, then resumes automation. That's the opportunity.Go ecosystem options (Station is Go + Bubbletea)
tea.ExecProcess(Bubbletea built-in) — pauses the TUI, hands control to a subprocess. Loses the TUI panel while subprocess runs. Also documented as broken in Wish SSH sessions (issue #196). Not useful for showing live output alongside step controls.taigrr/bubbleterm— embeddable terminal emulator Bubbletea component. Parses ANSI, maintains screen state, renders inside a Bubbletea viewport via pipes. This is the key component for embedding live pty output inside a TUI layout — right pane shows subprocess output, left pane shows step controls. Integrates with creack/pty. Maturity needs validation.aymanbagabas/go-pty— cross-platform Go pty interface by a Charmbracelet maintainer. Returns ReadWriteCloser; Unix = POSIX pty, Windows = ConPTY via custom spawner. Best option for pty on both Linux and Windows from Go, but requires library's ownCmdwrapper (notos/exec).google/goexpect— SSH spawner is particularly relevant for driving Linux containers over SSH from a Windows Station instance.Windows / ConPTY considerations
ConPTY (Windows 10 1809+) is the Windows pty equivalent but requires
PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLEat process creation — not supported by Go'sos/exec. Go proposal golang/go#62708 remains unresolved as of early 2026.Workarounds (
aymanbagabas/go-pty,ActiveState/termtest/conpty,UserExistsError/conpty) callCreateProcessdirectly viagolang.org/x/sys/windows. Works but has reported instability:ERROR_INSUFFICIENT_BUFFERfromCreatePseudoConsoleon some machines,0xc0000142process exits, win32-input-mode encoding changes.Practical consequence: If the target is a Linux LXC container over SSH, you avoid ConPTY entirely — the pty lives Linux-side. If the target is a local Windows process on a client machine, you need ConPTY or fall back to non-interactive (what sshubble currently does). Defer ConPTY to v0.2 and validate on VMID 130 first.
Recommendation: extend Station as a new subcommand
Not a sshubble extension. sshubble uses SSH exec channel (non-interactive), captures output, returns it. Adding structured interactive control would require replacing the execution model. Web operator UI is not the right interface for a technician walking a runbook.
Not a Station wizard extension. The existing wizard is a one-way installer — fixed sequence, no runtime input, no branching, no external process driving. Grafting pty embedding onto it distorts the architecture.
station run <runbook.yaml>is the right fit. Station: (1) already deployed to client Windows machines, (2) uses Bubbletea for TUI, (3) has two-pane layout established in the issues browser, (4) has Cobra command routing, (5) already integrates with sshubble's transport for remote commands. A new subcommand adds driver capability without disrupting existing functionality.For Linux targets (LXC containers): use
google/goexpect's SSH spawner or a direct SSH shell channel withaymanbagabas/go-ptyon the remote side. Pty complexity stays server-side.For Windows local targets (client machines): v0.1 avoids ConPTY — use structured command sequences via
powershell -NonInteractive. Reserve ConPTY for v0.2 after VMID 130 validation.Minimum viable design sketch (v0.1)
Command:
station run <runbook.yaml>Runbook YAML:
TUI layout (two-pane):
v0.1 scope:
approve: truesteps show confirmation before executing; tech can edit command inlineexpectfield: string/regex match; mismatch triggerson_failbehaviorpauseon fail: halts automation, presents manual override prompt, tech can edit and retry.jsonlaudit trail~/.station/runbooks/or URLv0.1 defers: ConPTY, interactive subprocess embedding (
bubbleterm), branching/conditionals, variable interpolation, web operator view, replay from recorded sessions.Open questions remaining
ExecStartPre=git pullpattern as other services)?aymanbagabas/go-ptyorActiveState/termtest/conptybefore scoping v0.2.station runget the sshubble session code — flag, interactive prompt, or env var from daemon?taigrr/bubbletermmaturity: ANSI coverage needs validation against PowerShell output and common Linux shell prompts before adopting.runme tuion a Linux container before writing the YAML schema from scratch — worth cribbing from even if the tool itself doesn't fit.Relationship to #13 (tui-use): tui-use would be the substrate for the interactive subprocess embedding feature (v0.2+) — specifically for the right-pane live terminal view in the TUI layout. Currently rated BENCH (3 days old, one maintainer). Re-evaluate around 2026-04-24; if stable, it replaces the need to wire
taigrr/bubbleterm+aymanbagabas/go-ptymanually.Imported from OneDev comment id 458 on issue #11
Original userId: 5
Original date: 2026-04-24T21:24:45.415+00:00
Ghst partially moots this — the "PTY substrate for an AI agent" piece is solved. What remains is the technician-facing runbook driver concept (YAML runbooks, two-pane Station TUI with approval gates). That's a product idea separate from ghst. Recommend narrowing this issue to just the
station run <runbook.yaml>proposal and deciding whether it's on the Station roadmap. No code action until that product call is made.