@shop-os/modelkit 0.3.2 → 0.3.4
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/README.md +2 -1
- package/dist/catalog.cjs +158 -11
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +13 -1
- package/dist/catalog.d.ts +13 -1
- package/dist/catalog.js +158 -11
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +186 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +184 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -152,6 +152,8 @@ interface VideoToolRequest {
|
|
|
152
152
|
source: VideoToolSource;
|
|
153
153
|
/** Upscale rows. */
|
|
154
154
|
upscaleFactor?: number;
|
|
155
|
+
/** Upscale rows whose `constraints.tool.prompt` is set; ignored by every other row. */
|
|
156
|
+
prompt?: string;
|
|
155
157
|
/** Interpolate rows. */
|
|
156
158
|
targetFps?: number;
|
|
157
159
|
/** HDR rows; the row's first `outputFormats` entry when unset. */
|
|
@@ -274,6 +276,8 @@ interface VideoToolConstraints {
|
|
|
274
276
|
};
|
|
275
277
|
/** Upscale: the output's long edge may not pass this, in pixels. */
|
|
276
278
|
maxOutputLongEdge?: number;
|
|
279
|
+
/** Upscale: the row takes an optional prompt that guides added detail. */
|
|
280
|
+
prompt?: boolean;
|
|
277
281
|
/** Interpolate: allowed target frame rate range. */
|
|
278
282
|
fps?: {
|
|
279
283
|
min: number;
|
|
@@ -396,6 +400,8 @@ interface CatalogCapabilities {
|
|
|
396
400
|
videoEdit?: boolean;
|
|
397
401
|
/** Video rows: first/last frames and reference images are mutually exclusive inputs. */
|
|
398
402
|
framesExcludeReferences?: boolean;
|
|
403
|
+
/** Video rows: a source video is never sent with first/last frames or reference images. */
|
|
404
|
+
sourceVideoExcludesFrames?: boolean;
|
|
399
405
|
/** Video rows: a last frame is accepted only together with a first frame. */
|
|
400
406
|
lastFrameRequiresFirstFrame?: boolean;
|
|
401
407
|
/** Text rows. `reasoning`: the model streams reasoning the UI should surface. */
|
|
@@ -819,6 +825,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
819
825
|
max: z.ZodNumber;
|
|
820
826
|
}, z.core.$loose>>;
|
|
821
827
|
maxOutputLongEdge: z.ZodOptional<z.ZodNumber>;
|
|
828
|
+
prompt: z.ZodOptional<z.ZodBoolean>;
|
|
822
829
|
fps: z.ZodOptional<z.ZodObject<{
|
|
823
830
|
min: z.ZodNumber;
|
|
824
831
|
max: z.ZodNumber;
|
|
@@ -1021,6 +1028,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1021
1028
|
acceptsSourceVideo: z.ZodOptional<z.ZodBoolean>;
|
|
1022
1029
|
videoEdit: z.ZodOptional<z.ZodBoolean>;
|
|
1023
1030
|
framesExcludeReferences: z.ZodOptional<z.ZodBoolean>;
|
|
1031
|
+
sourceVideoExcludesFrames: z.ZodOptional<z.ZodBoolean>;
|
|
1024
1032
|
lastFrameRequiresFirstFrame: z.ZodOptional<z.ZodBoolean>;
|
|
1025
1033
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
1026
1034
|
vision: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1030,15 +1038,19 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1030
1038
|
declare const CatalogModelSchema: z.ZodType<CatalogModel>;
|
|
1031
1039
|
declare const CatalogSchema: z.ZodType<CatalogModel[]>;
|
|
1032
1040
|
|
|
1033
|
-
declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages"];
|
|
1041
|
+
declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages", "sourceVideo"];
|
|
1034
1042
|
declare const IMAGE_INPUT_SPEC_KEYS: readonly ["prompt", "references", "aspectRatio", "size", "outputFormat", "seed"];
|
|
1035
1043
|
declare const AUDIO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "seed", "negativePrompt", "references", "sourceVideo", "instrumental"];
|
|
1044
|
+
/** Image inputs that `inputSpec.arrays` can join into one provider array field. */
|
|
1045
|
+
declare const ARRAY_INPUT_SPEC_KEYS: readonly ["firstFrame", "referenceImages", "lastFrame", "references"];
|
|
1046
|
+
type ArrayInputSpecKey = (typeof ARRAY_INPUT_SPEC_KEYS)[number];
|
|
1036
1047
|
type InputSpecKey = (typeof VIDEO_INPUT_SPEC_KEYS)[number] | (typeof IMAGE_INPUT_SPEC_KEYS)[number] | (typeof AUDIO_INPUT_SPEC_KEYS)[number];
|
|
1037
1048
|
declare const INPUT_SPEC_SUPPORTS_KEYS: readonly SupportedOption[];
|
|
1038
1049
|
declare const InputSpecSchema: z.ZodObject<{
|
|
1039
1050
|
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1040
1051
|
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
|
|
1041
1052
|
static: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1053
|
+
arrays: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
1042
1054
|
editEndpoint: z.ZodOptional<z.ZodString>;
|
|
1043
1055
|
}, z.core.$strict>;
|
|
1044
1056
|
type InputSpec = z.infer<typeof InputSpecSchema>;
|
|
@@ -1054,6 +1066,7 @@ interface ValidateRow {
|
|
|
1054
1066
|
};
|
|
1055
1067
|
}
|
|
1056
1068
|
declare function isInputSpecKey(key: string): key is InputSpecKey;
|
|
1069
|
+
declare function isArrayInputSpecKey(key: string): key is ArrayInputSpecKey;
|
|
1057
1070
|
declare function validateInputSpec(raw: ProviderOptionValue, row: ValidateRow): {
|
|
1058
1071
|
ok: true;
|
|
1059
1072
|
spec: InputSpec;
|
|
@@ -1406,7 +1419,11 @@ declare function planVideoTool(row: CatalogModel, req: Omit<VideoToolRequest, "m
|
|
|
1406
1419
|
|
|
1407
1420
|
/**
|
|
1408
1421
|
* Topaz Labs video tools on fal. `providerOptions.fal.model` names the Topaz model the
|
|
1409
|
-
* endpoint runs; the adapter sends it as `model`.
|
|
1422
|
+
* endpoint runs; the adapter sends it as `model`. Precision and Starlight are also listed in
|
|
1423
|
+
* Space Builder's video upscale node.
|
|
1424
|
+
*
|
|
1425
|
+
* FLUX video upscale on fal: one endpoint, two rows, because fal prices its `creativity`
|
|
1426
|
+
* modes differently and pricing is keyed by model. `providerOptions.fal.input` fixes the mode.
|
|
1410
1427
|
*/
|
|
1411
1428
|
declare const VIDEO_TOOL_MODELS: CatalogModel[];
|
|
1412
1429
|
|
|
@@ -1445,4 +1462,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
1445
1462
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
1446
1463
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
1447
1464
|
|
|
1448
|
-
export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type FalWebhookBody, type GeneratedImage, IMAGE_INPUT_SPEC_KEYS, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type KeyTier, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, 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 Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, falWebhookBodySchema, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, missingTierKeys, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, planVideoTool, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, videoToolConstraints, withRetry, xaiVideoAdapter };
|
|
1465
|
+
export { ADAPTER_IDS, ADAPTER_KEYS, ARRAY_INPUT_SPEC_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type ArrayInputSpecKey, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type FalWebhookBody, type GeneratedImage, IMAGE_INPUT_SPEC_KEYS, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type KeyTier, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, 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 Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, falWebhookBodySchema, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isArrayInputSpecKey, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, missingTierKeys, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, planVideoTool, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, videoToolConstraints, withRetry, xaiVideoAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -152,6 +152,8 @@ interface VideoToolRequest {
|
|
|
152
152
|
source: VideoToolSource;
|
|
153
153
|
/** Upscale rows. */
|
|
154
154
|
upscaleFactor?: number;
|
|
155
|
+
/** Upscale rows whose `constraints.tool.prompt` is set; ignored by every other row. */
|
|
156
|
+
prompt?: string;
|
|
155
157
|
/** Interpolate rows. */
|
|
156
158
|
targetFps?: number;
|
|
157
159
|
/** HDR rows; the row's first `outputFormats` entry when unset. */
|
|
@@ -274,6 +276,8 @@ interface VideoToolConstraints {
|
|
|
274
276
|
};
|
|
275
277
|
/** Upscale: the output's long edge may not pass this, in pixels. */
|
|
276
278
|
maxOutputLongEdge?: number;
|
|
279
|
+
/** Upscale: the row takes an optional prompt that guides added detail. */
|
|
280
|
+
prompt?: boolean;
|
|
277
281
|
/** Interpolate: allowed target frame rate range. */
|
|
278
282
|
fps?: {
|
|
279
283
|
min: number;
|
|
@@ -396,6 +400,8 @@ interface CatalogCapabilities {
|
|
|
396
400
|
videoEdit?: boolean;
|
|
397
401
|
/** Video rows: first/last frames and reference images are mutually exclusive inputs. */
|
|
398
402
|
framesExcludeReferences?: boolean;
|
|
403
|
+
/** Video rows: a source video is never sent with first/last frames or reference images. */
|
|
404
|
+
sourceVideoExcludesFrames?: boolean;
|
|
399
405
|
/** Video rows: a last frame is accepted only together with a first frame. */
|
|
400
406
|
lastFrameRequiresFirstFrame?: boolean;
|
|
401
407
|
/** Text rows. `reasoning`: the model streams reasoning the UI should surface. */
|
|
@@ -819,6 +825,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
819
825
|
max: z.ZodNumber;
|
|
820
826
|
}, z.core.$loose>>;
|
|
821
827
|
maxOutputLongEdge: z.ZodOptional<z.ZodNumber>;
|
|
828
|
+
prompt: z.ZodOptional<z.ZodBoolean>;
|
|
822
829
|
fps: z.ZodOptional<z.ZodObject<{
|
|
823
830
|
min: z.ZodNumber;
|
|
824
831
|
max: z.ZodNumber;
|
|
@@ -1021,6 +1028,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1021
1028
|
acceptsSourceVideo: z.ZodOptional<z.ZodBoolean>;
|
|
1022
1029
|
videoEdit: z.ZodOptional<z.ZodBoolean>;
|
|
1023
1030
|
framesExcludeReferences: z.ZodOptional<z.ZodBoolean>;
|
|
1031
|
+
sourceVideoExcludesFrames: z.ZodOptional<z.ZodBoolean>;
|
|
1024
1032
|
lastFrameRequiresFirstFrame: z.ZodOptional<z.ZodBoolean>;
|
|
1025
1033
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
1026
1034
|
vision: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1030,15 +1038,19 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1030
1038
|
declare const CatalogModelSchema: z.ZodType<CatalogModel>;
|
|
1031
1039
|
declare const CatalogSchema: z.ZodType<CatalogModel[]>;
|
|
1032
1040
|
|
|
1033
|
-
declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages"];
|
|
1041
|
+
declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages", "sourceVideo"];
|
|
1034
1042
|
declare const IMAGE_INPUT_SPEC_KEYS: readonly ["prompt", "references", "aspectRatio", "size", "outputFormat", "seed"];
|
|
1035
1043
|
declare const AUDIO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "seed", "negativePrompt", "references", "sourceVideo", "instrumental"];
|
|
1044
|
+
/** Image inputs that `inputSpec.arrays` can join into one provider array field. */
|
|
1045
|
+
declare const ARRAY_INPUT_SPEC_KEYS: readonly ["firstFrame", "referenceImages", "lastFrame", "references"];
|
|
1046
|
+
type ArrayInputSpecKey = (typeof ARRAY_INPUT_SPEC_KEYS)[number];
|
|
1036
1047
|
type InputSpecKey = (typeof VIDEO_INPUT_SPEC_KEYS)[number] | (typeof IMAGE_INPUT_SPEC_KEYS)[number] | (typeof AUDIO_INPUT_SPEC_KEYS)[number];
|
|
1037
1048
|
declare const INPUT_SPEC_SUPPORTS_KEYS: readonly SupportedOption[];
|
|
1038
1049
|
declare const InputSpecSchema: z.ZodObject<{
|
|
1039
1050
|
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1040
1051
|
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
|
|
1041
1052
|
static: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1053
|
+
arrays: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
1042
1054
|
editEndpoint: z.ZodOptional<z.ZodString>;
|
|
1043
1055
|
}, z.core.$strict>;
|
|
1044
1056
|
type InputSpec = z.infer<typeof InputSpecSchema>;
|
|
@@ -1054,6 +1066,7 @@ interface ValidateRow {
|
|
|
1054
1066
|
};
|
|
1055
1067
|
}
|
|
1056
1068
|
declare function isInputSpecKey(key: string): key is InputSpecKey;
|
|
1069
|
+
declare function isArrayInputSpecKey(key: string): key is ArrayInputSpecKey;
|
|
1057
1070
|
declare function validateInputSpec(raw: ProviderOptionValue, row: ValidateRow): {
|
|
1058
1071
|
ok: true;
|
|
1059
1072
|
spec: InputSpec;
|
|
@@ -1406,7 +1419,11 @@ declare function planVideoTool(row: CatalogModel, req: Omit<VideoToolRequest, "m
|
|
|
1406
1419
|
|
|
1407
1420
|
/**
|
|
1408
1421
|
* Topaz Labs video tools on fal. `providerOptions.fal.model` names the Topaz model the
|
|
1409
|
-
* endpoint runs; the adapter sends it as `model`.
|
|
1422
|
+
* endpoint runs; the adapter sends it as `model`. Precision and Starlight are also listed in
|
|
1423
|
+
* Space Builder's video upscale node.
|
|
1424
|
+
*
|
|
1425
|
+
* FLUX video upscale on fal: one endpoint, two rows, because fal prices its `creativity`
|
|
1426
|
+
* modes differently and pricing is keyed by model. `providerOptions.fal.input` fixes the mode.
|
|
1410
1427
|
*/
|
|
1411
1428
|
declare const VIDEO_TOOL_MODELS: CatalogModel[];
|
|
1412
1429
|
|
|
@@ -1445,4 +1462,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
1445
1462
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
1446
1463
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
1447
1464
|
|
|
1448
|
-
export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type FalWebhookBody, type GeneratedImage, IMAGE_INPUT_SPEC_KEYS, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type KeyTier, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, 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 Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, falWebhookBodySchema, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, missingTierKeys, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, planVideoTool, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, videoToolConstraints, withRetry, xaiVideoAdapter };
|
|
1465
|
+
export { ADAPTER_IDS, ADAPTER_KEYS, ARRAY_INPUT_SPEC_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type ArrayInputSpecKey, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type FalWebhookBody, type GeneratedImage, IMAGE_INPUT_SPEC_KEYS, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type KeyTier, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, 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 Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, falWebhookBodySchema, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isArrayInputSpecKey, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, missingTierKeys, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, planVideoTool, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, videoToolConstraints, withRetry, xaiVideoAdapter };
|
package/dist/index.js
CHANGED
|
@@ -2013,8 +2013,16 @@ var VIDEO_MODELS = [
|
|
|
2013
2013
|
|
|
2014
2014
|
// src/catalog/video-tools.ts
|
|
2015
2015
|
var TOPAZ_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/topazlabs.png";
|
|
2016
|
+
var FLUX_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/flux.png";
|
|
2016
2017
|
var TOPAZ_SOURCE_SECONDS = { max: 300 };
|
|
2017
|
-
var
|
|
2018
|
+
var SECONDS_USAGE = { unit: "seconds" };
|
|
2019
|
+
var FLUX_SOURCE_SECONDS = { max: 20 };
|
|
2020
|
+
var FLUX_UPSCALE_TOOL = {
|
|
2021
|
+
kind: "upscale",
|
|
2022
|
+
upscaleFactor: { min: 1.5, max: 3 },
|
|
2023
|
+
maxOutputLongEdge: 3840,
|
|
2024
|
+
prompt: true
|
|
2025
|
+
};
|
|
2018
2026
|
var VIDEO_TOOL_MODELS = [
|
|
2019
2027
|
{
|
|
2020
2028
|
id: "topaz-precision",
|
|
@@ -2024,7 +2032,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2024
2032
|
adapter: "fal",
|
|
2025
2033
|
providerModelId: "topaz/upscale/video/precision",
|
|
2026
2034
|
lifecycle: "active",
|
|
2027
|
-
exposure: ["cowork"],
|
|
2035
|
+
exposure: ["cowork", "space_builder"],
|
|
2028
2036
|
constraints: {
|
|
2029
2037
|
supports: [],
|
|
2030
2038
|
sourceVideoSeconds: TOPAZ_SOURCE_SECONDS,
|
|
@@ -2032,7 +2040,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2032
2040
|
},
|
|
2033
2041
|
defaults: {},
|
|
2034
2042
|
providerOptions: { fal: { model: "Proteus" } },
|
|
2035
|
-
usage:
|
|
2043
|
+
usage: SECONDS_USAGE,
|
|
2036
2044
|
pricingKind: "video_per_second",
|
|
2037
2045
|
display: {
|
|
2038
2046
|
provider: "topaz",
|
|
@@ -2049,7 +2057,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2049
2057
|
adapter: "fal",
|
|
2050
2058
|
providerModelId: "topaz/upscale/video/generative",
|
|
2051
2059
|
lifecycle: "active",
|
|
2052
|
-
exposure: ["cowork"],
|
|
2060
|
+
exposure: ["cowork", "space_builder"],
|
|
2053
2061
|
constraints: {
|
|
2054
2062
|
supports: [],
|
|
2055
2063
|
sourceVideoSeconds: TOPAZ_SOURCE_SECONDS,
|
|
@@ -2057,7 +2065,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2057
2065
|
},
|
|
2058
2066
|
defaults: {},
|
|
2059
2067
|
providerOptions: { fal: { model: "Starlight Precise 2.6" } },
|
|
2060
|
-
usage:
|
|
2068
|
+
usage: SECONDS_USAGE,
|
|
2061
2069
|
pricingKind: "video_per_second",
|
|
2062
2070
|
display: {
|
|
2063
2071
|
provider: "topaz",
|
|
@@ -2082,7 +2090,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2082
2090
|
},
|
|
2083
2091
|
defaults: {},
|
|
2084
2092
|
providerOptions: { fal: { model: "Apollo" } },
|
|
2085
|
-
usage:
|
|
2093
|
+
usage: SECONDS_USAGE,
|
|
2086
2094
|
pricingKind: "video_per_second",
|
|
2087
2095
|
display: {
|
|
2088
2096
|
provider: "topaz",
|
|
@@ -2105,13 +2113,63 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2105
2113
|
tool: { kind: "hdr", outputFormats: ["h265", "prores"] }
|
|
2106
2114
|
},
|
|
2107
2115
|
defaults: {},
|
|
2108
|
-
usage:
|
|
2116
|
+
usage: SECONDS_USAGE,
|
|
2109
2117
|
pricingKind: "video_per_second",
|
|
2110
2118
|
display: {
|
|
2111
2119
|
provider: "topaz",
|
|
2112
2120
|
logo: TOPAZ_LOGO,
|
|
2113
2121
|
description: "Topaz Hyperion 2.5 SDR to HDR: a 10-bit HDR master in H.265 (HDR10) or ProRes 422 HQ, at the source's size and frame rate."
|
|
2114
2122
|
}
|
|
2123
|
+
},
|
|
2124
|
+
{
|
|
2125
|
+
id: "flux-video-upscale-precise",
|
|
2126
|
+
aliases: [],
|
|
2127
|
+
label: "FLUX Upscale Precise",
|
|
2128
|
+
type: "video-tool",
|
|
2129
|
+
adapter: "fal",
|
|
2130
|
+
providerModelId: "blackforestlabs/flux-video-upscale",
|
|
2131
|
+
lifecycle: "active",
|
|
2132
|
+
exposure: ["space_builder"],
|
|
2133
|
+
constraints: {
|
|
2134
|
+
supports: [],
|
|
2135
|
+
sourceVideoSeconds: FLUX_SOURCE_SECONDS,
|
|
2136
|
+
tool: FLUX_UPSCALE_TOOL
|
|
2137
|
+
},
|
|
2138
|
+
defaults: {},
|
|
2139
|
+
providerOptions: { fal: { input: { creativity: 0 } } },
|
|
2140
|
+
usage: SECONDS_USAGE,
|
|
2141
|
+
pricingKind: "video_per_second",
|
|
2142
|
+
display: {
|
|
2143
|
+
provider: "black-forest-labs",
|
|
2144
|
+
logo: FLUX_LOGO,
|
|
2145
|
+
description: "FLUX 3 super-resolution, source-faithful: 1.5x to 3x, up to 4K, for clips up to 20 seconds.",
|
|
2146
|
+
sortOrder: 30
|
|
2147
|
+
}
|
|
2148
|
+
},
|
|
2149
|
+
{
|
|
2150
|
+
id: "flux-video-upscale-creative",
|
|
2151
|
+
aliases: [],
|
|
2152
|
+
label: "FLUX Upscale Creative",
|
|
2153
|
+
type: "video-tool",
|
|
2154
|
+
adapter: "fal",
|
|
2155
|
+
providerModelId: "blackforestlabs/flux-video-upscale",
|
|
2156
|
+
lifecycle: "active",
|
|
2157
|
+
exposure: ["space_builder"],
|
|
2158
|
+
constraints: {
|
|
2159
|
+
supports: [],
|
|
2160
|
+
sourceVideoSeconds: FLUX_SOURCE_SECONDS,
|
|
2161
|
+
tool: FLUX_UPSCALE_TOOL
|
|
2162
|
+
},
|
|
2163
|
+
defaults: {},
|
|
2164
|
+
providerOptions: { fal: { input: { creativity: 1 } } },
|
|
2165
|
+
usage: SECONDS_USAGE,
|
|
2166
|
+
pricingKind: "video_per_second",
|
|
2167
|
+
display: {
|
|
2168
|
+
provider: "black-forest-labs",
|
|
2169
|
+
logo: FLUX_LOGO,
|
|
2170
|
+
description: "FLUX 3 super-resolution that adds fine detail, optionally guided by a prompt: 1.5x to 3x, up to 4K, for clips up to 20 seconds. Costs more than Precise.",
|
|
2171
|
+
sortOrder: 40
|
|
2172
|
+
}
|
|
2115
2173
|
}
|
|
2116
2174
|
];
|
|
2117
2175
|
|
|
@@ -2238,7 +2296,8 @@ var VIDEO_INPUT_SPEC_KEYS = [
|
|
|
2238
2296
|
"generateAudio",
|
|
2239
2297
|
"cfgScale",
|
|
2240
2298
|
"promptExpansion",
|
|
2241
|
-
"referenceImages"
|
|
2299
|
+
"referenceImages",
|
|
2300
|
+
"sourceVideo"
|
|
2242
2301
|
];
|
|
2243
2302
|
var IMAGE_INPUT_SPEC_KEYS = [
|
|
2244
2303
|
"prompt",
|
|
@@ -2257,6 +2316,12 @@ var AUDIO_INPUT_SPEC_KEYS = [
|
|
|
2257
2316
|
"sourceVideo",
|
|
2258
2317
|
"instrumental"
|
|
2259
2318
|
];
|
|
2319
|
+
var ARRAY_INPUT_SPEC_KEYS = [
|
|
2320
|
+
"firstFrame",
|
|
2321
|
+
"referenceImages",
|
|
2322
|
+
"lastFrame",
|
|
2323
|
+
"references"
|
|
2324
|
+
];
|
|
2260
2325
|
var INPUT_SPEC_SUPPORTS_KEYS = [
|
|
2261
2326
|
"lastFrame",
|
|
2262
2327
|
"seed",
|
|
@@ -2270,6 +2335,7 @@ var INPUT_SPEC_SUPPORTS_KEYS = [
|
|
|
2270
2335
|
var VIDEO_KEY_SET = new Set(VIDEO_INPUT_SPEC_KEYS);
|
|
2271
2336
|
var IMAGE_KEY_SET = new Set(IMAGE_INPUT_SPEC_KEYS);
|
|
2272
2337
|
var AUDIO_KEY_SET = new Set(AUDIO_INPUT_SPEC_KEYS);
|
|
2338
|
+
var ARRAY_KEY_SET = new Set(ARRAY_INPUT_SPEC_KEYS);
|
|
2273
2339
|
var ALL_KEY_SET = /* @__PURE__ */ new Set([
|
|
2274
2340
|
...VIDEO_INPUT_SPEC_KEYS,
|
|
2275
2341
|
...IMAGE_INPUT_SPEC_KEYS,
|
|
@@ -2314,13 +2380,30 @@ var ValuesSchema = z2.record(z2.string(), z2.record(z2.string(), ProviderScalarS
|
|
|
2314
2380
|
}
|
|
2315
2381
|
});
|
|
2316
2382
|
var StaticSchema = z2.record(z2.string(), ProviderScalarSchema);
|
|
2383
|
+
var ArraysSchema = z2.record(z2.string().min(1), z2.array(z2.string()).min(1)).superRefine((arrays, ctx) => {
|
|
2384
|
+
for (const [name, keys] of Object.entries(arrays)) {
|
|
2385
|
+
for (const key of keys) {
|
|
2386
|
+
if (!ARRAY_KEY_SET.has(key)) {
|
|
2387
|
+
ctx.addIssue({
|
|
2388
|
+
code: "custom",
|
|
2389
|
+
path: [name],
|
|
2390
|
+
message: `inputSpec.arrays "${name}" has unknown image key "${key}"`
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2317
2396
|
var InputSpecSchema = z2.strictObject({
|
|
2318
2397
|
fields: FieldsSchema,
|
|
2319
2398
|
values: ValuesSchema.optional(),
|
|
2320
2399
|
static: StaticSchema.optional(),
|
|
2400
|
+
arrays: ArraysSchema.optional(),
|
|
2321
2401
|
editEndpoint: z2.string().min(1).optional()
|
|
2322
2402
|
}).superRefine((spec, ctx) => {
|
|
2323
|
-
const mappedNames = new Set(
|
|
2403
|
+
const mappedNames = /* @__PURE__ */ new Set([
|
|
2404
|
+
...Object.values(spec.fields),
|
|
2405
|
+
...Object.keys(spec.arrays ?? {})
|
|
2406
|
+
]);
|
|
2324
2407
|
for (const key of Object.keys(spec.static ?? {})) {
|
|
2325
2408
|
if (mappedNames.has(key)) {
|
|
2326
2409
|
ctx.addIssue({
|
|
@@ -2334,6 +2417,9 @@ var InputSpecSchema = z2.strictObject({
|
|
|
2334
2417
|
function isInputSpecKey(key) {
|
|
2335
2418
|
return ALL_KEY_SET.has(key);
|
|
2336
2419
|
}
|
|
2420
|
+
function isArrayInputSpecKey(key) {
|
|
2421
|
+
return ARRAY_KEY_SET.has(key);
|
|
2422
|
+
}
|
|
2337
2423
|
function validateInputSpec(raw, row) {
|
|
2338
2424
|
const parsed = InputSpecSchema.safeParse(raw);
|
|
2339
2425
|
if (!parsed.success) {
|
|
@@ -2412,14 +2498,54 @@ function validateInputSpec(raw, row) {
|
|
|
2412
2498
|
});
|
|
2413
2499
|
}
|
|
2414
2500
|
}
|
|
2501
|
+
const arrayOwner = /* @__PURE__ */ new Map();
|
|
2502
|
+
for (const [name, keys] of Object.entries(spec.arrays ?? {})) {
|
|
2503
|
+
const fieldKey = seenNames.get(name);
|
|
2504
|
+
if (fieldKey !== void 0) {
|
|
2505
|
+
issues.push({
|
|
2506
|
+
path: ["arrays", name],
|
|
2507
|
+
message: `inputSpec.arrays "${name}" is also the provider field of inputSpec.fields "${fieldKey}"`
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
for (const key of keys) {
|
|
2511
|
+
if (allowed !== void 0 && !allowed.has(key)) {
|
|
2512
|
+
issues.push({
|
|
2513
|
+
path: ["arrays", name],
|
|
2514
|
+
message: `inputSpec.arrays "${key}" is not supported for ${row.type} rows`
|
|
2515
|
+
});
|
|
2516
|
+
}
|
|
2517
|
+
if (key in spec.fields) {
|
|
2518
|
+
issues.push({
|
|
2519
|
+
path: ["arrays", name],
|
|
2520
|
+
message: `inputSpec.arrays "${key}" is already mapped in inputSpec.fields`
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
const owner = arrayOwner.get(key);
|
|
2524
|
+
if (owner === void 0) arrayOwner.set(key, name);
|
|
2525
|
+
else {
|
|
2526
|
+
issues.push({
|
|
2527
|
+
path: ["arrays", name],
|
|
2528
|
+
message: owner === name ? `inputSpec.arrays "${name}" lists "${key}" twice` : `inputSpec.arrays "${owner}" and "${name}" both take "${key}"`
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2415
2533
|
const supports = row.constraints.supports ?? [];
|
|
2416
2534
|
for (const key of INPUT_SPEC_SUPPORTS_KEYS) {
|
|
2417
|
-
if (
|
|
2535
|
+
if (supports.includes(key)) continue;
|
|
2536
|
+
if (key in spec.fields) {
|
|
2418
2537
|
issues.push({
|
|
2419
2538
|
path: ["fields", key],
|
|
2420
2539
|
message: `inputSpec.fields "${key}" needs "${key}" in constraints.supports`
|
|
2421
2540
|
});
|
|
2422
2541
|
}
|
|
2542
|
+
const arrayName = arrayOwner.get(key);
|
|
2543
|
+
if (arrayName !== void 0) {
|
|
2544
|
+
issues.push({
|
|
2545
|
+
path: ["arrays", arrayName],
|
|
2546
|
+
message: `inputSpec.arrays "${key}" needs "${key}" in constraints.supports`
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2423
2549
|
}
|
|
2424
2550
|
if (issues.length > 0) return { ok: false, issues };
|
|
2425
2551
|
return { ok: true, spec };
|
|
@@ -2544,6 +2670,7 @@ var VideoToolConstraintsSchema = z3.looseObject({
|
|
|
2544
2670
|
kind: z3.enum(["upscale", "interpolate", "hdr"]),
|
|
2545
2671
|
upscaleFactor: RangeSchema.optional(),
|
|
2546
2672
|
maxOutputLongEdge: z3.number().positive().optional(),
|
|
2673
|
+
prompt: z3.boolean().optional(),
|
|
2547
2674
|
fps: RangeSchema.optional(),
|
|
2548
2675
|
outputFormats: z3.array(z3.enum(["h265", "prores"])).min(1).optional()
|
|
2549
2676
|
});
|
|
@@ -2641,6 +2768,7 @@ var CatalogCapabilitiesSchema = z3.looseObject({
|
|
|
2641
2768
|
acceptsSourceVideo: z3.boolean().optional(),
|
|
2642
2769
|
videoEdit: z3.boolean().optional(),
|
|
2643
2770
|
framesExcludeReferences: z3.boolean().optional(),
|
|
2771
|
+
sourceVideoExcludesFrames: z3.boolean().optional(),
|
|
2644
2772
|
lastFrameRequiresFirstFrame: z3.boolean().optional(),
|
|
2645
2773
|
reasoning: z3.boolean().optional(),
|
|
2646
2774
|
vision: z3.boolean().optional(),
|
|
@@ -3838,6 +3966,7 @@ var ToolSchema = z10.object({
|
|
|
3838
3966
|
kind: z10.enum(["upscale", "interpolate", "hdr"]),
|
|
3839
3967
|
upscaleFactor: RangeSchema2.optional(),
|
|
3840
3968
|
maxOutputLongEdge: z10.number().positive().optional(),
|
|
3969
|
+
prompt: z10.boolean().optional(),
|
|
3841
3970
|
fps: RangeSchema2.optional(),
|
|
3842
3971
|
outputFormats: z10.array(z10.enum(["h265", "prores"])).min(1).optional()
|
|
3843
3972
|
});
|
|
@@ -3845,11 +3974,12 @@ function videoToolConstraints(row) {
|
|
|
3845
3974
|
if (row.type !== "video-tool") return void 0;
|
|
3846
3975
|
const parsed = ToolSchema.safeParse(row.constraints.tool);
|
|
3847
3976
|
if (!parsed.success) return void 0;
|
|
3848
|
-
const { kind, upscaleFactor, maxOutputLongEdge, fps, outputFormats } = parsed.data;
|
|
3977
|
+
const { kind, upscaleFactor, maxOutputLongEdge, prompt, fps, outputFormats } = parsed.data;
|
|
3849
3978
|
return {
|
|
3850
3979
|
kind,
|
|
3851
3980
|
...upscaleFactor !== void 0 && { upscaleFactor },
|
|
3852
3981
|
...maxOutputLongEdge !== void 0 && { maxOutputLongEdge },
|
|
3982
|
+
...prompt !== void 0 && { prompt },
|
|
3853
3983
|
...fps !== void 0 && { fps },
|
|
3854
3984
|
...outputFormats !== void 0 && { outputFormats }
|
|
3855
3985
|
};
|
|
@@ -4005,14 +4135,21 @@ async function readJson(ctx, res) {
|
|
|
4005
4135
|
function providerModelName(ctx) {
|
|
4006
4136
|
return z11.string().safeParse(ctx.model.providerOptions?.["fal"]?.["model"]).data;
|
|
4007
4137
|
}
|
|
4138
|
+
function staticInput(ctx) {
|
|
4139
|
+
return JsonObjectSchema.safeParse(ctx.model.providerOptions?.["fal"]?.["input"]).data ?? {};
|
|
4140
|
+
}
|
|
4008
4141
|
function toolInput(ctx, req, output) {
|
|
4009
4142
|
const tool = videoToolConstraints(ctx.model);
|
|
4010
4143
|
const model = providerModelName(ctx);
|
|
4011
|
-
const input = { video_url: req.source.url };
|
|
4144
|
+
const input = { ...staticInput(ctx), video_url: req.source.url };
|
|
4012
4145
|
if (tool?.kind === "upscale") {
|
|
4013
|
-
if (model !== void 0) input["model"] = model;
|
|
4014
4146
|
input["upscale_factor"] = req.upscaleFactor ?? 1;
|
|
4015
|
-
|
|
4147
|
+
if (model !== void 0) {
|
|
4148
|
+
input["model"] = model;
|
|
4149
|
+
input["H264_output"] = true;
|
|
4150
|
+
}
|
|
4151
|
+
const prompt = req.prompt?.trim();
|
|
4152
|
+
if (tool.prompt === true && prompt) input["prompt"] = prompt;
|
|
4016
4153
|
} else if (tool?.kind === "interpolate") {
|
|
4017
4154
|
if (model !== void 0) input["model"] = model;
|
|
4018
4155
|
input["target_fps"] = req.targetFps ?? 60;
|
|
@@ -4168,6 +4305,17 @@ function applyInputSpec(spec, req, refToUrl2, opts) {
|
|
|
4168
4305
|
const mapped = spec.values?.[canonical]?.[String(value)];
|
|
4169
4306
|
out[providerField] = mapped ?? serialised;
|
|
4170
4307
|
}
|
|
4308
|
+
for (const [providerField, keys] of Object.entries(spec.arrays ?? {})) {
|
|
4309
|
+
const urls = [];
|
|
4310
|
+
for (const key of keys) {
|
|
4311
|
+
if (!isArrayInputSpecKey(key)) continue;
|
|
4312
|
+
const value = canonicalValue(req, key);
|
|
4313
|
+
if (value === void 0) continue;
|
|
4314
|
+
if (Array.isArray(value)) urls.push(...value.map(refToUrl2));
|
|
4315
|
+
else if (isMediaRef(value)) urls.push(refToUrl2(value));
|
|
4316
|
+
}
|
|
4317
|
+
if (urls.length > 0) out[providerField] = urls;
|
|
4318
|
+
}
|
|
4171
4319
|
for (const [key, value] of Object.entries(spec.static ?? {})) {
|
|
4172
4320
|
out[key] = value;
|
|
4173
4321
|
}
|
|
@@ -8289,6 +8437,26 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
|
|
|
8289
8437
|
});
|
|
8290
8438
|
delete merged.sourceVideo;
|
|
8291
8439
|
}
|
|
8440
|
+
const imageInputs = ["firstFrame", "lastFrame", "referenceImages"].filter(
|
|
8441
|
+
(field) => field === "referenceImages" ? compact(merged.referenceImages).length > 0 : merged[field] !== void 0
|
|
8442
|
+
);
|
|
8443
|
+
if (merged.sourceVideo !== void 0 && imageInputs.length > 0 && model.capabilities?.sourceVideoExcludesFrames) {
|
|
8444
|
+
if (onUnsupported === "error") {
|
|
8445
|
+
throw new ModelKitError({
|
|
8446
|
+
code: "unsupported_option",
|
|
8447
|
+
message: `${model.id} takes a source video or images, not both`,
|
|
8448
|
+
model: model.id
|
|
8449
|
+
});
|
|
8450
|
+
}
|
|
8451
|
+
for (const field of imageInputs) {
|
|
8452
|
+
warnings.push({
|
|
8453
|
+
code: "option_ignored",
|
|
8454
|
+
field,
|
|
8455
|
+
message: `${model.id} takes a source video or images, not both; ${field} dropped`
|
|
8456
|
+
});
|
|
8457
|
+
delete merged[field];
|
|
8458
|
+
}
|
|
8459
|
+
}
|
|
8292
8460
|
if (merged.lastFrame !== void 0 && merged.firstFrame === void 0 && model.capabilities?.lastFrameRequiresFirstFrame) {
|
|
8293
8461
|
if (onUnsupported === "error") {
|
|
8294
8462
|
throw new ModelKitError({
|
|
@@ -9405,6 +9573,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
9405
9573
|
export {
|
|
9406
9574
|
ADAPTER_IDS,
|
|
9407
9575
|
ADAPTER_KEYS,
|
|
9576
|
+
ARRAY_INPUT_SPEC_KEYS,
|
|
9408
9577
|
AUDIO_INPUT_SPEC_KEYS,
|
|
9409
9578
|
Catalog,
|
|
9410
9579
|
CatalogModelSchema,
|
|
@@ -9447,6 +9616,7 @@ export {
|
|
|
9447
9616
|
googleImageAdapter,
|
|
9448
9617
|
hasAwsCredentials,
|
|
9449
9618
|
higgsfieldAdapter,
|
|
9619
|
+
isArrayInputSpecKey,
|
|
9450
9620
|
isInputSpecKey,
|
|
9451
9621
|
isListed,
|
|
9452
9622
|
isListedOn,
|