Archilyzer · Source

archilyzer

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

commit 872d70d3bc6ddce86b4cefc40fd4856bbd992716
parent c85add1d16d4ff9ee0e294c7d08a6750a3e2db03
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 13 Oct 2026 23:23:42 -0400

common: a video revision that reorders the cut marks the order its draft; a Title Case on-screen title is checked as its sentence (r28 M9 rulings)

revise-video: ops that change the timeline's order set drafted.timeline to
{task: revise-video, model, iteration, attempt 1}, so the reorder is a
model's draft (the cut's review row; the cut task redrafts it only with
force); ops that leave the order keep the parent's mark. onscreen: a title
whose words all start with a capital is checked in its sentence case
(titleAsSentence: small, ordinary headline and evidence words lowercased),
so ordinary Title Case passes and an unknown name still fails.

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

Diffstat:
Mcommon/lib/report/draft/tasks/onscreen.test.ts | 22+++++++++++++++++++++-
Mcommon/lib/report/draft/tasks/onscreen.ts | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mcommon/lib/report/draft/tasks/revise-video.ts | 15+++++++++++++++
Mmcp/src/draftTasks.test.ts | 24++++++++++++++++++++++++
4 files changed, 119 insertions(+), 3 deletions(-)

diff --git a/common/lib/report/draft/tasks/onscreen.test.ts b/common/lib/report/draft/tasks/onscreen.test.ts @@ -11,7 +11,7 @@ import os from "node:os"; import path from "node:path"; import { jsonReply, startFakeOllama, type FakeOllama } from "../../../../testing/llm/fakeOllama.mjs"; import { createIteration, projectOf, readIteration, updateIteration, writeIterationFile } from "../../iterations"; -import { checkOnscreen, isVerbatimOf, onscreen, onscreenBatches, quotedParts, ONSCREEN_SPEC } from "./onscreen"; +import { checkOnscreen, isTitleCase, isVerbatimOf, onscreen, onscreenBatches, quotedParts, titleAsSentence, ONSCREEN_SPEC } from "./onscreen"; import type { DraftFile } from "./media"; import type { TaskDeps } from "./types"; @@ -124,6 +124,26 @@ test("onscreen's checks, each alone", () => { assert.equal(isVerbatimOf("sel the", "I would never sell the bakery"), false, "whole words"); }); +test("onscreen: a Title Case title passes as its sentence case; an unknown name in one still fails (release 28 M9 ruling)", () => { + const u = { quote: "I would never sell the bakery to a chain", evidence: "Report: Synth Kitchen\nSection: The bakery\nClaim: The baker says she will not sell to a chain.\nQuote: \"I would never sell the bakery to a chain\"\nSource: Bread day, 2026-01-05" }; + const hard = (title: string) => checkOnscreen({ title }, u).hard; + // Ordinary Title Case: every word capitalised, none a name. + assert.deepEqual(hard("The Baker Will Never Sell The Bakery"), []); + assert.deepEqual(hard("She Refuses To Sell To A Chain"), []); + assert.deepEqual(hard("Not For Sale, Says The Baker"), []); + // A name the evidence has keeps its capital and passes. + assert.deepEqual(hard("Synth Kitchen Will Not Sell"), []); + // A name it lacks still fails, Title Case or not. + assert.match(hard("Why Marco Says The Bakery Stays").join(), /name “Marco” is not in the clip's evidence/); + assert.match(hard("The Bakery Stays, Says Marco").join(), /name “Marco” is not in the clip's evidence/); + assert.match(hard("The bakery stays, says Marco").join(), /name “Marco” is not in the clip's evidence/); + assert.equal(isTitleCase("The Baker Will Never Sell"), true); + assert.equal(isTitleCase("The baker will never sell"), false); + assert.equal(isTitleCase("Bakery"), false, "one word is not a case"); + assert.equal(titleAsSentence("Never Sell The Bakery To Marco", u.evidence), "Never sell the bakery to Marco"); + assert.equal(titleAsSentence("The baker said no", u.evidence), "The baker said no", "a sentence-case title as it is"); +}); + test("onscreen: the operator's text kept (forced, the draft an alternative); entries asks only those; batches fit the local cap", async () => { const full = await kit("manifests/full.video.manifest.json"); const p = await project(full); diff --git a/common/lib/report/draft/tasks/onscreen.ts b/common/lib/report/draft/tasks/onscreen.ts @@ -61,6 +61,60 @@ export function isVerbatimOf(part: string, quote: string): boolean { return !!p && ` ${strictNormalize(quote)} `.includes(` ${p} `); } +// The words a Title Case title leaves small, or capitalises with the rest: +// neither is ever a name. +const TITLE_SMALL = new Set( + `a an the and but or nor for so yet of to in on at by up as is it its from with into onto off out over under than +that this these those be been being was were are am has have had do does did not no never ever all any each every +more most much many some such own same other only just very too again once still also even then now here there +when where why how what who whom which whose while if after before about against between through during without +within upon via per vs`.split(/\s+/), +); +// Ordinary words a headline capitalises (say, deny, sell, …): never read as a +// name in a Title Case title, in the evidence or not. Kept short: a word not +// here and not in the evidence is a name's candidate, as before. +const TITLE_ORDINARY = new Set( + `say said says tell told claim claims claimed admit admits admitted deny denies denied refuse refuses refused want +wants wanted will would won't can can't could should must may might need needs get gets got make makes made take +takes took give gives gave go goes went come comes came keep keeps kept see sees saw know knows knew think thinks +thought call calls called ask asks asked answer answers answered change changes changed turn turns turned back +sell sells sold sale buy buys bought pay pays paid win wins won lose loses lost start starts started stop stops stopped stay stays +plan plans planned promise promises promised deal deals story stories question questions answer truth lie lies +side sides vote votes rule rules line lines word words first last next new old big small long short true false +real fake whole half day days week weeks month months year years time times later earlier late early again here +yes no never always often sometimes nobody everybody somebody anyone everyone someone nothing everything something +one two three four five six seven eight nine ten`.split(/\s+/), +); +const TITLE_WORD_RE = /[A-Za-z][A-Za-z'’-]*/g; +const stemOf = (w: string) => w.toLowerCase().replace(/['’]s$/, "").replace(/(ing|ed|es|s|ly)$/, ""); + +/** A title whose words (the small ones aside) all start with a capital, two at least. */ +export function isTitleCase(title: string): boolean { + const big = (title.match(TITLE_WORD_RE) ?? []).filter((w) => !TITLE_SMALL.has(w.toLowerCase())); + return big.length >= 2 && big.every((w) => /^[A-Z]/.test(w)); +} + +/** + * A Title Case title as the sentence it would be: past its first word, a word + * is lowercased when it is small, an ordinary headline word, or a word the + * evidence has in any case (by its stem); any other keeps its capital — a + * name's candidate, which the grounding then looks for. Any other title is + * returned as it is. + */ +export function titleAsSentence(title: string, evidence: string): string { + if (!isTitleCase(title)) return title; + const known = new Set((evidence.match(TITLE_WORD_RE) ?? []).map(stemOf)); + let first = true; + return title.replace(TITLE_WORD_RE, (w) => { + if (first) { + first = false; + return w; + } + const low = w.toLowerCase(); + return TITLE_SMALL.has(low) || TITLE_ORDINARY.has(low) || known.has(stemOf(w)) ? low : w; + }); +} + /** Every code check of one clip's on-screen text: `hard` refuses it. */ export function checkOnscreen(v: OnscreenValue, u: Pick<OnscreenUnit, "quote" | "evidence">): { hard: string[]; soft: string[] } { const hard: string[] = []; @@ -77,8 +131,11 @@ export function checkOnscreen(v: OnscreenValue, u: Pick<OnscreenUnit, "quote" | for (const part of parts) { if (!isVerbatimOf(part, u.quote)) hard.push(`the subtitle quotes “${part}”, which is not the clip's quote word for word`); } - // Names and numbers: in the evidence (a quoted part is the quote's own). - const said = `${title}. ${sub.replace(QUOTED_RE, " ")}`; + // Names and numbers: in the evidence (a quoted part is the quote's own). A + // Title Case title is checked in its sentence case (titleAsSentence): its + // capitals are not a name's signal, so an ordinary word is lowercased and an + // unknown name still stands out. + const said = `${titleAsSentence(title, u.evidence)}. ${sub.replace(QUOTED_RE, " ")}`; hard.push(...groundedProblems(said, u.evidence, "the clip's evidence")); hard.push(...firstPersonProblems(`${title}. ${sub}`)); return { hard: [...new Set(hard)], soft: [] }; diff --git a/common/lib/report/draft/tasks/revise-video.ts b/common/lib/report/draft/tasks/revise-video.ts @@ -19,6 +19,7 @@ import { readIteration, type Iteration } from "../../iterations"; import { applyVideoOps, cutView, trimmedCutView, type AppliedVideoOp, type RefusedVideoOp, type ReportForVideo, type VideoManifest } from "../videoOps"; import { rewriteMomentBases, slugResolver } from "./links"; import { projectDirOf, readManifest, readProjectReport, seedProject, writeManifest } from "./project"; +import { fieldSignature, makeProvenance, stableStringify } from "../../drafted.mjs"; import { COMMON_REVISE_RULES, LOCAL_REVISE_RULES, OPS_SCHEMA, localOpsBatch, reviseCorpusTools } from "./revise-report"; import { TaskInputError, runOnIteration, type TaskHandle, type TaskOutcome } from "./run"; import type { TaskDeps, TaskResult } from "./types"; @@ -208,6 +209,15 @@ async function reviseVideoBody(h: TaskHandle, input: ReviseVideoInput): Promise< applied: applied.map((a) => (a.warnings ? { ...a.op, warnings: a.warnings } : a.op)), refused: refused.map((r) => ({ ...r.op, why: r.why })), }; + // Release 28 (the M9 ruling): ops that change the cut's order make that + // order a model's draft — reviewable as the cut's row, and redrafted by the + // cut task only with force. An order they leave as it was keeps the + // parent's mark (or none). + if (timelineOrderChanged(parent.manifest, manifest)) { + const m = manifest as VideoManifest & { drafted?: Record<string, unknown> }; + m.drafted = { ...(m.drafted ?? {}), timeline: makeProvenance({ task: "revise-video", model, iteration: h.n, attempt: 1 }) }; + h.log(`the cut's order changed: marked a draft of revise-video on ${model}`); + } const dir = projectDirOf(iteration, input.projectsRoot); const seeded = await seedProject(parent.dir, dir, manifest); await writeManifest(dir, manifest); @@ -218,3 +228,8 @@ async function reviseVideoBody(h: TaskHandle, input: ReviseVideoInput): Promise< patch: { ops, projectDir: dir }, }; } + +/** Whether the timeline's order (its entries' ids, the cut's drafted field) differs between two manifests. */ +export function timelineOrderChanged(before: unknown, after: unknown): boolean { + return stableStringify(fieldSignature(before, { field: "timeline" })) !== stableStringify(fieldSignature(after, { field: "timeline" })); +} diff --git a/mcp/src/draftTasks.test.ts b/mcp/src/draftTasks.test.ts @@ -457,6 +457,30 @@ test("revise-video on a local model: one ops batch over the trimmed cut", async assert.equal(m.timeline.find((e: { id: string }) => e.id === "the-bakery").heading, "About the bakery"); }); +test("revise-video: ops that change the cut's order mark it a draft of revise-video; ops that do not keep the parent's mark (release 28 M9 ruling)", async () => { + await drainFake(); + await doneSweep("synth-basic", "basic", { manifest: true }); + const parentMark = JSON.parse(await readFile(path.join(DRAFT, "manifests", "basic.video.manifest.json"), "utf8")).drafted?.timeline; + // A move: the order changes. + const moved = await createIteration("synth-basic", { kind: "revise-video", model: "qwen3:8b", parent: 1, feedback: "Put c03 first." }, paths); + ol.push(jsonReply({ ops: [{ op: "move", id: "c03", after: "title" }] })); + const a = await runTask({ task: "revise-video", article: "synth-basic", n: moved.n, origin: ORIGIN, maxUsd: 1, projectsRoot }, deps()); + assert.equal(a.status, "done", a.summary); + const ma = JSON.parse(await readFile(path.join(projectOf(projectsRoot, "synth-basic", moved.n), "video.manifest.json"), "utf8")); + assert.equal(ma.timeline[1].id, "c03"); + assert.deepEqual( + { task: ma.drafted.timeline.task, model: ma.drafted.timeline.model, iteration: ma.drafted.timeline.iteration, attempt: ma.drafted.timeline.attempt }, + { task: "revise-video", model: "qwen3:8b", iteration: moved.n, attempt: 1 }, + ); + // A heading only: the order is the parent's, and so is its mark. + const renamed = await createIteration("synth-basic", { kind: "revise-video", model: "qwen3:8b", parent: 1, feedback: "Rename the-bakery." }, paths); + ol.push(jsonReply({ ops: [{ op: "heading", id: "the-bakery", text: "About the bakery" }] })); + const b = await runTask({ task: "revise-video", article: "synth-basic", n: renamed.n, origin: ORIGIN, maxUsd: 1, projectsRoot }, deps()); + assert.equal(b.status, "done", b.summary); + const mb = JSON.parse(await readFile(path.join(projectOf(projectsRoot, "synth-basic", renamed.n), "video.manifest.json"), "utf8")); + assert.deepEqual(mb.drafted?.timeline, parentMark); +}); + // ─── release 28 M4–M6: flips, threads, youtube (lane E) ─── // i1 done with the basic report and the FULL manifest with its threads taken