The window's Wayland application id is komorebi-recorder; komorebic ignore-rule class
registers it before the window exists, as the exe rule does on Windows.
The recorder is now the pinned first tab (Record, not closable, with a REC
marker while recording) of the viewer window; sessions follow as tabs. There
is one process and one window: komorebi-recorder, gui and view all claim the
same socket, and a second launch forwards (gui shows the Record tab, view
opens tabs) and exits. The request protocol gains an optional "tab" field;
old requests still parse. gui takes the record options (they only seed the
window that is started) and --new-window.
The window starts compact (420x380, always on top, Record tab only) when
launched plainly and full size for view; opening any session expands it,
and Compact / Expand is remembered in the prefs. RecorderApp::poll runs on
every frame whichever tab is showing, so recordings continue and finalize
while another tab is looked at. Cmd/Ctrl+0 shows the Record tab; Cmd/Ctrl+W
on it does nothing; closing the last session tab returns to Record.
KOMOREBI_RECORDER_PREFS_DIR and KOMOREBI_RECORDER_NO_IGNORE_RULE let tests
and end-to-end runs avoid the real prefs and the real komorebi.
The macOS/unix cfg branches (hidden title bar spacing) mirror the existing
tested patterns and could not be compiled on the Windows machine this was
written on.
The viewer is now one window with a tab per session. Opening a session
(Open..., recents, the recorder window's buttons, `view SESSION...`) follows
one rule: focus the tab that has it, else load into the current start-screen
or failed tab, else add a tab. Only the tab in view plays; closing a tab
cancels its scan and stops its playback. Keys: Cmd/Ctrl T, W, 1-9,
Ctrl+Tab (and Cmd+Shift+[ ] on a Mac).
`view` and the recorder window hand sessions to a running viewer over a
local socket (komorebi-recorder-viewer.sock in the data dir, one JSON line
each way) and only start a process when none answers; `view --new-window`
opts out. The socket uses komorebi_link's cfg pattern (std unix sockets, or
uds_windows on Windows). The unix/macOS branches could not be compiled
here, only the Windows one.
The recorder and viewer windows were untitled so komorebi would not tile
them. They now get the title komorebi-recorder, but only when that is safe:
before the window exists, on Windows, the recorder runs
komorebic ignore-rule exe <name> (live rule, nothing persisted, 3 s timeout,
no console) for its own exe and komorebi-recorder-gui.exe. Registered, or no
komorebi running, means titled; komorebic missing or failing, and every
non-Windows host, stays untitled with one line on stderr (and in the
recorder window's message area). doctor gains a dry-check line.
No macOS-specific code was added (cfg!(windows) only); nothing here was
built for macOS.
assert <session> --check "<kind> <args> <metric><op><number>" evaluates checks
with the existing analyses (findings, logq, motion, blank, annotations), one
Check trait and one registry line per kind. Exit 6 (ExitKind::Assertion) when a
check fails; checks that cannot be measured are errors (2/3/4), never a pass.
JSON envelope assert/1.
Spike with logman and tracerpt against Win32k, User32, Dwm-Core and
Shell-Core while driving a throwaway window. Sessions start without
elevation, but no event carries a window's rect, flags or caller.
Recommends not building an ETW tap.
`komorebi-recorder mark "text"` appends a point note (author script) to the
session being recorded, found by --session, KOMOREBI_RECORDER_SESSION or the
newest running recording. Notes now show as ticks on the viewer's bug lane.
record --until-exit -- <command> runs the command while recording (with
KOMOREBI_RECORDER_SESSION set) and stops when it exits; its status is reported
apart from the recorder's. record, displays, reindex and selftest take --json
(record/1, displays/1, reindex/1, selftest/1). brief --compact is a 40-line
brief, and findings merges detector findings (with stable f-xxxxxx ids) with
an agent's. annotate --ref log:"text" / log:HH:MM:SS.mmm / log:<video time>
resolves to a log line and says which.
record --window-track[=HZ] (off by default, 30 Hz without a value, 1..=120)
writes windows.jsonl: a sampler thread lists every top-level window once per
tick and writes the full window list only when something changed, plus a
keyframe each second, so a still desktop costs about a row a second.
platform::window::list gives generic facts (Windows: EnumWindows + DWM
cloaked/frame bounds; macOS: CGWindowList bounds and on-screen flag).
The manifest records the track (rows, late ticks) and warns if it stopped
or fell behind. Analysis::window_track answers 'windows at mach_ns T', and
sheet --windows draws each window's rect and label on every frame (cloaked
windows dim), or notes that the session has no track.
The macOS part (platform/macos/apps.rs window_list) was written against the
objc2 sources and is NOT built or run: this was developed on Windows.
Built-in frame analysis for agents that scripted ffmpeg tblend/signalstats.
motion is changes with an optional --region (display points) and a peak
mean luma delta; framediff compares two frames (or one moment of two
recordings with --against) with an optional PNG; blank reports stretches
where a region is near-uniform (named colour) or frozen; compare sets two
recordings side by side. changes now shares the engine with motion and
behaves as before. The crop API takes a rect so a window rect can be
passed later. No macOS-specific code touched (not buildable here).
logq <session> 'level=ERROR and hwnd=0x77179C' filters komorebi.log by
level, target, message, line, the span chain, the handled command and
event, or any span field, with and/or/parentheses, = != ~ !~, --count,
--group-by, --from/--to and a paged logq/1 envelope whose hits carry log:N
references. hwnd compares equal in decimal and hex. logparse keeps the
span chain as written (Line::chain).
at, range, frames and locate --utc now read any TimeSpec form (falling back to
video timecodes, so existing usage is unchanged). New: logtime:HH:MM:SS[.mmm[uuu]]
(also log-time: and wall:HH:MM:SS), a UTC time of day on the session's date, the
one inside the recording if it crosses midnight. A bare time of day stays video time.
komorebi's own send time (its 'pushed notification' log line) is now lined up with
events in order, so an event received long after it was sent still pairs with its
handler. Pair gains pushed_mach_ns and delivery_ms, and a handler view shows
pushed_video_s and delivery_ms beside the receive time. slow-handler without a push
time is info and says it may be delivery delay; a new delivery-batching finding
(info) describes notifications delivered in clumps. A bare process_command{Cmd(arg)}
span is now read as the command (it was nameless), and commands that differ only in
arguments are separate handlers.
No cfg(target_os = "macos") code touched.
Windows Graphics Capture holds a capture to 60 frames a second unless it is
given a minimum update interval, so a 120 Hz display was recorded at half its
rate and a one-refresh flash could fall between two frames. ScreenCaptureKit
was asked for at most 30 (the default --fps), so macOS lost frames the same
way.
--fps now means the most frames a second, and 0, the new default, means no
cap: Windows sets the session's minimum update interval to a millisecond (or
a frame at --fps), and macOS sets a zero minimum frame interval. The encoder
is told 60 fps when there is no cap.
On Windows each sample was also stamped to last 1/fps whatever the gap to the
next frame. A frame is now held until the next arrives and given the real
time between them; the last one still gets a frame at the nominal rate. macOS
passes ScreenCaptureKit's own sample timing through, so needs no change.
Checked on a Mac with a 120 Hz display and komorebi for Mac running: with no
cap a display is recorded a frame every 8.3 ms, and --fps 30 holds it to about
30 a second. The video holds as many frames as the frame log has rows, and the
state komorebi was recorded in matches what the frames show. The macOS encoder
never reads fps, so CaptureConfig::fps now says it reaches only the Windows
one.
A Mac recording has no probe to read: a ghost tile there is found from the
frames komorebi read, so what counts as a frame no one can see matters more
than it does on Windows, and only the plain cases were held.
Added, with a Mac state of two displays, the second at negative coordinates as
a display arranged to the left of the main one is:
- a window filling the left display is not outside every display, and the same
shape past its edge is
- one read of a frame no one can see is not enough, and two are
- a window on a workspace the display is not showing is not a ghost
- nothing is while komorebi is paused
The tests take their states from the session fixture and nothing from the host,
so they run on Windows as well as on a Mac: checked to type-check there (just
check-windows), not run.
--probe-windows was off unless asked for, so a recording made on Windows without
it could not say whether a window komorebi has in front is really on screen, and
had no ghost tiles to find: the most useful thing a Windows recording holds was
the one a person had to know to switch on.
On Windows record now probes each window event by default, and --no-probe-windows
turns it off. RecordArgs::probes_windows is the one place that decides, so the
command line and the recorder window (which takes RecordArgs::default) agree.
Elsewhere it stays off, because there is nothing to read: asking for
--probe-windows outright on a Mac is still an error, as it was, and the two flags
together are refused by clap on any host.
Checked on this Windows machine: a recording with no flag has a probe on 47 of
its 52 events, and with --no-probe-windows none of its 58.
The docs and help text say so, and a doc comment that said a Mac recording has no
ghost tiles is corrected: it has them, from the frames komorebi read.
Sixteen tests read the source of komorebi for Mac, through the catalog that
build.rs indexes from KOMOREBI_MAC_SRC (which nix develop sets) or the checkout
itself, and panicked or failed their assertions on a machine without it: every
Windows machine, and a Mac outside nix develop. That is not a failure of
anything, so they now say why and stop, as the tests that need ffmpeg do:
skipped: KOMOREBI_MAC_SRC is not set, or this build was made without it
testkit::komorebi_mac_source_available says whether both the variable and the
indexed catalog are there, and skip_without_komorebi_mac_source! is its use at
the top of a test. With the source they run exactly as before.
On Windows the whole suite now passes.
What the viewer offers under a bug region that was marked over a ghost tile, what
sending does and which credentials it uses, where the rule goes for each komorebi
(applications.json or applications.mac.json), how narrow it is, and what a
recording needs for there to be any ghost tile to propose on each host.
Under a bug region that was marked while a ghost tile was there, the Bugs tab
says so and offers a rule. The button opens a form with what the recording showed
of the window, the application's name to change, and the rule as it would be
written, narrow enough to leave the program's other windows alone; if no such
rule can be written (nothing tells the ghost from a window that is on screen) it
says why and sends nothing. Nothing is sent until the user presses the button.
Sending runs on a background thread, and the form lists the steps as they happen
and ends with the link to the pull request, a link to open one, or, if something
failed, where the clone is kept (with a button to open the folder) and the
instructions to finish by hand. Escape closes the form, but not while it is
sending.
The recording's ghost tiles are found when it is opened, for the platform the
recording is of: the words are those of that komorebi, and the rule goes in its
file, whatever the viewer runs on.
A rule written from what a recording shows, and the pull request that sends it,
for either komorebi: the rule goes in the file of the komorebi the recording is
of (applications.json or applications.mac.json), not of the machine it is looked
at on.
asc::rule is the rule. It is an ignore rule, always composite so that never the
whole program is ignored: the program and the class on Windows, the application
and the title on a Mac, which has no class. When the program's other windows in
the recording share the ghost's class, the title is added; when nothing tells the
ghost from a window that is on screen no rule is written, and it says why. It
puts the rule into the file changing the lines of the rule and no others: a new
application is a pure insertion where it sorts (case ignored, as just sort does
it), a known one gets the rule in its ignore list and its comma. The result is
checked to be the old file and the rule and nothing more, and a file not laid out
as jq prints it is refused instead of reprinted. Applied to the real
applications.json: 16 lines added and none removed.
asc::submit clones the repository into a temporary directory, branches, commits
with a message that says what was seen, why an ignore rule and why one this
narrow, and pushes. With gh signed in it pushes to the repository if the user may
and to their fork if not (making one), and opens the pull request; without, it
pushes with git and gives a link. git is used for every push, so it is the user's
own credential helper that is asked. gh is looked for where Homebrew puts it, for
a program started from Finder. Anything that fails leaves the clone, with the
commit in it, and says what is left to do. Every location is injectable, and the
tests send to local repositories, a fake gh and a hook that refuses, never to
GitHub.
A ghost tile is a tile of the layout holding a window a person cannot see: one
komorebi has in front on a workspace that is showing, and that was never on
screen, on at least two reads over half a second or still so at the last. Anything
less is a transition (a workspace switch, an application starting up) or
something a person did.
How the recording shows it depends on the host, since only one can be asked:
- komorebi for Windows: Windows says the window is cloaked or not visible on
every probe of it, and never on screen or minimized. This needs a recording
made with --probe-windows; without probes there are none here, which is not
knowing and not none.
- komorebi for Mac: macOS cannot be asked, but komorebi's state has each window's
frame, read live from the accessibility API. A ghost is a window whose frame is
zero-sized or outside every display on every read, and never one a person can
see. That is weaker evidence than Windows saying so, and is documented as such.
It was not run against a real Mac recording.
A ghost carries the program, class and title komorebi has for it, and the other
windows of the same program that the recording saw (siblings), so that a rule for
it can be narrow enough to leave them alone. overlaps() says whether it was there
while a bug region was marked.
komorebi for Windows writes a window as {hwnd, title, exe, class, rect} and the
state read dropped the class. It is what komorebi-application-specific-configuration
rules are mostly written against, so a Window now has it: empty on a Mac, which
has none, and for a window komorebi could not read, whose error text is not a
class.
The recorder opens the viewer as komorebi-recorder-gui, a separate executable
beside it, and `cargo run --bin komorebi-recorder` builds only the recorder.
The viewer was left as it was last built, which meant fixes to it did not
show up in `just run komorebi-recorder` until the other was built by hand.
Four tests only passed on a Mac:
- the pid is kept out of the locked file: Windows locks are mandatory, so the
test could not read the file it was holding; it checks the pid file only
- an older build's pid in the lock file: an older build only ever ran on a
Mac, and Windows cannot read it back while the file is locked; unix only
- the README describes the OS trace the host's session has: the Mac side of
it took the build host's manifest; it now says it is one
- the README embeds the session path: the quoting it looks for is the
host's own (single quotes in a unix shell, double on Windows)
On a Windows session several groups of the OS trace share the one source,
oslog:system (one per program), so the id of their collapsing headers,
built from the event and the source, was the same for all of them and egui
warned "First use of widget ID" under "the system around it". The
label is the program, and it tells them apart.
macOS gives every group a source of its own, which is why it never showed.
Every command that decodes the video (sheet, changes, view) failed on
Windows with 0xC00D36B4, for any video: the source reader was opened with
MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING, which converts colour but refuses a
frame size other than the video's, and they ask for BGRA at a size of their
own. MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING resizes too.
MF_MT_DEFAULT_STRIDE is no longer set on the requested type: frame_of reads
the pitch the buffer reports, negative for a bottom-up picture, so it asked
for nothing it needed.
An H.264 encoder refuses frames bigger than 4096 x 2304 (either way round).
On a 5120 x 2160 display the sink writer failed at SetInputMediaType with
0xC00D36B4 (MF_E_INVALIDMEDIATYPE), reported as "the encoder cannot take
frames of this format", and no display could be recorded.
segment::h264_size gives the size to encode at: the display's own, made even,
when H.264 can take it, and otherwise the largest even size of the same shape
that it can (5120 x 2160 is recorded at 4096 x 1728). When that is not the
display's size, a Direct3D 11 video processor scales each frame on the GPU
before it is handed to the encoder. Displays that fit are untouched.
Recorded and decoded on a 5120 x 2160 display: all three screens, undistorted.
The recorder window and the viewer carry an icon of their own: a slice of
watermelon, drawn as komorebi-recorder/assets/watermelon.svg. `just icon`
(assets/generate.py, with resvg from the devShell) renders the PNG the windows
set and the ICO that Windows embeds. Until now eframe's default egui icon
showed.
macOS: eframe sets the PNG as the Dock icon while a window is open. The program
is a bare executable and not an app bundle, so Finder is unchanged.
Windows: eframe sets the same PNG as the window and taskbar icon. build.rs
compiles the ICO into both executables with embed-resource (rc.exe on Windows,
llvm-rc when cross-building from a Mac), and the installer shows it in Apps &
features through ARPPRODUCTICON. The taskbar, Explorer and the installer have
not been looked at on Windows: W4 and W5 in docs/dev/windows-checkpoints.md now
say what to check.
embed-resource adds seven crates to the lockfile and moves toml_datetime and
toml_parser up by a patch release.
The model (the host axis and the flavor axis, the master clock, the facade, the
rules and the layer that enforces each), the same questions answered for each
host, the decisions behind the design, and the checkpoints to run on a Windows
machine, including the installer.
`komorebi-recorder view <session>` opens a recording in a window: the video of
every display, a timeline with a lane for the bug regions, events, log errors,
the machine and the findings, and an inspector for the state at the playhead,
one event traced end to end, and komorebi's log. The window is untitled so
komorebi leaves it alone, and out of any recording being made. It is where a bug
is marked: the form takes the region from the selection or the playhead and asks
what went wrong and what was expected. It opens from the recorder window as
well.
A transport clock that runs forwards or backwards at any speed, which is plain
arithmetic and tested to the millisecond, and an engine that decodes on its own
thread and keeps the frame of every display in step with it.
komorebi for Windows hides a window by cloaking it in place, so its state cannot
show whether a window is really hidden. `record --probe-windows` follows each
window event with a read of the window's real state from Windows and, now and
then, asks komorebi whether it manages the window. The analysis compares the
two: a window komorebi shows that Windows hides, one it hides that Windows
shows, and a visible window it does not manage. macOS refuses the flag with a
message.
From a komorebi event into what the OS trace recorded around it: komorebi's own
calls, the system, and each application, while the handler ran and for a second
after. On Windows the WinEvents are grouped per program. `trace --os` prints it.
When and where on each display the picture changed, found by decoding the video,
and a contact sheet of frames with the times, events and bug region marked. A
display with no video for part of a range has a gap there instead of an invented
frame.
The brief starts from what the user marked as the bug, in their words, and ranks
the events most worth tracing first; findings an agent concludes are saved with
the evidence they cite, which must exist. The commands arrive: `state`, `diff`,
`events`, `window`, `trace`, `code`, `brief`, `overview`, `search`, `annotate`,
`annotations`, `guide` and `schema`, all with `--json`, and a search is bounded
by a budget.
One event end to end: what its handler logged, what other threads logged
meanwhile, and every change with who made it and how sure that is. The state,
the diff and the events are answered as plain values, an overview ranks what
stands out in a recording, and invariants flag states that are wrong: a window
in two containers, a window parked off screen on the workspace that is showing
(a rule that holds only where komorebi hides windows by moving them, so it is
skipped on Windows).
Every `tracing` statement in komorebi's source is indexed at build time, for
each flavor, so a line of its log can be traced to the statement that wrote it
with the code around it. A recording from a different komorebi than the one
indexed is said to be skewed, decided by the files that differ between the two
commits rather than by commit equality. The `Analysis` facade that every
question is asked of arrives with it, and one window's history through a
recording.
A komorebi `State` is read into monitors, workspaces and windows through each
flavor's rules, and what changed between two states is said in terms a person
would use. `at`, `range`, `summary` and `locate` ask what the recording holds
around a video time, and the other way round, with the text and JSON the later
commands share.
komorebi's log says what happened but not which handler was running. The log is
parsed into lines with their span chain, and a handler's lines are gathered into
one block, from the line that opens it to the one that ends it, as each flavor's
log marks them: komorebi for Mac logs a header, komorebi for Windows has none
and a block is found from its span.
`doctor` says what the machine can do for a recording: which komorebi runs and
how it logs, whether the screen can be captured and played back, the displays
and their scale, and the host clock. Probes measure one thing: the clock across
a sleep, a short capture, a decode, whether komorebi would tile a window of
ours.
Reading the video back: AVFoundation on macOS, the Media Foundation source
reader on Windows, a clear error elsewhere. A request for the frames between two
times is answered with the frame that was on screen at the start, even when the
decoder had to seek to an earlier key frame. `selftest` records a rendered
on-screen clock and compares the clock the video shows with the time the session
predicts.
Run with no command, `komorebi-recorder` opens a small window with Record and
Stop. It is untitled and borderless because komorebi does not manage windows
without a title, so opening it does not move the layout under investigation, and
it keeps itself out of the video (by process name on macOS, with
`WDA_EXCLUDEFROMCAPTURE` on Windows). `komorebi-recorder-gui` is the same
program built for the GUI subsystem on Windows, so that a shortcut opens no
console; both are in the zips and the installer.
`komorebi-recorder record` starts every source in the order that makes the
non-video sources a superset of the video, stops them in reverse, and
checkpoints the manifest as it goes, so that a recorder that is killed leaves a
session `reindex` can recover. `--no-video` records everything but the screen,
and Ctrl-C or `--duration` stops and finalizes a recording. The format of
`annotations.jsonl`, the append-only file that bug regions, notes and findings
are written to, is defined here too. The command table arrives with it, with
`displays` and `reindex`, and with the text-and-JSON conventions the later
commands share.