Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 0b22c4778267a049fee3b19bf7e68b7b9ff8e5cd
parent a15a58b7d51c14ad82603435c35f7b0390dc858a
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 16:28:02 -0400

Merge main 4ef7dd96 (P6a live) into ux/r6

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
MAGENTS.md | 5+++--
MOPERATING.md | 37++++++++++++++++++++-----------------
MREPORT.md | 2+-
Meditor/CHANGELOG.md | 6++++++
Mplans/FACTS.md | 60+++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
Mplans/umtool-redesign.md | 120++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Dumtool/app/articles/page.tsx | 119-------------------------------------------------------------------------------
Dumtool/app/drafts/page.tsx | 12------------
Mumtool/app/globals.css | 31-------------------------------
Mumtool/app/projects/[...path]/page.tsx | 6+++---
Mumtool/app/projects/page.tsx | 4++--
Mumtool/app/settings/system/page.tsx | 33++++++++++++++-------------------
Mumtool/app/sites/[site]/page.tsx | 4++--
Dumtool/app/sites/page.tsx | 90-------------------------------------------------------------------------------
Mumtool/app/tools/bench/page.tsx | 4++--
Mumtool/app/tools/faces/page.tsx | 4++--
Mumtool/app/tools/find/page.tsx | 4++--
Mumtool/app/tools/sources/page.tsx | 4++--
Mumtool/app/tools/trim/[set]/page.tsx | 4++--
Mumtool/bin/umtool.mjs | 4++--
Dumtool/components/BrowseHeader.tsx | 27---------------------------
Mumtool/components/CopyButton.tsx | 2+-
Mumtool/components/CutBench.tsx | 17+++++++++--------
Mumtool/components/LoudnessTable.tsx | 3++-
Mumtool/components/MomentMarks.tsx | 3++-
Mumtool/components/NoteField.tsx | 3++-
Mumtool/components/PlanDiffPanel.tsx | 7++++---
Mumtool/components/ProvenancePanel.tsx | 9++++++---
Mumtool/components/SpecSheet.tsx | 3++-
Mumtool/components/ThumbBench.tsx | 7++++---
Mumtool/components/VerdictChip.tsx | 3++-
Mumtool/components/articles/ArticlePage.tsx | 2+-
Mumtool/components/articles/ArticleTable.tsx | 2+-
Mumtool/components/articles/EvidencePage.tsx | 4++--
Mumtool/components/articles/IterationsTab.tsx | 10+++++-----
Mumtool/components/articles/PolicyPanel.tsx | 3++-
Mumtool/components/articles/RefreshSummary.tsx | 4++--
Mumtool/components/articles/ResearchSlot.tsx | 10+++++-----
Mumtool/components/dashboard/CheckSourcesButton.tsx | 4++--
Dumtool/components/dashboard/DeliverablesPanel.tsx | 39---------------------------------------
Dumtool/components/dashboard/NowLive.tsx | 106-------------------------------------------------------------------------------
Dumtool/components/dashboard/NowPanel.tsx | 46----------------------------------------------
Dumtool/components/dashboard/Panel.tsx | 34----------------------------------
Dumtool/components/dashboard/SourcesPanel.tsx | 75---------------------------------------------------------------------------
Dumtool/components/dashboard/StateStrip.tsx | 56--------------------------------------------------------
Dumtool/components/dashboard/ToolsPanel.tsx | 89-------------------------------------------------------------------------------
Mumtool/components/notes/AnchoredNotes.tsx | 2+-
Mumtool/components/projects/ClipBench.tsx | 2+-
Mumtool/components/projects/CutPage.tsx | 1+
Mumtool/components/projects/MediaDrafts.tsx | 4++--
Mumtool/components/projects/ReportProject.tsx | 4++--
Mumtool/components/projects/SongProject.tsx | 2+-
Mumtool/components/projects/StructureEditors.tsx | 6+++---
Mumtool/components/projects/SweepProject.tsx | 4++--
Mumtool/components/projects/report/SourcesTab.tsx | 2+-
Mumtool/components/projects/report/shared.tsx | 2+-
Mumtool/components/projects/song/CutsTab.tsx | 11+++++++----
Dumtool/components/shell/JobProgress.tsx | 4----
Mumtool/components/shell/RunningList.tsx | 2+-
Mumtool/components/system/Maintenance.tsx | 9++++-----
Aumtool/components/system/NowLive.tsx | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/components/system/Status.tsx | 178+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/components/system/ToolsPanel.tsx | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/components/ui/badge.tsx | 5++++-
Mumtool/components/ui/job-progress.tsx | 3+--
Dumtool/components/ui/verdict.tsx | 22----------------------
Mumtool/docs/README.md | 146+++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
Mumtool/docs/authoring.md | 14+++++++-------
Dumtool/docs/browse.md | 88-------------------------------------------------------------------------------
Mumtool/docs/build.md | 2+-
Mumtool/docs/claim-bench.md | 4++--
Mumtool/docs/cli.md | 13+++++++++----
Mumtool/docs/clip-bench.md | 14+++++++-------
Dumtool/docs/dashboard.md | 36------------------------------------
Dumtool/docs/decisions.md | 107-------------------------------------------------------------------------------
Mumtool/docs/e2e.md | 2+-
Mumtool/docs/folders.md | 2+-
Aumtool/docs/inbox.md | 145+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/docs/index.md | 2+-
Mumtool/docs/mix-from-a-project.md | 8++++----
Mumtool/docs/notes.md | 16+++++++++++-----
Aumtool/docs/piece.md | 233+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dumtool/docs/projects.md | 129-------------------------------------------------------------------------------
Aumtool/docs/recurring.md | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/docs/refresh.md | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/docs/report-video.md | 62++++++++++++++++++++++++++++++++------------------------------
Aumtool/docs/research.md | 109+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/docs/settings.md | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dumtool/docs/sites.md | 132-------------------------------------------------------------------------------
Aumtool/docs/tools.md | 27+++++++++++++++++++++++++++
Aumtool/docs/work.md | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/e2e/article-iterations.spec.ts | 7++++++-
Mumtool/e2e/media-surfaces.spec.ts | 2+-
Mumtool/e2e/piece.spec.ts | 2+-
Mumtool/e2e/redirects.spec.ts | 4+++-
Mumtool/e2e/settings.spec.ts | 3+++
Mumtool/e2e/shell.spec.ts | 5+++++
Mumtool/e2e/song-piece.spec.ts | 22++++++++++++++++++----
Mumtool/lib/activity.ts | 2+-
Mumtool/lib/browse.ts | 11+++++++++++
Mumtool/lib/decisions.ts | 9++++++---
Mumtool/redirects.mjs | 6+++---
102 files changed, 1711 insertions(+), 1509 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md @@ -185,8 +185,9 @@ This tooling is on `main` as of 2026-08-20. umtool notes --all --open # from the checkout: node umtool/bin/umtool.mjs notes --all --open ``` -The operator leaves notes in umtool on articles (`/sites/<site>/<report>`) and on -report-video projects (rows, takes, moments in a cut). They live in a `notes.json` +The operator leaves notes in umtool on articles (`/sites/<site>/<report>`, the store's +`/articles/<id>`; the piece's Article tab) and on report-video projects (Cut-tab rows, +takes, moments in a cut). They live in a `notes.json` beside the report's `report.json` (never published) or beside the project's `video.manifest.json`. `umtool notes <site>/<report>` prints each open note with its anchor resolved and the **source** file to edit — a draft, not the generated diff --git a/OPERATING.md b/OPERATING.md @@ -161,11 +161,12 @@ pnpm archilyzer reports iterations example-article umtool chain example-article 3 ``` -- In umtool: `/articles/new` starts an article with a sweep or with research (question, channels, dates, model, - cap; research takes an autonomy, defaulted from the settings, and needs no channel); the article's **Iterations** - tab (`/articles/<id>?tab=iterations`) lists its iterations and runs the rest (**New iteration**, **Copy with - model**, **Narrate**, **Draft**, **Draft everything**, **Cancel**, **Make the video**, **Use this iteration**); `/articles/<id>/compare?a=&b=` - puts two side by side. The pages: [umtool/docs/sites.md](umtool/docs/sites.md). +- In umtool: Create's **Article from a question** (`/create?make=article`) starts an article with a sweep or with + research (question, channels, dates, model, cap; research takes an autonomy, defaulted from the settings, and needs + no channel); the article piece's **Iterations** tab (`/articles/<id>?tab=iterations`) lists its iterations and runs + the rest (**New iteration**, **Copy with model**, **Cancel**, **Make the video**, **Use this iteration**, + **Refresh…**, **Media drafts →** to the cut's Media tab); `/articles/<id>/compare?a=&b=` puts two side by side. + The pages: [umtool/docs/piece.md](umtool/docs/piece.md). - Each generation is an **iteration** of the article, `i1`, `i2`, … in `transcripts/reports/<id>/iterations/<n>/`, never published ([REPORT.md](REPORT.md), "Iterations"). The article's `report.json` changes only when you choose **Use this iteration**. An article with iterations and no `report.json` is in the making: not listed, not a @@ -192,8 +193,8 @@ umtool chain example-article 3 --draft-all --model qwen3:8b | Task | Field | Limits (code's) | Review | | --- | --- | --- | --- | -| `cut` | the timeline's order (`drafted.timeline`) | ids from the report's citations only, 3 to `generation.cut.maxClips` (20); windows untouched | the project page's **Review drafts** | -| `onscreen` | each clip's `onscreen.{title, subtitle}` | title ≤ 60, subtitle ≤ 90, one line; a subtitle quotes the clip's own words only | the On-screen table, **Review drafts** | +| `cut` | the timeline's order (`drafted.timeline`) | ids from the report's citations only, 3 to `generation.cut.maxClips` (20); windows untouched | the Media tab, **Review drafts** | +| `onscreen` | each clip's `onscreen.{title, subtitle}` | title ≤ 60, subtitle ≤ 90, one line; a subtitle quotes the clip's own words only | the Media tab's On-screen table, **Review drafts** | | `teaser` | a teaser's `lines` (a cut with none gets one) | 3 to 5 lines ≤ 70, no quote read out | the teaser editor, **Review drafts** | | `flips` | `render.chrome.flips` | pairs over the cut's clips of two dates, THEN the earlier; needs the deck | **Review drafts** | | `threads` | `render.chrome.threads` and each clip's `thread` | 2 to 4 threads; needs the deck; not with flips | **Review drafts** | @@ -203,15 +204,17 @@ umtool chain example-article 3 --draft-all --model qwen3:8b - Every drafted field carries `drafted {task, model, at, iteration, attempt}`. A field you wrote or edited is never replaced: the draft is kept in `<task>-draft.json` as an alternative, taken with **Use this**. `force` re-drafts only a field a model drafted. `entries` limits a per-entry task to those entries. -- In umtool: the project page's **draft** section has **Draft with** a model per task (force, the entries, the job's - progress, the last run's written, skipped and refused); the Iterations tab has the six beside **Narrate**. A - project not made from an iteration (`<projectsRoot>/<id>/i<n>/`) offers none. -- **Draft everything** (the Iterations tab, or `umtool chain <id> <n> --draft-all [--model M]`) is the chain with +- In umtool: the piece's **Media** tab lists every drafted field with its provenance, **Approve draft** and + **Reject**, and heads each section with **Draft with <model>** (force, the entries, the job's progress, the last + run's written, skipped and refused). A project not made from an iteration (`<projectsRoot>/<id>/i<n>/`) offers + none ("Drafting is off: no article iteration made this project."). +- **Draft everything** (the Media tab, or `umtool chain <id> <n> --draft-all [--model M]`) is the chain with its drafts: current → windows → prepare → posts → manifest → cut → on-screen → teaser → flips → threads → narration → voices → the fast build → podcast → YouTube (its chapters re-muxed so `out/youtube.txt` is written). No attach, no dedupe. A draft refused or failed is recorded failed and the chain goes on; one with nothing to draft, or flips and threads with no deck (or the other panel on), is skipped. A resume passes a draft that ran. -- **The review gate:** approve or reject each drafted field (with a note) on `/browse/<project>/review`. A preview or +- **The review gate:** approve or reject each drafted field (with a note) on the Media tab or the review bench, + `/projects/<project>/review` (**Review drafts — N**). A preview or fast build warns of an unreviewed draft; a `final` build refuses one, and refuses a rejected one whatever the flags; `--drafts-unreviewed` builds it anyway. A video revision that reorders the cut makes the order its draft. @@ -227,8 +230,8 @@ pnpm ops get generation-usage ``` - The presets: `code` (everything in Claude Code), `balanced` (sweeps in Claude Code, report revisions and research - on the API, video revisions and narration local), `api`, `local`. Choosing one writes its routes; the panel on - `/articles/new` writes the same settings. + on the API, video revisions and narration local), `api`, `local`. Choosing one writes its routes; umtool's + `/settings/generation` writes the same settings. - `gen run` exits 3 and runs nothing for a task routed to `code`. In Claude Code, `/gen` and the MCP's `generate` run a routed task through the editor and review what it made; `generation_policy` reads the policy and moves it when you ask. `/sweep` follows the policy too. @@ -305,9 +308,9 @@ pnpm ops delete-iteration --json '{"id":"example-article","n":3}' ``` - Every delete is a **plan** first: each path that would go with its size, what is kept and why, what refuses. In - umtool the buttons are **Delete article** (the article's page), `Delete i<n>` (its Iterations tab), **Delete - project** (a report-video project's page) and `Delete take <id>` (its takes page); each shows the plan and acts - only on **Confirm delete**. + umtool the buttons are **Delete article** (the article piece's **⋯** menu), `Delete i<n>` (its Iterations tab), + **Delete project** (a report video's **⋯** menu) and `Delete take <id>` (its takes page); each shows the plan and + acts only on **Confirm delete**. - **An article** takes its directory (report, video, history, notes, iterations), its iterations' video projects under the projects root and its staged exports. Refused while published or named by a site page with no report of its own (force unpublishes and drops the page), and while any iteration runs. diff --git a/REPORT.md b/REPORT.md @@ -6,7 +6,7 @@ One cited report, format `"archilyzer-report"`, version 1, persisted as `report. A report lives in one of two stores: -- **An article** — `transcripts/reports/<reportId>/report.json`, published by the project homepage. `transcripts/reports/index.json` — `{"published": [ids]}` — is the published, ordered list; an article directory it does not name is a draft. An article's `audience` (below) says which homepage build carries it: the public one only `"public"` articles, the private one every published article. An article may cite any channel of the corpus. An article may not be called `new` (umtool's `/articles/new` is a page). +- **An article** — `transcripts/reports/<reportId>/report.json`, published by the project homepage. `transcripts/reports/index.json` — `{"published": [ids]}` — is the published, ordered list; an article directory it does not name is a draft. An article's `audience` (below) says which homepage build carries it: the public one only `"public"` articles, the private one every published article. An article may cite any channel of the corpus. An article may not be called `new` (umtool's `/articles/new` is an address: it opens Create's article form). - **A site's page** — `transcripts/sites/<siteId>/reports/<reportId>/report.json`, published by its site at `/pages/<reportId>/`: the site's `pages` list in `site.json` is the published, ordered list — see [SITE.md](SITE.md). A page cites the site's `channels` and `citedChannels`. `index.json` and an article's `audience` are written ONLY through `common/lib/report/registry.ts` (`configureArticle`, `setPublished`, `setArticlesOrder`, `patchArticle`, `writeArticle`: locked, validated, atomic) and `pnpm ops articles-config` (`{"id", "audience"?, "published"?, "position"?}`), never by hand. Only a sound article (no problem below) is published; a patch may not add a problem to an article. diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog ## [Unreleased] +- **umtool's docs follow the redesign.** `umtool/docs/` has a sheet per place — `inbox.md`, `research.md`, `work.md`, `piece.md`, `tools.md`, `settings.md` — and `refresh.md` and `recurring.md`; the README lists the places, Create's lines and every old address with where it lands now. The dashboard, browse, decisions, sites and projects sheets are folded into them. +- **umtool's Settings · system says its status in lines.** The tools and free disk, the roots, the index ("51 records · rebuilt 3 min ago", once — the tools panel no longer repeats it), umtool's own jobs, the projects by state, the deliverables, the sources nobody has checked (**Re-check N projects**), then storage last. **Check** / **Check again** probe the tools. +- **In umtool a state is never a verdict colour.** "In the making", an open decision, an iteration running or queued, a research proposal waiting, a refresh held by the cap, open notes and a clip not fetched yet wear a neutral dashed tag; the moss, ochre and brick stay for judgements. **Use this iteration**, **Start iteration**, the research queue's **Yes** and **Continue into a sweep**, the song benches' buttons and the on-screen editors' saves are outlines — one filled action per view (the Next card's, the verdict bar's) — and a chosen toggle (a preset, a picked variant, the plan shown, an accepted cover) is pressed in, not lit. +- **A song's cuts have one address: the song's full path.** The Cuts tab's cut cards, a cut page's plan links and a song's Inbox calls link `/projects/<path>/<cut>`; the short `/projects/<song>/<cut>` still opens it. +- **umtool's Media tab says what is off, whole:** "Drafting is off: no article iteration made this project." / "Drafting waits for <article> i<n>, which is running." +- **umtool's dead pages are gone, their addresses kept.** `/drafts` redirects to Create's article form (as it did); the old `/articles` and `/sites` list pages, already behind their redirects to Work, are deleted. The faces and trim pages light Tools in the rail. Needs a restart of umtool. - **Refresh an article: fetch what is new, see what changed, update.** `pnpm ops report-draft --json '{"task": "refresh", "article": "<id>"}' --wait` (or umtool's **Refresh…**) takes the article's current report — or the iteration named by `"iteration"` — and runs ONE job on its own lane, `draft:refresh`: it fetches the report's scope and every channel its citations touch through the editor's own actions (`sync`, the channel's report, `transcribe-bucket` for only what landed; `fetch-posts` for a posts channel; a platform held or cooling down is skipped and said), builds the site whose build holds them locally (never a deploy), searches again with the report's own recorded enumerations (its trace; an older run's turns; else its question) and reads every cited quote again (words changed, `en` against `en-orig`, a source gone). Nothing changed: the new `refresh` iteration ends **no change**, $0. Something changed: a sweep of only the new and changed recordings, then a revision of the report with its findings and the quote fixes, within the caps — past one it ends **held by the cap** with the delta and the estimate. What it found is the iteration's `refresh.json`; the log ends `@@report-draft {…, refresh: {status, newIds, changed, drifted, deleted, summary}}`. `"fetch": false` reads the corpus as it stands; `"dryRun": true` answers the plan and writes nothing. Needs a restart of the editor and umtool. - **umtool's Refresh: plan, then confirm.** The article piece's **⋯ → Refresh…**, the Iterations tab's **Refresh…** and the Next card (when one is suggested) open the plan — the iteration refreshed and what it searches again, each channel's fetches or why one is skipped, the site built, the model, the cap and the day's spend — and **Refresh** starts the job (the Running list follows it). The Overview then says what it found: "1 new recording matches · 1 quote changed" (or "Nothing new since <date>"), the new recordings, the quotes that changed and what they say now, the fetches and the build, the spend or the cap that held it; the sources gone are said by where ("1 source deleted on YouTube", "1 source gone from the archive"), and for an iteration made before match counts were kept, changed recordings are "not tracked before <date>" rather than none; a refresh's card on the Iterations tab carries the same line. A refresh with a report is an **iteration ready** card like any other; making it current stays yours. - **The Inbox suggests a refresh.** Once a day per active article with a current report (parked, done and muted pieces are skipped), umtool runs the report's enumerations again over the corpus it read — no fetch, no model — and an article with new matches gets a **Review** card, "3 new recordings mention this since 2026-10-01: …", whose action is **Refresh**. The check reads the build the report read, else the research corpus — and only when that corpus holds every channel of the report's scope: otherwise the article is **unchecked**, with why ("the build holding harbor-radio is not on this machine; channels not in the research corpus: …"), and gets no card. A refresh the cap held is a **Your call** card until something newer runs. The check is kept in `REPORTS_ROOT/.umtool/refresh-check.json`; `umtool refresh --check` runs it now and prints the unchecked ones with their reason. diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -9114,8 +9114,9 @@ The record is [`landed-2026-10.md`](landed-2026-10.md). Every anchor below was r `kindTakesNotes` / `kindLinksArticles` (`:192`, `:195`) — `umtool/lib/annotations/targets.mjs:80`, `:164`; `umtool/lib/articles/links.mjs:47` — and an e2e spec fails on a kind id written as a literal outside `lib/projects/` and `components/projects/`. -- **/sites** lists every site's articles (`umtool/lib/articles/sites.ts`): published ids unioned with draft - report dirs, each with its open notes, its source and its linked video. An article row's `kind` is the REPORT's +- **Every site's articles** (`umtool/lib/articles/sites.ts`; Work's site facet `/work?by=site`, which `/sites` + redirects to, and `/sites/<site>`): published ids unioned with draft report dirs, each with its open notes, its + source and its linked video. An article row's `kind` is the REPORT's kind (`factcheck|sweep`), not a project kind. ## The caption-track rule (verified 2026-10-10, release 20 D3, against `585be292`) @@ -9160,8 +9161,8 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri / `deleteIteration`; `archilyzer reports delete`, `pnpm ops delete-article|delete-iteration`, umtool's Delete buttons): a plan first, then the store's writes and one rename (`.deleting-…`) under the lock, the bulk after it. An iteration's number is never reused (`current.json` `highest`). -- **An article may not be called `new`** (`RESERVED_ARTICLE_IDS`, `assertArticleId`): umtool's `/articles/new` is a - page. +- **An article may not be called `new`** (`RESERVED_ARTICLE_IDS`, `assertArticleId`): umtool's `/articles/new` is an + address (a redirect to Create's article form, `/create?make=article`). - **Generation jobs** are job kind `report-draft` on the queues `draft:api` and `draft:local` (`DRAFT_API_QUEUE`, `DRAFT_LOCAL_QUEUE`, `common/lib/queueKeys.ts`), enqueued by `enqueueReportDraft` (`common/controller/reportDraft.ts`). A `sweep` body with `iteration` CONTINUES a research run; a copy is `copyOf` with no `iteration`. @@ -9282,7 +9283,7 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri `article: ""`, `iteration: 0`. The cues are the local corpus's (`diskCuesOf`), not a build's. `archilyzer reports bench-verdicts` is `--dry` (read only), through the editor (default), or `--here` (API models only). - **`settings.generation.verdicts` = `{bar: {agreement, contradictedRecall, notFoundRecall}, models: string[]}`**: - fractions 0..1 (all 0 = no bar), and the passing models the operator ticked on umtool's `/bench` (never set + fractions 0..1 (all 0 = no bar), and the passing models the operator ticked on umtool's `/tools/bench` (never set automatically). umtool writes the whole block through the editor's settings action (a nested object replaces). `passesBar(score, bar)` (`bench/score.ts`) is the one pass rule: strict agreement and the two recalls; a recall with nothing ruled that way is not a miss. @@ -9407,3 +9408,52 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri fired by `approveResearch` when the run is left `ready`). - **build-video run by hand needs the editor's `WORKER_TOKEN`** for narration (source `editor/.env`; the chain sets it). + +## The umtool redesign: pieces, places, addresses (verified 2026-10-14, P6a, branch `ux/p6a` from `main` `165a4ee2`) + +- **The places** (`umtool/components/AppNav.tsx`, `components/shell/AppRail.tsx`): Inbox `/`, Research `/research`, + Work `/work`, Tools `/tools`, Settings `/settings` (`/settings/generation`, `/settings/system`), and **+ Create** + `/create` (a link, not a place). ⌘K / Ctrl+K opens the jump palette from any page (`components/shell/JumpPalette.tsx`). + A page passes `active`; old keys (`browse`, `articles`, `home`, a tool's own) map to a place (`placeOf`), and an + unknown key lights Work. +- **Piece ids are namespaced** (`umtool/lib/pieces/ids.mjs:10-13`): `a:<site>/<report>` (site `articles` = the + store), `p:<project id>`, `c:<case>`, `s:<series>`. A bare `x/y` never parses (`parsePieceId`), so a two-segment + id is never ambiguous. A project an article claims (an iteration's `projectDir`, then the manifest's `article` + key, then a unique slug — `lib/articles/links.mjs`) is that article's piece, not its own. +- **umtool's own state lives under `REPORTS_ROOT/.umtool/`**, never in the corpus, every file one writer, temp + + rename, an unreadable file never overwritten (409): `lifecycle.json` (`{state: active|parked|done, at, by?}` per + piece id; `lib/lifecycle.mjs:40`), `mutes.json` (piece → decision kind → `{at}`; `lib/mutes.mjs:38`), + `research/<case>/case.json` (a board; `lib/research/cases.mjs:7`; `sessions`, `census`, `archive`, `runs`, + `cases`, `new` are reserved ids, `:39`), `research/sessions/<16 hex>.json` (a reading log; `log.mjs:41`), + `research/census/<sha1>.json` (the track census per source build), `refresh-check.json` (R4's daily check; + `lib/inbox/refresh.ts:52`). A recurring report's schedule is the article store's, written by the editor only: + `transcripts/reports/<article>/schedule.json` (living) or `transcripts/reports/.series/<id>/series.json` + (`common/lib/report/schedule/store.ts:36-38`). +- **One stage rule** (`umtool/lib/pieces/tabs.mjs` `pieceSteps` `:60`, `stageOfPiece` `:93`, `stepOfPiece` + `:105`): the current step is the FURTHEST stage reached (Research → Article → Video → Deliver; a song's flow + Spec → Cuts → Done), a skipped stage before it is to do with its reason, a stage that cannot apply is `na`, a + piece marked done has done every stage that applies. The stepper, `data-piece-stage` and Work's stage facet all + read it, so they cannot disagree. +- **The decisions API contract** (`app/api/browse/decisions/route.ts`): `items[]` is ONE ROW PER DECISION, never + grouped or dropped (the MCP reads `open-note` rows, `project` as the notes target, and `href` ending + `note=<id>`; `lib/hrefs.ts` keeps `?note=` last). Each row's `piece`, `category`, `group`, `action {label, href}`, + `lifecycle`, `muted`, `hidden`, `hiddenBy` are additive; `groups` (cards: Your call, Review, Blocking, Notes, + Open, Ready to finish, Quiet — `lib/inbox/groups.mjs:24`), `hidden` and `muted` are counts beside them. + A song's decision keeps its BASENAME as `project` and links its full path (`lib/decisions.ts`, + `songProjectId` in `lib/browse.ts`). +- **Redirects are ONE table**, `umtool/redirects.mjs`, read by `next.config.ts`'s `redirects()` (checked before the + filesystem, the query passed through, the request's query FIRST) and by `e2e/redirects.spec.ts`. 16 rows, all + 307 (`permanent: false`) until P6b flips them to 308: `/` with `?from=` → `/create`; `/articles/new` and + `/drafts` → `/create?make=article`; `/browse` → `/work`; `/browse/decisions` → `/`; + `/browse/{find,faces,sources}`, `/browse/trim/:set` → `/tools/…`; `/browse/at` → `/projects/at`; + `/browse/:path*` → `/projects/:path*` (after the reserved rows); `/articles` → + `/work?kind=article&site=articles`; `/sites` → `/work?by=site`; `/mix` → `/tools/mix`; + `/:mode(sort|salvage|verify|keeps)` → `/tools/song/:mode`; `/bench` → `/tools/bench`. +- **A claimed project's address lands on its article** (`claimedProjectRedirect`, `lib/pieces/article.ts`): a + `redirect()` (307) from `/projects/<path>` with no view segment; the benches and kind views (`clip/<id>`, + `claim/<id>`, `review`, `narration`, `takes`) stay at the project's address. +- **A song's canonical address is its full path** (`/projects/<REPORTS_ROOT-relative path>`, `/…/<cut>`); the + basename resolves only when unique (`resolveProjectPath`, `lib/projects.ts`). +- **Colour is a role, and verdict colours are judgements only** (`umtool/app/globals.css`): Signal is focus, the lit + line and ONE filled action per view (`buttonVariants` `go`); every other action is an `outline`; a state that is + not a judgement wears `badgeVariants` `state` (a dashed ink edge); Meter is measurement. diff --git a/plans/umtool-redesign.md b/plans/umtool-redesign.md @@ -443,7 +443,8 @@ edition reviewed with the operator before the schedule is left on. | R5 recurring reports | `ux/r5` → `main` `0bf4aacd` | LIVE 2026-10-14 (editor 379S-Sk9…, umtool vWDhtigj…) | | R6 triage first | `ux/r6` | shipped on the branch (record below) | | Co-host pilot | — | after R6 (operator-approved) | -| P6 cleanup, docs, audit | — | after P4a-3, P4b, R4–R6 | +| P6a cleanup, docs, audit | `ux/p6a` | shipped on the branch (before R6) | +| P6b 308s, screenshot audit | — | after R6 | ### P2a, as shipped @@ -2829,6 +2830,123 @@ schedules, the lane armed and not held; a dry-run of the co-host series (`the-qu report"; `/work?recurring=1` 200. No schedule exists until the operator (or the pilot, with the operator) makes one. +### P6a, as shipped + +**What.** The cleanup, the docs and the audit list that do not wait for R6; the 308 flip and the full screenshot audit are +P6b's. No URL moved; every old address still lands. + +- **Deletes** (each with its proof: nothing imports it — a resolver over every `import`/`export … from` in `app`, + `components`, `lib`, `bin`, `e2e`, `scripts`, run before and after; or it is unreachable behind a redirect row): + - `components/BrowseHeader.tsx` — its 11 call sites render `AppShell` directly (same crumbs, note, `<header>`, + `.micro`, `[data-nav-group=song]`, `aria-current`); a tool page passes its own key, so `/tools/faces` and a trim set + light Tools (they lit Work). + - `app/articles/page.tsx`, `app/sites/page.tsx` — unreachable since P3's `/articles` and `/sites` rows. + - `app/drafts/page.tsx` — now a P6 row, `/drafts` → `/create?make=article` (where the page sent it). + - `components/shell/JobProgress.tsx` — a re-export for `RunningList` alone, which imports `components/ui/job-progress.tsx`. + - `components/ui/verdict.tsx` and its `.verdict` CSS — imported by nothing since P1. + - `components/dashboard/{Panel,ToolsPanel,NowPanel,StateStrip,SourcesPanel,DeliverablesPanel}.tsx` — the old dashboard + panels, rewritten as `components/system/{ToolsPanel,Status}.tsx` (+ `NowLive.tsx` moved) on the ui `Panel`, every + `data-*` kept. `components/dashboard/` keeps the Inbox's own (`InboxList`, `Lifecycle`, `ResumeChip`, `SlashFocus`, + `ToolList`, `CheckSourcesButton`). + - Kept, by rule: `lib/report/chain-run.mjs` (the resolver's only other "unused" file: it is executed, not imported). +- **Settings · system in status lines.** The index is said once, in its panel ("51 records · rebuilt just now", or "No + index — every read walks the disk."); Tools & disk says the free space and the tools (**Check** / **Check again**); + roots "= reports · UMTOOL_MEDIA_DIR unset", an old cache "not read; safe to delete"; Sources one count line with + **Re-check N projects**; Activity, Projects (**Every project →**), Deliverables (**Built →**); Storage, the long list, + last. +- **The audit list.** + - A state is never a verdict colour: `badgeVariants` gains `state` (a dashed ink edge) for "in the making", an open + decision's chip (`TONE.open`), an iteration running or queued, a research proposal waiting, a refresh held by the cap, + open notes, a clip not fetched yet. + - One filled action per view: IterationsTab's **Use this iteration** and **Start iteration**, ResearchSlot's **Yes** and + **Continue into a sweep**, StructureEditors' saves are outlines. + - The song benches (CutBench, ProvenancePanel, LoudnessTable, SpecSheet, ThumbBench, NoteField, VerdictChip, MomentMarks, + PlanDiffPanel, CopyButton) are `buttonVariants` outlines; a pressed toggle (blind, the picked variant, the plan shown, + an accepted cover, the chosen generation preset) wears the panel ground. Signal stays on focus and the cut slider. + - One address per cut: the Cuts tab's cards, the provenance plan links and a song's decision hrefs use the full path + (`songProjectId`, `lib/browse.ts`; the decision's `project` stays the basename, the notes' target); the short + `/projects/<song>/<cut>` still resolves through the basename alias. + - Media: "Drafting is off: no article iteration made this project." / "Drafting waits for <article> i<n>, which is + <status>." + - Found on the way: `umtool show` and `umtool check-sources` named `/browse/decisions` and "the dashboard"; Re-check in + sentence case. +- **Docs.** `umtool/docs/`: `inbox.md`, `research.md`, `work.md`, `piece.md`, `tools.md`, `settings.md`, `refresh.md`, + `recurring.md` (new); README (the places, Create's lines, the old-address table); `dashboard`, `browse`, `decisions`, + `sites`, `projects` folded in and deleted; the other sheets' addresses and "project page" now name the tab; `notes.md` + keeps its agent loop and says where each kind of note is written. Every relative link and anchor checked by a script. + AGENTS.md (where notes are written), FACTS (a new section: places, piece ids, the `.umtool` files, the one stage rule, + the decisions API, the 16-row redirect table, a claimed project's redirect, a song's address, colour roles; three stale + lines fixed), OPERATING.md (Create, the Iterations tab, the Media tab, `/settings/generation`, the ⋯ deletes), REPORT.md. + +| sha | what | +|---|---| +| `0353424a` | deletes: BrowseHeader, the dead list pages, `/drafts`' page (a P6 row), the JobProgress re-export, the Verdict primitive; `shell.spec` (tool pages light Tools), `redirects.spec` (the P6 row) | +| `9206e3da` | Settings · system: the dashboard panels to `components/system`, status lines; `settings.spec` (the index line, no index on Tools & disk) | +| `1f8136f9` | the audit: `state` tag, outlines, the cut's full path, the Media line; `article-iterations`, `song-piece`, `media-surfaces`, `piece` specs | +| `356b897a` | `umtool show` points at the Inbox | +| `821c6be2` | Re-check in sentence case | +| `658e992f` | the chosen preset is a pressed outline | +| `3c7f88a1` | docs, AGENTS, FACTS, OPERATING, REPORT | +| `4a224e58` | `umtool check-sources` names Settings · system | +| `a4406b50` | the cut page's last Signal outlines (the full run's one red) | + +**Gates.** + +| Gate | Result | +|---|---| +| repo-wide `tsc --noEmit` | clean at `4a224e58` (and `0353424a`, `1f8136f9`); `pnpm --filter umtool typecheck` clean at every commit | +| umtool unit (`node --test umtool/lib/*.test.mjs umtool/lib/*/*.test.mjs umtool/report-to-video/*.test.mjs`) | 858 tests, 856 pass, 2 skipped, 0 fail | +| `pnpm --filter umtool test` | 28/28 | +| `pnpm run test:scripts` (reads the capped build's traces) | 1010 tests, 1008 pass, 2 skipped, 0 fail | +| `pnpm archilyzer docs cli --check` | clean | +| capped umtool `next build` (corpus linked, `MemoryMax=5G`, heavy slot `--build --estimate 5120`) | exit 0 at `4a224e58`: compiled 13.2 s, 43 s wall, 1.54 GB max RSS; the link removed | +| full umtool e2e, run 1 (`4a224e58`, detached, queued) | 470 tests: 463 passed, 1 failed, 6 skipped, 11.3 min. The red was this lane's new assertion on a cut page (`song-piece.spec:164`, no Signal-outline control in `main`): four more — the plan compare and the copy buttons — fixed in `a4406b50` | +| `song-piece.spec` + the screenshot pass (`a4406b50`) | 30/30 (9 + 21 shots) | +| full umtool e2e, run 2 (`a4406b50`, queued ~1.5 min behind `ux-r6`) | 470 tests: 461 passed, 3 failed, 6 skipped, 11.2 min. The reds: `board.spec`'s serial chain (`:102` — `s` did not mark the speaker checked under load — and the two after it that read its board). No board file is touched here; `board.spec` alone at the same tip **3× — 7/7, 7/7, 7/7** | +| common, editor, mcp | not touched | + +**Screenshots** (job scratch `p6a-shots/{before,after}/`, 1366×768, dark and light, the e2e start build over the +fixture; before = this branch's first commit, which changes no pixel but the faces and trim pages' rail): Settings · +system and · generation; an article in the making (its head and its Iterations tab); a song's Overview, Cuts, Spec, +Cover, Notes and a cut page; a report video's Overview and Media tab; and every page moved off `BrowseHeader` — +`/projects`, a sweep report, `/sites/priv`, an evidence walk, `/tools/{find,faces,sources,bench,trim/mk-hooks}`. Seen: +the "IN THE MAKING", OPEN and running/queued tags dashed ink; Use this iteration and the song benches' controls ink +outlines, the Next card's action the one filled button; the system page's index said once and storage last. + +**Found and left** — P6b inherits: +- **The 308 flip** of all 16 `redirects.mjs` rows (`redirects.spec` asserts 307 today) and **the full screenshot audit + against the canvas**. +- **R6's files, not touched here:** the paused schedule chip is the doubt colour on a state in `PieceFrame`'s head AND on + `app/series/[id]/page.tsx` — change both together; R6's triage kinds and the `watch` shape belong in `inbox.md`'s + tables and `recurring.md`; Create's, the series page's and the run page's audit. +- **Signal or a verdict colour still on a state or an action, outside the listed benches** (38 files still name + `--color-sel`; most are focus rings): `NewArticleForm`'s **Start** and `NewProjectMenu`'s `/projects` submit and + `ActionPlan`'s confirm are `primary` (Signal outline); `OnscreenSection`'s "estimated" tag is `open`; `PlanDiffPanel` + colours swapped / added / removed deltas with the verdict colours; TrimBench (**play selection**, **run the chain** in + Signal, **clear trim** in the kept colour), FaceDeck, Deck, MixBench, PhraseConsole, WordSelector, ArticleReader, + NoteCards and NoteThread hand-roll Signal. +- **Lowercase button labels** against the copy rule: the Build tab's **show the command** / **run** / **cancel**, the + Sources tab's **tag N videos**, the song benches' **mark this moment**, **promote … to …**, **retire**, **save**, + `/projects`' **+ new project**, **filter**, **copy the whole picture**, the deck's and the trim bench's. +- `/settings/generation`'s Spend today aside renders "2026-10-14UTC" (no space). +- **Names that outlived the dashboard:** `components/dashboard/` (now the Inbox's own components) and `lib/dashboard.ts` + (the projects note, the state rows, the source buckets) — a rename after R6 lands, which adds Inbox cards there. +- **`/drafts` lands on Create's article form**, as the deleted page did; the plan's earlier notes said the Inbox. The + reviewer's call. + +### P6a rollout (orchestrator, 2026-10-14) + +Rulings: `/drafts` → Create's article form (`/create?make=article`, as the deleted page did); the `state` tag and the +outline rule apply to every state and secondary action, beyond the listed items; a song decision's `project` stays the +basename (the notes and MCP target) while its href takes the full path. Gates on `7fb90e6e`: full umtool e2e 461 passed, +3 failed, 6 skipped — the three are `board.spec`'s serial chain under load (`s` did not mark the speaker), a second race +after R5's fix, 3/3 alone; taken as its own fix (below). `main` fast-forwarded to `7fb90e6e`; umtool built and restarted +(`scripts/p6a-umtool.sh`). Live: every place, tab and tool page 200; `/drafts` 307 → `/create?make=article`; `/browse`, +`/articles`, `/sites` 307 → Work; a song's cut cards link the full path and `/projects/pokemon/wide` still answers; +decisions API 833 rows, notes' hrefs end `note=<id>`. P6b adds: **Prune…** on Settings · system wears the Reject colour +for a destructive action (outline it, as Delete schedule). + + ### R6, as shipped **What.** Triage first: a cheap pass that flags what is worth researching, and only what it flags reaches the diff --git a/umtool/app/articles/page.tsx b/umtool/app/articles/page.tsx @@ -1,119 +0,0 @@ -import Link from "next/link"; -import BrowseHeader from "@/components/BrowseHeader"; -import ArticleTable from "@/components/articles/ArticleTable"; -import { badgeVariants } from "@/components/ui/badge"; -import { readStoreRow, type ArticleRow } from "@/lib/articles/sites"; -import { readPendingArticles } from "@/lib/articles/generation"; - -export const dynamic = "force-dynamic"; - -// The homepage's articles (transcripts/reports/, release 26): published in -// reports/index.json's order, then drafts, each with its audience, notes, -// video project and source. Zero client JS: the filters are links. A site's -// own pages are on /sites. Above them, the articles in the making (release -// 27: iterations, no report.json yet), each with its newest iteration. - -type Search = { status?: string; notes?: string; audience?: string; deleted?: string; freed?: string }; - -export default async function ArticlesPage({ searchParams }: { searchParams: Promise<Search> }) { - const sp = await searchParams; - const [store, pending] = await Promise.all([readStoreRow(), readPendingArticles()]); - const keep = (a: ArticleRow) => - (!sp.status || a.status === sp.status) && - (!sp.audience || a.audience === sp.audience) && - (sp.notes !== "open" || a.openNotes > 0); - const shown = store.articles.filter(keep); - const qs = (next: Partial<Search>) => { - const p = new URLSearchParams(); - for (const [k, v] of Object.entries({ ...sp, ...next })) if (v && k !== "deleted" && k !== "freed") p.set(k, String(v)); - const s = p.toString(); - return `/articles${s ? `?${s}` : ""}`; - }; - const count = (f: (a: ArticleRow) => boolean) => store.articles.filter(f).length; - - return ( - <div className="flex h-full flex-col"> - <BrowseHeader - active="articles" - crumbs={[{ label: "articles" }]} - note={`${store.published} published (${store.publicCount} public) · ${store.drafts} drafts · ${store.openNotes} open notes`} - /> - <main className="deck-main flex-1 p-4"> - {sp.deleted && ( - <p role="status" data-deleted={sp.deleted} className="mb-2 text-[12px] text-[var(--color-dim)]"> - Deleted {sp.deleted} - {Number(sp.freed) > 0 ? ` (${(Number(sp.freed) / 1024 / 1024).toFixed(1)} MiB)` : ""}. - </p> - )} - <div className="mb-3 flex flex-wrap items-center gap-1.5"> - <span className="micro">status</span> - <Chip href={qs({ status: "" })} on={!sp.status} label="all" /> - <Chip href={qs({ status: "published" })} on={sp.status === "published"} label={`published ${store.published}`} /> - <Chip href={qs({ status: "draft" })} on={sp.status === "draft"} label={`draft ${store.drafts}`} /> - <span className="micro ml-3">audience</span> - <Chip href={qs({ audience: "" })} on={!sp.audience} label="all" /> - <Chip href={qs({ audience: "public" })} on={sp.audience === "public"} label={`public ${count((a) => a.audience === "public")}`} /> - <Chip href={qs({ audience: "private" })} on={sp.audience === "private"} label={`private ${count((a) => a.audience === "private")}`} /> - <span className="micro ml-3">notes</span> - <Chip href={qs({ notes: "" })} on={sp.notes !== "open"} label="all" /> - <Chip href={qs({ notes: "open" })} on={sp.notes === "open"} label={`open ${count((a) => a.openNotes > 0)}`} /> - <Link href="/articles/new" className="ml-auto text-[12px] text-[var(--color-dim)] hover:text-[var(--color-text)]"> - new article - </Link> - <Link href="/sites" className="ml-2 text-[12px] text-[var(--color-dim)] hover:text-[var(--color-text)]"> - site pages - </Link> - <Link href="/bench" className="ml-2 text-[12px] text-[var(--color-dim)] hover:text-[var(--color-text)]"> - verdict bench - </Link> - </div> - {pending.length > 0 && ( - <section aria-label="in the making" className="mb-4"> - <div className="micro mb-1">in the making</div> - <ul className="flex flex-col gap-1 text-[12px]"> - {pending.map((p) => ( - <li key={p.id} data-pending-article={p.id} data-status={p.newest?.status ?? "none"} className="flex flex-wrap items-baseline gap-2"> - <Link href={`/articles/${p.id}?tab=iterations`} className="font-mono text-[var(--color-text)] hover:underline"> - {p.id} - </Link> - {p.newest && ( - <> - <span className={badgeVariants({ variant: p.newest.status === "failed" ? "blocking" : p.newest.status === "done" ? "on" : "open", size: "sm" })}> - {p.newest.label} {p.newest.status === "queued" || p.newest.status === "running" ? "generating" : p.newest.status} - </span> - <span className="font-mono text-[var(--color-dim)]">{p.newest.model}</span> - {p.newest.question && <span className="text-[var(--color-dim)]">{p.newest.question}</span>} - </> - )} - <span className="text-[var(--color-dim)]"> - {p.count} iteration{p.count === 1 ? "" : "s"} - </span> - </li> - ))} - </ul> - </section> - )} - {store.indexError && ( - <p role="alert" className="mb-3 text-[12px] text-[var(--color-bad)]"> - {store.indexError} - </p> - )} - {store.articles.length === 0 ? ( - <p className="text-[12px] text-[var(--color-dim)]">no articles</p> - ) : shown.length === 0 ? ( - <p className="text-[12px] text-[var(--color-dim)]">nothing matches that filter</p> - ) : ( - <ArticleTable articles={shown} /> - )} - </main> - </div> - ); -} - -function Chip({ href, on, label }: { href: string; on: boolean; label: string }) { - return ( - <Link href={href} aria-current={on ? "true" : undefined} className={badgeVariants({ variant: on ? "on" : "neutral" })}> - {label} - </Link> - ); -} diff --git a/umtool/app/drafts/page.tsx b/umtool/app/drafts/page.tsx @@ -1,12 +0,0 @@ -import { redirect } from "next/navigation"; -import { newArticleHref } from "@/lib/hrefs"; - -export const dynamic = "force-dynamic"; - -// The proof of concept's page (2026-10-12) is the application's now: a new -// article on Create (/create?make=article, P5; it was /articles/new), its -// iterations on the article's Iterations tab (release 27 S8). P6 deletes this -// page and redirects /drafts to the Inbox. -export default function DraftsPage() { - redirect(newArticleHref()); -} diff --git a/umtool/app/globals.css b/umtool/app/globals.css @@ -746,37 +746,6 @@ canvas.grabbable { background: none; } - /* ── a verdict: glyph + word, never colour alone (canvas .v) ── */ - .verdict { - font: 600 11.5px var(--f-ui); - white-space: nowrap; - } - .verdict::before { - font-family: var(--f-mono); - margin-right: 4px; - } - .verdict[data-verdict="kept"] { - color: var(--kept-text); - } - .verdict[data-verdict="kept"]::before { - content: "✓"; - color: var(--kept); - } - .verdict[data-verdict="doubt"] { - color: var(--doubt-text); - } - .verdict[data-verdict="doubt"]::before { - content: "?"; - color: var(--doubt); - } - .verdict[data-verdict="reject"] { - color: var(--reject-text); - } - .verdict[data-verdict="reject"]::before { - content: "✕"; - color: var(--reject); - } - /* ── the stage stepper (canvas .stepper) ── */ .stepper-dot { width: 9px; diff --git a/umtool/app/projects/[...path]/page.tsx b/umtool/app/projects/[...path]/page.tsx @@ -1,6 +1,6 @@ import Link from "next/link"; import { notFound, redirect } from "next/navigation"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import ProjectView from "@/components/projects/ProjectView"; import ProjectGrid from "@/components/projects/ProjectGrid"; import { listProjects, resolveProjectPath } from "@/lib/projects"; @@ -51,7 +51,7 @@ export default async function BrowsePathPage({ if ("ambiguous" in resolved && resolved.ambiguous) { return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="projects" crumbs={[{ href: "/projects", label: "projects" }, { label: segments.join("/") }]} note={`${resolved.ambiguous.length} projects answer to that name`} /> @@ -84,7 +84,7 @@ export default async function BrowsePathPage({ const mine = all.filter((p) => p.id.startsWith(`${folder.path}/`)); return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="projects" crumbs={[{ href: "/projects", label: "projects" }, { label: folder.label }]} note={`${mine.length} project${mine.length === 1 ? "" : "s"}`} /> diff --git a/umtool/app/projects/page.tsx b/umtool/app/projects/page.tsx @@ -5,7 +5,7 @@ import { EmptyState } from "@/components/ui/empty-state"; import { Input } from "@/components/ui/field"; import { Toolbar, ToolbarGroup } from "@/components/ui/toolbar"; import { homeHref, projectsHref, workHref } from "@/lib/hrefs"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import NewProjectMenu from "@/components/NewProjectMenu"; import CopyButton from "@/components/CopyButton"; import ProjectGrid from "@/components/projects/ProjectGrid"; @@ -98,7 +98,7 @@ export default async function BrowsePage({ return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="projects" crumbs={[{ label: "projects" }]} note={projectsNote(all.length, blocking, openN)} /> diff --git a/umtool/app/settings/system/page.tsx b/umtool/app/settings/system/page.tsx @@ -1,29 +1,25 @@ import Link from "next/link"; -import DeliverablesPanel from "@/components/dashboard/DeliverablesPanel"; -import NowPanel from "@/components/dashboard/NowPanel"; -import SourcesPanel from "@/components/dashboard/SourcesPanel"; -import StateStrip from "@/components/dashboard/StateStrip"; -import ToolsPanel from "@/components/dashboard/ToolsPanel"; import AppShell from "@/components/shell/AppShell"; import { IndexPanel, RootsPanel, StoragePanel } from "@/components/system/Maintenance"; +import { ActivityPanel, DeliverablesPanel, ProjectsPanel, SourcesPanel } from "@/components/system/Status"; +import ToolsPanel from "@/components/system/ToolsPanel"; import { listActivity, runningActivity } from "@/lib/activity"; import { projectsNote, sourceBuckets, stateRows } from "@/lib/dashboard"; import { toolsCache } from "@/lib/doctor"; import { generationPolicyHref, settingsHref } from "@/lib/hrefs"; import { freeBytesUnder } from "@/lib/machine"; -import { REPORTS_ROOT } from "@/lib/paths"; -import { KINDS, decisionCounts, indexHealth, indexPrunePlan, listProjects } from "@/lib/projects"; -import { MEDIA_ROOT, MEDIA_TIERED } from "@/lib/paths"; +import { MEDIA_ROOT, MEDIA_TIERED, REPORTS_ROOT } from "@/lib/paths"; +import { KINDS, decisionCounts, indexPrunePlan, listProjects } from "@/lib/projects"; import { rootsReport } from "@/lib/system/roots.mjs"; import { storageRows } from "@/lib/system/storage-rows"; export const dynamic = "force-dynamic"; -// SETTINGS · SYSTEM (plans/umtool-redesign.md, P3): the machine and the -// collection at a glance -- what ran, where every project stands, which -// sources nobody has checked, what has been built, and whether the machine can -// build at all. These were the dashboard's panels; what in them is a CALL -// (a required tool missing, a disk nearly full) is an Inbox card instead. +// SETTINGS · SYSTEM (plans/umtool-redesign.md, P3, P5, P6): the machine and +// the collection at a glance -- whether this machine can build, its roots and +// index, what ran, where every project stands, which sources nobody has +// checked, what has been built; then storage. What in them is a CALL (a +// required tool missing, a disk nearly full) is an Inbox card instead. // // Everything is read from the index, the job registries and a few stats; // nothing here shells out -- the tools panel shows a cache or "not checked", @@ -41,7 +37,6 @@ export default async function SystemPage() { const running = runningActivity(); const recent = listActivity(8); const tools = toolsCache(); - const ix = indexHealth(); const free = await freeBytesUnder(REPORTS_ROOT); const [roots, prune, storage] = await Promise.all([rootsReport({ measureOld: false }), indexPrunePlan(), storageRows()]); @@ -62,14 +57,14 @@ export default async function SystemPage() { /> <main className="deck-main flex-1 p-4"> <div className="grid gap-3 lg:grid-cols-2 2xl:grid-cols-3"> - <ToolsPanel initial={tools} freeBytes={free} index={ix} /> + <ToolsPanel initial={tools} freeBytes={free} /> <RootsPanel roots={roots} /> <IndexPanel index={{ ok: prune.ok, records: prune.records, path: prune.path, builtAt: prune.builtAt, stale: prune.stale.length }} /> - <StoragePanel rows={storage} tiered={MEDIA_TIERED} mediaRoot={MEDIA_ROOT} /> - <NowPanel running={running} recent={recent} /> - <StateStrip rows={stateRows(KINDS, projects)} note={projectsNote(projects.length, blocking, openN)} /> - <SourcesPanel never={buckets.never} old={buckets.old} bad={buckets.bad} /> + <ActivityPanel running={running} recent={recent} /> + <ProjectsPanel rows={stateRows(KINDS, projects)} note={projectsNote(projects.length, blocking, openN)} /> <DeliverablesPanel projects={projects} /> + <SourcesPanel never={buckets.never} old={buckets.old} bad={buckets.bad} /> + <StoragePanel rows={storage} tiered={MEDIA_TIERED} mediaRoot={MEDIA_ROOT} /> </div> </main> </div> diff --git a/umtool/app/sites/[site]/page.tsx b/umtool/app/sites/[site]/page.tsx @@ -1,6 +1,6 @@ import Link from "next/link"; import { notFound } from "next/navigation"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import ArticleTable, { articleHref } from "@/components/articles/ArticleTable"; import SiteChips from "@/components/articles/SiteChips"; import WorkspacePanel from "@/components/articles/WorkspacePanel"; @@ -46,7 +46,7 @@ export default async function SitePage({ return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="articles" crumbs={[{ href: "/work?by=site", label: "articles" }, { label: row.title }]} note={`${row.published} published · ${row.drafts} drafts · ${row.openNotes} open notes`} diff --git a/umtool/app/sites/page.tsx b/umtool/app/sites/page.tsx @@ -1,90 +0,0 @@ -import Link from "next/link"; -import BrowseHeader from "@/components/BrowseHeader"; -import ArticleTable from "@/components/articles/ArticleTable"; -import SiteChips from "@/components/articles/SiteChips"; -import { badgeVariants } from "@/components/ui/badge"; -import { EmptyState } from "@/components/ui/empty-state"; -import { Toolbar, ToolbarGroup } from "@/components/ui/toolbar"; -import { sitesHref } from "@/lib/hrefs"; -import { listSiteRows, type ArticleRow } from "@/lib/articles/sites"; - -export const dynamic = "force-dynamic"; - -// Every site's articles, private sites first. Zero client JS: the filters are -// links that change searchParams (/browse/decisions' idiom), so a filtered -// view is one pasteable URL. - -type Search = { site?: string; status?: string; notes?: string }; - -export default async function SitesPage({ searchParams }: { searchParams: Promise<Search> }) { - const sp = await searchParams; - const all = await listSiteRows(); - - const keep = (a: ArticleRow) => - (!sp.status || a.status === sp.status) && (sp.notes !== "open" || a.openNotes > 0); - const sites = all - .filter((s) => !sp.site || s.siteId === sp.site) - .map((s) => ({ ...s, shown: s.articles.filter(keep) })) - .filter((s) => s.shown.length > 0 || (!sp.status && !sp.notes)); - - const articles = all.flatMap((s) => s.articles); - const open = articles.reduce((n, a) => n + a.openNotes, 0); - const qs = (next: Partial<Search>) => { - return sitesHref({ ...sp, ...next }); - }; - - return ( - <div className="flex h-full flex-col"> - <BrowseHeader active="articles" crumbs={[{ label: "articles" }]} note={`${all.length} sites · ${articles.length} articles · ${open} open notes`} /> - <main className="deck-main flex-1 p-4"> - <Toolbar aria-label="Filters" className="-mx-4 -mt-4 mb-4"> - <ToolbarGroup label="Site"> - <Chip href={qs({ site: "" })} on={!sp.site} label={`all ${all.length}`} /> - {all.map((s) => ( - <Chip key={s.siteId} href={qs({ site: s.siteId })} on={sp.site === s.siteId} label={s.siteId} /> - ))} - </ToolbarGroup> - <ToolbarGroup label="Status"> - <Chip href={qs({ status: "" })} on={!sp.status} label="all" /> - <Chip href={qs({ status: "published" })} on={sp.status === "published"} label={`published ${articles.filter((a) => a.status === "published").length}`} /> - <Chip href={qs({ status: "draft" })} on={sp.status === "draft"} label={`draft ${articles.filter((a) => a.status === "draft").length}`} /> - </ToolbarGroup> - <ToolbarGroup label="Notes"> - <Chip href={qs({ notes: "" })} on={sp.notes !== "open"} label="all" /> - <Chip href={qs({ notes: "open" })} on={sp.notes === "open"} label={`open ${articles.filter((a) => a.openNotes > 0).length}`} /> - </ToolbarGroup> - </Toolbar> - - {sites.length === 0 ? ( - <EmptyState title={all.length === 0 ? "No sites" : "Nothing matches that filter"} /> - ) : ( - <div className="space-y-6"> - {sites.map((s) => ( - <section key={s.siteId} data-site={s.siteId}> - <h2 className="mb-1.5 flex flex-wrap items-baseline gap-2"> - <Link href={`/sites/${s.siteId}`} className="text-[14px] font-semibold text-text hover:underline"> - {s.title} - </Link> - <span className="font-mono text-[11px] text-[var(--color-dim)]">{s.siteId}</span> - <SiteChips site={s} /> - <span className="micro" data-counts={`${s.published}/${s.drafts}`}> - {s.published} published · {s.drafts} draft{s.drafts === 1 ? "" : "s"} - </span> - </h2> - <ArticleTable articles={s.shown} /> - </section> - ))} - </div> - )} - </main> - </div> - ); -} - -function Chip({ href, on, label }: { href: string; on: boolean; label: string }) { - return ( - <Link href={href} aria-current={on ? "true" : undefined} className={badgeVariants({ variant: on ? "on" : "neutral" })}> - {label} - </Link> - ); -} diff --git a/umtool/app/tools/bench/page.tsx b/umtool/app/tools/bench/page.tsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import BarForm from "@/components/bench/BarForm"; import { badgeVariants } from "@/components/ui/badge"; import { @@ -50,7 +50,7 @@ export default async function BenchPage({ searchParams }: { searchParams: Promis return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="bench" crumbs={[{ label: "tools", href: "/tools" }, { label: "verdict bench" }]} note={`${runs.length} run${runs.length === 1 ? "" : "s"}`} diff --git a/umtool/app/tools/faces/page.tsx b/umtool/app/tools/faces/page.tsx @@ -1,4 +1,4 @@ -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import FaceDeck from "@/components/FaceDeck"; import { faceQueue, readFaceVerdicts, rejectedVideos } from "@/lib/faces"; @@ -49,7 +49,7 @@ export default async function FacesPage({ searchParams }: { searchParams: Promis return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="faces" crumbs={[{ href: "/tools", label: "tools" }, { label: "faces" }]} note={`${queue.length} corners · ${onAccepted} on accepted covers · ${Object.keys(verdicts.faces).length} judged`} /> diff --git a/umtool/app/tools/find/page.tsx b/umtool/app/tools/find/page.tsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import PhraseConsole from "@/components/PhraseConsole"; import ShortlistBar from "@/components/ShortlistBar"; import { @@ -95,7 +95,7 @@ export default async function FindPage({ searchParams }: { searchParams: Promise return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="find" crumbs={[{ href: "/tools", label: "tools" }, { label: "find" }]} note={`${episodes.length} episodes${result ? ` · ${result.corpus.words.toLocaleString()} words · ${result.ms}ms` : ""}`} diff --git a/umtool/app/tools/sources/page.tsx b/umtool/app/tools/sources/page.tsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import { corpusConcentration } from "@/lib/concentration"; export const dynamic = "force-dynamic"; @@ -20,7 +20,7 @@ export default async function SourcesPage() { return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="sources" crumbs={[{ href: "/tools", label: "tools" }, { label: "sources" }]} note={`${c.videos.length} episodes · ${c.builds} plans`} diff --git a/umtool/app/tools/trim/[set]/page.tsx b/umtool/app/tools/trim/[set]/page.tsx @@ -1,5 +1,5 @@ import { notFound } from "next/navigation"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import TrimBench from "@/components/TrimBench"; import BuildChain from "@/components/BuildChain"; import { TRIM_SETS, readCatalogue, readTrims } from "@/lib/trim"; @@ -27,7 +27,7 @@ export default async function TrimPage({ params }: { params: Promise<{ set: stri return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="trim" crumbs={[{ href: "/tools", label: "tools" }, { label: `trim: ${set.id}` }]} note={`${catalogue.hooks.length} hooks · ${trims.length} trimmed`} /> diff --git a/umtool/bin/umtool.mjs b/umtool/bin/umtool.mjs @@ -293,7 +293,7 @@ async function cmdShow() { } } if (!decisionsAreComplete(p.kind)) { - console.log(`\n(this kind's decisions are computed by the app — see /browse/decisions)`); + console.log(`\n(this kind's decisions are computed by the app — see "umtool inbox", or the Inbox at /)`); } } @@ -656,7 +656,7 @@ async function cmdCheckSources() { console.log(`# ${s.label}`); console.log(`(cd ${s.cwd} && ${s.argv.join(" ")})\n`); } - console.log("# Nothing was run. The dashboard's Sources panel runs this chain through the job runner."); + console.log("# Nothing was run. Settings · system's Sources panel runs this chain through the job runner."); } function usage() { diff --git a/umtool/components/BrowseHeader.tsx b/umtool/components/BrowseHeader.tsx @@ -1,27 +0,0 @@ -import AppShell from "@/components/shell/AppShell"; -import type { Crumb } from "@/components/shell/AppHeader"; - -export type { Crumb }; - -/** - * The header the browse levels share -- now a thin wrapper over the shell - * (components/shell/AppShell.tsx): the rail, and the page head with these - * crumbs and this note. - * - * Kept, with the SAME props, until P6 deletes it: it has 22 call sites, - * release 28's ReportProject, NarrationPage and app/bench/page.tsx among them, - * and every one of them gets the rail by changing nothing. New pages use - * AppShell directly. - */ -export default function BrowseHeader({ - crumbs, - note, - active = "browse", -}: { - crumbs: Crumb[]; - note?: string; - /** Which nav item is lit. Defaults to browse, which is the common case. */ - active?: string; -}) { - return <AppShell active={active} crumbs={crumbs} note={note} />; -} diff --git a/umtool/components/CopyButton.tsx b/umtool/components/CopyButton.tsx @@ -60,7 +60,7 @@ export default function CopyButton({ text, url, label = "copy", title, className data-state={state} className={ className ?? - "rounded border border-[var(--color-line)] px-2 py-0.5 text-[11px] text-[var(--color-dim)] hover:border-[var(--color-sel)] hover:text-[var(--color-sel)]" + "rounded border border-[var(--color-line)] px-2 py-0.5 text-[11px] text-[var(--color-dim)] hover:border-muted hover:text-[var(--color-text)]" } > {state === "done" ? "copied" : state === "busy" ? "…" : label} diff --git a/umtool/components/CutBench.tsx b/umtool/components/CutBench.tsx @@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { useRouter } from "next/navigation"; +import { buttonVariants } from "@/components/ui/button"; import VerdictChip from "@/components/VerdictChip"; import MomentMarks from "@/components/MomentMarks"; import NoteField from "@/components/NoteField"; @@ -243,7 +244,7 @@ export default function CutBench({ onClick={() => setBlind((v) => !v)} className={`rounded border px-2.5 py-1 text-[12px] disabled:opacity-40 ${ blind - ? "border-[var(--color-sel)] text-[var(--color-sel)]" + ? "border-muted bg-panel-2 text-text" : "border-[var(--color-line)] text-[var(--color-dim)] hover:text-[var(--color-text)]" }`} > @@ -324,7 +325,7 @@ export default function CutBench({ type="button" onClick={() => void mint()} data-next-pairing - className="ml-auto rounded border border-[var(--color-sel)] px-2 py-0.5 text-[11px] text-[var(--color-sel)]" + className={`ml-auto ${buttonVariants({ size: "sm" })}`} > another pairing </button> @@ -350,7 +351,7 @@ export default function CutBench({ type="button" data-choose={w} onClick={() => void decide(w)} - className="rounded border border-[var(--color-line)] px-2.5 py-1 text-[12px] text-[var(--color-text)] hover:border-[var(--color-sel)] hover:text-[var(--color-sel)]" + className={buttonVariants({ size: "md" })} > {label} </button> @@ -405,7 +406,7 @@ export default function CutBench({ type="button" data-choose={w} onClick={() => void decide(w)} - className="rounded border border-[var(--color-line)] px-2 py-0.5 font-mono text-[11px] text-[var(--color-dim)] hover:border-[var(--color-sel)] hover:text-[var(--color-sel)]" + className={`${buttonVariants({ size: "sm" })} font-mono`} > {label} </button> @@ -430,7 +431,7 @@ export default function CutBench({ onClick={() => setPick(v.rel)} className={`rounded border px-2 py-0.5 font-mono text-[11px] ${ pick === v.rel - ? "border-[var(--color-sel)] text-[var(--color-sel)]" + ? "border-muted bg-panel-2 text-text" : "border-[var(--color-line)] text-[var(--color-dim)] hover:text-[var(--color-text)]" }`} > @@ -451,7 +452,7 @@ export default function CutBench({ type="button" disabled={busy !== null} onClick={() => act("promote", chosen.rel)} - className="rounded border border-[var(--color-sel)] px-2.5 py-1 text-[12px] text-[var(--color-sel)] hover:bg-[color-mix(in_srgb,var(--color-sel)_14%,transparent)] disabled:opacity-40" + className={buttonVariants({ size: "md" })} > promote {chosen.tag} to {cut} </button> @@ -487,7 +488,7 @@ export default function CutBench({ onClick={() => setPick(v.rel)} className={`rounded border border-dashed px-2 py-0.5 font-mono text-[11px] ${ pick === v.rel - ? "border-[var(--color-sel)] text-[var(--color-sel)]" + ? "border-muted bg-panel-2 text-text" : "border-[var(--color-line)] text-[var(--color-dim)]" }`} > @@ -564,7 +565,7 @@ function BlindPane({ return ( <section className="rounded border border-[var(--color-line)] bg-[var(--color-panel)]"> <div className="flex flex-wrap items-baseline gap-2 border-b border-[var(--color-line)] px-3 py-1.5"> - <span className="font-mono text-[13px] text-[var(--color-sel)]">{title}</span> + <span className="font-mono text-[13px] text-[var(--color-text)]">{title}</span> {revealed ? ( <span className="font-mono text-[11px] text-[var(--color-text)]" data-revealed={revealed}> {revealed} diff --git a/umtool/components/LoudnessTable.tsx b/umtool/components/LoudnessTable.tsx @@ -1,6 +1,7 @@ "use client"; import { useState } from "react"; +import { buttonVariants } from "@/components/ui/button"; import { DEFAULT_TARGET, loudnessSpread, @@ -84,7 +85,7 @@ export default function LoudnessTable({ onClick={() => void measureAll()} disabled={busy !== null} data-measure-all - className="ml-auto rounded border border-[var(--color-sel)] px-2 py-0.5 text-[11px] text-[var(--color-sel)] disabled:opacity-40" + className={`ml-auto ${buttonVariants({ size: "sm" })}`} > {busy ? `measuring ${busy}…` : "measure the rest"} </button> diff --git a/umtool/components/MomentMarks.tsx b/umtool/components/MomentMarks.tsx @@ -1,6 +1,7 @@ "use client"; import { useState } from "react"; +import { buttonVariants } from "@/components/ui/button"; import CopyButton from "@/components/CopyButton"; import type { NoteMap } from "@/lib/notes"; @@ -93,7 +94,7 @@ export default function MomentMarks({ type="button" onClick={mark} data-mark - className="rounded border border-[var(--color-sel)] px-2 py-0.5 text-[11px] text-[var(--color-sel)]" + className={buttonVariants({ size: "sm" })} > mark this moment </button> diff --git a/umtool/components/NoteField.tsx b/umtool/components/NoteField.tsx @@ -1,6 +1,7 @@ "use client"; import { useEffect, useRef, useState } from "react"; +import { buttonVariants } from "@/components/ui/button"; import { NOTE_LIMIT, type NoteEntry } from "@/lib/note-types"; // A generous note, on anything. @@ -127,7 +128,7 @@ export default function NoteField({ type="button" disabled={saving || !dirty} onClick={save} - className="rounded border border-[var(--color-sel)] px-2 py-0.5 text-[11px] text-[var(--color-sel)] disabled:opacity-40" + className={buttonVariants({ size: "sm" })} > save </button> diff --git a/umtool/components/PlanDiffPanel.tsx b/umtool/components/PlanDiffPanel.tsx @@ -2,6 +2,7 @@ import Link from "next/link"; import { useState } from "react"; +import { buttonVariants } from "@/components/ui/button"; import type { PlanDelta, PlanDiff } from "@/lib/plandiff"; // Which notes actually differ between two arrangements. @@ -17,7 +18,7 @@ type Result = PlanDiff & { summary: string; deltaCount: number; truncated: numbe const KIND_TONE: Record<PlanDelta["kind"], string> = { swapped: "text-[var(--color-dirty)]", - moved: "text-[var(--color-sel)]", + moved: "text-[var(--color-text)]", added: "text-[var(--color-good)]", removed: "text-[var(--color-bad)]", same: "text-[var(--color-dim)]", @@ -79,7 +80,7 @@ export default function PlanDiffPanel({ onClick={() => void compare()} disabled={busy || !a || !b || a === b} data-plandiff - className="rounded border border-[var(--color-sel)] px-2 py-0.5 text-[11px] text-[var(--color-sel)] disabled:opacity-40" + className={buttonVariants({ size: "sm" })} > {busy ? "aligning…" : "compare"} </button> @@ -122,7 +123,7 @@ export default function PlanDiffPanel({ <td className="num border-b border-[var(--color-line)] px-2 py-1 text-right text-[var(--color-dirty)]" data-swapped={v.swapped}> {v.swapped} </td> - <td className="num border-b border-[var(--color-line)] px-2 py-1 text-right text-[var(--color-sel)]" data-moved={v.moved}> + <td className="num border-b border-[var(--color-line)] px-2 py-1 text-right text-[var(--color-meter)]" data-moved={v.moved}> {v.moved} </td> <td className="num border-b border-[var(--color-line)] px-2 py-1 text-right text-[var(--color-good)]" data-added={v.added}> diff --git a/umtool/components/ProvenancePanel.tsx b/umtool/components/ProvenancePanel.tsx @@ -1,6 +1,7 @@ import Link from "next/link"; import type { Provenance } from "@/lib/provenance"; import type { BuildStatus } from "@/lib/manifest"; +import { cutHref } from "@/lib/hrefs"; import { fmtDur } from "@/lib/format"; import NoteField from "@/components/NoteField"; import CopyButton from "@/components/CopyButton"; @@ -28,6 +29,7 @@ import { concentrationLine, shares } from "@/lib/concentration"; const ROW_LIMIT = 250; export default function ProvenancePanel({ + project, song, cut, prov, @@ -36,6 +38,8 @@ export default function ProvenancePanel({ notes, allNotes = false, }: { + /** The song's project id: the cut page's canonical address. */ + project: string; song: string; cut: string; prov: Provenance; @@ -44,8 +48,7 @@ export default function ProvenancePanel({ notes: NoteMap; allNotes?: boolean; }) { - const href = (plan: string | null) => - `/projects/${song}/${cut}${plan ? `?plan=${encodeURIComponent(plan)}` : ""}`; + const href = (plan: string | null) => cutHref(project, cut, plan ? { plan } : {}); const shown = allNotes ? prov.rows : prov.rows.slice(0, ROW_LIMIT); const hidden = prov.rows.length - shown.length; @@ -160,7 +163,7 @@ export default function ProvenancePanel({ data-plan={p} className={`rounded border px-1.5 py-0.5 font-mono text-[11px] ${ planParam === p - ? "border-[var(--color-sel)] text-[var(--color-sel)]" + ? "border-muted bg-panel-2 text-text" : "border-[var(--color-line)] text-[var(--color-dim)] hover:text-[var(--color-text)]" }`} > diff --git a/umtool/components/SpecSheet.tsx b/umtool/components/SpecSheet.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import Link from "next/link"; +import { buttonVariants } from "@/components/ui/button"; import type { Operation, Spec, SpecProblem, SpecSound } from "@/lib/spec"; // The spec sheet, edited. @@ -135,7 +136,7 @@ export default function SpecSheet({ disabled={!ready || saving || !dirty} onClick={save} data-save-spec - className="ml-auto rounded border border-[var(--color-sel)] px-2.5 py-1 text-[12px] text-[var(--color-sel)] disabled:opacity-40" + className={`ml-auto ${buttonVariants({ size: "md" })}`} > {dirty ? "save" : "saved"} </button> diff --git a/umtool/components/ThumbBench.tsx b/umtool/components/ThumbBench.tsx @@ -2,6 +2,7 @@ import { useState } from "react"; import Link from "next/link"; +import { buttonVariants } from "@/components/ui/button"; import NoteField from "@/components/NoteField"; import type { NoteMap } from "@/lib/notes"; import type { ThumbView } from "@/lib/thumbs"; @@ -99,7 +100,7 @@ export default function ThumbBench({ data-thumb={c.name} data-thumb-state={c.accepted ? "accepted" : c.clash ? "clash" : "candidate"} className={`rounded border p-2 ${ - c.accepted ? "border-[var(--color-sel)]" : "border-[var(--color-line)]" + c.accepted ? "border-muted bg-panel-2" : "border-[var(--color-line)]" }`} > <div className="flex flex-wrap items-start gap-3"> @@ -120,7 +121,7 @@ export default function ThumbBench({ <div className="min-w-0 flex-1 space-y-1"> <div className="flex flex-wrap items-baseline gap-2"> <span className="font-mono text-[12px] text-[var(--color-text)]">{c.name}</span> - {c.accepted && <span className="micro text-[var(--color-sel)]">accepted</span>} + {c.accepted && <span className="micro text-[var(--color-text)]">accepted</span>} <span className="num truncate text-[11px] text-[var(--color-dim)]">{c.file}</span> </div> @@ -174,7 +175,7 @@ export default function ThumbBench({ disabled={busy !== null} onClick={() => void accept(c.name, c.file)} data-accept={c.name} - className="rounded border border-[var(--color-sel)] px-2 py-0.5 text-[11px] text-[var(--color-sel)] disabled:opacity-40" + className={buttonVariants({ size: "sm" })} > {busy === c.name ? "accepting…" : `accept — spends ${c.corners.length} videos`} </button> diff --git a/umtool/components/VerdictChip.tsx b/umtool/components/VerdictChip.tsx @@ -1,6 +1,7 @@ "use client"; import { useEffect, useState } from "react"; +import { buttonVariants } from "@/components/ui/button"; import type { Verdict, VerdictEntry } from "@/lib/browse"; // One file's judgement, small enough to sit in a variant row. @@ -132,7 +133,7 @@ export default function VerdictChip({ /> <button type="submit" - className="rounded border border-[var(--color-sel)] px-1.5 py-0.5 text-[10px] text-[var(--color-sel)]" + className={buttonVariants({ size: "sm" })} > save </button> diff --git a/umtool/components/articles/ArticlePage.tsx b/umtool/components/articles/ArticlePage.tsx @@ -161,7 +161,7 @@ export default async function ArticlePage({ )} <span data-status={missing ? "pending" : published ? "published" : "draft"} - className={badgeVariants({ variant: published ? "on" : missing ? "open" : "neutral", size: "sm" })} + className={badgeVariants({ variant: published ? "on" : missing ? "state" : "neutral", size: "sm" })} > {missing ? "in the making" : published ? "published" : "draft"} </span> diff --git a/umtool/components/articles/ArticleTable.tsx b/umtool/components/articles/ArticleTable.tsx @@ -75,7 +75,7 @@ export default function ArticleTable({ articles }: { articles: ArticleRow[] }) { <Link href={`${articleHref(a)}?status=open`} data-open-notes={a.openNotes} - className={badgeVariants({ variant: "open", size: "sm" })} + className={badgeVariants({ variant: "state", size: "sm" })} > {a.openNotes} open </Link> diff --git a/umtool/components/articles/EvidencePage.tsx b/umtool/components/articles/EvidencePage.tsx @@ -1,6 +1,6 @@ import { notFound } from "next/navigation"; import { reportCitationNumbers } from "yt-dlp-transcript-common/lib/report/uses"; -import BrowseHeader, { type Crumb } from "@/components/BrowseHeader"; +import AppShell, { type Crumb } from "@/components/shell/AppShell"; import EvidenceWalk, { type WalkItem } from "@/components/articles/EvidenceWalk"; import { articleHref } from "@/lib/articles/href"; import { readArticleNotes, readReportFile } from "@/lib/articles/sites"; @@ -43,7 +43,7 @@ export default async function EvidencePage({ }; return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="articles" crumbs={[...crumbs, { href: articleHref({ site, id: reportId }), label: reportId }, { label: "evidence" }]} note={`${items.length} citations`} diff --git a/umtool/components/articles/IterationsTab.tsx b/umtool/components/articles/IterationsTab.tsx @@ -25,11 +25,11 @@ import type { ArticleIterations, DraftJobView, IterationRow, PolicyView } from " const field = "rounded border border-[var(--color-line)] bg-[var(--color-ink)] px-1.5 py-0.5 text-[12px] text-[var(--color-text)]"; -const STATUS_VARIANT: Record<string, "on" | "blocking" | "open" | "info" | "neutral"> = { +const STATUS_VARIANT: Record<string, "on" | "blocking" | "state" | "info" | "neutral"> = { done: "on", failed: "blocking", - running: "open", - queued: "open", + running: "state", + queued: "state", cancelled: "info", }; @@ -134,7 +134,7 @@ function NewIterationForm({ it, ctx, onDone }: { it: IterationRow; ctx: Ctx; onD onChange={(e) => setFeedback(e.target.value)} /> <div> - <Button type="submit" size="sm" variant="primary"> + <Button type="submit" size="sm" variant="outline"> Start iteration </Button> </div> @@ -276,7 +276,7 @@ function IterationCard({ <div className="mt-2 flex flex-wrap items-center gap-2"> {done && it.reportFrom !== null && !it.currentReport && ( - <Button size="sm" variant="primary" onClick={() => void ctx.use(it.n)}> + <Button size="sm" variant="outline" onClick={() => void ctx.use(it.n)}> Use this iteration </Button> )} diff --git a/umtool/components/articles/PolicyPanel.tsx b/umtool/components/articles/PolicyPanel.tsx @@ -66,7 +66,8 @@ export default function PolicyPanel({ <Button key={p} size="sm" - variant={g.preset === p ? "primary" : "outline"} + variant="outline" + className={g.preset === p ? "border-muted bg-panel-2" : undefined} aria-pressed={g.preset === p} disabled={busy} onClick={() => save({ routes: { ...policy.presets[p] } }, `preset ${p}`)} diff --git a/umtool/components/articles/RefreshSummary.tsx b/umtool/components/articles/RefreshSummary.tsx @@ -13,11 +13,11 @@ import RefreshWatch from "./RefreshWatch"; // again every few seconds (RefreshWatch). // --------------------------------------------------------------------------- -const STATUS: Record<string, { label: string; variant: "neutral" | "on" | "blocking" | "open" | "info" | "meter" }> = { +const STATUS: Record<string, { label: string; variant: "neutral" | "on" | "blocking" | "state" | "info" | "meter" }> = { running: { label: "running", variant: "meter" }, "no-change": { label: "no change", variant: "info" }, updated: { label: "updated", variant: "on" }, - "held-by-cap": { label: "held by the cap", variant: "open" }, + "held-by-cap": { label: "held by the cap", variant: "state" }, failed: { label: "failed", variant: "blocking" }, cancelled: { label: "cancelled", variant: "info" }, }; diff --git a/umtool/components/articles/ResearchSlot.tsx b/umtool/components/articles/ResearchSlot.tsx @@ -27,9 +27,9 @@ import type { ResearchProposal, ResearchView } from "@/lib/articles/research"; const field = "rounded border border-[var(--color-line)] bg-[var(--color-ink)] px-1.5 py-0.5 text-[12px] text-[var(--color-text)]"; -const STATUS_VARIANT: Record<string, "on" | "blocking" | "open" | "info" | "neutral" | "meter"> = { - proposed: "open", - approved: "open", +const STATUS_VARIANT: Record<string, "on" | "blocking" | "state" | "info" | "neutral" | "meter"> = { + proposed: "state", + approved: "state", enqueued: "meter", done: "on", failed: "blocking", @@ -186,7 +186,7 @@ function ProposalRow({ {p.status === "done" && p.channel && <p className="font-mono text-[11px] text-[var(--color-dim)]">channel {p.channel}</p>} {waits && canDecide && ( <div className="flex flex-wrap items-center gap-2"> - <Button size="sm" variant="primary" disabled={busy} aria-label={`Yes to ${p.id}`} onClick={() => decide(p.id, true)}> + <Button size="sm" variant="outline" disabled={busy} aria-label={`Yes to ${p.id}`} onClick={() => decide(p.id, true)}> Yes </Button> <Button size="sm" variant="destructive" disabled={busy} aria-label={`No to ${p.id}`} onClick={() => decide(p.id, false, why)}> @@ -330,7 +330,7 @@ export default function ResearchSlot({ )} <Button size="sm" - variant="primary" + variant="outline" disabled={busy} onClick={() => void post({ task: "sweep", article, iteration: n, model, ...extractorBody(model, extractorModel, extractor) })} > diff --git a/umtool/components/dashboard/CheckSourcesButton.tsx b/umtool/components/dashboard/CheckSourcesButton.tsx @@ -43,8 +43,8 @@ export default function CheckSourcesButton({ }} > {state === "started" - ? "checking…" - : label ?? `re-check ${projects.length} project${projects.length === 1 ? "" : "s"}`} + ? "Checking…" + : label ?? `Re-check ${projects.length} project${projects.length === 1 ? "" : "s"}`} </button> {msg && <span className="ml-2 text-[11px] text-[var(--color-bad)]">{msg}</span>} </> diff --git a/umtool/components/dashboard/DeliverablesPanel.tsx b/umtool/components/dashboard/DeliverablesPanel.tsx @@ -1,39 +0,0 @@ -import Link from "next/link"; -import type { ProjectSummary } from "@/lib/project-types"; -import { fmtAgo, fmtBytes } from "@/lib/format"; -import Panel from "./Panel"; - -// Built count, total bytes, newest, stale -- all from `attrs.finalBytes` and -// each project's state. Nothing here stats a file; the summariser already did. -export default function DeliverablesPanel({ projects }: { projects: ProjectSummary[] }) { - const built = projects.filter((p) => p.attrs?.["final-bytes"]); - const bytes = built.reduce((n, p) => n + Number(p.attrs?.["final-bytes"] ?? 0), 0); - const newest = [...built].sort((a, b) => b.newestMtimeMs - a.newestMtimeMs)[0] ?? null; - const stale = projects.filter((p) => p.state === "stale"); - return ( - <Panel title="deliverables" testid="deliverables" more={{ href: "/projects?state=built", label: "built →" }}> - <div className="flex flex-wrap gap-3 text-[11px] text-[var(--color-dim)]" data-deliverables={`${built.length}/${bytes}`}> - <span> - <b className="num text-[var(--color-text)]">{built.length}</b> built - </span> - <span> - <b className="num text-[var(--color-meter)]">{fmtBytes(bytes)}</b> on disk - </span> - {newest && ( - <span> - newest{" "} - <Link href={`/projects/${newest.id}`} className="font-mono ink-link"> - {newest.id} - </Link>{" "} - <span className="num">{fmtAgo(newest.newestMtimeMs)}</span> - </span> - )} - {stale.length > 0 && ( - <Link href="/projects?state=stale" className="text-[var(--color-dirty)] hover:underline" data-stale={stale.length}> - {stale.length} stale - </Link> - )} - </div> - </Panel> - ); -} diff --git a/umtool/components/dashboard/NowLive.tsx b/umtool/components/dashboard/NowLive.tsx @@ -1,106 +0,0 @@ -"use client"; - -import Link from "next/link"; -import { useEffect, useState } from "react"; -import type { ActivityItem } from "@/lib/activity-types"; -import { fmtAgo } from "@/lib/format"; - -// The running job, live. Polls /api/jobs every two seconds ONLY while something -// is running: an idle dashboard makes no requests at all, and one that has just -// watched a build finish stops the moment the state leaves "running". -// -// The per-entry boxes use the same vocabulary ReportBuildChain paints from -// (fetching / cutting / done / failed), computed server-side in lib/activity.ts -// so this file never re-parses events. - -const BOX = { - fetching: "border-[var(--color-meter)] text-[var(--color-meter)]", - cutting: "border-[var(--color-sel)] text-[var(--color-sel)]", - done: "border-[var(--color-good)] text-[var(--color-good)]", - failed: "border-[var(--color-bad)] text-[var(--color-bad)]", -} as const; - -export default function NowLive({ initial }: { initial: ActivityItem | null }) { - const [now, setNow] = useState<ActivityItem | null>(initial); - - // One fetch on mount, so the panel says what the registry says even if the - // page render and the route disagreed; then a 2 s poll ONLY while running. - useEffect(() => { - let alive = true; - void fetch("/api/jobs?n=1", { cache: "no-store" }) - .then((r) => (r.ok ? r.json() : null)) - .then((j: { running: ActivityItem | null } | null) => { - if (alive && j && j.running) setNow(j.running); - }) - .catch(() => {}); - return () => { - alive = false; - }; - }, []); - - useEffect(() => { - if (!now || now.state !== "running") return; - const t = setInterval(async () => { - try { - const r = await fetch("/api/jobs?n=1", { cache: "no-store" }); - if (!r.ok) return; - const j = (await r.json()) as { running: ActivityItem | null; jobs: ActivityItem[] }; - // When the running item has gone, show what it became rather than - // blanking: the newest job in the list is the one that just finished. - setNow(j.running ?? j.jobs.find((x) => x.id === now.id) ?? null); - } catch { - /* a missed poll is the next poll's problem */ - } - }, 2000); - return () => clearInterval(t); - }, [now]); - - if (!now) { - return ( - <p className="text-[12px] text-[var(--color-dim)]" data-now="idle"> - nothing running - </p> - ); - } - - const p = now.progress; - const entries = Object.entries(p?.entries ?? {}); - return ( - <div data-now={now.state} data-now-id={now.id} className="space-y-1.5"> - <div className="flex flex-wrap items-baseline gap-2 text-[12px]"> - <Link href={now.href} className="font-mono ink-link"> - {now.label} - </Link> - <span className="micro">{now.source}</span> - {p && ( - <span className="num text-[11px] text-[var(--color-dim)]" data-now-step={`${p.step}/${p.of}`}> - step {p.step}/{p.of} - </span> - )} - {p?.clipsOf !== undefined && ( - <span className="num text-[11px] text-[var(--color-meter)]"> - {p.clipsDone ?? 0}/{p.clipsOf} entries - </span> - )} - <span className="num ml-auto text-[11px] text-[var(--color-dim)]"> - {now.state === "running" ? `started ${fmtAgo(now.startedAt)}` : now.state} - {now.error ? ` — ${now.error}` : ""} - </span> - </div> - {entries.length > 0 && ( - <div className="flex flex-wrap gap-1"> - {entries.map(([id, st]) => ( - <span - key={id} - data-now-entry={id} - data-entry-state={st} - className={`rounded border px-1.5 py-0.5 font-mono text-[10px] ${BOX[st]}`} - > - {id} - </span> - ))} - </div> - )} - </div> - ); -} diff --git a/umtool/components/dashboard/NowPanel.tsx b/umtool/components/dashboard/NowPanel.tsx @@ -1,46 +0,0 @@ -import Link from "next/link"; -import type { ActivityItem } from "@/lib/activity"; -import { fmtAgo } from "@/lib/format"; -import NowLive from "./NowLive"; -import Panel from "./Panel"; - -// What is running, and what ran. Two registries (chain jobs, mix renders), one -// list -- merged in lib/activity.ts, never here. -export default function NowPanel({ - running, - recent, -}: { - running: ActivityItem | null; - recent: ActivityItem[]; -}) { - const done = recent.filter((a) => a.state !== "running"); - return ( - <Panel title="now" testid="now"> - <NowLive initial={running} /> - {done.length > 0 && ( - <ul className="mt-2 space-y-0.5 border-t border-[var(--color-line)] pt-2" data-activity=""> - {done.map((a) => ( - <li - key={a.id} - data-activity-id={a.id} - data-activity-state={a.state} - className="flex flex-wrap items-baseline gap-2 text-[11px]" - > - <span - className={ - a.state === "failed" ? "text-[var(--color-bad)]" : "text-[var(--color-dim)]" - } - > - {a.state} - </span> - <Link href={a.href} className="font-mono text-[var(--color-text)] hover:text-[var(--color-sel)]"> - {a.label} - </Link> - <span className="num ml-auto text-[var(--color-dim)]">{fmtAgo(a.endedAt ?? a.startedAt)}</span> - </li> - ))} - </ul> - )} - </Panel> - ); -} diff --git a/umtool/components/dashboard/Panel.tsx b/umtool/components/dashboard/Panel.tsx @@ -1,34 +0,0 @@ -import Link from "next/link"; -import { Panel as UiPanel } from "@/components/ui/panel"; - -/** The dashboard's one box shape: a micro title, an optional "all →", a body (components/ui/panel.tsx). */ -export default function Panel({ - title, - testid, - more, - children, - className = "", -}: { - title: string; - testid: string; - more?: { href: string; label: string }; - children: React.ReactNode; - className?: string; -}) { - return ( - <UiPanel - data-panel={testid} - title={title} - aside={ - more && ( - <Link href={more.href} className="ink-link text-[12px]"> - {more.label} - </Link> - ) - } - className={className} - > - {children} - </UiPanel> - ); -} diff --git a/umtool/components/dashboard/SourcesPanel.tsx b/umtool/components/dashboard/SourcesPanel.tsx @@ -1,75 +0,0 @@ -import Link from "next/link"; -import type { ProjectSummary } from "@/lib/project-types"; -import { SOURCES_STALE_DAYS } from "@/lib/dashboard"; -import CheckSourcesButton from "./CheckSourcesButton"; -import Panel from "./Panel"; - -// The long-form problem, on the front door: which projects have sources nobody -// has checked, checked too long ago, or known to be dead. All of it read from -// each project's summary attributes -- never probed here. -export default function SourcesPanel({ - never, - old, - bad, -}: { - never: ProjectSummary[]; - old: ProjectSummary[]; - bad: ProjectSummary[]; -}) { - const List = ({ items, attr }: { items: ProjectSummary[]; attr: string }) => ( - <ul className="space-y-0.5" data-sources-list={attr}> - {items.map((p) => ( - <li key={p.id} data-source-project={p.id} className="flex flex-wrap gap-2 text-[11px]"> - <Link href={`/projects/${p.id}`} className="font-mono ink-link"> - {p.id} - </Link> - <span className="text-[var(--color-dim)]"> - {[ - p.attrs?.["sources-dead"] ? `${p.attrs["sources-dead"]} dead` : "", - p.attrs?.["sources-missing"] ? `${p.attrs["sources-missing"]} no cues` : "", - p.attrs?.["cue-gaps"] ? `${p.attrs["cue-gaps"]} cue gap${p.attrs["cue-gaps"] === "1" ? "" : "s"}` : "", - ] - .filter(Boolean) - .join(" · ")} - </span> - </li> - ))} - </ul> - ); - const recheck = [...never, ...old].map((p) => p.id); - return ( - <Panel title="sources" testid="sources"> - <div className="mb-1.5 flex flex-wrap items-baseline gap-3 text-[11px]" data-sources-counts={`${never.length}/${old.length}/${bad.length}`}> - <span className="text-[var(--color-dim)]"> - <b className="num text-[var(--color-text)]">{never.length}</b> never checked - </span> - <span className="text-[var(--color-dim)]"> - <b className="num text-[var(--color-text)]">{old.length}</b> older than {SOURCES_STALE_DAYS} d - </span> - <span className="text-[var(--color-dim)]"> - <b className={`num ${bad.length ? "text-[var(--color-bad)]" : "text-[var(--color-text)]"}`}>{bad.length}</b>{" "} - with dead or missing sources - </span> - <span className="ml-auto"> - <CheckSourcesButton projects={recheck} /> - </span> - </div> - {bad.length > 0 && <List items={bad} attr="bad" />} - {never.length > 0 && ( - <> - <div className="micro mt-1.5">never checked</div> - <List items={never} attr="never" /> - </> - )} - {old.length > 0 && ( - <> - <div className="micro mt-1.5">older than {SOURCES_STALE_DAYS} d</div> - <List items={old} attr="old" /> - </> - )} - {!never.length && !old.length && !bad.length && ( - <p className="text-[12px] text-[var(--color-dim)]">every source was checked recently and is reachable</p> - )} - </Panel> - ); -} diff --git a/umtool/components/dashboard/StateStrip.tsx b/umtool/components/dashboard/StateStrip.tsx @@ -1,56 +0,0 @@ -import Link from "next/link"; -import type { StateRow } from "@/lib/dashboard"; -import Panel from "./Panel"; - -// One row per kind, the six states as proportional segments. -// -// ONE meaningful colour. `stale` is the only state that is a judgement -- a -// deliverable older than what describes it -- so it wears --color-dirty, and -// every other state is a step on a neutral ramp. A strip that coloured "built" -// green would be handing a verdict hue to a fact. -const FILL: Record<string, string> = { - draft: "var(--color-panel-2)", - windows: "var(--color-line)", - fetched: "color-mix(in srgb, var(--color-dim) 45%, transparent)", - built: "color-mix(in srgb, var(--color-text) 55%, transparent)", - shipped: "var(--color-text)", - stale: "var(--color-dirty)", -}; - -export default function StateStrip({ rows, note }: { rows: StateRow[]; note: string }) { - return ( - <Panel title="projects" testid="projects" more={{ href: "/projects", label: "every project →" }}> - <p className="micro mb-1.5" data-projects-note=""> - {note} - </p> - <div className="space-y-1.5"> - {rows.map((r) => ( - <div key={r.kind} data-state-row={r.kind} className="flex items-center gap-2 text-[11px]"> - <Link href={`/projects?kind=${encodeURIComponent(r.kind)}`} className="w-24 truncate text-[var(--color-dim)] hover:text-[var(--color-text)]"> - {r.label} - </Link> - <span className="num w-6 text-right text-[var(--color-text)]">{r.total}</span> - <div className="flex h-3 flex-1 overflow-hidden rounded-sm border border-[var(--color-line)]"> - {r.segments - .filter((s) => s.n > 0) - .map((s) => ( - <Link - key={s.state} - href={s.href} - title={`${s.n} ${s.state}`} - data-state-seg={s.state} - data-n={s.n} - style={{ flexGrow: s.n, background: FILL[s.state] }} - className="block min-w-[3px] hover:opacity-80" - /> - ))} - </div> - <span className="num w-40 truncate text-[10px] text-[var(--color-dim)]"> - {r.segments.filter((s) => s.n > 0).map((s) => `${s.n} ${s.state}`).join(" · ")} - </span> - </div> - ))} - </div> - </Panel> - ); -} diff --git a/umtool/components/dashboard/ToolsPanel.tsx b/umtool/components/dashboard/ToolsPanel.tsx @@ -1,89 +0,0 @@ -"use client"; - -import { useState } from "react"; -import { buttonVariants } from "@/components/ui/button"; -import type { DoctorReport } from "@/lib/tool-types"; -import { fmtGB } from "@/lib/dashboard"; -import { fmtAgo } from "@/lib/format"; - -// Tools, disk, index. The tool list is the CACHE handed down by the page, or -// "not checked": the page never probes. The button POSTs, which is the one -// place a probe happens in the app. -// -// Red ONLY when the report pipeline needs it and it is absent. A missing python -// on a machine that never cuts a face is a fact, not a fault. -export default function ToolsPanel({ - initial, - freeBytes, - index, -}: { - initial: DoctorReport | null; - freeBytes: number | null; - index: { ok: boolean; fresh: number; total: number }; -}) { - const [report, setReport] = useState<DoctorReport | null>(initial); - const [busy, setBusy] = useState(false); - - return ( - <section data-panel="tools" className="rounded border border-[var(--color-line)] bg-[var(--color-panel)] px-3 py-2"> - <div className="mb-1.5 flex items-baseline gap-2"> - <h2 className="micro">tools &amp; disk</h2> - <span className="micro ml-auto" data-tools-checked={report ? String(report.checkedAt) : "never"}> - {report ? `checked ${fmtAgo(report.checkedAt)}` : "not checked"} - </span> - <button - type="button" - data-action="doctor" - disabled={busy} - className={buttonVariants({ size: "sm" })} - onClick={async () => { - setBusy(true); - try { - const r = await fetch("/api/doctor", { method: "POST" }); - if (r.ok) setReport((await r.json()) as DoctorReport); - } finally { - setBusy(false); - } - }} - > - {busy ? "…" : report ? "re-check" : "check"} - </button> - </div> - {report && ( - <ul className="grid grid-cols-2 gap-x-3 gap-y-0.5 text-[11px]"> - {report.tools.map((t) => { - const bad = t.required && !t.present; - return ( - <li - key={t.id} - data-tool={t.id} - data-present={t.present ? "1" : "0"} - data-required={t.required ? "1" : "0"} - title={t.error ?? t.bin} - className={`flex gap-1.5 ${bad ? "text-[var(--color-bad)]" : t.present ? "text-[var(--color-dim)]" : "text-[var(--color-dim)] opacity-70"}`} - > - <span className="font-mono text-[var(--color-text)]">{t.id}</span> - <span className="num truncate">{t.present ? (t.version ?? "present") : "absent"}</span> - </li> - ); - })} - </ul> - )} - <div className="mt-1.5 flex flex-wrap gap-3 border-t border-[var(--color-line)] pt-1.5 text-[11px] text-[var(--color-dim)]"> - <span data-free-bytes={freeBytes ?? ""}> - free <b className="num text-[var(--color-meter)]">{fmtGB(freeBytes)}</b> - </span> - <span data-index={index.ok ? `${index.fresh}/${index.total}` : "off"}> - index{" "} - {index.ok ? ( - <> - <b className="num text-[var(--color-text)]">{index.fresh}/{index.total}</b> fresh - </> - ) : ( - "off" - )} - </span> - </div> - </section> - ); -} diff --git a/umtool/components/notes/AnchoredNotes.tsx b/umtool/components/notes/AnchoredNotes.tsx @@ -41,7 +41,7 @@ export default function AnchoredNotes({ type="button" data-action="toggle-notes" onClick={() => setOpen((o) => !o)} - className={openCount ? badgeVariants({ variant: "open", size: "sm" }) : "ink-link"} + className={openCount ? badgeVariants({ variant: "state", size: "sm" }) : "ink-link"} > {openCount ? `${openCount} open ${openCount === 1 ? "note" : "notes"}` : mine.length ? `${label} (${mine.length})` : `+ ${label.replace(/s$/, "")}`} </button> diff --git a/umtool/components/projects/ClipBench.tsx b/umtool/components/projects/ClipBench.tsx @@ -2162,7 +2162,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { ready {data.ready} of {data.needing} needing judgement </span> {!data.fetched && ( - <span className={badgeVariants({ variant: "open", size: "sm" })} data-clip-unfetched=""> + <span className={badgeVariants({ variant: "state", size: "sm" })} data-clip-unfetched=""> not fetched yet </span> )} diff --git a/umtool/components/projects/CutPage.tsx b/umtool/components/projects/CutPage.tsx @@ -136,6 +136,7 @@ export default async function CutPage({ </div> <div className="px-4 pb-4"> <ProvenancePanel + project={project.id} song={song.id} cut={cutName} prov={prov} diff --git a/umtool/components/projects/MediaDrafts.tsx b/umtool/components/projects/MediaDrafts.tsx @@ -538,11 +538,11 @@ export default function MediaDrafts({ <GateLine view={view} /> {!link.ok ? ( <p data-draft-unlinked="" title={link.why} className="m-0 text-[12px] text-muted"> - Not from an article iteration — Draft with is off here. + Drafting is off: no article iteration made this project. </p> ) : link.status !== "done" ? ( <p data-draft-unlinked="" className="m-0 text-[12px] text-muted"> - {link.article} i{link.n} is {link.status} — Draft with waits for it to finish. + Drafting waits for {link.article} i{link.n}, which is {link.status}. </p> ) : ( policyError && ( diff --git a/umtool/components/projects/ReportProject.tsx b/umtool/components/projects/ReportProject.tsx @@ -1,4 +1,4 @@ -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import PieceFrame from "@/components/piece/PieceFrame"; import { readPieceFrame } from "@/lib/pieces/frame"; import { projectHref, projectsHref } from "@/lib/hrefs"; @@ -38,7 +38,7 @@ export default async function ReportProject({ if (!detail) { return ( <div className="flex h-full flex-col"> - <BrowseHeader crumbs={[{ href: "/projects", label: "projects" }, { label: project.id }]} /> + <AppShell active="projects" crumbs={[{ href: "/projects", label: "projects" }, { label: project.id }]} /> <main className="deck-main flex-1 p-4"> <p className="text-[12px] text-[var(--color-bad)]"> <code className="font-mono">video.manifest.json</code> could not be parsed. diff --git a/umtool/components/projects/SongProject.tsx b/umtool/components/projects/SongProject.tsx @@ -58,7 +58,7 @@ export default async function SongProject({ note={`${song.present}/${song.cuts.length} cuts · ${song.variantCount} variants`} > {tab === "overview" && <OverviewTab project={project} song={song} frame={frame} covers={thumbs} />} - {tab === "cuts" && <CutsTab song={song} notes={notes} />} + {tab === "cuts" && <CutsTab projectId={project.id} song={song} notes={notes} />} {tab === "spec" && <SpecTab song={song} notes={notes} />} {tab === "cover" && <CoverTab song={song} view={thumbs} notes={notes} />} {tab === "notes" && <NotesTab projectId={project.id} song={song} notes={notes} />} diff --git a/umtool/components/projects/StructureEditors.tsx b/umtool/components/projects/StructureEditors.tsx @@ -164,7 +164,7 @@ function TeaserEditor({ <label>tail wait <input value={tailWait} onChange={(e) => edit(setTailWait)(e.target.value)} className={`${input} w-14`} /></label> <label>dip fade <input value={fade} onChange={(e) => edit(setFade)(e.target.value)} className={`${input} w-14`} /></label> <label>black <input value={black} onChange={(e) => edit(setBlack)(e.target.value)} className={`${input} w-14`} /></label> - <button type="button" data-testid={`teaser-save-${t.id}`} disabled={busy} onClick={submit} className={buttonVariants({ variant: "primary", size: "sm" })}> + <button type="button" data-testid={`teaser-save-${t.id}`} disabled={busy} onClick={submit} className={buttonVariants({ variant: "outline", size: "sm" })}> Save teaser </button> {local && <span className="text-[var(--color-bad)]">{local}</span>} @@ -242,7 +242,7 @@ function PostRow({ post, fresh = false, busy, save, remove }: { post: Post; fres for (const k of POST_FIELDS) p[k] = d[k]; void save(p); }} - className={buttonVariants({ variant: "primary", size: "sm" })} + className={buttonVariants({ variant: "outline", size: "sm" })} > {fresh ? "Add post" : "Save post"} </button> @@ -301,7 +301,7 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( </div> <div className="flex items-center gap-2 text-[var(--color-dim)]"> <label>stamp seconds <input value={seconds} placeholder={String(doc.factcheckResolved.stamp.seconds)} onChange={(e) => setSeconds(e.target.value)} className={`${input} w-14`} /></label> - <button type="button" data-testid="fc-save" disabled={busy} onClick={submit} className={buttonVariants({ variant: "primary", size: "sm" })}> + <button type="button" data-testid="fc-save" disabled={busy} onClick={submit} className={buttonVariants({ variant: "outline", size: "sm" })}> Save labels </button> </div> diff --git a/umtool/components/projects/SweepProject.tsx b/umtool/components/projects/SweepProject.tsx @@ -1,7 +1,7 @@ import Link from "next/link"; import { readdir, readFile, stat } from "node:fs/promises"; import path from "node:path"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; import { Markdown } from "@/lib/markdown"; import { fmtAgo } from "@/lib/format"; import type { ProjectRef } from "@/lib/project-types"; @@ -24,7 +24,7 @@ export default async function SweepProject({ project }: { project: ProjectRef }) return ( <div className="flex h-full flex-col"> - <BrowseHeader + <AppShell active="projects" crumbs={[{ href: "/projects", label: "projects" }, { label: project.id }]} note={`${citations} citation${citations === 1 ? "" : "s"} · no manifest`} /> diff --git a/umtool/components/projects/report/SourcesTab.tsx b/umtool/components/projects/report/SourcesTab.tsx @@ -28,7 +28,7 @@ export default async function SourcesTab({ project, detail }: ReportTabProps) { : "availability never checked"} </span> <span className="ml-auto"> - <CheckSourcesButton projects={[project.id]} label="re-check availability" /> + <CheckSourcesButton projects={[project.id]} label="Re-check availability" /> </span> </div> {/* Beside the sources, because these ARE the sources: tagging them in diff --git a/umtool/components/projects/report/shared.tsx b/umtool/components/projects/report/shared.tsx @@ -32,7 +32,7 @@ export const hms = (t: number) => { export const TONE: Record<Severity, BadgeVariants["variant"]> = { blocking: "blocking", - open: "open", + open: "state", info: "info", }; diff --git a/umtool/components/projects/song/CutsTab.tsx b/umtool/components/projects/song/CutsTab.tsx @@ -3,14 +3,15 @@ import VerdictChip from "@/components/VerdictChip"; import NoteField from "@/components/NoteField"; import { probeAll, type Cut, type Song } from "@/lib/browse"; import { fmtAgo, fmtBytes, fmtDur } from "@/lib/format"; +import { cutHref } from "@/lib/hrefs"; import type { NoteMap } from "@/lib/notes"; // The Cuts tab: the four cut cards (poster, verdicts, the slot's and the // file's notes, the variants) and what matches no cut -- SongProject's left // column, moved unchanged (P4a-3). A cut's own page (/projects/<song>/<cut>, -// CutPage) is this tab's view of one cut. +// CutPage) is this tab's view of one cut, linked at the song's full path (P6). -export default async function CutsTab({ song, notes }: { song: Song; notes: NoteMap }) { +export default async function CutsTab({ projectId, song, notes }: { projectId: string; song: Song; notes: NoteMap }) { // Durations are worth an ffprobe HERE but not on the index: this page is a // handful of files and "which of these is the short cut" is exactly the // question it answers. Memoised by mtime in lib/browse.ts. @@ -23,7 +24,7 @@ export default async function CutsTab({ song, notes }: { song: Song; notes: Note return ( <div className="max-w-[1100px] space-y-3" data-song-cuts=""> {song.cuts.map((cut) => ( - <CutCard key={cut.name} song={song} cut={cut} info={info} notes={notes} /> + <CutCard key={cut.name} projectId={projectId} song={song} cut={cut} info={info} notes={notes} /> ))} {song.unattributed.length > 0 && ( @@ -46,11 +47,13 @@ export default async function CutsTab({ song, notes }: { song: Song; notes: Note } function CutCard({ + projectId, song, cut, info, notes, }: { + projectId: string; song: Song; cut: Cut; info: Record<string, { duration: number; width: number; height: number }>; @@ -85,7 +88,7 @@ function CutCard({ <div className="min-w-0 flex-1 space-y-1"> <div className="flex flex-wrap items-baseline gap-2"> <Link - href={`/projects/${song.id}/${cut.name}`} + href={cutHref(projectId, cut.name)} className="ink-link font-mono text-[13px]" > {cut.name} diff --git a/umtool/components/shell/JobProgress.tsx b/umtool/components/shell/JobProgress.tsx @@ -1,4 +0,0 @@ -// The Running row's progress: the two smallest parts of the ONE job progress -// (components/ui/job-progress.tsx, P4b), which the Media tab's drafts, Draft -// everything, the Build tab and the Iterations tab's jobs use whole. -export { JobProgressBar, JobProgressText } from "@/components/ui/job-progress"; diff --git a/umtool/components/shell/RunningList.tsx b/umtool/components/shell/RunningList.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { useEffect, useRef, useState } from "react"; import type { ActivityItem, RunningView } from "@/lib/activity-types"; -import { JobProgressBar, JobProgressText } from "./JobProgress"; +import { JobProgressBar, JobProgressText } from "@/components/ui/job-progress"; // --------------------------------------------------------------------------- // The rail's foot (canvas `.running`): what is running, umtool's own and the diff --git a/umtool/components/system/Maintenance.tsx b/umtool/components/system/Maintenance.tsx @@ -36,14 +36,14 @@ export function RootsPanel({ roots }: { roots: Roots }) { {roots.reports.present ? "" : " — not there"} </Row> <Row k="media" bad={!!roots.media.problem}> - {roots.media.tiered ? roots.media.path : "= reports (UMTOOL_MEDIA_DIR unset): out/ stays in each project"} + {roots.media.tiered ? roots.media.path : "= reports · UMTOOL_MEDIA_DIR unset"} {roots.media.problem ? ` — ${roots.media.problem}` : ""} </Row> <Row k="cache"> {roots.cache.path} {roots.cache.index ? "" : " — no index yet"} </Row> - {roots.oldCache.present && <Row k="old cache">{roots.oldCache.path} — the cache&apos;s old place, no longer read; derived, safe to delete</Row>} + {roots.oldCache.present && <Row k="old cache">{roots.oldCache.path} — not read; safe to delete</Row>} </dl> </Panel> ); @@ -60,11 +60,10 @@ export function IndexPanel({ index }: { index: { ok: boolean; records: number; p , <b className="num text-meter">{index.stale}</b> for projects that are gone </> ) : null} - {index.builtAt ? ` · rebuilt ${fmtAgo(index.builtAt)}` : ""}. A cache of the walk: every read checks its own signature, so deleting it changes nothing but - latency. + {index.builtAt ? ` · rebuilt ${fmtAgo(index.builtAt)}` : ""} </p> ) : ( - <p className="m-0 text-[12.5px] text-text-2">No index (the lmdb store did not open): a normal state — everything works, just slower.</p> + <p className="m-0 text-[12.5px] text-text-2">No index — every read walks the disk.</p> )} {index.path && <p className="m-0 mt-1 truncate font-mono text-[11px] text-muted-2">{index.path}</p>} <div className="mt-2.5 flex flex-wrap items-start gap-2"> diff --git a/umtool/components/system/NowLive.tsx b/umtool/components/system/NowLive.tsx @@ -0,0 +1,107 @@ +"use client"; + +import Link from "next/link"; +import { useEffect, useState } from "react"; +import type { ActivityItem } from "@/lib/activity-types"; +import { fmtAgo } from "@/lib/format"; + +// umtool's own running job, live (Settings · system's Activity). Polls /api/jobs +// every two seconds ONLY while something is running: an idle page makes no +// requests at all, and one that has just watched a build finish stops the +// moment the state leaves "running". +// +// The per-entry boxes use the same vocabulary ReportBuildChain paints from +// (fetching / cutting / done / failed), computed server-side in lib/activity.ts +// so this file never re-parses events. + +const BOX = { + fetching: "border-[var(--color-meter)] text-[var(--color-meter)]", + cutting: "border-muted text-text", + done: "border-[var(--color-good)] text-[var(--color-good)]", + failed: "border-[var(--color-bad)] text-[var(--color-bad)]", +} as const; + +export default function NowLive({ initial }: { initial: ActivityItem | null }) { + const [now, setNow] = useState<ActivityItem | null>(initial); + + // One fetch on mount, so the panel says what the registry says even if the + // page render and the route disagreed; then a 2 s poll ONLY while running. + useEffect(() => { + let alive = true; + void fetch("/api/jobs?n=1", { cache: "no-store" }) + .then((r) => (r.ok ? r.json() : null)) + .then((j: { running: ActivityItem | null } | null) => { + if (alive && j && j.running) setNow(j.running); + }) + .catch(() => {}); + return () => { + alive = false; + }; + }, []); + + useEffect(() => { + if (!now || now.state !== "running") return; + const t = setInterval(async () => { + try { + const r = await fetch("/api/jobs?n=1", { cache: "no-store" }); + if (!r.ok) return; + const j = (await r.json()) as { running: ActivityItem | null; jobs: ActivityItem[] }; + // When the running item has gone, show what it became rather than + // blanking: the newest job in the list is the one that just finished. + setNow(j.running ?? j.jobs.find((x) => x.id === now.id) ?? null); + } catch { + /* a missed poll is the next poll's problem */ + } + }, 2000); + return () => clearInterval(t); + }, [now]); + + if (!now) { + return ( + <p className="text-[12px] text-[var(--color-dim)]" data-now="idle"> + Nothing running + </p> + ); + } + + const p = now.progress; + const entries = Object.entries(p?.entries ?? {}); + return ( + <div data-now={now.state} data-now-id={now.id} className="space-y-1.5"> + <div className="flex flex-wrap items-baseline gap-2 text-[12px]"> + <Link href={now.href} className="font-mono ink-link"> + {now.label} + </Link> + <span className="micro">{now.source}</span> + {p && ( + <span className="num text-[11px] text-[var(--color-dim)]" data-now-step={`${p.step}/${p.of}`}> + step {p.step}/{p.of} + </span> + )} + {p?.clipsOf !== undefined && ( + <span className="num text-[11px] text-[var(--color-meter)]"> + {p.clipsDone ?? 0}/{p.clipsOf} entries + </span> + )} + <span className="num ml-auto text-[11px] text-[var(--color-dim)]"> + {now.state === "running" ? `started ${fmtAgo(now.startedAt)}` : now.state} + {now.error ? ` — ${now.error}` : ""} + </span> + </div> + {entries.length > 0 && ( + <div className="flex flex-wrap gap-1"> + {entries.map(([id, st]) => ( + <span + key={id} + data-now-entry={id} + data-entry-state={st} + className={`rounded border px-1.5 py-0.5 font-mono text-[10px] ${BOX[st]}`} + > + {id} + </span> + ))} + </div> + )} + </div> + ); +} diff --git a/umtool/components/system/Status.tsx b/umtool/components/system/Status.tsx @@ -0,0 +1,178 @@ +import Link from "next/link"; +import CheckSourcesButton from "@/components/dashboard/CheckSourcesButton"; +import { Panel } from "@/components/ui/panel"; +import type { ActivityItem } from "@/lib/activity"; +import { SOURCES_STALE_DAYS, type StateRow } from "@/lib/dashboard"; +import { fmtAgo, fmtBytes } from "@/lib/format"; +import { projectHref, projectsHref } from "@/lib/hrefs"; +import type { ProjectSummary } from "@/lib/project-types"; +import NowLive from "./NowLive"; + +// --------------------------------------------------------------------------- +// Settings · system's status panels (the old dashboard's, P3; moved here and +// cut to status lines in P6). Everything is read from the index, the job +// registries and the summaries -- nothing here probes or shells out. +// --------------------------------------------------------------------------- + +/** umtool's own jobs: the one running (live), then the newest that ended. */ +export function ActivityPanel({ running, recent }: { running: ActivityItem | null; recent: ActivityItem[] }) { + const done = recent.filter((a) => a.state !== "running"); + return ( + <Panel title="Activity" data-panel="now" aside={<span className="text-muted-2">umtool&apos;s jobs</span>}> + <NowLive initial={running} /> + {done.length > 0 && ( + <ul className="m-0 mt-2 list-none space-y-0.5 border-t border-seam p-0 pt-2" data-activity=""> + {done.map((a) => ( + <li key={a.id} data-activity-id={a.id} data-activity-state={a.state} className="flex flex-wrap items-baseline gap-2 text-[11.5px]"> + <span className={a.state === "failed" ? "text-reject-text" : "text-muted"}>{a.state}</span> + <Link href={a.href} prefetch={false} className="ink-link font-mono"> + {a.label} + </Link> + <span className="num ml-auto text-muted">{fmtAgo(a.endedAt ?? a.startedAt)}</span> + </li> + ))} + </ul> + )} + </Panel> + ); +} + +// One row per kind, the six states as proportional segments. ONE meaningful +// colour: `stale` (a deliverable older than what describes it) is the doubt +// word; every other state is a step on a neutral ramp. +const FILL: Record<string, string> = { + draft: "var(--color-panel-2)", + windows: "var(--color-line)", + fetched: "color-mix(in srgb, var(--color-dim) 45%, transparent)", + built: "color-mix(in srgb, var(--color-text) 55%, transparent)", + shipped: "var(--color-text)", + stale: "var(--color-dirty)", +}; + +export function ProjectsPanel({ rows, note }: { rows: StateRow[]; note: string }) { + return ( + <Panel + title="Projects" + data-panel="projects" + aside={ + <Link href={projectsHref()} prefetch={false} className="ink-link"> + Every project → + </Link> + } + > + <p className="micro m-0 mb-1.5" data-projects-note=""> + {note} + </p> + <div className="space-y-1.5"> + {rows.map((r) => ( + <div key={r.kind} data-state-row={r.kind} className="flex items-center gap-2 text-[11.5px]"> + <Link href={projectsHref({ kind: r.kind })} prefetch={false} className="w-24 truncate text-muted hover:text-text"> + {r.label} + </Link> + <span className="num w-6 text-right text-text">{r.total}</span> + <div className="flex h-3 flex-1 overflow-hidden rounded-sm border border-seam"> + {r.segments + .filter((s) => s.n > 0) + .map((s) => ( + <Link + key={s.state} + href={s.href} + prefetch={false} + title={`${s.n} ${s.state}`} + data-state-seg={s.state} + data-n={s.n} + style={{ flexGrow: s.n, background: FILL[s.state] }} + className="block min-w-[3px] hover:opacity-80" + /> + ))} + </div> + <span className="num w-40 truncate text-[10.5px] text-muted"> + {r.segments + .filter((s) => s.n > 0) + .map((s) => `${s.n} ${s.state}`) + .join(" · ")} + </span> + </div> + ))} + </div> + </Panel> + ); +} + +/** Report projects whose sources nobody checked, checked long ago, or found dead -- from summaries, never probed. */ +export function SourcesPanel({ never, old, bad }: { never: ProjectSummary[]; old: ProjectSummary[]; bad: ProjectSummary[] }) { + const List = ({ items, attr, label }: { items: ProjectSummary[]; attr: string; label: string }) => ( + <> + <div className="micro mt-1.5">{label}</div> + <ul className="m-0 list-none space-y-0.5 p-0" data-sources-list={attr}> + {items.map((p) => ( + <li key={p.id} data-source-project={p.id} className="flex flex-wrap gap-2 text-[11.5px]"> + <Link href={projectHref(p.id, { tab: "sources" })} prefetch={false} className="ink-link font-mono"> + {p.id} + </Link> + <span className="text-muted"> + {[ + p.attrs?.["sources-dead"] ? `${p.attrs["sources-dead"]} dead` : "", + p.attrs?.["sources-missing"] ? `${p.attrs["sources-missing"]} no cues` : "", + p.attrs?.["cue-gaps"] ? `${p.attrs["cue-gaps"]} cue gap${p.attrs["cue-gaps"] === "1" ? "" : "s"}` : "", + ] + .filter(Boolean) + .join(" · ")} + </span> + </li> + ))} + </ul> + </> + ); + const recheck = [...never, ...old].map((p) => p.id); + return ( + <Panel title="Sources" data-panel="sources" aside={<CheckSourcesButton projects={recheck} />}> + <p className="m-0 text-[12.5px] text-text-2" data-sources-counts={`${never.length}/${old.length}/${bad.length}`}> + <b className="num text-meter">{never.length}</b> never checked · <b className="num text-meter">{old.length}</b> older than{" "} + {SOURCES_STALE_DAYS} d · <b className={`num ${bad.length ? "text-reject-text" : "text-meter"}`}>{bad.length}</b> dead or missing + </p> + {bad.length > 0 && <List items={bad} attr="bad" label="dead or missing" />} + {never.length > 0 && <List items={never} attr="never" label="never checked" />} + {old.length > 0 && <List items={old} attr="old" label={`older than ${SOURCES_STALE_DAYS} d`} />} + </Panel> + ); +} + +/** Built count, bytes, newest, stale -- from each summary's `final-bytes` and state; nothing here stats a file. */ +export function DeliverablesPanel({ projects }: { projects: ProjectSummary[] }) { + const built = projects.filter((p) => p.attrs?.["final-bytes"]); + const bytes = built.reduce((n, p) => n + Number(p.attrs?.["final-bytes"] ?? 0), 0); + const newest = [...built].sort((a, b) => b.newestMtimeMs - a.newestMtimeMs)[0] ?? null; + const stale = projects.filter((p) => p.state === "stale"); + return ( + <Panel + title="Deliverables" + data-panel="deliverables" + aside={ + <Link href={projectsHref({ state: "built" })} prefetch={false} className="ink-link"> + Built → + </Link> + } + > + <p className="m-0 flex flex-wrap gap-x-3 text-[12.5px] text-text-2" data-deliverables={`${built.length}/${bytes}`}> + <span> + <b className="num text-meter">{built.length}</b> built · <b className="num text-meter">{fmtBytes(bytes)}</b> + </span> + {newest && ( + <span> + newest{" "} + <Link href={projectHref(newest.id)} prefetch={false} className="ink-link font-mono"> + {newest.id} + </Link>{" "} + <span className="num text-muted">{fmtAgo(newest.newestMtimeMs)}</span> + </span> + )} + {stale.length > 0 && ( + <Link href={projectsHref({ state: "stale" })} prefetch={false} className="text-doubt-text hover:underline" data-stale={stale.length}> + {stale.length} stale + </Link> + )} + </p> + </Panel> + ); +} diff --git a/umtool/components/system/ToolsPanel.tsx b/umtool/components/system/ToolsPanel.tsx @@ -0,0 +1,74 @@ +"use client"; + +import { useState } from "react"; +import { buttonVariants } from "@/components/ui/button"; +import { Panel } from "@/components/ui/panel"; +import type { DoctorReport } from "@/lib/tool-types"; +import { fmtGB } from "@/lib/dashboard"; +import { fmtAgo } from "@/lib/format"; + +// Settings · system: the tools and the free disk. The tool list is the CACHE +// the page hands down, or "not checked": the page never probes. The button +// POSTs /api/doctor, the one place the app probes. +// +// Red ONLY when the report pipeline needs a tool and it is absent. A missing +// python on a machine that never cuts a face is a fact, not a fault. +export default function ToolsPanel({ initial, freeBytes }: { initial: DoctorReport | null; freeBytes: number | null }) { + const [report, setReport] = useState<DoctorReport | null>(initial); + const [busy, setBusy] = useState(false); + + return ( + <Panel + title="Tools & disk" + data-panel="tools" + aside={ + <span className="flex items-center gap-2"> + <span className="text-muted-2" data-tools-checked={report ? String(report.checkedAt) : "never"}> + {report ? `checked ${fmtAgo(report.checkedAt)}` : "not checked"} + </span> + <button + type="button" + data-action="doctor" + disabled={busy} + className={buttonVariants({ size: "sm" })} + onClick={async () => { + setBusy(true); + try { + const r = await fetch("/api/doctor", { method: "POST" }); + if (r.ok) setReport((await r.json()) as DoctorReport); + } finally { + setBusy(false); + } + }} + > + {busy ? "Checking…" : report ? "Check again" : "Check"} + </button> + </span> + } + > + <p className="m-0 text-[12.5px] text-text-2" data-free-bytes={freeBytes ?? ""}> + <b className="num text-meter">{fmtGB(freeBytes)}</b> free under the reports root + </p> + {report && ( + <ul className="m-0 mt-2 grid list-none grid-cols-2 gap-x-3 gap-y-0.5 p-0 text-[11.5px]"> + {report.tools.map((t) => { + const bad = t.required && !t.present; + return ( + <li + key={t.id} + data-tool={t.id} + data-present={t.present ? "1" : "0"} + data-required={t.required ? "1" : "0"} + title={t.error ?? t.bin} + className={`flex gap-1.5 ${bad ? "text-reject-text" : t.present ? "text-muted" : "text-muted opacity-70"}`} + > + <span className="font-mono text-text">{t.id}</span> + <span className="num truncate">{t.present ? (t.version ?? "present") : "absent"}</span> + </li> + ); + })} + </ul> + )} + </Panel> + ); +} diff --git a/umtool/components/ui/badge.tsx b/umtool/components/ui/badge.tsx @@ -16,7 +16,9 @@ import { cn } from "@/lib/utils"; // primary action). // - `sm` is a STATUS TAG: mono, caps, in the colour of what it reports. // The variants name ROLES (app/globals.css): blocking/open are the reject and -// doubt words, `meter` is a measurement, neutral/info are ink. +// doubt words, `meter` is a measurement, neutral/info are ink, and `state` is a +// state that is not a judgement (in the making, running, open, waiting): a +// dashed ink edge, never a verdict colour. // --------------------------------------------------------------------------- export const badgeVariants = cva( @@ -30,6 +32,7 @@ export const badgeVariants = cva( open: "border-doubt-text text-doubt-text", info: "border-seam-2 text-muted", meter: "border-meter text-meter", + state: "border-dashed border-muted text-text-2", }, size: { sm: "px-1.5 py-px font-mono text-[10px] uppercase tracking-wider", diff --git a/umtool/components/ui/job-progress.tsx b/umtool/components/ui/job-progress.tsx @@ -21,8 +21,7 @@ import { Button } from "./button"; // // -- so a Running row in the rail, a draft row on the Media tab and the build // on the Build tab read the same way. The Running row uses the two smallest -// parts (JobProgressText, JobProgressBar); `components/shell/JobProgress.tsx` -// re-exports them. Colour: Meter for measurement (the bar, the spend), the +// parts (JobProgressText, JobProgressBar). Colour: Meter for measurement (the bar, the spend), the // verdict text steps only for an ended job's outcome; never Signal. // --------------------------------------------------------------------------- diff --git a/umtool/components/ui/verdict.tsx b/umtool/components/ui/verdict.tsx @@ -1,22 +0,0 @@ -import { cn } from "@/lib/utils"; - -// A judgement: glyph AND word, never colour alone (canvas `.v`). The glyph -// carries the verdict colour; the word takes its text step, which in light is -// darker than the glyph (app/globals.css, "COLOUR MEANS SOMETHING"). -// -// Desk only. A verdict never sits on the reader: the record carries no -// judgement, and on the pale surface the hues collapse for colour-blind eyes. -export type VerdictKind = "kept" | "doubt" | "reject"; - -export function Verdict({ - kind, - className, - children, - ...props -}: React.ComponentProps<"span"> & { kind: VerdictKind }) { - return ( - <span data-verdict={kind} className={cn("verdict", className)} {...props}> - {children} - </span> - ); -} diff --git a/umtool/docs/README.md b/umtool/docs/README.md @@ -1,35 +1,74 @@ # umtool docs -umtool judges and drives the things this repo makes videos out of. There are two -kinds of work in it today and the tool treats them the same way: as **projects** -in a folder tree, each with a state, a set of open decisions, and a build. +## The places -These sheets live in the repo because they describe code and have to move with it. -Notes about *one particular video* belong beside that video, in its own `README.md` -— which the project page now renders at the top, with any other `*.md` beside it -under **Notes**. +Every page has the rail: **Inbox · Research · Work · Tools · Settings**, **+ Create**, **Jump to…** (⌘K / Ctrl+K from +anywhere), Pinned, the **Running** list with today's API spend, and the theme (**Auto** / **Light** / **Dark**). -`/` is the [dashboard](dashboard.md): what is running, what is waiting on you, -where every project stands, which sources nobody has checked, what is built, and -whether this machine can build. The song piles are one nav entry, `song ▸`. +| Place | Addresses | Sheet | +|---|---|---| +| Inbox | `/` (`?hidden=1`, `?muted=1`) | [inbox.md](inbox.md) | +| Research | `/research`, `/research/<case>`, `/research/runs`, `/research/runs/<article>/<n>`, `/research/archive` | [research.md](research.md) | +| Work | `/work`, `/projects`, `/sites/<site>` | [work.md](work.md) | +| A piece | `/articles/<id>`, `/sites/<site>/<report>`, `/projects/<path>`, `/series/<id>` | [piece.md](piece.md) | +| Tools | `/tools`, `/tools/{find,mix,faces,sources,bench}`, `/tools/song[/<mode>]`, `/tools/trim/<set>` | [tools.md](tools.md) | +| Settings | `/settings`, `/settings/generation`, `/settings/system` | [settings.md](settings.md) | +| Create | `/create` (`?make=`, `?from=`, `?case=`, `?article=`) | below | + +**Create** is one list, "What are you making?" — j/k move the lit line, Enter opens its form, Escape closes it; the +open form is the address (`?make=`): + +| Group | Line | Button | `?make=` | +|---|---|---|---| +| Research | Research a question | **Open a case** | `research` | +| Article | From a question | **Start sweep** | `article` | +| Article | From a board | **Draft article** | `article-board` | +| Article | A recurring report ([recurring.md](recurring.md)) | **Set a schedule** | `recurring` | +| Video | From an article | **Choose article** | `video-article` | +| Video | From a board | **Choose board** | `video-board` | +| Video | From a recording | **Choose recording** | `video-recording` | +| Video | From a sweep report | **Choose report** | `video-report` | +| Song | A song cut | **New song** | `song` | + +The editor's "Open in umtool" (`/?from=<channel>/<id>`) lands on `/create?from=…` with **From a recording** open and +prefilled. + +## Old addresses + +`umtool/redirects.mjs` is the one table (307 today; P6b makes them 308). The query string is kept. + +| Old | Now | +|---|---| +| `/?from=<channel>/<id>` | `/create?from=…` | +| `/articles/new`, `/drafts` | `/create?make=article` | +| `/browse` | `/work` | +| `/browse/decisions` | `/` | +| `/browse/find`, `/browse/faces`, `/browse/sources`, `/browse/trim/<set>` | `/tools/…` | +| `/browse/at` | `/projects/at` | +| `/browse/<path>[/…]` | `/projects/<path>[/…]` | +| `/articles` | `/work?kind=article&site=articles` | +| `/sites` | `/work?by=site` | +| `/mix` | `/tools/mix` | +| `/sort`, `/salvage`, `/verify`, `/keeps` | `/tools/song/<mode>` | +| `/bench` | `/tools/bench` | ## You have been asked for an umtool video -Work out which kind you are making first — the rest follows from it. - | What you were handed | Kind | Start here | |---|---|---| | A cited sweep report (`*sweep-report.md`) and "make this a video" | `report-video` | [report-video.md](report-video.md), then [authoring.md](authoring.md) | -| One archived recording and "make a video from this" | `report-video` | `umtool new <slug> --from <channel>/<id> [--seed chapters]`, or the editor's "Open in umtool" | +| One archived recording and "make a video from this" | `report-video` | Create → **From a recording**, or `umtool new <slug> --from <channel>/<id> [--seed chapters]` | +| A board of pinned quotes | `report-video` | the board's **Start a video from this board** ([research.md](research.md)) | +| An article with a done iteration | `report-video` | Create → **From an article**, or the Iterations tab's **Make the video** | | A song's clips and "judge these" | `song` (template `um-song`) | `~/reports/quartering-uh-song/specs/` | | A report with no manifest yet | `sweep-report` | [authoring.md](authoring.md) | The short path from a cited report to a built video: ```sh -# 0. scaffold it (writes an EMPTY timeline and a citation checklist), from a -# report, a viewer share URL, or a bare <channel>/<videoId>. `--seed chapters` -# writes one clip per digest chapter -- the digest's boundaries, not guesses. +# 0. scaffold it (an EMPTY timeline and a citation checklist), from a report, a +# viewer share URL, or <channel>/<videoId>. `--seed chapters` writes one clip +# per digest chapter -- the digest's boundaries, not guesses. umtool new <slug> --from <sweep-report.md> umtool new <slug> --from the-quartering/MpZuPjnF_O8 --site-origin https://jeralyzer.pages.dev --seed chapters umtool doctor # can this machine build at all? @@ -43,71 +82,66 @@ umtool check <slug> node umtool/report-to-video/resolve-windows.mjs ~/reports/<slug>/video.manifest.json node umtool/report-to-video/resolve-windows.mjs ~/reports/<slug>/video.manifest.json --write -# 4. bench any clip whose edges you are unsure of -# /browse/<slug>/clip/<id> +# 4. bench any clip whose edges you are unsure of: the Cut tab's Walk the cut, +# or /projects/<slug>/clip/<id> -# 4b. if the manifest has a ledger, rule on every claim in it. `umtool check` -# BLOCKS until it is empty, because both totals lie on an unadjudicated one. -# /browse/<slug>/claim/<id> +# 4b. a manifest with a ledger: rule on every claim. `umtool check` BLOCKS +# until none is unadjudicated. /projects/<slug>/claim/<id> -# 5. build: a fast pass to watch, then the real one. -# The BUTTON on the project page runs it -- cancellation, the per-step -# timeouts and the process-group kill live in the server's job runner. -# `umtool build` prints the same chain if you would rather paste it. +# 5. build: a fast pass to watch, then the real one -- the Build tab runs it +# (cancellation, per-step timeouts, the process-group kill live in the +# server's job runner). `umtool build` prints the same chain. umtool build <slug> --preset fast # 6. before revising: keep the manifest that made the deliverable umtool snapshot <slug> --label v1 -# …edit… umtool diff <slug> revisions/<stamp>-v1.manifest.json -# 7. post it: the TOC / description / chapters, derived from the build's offsets +# 7. post it: the TOC / description / chapters, from the build's offsets umtool export <slug> --format toc-bbcode ``` -**A manifest may describe more than one cut.** `build-video.mjs --variant -sourced|full` selects between them; `sourced` is the default and still writes -`out/<slug>.mp4`, so the button and `umtool build` are unchanged. The working -files moved under `out/<variant>/` while `clips-raw` and `availability.json` -stayed at the root. See -[report-video.md](report-video.md#one-manifest-two-cuts). +**A manifest may describe more than one cut.** `build-video.mjs --variant sourced|full`; `sourced` is the default and +writes `out/<slug>.mp4`. The working files are under `out/<variant>/`; `clips-raw` and `availability.json` stay at the +root. See [report-video.md](report-video.md#one-manifest-two-cuts). -**Run step 2 before step 5, always.** It is a few seconds and it catches the two -defects that have already shipped in real videos: a manifest with no `siteOrigin` -(19 QR codes encoding `undefined/?v=…`) and one pointing at `http://localhost:3000` -(QR codes that resolve to nothing on anybody's phone). +**Run step 2 before step 5, always.** It catches the two defects that have shipped in real videos: a manifest with no +`siteOrigin` (QR codes encoding `undefined/?v=…`) and one pointing at `http://localhost:3000`. ## The sheets | Sheet | What it covers | |---|---| -| [dashboard.md](dashboard.md) | The front door: what each panel reads, `/api/jobs`, `umtool doctor` | -| [projects.md](projects.md) | Kinds vs templates, marker files, ids, how to add a kind | -| [folders.md](folders.md) | The walk, `REPORTS_ROOT`, read roots vs write roots | -| [browse.md](browse.md) | The project index, the four filters, cards per kind | +| [inbox.md](inbox.md) | The Inbox: groups, cards, Park / Mark done / Mute; every decision kind and its severity; the Running list; `/api/browse/decisions` | +| [research.md](research.md) | Search, the reader, the reading log, boards, hand-offs, agent runs, the archive inventory | +| [work.md](work.md) | Work's facets, the projects grid, a site's page | +| [piece.md](piece.md) | The piece page: head, stepper, Next card, tabs per kind; iterations, the reader and notes, evidence; projects: kinds, ids, routing, delete | +| [refresh.md](refresh.md) | Refresh: fetch what is new, check it, update; the daily check | +| [recurring.md](recurring.md) | Recurring reports: living reports and series, the schedule, the series page | +| [tools.md](tools.md) | The song piles, find, mix, faces, sources, trims, the verdict bench | +| [settings.md](settings.md) | The generation policy and spend; the system page; `umtool doctor` | | [report-video.md](report-video.md) | The manifest as an EDL, the three-stage window model, `lock` | | [clip-bench.md](clip-bench.md) | Editing a clip's window against the waveform and the cues | | [claim-bench.md](claim-bench.md) | Ruling on a `ledger[]` claim against ±90 s of context | | [build.md](build.md) | The four-step chain, presets, cancellation, overwrite | -| [decisions.md](decisions.md) | What earns a severity, and how a kind contributes | -| [mix-from-a-project.md](mix-from-a-project.md) | Deep-linking a clip into `/mix` | +| [mix-from-a-project.md](mix-from-a-project.md) | Deep-linking a clip into the mix bench | +| [folders.md](folders.md) | The walk, `REPORTS_ROOT`, read roots vs write roots | | [index.md](index.md) | The LMDB index, and why the filesystem stays the model | -| [cli.md](cli.md) | `umtool ls / show / check / build / window / …` | +| [cli.md](cli.md) | `umtool ls / show / check / build / inbox / refresh / schedule / …` | | [notes.md](notes.md) | Operator notes on articles and videos; `umtool notes`, the agent loop | -| [sites.md](sites.md) | `/sites`: every site's articles, their media, workspaces and notes | -| [authoring.md](authoring.md) | Writing a manifest from a sweep report | +| [authoring.md](authoring.md) | Writing a manifest from a sweep report; generating one | | [e2e.md](e2e.md) | The fixture, the stubs, the global queue | | [quirks.md](quirks.md) | Everything that cost time to find out | ## The rules that outrank convenience -1. **The filesystem is the model.** An index may cache what the tree says; if a - value exists *only* in the index, that is a bug. See [index.md](index.md). -2. **The index must not shell out.** Listing projects never probes, never runs - ffprobe, never runs yt-dlp. Measuring is what a project page and a job do. -3. **Judgements travel with the tree.** `verdicts.json`, `notes.json` and - `video.manifest.json` live *inside* the project directory, so copying the - directory copies the decisions. -4. **Never guess at something you cannot read.** A directory whose name does not - route, a project two kinds match, a citation with no cue file — each is - *reported*, never silently dropped or resolved by picking one. +1. **The filesystem is the model.** An index may cache what the tree says; a value that exists only in the index is a + bug ([index.md](index.md)). +2. **The index must not shell out.** Listing never probes, never runs ffprobe or yt-dlp. A piece page and a job measure. +3. **Judgements travel with the tree.** `verdicts.json`, `notes.json` and `video.manifest.json` live inside the + project directory. umtool's own state (lifecycle, mutes, boards, reading logs) is under `REPORTS_ROOT/.umtool/`, + never in the corpus. +4. **Never guess at something you cannot read.** A name that does not route, a project two kinds match, a citation with + no cue file — each is reported, never dropped or resolved by picking one. +5. **These sheets describe code and move with it.** Notes about one video belong beside it, in its own `README.md` + (its Overview tab renders it; other `*.md` beside it are under History). diff --git a/umtool/docs/authoring.md b/umtool/docs/authoring.md @@ -88,7 +88,7 @@ a human-chosen window usually *is* the truth. ## 5. Bench each clip -`/browse/<slug>/clip/<id>`. Look at the waveform and the cue rail, and act on +The Cut tab's **Walk the cut**, or `/projects/<slug>/clip/<id>`. Look at the waveform and the cue rail, and act on what it says: run a clip to the end of its sentence, or set `lockEnd` to acknowledge that you meant to cut there. One 14-clip cut shipped with 8 clips ending mid-thought. @@ -109,8 +109,8 @@ technically correct and editorially wrong. ## Generating with a model A model can make the report and the cut in place of steps 0–2: in umtool, -`/articles/new` and then the article's Iterations tab ([sites.md](sites.md)), -or from a shell. When the archive may lack the material, start with research +Create's **From a question** (`/create?make=article`) and then the article's +Iterations tab ([piece.md](piece.md#iterations)), or from a shell. When the archive may lack the material, start with research instead of a sweep: its queue proposes what to fetch, and **Continue into a sweep** makes the report once it is in (OPERATING.md, "Research runs"). @@ -140,8 +140,8 @@ pnpm ops report-draft --json '{"task":"narrate","article":"<id>","iteration":<n> `narration-draft.json`. - **The media drafts** (cut, on-screen, teaser, flips, threads, narration, YouTube) each draft fields of the iteration's cut, marked as drafts: the - project page's **draft** section (**Draft with** a model per task), the - Iterations tab, or `pnpm ops report-draft` with `iteration`. A field you + piece's **Media** tab (**Draft with <model>** per section, **Draft + everything**), or `pnpm ops report-draft` with `iteration`. A field you wrote or edited is never replaced; the draft waits in `<task>-draft.json` as an alternative (**Use this**). `force` re-drafts a model's field only. The limits per task are OPERATING.md's table ("Generate and iterate"). @@ -150,8 +150,8 @@ pnpm ops report-draft --json '{"task":"narrate","article":"<id>","iteration":<n> the podcast, then drafts the YouTube text and writes `out/youtube.txt`. A failed draft does not stop it; flips and threads need the deck, and one panel only. -- **Review every draft before a final build:** `/browse/<project>/review`, - approve or reject with a note. A fast build warns; `--preset final` +- **Review every draft before a final build:** the Media tab, or the review + bench `/projects/<project>/review`: **Approve draft**, or **Reject** with a note. A fast build warns; `--preset final` refuses an unapproved or rejected draft (`--drafts-unreviewed` overrides the unapproved). - **Then review it as a hand-made cut:** `umtool check`, steps 4–6, and a fast diff --git a/umtool/docs/browse.md b/umtool/docs/browse.md @@ -1,88 +0,0 @@ -# /browse — the project index - -Every project, of every kind, in one list. **Zero client JavaScript**: the filters -are links that change `searchParams`, and `?q=` is a plain GET form. Nothing here -hydrates, and `pnpm build` still reports the page as server-rendered. - -## The four filters - -| filter | param | values | -|---|---|---| -| kind / template | `?kind=`, `?template=` | registry ids | -| state | `?state=` | `draft` `windows` `fetched` `built` `shipped` `stale` | -| open decisions | `?open=blocking` \| `?open=1` | from the decision counts | -| text / recency | `?q=`, `?sort=name\|recent` | substring over the haystack | - -**Counts come from the unfiltered set.** A chip whose number changes when you -click a different chip moves under the cursor, and the whole point of a filter row -is to say how much is behind each one. An e2e spec asserts the chip's number -equals the number of cards rendered. - -`?q=` is a `<form method="get">` carrying the other filters as hidden inputs — the -`/browse/find` idiom — so searching does not throw away the filters you set, and -any filtered view is one pasteable URL. - -## The state vocabulary - -One vocabulary across every kind, not per-kind words, because the point of the -filter is to ask "what is half-done" without first asking "half-done at what". A -kind maps its own situation onto these; it does not invent a seventh. - -## The cards - -`components/projects/ProjectGrid.tsx` **contains no kind ids and no per-kind -branches**, and that is the design working rather than an omission: a kind's -summariser has already rendered its own facts (`19 clips · 4m46s · 17 sources`, -`3/4 cuts · 2 variants`) and its own flags. The grid lays out strings. - -A kind can attach `data-*` attributes to its card through `attrs`, which is how a -song keeps `data-missing` as an assertion surface without the grid knowing what a -cut is. - -The poster falls back: the deliverable → a built **segment** (which already -carries the chrome, so the card looks like the video mid-build) → a raw clip → -nothing. Served by `/api/browse/poster?project=…`, which takes **no -client-supplied `rel`** — the frame is the one the summariser chose. - -## Routing - -`app/browse/[...path]` resolves the **longest** path prefix that is a project and -hands the rest to that kind's view. `a/b` being a project must not stop `a/b/c` -from being one. - -- `[]` → the project page -- `["wide"]` on a song → the cut page, unchanged -- `["clip","c04"]` on a report video → the clip bench -- anything else → 404, rather than a page that silently drops half its URL - -The static tool pages (`/browse/decisions`, `find`, `sources`, `faces`, `trim`, -`at`) still win their routes, and a spec asserts each is 200. - -## Cost - -Listing never probes and never shells out — the rule `listSongs()` already -followed, extended to every kind. A summary is memoised against a signature of -mtimes and sizes, so it survives for as long as the project has not changed and is -discarded the moment it has. - -The `open` filter needs decision counts for every project, which means running -each kind's reducer. That is memoised the same way; the expensive input is cue -files, and their *derived* answers are cached against the file's own mtime. - -## Discovered by getting it wrong once - -**Tailwind's source detection is turned OFF, and the three real directories are -named in `app/globals.css`.** It has to be. Auto-detection honours `.gitignore` -but scans everything else, so a scratch `NEXT_DIST_DIR` got read, its binary -turbopack cache yielded a garbage class candidate, and every page 500d on a CSS -parse error with nothing wrong in the CSS. - -Then it happened a second time from **this file**: an earlier draft quoted the -corrupt candidate to explain the first failure, Tailwind scanned the markdown, -and the trap re-created itself. Hence `source(none)` plus explicit `@source` — -a doc, a fixture, a test artefact or a stray dist dir can no longer poison the -stylesheet at all. If you add a directory that holds class names, name it there. - -**`lmdb` must be in `serverExternalPackages`.** Bundled, Turbopack tries to -resolve its optional `moduleRequire('cbor-x')` and fails the whole module graph — -so every page importing `lib/projects` 500s naming a package nothing here uses. diff --git a/umtool/docs/build.md b/umtool/docs/build.md @@ -1,6 +1,6 @@ # Building -From the project page, or `umtool build <project>` to see the chain. +From the piece's **Build** tab (a preset, **show the command**, **run**, **cancel**), or `umtool build <project>` to see the chain. ## Four steps diff --git a/umtool/docs/claim-bench.md b/umtool/docs/claim-bench.md @@ -1,6 +1,6 @@ # The claim bench -`/browse/<project>/claim/<id>`. +`/projects/<project>/claim/<id>` — a claim's Inbox card (**Adjudicate claim**) links it. The clip bench asks *"where exactly does this cut?"*. This one asks *"what did he mean by that?"* — and the two want opposite things. A clip wants sample-accurate @@ -113,7 +113,7 @@ but 20 of 50 needed the **Rumble site-id → URL-slug** remap first (see ## Sign-off is "the inbox is empty" `claim-unadjudicated` is **blocking** and is emitted one row per entry. Work it to -empty; see [decisions.md](decisions.md). +empty; see [inbox.md](inbox.md#decisions). Never auto-apply an adjudication. Every ruling carries its `scopeBasis` precisely so the next person can check it against the audio in one click. diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -9,8 +9,8 @@ The audience is an AI assistant working in this repo, which is why every command takes `--json` and why `check` exits non-zero. It reads the **same** `lib/projects/*.mjs` the app does, so `umtool ls` and -`/browse` cannot disagree about what a project is, and `umtool check` and the -decisions inbox cannot disagree about what is wrong with one. +`/projects` cannot disagree about what a project is, and `umtool check` and the +Inbox cannot disagree about what is wrong with one. ## Commands @@ -34,6 +34,11 @@ decisions inbox cannot disagree about what is wrong with one. | `diff <project> <snapshot>` | added / removed / moved / window / retyped, by entry id | | `export <project> --format toc-bbcode\|toc-markdown\|description\|chapters [--variant V]` | the posting artifacts, from the build's chapter offsets | | `check-sources [<project>…]` | **prints** the re-check chain; with no args, the never-checked and >30 d projects | +| `corrections <project>` | what the report got wrong (the clip bench's sixth field) and the walk's coverage, as markdown for the next pass | +| `chain <article> <n> [--from <step>] [--dry] [--final] [--draft-all [--model M]]` | an iteration to a video: the Iterations tab's **Make the video** (`--draft-all`: Draft everything) | +| `refresh <article> [--iteration N] [--no-fetch] [--yes] [--json]` · `refresh --check [<article>] [--force]` | the refresh's plan, `--yes` starts it; the daily check now ([refresh.md](refresh.md)) | +| `schedule list \| show <id> [--json]` | the recurring reports, read-only ([recurring.md](recurring.md)) | +| `notes …` | operator notes: list, read, reply, resolve ([notes.md](notes.md)) | A project argument is an exact id, a directory, or a **unique** basename. Two projects answering to one name is reported, never resolved by picking one. @@ -82,12 +87,12 @@ front of a twenty-minute build, and it exits non-zero so a script can gate on it **`build` prints, it does not run.** Cancellation, per-step timeouts and the process-group kill live in the server's job runner; a second runner here would be -a second, worse set of those. Use the button on the project page, or paste the +a second, worse set of those. Use **run** on the piece's Build tab, or paste the printed commands. **`check` cannot compute the song reducer.** Nine decision kinds are TypeScript beside `readSong()`, the loudness cache and the accepted cover set. It reports how -many projects it only checked the routing of, and points at `/browse/decisions`. +many projects it only checked the routing of; `umtool inbox` and the Inbox have the rest. ## `window` goes through the same writer the bench does diff --git a/umtool/docs/clip-bench.md b/umtool/docs/clip-bench.md @@ -1,6 +1,6 @@ # The clip bench -`/browse/<project>/clip/<id>`. +`/projects/<project>/clip/<id>` — reached from the Cut tab's **Walk the cut** or a row's **bench →**. "How much context does this clip need" used to be a loop of hand-editing JSON, re-running two CLIs and watching an mp4. This is that loop in one place. @@ -77,7 +77,7 @@ was. See [report-video.md](report-video.md#where-the-bytes-come-from-the-editor- machine with no editor to ask. Same file naming, same format pin, same Rumble HLS retry, same NDJSON events. -**"Fetch N unfetched clips via the editor"**, above the cut on the project page, +**"Fetch N unfetched clips via the editor"**, above the rows on the Cut tab, closes the whole `ready N of M` gap in one press — the clips that need judgement with nothing cached holding them, one at a time, awaiting each before starting the next. Stop abandons rather than kills: the in-flight fetch is already paid @@ -203,7 +203,7 @@ anything is saved. The sixth field in that panel is not about this video at all. It records what the **report** got wrong about this clip — wrong speaker, wrong addressee, wrong date -— and nothing renders it. The project page collects every one under *corrections +— and nothing renders it. The Cut tab collects every one under *corrections for the next pass*, and `umtool corrections <project>` prints the same list as markdown with each clip's own moment link, ready to paste into the next sweep. @@ -231,8 +231,8 @@ before the edit. `p` and `n` (and the links in the header line) move to the previous and next clip **on the walk**, computed server-side. Reviewing a cut is watching nineteen -clips in a row, and going back to the project page between each one is nineteen -round trips to re-find your place. The project page starts the walk: one +clips in a row, and going back to the Cut tab between each one is nineteen +round trips to re-find your place. The Cut tab starts the walk: one **"Walk the cut → start at `<first clip on it>`"** button above the rows, because the per-row links are the right control for "go to that one" and the wrong one for "start". @@ -254,7 +254,7 @@ timeline order — so `p`, `n`, both header links, the start button and the jump A **URL still opens any clip**, judged or unfetched — the bench renders it, says *"nothing fetched for this clip yet"* and carries a **not fetched yet** pill, and its two links point at the fetched, unjudged neighbours either side. The -per-row link on the project page is that URL, so "go to that one" is unchanged. +per-row link on the Cut tab is that URL, so "go to that one" is unchanged. Both pages read **`ready N of M needing judgement`**: `M` is the clips with no verdict, `N` the ones among them that can be judged today. The gap between the @@ -383,7 +383,7 @@ somebody's judgement. ## Deliver — the half that starts when the walk ends The bench answers one question per clip. What a report owes its readers after -that is a different list, and it lives on the **project page** as `Deliver` +that is a different list, and it lives on the piece's **Deliver** tab (`components/projects/DeliverSection.tsx`, `/api/report/deliver`): | | | diff --git a/umtool/docs/dashboard.md b/umtool/docs/dashboard.md @@ -1,36 +0,0 @@ -# The dashboard (`/`) - -The front door. It used to be a doorway that put you back in the song pile you -last judged; it is a page now, and the song piles are one nav entry (`song ▸`) -at the URLs they always had. - -**Nothing on it shells out.** Every panel reads the index, the two in-memory -job registries, or a cache. The one probe on the page is behind a button. - -| panel | what it reads | where it goes | -|---|---|---| -| **now** | `runningActivity()` — whichever of the two job registries (`lib/jobs.ts` chain jobs, `lib/mix.ts` renders) is busy, merged in `lib/activity.ts`; step `n/of` and per-entry state from the build's NDJSON events. A client poll of `/api/jobs` every 2 s **only while something runs**. Under it, the newest finished jobs. | the project page, or `/mix` | -| **needs a decision** | `openDecisions()` — the same reducer as `/browse/decisions`; totals and the worst eight | `/browse/decisions` | -| **projects** | `listProjects()` + `decisionCounts()`; one row per kind, the six states as proportional segments. The header string comes from `lib/dashboard.ts`, shared with `/browse`, so the two cannot disagree. One meaningful colour: `stale` is `--color-dirty`; every other state is neutral. | `/browse?kind=&state=` | -| **sources** | each report project's summary attrs (`sources-checked-at`, `sources-dead`, `sources-missing`, `cue-gaps`), written by `lib/projects/report.mjs`: never checked / older than 30 d / with dead or missing sources. "Re-check" starts one `check-sources` job. | the project page | -| **deliverables** | `attrs["final-bytes"]` (a report's `out/<slug>.mp4` + `-full.mp4`; a song's shipped cuts) — built count, bytes, newest, stale | `/browse?state=built` | -| **tools & disk** | the doctor **cache** (`lib/doctor.ts`, ten minutes) or "not checked"; free bytes under `REPORTS_ROOT` via `statfs`; index health. The button `POST`s `/api/doctor`, which is the only place the app probes. Red only when the report pipeline needs a tool and it is absent. | — | -| **recent** | the six newest projects by `newestMtimeMs`, as the same cards `/browse` draws | the project page | -| **resume** | the last URL the recorder wrote (`components/LastPage.tsx`), HEAD-probed down to `/browse`, offered as a chip rather than navigated to | wherever you were | - -`?from=<channel>/<id>` opens the new-project menu prefilled — the editor's -"Open in umtool" link (`UMTOOL_URL`) lands here. - -## `/api/jobs` - -`GET` → `{ running, jobs }`, one shape over both registries, `no-store`. The -registries stay separate: their one-at-a-time rules differ (a chain is -process-wide exclusive; a render is one ffmpeg call). - -## `umtool doctor` - -The CLI form of the tools panel: `umtool doctor [--json]`, exit 1 if the -report pipeline is missing a tool it cannot run without (ffmpeg, ffprobe, -yt-dlp, qrencode). ImageMagick is probed as `magick` — every call in the -pipeline is IM7's `magick`, and a machine with only `convert` cannot build a -card, which the report says. diff --git a/umtool/docs/decisions.md b/umtool/docs/decisions.md @@ -1,107 +0,0 @@ -# Decisions - -One worklist, every project, every kind: `/browse/decisions`, or -`umtool decisions`. - -## Severity is EARNED - -| | | -|---|---| -| `blocking` | something downstream would **lie or die** if you acted on it | -| `open` | a real decision nobody has made | -| `info` | a true fact that is not a decision | - -An inbox that marks four missing cuts per song as blocking is an inbox nobody -opens twice. A song that never had a vertical is not waiting on you. - -## It is a REDUCER, and it must never measure - -Every call it makes is one a project page already makes. An inbox that shells out -to ffmpeg once per rendition, or to yt-dlp once per source, is an inbox that takes -a minute to open — which is the one thing it cannot afford to be. - -So loudness is read from the **cache**, and availability is read from whatever the -preflight last **wrote** (`out/availability.json`), never measured here. "Nobody -has ever run one" is itself something it can say. - -## The kinds - -Each registry entry owns its own vocabulary (`decisionKinds`), and the union is -assembled rather than hand-written — a closed union in one shared file would mean -every future kind editing it to say a word only it uses. - -**report-video** - -| kind | severity | trigger | -|---|---|---| -| `manifest-invalid` | blocking | missing or `localhost` `siteOrigin`, missing `channelSlug`, duplicate ids, `section` out of range | -| `clip-no-cues` | blocking | no `transcript.cues.json` — the build dies there | -| `clip-unfetchable` | blocking | the last preflight says the source is gone | -| `clip-mid-sentence` | open | the cut lands inside a cue that does not close a sentence, and `lockEnd` is unset | -| `window-overlap` | open/info | two clips from one source overlap | -| `no-punctuation` | info | a source's ASR has no terminators — one row per project | -| `clip-cue-gap` | open | the source's cue file **ends before a clip does** (`cues end 880 s · c03 needs 897 s`); one row per source, naming the clip that reaches furthest. The build does not die — it cuts from audio — but the tail has no words behind it; recover the transcript or shorten the window | -| `claim-unadjudicated` | blocking | a `ledger[]` entry missing any of the six adjudication fields | -| `claim-incoherent` | open | a fired coherence predicate, in plain words | -| `stale-build` | open | the output is older than the manifest | -| `unbuilt` | info | never built. A normal state, not a decision | - -`claim-unadjudicated` **earns** blocking: both the stated and the implied total -lie if you act on an unadjudicated ledger, and they lie quietly, in a chart, with -somebody's name on it. It is also the one kind that is deliberately **one row per -entry** rather than collapsed — fifty unpunctuated sources are the same true -thing said fifty times, but fifty unadjudicated claims are fifty *different* -decisions, and the inbox being empty is the sign-off. - -`claim-incoherent` is `open` rather than blocking because the decision is -**editorial**: is the flag right, and does it belong on screen? Neither answer -stops a build. - -Both come from `ledger-totals.mjs` in `report-to-video`, which is pure arithmetic -over JSON already parsed into memory — so the reducer stays a reducer. Audio is -fetched only when a claim page is opened, one claim at a time. - -**song** — the nine the existing reducer emits: `unjudged-variant`, -`missing-cut`, `no-recipe`, `stale-recipe`, `spec-problem`, `no-plan`, -`unattributed`, `thumb-unaccepted`, `loudness`. - -**routing**, kind-independent — `shadowed-name` (blocking), `unroutable-name` -(info), `ambiguous-project` (blocking). - -## Adding one - -Extend the kind's `decisionKinds` and emit it from its `decisions(ctx, summary)`. -Nothing outside `lib/projects/` needs to change. - -## What the CLI can and cannot do - -`umtool check` computes every report-video decision and every routing one, and -exits 1 on anything blocking — which is what makes it usable as a gate before a -build. It **cannot** compute the song reducer: that is TypeScript beside -`readSong()`, the loudness cache and the accepted cover set, and a second -implementation is the thing this design exists to avoid having two of. It says -how many projects it only checked the routing of. - -## Discovered by getting it wrong once - -**Forty true rows are worse than one.** The first real run emitted a -`no-punctuation` row per *source* — forty-odd across six projects, all correct, -burying two blocking rows off the top of the list. One per project now. - -**A reducer that says the opposite of the card next to it.** The first -adjudicated build shipped a rail tally reading "Spans everything **18**" directly -beside a card reading "He never said eighteen". The adjudication had set -`valueKind: "derived"` and nothing downstream was reading it: the tally still took -the latest value of any kind, and the ledger's `label` still said "the only -explicit sum in the corpus". A field that changes what something *means* has to be -chased through every renderer that prints it, and the only way this surfaced was -looking at a frame. - -**Do not assume where a project reads its cues from.** The first run confidently -reported three sources of `quartering-flagging-takedowns` as having no cue file. -They cite deleted YouTube uploads, are cut from live Rumble mirrors, and build -against a **shadow `CHANNELS_DIR`** the project's own `make-shadow-channels.sh` -writes. A project now says which directory it reads — `provenance.channelsDir`, or -the `.shadow-channels` convention that already existed — and neither is a guess: -both are things the project wrote down. When the builder is present but unrun, the -decision says to run it rather than declaring the sources gone. diff --git a/umtool/docs/e2e.md b/umtool/docs/e2e.md @@ -40,7 +40,7 @@ rendered over a deliverable would be indistinguishable from a person doing it. | `takes-fixture` | takes **write** `takes/verdicts.json` — two groups, a take with no preview, one skipped take.json, a work dir that is not a take | | `delete-fixture` | `article-delete.spec.ts` **deletes** a take of it, then the project (`e2e/fixtures/delete-fixture.mjs`, with the article `psi`; the spec writes its draft `omega` itself, since `articles.spec.ts` counts the store's rows) | | `bike-fixture` | the third kind | -| `find/` | shadowed by a tool page | +| `find/` | a project named like a tool (`find` was a static page under `/browse`; since P3 it is an ordinary project name, and `/projects/at?path=` stays the escape hatch) | | `deep/nested/solo-fixture` | a pass-through chain, for the collapse | **Three copies of one manifest is not duplication.** Sharing one project between diff --git a/umtool/docs/folders.md b/umtool/docs/folders.md @@ -114,7 +114,7 @@ Measured on the real tree: **12 projects in 25 ms**, and the 3.1 GB never touche A folder with no projects and exactly one child collapses **for display**: `quartering-uh-song / videos` is one heading. -**The URL is never collapsed.** `/browse/quartering-uh-song/videos/yoshi` stays +**The URL is never collapsed.** `/projects/quartering-uh-song/videos/yoshi` stays the one true address. A URL has to mean the same thing in six weeks, and a display convenience does not get to decide what a link is. diff --git a/umtool/docs/inbox.md b/umtool/docs/inbox.md @@ -0,0 +1,145 @@ +# The Inbox (`/`) + +## The page + +- **One card per piece and kind**: 483 unadjudicated claims on one video are ONE call. `umtool inbox [--all] [--json]` + prints the same list. +- **The big number** — the cards in Your call, Review, Blocking, Notes and Open on active pieces, plus the machine's + own calls ("N calls waiting on you"). Under it: rows · pieces ready to finish · quiet · hidden (`lib/inbox/headline.mjs`, + which the rail's count and the CLI also read). +- **One lit list** of the groups below. A card: piece · what, its why, the count in Meter, ONE action (an outline at + rest, filled Signal on the lit line), **Park**, **Mute** (**Not yet** on a looks-done card). j/k move the light. +- **Park** / **Mark done** / **Reactivate** write the piece's lifecycle; **Mute** / **Unmute** this kind of call on this + piece. Each shows "<Parked|Marked done|Reactivated|Muted|Unmuted> <title>" with **Undo** for 8 s. +- **Show hidden N** (`/?hidden=1`) lists the calls on parked and done pieces as a Hidden group, each with + **Reactivate**. **Muted N** (`/?muted=1`) lists the muted ones, each with **Unmute**. Hidden rows are never dropped: + every count but the cards still has them. +- **resume <url> →** offers the last page you were on (after its redirect), never navigates by itself. + +| Group | What lands there | Note on the page | +|---|---|---| +| **Your call** | research proposals, failed runs, a tick that failed or was held, a refresh held by the cap — money or work waiting on a yes | spend or failed runs | +| **Review** | an iteration ready, drafts to review, an edition ready, new recordings since the current report | | +| **Blocking** | a blocking decision on an active piece; a `notes.json` that does not read; the machine's calls (a required tool absent, under 5 GB free under the reports root → **Check tools** / **Open system**, `/settings/system`) | active pieces only | +| **Notes** | open operator notes | | +| **Open** | an open decision the groups above do not take (a variant with no verdict, a video to link) | | +| **Ready to finish** | a piece that looks done (**Mark done**) | suggested, never automatic | +| **Quiet** | every `info` decision — facts, not calls; folded | N cards, facts rather than calls | + +A piece's page shows the same top card as its **Next** card ([piece.md](piece.md)). + +## Lifecycle and mutes + +| State | File | Effect | +|---|---|---| +| `active` / `parked` / `done` | `REPORTS_ROOT/.umtool/lifecycle.json`, keyed by piece id (`POST /api/pieces/lifecycle`) | a parked or done piece's calls are hidden (`hiddenBy: parked \| done`); Work's lifecycle facet; the piece's chip | +| muted (piece × decision kind) | `REPORTS_ROOT/.umtool/mutes.json` (`POST /api/pieces/mute`) | those rows are hidden (`hiddenBy: muted`); a parked or done piece's reason wins | + +Both files: one writer, temp + rename, an unreadable file never overwritten (409). "Looks done" only ever suggests: a +song with every cut, a final video plus a `share-*` batch, or a published article with its video. + +## Decisions + +Severity is EARNED: + +| | | +|---|---| +| `blocking` | something downstream would **lie or die** if you acted on it | +| `open` | a real decision nobody has made | +| `info` | a true fact that is not a decision (always Quiet) | + +**It is a reducer, and it must never measure.** Every call it makes is one a piece page already makes: loudness from the +cache, availability from what the preflight last wrote (`out/availability.json`). "Nobody has ever run one" is +itself something it can say. + +Each kind's card action names its result (`lib/inbox/groups.mjs`), and a project-wide call links the tab it is settled +on (`decisionTab`, `songTabOfSection`). + +**report-video** + +| kind | severity | trigger | action | +|---|---|---|---| +| `manifest-invalid` | blocking | missing or `localhost` `siteOrigin`, missing `channelSlug`, duplicate ids, `section` out of range | Fix the manifest | +| `clip-no-cues` | blocking | no `transcript.cues.json` — the build dies there | Fix the cue source | +| `clip-unfetchable` | blocking | the last preflight says the source is gone | Replace the source | +| `clip-mid-sentence` | open | the cut lands inside a cue that does not close a sentence, and `lockEnd` is unset | Trim to the sentence | +| `window-overlap` | open/info | two clips from one source overlap | Fix the windows | +| `no-punctuation` | info | a source's ASR has no terminators — one row per project | Check the windows | +| `clip-cue-gap` | open | the cue file ends before a clip does (`cues end 880 s · c03 needs 897 s`), one row per source | Fix the window | +| `claim-unadjudicated` | blocking | a `ledger[]` entry missing any of the six adjudication fields — one row per entry | Adjudicate claim | +| `claim-incoherent` | open | a fired coherence predicate, in plain words | Rule on the flag | +| `stale-build` | open | the output is older than the manifest (→ Build) | Rebuild the video | +| `unbuilt` | info | never built | Build the video | +| `storage-unreachable` | blocking | an `out/` or deliverables link whose drive is not there | Reconnect the media drive | +| `storage-mismatch` | open | a storage move that was cut, with the command that finishes it | Settle the storage | +| `clip-cut-outside` | blocking | a `cutStart`/`cutEnd` without its pair, under half a second, or outside its window | Fix the cut | + +**song** — `unjudged-variant` (Judge variant), `missing-cut` (Ship the cut), `no-recipe` / `stale-recipe` (Record the +recipe), `spec-problem` (Fix the spec), `no-plan` (Name the plan), `unattributed` (Attribute variant), +`thumb-unaccepted` (Accept a cover), `loudness` (Re-render at the target). A song-wide call opens its tab (Spec, Cuts, +Cover); a cut's opens the cut's page, at the song's full path. + +**articles, runs and schedules** (from disk, beside the reducers — `lib/inbox.ts`) + +| kind | group | action | +|---|---|---| +| `research-proposal` — a research run's acquisition waiting (`proposals.json`, status `proposed`) | Your call | Approve acquisition | +| `iteration-failed` — a failed run not superseded by a later live one; spend from its `usage` | Your call | Retry run | +| `tick-failed`, `tick-held` ([recurring.md](recurring.md)) | Your call | Tick now / Raise cap | +| `refresh-held` ([refresh.md](refresh.md)) | Your call | Refresh | +| `iteration-ready` — done, not current, newer than current | Review | Make i<n> current | +| `drafts-unreviewed` — drafted fields awaiting review (unreviewed, or edited since approved) | Review | Review drafts | +| `edition-ready` | Review | Review edition | +| `refresh-available` | Review | Refresh | +| `open-note` — an operator note (its href ends `note=<id>`) | Notes | Answer note | +| `unreadable-notes` | Blocking | Repair notes.json | +| `link-ambiguous` — a slug match no iteration or manifest settles | Open | Link the video | +| `looks-done` | Ready to finish | Mark done | + +**routing**, any kind — `shadowed-name` (blocking), `unroutable-name` (info), `ambiguous-project` (blocking) +([piece.md](piece.md#projects-kinds-ids-routing)). + +`claim-unadjudicated` earns blocking: both the stated and the implied total lie on an unadjudicated ledger, quietly, in +a chart, with somebody's name on it — and fifty unadjudicated claims are fifty different decisions, so the empty Inbox +is the sign-off. `claim-incoherent` is open: whether the flag is right, and belongs on screen, is editorial. + +**Adding a kind:** extend the project kind's `decisionKinds` and emit it from its `decisions(ctx, summary)`; nothing +outside `lib/projects/` changes. Give it a card action in `lib/inbox/groups.mjs` and its words in `lib/inbox/what.mjs`. + +## The API, `GET /api/browse/decisions` + +`items[]` is ONE ROW PER DECISION, never grouped and never dropped: the MCP reads it (`open-note` rows, `project` as the +notes target, `href` ending `note=<id>`; `lib/hrefs.ts` keeps `?note=` last). Each row carries `piece`, `category`, +`group`, `action {label, href}`, `lifecycle`, `muted`, `hidden`, `hiddenBy` — additive. Beside it: `counts` (by +severity), `groups` (the cards), `hidden`, `muted`. `?project=<song>` narrows to one song's reducer. `no-store`. + +`umtool decisions [--json]` prints the reducer's rows; `umtool check` computes every report-video and routing decision +and exits 1 on anything blocking (it cannot run the song reducer and says how many it only routed). + +## The Running list (the rail's foot) + +- umtool's own jobs (a chain, a render, an index rebuild, a storage move) and the editor's `GET /api/ops/jobs?active=1`: + generation first, then a research run's acquisitions and clip windows umtool asked for, then the rest; at most 5 + rows, the rest folded ("+ 2 running · 140 queued · 3 lanes"). The lane runners are never rows. +- A row: the kind in words, the target, queued ("queued · 1 ahead") or running, progress, a generation job's spend in + Meter. A sweep's row links its run page; another placed draft its article's Iterations tab; anything else the editor's + `/jobs`. The label says the day's API spend from the ledger ("$0.42 today"). +- Three sentences, never one: **Editor unreachable**, **Editor's WORKER_TOKEN not set**, **Nothing running** (and + **WORKER_TOKEN not set here**, **WORKER_TOKEN does not match the editor's**). +- Polled every 8 s while the tab is visible; a page never waits on the editor ("Asking the editor…"). + +## Discovered by getting it wrong once + +**Forty true rows are worse than one.** The first real run emitted a `no-punctuation` row per source — forty-odd, all +correct, burying two blocking rows. One per project now. + +**518 "blocking" was mostly one finished video.** 483 of them were `claim-unadjudicated` on `quartering-diet`. One card +per piece and kind, and a lifecycle that hides a done piece's calls, made the number mean something. + +**A reducer that says the opposite of the card next to it.** An adjudicated build shipped a rail tally reading "Spans +everything **18**" beside a card reading "He never said eighteen": `valueKind: "derived"` was set and nothing +downstream read it. A field that changes what something means has to be chased through every renderer that prints it. + +**Do not assume where a project reads its cues from.** A project says which directory it reads — +`provenance.channelsDir`, or the `.shadow-channels` convention — and when the builder is present but unrun, the +decision says to run it rather than declaring the sources gone. diff --git a/umtool/docs/index.md b/umtool/docs/index.md @@ -51,7 +51,7 @@ without the native module all take that path, and everything still works. It is deliberately almost invisible, so its health has to be surfaced on purpose: -- the footer note on `/browse` — `index: 9/11 fresh` +- the footer note on `/projects` — `index: 9/11 fresh`; Settings · system's Index panel - the `x-index` header on `/api/browse/projects` - `umtool index` — records, schema, when it was built - `umtool index --rebuild` / `--prune` / `--since <ms>` diff --git a/umtool/docs/mix-from-a-project.md b/umtool/docs/mix-from-a-project.md @@ -1,4 +1,4 @@ -# Reaching /mix from a project +# Reaching the mix bench from a project Six of seven projects used to resolve to `null` in the mix bench: `MEDIA_ROOTS` was the um-song subtree, so no report video's media was openable at all. @@ -6,7 +6,7 @@ was the um-song subtree, so no report video's media was openable at all. ## The link ``` -/mix?body=<absolute>&start=<s>&end=<s>&from=<projectId>&clip=<clipId> +/tools/mix?body=<absolute>&start=<s>&end=<s>&from=<projectId>&clip=<clipId> ``` - **`body` is absolute**, like the picker's own `<option value>`. That is what @@ -17,7 +17,7 @@ was the um-song subtree, so no report video's media was openable at all. resolver for what the first one already did. - A deliverable link carries no window: the whole thing is the point. -Resolved **server-side** in `app/mix/page.tsx`, which is why this needs no +Resolved **server-side** in `app/tools/mix/page.tsx`, which is why this needs no `useSearchParams` and no Suspense boundary — that page already ran on the server, it simply never read its own `searchParams`. @@ -52,7 +52,7 @@ fade, gain, duck — *are* adopted, because those are things learned about that pair. Arriving via a link does **not** write a session. A session is saved only on a -real render, so drive-by navigation cannot change what the next bare `/mix` visit +real render, so drive-by navigation cannot change what the next bare `/tools/mix` visit opens. ## Refuse, never clamp diff --git a/umtool/docs/notes.md b/umtool/docs/notes.md @@ -1,10 +1,16 @@ # Notes: the operator writes them in umtool, an agent acts on them -A note is a sentence or two the operator leaves on an **article** (one of the -homepage's, `/articles/<id>`, or a site's own page, `/sites/<site>/<report>`) or on -a **report-video project** (a timeline row, a -take, a moment in a rendered cut). It is saved where the agent that made the thing -can read it back, act on the right SOURCE file, and reply or resolve. +## Where they are written + +| On | Where in umtool | +|---|---| +| an article (the store's `/articles/<id>`, or a site's `/sites/<site>/<report>`) | the piece's **Article** tab: a passage, a section, a citation, the whole article ([piece.md](piece.md#reading-and-noting-the-article-tab)); a timed note on its video | +| a report-video project | the **Cut** tab's rows and the clip bench (`entry`), the takes bench (`take`), the **Build** tab's final video and a take's preview (`moment`), an edit to a generated manifest (`edit`) | +| a song | the song piece's **Notes** tab and the notes beside each cut and file (a song's own `notes.json`, not this store) | + +A note is saved where the agent that made the thing can read it back, act on the right SOURCE file, and reply or +resolve. Open notes are the Inbox's **Notes** group (`open-note`, **Answer note**; its link ends `note=<id>` and opens +the tab the note is drawn on). ```sh umtool notes --all --open # every notes file with an open note diff --git a/umtool/docs/piece.md b/umtool/docs/piece.md @@ -0,0 +1,233 @@ +# A piece + +## Ids and addresses + +An article plus the video project(s) made from it is ONE piece with one page; a project no article claims is a piece +too. Ids are namespaced (`lib/pieces/ids.mjs`); a bare `x/y` never parses. + +| Piece | Id | Page | +|---|---|---| +| a store article | `a:articles/<id>` | `/articles/<id>` | +| a site's report | `a:<site>/<report>` | `/sites/<site>/<report>` (the MCP's and the notes' address) | +| a project no article claims | `p:<project id>` | `/projects/<path>` | +| a research case | `c:<case>` | `/research/<case>` ([research.md](research.md)) | +| a recurring report's series | `s:<series>` | `/series/<id>` ([recurring.md](recurring.md)) | + +**Which article claims a project**, in order: an iteration's `projectDir` (with `current.video` choosing the Cut tab's +project), the manifest's `article` key, then a unique slug match in the article's workspace (only this raises +`link-ambiguous`). A `projectDir` outside `REPORTS_ROOT` is "not reachable here". **A claimed project's own address +lands on its article** (a 307: `/projects/<path>` with no view segment → the article's address, the same `?tab=`, a +`?note=`'s tab, `?project=` when it is not the Cut). The benches stay at the project's address. + +## The frame + +- **The head**: the trail, the title, the meta line (an article's status — **in the making**, **published**, **draft** — + dates, revisions), **Active ▾** / **Parked ▾** / **Done ▾** (Park, Mark done, Reactivate, with **Undo**), **⋯** (the + piece id and the kind's actions), the status line (`4 clips · 2 other · 0:12 · not built`). +- **Under it**: the stage stepper; "from the board <title>", "a video of <article>" or "an edition of <series>" when so; + a living report's cadence chip with **Pause schedule** / **Resume schedule** and **Tick now**; an article's **policy** + chip (preset, model, today's spend of the daily cap → `/settings/generation`). +- **The Next card** (Overview): the piece's top Inbox call — what, why, "then N more calls", and its ONE action, filled. + A parked or done piece's Next is **Reactivate**. "Nothing waiting on you" when nothing is. +- **Tabs** are `?tab=` (no tab is the Overview; a bad one is the Overview); counts in Meter. Only the tab on show is + read. +- **Keys** (not while typing, nor on a focused video, nor in a menu): `1`–`9` open the tabs, `n` runs the Next card's + action. + +### The stepper + +ONE rule (`lib/pieces/tabs.mjs` `pieceSteps`), read by the stepper, `data-piece-stage` and Work's stage facet alike: +the current step is the **furthest stage reached**; a skipped stage before it is to do with its reason ("no report +yet"); a stage that cannot apply is dimmed with its reason (a project no article claims has no Article stage); a piece +marked done has done every stage that applies. + +| Flow | Reached when | +|---|---| +| Research → Article → Video → Deliver | Research: iterations, or a board that seeded it · Article: a report · Video: a claimed project (or one not reachable here) · Deliver: looks done (a final video and a `share-*` batch, or published with its video) | +| Spec → Cuts → Done (a song) | Spec: a `spec.json` · Cuts: one cut built · Done: all four (the derived `shipped`) | + +## A report video (`/projects/<path>`, and an article's video tabs) + +| Tab | Holds | +|---|---| +| **Overview** | the Next card, the project's decisions, "This video" (cut, final video, channel, cited, enumerated), the article and its newest iterations, the research board, the README | +| **Cut** | **Walk the cut** (the filled action) → the clip bench; **Takes — N**; the timeline rows (drag or alt+↑/↓; each row's ⋯), **Fetch N unfetched clips via the editor**, show every quote (`?all=1`), corrections for the next pass | +| **Media** | every drafted field, below | +| **Build** | the build chain: a preset (preview, fast, final), **show the command**, **run**, **cancel** ([build.md](build.md)); the final video and **open in mix** | +| **Deliver** | cuts and share batches, the export formats, the podcast | +| **Sources** | every cited recording: cues, coverage, availability, **Re-check availability**; tag the cited videos (a tag, a scope, **tag N videos** / **untag N videos**) | +| **History** | revisions (snapshot, diff), provenance, notes (prose and sibling `.md`) | + +**⋯**: **Delete project**. `?note=<id>` opens the tab its anchor is drawn on (a row's or an edit's → Cut, a timed note +→ Build). A project-wide call links its tab (`stale-build` → Build, `no-punctuation` → Sources). + +### Media + +- ONE lit list of every drafted field, grouped by section (Cut, On-screen, Teaser, Flips, Threads, Narration, + YouTube; chips narrow it), each line its words, its **provenance** (the draft file, when, the model, "attempt 2 of 2 + chosen", refused attempts' rules, "repaired"), **Approve draft** / **Reject** with a note, the alternatives with + **Use this**. +- Each section's head: what it writes and **Draft with <model>** (force, entries, the job, the last run) — only on a + project an article iteration made ("Drafting is off: no article iteration made this project."; a running iteration: + "Drafting waits for <article> i<n>, which is <status>."). +- Above: the counts, **Review drafts — N** (the review bench), the Draft everything model and **Draft everything**, + **Approve all N**, the final gate's line. Then the On-screen panel and the YouTube text. +- Keys in the list: j/k light a field, `a` approves it, `r` rejects it (the cursor to its note first). +- "Awaiting review" is ONE count (`awaitingReview`): a field a model drafted whose verdict is not given on its current + value. The Inbox card, the tab's count, **Approve all** and the review bench read it. Verdicts are + `<project>/drafts.review.json`; a final build refuses an unapproved or rejected draft. + +### The benches + +One shell (`components/projects/bench/BenchShell.tsx`): a top bar (home, **← the piece**, the kind, **N of M**, ‹ prev / +next ›, the keys), the work, the **verdict bar** (the question, its consequence in bold, the actions; the first is the +filled one), the reader on the right. + +| Bench | Address | Keys | The bar | +|---|---|---|---| +| Clip ([clip-bench.md](clip-bench.md)) | `/projects/<p>/clip/<id>` | `y` confirm, `x` note, `[ ] , .` nudge, space play, `p` `n` walk | "Extend c04 to the end of the sentence?" → **Extend to m:ss** (or **Fetch to m:ss**), **Keep the cut here**; else "Is c04 what the report says it is?" — **Yes, confirmed**, **No, note what is wrong** | +| Claim ([claim-bench.md](claim-bench.md)) | `/projects/<p>/claim/<id>` | j/k cue | "Save the ruling on k01?" → **Save ruling**, **Next claim** | +| Narration | `/projects/<p>/narration` | j/k card, `a`, `r` | "Approve the narration of t1?" → **Approve**, **Reject with a note** | +| Takes | `/projects/<p>/takes` | `n` `p` listen, `l` `m` `x` | "Is <take> the take for <group>?" → **Like**, **Maybe**, **No** | +| Drafts review | `/projects/<p>/review` | j/k field, `a`, `r` | "Approve the drafted on-screen text of m01?" → **Approve draft**, **Reject with a note** | + +**Extend to …** saves at once; **Reset** (`R`) puts the window it replaced back. + +## An article (`/articles/<id>`, `/sites/<site>/<report>`) + +| Tab | Holds | +|---|---| +| **Overview** | the Next card; Iterations (newest five, **All iterations →**, the current report's question and scope) and the video's decisions; Article · N sections (**Read →**); Cut · i<n> (**Open the cut →**), other cuts, "Possible videos"; the board; the last **Refresh** ([refresh.md](refresh.md)) | +| **Article** | the reader with its notes (below); its switch **article** · **source** (`?tab=source`: workspace files, the slide lint) · **evidence**; the linked projects; "No report yet" for one in the making | +| **Iterations** | every iteration, below (a site's report has none) | +| **Cut** · **Media** · **Build** · **Deliver** · **Sources** · **History** | the claimed project's tabs, as above; "No video project yet" when there is none | + +**⋯**: **Refresh…**, **Delete article** (a store article; a published one offers **delete anyway**, which unpublishes +it first), and the video's **Delete project**; a living report's Edit cadence and Delete schedule. Addresses: +`?note=<id>` opens the Article tab on an article note (else the video's tab where it is drawn); `?rv=`, `?status=`, +`?ws=&rel=` open the Article tab; `?project=<id>` another cut the piece owns; `?refresh=1` the refresh plan. + +### Iterations + +An article made by a model is a series of **iterations** (`i1`, `i2`, …: common's `lib/report/iterations.ts`). +umtool **starts** them and never writes one: each is a `report-draft` job the EDITOR runs, asked over its ops API with +the shared `WORKER_TOKEN` (`lib/articles/generation.ts`). + +| On an iteration | What happens | +|---|---| +| **Use this iteration** | the article's `report.json` becomes its report (common's `makeCurrent`: locked, validated; the audience and the attached video kept) | +| **New iteration** → **Start iteration** | a `revise-report` or `revise-video` of it, from feedback, on a model | +| **Copy with model** | the same kind, base, question or feedback, on another model (an API sweep: its extractor too) | +| **Media drafts →** | the iteration's cut's Media tab | +| **Make the video** | the chain (`lib/report/chain.mjs`) as a umtool job: its steps, each one's status, **Run the chain** (resume, or from a step), **Cancel the chain** | +| **Cancel i<n>** | `job cancel` on its editor job | +| **Run** | the run page of a sweep ([research.md](research.md#agent-runs-researchruns-and-researchrunsarticlen)) | +| compare | tick two, then **Compare iN and iM** (`/articles/<id>/compare?a=&b=`: sections and findings side by side, ops applied and refused, failed checks, both cuts) | +| **Delete iN** | the plan, then **Confirm delete** (common's `deleteIteration` under the registry's lock). Refused: the current article or video, the iteration the report came from, a running one, one another revises or copies | +| **Refresh…** (the tab's head) | [refresh.md](refresh.md) | + +A `research` iteration carries its research queue: each acquisition with **Yes** / **No**, and **Continue into a sweep** +once nothing is pending (OPERATING.md, "Research runs"). The tab's head: the count, which is the article and the +video, the article's spend and the day's against the daily cap. + +### Reading and noting (the Article tab) + +The article in a ~70ch column, its notes in a rail (a drawer below 1100px); its video under the title takes timed notes +(`n` with the video focused, or **Mark**). + +| To note | Do | +|---|---| +| a passage | select it → **Note** (or `n`) | +| a section | **+ note** on its heading | +| a citation | click it → the evidence panel → **+ note on this citation** | +| the article | **+ whole article** | + +A passage note keeps its quote and 32 characters either side and is found again in the text as it is now (exact, then +normalised, then by its surviving context); one whose quote is gone is **orphaned**. Keys: j/k move, `r` resolves, `e` +edits, `n` notes, Escape closes. `?status=` and `?note=` open the rail on a filter or a note. **Copy agent brief** +copies `/api/notes/context` (the `umtool notes` digest; [notes.md](notes.md)). Open notes are `open-note` calls in the +Inbox. + +### Evidence + +A citation's panel: its quote, speaker, date, label and link; ±6 cues of its record, the cited ones marked (click to +seek); media, best first — the site's prepared clip, a clip window the editor fetched, a saved video or audio file, +else the `fetch_clip` line (umtool never runs yt-dlp for it). A post shows its text and capture. The walk +(`…/evidence?c=<id>`) is the same panel one citation at a time: j/k (or ←/→), space plays, `n` notes. + +**Add to video** (with a linked project) puts the cited span at the end of its timeline as a clip; the manifest is +snapshotted first, so the Cut tab's **Undo** takes it back, and a generated manifest gets an `edit` note. + +## A song (`/projects/<path>`) + +| Tab | Holds | +|---|---| +| **Overview** | the Next card, the song's decisions, the four cut slots (**All cuts →**), This song (cuts, variants, verdicts, plans, cover, looks done; **copy this song**), Song tools, the README | +| **Cuts** | the four cut cards (poster, verdicts, the slot's and the file's notes, variants), what matches no cut name | +| **Spec** | the spec sheet, the plans and their notes, `clips.csv` | +| **Cover** | the cover bench ("No cover generated for <id> yet" when none) | +| **Notes** | the note on the song; every other note, each linking the tab it is on | + +A cut's page, `/projects/<path>/<cut>`, is the Cuts tab's view of one cut (the four cuts beside the title; the cut +bench, loudness, provenance). **The canonical address is the full path**; a bare basename resolves when unique. +`?note=<target>` opens the tab it is written on: `song` → Notes; `cut:` `file:` `moment:` `source:` `clip:` → Cuts; +`plan:` → Spec; `thumb:` → Cover. The cut page keeps `?v=`, `?plan=`, `?notes=all`. + +## Projects: kinds, ids, routing + +A **project** is a directory under `REPORTS_ROOT` holding one piece of work; umtool finds them by walking the tree +([folders.md](folders.md)). A **kind** is what it is; a **template** is which configuration of that kind. + +| kind | template | marker | what it is | +|---|---|---|---| +| `report-video` | `cited-timeline` | `video.manifest.json` | a sweep report said in the sources' own voices | +| `song` | `um-song` | `spec.json`, `verdicts.json`, or any cut | filler sounds playing a game tune | +| `sweep-report` | `sweep` | a `*sweep*.md` and no manifest | a report that is not yet a video | + +- **Detection**: `project.json` (`{kind, template}`) wins; otherwise every kind's `detect()` runs on the entry NAMES. + Two matches is an `ambiguous-project` decision, never a guess. +- **An id is a PATH** relative to `REPORTS_ROOT` (`ferret-rescue`, `quartering-uh-song/videos/yoshi`), never the + basename. A bare basename resolves only when unique; two projects sharing it get a page listing both canonical paths. +- **`shadowed`** — the first segment is `at` (`RESERVED_BROWSE`, held equal to `app/projects/`'s static pages by an e2e + spec): listed with a blocking decision, opened at `/projects/at?path=…`. **`unroutable`** — the name fails + `isSegment()`: an info decision, opened the same way. +- **Delete project** (⋯; `POST /api/projects/delete`, `lib/report/delete.mjs`): the plan (the directory with its size + and biggest parts, and a media copy `umtool storage` linked), then **Confirm delete** or **Keep it**. Refused: a + link or a path through one, one a umtool job works in, an article's current video or a running iteration's project; a + manifest naming an article with a video attached needs **delete anyway**. Nothing outside `REPORTS_ROOT` and + `MEDIA_ROOT` is touched. + +**Adding a kind** — a registry entry and one view, nothing else: + +1. `lib/projects/kinds.mjs`: `id`, `template`, `label`, `badge`, `detect(names)`, `stages`, `decisionKinds`, and + optionally `summarise`, `signature`, `decisions`, `views`, `piece` (its stepper flow). +2. A component in `components/projects/` and a case in `ProjectView.tsx`. + +`e2e/projects.spec.ts` fails when a kind id is written outside `lib/projects/` and `components/projects/`, when +`RESERVED_BROWSE` drifts from the real static pages, and when a kind injected through `E2E_UMTOOL_EXTRA_KINDS` does not +reach the index, the chips and the CLI with no code edit. + +| File | What | +|---|---| +| `lib/projects/kinds.mjs` | the registry (plain ESM, server-only) | +| `lib/projects/walk.mjs` | the folder walk, routing, collapsing | +| `lib/projects/{report,song,sweep}.mjs` | per-kind reading | +| `lib/projects.ts` | the app's façade: caching, dispatch, the index, `resolveProjectPath` | +| `lib/pieces.ts`, `lib/pieces/*` | the piece graph, ids, the frame, the tabs and the stepper | +| `lib/project-types.ts` | types only, no `node:` import ever | + +## Discovered by getting it wrong once + +**`lib/projects/kinds.mjs` is server-only**, despite being plain ESM: it imports the per-kind modules and those read +the disk, so a client component importing it drags `node:fs` into the browser bundle. It passed `tsc` and 500'd every +page. A client component takes `lib/project-types.ts`. `pnpm build`, not typecheck, catches it. + +**Watch the import cycle.** `songIds()` lives in `lib/projects/song-ids.mjs` because in `song.mjs` it closes `song → +walk → kinds → song`; Turbopack then evaluates `kinds.mjs` mid-initialisation and every song page 500s with "Cannot +access 'CUT_NAMES' before initialization". Nothing prerenders, so a build does not see it; a page render does. + +**Do not write a root path out by hand.** The song-decision dispatch had the production path hard-coded, so under the +e2e fixture no song decisions were produced at all and the Inbox looked clean because it was empty. + +**Caches live on `globalThis`.** A module-level cache is one copy per Next bundle, so an API route's invalidation never +reached the page rendered next (a new project 404'd; a deleted piece stayed on Work for 15 s). diff --git a/umtool/docs/projects.md b/umtool/docs/projects.md @@ -1,129 +0,0 @@ -# Projects - -A **project** is a directory under `REPORTS_ROOT` that holds one piece of work. -umtool finds them by walking the tree; nothing registers itself and nothing had -to move on disk for this to exist. - -## Kind vs template - -A **kind** is what a thing *is*. A **template** is which configuration of that -kind it is. `um-song` is not a kind — it is the one template of the `song` kind -that exists so far, and the distinction is the whole point: the next thing this -tool has to hold (a supercut, a cover set, a vertical short) will be a new -template of an existing kind at least as often as a new kind. - -Three kinds ship: - -| kind | template | marker | what it is | -|---|---|---|---| -| `report-video` | `cited-timeline` | `video.manifest.json` | a sweep report said in the sources' own voices | -| `song` | `um-song` | `spec.json`, `verdicts.json`, or any cut | filler sounds playing a game tune | -| `sweep-report` | `sweep` | a `*sweep*.md` **and no manifest** | a report that is not yet a video | - -`sweep-report` earns its place on day one because `~/reports/hasan-bike` is one, -and because a kind with no decisions, no build and no rich read is the cheapest -possible proof that the registry is extensible. - -## Detection - -`project.json` (`{kind, template}`) wins outright, so a directory can always -declare itself. Otherwise every kind's `detect()` runs against the directory's -entry NAMES — no reads, no stats. - -**Two matches is an error, never a guess.** A directory that is two kinds is a -bug, and picking one would hide it; it gets an `ambiguous-project` decision -instead. - -## Identity: an id is a PATH - -A project's id is its POSIX path relative to `REPORTS_ROOT` — -`ferret-rescue`, or `quartering-uh-song/videos/yoshi`. Not the basename: bare -names collide across folders (a second `pokemon` is a matter of time) and the -path is what makes a link stable. - -A **bare basename still works as a URL**, because `/browse/yoshi` and -`/browse/yoshi/wide` are the addresses that exist in every decision href, every -spec, and whatever anybody has open. It resolves **only when unique** — two -projects sharing a name is precisely why an id is a path, so that case reports -the collision and offers both canonical URLs rather than picking one. - -## Two ways a project cannot be opened - -Both used to fail **silently**, which is worse than either. - -**`shadowed`** — the first path segment is a static page under `app/browse/` -(`decisions`, `faces`, `find`, `sources`, `trim`, `at`). A static segment beats a -dynamic one, so `/browse/find` renders the phrase console no matter what is on -disk. The project is still listed, with a `blocking` decision, and its link goes -to `/browse/at?path=…`. - -**`unroutable`** — the name fails `isSegment()` (a space is enough). It has no -address of its own; it is listed with an `info` decision and reached the same way. - -`RESERVED_BROWSE` is asserted by an e2e spec to equal the real directory listing -of `app/browse/`, so a tenth tool page cannot quietly make a project unreachable. - -## Deleting a project - -**Delete project** on a report-video project's page (`POST /api/projects/delete`, -`lib/report/delete.mjs`) is the "new project" door's other half. It shows the -plan first — the directory with its size and its biggest parts, and, for an -`out/`, `clips/` or `share-*` that `umtool storage` linked to the media root, -that media copy — and removes it on **Confirm delete**. Refused: a project that -is a link or is reached through one, one a umtool job is working in, an -article's current video (an iteration project `current.json` names) or a running -iteration's project. A project whose manifest names an article with a video -attached needs **delete anyway** (the article keeps its attached copy). Any -other link is removed as a link; its target is kept and named. Nothing outside -`REPORTS_ROOT` and `MEDIA_ROOT` is touched, and neither root itself. - - -**A registry entry and one view. Nothing else.** - -1. Add an entry to `lib/projects/kinds.mjs`: `id`, `template`, `label`, `badge`, - `detect(names)`, `stages`, `decisionKinds`, and optionally `summarise`, - `signature`, `decisions`, `views`. -2. Add a component to `components/projects/` and a case in `ProjectView.tsx`. - -`e2e/projects.spec.ts` enforces this three ways, and they are the assertions that -fail when somebody special-cases a kind in a page — which no page test can see: - -- **no kind id is special-cased outside `lib/projects/` and - `components/projects/`** — a grep for lines carrying both a kind id and the - word `kind`; -- **`RESERVED_BROWSE` equals the real static pages**; -- **a kind injected through `E2E_UMTOOL_EXTRA_KINDS` reaches the index, the chips and - the CLI with no code edit at all**. - -## Where the code is - -| file | what | -|---|---| -| `lib/projects/kinds.mjs` | the registry. Plain ESM, no TypeScript | -| `lib/projects/walk.mjs` | the folder walk, routing, collapsing | -| `lib/projects/{report,song,sweep}.mjs` | per-kind reading | -| `lib/projects/core.mjs` | the CLI's assembled view | -| `lib/projects.ts` | the app's façade: caching, dispatch, the index | -| `lib/report/delete.mjs` | deleting a project or a take: the plan, then the delete | -| `lib/project-types.ts` | types only, **no `node:` import ever** | - -## Discovered by getting it wrong once - -**`lib/projects/kinds.mjs` is server-only**, despite being plain ESM. It imports -the per-kind modules and those read the disk, so importing it from a client -component drags `node:fs` into the browser bundle — which this repo has already -been bitten by: it passed `tsc --noEmit` and then 500'd every page. A client -component takes `lib/project-types.ts` and gets the rest as props. **`pnpm build`, -not typecheck, is what catches a regression here.** - -**Watch the import cycle.** `songIds()` lives in its own module -(`lib/projects/song-ids.mjs`) because putting it in `song.mjs` closes -`song → walk → kinds → song`. Plain node survives that; Turbopack evaluates -`kinds.mjs` while `song.mjs` is still initialising and every song page 500s with -"Cannot access 'CUT_NAMES' before initialization". `pnpm build` does not see it -either — nothing prerenders. A page render does. - -**Do not write a root path out by hand.** The song-decision dispatch had the -production path hard-coded, so under the e2e fixture — whose songs live elsewhere -— *no song decisions were produced at all* and the inbox looked clean because it -was empty. diff --git a/umtool/docs/recurring.md b/umtool/docs/recurring.md @@ -0,0 +1,71 @@ +# Recurring reports + +## Two shapes + +The same topic, updated at an interval. The EDITOR keeps the schedule and runs the ticks (its `report-schedule` lane, +armed at boot unless `ARCHILYZER_IDLE_BOOT`); umtool shows and edits a schedule and never runs a timer. + +| Shape | What each tick does | +|---|---| +| **Living report** | One article kept current: a [refresh](refresh.md) (its own fetch, then what changed, then the update). The result is an iteration-ready card; "Make each update current without review" makes it current (default off). The first tick, with no report yet, is the article's first sweep. | +| **Series** | A new dated **edition** over whole days since the last: the day after the previous edition's end through the day before the tick (weekly on Mon 06:00 covers Mon … Sun before it). Fetch over the window's channels and dates, then a sweep with from/to. A window nothing matches is a quiet edition: recorded, no article, $0. A tick with nothing to cover yet makes no edition. | + +## Make one + +**+ Create** → **A recurring report** (`/create?make=recurring`), or ⌘K "New recurring report": + +1. **Living report** or **Series**; topic; question; scope — channels, or a board's (its channels, its date floor, its + query as the window check); cadence (**Daily**, **Weekly** on a day, **Every N days** at HH:MM, in the editor's + zone); a series' window check, or a living report's "Make each update current without review". +2. **Plan the schedule** — the editor's dry run: the first tick, the model, the per-tick cap, the daily cap, a series' + first window and title, what is worth knowing. **Change it** goes back to the form. +3. **Start the schedule** — writes it and opens the series page or the article. + +```sh +pnpm ops report-schedule --json '{"action":"create","shape":"series","topic":"Co-host updates","channels":["<slug>"],"cadence":"weekly mon 06:00","dryRun":true}' +pnpm ops report-schedule --json '{"action":"list"}' +pnpm ops report-schedule --json '{"action":"tick-now","id":"<id>"}' --wait +umtool schedule list | show <id> [--json] # read-only +``` + +## The series page, `/series/<id>` (piece `s:<id>`) + +- The cadence chip ("weekly · next Mon 06:00", "· paused"), **Pause schedule** / **Resume schedule**, **Tick now**, + **Edit cadence** (→ **Save cadence**), **Delete schedule** (the plan, then **Confirm delete** or **Keep it**; the + editions stay as articles). +- The tick in flight, as a job. +- The editions, newest first: a done one links its article; a quiet one is dimmed, with its window and why. +- The tick log: when, how (schedule or Tick now), status, edition, spend, why. +- What it asks: question, channels, board, window check, cadence and zone, model and cap. + +A living report's `/series/<article>` redirects to its article, whose head carries the same chip with Pause / Resume and +Tick now, and Edit cadence and Delete schedule in its **⋯** menu. An edition's head says "an edition of <series>". + +## Where it shows + +- **Work**: the **Recurring** facet (`/work?recurring=1`), the Series kind, the chip under a row's id. An edition is + not a Work row; its series is. +- **Inbox**: `tick-failed` (Your call, **Tick now**), `tick-held` (Your call, **Raise cap** → `/settings/generation`, + "up to $x a tick"), `edition-ready` (Review, **Review edition** → the edition's iterations). An edition raises no + iteration card of its own. +- **Running**: a `report-tick` is a generation row with its spend, linking the schedule. + +## Rules + +- **The lane's pause** is `settings.reportSchedule.held` (`pnpm ops lane {"lane":"report-schedule","held":true}`, or the + editor's pause): it stops new ticks; one in flight finishes. **Tick now** is the operator's word: not held by the + lane, still within the caps. +- **One tick at a time** machine-wide (queue `report-tick`), never two of one schedule. A missed window is ONE catch-up + tick (`missed` counts the rest). A resume or a new cadence re-plans from now. +- **No day is read twice.** A held or refused edition leaves no line; the next tick covers its window. +- A step refused or skipped in the fetch (a held or cooling platform, a channel no build holds) is a warning on the + tick, never its failure; a build that ran and failed fails it. + +## Where it is stored + +Written by the editor only, through `controller/reportSchedule.ts`: + +| Shape | File | +|---|---| +| Living | `transcripts/reports/<article>/schedule.json`, beside the article | +| Series | `transcripts/reports/.series/<id>/series.json`, its editions listed in it; each edition the store article `<series>-<YYYY-MM-DD>` | diff --git a/umtool/docs/refresh.md b/umtool/docs/refresh.md @@ -0,0 +1,81 @@ +# Refresh: fetch what is new, check it, update + +## What it is + +A **refresh** is an iteration of an article (kind `refresh`, its parent the iteration refreshed). It is ONE editor job, +`report-draft {"task":"refresh"}` on the queue `draft:refresh`. umtool plans it, confirms it, shows what it found and +suggests it; the editor runs it. + +```sh +umtool refresh <article> [--iteration N] [--no-fetch] [--yes] [--json] # the plan; --yes starts it +umtool refresh --check [<article>] [--force] # the daily check, now +pnpm ops report-draft --json '{"task":"refresh","article":"<id>","dryRun":true}' +pnpm ops report-draft --json '{"task":"refresh","article":"<id>"}' --wait +``` + +## Where + +| Surface | What | +|---|---| +| the article piece's **⋯** → **Refresh…** | opens the plan | +| the Iterations tab's **Refresh…** | the same plan | +| `?refresh=1` on the article's address | the same plan; the Next card's and the Inbox card's **Refresh** link here | +| the Overview's **Refresh · i<n>** card | the last refresh: its state, line, new recordings, changed quotes, sources gone, fetches and build, spend; **Review in Iterations →** once it has a report | +| the Iterations tab | a refresh's line on its card | + +## The plan, then Refresh + +The dialog says, before anything runs: + +- **Refreshes** — the iteration (i<n>, kind, made, the question). +- **Searched again** — the queries, the match set then, the quotes read again. +- **Fetch** — each channel's actions (`sync`, `refresh-report`, `transcribe-bucket`, `fetch-posts`), or "skipped — <why>" + (a platform held or cooling down). +- **Build** — the site whose build holds the channels: "locally, if anything changed — never deployed". +- **Update** — model, extractor, "spends up to $X", the rate, today's spend. +- Refusals and warnings (an older parent: "changed recordings are not tracked before <date>"). + +**Refresh** starts it ("Refresh i<n> is running (job …)"); **Cancel** closes it with nothing written. + +## The three stages + +1. **Fetch (no model).** The report's scope plus every channel its citations touch: the editor's own paced `sync` per + video channel, `refresh-report` and `transcribe-bucket` for ONLY what landed, `fetch-posts` per posts channel, then + a local `publish build` of the site holding them (through the publish lock; never a deploy). Each step is waited + for, up to 6 h, then read as it is. +2. **What changed (no model).** The original enumeration again with the iteration's recorded terms and scope: **new** + recordings (ids not matched before, late transcripts included), **changed** ones (matching lines moved), and every + cited quote re-read on today's transcript (moved, drifted, missing; deleted or private on the platform; `en` vs + `en-orig`). Written as the iteration's `refresh.json`. **Nothing changed → the iteration ends "no change", $0.** +3. **Update (model).** Runs on its own when stage 2 found anything, within the caps: a sweep restricted to the new and + changed ids (the sweep's `ids` restriction), then a revision of the parent with those findings and the drift fixes. + A cap refusal ends `held-by-cap` with the estimate. The result is an **iteration-ready** card; making it current + stays yours (**Use this iteration**). + +`refresh.json` `status`: `running`, `no-change`, `updated`, `held-by-cap`, `failed`, `cancelled`. The iteration ends +`done` whatever the refresh's status; only a failed revision or a cancel fails it. + +## The daily check and its cards + +Once a UTC day per active store article with a current report (parked, done and muted skipped), umtool re-runs +stage 2's enumeration alone — no fetch, no model, at most 12 queries — over the build the iteration read when it is on +this machine and holds every channel of the scope, else Research's local corpus when that does. Neither: the entry is +`unchecked` with the reason, never "0 new". Kept in `REPORTS_ROOT/.umtool/refresh-check.json`; checked in the +background in the app's server only (`UMTOOL_REFRESH_CHECK=0` turns it off; the e2e server does). + +| Card | Group | Action | +|---|---|---| +| `refresh-available` — "3 new recordings mention this since <date>" | Review | **Refresh** | +| `refresh-held` — the newest refresh held by the cap | Your call | **Refresh** | + +A card goes when a refresh made after the check exists or one is running. + +## Code + +| Module | What | +|---|---| +| `common/lib/report/draft/refresh/` | `refresh.json` (`types.ts`), the basis (`basis.ts`), the delta (`delta.ts`), stage 1 (`fetch.ts`), the task (`task.ts`) | +| `common/controller/reportRefresh.ts` | the editor's side: the target iteration, the plan, the enqueue, `fetchScope` (stage 1 for any scope; R5's ticks call it) | +| `umtool/lib/articles/refresh.ts` | plan, start, read; `GET/POST /api/articles/refresh` | +| `umtool/lib/inbox/refresh.ts` | the daily check and the two cards; `POST /api/articles/refresh/check` | +| `umtool/components/articles/Refresh{Dialog,Summary,Watch}.tsx` | the dialog, the Overview's card, its 4 s re-read while running | diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -119,7 +119,7 @@ Destiny, on a call. It is deliberately not a decision in the inbox: the fix belongs to the next sweep, not to this manifest, and nothing here can close it. `correctionsOf()` is -the one definition; the project page lists it and `umtool corrections <project>` +the one definition; the Cut tab lists it and `umtool corrections <project>` prints the same list as markdown with the QR's own moment link per bullet, ready to paste into the next prompt. @@ -181,7 +181,7 @@ is somebody checking that claim against the audio. **The note is not always a complaint.** On a confirmed clip `correction` says why a good clip's window moved, or something a reader should know; on an incorrect one it says what the report got wrong. `umtool corrections` and the -project page split on the *verdict*, not on "has text", so the next pass is +Cut tab split on the *verdict*, not on "has text", so the next pass is never sent to fix a clip nobody complained about. **An incorrect verdict with no note is a complaint nobody can act on**, so the @@ -204,7 +204,7 @@ the explicit value, so those entries can still be cleared — a rule that refuse to let somebody undo a note they wrote before the rule existed would be a trap. `reviewOf()` is the one definition of coverage — the bench header's -`N reviewed`, the project page's "Walk the cut" button and `umtool corrections +`N reviewed`, the Cut tab's **Walk the cut** and `umtool corrections <project>` all read it, and `walkReadiness()` reads the same verdict rule to decide what the walk VISITS (unjudged and fetched — see [clip-bench.md](clip-bench.md#what-the-walk-skips)), and the last opens with @@ -573,7 +573,7 @@ predicate: a large rise or fall between claims — fluctuation is usually the A seventh **optional** field, `roles`, records who he named when he enumerated rather than counted. It is not part of the gate — see [claim-bench.md](claim-bench.md). -Rule on them at [`/browse/<project>/claim/<id>`](claim-bench.md). +Rule on them at [`/projects/<project>/claim/<id>`](claim-bench.md). ## One manifest, two cuts @@ -666,8 +666,8 @@ end against the latest clip end, so a clip past the transcript's end reads as availability from `out/availability.json` with its age, or "never checked"; and the cite target — derived `${siteOrigin}/?v=…` or the per-clip `citeUrl` override, marked as such when it differs (every clip in one real manifest -carries a `citeUrl`; only the Rumble ones point elsewhere). The project page, -`umtool show` and the dashboard's Sources panel all read this one function. +carries a `citeUrl`; only the Rumble ones point elsewhere). The Sources tab, +`umtool show` and Settings · system's Sources panel all read this one function. Nothing in it probes. ## Revisions, instead of `.bak` @@ -685,7 +685,7 @@ labelled `built-<file>`, so the file and its description stay paired. ## Notes have a home -`README.md` renders at the top of the project page. Provenance splits by +`README.md` renders on the Overview tab. Provenance (the History tab) splits by shape: scalars and URLs stay in the table; any string over ~120 characters or containing a newline (`coverage`, `transcriptGapNote`, `qrNote`, `revisionNote`, `asrCaveat`, …) reads as a titled paragraph under **Notes**. Other `*.md` files @@ -694,7 +694,8 @@ there too. No field is moved or rewritten. ## Takes: alternative renders, judged side by side -`/browse/<project>/takes`, linked from the project page when `takes/` exists. +`/projects/<project>/takes` (a bench: [piece.md](piece.md#the-benches)), linked from the Cut tab as **Takes — N** +when `takes/` exists. Something else renders the takes; umtool reads them and records the verdicts. ``` @@ -727,10 +728,10 @@ gone shows as missing. Notes on a project live in `<project>/notes.json` (shape and CLI: [notes.md](notes.md)): **row notes** on a timeline entry (`entry` anchor, an open -count per row on the project page and in the clip bench), **take notes**, **timed +count per row on the Cut tab and in the clip bench), **take notes**, **timed notes** and **edit notes**. -**Timed notes.** On the built cut (On-screen → the built video), on every take +**Timed notes.** On the built cut (the Build tab's final video), on every take preview and on an article's report video: `n` with the video focused, or Mark, writes a note at the playhead, and the tick strip under the player seeks. On a project the second is resolved against the build's `schedule.json` (the @@ -743,8 +744,8 @@ a mark is exact when the lengths match within 0.25 s and `approx` when they differ, when the schedule is estimated, or when the second is a held frame past the clip's source. `lib/report/moments.mjs`, `GET /api/report/moment`. -**Generated manifests.** A manifest with `generatedBy` shows one line on the -project page, the clip bench and the On-screen section: "Generated by +**Generated manifests.** A manifest with `generatedBy` shows one line on every +tab of its piece, the clip bench and the On-screen section: "Generated by `<generatedBy>`; a rebuild of manifests overwrites edits made here." Edits are still allowed. Every manifest writer ROUTE goes through `withEditNotes` (`lib/report/guard.ts`), which diffs the manifest before and after and records @@ -756,12 +757,12 @@ tool and is not wrapped. ## Structural edits -The project page's timeline re-orders by drag or alt+↑/↓; each row's ⋯ menu +The Cut tab's timeline re-orders by drag or alt+↑/↓; each row's ⋯ menu duplicates it, removes it, or inserts a clip after it -(`<channel>/<video>@<start>-<end>`). The On-screen section edits a teaser's lines, +(`<channel>/<video>@<start>-<end>`). The On-screen section (the Media tab) edits a teaser's lines, beat, tail, tail wait and dip; the posts (add, edit, remove); and each verdict's label and colour and the stamp seconds. An article's citation can be added to the -end of a linked project's timeline ("Add to video", [sites.md](sites.md)). +end of a linked project's timeline ("Add to video", [piece.md](piece.md#evidence)). All of it is `POST /api/report/timeline` (`move`, `remove`, `duplicate`, `insert`, `teaser`, `post`, `post-remove`, `factcheck`, `undo`; `GET` gives the token), with @@ -782,7 +783,7 @@ byte-identical. ## Exports `umtool export <project> --format toc-bbcode|toc-markdown|description|chapters` -and the Export row on the project page (one copy button per format, per +and the Deliver tab's export row (one copy button per format, per variant with anything on disk). All derived from the manifest plus the build's offsets — `out/<variant>/chapters.ffmeta` when present, else `segmentOffsets()` over the segments, else a refusal with the reason. `toc-bbcode` reproduces the @@ -809,23 +810,24 @@ and `WORKER_TOKEN` as a clip fetch, from the server's environment) and keeps eac sound in `out/narration/`. The README's "Narration" section has the shape, the rules and the validator. -**The narration review** — `/browse/<project>/narration`, linked from the -project page as **Narration — N** — is the script card by card before synthesis: -the words beside what the card shows, who drafted them, Approve / Reject (a note -required) / Save words / Play. `GET|POST /api/report/narration`, +**The narration review** — `/projects/<project>/narration`, a bench linked from the +Media tab's narration section — is the script card by card before synthesis: +the words beside what the card shows, who drafted them, **Approve** / **Reject with a +note** (`a` / `r`, the verdict bar on the card in hand) / **Save words** / **play**. `GET|POST /api/report/narration`, `POST /api/report/narration/play` (a job: `narrate-via-editor.mjs --only`), `GET /api/report/narration/audio`. Once a narration verdict exists, a build refuses any hand-written narrated card not approved on its current words (`--narration-unreviewed` builds unreviewed and edited ones; a rejected one never). -**The drafts review** (release 28) — `/browse/<project>/review`, linked as -**Review drafts — N** when a draft task wrote a field — lists every drafted -field (on-screen text, a narration, a teaser's lines, the cut's order, the -flips, the threads, the YouTube text): who drafted it, its value, Approve / -Reject (a note required), and the alternatives a task kept for a field that is -the operator's, each with **Use this**. The same badge sits beside the field in -the On-screen table, the teaser editor and on the narration page. Verdicts — +**The drafts review** (release 28; P4b made it the Media tab and a bench) — the +Media tab lists every drafted field (on-screen text, a narration, a teaser's lines, +the cut's order, the flips, the threads, the YouTube text): its provenance, its +value, **Approve draft** / **Reject** (a note required), and the alternatives a +task kept for a field that is the operator's, each with **Use this**; +`/projects/<project>/review` (**Review drafts — N**) walks the same fields one at a +time ([piece.md](piece.md#media)). The same badge sits beside the field in the +On-screen table, the teaser editor and on the narration bench. Verdicts — the narration's included — live in `drafts.review.json` beside the manifest (release 25's `narration.review.json` is still read); `GET|POST /api/report/drafts`. A final build refuses a drafted field not approved on its @@ -837,6 +839,6 @@ the operator's: its mark goes. The README's "The drafts review" has the rules. `check-sources` is one `check-availability.mjs --allow-missing` step per selected project — the driver's step 1, reused — through `startJob`, so it -serialises with builds and is cancellable. The dashboard's Sources panel starts -it over the never-checked and older-than-30-day projects; the project page over -one; `umtool check-sources` prints the chain. +serialises with builds and is cancellable. Settings · system's Sources panel starts +it over the never-checked and older-than-30-day projects; a project's Sources tab +over one; `umtool check-sources` prints the chain. diff --git a/umtool/docs/research.md b/umtool/docs/research.md @@ -0,0 +1,109 @@ +# Research + +## The sources + +Read-only on the corpus, over the MCP's own engine (`createCorpusTools`, `yt-dlp-transcript-mcp/research`), with its +caps. The **Source** chip offers: + +| Source | From | +|---|---| +| local | `TRANSCRIPT_LOCAL_DIR`, else `EXPORT_PUBLIC_DIR`, else `<repo>/export/public` (whichever site was composed last) | +| `remote:<site>` | every `transcripts/sites/*/site.json` with a `siteUrl` | +| the hub | `TRANSCRIPT_HUB_URL`, else `settings.json` `homepageUrl` | + +Held counts (what the archive has on disk) are the editor's `GET /api/ops/coverage`; without `WORKER_TOKEN`, an editor +that does not answer, a 503 or a 401 each say which, and the local corpus falls back to reading `CHANNELS_DIR`. + +## Search, `/research` + +- **The ask bar** (`/` focuses it): a phrase, `/regex/`, or `a near:8 b` (a regex within one caption line — there is + no `near` in the engine). **Search** ↵. **Board:** chooses where **Pin to board** goes (`?case=`; "ask on pin", an + open case, or **New case…**). +- **Scope chips**: Source, channels, dates, platform state, Videos and streams / Videos only / Streams only, **+ Posts**. + Before anything runs the holds line says what the scope holds: "holds 3 channels · 2,140 videos · 2019–2026 · + transcripts 81% · captions 19%". Transcripts vs captions is known only for channels a search has read whole ("counted + by the first full search" until then); the count is kept per source build under `.umtool/research/census/`. +- **One search reads the whole scope once** (`enumerate_matches`) and never pages. The header is honest: "412 + recordings · full coverage", or "Partial — not reached: X, Y"; lines, pages, mirrors folded, aliases, "showing n of N", + **read x of N**. **Show 200 more** draws more of what was found; it never searches again. +- **Results**: ONE lit list grouped by recording — timecode, the match marked, the read state, the cite thread on the lit + line. **Facets** (year histogram with zeros, channel, transcript/captions, state, reading) narrow what is drawn. +- **The reader** (right): the window with the cited cue lit and centred, **−** / **+** span, **Pin to board** (the one + filled action), **Copy citation** (the house format: `"quote" [title @ m:ss](url)`), **Play from m:ss** when a local + file covers it, else **Fetch clip** (the editor's fetch-window route, as the MCP's `fetch_clip`; "The editor is + fetching it (job …)"). +- **Keys**: j/k line, `r` read, `s` skip (both move to the next recording), `u` unread, `c` copy citation, `p` pin, `/` + ask. The query and scope are the URL; a `?q=` link runs on arrival. +- **The reading log** — read, skipped or unread per hit — is `REPORTS_ROOT/.umtool/research/sessions/<16 hex>.json`, + keyed by query + scope. +- **Cases**: before a search the page lists every case (title, quotes · sections · drifted, updated). Header links: + **Agent runs**, **Archive inventory**. +- A Candace hit (`candace-owens`, `realcandaceo`) is marked local only; a board holding one is refused an article. + +## A board, `/research/<case>` (piece `c:<case>`) + +A case is a question being researched: its scope, the quotes pinned as **snapshots**, their sections and order, a +claim line and note on each. + +- **A pin is a snapshot**: the words at the cite, read by the server at pin time, and the cite (source, channel, + recording, title, date, cue span, track, the moment link, the house citation, local-only). The same cite twice answers + the quote already there. +- **The page**: **Re-verify quotes** (`v`), **Copy as cited markdown** (`c`), **Download .md**; ONE lit list of + section heads and quote slips (the words on the reader surface; **Claim** and **note:** edited in place; flags + **Speaker not checked**, **Drifted** with the words there now and **Use the current words**, **Missing**, **en-orig + differs**, **by agent**); on the lit quote its section select, **Mark speaker checked**, **Remove**. A quote drags by its + grip. +- **Side panel**: **Hand off** (below), Scope, Searched, Read N of M, Stored, Piece, From run, **Search and pin more** + (`/`), **+ Section** (`a`), Notes, Made from it. +- **Keys**: j/k, alt+j / alt+k move the lit quote (or section), `e` claim, `n` note, `s` speaker, `m` section, `a` add + section, `r` rename (the lit section, else the case), `x` remove (asks), `v` re-verify, `c` copy, `/` search more. + Moves pressed while one is saving queue in order. +- **Re-verify**: the quote's own track ±30 s → `ok` (and where it starts now), `drifted` (the words there now), + `missing` (the recording is gone), `unreadable` (the source is not offered), and `en` vs `en-orig` where they differ. + Nothing changes a quote's words but **Use the current words** (the old words kept in its history). +- **The export**: `# title`, the notes, a `##` per section with one finding per quote — `- <claim>: "<quote>" — + [<title> @ m:ss](<link>)` — and `## Coverage`. It converts as a `/sweep` report. +- **Stored** at `REPORTS_ROOT/.umtool/research/<case>/case.json` (one writer, temp + rename, 409 on an unreadable file). + `sessions`, `census`, `archive`, `runs`, `cases`, `new` are not case ids. + +### Hand-offs (plan, then confirm) + +| Button | What it plans | Confirm | +|---|---|---| +| **Draft an article from this board** | a `report-draft` sweep seeded with the exported board (`seed.md`): the article (new, or a new iteration), the question (the query, else the title), the channels, the seed size, the API model and its cap. Refused on a local model, and for a board with a local-only quote | **Start the sweep (up to $X)** | +| **Start a video from this board** | `scaffoldReportVideo` with the board's timeline: one clip per quote in board order, its window the quote's cue span, the claim as its note; the folder, title, origin; a taken folder is refused | **Create the project** | +| **Run a sweep on this scope** | the same sweep without the seed, on the policy's sweep route (a route to Claude Code runs the API agent, and says so) | **Start the sweep …** | + +Create's **From a board** lines open the same plans. + +## Agent runs, `/research/runs` and `/research/runs/<article>/<n>` + +`/research/runs` lists every sweep iteration of the article store, newest first. A run page shows what a sweep did, +step by step — live while it runs (re-read every 2.5 s), a replay when done: + +- **The head**: the question (two lines; the full text on hover), `<article> · i<n>` in the trail, sweep · model · + extractor · channels · dates · corpus · when · minutes · spend · kept / dropped · checks · status. **Run 1 2 3** + (`?run=k`) when it ran more than once, **Replay** (`r`), **Open as a board** / **Update the board** (`b`). +- **Steps**, one lit list: scope, each turn (`t0`…, a repair's `r0`…) or a pipeline's enumerations and batches, findings, + quote checks, the end — each with the running spend. The lit step's detail: the enumeration's ids and what was not + reached, a batch's extractor lines (on the reader), findings with quotes, the checks grouped **Dropped** / **Refused by a + strict check** / **Kept**, each with why; **Spend by step, cumulative**. +- **The record** is the iteration's `trace.jsonl` (written by the editor); a run from before it is projected from + `turns.jsonl`, with a gap step where the checks were not recorded. +- **Open as a board** makes the case `<article>-run<n>` from the report's quoted citations (`by: "agent"`, the + report's sections, the finding as the claim); a second press adds what is new and never touches your claims, notes, + sections or order. The board's side panel links **From run**. +- The Iterations tab's **Run** link and a sweep's Running row open it. + +## The archive inventory, `/research/archive` + +Channels × years: what the archive can and cannot answer. **Videos held** / **Videos published**, **Heatmap** / +**Table**, the source chips. A cell's number on the Meter ramp; a gap over 60 days marked under its year; "—" for none. +Hover or focus a cell for held, published, missing states, transcripts vs captions; the arrow keys walk the grid. +Held counts are kept 5 minutes per channel ("Held counts from 3 min ago (kept 5 min)"); **Refresh** asks again. + +## Routes + +`/api/research/{sources,scope,search,window,coverage,log,media,fetch}`, `/api/research/cases[/<id>[/quotes[/<qid>] +|/verify|/export.md|/handoff]]`, `/api/research/runs/<article>/<n>[/board]` — JSON, `no-store`, errors in words (400 bad +input, 404 nothing there, 409 an unreadable file, 502 a source that cannot be read). diff --git a/umtool/docs/settings.md b/umtool/docs/settings.md @@ -0,0 +1,55 @@ +# Settings + +`/settings` lists the two pages. The rail's Settings opens `/settings/system`. + +## Generation, `/settings/generation` + +The generation policy (`settings.generation`), read from and written through the EDITOR's settings action; an editor +that does not answer is said ("The editor did not answer …, so the policy is unknown. Start it, then reload."). + +- **policy**: the presets (`code`, `balanced`, `api`, `local`; the chosen one pressed — choosing one writes its routes; + a route set by hand makes it `custom`); **routes** (where each task runs: `code` = Claude Code, `api` = the Claude API, + `local` = the local model); **models** (the API model, the local model, the extractor an API sweep reads its batches + with); **caps** (USD per task, the daily cap, **Save caps** — the editor refuses a cap it will not take); **API key**: + the key FILE's path and whether it is there — never the key. +- **Spend today**: the editor's usage ledger for the UTC day, job by job (time, task, the article's iteration, the + models, USD), against the daily cap; **Last 7 days** on a Meter bar. + +The head says the policy in one line ("Generation: balanced · Claude Code: sweeps · API: report revisions, research · +local: video revisions, drafts"); Create's chip, an article's **policy** chip and a `tick-held` card's **Raise cap** link +here. OPERATING.md, "Generate and iterate", has the presets, caps and key rules. + +## System, `/settings/system` + +The machine and the collection at a glance, read from the index, the job registries and a few stats; nothing here +probes but **Check**. What is a call (a required tool absent, under 5 GB free) is an Inbox card linking here. + +| Panel | Says | Acts | +|---|---|---| +| **Tools & disk** | free space under the reports root; each tool's version or "absent" (red only when the report pipeline needs it), from the doctor's cache | **Check** / **Check again** (`POST /api/doctor`) | +| **Roots** | reports, media (or "= reports · UMTOOL_MEDIA_DIR unset"), the cache and whether an index exists, an old cache "not read; safe to delete" | — | +| **Index** | "N records · rebuilt <ago>" (and how many are for projects that are gone), or "No index — every read walks the disk." | **Rebuild…** (`umtool index --rebuild`, as a job in Running), **Prune…** (drops the stale records) | +| **Activity** | umtool's own running job (live) and the newest that ended | — | +| **Projects** | per kind, the six states as proportional segments (`stale` the one coloured state); the same header line as `/projects` | **Every project →**, a segment opens `/projects?kind=&state=` | +| **Deliverables** | built count and bytes, the newest, how many are stale | **Built →** | +| **Sources** | report projects never checked, older than 30 d, with dead or missing sources | **Re-check N projects** (one `check-sources` job) | +| **Storage** | every project's `out/` (here, on media, DRIVE MISSING, none) and its deliverables switch | **Move every out/ to the media root…**, **Move every out/ back…**, per project **Move out…**, **Move back…**, **Deliverables to media…** / **Deliverables home…** | + +**Plan, then confirm** (`components/system/ActionPlan.tsx`): every action that changes or moves anything asks for its +plan first (`POST /api/system/{index,storage} {…, dryRun: true}`: what it touches with sizes, what refuses, what is worth +knowing). The plan takes the focus; only its confirm (named for the result: "Drop 2 records", "Rebuild the index", +"Move out") acts, and it re-reads the plan and refuses (409) if it now refuses. **Keep it** or Escape closes it with +nothing written. A project is named by id, never a path; a busy one is refused alone, skipped in an "all". The moves run +`umtool storage …` as umtool jobs, the same CLI a terminal runs. + +## `umtool doctor` + +`umtool doctor [--json]`: the roots, then every tool with its version, exit 1 if the report pipeline is missing a tool +it cannot run without (ffmpeg, ffprobe, yt-dlp, qrencode). ImageMagick is probed as `magick` (IM7); a machine with only +`convert` cannot build a card, and the report says so. The app's cache of it is `lib/doctor.ts` (ten minutes). + +## `/api/jobs` + +`GET` → `{ running, jobs }`, one shape over umtool's two registries (`lib/jobs.ts` chain jobs, `lib/mix.ts` renders), +`no-store`. Their one-at-a-time rules differ (a chain is process-wide exclusive; a render is one ffmpeg call). The rail's +Running list adds the editor's jobs ([inbox.md](inbox.md#the-running-list-the-rails-foot)). diff --git a/umtool/docs/sites.md b/umtool/docs/sites.md @@ -1,132 +0,0 @@ -# /sites — every site's articles - -Every report on every site under `transcripts/sites/` — published and drafts — -read in place: no private site built, no port served. umtool **reads** the sites; -the one file it writes there is a report's `notes.json` (docs/notes.md). - -| page | what | -|---|---| -| `/sites` | every site (private first), every article: status, updated, citations, open notes, poster, video project, source draft. Filters are links: `?site=`, `?status=published\|draft`, `?notes=open` | -| `/sites/<site>` | its articles, its report videos (playable), the umtool projects they were cut in (takes, like/maybe/no), the workspace files they were written from (`?ws=&rel=` opens one) | -| `/sites/<site>/<report>` | the article with its notes (below) | -| `/sites/<site>/<report>?tab=source` | the article's workspace files, its own draft opened | -| `/sites/<site>/<report>/evidence` | every citation, one per screen (`?c=<id>`) | -| `/articles` | the homepage's article store (`transcripts/reports/`), the same columns; above it, the articles **in the making** (iterations, no `report.json` yet) | -| `/articles/new` | a new article: question, channels (the editor's), dates, the sweep (agent on Claude, pipeline on the local model), model, cap; and the **generation policy** | -| `/articles/<id>?tab=iterations` | the article's iterations (below) | -| `/articles/<id>/compare?a=<n>&b=<n>` | two iterations side by side: sections and findings (what the other lacks marked), ops applied and refused, failed checks, both cuts | -| `/drafts` | redirects to `/articles/new` | - -## Where an article comes from - -- **Site and reports**: common's `listSites`/`getSite` (site.json, the editor's - defaults), `listReportDirs` (the enumerator the editor's Reports tab uses), each - `report.json` through the report validator. **Published** = named in site.json - `pages`, in that order; every other report directory is a **draft**. -- **Source** (`lib/articles/sources.mjs`): the draft under - `~/reports/<ws>/polemics/drafts/` whose `id` or file name is the report id, - `polemic-` allowed on either side, preferring a workspace whose generator names - the site; the generator is the `*.py`/`*.mts` under `<ws>/polemics` or - `<ws>/site` that names the site or the report. Shown with its reason; written - into `notes.json` `source` on the first note. **Edit the draft, not - report.json** — the generator overwrites report.json. -- **Video project** (`lib/articles/links.mjs`): a report-video manifest with a - top-level `"article": "<site>/<report>"` is linked to that article and nothing - else (build-video.mjs ignores the key). Otherwise a manifest `slug` equal to the - report id (± `polemic-`) in the draft's workspace, when exactly one matches; - several are listed as "possible". - -## Generated articles: iterations (release 27) - -An article made by a model is a series of **iterations** (`i1`, `i2`, …: common's -`lib/report/iterations.ts`). umtool **starts** them and never writes one: each is -a `report-draft` job the EDITOR runs, asked over its ops API with the shared -`WORKER_TOKEN` (`lib/articles/generation.ts`). The token stays on the server. - -| on an iteration | what happens | -|---|---| -| **Use this iteration** | the article's `report.json` becomes its report — common's `makeCurrent`, the registry's writer (locked, validated; the audience and the attached video kept) | -| **New iteration** | a `revise-report` or `revise-video` of it, from feedback, on a model | -| **Copy with model** | the same kind, base, question or feedback, on another model | -| **Narrate** | a narration step over its cut, on a model | -| **Cancel** | `job cancel` on its editor job; the log's last lines are polled every 2.5 s while it runs | -| **Make the video** | the chain (`lib/report/chain.mjs`) as a umtool job: its ten steps, each one's status, resume or **from** a step, cancel | -| **compare** | tick two, then **Compare iN and iM** | -| **Delete iN** | the plan (its directory and its project, with sizes; what refuses), then **Confirm delete** — common's `deleteIteration` under the registry's lock. Refused: the current article or video, the iteration the article's report came from, a running one, one another revises or copies | - -**Delete article** (on any article of the store, in the making too) shows the -plan — the article's directory, its iterations' projects, its staged exports, -what is kept — and deletes on **Confirm delete** (common's `deleteArticle`; a -chain of it running here refuses). A published article offers **delete anyway**, -which unpublishes it first. `/articles?deleted=<id>` says what went. - -The list shows each one's kind, model, parent, copy, status, cost per model, -minutes, ops applied and refused, and checks; which is the article and which the -video; the article's spend and the day's API spend against the daily cap (the -editor's usage ledger). A `research` iteration carries its research queue -(`ResearchSlot`). - -**The policy** (`/articles/new`) is `settings.generation`: the presets (`code`, -`balanced`, `api`, `local` — each writes its routes), a route per task, the -models, the caps. It is written through the editor's settings action. The API -key is never shown or taken: only its file's path and whether the file exists. - -## Reading and noting - -The article renders in a ~70ch column with its notes in a rail (a drawer below -1100px). Its video sits under the title (`components/articles/ArticleVideo.tsx`) -and takes timed notes: `n` with the video focused, or **Mark**, notes the -playhead as a `moment` anchor on the article's notes ([report-video.md](report-video.md)). - -| to note | do | -|---|---| -| a passage | select it → **Note** (or `n`) | -| a section | **+ note** on its heading | -| a citation | click it → the evidence panel → **+ note on this citation** | -| the article | **+ whole article** | - -A passage note keeps its quote and 32 characters either side; it is found again -in the text as it is now (`lib/annotations/anchor.mjs`: exact, then -whitespace/quote/case-normalised, then by its surviving context) and marked. -One whose quote is gone is listed **orphaned**. Keys, when not typing: `j`/`k` -move, `r` resolves, `e` edits, `n` notes, `Esc` closes. `?status=` and `?note=` -open the rail on a filter or a note (the decisions inbox links to the note). -**Copy agent brief** copies `/api/notes/context` — the `umtool notes` digest. - -Open notes are `open-note` rows in `/browse/decisions` and on the dashboard. - -## Evidence - -A citation's panel: its quote, speaker, date, label and original link; ±6 cues -of its record's `transcript.cues.json`, the cited ones marked (click one to seek); -and media, best first: - -1. the site's **prepared** clip (`.export-index/sites/<site>/report-media/`); -2. a clip **window** the editor fetched (`data/<id>/clips/`); -3. a **saved** video or audio file in `data/<id>/` (through its media-tier link); -4. otherwise the `fetch_clip` MCP line to fetch it through the editor. umtool - never runs yt-dlp, and its own fetch client needs a project manifest. - -A post shows its text and its capture screenshot. The walk -(`/evidence`) is the same panel one citation at a time: `j`/`k` (or ←/→), -`space` plays, `n` notes. - -**Add to video** (in the panel, when the article has a linked video project) -puts the cited span at the end of that project's timeline as a clip -(`/api/report/timeline` insert): the manifest is snapshotted first, so the -project page's **Undo** takes it back, and on a generated manifest an `edit` note -tells the agent to port it into the generator's inputs. - -## Routes (read-only) - -| route | serves | -|---|---| -| `/api/sites/media?site&report&file` | a file in the report dir (video.mp4, poster.jpg, stills/…), byte ranges | -| `/api/sites/media?site&moment` | the prepared clip of a moment, via report-media/index.json | -| `/api/sites/media?corpus=<abs>` | a media file lexically under CHANNELS_DIR | -| `/api/sites/evidence?site&report&cite` | one citation's evidence (JSON) | -| `/api/sites/workspace?ws&rel` | a listed workspace file; HTML under a CSP sandbox | - -`SITES_DIR` (else `TRANSCRIPTS_DIR/sites`, else the checkout's -`transcripts/sites`) is where all of it is read; the e2e suite points it at its -fixture (`e2e/fixtures/sites-fixture.mjs`). diff --git a/umtool/docs/tools.md b/umtool/docs/tools.md @@ -0,0 +1,27 @@ +# Tools + +## `/tools` + +Two lists. **Song**: song piles, find, mix, faces, sources, a trim set. **Articles**: the verdict bench. While you are in +a tool the rail opens Tools into its tools: find · mix · **song ▸** (the four piles) · faces · sources · bench. + +| Tool | Address | What it is | +|---|---|---| +| Song piles | `/tools/song`, `/tools/song/<mode>` | the clip-judging deck, one pile at a time: `sort` (candidate clips never judged), `salvage` (clips parked as unclean, offered again), `verify` (accepted clips the risk check flagged, riskiest first), `keeps` (clips kept on purpose for a stray word, to side). `?limit=`, `?only=<ids>` | +| Find | `/tools/find` | every occurrence of a word across the song corpus: a GET form (`?q=`, `?page=`, `?list=<shortlist>`), filters as links, so a view is one pasteable URL | +| Mix | `/tools/mix` | the mix bench: set the handover and the end point, hear it, render it. A clip deep-links in with `?body=&start=&end=&from=&clip=` ([mix-from-a-project.md](mix-from-a-project.md)) | +| Faces | `/tools/faces` | every cover corner on record, deduped by episode and moment, the ones that ship first: judge the crop (`face-verdicts.json`, which `make-thumb.mjs` reads). `?cover=` / `?key=` open one | +| Sources | `/tools/sources` | where the song palette comes from: placements and clips per episode, the top episode, the top five, how many cover half | +| Trim | `/tools/trim/<set>` | a hook set's trims against the waveform, then **run the chain** (apply-hook-trims → pick-take → mix-hooks) | +| Verdict bench | `/tools/bench` | could a model propose a fact-check verdict well enough to review: runs of `archilyzer reports bench-verdicts`, each model's agreement and recalls against the bar (**passes the bar** / **fails the bar**), confusion matrices, the items; the bar is set here (`settings.generation.verdicts`) | + +A song's own page links its piles, find, mix and sources (its Overview's Song tools; [piece.md](piece.md#a-song-projectspath)). +The old addresses (`/sort`, `/salvage`, `/verify`, `/keeps`, `/mix`, `/bench`, `/browse/find`, `/browse/faces`, +`/browse/sources`, `/browse/trim/<set>`) redirect here. + +## The deck (`/tools/song/<mode>`) + +A clip at a time, its verdict and reason codes by key. Some of the keys: space play, `[` / `]` +1 s left / right, `,` +/ `.` un-expand a side, `A` play the whole window, `E` hear the expansion (shift+E applies it), `R` undo the +auto-expand, `M` another sound in this window, `W` the word, the digits a reason, Escape keep it. The deck's own legend +lists every key for the pile. diff --git a/umtool/docs/work.md b/umtool/docs/work.md @@ -0,0 +1,84 @@ +# Work + +## `/work` — every piece + +One lit list: every article (with the video projects it claims), every project no article claims, every series. An +edition of a series is not a row; its series is. A row: the title and id (and a schedule's chip), the stage on a step +bar, the kind ("article + report video" …), the lifecycle ("· looks done" when it does), open calls in Meter, and on the +lit line **Park** / **Mark done** (or **Reactivate**). **+ Create** in the head. + +The facets are links (any view is one pasteable URL), each chip with the count it would show; `/` focuses **Find a +piece** (a GET search, `q`). + +| Facet | Key | Values | +|---|---|---| +| Stage | `stage` | `research`, `article`, `video`, `deliver` — the one stage rule ([piece.md](piece.md#the-stepper)); a song files Spec → article, Cuts → video, Done → deliver | +| Kind | `kind` | `article`, `series`, a project kind id (`report-video`, `song`, `sweep-report`); a project kind also finds the article whose video it is | +| Lifecycle | `life` | `active` (the default), `parked`, `done`, `all` | +| Site | `site` | a site id (`articles` = the store); **site page →** opens `/sites/<site>` | +| Recurring | `recurring=1` | series and living reports | +| View | `by=site`, `sort=name` | **By site** groups by site; **By name** sorts | +| Also | `template`, `state`, `open`, `status`, `notes`, `audience` | the old lists' keys; each shows as a chip that takes itself off | + +`/browse`, `/articles` and `/sites` redirect here with their keys kept (`/articles` → `?kind=article&site=articles`, the +store's; `/sites` → `?by=site`). After a delete, `?deleted=<id>` (and `freed`) says what went. + +## `/projects` — every project, by folder + +The project grid the old `/browse` was: one card per project, by folder. **+ new project** (or `?new=1`) opens the +scaffold form; **copy the whole picture** copies every project as markdown. Server-rendered, no client JavaScript. + +| Filter | Key | Values | +|---|---|---| +| Kind / template | `kind`, `template` | registry ids | +| State | `state` | `draft` `windows` `fetched` `built` `shipped` `stale` | +| Decisions | `open` | `blocking`, `1` (any waiting) | +| Text / order | `q`, `sort` | substring over the haystack; `name` or `recent` | + +- **Counts come from the unfiltered set**, so a chip's number does not move under the cursor; an e2e spec holds the + number to the cards drawn. +- **One state vocabulary across every kind**, so "what is half-done" needs no "at what". A kind maps onto it; it does + not invent a seventh. +- **The cards carry no kind ids** (`components/projects/ProjectGrid.tsx`): a kind's summariser renders its own facts + (`19 clips · 4m46s · 17 sources`, `3/4 cuts · 2 variants`) and flags, and attaches `data-*` through `attrs`. +- **The poster** falls back: the deliverable → a built segment → a raw clip → nothing, served by + `/api/browse/poster?project=…`, which takes no client-supplied `rel`. +- **Listing never probes.** A summary is memoised against a signature of mtimes and sizes; `open` needs every kind's + reducer, memoised the same way. The footer says the index's health ("index: 9/11 fresh"). +- `/projects/<folder>` is the same grid under a folder. A bare name two projects share lists both canonical paths. + +## `/sites/<site>` — a site's page + +Its articles (status, updated, citations, open notes, the linked video and source draft), its report videos (playable), +the video projects they were cut in (their takes and like / maybe / no), and the workspace files they were written from +(`?ws=&rel=` opens one). Its articles open as pieces at `/sites/<site>/<report>` ([piece.md](piece.md)). + +- **Site and reports**: common's `listSites`/`getSite`, `listReportDirs`, each `report.json` through the report + validator. **Published** = named in `site.json` `pages`, in that order; every other report directory is a draft. +- **Source** (`lib/articles/sources.mjs`): the draft under `~/reports/<ws>/polemics/drafts/` whose `id` or file name is + the report id (`polemic-` allowed on either side), preferring a workspace whose generator names the site. **Edit the + draft, not `report.json`** — the generator overwrites `report.json`. +- `SITES_DIR` (else `TRANSCRIPTS_DIR/sites`, else the checkout's `transcripts/sites`) is where it is read; the e2e + suite points it at `e2e/fixtures/sites-fixture.mjs`'s fixture. + +| Route (read-only) | Serves | +|---|---| +| `/api/sites/media?site&report&file` | a file in the report dir (video.mp4, poster.jpg, stills/…), byte ranges | +| `/api/sites/media?site&moment` | the prepared clip of a moment | +| `/api/sites/media?corpus=<abs>` | a media file lexically under `CHANNELS_DIR` | +| `/api/sites/evidence?site&report&cite` | one citation's evidence (JSON) | +| `/api/sites/workspace?ws&rel` | a listed workspace file; HTML under a CSP sandbox | + +## Discovered by getting it wrong once + +**Tailwind's source detection is OFF, and the scanned directories are named in `app/globals.css`** +(`source(none)` plus `@source "../app"`, `"../components"`, `"../lib"`, common's report components). Auto-detection read +a scratch `NEXT_DIST_DIR`'s binary cache, took a garbage class candidate, and every page 500'd on a CSS parse error — +then it happened again from a doc that quoted the candidate. A doc, a fixture or a stray dist dir can no longer poison +the stylesheet. If you add a directory that holds class names, name it there. + +**`lmdb` must be in `serverExternalPackages`.** Bundled, Turbopack resolves its optional `moduleRequire('cbor-x')` and +fails the whole module graph — every page importing `lib/projects` 500s naming a package nothing here uses. + +**Every page is dynamic, so a `<Link>` prefetch is a full render.** The rail, the Inbox, Work and the tool lists do not +prefetch; a piece's tabs do not either. diff --git a/umtool/e2e/article-iterations.spec.ts b/umtool/e2e/article-iterations.spec.ts @@ -44,6 +44,9 @@ test("an article in the making: listed as such on Work, opened as its piece, its // The article piece (P4a-2) opens on its Overview, the iterations summarised there. await expect(page).toHaveURL(new RegExp(`${urls.articleHref(ZETA)}$`)); await expect(page.locator("[data-article-meta] [data-status]")).toHaveAttribute("data-status", "pending"); + // In the making is a state, not a judgement: the neutral state tag, never a verdict colour (P6). + await expect(page.locator("[data-article-meta] [data-status]")).toHaveClass(/border-dashed/); + await expect(page.locator("[data-article-meta] [data-status]")).not.toHaveClass(/doubt/); await expect(page.locator("[data-piece-iterations='4']")).toBeVisible(); await page.getByTestId("piece-tab-iterations").click(); @@ -100,7 +103,9 @@ test("use, revise, copy with model, cancel: each through the editor, the list fo await page.goto(urls.articleHref({ site: "articles", id: ARTICLE }, { tab: "iterations" })); await expect(card(page, 1)).toHaveAttribute("data-status", "done", { timeout: 20_000 }); - // USE THIS ITERATION: the registry writes the article's report.json. + // USE THIS ITERATION: the registry writes the article's report.json. An + // outline (P6): the tab's filled action is the Next card's, not a card's. + await expect(card(page, 1).getByRole("button", { name: "Use this iteration" })).not.toHaveClass(/signal/); await card(page, 1).getByRole("button", { name: "Use this iteration" }).click(); await expect(page.getByRole("status").filter({ hasText: "the article is i1" })).toBeVisible(); await expect(card(page, 1).locator("[data-current='article']")).toBeVisible(); diff --git a/umtool/e2e/media-surfaces.spec.ts b/umtool/e2e/media-surfaces.spec.ts @@ -97,7 +97,7 @@ test("Draft with <model> per section: the job followed, the badge, the last run, // A project made from no iteration offers no draft, and says why. await page.goto(urls.section("reports/youtube-fixture", "drafts")); - await expect(page.getByRole("region", { name: "Media drafts" }).locator("[data-draft-unlinked]")).toHaveText("Not from an article iteration — Draft with is off here."); + await expect(page.getByRole("region", { name: "Media drafts" }).locator("[data-draft-unlinked]")).toHaveText("Drafting is off: no article iteration made this project."); }); test("Draft everything: every draft in order on the model chosen, a refused one passed, the panels skipped, then the fast build, the podcast and out/youtube.txt", async ({ page }) => { diff --git a/umtool/e2e/piece.spec.ts b/umtool/e2e/piece.spec.ts @@ -381,7 +381,7 @@ test("the Media tab: every drafted field with where it came from, approve per fi await expect(media.locator("[data-draft-row]")).toHaveCount(3); // Made from no iteration, it drafts nothing: the sections with fields, in Draft everything's order. await expect(media.locator("[data-media-section]")).toHaveCount(2); - await expect(media.locator("[data-draft-unlinked]")).toHaveText("Not from an article iteration — Draft with is off here."); + await expect(media.locator("[data-draft-unlinked]")).toHaveText("Drafting is off: no article iteration made this project."); const m01 = media.locator("[data-draft-row='onscreen/m01/onscreen']"); await expect(m01.locator("[data-draft-text]")).toContainText("She will not sell"); diff --git a/umtool/e2e/redirects.spec.ts b/umtool/e2e/redirects.spec.ts @@ -37,7 +37,7 @@ function parts(href: string): [string, [string, string][]] { return [u.pathname, [...u.searchParams.entries()]]; } -test("the table has the P3 and P5 rows, reserved /browse tools before the catch-all", () => { +test("the table has the P3, P5 and P6 rows, reserved /browse tools before the catch-all", () => { const sources = REDIRECTS.map((r) => r.source); const catchAll = sources.indexOf("/browse/:path*"); expect(catchAll).toBeGreaterThan(0); @@ -49,6 +49,8 @@ test("the table has the P3 and P5 rows, reserved /browse tools before the catch- // P5: the editor's hand-off, only when the query has `from`; the new-article form. expect(REDIRECTS.find((r) => r.source === "/")).toMatchObject({ destination: "/create", has: [{ type: "query", key: "from" }] }); expect(REDIRECTS.find((r) => r.source === "/articles/new")?.destination).toBe("/create?make=article"); + // P6: the deleted /drafts page lands where it did. + expect(REDIRECTS.find((r) => r.source === "/drafts")?.destination).toBe("/create?make=article"); }); for (const row of REDIRECTS) { diff --git a/umtool/e2e/settings.spec.ts b/umtool/e2e/settings.spec.ts @@ -180,6 +180,9 @@ test("system: the doctor's roots are the fixture's", async ({ page, request }) = const roots = page.locator("[data-panel=roots]"); await expect(roots).toContainText(".e2e-song"); await expect(roots).toContainText("UMTOOL_MEDIA_DIR unset"); + // Status lines, not paragraphs (P6): the index is said once, in its own panel. + await expect(page.locator("[data-panel=index] p").first()).toHaveText(/^\d+ records(, \d+ for projects that are gone)?( · rebuilt .+)?$|^No index — every read walks the disk\.$/); + await expect(page.locator("[data-panel=tools]")).not.toContainText("index"); const doctor = await (await request.get("/api/doctor")).json(); expect(doctor.roots.reports.path).toContain(".e2e-song"); expect(doctor.roots.media.tiered).toBe(false); diff --git a/umtool/e2e/shell.spec.ts b/umtool/e2e/shell.spec.ts @@ -26,6 +26,11 @@ const PLACES: { url: string; lit: string; current: "page" | "true" }[] = [ { url: urls.toolsHref(), lit: "tools", current: "page" }, { url: urls.mixHref(), lit: "tools", current: "true" }, { url: urls.findHref(), lit: "tools", current: "true" }, + // Every tool page lights Tools (P6: faces and a trim set lit Work before). + { url: urls.facesHref(), lit: "tools", current: "true" }, + { url: urls.trimHref("mk-hooks"), lit: "tools", current: "true" }, + { url: urls.sourcesHref(), lit: "tools", current: "true" }, + { url: urls.benchHref(), lit: "tools", current: "true" }, { url: urls.systemHref(), lit: "settings", current: "page" }, { url: urls.generationPolicyHref(), lit: "settings", current: "page" }, ]; diff --git a/umtool/e2e/song-piece.spec.ts b/umtool/e2e/song-piece.spec.ts @@ -56,6 +56,11 @@ test("the frame: title, trail, the Spec → Cuts → Done stepper, five tabs, th await expect(page.locator("[data-cut]")).toHaveCount(0); await expect(page.locator("[data-op]")).toHaveCount(0); await expect(page.locator("[data-note-for=song]")).toHaveCount(0); + // An open decision is a state: its chip is the neutral state tag, never the doubt colour (P6). + const openChip = page.locator("[data-decision][data-severity=open]").first().locator("span").first(); + await expect(openChip).toHaveText(/open/i); + await expect(openChip).toHaveClass(/border-dashed/); + await expect(openChip).not.toHaveClass(/doubt/); }); test("a song with a hole is at Cuts, and Work files it where its stepper says", async ({ page }) => { @@ -91,14 +96,18 @@ test("the Next card is the song's top Inbox call, and its one action goes where await expect(action).toHaveText(top!.action.label); }); -test("a song's calls land on their tab: the spec's on Spec, a cover's on Cover, a cut's on its page", async ({ request }) => { +test("a song's calls land on their tab: the spec's on Spec, a cover's on Cover, a cut's on its page -- at the full path", async ({ request }) => { const items = ((await (await request.get("/api/browse/decisions?project=alpha")).json()) as { items: { kind: string; href: string }[] }).items; const WHERE: Record<string, string> = { "spec-problem": "spec", "no-plan": "spec", unattributed: "cuts", "thumb-unaccepted": "cover" }; const songWide = items.filter((d) => WHERE[d.kind]); expect(songWide.length, "alpha names no plan, so at least that call").toBeGreaterThan(0); - for (const d of songWide) expect(d.href, d.kind).toBe(`/projects/alpha?tab=${WHERE[d.kind]}`); - for (const d of items.filter((x) => x.kind === "unjudged-variant" || x.kind === "stale-recipe")) { - expect(d.href, d.kind).toMatch(/^\/projects\/alpha\/(wide|wide-short|vertical|vertical-short)(\?|$)/); + // The song's canonical address is its full path (P6); the basename stays the + // decision's project, the notes' target. + for (const d of songWide) expect(d.href, d.kind).toBe(urls.projectHref(ALPHA, { tab: WHERE[d.kind] })); + const cutCalls = items.filter((x) => x.kind === "unjudged-variant" || x.kind === "stale-recipe"); + expect(cutCalls.length).toBeGreaterThan(0); + for (const d of cutCalls) { + expect(d.href, d.kind).toMatch(new RegExp(`^/projects/${ALPHA}/(wide|wide-short|vertical|vertical-short)(\\?|$)`)); } }); @@ -110,6 +119,9 @@ test("the tab is the URL: ?tab=, a note's target, a bad tab the Overview, and th await expect(tab(page, "cuts")).toHaveAttribute("aria-current", "page"); await expect(page.locator("[data-cut]")).toHaveCount(4); await expect(page.locator("[data-song-slot]")).toHaveCount(0); + // A cut card links the cut at the song's full path (P6), as the Overview's + // slots and the picker do; the basename still resolves (below, and the 1366 test). + await expect(page.locator("[data-cut=wide]").getByRole("link", { name: "wide", exact: true })).toHaveAttribute("href", urls.cutHref(ALPHA, "wide")); await page.goto(urls.songSection("alpha", "spec")); await expect(page.locator("[data-op=trim-hooks]")).toBeVisible(); @@ -148,6 +160,8 @@ test("a cut's page is a view of the Cuts tab: the frame, the four cuts beside th const picker = page.locator("[data-song-cut-picker=wide]"); await expect(picker.locator("[aria-current=page]")).toHaveText("wide"); await expect(page.locator("[data-loudness='wide.mp4']")).toBeVisible(); + // The bench's controls are outlines; Signal is only focus and the lit line (P6). + await expect(page.locator("main button[class*='color-sel'], main a[class*='border-[var(--color-sel)]']")).toHaveCount(0); // The trail's project id is the way back to the song. await expect(page.getByRole("navigation", { name: "Breadcrumb" }).getByRole("link", { name: ALPHA })).toHaveAttribute( "href", diff --git a/umtool/lib/activity.ts b/umtool/lib/activity.ts @@ -60,7 +60,7 @@ export type ActivityProgress = { entries?: Record<string, "fetching" | "cutting" | "done" | "failed">; }; -/** One progress presentation for every row (components/shell/JobProgress.tsx). */ +/** One progress presentation for every row (components/ui/job-progress.tsx). */ export type ActivityMeter = { /** 0..1, or null when the job reports none (no bar is drawn). */ fraction: number | null; diff --git a/umtool/lib/browse.ts b/umtool/lib/browse.ts @@ -28,6 +28,17 @@ import { acceptedFor, readThumbAccepted, type ThumbDoc } from "./thumbs"; /** The root the whole feature hangs off. `SONG_REPORTS_DIR` already moves it. */ export const BROWSE_ROOT = path.join(SONG_REPORTS, "videos"); +/** + * A song's project id -- its path under REPORTS_ROOT, the one canonical address + * (`/projects/<id>`, `/projects/<id>/<cut>`) -- from the basename the song + * readers key by. A song outside REPORTS_ROOT keeps its basename, which the + * project resolver takes as an alias when it is unique. + */ +export function songProjectId(name: string): string { + const rel = path.relative(REPORTS_ROOT, path.join(BROWSE_ROOT, name)); + return rel && !rel.startsWith("..") && !path.isAbsolute(rel) ? rel.split(path.sep).join("/") : name; +} + // The cut list is FIXED, not derived from the directory. // // mortal-kombat and mario-rpg have no vertical.mp4, and a scan-derived list diff --git a/umtool/lib/decisions.ts b/umtool/lib/decisions.ts @@ -1,4 +1,5 @@ -import { readSong, resolveRendition, thumbAliasesFor } from "./browse"; +import { readSong, resolveRendition, songProjectId, thumbAliasesFor } from "./browse"; +import { cutHref as cutPageHref, projectHref } from "./hrefs"; import { cachedLoudness } from "./loudness"; import { DEFAULT_TARGET, loudnessVerdict } from "./loudness-types"; import { buildStatus, readManifest } from "./manifest"; @@ -139,8 +140,10 @@ export async function decisionsForSong(id: string): Promise<Decision[]> { // A song-wide call opens the song piece's tab its section is on (P4a-3, // lib/pieces/song-tabs.mjs): the spec's on Spec, a stray variant on Cuts, a // cover on Cover. A cut's call opens the cut's page (the Cuts tab's view). - const songHref = (section: string) => `/projects/${id}?tab=${songTabOfSection(section)}`; - const cutHref = (cut: string) => `/projects/${id}/${cut}`; + // Both on the song's canonical address, its full path (P6); the basename + // stays the decision's `project`, the notes' target. + const songHref = (section: string) => projectHref(songProjectId(id), { tab: songTabOfSection(section) }); + const cutHref = (cut: string) => cutPageHref(songProjectId(id), cut); const target = { lufs: spec.loudness?.targetLufs ?? DEFAULT_TARGET.lufs, truePeak: spec.loudness?.truePeak ?? DEFAULT_TARGET.truePeak, diff --git a/umtool/redirects.mjs b/umtool/redirects.mjs @@ -39,11 +39,9 @@ * }} RedirectRow */ -// Not here yet, by phase: `/drafts` → `/` (P6 deletes the page; until then -// it redirects to Create's new article by itself). - const p3 = (source, destination) => ({ source, destination, permanent: false, phase: "P3" }); const p5 = (source, destination, extra = {}) => ({ source, destination, permanent: false, ...extra, phase: "P5" }); +const p6 = (source, destination) => ({ source, destination, permanent: false, phase: "P6" }); /** @type {RedirectRow[]} */ export const REDIRECTS = [ @@ -54,6 +52,8 @@ export const REDIRECTS = [ p5("/", "/create", { has: [{ type: "query", key: "from" }] }), // The new-article form is Create's "Article from a question". p5("/articles/new", "/create?make=article"), + // The proof of concept's new-article page (release 27), deleted in P6. + p6("/drafts", "/create?make=article"), // The project list became Work; the decision list became the Inbox. p3("/browse", "/work"), p3("/browse/decisions", "/"),