commit 9363de06e4e70fc2b5ed7b171013ea83d7633b6d parent a8c3dc5459ea47ad79f826fc7e83d9ac1d6c6495 Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st> Date: Thu, 5 Nov 2026 02:22:56 -0500 umtool: + Add posts (posts reel with a Preview, leading on a cut of posts or an empty one, under Options on a cut of clips: POST /api/report/add-posts, postReel.mjs postsReel); the Takes page's Play <latest> beside the working cut's line and its work files under Advanced; the post bench's Play from here; the Overview's README folded; the clip link short form takes any video id; e2e: add-clip.spec.ts (acceptance A: find, cues, place, add, fetched; a pasted link) and post-happy-path.spec.ts (a post video from Add posts to a queued render, all by clicking) on fixtures of their own; docs name where the folded controls are; the [Unreleased] bullet Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Diffstat:
16 files changed, 385 insertions(+), 20 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **umtool: Play is one press from anywhere, a clip is added without its spec, and every page leads with its next step.** A cut or a take named anywhere now carries a Play that opens the newest take (at the item when there is one): the project's head on every tab (with Walk, + Add a clip and the status `latest <take> · <length> · rendered <day> · <n> open notes`), every Cut tab row, every take card, the take walk, `/jobs`' renders (with the mp4's local path and Copy), the Inbox's cards and the rail's Recent cuts; a cut of posts showed no Play at all. **+ Add a clip** finds the words in the recordings the cut draws on (or the archive, or a pasted link with a time), sets the in and out on the moment's cues, places it after a row (by date when the cut is in date order) and fetches its window through the editor; from the Cut tab, from Play at the playhead and from a take ("to this take only": `umtool timeline <p> --take <t> insert <spec> --after <id>`). **+ Add posts** is `posts reel` with a preview; **Reads and voices** edits the pronunciation lexicon and the voice map with Try it; a take has **Check before render** (`lint --take`), **New draft from this take** and **Add items from another project** (with a preview). The rest of each page sits under one **Options** / **Advanced** disclosure, its open state remembered per viewer; nothing was removed. - **A take can carry items of other projects, and be edited without touching the project.** A cut assembled as a take of one project from the items of several (the mid cut: a take of the full cut, items from the full cut and a staging project) needed a script to clone the entries, hard-link their narration in and copy each re-read into the take's patch by hand. `umtool take <p> --id <t> --import-item <project>:<item>[,<item>…] [--after|--before <entry>]` now clones the items with their narration and its pick, hard-links every file they name into the take's project (another file already at a path: linked under `imports/<source>/` instead, never written over), places them, and is safe to run again (`updated`, or `unchanged` with no write). `posts set-item`, `roles`, `narrate`, `reread` and `fx` take `--in-take <take>`: the same edit lands in the take's patch with an undo point of the take's own (`umtool timeline <p> --take <t> undo`), the project's manifest untouched. `umtool take … --draft --from <take>` starts a draft from another take's patch, and `umtool lint <p> [--take <t>]` runs the build's lint on a take and checks that every file its items name is in the project. `posts narrate --thread` finds the editor's WORKER_TOKEN in `editor/.env` as umtool's other editor calls do. A cut whose posts carry the progress bar (`posts progress auto`) no longer fails its lint (`render.posts.progress is not a knob`), nor does one with the clock, panel, join, link-visit or branch-map knobs. - **Every umtool take render records itself, and umtool runs a queue of steps in order.** A render that died at exit 1 behind a filtered shell chain left no trace (`take.json` kept `builtAt: null`, no log), and the next chain read the chain's own DONE as success. Now every render, whoever starts it, writes `takes/<id>/render.json` (running, waiting at the heavy slot, done, failed or cancelled; its stage; on failure the first error line and the log's last 40 lines; on done the mp4 and its seconds) and the full `takes/<id>/render.log`; done needs exit 0 and a non-empty mp4, and a record whose process is gone reads failed. `umtool take status <p> --id <t>` exits 0 done, 3 still going, 1 failed. `umtool queue add [--after <qid>] -- <command…>` queues a umtool command that the umtool app runs, one step at a time, surviving the session, a restart or a ship: a failure blocks what waits on it, `retry` puts both back, a step that was running when the app died is failed with its log and never re-run. `umtool queue ls|status|wait|log|cancel|retry` and `umtool jobs` poll them; `/jobs` (the rail's *Running*) and the Takes page show the queue and the records, with the error and the log. umtool/docs/cli.md, "Queue and poll instead of scripting". - **A small fix to a report-video take re-renders in minutes, not half an hour.** A take renders hard cuts, and its final picture was one overlay pass over the whole cut on every take -- 12.6 of mid-6's 30 minutes, 26 of mid-7's 60 -- however small the change. The pass is now in keyed chunks, one segment's run each: `umtool take … --from <take>` re-encodes only the chunks of the post it touched, and a post that grew or shrank moves the chunks after it without changing them (the deck's frames after it are the same frames, later). The deck is drawn only where a chunk to encode reads it, so a take `--from` a pruned one no longer captures the whole deck again (12,347 captures, ~3 minutes on mid-7), and the cut's sound is keyed by each segment's audio, so a caption or a knob that moves no word keeps it. The picture is now frame-exact: the old pass laid each next segment at the longer of its picture and its sound, the footage up to 0.3 s behind the deck by the end of the cut. diff --git a/umtool/app/api/report/add-posts/route.ts b/umtool/app/api/report/add-posts/route.ts @@ -0,0 +1,51 @@ +import { projectRef } from "@/lib/projects"; +import { refuseCaller } from "@/lib/report/caller"; +import { StaleToken, StructureRefused } from "@/lib/report/manifest.mjs"; +import { postsReel } from "@/lib/report/postReel.mjs"; + +export const dynamic = "force-dynamic"; + +// ADD POSTS to a cut of posts (lane/ui-simplify, 5 Nov; terminal-only before: `umtool posts reel`): the +// channel archive's posts the cut does not play yet, as post items, in one write (postReel.mjs postsReel, +// the CLI's own). `dryRun` answers what it would add. +// +// POST { project, channels: [slug…], own?, since?, until?, withMedia?, after?, limit?, dryRun? } +// -> { added, selected, already, entries: [{ id, date, text, … }], dryRun } +export async function POST(request: Request) { + const refused = refuseCaller(request, "/api/report/add-posts"); + if (refused) return refused; + const b = (await request.json().catch(() => null)) as Record<string, unknown> | null; + if (!b) return Response.json({ error: "bad json" }, { status: 400 }); + const project = await projectRef(String(b.project ?? "")); + if (!project) return Response.json({ error: "no such project" }, { status: 404 }); + const channels = Array.isArray(b.channels) ? b.channels.filter((c): c is string => typeof c === "string" && c.length > 0) : []; + if (!channels.length) return Response.json({ error: "name a channel whose posts to add" }, { status: 400 }); + const str = (k: string) => (typeof b[k] === "string" && b[k] ? (b[k] as string) : null); + const limit = Number.isInteger(b.limit) && (b.limit as number) > 0 ? (b.limit as number) : null; + try { + const r = await postsReel(project, { + channels, + since: str("since"), + until: str("until"), + own: b.own === true, + withMedia: b.withMedia === true, + replies: "include", + order: "chrono", + limit, + after: str("after"), + dryRun: b.dryRun === true, + }); + const entries = ((r.entries ?? []) as Record<string, unknown>[]).map((e) => ({ + id: e.id, + date: typeof e.date === "string" ? e.date.slice(0, 10) : null, + handle: e.handle ?? null, + text: String(e.text ?? "").replace(/\s+/g, " ").slice(0, 140), + media: Array.isArray(e.media) ? e.media.length : 0, + })); + return Response.json({ ok: true, added: r.added, selected: r.selected, already: r.already, dryRun: !!r.dryRun, entries }, { headers: { "cache-control": "no-store" } }); + } catch (e) { + if (e instanceof StaleToken) return Response.json({ error: e.message, stale: true }, { status: 409 }); + if (e instanceof StructureRefused) return Response.json({ error: e.message, errors: e.errors }, { status: 400 }); + return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status: 400 }); + } +} diff --git a/umtool/components/projects/AddClip.tsx b/umtool/components/projects/AddClip.tsx @@ -56,7 +56,7 @@ export function parseTime(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>`. */ 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_-]{6,})@([0-9:hms.]+)$/.exec(s); + 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 }; diff --git a/umtool/components/projects/AddPosts.tsx b/umtool/components/projects/AddPosts.tsx @@ -0,0 +1,121 @@ +"use client"; + +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { buttonVariants } from "@/components/ui/button"; +import { cn } from "@/lib/utils"; +import { announceManifestChanged } from "./timelineApi"; + +// --------------------------------------------------------------------------- +// ADD POSTS to a cut of posts (lane/ui-simplify, 5 Nov): the channel's +// archived posts the cut does not play yet, as post items -- `umtool posts reel` +// in the app (POST /api/report/add-posts, postReel.mjs postsReel). Preview +// lists what it would add; Add writes them in one undoable write. +// --------------------------------------------------------------------------- + +type Row = { id: string; date: string | null; handle: string | null; text: string; media: number }; +type Answer = { ok?: boolean; error?: string; added?: number; selected?: number; already?: number; dryRun?: boolean; entries?: Row[] }; + +export default function AddPosts({ project, channels: known }: { project: string; channels: string[] }) { + const router = useRouter(); + const [open, setOpen] = useState(false); + const [channel, setChannel] = useState(known[0] ?? ""); + const [own, setOwn] = useState(true); + const [since, setSince] = useState(""); + const [until, setUntil] = useState(""); + const [busy, setBusy] = useState(false); + const [plan, setPlan] = useState<Answer | null>(null); + const [done, setDone] = useState<Answer | null>(null); + const go = async (dryRun: boolean) => { + setBusy(true); + const r = await fetch("/api/report/add-posts", { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ project, channels: [channel.trim()], own, since: since || null, until: until || null, dryRun }), + }); + const j = (await r.json().catch(() => ({ error: `HTTP ${r.status}` }))) as Answer; + setBusy(false); + if (!r.ok) j.error ??= `HTTP ${r.status}`; + if (dryRun) { + setPlan(j); + setDone(null); + } else { + setDone(j); + setPlan(null); + if (r.ok) { + announceManifestChanged(project); + router.refresh(); + } + } + }; + const input = "rounded-[3px] border border-seam-2 bg-ground px-1.5 py-[3px] text-[12px] text-text outline-none focus:border-signal"; + return ( + <> + <button type="button" data-add-posts-open="" aria-expanded={open} onClick={() => setOpen((o) => !o)} className={buttonVariants({ variant: open ? "pressed" : "outline", size: "sm" })}> + + Add posts + </button> + {open && ( + <section data-add-posts="" className="basis-full space-y-2 rounded border border-seam bg-panel p-3 text-[12px]"> + <div className="flex flex-wrap items-center gap-2"> + <h2 className="micro m-0">Add posts</h2> + <span className="text-muted">the archive's posts this cut does not play yet</span> + </div> + <div className="flex flex-wrap items-center gap-2"> + <label className="inline-flex items-center gap-1"> + channel + <input data-add-posts-channel="" list="add-posts-channels" value={channel} onChange={(e) => setChannel(e.target.value)} className={cn(input, "w-44 font-mono")} /> + <datalist id="add-posts-channels"> + {known.map((c) => ( + <option key={c} value={c} /> + ))} + </datalist> + </label> + <label className="inline-flex items-center gap-1"> + <input type="checkbox" data-add-posts-own="" checked={own} onChange={(e) => setOwn(e.target.checked)} /> + their own posts only + </label> + <label className="inline-flex items-center gap-1"> + from + <input type="date" data-add-posts-since="" value={since} onChange={(e) => setSince(e.target.value)} className={input} /> + </label> + <label className="inline-flex items-center gap-1"> + to + <input type="date" data-add-posts-until="" value={until} onChange={(e) => setUntil(e.target.value)} className={input} /> + </label> + <button type="button" data-add-posts-preview="" disabled={busy || !channel.trim()} onClick={() => void go(true)} className={buttonVariants({ variant: "outline", size: "sm" })}> + Preview + </button> + <button type="button" data-add-posts-go="" disabled={busy || !channel.trim() || (plan !== null && !plan.added)} onClick={() => void go(false)} className={buttonVariants({ variant: "go", size: "sm" })}> + {plan?.added ? `Add ${plan.added} post${plan.added === 1 ? "" : "s"}` : "Add"} + </button> + </div> + {[plan, done].map((a, k) => + a ? ( + <div key={k} data-add-posts-result={k === 0 ? "plan" : "done"} data-add-posts-added={a.added ?? 0}> + {a.error ? ( + <p className="m-0 text-reject-text">{a.error}</p> + ) : ( + <> + <p className="m-0 text-text-2"> + {k === 0 ? "would add" : "added"} {a.added} post item{a.added === 1 ? "" : "s"} ({a.selected} selected, {a.already} already in the cut) + </p> + <ol className="m-0 max-h-48 list-none space-y-0.5 overflow-auto p-0"> + {(a.entries ?? []).map((e) => ( + <li key={e.id} data-add-posts-row={e.id} className="flex gap-2"> + <span className="shrink-0 font-mono text-[11px] text-muted">{e.date}</span> + <span className="shrink-0 font-mono text-[11px]">{e.id}</span> + <span className="min-w-0 truncate text-text-2">{e.text}</span> + {e.media > 0 && <span className="text-muted">+{e.media}</span>} + </li> + ))} + </ol> + </> + )} + </div> + ) : null, + )} + </section> + )} + </> + ); +} diff --git a/umtool/components/projects/PostBenchPage.tsx b/umtool/components/projects/PostBenchPage.tsx @@ -4,6 +4,7 @@ import PostBench from "./PostBench"; import { channelsDirFor, readManifest } from "@/lib/projects/report.mjs"; import { manifestToken } from "@/lib/report/manifest.mjs"; import { projectHref, playHref } from "@/lib/hrefs"; +import PlayLink from "./PlayLink"; import { deckGeometry, deckOn, feedGeometry, feedOn } from "umtool-report-to-video/deck"; import { postItemPlan, panelEntry } from "umtool-report-to-video/post-item"; import { planContext } from "umtool-report-to-video/post-conversation"; @@ -49,6 +50,7 @@ export default async function PostBenchPage({ project, id, search = {} }: { proj active="projects" crumbs={[{ href: "/projects", label: "Projects" }, { href: projectHref(project.id), label: project.name }, { label: `post ${id}` }]} note={`post item ${k + 1} of ${neighbours.length} · ${String(entry.post ?? "")}`} + actions={<PlayLink project={project.id} clip={id} where="post-bench" variant="header" label="▶ Play from here" />} /> <main className="deck-main flex-1 overflow-auto p-4"> <PostBench diff --git a/umtool/components/projects/TakesBench.tsx b/umtool/components/projects/TakesBench.tsx @@ -304,8 +304,11 @@ export default function TakesBench({ <BenchBody verdict={verdictBar}> <div className="space-y-6"> {head} - {workDirs && <TakeWorkDirs project={project} dirs={workDirs} ready={ready} />} - <WorkSummary project={project} work={work} error={workError} ready={ready} onFreed={() => void loadWork()} /> + {/* The takes' work files (what a render left, what can be freed): rare, so Advanced (lane/ui-simplify). */} + <Advanced id="takes" label="Work files" hint="what the renders left, and what can be freed"> + {workDirs && <TakeWorkDirs project={project} dirs={workDirs} ready={ready} />} + <WorkSummary project={project} work={work} error={workError} ready={ready} onFreed={() => void loadWork()} /> + </Advanced> {groups.map((g) => { const tally = VERDICTS.map((v) => [v.id, g.takes.filter((t) => verdicts[t.id]?.verdict === v.id).length] as const) .filter(([, n]) => n > 0) diff --git a/umtool/components/projects/TakesPage.tsx b/umtool/components/projects/TakesPage.tsx @@ -13,6 +13,7 @@ import NewTakePanel from "./NewTakePanel"; import TakesBench, { type Take, type TakeVerdict } from "./TakesBench"; import { LatestLine } from "./review/WhatPlays"; import { readWorkingCut } from "@/lib/report/workingCut.mjs"; +import PlayLink from "./PlayLink"; import { resolveTakeManifest } from "@/lib/report/takeManifest.mjs"; import { readCancelled, takeWorkDirs } from "@/lib/report/takeCancel.mjs"; import { variantFamily } from "@/lib/report/variantFork.mjs"; @@ -154,8 +155,9 @@ export default async function TakesPage({ project }: { project: ProjectRef }) { workDirs={workDirs} head={ <> - <p className="m-0 text-[12.5px]" data-takes-working=""> + <p className="m-0 flex flex-wrap items-center gap-2 text-[12.5px]" data-takes-working=""> <LatestLine project={project.id} working={working} /> + {working?.latest && <PlayLink project={project.id} where="takes-head" variant="button" label={`▶ Play ${working.latest.id}`} />} </p> {(parentOf || variants.length > 0) && ( <p className="m-0 text-[12px] text-text-2" data-takes-family={family.members.length}> diff --git a/umtool/components/projects/report/CutTab.tsx b/umtool/components/projects/report/CutTab.tsx @@ -16,6 +16,7 @@ import PlayLink from "../PlayLink"; import { AddClipToggle } from "../AddClip"; import { Advanced, Options } from "@/components/ui/disclosure"; import PronunciationPanel from "../PronunciationPanel"; +import AddPosts from "../AddPosts"; import TightWindowsPanel from "./TightWindowsPanel"; import { clipRecord, storedUrlOf } from "@/lib/clips/stored"; import { Fragment } from "react"; @@ -75,6 +76,9 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor ) ).filter(Boolean).length; const walkStart = (readiness.readyIds[0] as string | undefined) ?? clips[0]?.id; + // Add posts (posts reel) leads on a cut of posts or an empty one; on a cut of clips it waits under Options. + const postsFirst = entries.length === 0 || entries.some((x) => x.kind === "post"); + const postChannels = [...new Set(entries.filter((x) => x.kind === "post" && typeof x.post === "string").map((x) => String(x.post).split("/")[0]))]; const showAll = search.all === "1"; // The candidates inbox (UI notes item 14): its panel once a sweep has proposed something; until // then one line in the timeline's heading says how proposals come in (no panel, no height). @@ -415,6 +419,8 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor )} {/* Add a clip, as one flow (lane/ui-simplify): find, in/out on the cues, place, add, fetched. */} <AddClipToggle project={project.id} where="cut" open={search.add === "1"} className="self-center" /> + {/* A cut of posts (or an empty one): the archive's posts it does not play yet (posts reel); else under Options. */} + {postsFirst && <AddPosts project={project.id} channels={postChannels} />} {/* Alternative renders of part of the cut, judged on their own page -- where the first one is made, too (release 33's take maker). */} {takes.exists ? ( @@ -434,6 +440,7 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor {/* Everything else, folded (lane/ui-simplify): Options the common, Advanced the rare; open state remembered per viewer. */} <div className="flex flex-wrap items-start gap-x-4 gap-y-1.5" data-cut-panels=""> <Options id="cut" hint="clip editor · trailer · walk a take · fetch"> + {!postsFirst && <AddPosts project={project.id} channels={postChannels} />} {/* A montage's instances, ruled by ear before a render (release 34). */} {montage.length > 0 && ( <Link diff --git a/umtool/components/projects/report/OverviewTab.tsx b/umtool/components/projects/report/OverviewTab.tsx @@ -20,6 +20,7 @@ import SourceBacklog from "./SourceBacklog"; import ProjectSites from "./ProjectSites"; import LinkPolicyPanel from "./LinkPolicyPanel"; import { manifestToken } from "@/lib/report/manifest.mjs"; +import { Options } from "@/components/ui/disclosure"; // The Overview tab (canvas "Piece · Overview"): the Next card, then the // piece's decisions and -- when it is an article's video -- the article and @@ -157,11 +158,13 @@ export default async function OverviewTab({ project, detail, frame }: ReportTabP {/* --- the author's own account of the cut ------------------------- */} {readme && ( - <section data-readme="" className="rounded border border-[var(--color-line)] bg-[var(--color-panel)] px-3 py-2"> - <div className="max-h-[40vh] overflow-y-auto"> - <Markdown text={readme} /> - </div> - </section> + <Options id="overview-readme" label="README" hint="the author's account of the cut"> + <section data-readme="" className="basis-full rounded border border-[var(--color-line)] bg-[var(--color-panel)] px-3 py-2"> + <div className="max-h-[40vh] overflow-y-auto"> + <Markdown text={readme} /> + </div> + </section> + </Options> )} </> ); diff --git a/umtool/docs/clip-bench.md b/umtool/docs/clip-bench.md @@ -441,7 +441,7 @@ on first open — from the take's manifest as the walk reads it (a draft's too, take's own status, queue and runner (`out/bench-excerpts/takes/<take>/`), so a take's clip that carries the cut's id with other bounds never shares the cut's prep state. A save on the take's walk that moves an edge queues it as the cut's writes do. `umtool fetch <project> --take <take>` asks the editor for the take's -windows (a clip only the take has included) as the Cut tab's **Fetch windows** asks for the cut's. +windows (a clip only the take has included) as the Cut tab's **Fetch windows** (under Options) asks for the cut's. **`?all=1` walks every clip.** A take's clips often carry the verdict of the clip they were cut from, so the default walk — fetched and still needing a verdict — would skip them. **walk every diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -76,7 +76,7 @@ is cleared in the same write, and said. | both edges to the sentence: the one at the playhead (a playhead parked on an edge does not count), else every sentence the clip's cut (its quote) touches, else the whole sentences inside the window, else the one it is inside — then the start back into the pause before its first word and the end forward into the one after its last (0.1 s of quiet, ≤ 1 s away), inside the cached window | clip bench, under the waveform: **Tighten to this sentence**; **Undo** writes back the edges (and the cut, the mute mark, the cite, the QR) it moved | — | `PUT /api/report/window {project, clip, token, start, end}` | | one edge to the middle of its nearest pause (≤ 1 s) | **Snap edge to nearest pause**: **start** / **end**; **Undo** | — | same | | the words and the pauses, drawn | the bench's zoom, at 20 s or less shown: a box per word with its text (a caption word's box runs to the next word's start), the pauses as bands, the measured silences under them | — | `GET /api/report/clip-editor?project&clip&video&from&to` (`words`, `wordsFrom`, `timed`) | -| every clip of the cut, proposed: before → after and the seconds either way, what moved and why; **nothing applies without a press** | the Cut tab's **Propose tight windows**: each row's **Apply**, then its **Undo**; **show every clip** lists the ones already tight | `umtool tighten <p> [--json] [--all] [--no-measure]` · `--apply <clip>[,<clip>…]` | `GET /api/report/tighten?project=<p>[&clip=…][&measure=0]`, each Apply a `PUT /api/report/window` | +| every clip of the cut, proposed: before → after and the seconds either way, what moved and why; **nothing applies without a press** | the Cut tab's Advanced → **Propose tight windows**: each row's **Apply**, then its **Undo**; **show every clip** lists the ones already tight | `umtool tighten <p> [--json] [--all] [--no-measure]` · `--apply <clip>[,<clip>…]` | `GET /api/report/tighten?project=<p>[&clip=…][&measure=0]`, each Apply a `PUT /api/report/window` | The batch has no playhead: the cut's sentences, else the whole ones in the window. A clip with nothing on disk is proposed from its cues and words (no silences) and says *not fetched*; one whose recording has no cues says so and is @@ -1054,7 +1054,7 @@ written over. Three kinds (UI notes 2026-10-30, item 12), the bench's and Play's | | In umtool | From a terminal | Route | |---|---|---|---| -| **as cut (no chrome)**: the clip as the cut plays it | **Export clip**, or Export ▾ → **As cut (no chrome)** — the clip bench's reader (on a phone too); Play the cut under the transport (the clip at the playhead) or a note's **Export <clip>** | `umtool export <p> <clip> [--take <t>] [--json]` | `POST /api/report/clip-export {project, clip, take?, kind?: "cut"}` | +| **as cut (no chrome)**: the clip as the cut plays it | **Export clip**, or Export ▾ → **As cut (no chrome)** — the clip bench's reader (on a phone too); Play the cut under the transport, in its Options (the clip at the playhead) or a note's **Export <clip>** | `umtool export <p> <clip> [--take <t>] [--json]` | `POST /api/report/clip-export {project, clip, take?, kind?: "cut"}` | | **with N s of context**: what the cut plays and N s either side (1–120, default 5), as recorded | Export ▾ → **With context**, the seconds beside it | `umtool export <p> <clip> --context N [--fetch]` | `… {kind: "context", context: N, fetch?: true}` | | **raw / full exchange**: a stretch of the recording as recorded — the clip and the fetch pad (**raw**), or a span of source seconds | **raw** beside Export clip; Export ▾ → **Raw / full exchange**, from–to (starting at the clip's extent ± 30 s) | `umtool export <p> <clip> --raw [--from S --to S] [--fetch]` | `… {kind: "raw", span?: {from, to}, fetch?: true}` | | the export's job | the status line under the buttons (*Fetching what it needs through the editor, then exporting…*, the job's last line), then the file | — | `GET /api/report/clip-export?job=<id>` → `{job, done?, error?}` | @@ -1207,10 +1207,10 @@ source project's. `--json` on a take-scoped edit is the command's own object wit |---|---|---|---| | list | the Takes page | `umtool takes ls <p> [--json]` (picked, superseded, RENDERING) | `GET /api/report/takes` | | relabel (take.json's `label`; an undo point in the take's `revisions/`) | a take's ✎ | `umtool takes relabel <p> <take> <label…>` | `POST /api/report/takes/housekeeping {project, take, op: "relabel", label}` | -| superseded (verdicts.json `superseded: {by, at}`; folded away in the list, nothing deleted; a pick clears it) | **Mark superseded** (by a take), **Not superseded**; **show them** in the group | `umtool takes supersede <p> <take> [--by <take>]` · `--clear` | `{op: "supersede", by?}` · `{op: "unsupersede"}` | +| superseded (verdicts.json `superseded: {by, at}`; folded away in the list, nothing deleted; a pick clears it) | the take card's Advanced → **Mark superseded** (by a take), **Not superseded**; **show them** in the group | `umtool takes supersede <p> <take> [--by <take>]` · `--clear` | `{op: "supersede", by?}` · `{op: "unsupersede"}` | | **cancel a take while it renders** — its render stopped, the take marked cancelled (`takes/<take>/cancelled.json`), render mode let go if it held it | **Cancel render** on the take's card (a rebuild) or on its *rendering now* row (a first render, which has no card yet) | `umtool takes cancel <p> <take> [--json]` | `{op: "cancel"}` → `{stopped, how, cancelled, renderMode, said}` | -| delete `takes/<take>/` | **Delete take** (the plan first) — a cancelled first render too, under **show them** | `umtool takes delete <p> <take> [--dry-run] [--force]` | `POST /api/report/takes/delete {project, take, dryRun?, force?}` | -| **fork as variant** — the take as a project beside this one (see below) | **Fork as variant** on the card (the name, default `v-<take>`), then a link to it and **compare** | `umtool takes fork <p> <take> [--name N] [--json]` | `{op: "fork", name?}` → `{id, take, links, copied, variant}` | +| delete `takes/<take>/` | the take card's Advanced → **Delete take** (the plan first) — a cancelled first render too, under **show them** | `umtool takes delete <p> <take> [--dry-run] [--force]` | `POST /api/report/takes/delete {project, take, dryRun?, force?}` | +| **fork as variant** — the take as a project beside this one (see below) | **Fork as variant** in the card's Options (the name, default `v-<take>`), then a link to it and **compare** | `umtool takes fork <p> <take> [--name N] [--json]` | `{op: "fork", name?}` → `{id, take, links, copied, variant}` | | **compare two takes side by side** — of the project or of it and its variants | **Compare with…** on the card → `/projects/<p>/takes/compare?a=<project>:<take>&b=<project>:<take>`: two players in step (one transport: **Play both**, ±5 s, the seek bar; B pulled back to A past 0.15 s; **sound A / B**), then what differs | `umtool takes compare <p> <a> <b> [--json]` (`<take>` or `<project>:<take>`) | — (the page reads `lib/report/takeCompare.mjs`) | **What a running render names is respected**: a take whose build lock (`takes/<id>/.building.json`) is live is diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -2141,7 +2141,7 @@ manifest as it is now. A recipe is `{ group, window, quick?, takes: [{ id, label summary?, kind?, quick? }] }` (a take's own `group`/`window`/`quick` win), run one take at a time, carrying on past a failure; Make all styles writes `takes/all-styles.recipe.json`. -**Use this take** (`POST /api/report/takes/pick`, `umtool takes pick`) copies the take's +**Use this take** (in the take card's Options; `POST /api/report/takes/pick`, `umtool takes pick`) copies the take's `video.manifest.json` over the project's through the manifest writer (`replaceManifest`: the automatic snapshot `auto-before-pick-take` first, the generated-manifest guard, the drafted-mark rule), marks it **picked** in verdicts.json (one pick per group) and links the History tab's @@ -2572,7 +2572,7 @@ earlier rulings**. The same writer is `umtool rulings` ([cli.md](cli.md)). ### Fetching the windows, and stand-ins A phrase seed's every clip needs its window on disk before anything plays or -renders. **Fetch windows** (the Cut tab, the clip deck; `umtool fetch <project>`) +renders. **Fetch windows** (the Cut tab's Options, the clip deck; `umtool fetch <project>`) asks the editor for all of them as one `fetch-windows` batch — the body is `{requestedBy: "umtool:<project>", manifest: <its path>, storedUrl: "fallback", items: [{slug, id, from, to, clipId, pad, reason}]}`, the window the build would @@ -2623,7 +2623,7 @@ at least one for each year; the rest are in `phrase-scan.json` as A montage of one phrase is also a montage of everyone who said it near the host: a co-host's "slow news day", a guest's answer, a post read aloud. **Score the -voices** on the clip deck or the Cut tab (or `umtool voice-match <project>`) scores every clip's +voices** on the clip deck or the Cut tab's Advanced (or `umtool voice-match <project>`) scores every clip's voice against the host's, locally, and writes `voice-match.json` beside the manifest; each row then shows `voice 0.43 · unsure`. It is an aid to the ear: the audition deck puts the doubtful clips first and the ruling is still yours. @@ -2914,8 +2914,14 @@ keep / cut and comments work the same. Nothing in it calls a model. first whole second and `citeUrl` this clip's with `t=` moved there (one with no `t=` is kept as it is: it may cite a mirror). The editor then opens the new clip; its window may need **Fetch this clip's window** first. The project - page's timeline has the same as **Add clip** (a `<channel>/<video>@<start>-<end>` - spec, after which entry, the quote from the recording's cues). + page's timeline has the same as **Add by spec** (a `<channel>/<video>@<start>-<end>` + spec, after which entry, the quote from the recording's cues) -- and **+ Add a clip** + (the project head, the Cut tab, Play's **+ Add a clip here**, a take walk's **+ Add a + clip to <take> only**) does it without the spec: find the words in the recordings + the cut draws on (or the archive, or paste a link with a time), click a cue to + start there and shift-click one to end there, the place after a row (by date when + the cut is in date order), **Add to the cut** -- and its window is fetched through + the editor's paced fetch at once (lane/ui-simplify). - **Blur** (on every clip): the clip's picture blurred at the encode — see [knobs.md](knobs.md#a-clips-picture-blurred). diff --git a/umtool/e2e/add-clip.spec.ts b/umtool/e2e/add-clip.spec.ts @@ -0,0 +1,68 @@ +import { test, expect } from "@playwright/test"; +import { readFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; + +// --------------------------------------------------------------------------- +// ADD A CLIP, AS ONE FLOW (lane/ui-simplify, 5 Nov; acceptance test A): find +// the words in a recording the cut draws on, the in and out from its cues, +// placed after a row, added -- and its window fetched through the editor's +// paced fetch (the stub editor here). Fixture: add-clip-fixture, a copy of the +// clip editor's cut on testchan/vid1 (its cues: e2e/fixtures/make-fixture.mjs +// CUES.vid1). The old spec form stays (clip-blur.spec.ts, "Add by spec"). +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const P = "reports/add-clip-fixture"; +const DIR = path.join(HERE, "..", ".e2e-song", "reports", "add-clip-fixture"); +type Entry = Record<string, unknown> & { id: string; type: string }; +const timeline = (): Entry[] => JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")).timeline; + +test("Add a clip: find the words, in and out on the cues, after a row, added and fetched", async ({ page }) => { + test.setTimeout(120_000); + // The head's + Add a clip lands on the Cut tab with the panel open. + await page.goto(urls.projectHref(P)); + await page.locator("[data-primary-add-clip]").click(); + await expect(page.locator('[data-add-clip="cut"]')).toBeVisible(); + + await page.locator("[data-add-clip-q]").fill("fourth one"); + await page.locator("[data-add-clip-find]").click(); + await expect(page.locator("[data-add-clip-hits]")).toHaveAttribute("data-add-clip-hits", "1"); + await page.locator('[data-add-clip-hit="vid1@12"]').click(); + // The moment's cue, lit: in 12, out at the end of its sentence (the same cue closes one). + await expect(page.locator('[data-add-clip-edge="in"]')).toHaveValue("12"); + await expect(page.locator('[data-add-clip-edge="out"]')).toHaveValue("15"); + await expect(page.locator("[data-add-clip-quote]")).toHaveValue("A fourth one, done."); + // Shift-click a later line: the out moves to its end, the quote follows. + await page.locator('[data-add-clip-cue="18"]').click({ modifiers: ["Shift"] }); + await expect(page.locator('[data-add-clip-edge="out"]')).toHaveValue("21"); + await expect(page.locator("[data-add-clip-quote]")).toHaveValue(/A fourth one, done\..*it lands at last\./); + // Nudge the in half a second later. + await page.getByRole("button", { name: "in 0.5 s later" }).click(); + await expect(page.locator('[data-add-clip-edge="in"]')).toHaveValue("12.5"); + + const first = timeline()[0].id; + await page.locator("[data-add-clip-after]").selectOption(first); + await page.locator("[data-add-clip-submit]").click(); + const added = page.locator("[data-add-clip-added]"); + await expect(added).toBeVisible(); + const id = await added.getAttribute("data-add-clip-added"); + await expect.poll(() => timeline().map((e) => e.id).indexOf(id!)).toBe(1); + const e = timeline()[1]; + expect(e).toMatchObject({ type: "clip", video: "vid1", start: 12.5, end: 21 }); + // Its window, through the editor's paced fetch: the job runs and ends (done, or the stub's own answer). + await expect(added).not.toHaveAttribute("data-add-clip-fetch", "running", { timeout: 60_000 }); + await expect(added).not.toHaveAttribute("data-add-clip-fetch", "idle"); +}); + +test("Add a clip from a pasted link: the recording the cut already carries, at its time", async ({ page }) => { + await page.goto(urls.projectHref(P, { tab: "cut" })); + await page.locator('[data-add-clip-open="cut"]').click(); + await page.locator('[data-add-clip-mode="link"]').click(); + await page.locator("[data-add-clip-link]").fill("testchan/vid1@0:09"); + await page.locator("[data-add-clip-open-link]").click(); + await expect(page.locator("[data-add-clip-moment]")).toHaveAttribute("data-add-clip-moment", "testchan/vid1@9"); + await expect(page.locator('[data-add-clip-edge="in"]')).toHaveValue("9"); + await expect(page.locator("[data-add-clip-quote]")).toHaveValue("Another whole sentence entirely."); +}); diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs @@ -54,6 +54,7 @@ import { makeCutEditingFixture } from "./cut-editing-fixture.mjs"; import { makeReelFixture } from "./reel-fixture.mjs"; import { makeIntakeFixture } from "./intake-fixture.mjs"; import { makePostItemsFixture } from "./post-items-fixture.mjs"; +import { makePostHappyFixture } from "./post-happy-fixture.mjs"; import { makePostNarrationFixture } from "./post-narration-fixture.mjs"; import { makeTakeItemsFixture } from "./take-items-fixture.mjs"; import { makePlayPreloadFixture } from "./play-preload-fixture.mjs"; @@ -1877,6 +1878,8 @@ makeMontageOpsFixture({ reports, channels: CHANNELS, manifest }); makeClipEditorFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), cues: CUES.vid1 }); // A clip's picture blurred, New clip from selection and the timeline's Add clip (clip-blur.spec.ts). makeClipEditorFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), cues: CUES.vid1, name: "clip-blur-fixture", title: "The Clip Blur Fixture" }); +// Add a clip as one flow (lane/ui-simplify; e2e/add-clip.spec.ts): the same cut, its own copy. +makeClipEditorFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), cues: CUES.vid1, name: "add-clip-fixture", title: "The Add Clip Fixture" }); // Release 36 lane C: the Look panel, a short's framing and Make a short (clip-look.spec.ts). makeClipEditorFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), cues: CUES.vid1, name: "clip-look-fixture", title: "The Clip Look Fixture" }); // P4b: the bench shell's own clips, and the Media tab's fields with their draft files. @@ -1915,6 +1918,7 @@ makeReelFixture({ reports, deckManifest }); makeIntakeFixture({ reports, channels: CHANNELS, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); // Post items (report-to-video/post-item.mjs): a cut mixing a clip and posts played as items, a synthesized posts archive (post-items.spec.ts). makePostItemsFixture({ reports, channels: CHANNELS, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); +makePostHappyFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); // Narrated post items (report-to-video/post-narration.mjs): a take read over a video, four pictures cycling (post-narration.spec.ts). makePostNarrationFixture({ reports, deckManifest }); // A take's own items (takeImport.mjs, takeScope.mjs): a post imported from another project into a draft take, edited in the take only (take-items.spec.ts). diff --git a/umtool/e2e/fixtures/post-happy-fixture.mjs b/umtool/e2e/fixtures/post-happy-fixture.mjs @@ -0,0 +1,22 @@ +// THE POST VIDEO's HAPPY PATH, by clicking (lane/ui-simplify, 5 Nov; e2e/post-happy-path.spec.ts): a cut of one +// cut with nothing in it yet, on the post-items fixture's archive (postchan-x, made by post-items-fixture.mjs first). +// The spec adds the posts (Add posts), sets a pronunciation (Reads and voices), plays it (the head's Play) and +// queues a take's render -- every step a press, nothing from a terminal. +import { copyFileSync, mkdirSync, writeFileSync } from "node:fs"; +import path from "node:path"; +import { POST_CHANNEL } from "./post-items-fixture.mjs"; + +export function makePostHappyFixture({ reports, deckManifest, cachedWindow }) { + const name = "post-happy-fixture"; + const dir = path.join(reports, name); + mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true }); + copyFileSync(cachedWindow, path.join(dir, "out", "clips-raw", "playvid_0.00-9.00.mp4")); + // An empty cut: a post video starts from its posts. + const timeline = []; + const m = deckManifest(name, "The Post Happy Path", timeline); + m.provenance = { ...m.provenance, channelSlug: POST_CHANNEL }; + m.render.fetchPad = 0; + m.render.lockedEdges = false; + writeFileSync(path.join(dir, "video.manifest.json"), JSON.stringify(m, null, 2) + "\n"); + return { dir }; +} diff --git a/umtool/e2e/post-happy-path.spec.ts b/umtool/e2e/post-happy-path.spec.ts @@ -0,0 +1,75 @@ +import { test, expect } from "@playwright/test"; +import { existsSync, readFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; +import { openPanel } from "./panels"; + +// --------------------------------------------------------------------------- +// THE POST VIDEO, END TO END BY CLICKING (lane/ui-simplify, 5 Nov; the operator: +// "a person can make a video end to end in umtool with no agent"). Fixture: +// e2e/fixtures/post-happy-fixture.mjs -- an empty cut on the postchan-x +// archive. Every step is a press: +// +// Cut tab → + Add posts → Preview → Add N posts (posts reel) +// Options "Reads and voices" → a pronunciation → Try it (posts say) +// the head's ▶ Play → Play of the cut (no /play typed) +// Takes → New take → Make it → its render queued (the take maker) +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const P = "reports/post-happy-fixture"; +const DIR = path.join(HERE, "..", ".e2e-song", "reports", "post-happy-fixture"); +const timeline = () => (JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")).timeline as { id: string; type: string }[]); + +test("a post video from Add posts to a queued render, all by clicking", async ({ page }) => { + test.setTimeout(300_000); + await page.goto(urls.projectHref(P, { tab: "cut" })); + + // 1. Add posts: what the archive holds that the cut does not play, previewed, then added in one write. + await page.locator("[data-add-posts-open]").click(); + await page.locator("[data-add-posts-channel]").fill("postchan-x"); + await page.locator("[data-add-posts-preview]").click(); + const plan = page.locator('[data-add-posts-result="plan"]'); + await expect(plan).toBeVisible(); + const n = Number(await plan.getAttribute("data-add-posts-added")); + expect(n).toBeGreaterThan(0); + await page.locator("[data-add-posts-go]").click(); + await expect(page.locator('[data-add-posts-result="done"]')).toHaveAttribute("data-add-posts-added", String(n)); + await expect.poll(() => timeline().filter((e) => e.type === "post").length).toBe(n); + await expect(page.locator('li[data-kind="post"]')).toHaveCount(n); + // The head now offers Play (the newest take; none yet, so the cut). + await expect(page.locator('[data-play-link="header"]')).toHaveAttribute("href", urls.playHref(P)); + // Every row plays from itself. + await expect(page.locator('li[data-kind="post"]').first().locator('[data-play-link="row"]')).toBeVisible(); + + // 2. Reads and voices: a pronunciation, tried. + await openPanel(page, "options", "cut-reads"); + await page.locator("[data-lexicon-word]").fill("atm"); + await page.locator("[data-lexicon-say]").fill("A-T-M"); + await page.locator("[data-lexicon-add]").click(); + await expect(page.locator('[data-lexicon-row="atm"]')).toBeVisible(); + expect(existsSync(path.join(DIR, "narration", "lexicon.json"))).toBe(true); + await page.locator("[data-lexicon-try]").fill("it is atm now"); + await page.locator("[data-lexicon-try-go]").click(); + await expect(page.locator("[data-lexicon-tried]")).toContainText("A-T-M"); + + // 3. Play, from the head: no /play typed. + await page.locator('[data-play-link="header"]').click(); + await expect(page).toHaveURL(/\/play$/); + await expect(page.locator("[data-play-cut]")).toBeVisible(); + + // 5. A take, rendered: the take maker's job starts from a press. + await page.goto(urls.takesHref(P)); + await page.locator("[data-action='new-take-open']").click(); + const style = page.locator("[data-take-style]"); + await expect(style).toBeEnabled(); + await style.selectOption("e2e-crisp"); + await page.locator("[data-take-window='full']").check(); + await page.locator("[data-action='make-take']").click(); + const job = page.locator("[data-take-job]"); + await expect(job).toBeVisible(); + await expect(page.locator('[data-take-step="crisp"]')).toBeAttached(); + // Not left running for the next spec: the job ends (its own spec judges a render's result). + await expect(job).not.toHaveAttribute("data-job-progress-of", "running", { timeout: 240_000 }); +});