agentcut 0.1.1 → 0.2.2

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.
@@ -0,0 +1,118 @@
1
+ import type { WorkspacePaths } from "./workspace.js";
2
+ export declare const REFERENCE_DOMAINS: string[];
3
+ export declare const LOGIN_BROWSERS: readonly ["chrome", "safari", "firefox", "edge", "brave"];
4
+ export type LoginBrowser = (typeof LOGIN_BROWSERS)[number];
5
+ export type ReferenceStage = "setup" | "downloading" | "frames" | "ready" | "failed";
6
+ export type ReferenceErrorCode = "login_required" | "cookies" | "unavailable" | "too_long" | "too_large" | "unsupported" | "network" | "setup" | "cancelled" | "failed";
7
+ export interface ReferenceFrame {
8
+ path: string;
9
+ time: number;
10
+ }
11
+ export interface ReferenceJob {
12
+ id: string;
13
+ slug: string;
14
+ /** Source link, or null for an uploaded video. */
15
+ url: string | null;
16
+ browser: LoginBrowser | null;
17
+ stage: ReferenceStage;
18
+ /** 0..1 while downloading, else null. */
19
+ progress: number | null;
20
+ detail?: string;
21
+ /** Project-relative paths, set when ready. */
22
+ path?: string;
23
+ dir?: string;
24
+ frames?: ReferenceFrame[];
25
+ sheet?: string | null;
26
+ error?: {
27
+ code: ReferenceErrorCode;
28
+ message: string;
29
+ };
30
+ }
31
+ declare class ReferenceError extends Error {
32
+ readonly code: ReferenceErrorCode;
33
+ constructor(code: ReferenceErrorCode, message: string);
34
+ }
35
+ export declare function normalizeReferenceUrl(raw: unknown): string;
36
+ /** Browsers with a profile on this computer (where yt-dlp reads logins), most convenient first. */
37
+ export declare function installedBrowsers(): LoginBrowser[];
38
+ export declare function ensureFfmpeg(onDownload?: () => void): Promise<string>;
39
+ /** yt-dlp, updated every few days (or now with `force`, after an unexplained failure). */
40
+ export declare function ensureYtdlp({ force, onDownload }?: {
41
+ force?: boolean;
42
+ onDownload?: () => void;
43
+ }): Promise<string>;
44
+ /** Turn yt-dlp's output into something the user can act on. */
45
+ export declare function classifyFailure(output: string, browser: LoginBrowser | null): ReferenceError;
46
+ export interface ReferenceShot {
47
+ start: number;
48
+ end: number;
49
+ frames: string[];
50
+ }
51
+ /**
52
+ * Shots from cut times, and when to grab frames: the opening, the middle of every shot (more for
53
+ * long ones), and the ending. Capped at MAX_FRAMES, keeping the opening and an even spread.
54
+ */
55
+ export declare function planFrames(duration: number, cuts: number[]): {
56
+ shots: {
57
+ start: number;
58
+ end: number;
59
+ }[];
60
+ times: number[];
61
+ };
62
+ export interface ReferenceStrip {
63
+ kind: "hook" | "cut" | "captions";
64
+ /** Seconds covered, sampled at `fps`, frames left to right, top to bottom. */
65
+ start: number;
66
+ end: number;
67
+ fps: number;
68
+ path: string;
69
+ /** For cuts: the cut time. */
70
+ at?: number;
71
+ }
72
+ /** Windows worth seeing in motion: the hook, around every cut, and a stretch of captions. */
73
+ export declare function planStrips(duration: number, shots: {
74
+ start: number;
75
+ end: number;
76
+ }[]): Omit<ReferenceStrip, "path">[];
77
+ export interface ReferenceAnalysis {
78
+ duration: number;
79
+ cuts: number[];
80
+ averageShotSeconds: number;
81
+ shots: ReferenceShot[];
82
+ frames: ReferenceFrame[];
83
+ /** Every frame in one image, in order, left to right. */
84
+ sheet: string | null;
85
+ /** Short stretches sampled several times a second: transitions, graphics entering, captions. */
86
+ strips: ReferenceStrip[];
87
+ }
88
+ export declare class ReferenceImports {
89
+ private readonly paths;
90
+ private readonly emit;
91
+ private readonly onAssets;
92
+ private readonly jobs;
93
+ private readonly waiters;
94
+ private readonly children;
95
+ private readonly cancelled;
96
+ constructor(paths: WorkspacePaths, emit: (job: ReferenceJob) => void, onAssets: (slug: string) => void);
97
+ list(slug: string): ReferenceJob[];
98
+ /** Import a link. Pass a failed job's `id` with `browser` to retry it with the user's browser login. */
99
+ importUrl(slugInput: unknown, rawUrl: unknown, options?: {
100
+ id?: unknown;
101
+ browser?: unknown;
102
+ }): ReferenceJob;
103
+ /** Sample frames and write reference.json for a video already in assets/references/<id>/ (an upload). */
104
+ prepare(slugInput: unknown, pathInput: unknown): ReferenceJob;
105
+ wait(id: string): Promise<ReferenceJob | undefined>;
106
+ cancel(id: string): {
107
+ cancelled: boolean;
108
+ };
109
+ cancelAll(): void;
110
+ private update;
111
+ private start;
112
+ private checkCancelled;
113
+ private tools;
114
+ private download;
115
+ private runYtdlp;
116
+ private prepareExisting;
117
+ }
118
+ export {};