/** * `vclaw video match-highlights` — the PURE verification passes. * * The one-pass segment listing is good at timestamps and bad at completeness and * at outcome labels. Measured on the live 2026-09-16 run (part 1, 91 minutes): * the listing produced 120 deliveries, of which 21 were duplicates and 17 real * legal balls were missing across 13 gaps; of 13 claimed fours only 9 were real, * and 5 real fours sat on balls the listing had skipped entirely. * * So three passes sit on top of the listing, ported from the proven * `verify_part.py` harness: * * 1. **Gap pass** (completeness). Long silences between catalogued deliveries * are cut into stretch reels and one agentic call per batch lists whatever * deliveries are inside them. Recovered rows are merged back and deduped. * 2. **Judge 1** (precision). Every candidate boundary is cut into one reel and * one agentic call rules on each window: did the ball actually reach the rope? * 3. **Judge 2** (recall inside precision). A candidate the judge rejected, but * which the listing had called a boundary, gets its whole stretch re-examined * — the boundary is often on a ball the listing skipped, not on the one it * catalogued. * * Then every event is RELABELLED from the judged verdicts, because the listing's * own `t` values are the part that cannot be trusted. * * Everything here is a deterministic function of its inputs. The reels, uploads * and calls live in `src/cli/handlers/match-highlights-passes.ts`. */ import type { MatchEvent } from './match-highlights.js'; import type { MatchWindow } from './match-highlights-cut.js'; /** A gap counts as "something is missing" past `max(floor, multiplier × median gap)`. */ export declare const GAP_MEDIAN_MULTIPLIER = 2.2; export declare const GAP_FLOOR_SECONDS = 50; /** Fallback median when the listing is too short to have gaps. */ export declare const GAP_MEDIAN_FALLBACK = 20; /** * A stretch longer than this is not scanned. A segment that failed leaves a hole * the size of a whole segment; re-uploading that as a "gap" would cost as much as * the original call and is not what the pass is for. */ export declare const MAX_STRETCH_SECONDS = 300; /** Stretches per gap-pass reel. One call per batch keeps each prompt legible. */ export declare const GAP_BATCH_SIZE = 8; /** * Total source seconds per gap reel. Eight 300-second stretches would be a * 40-minute re-encode read into ONE Buffer for the upload; the live run saw a * 782 MB reel that way. Whichever cap is reached first closes the batch. */ export declare const GAP_BATCH_MAX_SECONDS = 900; /** Two events whose starts are within this are one event. */ export declare const DEDUPE_WITHIN_SECONDS = 4; /** A window at least this long is judged even when the listing gave it a dull label. */ export declare const JUDGE_LONG_WINDOW_SECONDS = 14; /** Padding for the gap-pass stretch reels. */ export declare const GAP_REEL_PRE = 1.5; export declare const GAP_REEL_POST = 2; /** Padding for the judge reels. */ export declare const JUDGE_REEL_PRE = 1.5; export declare const JUDGE_REEL_POST = 3; /** How long past the last event a trailing disputed stretch may run. */ export declare const DISPUTED_TAIL_SECONDS = 30; export interface WindowTableRow { /** Index announced to the model. */ i: number; /** Position of this window inside the concatenated reel. */ reelStart: number; reelEnd: number; /** Position in the source recording. */ start: number; end: number; note: string; /** Indices into the array the windows were planned from. */ sources: number[]; } /** * Lay the cut windows out along the reel they will be concatenated into. * * `sources` is carried through from {@link planWindows}. Recovering the event by * un-padding (`start + pre`) is NOT safe: a window clamped at 0 or at the * duration no longer carries its padding, and a merged window would hand one * verdict to two events. */ export declare function buildWindowTable(windows: readonly MatchWindow[]): WindowTableRow[]; /** The window list as the prompt states it. */ export declare function windowsText(table: readonly WindowTableRow[], label?: string): string; /** Clip seconds → source seconds for one window. */ export declare function clipToSource(window: WindowTableRow, clipSeconds: number): number; export interface GapStretch { /** Source seconds the stretch spans (between two catalogued events). */ s: number; e: number; n: string; } export interface GapDetection { stretches: GapStretch[]; medianGap: number; threshold: number; /** Stretches longer than {@link MAX_STRETCH_SECONDS}, left alone; usually a failed segment. */ oversized: number; } /** * Find the silences that are long enough to hide a delivery. * * The gap is measured END of one event to START of the next. The threshold is * deliberately loose: a stretch that turns out to hold nothing costs an empty * array in the answer, while a missed stretch costs a ball. On the live run this * flagged 21 stretches, of which 13 held the 17 recovered balls. */ export declare function detectGapStretches(events: readonly MatchEvent[], options?: { medianMultiplier?: number; floorSeconds?: number; maxStretchSeconds?: number; }): GapDetection; /** * Split the stretches into one reel's worth each: at most `size` stretches AND * at most `maxSeconds` of source per reel. The seconds cap matters because the * reel is re-encoded and then read into ONE Buffer to upload. */ export declare function batchStretches(stretches: readonly GapStretch[], size?: number, maxSeconds?: number): GapStretch[][]; export interface MappedGapRows { recovered: MatchEvent[]; /** Rows that named an unknown stretch, carried a bad number, or landed outside their stretch. */ dropped: number; } /** * Map one gap-pass answer (`{w, s, e, t, n}` in CLIP seconds) back onto the * source timeline. A row whose start falls outside its own stretch (±2 s of the * padded window) is dropped and counted: the model has drifted onto a * neighbouring window and its timestamp would be wrong. */ export declare function mapGapRows(payload: unknown, table: readonly WindowTableRow[]): MappedGapRows; export interface DedupeResult { events: MatchEvent[]; removed: number; } /** * Two starts within `withinSeconds` are one delivery: the listing repeats itself * across a segment seam, and the gap pass re-finds a ball that was catalogued * after all. The survivor keeps the earlier start and the later end, joins the * notes, and is PROMOTED to an interesting label if the absorbed row had one — * a duplicate that says "four" is worth more than one that says "dot". */ export declare function dedupeEvents(events: readonly MatchEvent[], options?: { withinSeconds?: number; interestingTypes?: readonly string[]; }): DedupeResult; export interface JudgeVerdict { /** Window index inside the judged reel. */ i: number; /** Source seconds of the event this verdict is about. */ start: number; end: number; boundary: boolean; kind?: string; evidence?: string; via: 'judge-1' | 'judge-2'; } /** * Which events get judged: the ones the listing labelled interesting, PLUS any * window at least {@link JUDGE_LONG_WINDOW_SECONDS} long. The long-window clause * is the recall lever — a ball that reached the rope takes a while to come back, * so a long window is suspicious regardless of what the listing called it. * Returns indices into `events`. */ export declare function selectJudgeCandidates(events: readonly MatchEvent[], types: readonly string[], longWindowSeconds?: number): number[]; /** Map a judge-1 answer (`{i, boundary, kind, evidence}`) onto the events it judged. */ export declare function mapJudgeVerdicts(payload: unknown, table: readonly WindowTableRow[], events: readonly MatchEvent[]): JudgeVerdict[]; /** * The stretches judge 2 re-examines: a candidate the judge REJECTED that the * listing had nonetheless called a boundary. On the live run this is where the * real four usually was — on the very next ball, which the listing had skipped. * Each stretch runs from that event's start to the following event's start. */ export declare function selectDisputedStretches(events: readonly MatchEvent[], verdicts: readonly JudgeVerdict[], types: readonly string[], durationSeconds: number): GapStretch[]; /** * Map a judge-2 answer (`{i, boundary, kind, runUpStart, deadBall, evidence}`) * back to source seconds. Unlike judge 1 these verdicts carry their OWN * timestamps, because the whole point is that the boundary was on a different * ball from the one the stretch starts with. */ export declare function mapDisputedVerdicts(payload: unknown, table: readonly WindowTableRow[]): JudgeVerdict[]; /** * Does this verdict confirm its event? * * `boundary` asks one question — did the ball reach the rope — so a judged * WICKET comes back `{boundary: false, kind: "wicket"}`. Reading `boundary` * alone therefore threw away real wickets from a reel whose default `--types` * includes them. A verdict also confirms when its `kind` is one of the types * being kept, which generalises past cricket. */ export declare function verdictConfirms(verdict: JudgeVerdict, types: readonly string[]): boolean; export interface RelabelResult { events: MatchEvent[]; /** Events promoted to a judged label. */ promoted: number; /** Events the listing called a boundary that the judge did not confirm. */ demoted: number; } /** * Replace the listing's outcome labels with the judged ones. * * This is the step that makes `--types` mean something. The listing's `t` is the * part the live run found unreliable: 13 claimed fours, 9 real. Every event * within 4 s of a confirmed boundary takes that boundary's kind; every other * event still carrying an unconfirmed interesting label is demoted to * `demotedType`. Judge-2 boundaries that match no existing event are ADDED, * because they sit on balls the listing never catalogued. */ export declare function relabelEvents(events: readonly MatchEvent[], boundaries: readonly JudgeVerdict[], options?: { types?: readonly string[]; demotedType?: string; withinSeconds?: number; }): RelabelResult; export interface SportPrompts { id: string; /** Default event types for the highlights reel. */ highlightTypes: readonly string[]; /** The per-segment listing prompt. */ listing: string; /** "What did the listing miss in these stretches?" */ gap(table: readonly WindowTableRow[]): string; /** "Did each of these actually happen?" */ judge(table: readonly WindowTableRow[]): string; /** "The listing says there was one here and you said no — look at the whole stretch." */ disputed(table: readonly WindowTableRow[]): string; /** * "Each of these windows ends on a scorer's keystroke — find the ball it was for." * Used by `--events-file … --place`, where the events are already known and only * their timing is being bought. `postSeconds` is the window's own tail, so the prompt * cannot drift from the geometry it describes. */ place(table: readonly WindowTableRow[], options?: { postSeconds?: number; }): string; } /** * One entry per sport. The prompts are the exact wording the live run used; a new * sport is a data addition here, not a code change. Scoreboard OCR is deliberately * NOT part of this: it was broadcast-specific and is a separate concern. */ export declare const SPORT_PROMPTS: Record; export declare const DEFAULT_SPORT = "cricket"; export declare function resolveSport(id: string | undefined): SportPrompts; /** * The one retry this command allows. `too many tool calls` means the agentic * loop ran out of tool budget scanning a long reel — a different failure from * `incomplete` (the output cap), which is terminal and never retried. Retrying * with an instruction to inspect fewer, larger windows is what unstuck the live * run's longest gap batches. */ export declare function isToolCallOverflow(error: unknown): boolean; export declare const TOOL_OVERFLOW_RETRY_PREFIX = "[retry] The previous attempt failed with: 'Model generated too many tool calls'. Inspect fewer, larger windows this time.\n\n"; //# sourceMappingURL=match-highlights-verify.d.ts.map