commit 67216f02302388f5a02228a8c01b4e7a4b4620da
parent 0dade54debb2788f4c3f5f39af2b62b6e0434e5d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 16 Oct 2026 23:52:52 -0400
plans: release 32 lane R6 — the owed UI (the stored media URL option everywhere a window is fetched, the Inbox on a phone, the bulk media and persist buttons); editor e2e owed-ui.spec, FACTS, CHANGELOG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 245 insertions(+), 0 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,10 @@
# Changelog
## [Unreleased]
+- **"Cut from the stored media URL" wherever a clip window is fetched.** When Odysee refuses its page lookup, a window can be cut from the video file address the record already stores. The option sits beside the editor's **Fetch missing evidence** (Reports and Articles tabs — offered once a preview finds Odysee windows with a stored address, and the preview says how many) and umtool's **Fetch clip** (articles, the drafts deck, the research reader), the clip and claim benches and **Fetch N unfetched clips** — only where the record stores one, off by default. Ticked, the page is asked first as always, and the stored file is used only when Odysee refuses. `POST /api/media/fetch-window` and the MCP's `fetch_clip` take `storedUrl` (`"fallback"` or `"only"`).
+- **The Inbox reads on a phone.** At narrow widths each row wraps: the piece, what and why on top, the count and its action underneath. Before, at about 380 px the rows showed only the count and the button.
+- **Attach a whole local archive and make playable copies from the channel page.** The Cleanup stage's **Media for the whole channel** has **Attach media from a local archive** (a folder, a .zip or a .7z; only names matching, create records for videos the channel does not hold, replace files already saved) and **Playable copies** (trackers, folder) — what `archilyzer media attach` and `media playable` did for a channel. Each previews first, the run is armed by a preview of the same settings, and the result is said in plain words with the job linked.
+- **Save a list of videos to the store from the Saved videos page.** **Save these videos** takes one video per line (`channel/video-id` or a video page link), the quality and whether to replace a taller one; **Preview** says what a run would do with each (to download, already saved, no source address, not found) and **Save videos** starts one job per channel and links each — `pnpm ops persist-videos` in the UI.
- **A clip window can be cut from the media URL an Odysee record already stores, when Odysee's lookup is rate-limited.** `pnpm ops fetch-windows` takes `"storedUrl"`: `"fallback"` tries the page as before and, when the lookup answers 429, cuts the window from the file the record's `metadata.info.json` names on Odysee's CDN (`*.odycdn.com`) instead; `"only"` goes straight to that file and asks the page nothing. A held or cooling Odysee no longer refuses those windows — only the ones with no stored file are refused or left for a later run. Same queue, same gaps between fetches, the audio check still applies, and the window's provenance says `source: "stored-media-url"` with the host. The default, `"never"`, changes nothing; only Odysee is allowed. Needs a restart of the editor.
- **umtool's drafts review is an audition deck: hear the cited moment, then keep it or cut it.** `/projects/<project>/review` shows one card per drafted field still waiting for a verdict: the drafted value large, the cited span of its clip playing (video when a window or saved video holds it, else audio marked "audio only"), and the quote under it lighting word by word as it is spoken. Swipe right, → or `k` keeps it (approves); left, ← or `x` cuts it (rejects — tap a reason chip or write a few words, never required); up, ↑ or `e` edits it on the card (on-screen text, narration, teaser lines and the YouTube title; Enter keeps it as edited); down, ↓ or `s` skips it to the back; space replays the span; `z` undoes the last keep, cut or skip. Tap a word to mark it misheard: the note says so. Every action is also a button (a bar under the thumb on a phone). The next card's media is already loading, and the deck ends with what was cut and skipped. Verdicts are the same `drafts.review.json` as before; **List** (`?view=list`) is the old list, whose reader now plays the span too. No model is needed for any of it.
- **Fetch clip wherever a citation is shown in umtool.** When nothing on disk holds a cited span — on the deck, in the list's reader, on an article's evidence panel and its evidence walk — **Fetch clip** asks the editor for those seconds exactly as the MCP's `fetch_clip` does, shows its progress, and plays the window when it lands. A rate limit says the platform is rate-limiting; a window the audio check refused says the source served corrupt audio. The evidence panel plays video first and has **Play span** (from the span's start to its end).
diff --git a/editor/e2e/owed-ui.spec.ts b/editor/e2e/owed-ui.spec.ts
@@ -0,0 +1,116 @@
+import { test, expect } from "@playwright/test";
+import { mkdir, writeFile } from "node:fs/promises";
+import { join } from "node:path";
+import { channelStage, resetData, testPaths } from "./helpers";
+
+// Release 32 lane R6: the owed UI. "Cut from the stored media URL" offered on
+// the Articles tab's Fetch missing evidence once a preview finds a window on
+// an Odysee record that stores its CDN file (off by default); the channel's
+// whole-channel media tools (attach from a local archive, playable copies)
+// previewed from the Cleanup stage; and "Save these videos" on the Saved videos
+// page previewed and armed. Synthetic records only; nothing is fetched.
+
+const SLUG = "test-transcribe"; // an Odysee channel (one-transcribe-channel)
+const STORED = "v6stored01";
+// Eleven characters: the archive names a file by a YouTube-shaped id (lib/attachMediaPlan.ts).
+const HELD = "v6held01abc";
+const page = (id: string) => `https://odysee.com/@example:1/synthetic-${id}:1`;
+const channelDir = () => join(testPaths().transcriptsDir, "channels", SLUG);
+
+async function record(id: string, stored: boolean) {
+ const dir = join(channelDir(), "data", id);
+ await mkdir(dir, { recursive: true });
+ await writeFile(
+ join(dir, "metadata.info.json"),
+ JSON.stringify({
+ id,
+ title: `Synthetic ${id}`,
+ webpage_url: page(id),
+ duration: 600,
+ ...(stored ? { formats: [{ format_id: "original", url: `https://player.odycdn.com/v6/streams/${id}/f0.mp4`, protocol: "https", ext: "mp4" }] } : {}),
+ }),
+ );
+}
+
+test.beforeEach(async () => {
+ await resetData("one-transcribe-channel");
+});
+
+test("Fetch missing evidence offers the stored media URL once a preview finds an Odysee window that has one", async ({ page: p }) => {
+ await record(STORED, true);
+ const reports = join(testPaths().transcriptsDir, "reports");
+ await mkdir(join(reports, "fixture-stored"), { recursive: true });
+ await writeFile(
+ join(reports, "fixture-stored", "report.json"),
+ JSON.stringify({
+ format: "archilyzer-report",
+ version: 1,
+ id: "fixture-stored",
+ kind: "sweep",
+ title: "Fixture stored article",
+ sections: [{ id: "s1", title: "One", claims: [{ id: "k01", text: "It is said: \"a synthetic line\"", citations: ["c01"] }] }],
+ citations: { c01: { kind: "video", channel: SLUG, id: STORED, start: 10, end: 14, quote: "a synthetic line" } },
+ }),
+ );
+ await writeFile(join(reports, "index.json"), JSON.stringify({ published: ["fixture-stored"] }));
+
+ await p.goto("/sites/articles");
+ await expect(p.locator("[data-stored-url-option]")).toHaveCount(0);
+ await p.getByRole("button", { name: "Preview missing evidence" }).click();
+ const summary = p.getByLabel("Missing evidence");
+ await expect(summary).toContainText("odysee: 1 window(s) on clips:odysee · 1 with a stored media URL", { timeout: 30_000 });
+ const option = p.locator("[data-stored-url-option]");
+ await expect(option).toBeVisible();
+ await expect(option).toContainText("Cut from the stored media URL");
+ await expect(option).toContainText("Odysee only.");
+ await expect(option.getByRole("checkbox")).not.toBeChecked();
+});
+
+test("the channel's media tools: attach from a local archive and playable copies, each previewed first", async ({ page: p }) => {
+ test.setTimeout(90_000);
+ await record(HELD, false);
+ // Inside the test corpus, which resetData clears.
+ const archive = join(testPaths().transcriptsDir, "r32r6-archive");
+ await mkdir(archive, { recursive: true });
+ await writeFile(join(archive, `Synthetic held recording [${HELD}].mp4`), "synthetic media bytes\n");
+
+ await p.goto(channelStage(SLUG, "cleanup"));
+ const tools = p.getByRole("group", { name: "channel media tools" });
+ await tools.locator("summary").click();
+ const attach = tools.getByLabel("attach media from a local archive");
+ await expect(attach.getByRole("button", { name: "Attach", exact: true })).toBeDisabled();
+ await attach.getByLabel("archive path").fill(archive);
+ await attach.getByRole("button", { name: "Preview attach" }).click();
+ await expect(attach.getByRole("status", { name: "attach preview" })).toContainText("Would attach 1 held video.", { timeout: 30_000 });
+ await expect(attach.getByRole("status", { name: "attach preview" }).getByRole("link", { name: /^job / })).toBeVisible();
+ await expect(attach.getByRole("button", { name: "Attach", exact: true })).toBeEnabled();
+ // Other settings than the preview's disarm it.
+ await attach.getByText("Replace files already saved").click();
+ await expect(attach.getByRole("button", { name: "Attach", exact: true })).toBeDisabled();
+
+ const playable = tools.getByLabel("playable copies", { exact: true });
+ await playable.getByRole("button", { name: "Preview playable copies" }).click();
+ await expect(playable.getByRole("status", { name: "playable preview" })).toContainText("Would make 0 playable copies", { timeout: 30_000 });
+ await expect(playable.getByRole("button", { name: "Make playable copies" })).toBeEnabled();
+});
+
+test("Save these videos: a preview buckets the list and arms the run; a line that names no video is refused", async ({ page: p }) => {
+ await record(HELD, false);
+ await p.goto("/saved-videos");
+ const box = p.getByRole("region", { name: "save these videos" });
+ const save = box.getByRole("button", { name: "Save videos" });
+ await box.getByLabel("videos to save").fill("just-one-word");
+ await box.getByRole("button", { name: "Preview" }).click();
+ await expect(box.getByRole("alert")).toContainText('line 1 "just-one-word"');
+ await expect(save).toBeDisabled();
+
+ await box.getByLabel("videos to save").fill(`${SLUG}/${HELD}\nno-such-channel/x1`);
+ await box.getByRole("button", { name: "Preview" }).click();
+ const preview = box.getByRole("status", { name: "save preview" });
+ await expect(preview).toContainText("A run would download 1 video.");
+ await expect(preview.locator('[data-bucket="toFetch"]')).toContainText(`${SLUG}/${HELD}`);
+ await expect(preview.locator('[data-bucket="unknown"]')).toContainText("no-such-channel/x1");
+ await expect(save).toBeEnabled();
+ await box.getByLabel("quality to save").selectOption("video_720");
+ await expect(save).toBeDisabled();
+});
diff --git a/plans/FACTS.md b/plans/FACTS.md
@@ -10086,3 +10086,34 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri
`cut from the stored media URL (<host>) — <platform> lookup rate-limited|held` or `(asked: only)`.
- Not wired: the single `/api/media/fetch-window` route and the MCP's `fetch_clip` (which posts to that route, not to
fetch-windows), and any UI toggle.
+
+## Release 32 lane R6: the owed UI (verified 2026-10-17, branch `r32/owed-ui`)
+
+- **The stored media URL in the UI.** `lib/storedMediaUrl.ts` holds the UI's words: `STORED_URL_LABEL`,
+ `STORED_URL_HELP`, and `STORED_URL_UI_MODE = "fallback"` — every surface's tick asks `fallback`; `only` stays for the
+ CLI and the MCP. Offered only where it can do something: the editor's Fetch missing evidence once a preview (which
+ always asks with the mode — a dry run starts nothing — so `storedUrlItems` is counted) or a refused run shows a
+ stored-URL platform's windows; umtool's surfaces when `GET /api/cited/stored?(channel&video | project&clip)` answers
+ `{stored: true}` (`lib/clips/stored.ts`: `storedMediaUrl()` over CHANNELS_DIR; a project clip's record is the clip's
+ `channel` else `provenance.channelSlug`, and `video` — a timeline clip's or a ledger claim's, as fetch-via-editor.mjs).
+ CutTab counts the pending clips with one (`storedUrlClips` on FetchUnfetchedButton).
+- **The single window takes it too.** `POST /api/media/fetch-window {storedUrl}` (400 on anything but the three modes)
+ → `fetchWindowAction({storedUrl})`: `only` + a stored URL → no page request; a held or cooling platform does not
+ refuse a window with one (`why` held | rate-limited); `fallback` + a page `FetchWindowError` of class `rate_limit` →
+ the clip gap (`CLIP_WINDOW_MIN_GAP_SECONDS`, or `E2E_CLIP_WINDOW_GAP_MS`) → the stored-URL cut. Without a stored URL
+ the window goes the usual way, refusals included. `spec.params.storedUrl` keeps the mode for Retry. MCP `fetch_clip`
+ takes `storedUrl` (`fallback` | `only`; a window only — a whole recording drops it). umtool: `/api/cited/fetch` and
+ `/api/research/fetch` pass it as fetch_clip's field; `/api/report/fetch {storedUrl}` → `editorFetchSteps({…,
+ storedUrl})` → `fetch-via-editor.mjs --stored-url <mode>` (both its single and `--all` bodies; refused with `--full`;
+ the route refuses it with a whole recording or `UMTOOL_LOCAL_FETCH=1`).
+- **Channel-wide media tools** (`app/channels/[slug]/components/ChannelMediaTools.tsx`, the Cleanup stage): the
+ existing `attachMediaAction(slug, {source, match?, createRecords?, replace?, dryRun?})` and
+ `preparePlayableAction(slug, {trackers?, root?, dryRun?})`, no ids — the whole channel. Both jobs' logs end with
+ `summary: {json}` (attachMedia's `summaryOf`, preparePlayable's own); `lib/mediaToolsWords.ts` reads it into
+ sentences. attach-media matches a file to a record only by an ELEVEN-character YouTube-shaped id (folder `(<id>)`,
+ file `<id>.ext`, `-<id>.ext` or `[<id>].ext`).
+- **Save these videos** (`/saved-videos`, `persistListAction.ts`): `lib/videoList.ts` reads one video per line
+ (`slug/id`, `slug id`, `slug,id`, or any URL containing `/channels/<slug>/videos/<id>`; `#` and blank lines skipped,
+ repeats once, a bad line refuses the whole list with its line number) → `persistVideosAction` exactly as the ops
+ route calls it.
+
diff --git a/plans/release-32/owed-ui.md b/plans/release-32/owed-ui.md
@@ -0,0 +1,94 @@
+# Release 32 lane R6: the owed UI (as shipped)
+
+Branch `r32/owed-ui` from `main` `23ea764b`. Brief: `r32r6-brief.md` (the plan of record for this lane). FACTS:
+"Release 32 lane R6: the owed UI".
+
+## What and why
+
+The operator's rule for the release: everything a model or the CLI can do, a person can do in the UI. Three items
+were owed after R5 and the release's smoke.
+
+- **"Cut from the stored media URL" wherever a window is fetched** (R5 shipped `fetch-windows {storedUrl}` with no UI).
+ One label, one help line and one mode for every surface (`lib/storedMediaUrl.ts`: `STORED_URL_LABEL`,
+ `STORED_URL_HELP`, `STORED_URL_UI_MODE = "fallback"`). Off by default, offered only where it can do something:
+ - the editor's **Fetch missing evidence** (Reports and Articles tabs): once a preview — which now always counts the
+ stored URLs, "odysee: N window(s) on clips:odysee · M with a stored media URL" — or a refused run shows windows on
+ a stored-URL platform;
+ - umtool's **Fetch clip** (`CitedClip`: the article evidence panel, the drafts deck, the audition deck), the
+ research reader's Fetch clip, the clip bench's fetch-more row, the claim bench's fetch, and **Fetch N unfetched
+ clips** on the Cut tab — each when the record stores one (`GET /api/cited/stored`, `lib/clips/stored.ts`).
+ - `POST /api/media/fetch-window` takes `storedUrl` (the batch's rule for one window; fallback waits the clip gap
+ after the page's 429), and the MCP's `fetch_clip` passes it through. `instructions.ts` lists no tool fields, so
+ it is unchanged; the tool's schema describes the field.
+- **The Inbox at ~380 px**: a row's four fixed columns (56 + 190 + 112 px and gaps) left the title no width. Under `sm`
+ the row now wraps — the title and why on the first row (two lines each at most), the count, the action and
+ Park/Mute on the second; from `sm` up, the grid as before. Shots: `$T/shots/r32r6-inbox-{380,520}-{before,after}.png`
+ and `r32r6-inbox-1366-after.png` (the e2e fixture's inbox).
+- **The bulk CLI-only rows get buttons where their object lives**:
+ - the channel's Cleanup stage, **Media for the whole channel**: **Attach media from a local archive** (`media
+ attach <slug> <source>` — only names matching, create records, replace) and **Playable copies** (`media playable
+ <slug>` — trackers, folder). Both preview first (the job's dry run), the run is armed by a preview of the same
+ settings, and the job's `summary:` line is said in plain words with the job linked.
+ - **Save these videos** on `/saved-videos` (`persist-videos`): one video per line (`slug/id` or a video page
+ link), quality, replace a taller one; Preview answers with the plan's buckets, Save starts one job per channel
+ and links each.
+
+| Commit | What |
+| --- | --- |
+| `632ec204` | editor: the option on Fetch missing evidence; `storedUrl` on the single fetch-window route (+ Retry); the UI's words in common |
+| `0e98e714` | mcp: `fetch_clip` takes `storedUrl` |
+| `93c9ee69` | umtool: the option beside every window fetch; `/api/cited/stored`; `fetch-via-editor.mjs --stored-url` |
+| `c7709fb0` | umtool: the Inbox's rows wrap under `sm`; `e2e/stored-url.spec.ts` and its fixture |
+| `f3b26188` | editor: channel-wide attach and playable copies, Save these videos |
+| (this commit) | `e2e/owed-ui.spec.ts`, this record, FACTS, CHANGELOG |
+
+## Gates (from the worktree root, every heavy step through the shared lock)
+
+- `pnpm -r --no-bail --workspace-concurrency=1 exec tsc --noEmit`: clean.
+- common: 4508 (4507 + 1 skipped) before and after (only constants added).
+- editor unit: 331 → 340, all pass (`api/media/fetch-window/route.storedUrl.test.ts` 5,
+ `saved-videos/lib/videoList.test.ts` 2, `channels/[slug]/lib/mediaToolsWords.test.ts` 2).
+- mcp: 377 → 378 (`fetchClip.test.ts` +1; the tool-schema test lists `storedUrl`).
+- umtool: 42 → 45 (`lib/clips/stored.test.ts` 2, `cited.test.ts` +1).
+- test:scripts: 1052 → 1053 (1049 + 4 skipped; `fetch-via-editor.test.mjs` +1).
+- `docs env --check`, `docs files --check`, `docs cli --check`, `settings example --check`: clean (no CLI row, ops
+ key, env or settings key changed).
+- e2e, umtool: `stored-url.spec.ts` 2/2 (with the before shots, 4/4 in 14.8 s); `inbox.spec.ts` 13/13 with the after
+ shots (15/15 in 22.4 s); on the final tree `stored-url.spec.ts` 2/2 with the 380/520/1366 shots (5/5 in 14.7 s).
+ The shots spec was a scratch file, not committed.
+- e2e, editor: `owed-ui.spec.ts` — run 1: 2 passed, 1 failed (the attach preview found no id: the spec's id was not
+ the eleven characters attach-media matches, and its archive was written outside the test corpus — both fixed in
+ the spec); run 2: **3/3 in 10.8 s**.
+
+## Decisions
+
+- **A person's tick asks `fallback`, never `only`.** Fallback asks the page first and uses the stored file only when
+ the platform refuses (or is held or cooling, when it goes straight to the file), so a tick on a platform that is
+ answering changes nothing. `only` stays for the CLI and the MCP.
+- **Offered per record, not per platform.** umtool asks whether the record stores a trusted URL (which implies an
+ allowlisted platform); the editor's batch offers it when the preview counted windows with one, or a refused group
+ is on an allowlisted platform. A Preview always asks with the mode — a dry run starts nothing — so R5's
+ "storedUrlItems only when a mode was asked" contract stands.
+- **The single window's fallback waits `CLIP_WINDOW_MIN_GAP_SECONDS`** (30 s; `E2E_CLIP_WINDOW_GAP_MS` in tests)
+ between the page's 429 and the stored-URL cut, the batch's least clip gap. The single route has no gap state of
+ its own; this is the "one stream, real gaps" rule for its one retry.
+- **The research reader got the option too** (not named in the brief, but it fetches windows): only when the cited
+ record is in the editor's own corpus and stores a URL.
+- **Bulk tools live with the store.** Channel-wide attach and playable copies are on the Cleanup stage beside
+ "Retention & persistence" (both write into, or beside, the saved-video store; the Download stage is hidden for a
+ channel with no URL, which is exactly the channel a local archive serves). The cross-channel persist list is on
+ `/saved-videos`.
+
+## Not done
+
+- No new video-page window fetch in the editor (there is none to put the option on; the batch and the single route
+ cover the paths).
+- The full editor and umtool suites (the orchestrator's).
+
+## Live after merge (the orchestrator)
+
+No data step is owed. Rebuild and restart both apps through their units; then smoke: `/sites/articles` → Preview
+missing evidence (an Odysee window with a stored URL shows the count and the option); an umtool article's evidence
+for an Odysee citation not on disk shows the option under Fetch clip; `/saved-videos` → Save these videos → Preview
+with one `slug/id`; a channel's Cleanup stage → Media for the whole channel → Preview playable copies; the Inbox at a
+phone width.