Commit Graph
34 Commits
Author SHA1 Message Date
LGUG2Z 8e454e1e03 feat(gui): one window for recording and reviewing
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.
2026-10-28 17:41:27 -07:00
LGUG2Z 72d600c8f6 feat(viewer): open sessions as tabs of one window
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.
2026-10-28 16:58:55 -07:00
LGUG2Z 19886f96fe feat(gui): name the windows komorebi-recorder, once komorebi is told to ignore them
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.
2026-10-28 16:58:55 -07:00
LGUG2Z 13713d65e8 feat(assert): scripted pass/fail checks over a recording's findings, log, motion and notes
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.
2026-10-28 16:24:29 -07:00
LGUG2Z e7283ae45d docs(dev): what ETW would tell us about window management
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.
2026-10-28 16:24:29 -07:00
LGUG2Z f9f4e437e4 feat(annotate): mark the timeline from a script while recording
`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.
2026-10-28 16:24:29 -07:00
LGUG2Z cf15fc978c feat(cli): record until a command exits, findings and brief --compact, and --json everywhere
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.
2026-10-28 16:24:29 -07:00
LGUG2Z 3c4f352846 feat(record): sample every window's rect at video rate, and draw them on sheets
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.
2026-10-28 16:24:29 -07:00
LGUG2Z 6af9eabd27 feat(video): motion, framediff, blank and compare for recordings
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).
2026-10-28 16:24:29 -07:00
LGUG2Z 1f6e4cef05 feat(logq): query komorebi's log by field, with counts and group-by
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).
2026-10-28 16:24:29 -07:00
LGUG2Z f3811fc24f feat(time): one clock for every time argument, and no slow handlers that are really delivery delay
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.
2026-10-28 16:24:29 -07:00
LGUG2Z 11f028b8c9 feat(capture): record at the display's refresh rate, and give each frame its real duration
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.
2026-10-28 16:24:29 -07:00
LGUG2Z c239607af9 feat(record): read what Windows says about each window by default
--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.
2026-10-28 16:24:29 -07:00
LGUG2Z 7c692138c7 docs(usage): proposing a rule for a ghost tile
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.
2026-10-28 16:24:29 -07:00
LGUG2Z 8a203f0da7 feat(icon): a watermelon for every window
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.
2026-10-27 22:22:56 -07:00
LGUG2Z df4ab2d2a5 docs(repo): how it fits together, per platform, and why
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.
2026-10-27 22:22:56 -07:00
LGUG2Z 28cfdaa463 feat(viewer): view a recording
`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.
2026-10-27 22:22:56 -07:00
LGUG2Z 52a45aa17b feat(winprobe): ask Windows what it thinks of a window
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.
2026-10-27 22:22:56 -07:00
LGUG2Z 069347060d feat(analysis): see what the screen did
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.
2026-10-27 22:22:56 -07:00
LGUG2Z 26963391a3 feat(analysis): investigate from what you marked
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.
2026-10-27 22:22:56 -07:00
LGUG2Z 079f1ac6d0 feat(analysis): explain one event, follow one window
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).
2026-10-27 22:22:56 -07:00
LGUG2Z 72419d89a2 feat(analysis): what komorebi believed, and what changed
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.
2026-10-27 22:22:56 -07:00
LGUG2Z e3a1f01fd7 feat(doctor): check what a recording leans on
`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.
2026-10-27 22:22:56 -07:00
LGUG2Z 3e30d81bc5 feat(av): decode the recorded video
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.
2026-10-27 22:22:56 -07:00
LGUG2Z 5291a24fd4 feat(app): the recorder window
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.
2026-10-27 22:22:56 -07:00
LGUG2Z 05d87908c5 feat(recorder): orchestrate a recording
`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.
2026-10-27 22:22:56 -07:00
LGUG2Z 1006ec2570 feat(timeline): index a session
`timeline.jsonl` is a merged, time-sorted index that points into the raw files
by byte range, so the raw files are never rewritten and the index can be rebuilt
at any time. It places komorebi's log, events, the OS trace and the recorder's
own incidents on one timeline, and answers what was around a video time and
where in the video a log line or event is. `frames` extracts PNG frames from the
recorded video with ffmpeg, which is never used to capture.
2026-10-27 22:22:56 -07:00
LGUG2Z 383cc3c3db feat(power): ride out sleep, lock and display changes
Docking, sleep and lock are where komorebi bugs show up, so the recording
carries on through them. On Windows a hidden window hears suspend, resume, the
lid, the displays and session lock as Windows delivers them; on a Mac a sleep is
found because the host clock pauses while the wall clock does not, and the lock
is polled on both hosts. A tracker turns these into reactions: a display that is
gone has its video finalized at once, one that returns starts a new segment, and
every stream is started afresh after a wake instead of trusting the old one.
2026-10-27 22:22:56 -07:00
LGUG2Z fb11cb2db9 feat(capture): record the screen
Screen capture behind a `CaptureBackend`: ScreenCaptureKit and AVFoundation on
macOS (HEVC by default), Windows Graphics Capture and a Media Foundation writer
on Windows (H.264). Each display is written as fragmented mp4 in segments with
every frame's master-clock timestamp, and a manager decides, from what the
backend reports, when a segment ends and another begins. The segment logic is
shared by both backends and tested without a screen.
2026-10-27 22:22:56 -07:00
LGUG2Z 9d35869f88 feat(sources): the OS trace
What the OS says while komorebi acts: the unified log (`log stream`) on macOS,
one file per managed application, komorebi's process and the system; on Windows
the WinEvents komorebi hears, folded when repeated, and the Event Log's warnings
and its display, power and GPU providers. Both end up as `oslog/*.ndjson` on the
master clock, and a host with no OS trace says so instead of failing.
2026-10-27 22:22:56 -07:00
LGUG2Z 4724d831ba feat(session): the session directory
A session is a directory and its manifest, `session.json`: the host, the
komorebi flavor, the clock anchors, the log segments and the applications seen,
written atomically. komorebi's own log is recorded as the exact byte range
written while recording (`%TEMP%` on Windows, its data directory on a Mac),
together with the version of the komorebi that wrote it. A generated README in
each session says what every file is, quoting paths the way the host's shell
reads them.
2026-10-27 22:22:56 -07:00
LGUG2Z c748237741 feat(komorebi_link): record what komorebi says
The recorder subscribes to komorebi over its socket (a unix socket on macOS,
`uds_windows` on Windows) and writes every notification with the state it came
with, stamped on the master clock. Its accept loop only hands off to a writer
thread, since komorebi notifies subscribers while holding its locks. What
happens to the recording itself (a komorebi that exits, a stream that dies) is
written as incidents, and a lock file says whether a recorder is still running
in a session.
2026-10-27 22:22:56 -07:00
LGUG2Z 0de0f82840 feat(flavor): read komorebi for Mac and for Windows
Which komorebi produced a session is a separate axis from the host the recorder
ran on. `Flavor` names the two and `Rules` holds what each knows: what its
events look like on the wire, which of them move a window, and which are
komorebi making things up. komorebi for Mac and komorebi for Windows each
implement it, and a missing method is a compile error. The Windows rules were
written from komorebi's source and say so until a recording confirms them.

Events are classified through the rules, and the names of things in a session
(`event:12`, `log:7`) are parsed here too, with the envelope and exit codes
every command will answer in.
2026-10-27 22:22:56 -07:00
LGUG2Z d5eacecef8 feat(clock): the master clock
Every record in a session is stamped on one monotonic clock:
`mach_absolute_time` on macOS and `QueryPerformanceCounter` on Windows, behind a
`platform` facade with a third `unsupported` host that builds anywhere. Anchors
pair that clock with the wall clock, a map interpolates between them, and a jump
detector notices sleep and clock steps by comparing how far each moved. Video
timecodes are parsed and printed here too.

`Host` and `ClockKind` say what a session was recorded on.
2026-10-27 22:22:56 -07:00