Repository navigation
feat(viewer): watch a lab session in a native picture-in-picture window - #349
Merged
Merged
Conversation
Add pickforge-viewer, a Linux binary that shows one lab session in a native window and speaks the stdio protocol in PROTOCOL.md. - Capture the session Xvfb through /tmp/.X11-unix with empty auth: MIT-SHM fetches of the DAMAGE bounding box with a GetImage fallback, at most one fetch per 16 ms, XFIXES cursor image and XInput 2 motion. - Scale with area averaging down and bilinear up, recompute only dirty rows, letterbox, and composite the cursor in the window. - Draw a frameless winit and softbuffer window: a 384 px thumbnail that expands on click, a 32 px bar with Fullscreen, Collapse and Close, and a status pill. Honor --placement host|self and the scale factor. - Pause capture while the window is occluded, minimized or, on Wayland, gets no frame callbacks. End the session on X EOF, a changed Xvfb start time or the host sessionEnded command. - Embed Geist Medium under the SIL Open Font License 1.1. - Test the protocol, scaler goldens, layout math and arguments without a display, capture against Xvfb, and the real window on a second Xvfb.
# Conflicts: # Cargo.lock # docs/releases/UNRELEASED.md
3 tasks done
3 of 4 tasks
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.
The #207 viewer shows a lab session through x11vnc, a loopback bridge and noVNC in a Chromium window. It costs a browser per window and depends on VNC, so it is a poor base for a picture-in-picture view the user keeps open while an agent works.
This adds
pickforge-viewer, a small Rust binary that reads the session's own Xvfb directly with MIT-SHM, DAMAGE and XFIXES and draws it in a native window (winit, softbuffer, swash). A detached TypeScript host supervises it over stdio JSON lines and exposes a private socket with status, expand, collapse and shutdown only.pickforge-lab watchandviewer.mode: "auto"use it when a matching binary is installed and a graphical session exists, and fall back to the noVNC viewer otherwise, including when the native viewer fails to start. The viewer is watch only; control comes in #341. Releases now ship the binary as a separate Linux x86_64 asset with a checksum, and the installer installs it, as approved by the owner.Closes #340
crates/pickforge-viewertests,native-viewer-live.test.ts, QA notescapture_tests.rs,app_tests.rs, benchmark below--self-test,app_tests.rs, QA screenshotsviewer-hyprland.test.ts,native-viewer.test.ts, QA notesnative-viewer.test.tswatchandviewer.mode: "auto"prefer native, else noVNCDISPLAY=:999); stale readiness with and without a launch record; concurrent stop and startwatch.test.ts,native-viewer.test.ts, QA notesscripts/lab/viewer-bench.mjson the owner's Hyprland desktoppickforge; npm-only installs keep the fallbackinstaller.test.ts, candidate jobsCPU use, with the noVNC figure covering Chromium, the bridge and x11vnc:
QA pass: I drove the built CLI and the release binary on nested Xvfb displays, then on the owner's Hyprland desktop with their approval. The live check found that Omarchy dims every window, so the PiP showed the desktop through it. A per-launch opacity rule now keeps both viewer windows opaque until the viewer exits. Once, before that fix was rebuilt, the window sat off screen and expand failed. A fresh launch and three cycles did not reproduce it.
The viewer renders text with swash instead of fontdue, because fontdue depends on
ttf-parser, which RUSTSEC-2026-0192 marks unmaintained. Swash adds about 1.6 MB to the stripped binary, which is now 5.0 MB.Declined: backoff for a GetImage failure that persists on the same area. Lab displays have a fixed size, so it needs a failing X server.
PickCheck has no grammar for shell, so
scripts/install.shandscripts/candidate-smoke.shwere not measured.Follow-up: #348, the
--gaia-urlbar in browser sessions, seen during this QA.Rollback: revert this PR.
watchandviewer.mode: "auto"go back to the noVNC viewer, and the release stops shipping the binary.Council review, 3 rounds:
After the council, Astra reviewed the opacity rule from the live check. It found that a viewer browser that exits on its own left the rule enabled. The rule is now disabled when the browser exits, with tests for an early exit and an interrupt. Astra's recheck approved the fix at 10/10.