commit 0c677c785250a3f8b1db04163bcfad1277e80cf2
parent a4391ba7a74194d97d1492fc845d16dcc2baaf7c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 10 Nov 2026 11:20:35 -0500
Merge lane/needs-you: home is "What needs you" -- versions to judge, clips to walk, stale quote-checks, the X jar and new transcripts on live cases, each with its one-press fix in place; a Quick clip box with the word strip; Like / Maybe / No in Play (redesign L4)
- new Inbox sources (lib/inbox/versions, walk, checks, caseCues, xJar); unjudged or untouched over 14 days fold to Quiet
- presses in place: Snap the cut to the words, Run quote-check, Use embed ids (POST /api/report/links {fix} = umtool links --fix)
- Quick clip on home: a moment link or ch/vid@s-e, the word strip and nudges, render through the quick-clip job, the share line
- Play's version line: Like / Maybe / No (umtool takes verdict <p> <take> like|maybe|no|clear)
- one moment parser (lib/report/momentLink.mjs) for Quick clip and Add clip; YouTube ids starting "-" or "_" accepted from links, the spec passed after "--"
- the rail's Pinned (never stored) is gone; Running and Recent cuts are on home
- cross-site writes refused on the links, verdict, window, quick-clip and timeline routes (the rest: lane write-guard)
- takeManifest.mjs: E1's per-write tmp name kept (the same race fixed twice)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts:
# umtool/lib/report/takeManifest.mjs
Diffstat:
54 files changed, 2495 insertions(+), 178 deletions(-)
diff --git a/umtool/app/api/report/links/route.ts b/umtool/app/api/report/links/route.ts
@@ -2,8 +2,8 @@ import { projectRef } from "@/lib/projects";
import { readManifest } from "@/lib/projects/report.mjs";
import { linkVerdicts, readLinkCheck, runLinkCheck } from "@/lib/report/linkCheck.mjs";
import { refuseCaller } from "@/lib/report/caller";
-import { withEditNotes } from "@/lib/report/guard";
-import { updateClip } from "@/lib/report/manifest.mjs";
+import { crossSiteRefusal } from "@/lib/report/sameOrigin.mjs";
+import { applyLinkFixes } from "@/lib/report/linksCli.mjs";
export const dynamic = "force-dynamic";
@@ -17,7 +17,10 @@ export const dynamic = "force-dynamic";
// GET ?project=<id> the recorded check (out/links.json) read against the manifest as it is now
// POST { project, fix? } check now, record it, and answer the same; `fix`: first
// rewrite every dead link the last check knows the fix for
-// (a Twitch id the site serves as v<id>) through the window writer
+// (a Twitch id the site serves as v<id>; a Rumble folder id as the
+// embed id the archive serves, `siteVideo` -- "Use embed ids")
+// through the window writer, after one undo point (linksCli.mjs
+// applyLinkFixes, `umtool links <p> --fix`'s own)
const headers = { "cache-control": "no-store" };
async function answer(dir: string, doc: Awaited<ReturnType<typeof readLinkCheck>>) {
@@ -36,6 +39,9 @@ export async function GET(request: Request) {
export async function POST(request: Request) {
const refused = refuseCaller(request, "/api/report/links");
if (refused) return refused;
+ // Another site's page may not write here (lib/report/sameOrigin.mjs: Sec-Fetch-Site, Origin, a loopback Host).
+ const cross = crossSiteRefusal(request.headers);
+ if (cross) return Response.json({ error: cross }, { status: 403 });
const b = (await request.json().catch(() => null)) as { project?: unknown; fix?: unknown } | null;
if (!b || typeof b !== "object") return Response.json({ error: "bad json" }, { status: 400, headers });
const project = await projectRef(String(b.project ?? ""));
@@ -43,16 +49,10 @@ export async function POST(request: Request) {
let m = await readManifest(project.dir);
if (!m) return Response.json({ error: "the project has no video.manifest.json" }, { status: 400, headers });
try {
- const fixed: { clip: string; from: string; to: string }[] = [];
+ let fixed: { clip: string; from: string; to: string; siteVideo?: string }[] = [];
if (b.fix === true) {
- const last = await readLinkCheck(project.dir);
- const now = new Map(((m.timeline ?? []) as { id: string; citeUrl?: string }[]).map((e) => [e.id, e.citeUrl]));
- for (const l of last?.links ?? []) {
- // Only a link still exactly what the check saw: an edit since is somebody's decision.
- if (l.state !== "dead" || !l.fix || now.get(l.clip) !== l.url) continue;
- await withEditNotes(project, () => updateClip(project.dir, l.clip, { citeUrl: l.fix }));
- fixed.push({ clip: l.clip, from: l.url, to: l.fix });
- }
+ // Only a clip still as the recorded check saw it: an edit since is somebody's decision.
+ fixed = (await applyLinkFixes(project, m, await readLinkCheck(project.dir), { guard: true })).fixed;
if (fixed.length) m = await readManifest(project.dir);
}
const doc = await runLinkCheck(project.dir, m);
diff --git a/umtool/app/api/report/quick-clip/route.ts b/umtool/app/api/report/quick-clip/route.ts
@@ -1,6 +1,7 @@
import path from "node:path";
import { getJob, jobView, runningJob, startJob } from "@/lib/jobs";
import { refuseCaller } from "@/lib/report/caller";
+import { crossSiteRefusal } from "@/lib/report/sameOrigin.mjs";
import { UMTOOL_DIR } from "@/lib/report/driver.mjs";
import { quickClipSpec } from "@/lib/report/quickClip.mjs";
@@ -23,11 +24,14 @@ const SITE_RE = /^[a-z0-9][a-z0-9._-]*$/i;
export async function POST(request: Request) {
const refused = refuseCaller(request, "/api/report/quick-clip");
if (refused) return refused;
+ // Another site's page may not write here (lib/report/sameOrigin.mjs: Sec-Fetch-Site, Origin, a loopback Host).
+ const cross = crossSiteRefusal(request.headers);
+ if (cross) return Response.json({ error: cross }, { status: 403 });
const body = (await request.json().catch(() => null)) as Record<string, unknown> | null;
if (!body || typeof body !== "object") return Response.json({ error: "expected JSON" }, { status: 400, headers });
const spec = String(body.spec ?? "").trim();
if (!quickClipSpec(spec)) {
- return Response.json({ error: 'spec is <channel>/<video>@<start>-<end> in seconds, the end after the start, its ids neither "." nor starting "-"' }, { status: 400, headers });
+ return Response.json({ error: 'spec is <channel>/<video>@<start>-<end> in seconds, the end after the start, its ids not dots, the channel not starting "-", the video only when a YouTube id (11 characters)' }, { status: 400, headers });
}
const snap = body.snap === undefined || body.snap === null || body.snap === "" ? null : String(body.snap);
if (snap !== null && snap !== "words") return Response.json({ error: "snap is words, or nothing" }, { status: 400, headers });
@@ -37,8 +41,10 @@ export async function POST(request: Request) {
const running = runningJob();
if (running) return Response.json({ error: `a job is already running (${running.kind}) — make the clip when it is done`, running: jobView(running) }, { status: 409, headers });
const argv = [
- process.execPath, path.join(/* turbopackIgnore: true */ UMTOOL_DIR, "bin", "umtool.mjs"), "clip", spec,
+ process.execPath, path.join(/* turbopackIgnore: true */ UMTOOL_DIR, "bin", "umtool.mjs"), "clip",
...(snap ? ["--snap", snap] : []), ...(title ? ["--title", title] : []), ...(site ? ["--site", site] : []), "--progress", "ndjson",
+ // The spec after `--`: never read as a flag, whatever its ids (a YouTube id may start with `-`).
+ "--", spec,
];
const job = startJob(`quick clip ${spec}`, [{ cwd: UMTOOL_DIR, env: {}, label: `quick clip ${spec}${snap ? " (snapped to the words)" : ""}`, argv, ndjson: true, timeoutMs: 90 * 60_000 }]);
return Response.json({ ok: true, job: jobView(job) }, { status: 202, headers });
diff --git a/umtool/app/api/report/quick-clip/strip/route.ts b/umtool/app/api/report/quick-clip/strip/route.ts
@@ -0,0 +1,22 @@
+import { MomentError, quickClipStrip } from "@/lib/report/quickClipStrip.mjs";
+
+export const dynamic = "force-dynamic";
+
+// HOME'S QUICK CLIP BOX, before the render (umtool redesign L4; lib/report/quickClipStrip.mjs): a pasted moment
+// -- an archive, YouTube or Rumble link with its time, or `<channel>/<video>@<start>-<end>` -- found in the
+// corpus, its span, and the words around it to set the edges by. Reads only; the render is POST
+// /api/report/quick-clip.
+//
+// GET ?moment=<text> -> { spec, channel, video, start, end, from, to, words | null, cues | null, wordsFrom, title, duration }
+// | 400 { error } not a moment, or not in this corpus
+const headers = { "cache-control": "no-store" };
+
+export async function GET(request: Request) {
+ const moment = new URL(request.url).searchParams.get("moment") ?? "";
+ try {
+ return Response.json(await quickClipStrip(moment), { headers });
+ } catch (e) {
+ const status = e instanceof MomentError ? 400 : 500;
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status, headers });
+ }
+}
diff --git a/umtool/app/api/report/takes/verdict/route.ts b/umtool/app/api/report/takes/verdict/route.ts
@@ -1,5 +1,7 @@
import { projectRef } from "@/lib/projects";
import { isTakeId, listTakes, readVerdicts, setTakeVerdict } from "@/lib/report/takes.mjs";
+import { refuseCaller } from "@/lib/report/caller";
+import { crossSiteRefusal } from "@/lib/report/sameOrigin.mjs";
export const dynamic = "force-dynamic";
@@ -18,6 +20,11 @@ export async function GET(request: Request) {
}
export async function POST(request: Request) {
+ const refused = refuseCaller(request, "/api/report/takes/verdict");
+ if (refused) return refused;
+ // Another site's page may not write here (lib/report/sameOrigin.mjs: Sec-Fetch-Site, Origin, a loopback Host).
+ const cross = crossSiteRefusal(request.headers);
+ if (cross) return Response.json({ error: cross }, { status: 403 });
const body = (await request.json().catch(() => null)) as {
project?: string;
take?: string;
diff --git a/umtool/app/api/report/timeline/route.ts b/umtool/app/api/report/timeline/route.ts
@@ -1,5 +1,6 @@
import { invalidateProjects } from "@/lib/projects";
import { withEditNotes } from "@/lib/report/guard";
+import { crossSiteRefusal } from "@/lib/report/sameOrigin.mjs";
import {
StaleToken,
StructureRefused,
@@ -132,6 +133,9 @@ const atOf = (v: unknown) => (v === undefined || v === null || v === "" ? null :
export async function POST(request: Request) {
const refused = refuseCaller(request, "/api/report/timeline");
if (refused) return refused;
+ // Another site's page may not write here (lib/report/sameOrigin.mjs: Sec-Fetch-Site, Origin, a loopback Host).
+ const cross = crossSiteRefusal(request.headers);
+ if (cross) return Response.json({ error: cross }, { status: 403 });
let body: Body;
try {
body = await request.json();
diff --git a/umtool/app/api/report/window/route.ts b/umtool/app/api/report/window/route.ts
@@ -3,6 +3,7 @@ import { MarksOutside, StaleToken, updateClip } from "@/lib/report/manifest.mjs"
import { updateTakeClip } from "@/lib/report/takeEdit.mjs";
import { resolveClip } from "@/lib/report/serve.mjs";
import { refuseCaller } from "@/lib/report/caller";
+import { crossSiteRefusal } from "@/lib/report/sameOrigin.mjs";
export const dynamic = "force-dynamic";
@@ -19,6 +20,9 @@ export const dynamic = "force-dynamic";
export async function PUT(request: Request) {
const refused = refuseCaller(request, "/api/report/window");
if (refused) return refused;
+ // Another site's page may not write here (lib/report/sameOrigin.mjs: Sec-Fetch-Site, Origin, a loopback Host).
+ const cross = crossSiteRefusal(request.headers);
+ if (cross) return Response.json({ error: cross }, { status: 403 });
let body: Record<string, unknown>;
try {
body = await request.json();
diff --git a/umtool/app/page.tsx b/umtool/app/page.tsx
@@ -13,6 +13,10 @@ import { whatOf } from "@/lib/inbox/what.mjs";
import type { Decision } from "@/lib/decisions";
import type { LifecycleState } from "@/lib/lifecycle";
import { playHrefOfPiece } from "@/components/projects/playable";
+import QuickClip from "@/components/inbox/QuickClip";
+import RunningList from "@/components/shell/RunningList";
+import RecentCuts from "@/components/shell/RecentCuts";
+import { initialRunning } from "@/lib/activity";
export const dynamic = "force-dynamic";
@@ -25,7 +29,13 @@ export const dynamic = "force-dynamic";
// What the dashboard's panels were: a call became a card here (a tool the
// pipeline needs that is missing, a disk nearly full); the rest -- recent
// jobs, project states, sources, deliverables, tools and disk -- is on
-// /settings/system. What is running is in the rail.
+// /settings/system.
+//
+// WHAT NEEDS YOU (umtool redesign L4): beside the list, the Quick clip box (a
+// moment link to a basic mp4 and its share line, components/inbox/QuickClip.tsx),
+// what is Running and the Recent cuts -- the rail's, until the rail kept
+// navigation only. A card whose rows agree on a one-press settle (Use embed ids,
+// Run quote-check, Snap the cut to the words, Check links) presses it in place.
//
// `?from=<slug>/<id>` is the editor's "make a video" hand-off (VideoPanel,
// VideoNavStrip): redirects.mjs sends it to /create?from=… (P5) before this
@@ -44,13 +54,13 @@ async function machineCards(): Promise<InboxCard[]> {
return (await machineCalls()).map((m) => ({
key: `machine:${m.kind}`,
piece: null,
- title: "umtool",
+ title: m.title ?? "umtool",
kind: m.kind,
what: whatOf(m.kind),
why: m.why,
count: m.count,
severity: "blocking",
- action: { label: m.kind === "machine-tool" ? "Check tools" : "Open system", href: systemHref() },
+ action: m.action ?? { label: m.kind === "machine-tool" ? "Check tools" : "Open system", href: systemHref() },
lifecycle: "active" as const,
}));
}
@@ -71,6 +81,8 @@ function toCard(group: string, c: GroupCard, lifecycle: LifecycleState, muted =
lifecycle,
...(muted ? { muted } : {}),
finish: c.kind === "looks-done",
+ project: c.project,
+ settle: c.settle ?? null,
};
}
@@ -172,17 +184,26 @@ export default async function Inbox({
</p>
)}
- <div className="mb-1 mt-1 flex items-end gap-3.5" data-inbox-count={head.calls}>
- <span className="display text-[72px] font-[850] leading-[0.8]">{head.calls}</span>
- <span className="pb-0.5 text-[13px] text-text-2">
- {head.calls === 1 ? "call waiting on you" : "calls waiting on you"}
- <small className="block text-[12px] text-muted" data-inbox-note="">
- {headlineNote(head)}
- </small>
- </span>
- </div>
+ <div className="grid gap-x-6 gap-y-5 min-[1280px]:grid-cols-[minmax(0,1fr)_300px]">
+ <div className="min-w-0">
+ <div className="mb-1 mt-1 flex items-end gap-3.5" data-inbox-count={head.calls}>
+ <span className="display text-[72px] font-[850] leading-[0.8]">{head.calls}</span>
+ <span className="pb-0.5 text-[13px] text-text-2">
+ {head.calls === 1 ? "call waiting on you" : "calls waiting on you"}
+ <small className="block text-[12px] text-muted" data-inbox-note="">
+ {headlineNote(head)}
+ </small>
+ </span>
+ </div>
- <InboxList groups={all} />
+ <InboxList groups={all} />
+ </div>
+ <aside data-home-aside="" className="min-w-0 space-y-4 min-[1280px]:sticky min-[1280px]:top-4 min-[1280px]:self-start">
+ <QuickClip />
+ <RunningList initial={initialRunning()} />
+ <RecentCuts />
+ </aside>
+ </div>
</main>
<UndoBar />
</div>
diff --git a/umtool/components/inbox/InboxList.tsx b/umtool/components/inbox/InboxList.tsx
@@ -9,6 +9,8 @@ import { cn } from "@/lib/utils";
import { LifecycleButton, MuteButton, type LifecycleState } from "@/components/piece/Lifecycle";
import Menu from "@/components/piece/Menu";
import { PhoneOnly } from "@/components/shell/phone";
+import DecisionSettle from "@/components/projects/report/DecisionSettle";
+import type { Decision } from "@/lib/decisions";
// ---------------------------------------------------------------------------
// The Inbox's cards as ONE lit list (canvas "Inbox"): a group head, then a
@@ -45,6 +47,14 @@ export type InboxCard = {
finish?: boolean;
/** A report video's Play address (at the card's note), when the piece has one. */
play?: string | null;
+ /** The project the card's rows are about (its settle is pressed on it). */
+ project?: string;
+ /**
+ * ONE-CLICK (umtool redesign L4): the settle its rows agree on (lib/inbox/groups.mjs mergeSettle), pressed
+ * in place -- Use embed ids, Run quote-check, Snap the cut to the words, Check links -- through the
+ * routes the project page's Checks list presses (DecisionSettle). The card's title links where it is settled.
+ */
+ settle?: Decision["settle"] | null;
};
export type InboxGroup = {
@@ -117,6 +127,10 @@ export default function InboxList({ groups }: { groups: InboxGroup[] }) {
function Card({ card: c }: { card: InboxCard }) {
const parked = c.lifecycle !== "active";
+ // A research case's card (`c:`): cases have no lifecycle or mutes yet, so no Park or Mute.
+ const parkable = !!c.piece && !c.piece.startsWith("c:");
+ // Pressed in place only on an active, unmuted card: a hidden one's action is its way back.
+ const oneClick = !!(c.settle && c.project && !parked && !c.muted && !c.finish);
return (
<LitLine
id={c.key}
@@ -132,7 +146,15 @@ function Card({ card: c }: { card: InboxCard }) {
>
<div className="min-w-0 basis-full sm:basis-auto">
<b className="line-clamp-2 font-medium text-inherit sm:block sm:truncate" data-card-title="">
- {c.title} <span className="font-normal text-muted-2">·</span> {c.what}
+ {oneClick ? (
+ <Link href={c.action.href} prefetch={false} data-card-link="" className="text-inherit no-underline hover:underline" title={c.action.label}>
+ {c.title} <span className="font-normal text-muted-2">·</span> {c.what}
+ </Link>
+ ) : (
+ <>
+ {c.title} <span className="font-normal text-muted-2">·</span> {c.what}
+ </>
+ )}
</b>
<small className="line-clamp-2 text-[12px] text-muted-2 sm:block sm:truncate">{c.why}</small>
</div>
@@ -146,6 +168,10 @@ function Card({ card: c }: { card: InboxCard }) {
<LifecycleButton piece={c.piece} title={c.title} from={c.lifecycle} to="active" label="Reactivate" variant="outline" size="md" className="lit-go max-md:min-h-11" />
) : c.finish && c.piece ? (
<LifecycleButton piece={c.piece} title={c.title} from={c.lifecycle} to="done" label="Mark done" variant="outline" size="md" className="lit-go max-md:min-h-11" />
+ ) : oneClick && c.settle && c.project ? (
+ <span data-card-settle={c.settle.kind}>
+ <DecisionSettle project={c.project} settle={c.settle} size="md" className="lit-go max-md:min-h-11" />
+ </span>
) : (
<Link href={c.action.href} prefetch={false} data-action-link="" className={cn(buttonVariants({ variant: "outline", size: "md" }), "lit-go max-md:min-h-11")}>
{c.action.label}
@@ -158,14 +184,14 @@ function Card({ card: c }: { card: InboxCard }) {
)}
</span>
<LitActions className="ml-auto gap-0.5 sm:ml-0 max-md:hidden">
- {!parked && !c.muted && c.piece && (
+ {!parked && !c.muted && c.piece && parkable && (
<>
<LifecycleButton piece={c.piece} title={c.title} from={c.lifecycle} to="parked" label="Park" />
<MuteButton piece={c.piece} kind={c.kind} title={c.title} muted={false} label={c.finish ? "Not yet" : "Mute"} />
</>
)}
</LitActions>
- {!parked && !c.muted && c.piece && (
+ {!parked && !c.muted && c.piece && parkable && (
<PhoneOnly>
<Menu
data-inbox-more={c.key}
diff --git a/umtool/components/inbox/QuickClip.tsx b/umtool/components/inbox/QuickClip.tsx
@@ -0,0 +1,238 @@
+"use client";
+
+import Link from "next/link";
+import { useEffect, useRef, useState } from "react";
+import WordStrip from "@/components/projects/bench/WordStrip";
+import CopyShareLine from "@/components/projects/CopyShareLine";
+import { buttonVariants } from "@/components/ui/button";
+import { ingredientHref, takesHref } from "@/lib/hrefs";
+import { cn } from "@/lib/utils";
+
+// ---------------------------------------------------------------------------
+// QUICK CLIP, ON HOME (umtool redesign L4; L1's `umtool clip`): paste a moment
+// -- an archive, YouTube or Rumble link with its time, or
+// `<channel>/<video>@<start>-<end>` -- and it is found in the corpus with the
+// words around it (GET /api/report/quick-clip/strip); set the edges on the
+// word strip (a click starts there, shift-click ends there) or nudge them;
+// Render runs `umtool clip` as one job (POST /api/report/quick-clip: the window
+// asked of the editor, rendered basic, the heavy slot); then the share line,
+// copied (the take panel's Copy share line). The terminal twin:
+// `umtool clip <channel>/<video>@<start>-<end> [--snap words]`.
+// ---------------------------------------------------------------------------
+
+type Strip = {
+ spec: string;
+ channel: string;
+ video: string;
+ start: number;
+ end: number;
+ from: number;
+ to: number;
+ words: { w: string; start: number; end?: number }[] | null;
+ cues: { start: number; end: number; text: string }[] | null;
+ wordsFrom: string | null;
+ title: string | null;
+};
+type Done = { project: string; output: string; share: { platform: string | null; archive: string | null; text: string } };
+type Run = { id: string; state: string; log: string[] };
+
+const r2 = (x: number) => Math.round(x * 100) / 100;
+const clock = (s: number) => {
+ const h = Math.floor(s / 3600);
+ const m = Math.floor((s % 3600) / 60);
+ const ss = (s % 60).toFixed(2).padStart(5, "0");
+ return h ? `${h}:${String(m).padStart(2, "0")}:${ss}` : `${m}:${ss}`;
+};
+const NUDGES = [-0.5, -0.1, 0.1, 0.5];
+
+export default function QuickClip() {
+ const [text, setText] = useState("");
+ const [strip, setStrip] = useState<Strip | null>(null);
+ const [cut, setCut] = useState<{ cutStart: number; cutEnd: number } | null>(null);
+ const [snap, setSnap] = useState(false);
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const [run, setRun] = useState<Run | null>(null);
+ const [done, setDone] = useState<Done | null>(null);
+ const timer = useRef<number | null>(null);
+
+ useEffect(() => () => {
+ if (timer.current) window.clearTimeout(timer.current);
+ }, []);
+
+ const find = async () => {
+ setBusy(true);
+ setError(null);
+ setDone(null);
+ setRun(null);
+ try {
+ const r = await fetch(`/api/report/quick-clip/strip?moment=${encodeURIComponent(text.trim())}`, { cache: "no-store" });
+ const j = (await r.json().catch(() => ({}))) as Strip & { error?: string };
+ if (!r.ok) throw new Error(j.error ?? `HTTP ${r.status}`);
+ setStrip(j);
+ setCut({ cutStart: j.start, cutEnd: j.end });
+ } catch (e) {
+ setStrip(null);
+ setCut(null);
+ setError(e instanceof Error ? e.message : String(e));
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ const nudge = (edge: "cutStart" | "cutEnd", d: number) =>
+ setCut((c) => {
+ if (!c) return c;
+ const next = { ...c, [edge]: r2(Math.max(0, c[edge] + d)) };
+ return next.cutEnd - next.cutStart >= 0.2 ? next : c;
+ });
+
+ const onWord = (w: { start: number; end: number | null }, shift: boolean) =>
+ setCut((c) => {
+ if (!c) return c;
+ if (shift) {
+ const end = r2(w.end ?? w.start + 0.4);
+ return end > c.cutStart + 0.2 ? { ...c, cutEnd: end } : c;
+ }
+ const start = r2(w.start);
+ return start < c.cutEnd - 0.2 ? { ...c, cutStart: start } : { cutStart: start, cutEnd: r2(start + Math.max(1, c.cutEnd - c.cutStart)) };
+ });
+
+ const spec = strip && cut ? `${strip.channel}/${strip.video}@${cut.cutStart}-${cut.cutEnd}` : null;
+
+ const poll = (id: string) => {
+ timer.current = window.setTimeout(async () => {
+ try {
+ const r = await fetch(`/api/report/quick-clip?job=${encodeURIComponent(id)}`, { cache: "no-store" });
+ const j = (await r.json().catch(() => ({}))) as { job?: Run; done?: Done; error?: string };
+ if (j.job) setRun(j.job);
+ if (j.done) {
+ setDone(j.done);
+ setBusy(false);
+ return;
+ }
+ if (j.error || (j.job && j.job.state !== "running" && j.job.state !== "queued")) {
+ setError(j.error ?? `the quick clip ended ${j.job?.state ?? "badly"}`);
+ setBusy(false);
+ return;
+ }
+ } catch {
+ // asked again on the next tick
+ }
+ poll(id);
+ }, 1500);
+ };
+
+ const render = async () => {
+ if (!spec) return;
+ setBusy(true);
+ setError(null);
+ setDone(null);
+ try {
+ const r = await fetch("/api/report/quick-clip", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ spec, ...(snap ? { snap: "words" } : {}) }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { job?: Run; error?: string };
+ if (!r.ok || !j.job) throw new Error(j.error ?? `HTTP ${r.status}`);
+ setRun(j.job);
+ poll(j.job.id);
+ } catch (e) {
+ setError(e instanceof Error ? e.message : String(e));
+ setBusy(false);
+ }
+ };
+
+ const state = done ? "done" : run ? run.state : strip ? "ready" : "idle";
+ return (
+ <section data-quick-clip={state} aria-label="Quick clip" className="rounded-[4px] border border-seam bg-panel p-3">
+ <h2 className="micro mb-2">Quick clip</h2>
+ <form
+ className="flex gap-1.5"
+ onSubmit={(e) => {
+ e.preventDefault();
+ if (text.trim()) void find();
+ }}
+ >
+ <input
+ data-quick-clip-input=""
+ value={text}
+ onChange={(e) => setText(e.target.value)}
+ placeholder="a moment link, or channel/video@start-end"
+ aria-label="a moment link, or channel/video@start-end"
+ className="min-w-0 flex-1 rounded-[3px] border border-seam bg-bg px-2 py-1 font-mono text-[12px] text-text"
+ />
+ <button type="submit" data-quick-clip-find="" disabled={busy || !text.trim()} className={buttonVariants({ variant: "outline", size: "sm" })}>
+ Find
+ </button>
+ </form>
+
+ {strip && cut && (
+ <div className="mt-2.5 space-y-2" data-quick-clip-strip={strip.spec}>
+ <p className="m-0 truncate text-[12px] text-text-2" title={strip.title ?? undefined}>
+ {/* The recording's life cycle (lane L5's rail): where it is downloaded, transcribed, cut and cited. */}
+ <Link href={ingredientHref(strip.channel, strip.video)} prefetch={false} data-quick-clip-ingredient="" className="font-mono text-muted no-underline hover:underline" title="its life cycle">
+ {strip.channel}/{strip.video}
+ </Link>
+ {strip.title ? ` · ${strip.title}` : ""}
+ </p>
+ <WordStrip hood={{ words: strip.words, cues: strip.cues }} cut={cut} playhead={null} onSeek={() => {}} onWord={onWord} className="max-h-[7.5em] text-[12.5px]" />
+ <p className="m-0 text-[11px] text-muted-2">a word: start there · shift-click: end there ({strip.wordsFrom === "cues" ? "the cues" : (strip.wordsFrom ?? "no words")})</p>
+ {(["cutStart", "cutEnd"] as const).map((edge) => (
+ <div key={edge} className="flex items-center gap-1 text-[12px]" data-quick-clip-edge={edge === "cutStart" ? "start" : "end"}>
+ <span className="w-9 text-muted">{edge === "cutStart" ? "start" : "end"}</span>
+ {NUDGES.map((d) => (
+ <button
+ key={d}
+ type="button"
+ data-quick-clip-nudge={`${edge === "cutStart" ? "start" : "end"}:${d}`}
+ onClick={() => nudge(edge, d)}
+ disabled={busy}
+ className={cn(buttonVariants({ variant: "quiet", size: "sm" }), "px-1.5 font-mono")}
+ >
+ {d > 0 ? `+${d}` : d}
+ </button>
+ ))}
+ <span className="ml-auto font-mono text-text" data-quick-clip-at={cut[edge]}>
+ {clock(cut[edge])}
+ </span>
+ </div>
+ ))}
+ <div className="flex flex-wrap items-center gap-2">
+ <button type="button" data-quick-clip-render="" disabled={busy} onClick={() => void render()} className={buttonVariants({ variant: "go", size: "sm" })}>
+ {busy && run ? "Rendering…" : `Render ${(cut.cutEnd - cut.cutStart).toFixed(1)} s`}
+ </button>
+ <label className="flex items-center gap-1 text-[11.5px] text-text-2" title="snap the edges to the words heard there (the editor transcribes the window)">
+ <input type="checkbox" data-quick-clip-snap="" checked={snap} onChange={(e) => setSnap(e.target.checked)} disabled={busy} />
+ snap to the words
+ </label>
+ </div>
+ <p className="m-0 break-all font-mono text-[11px] text-muted-2" data-quick-clip-spec={spec ?? ""}>
+ umtool clip {spec}
+ {snap ? " --snap words" : ""}
+ </p>
+ </div>
+ )}
+
+ {run && !done && (
+ <p className="m-0 mt-2 truncate font-mono text-[11px] text-text-2" data-quick-clip-progress="" title={run.log.join("\n")}>
+ {run.log[run.log.length - 1] ?? run.state}
+ </p>
+ )}
+ {done && (
+ <div className="mt-2 space-y-1" data-quick-clip-done={done.project}>
+ <CopyShareLine project={done.project} take="clip" testid="quick-clip" />
+ <Link href={takesHref(done.project)} prefetch={false} className="ink-link text-[12px]">
+ the render ({done.project})
+ </Link>
+ </div>
+ )}
+ {error && (
+ <p role="alert" data-quick-clip-error="" className="m-0 mt-2 text-[12px] text-reject-text">
+ {error}
+ </p>
+ )}
+ </section>
+ );
+}
diff --git a/umtool/components/projects/AddClip.tsx b/umtool/components/projects/AddClip.tsx
@@ -6,6 +6,7 @@ import { buttonVariants } from "@/components/ui/button";
import { newClipEntry, quoteFromCues } from "@/lib/report/clipEditorModel.mjs";
import { cn } from "@/lib/utils";
import { announceManifestChanged, refusalOf, timelineOp, type TimelineResult } from "./timelineApi";
+import { parseMomentInput, parseTime as parseTimeOf } from "@/lib/report/momentLink.mjs";
// ---------------------------------------------------------------------------
// ADD A CLIP, AS ONE FLOW (lane/ui-simplify, 5 Nov; the operator: "adding new
@@ -41,41 +42,17 @@ const clock = (s: number) => {
return h ? `${h}:${String(m).padStart(2, "0")}:${String(sec).padStart(2, "0")}` : `${m}:${String(sec).padStart(2, "0")}`;
};
-/** `1:02:32`, `62m32s`, `3752`, `1h2m32s` → seconds; null when it is not a time. */
-export function parseTime(v: string | null | undefined): number | null {
- const s = String(v ?? "").trim();
- if (!s) return null;
- if (/^\d+(\.\d+)?s?$/.test(s)) return Number(s.replace(/s$/, ""));
- const hms = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?$/.exec(s);
- if (hms && (hms[1] || hms[2] || hms[3])) return Number(hms[1] ?? 0) * 3600 + Number(hms[2] ?? 0) * 60 + Number(hms[3] ?? 0);
- const parts = s.split(":").map(Number);
- if (parts.length >= 2 && parts.length <= 3 && parts.every((n) => Number.isFinite(n))) return parts.reduce((a, n) => a * 60 + n, 0);
- return null;
-}
+/** `1:02:32`, `62m32s`, `3752`, `1h2m32s` → seconds; null when it is not a time (lib/report/momentLink.mjs). */
+export const parseTime = parseTimeOf as (v: string | null | undefined) => number | null;
-/** A pasted link or a short form → `{ video, t, channel? }`: a YouTube link (`v=`, youtu.be, /live/, /shorts/) with t= or start=, `<channel>/<video>@<time>`, `<video>@<time>`. */
+/**
+ * A pasted link or a short form → `{ video, t, channel? }` (lib/report/momentLink.mjs, home's Quick clip box's
+ * parser too): a YouTube link (`v=`, youtu.be, /live/, /shorts/) with t= or start=, an archive's moment link, a
+ * Rumble link, `<channel>/<video>@<time>` or `@<start>-<end>`, `<video>@<time>`.
+ */
export function parseMomentLink(raw: string): { video: string; t: number; channel: string | null } | null {
- const s = raw.trim();
- const short = /^(?:([A-Za-z0-9][A-Za-z0-9._-]*)\/)?([A-Za-z0-9_-]{2,})@([0-9:hms.]+)$/.exec(s);
- if (short) {
- const t = parseTime(short[3]);
- return t === null ? null : { channel: short[1] ?? null, video: short[2], t };
- }
- let u: URL;
- try {
- u = new URL(/^https?:\/\//.test(s) ? s : `https://${s}`);
- } catch {
- return null;
- }
- let video: string | null = u.searchParams.get("v");
- if (!video && /youtu\.be$/.test(u.hostname)) video = u.pathname.slice(1).split("/")[0] || null;
- if (!video) {
- const m = /\/(?:live|shorts|embed|v)\/([A-Za-z0-9_-]{6,})/.exec(u.pathname);
- video = m ? m[1] : null;
- }
- if (!video) return null;
- const t = parseTime(u.searchParams.get("t") ?? u.searchParams.get("start") ?? (u.hash.match(/t=([0-9hms:.]+)/)?.[1] ?? "0")) ?? 0;
- return { video, t, channel: null };
+ const m = parseMomentInput(raw);
+ return m ? { video: m.video, t: m.start, channel: m.channel } : null;
}
/** Where a clip of `date` goes in a cut in date order: after the last dated entry on or before it; null when the cut is not in date order. */
diff --git a/umtool/components/projects/bench/WordStrip.tsx b/umtool/components/projects/bench/WordStrip.tsx
@@ -0,0 +1,62 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+
+// ---------------------------------------------------------------------------
+// THE WORD STRIP: a span's words as text -- the cut's lit, the one playing
+// marked, a click seeks there (`onSeek`); the clip editor's, and home's Quick
+// clip box's (umtool redesign L4). Timed words when the corpus has them (a
+// words sidecar, a whisper transcript, the captions' word starts), else the
+// cues. `onWord` (the Quick clip box): a click on a word sets an edge instead.
+// ---------------------------------------------------------------------------
+
+export type StripSource = {
+ words?: { w: string; start: number; end?: number }[] | null;
+ cues?: { start: number; end: number; text: string }[] | null;
+} | null;
+
+export default function WordStrip({
+ hood,
+ cut,
+ playhead,
+ onSeek,
+ onWord,
+ className,
+}: {
+ hood: StripSource;
+ cut: { cutStart: number; cutEnd: number };
+ playhead: number | null;
+ onSeek: (t: number) => void;
+ /** A click on a word, with shift held or not (the Quick clip box: start at it, shift: end after it). */
+ onWord?: (w: { start: number; end: number | null }, shift: boolean) => void;
+ className?: string;
+}) {
+ if (!hood) return <p className="m-0 text-[12px] text-muted">reading the words…</p>;
+ const list = hood.words?.length ? hood.words.map((w) => ({ text: w.w, start: w.start, end: w.end ?? null })) : (hood.cues ?? []).map((c) => ({ text: c.text, start: c.start, end: c.end as number | null }));
+ if (!list.length) return <p className="m-0 text-[12px] text-muted">No words or cues for this span.</p>;
+ return (
+ <p data-editor-words={hood.words?.length ? "words" : "cues"} className={cn("m-0 max-h-[9.5em] overflow-auto text-[13px] leading-relaxed text-muted", className)}>
+ {list.map((w, i) => {
+ const end = w.end ?? list[i + 1]?.start ?? w.start;
+ const mid = (w.start + end) / 2;
+ const inCut = mid >= cut.cutStart && mid <= cut.cutEnd;
+ const now = playhead !== null && playhead >= w.start && playhead < end;
+ return (
+ <span key={i}>
+ <button
+ type="button"
+ data-word={i}
+ data-word-t={w.start}
+ data-in-cut={inCut ? "" : undefined}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={(e) => (onWord ? onWord({ start: w.start, end: w.end }, e.shiftKey) : onSeek(w.start))}
+ className={cn("rounded-[2px] px-[1px] hover:bg-panel-2", inCut && "text-text", now && "bg-[color-mix(in_srgb,var(--signal)_30%,transparent)]")}
+ >
+ {w.text}
+ </button>{" "}
+ </span>
+ );
+ })}
+ </p>
+ );
+}
diff --git a/umtool/components/projects/report/DecisionSettle.tsx b/umtool/components/projects/report/DecisionSettle.tsx
@@ -3,22 +3,32 @@
import { useState } from "react";
import { useRouter } from "next/navigation";
import { buttonVariants } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
import type { Decision } from "@/lib/decisions";
// The one-press settle beside a check row (lib/projects/report.mjs `settle`):
// a clip patch through the window writer -- "It's deliberate: b repeats a"
// (repeatOf), "Move to 12:34" (the clock and the QR back on the clip) -- or a
-// link check against the sites the QRs open. The row's `fix` is the same
-// thing from a terminal; nothing here needs a model.
+// link check against the sites the QRs open (with `fix`: the dead links whose
+// fix is known rewritten first -- a Twitch id as v<id>, a Rumble folder id as
+// its embed id, "Use embed ids"), or a quote check on the durable queue (POST
+// /api/cli, the registry's `quote-check` row: it transcribes through the
+// editor, so it queues). The row's `fix` is the same thing from a terminal;
+// nothing here needs a model. The Inbox's cards press the same buttons (L4).
export default function DecisionSettle({
project,
settle,
token = null,
+ size = "sm",
+ className,
}: {
project: string;
settle: NonNullable<Decision["settle"]>;
token?: string | null;
+ /** The Inbox's card draws it as its primary action: `md`, lit. */
+ size?: "sm" | "md";
+ className?: string;
}) {
const router = useRouter();
const [busy, setBusy] = useState(false);
@@ -42,6 +52,12 @@ export default function DecisionSettle({
headers: { "content-type": "application/json" },
body: JSON.stringify({ project, file: settle.file }),
})
+ : settle.kind === "quote-check"
+ ? await fetch("/api/cli", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ verb: "quote-check", values: { project, "--clips": settle.clips.join(",") } }),
+ })
: settle.kind === "publish-site"
? await fetch("/api/report/publish-site", {
method: "POST",
@@ -60,6 +76,7 @@ export default function DecisionSettle({
notes?: string[];
left?: { label: string | null; after: string }[];
jobId?: string | null;
+ queued?: { qid: string } | null;
};
if (!r.ok) {
setErr(j.error ?? `HTTP ${r.status}`);
@@ -75,6 +92,10 @@ export default function DecisionSettle({
`${moved} marker${moved === 1 ? "" : "s"} moved` +
(left.length ? ` · left by hand: ${left.map((l) => `${l.label ? `"${l.label}"` : "a marker"} after ${l.after}`).join(", ")}` : ""),
);
+ } else if (settle.kind === "quote-check") {
+ // The queue runs it (the editor transcribes each clip); the row goes once the check is current.
+ setSaid(`queued${j.queued?.qid ? ` as ${j.queued.qid}` : ""} — ${settle.clips.length} clip${settle.clips.length === 1 ? "" : "s"}; see /jobs`);
+ return;
} else if (settle.kind === "publish-site") {
// The editor's publish queue runs it; nothing here changes until the deploy lands and a check reads it.
setSaid(`queued on the editor's publish queue${j.jobId ? ` (job ${j.jobId})` : ""} — Check links once it is deployed`);
@@ -89,13 +110,13 @@ export default function DecisionSettle({
};
return (
- <span className="inline-flex items-center gap-2" data-settle={settle.kind}>
+ <span className="inline-flex flex-wrap items-center gap-x-2 gap-y-1" data-settle={settle.kind}>
<button
type="button"
- data-settle-button={settle.kind === "patch" ? settle.clip : settle.kind === "patch-markers" ? settle.file : settle.kind === "publish-site" ? `publish-${settle.siteId}` : "links"}
+ data-settle-button={settle.kind === "patch" ? settle.clip : settle.kind === "patch-markers" ? settle.file : settle.kind === "publish-site" ? `publish-${settle.siteId}` : settle.kind === "quote-check" ? "quote-check" : "links"}
disabled={busy}
onClick={() => void run()}
- className={buttonVariants({ variant: settle.kind === "patch" ? "go" : "outline", size: "sm" })}
+ className={cn(buttonVariants({ variant: settle.kind === "patch" ? "go" : "outline", size }), className)}
title={
settle.kind === "patch"
? `writes ${Object.keys(settle.patch).join(", ")} on ${settle.clip} through the window writer`
@@ -103,10 +124,14 @@ export default function DecisionSettle({
? `each marker of ${settle.file} after a clip that is gone takes the cut's marker of the same label`
: settle.kind === "publish-site"
? `asks the editor to build and deploy ${settle.siteId} (its publish queue, through the heavy slot)`
- : "resolves every clip QR against the site it links (corpus.json → the shard's record), one request at a time per host"
+ : settle.kind === "quote-check"
+ ? `umtool quote-check --clips ${settle.clips.join(",")} on the durable queue: the editor transcribes what each clip plays and its quote is found in it`
+ : settle.fix
+ ? "rewrites each dead link whose fix the last check knows (a Rumble folder id → its embed id, a Twitch id → v<id>) through the window writer, then checks again"
+ : "resolves every clip QR against the site it links (corpus.json → the shard's record), one request at a time per host"
}
>
- {busy ? (settle.kind === "check-links" ? "Checking…" : settle.kind === "publish-site" ? "Asking the editor…" : "Saving…") : settle.label}
+ {busy ? (settle.kind === "check-links" ? "Checking…" : settle.kind === "publish-site" ? "Asking the editor…" : settle.kind === "quote-check" ? "Queueing…" : "Saving…") : settle.label}
</button>
{said && !err && (
<span data-settle-said="" className="text-[11.5px] text-text-2">
diff --git a/umtool/components/projects/review/ClipEditor.tsx b/umtool/components/projects/review/ClipEditor.tsx
@@ -21,6 +21,7 @@ import LiveDeckPreview from "./LiveDeckPreview";
// Release 36 lane D: the assistant's labels, Suggest, Ask and Apply (all optional).
import type { ReplyProposal } from "@/lib/annotations/types";
import { proposalWords, ReplyProposalRow, SuggestLabel, SuggestPanel, SuggestWhy, useClipSuggest, type ClipSuggest } from "./ClipSuggest";
+import WordStrip from "../bench/WordStrip";
// ---------------------------------------------------------------------------
// THE CLIP EDITOR (release 35 C2): a person hops in on an assistant's clips.
@@ -1263,36 +1264,8 @@ function Strip({
);
}
-/** The words of the neighbourhood as text: the cut's lit, the one playing marked; a click seeks there. */
-function Words({ hood, cut, playhead, onSeek }: { hood: Neighbourhood | null; cut: Cut; playhead: number | null; onSeek: (t: number) => void }) {
- if (!hood) return <p className="m-0 text-[12px] text-muted">reading the words…</p>;
- const list = hood.words?.length ? hood.words.map((w) => ({ text: w.w, start: w.start, end: w.end })) : (hood.cues ?? []).map((c) => ({ text: c.text, start: c.start, end: c.end }));
- if (!list.length) return <p className="m-0 text-[12px] text-muted">No words or cues for this span.</p>;
- return (
- <p data-editor-words={hood.words?.length ? "words" : "cues"} className="m-0 max-h-[9.5em] overflow-auto text-[13px] leading-relaxed text-muted">
- {list.map((w, i) => {
- const mid = (w.start + w.end) / 2;
- const inCut = mid >= cut.cutStart && mid <= cut.cutEnd;
- const now = playhead !== null && playhead >= w.start && playhead < w.end;
- return (
- <span key={i}>
- <button
- type="button"
- data-word={i}
- data-word-t={w.start}
- data-in-cut={inCut ? "" : undefined}
- onMouseDown={(e) => e.preventDefault()}
- onClick={() => onSeek(w.start)}
- className={cn("rounded-[2px] px-[1px] hover:bg-panel-2", inCut && "text-text", now && "bg-[color-mix(in_srgb,var(--signal)_30%,transparent)]")}
- >
- {w.text}
- </button>{" "}
- </span>
- );
- })}
- </p>
- );
-}
+/** The words of the neighbourhood as text: the cut's lit, the one playing marked; a click seeks there (bench/WordStrip.tsx). */
+const Words = WordStrip;
function EdgeControl({ edge, value, onNudge, onSet, onPlayhead }: { edge: "in" | "out"; value: number; onNudge: (d: number) => void; onSet: (v: number) => void; onPlayhead: (() => void) | null }) {
const [text, setText] = useState(String(value));
diff --git a/umtool/components/projects/review/PlayCut.tsx b/umtool/components/projects/review/PlayCut.tsx
@@ -41,6 +41,7 @@ import { useIntroPage } from "./useIntroPage";
import { videoStageAt, type VideoEntryPlay } from "@/lib/report/playVideo.mjs";
import ComboBadge, { type ComboInfo } from "./ComboBadge";
import CopyShareLine from "../CopyShareLine";
+import VersionVerdict from "./VersionVerdict";
import { StillButton } from "../inspector/StillInspector";
// ---------------------------------------------------------------------------
@@ -1218,6 +1219,8 @@ export default function PlayCut({
Watch render
</a>
)}
+ {/* Play and judge (L4): a rendered version's verdict, where it is watched. */}
+ {view.take.made && <VersionVerdict project={project} take={view.take.id} />}
</p>
) : (
<p className="m-0 border-b border-seam px-4 py-1 text-[11.5px] text-text-2 max-md:-mx-4 max-md:-mt-3" data-play-take="" data-play-draft-note="">
diff --git a/umtool/components/projects/review/VersionVerdict.tsx b/umtool/components/projects/review/VersionVerdict.tsx
@@ -0,0 +1,82 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { buttonVariants } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+
+// ---------------------------------------------------------------------------
+// PLAY AND JUDGE (umtool redesign L4, "What needs you"): a rendered version
+// played in Play (`?take=`) is judged where it is watched -- Like · Maybe · No,
+// the Takes page's three verdicts, written through the same route (POST
+// /api/report/takes/verdict, takes/verdicts.json); pressing the lit one clears
+// it. The Inbox's "versions to judge" card opens here, and judging drops it.
+// Its terminal twin: `umtool takes verdict <p> <take> like|maybe|no|clear`.
+// ---------------------------------------------------------------------------
+
+const VERDICTS = [
+ { id: "like", label: "Like" },
+ { id: "maybe", label: "Maybe" },
+ { id: "no", label: "No" },
+] as const;
+type Verdict = (typeof VERDICTS)[number]["id"];
+
+export default function VersionVerdict({ project, take }: { project: string; take: string }) {
+ const [verdict, setVerdict] = useState<Verdict | null | undefined>(undefined);
+ const [busy, setBusy] = useState(false);
+ const [err, setErr] = useState<string | null>(null);
+
+ useEffect(() => {
+ let live = true;
+ void fetch(`/api/report/takes/verdict?project=${encodeURIComponent(project)}`, { cache: "no-store" })
+ .then((r) => r.json())
+ .then((j: { verdicts?: Record<string, { verdict?: Verdict | null }> }) => live && setVerdict(j.verdicts?.[take]?.verdict ?? null))
+ .catch(() => live && setVerdict(null));
+ return () => {
+ live = false;
+ };
+ }, [project, take]);
+
+ const judge = async (v: Verdict) => {
+ const next = verdict === v ? null : v;
+ setBusy(true);
+ setErr(null);
+ try {
+ const r = await fetch("/api/report/takes/verdict", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, take, verdict: next }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { error?: string };
+ if (!r.ok) throw new Error(j.error ?? `HTTP ${r.status}`);
+ setVerdict(next);
+ } catch (e) {
+ setErr(e instanceof Error ? e.message : String(e));
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ return (
+ <span className="inline-flex flex-wrap items-center gap-1" data-play-verdict={verdict ?? ""} role="group" aria-label={`judge ${take}`}>
+ {VERDICTS.map((v) => (
+ <button
+ key={v.id}
+ type="button"
+ data-play-verdict-button={v.id}
+ aria-pressed={verdict === v.id}
+ disabled={busy || verdict === undefined}
+ onClick={() => void judge(v.id)}
+ title={verdict === v.id ? `clear the verdict on ${take}` : `${v.label}: ${take}'s verdict (takes/verdicts.json)`}
+ className={cn(buttonVariants({ variant: verdict === v.id ? "go" : "outline", size: "sm" }))}
+ >
+ {v.label}
+ </button>
+ ))}
+ {err && (
+ <span data-play-verdict-error="" className="text-[11.5px] text-doubt-text">
+ {err}
+ </span>
+ )}
+ </span>
+ );
+}
diff --git a/umtool/components/shell/AppRail.tsx b/umtool/components/shell/AppRail.tsx
@@ -1,34 +1,27 @@
import Link from "next/link";
import { cookies } from "next/headers";
import AppNav, { placeOf } from "@/components/AppNav";
-import { initialRunning } from "@/lib/activity";
import { homeHref } from "@/lib/hrefs";
import { THEME_COOKIE, parseTheme } from "@/lib/theme";
import CreateMenu from "./CreateMenu";
import JumpButton from "./JumpButton";
import PhoneDock from "./PhoneDock";
-import RunningList from "./RunningList";
-import RecentCuts from "./RecentCuts";
import ThemeControl from "./ThemeControl";
import { Mark, Wordmark } from "./Wordmark";
// ---------------------------------------------------------------------------
// The rail (canvas `.rail`): every page's left column. Top to bottom:
// the mark and the wordmark (home), the places (Inbox · Research · Work ·
-// Tools · Settings, components/AppNav.tsx), + Create, Jump to… ⌘K, Pinned,
-// and at the foot what is Running and the theme.
+// Tools · Settings, components/AppNav.tsx), + Create, Jump to… ⌘K, and at
+// the foot the theme. NAVIGATION ONLY (the redesign's L4): what is Running
+// and the Recent cuts are on home, beside the Inbox; Pinned, which never had
+// a store, is gone.
//
-// SERVER ONLY: it reads the theme cookie and the in-process job registries.
+// SERVER ONLY: it reads the theme cookie.
// A client page (the song deck) gets it from its server page instead.
//
// Jump (⌘K) opens the palette (JumpPalette.tsx, in the root layout).
//
-// What is not built yet says so plainly rather than pretending:
-// - Pinned has no store until the piece page (P4a); it is empty.
-// - Running (RunningList.tsx) is umtool's own jobs and the editor's live ones
-// with spend (lib/activity.ts readRunning, P2b). The server draws the last
-// view it has, never waiting on the editor; the browser asks after load.
-//
// On a phone (below md) the rail is not drawn and the PHONE DOCK, rendered
// here beside it, carries the places at the foot of the screen (PhoneDock.tsx).
// ---------------------------------------------------------------------------
@@ -49,16 +42,7 @@ export default async function AppRail({ active }: { active: string }) {
<JumpButton />
- <section data-rail-section="pins" aria-label="Pinned">
- <h2 className="micro px-5 pb-1.5 pt-4">Pinned</h2>
- <p className="px-5 text-[12px] text-muted-2">Nothing pinned</p>
- </section>
-
- <RecentCuts />
-
- <RunningList initial={initialRunning()} />
-
- <div data-rail-section="theme" className="px-4 pb-4 pt-3">
+ <div data-rail-section="theme" className="mt-auto px-4 pb-4 pt-3">
<ThemeControl initial={theme} />
</div>
</div>
diff --git a/umtool/components/shell/RecentCuts.tsx b/umtool/components/shell/RecentCuts.tsx
@@ -7,9 +7,10 @@ import Link from "next/link";
import { projectHref } from "@/lib/hrefs";
// ---------------------------------------------------------------------------
-// THE RAIL'S RECENT CUTS (lane/ui-simplify, 5 Nov): the last report videos this
+// RECENT CUTS, ON HOME (lane/ui-simplify, 5 Nov; the rail's until the
+// redesign's L4 left the rail navigation only): the last report videos this
// viewer opened, each with ▶ Play (the newest take) -- so Play is one click from
-// any page. A per-viewer convenience, so localStorage (wrapped: a private
+// home. A per-viewer convenience, so localStorage (wrapped: a private
// window or blocked storage just shows nothing); <RememberCut> on a project's
// page and on Play writes it.
// ---------------------------------------------------------------------------
@@ -58,11 +59,11 @@ export default function RecentCuts() {
}, []);
if (!list.length) return null;
return (
- <section data-rail-section="recent-cuts" aria-label="Recent cuts">
- <h2 className="micro px-5 pb-1.5 pt-4">Recent cuts</h2>
- <ul className="m-0 list-none space-y-0.5 px-4 p-0">
+ <section data-home-section="recent-cuts" aria-label="Recent cuts">
+ <h2 className="micro pb-1.5">Recent cuts</h2>
+ <ul className="m-0 list-none space-y-0.5 p-0">
{list.map((r) => (
- <li key={r.project} data-recent-cut={r.project} className="flex items-center gap-1 px-1 text-[12px]">
+ <li key={r.project} data-recent-cut={r.project} className="flex items-center gap-1 text-[12px]">
<Link href={projectHref(r.project)} prefetch={false} className="min-w-0 flex-1 truncate text-text-2 no-underline hover:text-text" title={`${r.title} (${r.project})`}>
{r.project.split("/").pop()}
</Link>
diff --git a/umtool/components/shell/RunningList.tsx b/umtool/components/shell/RunningList.tsx
@@ -7,7 +7,8 @@ import { JobProgressBar, JobProgressText } from "@/components/ui/job-progress";
import { jobsHref } from "@/lib/hrefs";
// ---------------------------------------------------------------------------
-// The rail's foot (canvas `.running`): what is running, umtool's own and the
+// What is running, on home (canvas `.running`; it was the rail's foot until
+// the redesign's L4 left the rail navigation only): umtool's own and the
// editor's, with spend. The label row is "Running N" and the day's API spend
// in Meter; then a row per job (lib/running.mjs chooses them) -- kind, target,
// progress, queued or running, and a generation job's spend -- each linking to
@@ -114,12 +115,12 @@ export default function RunningList({ initial }: { initial: RunningView }) {
const state = editor.reason ?? (editor.pending ? "pending" : "ok");
return (
<section
- data-rail-section="running"
+ data-home-section="running"
aria-label="Running"
data-editor-state={state}
- className="mt-auto border-t border-seam pb-2 pt-3"
+ className="rounded-[4px] border border-seam pb-2 pt-3"
>
- <h2 className="micro flex justify-between px-5 pb-2">
+ <h2 className="micro flex justify-between px-3 pb-2">
<span>
<Link href={jobsHref()} prefetch={false} className="text-inherit no-underline hover:text-text" data-rail-jobs="" title="Jobs: the queue, every take render's record, the app's jobs">
Running
@@ -139,23 +140,23 @@ export default function RunningList({ initial }: { initial: RunningView }) {
)}
</h2>
{rows.length > 0 && (
- <ul className="grid gap-1.5 px-5" data-running-list="">
+ <ul className="grid gap-1.5 px-3" data-running-list="">
{rows.map((i) => (
<Row key={`${i.source}:${i.id}`} item={i} />
))}
</ul>
)}
{editor.text ? (
- <p className="mt-1.5 px-5 text-[12px] text-text-2" data-running-editor={editor.reason ?? ""} title={editor.detail ?? undefined}>
+ <p className="mt-1.5 px-3 text-[12px] text-text-2" data-running-editor={editor.reason ?? ""} title={editor.detail ?? undefined}>
{editor.text}
</p>
) : rows.length === 0 ? (
- <p className="px-5 text-[12px] text-muted-2" data-running-empty={editor.pending ? "pending" : ""}>
+ <p className="px-3 text-[12px] text-muted-2" data-running-empty={editor.pending ? "pending" : ""}>
{editor.pending ? "Asking the editor…" : "Nothing running"}
</p>
) : null}
{more.text && (
- <a href={editor.jobsHref} className="mt-1.5 block px-5 text-[11.5px] text-muted-2 no-underline hover:text-text" data-running-more="">
+ <a href={editor.jobsHref} className="mt-1.5 block px-3 text-[11.5px] text-muted-2 no-underline hover:text-text" data-running-more="">
{rows.length ? more.text : more.text.replace(/^\+ /, "")}
</a>
)}
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -78,10 +78,11 @@ Inbox cannot disagree about what is wrong with one.
| `take status <project> [--id <take>] [--json] [--log] [--tail N]` | a take's **render record** (`takes/<take>/render.json`, written by every render whoever started it — a terminal, the Takes page, the queue): `state` (`running`, `waiting` at the heavy slot, `done`, `failed`, `cancelled`; `queued` or `blocked` while a queue step waits to render it), `stage` and a rough `percent`, the `error` (the first error line, not a bare "exited 1") and the log's last 40 lines (`tail`), on done the `mp4` and its measured `seconds`; `--log` prints the FULL `takes/<take>/render.log`. A "running" whose process is gone reads **failed** ("the render process is gone"); a done whose mp4 is missing or 0 bytes reads **failed**. **Exit 0 done · 3 queued, waiting or running · 1 failed, cancelled, blocked or none.** Without `--id`: every take with a record, the newest's exit ([queue and poll](#queue-and-poll-instead-of-scripting)); and its fast-feedback renders beside it, `preview` and `changes` (each one's state, mp4, seconds, log; a changes reel's piece count, its base and its list), a queued `--preview`/`--changes` step said as such -- never as the take's own render |
| `queue add [--after <qid>\|last] [--label T] [--timeout <minutes>] [--json] -- <umtool subcommand argv…>` | a **step** of the durable queue: the argv of a umtool command, one word per argument (no shell), stored under `<reports root>/.umtool-queue/` and run by the **umtool app** (its systemd unit), one step at a time, in order — so it survives the session that queued it, an app restart and a ship. Prints the qid (`q<N>`) alone on stdout. `--after` waits for that step to be **done**; when it fails or is cancelled this one is **blocked** (and so is whatever waits on it). `--timeout`: the step's limit (default 720 minutes). A step does not start while the app's own job runner is busy (a Takes-page job), and a heavy step still takes the machine's heavy slot and render mode by itself |
| `queue ls [--all] [--json]` · `queue status <qid> [--json]` · `queue wait <qid> [--timeout <s>]` · `queue log <qid> [--tail N]` · `queue cancel <qid>` · `queue retry <qid>` | the queue: `ls` the runner (is the app running it) and the steps not finished or finished in the last 24 h; `status` one step (**exit 0 done · 3 queued or running · 1 failed, blocked or cancelled**); `wait` the same after up to `<s>` seconds (default 90); `log` its FULL log (`logs/<qid>.log`; earlier attempts kept as `<qid>.<n>.log`); `cancel` a queued or blocked step at once, a running one stopped (its process group); `retry` a failed or cancelled step back in the queue with every step blocked behind it. A step that was running when the app died reads **failed** ("the step's process is gone"), its log kept — it is never re-run on its own |
-| `jobs [--json]` | every running and recent **take render** across projects (their records), every queue step not finished or finished in the last 24 h, and the umtool app's own jobs (`GET /api/jobs` at `--url` / `UMTOOL_URL`, when it answers). The page is **/jobs** (the rail's *Running* links it) |
+| `jobs [--json]` | every running and recent **take render** across projects (their records), every queue step not finished or finished in the last 24 h, and the umtool app's own jobs (`GET /api/jobs` at `--url` / `UMTOOL_URL`, when it answers). The page is **/jobs** (home's *Running* links it) |
| `takes make <project> [--recipe FILE] [--only ID,ID] [--force]` · `takes make <project> --all-styles [--group G] [--at S --dur S \| --full]` | a recipe's takes, one at a time (default `takes/recipe.json`); every montage style, one take each (Make all styles); **exit 1** if any failed |
| `takes styles [--json]` · `takes effects <project> [--json]` · `takes pick <project> <take> [--anyway] [--pin \| --unpin] [--json]` | the montage styles; the overlay effects the cut offers (`render.chrome.fx` presets: the Takes page's **Effect** list); **Use this take** — refused (exit 1) when the project changed since the take was made, until `--anyway`; `--pin` keeps the pick when newer takes are built (each whole-cut take of the manifest is otherwise its group's pick once built), `--unpin` lets go ([report-video.md](report-video.md#takes-alternative-renders-judged-side-by-side)) |
| `takes ls <project> [--json]` · `takes relabel <project> <take> <label…>` · `takes supersede <project> <take> [--by <take>]` · `takes supersede <project> <take> --clear` · `takes delete <project> <take> [--dry-run] [--force]` | **take housekeeping** (the Takes page's ✎, **Mark superseded**, **Delete take**): first the working cut's line (`Latest: draft-22 · 28:03 · +N edits since`, and the edits in words; `--json`: `working`), then the takes with latest / picked (pinned) / superseded / RENDERING; a label fixed in `take.json` (an undo point of the take's own); a take folded away as superseded (verdicts.json, nothing deleted); a take deleted. Relabel and delete are refused (**exit 1**) while the take renders or a live render is made from it ([knobs.md](knobs.md#takes-relabel-supersede-cancel-delete-fork-as-variant-compare)) |
+| `takes verdict <project> <take> like\|maybe\|no\|clear [--note "…"] [--json]` | **a take's verdict** in `takes/verdicts.json` — the Takes page's and Play's **Like · Maybe · No**; a version with a render and none is a call on home ("versions to judge", [knobs.md](knobs.md#what-needs-you-home-the-inbox-one-press-actions-quick-clip)) |
| `takes save <project> [--label L] [--force] [--json]` · `takes open <project> <take> [--json]` · `takes freeze <project> [<take>… \| --all] [--apply] [--json]` | **the working draft and its saved versions** (Play's **Save version** and **Open in draft**): `save` freezes the draft (`video.manifest.json`) as the next `v<N>` — `takes/v<N>/base.manifest.json` byte for byte, `take.json` `version: true` — and names it the draft's parent (`takes/draft.json`); nothing is saved when the draft has no edits since its parent, unless `--force`. `open` copies a version into the draft — the draft saved first as the next `v<N>` when it has edits since its parent — with one undo point (`umtool timeline <p> undo` puts the draft and its parent back); a legacy take with its own timeline opens by its patch over the draft (as `take --promote`), another legacy take as the manifest it was rendered from (as `takes pick`). Neither touches the pick or its pin. `freeze` gives legacy takes a frozen base (the manifest each was rendered from, else the draft now) — a dry run unless `--apply`, each take's difference from how it resolves today said. Version ids are `v1`, `v2`, … — one above every `v<N>` directory under `takes/`, never reused ([knobs.md](knobs.md#the-working-draft-and-saved-versions)) |
| `takes cancel <project> <take> [--json]` · `takes fork <project> <take> [--name N] [--json]` · `takes compare <project> <a> <b> [--json]` | **take housekeeping, the rest**: **Cancel render** (asked of the process rendering it, which stops its render's process group, marks the take cancelled and lets render mode go; exit 1 when it has not stopped); **Fork as variant** (a project beside this one, default `v-<take>`: the take's manifest, `variant.json`, the parent's media and assets linked, the take in it); two takes **side by side** (`<take>` or `<project>:<take>`: the facts, the cut's changes A → B, the look's differences) ([knobs.md](knobs.md#takes-relabel-supersede-cancel-delete-fork-as-variant-compare)) |
| `trailer <project> --take <t> (--beats FILE \| --beats-json JSON) [--intro] [--finale S] [--xfade 0.3] [--no-snap] [--out NAME] [--dry-run] [--json]` | a **trailer cut from the take's finished master**: spans of the master's own frames (the deck shows the whole timeline), clip beats in source seconds mapped by the take's build records, each clip beat's end moved forward into the next pause (through its sentence when one ends within 1 s) and its start back into the one before, so the crossfade lands in quiet, each move said (`--no-snap`: the edges as written), crossfaded, the take's encode, in the heavy slot; writes `takes/<t>/out/<slug>.trailer.mp4` and `.trailer.json`; **exit 1** on a refusal ([report-video.md](report-video.md#trailer-from-the-master)) · `--reel <name> [--take <t>]`: a **beat reel** -- its own beats file (`promo/<name>-beats.json`), crossfade, intro (one rendered for the reel when the master has none, or the reel's own) and outro card (the title, the call to action, an image, the site's name; faded in from the last beat, held to the end), written to `<slug>.<name>.mp4`; no `--take`: its pinned take, else the one it was last cut from, else the latest finished master ([report-video.md](report-video.md#beat-reels)) |
@@ -239,6 +240,7 @@ draft (the project's manifest); *project*: a project's other files, or reads; *c
| `takes ls <project>` | the working cut, then each take | form · *project* |
| `takes relabel <project> <take> <label>` | a take's label | form · *project* |
| `takes supersede <project> <take> [--by BY] [--clear]` | a take folded away in the list (or back) | form · *project* |
+| `takes verdict <project> <take> like\|maybe\|no\|clear [--note NOTE]` | a take's verdict: like, maybe, no or clear (Play and judge) | form · *project* |
| `takes save <project> [--label LABEL] [--force]` | the working draft frozen as the next version (v<N>) | form · *project* |
| `takes open <project> <take>` | a saved version into the draft (the draft saved first) | form · *draft* |
| `takes freeze <project> [<takes>…] [--all] [--apply]` | legacy takes given a frozen base (a dry run unless --apply) | form · *project* |
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -371,7 +371,7 @@ bare footage (no deck, no cards: `data-play-bare`).
| the mode | Build, **Look**: **Basic \| Deck** | `umtool look <p> mode=basic` | `PUT /api/report/render {patch: {mode}}` |
| the built-in preset | Media, Video modules, Look preset | `umtool preset apply basic <p> [--replace]` | — |
| a clip's **share line** — its platform page at the first second it plays (YouTube `t=<s>s`, Rumble `start=<s>`, Twitch `t=<h>h<m>m<s>s`) and its moment on the archive (`archiveMomentUrl`); a Rumble folder id (the URL slug the corpus keeps it under) goes out as the embed id the archive serves | **Copy share line**: on each take's card (its first clip) and on Play (the clip on screen); the line is shown beside the button too | `umtool share <p> [<clip>] [--take <t>] [--site <id>] [--json]` | `GET /api/report/share-line?project&clip&take` |
-| **quick clip** — one moment to a shareable mp4: a basic-mode project under `quick-clips/` (its slug from `--title`, else `<channel>-<video>-<start>`), its window ASKED OF THE EDITOR (a Rumble recording fetched whole — the editor decides), `--snap words`: the edges snapped to the words heard there (the editor's transcribe op; the first word mostly after the start, the last mostly before the end, 0.15 s before and 0.3 s after, never into a neighbour), rendered as the take `clip` (the heavy slot; its record; the take panel), then the mp4's path and the share line; `--site <id>` names the archive (else the first public site carrying the channel) | — (the route) | `umtool clip <channel>/<video>@<start>-<end> [--snap words] [--title T] [--site <id>] [--folder F] [--json]` | `POST /api/report/quick-clip {spec, snap?, title?, site?}` → 202 `{job}`; `GET ?job=<id>` → `{job, done?: {project, output, share}}` |
+| **quick clip** — one moment to a shareable mp4: a basic-mode project under `quick-clips/` (its slug from `--title`, else `<channel>-<video>-<start>`), its window ASKED OF THE EDITOR (a Rumble recording fetched whole — the editor decides), `--snap words`: the edges snapped to the words heard there (the editor's transcribe op; the first word mostly after the start, the last mostly before the end, 0.15 s before and 0.3 s after, never into a neighbour), rendered as the take `clip` (the heavy slot; its record; the take panel), then the mp4's path and the share line; `--site <id>` names the archive (else the first public site carrying the channel) | home's **Quick clip** box ([What needs you](#what-needs-you-home-the-inbox-one-press-actions-quick-clip)) | `umtool clip <channel>/<video>@<start>-<end> [--snap words] [--title T] [--site <id>] [--folder F] [--json]` | `POST /api/report/quick-clip {spec, snap?, title?, site?}` → 202 `{job}`; `GET ?job=<id>` → `{job, done?: {project, output, share}}` |
The Rumble mapping is ONE helper (`lib/report/shareLine.mjs` `siteVideoFor`, over common `videoDir-server.mjs`
`recordIdOfVideoDir`: the folder's `metadata.info.json` `id`) and it has three callers: the share line;
@@ -379,6 +379,37 @@ The Rumble mapping is ONE helper (`lib/report/shareLine.mjs` `siteVideoFor`, ove
`citeUrl` that was the dead link moves with it); and `umtool timeline insert <rumble-channel>/<folder>@…`, which
writes the inserted clip with its `siteVideo`. A clip that pins `siteVideo` is never looked up.
+## What needs you (home: the Inbox, one-press actions, Quick clip)
+
+Home (`/`) is the Inbox widened (umtool redesign L4): the calls waiting on the operator, grouped and ranked
+(`lib/inbox/groups.mjs`), and beside them the **Quick clip** box, what is **Running** and the **Recent cuts** — which
+were the rail's; the rail keeps navigation only (Pinned, which never had a store, is gone). Every row is in
+`GET /api/browse/decisions` (`items[]`, one per decision) and `umtool inbox`.
+
+| Call | When | Its action (one press, where there is one) | From a terminal |
+|---|---|---|---|
+| **versions to judge** (`version-unjudged`, Review) | a version — or a legacy take — with a render on disk (its preview) and no verdict, not superseded; a quick clip's is not one; one rendered over two weeks ago is Quiet (folded: no longer waiting) | **Play and judge**: Play on the newest (`?take=`), where **Like · Maybe · No** sit in the version's line (pressing the lit one clears it) | `umtool takes verdict <p> <take> like\|maybe\|no\|clear [--note "…"]` |
+| **clips not walked** (`clips-unwalked`, Review) | the draft's clips with no walk verdict, on a draft whose walk has begun or that has a render or a saved version (a cut still being assembled is not a call); a draft untouched for two weeks is Quiet | **Walk the clips**: the bench on the first in walk order | `umtool walk <p>` |
+| **quote checks out of date** (`quote-check-stale`, Open) | a project with `quote-check.json` and clips its rows no longer vouch for: the cut or the quote changed since, or never checked | **Run quote-check** on those clips: a step on the durable queue (POST `/api/cli`, the registry's `quote-check` row — it transcribes through the editor) | `umtool quote-check <p> --clips a,b` |
+| a quote **heard away from the cut** (`clip-quote-moved`, Blocking) | the check's row says `moved` | **Snap the cut to the words** (`window --align`'s patch, through the window writer) | `umtool window <p> <clip> --align` |
+| a quote **not heard** (`clip-quote-missing`, Blocking) | the check's row says `not-found` | **Run quote-check** (after a refetch) | `umtool fetch <p> --refetch <clip> && umtool quote-check <p> --clips <clip>` |
+| **QR links that don't open** (`link-dead`, Blocking) on a Rumble folder id | the recorded check knows the fix: the archive serves the recording by its embed id | **Use embed ids (N)**: the clip's `siteVideo` (a `citeUrl` that was the dead link moves with it), one undo point, then the check again (POST `/api/report/links {fix: true}`, `linksCli.mjs` applyLinkFixes — only a clip still as the check saw it) | `umtool links <p> --fix` |
+| **new transcripts since the last scan** (`case-new-cues`, Review) | a research case with a pipeline, not done, whose candidate scan last finished at T, and recordings in its scope transcribed since T (the transcript index's per-video mtimes; with no index, the files) | **Scan again**: the case's pipeline page | `archilyzer case candidates <case>` |
+| **X's cookies are stale and X work waits** (`x-jar-stale`, Blocking: a machine call beside a missing tool — on home and in the rail's count, no piece's, so not in `items[]`) | the editor's services (`GET /api/ops/services`, asked through umtool's editor client, a minute's memo, never waited on past 0.4 s — a late answer is the next read's) carry a stale X alert — the rule the editor's banner draws by | **Refresh X's cookies**: the editor's settings (Refresh cookies / Connect X account, then Recheck) — a human click; nothing here asks X | `pnpm ops get services` |
+
+A card whose rows agree on one press shows it in place of its link (`mergeSettle`: a quote check over every clip the
+card lists; the same project-wide press; never two clip patches), its title still a link to where it is settled — the
+same `DecisionSettle` buttons the project page's Checks list presses.
+
+**Quick clip.** Paste a moment — an archive's moment link (`?v=<channel>/<video>&t=`, or a `/m/…/<s>-<e>/` page), a
+YouTube or Rumble link with its time (the channel is the one whose `data/` holds the recording; a Rumble embed id, the
+channel whose metadata names it), or `<channel>/<video>@<start>-<end>` (`lib/report/momentLink.mjs`, the timeline's
+Add clip reads the same) — and **Find** shows the recording, its span (a link's second runs to the end of its
+sentence, at most 20 s) and the words around it (the corpus's words, else its cues: `GET
+/api/report/quick-clip/strip?moment=`). A word starts the clip there, shift-click ends it there; **−0.5 −0.1 +0.1
++0.5** nudge each edge; **snap to the words** asks the editor to snap them. **Render** is `umtool clip` (above: POST
+`/api/report/quick-clip`), the command line shown under it; when it is done, **Copy share line**.
+
## An ingredient's life cycle (the rail)
`/ingredients/<channel>/<video>` is one recording of the corpus across its whole life: nine stages across the top,
@@ -1613,7 +1644,7 @@ has the walk-through; in short:
| one step: state, exit, error, log | `umtool queue status <qid> [--json]` (exit 0 done · 3 going · 1 failed/blocked/cancelled) · `queue wait <qid> --timeout 90` · `queue log <qid>` | **/jobs** → Queue, a step's **log** | `GET /api/queue` · `GET /api/queue/log?qid=` |
| cancel / retry | `umtool queue cancel <qid>` · `umtool queue retry <qid>` (with the steps blocked behind it) | **Cancel** / **Retry** on the step | `POST /api/queue?cancel=<qid>` · `?retry=<qid>` |
| a take's render record | `umtool take status <p> --id <take> [--json] [--log] [--tail N]` (exit 0 done · 3 queued/waiting/running · 1 failed) | the take's card (a render running now, or a later one that failed), **first render failed** above the takes, the project's **Queue** | `GET /api/report/takes/render?project=&take=` (`&log=1` the full log) |
-| everything, across projects | `umtool jobs [--json]` | **/jobs** (the rail's *Running*) | `GET /api/queue`, `GET /api/jobs` |
+| everything, across projects | `umtool jobs [--json]` | **/jobs** (home's *Running*) | `GET /api/queue`, `GET /api/jobs` |
## A take's own items (imported from other projects, edited in the take only)
diff --git a/umtool/e2e/fixtures/editor-stub-services.mjs b/umtool/e2e/fixtures/editor-stub-services.mjs
@@ -0,0 +1,25 @@
+// The editor's cookie alerts, stubbed (umtool redesign L4, needs-you.spec.ts): `GET /api/ops/services` answers
+// what a spec put there (`POST /__stub/services {alerts, x}`, the stub's own door, no token; `{}` resets to no
+// alerts) -- the payload editor/app/lib/cookieAlerts.ts serves, so the Inbox's X jar row (lib/inbox/xJar.ts)
+// reads the same shape it reads from the real editor. Nothing here asks X anything.
+const state = { alerts: [], pending: [], x: null };
+
+/** The spec's door. True when it answered. */
+export function servicesControl(req, res, url, { json, readBody }) {
+ if (req.method !== "POST" || url.pathname !== "/__stub/services") return false;
+ readBody(req, (body) => {
+ state.alerts = Array.isArray(body?.alerts) ? body.alerts : [];
+ state.pending = Array.isArray(body?.pending) ? body.pending : [];
+ state.x = body?.x && typeof body.x === "object" ? body.x : null;
+ json(res, 200, { ok: true, alerts: state.alerts.length });
+ });
+ return true;
+}
+
+/** `GET /api/ops/services`, behind the token. True when it answered. */
+export function servicesRoute(req, res, url, { json }) {
+ if (req.method !== "GET" || url.pathname !== "/api/ops/services") return false;
+ req.resume();
+ json(res, 200, { ok: true, alerts: state.alerts, pending: state.pending, ...(state.x ? { x: state.x } : {}) });
+ return true;
+}
diff --git a/umtool/e2e/fixtures/editor-stub.mjs b/umtool/e2e/fixtures/editor-stub.mjs
@@ -16,6 +16,7 @@
// entry, ready when its own endpoint answers.
import { intakeControl, intakeRoute } from "./editor-stub-intake.mjs";
+import { servicesControl, servicesRoute } from "./editor-stub-services.mjs";
import http from "node:http";
import { spawn, spawnSync } from "node:child_process";
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync, statSync } from "node:fs";
@@ -1236,6 +1237,8 @@ const server = http.createServer((req, res) => {
}
// The intake specs' counts (editor-stub-intake.mjs).
if (intakeControl(req, res, url, { json, readBody })) return;
+ // The cookie alerts a spec puts up (editor-stub-services.mjs, needs-you.spec.ts).
+ if (servicesControl(req, res, url, { json, readBody })) return;
if (req.method === "POST" && url.pathname === "/__stub/ops-jobs") {
return readBody(req, (body) => {
const mode = body?.mode ?? "ok";
@@ -1253,6 +1256,8 @@ const server = http.createServer((req, res) => {
return json(res, 401, { error: "missing bearer token" });
}
+ // The editor's cookie alerts and X's jar (editor-stub-services.mjs): the Inbox's X jar row reads them.
+ if (servicesRoute(req, res, url, { json })) return;
// UI notes items 13 and 16: a channel's counts, the focus, capture-posts (editor-stub-intake.mjs).
if (intakeRoute(req, res, url, { channels: CHANNELS, json, readBody, push: (r) => (requests.push({ ...r, authorization: auth }), record()) })) return;
// Release 38 lane C: a research case's verify, leads and evidence stages (editor-stub-case-stages.mjs).
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -67,6 +67,7 @@ import { makePostComboFixture } from "./post-combo-fixture.mjs";
import { makeMediaScenesFixture } from "./media-scenes-fixture.mjs";
import { makeInstrumentsFixture } from "./instruments-fixture.mjs";
import { makeIntroPlayFixture } from "./intro-play-fixture.mjs";
+import { makeNeedsYouFixture } from "./needs-you-fixture.mjs";
import { makeInspectorFixtures } from "./inspector-fixture.mjs";
import { makeIngredientRailFixture } from "./ingredient-rail-fixture.mjs";
@@ -2538,6 +2539,9 @@ makeCaseFixture({ channels: CHANNELS, reportsRoot: dest });
// R3: transparent runs -- a traced sweep, an imported turns-only one with two
// run starts, and one still running.
makeRunTraceFixture({ articles: ARTICLES, source: `local:${RESEARCH_PUBLIC}` });
+// WHAT NEEDS YOU (needs-you.spec.ts, redesign L4): a cut with a rendered version to judge, clips to walk and quote
+// checks out of date; a Rumble QR naming its folder (Use embed ids); a live case with a transcript since its scan.
+makeNeedsYouFixture({ reports, reportsRoot: dest, channels: CHANNELS, deckManifest, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
console.log(`fixture at ${dest}`);
console.log(` SITES_DIR=${SITES}`);
diff --git a/umtool/e2e/fixtures/needs-you-fixture.mjs b/umtool/e2e/fixtures/needs-you-fixture.mjs
@@ -0,0 +1,100 @@
+// WHAT NEEDS YOU (needs-you.spec.ts, umtool redesign L4): one fixture per new Inbox call --
+//
+// reports/needs-you-fixture the Play cut (play-cut-fixture.mjs) with
+// c01 walked (confirmed), c02–c04 not -> clips-unwalked
+// v1, a RENDERED saved version (its base frozen, a preview), no verdict;
+// `short`, a rendered legacy take, no verdict -> version-unjudged (Play ?take=v1)
+// quote-check.json: c02's row for a cut it no longer plays; c01, c03, c04 never
+// checked -> quote-check-stale, its one press Run quote-check
+// reports/needs-you-links one clip of a RUMBLE recording cited by its URL-slug folder (v6nyslug) whose
+// archive record is its embed id (v6nyembd, its metadata.info.json), and a
+// recorded link check calling it dead with that fix -> link-dead, Use embed ids (1)
+// .umtool/research/needs-you-case a case with a pipeline (scope nychan), its candidate scan done on
+// 1 Nov, and nychan/nyfresh transcribed since -> case-new-cues
+//
+// X's jar is the stub editor's (editor-stub-services.mjs), put up by the spec. The spec WRITES (a verdict, the
+// links fix, a queued quote check): this fixture is its own. Synthetic, like every fixture.
+import { copyFileSync, mkdirSync, readFileSync, utimesSync, writeFileSync } from "node:fs";
+import { createHash } from "node:crypto";
+import path from "node:path";
+import { linksOf, withArchiveId } from "../../lib/report/linkCheck.mjs";
+
+export const NY_PROJECT = "needs-you-fixture";
+export const NY_TITLE = "The Needs You Fixture";
+export const NY_LINKS = "needs-you-links";
+export const NY_LINKS_TITLE = "The Needs You Links";
+export const NY_CASE = "needs-you-case";
+export const NY_RUMBLE = "nyrumble";
+export const NY_FOLDER = "v6nyslug";
+export const NY_EMBED = "v6nyembd";
+/**
+ * A public-shaped site that never resolves (`.invalid`, RFC 6761: no resolver answers it): the re-check after
+ * the fix cannot verify, and says so. Not a loopback address -- that is a blocking siteOrigin of its own.
+ */
+export const NY_SITE = "https://ny-archive.invalid";
+
+const write = (dir, name, doc) => {
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(path.join(dir, name), typeof doc === "string" ? doc : JSON.stringify(doc, null, 2) + "\n");
+};
+
+/**
+ * @param {{ reports: string, reportsRoot: string, channels: string, deckManifest: Function, manifest: Function, cachedWindow: string, makePlayCutFixture: Function }} o
+ */
+export function makeNeedsYouFixture({ reports, reportsRoot, channels, deckManifest, manifest, cachedWindow, makePlayCutFixture }) {
+ // ---- the cut: versions to judge, clips not walked, quote checks out of date ----
+ const { dir } = makePlayCutFixture({ reports, deckManifest, cachedWindow, name: NY_PROJECT, title: NY_TITLE });
+ const file = path.join(dir, "video.manifest.json");
+ const m = JSON.parse(readFileSync(file, "utf8"));
+ m.timeline = m.timeline.map((e) => (e.id === "c01" ? { ...e, verdict: "confirmed" } : e));
+ const text = JSON.stringify(m, null, 2) + "\n";
+ writeFileSync(file, text);
+ const v1 = path.join(dir, "takes", "v1");
+ write(v1, "base.manifest.json", text);
+ write(v1, "take.json", {
+ id: "v1", group: "takes", order: 3, label: "Saved draft", kind: "reference", summary: "", changes: [], preview: "preview.mp4",
+ // Rendered a day before the fixture is made: a call (a render older than two weeks is Quiet, versions.mjs RECENT_DAYS).
+ seconds: 9, builtAt: new Date(Date.now() - 864e5).toISOString(), style: null, patch: null, window: "full", version: true,
+ savedAt: new Date(Date.now() - 2 * 864e5).toISOString(), baseHash: createHash("sha256").update(text).digest("hex"),
+ });
+ copyFileSync(cachedWindow, path.join(v1, "preview.mp4"));
+ write(dir, "quote-check.json", { version: 1, checkedAt: "2026-11-08T11:00:00.000Z", clips: { c02: { status: "ok", cut: { from: 3, to: 5 }, quote: "And this one runs on", checkedAt: "2026-11-08T11:00:00.000Z" } } });
+
+ // ---- the Rumble QR that names the folder, not the record ----
+ const rch = path.join(channels, NY_RUMBLE);
+ write(rch, "config.json", { name: "NY Rumble", platform: "rumble" });
+ const rv = path.join(rch, "data", NY_FOLDER);
+ write(rv, "metadata.info.json", { id: NY_EMBED, title: "The NY Rumble Recording", webpage_url: `https://rumble.com/${NY_FOLDER}-the-ny-rumble-recording.html` });
+ write(rv, "transcript.cues.json", { title: "The NY Rumble Recording", duration: 60, cues: [{ start: 0, end: 60, text: "a rumble." }] });
+ const lm = manifest(NY_LINKS, NY_LINKS_TITLE, { siteOrigin: NY_SITE, channelSlug: NY_RUMBLE }, [{ type: "clip", id: "n01", video: NY_FOLDER, start: 10, end: 14, cite: 10, section: 0, quote: "a rumble." }]);
+ const ldir = path.join(reports, NY_LINKS);
+ write(ldir, "video.manifest.json", lm);
+ const [qr] = linksOf(lm);
+ if (!qr) throw new Error("needs-you-fixture: the Rumble clip draws no QR");
+ write(path.join(ldir, "out"), "links.json", {
+ version: 1,
+ checkedAt: "2026-11-08T12:00:00.000Z",
+ fetched: 3,
+ origins: { [NY_SITE]: { state: "ok", generatedAt: "2026-11-01T00:00:00.000Z" } },
+ links: [
+ {
+ clip: "n01", url: qr.url, state: "dead", origin: NY_SITE,
+ why: `"${NY_FOLDER}" is the recording's folder (its Rumble URL slug), not a record on ${new URL(NY_SITE).host}; the site's record is its embed id "${NY_EMBED}"`,
+ fix: withArchiveId(qr.url, NY_FOLDER, NY_EMBED), fixSiteVideo: NY_EMBED,
+ },
+ ],
+ });
+
+ // ---- a live case, scanned on 1 Nov, its channel transcribed since ----
+ const now = "2026-11-01T00:00:00.000Z";
+ const cdir = path.join(reportsRoot, ".umtool", "research", NY_CASE);
+ write(cdir, "case.json", { format: "umtool-research-case", version: 1, id: NY_CASE, title: "The Needs You Case", scope: { source: "local" }, search: null, sessions: [], sections: [], quotes: [], notes: "", handoffs: [], counters: { quote: 0, section: 0 }, createdAt: now, updatedAt: now });
+ write(cdir, "pipeline.json", { format: "archilyzer-case-pipeline", version: 1, case: NY_CASE, subjects: [], scope: { channels: ["nychan"], groups: [], sites: [] }, eras: [], groups: [], privateNames: { sha256: [], note: "" }, readerPrompts: { common: "" }, status: "reading", createdAt: now, updatedAt: now });
+ write(cdir, "stages.json", { candidates: { state: "done", startedAt: now, endedAt: "2026-11-01T00:05:00.000Z", by: "cli", pid: 1, log: [], counts: { windows: 0 } } });
+ write(path.join(channels, "nychan"), "config.json", { name: "NY Chan", platform: "youtube" });
+ const old = path.join(channels, "nychan", "data", "nyold");
+ write(old, "transcript.cues.json", { title: "Before the scan", duration: 10, cues: [{ start: 0, end: 10, text: "old." }] });
+ utimesSync(path.join(old, "transcript.cues.json"), new Date("2026-10-20T00:00:00Z"), new Date("2026-10-20T00:00:00Z"));
+ write(path.join(channels, "nychan", "data", "nyfresh"), "transcript.cues.json", { title: "After the scan", duration: 10, cues: [{ start: 0, end: 10, text: "new." }] });
+ return { dir, ldir, cdir };
+}
diff --git a/umtool/e2e/inbox-engine.spec.ts b/umtool/e2e/inbox-engine.spec.ts
@@ -54,7 +54,8 @@ test("one row per decision, each with the inbox's fields; the counts add up", as
expect(hidden).toBe(items.filter((d) => d.hidden).length);
expect(groups.map((g) => g.id)).toEqual(["your-call", "review", "blocking", "notes", "open", "ready-to-finish", "quiet"]);
for (const d of items) {
- expect(d.piece, `${d.kind} ${d.project}`).toMatch(/^[ap]:/);
+ // A research case's new transcripts (L4, case-new-cues) are its case's: `c:<case>`.
+ expect(d.piece, `${d.kind} ${d.project}`).toMatch(d.kind === "case-new-cues" ? /^c:/ : /^[ap]:/);
expect(d.group).toBeTruthy();
expect(d.category).toBeTruthy();
expect(d.lifecycle).toBeTruthy();
diff --git a/umtool/e2e/needs-you.spec.ts b/umtool/e2e/needs-you.spec.ts
@@ -0,0 +1,243 @@
+import { test, expect, type APIRequestContext, type Page } from "@playwright/test";
+import { mkdirSync, readFileSync, rmSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs";
+import { NY_CASE, NY_EMBED, NY_LINKS, NY_PROJECT, NY_TITLE } from "./fixtures/needs-you-fixture.mjs";
+import * as urls from "./urls";
+import { warm, WARM_TIMEOUT } from "./warm";
+
+// ---------------------------------------------------------------------------
+// WHAT NEEDS YOU (umtool redesign L4): home is the Inbox, widened --
+//
+// each new kind from its fixture (fixtures/needs-you-fixture.mjs): versions to judge, clips not walked, quote
+// checks out of date, a live case's new transcripts, X's jar (the stub editor's services, only while X work
+// waits), and a dead Rumble QR with Use embed ids;
+// one-press actions that change the file: Play and judge (verdicts.json), Use embed ids (the manifest's
+// siteVideo), Run quote-check (a step on the durable queue);
+// the Quick clip box: a moment found, its edges nudged, rendered (the stub editor's window), its share line;
+// the rail keeps navigation only: Running and the Recent cuts are on home.
+//
+// The tests run in order: Quick clip before Run quote-check, which leaves a step on the queue (cancelled after).
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const FIXTURE = path.join(HERE, "..", ".e2e-song");
+const P = `reports/${NY_PROJECT}`;
+const L = `reports/${NY_LINKS}`;
+const DIR = path.join(FIXTURE, "reports", NY_PROJECT);
+const LDIR = path.join(FIXTURE, "reports", NY_LINKS);
+const STUB = `http://127.0.0.1:${portFor("EDITOR_STUB_PORT")}`;
+const QUICK_PROJECT = "quick-clips/basicyt-quickvid-10";
+const SHOTS = process.env.E2E_NEEDS_YOU_SHOTS ?? "";
+const shot = async (page: Page, name: string) => {
+ if (!SHOTS) return;
+ mkdirSync(SHOTS, { recursive: true });
+ await page.screenshot({ path: path.join(SHOTS, `${name}.png`) });
+};
+const card = (page: Page, kind: string, piece: string | null = null) =>
+ page.locator(`[data-card='${kind}']${piece ? `[data-piece='${piece}']` : ""}`);
+const json = (file: string) => JSON.parse(readFileSync(file, "utf8"));
+const X_ALERT = {
+ service: "x",
+ label: "X",
+ family: "x",
+ state: "stale",
+ kind: "jar-age",
+ since: "2026-11-09T09:00:00.000Z",
+ raisedAt: "2026-11-09T09:00:00.000Z",
+ headline: "X cookies are 3 h old (limit 60 min)",
+ fix: "Refresh cookies (or Connect X account) on /settings — then Recheck.",
+ detail: "2 X jobs are queued.",
+};
+const services = (request: APIRequestContext, alerts: unknown[]) => request.post(`${STUB}/__stub/services`, { data: { alerts } });
+let queued: string | null = null;
+
+test.beforeAll(async ({ playwright }) => {
+ test.setTimeout(WARM_TIMEOUT);
+ await warm(playwright, ["/", "/api/browse/decisions", urls.playHref(P, { take: "short" }), `/api/report/quick-clip/strip?moment=${encodeURIComponent("basicyt/quickvid@10-14")}`]);
+});
+
+test.afterAll(async ({ request }) => {
+ await services(request, []);
+ if (queued) await request.post(`/api/queue?cancel=${queued}`);
+ rmSync(path.join(FIXTURE, "quick-clips", "basicyt-quickvid-10"), { recursive: true, force: true });
+ rmSync(path.join(FIXTURE, "channels", "basicyt", "data", "quickvid", "clips"), { recursive: true, force: true });
+});
+
+test("each new call is on home from its fixture -- versions, clips, quote checks, the case, the Rumble QR; X's jar only while X work waits", async ({ page, request }) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await services(request, []);
+ await page.goto("/");
+ const piece = `p:${P}`;
+
+ const versions = card(page, "version-unjudged", piece);
+ await expect(versions).toBeVisible({ timeout: 60_000 });
+ await expect(versions.locator("[data-card-title]")).toContainText(`${NY_TITLE} · 2 versions to judge`);
+ await expect(versions.locator("[data-action-link]")).toHaveText("Play and judge");
+ await expect(page.locator(`[data-group=review] [data-card='version-unjudged'][data-piece='${piece}']`)).toHaveCount(1);
+
+ const walk = card(page, "clips-unwalked", piece);
+ await expect(walk.locator("[data-card-title]")).toContainText("3 clips not walked");
+ await expect(walk.locator("[data-action-link]")).toHaveAttribute("href", urls.clipBenchHref(P, "c02"));
+
+ const checks = card(page, "quote-check-stale", piece);
+ await expect(checks.locator("[data-card-title]")).toContainText("4 quote checks out of date");
+ await expect(checks.locator("[data-count]")).toHaveText("4");
+ await expect(checks.locator("[data-settle-button='quote-check']")).toHaveText("Run quote-check");
+ // A one-press card's title still goes where it is settled.
+ await expect(checks.locator("[data-card-link]")).toHaveAttribute("href", urls.projectHref(P));
+
+ const theCase = card(page, "case-new-cues", `c:${NY_CASE}`);
+ await expect(theCase.locator("[data-card-title]")).toContainText("1 new transcript since the last scan");
+ await expect(theCase.locator("[data-action-link]")).toHaveAttribute("href", `/research/${NY_CASE}/pipeline`);
+
+ const links = page.locator(`[data-group=blocking] [data-card='link-dead'][data-piece='p:${L}']`);
+ await expect(links.locator("[data-settle-button='links']")).toHaveText("Use embed ids (1)");
+
+ // X's jar: nothing while no X work waits; the editor's three lines once its alert is up.
+ await expect(card(page, "x-jar-stale")).toHaveCount(0);
+ await services(request, [X_ALERT]);
+ await page.reload();
+ const x = page.locator("[data-group=blocking] [data-card='x-jar-stale']");
+ await expect(x).toBeVisible({ timeout: 30_000 });
+ await expect(x).toContainText("X cookies are 3 h old (limit 60 min)");
+ await expect(x).toContainText("2 X jobs are queued.");
+ await expect(x.locator("[data-action-link]")).toHaveText("Refresh X's cookies");
+ await expect(x.locator("[data-action-link]")).toHaveAttribute("href", `${STUB}/settings`);
+ await shot(page, "needs-you-home");
+
+ // The API keeps one row per decision.
+ const items = ((await (await request.get("/api/browse/decisions")).json()) as { items: { kind: string; project: string; target: string }[] }).items;
+ expect(items.filter((d) => d.kind === "version-unjudged" && d.project === P).map((d) => d.target).sort()).toEqual(["short", "v1"]);
+ expect(items.filter((d) => d.kind === "clips-unwalked" && d.project === P).map((d) => d.target)).toEqual(["c02", "c03", "c04"]);
+ expect(items.filter((d) => d.kind === "quote-check-stale" && d.project === P).map((d) => d.target)).toEqual(["c01", "c02", "c03", "c04"]);
+ // X's jar is a machine call (lib/machine.ts): on the page and the rail's count, not a piece's row.
+ expect(items.some((d) => d.kind === "x-jar-stale")).toBe(false);
+ expect(items.filter((d) => d.kind === "case-new-cues").map((d) => (d as { piece?: string }).piece)).toContain(`c:${NY_CASE}`);
+
+ await services(request, []);
+ await page.reload();
+ await expect(card(page, "x-jar-stale")).toHaveCount(0);
+});
+
+test("the rail keeps navigation only: Running and the Recent cuts are on home", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await page.goto(urls.playHref(P, { take: "short" }));
+ await expect(page.locator("[data-play-take='short']")).toBeVisible({ timeout: 60_000 });
+ await page.goto("/");
+ const rail = page.locator("[data-app-rail]");
+ await expect(rail).toBeVisible();
+ await expect(rail.locator("[data-rail-section=pins], [data-home-section=running], [data-home-section=recent-cuts]")).toHaveCount(0);
+ await expect(rail).not.toContainText("Pinned");
+ const aside = page.locator("[data-home-aside]");
+ await expect(aside.locator("[data-home-section=running]")).toBeVisible();
+ await expect(aside.locator("[data-quick-clip]")).toBeVisible();
+ // Play remembered the cut: it is a Recent cut on home.
+ await expect(aside.locator(`[data-recent-cut='${P}']`)).toBeVisible();
+});
+
+test("Play and judge: the card opens Play on the version; Like writes verdicts.json and the card counts one fewer", async ({ page }) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await page.goto("/");
+ const versions = card(page, "version-unjudged", `p:${P}`);
+ await versions.locator("[data-action-link]").click();
+ // Play keeps where it is in its address (clip, at): the version is the take.
+ await expect(page).toHaveURL(/\/play\?take=short(&|$)/);
+ const verdict = page.locator("[data-play-take='short'] [data-play-verdict]");
+ await expect(verdict.locator("[data-play-verdict-button='like']")).toBeEnabled({ timeout: 60_000 });
+ await shot(page, "needs-you-play-judge");
+ await verdict.locator("[data-play-verdict-button='like']").click();
+ await expect(verdict).toHaveAttribute("data-play-verdict", "like");
+ await expect(verdict.locator("[data-play-verdict-button='like']")).toHaveAttribute("aria-pressed", "true");
+ expect(json(path.join(DIR, "takes", "verdicts.json")).short?.verdict).toBe("like");
+
+ await page.goto("/");
+ const left = card(page, "version-unjudged", `p:${P}`);
+ await expect(left.locator("[data-card-title]")).toContainText("1 version to judge");
+ await expect(left.locator("[data-action-link]")).toHaveAttribute("href", urls.playHref(P, { take: "v1" }));
+ // The saved version too: judged where it plays (its base, frozen).
+ await left.locator("[data-action-link]").click();
+ await page.locator("[data-play-take='v1'] [data-play-verdict-button='no']").click();
+ await expect(page.locator("[data-play-take='v1'] [data-play-verdict]")).toHaveAttribute("data-play-verdict", "no");
+ expect(json(path.join(DIR, "takes", "verdicts.json")).v1?.verdict).toBe("no");
+ await page.goto("/");
+ await expect(card(page, "version-unjudged", `p:${P}`)).toHaveCount(0);
+});
+
+test("Use embed ids: one press on the dead Rumble QR writes the clip's siteVideo, and the card goes", async ({ page }) => {
+ test.setTimeout(120_000);
+ await page.goto("/");
+ const links = page.locator(`[data-card='link-dead'][data-piece='p:${L}']`);
+ await links.locator("[data-settle-button='links']").click();
+ await expect(links.locator("[data-settle-said]")).toContainText("fixed n01", { timeout: 60_000 });
+ const n01 = (json(path.join(LDIR, "video.manifest.json")).timeline as { id: string; siteVideo?: string }[]).find((e) => e.id === "n01");
+ expect(n01?.siteVideo).toBe(NY_EMBED);
+ // One undo point before the rewrite, as `umtool links --fix` takes.
+ await page.reload();
+ await expect(page.locator(`[data-card='link-dead'][data-piece='p:${L}']`)).toHaveCount(0);
+});
+
+test("Quick clip: a moment link found, the edges nudged on its words, rendered, the share line copied", async ({ page, context }) => {
+ test.setTimeout(300_000);
+ await context.grantPermissions(["clipboard-read", "clipboard-write"]);
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await page.goto("/");
+ const box = page.locator("[data-quick-clip]");
+ const input = box.locator("[data-quick-clip-input]");
+
+ // A platform link names no channel: the one channel holding the recording is found; its span is its sentence.
+ await input.fill("https://www.youtube.com/watch?v=quickvid&t=10");
+ await box.locator("[data-quick-clip-find]").click();
+ await expect(box.locator("[data-quick-clip-strip]")).toHaveAttribute("data-quick-clip-strip", "basicyt/quickvid@10-30", { timeout: 30_000 });
+ await input.fill("nothing here");
+ await box.locator("[data-quick-clip-find]").click();
+ await expect(box.locator("[data-quick-clip-error]")).toContainText("not a moment");
+
+ await input.fill("basicyt/quickvid@10-14");
+ await box.locator("[data-quick-clip-find]").click();
+ await expect(box.locator("[data-quick-clip-strip]")).toHaveAttribute("data-quick-clip-strip", "basicyt/quickvid@10-14", { timeout: 30_000 });
+ await expect(box.locator("[data-editor-words]")).toContainText("a synthetic tone");
+ await box.locator("[data-quick-clip-nudge='start:0.5']").click();
+ await box.locator("[data-quick-clip-nudge='end:-0.5']").click();
+ await box.locator("[data-quick-clip-nudge='end:0.5']").click();
+ await expect(box.locator("[data-quick-clip-spec]")).toHaveText("umtool clip basicyt/quickvid@10.5-14");
+ await shot(page, "needs-you-quick-clip");
+
+ await box.locator("[data-quick-clip-render]").click();
+ await expect(box).toHaveAttribute("data-quick-clip", "done", { timeout: 240_000 });
+ await expect(box.locator("[data-quick-clip-done]")).toHaveAttribute("data-quick-clip-done", QUICK_PROJECT);
+ const made = json(path.join(FIXTURE, QUICK_PROJECT, "video.manifest.json"));
+ expect(made.render.mode).toBe("basic");
+ expect(made.timeline.map((e: { video: string; start: number }) => `${e.video}@${e.start}`)).toEqual(["quickvid@10.5"]);
+ const copy = box.locator('[data-share-copy="quick-clip"]');
+ await copy.click();
+ await expect(copy).toHaveAttribute("data-share-state", /copied|shown/, { timeout: 60_000 });
+ await expect(box.locator('[data-share-line-box="quick-clip"] [data-share-line]')).toHaveText("https://www.youtube.com/watch?v=quickvid&t=10s");
+ await shot(page, "needs-you-quick-clip-done");
+ // A quick clip is shared, not judged or walked: no version to judge, no clips to walk.
+ const items = ((await (await page.request.get("/api/browse/decisions")).json()) as { items: { project: string; kind: string }[] }).items;
+ expect(items.filter((d) => d.project === QUICK_PROJECT && (d.kind === "version-unjudged" || d.kind === "clips-unwalked"))).toEqual([]);
+});
+
+test("Run quote-check: one press queues `umtool quote-check` on the card's clips", async ({ page, request }) => {
+ test.setTimeout(120_000);
+ await page.goto("/");
+ const checks = card(page, "quote-check-stale", `p:${P}`);
+ await checks.locator("[data-settle-button='quote-check']").click();
+ const said = checks.locator("[data-settle-said]");
+ await expect(said).toContainText(/queued as q\d+ — 4 clips/, { timeout: 30_000 });
+ queued = /queued as (q\d+)/.exec((await said.textContent()) ?? "")?.[1] ?? null;
+ const view = (await (await request.get(`/api/queue?project=${encodeURIComponent(P)}&all=1`)).json()) as { steps: { qid: string; argv?: string[]; label?: string }[] };
+ const step = view.steps.find((s) => s.qid === queued);
+ expect(step, JSON.stringify(view.steps)).toBeTruthy();
+ expect(JSON.stringify(step)).toContain("quote-check");
+ expect(JSON.stringify(step)).toContain("c01,c02,c03,c04");
+ // Off the queue again: it would hold the app's one job runner for the specs after this one.
+ expect((await request.post(`/api/queue?cancel=${queued}`)).ok()).toBe(true);
+ queued = null;
+});
diff --git a/umtool/e2e/running.spec.ts b/umtool/e2e/running.spec.ts
@@ -7,7 +7,8 @@ import { LIVE_ARTICLE, LIVE_JOB } from "./fixtures/run-trace-fixture.mjs";
import { runHref } from "../lib/research/runs-hrefs";
// ---------------------------------------------------------------------------
-// P2b: what is running, in the rail, and drafts as decisions in the Inbox.
+// P2b: what is running (on home, beside the Inbox, since the redesign's L4;
+// the rail's foot before), and drafts as decisions in the Inbox.
//
// The Running list (components/shell/RunningList.tsx, lib/activity.ts) is
// umtool's own jobs and the editor's live ones, from the editor stub's
@@ -37,7 +38,8 @@ async function editorJobs(request: APIRequestContext, mode: "ok" | "editor-token
expect(fresh.ok()).toBeTruthy();
}
-const running = (page: Page) => page.locator("[data-app-rail] [data-rail-section=running]");
+// On home since the rail kept navigation only (redesign L4).
+const running = (page: Page) => page.locator("[data-home-aside] [data-home-section=running]");
test.afterEach(async ({ request }) => {
await editorJobs(request, "ok", [], true);
@@ -75,9 +77,9 @@ const JOBS = [
{ id: "e2e-q3", kind: "download-missing", channelSlug: "otherchan", status: "queued", queuedAt: NOW - 3000, queue: { key: "youtube", position: 3, queued: 3 } },
];
-test("the rail lists the editor's running and queued jobs, a draft's spend, and the day's", async ({ page, request }) => {
+test("home lists the editor's running and queued jobs, a draft's spend, and the day's", async ({ page, request }) => {
await editorJobs(request, "ok", JOBS);
- await page.goto("/tools");
+ await page.goto("/");
const r = running(page);
await expect(r).toHaveAttribute("data-editor-state", "ok");
await expect(r.locator("[data-running-count]")).toHaveAttribute("data-running-count", "2");
@@ -132,7 +134,7 @@ test("the rail lists the editor's running and queued jobs, a draft's spend, and
test("nothing running, the editor's token unset, and an editor that does not answer are three sentences", async ({ page, request }) => {
await editorJobs(request, "ok", [{ id: "e2e-lane-only", kind: "auto-publish", status: "running", queuedAt: NOW, startedAt: NOW }]);
- await page.goto("/tools");
+ await page.goto("/");
const r = running(page);
await expect(r).toHaveAttribute("data-editor-state", "ok");
await expect(r.locator("[data-running-empty]")).toHaveText("Nothing running");
@@ -162,7 +164,7 @@ test("a report-draft row links its run page when it is a sweep (R3), its article
// Placed by its log: a narration step, not a sweep.
{ id: "e2e-draft-narrate", kind: "report-draft", status: "running", queuedAt: NOW - 10_000, startedAt: NOW - 10_000, log: ["narrate of zeta i1 on qwen3:8b (the local model)"] },
]);
- await page.goto("/tools");
+ await page.goto("/");
const r = running(page);
const sweep = r.locator(`[data-running=${LIVE_JOB}]`);
await expect(sweep.locator("[data-running-target]")).toContainText(`${LIVE_ARTICLE} i1`);
diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs
@@ -594,7 +594,7 @@ export const GROUPS = [
],
docs: [
["`jobs [--json]`",
- "every running and recent **take render** across projects (their records), every queue step not finished or finished in the last 24 h, and the umtool app's own jobs (`GET /api/jobs` at `--url` / `UMTOOL_URL`, when it answers). The page is **/jobs** (the rail's *Running* links it)"],
+ "every running and recent **take render** across projects (their records), every queue step not finished or finished in the last 24 h, and the umtool app's own jobs (`GET /api/jobs` at `--url` / `UMTOOL_URL`, when it answers). The page is **/jobs** (home's *Running* links it)"],
],
},
{
@@ -604,6 +604,7 @@ export const GROUPS = [
" | ls <project> | relabel <project> <take> <label…> | supersede <project> <take> [--by <take>] [--clear]",
" | delete <project> <take> [--dry-run] [--force] take housekeeping: a label fixed, a take folded away",
" as superseded, a take deleted -- refused while a render names it",
+ " | verdict <project> <take> like|maybe|no|clear [--note T] a take's verdict (verdicts.json): Play and judge",
],
docs: [
["`takes make <project> [--recipe FILE] [--only ID,ID] [--force]` · `takes make <project> --all-styles [--group G] [--at S --dur S \\| --full]`",
@@ -612,6 +613,8 @@ export const GROUPS = [
"the montage styles; the overlay effects the cut offers (`render.chrome.fx` presets: the Takes page's **Effect** list); **Use this take** — refused (exit 1) when the project changed since the take was made, until `--anyway`; `--pin` keeps the pick when newer takes are built (each whole-cut take of the manifest is otherwise its group's pick once built), `--unpin` lets go ([report-video.md](report-video.md#takes-alternative-renders-judged-side-by-side))"],
["`takes ls <project> [--json]` · `takes relabel <project> <take> <label…>` · `takes supersede <project> <take> [--by <take>]` · `takes supersede <project> <take> --clear` · `takes delete <project> <take> [--dry-run] [--force]`",
"**take housekeeping** (the Takes page's ✎, **Mark superseded**, **Delete take**): first the working cut's line (`Latest: draft-22 · 28:03 · +N edits since`, and the edits in words; `--json`: `working`), then the takes with latest / picked (pinned) / superseded / RENDERING; a label fixed in `take.json` (an undo point of the take's own); a take folded away as superseded (verdicts.json, nothing deleted); a take deleted. Relabel and delete are refused (**exit 1**) while the take renders or a live render is made from it ([knobs.md](knobs.md#takes-relabel-supersede-cancel-delete-fork-as-variant-compare))"],
+ ["`takes verdict <project> <take> like\\|maybe\\|no\\|clear [--note \"…\"] [--json]`",
+ "**a take's verdict** in `takes/verdicts.json` — the Takes page's and Play's **Like · Maybe · No**; a version with a render and none is a call on home (\"versions to judge\", [knobs.md](knobs.md#what-needs-you-home-the-inbox-one-press-actions-quick-clip))"],
["`takes save <project> [--label L] [--force] [--json]` · `takes open <project> <take> [--json]` · `takes freeze <project> [<take>… \\| --all] [--apply] [--json]`",
"**the working draft and its saved versions** (Play's **Save version** and **Open in draft**): `save` freezes the draft (`video.manifest.json`) as the next `v<N>` — `takes/v<N>/base.manifest.json` byte for byte, `take.json` `version: true` — and names it the draft's parent (`takes/draft.json`); nothing is saved when the draft has no edits since its parent, unless `--force`. `open` copies a version into the draft — the draft saved first as the next `v<N>` when it has edits since its parent — with one undo point (`umtool timeline <p> undo` puts the draft and its parent back); a legacy take with its own timeline opens by its patch over the draft (as `take --promote`), another legacy take as the manifest it was rendered from (as `takes pick`). Neither touches the pick or its pin. `freeze` gives legacy takes a frozen base (the manifest each was rendered from, else the draft now) — a dry run unless `--apply`, each take's difference from how it resolves today said. Version ids are `v1`, `v2`, … — one above every `v<N>` directory under `takes/`, never reused ([knobs.md](knobs.md#the-working-draft-and-saved-versions))"],
["`takes cancel <project> <take> [--json]` · `takes fork <project> <take> [--name N] [--json]` · `takes compare <project> <a> <b> [--json]`",
diff --git a/umtool/lib/cli/verbs.mjs b/umtool/lib/cli/verbs.mjs
@@ -241,6 +241,7 @@ export const VERBS = Object.freeze([
form("takes ls", "project", "the working cut, then each take", [project()]),
form("takes relabel", "project", "a take's label", [project(), takeArg(), arg("label")]),
form("takes supersede", "project", "a take folded away in the list (or back)", [project(), takeArg(), name("--by"), bool("--clear")]),
+ form("takes verdict", "project", "a take's verdict: like, maybe, no or clear (Play and judge)", [project(), takeArg(), pick("verdict", ["like", "maybe", "no", "clear"], { required: true }), opt("--note", { help: "the verdict's note" })]),
form("takes save", "project", "the working draft frozen as the next version (v<N>)", [project(), opt("--label"), bool("--force", "save even with no edits since its parent")]),
form("takes open", "draft", "a saved version into the draft (the draft saved first)", [project(), takeArg({ help: "the version (or take) to open" })]),
form("takes freeze", "project", "legacy takes given a frozen base (a dry run unless --apply)", [project(), many("takes", { item: "name", help: "take ids, one per line (none: --all)" }), bool("--all"), bool("--apply", "write them (else a dry run)")], { confirm: { what: "write each legacy take's frozen base (how it resolves can change)", when: ["--apply"] } }),
diff --git a/umtool/lib/decisions.ts b/umtool/lib/decisions.ts
@@ -90,9 +90,13 @@ export type Decision = {
| { kind: "patch"; clip: string; patch: Record<string, unknown>; label: string }
| { kind: "check-links"; label: string; fix?: boolean }
| { kind: "patch-markers"; file: string; label: string }
- | { kind: "publish-site"; siteId: string; label: string };
+ | { kind: "publish-site"; siteId: string; label: string }
+ // Run the quote check on these clips (L4): `umtool quote-check <p> --clips …`, on the durable queue.
+ | { kind: "quote-check"; clips: string[]; label: string };
/** The clips a project-wide row is about (a site's dead links). */
clips?: string[];
+ /** The card's own title, when the rows name one ("3 versions to judge"); else the Inbox labels it by kind. */
+ what?: string;
// ---- The inbox's fields (lib/inbox.ts). ADDITIVE: a row without them is
// still a decision, and the reducers above never set them. ----
diff --git a/umtool/lib/inbox.ts b/umtool/lib/inbox.ts
@@ -27,6 +27,8 @@ import { readSchedules } from "./schedules";
import type { ScheduleView } from "./schedule-types";
import { refreshDecisions } from "./inbox/refresh";
import { sourceWatchDecisions } from "./inbox/sourceWatch";
+import { projectCallsAll } from "./inbox/projectCalls";
+import { caseCuesDecisions } from "./inbox/caseCues";
// ---------------------------------------------------------------------------
// THE INBOX, AS DATA: every open decision (lib/projects.ts openDecisions: the
@@ -66,14 +68,26 @@ import { sourceWatchDecisions } from "./inbox/sourceWatch";
// per proposal, gone once approved or rejected (or the
// claim ruled by hand, or changed: a stale proposal)
// unreadable-proposals that file does not read: one Blocking row
+// version-unjudged a rendered version (or legacy take) with no verdict:
+// Play and judge (lib/inbox/versions.mjs, umtool
+// redesign L4 "What needs you")
+// clips-unwalked the draft's clips nobody walked, on a draft with a
+// render or a walk begun (lib/inbox/walk.mjs)
+// quote-check-stale clips the quote check no longer vouches for, with
+// Run quote-check in place (lib/inbox/checks.mjs)
+// case-new-cues a live research case's scope has new transcripts
+// since its last candidate scan (lib/inbox/caseCues.mjs)
+//
+// (X's login when X work waits on it -- x-jar-stale, lib/inbox/xJar.mjs -- is a
+// MACHINE call, lib/machine.ts, beside a missing tool: it is no piece's.)
//
// -- each row given its piece, category, group, one action, lifecycle and
// `hidden` (lib/inbox/groups.mjs), ranked. One row per decision, never dropped:
// the MCP reads `items[]` (mcp/src/archivalTools.ts).
//
// No editor call anywhere here: there is no "waiting on a cap" state (the daily
-// cap refuses at start, a per-job cap ends the run), and running jobs are the
-// rail's (lib/activity.ts readRunning).
+// cap refuses at start, a per-job cap ends the run), and running jobs are
+// home's Running list (lib/activity.ts readRunning).
//
// SERVER ONLY.
// ---------------------------------------------------------------------------
@@ -90,6 +104,8 @@ export type GroupCard = {
what: string | null;
action: { label: string; href: string };
at: number;
+ /** The one-press settle the card offers in place, when its rows agree on one (groups.mjs mergeSettle). */
+ settle: Decision["settle"] | null;
};
export type GroupSummary = {
id: string;
@@ -392,7 +408,9 @@ export async function diskDecisions(graph: PieceGraph, life: LifecycleRead): Pro
.catch(() => [] as Decision[]);
// Re-sweep when complete (UI notes item 16): a report video's source watch that fired.
const sources = await sourceWatchDecisions().catch(() => [] as Decision[]);
- return [...perArticle.flat(), ...pieceDecisions(graph, life), ...drafts, ...proposals, ...refresh, ...recurring, ...sources];
+ // What needs you (L4): versions to judge, clips to walk, stale quote checks, a live case's new transcripts.
+ const [calls, cases] = await Promise.all([projectCallsAll().catch(() => [] as Decision[]), caseCuesDecisions().catch(() => [] as Decision[])]);
+ return [...perArticle.flat(), ...pieceDecisions(graph, life), ...drafts, ...proposals, ...refresh, ...recurring, ...sources, ...calls, ...cases];
}
/**
diff --git a/umtool/lib/inbox/caseCues.mjs b/umtool/lib/inbox/caseCues.mjs
@@ -0,0 +1,63 @@
+// NEW TRANSCRIPTS ON A LIVE CASE (umtool redesign L4, "What needs you"): a
+// research case with a pipeline (`<case>/pipeline.json`, common's caseTypes.ts)
+// that is not done, whose candidate scan last ran at T, and whose scope's
+// channels have recordings transcribed (or their captions written) since T --
+// "14 new transcripts since the last scan". Review group; its action the case's
+// pipeline page, where Scan candidates runs the scan again.
+//
+// "Since the last refresh" is the candidates stage's last finished run
+// (stages.json): that is the read of the corpus the case's windows come from.
+// A case never scanned raises nothing -- there is no "since" to count from.
+//
+// Pure: lib/inbox/caseCues.ts lists the cases and counts the cues (the
+// transcript index's per-video mtimes; a fixture with no index, the files).
+
+export const CASE_NEW_CUES = "case-new-cues";
+
+/**
+ * The case's `since`: the candidates stage's last done run's end, as ms, or null.
+ * @param {Record<string, any> | null | undefined} stages readStages()
+ */
+export function lastScanOf(stages) {
+ const run = stages?.candidates;
+ if (!run || run.state !== "done") return null;
+ const ms = Date.parse(run.endedAt ?? run.startedAt ?? "");
+ return Number.isFinite(ms) ? ms : null;
+}
+
+/**
+ * The videos with cues newer than `since`: `{ channel, id, at }[]`, newest first.
+ * @param {Array<{ channel: string, id: string, at: number }>} rows
+ * @param {number} since
+ */
+export function newSince(rows, since) {
+ return (Array.isArray(rows) ? rows : [])
+ .filter((r) => r && Number.isFinite(r.at) && r.at > since)
+ .sort((a, b) => b.at - a.at || `${a.channel}/${a.id}`.localeCompare(`${b.channel}/${b.id}`));
+}
+
+/**
+ * One case's row, or null.
+ *
+ * @param {{ id: string, title: string, since: number, fresh: Array<{ channel: string, id: string, at: number }>, href: string }} o
+ */
+export function caseCuesDecision({ id, title, since, fresh, href }) {
+ const n = fresh?.length ?? 0;
+ if (!n) return null;
+ const channels = [...new Set(fresh.map((r) => r.channel))];
+ const when = new Date(since).toISOString().slice(0, 16).replace("T", " ");
+ return {
+ project: `research/${id}`,
+ projectTitle: title,
+ // The case's piece (lib/research/cases.mjs casePieceId): a case has no lifecycle or mutes yet, so the
+ // Inbox draws no Park or Mute on its card.
+ piece: `c:${id}`,
+ kind: CASE_NEW_CUES,
+ target: id,
+ what: `${n} new transcript${n === 1 ? "" : "s"} since the last scan`,
+ why: `${n} new transcript${n === 1 ? "" : "s"} since the last scan · ${when} UTC · on ${channels.slice(0, 4).join(", ")}${channels.length > 4 ? ` and ${channels.length - 4} more` : ""} — scan the candidates again`,
+ href,
+ severity: "open",
+ at: fresh[0].at,
+ };
+}
diff --git a/umtool/lib/inbox/caseCues.ts b/umtool/lib/inbox/caseCues.ts
@@ -0,0 +1,131 @@
+import { existsSync } from "node:fs";
+import { readdir, stat } from "node:fs/promises";
+import path from "node:path";
+import { caseChannels } from "yt-dlp-transcript-common/controller/caseCorpus";
+import { readDefinition, readStages } from "yt-dlp-transcript-common/lib/research/caseStore-server";
+import type { Decision } from "@/lib/decisions";
+import { CHANNELS_DIR, REPORTS_ROOT } from "@/lib/paths.mjs";
+import { caseDir, isCaseId, readCase, researchDir } from "@/lib/research/cases.mjs";
+import { researchCasePipelineHref } from "@/lib/research/hrefs";
+import { corpusPaths } from "@/lib/research/pipeline";
+import { caseCuesDecision, lastScanOf, newSince } from "./caseCues.mjs";
+
+// ---------------------------------------------------------------------------
+// New transcripts on a live case, for the Inbox (lib/inbox/caseCues.mjs says
+// what counts): every research case with a pipeline, not done, scanned at
+// least once; its scope's channels (common's caseChannels) and, per video,
+// when its cues were last written --
+//
+// the transcript index's `mtimes` (key [channel, video] -> transcriptMs /
+// subsMs, build-index's own record: channelSignature.ts reads the same) when
+// the index is there -- a key range per channel, no file opened;
+// else (a fixture, a corpus never indexed) the video directories' cue files.
+//
+// Kept per case and scan for ten minutes (new transcripts land in batches; the
+// rail asks every ten seconds). A case that cannot be read adds nothing; this
+// never throws. SERVER ONLY.
+// ---------------------------------------------------------------------------
+
+const MEMO_MS = 10 * 60_000;
+type Row = { channel: string; id: string; at: number };
+type Memo = Map<string, { at: number; value: Decision | null }>;
+const g = globalThis as typeof globalThis & { __umtoolCaseCuesMemo?: Memo };
+const memo: Memo = (g.__umtoolCaseCuesMemo ??= new Map());
+
+/** A cue file's name: the transcript and its sidecars, a caption track. */
+const CUE_FILE = /^(transcript\..+|.+\.vtt)$/;
+
+/** Per video of `slugs`, when its cues were last written (ms), from an index already open. */
+type MtimesDb = { getRange(o: { start: unknown; end: unknown }): Iterable<{ key: unknown; value: { transcriptMs?: number | null; subsMs?: number | null } }> };
+function fromIndex(mtimes: MtimesDb, slugs: string[]): Row[] {
+ const out: Row[] = [];
+ for (const slug of slugs) {
+ for (const { key, value } of mtimes.getRange({ start: [slug], end: [slug, "\uffff"] })) {
+ const k = key as [string, string];
+ if (k[0] !== slug) break;
+ const at = Math.max(value?.transcriptMs ?? 0, value?.subsMs ?? 0);
+ if (at > 0) out.push({ channel: slug, id: k[1], at });
+ }
+ }
+ return out;
+}
+
+/** The same from the files: each video directory's newest cue file. */
+async function fromFiles(channelsDir: string, slugs: string[]): Promise<Row[]> {
+ const out: Row[] = [];
+ for (const slug of slugs) {
+ const data = path.join(/* turbopackIgnore: true */ channelsDir, slug, "data");
+ const ids = await readdir(/* turbopackIgnore: true */ data, { withFileTypes: true }).catch(() => []);
+ for (const d of ids) {
+ if (!d.isDirectory() || d.name.startsWith(".")) continue;
+ const names = await readdir(/* turbopackIgnore: true */ path.join(data, d.name)).catch(() => [] as string[]);
+ let at = 0;
+ for (const n of names) {
+ if (!CUE_FILE.test(n)) continue;
+ const s = await stat(/* turbopackIgnore: true */ path.join(data, d.name, n)).catch(() => null);
+ if (s && s.mtimeMs > at) at = s.mtimeMs;
+ }
+ if (at > 0) out.push({ channel: slug, id: d.name, at });
+ }
+ }
+ return out;
+}
+
+async function caseRow(id: string, index: () => Promise<MtimesDb | null>): Promise<Decision | null> {
+ const dir = caseDir(REPORTS_ROOT, id);
+ const def = await readDefinition(dir, id);
+ if (!def || def.status === "done") return null;
+ const since = lastScanOf(await readStages(dir));
+ if (since === null) return null;
+ const key = `${id}:${since}`;
+ const hit = memo.get(key);
+ if (hit && Date.now() - hit.at < MEMO_MS) return hit.value;
+ const paths = corpusPaths();
+ const { slugs } = await caseChannels(paths, def);
+ const mtimes = await index();
+ const rows = mtimes ? fromIndex(mtimes, slugs) : await fromFiles(CHANNELS_DIR, slugs);
+ const title = (await readCase(REPORTS_ROOT, id).catch(() => null))?.title ?? id;
+ const value = caseCuesDecision({ id, title, since, fresh: newSince(rows, since), href: researchCasePipelineHref(id) }) as Decision | null;
+ for (const k of memo.keys()) if (k.startsWith(`${id}:`)) memo.delete(k);
+ memo.set(key, { at: Date.now(), value });
+ return value;
+}
+
+/** Every live case's "N new transcripts since the last scan". Never throws. */
+export async function caseCuesDecisions(): Promise<Decision[]> {
+ try {
+ const names = await readdir(/* turbopackIgnore: true */ researchDir(REPORTS_ROOT), { withFileTypes: true }).catch(() => []);
+ const ids = names.filter((d) => d.isDirectory() && isCaseId(d.name)).map((d) => d.name);
+ if (!ids.length) return [];
+ // The index opened ONCE for every case (lmdb-js shares an environment by path: a close per case could
+ // end another case's range read), and the cases read one after another.
+ // Opened only when a case is not answered from the memo.
+ const lmdbPath = corpusPaths().lmdbPath;
+ type Env = { openDB: (o: object) => unknown; close: () => Promise<void> };
+ let root = null as Env | null;
+ let opened: Promise<MtimesDb | null> | null = null;
+ const index = () =>
+ (opened ??= (async () => {
+ if (!existsSync(/* turbopackIgnore: true */ lmdbPath)) return null;
+ try {
+ const { open } = await import("lmdb");
+ root = open({ path: lmdbPath, readOnly: true, maxDbs: 14 }) as unknown as Env;
+ return root.openDB({ name: "mtimes", encoding: "msgpack" }) as MtimesDb;
+ } catch {
+ return null;
+ }
+ })());
+ try {
+ const out: Decision[] = [];
+ for (const id of ids) {
+ const r = await caseRow(id, index).catch(() => null);
+ if (r) out.push(r);
+ }
+ return out;
+ } finally {
+ await root?.close().catch(() => {});
+ }
+ } catch {
+ return [];
+ }
+}
diff --git a/umtool/lib/inbox/checks.mjs b/umtool/lib/inbox/checks.mjs
@@ -0,0 +1,67 @@
+// QUOTE CHECKS GONE STALE (umtool redesign L4, "What needs you"): a project
+// that uses the quote check (`<p>/quote-check.json`, lib/report/quoteCheck.mjs)
+// and has clips the check no longer vouches for -- the cut or the quote changed
+// since its row (rowIsCurrent), or a clip with a quote that was never checked
+// -- is a call: one row per clip, one card per piece, its one-press action
+// **Run quote-check** on those clips (the durable queue: it transcribes through
+// the editor), its terminal twin `umtool quote-check <p> --clips a,b`.
+//
+// The failing rows themselves (moved, not-found) are the project reducer's,
+// blocking: clip-quote-moved / clip-quote-missing (lib/projects/report.mjs),
+// with their own one-press settles. A project with no quote-check.json raises
+// nothing here: the check is opt-in.
+//
+// Pure: lib/inbox/projectCalls.ts reads the manifest and the file.
+import { rowIsCurrent } from "../report/quoteCheck.mjs";
+
+export const QUOTE_CHECK_STALE = "quote-check-stale";
+
+/**
+ * The clips the check does not vouch for: `{ id, why: "stale" | "unchecked" }`, timeline order.
+ * @param {Array<Record<string, any>>} timeline
+ * @param {{ clips?: Record<string, any> } | null} doc readQuoteCheck()
+ */
+export function staleQuoteChecks(timeline, doc) {
+ const rows = doc?.clips && typeof doc.clips === "object" ? doc.clips : null;
+ if (!rows || !Object.keys(rows).length) return [];
+ const out = [];
+ for (const e of Array.isArray(timeline) ? timeline : []) {
+ if (e?.type !== "clip" || e.src || e.quoteRuled || !String(e.quote ?? "").trim()) continue;
+ const row = rows[e.id];
+ if (!row) out.push({ id: String(e.id), why: "unchecked" });
+ else if (!rowIsCurrent(row, e)) out.push({ id: String(e.id), why: "stale" });
+ }
+ return out;
+}
+
+/**
+ * The `quote-check-stale` rows of one project, each with the one-press settle
+ * for the whole set (the card's button runs the check on every clip it lists).
+ *
+ * @param {{ project: string, projectTitle: string, projectKind?: string, timeline: any[], doc: any, href: string, at: number }} o
+ */
+export function quoteCheckDecisions({ project, projectTitle, projectKind, timeline, doc, href, at }) {
+ const stale = staleQuoteChecks(timeline, doc);
+ if (!stale.length) return [];
+ const n = stale.length;
+ const what = `${n} quote check${n === 1 ? "" : "s"} out of date`;
+ const moved = stale.filter((s) => s.why === "stale").map((s) => s.id);
+ const never = stale.filter((s) => s.why === "unchecked").map((s) => s.id);
+ const list = (ids) => `${ids.slice(0, 6).join(", ")}${ids.length > 6 ? ` and ${ids.length - 6} more` : ""}`;
+ const why = [what, moved.length ? `cut or quote changed since: ${list(moved)}` : null, never.length ? `never checked: ${list(never)}` : null].filter(Boolean).join(" · ");
+ const clips = stale.map((s) => s.id);
+ return stale.map((s) => ({
+ project,
+ projectTitle,
+ ...(projectKind ? { projectKind } : {}),
+ kind: QUOTE_CHECK_STALE,
+ target: s.id,
+ what,
+ why,
+ href,
+ severity: "open",
+ at,
+ fix: `umtool quote-check ${project} --clips ${clips.join(",")}`,
+ settle: { kind: "quote-check", clips: [s.id], label: "Run quote-check" },
+ }));
+}
diff --git a/umtool/lib/inbox/groups.mjs b/umtool/lib/inbox/groups.mjs
@@ -71,6 +71,14 @@ const KIND_CATEGORY = {
// claims, each waiting on the operator's approve or reject.
"verdict-proposed": "review",
"unreadable-proposals": "fix",
+ // The redesign's "What needs you" (L4): a rendered version nobody judged,
+ // the draft's clips nobody walked, a research case's new transcripts since
+ // its last scan -- each something to look at; X's login when X work waits
+ // on it -- a fix, like a missing tool. A stale quote check is an open call.
+ "version-unjudged": "review",
+ "clips-unwalked": "review",
+ "case-new-cues": "review",
+ "x-jar-stale": "fix",
};
const CATEGORY_GROUP = {
@@ -99,7 +107,7 @@ export function groupOf(d) {
// Within a group: the brief's order first (proposals before failed runs), then
// everything else as equals.
-const KIND_RANK = { "worth-researching": 0, "research-proposal": 0, "iteration-failed": 1, "tick-held": 2, "tick-failed": 2, "tick-partial": 2, "iteration-ready": 0, "edition-ready": 0, "drafts-unreviewed": 1, "verdict-proposed": 1, "unreadable-notes": 0, "unreadable-proposals": 0, "refresh-held": 2, "refresh-available": 2, "sources-complete": 2 };
+const KIND_RANK = { "worth-researching": 0, "research-proposal": 0, "iteration-failed": 1, "tick-held": 2, "tick-failed": 2, "tick-partial": 2, "iteration-ready": 0, "edition-ready": 0, "drafts-unreviewed": 1, "verdict-proposed": 1, "unreadable-notes": 0, "unreadable-proposals": 0, "refresh-held": 2, "refresh-available": 2, "sources-complete": 2, "version-unjudged": 1, "case-new-cues": 2, "clips-unwalked": 3, "x-jar-stale": 0 };
const SEVERITY_RANK = { blocking: 0, open: 1, info: 2 };
// ONE primary action per decision, its button copy naming the result.
@@ -159,6 +167,11 @@ const ACTION_LABEL = {
"refresh-held": "Refresh",
"refresh-available": "Refresh",
"sources-complete": "Re-sweep",
+ "version-unjudged": "Play and judge",
+ "clips-unwalked": "Walk the clips",
+ "quote-check-stale": "Run quote-check",
+ "case-new-cues": "Scan again",
+ "x-jar-stale": "Refresh X's cookies",
};
const CATEGORY_LABEL = { fix: "Fix it", choose: "Decide", info: "Open", spend: "Decide", review: "Review", note: "Answer note", finish: "Mark done" };
@@ -266,13 +279,35 @@ export function summarizeGroups(items) {
what: d.what ?? null,
action: d.action ?? actionOf(d),
at: d.at ?? 0,
+ // The one-press settle the card offers in place (L4), when its rows agree on one.
+ settle: d.settle ?? null,
};
cardOf.set(key, card);
group.cards.push(card);
- }
+ } else card.settle = mergeSettle(card.settle, d.settle ?? null);
card.count += 1;
if ((SEVERITY_RANK[d.severity] ?? 3) < (SEVERITY_RANK[card.severity] ?? 3)) card.severity = d.severity;
card.at = Math.max(card.at, d.at ?? 0);
}
return out;
}
+
+/**
+ * The settle a CARD offers for all its rows (umtool redesign L4: one-click
+ * actions in the Inbox), from two rows' (lib/decisions.ts `settle`): a quote
+ * check runs on every clip either names; the same project-wide settle (a link
+ * check, a publish) is kept; anything else -- two clip patches, two different
+ * presses -- is no settle, and the card's link is the way. A row without one
+ * leaves the card without one.
+ *
+ * @param {Record<string, any> | null} a
+ * @param {Record<string, any> | null} b
+ */
+export function mergeSettle(a, b) {
+ if (!a || !b) return null;
+ if (a.kind === "quote-check" && b.kind === "quote-check") {
+ return { ...a, clips: [...new Set([...(a.clips ?? []), ...(b.clips ?? [])])] };
+ }
+ if (a.kind === "patch" || b.kind === "patch") return null;
+ return JSON.stringify(a) === JSON.stringify(b) ? a : null;
+}
diff --git a/umtool/lib/inbox/needs-you.test.ts b/umtool/lib/inbox/needs-you.test.ts
@@ -0,0 +1,279 @@
+// "What needs you" (umtool redesign L4): the Inbox's new decision sources --
+// versions to judge, clips not walked, stale quote checks, a live case's new
+// transcripts, X's jar -- as pure rows, then read from a temporary reports tree
+// and a stand-in editor; and the card's one-press settle (groups.mjs mergeSettle).
+//
+// Run with: pnpm --filter umtool exec tsx --test lib/inbox/needs-you.test.ts
+import { after, before, test } from "node:test";
+import assert from "node:assert/strict";
+import { createServer, type Server } from "node:http";
+import type { AddressInfo } from "node:net";
+import { mkdtempSync } from "node:fs";
+import { mkdir, rm, utimes, writeFile } from "node:fs/promises";
+import os from "node:os";
+import path from "node:path";
+
+// The environment BEFORE any module that reads lib/paths.mjs is loaded (checks.mjs reaches it through
+// quoteCheck.mjs): a static import would be hoisted above this and read the real ~/reports.
+const tmp = mkdtempSync(path.join(os.tmpdir(), "umtool-needs-you-"));
+process.env.CHANNELS_DIR = path.join(tmp, "channels");
+process.env.SITES_DIR = path.join(tmp, "sites");
+process.env.REPORTS_DIR = path.join(tmp, "reports");
+process.env.UMTOOL_XJAR_MEMO_MS = "0";
+const { VERSION_UNJUDGED, versionsDecisions, versionsToJudge } = await import("./versions.mjs");
+const { CLIPS_UNWALKED, walkDecisions } = await import("./walk.mjs");
+const { QUOTE_CHECK_STALE, quoteCheckDecisions, staleQuoteChecks } = await import("./checks.mjs");
+const { X_JAR_STALE, xJarDecision } = await import("./xJar.mjs");
+const { CASE_NEW_CUES, caseCuesDecision, lastScanOf, newSince } = await import("./caseCues.mjs");
+const { annotate, groupOf, mergeSettle, summarizeGroups } = await import("./groups.mjs");
+const { whatOf } = await import("./what.mjs");
+
+const take = (id: string, o: Record<string, unknown> = {}) => ({ id, label: id, previewSize: 100, previewMtimeMs: 0, builtAt: "2026-11-01T10:00:00Z", draft: false, quick: false, version: true, seconds: 95, ...o });
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+type Row = { kind: string; severity: string; [k: string]: any };
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+type Any = any;
+const annotated = (rows: Any[]): Row[] => annotate(rows as never[], { pieceOf: () => "p:x", lifecycleOf: () => "active" }) as Any[];
+
+test("versions to judge: rendered (its preview there, whatever `draft` says), no verdict, not superseded, not a quick render or a skipped take -- newest first", () => {
+ const takes = [
+ take("v1", { builtAt: "2026-11-01T10:00:00Z" }),
+ take("v2", { builtAt: "2026-11-03T10:00:00Z" }),
+ take("v3", { previewSize: null }),
+ take("d1", { draft: true, previewSize: null }),
+ take("d2", { draft: true, builtAt: "2026-10-25T10:00:00Z" }),
+ take("q1", { quick: true }),
+ take("liked"),
+ take("gone"),
+ take("clip"),
+ ];
+ const verdicts = { liked: { verdict: "like" }, gone: { verdict: null, superseded: { by: "v2" } } };
+ assert.deepEqual(versionsToJudge(takes, verdicts, { skip: (t) => t.id === "clip" }).map((t) => t.id), ["v2", "v1", "d2"]);
+ const rows = versionsDecisions({ project: "x", projectTitle: "X", takes, verdicts, playHref: (t) => `/projects/x/play?take=${t}`, skip: (t) => t.id === "clip", now: Date.parse("2026-11-04T00:00:00Z") });
+ assert.equal(rows.length, 3);
+ assert.ok(rows.every((r) => r.kind === VERSION_UNJUDGED && r.href === "/projects/x/play?take=v2" && r.what === "3 versions to judge" && r.severity === "open"));
+ assert.match(rows[0].why, /^3 versions to judge · newest version v2 · 1:35 · rendered 2026-11-03/);
+ const [row] = annotated(rows);
+ assert.equal(groupOf(row), "review");
+ assert.equal(row.action.label, "Play and judge");
+ // A render nobody judged for two weeks is no longer waiting: Quiet, folded.
+ const later = versionsDecisions({ project: "x", projectTitle: "X", takes, verdicts, playHref: () => "/", skip: (t) => t.id === "clip", now: Date.parse("2026-11-16T12:00:00Z") });
+ assert.deepEqual(later.map((r) => [r.target, r.severity, r.what]), [["v2", "open", "1 version to judge"], ["v1", "info", "2 versions to judge"], ["d2", "info", "2 versions to judge"]]);
+ assert.equal(later[1].href, "/");
+ assert.equal(groupOf(later[1]), "quiet");
+ assert.deepEqual(versionsDecisions({ project: "x", projectTitle: "X", takes: [], verdicts: {}, playHref: () => "/" }), []);
+ // Shapes it does not know are left out, never thrown on.
+ assert.deepEqual(versionsToJudge(null as never, null as never), []);
+});
+
+test("clips not walked: only on a draft going somewhere -- a walk begun or a render made; the bench on the first in walk order", () => {
+ const clips = [
+ { id: "c03", verdict: "unreviewed" },
+ { id: "c01", verdict: "confirmed" },
+ { id: "c02", verdict: "unreviewed" },
+ ];
+ const base = { project: "x", projectTitle: "X", at: 5, now: 10, benchHref: (c: string) => `/projects/x/clip/${c}` };
+ const rows = walkDecisions({ ...base, clips, rendered: false });
+ assert.deepEqual(rows.map((r) => r.target), ["c03", "c02"]);
+ assert.ok(rows.every((r) => r.kind === CLIPS_UNWALKED && r.href === "/projects/x/clip/c03" && r.what === "2 clips not walked"));
+ assert.match(rows[0].why, /2 clips not walked · 1 of 3 walked · next c03 — c03, c02/);
+ // Never walked and never rendered: a cut in the making, not yet a call.
+ assert.deepEqual(walkDecisions({ ...base, clips: clips.map((c) => ({ ...c, verdict: "unreviewed" })), rendered: false }), []);
+ assert.equal(walkDecisions({ ...base, clips: clips.map((c) => ({ ...c, verdict: "unreviewed" })), rendered: true }).length, 3);
+ assert.deepEqual(walkDecisions({ ...base, clips: clips.map((c) => ({ ...c, verdict: "confirmed" })), rendered: true }), []);
+ const [row] = annotated(rows);
+ assert.deepEqual([groupOf(row), row.action.label, whatOf(CLIPS_UNWALKED)], ["review", "Walk the clips", "clips not walked"]);
+ // A draft untouched for two weeks: its walk is not waiting.
+ assert.ok(walkDecisions({ ...base, clips, rendered: false, now: 5 + 15 * 864e5 }).every((r) => r.severity === "info"));
+});
+
+test("stale quote checks: a clip whose cut or quote changed since its row, or never checked, on a project that uses the check", () => {
+ const clip = (id: string, start: number, o: Record<string, unknown> = {}) => ({ type: "clip", id, video: "v", start, end: start + 5, quote: `Line ${start}`, ...o });
+ const row = (start: number, status = "ok") => ({ status, cut: { from: start, to: start + 5 }, quote: `Line ${start}` });
+ const timeline = [clip("a", 10), clip("b", 20, { cutStart: 21 }), clip("c", 30), clip("d", 40, { quoteRuled: true }), clip("e", 50, { quote: "" }), { type: "card", id: "k1" }];
+ const doc: Any = { version: 1, clips: { a: row(10), b: row(20, "moved"), d: row(1) } };
+ assert.deepEqual(staleQuoteChecks(timeline, doc), [
+ { id: "b", why: "stale" },
+ { id: "c", why: "unchecked" },
+ ]);
+ // No quote-check.json (or an empty one): the check is opt-in, nothing to say.
+ assert.deepEqual(staleQuoteChecks(timeline, { clips: {} }), []);
+ assert.deepEqual(staleQuoteChecks(timeline, null), []);
+ const rows = quoteCheckDecisions({ project: "x", projectTitle: "X", timeline, doc, href: "/projects/x", at: 1 });
+ assert.deepEqual(rows.map((r) => [r.kind, r.target, r.settle]), [
+ [QUOTE_CHECK_STALE, "b", { kind: "quote-check", clips: ["b"], label: "Run quote-check" }],
+ [QUOTE_CHECK_STALE, "c", { kind: "quote-check", clips: ["c"], label: "Run quote-check" }],
+ ]);
+ assert.equal(rows[0].fix, "umtool quote-check x --clips b,c");
+ assert.match(rows[0].why, /2 quote checks out of date · cut or quote changed since: b · never checked: c/);
+ // One card, one press over every clip it lists.
+ const [g] = (summarizeGroups(annotated(rows)) as Any[]).filter((x) => x.cards.length);
+ assert.equal(g.id, "open");
+ assert.deepEqual(g.cards[0].settle, { kind: "quote-check", clips: ["b", "c"], label: "Run quote-check" });
+ assert.equal(g.cards[0].action.label, "Run quote-check");
+});
+
+test("a card's settle: one quote check over every clip; the same project-wide press kept; two patches, or a row without one, none", () => {
+ const q = (c: string) => ({ kind: "quote-check", clips: [c], label: "Run quote-check" });
+ const links = { kind: "check-links", fix: true, label: "Use embed ids (2)" };
+ assert.deepEqual(mergeSettle(q("a"), q("b")), { kind: "quote-check", clips: ["a", "b"], label: "Run quote-check" });
+ assert.deepEqual(mergeSettle(links, { ...links }), links);
+ assert.equal(mergeSettle({ kind: "patch", clip: "a", patch: {}, label: "x" }, { kind: "patch", clip: "b", patch: {}, label: "x" }), null);
+ assert.equal(mergeSettle(links, null), null);
+ assert.equal(mergeSettle(links, { kind: "check-links", label: "Check links" }), null);
+});
+
+test("X's jar: a row only when an X alert is up (X work waits) -- the editor's three lines, Blocking", () => {
+ const x = { source: "profile", ageMinutes: 190, maxAgeMinutes: 60, fresh: false, loggedIn: true, at: null, readAt: "", summary: "" };
+ const alert = { service: "x", label: "X", family: "x", state: "stale", kind: "jar-age", raisedAt: "2026-11-09T10:00:00Z", headline: "X cookies are 3 h old (limit 60 min)", fix: "Refresh cookies (or Connect X account) on /settings — then Recheck.", detail: "2 X jobs are queued." };
+ assert.equal(xJarDecision({ alerts: [], x }, { href: "/s" }), null);
+ assert.equal(xJarDecision({ alerts: [{ ...alert, state: "ok-again" }], x }, { href: "/s" }), null);
+ assert.equal(xJarDecision({ alerts: [{ ...alert, family: "ytdlp", service: "rumble" }], x }, { href: "/s" }), null);
+ assert.equal(xJarDecision("not a payload", { href: "/s" }), null);
+ const row = xJarDecision({ alerts: [alert], x }, { href: "http://editor/settings" });
+ assert.ok(row);
+ assert.equal(row.kind, X_JAR_STALE);
+ assert.equal(row.severity, "blocking");
+ assert.equal(row.why, "X cookies are 3 h old (limit 60 min) Refresh cookies (or Connect X account) on /settings — then Recheck. 2 X jobs are queued.");
+ assert.equal(row.at, Date.parse("2026-11-09T10:00:00Z"));
+ const [a] = annotate([row], { pieceOf: () => null, lifecycleOf: () => "active" });
+ assert.deepEqual([a.group, a.action.label, a.hidden], ["blocking", "Refresh X's cookies", false]);
+});
+
+test("a live case's new transcripts: since its last done candidate scan; none before one ran", () => {
+ assert.equal(lastScanOf({}), null);
+ assert.equal(lastScanOf({ candidates: { state: "running", startedAt: "2026-11-01T00:00:00Z" } }), null);
+ const since = lastScanOf({ candidates: { state: "done", startedAt: "2026-11-01T00:00:00Z", endedAt: "2026-11-01T00:05:00Z" } });
+ assert.equal(since, Date.parse("2026-11-01T00:05:00Z"));
+ const rows = [
+ { channel: "a", id: "old", at: since! - 1 },
+ { channel: "a", id: "new1", at: since! + 10 },
+ { channel: "b", id: "new2", at: since! + 20 },
+ ];
+ const fresh = newSince(rows, since!);
+ assert.deepEqual(fresh.map((r) => r.id), ["new2", "new1"]);
+ const row = caseCuesDecision({ id: "lighthouse", title: "Lighthouse", since: since!, fresh, href: "/research/lighthouse/pipeline" });
+ assert.ok(row);
+ assert.deepEqual([row.kind, row.target, row.what, row.at], [CASE_NEW_CUES, "lighthouse", "2 new transcripts since the last scan", since! + 20]);
+ assert.match(row.why, /since the last scan · 2026-11-01 00:05 UTC · on b, a — scan the candidates again/);
+ assert.equal(caseCuesDecision({ id: "x", title: "x", since: since!, fresh: [], href: "/" }), null);
+ const [a] = annotate([row], { pieceOf: () => null, lifecycleOf: () => "active" });
+ assert.deepEqual([a.group, a.action.label], ["review", "Scan again"]);
+});
+
+// ─── read from disk and from a stand-in editor ────────────────────────────────
+
+let editor: Server;
+let services: unknown = { ok: true, alerts: [], pending: [] };
+
+before(async () => {
+ editor = createServer((req, res) => {
+ res.setHeader("content-type", "application/json");
+ if (req.url?.startsWith("/api/ops/services")) return res.end(JSON.stringify(services));
+ res.statusCode = 404;
+ res.end(JSON.stringify({ ok: false, error: "no route" }));
+ });
+ await new Promise<void>((r) => editor.listen(0, "127.0.0.1", r));
+ process.env.ARCHILYZER_EDITOR_URL = `http://127.0.0.1:${(editor.address() as AddressInfo).port}`;
+ process.env.WORKER_TOKEN = "t";
+
+ // A report video with two rendered versions (one judged), a walk begun, and a quote check gone stale.
+ const p = path.join(tmp, "reports", "ny-cut");
+ const clip = (id: string, start: number, o: Record<string, unknown> = {}) => ({ type: "clip", id, video: "vid", start, end: start + 4, cite: start, quote: `Line ${start}`, ...o });
+ await mkdir(p, { recursive: true });
+ await writeFile(
+ path.join(p, "video.manifest.json"),
+ JSON.stringify({ schemaVersion: 1, slug: "ny-cut", title: "The NY Cut", provenance: { channelSlug: "nychan" }, render: { width: 1920, height: 1080, fps: 30 }, timeline: [clip("c01", 10, { verdict: "confirmed" }), clip("c02", 20), clip("c03", 30)] }),
+ );
+ for (const [id, order] of [["v1", 1], ["v2", 2]] as const) {
+ await mkdir(path.join(p, "takes", id), { recursive: true });
+ await writeFile(path.join(p, "takes", id, "take.json"), JSON.stringify({ id, group: "cut", order, label: `Version ${order}`, kind: "similar", preview: "preview.mp4", version: true, window: "full", builtAt: new Date(Date.now() - (3 - order) * 864e5).toISOString() }));
+ await writeFile(path.join(p, "takes", id, "preview.mp4"), "mp4");
+ }
+ await writeFile(path.join(p, "takes", "verdicts.json"), JSON.stringify({ v1: { verdict: "like", note: "", at: "2026-11-02T00:00:00Z" } }));
+ await writeFile(path.join(p, "quote-check.json"), JSON.stringify({ version: 1, clips: { c02: { status: "ok", cut: { from: 19, to: 24 }, quote: "Line 20" } } }));
+
+ // A live case scanned on 1 Nov, its channel transcribed once before and twice after.
+ const c = path.join(tmp, "reports", ".umtool", "research", "ny-case");
+ await mkdir(c, { recursive: true });
+ const now = "2026-11-01T00:00:00Z";
+ await writeFile(path.join(c, "case.json"), JSON.stringify({ format: "umtool-research-case", version: 1, id: "ny-case", title: "The NY Case", scope: { source: "local" }, search: null, sessions: [], sections: [], quotes: [], notes: "", handoffs: [], counters: { quote: 0, section: 0 }, createdAt: now, updatedAt: now }));
+ await writeFile(path.join(c, "pipeline.json"), JSON.stringify({ format: "archilyzer-case-pipeline", version: 1, case: "ny-case", subjects: [], scope: { channels: ["nychan"], groups: [], sites: [] }, eras: [], groups: [], privateNames: { sha256: [], note: "" }, readerPrompts: { common: "" }, status: "reading", createdAt: now, updatedAt: now }));
+ await writeFile(path.join(c, "stages.json"), JSON.stringify({ candidates: { state: "done", startedAt: now, endedAt: "2026-11-01T00:05:00Z", by: "cli", pid: 1, log: [] } }));
+ for (const [id, when] of [["old", "2026-10-20T00:00:00Z"], ["new1", "2026-11-03T00:00:00Z"], ["new2", "2026-11-04T00:00:00Z"]]) {
+ const d = path.join(tmp, "channels", "nychan", "data", id);
+ await mkdir(d, { recursive: true });
+ await writeFile(path.join(d, "transcript.cues.json"), "{}");
+ await utimes(path.join(d, "transcript.cues.json"), new Date(when), new Date(when));
+ }
+});
+
+after(async () => {
+ editor?.close();
+ await rm(tmp, { recursive: true, force: true });
+});
+
+test("from disk: the report video's version to judge, its clips not walked, its stale quote check -- each kind once per row", async () => {
+ const { projectCallsAll } = await import("./projectCalls");
+ const rows = (await projectCallsAll()).filter((d) => d.project === "ny-cut");
+ const of = (k: string) => rows.filter((d) => d.kind === k).map((d) => d.target);
+ assert.deepEqual(of(VERSION_UNJUDGED), ["v2"]);
+ assert.equal(rows.find((d) => d.kind === VERSION_UNJUDGED)?.href, "/projects/ny-cut/play?take=v2");
+ assert.deepEqual(of(CLIPS_UNWALKED), ["c02", "c03"]);
+ assert.equal(rows.find((d) => d.kind === CLIPS_UNWALKED)?.href, "/projects/ny-cut/clip/c02");
+ // c02's row is for a cut it no longer plays; c01 and c03 were never checked.
+ assert.deepEqual(of(QUOTE_CHECK_STALE), ["c01", "c02", "c03"]);
+ assert.ok(rows.every((d) => d.projectTitle === "The NY Cut"));
+ // Read again with nothing changed: the same rows (the memo), and judging v2 drops it.
+ assert.deepEqual((await projectCallsAll()).filter((d) => d.project === "ny-cut"), rows);
+ await writeFile(path.join(tmp, "reports", "ny-cut", "takes", "verdicts.json"), JSON.stringify({ v1: { verdict: "like", note: "", at: "x" }, v2: { verdict: "maybe", note: "", at: "y" } }));
+ assert.deepEqual((await projectCallsAll()).filter((d) => d.project === "ny-cut" && d.kind === VERSION_UNJUDGED), []);
+});
+
+test("from disk: the live case's two new transcripts since its scan (the files, with no index)", async () => {
+ const { caseCuesDecisions } = await import("./caseCues");
+ const [row] = await caseCuesDecisions();
+ assert.ok(row);
+ assert.deepEqual([row.kind, row.project, row.projectTitle, row.href, row.piece], [CASE_NEW_CUES, "research/ny-case", "The NY Case", "/research/ny-case/pipeline", "c:ny-case"]);
+ assert.equal(row.what, "2 new transcripts since the last scan");
+});
+
+test("from the editor: no row while no X work waits; the row once the jar's alert is up; none when the editor is gone", async () => {
+ const { xJarDecisions } = await import("./xJar");
+ assert.deepEqual(await xJarDecisions(), []);
+ services = { ok: true, alerts: [{ service: "x", label: "X", family: "x", state: "stale", kind: "jar-age", raisedAt: "2026-11-09T10:00:00Z", headline: "X cookies are 3 h old", fix: "Refresh cookies on /settings — then Recheck.", detail: "" }], pending: [] };
+ const [row] = await xJarDecisions();
+ assert.equal(row?.kind, X_JAR_STALE);
+ assert.equal(row?.href, `${process.env.ARCHILYZER_EDITOR_URL}/settings`);
+ await new Promise<void>((r) => editor.close(() => r()));
+ assert.deepEqual(await xJarDecisions(), []);
+});
+
+test("the one-press routes refuse another site's write (sameOrigin.mjs) and still take this app's own", async () => {
+ const routes = [
+ { mod: await import("../../app/api/report/links/route"), method: "POST" as const, body: { project: "ny-cut", fix: true } },
+ { mod: await import("../../app/api/report/takes/verdict/route"), method: "POST" as const, body: { project: "ny-cut", take: "v2", verdict: "like" } },
+ { mod: await import("../../app/api/report/window/route"), method: "PUT" as const, body: { project: "ny-cut", clip: "c02", lockCut: true } },
+ // Home's Quick clip render (it starts a job) and the timeline's writes (Add clip).
+ { mod: await import("../../app/api/report/quick-clip/route"), method: "POST" as const, body: { spec: "nychan/nyfresh@1-2" } },
+ { mod: await import("../../app/api/report/timeline/route"), method: "POST" as const, body: { project: "ny-cut", op: "remove", id: "c03" } },
+ ];
+ for (const { mod, method, body } of routes) {
+ const handler = (mod as unknown as Record<string, (r: Request) => Promise<Response>>)[method];
+ // A text/plain form post from evil.example to this app: no preflight, refused before the body is read.
+ const cross = await handler(
+ new Request("http://localhost:3050/api/x", { method, headers: { host: "localhost:3050", origin: "https://evil.example", "sec-fetch-site": "cross-site", "content-type": "text/plain" }, body: JSON.stringify(body) }),
+ );
+ assert.equal(cross.status, 403, method);
+ assert.match(((await cross.json()) as { error: string }).error, /refused/);
+ // A rebinding page (Host: evil.example) is refused too.
+ const rebound = await handler(new Request("http://evil.example/api/x", { method, headers: { host: "evil.example:3050" }, body: JSON.stringify(body) }));
+ assert.equal(rebound.status, 403);
+ }
+ // This app's own page (same-origin) gets past the guard: the verdict is written.
+ const verdict = (await import("../../app/api/report/takes/verdict/route")) as unknown as { POST: (r: Request) => Promise<Response> };
+ const own = await verdict.POST(
+ new Request("http://localhost:3050/api/report/takes/verdict", { method: "POST", headers: { host: "localhost:3050", origin: "http://localhost:3050", "sec-fetch-site": "same-origin", "content-type": "application/json" }, body: JSON.stringify({ project: "ny-cut", take: "v2", verdict: "no" }) }),
+ );
+ assert.equal(own.status, 200, await own.clone().text());
+});
diff --git a/umtool/lib/inbox/projectCalls.ts b/umtool/lib/inbox/projectCalls.ts
@@ -0,0 +1,124 @@
+import { stat, readdir } from "node:fs/promises";
+import path from "node:path";
+import type { Decision } from "@/lib/decisions";
+import { clipBenchHref, playHref, projectHref } from "@/lib/hrefs";
+import { projectRefs } from "@/lib/projects";
+import { kindMakesTakes } from "@/lib/projects/kinds.mjs";
+import { readManifest, reviewOf, walkOrder } from "@/lib/projects/report.mjs";
+import type { ProjectRef } from "@/lib/project-types";
+import { QUOTE_CHECK_FILE, readQuoteCheck } from "@/lib/report/quoteCheck.mjs";
+import { QUICK_CLIP_FOLDER, QUICK_CLIP_TAKE } from "@/lib/report/quickClip.mjs";
+import { listTakes, readVerdicts, takesDirOf, verdictsFileOf } from "@/lib/report/takes.mjs";
+import { quoteCheckDecisions } from "./checks.mjs";
+import { versionsDecisions } from "./versions.mjs";
+import { walkDecisions } from "./walk.mjs";
+
+// ---------------------------------------------------------------------------
+// A REPORT VIDEO'S CALLS THE REDUCER DOES NOT MAKE (umtool redesign L4, "What
+// needs you"), read from its disk for the Inbox:
+//
+// version-unjudged a rendered version (or legacy take) with no verdict
+// (lib/inbox/versions.mjs) -- Play and judge
+// clips-unwalked the draft's clips with no walk verdict, on a draft that
+// is going somewhere (lib/inbox/walk.mjs) -- Walk
+// quote-check-stale clips the quote check no longer vouches for
+// (lib/inbox/checks.mjs) -- Run quote-check
+//
+// One project that cannot be read adds nothing; nothing here throws. Each
+// project's rows are kept against a signature of the files they come from
+// (the manifest, quote-check.json, takes/ and each take's directory, the
+// verdicts), on globalThis: one cache per process, not per Next bundle.
+// SERVER ONLY.
+// ---------------------------------------------------------------------------
+
+type Memo = Map<string, { sig: string; value: Decision[] }>;
+const g = globalThis as typeof globalThis & { __umtoolProjectCallsMemo?: Memo };
+const memo: Memo = (g.__umtoolProjectCallsMemo ??= new Map());
+
+const stamp = async (file: string) => {
+ const s = await stat(/* turbopackIgnore: true */ file).catch(() => null);
+ return s ? `${Math.round(s.mtimeMs)}.${s.size}` : "-";
+};
+
+async function signatureOf(dir: string): Promise<string> {
+ const takes = takesDirOf(dir);
+ const entries = await readdir(/* turbopackIgnore: true */ takes).catch(() => [] as string[]);
+ const per = await Promise.all(entries.filter((n) => !n.startsWith(".")).sort().map(async (n) => `${n}@${await stamp(path.join(takes, n))}`));
+ const [man, qc, verdicts] = await Promise.all([stamp(path.join(dir, "video.manifest.json")), stamp(path.join(dir, QUOTE_CHECK_FILE)), stamp(verdictsFileOf(dir))]);
+ // A coarse clock too: versions.mjs and walk.mjs age rows into Quiet at RECENT_DAYS, which no file says.
+ const bucket = Math.floor(Date.now() / (6 * 3600_000));
+ return [man, qc, verdicts, per.join(","), bucket].join("|");
+}
+
+/** A quick clip's project (lib/report/quickClip.mjs: `<reports>/quick-clips/<slug>`): a share, not a piece in the making. */
+const isQuickClip = (ref: ProjectRef) => ref.id.startsWith(`${QUICK_CLIP_FOLDER}/`);
+/** A take a quick clip made: a share, not a version to judge. */
+const isQuickClipTake = (ref: ProjectRef, take: { id: string }) => take.id === QUICK_CLIP_TAKE && isQuickClip(ref);
+
+async function callsOf(ref: ProjectRef): Promise<Decision[]> {
+ // A quick clip is shared, not judged or walked: no calls.
+ if (isQuickClip(ref)) return [];
+ const manifest = (await readManifest(ref.dir)) as Record<string, unknown> | null;
+ const title = typeof manifest?.title === "string" && manifest.title ? manifest.title : ref.name;
+ const base = { project: ref.id, projectTitle: title, projectKind: ref.kind };
+ const [{ takes }, verdicts] = await Promise.all([listTakes(ref.dir), readVerdicts(ref.dir)]);
+ const out: Decision[] = [];
+
+ out.push(
+ ...(versionsDecisions({
+ ...base,
+ takes,
+ verdicts,
+ playHref: (take: string) => playHref(ref.id, { take }),
+ skip: (t: Record<string, unknown>) => isQuickClipTake(ref, { id: String(t.id) }),
+ }) as Decision[]),
+ );
+
+ if (manifest) {
+ const timeline = (manifest.timeline ?? []) as Record<string, unknown>[];
+ const review = reviewOf(manifest);
+ const verdictOf = new Map(review.clips.map((c: { id: string; verdict: string }) => [c.id, c.verdict]));
+ const clips = walkOrder(timeline).map((e: { id: string }) => ({ id: String(e.id), verdict: verdictOf.get(e.id) ?? "unreviewed" }));
+ const rendered = takes.some((t: { previewSize: number | null; version: boolean }) => t.previewSize != null || t.version);
+ const at = await stat(/* turbopackIgnore: true */ path.join(ref.dir, "video.manifest.json")).then((s) => s.mtimeMs, () => 0);
+ out.push(...(walkDecisions({ ...base, clips, rendered, at, benchHref: (clip: string) => clipBenchHref(ref.id, clip) }) as Decision[]));
+ const doc = await readQuoteCheck(ref.dir);
+ const checkedAt = Date.parse(String((doc as { checkedAt?: string }).checkedAt ?? "")) || at;
+ out.push(...(quoteCheckDecisions({ ...base, timeline, doc, href: projectHref(ref.id), at: checkedAt }) as Decision[]));
+ }
+ return out;
+}
+
+async function projectCalls(ref: ProjectRef): Promise<Decision[]> {
+ const sig = await signatureOf(ref.dir);
+ const hit = memo.get(ref.id);
+ if (hit && hit.sig === sig) return hit.value;
+ const value = await callsOf(ref).catch(() => [] as Decision[]);
+ memo.set(ref.id, { sig, value });
+ return value;
+}
+
+// One read at a time: the page and the rail's count ask together, and share it.
+const gi = globalThis as typeof globalThis & { __umtoolProjectCallsInflight?: Promise<Decision[]> | null };
+
+/** Every report video's versions to judge, clips not walked and stale quote checks. Never throws. */
+export function projectCallsAll(): Promise<Decision[]> {
+ if (gi.__umtoolProjectCallsInflight) return gi.__umtoolProjectCallsInflight;
+ const p = readAll().finally(() => {
+ if (gi.__umtoolProjectCallsInflight === p) gi.__umtoolProjectCallsInflight = null;
+ });
+ gi.__umtoolProjectCallsInflight = p;
+ return p;
+}
+
+async function readAll(): Promise<Decision[]> {
+ try {
+ const refs = (await projectRefs()).filter((r) => kindMakesTakes(r.kind));
+ const live = new Set(refs.map((r) => r.id));
+ for (const id of memo.keys()) if (!live.has(id)) memo.delete(id);
+ const per = await Promise.all(refs.map((r) => projectCalls(r).catch(() => [] as Decision[])));
+ return per.flat();
+ } catch {
+ return [];
+ }
+}
diff --git a/umtool/lib/inbox/versions.mjs b/umtool/lib/inbox/versions.mjs
@@ -0,0 +1,94 @@
+// VERSIONS TO JUDGE (umtool redesign L4, "What needs you"): a saved version
+// (lib/report/versions.mjs) -- or a legacy take -- that has a RENDER and no
+// verdict is a call in the Inbox's Review group. One row per version (the API
+// keeps one row per decision), one card per piece ("3 versions to judge"), its
+// action Play and judge: Play on the newest of them (`?take=`), where the
+// verdict buttons are.
+//
+// Not a version to judge: one with no render on disk (a saved version not yet
+// rendered, a draft take -- `previewSize` null), a quick draft-quality
+// render, a superseded take (folded away by a person), and a quick clip's one
+// take (a share, not a version -- lib/report/quickClip.mjs). "Rendered" is the
+// preview file being there, whatever take.json's `draft` says.
+//
+// Pure: lib/inbox/projectCalls.ts reads the takes and verdicts and hands them
+// here. Never throws on a shape it does not know: it is left out.
+
+export const VERSION_UNJUDGED = "version-unjudged";
+/**
+ * A render older than this that nobody judged is no longer waiting: its rows are `info` (the Quiet group,
+ * folded) rather than Review -- on the real tree (9 Nov) 46 projects had a render with no verdict, 18 of them
+ * from the last two weeks.
+ */
+export const RECENT_DAYS = 14;
+
+const timeOf = (t) => {
+ const ms = Date.parse(t?.builtAt ?? t?.savedAt ?? "");
+ if (Number.isFinite(ms)) return ms;
+ return Number.isFinite(t?.previewMtimeMs) ? t.previewMtimeMs : 0;
+};
+
+/**
+ * The takes that wait on a verdict, newest first.
+ *
+ * @param {Array<Record<string, any>>} takes listTakes()'s takes
+ * @param {Record<string, { verdict?: string | null, superseded?: unknown }>} verdicts readVerdicts()
+ * @param {{ skip?: (take: Record<string, any>) => boolean }} [o]
+ */
+export function versionsToJudge(takes, verdicts, { skip = () => false } = {}) {
+ const v = verdicts && typeof verdicts === "object" ? verdicts : {};
+ return (Array.isArray(takes) ? takes : [])
+ .filter((t) => t && typeof t.id === "string")
+ .filter((t) => t.previewSize != null && t.quick !== true)
+ .filter((t) => !v[t.id]?.verdict && !v[t.id]?.superseded)
+ .filter((t) => !skip(t))
+ .sort((a, b) => timeOf(b) - timeOf(a) || String(a.id).localeCompare(String(b.id)));
+}
+
+/** The card's title: how many wait. */
+export function versionsWhat(waiting) {
+ const n = waiting.length;
+ return `${n} version${n === 1 ? "" : "s"} to judge`;
+}
+
+const day = (ms) => (ms ? new Date(ms).toISOString().slice(0, 10) : null);
+const mins = (s) => (Number.isFinite(s) && s > 0 ? `${Math.floor(s / 60)}:${String(Math.round(s % 60)).padStart(2, "0")}` : null);
+
+/**
+ * The `version-unjudged` rows of one project.
+ *
+ * @param {{
+ * project: string, projectTitle: string, projectKind?: string,
+ * takes: Array<Record<string, any>>, verdicts: Record<string, any>,
+ * playHref: (take: string) => string,
+ * skip?: (take: Record<string, any>) => boolean,
+ * now?: number,
+ * }} o
+ */
+export function versionsDecisions({ project, projectTitle, projectKind, takes, verdicts, playHref, skip, now = Date.now() }) {
+ const waiting = versionsToJudge(takes, verdicts, { skip });
+ if (!waiting.length) return [];
+ const old = (t) => now - timeOf(t) > RECENT_DAYS * 864e5;
+ // Two cards at most: the recent renders (Review) and the older ones (Quiet), each counted and named by its own.
+ return [waiting.filter((t) => !old(t)), waiting.filter(old)].flatMap((rows) => {
+ if (!rows.length) return [];
+ const what = versionsWhat(rows);
+ // The card's sentence is its newest row's (summarizeGroups keeps the first, ranked newest first).
+ const newest = rows[0];
+ const href = playHref(newest.id);
+ const facts = [`${newest.version ? "version" : "take"} ${newest.id}`, newest.label && newest.label !== newest.id ? `“${newest.label}”` : null, mins(newest.seconds), day(timeOf(newest)) ? `rendered ${day(timeOf(newest))}` : null];
+ const why = `${what} · newest ${facts.filter(Boolean).join(" · ")} — play it and say like, maybe or no`;
+ return rows.map((t) => ({
+ project,
+ projectTitle,
+ ...(projectKind ? { projectKind } : {}),
+ kind: VERSION_UNJUDGED,
+ target: t.id,
+ what,
+ why,
+ href,
+ severity: old(t) ? "info" : "open",
+ at: timeOf(t),
+ }));
+ });
+}
diff --git a/umtool/lib/inbox/walk.mjs b/umtool/lib/inbox/walk.mjs
@@ -0,0 +1,70 @@
+// CLIPS NOT WALKED (umtool redesign L4, "What needs you"): the working draft's
+// clips with no walk verdict (lib/projects/report.mjs reviewOf: "unreviewed")
+// are a call in the Review group -- one row per clip, one card per piece
+// ("12 clips not walked"), its action the clip bench on the first of them in
+// walk order (by source, then start: report.mjs walkOrder), the one that is
+// fetched first when any is.
+//
+// Only a draft that is GOING somewhere is waiting on a walk: one whose walk has
+// begun (a clip has a verdict), or that has a rendered take or a saved version.
+// A cut still being assembled, never walked and never rendered, is not yet a
+// call -- 78 of the 91 real report projects have unwalked clips (9 Nov), and an
+// Inbox that lists every cut in the making is one nobody reads. And a draft
+// nobody has edited for RECENT_DAYS is not waiting either: its rows are `info`
+// (the Quiet group, folded), 43 projects down to 12 on the real tree.
+//
+// Pure: lib/inbox/projectCalls.ts reads the manifest and the takes and hands
+// the walk's rows here.
+
+export const CLIPS_UNWALKED = "clips-unwalked";
+/** A draft not edited for this long is no longer waiting on its walk: `info` (Quiet, folded) -- versions.mjs's rule. */
+export { RECENT_DAYS } from "./versions.mjs";
+import { RECENT_DAYS } from "./versions.mjs";
+
+/** The card's title. */
+export function walkWhat(n) {
+ return `${n} clip${n === 1 ? "" : "s"} not walked`;
+}
+
+/**
+ * The `clips-unwalked` rows of one project.
+ *
+ * `clips` in WALK order (reviewOf's rows, walkOrder); `rendered`: the project
+ * has a rendered take or a saved version.
+ *
+ * @param {{
+ * project: string, projectTitle: string, projectKind?: string,
+ * clips: Array<{ id: string, verdict: string, fetched?: boolean }>,
+ * rendered: boolean,
+ * at: number,
+ * benchHref: (clip: string) => string,
+ * now?: number,
+ * }} o
+ */
+export function walkDecisions({ project, projectTitle, projectKind, clips, rendered, at, benchHref, now = Date.now() }) {
+ const rows = (Array.isArray(clips) ? clips : []).filter((c) => c && typeof c.id === "string");
+ const waiting = rows.filter((c) => c.verdict === "unreviewed");
+ if (!waiting.length) return [];
+ const walked = rows.length - waiting.length;
+ if (!walked && !rendered) return [];
+ const first = waiting.find((c) => c.fetched) ?? waiting[0];
+ const what = walkWhat(waiting.length);
+ const ids = waiting.map((c) => c.id);
+ const why =
+ `${what} · ${walked} of ${rows.length} walked · next ${first.id}` +
+ `${first.fetched === false && !waiting.some((c) => c.fetched) ? " (not fetched yet)" : ""}` +
+ ` — ${ids.slice(0, 6).join(", ")}${ids.length > 6 ? ` and ${ids.length - 6} more` : ""}`;
+ const href = benchHref(first.id);
+ return waiting.map((c) => ({
+ project,
+ projectTitle,
+ ...(projectKind ? { projectKind } : {}),
+ kind: CLIPS_UNWALKED,
+ target: c.id,
+ what,
+ why,
+ href,
+ severity: now - at > RECENT_DAYS * 864e5 ? "info" : "open",
+ at,
+ }));
+}
diff --git a/umtool/lib/inbox/what.mjs b/umtool/lib/inbox/what.mjs
@@ -61,6 +61,13 @@ export const WHAT = {
"ambiguous-project": "two kinds match",
"machine-tool": "a required tool is missing",
"machine-disk": "disk nearly full",
+ "version-unjudged": "versions to judge",
+ "clips-unwalked": "clips not walked",
+ "quote-check-stale": "quote checks out of date",
+ "case-new-cues": "new transcripts since the last scan",
+ "x-jar-stale": "X's cookies are stale and X work waits",
+ "clip-quote-moved": "quotes heard away from the cut",
+ "clip-quote-missing": "quotes not heard in the cut",
};
/** A kind's words; an unknown kind reads as its id with spaces. */
diff --git a/umtool/lib/inbox/xJar.mjs b/umtool/lib/inbox/xJar.mjs
@@ -0,0 +1,41 @@
+// X'S LOGIN, WHEN X WORK WAITS (umtool redesign L4, "What needs you"): the
+// editor's cookie alerts (`GET /api/ops/services`, editor/app/lib/cookieAlerts.ts
+// over common/lib/serviceCookies.ts) carry X's jar age always, and an ALERT only
+// when the jar refused an X job or X jobs are queued behind it -- the rule the
+// editor's own banner draws by. So the Inbox shows the jar only when there is a
+// stale alert of X's family: one Blocking card (a MACHINE call, lib/machine.ts:
+// no piece's), the editor's three short lines
+// (how old, the one thing to do, what it refused), its action the editor's
+// settings, where Refresh cookies / Connect X account and Recheck are.
+//
+// Nothing here asks X anything, and nothing refreshes the jar: a refresh is a
+// human click in the editor. Pure: lib/inbox/xJar.ts asks the editor.
+
+export const X_JAR_STALE = "x-jar-stale";
+
+/**
+ * The row, or null when no X work waits (or the payload is not one).
+ *
+ * @param {unknown} payload the services route's answer
+ * @param {{ href: string, now?: number }} o
+ */
+export function xJarDecision(payload, { href, now = Date.now() }) {
+ const p = /** @type {Record<string, any> | null} */ (payload && typeof payload === "object" ? payload : null);
+ const alerts = Array.isArray(p?.alerts) ? p.alerts : [];
+ const x = alerts.find((a) => a && a.family === "x" && a.state === "stale");
+ if (!x) return null;
+ const jar = p?.x && typeof p.x === "object" ? p.x : null;
+ const lines = [x.headline, x.fix, x.detail].map((s) => (typeof s === "string" ? s.trim() : "")).filter(Boolean);
+ const at = Date.parse(x.raisedAt ?? x.since ?? "") || now;
+ return {
+ project: "editor",
+ projectTitle: x.label ? `${x.label} login` : "X login",
+ kind: X_JAR_STALE,
+ target: x.service ?? "x",
+ why: lines.length ? lines.join(" ") : "X's cookies are past their age limit — refresh them on the editor's settings",
+ href,
+ severity: "blocking",
+ at,
+ ...(jar && Number.isFinite(jar.ageMinutes) ? { ageMinutes: jar.ageMinutes } : {}),
+ };
+}
diff --git a/umtool/lib/inbox/xJar.ts b/umtool/lib/inbox/xJar.ts
@@ -0,0 +1,46 @@
+import type { Decision } from "@/lib/decisions";
+import { askEditor, editorUrl } from "@/lib/articles/generation";
+import { xJarDecision } from "./xJar.mjs";
+
+// ---------------------------------------------------------------------------
+// X's jar, for the Inbox (lib/inbox/xJar.mjs says when it is a call): the
+// editor's services route asked through umtool's editor client (askEditor,
+// its WORKER_TOKEN), answered from a minute's memo, and never waited on for
+// more than WAIT_MS (0.4 s) -- the Inbox and the rail's count read it, and an editor
+// that is slow or down must not slow them. Any failure is no row. SERVER ONLY.
+// ---------------------------------------------------------------------------
+
+/** UMTOOL_XJAR_MEMO_MS (the e2e suite's 0: each read asks the stub), else a minute. */
+const memoMs = () => {
+ const v = Number(process.env.UMTOOL_XJAR_MEMO_MS);
+ return Number.isFinite(v) && v >= 0 ? v : 60_000;
+};
+/** The editor's services answer from a stat: a late answer still lands in the memo for the next read. */
+const WAIT_MS = 400;
+
+type Memo = { at: number; value: Promise<Decision | null> } | null;
+const g = globalThis as typeof globalThis & { __umtoolXJarMemo?: Memo };
+
+/** Forget the memo (a spec that changed the stub's services; a Recheck). */
+export function clearXJarMemo(): void {
+ g.__umtoolXJarMemo = null;
+}
+
+async function ask(): Promise<Decision | null> {
+ const payload = await askEditor("/api/ops/services", { fresh: true });
+ return xJarDecision(payload, { href: `${editorUrl()}/settings` }) as Decision | null;
+}
+
+/** The X jar's row when X work waits on it, else none. Never throws. */
+export async function xJarDecisions({ fresh = false }: { fresh?: boolean } = {}): Promise<Decision[]> {
+ const m = g.__umtoolXJarMemo;
+ let value: Promise<Decision | null>;
+ if (m && !fresh && Date.now() - m.at < memoMs()) value = m.value;
+ else {
+ value = ask().catch(() => null);
+ g.__umtoolXJarMemo = { at: Date.now(), value };
+ }
+ const timeout = new Promise<null>((resolve) => setTimeout(() => resolve(null), WAIT_MS).unref?.());
+ const row = await Promise.race([value, timeout]).catch(() => null);
+ return row ? [row] : [];
+}
diff --git a/umtool/lib/machine.ts b/umtool/lib/machine.ts
@@ -1,13 +1,23 @@
import { statfs } from "node:fs/promises";
import { toolsCache } from "./doctor";
import { REPORTS_ROOT } from "./paths";
+import { xJarDecisions } from "./inbox/xJar";
// The machine's own calls for the Inbox: a tool a report build needs that the
// last doctor check found absent, and a reports root nearly out of space. Read
// from the doctor's CACHE and one statfs -- never a probe (the probe is the
-// button on /settings/system). SERVER ONLY.
+// button on /settings/system). And X's login when X work waits on it (umtool
+// redesign L4, lib/inbox/xJar.ts: the editor's services, memoised, never
+// waited on long) -- its card names the editor's settings. SERVER ONLY.
-export type MachineCall = { kind: "machine-tool" | "machine-disk"; why: string; count: number };
+export type MachineCall = {
+ kind: "machine-tool" | "machine-disk" | "x-jar-stale";
+ why: string;
+ count: number;
+ /** The card's title and its one action, when not umtool's own (X's login: the editor's settings). */
+ title?: string;
+ action?: { label: string; href: string };
+};
/** Below this a render or a fetch would fail part-way. */
export const LOW_DISK_BYTES = 5e9;
@@ -35,5 +45,8 @@ export async function machineCalls(): Promise<MachineCall[]> {
if (free !== null && free < LOW_DISK_BYTES) {
out.push({ kind: "machine-disk", why: `${(free / 1e9).toFixed(1)} GB free under the reports root`, count: 1 });
}
+ for (const x of await xJarDecisions().catch(() => [])) {
+ out.push({ kind: "x-jar-stale", why: x.why, count: 1, title: x.projectTitle ?? "X login", action: { label: "Refresh X's cookies", href: x.href } });
+ }
return out;
}
diff --git a/umtool/lib/projects/report.mjs b/umtool/lib/projects/report.mjs
@@ -1434,14 +1434,26 @@ export async function reportDecisions(ctx, summary) {
// there are any; a stale row -- the cut or the quote changed since -- says
// nothing).
{
- const { quoteGate, readQuoteCheck } = await import("../report/quoteCheck.mjs");
- for (const g of quoteGate(clips, await readQuoteCheck(dir))) {
+ const { alignPatch, quoteGate, readQuoteCheck } = await import("../report/quoteCheck.mjs");
+ const qdoc = await readQuoteCheck(dir);
+ for (const g of quoteGate(clips, qdoc)) {
const moved = g.status === "moved";
+ // The one press (L4, the Inbox's and the Checks list's): a moved quote's cut snapped to the words as heard
+ // (`window --align`'s patch, through the window writer); a quote not heard, checked again once refetched.
+ let settle = { kind: "quote-check", clips: [g.id], label: "Run quote-check" };
+ if (moved) {
+ try {
+ settle = { kind: "patch", clip: g.id, patch: alignPatch(clips.find((e) => e.id === g.id), qdoc.clips[g.id]), label: "Snap the cut to the words" };
+ } catch {
+ settle = null;
+ }
+ }
add(moved ? "clip-quote-moved" : "clip-quote-missing", g.id, g.why.replace("<p>", id), "blocking", {
href: clipHref(g.id),
fix: moved
? `umtool window ${id} ${g.id} --align # or --quote-ruled, having heard it`
: `umtool fetch ${id} --refetch ${g.id} && umtool quote-check ${id} --clips ${g.id} # or --quote-ruled, having heard it`,
+ ...(settle ? { settle } : {}),
});
}
}
@@ -1664,8 +1676,11 @@ export async function reportDecisions(ctx, summary) {
{
fix: rows.some((r) => r.fix) ? `umtool links ${id} --fix` : checkFix,
// The links whose fix is known (a Twitch id the site serves as v<id>) are rewritten in one press.
+ // A Rumble folder id the archive serves by its EMBED id (linkCheck.mjs fixSiteVideo, L1's mapping): Use embed ids.
settle: rows.some((r) => r.fix)
- ? { kind: "check-links", fix: true, label: `Fix ${rows.filter((r) => r.fix).length} link${rows.filter((r) => r.fix).length === 1 ? "" : "s"} (the site's v<id>)` }
+ ? rows.filter((r) => r.fix).every((r) => r.fixSiteVideo)
+ ? { kind: "check-links", fix: true, label: `Use embed ids (${rows.filter((r) => r.fix).length})` }
+ : { kind: "check-links", fix: true, label: `Fix ${rows.filter((r) => r.fix).length} link${rows.filter((r) => r.fix).length === 1 ? "" : "s"} (the site's v<id>)` }
: checkSettle,
clips: ids,
},
diff --git a/umtool/lib/report/linksCli.mjs b/umtool/lib/report/linksCli.mjs
@@ -87,22 +87,9 @@ export async function linksCommand(args, { root = REPORTS_ROOT, out = (s) => con
const fixed = [];
let undo = null;
if (flags.has("--fix")) {
- // ONE undo point before the rewrites (revisions/<stamp>-auto-before-links-fix): `umtool timeline <p> undo` takes them all back.
- if (doc.links.some((l) => l.state === "dead" && l.fix)) undo = await createSnapshot(project.dir, { label: `${AUTO_SNAPSHOT_PREFIX}links-fix` });
- for (const l of doc.links) {
- if (l.state !== "dead" || !l.fix) continue;
- // A Rumble folder id (linkCheck.mjs siteIdOf): the clip names the embed id the archive serves (`siteVideo`),
- // and a citeUrl that was the dead link moves with it; a QR built from the moment needs nothing else.
- if (l.fixSiteVideo) {
- const e = (m.timeline ?? []).find((x) => x?.id === l.clip);
- const patch = { siteVideo: l.fixSiteVideo, ...(e?.citeUrl === l.url ? { citeUrl: l.fix } : {}) };
- await withEditNotes(project, () => updateClip(project.dir, l.clip, patch));
- fixed.push({ clip: l.clip, from: l.url, to: l.fix, siteVideo: l.fixSiteVideo });
- continue;
- }
- await withEditNotes(project, () => updateClip(project.dir, l.clip, { citeUrl: l.fix }));
- fixed.push({ clip: l.clip, from: l.url, to: l.fix });
- }
+ const r = await applyLinkFixes(project, m, doc);
+ fixed.push(...r.fixed);
+ undo = r.undo;
if (fixed.length) {
m = await readManifest(project.dir);
doc = await runLinkCheck(project.dir, m, opts);
@@ -288,3 +275,48 @@ export async function linkPolicyCommand(args, { root = REPORTS_ROOT, out = (s) =
return e instanceof CliError ? 2 : 1;
}
}
+
+/**
+ * Rewrite every dead link `doc` knows the fix for, through the window writer,
+ * after ONE undo point (revisions/<stamp>-auto-before-links-fix: `umtool
+ * timeline <p> undo` takes them all back). The CLI's `--fix` over a check it
+ * just ran, and the page's (POST /api/report/links `fix`: the Checks list's
+ * and the Inbox's "Use embed ids") over the RECORDED one -- `guard`: only a
+ * clip still as that check saw it (its citeUrl the dead link, or no siteVideo
+ * yet for a Rumble folder id); an edit since is somebody's decision.
+ *
+ * A Rumble folder id (linkCheck.mjs siteIdOf, L1's mapping): the clip names the
+ * embed id the archive serves (`siteVideo`), and a citeUrl that was the dead
+ * link moves with it; a QR built from the moment needs nothing else. Any other
+ * fix (a Twitch id as v<id>) is the clip's citeUrl.
+ *
+ * @param {{ id: string, dir: string }} project
+ * @param {Record<string, any>} m the manifest the check read
+ * @param {{ links?: Array<Record<string, any>> } | null} doc
+ * @param {{ guard?: boolean }} [o]
+ */
+export async function applyLinkFixes(project, m, doc, { guard = false } = {}) {
+ const byId = new Map((m?.timeline ?? []).map((e) => [e?.id, e]));
+ const todo = (doc?.links ?? []).filter((l) => {
+ if (l.state !== "dead" || !l.fix) return false;
+ if (!guard) return true;
+ const e = byId.get(l.clip);
+ if (!e) return false;
+ return l.fixSiteVideo ? !e.siteVideo : e.citeUrl === l.url;
+ });
+ const fixed = [];
+ if (!todo.length) return { fixed, undo: null };
+ const undo = await createSnapshot(project.dir, { label: `${AUTO_SNAPSHOT_PREFIX}links-fix` });
+ for (const l of todo) {
+ if (l.fixSiteVideo) {
+ const e = byId.get(l.clip);
+ const patch = { siteVideo: l.fixSiteVideo, ...(e?.citeUrl === l.url ? { citeUrl: l.fix } : {}) };
+ await withEditNotes(project, () => updateClip(project.dir, l.clip, patch));
+ fixed.push({ clip: l.clip, from: l.url, to: l.fix, siteVideo: l.fixSiteVideo });
+ continue;
+ }
+ await withEditNotes(project, () => updateClip(project.dir, l.clip, { citeUrl: l.fix }));
+ fixed.push({ clip: l.clip, from: l.url, to: l.fix });
+ }
+ return { fixed, undo };
+}
diff --git a/umtool/lib/report/momentLink.mjs b/umtool/lib/report/momentLink.mjs
@@ -0,0 +1,121 @@
+// A MOMENT, AS PASTED (umtool redesign L4, home's Quick clip box; the timeline's
+// Add clip): the one parser for what a person pastes to name a second of a
+// recording --
+//
+// <channel>/<video>@<start>-<end> a span (`umtool clip`'s spec)
+// <channel>/<video>@<time>, <video>@<time>
+// an archive's moment link `<site>/?v=<channel>/<video>&t=<s>` (site-links.mjs
+// archiveMomentUrl; `%2F` too, `#t=` too), or a moment
+// page `<site>/m/<channel>/<video>/<s>-<e>/`
+// a YouTube link watch?v=, youtu.be/, /live/, /shorts/, /embed/; t= / start= / #t=
+// a Rumble link rumble.com/<id>-<title>.html (the URL slug's id: the
+// corpus's folder) or /embed/<id>/ (the embed id); start= / t=
+//
+// -> `{ channel | null, video, start, end | null, via }`, or null for anything
+// that is not one. A time is seconds, `1:02:32`, `62m32s` or `1h2m32s`. The
+// channel of a platform link is found on the disk by the caller
+// (quickClipStrip.mjs). Pure, browser-safe: no imports.
+
+/** `1:02:32`, `62m32s`, `3752`, `1h2m32s` → seconds; null when it is not a time. */
+export function parseTime(v) {
+ const s = String(v ?? "").trim();
+ if (!s) return null;
+ if (/^\d+(\.\d+)?s?$/.test(s)) return Number(s.replace(/s$/, ""));
+ const hms = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?$/.exec(s);
+ if (hms && (hms[1] || hms[2] || hms[3])) return Number(hms[1] ?? 0) * 3600 + Number(hms[2] ?? 0) * 60 + Number(hms[3] ?? 0);
+ const raw = s.split(":");
+ // `:` alone, or an empty part (`1:`, `:30`), is not a time.
+ if (raw.some((p) => !/^\d+(\.\d+)?$/.test(p))) return null;
+ const parts = raw.map(Number);
+ if (parts.length >= 2 && parts.length <= 3 && parts.every((n) => Number.isFinite(n))) return parts.reduce((a, n) => a * 60 + n, 0);
+ return null;
+}
+
+const ID = /^[A-Za-z0-9_-]{2,}$/;
+const CHANNEL = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
+/**
+ * The ids of a moment. TYPED forms (`<channel>/<video>@…`, `<video>@…`) refuse a video starting with `-`: typed,
+ * it is likelier a slip than an id. A LINK's video id is the platform's, and a YouTube id may start with `-` or `_`
+ * (about 1 in 64): accepted -- it reaches a child's argv only inside the `<channel>/<video>@…` word, after `--`.
+ */
+const ok = (channel, video, { typed = false } = {}) =>
+ (channel === null || (CHANNEL.test(channel) && !/^\.+$/.test(channel))) && ID.test(video) && !(typed && video.startsWith("-"));
+
+/** The time a link names: `t=` / `start=` in its query, else `t=` in its hash; 0 when none. */
+function linkTime(u) {
+ const raw = u.searchParams.get("t") ?? u.searchParams.get("start") ?? (/(?:^#|&)t=([0-9hms:.]+)/.exec(u.hash)?.[1] ?? null);
+ return raw === null ? 0 : parseTime(raw);
+}
+
+/**
+ * @param {unknown} raw
+ * @returns {{ channel: string | null, video: string, start: number, end: number | null, via: "spec" | "short" | "archive" | "youtube" | "rumble" } | null}
+ */
+export function parseMomentInput(raw) {
+ const s = String(raw ?? "").trim();
+ if (!s || s.length > 2000) return null;
+
+ // <channel>/<video>@<start>-<end>: a span.
+ const span = /^([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9_-]{2,})@(\d+(?:\.\d+)?)-(\d+(?:\.\d+)?)$/.exec(s);
+ if (span) {
+ const [, channel, video, a, b] = span;
+ const start = Number(a);
+ const end = Number(b);
+ return ok(channel, video, { typed: true }) && end > start ? { channel, video, start, end, via: "spec" } : null;
+ }
+ // [<channel>/]<video>@<time>
+ const short = /^(?:([A-Za-z0-9][A-Za-z0-9._-]*)\/)?([A-Za-z0-9_-]{2,})@([0-9:hms.]+)$/.exec(s);
+ if (short) {
+ const t = parseTime(short[3]);
+ const channel = short[1] ?? null;
+ return t === null || !ok(channel, short[2], { typed: true }) ? null : { channel, video: short[2], start: t, end: null, via: "short" };
+ }
+
+ let u;
+ try {
+ u = new URL(/^https?:\/\//i.test(s) ? s : `https://${s}`);
+ } catch {
+ return null;
+ }
+ const host = u.hostname.toLowerCase().replace(/^(www|m)\./, "");
+
+ // An archive's moment page: /m/<channel>/<video>/<s>-<e>/
+ const page = /\/m\/([^/]+)\/([^/]+)\/(\d+(?:\.\d+)?)-(\d+(?:\.\d+)?)\/?$/.exec(u.pathname);
+ if (page) {
+ const channel = decodeURIComponent(page[1]);
+ const video = decodeURIComponent(page[2]);
+ const start = Number(page[3]);
+ const end = Number(page[4]);
+ return ok(channel, video) && end > start ? { channel, video, start, end, via: "archive" } : null;
+ }
+ // An archive's moment link: ?v=<channel>/<video>&t=<s> (a YouTube v= never holds a slash).
+ const v = u.searchParams.get("v");
+ if (v && v.includes("/")) {
+ const [channel, video, ...more] = v.split("/");
+ const t = linkTime(u);
+ return !more.length && t !== null && ok(channel, video) ? { channel, video, start: t, end: null, via: "archive" } : null;
+ }
+
+ if (host === "rumble.com") {
+ const embed = /^\/embed\/([A-Za-z0-9]+)\/?/.exec(u.pathname);
+ const slug = /^\/(v[A-Za-z0-9]+)(?:-[^/]*)?(?:\.html)?\/?$/.exec(u.pathname);
+ const video = embed?.[1] ?? slug?.[1] ?? null;
+ const t = linkTime(u);
+ return video && t !== null && ok(null, video) ? { channel: null, video, start: t, end: null, via: "rumble" } : null;
+ }
+
+ if (host === "youtube.com" || host === "youtu.be" || host === "music.youtube.com") {
+ let video = v;
+ if (!video && host === "youtu.be") video = u.pathname.slice(1).split("/")[0] || null;
+ if (!video) video = /\/(?:live|shorts|embed|v)\/([A-Za-z0-9_-]{6,})/.exec(u.pathname)?.[1] ?? null;
+ const t = linkTime(u);
+ return video && t !== null && ok(null, video) ? { channel: null, video, start: t, end: null, via: "youtube" } : null;
+ }
+
+ // Any other link with a v= and a time: a YouTube-shaped one (the timeline's Add clip always took it).
+ if (v && ok(null, v)) {
+ const t = linkTime(u);
+ return t === null ? null : { channel: null, video: v, start: t, end: null, via: "youtube" };
+ }
+ return null;
+}
diff --git a/umtool/lib/report/momentLink.test.mjs b/umtool/lib/report/momentLink.test.mjs
@@ -0,0 +1,53 @@
+// The moment parser (umtool redesign L4): every form home's Quick clip box and
+// the timeline's Add clip take, and what they refuse.
+import assert from "node:assert/strict";
+import test from "node:test";
+import { parseMomentInput, parseTime } from "./momentLink.mjs";
+
+test("times: seconds, h:m:s, 62m32s, 1h2m32s; nothing else", () => {
+ assert.equal(parseTime("3752"), 3752);
+ assert.equal(parseTime("12.5s"), 12.5);
+ assert.equal(parseTime("1:02:32"), 3752);
+ assert.equal(parseTime("62m32s"), 3752);
+ assert.equal(parseTime("1h2m32s"), 3752);
+ assert.equal(parseTime("soon"), null);
+ for (const bad of [":", "1:", ":30", "1::2"]) assert.equal(parseTime(bad), null, bad);
+ assert.equal(parseTime(""), null);
+});
+
+test("the spec and the short forms", () => {
+ assert.deepEqual(parseMomentInput("basicyt/quickvid@10-14.5"), { channel: "basicyt", video: "quickvid", start: 10, end: 14.5, via: "spec" });
+ assert.equal(parseMomentInput("basicyt/quickvid@14-10"), null);
+ assert.deepEqual(parseMomentInput("basicyt/quickvid@1:02"), { channel: "basicyt", video: "quickvid", start: 62, end: null, via: "short" });
+ assert.deepEqual(parseMomentInput("quickvid@62"), { channel: null, video: "quickvid", start: 62, end: null, via: "short" });
+ for (const bad of ["../quickvid@10-14", "..@1-2", "-rf/quickvid@10-14", "basicyt/-x@10-14", "basicyt/quickvid", "", "nothing here"]) {
+ assert.equal(parseMomentInput(bad), null, bad);
+ }
+});
+
+test("an archive's moment link and moment page", () => {
+ assert.deepEqual(parseMomentInput("https://jeralyzer.pages.dev/?v=sitechan%2Fsv1&t=754"), { channel: "sitechan", video: "sv1", start: 754, end: null, via: "archive" });
+ assert.deepEqual(parseMomentInput("https://jeralyzer.pages.dev/?v=sitechan/sv1#t=12"), { channel: "sitechan", video: "sv1", start: 12, end: null, via: "archive" });
+ assert.deepEqual(parseMomentInput("https://jeralyzer.pages.dev/m/sitechan/sv1/754.00-761.50/"), { channel: "sitechan", video: "sv1", start: 754, end: 761.5, via: "archive" });
+ assert.equal(parseMomentInput("https://jeralyzer.pages.dev/?v=a/b/c&t=1"), null);
+});
+
+test("YouTube and Rumble links: the video and the second; the channel is the disk's to find", () => {
+ assert.deepEqual(parseMomentInput("https://www.youtube.com/watch?v=n8G_ysDV2bA&t=4132s"), { channel: null, video: "n8G_ysDV2bA", start: 4132, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("youtu.be/n8G_ysDV2bA?t=1h2m"), { channel: null, video: "n8G_ysDV2bA", start: 3720, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("https://www.youtube.com/live/n8G_ysDV2bA?start=90"), { channel: null, video: "n8G_ysDV2bA", start: 90, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("https://youtube.com/shorts/n8G_ysDV2bA"), { channel: null, video: "n8G_ysDV2bA", start: 0, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("https://rumble.com/v6w2hyk-candace-owens-x-nick-fuentes-interview-full-71125.html?start=754"), { channel: null, video: "v6w2hyk", start: 754, end: null, via: "rumble" });
+ assert.deepEqual(parseMomentInput("https://rumble.com/embed/v6tvlpq/?start=12"), { channel: null, video: "v6tvlpq", start: 12, end: null, via: "rumble" });
+ assert.equal(parseMomentInput("https://rumble.com/c/SomeChannel"), null);
+ assert.equal(parseMomentInput("https://example.com/watch?v=abcdef&t=nope"), null);
+});
+
+test("a link's YouTube id may start with - or _ (about 1 in 64); a typed one may not start with -", () => {
+ assert.deepEqual(parseMomentInput("https://www.youtube.com/watch?v=-abcDEF1234&t=5"), { channel: null, video: "-abcDEF1234", start: 5, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("https://youtu.be/_abcDEF1234?t=7"), { channel: null, video: "_abcDEF1234", start: 7, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("https://jeralyzer.pages.dev/?v=chan%2F-abcDEF1234&t=9"), { channel: "chan", video: "-abcDEF1234", start: 9, end: null, via: "archive" });
+ assert.deepEqual(parseMomentInput("chan/_abcDEF1234@1-2"), { channel: "chan", video: "_abcDEF1234", start: 1, end: 2, via: "spec" });
+ assert.equal(parseMomentInput("chan/-abcDEF1234@1-2"), null);
+ assert.equal(parseMomentInput("-abcDEF1234@12"), null);
+});
diff --git a/umtool/lib/report/quickClip.mjs b/umtool/lib/report/quickClip.mjs
@@ -63,17 +63,25 @@ const fin = (v) => typeof v === "number" && Number.isFinite(v);
/**
* A quick clip's spec, parsed and checked: `<channel>/<video>@<start>-<end>`, the end after the start, and
- * neither id a path trick -- not all dots (`..`) and not starting with `-` (an argv flag) -- so the names
- * that reach the disk and a child's argv are ids. Null when it is not one. Pure.
+ * neither id a path trick -- not all dots (`..`); the channel not starting with `-` (an argv flag), the video
+ * only when it is a YouTube id (redesign L4: those can start with `-`) -- so the names that reach the disk and a
+ * child's argv are ids. Null when it is not one. Pure.
* @param {unknown} spec
*/
export function quickClipSpec(spec) {
const c = parseClipSpec(spec);
if (!c || !(c.end > c.start)) return null;
- for (const id of [c.channel, c.video]) if (/^\.+$/.test(id) || id.startsWith("-")) return null;
+ for (const id of [c.channel, c.video]) if (/^\.+$/.test(id)) return null;
+ // The channel heads the argv word, so it never starts with `-`. A video id may only when it is YouTube-shaped
+ // (11 of [A-Za-z0-9_-]: about 1 id in 64 starts with `-`): the app's job passes the spec after `--` anyway.
+ if (c.channel.startsWith("-")) return null;
+ if (c.video.startsWith("-") && !YOUTUBE_ID.test(c.video)) return null;
return c;
}
+/** A YouTube video id: 11 characters of the URL-safe base64 alphabet. */
+const YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
+
/** A project slug from words: lower-case letters, digits and dashes, at most 48, never `share-…` (a deliverables link's name). */
export function quickClipSlug({ title = null, channel, video, start }) {
const clean = (words) => String(words).toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48).replace(/-+$/, "");
@@ -278,6 +286,11 @@ export async function quickClipCommand(args, { root = REPORTS_ROOT, log = consol
try {
for (let i = 0; i < args.length; i += 1) {
const a = args[i];
+ // `--`: every word after it is the spec, never a flag (the app's job passes it so).
+ if (a === "--") {
+ words.push(...args.slice(i + 1));
+ break;
+ }
if (!a.startsWith("--")) words.push(a);
else if (valued.has(a)) {
if (i + 1 >= args.length) throw new CliError(`${a} needs a value`);
diff --git a/umtool/lib/report/quickClipStrip.mjs b/umtool/lib/report/quickClipStrip.mjs
@@ -0,0 +1,121 @@
+// HOME'S QUICK CLIP BOX, BEFORE THE RENDER (umtool redesign L4): a pasted
+// moment (momentLink.mjs) found in the corpus and read -- which channel holds
+// the recording (a platform link names none: the channel whose data/ holds
+// it; a Rumble embed id, the channel whose metadata names it), the span (the
+// link's own, else from the cue it lands in to the end of its sentence, at
+// most three cues on, as the timeline's Add clip picks), and the words around
+// it to cut by: the corpus's words (report-to-video/clip-words.mjs -- a words
+// sidecar, a whisper transcript, the en-orig captions' word starts), else its
+// cues. Nothing is fetched; the render is `umtool clip` (quickClip.mjs, POST
+// /api/report/quick-clip), which asks the editor for the window.
+//
+// Reads only. Plain ESM.
+import { readdir, stat } from "node:fs/promises";
+import path from "node:path";
+import { resolveVideoDirId } from "yt-dlp-transcript-common/lib/videoDir-server.mjs";
+import { clipWords } from "umtool-report-to-video/clip-words";
+import { CHANNELS_DIR } from "../paths.mjs";
+import { ENDS_SENTENCE, IS_FILLER, cuePathFor, readCues } from "../projects/report.mjs";
+import { parseMomentInput } from "./momentLink.mjs";
+import { quickClipSpec } from "./quickClip.mjs";
+
+/** Seconds of words shown either side of the span. */
+export const STRIP_PAD_S = 12;
+/** A moment with no end: its sentence, at most this long. */
+export const DEFAULT_SPAN_S = 20;
+
+const r2 = (x) => Math.round(Number(x) * 100) / 100;
+const isDir = (p) => stat(p).then((s) => s.isDirectory(), () => false);
+export class MomentError extends Error {}
+
+/**
+ * The channel (and the folder id) a recording is under: the named one, else every channel whose data/ holds it
+ * (a Rumble embed id: by the channel's metadata). Several: refused, naming them.
+ * @param {{ channel: string | null, video: string }} m
+ */
+export async function findRecording(m, { channelsDir = CHANNELS_DIR } = {}) {
+ const at = async (slug) => {
+ const dir = await resolveVideoDirId(channelsDir, slug, m.video).catch(() => m.video);
+ return (await isDir(path.join(channelsDir, slug, "data", dir))) ? { channel: slug, video: dir } : null;
+ };
+ if (m.channel) {
+ const got = await at(m.channel);
+ if (!got) throw new MomentError(`this corpus has no ${m.channel}/${m.video}`);
+ return got;
+ }
+ const slugs = (await readdir(channelsDir, { withFileTypes: true }).catch(() => []))
+ .filter((d) => (d.isDirectory() || d.isSymbolicLink()) && !d.name.startsWith("."))
+ .map((d) => d.name)
+ .sort();
+ const found = [];
+ for (const slug of slugs) {
+ if (await isDir(path.join(channelsDir, slug, "data", m.video))) found.push({ channel: slug, video: m.video });
+ }
+ // A Rumble embed id has no folder of its own: the channel whose metadata names it (resolveVideoDirId).
+ if (!found.length && /^v[a-z0-9]{4,}$/i.test(m.video)) {
+ for (const slug of slugs) {
+ const got = await at(slug);
+ if (got) found.push(got);
+ }
+ }
+ if (!found.length) throw new MomentError(`no channel in this corpus holds ${m.video} — download it first, or write <channel>/${m.video}@<start>-<end>`);
+ if (found.length > 1) throw new MomentError(`${found.length} channels hold ${m.video} (${found.map((f) => f.channel).join(", ")}): write <channel>/${m.video}@<start>-<end>`);
+ return found[0];
+}
+
+/**
+ * The moment's span, from its cues when the link named only a second.
+ * @param {{ start: number, end: number | null }} m
+ * @param {Array<{ start: number, end: number, text: string }>} cues
+ */
+export function spanOf(m, cues) {
+ if (m.end !== null && m.end > m.start) return { start: r2(m.start), end: r2(m.end) };
+ const list = (cues ?? []).filter((c) => Number.isFinite(c?.start) && Number.isFinite(c?.end)).sort((a, b) => a.start - b.start);
+ const i = list.findIndex((c) => c.end > m.start);
+ if (i < 0) return { start: r2(m.start), end: r2(m.start + DEFAULT_SPAN_S) };
+ const from = list[i];
+ const closes = (c) => ENDS_SENTENCE.test(c.text ?? "") && !IS_FILLER.test(c.text ?? "");
+ const close = list.slice(i).find((c, k) => closes(c) || k >= 2) ?? from;
+ const start = Math.max(m.start, from.start);
+ const end = Math.min(close.end, start + DEFAULT_SPAN_S);
+ return { start: r2(start), end: r2(end > start + 0.5 ? end : start + DEFAULT_SPAN_S) };
+}
+
+/**
+ * A pasted moment, read: `{ spec, channel, video, start, end, from, to, words | null, cues | null, wordsFrom, title, duration }`.
+ * Throws MomentError with the sentence to show.
+ * @param {string} text
+ */
+export async function quickClipStrip(text, { channelsDir = CHANNELS_DIR } = {}) {
+ const m = parseMomentInput(text);
+ if (!m) throw new MomentError("not a moment: paste an archive, YouTube or Rumble link with its time, or <channel>/<video>@<start>-<end>");
+ const rec = await findRecording(m, { channelsDir });
+ const provenance = { channelSlug: rec.channel };
+ const entry = { type: "clip", channel: rec.channel, video: rec.video };
+ const file = cuePathFor({ provenance }, entry, channelsDir, null);
+ const doc = file ? await readCues(file) : null;
+ const allCues = doc?.cues ?? [];
+ const { start, end } = spanOf(m, allCues);
+ const duration = Number.isFinite(doc?.duration) ? doc.duration : null;
+ const from = r2(Math.max(0, start - STRIP_PAD_S));
+ const to = r2(duration ? Math.min(duration, end + STRIP_PAD_S) : end + STRIP_PAD_S);
+ const got = await clipWords(entry, provenance, from, to, { channelsDir }).catch(() => null);
+ const cues = got?.words?.length ? null : allCues.filter((c) => c.end >= from && c.start <= to).map((c) => ({ start: c.start, end: c.end, text: c.text }));
+ const spec = `${rec.channel}/${rec.video}@${start}-${end}`;
+ if (!quickClipSpec(spec)) throw new MomentError(`${spec} is not a clip (the end after the start)`);
+ return {
+ spec,
+ channel: rec.channel,
+ video: rec.video,
+ start,
+ end,
+ from,
+ to,
+ words: got?.words?.length ? got.words.map((w) => ({ w: w.text, start: w.start, ...(Number.isFinite(w.end) ? { end: w.end } : {}) })) : null,
+ wordsFrom: got?.from ?? (cues?.length ? "cues" : null),
+ cues: cues?.length ? cues : null,
+ title: typeof doc?.title === "string" ? doc.title : null,
+ duration,
+ via: m.via,
+ };
+}
diff --git a/umtool/lib/report/quickClipStrip.test.mjs b/umtool/lib/report/quickClipStrip.test.mjs
@@ -0,0 +1,72 @@
+// Home's Quick clip box before the render (umtool redesign L4): a pasted moment
+// found in a corpus, its span from the cues, and the words to cut by.
+import assert from "node:assert/strict";
+import test from "node:test";
+import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import os from "node:os";
+import path from "node:path";
+import { MomentError, findRecording, quickClipStrip, spanOf } from "./quickClipStrip.mjs";
+import { quickClipCommand, quickClipSpec } from "./quickClip.mjs";
+
+const cues = [
+ { start: 0, end: 4, text: "first we go" },
+ { start: 4, end: 8, text: "and then we stop." },
+ { start: 8, end: 12, text: "a new thought" },
+ { start: 12, end: 16, text: "runs on" },
+ { start: 16, end: 20, text: "and on" },
+ { start: 20, end: 24, text: "and ends." },
+];
+
+test("a span: the link's own; else from the cue it lands in to its sentence's end, at most three cues on", () => {
+ assert.deepEqual(spanOf({ start: 3, end: 9 }, cues), { start: 3, end: 9 });
+ assert.deepEqual(spanOf({ start: 1, end: null }, cues), { start: 1, end: 8 });
+ assert.deepEqual(spanOf({ start: 9, end: null }, cues), { start: 9, end: 20 });
+ assert.deepEqual(spanOf({ start: 30, end: null }, cues), { start: 30, end: 50 });
+ assert.deepEqual(spanOf({ start: 5, end: null }, []), { start: 5, end: 25 });
+});
+
+test("the recording found on the disk: by its channel, by the one channel holding it, refused when none or two do", async () => {
+ const root = await mkdtemp(path.join(os.tmpdir(), "quick-clip-strip-"));
+ try {
+ const rec = async (slug, id, doc) => {
+ const d = path.join(root, slug, "data", id);
+ await mkdir(d, { recursive: true });
+ await writeFile(path.join(root, slug, "config.json"), JSON.stringify({ platform: "youtube" }));
+ if (doc) await writeFile(path.join(d, "transcript.cues.json"), JSON.stringify(doc));
+ };
+ await rec("chan", "vid1", { title: "A fixture", duration: 30, cues });
+ await rec("chan", "both");
+ await rec("other", "both");
+ assert.deepEqual(await findRecording({ channel: null, video: "vid1" }, { channelsDir: root }), { channel: "chan", video: "vid1" });
+ assert.deepEqual(await findRecording({ channel: "chan", video: "vid1" }, { channelsDir: root }), { channel: "chan", video: "vid1" });
+ await assert.rejects(findRecording({ channel: null, video: "nope" }, { channelsDir: root }), /no channel in this corpus holds nope/);
+ await assert.rejects(findRecording({ channel: null, video: "both" }, { channelsDir: root }), /2 channels hold both \(chan, other\)/);
+ await assert.rejects(findRecording({ channel: "other", video: "vid1" }, { channelsDir: root }), MomentError);
+
+ const s = await quickClipStrip("https://www.youtube.com/watch?v=vid1&t=1", { channelsDir: root });
+ assert.equal(s.spec, "chan/vid1@1-8");
+ assert.deepEqual([s.from, s.to, s.title, s.duration, s.via], [0, 20, "A fixture", 30, "youtube"]);
+ // No words sidecar here: the cues around the span.
+ assert.equal(s.words, null);
+ assert.equal(s.wordsFrom, "cues");
+ assert.deepEqual(s.cues.map((c) => c.text), ["first we go", "and then we stop.", "a new thought", "runs on", "and on", "and ends."]);
+ await assert.rejects(quickClipStrip("not a moment", { channelsDir: root }), /not a moment/);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("a quick clip's spec: a YouTube id starting with - is one (the job passes the spec after --); `-x`, a dash channel or dots are not", () => {
+ assert.deepEqual(quickClipSpec("chan/-abcDEF1234@1-2"), { channel: "chan", video: "-abcDEF1234", start: 1, end: 2 });
+ assert.ok(quickClipSpec("chan/_abcDEF1234@1-2"));
+ for (const bad of ["chan/-x@1-2", "-rf/vid@1-2", "../vid@1-2", "chan/..@1-2", "chan/vid@2-1"]) assert.equal(quickClipSpec(bad), null, bad);
+});
+
+test("umtool clip -- <spec>: the word after -- is the spec, never a flag", async () => {
+ const out = [];
+ const err = [];
+ // A spec that parses but names no recording here: the command reaches the spec check, not "unknown flag".
+ const code = await quickClipCommand(["--json", "--", "nochan/-abcDEF1234@1-2"], { root: "/nonexistent-umtool-root", log: (s) => out.push(s), err: (s) => err.push(s), channelsDir: "/nonexistent-umtool-channels" });
+ assert.notEqual(code, 0);
+ assert.doesNotMatch(err.join("\n"), /unknown flag/);
+});
diff --git a/umtool/lib/report/quoteCheck.test.mjs b/umtool/lib/report/quoteCheck.test.mjs
@@ -162,6 +162,10 @@ test("umtool check: a moved quote and a missing one are blocking, with the fix;
assert.match(ds[0].why, /a: its quote is heard \+13\.06 s from its cut — umtool window cut a --align/);
assert.equal(ds[0].fix, "umtool window cut a --align # or --quote-ruled, having heard it");
assert.match(ds[1].fix, /umtool fetch cut --refetch b/);
+ // The one press (L4): a moved quote's cut snapped to the words as heard (alignPatch); a missing one checked again.
+ assert.deepEqual(ds[0].settle, { kind: "patch", clip: "a", patch: alignPatch({ ...clip("a", 10), type: "clip" }, { ...row(10, "moved", { heard: { from: 23.06, to: 25 } }) }), label: "Snap the cut to the words" });
+ assert.equal(ds[0].settle.patch.lockCut, true);
+ assert.deepEqual(ds[1].settle, { kind: "quote-check", clips: ["b"], label: "Run quote-check" });
} finally {
await rm(root, { recursive: true, force: true });
}
diff --git a/umtool/lib/report/takeCli.mjs b/umtool/lib/report/takeCli.mjs
@@ -101,6 +101,9 @@ export const TAKE_USAGE = [
"records which cut it is (censored | uncensored).",
].join("\n");
+/** What `umtool takes verdict` says: a verdict, or `clear`. */
+const TAKE_VERDICT_WORDS = new Set(["like", "maybe", "no", "clear"]);
+
export const TAKES_USAGE = [
"usage: umtool takes make <project> [--recipe FILE] [--only ID,ID] [--force] [--progress ndjson]",
` the recipe's takes, one at a time (default: takes/${RECIPE_FILE}); a take that`,
@@ -118,6 +121,8 @@ export const TAKES_USAGE = [
" umtool takes relabel <project> <take> <label…> take.json's label (an undo point of the take's own;",
" refused while it renders)",
" umtool takes supersede <project> <take> [--by <take>] | --clear folded away in the takes list (verdicts.json)",
+ " umtool takes verdict <project> <take> like|maybe|no|clear [--note \"…\"] [--json] the take's verdict (verdicts.json):",
+ " the Takes page's and Play's Like / Maybe / No; a version with a render and none is a call in the Inbox",
" umtool takes delete <project> <take> [--dry-run] [--force] takes/<take>/ whole (refused while it renders or a",
" render is made from it; --force only past the take the project's manifest is)",
" umtool takes cancel <project> <take> [--json] stop the take's render (it renders now: its build lock is live",
@@ -148,7 +153,7 @@ function parse(args) {
const valued = new Set([
"--id", "--label", "--group", "--kind", "--summary", "--style", "--patch", "--patch-json", "--set", "--effect",
"--at", "--dur", "--recipe", "--only", "--progress", "--from", "--by", "--name", "--tail",
- "--import-item", "--after", "--before", "--as", "--pad",
+ "--import-item", "--after", "--before", "--as", "--pad", "--note",
]);
/** @type {Record<string, string[]>} */
const flags = {};
@@ -602,6 +607,20 @@ export async function takesCommand(args, { reportsRoot = REPORTS_ROOT, log = con
else log(r.revision ? `${take}: "${r.label}" (was "${r.was}"; undo point takes/${take}/${r.revision.rel})` : `${take} is already "${r.label}"`);
return 0;
}
+ if (sub === "verdict") {
+ // Play and judge's twin (L4): a take's verdict in takes/verdicts.json, the Takes page's and Play's buttons.
+ const project = await pickProject(rest[0], reportsRoot);
+ const take = rest[1];
+ const said = rest[2];
+ if (!take || !said || ![...TAKE_VERDICT_WORDS].includes(said)) throw new CliError("umtool takes verdict <project> <take> like|maybe|no|clear [--note \"…\"]");
+ const { listTakes, setTakeVerdict } = await import("./takes.mjs");
+ if (!(await listTakes(project.dir)).takes.some((t) => t.id === take)) throw new CliError(`${project.id} has no take ${take}`);
+ const note = p.one("--note");
+ const r = await setTakeVerdict(project.dir, take, { verdict: said === "clear" ? null : said, ...(note !== undefined && note !== null ? { note } : {}) });
+ if (p.has("--json")) log(JSON.stringify({ ok: true, take, entry: r.entry }, null, 2));
+ else log(r.entry?.verdict ? `${take}: ${r.entry.verdict}${r.entry.note ? ` — ${r.entry.note}` : ""}` : `${take}: no verdict`);
+ return 0;
+ }
if (sub === "supersede") {
const project = await pickProject(rest[0], reportsRoot);
const take = rest[1];
diff --git a/umtool/lib/report/versions.test.mjs b/umtool/lib/report/versions.test.mjs
@@ -260,6 +260,26 @@ test("umtool takes save | open | freeze, with --json", async () => {
}
});
+test("umtool takes verdict: Play and judge's twin -- like | maybe | no | clear, with a note; an unknown take or word refused", async () => {
+ const { root, dir, reportsRoot } = await project();
+ try {
+ const out = [];
+ const err = [];
+ const run = (args) => takesCommand(args, { reportsRoot, log: (s) => out.push(s), err: (s) => err.push(s) });
+ assert.equal(await run(["save", "proj"]), 0);
+ assert.equal(await run(["verdict", "proj", "v1", "maybe", "--note", "the cold open drags"]), 0);
+ assert.equal(out.pop(), "v1: maybe — the cold open drags");
+ const { readVerdicts } = await import("./takes.mjs");
+ assert.deepEqual([(await readVerdicts(dir)).v1.verdict, (await readVerdicts(dir)).v1.note], ["maybe", "the cold open drags"]);
+ assert.equal(await run(["verdict", "proj", "v1", "clear", "--json"]), 0);
+ assert.equal(JSON.parse(out.pop()).entry?.verdict ?? null, null);
+ assert.equal(await run(["verdict", "proj", "v9", "like"]), 2);
+ assert.equal(await run(["verdict", "proj", "v1", "great"]), 2);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
test("one undo stack: in the app (setUndoEveryMs(0)) two trims a moment apart are two undo points, undone one by one; the terminal -- and a step the app spawns -- keeps the throttle", async () => {
const { root, dir } = await project();
const { setUndoEveryMs } = await import("./manifest.mjs");
diff --git a/umtool/playwright.config.ts b/umtool/playwright.config.ts
@@ -251,6 +251,8 @@ export default defineConfig({
// would otherwise enumerate every fixture article's corpus and add cards
// other specs count. refresh.spec runs the check itself, through its route.
`UMTOOL_REFRESH_CHECK=0 ` +
+ // The Inbox's X jar row (lib/inbox/xJar.ts) asks the stub's services on every read, not from a minute's memo.
+ `UMTOOL_XJAR_MEMO_MS=0 ` +
// The voice match's engine (release 34): the test kit's fake embedder,
// run by this node, in the place of scripts/speaker-embed.py and the
// TitaNet venv -- the same command line and JSON, no python, no model.