commit ed538a478d8e78c893e69465de7ee9dc404661b5
parent 16a8993f3e7b0e494f1200292fa8f317ec9aa714
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 15 Oct 2026 18:58:42 -0400
editor, plans: the frame-scan e2e names its buttons by their text (1/1); the lane P record (plans/release-30/frame-scan.md) and CHANGELOG (crop, hero, fresh)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 105 insertions(+), 3 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,7 +1,7 @@
# Changelog
## [Unreleased]
-- **A saved stream can be scanned frame by frame for a poker tournament's progress.** On a video whose source is in the saved-video store, the video page's new **Frame scan** panel has **Scan frames** (or `pnpm ops frame-scan --json '{"slug":"<channel>","id":"<video>"}'`). The scan takes a frame every 10 seconds (keyframes only, so a 4-hour stream decodes in a minute or two), skips frames that show the same picture as the last one read, and has a vision model read the poker client in the rest: the phase (table, lobby, break), the tournament's name, level, blinds and players left, the hero's chips, the board, an all-in or a bust shown on screen. It also reads the numbers the streamer says in the transcript ("eighty five players left", "the average stack is…"). From both, code works out each tournament's chip and players-left series (one wild reading between two that agree is set aside as a misread), the events (a double-up, a big loss, a bust, the final table, a win), the phases, and a flag wherever a spoken number and a frame disagree. The panel shows the phases as a strip, a small chart per tournament, the events (each time a link to that moment on the video's platform) and the flags. Everything is written to `frame-scan.poker.json` beside the video; the frames themselves are a cache on the channel's media drive, removed with `{"evict": true}`. Scanning again only reads frames not read yet. It runs on the Claude API by default (`settings.generation.frames`: Claude Haiku 4.5, a $5 cap a scan, the day's cap as for every generation) or on a local vision model (route `frames` to `local`). Needs a restart of the editor.
+- **A saved stream can be scanned frame by frame for a poker tournament's progress.** On a video whose source is in the saved-video store, the video page's new **Frame scan** panel has **Scan frames** (or `pnpm ops frame-scan --json '{"slug":"<channel>","id":"<video>"}'`). The scan takes a frame every 10 seconds (keyframes only, so a 4-hour stream decodes in a minute or two), skips frames that show the same picture as the last one read, and has a vision model read the poker client in the rest: the phase (table, lobby, break), the tournament's name, level, blinds and players left, the hero's chips, the board, an all-in or a bust shown on screen. It also reads the numbers the streamer says in the transcript ("eighty five players left", "the average stack is…"). From both, code works out each tournament's chip and players-left series (one wild reading between two that agree is set aside as a misread), the events (a double-up, a big loss, a bust, the final table, a win), the phases, and a flag wherever a spoken number and a frame disagree. The panel shows the phases as a strip, a small chart per tournament, the events (each time a link to that moment on the video's platform) and the flags. Everything is written to `frame-scan.poker.json` beside the video; the frames themselves are a cache on the channel's media drive, removed with `{"evict": true}`. Scanning again only reads frames not read yet. `"crop": [x, y, w, h]` (fractions of the picture) reads only the poker client when a webcam sits beside it, and `"hero": "<screen name>"` tells the model whose seat is the streamer's; both are remembered for the next scan, and `"fresh": true` reads every frame again (another model). It runs on the Claude API by default (`settings.generation.frames`: Claude Haiku 4.5, a $5 cap a scan, the day's cap as for every generation) or on a local vision model (route `frames` to `local`). Needs a restart of the editor.
- **`umtool new <slug> --from <channel>/<video> --seed frames` drafts a supercut from a frame scan.** One clip around each event, cut at the transcript's sentence edges, each with the running stats as its on-screen subtitle ("Level 5 · 9 left · 9,000 chips (22.5 BB)"), and the stats along each clip kept in the manifest's `frameScan` block for a stats overlay (not drawn yet). Review each clip in the bench before keeping it.
- **find-copy can fetch from an archive.org copy that is a single video file.** Such a file's fetch failed with "Requested format is not available" and the copy was then marked as failed. A copy's window is now cut from whatever single file it is, and a copy is marked failed only when the copy itself is gone or refused. `pnpm ops find-copy --json '{"article": "<id>", "retryFailed": true}'` tries copies marked failed again. Needs a restart of the editor.
- **A model can propose verdicts for a fact-check's unruled claims, for you to approve or reject.** `pnpm ops report-draft --json '{"task":"verdicts","article":"<id>"}'` asks each claim with no verdict, with the verdict bench's own prompt, and keeps each proposed verdict, its reason, the model and the prompt version in `verdicts.proposed.json` beside the article, never in `report.json`. It runs only on a model you ticked on the verdict bench (`settings.generation.verdicts.models`, empty until you do), and never sets a verdict itself. umtool's Inbox shows "N verdicts proposed" under Review; **Review verdicts** opens the article, where each proposal has **Approve** (the claim gets that verdict) and **Reject** (the claim stays unruled), with an optional note. A claim you have ruled, or whose proposal you have reviewed, is not asked again. `pnpm ops verdict-review` does the same from the command line. Needs a restart of the editor and umtool.
diff --git a/editor/e2e/frame-scan.spec.ts b/editor/e2e/frame-scan.spec.ts
@@ -56,7 +56,7 @@ test("Scan frames on a saved stream: the job, then the panel's phases, events an
await page.goto(`/channels/${SLUG}/videos/${ID}`);
const panel = page.getByTestId("frame-scan-panel");
await expect(panel).toContainText("Not scanned.");
- await panel.getByRole("button", { name: `Scan frames of ${ID}` }).click();
+ await panel.getByRole("button", { name: "Scan frames", exact: true }).click();
await expect(page.getByLabel(`Scan frames of ${ID} output`)).toContainText("@@frame-scan", { timeout: 60_000 });
await page.reload();
@@ -70,5 +70,5 @@ test("Scan frames on a saved stream: the job, then the panel's phases, events an
await expect(events.getByRole("link", { name: "1:30" })).toHaveAttribute("href", "https://rumble.com/v7synth-synthetic-poker.html?start=90");
await expect(panel.getByLabel("tournament Synthetic Cup")).toContainText("Stack (chips)");
await expect(panel.getByLabel("frame scan flags")).toContainText("said 4, the frame at 2:00 reads 9");
- await expect(panel.getByRole("button", { name: `Scan frames of ${ID}` })).toBeVisible();
+ await expect(panel.getByRole("button", { name: "Scan again", exact: true })).toBeVisible();
});
diff --git a/plans/release-30/frame-scan.md b/plans/release-30/frame-scan.md
@@ -0,0 +1,102 @@
+# Release 30, lane P: the frame scan (`r30/frame-scan`)
+
+The operator's ask (2026-10-15): scan a stream on the Jeralyzer, break it into frames and analyse them for a poker
+tournament's progress, toward a supercut with a stats overlay. First stream: `the-quartering-rumble/v7gkv5w`
+(3:45:54, 1920×1080, the saved container `original`).
+
+### P1–P4, as shipped (2026-10-15, lane P, `r30/frame-scan` from `main` `59fdc486`)
+
+Built as the brief's design (generic engine, poker as its first profile), with these as built:
+
+- **Sampling** (`common/lib/frames/sample-server.ts`): one ffmpeg per half hour of stream, keyframes only
+ (`-skip_frame nokey`, `-ss` before `-i`), `fps=1/N` then an optional CROP (fractions `[x, y, w, h]`: the part read and
+ hashed — the poker client, not the webcam beside it), then split into a JPEG at the profile's width (poker 1280) and a
+ 17×16 grey thumbnail on stdout for the dHash. `t` is the grid time in SOURCE seconds. The cache is resumable by grid
+ time (`index.json`, keyed by step, width, decode mode and crop). Measured on `v7gkv5w` (no model): the whole stream,
+ 1,355 frames at 10 s with the crop, in 268 s from the media drive.
+- **Duplicates** (`dhash.ts`): a frame within `dupMaxBits` (poker 2) of the last READ frame is not asked, re-read every
+ `rereadEvery` (6); the derivation reads duplicates as copies. On `v7gkv5w` with the crop: 1,139 of 1,355 kept (0
+ bits: 1,290; 4: 1,039; 6: 929). Without the crop the webcam makes nearly every frame differ.
+- **Reading** (`scan.ts`, `structuredAnswer` with images): up to 4 frames an ask on the API, 1 on a local model; each
+ reading coerced in code (`coercePokerReading`: enums, ranges, card format, misread pairs dropped, the log's lines kept
+ as written). Prompt version 2 (calibrated on the first stream's frames, read locally): the stats header ("position N
+ of M", average stack), the dealer log copied line by line, the hero's bounty, the break countdown, an action label in
+ a name box. Rules only, no worked example (Q0). Capped: the run stops before an ask whose estimate (image tokens from
+ the JPEG's size, the price table) would pass `maxUsd`; three failed asks in a row stop it; a cancelled or cut run keeps
+ what it read (the sidecar is written every 5 asks).
+- **Spoken numbers** (`numberWords.ts`, `pokerSpoken.ts`): the transcript's numbers normalized to digits (words,
+ "$2,750", "311 K", "233k", ordinals after a tens word), then rules: players left, the field, average stack, the
+ hero's stack (scaled ×1000 beside an average said in thousands within half an hour, marked `approx`) and big blinds,
+ the hero's place, buy-in (and the ASR's "buying is"), first prize, prize pool, the blind level said as poker says it
+ (never a bare "level N": the streamer games), blinds. A stack, big-blind count or place said as a supposition ("once
+ I'm down to…", "it's not like I'm sitting on…") is left out. On `v7gkv5w`'s 1,672 cues: 30 readings, every one checked
+ by eye against its cue (scratch only, nothing committed).
+- **Derivation** (`poker.ts` `derivePoker`, pure): tournaments keyed by the name on screen (unnamed readings take the
+ name before; a field-size change over 1.5×, or chips again after the hero was out and away from the table, is another
+ tournament); series per tournament (stack, stack in BB — shown, else stack over the big blind, the blinds carried
+ until they change — players left, level, position, average stack, big blind), a point both neighbours agree against
+ set aside as a misread (an end point only when it disagrees by the square of the ratio; a last 0 is kept); events
+ judged on every kept point, a change needing the reading after it (double-up ×1.8, big loss ½, bust, final table, won),
+ the frame's own banners once a minute, and the log's: the hero's pots (`big-pot` at 25 BB or more), a knockout, a bust
+ ("<hero> has finished the tournament in Nth"); "Blinds are now a/b" and "<name> has finished the tournament in Nth"
+ fill blinds and players left a frame did not show. A spoken number within 90 s of a frame value of its field agrees
+ or is a FLAG; with none it fills the series (`[t, v, "spoken"]`) and never makes an event.
+- **The job** (`controller/frameScan.ts`, kind `frame-scan`, `needsMedia`): queue `frames` on the API, `draft:local` on
+ a local model (GPU arbiter, unloaded after); the model is the body's, else `settings.generation.routes.frames`
+ (`code` = name one) and `settings.generation.frames {apiModel: claude-haiku-4-5, localModel: qwen2.5vl:7b, maxUsd 5,
+ everySeconds 10}`; refused with no saved video (the sentence is the `persist-videos` body), past `caps.daily`, or with
+ `maxUsd` over `caps.max`; spend to the usage ledger (`task: "frame-scan"`); `@@frame-scan {…}` ends the log. Body:
+ `{slug, id, profile?, everySeconds?, from?, to?, maxFrames?, model?, maxUsd?, hero?, framesPerAsk?, crop?, fresh?,
+ evict?}`; `hero` and `crop` are kept with the sidecar for the next run; `fresh` reads every frame again (another model)
+ keeping the runs and the spend; `evict` removes the cache, no job.
+- **Surfaces**: `pnpm ops frame-scan` / `POST /api/ops/frame-scan`; the video page's **Frame scan** panel (phase strip,
+ a stack and players-left chart per tournament, events linked to the moment on the platform — Rumble `?start=`, YouTube
+ `t=`, Twitch `t=XhYmZs` — the flags, the summary; the hero's small pots counted, not listed) and **Scan frames** when
+ the video is saved; the jobs list's `frames` progress. Not a registry operation: those are corpus-wide lanes.
+- **umtool** (`report-to-video/frames-cut.mjs`, ledger-totals' pattern, and `umtool new <slug> --from <channel>/<id>
+ --seed frames`): a clip around each event (bust, final table, knockout, double-up, big pot, big loss, all-in, won;
+ windows widened to the cues' sentence edges within widen's budgets, merged when they touch, at most 20), its
+ on-screen subtitle the running stats (code's draft, `drafted.onscreen` `model: "code"`), and the manifest's
+ `frameScan.overlay` (the stats at each clip's start and every change inside it). No render reads `frameScan` yet.
+- **The test kit**: the fake Anthropic takes and checks image blocks (and counts them at (w·h)/750), the fake ollama a
+ message's `images` (1,200 tokens each against the cap); `testing/frames/syntheticPoker.mjs` paints a fake client with
+ ffmpeg (`color` + `drawtext`) into a 210-s stream, with `pokerTruthAt(t)` and `SPOKEN_CUES`.
+- **OCR** (the brief's option (b)): not added. `tesseract` is not installed and no OCR package is in the tree.
+ `tesseract.js` would be a dependency (the JS, a 4–7 MB wasm core) plus a language file (`eng` fast ≈ 4 MB, best ≈ 15
+ MB) that it downloads from a CDN at first use unless vendored, run in worker threads at roughly 0.1–0.3 s a small
+ region; no system dependency. The first stream's layout is fixed (the hero's stack box, the pot, the 4-line dealer
+ log, the header), so a digits-only reader of those boxes is viable as a second reader beside the model — the next
+ step once a live run shows where the model misreads.
+
+| Commit | What |
+| --- | --- |
+| `ba992f00` | common, mcp: the engine — sampling, dHash, the poker profile, spoken numbers, derivation, images in `structuredAnswer`, `settings.generation.frames` and the `frames` route, the job kind and controller, the sidecar, the fakes' images, the synthetic stream |
+| `77f9720c` | editor, scripts: `pnpm ops frame-scan`, the video page's Frame scan panel and Scan button, COMMANDS.md |
+| `77127aaa` | umtool: `frames-cut.mjs`, `umtool new … --seed frames` |
+| `e8449230` | umtool, plans: the draft's on-screen text is code's; FACTS; CHANGELOG |
+| `1f2b1a0c` | common: the spoken numbers calibrated on the first stream's transcript |
+| `ab82ee65` | common, editor, umtool, mcp, scripts: calibrated on the first stream's frames — the crop, prompt version 2 (header, log, bounty, break countdown), the log's pots, knockouts, busts, blinds and finishing places, generations after a bust, the position and average-stack series, carried blinds, `fresh`, a kept `hero` and `crop`; the mcp preset test names `frames` |
+| (this commit) | editor: the e2e spec's button locators (a StreamActionLog button is named by its text); this record; CHANGELOG |
+
+Gates (from the worktree root; every tsc and suite under the shared heavy lock):
+- tsc: common, editor, mcp, umtool, export, homepage clean (package-scoped through the slice; the recursive run before
+ the last commit — see the report).
+- common: 4253 at the branch's start (1 failing that run, not reproduced) → 4310 at `1f2b1a0c`, all pass; lib/frames
+ 59/59 at `ab82ee65` (the synthetic stream end to end on both fakes, the cap, resume, `fresh`, the crop).
+- editor unit: 310 → 318 at `1f2b1a0c`, all pass; `_frameScan.test.ts` 6/6 and `frameScanView.test.ts` 2/2 at the tip.
+- test:scripts: 1024 (1021 + 3 skipped) → 1029 (1026 + 3 skipped) at `1f2b1a0c`; `frames-cut.test.mjs` 5/5 at the tip.
+- umtool unit: 33 → 33. mcp: 372 with 1 failing at `1f2b1a0c` (the preset test did not name `frames`) → fixed in
+ `ab82ee65` (`generation.test.ts` 16/16).
+- `docs cli` and `settings example` regenerated; `docs files --check`, `docs env --check` clean.
+- editor e2e, one spec: `frame-scan.spec.ts` 1/1 (5.0 s; the e2e build 482 s) — the synthetic stream saved, **Scan
+ frames**, the job against the fake Anthropic, then the panel: 21 frames, the break segment, double-up and bust with the
+ Rumble `?start=90` link, the tournament's chart, the spoken/frame flag. (The first run, 1 failed: the spec named the
+ button by the log's label.)
+- Measured without a model on `v7gkv5w`: the whole stream sampled in 268 s; 1,139 of 1,355 frames kept with the crop.
+
+Found and left:
+- The sampler runs `ffmpeg`/`ffprobe` from PATH, not `paths.ffmpegBin` (`FFMPEG_BIN`): the editor e2e server points
+ `FFMPEG_BIN` at a fake that makes no frames, and the scan needs real ones. A later slice may give the scan its own
+ override.
+- `frameScan.overlay` is data only: no chrome region draws it.
+- OCR of the client's fixed boxes (above) and a per-channel crop/hero setting are next steps.