// WHAT THE LAST "FIND CLIPS" FOUND — `data//find-clips.json` (release 36, // lane A). Written by the find-clips job when umtool's clip finder finished // (controller/findClips.ts); read by the video page's Find clips panel, which // links the umtool project and lists the narrated-video segments umtool found, // each with its own "Find clips in this part". Overwritten by the next run // (the newest run is the one the panel describes; a per-segment run names its // segment). A small text sidecar on the corpus disk; never published. import { sidecar, sidecarField } from "./sidecar-server"; export const FIND_CLIPS_FILENAME = "find-clips.json"; export type FindClipsSegment = { id: string; from: number; to: number; subject?: number | string; host?: number | string; why?: string; }; export type FindClipsStepRecord = { id: string; label: string; action: "ran" | "skipped"; why: string; }; export type FindClipsRecord = { version: 1; at: string; jobId: string; // The umtool project, its clip editor's URL, and whether umtool made it now // (false: it re-analyzed the project already cut from this recording). project: string; url: string; created: boolean; // The segment this run was scoped to: the one asked for, else the one // umtool's auto-scope chose (its answer's `segment`). segment?: string; // Every narrated-video segment umtool found in the recording. segments: FindClipsSegment[]; steps: FindClipsStepRecord[]; }; function coerce(value: unknown): FindClipsRecord | null { if (!value || typeof value !== "object" || Array.isArray(value)) return null; const v = value as Record; if (v.version !== 1 || typeof v.project !== "string" || typeof v.url !== "string") return null; if (!Array.isArray(v.segments) || !Array.isArray(v.steps)) return null; return value as FindClipsRecord; } export const findClipsSidecar = sidecar(FIND_CLIPS_FILENAME, sidecarField(coerce), { indent: 2 }); export const loadFindClipsRecord = findClipsSidecar.load; export const writeFindClipsRecord = findClipsSidecar.write;