Skip to main content

Module ui_record

Module ui_record 

Source
Expand description

UI action record: a short animated GIF of the caller’s own pane, for a task that changes the UI (docs/specs/SPEC_KANBAN_TASK_MEDIA_2026_10_25.md §6, phase 2). start begins collecting frames; stop (or the time limit) finishes the file and returns its path, which goes straight into files of Tasks update/submit.

A frame is what screenshot returns: the host’s capture of the caller’s own pane (or a browser pane it opened), cut to that pane, with the secret fields and the Vault the host found just before and just after the capture blacked out here (screenshot_redact). So the target rules and the redaction are the screenshot’s own, frame by frame: the pane is checked again before every capture, and a pane that has gone to the user (a hand-off, an approval, a question, paused) ends the recording. A frame the host could not check for secret fields is left out and counted, never kept. The host captures the whole viewport and this crops it (a clipped capture in a visible page briefly changes its viewport and flickers the window, which a recording would do for its whole length); the rest of the viewport is dropped here. Frames are encoded as they arrive, so memory stays at about the size of the file, and the file is kept under the size one attached image may have.

Structs§

Finished 🔒
What a finished recording is.
GifBuilder 🔒
A GIF written one frame at a time. A frame’s delay is the time until the next one, so each is held back until its successor arrives (or the end), and then encoded.
Recording 🔒
One recording in progress, or ended and not yet collected.
SharedBuf 🔒
A growable buffer the encoder writes into and the builder can measure and take back.

Constants§

DEFAULT_FPS 🔒
FRAME_TIMEOUT 🔒
How long a host capture may take before the frame is given up on. A capture takes about 70 ms; a pane in a minimized or hidden window never answers.
FRAME_WIDTH 🔒
Frames are scaled down to this width: a recording is for looking at a change, not for reading text.
MAX_BYTES 🔒
The file stays under the size one attached image may have (task media: MAX_IMAGE_BYTES; a GIF is an image).
MAX_FAILED_IN_A_ROW 🔒
How many frames in a row may fail before the recording ends with what it has.
MAX_FPS 🔒
The most frames a second (the spec’s limit), and what a call gets without asking.
MAX_SECONDS 🔒
The longest recording, in seconds (the spec’s limit).
MIN_DELAY_MS 🔒
The shortest a frame stays on screen: GIF counts in hundredths of a second and viewers treat less as slow.
RETENTION 🔒
Recordings in the temp folder older than this are removed when a new one is written.

Statics§

RECORDINGS 🔒
One recording a caller at a time.

Functions§

capture_frame 🔒
One frame: the host’s capture of block_id as JPEG, blacked out where it has secret fields.
crop_to 🔒
crop (x, y, width, height in CSS pixels) of a whole-viewport img whose page is viewport_width CSS pixels wide.
dir 🔒
frame_from 🔒
A host capture as a frame: decoded, scaled to FRAME_WIDTH if wider, and opaque (GIF has no partial alpha).
frame_of_response 🔒
The host’s answer to one capture as a frame, with what the host found to hide blacked out first, exactly as screenshot does. A capture the host could not check for secret fields is an error, so the frame is left out.
handle_ui_record 🔒
POST /api/v1/ui/record — backs UI action record. op start begins a recording of the caller’s own pane (or a browser pane it opened, pane); op stop ends it and returns the file.
limits 🔒
fps as asked for, held to the limits; seconds likewise.
prune_old 🔒
response 🔒
response_with 🔒
As response; with inline the file’s bytes go in the answer too, for a caller that cannot read this machine’s folders (a container agent). A file that cannot be read back is left out, and the answer still names it.
run 🔒
The capture loop: a frame every 1/fps second until stopped, out of time, out of room, or failing.
scale_frame 🔒
img scaled to FRAME_WIDTH if wider, and opaque.