feat(console): attach a live agent terminal#209
Open
Lanzelot1 wants to merge 2 commits into
Open
Conversation
63803e6 to
d8175e6
Compare
458f900 to
65fa084
Compare
d8175e6 to
2e2b20d
Compare
65fa084 to
321606b
Compare
2e2b20d to
260e49f
Compare
321606b to
2c1cc68
Compare
260e49f to
2e2a867
Compare
2c1cc68 to
388a40a
Compare
Adds the lazygit 'look inside the process' move the console lacked: 'a' on a roster agent (or ':attach <agent>') suspends the console and hands the terminal to the agent's live PTY over the manager's loopback WS attach endpoint; Ctrl-] (COTAL_DETACH_KEY) returns and repaints. Reuses the CLI's attach-client and the manager's attach op — the console resolves the ws via a per-action control-caller-admin mint (like kill/pause) and suspends Ink in place (App renders null so stdin is released to the PTY; the observer + MeshView keep running in the background, no rebuild). canControl-gated, pty-runtime only, same-host (loopback ws).
…f8 stdin
An invalid COTAL_DETACH_KEY no longer process.exit(1)s from inside the console —
attachClient throws, the standalone command exits loudly, the console flashes a
notice (validated before suspending, and the error notice survives the resume).
Normalize stdin data in attachClient: Ink sets stdin.setEncoding("utf8"), which
persists after it releases raw mode, so the 1-byte detach compare never matched
strings and Ctrl-] could not detach from a console attach. New live smoke drives
the real TUI under node-pty through attach -> type -> detach -> repaint and the
bad-key path.
2e2a867 to
9fa3f87
Compare
388a40a to
47dfed1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes the #1 control gap — the console couldn't open or drive a running agent's terminal (the classic lazygit/k9s "look inside the process" move). Now
aon a roster agent (or:attach <agent>) suspends the console and hands the terminal to the agent's live PTY over the manager's WS attach endpoint;Ctrl-](orCOTAL_DETACH_KEY) returns and repaints.attachop (returns a loopback ws after own-child/admin authz, rejects non-pty runtimes) and the CLI'sattach-client. The console resolves the ws via a per-actioncontrol-caller-adminmint (the exact path kill/pause use) and streams it.nulland gates its top-leveluseInput, so Ink releases stdin (ref-counted raw mode) beforeattachClientgrabs it; the observer endpoint + MeshView keep running in the background (App stays mounted), so the console repaints current state on return. On detach the effect re-asserts alt-screen/alt-scroll/cursor (attach-client leaves the main buffer after a full-screen child).canControl-gated, pty-runtime only (tmux/cmux are watched natively and flash their own hint), same-host only (the ws is loopback). Keyed by name, so it works for a managed agent even if it isn't a mesh roster peer (likecotal attach --name).Stacked on #208 (
feat/console-membership) — retarget to main as the chain merges.Verified
pnpm typecheckclean; existingsmoke:attach(pty-vs-tmux gating) still green.smoke:attach-control:live(4 checks): against a real broker + Manager + pty agent, the console's exact control-op path (control-caller-adminmint →requestControl(ADMIN, {op:"attach"})) returns a validws://127.0.0.1:…/attach/<name>, and a missing agent errors (not crashes). The attachClient data path + terminal hygiene is already covered byattach-repaint.smoke.:attach echosuspends the UI (Ink → null), the agent terminal takes over, typingHELLO-FROM-CONSOLEreaches the agent and echoes back (bidirectional I/O), and the console process/MeshView stay alive in the background. (Detach byte delivery throughtmux send-keysis a harness quirk; the detach+repaint path is smoke-covered.)Notes
No core change — reuses + . No SPEC change.