@slatesvideo/shared 0.5.9 → 0.6.0

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.
@@ -2,6 +2,7 @@ export * from './reference-rules.js';
2
2
  export * from './reference-composer.js';
3
3
  export * from './content-policy.js';
4
4
  export * from './style-library.js';
5
+ export * from './model-capabilities.js';
5
6
  export * from './model-facts.js';
6
7
  export * from './character-sheet.js';
7
8
  export * from './environment-sheet.js';
@@ -13,6 +13,10 @@ export * from './reference-rules.js';
13
13
  export * from './reference-composer.js';
14
14
  export * from './content-policy.js';
15
15
  export * from './style-library.js';
16
+ // Model CAPABILITY SSOT (aspect ratios, video resolutions, durations, reference
17
+ // caps). The desktop's MODEL_REGISTRY spreads these into every entry and the op
18
+ // surface validates + generates its descriptions from them — never hand-typed.
19
+ export * from './model-capabilities.js';
16
20
  export * from './model-facts.js';
17
21
  export * from './character-sheet.js';
18
22
  export * from './environment-sheet.js';
@@ -0,0 +1,124 @@
1
+ /** Every aspect ratio any Slates model accepts. There is no `9:21`. */
2
+ export type AspectRatio = '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9';
3
+ /**
4
+ * 🚨 `768p` and `2k` entered this vocabulary with MiniMax H3 (2026-08-27) and
5
+ * are NOT aliases of anything already here. 768p is H3's native generation tier
6
+ * and prices between 480p and 2K ($0.060/s vs 720p Seedance's $0.15/s — a
7
+ * different tier of a different model, not a rename); 2K is H3's upscaled tier.
8
+ * Aliasing either onto 720p/1080p would build a cost key that does not exist.
9
+ */
10
+ export type VideoResolution = '480p' | '720p' | '768p' | '1080p' | '2k' | '4k';
11
+ /**
12
+ * The full ten, in display order. `9:21` was in the MCP op's enum and in NO
13
+ * model — it was invented downstream. Do not add a ratio here that no model
14
+ * declares; the op's enum is generated from the union of what models accept, so
15
+ * a phantom entry here becomes a phantom entry an agent can pass.
16
+ */
17
+ export declare const ALL_ASPECT_RATIOS: AspectRatio[];
18
+ /** Duration constraints for a video model. */
19
+ export interface DurationCapability {
20
+ min: number;
21
+ max: number;
22
+ /** 'continuous' = every whole second from min to max; 'discrete' = `values` only. */
23
+ mode: 'continuous' | 'discrete';
24
+ /** For discrete mode: the exact allowed durations. */
25
+ values?: number[];
26
+ /** Resolution-dependent narrowing (Veo forces 8s at 1080p AND 4k). */
27
+ resolutionOverrides?: Record<string, Pick<DurationCapability, 'min' | 'max' | 'mode' | 'values'>>;
28
+ /** Prompt-mode narrowing (Veo's reference-to-video endpoint is 8s only). */
29
+ modeOverrides?: Record<string, Pick<DurationCapability, 'min' | 'max' | 'mode' | 'values'>>;
30
+ }
31
+ /** Video resolution constraints. */
32
+ export interface VideoResolutionCapability {
33
+ options: VideoResolution[];
34
+ /** Set when the resolution is not selectable at all (Omni Flash is 720p, full stop). */
35
+ fixed?: VideoResolution;
36
+ /** Default when this model is chosen (falls back to `options[0]`). */
37
+ default?: VideoResolution;
38
+ }
39
+ /** Everything a model will ACCEPT. Capability only — never a price. */
40
+ export interface ModelCapability {
41
+ aspectRatios: AspectRatio[];
42
+ /** Provider-keyed overrides. `fal` is the one that matters — see AGENT_ROUTE_PROVIDER. */
43
+ providerAspectRatios?: Record<string, AspectRatio[]>;
44
+ videoResolution?: VideoResolutionCapability;
45
+ duration?: DurationCapability;
46
+ /** Max reference images in create-image mode (image models). */
47
+ maxRefImages?: number;
48
+ /** Max ingredient / free reference images (video models). */
49
+ maxIngredientImages?: number;
50
+ /** Reference VIDEOS accepted. Absent/0 = none. */
51
+ maxReferenceVideos?: number;
52
+ /** Reference AUDIO clips accepted. Absent/0 = none. */
53
+ maxReferenceAudio?: number;
54
+ /** Ceiling on TOTAL reference files across ALL modalities. */
55
+ maxReferenceFilesTotal?: number;
56
+ /** Combined seconds across every reference video. */
57
+ maxReferenceVideoSeconds?: number;
58
+ /** Combined seconds across every reference audio clip. */
59
+ maxReferenceAudioSeconds?: number;
60
+ }
61
+ /**
62
+ * The provider every AGENT generation actually lands on for Kling and Veo.
63
+ *
64
+ * 🚨 THIS IS WHY `providerAspectRatios` MATTERS TO THE OP. MCP/CLI/Studio-Agent
65
+ * generations are credits-only (BYOK is retired on the agent surface), and the
66
+ * credits route carries Kling and Veo on fal: `slate/src/main/agent/routes.ts`
67
+ * never sends `klingProvider`, so `handlers/video.ts` defaults it to `'fal'`,
68
+ * and `generateVeoVideo`'s proxy arm builds a fal request
69
+ * (`buildFalVeoRequest`). So an agent gets Kling's THREE fal ratios and Veo's
70
+ * TWO — not the eight and ten those models take on their direct APIs. Validating
71
+ * against the direct sets would accept a ratio fal rejects, which is the exact
72
+ * failure this module exists to delete.
73
+ */
74
+ export declare const AGENT_ROUTE_PROVIDER = "fal";
75
+ export declare const MODEL_CAPABILITIES: Record<string, ModelCapability>;
76
+ export declare function getModelCapability(model: string): ModelCapability | undefined;
77
+ /** Aspect ratios a model accepts, honouring the provider override. */
78
+ export declare function aspectRatiosFor(model: string, provider?: string): AspectRatio[];
79
+ /** Video resolutions a model accepts. A FIXED model reports exactly its one value. */
80
+ export declare function videoResolutionsFor(model: string): VideoResolution[];
81
+ /** The resolution a model would actually run at. Fixed wins; else keep a legal
82
+ * current value; else the model's own default. Mirrors `clampVideoResolution`. */
83
+ export declare function defaultVideoResolutionFor(model: string): VideoResolution | undefined;
84
+ /**
85
+ * Duration constraints after applying overrides.
86
+ *
87
+ * ⚠️ ORDER IS LOAD-BEARING and mirrors `getAvailableDurations` in
88
+ * slate/src/shared/pricing.ts EXACTLY: mode override first (more specific),
89
+ * resolution override only if no mode override applied. Reversing them would
90
+ * make the desktop and the agent disagree about the same generation.
91
+ */
92
+ export declare function durationsFor(model: string, opts?: {
93
+ videoResolution?: string;
94
+ promptMode?: string;
95
+ }): DurationCapability | undefined;
96
+ /** Every legal whole-second duration. Mirrors `getAvailableDurations`. */
97
+ export declare function durationValuesFor(model: string, opts?: {
98
+ videoResolution?: string;
99
+ promptMode?: string;
100
+ }): number[];
101
+ /** Union of every ratio the given models accept — the legal universe for an enum. */
102
+ export declare function aspectRatioUnion(models: readonly string[], provider?: string): AspectRatio[];
103
+ /** Union of every resolution the given models accept. */
104
+ export declare function videoResolutionUnion(models: readonly string[]): VideoResolution[];
105
+ /** Widest legal duration window across the given models, overrides included. */
106
+ export declare function durationBounds(models: readonly string[]): {
107
+ min: number;
108
+ max: number;
109
+ };
110
+ export declare function checkAspectRatio(model: string, aspectRatio: string | undefined, provider?: string): string | null;
111
+ export declare function checkVideoResolution(model: string, videoResolution: string | undefined): string | null;
112
+ export declare function checkDuration(model: string, duration: number | undefined, opts?: {
113
+ videoResolution?: string;
114
+ promptMode?: string;
115
+ }): string | null;
116
+ /** e.g. "kling-v3.0-std/kling-v3.0-pro: 16:9, 9:16, 1:1 · seedance-2: 21:9, …" */
117
+ export declare function describeAspectRatios(models: readonly string[], provider?: string): string;
118
+ /** e.g. "seedance-2: 480p, 720p, 1080p, 4k (default 1080p) · omni-flash: 720p only (fixed)" */
119
+ export declare function describeVideoResolutions(models: readonly string[]): string;
120
+ /** e.g. "kling-v3.0-std: 3-15s · veo-3.1-fast: 4s/6s/8s (1080p/4k: 8s only; with reference images: 8s only)" */
121
+ export declare function describeDurations(models: readonly string[]): string;
122
+ /** e.g. "seedance-2: 9 · seedance-2.5: 30 · omni-flash: 7 · seedance-2.5-edit: 0 (prompt + source clip only)" */
123
+ export declare function describeReferenceImageCaps(models: readonly string[]): string;
124
+ //# sourceMappingURL=model-capabilities.d.ts.map