Archilyzer · Source

archilyzer

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

commit 7ab5332b31a19f2e2d6b5dd2bb2cfab27ec9806a
parent 9ff8a0872b62a8595c91c00f39395e17cc9f1345
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 20 Oct 2026 14:43:54 -0400

common: revise-video takes the look ops (look, slide, room) through the look's own rules

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

Diffstat:
Mcommon/lib/report/draft/tasks/revise-report.ts | 7++++---
Mcommon/lib/report/draft/tasks/revise-video.ts | 25++++++++++++++++++++++---
Mcommon/lib/report/draft/videoOps.test.ts | 26++++++++++++++++++++++++++
Mcommon/lib/report/draft/videoOps.ts | 18+++++++++++++++++-
4 files changed, 69 insertions(+), 7 deletions(-)

diff --git a/common/lib/report/draft/tasks/revise-report.ts b/common/lib/report/draft/tasks/revise-report.ts @@ -345,10 +345,11 @@ export async function reviseReportBody(h: TaskHandle, input: ReviseReportInput): // then says nothing was proposed); a cancel is rethrown. export async function localOpsBatch( h: TaskHandle, - o: { model: string; system: string; what: string; build: (maxChars: number) => string; apply: (ops: unknown[]) => Promise<unknown> }, + o: { model: string; system: string; what: string; build: (maxChars: number) => string; apply: (ops: unknown[]) => Promise<unknown>; schema?: object }, ): Promise<void> { const { deps } = h; - const fitted = fitLocalAsk({ llm: deps.llm, model: o.model, system: o.system, schema: OPS_SCHEMA, build: o.build }); + const schema = o.schema ?? OPS_SCHEMA; + const fitted = fitLocalAsk({ llm: deps.llm, model: o.model, system: o.system, schema, build: o.build }); h.log(`one ops batch over the ${o.what} (~${fitted.tokens} of ${fitted.cap} prompt tokens)`); const t0 = Date.now(); const asked = await structuredAnswer<{ ops?: unknown[] }>({ @@ -356,7 +357,7 @@ export async function localOpsBatch( model: o.model, system: o.system, user: fitted.user, - schema: OPS_SCHEMA, + schema, meter: h.meter, signal: deps.signal, }).catch((e: unknown) => { diff --git a/common/lib/report/draft/tasks/revise-video.ts b/common/lib/report/draft/tasks/revise-video.ts @@ -33,8 +33,26 @@ export const VIDEO_OPS_TEXT = [ '- {"op":"trim","id":"<clip id>","start":S,"end":E} a clip\'s in/out seconds, within 3 s of its current ones', '- {"op":"add_clip","citation":"<citation id from the report>","after":"<entry id>"} a clip for a cited moment not in the cut', '- {"op":"title","text":"..."} / {"op":"subtitle","text":"..."}', + // Release 38: the look (the video assistant's look ops, checked by the look's own rules). + '- {"op":"look","key":"transition","value":0.15} the join between clips in seconds (0 = hard cuts); key transitionStyle (fade, fadeblack, fadewhite, dissolve, blurslide), qr (true/false), loudness (a LUFS target, higher = louder; null = as recorded), captions (true/false), headerHeight / footerHeight (pixels, 0 = off)', + '- {"op":"slide","key":"blur","value":0.3} the blur slide: key travel, blur (the smear) or grain', + '- {"op":"room","key":"maxS","value":2} room at the clips\' edges: key tail / head (true/false), maxS (seconds the sound may run past a cut), minGap', ].join("\n"); +// OPS_SCHEMA and the look ops' key and value (release 38). +export const VIDEO_OPS_SCHEMA = { + ...OPS_SCHEMA, + properties: { + ops: { + ...OPS_SCHEMA.properties.ops, + items: { + ...OPS_SCHEMA.properties.ops.items, + properties: { ...OPS_SCHEMA.properties.ops.items.properties, key: { type: "string" }, value: { type: ["number", "string", "boolean", "null"] } }, + }, + }, + }, +}; + const shortQuote = (q: string, words = 12) => { const w = q.split(/\s+/).filter(Boolean); return w.length > words ? `${w.slice(0, words - 4).join(" ")} …` : q; @@ -94,7 +112,7 @@ async function reviseVideoBody(h: TaskHandle, input: ReviseVideoInput): Promise< .join("\n"); const view = () => `${cutView(manifest)}\n\nREPORT CITATIONS (add_clip takes these ids):\n${cites}`; const applyOps = (ops: unknown[]) => { - const r = applyVideoOps(manifest, ops, { report, parent: parent.manifest }); + const r = applyVideoOps(manifest, ops, { report, parent: parent.manifest, feedback }); manifest = r.manifest; applied.push(...r.applied); refused.push(...r.refused); @@ -110,7 +128,7 @@ async function reviseVideoBody(h: TaskHandle, input: ReviseVideoInput): Promise< { name: "apply_ops", description: "Apply edit operations (see the system prompt). Returns what was applied and refused, and the cut after.", - inputSchema: OPS_SCHEMA, + inputSchema: VIDEO_OPS_SCHEMA, run: async (inp: { ops?: unknown }) => { const r = applyOps(Array.isArray(inp?.ops) ? inp.ops : []); return ( @@ -135,6 +153,7 @@ async function reviseVideoBody(h: TaskHandle, input: ReviseVideoInput): Promise< model, system: `${LOCAL_REVISE_RULES(what)}\n\n${VIDEO_OPS_TEXT.replace("objects for apply_ops", "objects in the `ops` list")}`, what: "cut", + schema: VIDEO_OPS_SCHEMA, build: (maxChars) => { const budget = maxChars - feedback.length - 400; const cut = trimmedCutView(manifest, { maxChars: Math.floor(budget * 0.7), feedback }); @@ -185,7 +204,7 @@ async function reviseVideoBody(h: TaskHandle, input: ReviseVideoInput): Promise< model, system, user: `OPERATOR FEEDBACK:\n${feedback}\n\nTHE VIDEO NOW:\n${view()}\n\nAnswer with the ops batch that carries out the feedback.`, - schema: OPS_SCHEMA, + schema: VIDEO_OPS_SCHEMA, meter: h.meter, signal: deps.signal, }).catch((e: unknown) => { diff --git a/common/lib/report/draft/videoOps.test.ts b/common/lib/report/draft/videoOps.test.ts @@ -147,3 +147,29 @@ test("trimmed cut view (Q3): the named chapter in full, every entry still listed assert.ok(v.text.length < full.length); assert.equal(trimmedCutView(manifest, { maxChars: 1e6 }).short.length, 0); }); + +test("the look ops (release 38): look, slide and room through the look's own rules; a bad value refused with the build's sentence", () => { + const r = applyVideoOps( + manifest, + [ + { op: "look", key: "transition", value: 0.15 }, + { op: "slide", key: "blur", value: 0.3 }, + { op: "room", key: "tail", value: 2 }, + { op: "look", key: "transition", value: 9 }, + { op: "look", key: "chrome", value: {} }, + ], + { report, feedback: "quicker joins, less smear, keep 2 s after the last word" }, + ); + const render = r.manifest.render as { transition: number; slide: unknown; room: unknown }; + assert.equal(render.transition, 0.15); + assert.deepEqual(render.slide, { blur: 0.3 }); + assert.deepEqual(render.room, { tail: true, maxS: 2 }); + assert.deepEqual(r.applied.map((a) => a.index), [0, 1, 2]); + // The slide's knobs warn on a cut whose join is not a blur slide. + assert.match(r.applied[1]!.warnings![0]!, /the slide's knobs show once the join style is blur slide/); + assert.deepEqual( + r.refused.map((x) => x.why), + ["render.transition must be a number of seconds from 0 (a hard cut) to 3", '"chrome" is not a look setting (headerHeight, footerHeight, qr, transition, transitionStyle, loudness, captions, room, slide)'], + ); + assert.equal((manifest.render as { transition: number }).transition, 0.4, "the input is not touched"); +}); diff --git a/common/lib/report/draft/videoOps.ts b/common/lib/report/draft/videoOps.ts @@ -9,6 +9,9 @@ // trim {id, start, end} a clip's in/out, within the fetched window ±3 s // add_clip {citation, after?} a clip for a video citation of the report not in the cut // title {text} / subtitle {text} +// look {key, value} a look setting (release 38: the video assistant's ops, +// slide {key, value} ../videoAssistOps.mjs — checked by the look's own rules, +// room {key, value} common lib/report/look.mjs, as umtool's updateRender is) // // The rules, in code: // - A narration passes ./grounding.ts's hard checks, or the op is refused @@ -23,8 +26,9 @@ // Pure: the manifest in, a new one out. import { checkNarration, groundingInputOf, type GroundingInput } from "./grounding"; +import { checkAssistOps } from "../videoAssistOps.mjs"; -export const VIDEO_OP_NAMES = ["drop", "move", "heading", "narration", "trim", "add_clip", "title", "subtitle"] as const; +export const VIDEO_OP_NAMES = ["drop", "move", "heading", "narration", "trim", "add_clip", "title", "subtitle", "look", "slide", "room"] as const; export const TRIM_SLACK_SECONDS = 3; @@ -63,6 +67,8 @@ export type VideoOpsContext = { parent?: VideoManifest; // Grounding's input; default: from the report. grounding?: GroundingInput; + // The operator's words: a look op may name more seconds than a step allows. + feedback?: string; }; export type VideoOpsResult = { manifest: VideoManifest; applied: AppliedVideoOp[]; refused: RefusedVideoOp[] }; @@ -173,6 +179,16 @@ export function applyVideoOps(input: VideoManifest, ops: readonly unknown[], ctx parentClips.set(cid, e); break; } + case "look": + case "slide": + case "room": { + // The video assistant's look ops (release 38): the look's own rules decide. + const r = checkAssistOps(manifest, [op], { request: ctx.feedback ?? "", scope: "look" }); + if (r.refused.length) refuse(r.refused[0]!.why); + manifest.render = r.manifest.render; + if (r.ops[0]?.warning) warnings = [r.ops[0].warning]; + break; + } case "title": case "subtitle": { const t = str(op.text, "text").trim();