@shop-os/modelkit 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,15 @@ header in the release PR.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.15.0] - Unreleased
13
+
14
+ Reference and source videos have a minimum frame size, checked before the provider call (ENG-3453).
15
+
16
+ ### Added
17
+ - `references.videoPixels` and `sourceVideoPixels` constraints (`{ minWidth?, minHeight? }`, `VideoPixelLimits`): the smallest frame a row takes for a reference or source video. Kits before 0.15.0 ignore them (the constraint objects are loose).
18
+ - `videoSizeViolation(model, { referenceVideos?, sourceVideo? })` beside `videoLengthViolation`: the first undersized video as a user-facing message ("Kling 4.0 takes reference videos at least 700 px wide; video 1 is 576 px."), from measured sizes. An unmeasured video passes.
19
+ - Limits from fal's schemas: `kling-4.0` reference videos and `kling-4.0-edit` source 700 px, `kling-o3-edit` source 720 px, `kling-3.0-motion-control-*` motion clip 340 px (width and height each). The stored `model_catalog` rows need the same values (pro-admin) for runtime checks to see them.
20
+
12
21
  ## [0.14.0] - Unreleased
13
22
 
14
23
  Video Depth Anything on fal, as a Creative Studio video tool.
package/dist/catalog.cjs CHANGED
@@ -79,6 +79,7 @@ __export(catalog_entry_exports, {
79
79
  sortCatalogRows: () => sortCatalogRows,
80
80
  takesTargetAspectRatio: () => takesTargetAspectRatio,
81
81
  videoLengthViolation: () => videoLengthViolation,
82
+ videoSizeViolation: () => videoSizeViolation,
82
83
  videoToolConstraints: () => videoToolConstraints
83
84
  });
84
85
  module.exports = __toCommonJS(catalog_entry_exports);
@@ -5167,6 +5168,7 @@ function klingMotionControl(tier) {
5167
5168
  videos: 1,
5168
5169
  audios: 0,
5169
5170
  videoSeconds: { min: 3, max: 30.05 },
5171
+ videoPixels: { minWidth: 340, minHeight: 340 },
5170
5172
  min: { images: 1, videos: 1 }
5171
5173
  },
5172
5174
  requires: ["references"],
@@ -5233,6 +5235,7 @@ var VIDEO_FAMILY_MODELS = [
5233
5235
  references: { ...NO_REFERENCES, images: 4 },
5234
5236
  requires: ["sourceVideo"],
5235
5237
  sourceVideoSeconds: { min: 3, max: 15.05 },
5238
+ sourceVideoPixels: { minWidth: 720, minHeight: 720 },
5236
5239
  // generateAudio keeps (true) or drops (false) the source soundtrack.
5237
5240
  supports: ["generateAudio"],
5238
5241
  prompt: KLING_PROMPT,
@@ -5273,7 +5276,8 @@ var VIDEO_FAMILY_MODELS = [
5273
5276
  ...NO_REFERENCES,
5274
5277
  images: 10,
5275
5278
  videos: 5,
5276
- videoSeconds: { min: 3, max: 30.05, total: 30 }
5279
+ videoSeconds: { min: 3, max: 30.05, total: 30 },
5280
+ videoPixels: { minWidth: 700, minHeight: 700 }
5277
5281
  },
5278
5282
  supports: ["lastFrame"],
5279
5283
  prompt: KLING_V4_PROMPT,
@@ -5307,6 +5311,7 @@ var VIDEO_FAMILY_MODELS = [
5307
5311
  references: { ...NO_REFERENCES, images: 10 },
5308
5312
  requires: ["sourceVideo"],
5309
5313
  sourceVideoSeconds: { min: 3, max: 30.05 },
5314
+ sourceVideoPixels: { minWidth: 700, minHeight: 700 },
5310
5315
  supports: [],
5311
5316
  prompt: KLING_V4_PROMPT,
5312
5317
  audio: KLING_V4_AUDIO
@@ -7857,6 +7862,10 @@ var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
7857
7862
  total: import_zod3.z.number().optional(),
7858
7863
  editMin: import_zod3.z.number().optional()
7859
7864
  });
7865
+ var VideoPixelLimitsSchema = import_zod3.z.looseObject({
7866
+ minWidth: import_zod3.z.number().int().positive().optional(),
7867
+ minHeight: import_zod3.z.number().int().positive().optional()
7868
+ });
7860
7869
  var ReferenceLimitsSchema = import_zod3.z.looseObject({
7861
7870
  images: import_zod3.z.number().optional(),
7862
7871
  imagesWithVideo: import_zod3.z.number().optional(),
@@ -7865,6 +7874,7 @@ var ReferenceLimitsSchema = import_zod3.z.looseObject({
7865
7874
  total: import_zod3.z.number().optional(),
7866
7875
  audioOnly: import_zod3.z.boolean().optional(),
7867
7876
  videoSeconds: VideoSecondsLimitsSchema.optional(),
7877
+ videoPixels: VideoPixelLimitsSchema.optional(),
7868
7878
  audioSeconds: import_zod3.z.looseObject({
7869
7879
  min: import_zod3.z.number().optional(),
7870
7880
  max: import_zod3.z.number().optional(),
@@ -7954,6 +7964,7 @@ var ModelConstraintsSchema = import_zod3.z.looseObject({
7954
7964
  }).optional(),
7955
7965
  languages: import_zod3.z.array(LanguageOptionSchema).optional(),
7956
7966
  outputFormats: import_zod3.z.array(import_zod3.z.string().min(1)).min(1).optional(),
7967
+ sourceVideoPixels: VideoPixelLimitsSchema.optional(),
7957
7968
  sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: import_zod3.z.boolean().optional() }).optional(),
7958
7969
  // segmentSeconds/maxTotalSeconds stay required: a kit before 0.3.0 drops a row whose
7959
7970
  // extension lacks them, so every extension block keeps them.
@@ -9478,6 +9489,28 @@ function videoLengthViolation(model, input) {
9478
9489
  return `${model.label} takes a source video of at least ${String(sourceMin)} s; this one is ${seconds2(source, sourceMin)} s.`;
9479
9490
  return void 0;
9480
9491
  }
9492
+ function undersizedSide(frame, limits) {
9493
+ if (!frame || !limits) return void 0;
9494
+ const { width, height } = frame;
9495
+ if (limits.minWidth !== void 0 && width !== void 0 && width > 0 && width < limits.minWidth)
9496
+ return { side: "wide", min: limits.minWidth, actual: width };
9497
+ if (limits.minHeight !== void 0 && height !== void 0 && height > 0 && height < limits.minHeight)
9498
+ return { side: "tall", min: limits.minHeight, actual: height };
9499
+ return void 0;
9500
+ }
9501
+ function videoSizeViolation(model, input) {
9502
+ const refLimits = model.constraints.references?.videoPixels;
9503
+ const refs = input.referenceVideos ?? [];
9504
+ for (let i = 0; i < refs.length; i++) {
9505
+ const under2 = undersizedSide(refs[i], refLimits);
9506
+ if (under2)
9507
+ return `${model.label} takes reference videos at least ${String(under2.min)} px ${under2.side}; video ${i + 1} is ${String(under2.actual)} px.`;
9508
+ }
9509
+ const under = undersizedSide(input.sourceVideo, model.constraints.sourceVideoPixels);
9510
+ if (under)
9511
+ return `${model.label} takes a source video at least ${String(under.min)} px ${under.side}; this one is ${String(under.actual)} px.`;
9512
+ return void 0;
9513
+ }
9481
9514
  function resolveImageOptions(model, request, onUnsupported = "error") {
9482
9515
  const warnings = [];
9483
9516
  const c = model.constraints;