Skip to content

Expose pane revision / output sequence in librmux (parity with Rust SDK) #2

Description

@ark2042

Context

The Rust SDK surfaces a per-pane revision (and output sequence) — the monotonic counter that increments when a pane's content/lifecycle changes. It's the canonical "did the pane actually change?" signal, which is central to building reliable agentic waits without polling or diffing rendered text.

On the Python side, PaneSnapshot is currently text-only (parsed from capture-pane -p): no revision, no output sequence. So a consumer can't tell "new output arrived" apart from "same screen re-rendered" without diffing text, which is exactly the kind of ghost-text ambiguity revision is meant to remove (spinners, status-line refreshes, prompt repaints, cursor blink).

Feasibility (already verified)

This does not require the bincode daemon protocol. The rmux binary already exposes these as format variables, reachable from Python through the existing display-message path:

$ rmux display-message -t <session> -p '#{pane_id}|#{pane_revision}'
%0|2
  • #{pane_revision} (alias of #{pane_lifecycle_revision})
  • #{pane_output_sequence}

librmux already wraps display-message (incl. --json), so the plumbing is in place. Verified against rmux 0.6.1.

Proposal (open to your preferred shape)

Two non-exclusive options:

  1. Lightweight accessors on Pane:

    pane.revision() -> int          # #{pane_revision}
    pane.output_sequence() -> int   # #{pane_output_sequence}

    Minimal, additive, no change to PaneSnapshot.

  2. Enrich PaneSnapshot with revision: populate a revision: int | None field when a snapshot is captured, bringing it closer to the Rust PaneSnapshot.

I'd lean toward (1) first (smallest surface, immediately useful for wait/idle detection), with (2) as a follow-up if you want full snapshot parity.

Out of scope (flagging explicitly)

The structured grid + cursor snapshot (the Rust daemon PaneSnapshot endpoint) is bincode-only with no CLI/JSON path today, so it's not reachable from librmux without a new binary-side command. That's a separate, larger ask on the rmux core — not part of this issue.

Offer

Happy to send a PR once you confirm the shape (accessor naming, int vs str return, PaneSnapshot field vs method). Same approach as #1 (additive, fake_rmux_json unit tests + real smoke).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions