Skip to content

feat(cli): rat watch for read-only session observation - #7

Closed
seamoss wants to merge 1 commit into
devfrom
feat/watch-readonly
Closed

seamoss wants to merge 1 commit into
devfrom
feat/watch-readonly

Conversation

@seamoss

@seamoss seamoss commented Apr 24, 2026

Copy link
Copy Markdown
Owner

Summary

`rat watch ` attaches and tails output but never sends anything back — no input, no detach, no resize. The interactive attacher is untouched.

```sh
rat watch agent # follow live
rat watch agent | tee agent.out # capture to file
```

Ctrl-C stops watching. Uses the same OutputFilter as `rat attach` to keep kitty-CSI-u enables out of the watcher's terminal.

Test plan

  • cargo build + clippy + fmt + test green
  • CI green
  • Smoke: rat attach one session, rat watch from another term, verify keystrokes on watcher do not reach the session and Ctrl-C cleanly exits

New `rat watch <id>` subcommand: attaches over the Unix socket and
replays + tails the session's PtyOutput to stdout, but never sends
ClientMsg::Input, Detach, or Resize. The interactive attacher (if
any) is completely untouched.

Implementation notes:
- Stays in cooked mode so the terminal's line discipline handles
  Ctrl-C → SIGINT cleanly, which the tokio signal task traps and
  uses to notify the read loop to exit.
- Reuses OutputFilter so keyboard-protocol enables from inner TUIs
  don't bleed into the watcher's terminal.
- Suppresses SessionEnded-based exit distinction with the shared
  `print_session_ended` banner so ending a session while watching
  is visually consistent with ending while attached.

Useful for pair/review ("peek without risk of typing"), CI-style
monitoring via `rat watch x > log`, or any tool that wants a live
byte stream from a session without the raw-mode contract of attach.
@seamoss

seamoss commented Apr 24, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #11 — combined to avoid peer-merge conflict churn. Original commit preserved there.

@seamoss seamoss closed this Apr 24, 2026
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