commit 92915c63024ba2dcf2a67f40cb9b841a95fe6ea5
parent 04049c543f986f24e6175652e6bde2917b513f2b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 13 Oct 2026 22:39:48 -0400
report-draft: the teaser task — the closing card's lines, checked by the build's own validateTeaser (r28 M3)
tasks/teaser.ts: one unit per teaser entry; a cut with none gets one after
its last clip (`id: "teaser"`), its lines written through applyDraft as an
empty field. The evidence: the report's title, subtitle, section titles,
claim gists (quoted words out) and the months its sources are from. Code
refuses fewer than 3 or more than 5 lines, a line over 70 characters or on
two lines, quotation marks, a run of 5 words from any quote, a name or
number the evidence lacks, and anything deck.mjs validateTeaser refuses (the
row each role fits); without that check nothing is written.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 375 insertions(+), 1 deletion(-)
diff --git a/common/lib/report/draft/tasks/index.ts b/common/lib/report/draft/tasks/index.ts
@@ -6,6 +6,7 @@ import type { MediaTaskInput } from "./media";
import { cut, type CutInput } from "./cut";
import { narrate, type NarrateInput } from "./narrate";
import { onscreen, type OnscreenInput } from "./onscreen";
+import { teaser, type TeaserInput } from "./teaser";
import { research, type ResearchInput } from "./research";
import { reviseReport, type ReviseReportInput } from "./revise-report";
import { reviseVideo, type ReviseVideoInput } from "./revise-video";
@@ -23,6 +24,7 @@ export { reviseVideo, type ReviseVideoInput } from "./revise-video";
export { narrate, NARRATE_SPEC, type NarrateInput } from "./narrate";
export { cut, CUT_SPEC, CUT_MIN_CLIPS, DEFAULT_MAX_CLIPS, buildCut, cutCandidates, isConverterOrder, type CutInput } from "./cut";
export { loadDeckChecks, type DeckChecks } from "./deckChecks";
+export { teaser, TEASER_SPEC, TEASER_MIN_LINES, TEASER_MAX_LINES, TEASER_LINE_MAX, checkTeaser, type TeaserInput } from "./teaser";
export { onscreen, ONSCREEN_SPEC, ONSCREEN_TITLE_MAX, ONSCREEN_SUBTITLE_MAX, checkOnscreen, type OnscreenInput } from "./onscreen";
// The media task scaffold (release 28, M0): what every media task is.
export {
@@ -60,7 +62,8 @@ export type TaskInput =
| ({ task: "research" } & ResearchInput)
| ({ task: "cut" } & CutInput)
| ({ task: "onscreen" } & OnscreenInput)
- | ({ task: Exclude<MediaStepTask, "narrate" | "cut" | "onscreen"> } & MediaTaskInput);
+ | ({ task: "teaser" } & TeaserInput)
+ | ({ task: Exclude<MediaStepTask, "narrate" | "cut" | "onscreen" | "teaser"> } & MediaTaskInput);
// A media task this build does not have: the step is recorded on the
// iteration as failed, saying so (release 28 lanes D and E replace these).
@@ -92,6 +95,7 @@ export function runTask(input: TaskInput, deps: TaskDeps): Promise<TaskResult> {
case "onscreen":
return onscreen(input, deps);
case "teaser":
+ return teaser(input, deps);
case "flips":
case "threads":
case "youtube":
diff --git a/common/lib/report/draft/tasks/teaser.test.ts b/common/lib/report/draft/tasks/teaser.test.ts
@@ -0,0 +1,143 @@
+// TASK teaser (release 28 M3) over the S0 kit's manifests and the basic
+// report, against the fake ollama: a cut with no teaser gets one after its
+// last clip; each code check refuses what it should (count, length, one line,
+// quotation marks, a quote's run, names and numbers, the build's own
+// validateTeaser); the better of two kept; the operator's lines kept and the
+// draft an alternative; the umtool lint passes on what is written.
+
+import { after, before, test } from "node:test";
+import assert from "node:assert/strict";
+import { execFile } from "node:child_process";
+import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import os from "node:os";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { promisify } from "node:util";
+import { jsonReply, startFakeOllama, type FakeOllama } from "../../../../testing/llm/fakeOllama.mjs";
+import { createIteration, projectOf, updateIteration, writeIterationFile } from "../../iterations";
+import { loadDeckChecks, type DeckChecks } from "./deckChecks";
+import { checkTeaser, claimGist, parseTeaser, teaser, teaserEvidence } from "./teaser";
+import type { DraftFile } from "./media";
+import type { TaskDeps } from "./types";
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const ROOT = path.resolve(HERE, "../../../../..");
+const DRAFT = new URL("../../../../testing/draft/", import.meta.url);
+const kit = async (rel: string) => JSON.parse(await readFile(new URL(rel, DRAFT), "utf8"));
+const run = promisify(execFile);
+
+let tmp: string;
+let ol: FakeOllama;
+let deck: DeckChecks;
+before(async () => {
+ tmp = await mkdtemp(path.join(os.tmpdir(), "teaser-task-"));
+ ol = await startFakeOllama();
+ deck = await loadDeckChecks(ROOT);
+});
+after(async () => {
+ await ol.close();
+ await rm(tmp, { recursive: true, force: true });
+});
+
+let caseN = 0;
+async function project(manifest: unknown, withDeck = true) {
+ caseN++;
+ const paths = { articlesDir: path.join(tmp, `reports-${caseN}`), exportIndexDir: path.join(tmp, `idx-${caseN}`) };
+ const projectsRoot = path.join(tmp, `projects-${caseN}`);
+ await mkdir(paths.articlesDir, { recursive: true });
+ await createIteration("synth-basic", { kind: "sweep", model: "qwen3:8b", question: "q", scope: { channels: ["synth-kitchen"] } }, paths);
+ const report = await kit("reports/basic.report.json");
+ await writeIterationFile("synth-basic", 1, "report.json", report, paths);
+ const dir = projectOf(projectsRoot, "synth-basic", 1);
+ await mkdir(dir, { recursive: true });
+ await writeFile(path.join(dir, "video.manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`);
+ await writeFile(path.join(dir, "report.json"), JSON.stringify(report));
+ await updateIteration("synth-basic", 1, { status: "done", projectDir: dir }, paths);
+ const lines: string[] = [];
+ const deps: TaskDeps = {
+ llm: { ollama: { baseUrl: ol.url } },
+ corpus: { source: "none", tools: [], call: async () => "" },
+ cuesOf: async () => null,
+ paths,
+ log: (l) => lines.push(l),
+ now: () => new Date("2026-10-13T12:00:00.000Z"),
+ ...(withDeck ? { deckChecks: async () => deck } : {}),
+ };
+ const manifestNow = async () => JSON.parse(await readFile(path.join(dir, "video.manifest.json"), "utf8"));
+ const draft = async () => JSON.parse(await readFile(path.join(dir, "teaser-draft.json"), "utf8")) as DraftFile;
+ const input = (o: Record<string, unknown> = {}) => ({ article: "synth-basic", n: 1, model: "qwen3:8b", projectsRoot, ...o });
+ return { dir, deps, lines, manifestNow, draft, input, report };
+}
+
+test("teaser, the recorded run: a cut with none gets one after its last clip; the better of two kept; the umtool lint passes", async () => {
+ const m = await kit("manifests/basic.video.manifest.json");
+ const p = await project(m);
+ const r = await kit("runs/teaser.json");
+ ol.push(...r.turns);
+ const out = await teaser(p.input(), p.deps);
+ assert.equal(out.status, "done", `${out.summary}\n${p.lines.join("\n")}`);
+ assert.equal(ol.remaining(), 0);
+ const after = await p.manifestNow();
+ assert.deepEqual(after.timeline.map((e: { id: string }) => e.id).slice(-2), ["c06", "teaser"]);
+ const t = after.timeline.at(-1);
+ assert.deepEqual(t, {
+ type: "teaser",
+ id: "teaser",
+ lines: ["Synth Kitchen", "The bakery", "The contest", "What the baker says"],
+ drafted: { lines: { task: "teaser", model: "qwen3:8b", at: "2026-10-13T12:00:00.000Z", iteration: 1, attempt: 2 } },
+ });
+ const first = ((await p.draft()).units.teaser as { attempts: { hard: string[] }[] }).attempts[0]!.hard.join("\n");
+ assert.match(first, /line 2 repeats a quote \("would never sell the bakery"\)/);
+ assert.match(first, /line 4: number “two” is not in the report/);
+ const lint = await run(process.execPath, [path.join(ROOT, "umtool/report-to-video/lint.mjs"), path.join(p.dir, "video.manifest.json"), "--json"]).catch((e) => e);
+ assert.deepEqual(JSON.parse(lint.stdout).errors, [], lint.stdout);
+});
+
+test("teaser's checks, each alone; the build's validateTeaser is one of them", async () => {
+ const m = await kit("manifests/basic.video.manifest.json");
+ const report = await kit("reports/basic.report.json");
+ const u = { id: "teaser", entry: null, evidence: teaserEvidence(report, m), quotes: Object.values(report.citations).map((c) => (c as { quote: string }).quote), deck };
+ const hard = (lines: string[], unit: typeof u = u) => checkTeaser(lines, unit).hard;
+ assert.deepEqual(hard(["Synth Kitchen", "The bakery", "The contest"]), []);
+ assert.match(hard(["Synth Kitchen", "The bakery"]).join(), /2 lines \(3 to 5\)/);
+ assert.match(hard(["Synth Kitchen", "The bakery", "The contest", "The bakery", "The contest", "Synth Kitchen"]).join(), /6 lines \(3 to 5\)/);
+ assert.match(hard(["Synth Kitchen", "The bakery", "x".repeat(71)]).join(), /line 3 is 71 characters \(at most 70\)/);
+ assert.match(hard(["Synth Kitchen", "The\nbakery", "The contest"]).join(), /line 2 is more than one line/);
+ assert.match(hard(["Synth Kitchen", "“The bakery”", "The contest"]).join(), /line 2 has quotation marks/);
+ assert.deepEqual(hard(["Synth Kitchen", "The baker's bakery", "The contest"]), [], "an apostrophe is not a quotation");
+ assert.match(hard(["Synth Kitchen", "The bakery", "In 2025"]).join(), /line 3: number 2025 is not in the report/);
+ assert.match(hard(["Synth Kitchen", "The bakery", "Ask Marco"]).join(), /line 3: name “Marco” is not in the report/);
+ // A middle line is a title: past its row's fit the build refuses it.
+ assert.match(hard(["Synth Kitchen", "The bakery and the contest and the oven", "The contest"]).join(), /it would not build: .*lines\[1\]/);
+ // Without the build's check nothing is written.
+ assert.match(hard(["Synth Kitchen", "The bakery", "The contest"], { ...u, deck: null as never }).join(), /not available, so the lines are not written/);
+ assert.equal(claimGist('She says she would not sell: "I would never sell the bakery to a chain"'), "She says she would not sell");
+ assert.deepEqual(parseTeaser({ lines: [" a ", { text: "b" }, ""] }), ["a", "b"]);
+ assert.throws(() => parseTeaser({}), /no "lines"/);
+});
+
+test("teaser: the operator's lines kept (forced, the draft an alternative); a teaser with no deck check is not written", async () => {
+ const full = await kit("manifests/full.video.manifest.json");
+ const p = await project(full);
+ const skipped = await teaser(p.input(), p.deps);
+ assert.equal(skipped.status, "failed");
+ assert.match(String((await p.draft()).units.fin!.skipped), /the operator's/);
+ ol.push(jsonReply({ lines: ["Synth Kitchen", "The bakery", "The contest"] }));
+ const forced = await teaser(p.input({ force: true }), p.deps);
+ assert.match(forced.summary, /^0 teaser\(s\) drafted, 1 as alternatives/);
+ assert.deepEqual((await p.manifestNow()).timeline.at(-1).lines, full.timeline.at(-1).lines);
+ assert.deepEqual((await p.draft()).alternatives.map((a) => [a.target.entry, a.reason]), [["fin", "operator"]]);
+ // Dates in the evidence: the full kit's clips carry none, the evidence says so by leaving them out.
+ assert.doesNotMatch(teaserEvidence(p.report, full), /Sources dated/);
+ const dated = structuredClone(full);
+ dated.timeline.find((e: { id: string }) => e.id === "c07").date = "2026-03-01";
+ dated.timeline.find((e: { id: string }) => e.id === "c01").date = "2026-01-05";
+ assert.match(teaserEvidence(p.report, dated), /Sources dated: January 2026 to March 2026/);
+
+ const q = await project(await kit("manifests/basic.video.manifest.json"), false);
+ ol.push(jsonReply({ lines: ["Synth Kitchen", "The bakery", "The contest"] }), jsonReply({ lines: ["Synth Kitchen", "The bakery", "The contest"] }));
+ const none = await teaser(q.input(), q.deps);
+ assert.equal(none.status, "failed");
+ assert.equal((await q.manifestNow()).timeline.some((e: { type: string }) => e.type === "teaser"), false, "no teaser added");
+ assert.equal(ol.remaining(), 0);
+});
diff --git a/common/lib/report/draft/tasks/teaser.ts b/common/lib/report/draft/tasks/teaser.ts
@@ -0,0 +1,207 @@
+// TASK teaser — the lines of the cut's teaser card (release 28 M3). A STEP on
+// a done iteration (./media.ts): one unit per teaser entry, the field `lines`.
+//
+// The evidence is the report as a whole: its title and subtitle, its section
+// titles, each claim's gist (its words, the quoted ones taken out) and the
+// days its sources are from. The lines are TEASER_MIN_LINES to
+// TEASER_MAX_LINES, each one line of at most TEASER_LINE_MAX characters; the
+// first is drawn as the overline, the middle ones as titles and the last as
+// the kicker (a date, or the turn), and each must fit its role's row — which
+// the build's own `validateTeaser` judges (umtool's deck.mjs, through
+// `TaskDeps.deckChecks`; a teaser it cannot check is not written). No line
+// reads a quote out: no quotation marks, and no run of TEASER_QUOTE_RUN words
+// from any citation's quote. No name or number the evidence does not have.
+//
+// A cut with no teaser gets one: an entry `{type: "teaser", id: "teaser"}`
+// after its last clip, its lines written through applyDraft as any empty
+// field — the operator deletes it like any entry.
+
+import { strictNormalize } from "../../../citations/verify";
+import { applyDraft, entriesWithId } from "../../drafted.mjs";
+import { groundedProblems } from "../grounding";
+import type { ManifestEntry, VideoManifest } from "../videoOps";
+import type { DeckChecks } from "./deckChecks";
+import { runMediaTask, type MediaContext, type MediaReport, type MediaTaskInput, type MediaTaskSpec, type MediaUnit } from "./media";
+import type { TaskDeps, TaskResult } from "./types";
+
+export const TEASER_MIN_LINES = 3;
+export const TEASER_MAX_LINES = 5;
+export const TEASER_LINE_MAX = 70;
+// A run this long copied from a quote is the quote read out.
+export const TEASER_QUOTE_RUN = 5;
+// The row each role fits (deck.mjs TEASER_LIMITS.fit): the prompt's rule; the
+// build's validator is the check.
+const ROLE_FIT = { overline: 64, title: 34, kicker: 56 };
+export const NEW_TEASER_ID = "teaser";
+
+export type TeaserInput = MediaTaskInput;
+
+type TeaserUnit = MediaUnit & {
+ // The teaser entry as it is (null: the cut has none, and the task adds it).
+ entry: ManifestEntry | null;
+ evidence: string;
+ quotes: string[];
+ deck: DeckChecks | null;
+};
+
+type Obj = Record<string, any>;
+const isObj = (v: unknown): v is Obj => !!v && typeof v === "object" && !Array.isArray(v);
+const stripCites = (s: string) => s.replace(/\[([^\]]+)\]\(cite:[^)]+\)/g, "$1").replace(/\(cite:[^)]+\)/g, "").replace(/\s+/g, " ").trim();
+const QUOTE_MARKS_RE = /["“”«»„‟]|‘[^’]*’|(^|\s)'[^']+'(?=[\s.,;:!?]|$)/;
+
+/** A claim's gist: its words with every quoted part (and the colon before it) taken out. */
+export function claimGist(text: string): string {
+ return stripCites(text)
+ .replace(/:?\s*("[^"]*"|“[^”]*”)/g, "")
+ .replace(/\s+/g, " ")
+ .replace(/[\s:,;]+$/, "")
+ .trim();
+}
+
+const MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
+
+/** The report as the teaser may use it: titles, section titles, claim gists, the days of its sources. */
+export function teaserEvidence(report: MediaReport, manifest: VideoManifest): string {
+ const lines = [`Report: ${String(report.title ?? "")}`];
+ if (report.subtitle) lines.push(`Subtitle: ${String(report.subtitle)}`);
+ for (const s of Array.isArray(report.sections) ? report.sections : []) {
+ const gists = (Array.isArray(s?.claims) ? s.claims : []).map((c: Obj) => claimGist(String(c?.text ?? ""))).filter(Boolean);
+ if (!gists.length) continue;
+ lines.push(`Section: ${String(s.title ?? "")}`);
+ for (const g of gists.slice(0, 8)) lines.push(`- ${g}`);
+ }
+ const days = new Set<string>();
+ for (const c of Object.values(isObj(report.citations) ? report.citations : {})) if (typeof (c as Obj)?.date === "string") days.add((c as Obj).date.slice(0, 10));
+ for (const e of manifest.timeline) if (typeof e.date === "string") days.add(e.date.slice(0, 10));
+ const sorted = [...days].filter((d) => /^\d{4}-\d{2}/.test(d)).sort();
+ if (sorted.length) {
+ const month = (d: string) => `${MONTHS[Number(d.slice(5, 7)) - 1] ?? ""} ${d.slice(0, 4)}`.trim();
+ lines.push(`Sources dated: ${month(sorted[0]!)}${sorted.length > 1 && month(sorted.at(-1)!) !== month(sorted[0]!) ? ` to ${month(sorted.at(-1)!)}` : ""}`);
+ }
+ return lines.join("\n");
+}
+
+/** The quote words a line repeats in a run of TEASER_QUOTE_RUN or more, or null. */
+export function quoteRunIn(line: string, quotes: readonly string[]): string | null {
+ const said = ` ${strictNormalize(line)} `;
+ for (const q of quotes) {
+ const w = strictNormalize(q).split(" ").filter(Boolean);
+ for (let k = 0; k + TEASER_QUOTE_RUN <= w.length; k++) {
+ const run = w.slice(k, k + TEASER_QUOTE_RUN).join(" ");
+ if (said.includes(` ${run} `)) return run;
+ }
+ }
+ return null;
+}
+
+/** The teaser entry these lines would make. */
+export const teaserEntryOf = (u: Pick<TeaserUnit, "entry" | "id">, lines: string[]): ManifestEntry =>
+ ({ ...(u.entry ?? { type: "teaser", id: u.id }), lines }) as ManifestEntry;
+
+/** Every code check of a teaser's lines: `hard` refuses them. */
+export function checkTeaser(lines: string[], u: Pick<TeaserUnit, "entry" | "id" | "evidence" | "quotes" | "deck">): { hard: string[]; soft: string[] } {
+ const hard: string[] = [];
+ if (lines.length < TEASER_MIN_LINES || lines.length > TEASER_MAX_LINES) hard.push(`${lines.length} lines (${TEASER_MIN_LINES} to ${TEASER_MAX_LINES})`);
+ lines.forEach((l, i) => {
+ const n = `line ${i + 1}`;
+ if (!l.trim()) hard.push(`${n} is empty`);
+ if (/[\r\n]/.test(l)) hard.push(`${n} is more than one line`);
+ if (l.trim().length > TEASER_LINE_MAX) hard.push(`${n} is ${l.trim().length} characters (at most ${TEASER_LINE_MAX})`);
+ if (QUOTE_MARKS_RE.test(l)) hard.push(`${n} has quotation marks: a teaser reads no quote out`);
+ const run = quoteRunIn(l, u.quotes);
+ if (run) hard.push(`${n} repeats a quote ("${run}"): the clips say it; the teaser does not read it out`);
+ for (const p of groundedProblems(l, u.evidence, "the report")) hard.push(`${n}: ${p}`);
+ });
+ if (!hard.length) {
+ if (!u.deck) hard.push("the build's teaser check (deck.mjs validateTeaser) is not available, so the lines are not written");
+ else for (const e of u.deck.validateTeaser(teaserEntryOf(u, lines), `teaser ${u.id}`)) hard.push(`it would not build: ${e}`);
+ }
+ return { hard, soft: [] };
+}
+
+export function teaserSystem(): string {
+ const rules = [
+ `Write ${TEASER_MIN_LINES} to ${TEASER_MAX_LINES} short lines, each one line of plain words.`,
+ `The first line is the overline (at most ${ROLE_FIT.overline} characters): who or what the video is about.`,
+ `The middle lines are titles (each at most ${ROLE_FIT.title} characters): the questions or findings the video turns on, without giving the answers away.`,
+ `The last line is the kicker (at most ${ROLE_FIT.kicker} characters): when, or the turn the video ends on.`,
+ "Read no quote out: no quotation marks, and do not repeat the speakers' words.",
+ "Use only names, numbers and dates that appear in the evidence.",
+ "Write in the third person.",
+ ];
+ return (
+ "You write the teaser card that closes a short evidence video: a few lines that slam in one after another. " +
+ `Rules: ${rules.map((r, i) => `(${i + 1}) ${r}`).join(" ")} ` +
+ 'Answer with "lines": the lines in order.'
+ );
+}
+
+const SCHEMA = { type: "object", properties: { lines: { type: "array", items: { type: "string" } } }, required: ["lines"] };
+
+/** The model's answer to lines (a throw is a hard failure). */
+export function parseTeaser(answer: unknown): string[] {
+ const a = isObj(answer) ? answer : {};
+ if (!Array.isArray(a.lines)) throw new Error('no "lines" in the answer');
+ return a.lines.map((l: unknown) => (typeof l === "string" ? l : isObj(l) && typeof l.text === "string" ? l.text : String(l ?? "")).trim()).filter((l: string) => l !== "");
+}
+
+// A free id for a new teaser: "teaser", else "teaser-2", …
+function freeId(manifest: VideoManifest): string {
+ const ids = new Set(manifest.timeline.map((e) => e.id));
+ if (!ids.has(NEW_TEASER_ID)) return NEW_TEASER_ID;
+ for (let i = 2; ; i++) if (!ids.has(`${NEW_TEASER_ID}-${i}`)) return `${NEW_TEASER_ID}-${i}`;
+}
+
+async function teaserUnits(ctx: MediaContext<TeaserInput>): Promise<TeaserUnit[]> {
+ const { manifest, report } = ctx;
+ let deck: DeckChecks | null = null;
+ try {
+ deck = (await ctx.handle.deps.deckChecks?.()) ?? null;
+ } catch (e) {
+ ctx.handle.log(` the build's teaser check is not loaded (${(e as Error).message})`);
+ }
+ const evidence = teaserEvidence(report, manifest);
+ const quotes = Object.values(isObj(report.citations) ? report.citations : {})
+ .map((c) => String((c as Obj)?.quote ?? ""))
+ .concat(manifest.timeline.map((e) => String(e.quote ?? "")))
+ .filter(Boolean);
+ const seen = new Set<string>();
+ const teasers = manifest.timeline.filter((e) => e.type === "teaser" && !seen.has(e.id) && seen.add(e.id));
+ const base = { evidence, quotes, deck };
+ if (!teasers.length) {
+ const id = freeId(manifest);
+ return [{ id, target: { entry: id, field: "lines" }, label: "a new teaser after the last clip", entry: null, ...base }];
+ }
+ return teasers.map((e) => ({ id: e.id, target: { entry: e.id, field: "lines" }, entry: e, ...base }));
+}
+
+/** The teaser as a media task (./media.ts): one unit per teaser entry, or one new teaser. */
+export const TEASER_SPEC: MediaTaskSpec<TeaserUnit, string[], TeaserInput> = {
+ task: "teaser",
+ noun: "teaser",
+ verb: "drafted",
+ progressMetric: "entries",
+ units: (ctx) => teaserUnits(ctx),
+ schema: () => SCHEMA,
+ system: () => teaserSystem(),
+ user: (u) => `Evidence (the only facts you may use):\n${u.evidence}\n\nWrite the teaser's lines.`,
+ parse: (answer) => parseTeaser(answer),
+ check: (lines, u) => checkTeaser(lines, u),
+ apply(manifest, u, value, provenance, force) {
+ // No teaser yet: add one after the last clip, then write its lines as any
+ // empty field.
+ if (!u.entry && !entriesWithId(manifest, u.id).length) {
+ let at = -1;
+ manifest.timeline.forEach((e, i) => {
+ if (e.type === "clip") at = i;
+ });
+ manifest.timeline.splice(at < 0 ? manifest.timeline.length : at + 1, 0, { type: "teaser", id: u.id } as ManifestEntry);
+ }
+ return applyDraft(manifest, { entry: u.id, field: "lines", value, provenance, force });
+ },
+ describe: (lines) => lines.join(" / "),
+};
+
+export async function teaser(input: TeaserInput, deps: TaskDeps): Promise<TaskResult> {
+ return runMediaTask(TEASER_SPEC, input, deps);
+}
diff --git a/common/testing/draft/runs/teaser.json b/common/testing/draft/runs/teaser.json
@@ -0,0 +1,20 @@
+{
+ "task": "teaser",
+ "model": "qwen3:8b",
+ "turns": [
+ {
+ "message": {
+ "role": "assistant",
+ "content": "{\"lines\": [\"Synth Kitchen\", \"She would never sell the bakery\", \"The contest\", \"Two streams later\"]}"
+ },
+ "done": true
+ },
+ {
+ "message": {
+ "role": "assistant",
+ "content": "{\"lines\": [\"Synth Kitchen\", \"The bakery\", \"The contest\", \"What the baker says\"]}"
+ },
+ "done": true
+ }
+ ]
+}