@shop-os/modelkit 0.17.1 → 0.18.1
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/CHANGELOG.md +24 -0
- package/dist/catalog.cjs +241 -15
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +78 -3
- package/dist/catalog.d.ts +78 -3
- package/dist/catalog.js +241 -15
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +328 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +86 -3
- package/dist/index.d.ts +86 -3
- package/dist/index.js +326 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.d.cts
CHANGED
|
@@ -13,7 +13,38 @@ type ImageSize = "512" | "1K" | "2K" | "4K";
|
|
|
13
13
|
type VideoResolution = "360p" | "480p" | "720p" | "768p" | "1080p" | "2k" | "4k";
|
|
14
14
|
/** "xhigh" and "max" exist only on gpt-image-2.5; gpt-image-2 rejects them at the provider. */
|
|
15
15
|
type ImageQuality = "auto" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* "gif" (animated) and "svg" (vector) are GPT Image 2.6 formats: a row offers them only by
|
|
18
|
+
* listing them in `constraints.imageFormats`, and the resolver refuses them anywhere else.
|
|
19
|
+
*/
|
|
20
|
+
type OutputFormat = "png" | "jpeg" | "webp" | "gif" | "svg";
|
|
21
|
+
/** The image's background where the provider lets the caller choose (OpenAI `background`). */
|
|
22
|
+
type ImageBackground = "auto" | "opaque" | "transparent";
|
|
23
|
+
/** An animated (`outputFormat: "gif"`) request's frames. The frame size travels as `exactSize`. */
|
|
24
|
+
interface ImageAnimation {
|
|
25
|
+
/** Frames in the loop; the row's default when unset. */
|
|
26
|
+
frameCount?: number;
|
|
27
|
+
/** How long each frame shows, in milliseconds; the row's default when unset. */
|
|
28
|
+
frameDurationMs?: number;
|
|
29
|
+
}
|
|
30
|
+
/** One frame size an animated row offers, with the frame counts the provider takes at it. */
|
|
31
|
+
interface AnimationFrameSize {
|
|
32
|
+
/** `WxH`, sent as the request's `exactSize`. */
|
|
33
|
+
size: string;
|
|
34
|
+
minFrames: number;
|
|
35
|
+
maxFrames: number;
|
|
36
|
+
}
|
|
37
|
+
/** What an animated output (`imageFormats` lists "gif") takes. Kits before 0.18.0 ignore it. */
|
|
38
|
+
interface AnimationLimits {
|
|
39
|
+
/** The frame sizes offered, first is the default. */
|
|
40
|
+
frameSizes: AnimationFrameSize[];
|
|
41
|
+
frameDurationMs: {
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
};
|
|
45
|
+
defaultFrameCount: number;
|
|
46
|
+
defaultFrameDurationMs: number;
|
|
47
|
+
}
|
|
17
48
|
/**
|
|
18
49
|
* A media input. `label` is a caption the adapter emits as a text part right
|
|
19
50
|
* before the media where the provider takes interleaved content (Gemini image,
|
|
@@ -154,6 +185,10 @@ interface ImageRequest {
|
|
|
154
185
|
seed?: number;
|
|
155
186
|
count?: number;
|
|
156
187
|
outputFormat?: OutputFormat;
|
|
188
|
+
/** Rows whose `constraints.backgrounds` lists the value. */
|
|
189
|
+
background?: ImageBackground;
|
|
190
|
+
/** `outputFormat: "gif"` on rows with `constraints.animation`. */
|
|
191
|
+
animation?: ImageAnimation;
|
|
157
192
|
/** Upscale factor for upscaler rows; adapters map it to the provider's field. */
|
|
158
193
|
scaleFactor?: number;
|
|
159
194
|
/** Gemini image safety thresholds. Off (provider default) unless supplied. */
|
|
@@ -755,6 +790,18 @@ interface ModelConstraints {
|
|
|
755
790
|
languages?: LanguageOption[];
|
|
756
791
|
/** Audio-output rows whose provider lets the caller pick a file format; `defaults.outputFormat` is one. */
|
|
757
792
|
outputFormats?: string[];
|
|
793
|
+
/**
|
|
794
|
+
* Image rows: the output formats offered, first is the default; needs `supports: outputFormat`.
|
|
795
|
+
* Without it an image row takes png, jpeg and webp; "gif" and "svg" are offered only here.
|
|
796
|
+
* Kits before 0.18.0 ignore it.
|
|
797
|
+
*/
|
|
798
|
+
imageFormats?: OutputFormat[];
|
|
799
|
+
/** Image rows: the backgrounds the caller may pick (`ImageRequest.background`). Kits before 0.18.0 ignore it. */
|
|
800
|
+
backgrounds?: ImageBackground[];
|
|
801
|
+
/** Image rows that list "gif" in `imageFormats`: frame sizes, counts and durations. */
|
|
802
|
+
animation?: AnimationLimits;
|
|
803
|
+
/** Image rows that list "svg": the text model that writes the SVG from the image (OpenAI `svg.model`). */
|
|
804
|
+
svgModel?: string;
|
|
758
805
|
/** Smallest frame the source video may have (Kling 4.0 Edit: 700 px). Kits before 0.15.0 ignore it. */
|
|
759
806
|
sourceVideoPixels?: VideoPixelLimits;
|
|
760
807
|
/** Length limits for the source video the row edits or extends. */
|
|
@@ -856,7 +903,7 @@ interface CatalogCapabilities {
|
|
|
856
903
|
}
|
|
857
904
|
/** Row defaults the request types do not share. */
|
|
858
905
|
interface MediaNodeDefaults {
|
|
859
|
-
/** Image rows:
|
|
906
|
+
/** Image rows: an `OutputFormat`. Audio-output rows: one of `constraints.outputFormats`. */
|
|
860
907
|
outputFormat?: string;
|
|
861
908
|
/** One of `constraints.voices[].id`. */
|
|
862
909
|
voice?: string;
|
|
@@ -1337,6 +1384,32 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1337
1384
|
name: z.ZodString;
|
|
1338
1385
|
}, z.core.$loose>>>;
|
|
1339
1386
|
outputFormats: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1387
|
+
imageFormats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1388
|
+
png: "png";
|
|
1389
|
+
jpeg: "jpeg";
|
|
1390
|
+
webp: "webp";
|
|
1391
|
+
gif: "gif";
|
|
1392
|
+
svg: "svg";
|
|
1393
|
+
}>>>;
|
|
1394
|
+
backgrounds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1395
|
+
auto: "auto";
|
|
1396
|
+
opaque: "opaque";
|
|
1397
|
+
transparent: "transparent";
|
|
1398
|
+
}>>>;
|
|
1399
|
+
animation: z.ZodOptional<z.ZodObject<{
|
|
1400
|
+
frameSizes: z.ZodArray<z.ZodObject<{
|
|
1401
|
+
size: z.ZodString;
|
|
1402
|
+
minFrames: z.ZodNumber;
|
|
1403
|
+
maxFrames: z.ZodNumber;
|
|
1404
|
+
}, z.core.$loose>>;
|
|
1405
|
+
frameDurationMs: z.ZodObject<{
|
|
1406
|
+
min: z.ZodNumber;
|
|
1407
|
+
max: z.ZodNumber;
|
|
1408
|
+
}, z.core.$loose>;
|
|
1409
|
+
defaultFrameCount: z.ZodNumber;
|
|
1410
|
+
defaultFrameDurationMs: z.ZodNumber;
|
|
1411
|
+
}, z.core.$loose>>;
|
|
1412
|
+
svgModel: z.ZodOptional<z.ZodString>;
|
|
1340
1413
|
sourceVideoPixels: z.ZodOptional<z.ZodObject<{
|
|
1341
1414
|
minWidth: z.ZodOptional<z.ZodNumber>;
|
|
1342
1415
|
minHeight: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1482,6 +1555,8 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1482
1555
|
png: "png";
|
|
1483
1556
|
jpeg: "jpeg";
|
|
1484
1557
|
webp: "webp";
|
|
1558
|
+
gif: "gif";
|
|
1559
|
+
svg: "svg";
|
|
1485
1560
|
}>, z.ZodString]>>;
|
|
1486
1561
|
scaleFactor: z.ZodOptional<z.ZodNumber>;
|
|
1487
1562
|
safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1996,4 +2071,4 @@ declare function promptConventions(row: {
|
|
|
1996
2071
|
constraints: unknown;
|
|
1997
2072
|
}): PromptConventions;
|
|
1998
2073
|
|
|
1999
|
-
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type DubbingRequest, type DubbingResult, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeySource, type KeyTier, type LanguageOption, type Lifecycle, type LipsyncRequest, type LipsyncResult, type LiveCatalogState, MEDIA_METHODS, MEDIA_NODE_MODELS, MODEL3D_IMAGE_SLOTS, MODEL3D_MODELS, MODELS, type MaskBox, type MaskPoint, type MediaMethod, type MediaNodeDefaults, type MediaOutput, type MediaPart, type MediaRef, type Model3dConstraints, type Model3dEndpoints, type Model3dFamily, type Model3dInputRefusal, type Model3dPricedInputs, type Model3dPricedOptions, type Model3dRequest, type Model3dResult, type Model3dStatus, type Model3dSubmission, type Model3dTexture, type Model3dViews, type Model3dWired, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveCall, type ResolveResult, type ResolvedCall, type Routing, SURFACES, type SpeechRequest, type SubtitleOptions, type SubtitleTextStyle, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type TranscriptWord, type TranscriptionRequest, type TranscriptionResult, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoPixelLimits, type VideoRequest, type VideoResolution, VideoResolutionSchema, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type VoiceCandidate, type VoiceChangeRequest, type VoiceCloneRequest, type VoiceCloneResult, type VoiceCloneState, type VoiceDeleteRequest, type VoiceDesignRequest, type VoiceDesignResult, type VoiceGender, type VoiceOption, type VoiceSample, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, lumaReframeTooTall, model3dConstraints, model3dInputRefusal, model3dPricingSku, model3dResolution, model3dSeedFits, model3dSkus, model3dTexture, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveDubbingOptions, resolveImageOptions, resolveLipsyncOptions, resolveOptions, resolveSpeechOptions, resolveTranscriptionOptions, resolveVideoOptions, resolveVoiceChangeOptions, resolveVoiceCloneOptions, resolveVoiceDesignOptions, sortCatalogRows, takesTargetAspectRatio, videoLengthViolation, videoSizeViolation, videoToolConstraints };
|
|
2074
|
+
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AnimationFrameSize, type AnimationLimits, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type DubbingRequest, type DubbingResult, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageAnimation, type ImageBackground, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeySource, type KeyTier, type LanguageOption, type Lifecycle, type LipsyncRequest, type LipsyncResult, type LiveCatalogState, MEDIA_METHODS, MEDIA_NODE_MODELS, MODEL3D_IMAGE_SLOTS, MODEL3D_MODELS, MODELS, type MaskBox, type MaskPoint, type MediaMethod, type MediaNodeDefaults, type MediaOutput, type MediaPart, type MediaRef, type Model3dConstraints, type Model3dEndpoints, type Model3dFamily, type Model3dInputRefusal, type Model3dPricedInputs, type Model3dPricedOptions, type Model3dRequest, type Model3dResult, type Model3dStatus, type Model3dSubmission, type Model3dTexture, type Model3dViews, type Model3dWired, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveCall, type ResolveResult, type ResolvedCall, type Routing, SURFACES, type SpeechRequest, type SubtitleOptions, type SubtitleTextStyle, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type TranscriptWord, type TranscriptionRequest, type TranscriptionResult, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoPixelLimits, type VideoRequest, type VideoResolution, VideoResolutionSchema, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type VoiceCandidate, type VoiceChangeRequest, type VoiceCloneRequest, type VoiceCloneResult, type VoiceCloneState, type VoiceDeleteRequest, type VoiceDesignRequest, type VoiceDesignResult, type VoiceGender, type VoiceOption, type VoiceSample, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, lumaReframeTooTall, model3dConstraints, model3dInputRefusal, model3dPricingSku, model3dResolution, model3dSeedFits, model3dSkus, model3dTexture, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveDubbingOptions, resolveImageOptions, resolveLipsyncOptions, resolveOptions, resolveSpeechOptions, resolveTranscriptionOptions, resolveVideoOptions, resolveVoiceChangeOptions, resolveVoiceCloneOptions, resolveVoiceDesignOptions, sortCatalogRows, takesTargetAspectRatio, videoLengthViolation, videoSizeViolation, videoToolConstraints };
|
package/dist/catalog.d.ts
CHANGED
|
@@ -13,7 +13,38 @@ type ImageSize = "512" | "1K" | "2K" | "4K";
|
|
|
13
13
|
type VideoResolution = "360p" | "480p" | "720p" | "768p" | "1080p" | "2k" | "4k";
|
|
14
14
|
/** "xhigh" and "max" exist only on gpt-image-2.5; gpt-image-2 rejects them at the provider. */
|
|
15
15
|
type ImageQuality = "auto" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* "gif" (animated) and "svg" (vector) are GPT Image 2.6 formats: a row offers them only by
|
|
18
|
+
* listing them in `constraints.imageFormats`, and the resolver refuses them anywhere else.
|
|
19
|
+
*/
|
|
20
|
+
type OutputFormat = "png" | "jpeg" | "webp" | "gif" | "svg";
|
|
21
|
+
/** The image's background where the provider lets the caller choose (OpenAI `background`). */
|
|
22
|
+
type ImageBackground = "auto" | "opaque" | "transparent";
|
|
23
|
+
/** An animated (`outputFormat: "gif"`) request's frames. The frame size travels as `exactSize`. */
|
|
24
|
+
interface ImageAnimation {
|
|
25
|
+
/** Frames in the loop; the row's default when unset. */
|
|
26
|
+
frameCount?: number;
|
|
27
|
+
/** How long each frame shows, in milliseconds; the row's default when unset. */
|
|
28
|
+
frameDurationMs?: number;
|
|
29
|
+
}
|
|
30
|
+
/** One frame size an animated row offers, with the frame counts the provider takes at it. */
|
|
31
|
+
interface AnimationFrameSize {
|
|
32
|
+
/** `WxH`, sent as the request's `exactSize`. */
|
|
33
|
+
size: string;
|
|
34
|
+
minFrames: number;
|
|
35
|
+
maxFrames: number;
|
|
36
|
+
}
|
|
37
|
+
/** What an animated output (`imageFormats` lists "gif") takes. Kits before 0.18.0 ignore it. */
|
|
38
|
+
interface AnimationLimits {
|
|
39
|
+
/** The frame sizes offered, first is the default. */
|
|
40
|
+
frameSizes: AnimationFrameSize[];
|
|
41
|
+
frameDurationMs: {
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
};
|
|
45
|
+
defaultFrameCount: number;
|
|
46
|
+
defaultFrameDurationMs: number;
|
|
47
|
+
}
|
|
17
48
|
/**
|
|
18
49
|
* A media input. `label` is a caption the adapter emits as a text part right
|
|
19
50
|
* before the media where the provider takes interleaved content (Gemini image,
|
|
@@ -154,6 +185,10 @@ interface ImageRequest {
|
|
|
154
185
|
seed?: number;
|
|
155
186
|
count?: number;
|
|
156
187
|
outputFormat?: OutputFormat;
|
|
188
|
+
/** Rows whose `constraints.backgrounds` lists the value. */
|
|
189
|
+
background?: ImageBackground;
|
|
190
|
+
/** `outputFormat: "gif"` on rows with `constraints.animation`. */
|
|
191
|
+
animation?: ImageAnimation;
|
|
157
192
|
/** Upscale factor for upscaler rows; adapters map it to the provider's field. */
|
|
158
193
|
scaleFactor?: number;
|
|
159
194
|
/** Gemini image safety thresholds. Off (provider default) unless supplied. */
|
|
@@ -755,6 +790,18 @@ interface ModelConstraints {
|
|
|
755
790
|
languages?: LanguageOption[];
|
|
756
791
|
/** Audio-output rows whose provider lets the caller pick a file format; `defaults.outputFormat` is one. */
|
|
757
792
|
outputFormats?: string[];
|
|
793
|
+
/**
|
|
794
|
+
* Image rows: the output formats offered, first is the default; needs `supports: outputFormat`.
|
|
795
|
+
* Without it an image row takes png, jpeg and webp; "gif" and "svg" are offered only here.
|
|
796
|
+
* Kits before 0.18.0 ignore it.
|
|
797
|
+
*/
|
|
798
|
+
imageFormats?: OutputFormat[];
|
|
799
|
+
/** Image rows: the backgrounds the caller may pick (`ImageRequest.background`). Kits before 0.18.0 ignore it. */
|
|
800
|
+
backgrounds?: ImageBackground[];
|
|
801
|
+
/** Image rows that list "gif" in `imageFormats`: frame sizes, counts and durations. */
|
|
802
|
+
animation?: AnimationLimits;
|
|
803
|
+
/** Image rows that list "svg": the text model that writes the SVG from the image (OpenAI `svg.model`). */
|
|
804
|
+
svgModel?: string;
|
|
758
805
|
/** Smallest frame the source video may have (Kling 4.0 Edit: 700 px). Kits before 0.15.0 ignore it. */
|
|
759
806
|
sourceVideoPixels?: VideoPixelLimits;
|
|
760
807
|
/** Length limits for the source video the row edits or extends. */
|
|
@@ -856,7 +903,7 @@ interface CatalogCapabilities {
|
|
|
856
903
|
}
|
|
857
904
|
/** Row defaults the request types do not share. */
|
|
858
905
|
interface MediaNodeDefaults {
|
|
859
|
-
/** Image rows:
|
|
906
|
+
/** Image rows: an `OutputFormat`. Audio-output rows: one of `constraints.outputFormats`. */
|
|
860
907
|
outputFormat?: string;
|
|
861
908
|
/** One of `constraints.voices[].id`. */
|
|
862
909
|
voice?: string;
|
|
@@ -1337,6 +1384,32 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1337
1384
|
name: z.ZodString;
|
|
1338
1385
|
}, z.core.$loose>>>;
|
|
1339
1386
|
outputFormats: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1387
|
+
imageFormats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1388
|
+
png: "png";
|
|
1389
|
+
jpeg: "jpeg";
|
|
1390
|
+
webp: "webp";
|
|
1391
|
+
gif: "gif";
|
|
1392
|
+
svg: "svg";
|
|
1393
|
+
}>>>;
|
|
1394
|
+
backgrounds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1395
|
+
auto: "auto";
|
|
1396
|
+
opaque: "opaque";
|
|
1397
|
+
transparent: "transparent";
|
|
1398
|
+
}>>>;
|
|
1399
|
+
animation: z.ZodOptional<z.ZodObject<{
|
|
1400
|
+
frameSizes: z.ZodArray<z.ZodObject<{
|
|
1401
|
+
size: z.ZodString;
|
|
1402
|
+
minFrames: z.ZodNumber;
|
|
1403
|
+
maxFrames: z.ZodNumber;
|
|
1404
|
+
}, z.core.$loose>>;
|
|
1405
|
+
frameDurationMs: z.ZodObject<{
|
|
1406
|
+
min: z.ZodNumber;
|
|
1407
|
+
max: z.ZodNumber;
|
|
1408
|
+
}, z.core.$loose>;
|
|
1409
|
+
defaultFrameCount: z.ZodNumber;
|
|
1410
|
+
defaultFrameDurationMs: z.ZodNumber;
|
|
1411
|
+
}, z.core.$loose>>;
|
|
1412
|
+
svgModel: z.ZodOptional<z.ZodString>;
|
|
1340
1413
|
sourceVideoPixels: z.ZodOptional<z.ZodObject<{
|
|
1341
1414
|
minWidth: z.ZodOptional<z.ZodNumber>;
|
|
1342
1415
|
minHeight: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1482,6 +1555,8 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1482
1555
|
png: "png";
|
|
1483
1556
|
jpeg: "jpeg";
|
|
1484
1557
|
webp: "webp";
|
|
1558
|
+
gif: "gif";
|
|
1559
|
+
svg: "svg";
|
|
1485
1560
|
}>, z.ZodString]>>;
|
|
1486
1561
|
scaleFactor: z.ZodOptional<z.ZodNumber>;
|
|
1487
1562
|
safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1996,4 +2071,4 @@ declare function promptConventions(row: {
|
|
|
1996
2071
|
constraints: unknown;
|
|
1997
2072
|
}): PromptConventions;
|
|
1998
2073
|
|
|
1999
|
-
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type DubbingRequest, type DubbingResult, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeySource, type KeyTier, type LanguageOption, type Lifecycle, type LipsyncRequest, type LipsyncResult, type LiveCatalogState, MEDIA_METHODS, MEDIA_NODE_MODELS, MODEL3D_IMAGE_SLOTS, MODEL3D_MODELS, MODELS, type MaskBox, type MaskPoint, type MediaMethod, type MediaNodeDefaults, type MediaOutput, type MediaPart, type MediaRef, type Model3dConstraints, type Model3dEndpoints, type Model3dFamily, type Model3dInputRefusal, type Model3dPricedInputs, type Model3dPricedOptions, type Model3dRequest, type Model3dResult, type Model3dStatus, type Model3dSubmission, type Model3dTexture, type Model3dViews, type Model3dWired, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveCall, type ResolveResult, type ResolvedCall, type Routing, SURFACES, type SpeechRequest, type SubtitleOptions, type SubtitleTextStyle, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type TranscriptWord, type TranscriptionRequest, type TranscriptionResult, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoPixelLimits, type VideoRequest, type VideoResolution, VideoResolutionSchema, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type VoiceCandidate, type VoiceChangeRequest, type VoiceCloneRequest, type VoiceCloneResult, type VoiceCloneState, type VoiceDeleteRequest, type VoiceDesignRequest, type VoiceDesignResult, type VoiceGender, type VoiceOption, type VoiceSample, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, lumaReframeTooTall, model3dConstraints, model3dInputRefusal, model3dPricingSku, model3dResolution, model3dSeedFits, model3dSkus, model3dTexture, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveDubbingOptions, resolveImageOptions, resolveLipsyncOptions, resolveOptions, resolveSpeechOptions, resolveTranscriptionOptions, resolveVideoOptions, resolveVoiceChangeOptions, resolveVoiceCloneOptions, resolveVoiceDesignOptions, sortCatalogRows, takesTargetAspectRatio, videoLengthViolation, videoSizeViolation, videoToolConstraints };
|
|
2074
|
+
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AnimationFrameSize, type AnimationLimits, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type DubbingRequest, type DubbingResult, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageAnimation, type ImageBackground, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeySource, type KeyTier, type LanguageOption, type Lifecycle, type LipsyncRequest, type LipsyncResult, type LiveCatalogState, MEDIA_METHODS, MEDIA_NODE_MODELS, MODEL3D_IMAGE_SLOTS, MODEL3D_MODELS, MODELS, type MaskBox, type MaskPoint, type MediaMethod, type MediaNodeDefaults, type MediaOutput, type MediaPart, type MediaRef, type Model3dConstraints, type Model3dEndpoints, type Model3dFamily, type Model3dInputRefusal, type Model3dPricedInputs, type Model3dPricedOptions, type Model3dRequest, type Model3dResult, type Model3dStatus, type Model3dSubmission, type Model3dTexture, type Model3dViews, type Model3dWired, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveCall, type ResolveResult, type ResolvedCall, type Routing, SURFACES, type SpeechRequest, type SubtitleOptions, type SubtitleTextStyle, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type TranscriptWord, type TranscriptionRequest, type TranscriptionResult, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoPixelLimits, type VideoRequest, type VideoResolution, VideoResolutionSchema, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type VoiceCandidate, type VoiceChangeRequest, type VoiceCloneRequest, type VoiceCloneResult, type VoiceCloneState, type VoiceDeleteRequest, type VoiceDesignRequest, type VoiceDesignResult, type VoiceGender, type VoiceOption, type VoiceSample, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, lumaReframeTooTall, model3dConstraints, model3dInputRefusal, model3dPricingSku, model3dResolution, model3dSeedFits, model3dSkus, model3dTexture, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveDubbingOptions, resolveImageOptions, resolveLipsyncOptions, resolveOptions, resolveSpeechOptions, resolveTranscriptionOptions, resolveVideoOptions, resolveVoiceChangeOptions, resolveVoiceCloneOptions, resolveVoiceDesignOptions, sortCatalogRows, takesTargetAspectRatio, videoLengthViolation, videoSizeViolation, videoToolConstraints };
|
package/dist/catalog.js
CHANGED
|
@@ -439,6 +439,25 @@ var NANO_BANANA_2_1_RATIOS = [
|
|
|
439
439
|
"adaptive"
|
|
440
440
|
];
|
|
441
441
|
var GEMINI_PROMPT_MAX_CHARS = 5e4;
|
|
442
|
+
var GPT_IMAGE_2_6_ANIMATION = {
|
|
443
|
+
frameSizes: [
|
|
444
|
+
{ size: "288x288", minFrames: 2, maxFrames: 16 },
|
|
445
|
+
{ size: "384x384", minFrames: 2, maxFrames: 16 },
|
|
446
|
+
{ size: "512x288", minFrames: 2, maxFrames: 16 },
|
|
447
|
+
{ size: "288x512", minFrames: 2, maxFrames: 16 },
|
|
448
|
+
{ size: "512x512", minFrames: 2, maxFrames: 16 },
|
|
449
|
+
{ size: "768x768", minFrames: 2, maxFrames: 12 }
|
|
450
|
+
],
|
|
451
|
+
frameDurationMs: { min: 20, max: 2e3 },
|
|
452
|
+
defaultFrameCount: 9,
|
|
453
|
+
defaultFrameDurationMs: 200
|
|
454
|
+
};
|
|
455
|
+
var GPT_IMAGE_2_6_OUTPUT = {
|
|
456
|
+
imageFormats: ["png", "gif", "svg"],
|
|
457
|
+
backgrounds: ["auto", "opaque", "transparent"],
|
|
458
|
+
animation: GPT_IMAGE_2_6_ANIMATION,
|
|
459
|
+
svgModel: "gpt-6.1-sol"
|
|
460
|
+
};
|
|
442
461
|
var GPT_IMAGE_PROMPT = { referenceSyntax: "numbered", maxChars: 32e3 };
|
|
443
462
|
function geminiImage(id, label, aliases, sizes, display, exposure, references, promptMaxChars, aspectRatios = GEMINI_RATIOS) {
|
|
444
463
|
const prompt = { referenceSyntax: "caption" };
|
|
@@ -607,7 +626,8 @@ var IMAGE_MODELS = [
|
|
|
607
626
|
qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
|
|
608
627
|
references: { images: 16 },
|
|
609
628
|
supports: ["quality", "count", "outputFormat"],
|
|
610
|
-
prompt: GPT_IMAGE_PROMPT
|
|
629
|
+
prompt: GPT_IMAGE_PROMPT,
|
|
630
|
+
...GPT_IMAGE_2_6_OUTPUT
|
|
611
631
|
},
|
|
612
632
|
defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
|
|
613
633
|
usage: { ...IMAGE_USAGE3 },
|
|
@@ -642,7 +662,8 @@ var IMAGE_MODELS = [
|
|
|
642
662
|
qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
|
|
643
663
|
references: { images: 16 },
|
|
644
664
|
supports: ["quality", "count", "outputFormat"],
|
|
645
|
-
prompt: GPT_IMAGE_PROMPT
|
|
665
|
+
prompt: GPT_IMAGE_PROMPT,
|
|
666
|
+
...GPT_IMAGE_2_6_OUTPUT
|
|
646
667
|
},
|
|
647
668
|
defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
|
|
648
669
|
usage: { ...IMAGE_USAGE3 },
|
|
@@ -6015,6 +6036,44 @@ var VIDEO_MODELS = [
|
|
|
6015
6036
|
lastFrameRequiresFirstFrame: true
|
|
6016
6037
|
}
|
|
6017
6038
|
},
|
|
6039
|
+
{
|
|
6040
|
+
// https://aistudio.google.com/docs/omni (2026-11-05): the 1.1 Interactions API with
|
|
6041
|
+
// 3-15 s output; first-to-last-frame and each extension stay at 3-10 s (the adapter
|
|
6042
|
+
// refuses more), extended clips stop at 30 s, and 11-15 s clips take one reference video.
|
|
6043
|
+
id: "gemini-omni-1.2-flash",
|
|
6044
|
+
aliases: ["gemini-omni-1.2-video", "gemini-omni-1.2-reference", "gemini-omni-1.2-edit"],
|
|
6045
|
+
label: "Gemini Omni 1.2 Flash",
|
|
6046
|
+
type: "video",
|
|
6047
|
+
adapter: "google-genai",
|
|
6048
|
+
providerModelId: "gemini-omni-1.2-flash",
|
|
6049
|
+
lifecycle: "active",
|
|
6050
|
+
exposure: ["cowork", "space_builder"],
|
|
6051
|
+
constraints: {
|
|
6052
|
+
aspectRatios: [...OMNI_RATIOS],
|
|
6053
|
+
resolutions: ["360p", "720p", "1080p", "4k"],
|
|
6054
|
+
durations: { min: 3, max: 15 },
|
|
6055
|
+
durationPresets: [3, 5, 8, 10, 15],
|
|
6056
|
+
references: { images: 6, videos: 1, videoSeconds: { max: 10 } },
|
|
6057
|
+
sourceVideoSeconds: { max: 15 },
|
|
6058
|
+
supports: ["videoExtension", "lastFrame"],
|
|
6059
|
+
extension: { segmentSeconds: 10, maxTotalSeconds: 30, returns: "joined" },
|
|
6060
|
+
prompt: OMNI_PROMPT,
|
|
6061
|
+
audio: "always"
|
|
6062
|
+
},
|
|
6063
|
+
defaults: {},
|
|
6064
|
+
usage: { ...VIDEO_USAGE3 },
|
|
6065
|
+
pricingKind: "video_per_second",
|
|
6066
|
+
display: {
|
|
6067
|
+
provider: "google",
|
|
6068
|
+
logo: GOOGLE_LOGO3,
|
|
6069
|
+
description: "Google Gemini Omni Flash 1.2 conversational video generation, editing and extension; text, image, and up to 15-second video input, 3-15 second output at up to 4K and 24 FPS (start and end frames up to 10 seconds), extendable to 30 seconds."
|
|
6070
|
+
},
|
|
6071
|
+
capabilities: {
|
|
6072
|
+
acceptsSourceVideo: true,
|
|
6073
|
+
videoEdit: true,
|
|
6074
|
+
lastFrameRequiresFirstFrame: true
|
|
6075
|
+
}
|
|
6076
|
+
},
|
|
6018
6077
|
{
|
|
6019
6078
|
// vibe-triggers and Space Builder drop the ratio when a frame is wired; Cowork always sends it.
|
|
6020
6079
|
id: "seedance-2.0",
|
|
@@ -7874,7 +7933,20 @@ var AspectRatioSchema = z3.enum([
|
|
|
7874
7933
|
var ImageSizeSchema = z3.enum(["512", "1K", "2K", "4K"]);
|
|
7875
7934
|
var VideoResolutionSchema = z3.enum(["360p", "480p", "720p", "768p", "1080p", "2k", "4k"]);
|
|
7876
7935
|
var ImageQualitySchema = z3.enum(["auto", "low", "medium", "high", "xhigh", "max"]);
|
|
7877
|
-
var OutputFormatSchema = z3.enum(["png", "jpeg", "webp"]);
|
|
7936
|
+
var OutputFormatSchema = z3.enum(["png", "jpeg", "webp", "gif", "svg"]);
|
|
7937
|
+
var ImageBackgroundSchema = z3.enum(["auto", "opaque", "transparent"]);
|
|
7938
|
+
var AnimationLimitsSchema = z3.looseObject({
|
|
7939
|
+
frameSizes: z3.array(
|
|
7940
|
+
z3.looseObject({
|
|
7941
|
+
size: z3.string().regex(/^\d+x\d+$/u),
|
|
7942
|
+
minFrames: z3.number().int().positive(),
|
|
7943
|
+
maxFrames: z3.number().int().positive()
|
|
7944
|
+
})
|
|
7945
|
+
).min(1),
|
|
7946
|
+
frameDurationMs: z3.looseObject({ min: z3.number().positive(), max: z3.number().positive() }),
|
|
7947
|
+
defaultFrameCount: z3.number().int().positive(),
|
|
7948
|
+
defaultFrameDurationMs: z3.number().positive()
|
|
7949
|
+
});
|
|
7878
7950
|
var RequiredInputSchema = z3.enum(["firstFrame", "sourceVideo", "references", "sourceAudio"]);
|
|
7879
7951
|
var SupportedOptionSchema = z3.enum([
|
|
7880
7952
|
"seed",
|
|
@@ -8028,6 +8100,10 @@ var ModelConstraintsSchema = z3.looseObject({
|
|
|
8028
8100
|
}).optional(),
|
|
8029
8101
|
languages: z3.array(LanguageOptionSchema).optional(),
|
|
8030
8102
|
outputFormats: z3.array(z3.string().min(1)).min(1).optional(),
|
|
8103
|
+
imageFormats: z3.array(OutputFormatSchema).min(1).optional(),
|
|
8104
|
+
backgrounds: z3.array(ImageBackgroundSchema).min(1).optional(),
|
|
8105
|
+
animation: AnimationLimitsSchema.optional(),
|
|
8106
|
+
svgModel: z3.string().min(1).optional(),
|
|
8031
8107
|
sourceVideoPixels: VideoPixelLimitsSchema.optional(),
|
|
8032
8108
|
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: z3.boolean().optional() }).optional(),
|
|
8033
8109
|
// segmentSeconds/maxTotalSeconds stay required: a kit before 0.3.0 drops a row whose
|
|
@@ -8787,6 +8863,155 @@ function shrinkToShortEdge(width, height, limit) {
|
|
|
8787
8863
|
return { width: Math.round(width * scale), height: Math.round(height * scale) };
|
|
8788
8864
|
}
|
|
8789
8865
|
|
|
8866
|
+
// src/resolve-image-output.ts
|
|
8867
|
+
var BASE_FORMATS = ["png", "jpeg", "webp"];
|
|
8868
|
+
var ONE_K_FRAME_PIXELS = 288 * 512;
|
|
8869
|
+
function imageOutputFormats(model) {
|
|
8870
|
+
return model.constraints.imageFormats ?? BASE_FORMATS;
|
|
8871
|
+
}
|
|
8872
|
+
function animationTier(model, frameSize) {
|
|
8873
|
+
const [w, h] = frameSize.split("x").map(Number);
|
|
8874
|
+
const tier = (w ?? 0) * (h ?? 0) <= ONE_K_FRAME_PIXELS ? "1K" : "2K";
|
|
8875
|
+
const offered = model.constraints.sizes ?? ["1K", "2K", "4K"];
|
|
8876
|
+
if (offered.includes(tier)) return tier;
|
|
8877
|
+
return offered[offered.length - 1] ?? tier;
|
|
8878
|
+
}
|
|
8879
|
+
function refuse(model, message) {
|
|
8880
|
+
throw new ModelKitError({ code: "unsupported_option", message, model: model.id });
|
|
8881
|
+
}
|
|
8882
|
+
function clamp(value, min, max) {
|
|
8883
|
+
return Math.min(Math.max(value, min), max);
|
|
8884
|
+
}
|
|
8885
|
+
function applyAnimation(model, req, onUnsupported, warnings) {
|
|
8886
|
+
const limits = model.constraints.animation;
|
|
8887
|
+
if (!limits) return;
|
|
8888
|
+
const sizes = limits.frameSizes;
|
|
8889
|
+
let frameSize = sizes.find((s) => s.size === req.exactSize);
|
|
8890
|
+
if (!frameSize) {
|
|
8891
|
+
const fallback = sizes[0];
|
|
8892
|
+
if (req.exactSize !== void 0) {
|
|
8893
|
+
if (onUnsupported === "error") {
|
|
8894
|
+
refuse(
|
|
8895
|
+
model,
|
|
8896
|
+
`${model.id} makes GIF frames at ${sizes.map((s) => s.size).join(", ")}; got ${req.exactSize}`
|
|
8897
|
+
);
|
|
8898
|
+
}
|
|
8899
|
+
warnings.push({
|
|
8900
|
+
code: "option_ignored",
|
|
8901
|
+
field: "exactSize",
|
|
8902
|
+
from: req.exactSize,
|
|
8903
|
+
to: fallback.size,
|
|
8904
|
+
message: `${model.id} has no ${req.exactSize} GIF frame; using ${fallback.size}`
|
|
8905
|
+
});
|
|
8906
|
+
}
|
|
8907
|
+
frameSize = fallback;
|
|
8908
|
+
}
|
|
8909
|
+
req.exactSize = frameSize.size;
|
|
8910
|
+
delete req.aspectRatio;
|
|
8911
|
+
const animation = { ...req.animation };
|
|
8912
|
+
const asked = animation.frameCount;
|
|
8913
|
+
const frames = asked ?? clamp(limits.defaultFrameCount, frameSize.minFrames, frameSize.maxFrames);
|
|
8914
|
+
if (frames < frameSize.minFrames || frames > frameSize.maxFrames || !Number.isInteger(frames)) {
|
|
8915
|
+
if (onUnsupported === "error") {
|
|
8916
|
+
refuse(
|
|
8917
|
+
model,
|
|
8918
|
+
`${model.id} makes ${frameSize.minFrames} to ${frameSize.maxFrames} frames at ${frameSize.size}; got ${frames}`
|
|
8919
|
+
);
|
|
8920
|
+
}
|
|
8921
|
+
const snapped = clamp(Math.round(frames), frameSize.minFrames, frameSize.maxFrames);
|
|
8922
|
+
warnings.push({
|
|
8923
|
+
code: "option_ignored",
|
|
8924
|
+
field: "animation.frameCount",
|
|
8925
|
+
from: frames,
|
|
8926
|
+
to: snapped,
|
|
8927
|
+
message: `${model.id} makes ${frameSize.minFrames} to ${frameSize.maxFrames} frames at ${frameSize.size}; using ${snapped}`
|
|
8928
|
+
});
|
|
8929
|
+
animation.frameCount = snapped;
|
|
8930
|
+
} else {
|
|
8931
|
+
animation.frameCount = frames;
|
|
8932
|
+
}
|
|
8933
|
+
const { min, max } = limits.frameDurationMs;
|
|
8934
|
+
const duration = animation.frameDurationMs ?? limits.defaultFrameDurationMs;
|
|
8935
|
+
if (duration < min || duration > max) {
|
|
8936
|
+
if (onUnsupported === "error") {
|
|
8937
|
+
refuse(model, `${model.id} shows each GIF frame ${min} to ${max} ms; got ${duration}`);
|
|
8938
|
+
}
|
|
8939
|
+
const snapped = clamp(duration, min, max);
|
|
8940
|
+
warnings.push({
|
|
8941
|
+
code: "option_ignored",
|
|
8942
|
+
field: "animation.frameDurationMs",
|
|
8943
|
+
from: duration,
|
|
8944
|
+
to: snapped,
|
|
8945
|
+
message: `${model.id} shows each GIF frame ${min} to ${max} ms; using ${snapped}`
|
|
8946
|
+
});
|
|
8947
|
+
animation.frameDurationMs = snapped;
|
|
8948
|
+
} else {
|
|
8949
|
+
animation.frameDurationMs = duration;
|
|
8950
|
+
}
|
|
8951
|
+
req.animation = animation;
|
|
8952
|
+
req.size = animationTier(model, frameSize.size);
|
|
8953
|
+
}
|
|
8954
|
+
function applyImageOutputRules(model, req, onUnsupported, warnings) {
|
|
8955
|
+
const c = model.constraints;
|
|
8956
|
+
const format = req.outputFormat;
|
|
8957
|
+
if (format !== void 0 && !imageOutputFormats(model).includes(format)) {
|
|
8958
|
+
if (onUnsupported === "error") {
|
|
8959
|
+
refuse(
|
|
8960
|
+
model,
|
|
8961
|
+
`${model.id} does not offer outputFormat ${format}. Supported: ${imageOutputFormats(model).join(", ")}.`
|
|
8962
|
+
);
|
|
8963
|
+
}
|
|
8964
|
+
warnings.push({
|
|
8965
|
+
code: "option_ignored",
|
|
8966
|
+
field: "outputFormat",
|
|
8967
|
+
from: format,
|
|
8968
|
+
message: `${model.id} does not offer ${format}; ignored`
|
|
8969
|
+
});
|
|
8970
|
+
delete req.outputFormat;
|
|
8971
|
+
}
|
|
8972
|
+
if (req.background !== void 0 && !(c.backgrounds ?? []).includes(req.background)) {
|
|
8973
|
+
if (onUnsupported === "error") {
|
|
8974
|
+
refuse(model, `${model.id} does not offer background ${req.background}`);
|
|
8975
|
+
}
|
|
8976
|
+
warnings.push({
|
|
8977
|
+
code: "option_ignored",
|
|
8978
|
+
field: "background",
|
|
8979
|
+
from: req.background,
|
|
8980
|
+
message: `${model.id} does not offer background ${req.background}; ignored`
|
|
8981
|
+
});
|
|
8982
|
+
delete req.background;
|
|
8983
|
+
}
|
|
8984
|
+
if (req.outputFormat === "gif") {
|
|
8985
|
+
applyAnimation(model, req, onUnsupported, warnings);
|
|
8986
|
+
} else if (req.animation !== void 0) {
|
|
8987
|
+
warnings.push({
|
|
8988
|
+
code: "option_ignored",
|
|
8989
|
+
field: "animation",
|
|
8990
|
+
message: `animation applies to GIF output only; ignored`
|
|
8991
|
+
});
|
|
8992
|
+
delete req.animation;
|
|
8993
|
+
}
|
|
8994
|
+
if (req.outputFormat === "svg") {
|
|
8995
|
+
if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
|
|
8996
|
+
if ((req.references ?? []).length > 0) {
|
|
8997
|
+
refuse(model, `${model.label} cannot make an SVG from reference images`);
|
|
8998
|
+
}
|
|
8999
|
+
if ((req.count ?? 1) > 1) {
|
|
9000
|
+
if (onUnsupported === "error") {
|
|
9001
|
+
refuse(model, `${model.label} makes one SVG per call`);
|
|
9002
|
+
}
|
|
9003
|
+
warnings.push({
|
|
9004
|
+
code: "option_ignored",
|
|
9005
|
+
field: "count",
|
|
9006
|
+
from: req.count,
|
|
9007
|
+
to: 1,
|
|
9008
|
+
message: `${model.id} makes one SVG per call; using 1`
|
|
9009
|
+
});
|
|
9010
|
+
req.count = 1;
|
|
9011
|
+
}
|
|
9012
|
+
}
|
|
9013
|
+
}
|
|
9014
|
+
|
|
8790
9015
|
// src/resolve-lists.ts
|
|
8791
9016
|
function preview(listed2) {
|
|
8792
9017
|
const shown = listed2.slice(0, 12).join(", ");
|
|
@@ -9644,6 +9869,7 @@ function resolveImageOptions(model, request, onUnsupported = "error") {
|
|
|
9644
9869
|
"points",
|
|
9645
9870
|
"boxes"
|
|
9646
9871
|
]);
|
|
9872
|
+
applyImageOutputRules(model, merged, onUnsupported, warnings);
|
|
9647
9873
|
const factor = merged.scaleFactor;
|
|
9648
9874
|
if (factor !== void 0 && c.scaleFactors && !c.scaleFactors.includes(factor)) {
|
|
9649
9875
|
if (onUnsupported === "error") {
|
|
@@ -9980,7 +10206,7 @@ function setOrDelete(req, field, refs) {
|
|
|
9980
10206
|
else delete req[field];
|
|
9981
10207
|
}
|
|
9982
10208
|
function isImageFormat(format) {
|
|
9983
|
-
return format === "png" || format === "jpeg" || format === "webp";
|
|
10209
|
+
return format === "png" || format === "jpeg" || format === "webp" || format === "gif" || format === "svg";
|
|
9984
10210
|
}
|
|
9985
10211
|
function stripUndefined(obj) {
|
|
9986
10212
|
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
|
|
@@ -10187,7 +10413,7 @@ function resolveTranscriptionOptions(model, request, onUnsupported = "error") {
|
|
|
10187
10413
|
}
|
|
10188
10414
|
|
|
10189
10415
|
// src/resolve-voice.ts
|
|
10190
|
-
function
|
|
10416
|
+
function refuse2(model, code, message) {
|
|
10191
10417
|
return new ModelKitError({ code, message: `${model.label} ${message}`, model: model.id });
|
|
10192
10418
|
}
|
|
10193
10419
|
function checkSample(model, sample, index) {
|
|
@@ -10196,7 +10422,7 @@ function checkSample(model, sample, index) {
|
|
|
10196
10422
|
if (limits === void 0 || length === void 0) return;
|
|
10197
10423
|
if (limits.min !== void 0 && length < limits.min || limits.max !== void 0 && length > limits.max) {
|
|
10198
10424
|
const range2 = `${limits.min ?? 0}-${limits.max ?? "any"} s`;
|
|
10199
|
-
throw
|
|
10425
|
+
throw refuse2(
|
|
10200
10426
|
model,
|
|
10201
10427
|
"unsupported_option",
|
|
10202
10428
|
`takes samples of ${range2}; sample ${index + 1} is ${length} s`
|
|
@@ -10205,11 +10431,11 @@ function checkSample(model, sample, index) {
|
|
|
10205
10431
|
}
|
|
10206
10432
|
function resolveVoiceCloneOptions(model, request) {
|
|
10207
10433
|
const title = request.title.trim();
|
|
10208
|
-
if (!title) throw
|
|
10209
|
-
if (request.samples.length === 0) throw
|
|
10434
|
+
if (!title) throw refuse2(model, "missing_input", "needs a title");
|
|
10435
|
+
if (request.samples.length === 0) throw refuse2(model, "missing_input", "needs a voice sample");
|
|
10210
10436
|
const max = model.constraints.references?.audios;
|
|
10211
10437
|
if (max !== void 0 && request.samples.length > max) {
|
|
10212
|
-
throw
|
|
10438
|
+
throw refuse2(
|
|
10213
10439
|
model,
|
|
10214
10440
|
"unsupported_option",
|
|
10215
10441
|
`takes up to ${max} samples; got ${request.samples.length}`
|
|
@@ -10219,7 +10445,7 @@ function resolveVoiceCloneOptions(model, request) {
|
|
|
10219
10445
|
const total = model.constraints.references?.audioSeconds?.total;
|
|
10220
10446
|
const seconds3 = request.samples.reduce((sum, s) => sum + (s.audio.durationSeconds ?? 0), 0);
|
|
10221
10447
|
if (total !== void 0 && seconds3 > total) {
|
|
10222
|
-
throw
|
|
10448
|
+
throw refuse2(
|
|
10223
10449
|
model,
|
|
10224
10450
|
"unsupported_option",
|
|
10225
10451
|
`takes up to ${total} s of samples; got ${seconds3} s`
|
|
@@ -10228,7 +10454,7 @@ function resolveVoiceCloneOptions(model, request) {
|
|
|
10228
10454
|
for (const field of ["transcript", "designSignature"]) {
|
|
10229
10455
|
const set = request.samples.filter((s) => s[field]?.trim()).length;
|
|
10230
10456
|
if (set !== 0 && set !== request.samples.length) {
|
|
10231
|
-
throw
|
|
10457
|
+
throw refuse2(model, "missing_input", `needs ${field} on every sample or on none`);
|
|
10232
10458
|
}
|
|
10233
10459
|
}
|
|
10234
10460
|
return { request: { ...request, model: model.id, title }, warnings: [] };
|
|
@@ -10236,10 +10462,10 @@ function resolveVoiceCloneOptions(model, request) {
|
|
|
10236
10462
|
function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
10237
10463
|
const warnings = [];
|
|
10238
10464
|
const prompt = request.prompt.trim();
|
|
10239
|
-
if (!prompt) throw
|
|
10465
|
+
if (!prompt) throw refuse2(model, "missing_input", "needs a voice description");
|
|
10240
10466
|
const maxChars = promptConventions(model).maxChars;
|
|
10241
10467
|
if (maxChars !== void 0 && prompt.length > maxChars) {
|
|
10242
|
-
throw
|
|
10468
|
+
throw refuse2(
|
|
10243
10469
|
model,
|
|
10244
10470
|
"unsupported_option",
|
|
10245
10471
|
`takes up to ${maxChars} characters; got ${prompt.length}`
|
|
@@ -10250,7 +10476,7 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
|
10250
10476
|
const preview2 = request.previewText?.trim();
|
|
10251
10477
|
if (preview2) {
|
|
10252
10478
|
if (limits !== void 0 && preview2.length > limits.previewMaxChars) {
|
|
10253
|
-
throw
|
|
10479
|
+
throw refuse2(
|
|
10254
10480
|
model,
|
|
10255
10481
|
"unsupported_option",
|
|
10256
10482
|
`takes a preview line of up to ${limits.previewMaxChars} characters; got ${preview2.length}`
|
|
@@ -10266,7 +10492,7 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
|
10266
10492
|
const cap = limits?.maxCandidates ?? count2;
|
|
10267
10493
|
if (!Number.isInteger(count2) || count2 < 1 || count2 > cap) {
|
|
10268
10494
|
if (onUnsupported === "error" || !Number.isInteger(count2)) {
|
|
10269
|
-
throw
|
|
10495
|
+
throw refuse2(
|
|
10270
10496
|
model,
|
|
10271
10497
|
"unsupported_option",
|
|
10272
10498
|
`returns 1-${cap} candidates; got ${count2}`
|