FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Feature Request: Add terminal session recording to Start-Transcript (capture TUI applications, export to video) · Issue #28353 · PowerShell/PowerShell · GitHub

Repository navigation

Feature Request: Add terminal session recording to Start-Transcript (capture TUI applications, export to video) #28353

Open

Description

Summary

Start-Transcript should gain the ability to record the terminal session itself — including full-screen interactive TUI applications — and save it in a replayable, time-stamped format (asciicast v3) optionally rendered as a video file (GIF/WebM/MP4). This is the PowerShell-level equivalent of RHEL's system-wide session recording via tlog/SSSD/PAM, or of asciinema/script(1) — notably, the asciinema CLI itself does not support Windows.

Background

Start-Transcript is documented to capture "all command that the user types and all output that appears on the console", but in practice it only captures what flows through the PowerShell host. TUI applications bypass the pipeline entirely:

  • On Windows, sconfig (Windows Server) opens the console directly (CONIN$/CONOUT$), switches to raw mode, and paints the screen with VT sequences
  • On Linux, nmtui (RHEL), vim, htop, etc. open /dev/tty and use the alternate screen buffer

So a transcript of a session that uses a TUI application is effectively blank for the duration of that application. This was discussed in detail in discussion #28296, where rhubarb-geek-nz confirmed the current behavior is best-effort and noted his console-logger tool proves the technical approach on Windows: a pseudo-console (ConPTY) wrapper can both display and capture interactive programs.

Proposed behavior

Start-Transcript -Path .\audit\session01 -RecordTerminal -RecordingFormat WebM
sconfig        # full-screen TUI — fully recorded
# ... interact ...
Stop-Transcript

Produces:

  • session01.txt — the existing text transcript (unchanged)
  • session01.cast — time-stamped terminal stream (asciicast v3); always written as source of truth; plays with asciinema play
  • session01.webm — rendered video (GIF built-in; WebM/MP4 via ffmpeg when available)

New parameters (strictly additive, existing behavior untouched): -RecordTerminal, -RecordingFormat (Asciicast|Gif|WebM|Mp4), -RecordInput (keystroke capture, off by default due to secret-capture risk), -RecordIdleTimeLimit.

Technical approach: host-level capture — the console host attaches native child processes to a ConPTY (Windows) / PTY (Unix) pair, proxies the VT stream to the real terminal, and tees it with timestamps into the recorder. Only the host can do this transparently; a PSGallery module cannot intercept CONIN$/CONOUT$//dev/tty traffic of arbitrary children.

Scenarios

  • Audit/compliance: defensible records of privileged interactive administration (sconfig, nmtui, vendor consoles), aligned with the tlog/SSSD precedent and extendable via Group Policy per RFC0041
  • Support/incident response: reproduce exactly what was on screen when a failure occurred inside a TUI app
  • Training/docs/bug reports: shareable GIF/WebM of a full session including TUI interactions

Status

Per the RFC process, this issue requests the appropriate Working Group (WG-Interactive) to review whether the RFC can proceed toward an experimental implementation.

/cc rhubarb-geek-nz

Activity

  1. 237dmitry commented on Nov 5, 2026

    open /dev/tty and use the alternate screen buffer

    Alternative buffer does not work on /dev/tty ( `e[?1049h, `e[?1049l)

    tty   #  /dev/tty3   -  (fbcon)
    tty   #  /dev/pts/0  +  (terminal emulator)
    
  2. soroshsabz commented on Nov 5, 2026

    Author

    Community module update + proposed engine enhancements that would make this cleanly implementable

    A cross-platform community implementation of this request at PowerShell Gallery module scope now exists: Bsn.Host with Start-/Stop-/Show-InteractiveTranscript — ConPTY engine (Windows 10 1809+), script(1) (Linux/macOS), asciicast v2 output, RFC 421 parameter semantics (-RecordingFormat, -RecordIdleTimeLimit, -RecordInput, r/i events). It validates the "nested recorded session" model: everything run inside the recorded session — including full-screen TUI apps — is captured, and Stop-InteractiveTranscript finalizes it from inside.

    Building it confirmed precisely where the module ceiling is, and which engine-level APIs would remove it. Proposed on the RFC PR as well (PowerShell/PowerShell-RFC#421 (comment)), summarized here:

    1. Console output tap / interceptor interface — host raises events (or invokes interceptors) for every chunk it writes to the terminal. Gives first-class enhanced transcripts without Out-Default proxy hacks; still cannot see native/TUI children that write to inherited console handles.
    2. Managed PTY primitive in .NET/PowerShell (create PTY, spawn attached process, streams, resize events; ConPTY + openpty behind one API) — the single biggest practical win: our 600-line P/Invoke engine plus the script(1) fallback collapses to ~50 lines, and every terminal-automation module benefits. (Long-standing dotnet/runtime request.)
    3. Host-sponsored nested-terminal passthrough primitive (PSHost.EnterNestedTerminal(...)-style: raw console-mode save/restore, VT passthrough, resize forwarding, clean teardown) — this is the "host cooperation" the feature needs; the engine provides plumbing, the gallery provides UX.
    4. Pluggable transcript sinks on Start-Transcript — the engine keeps transparent host-level capture (as the RFC specifies), modules implement sinks (asciicast v2, audit/SIEM formats, video renderers). One capture implementation in-box; format innovation in the ecosystem.

    The architectural boundary is stable across all of these: a module can never retroactively insert a PTY between an already-running shell and its terminal — same reason asciinema, script(1) and tlog all use entered/hosted sessions. Transparent capture of the current session stays engine-only, which is what the RFC proposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL