@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 +9 -0
- package/dist/catalog.cjs +34 -1
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +31 -1
- package/dist/catalog.d.ts +31 -1
- package/dist/catalog.js +34 -1
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +35 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -136,6 +136,7 @@ __export(index_exports, {
|
|
|
136
136
|
toGeneratedImage: () => toGeneratedImage,
|
|
137
137
|
validateInputSpec: () => validateInputSpec,
|
|
138
138
|
videoLengthViolation: () => videoLengthViolation,
|
|
139
|
+
videoSizeViolation: () => videoSizeViolation,
|
|
139
140
|
videoToolConstraints: () => videoToolConstraints,
|
|
140
141
|
withRetry: () => withRetry,
|
|
141
142
|
xaiVideoAdapter: () => xaiVideoAdapter
|
|
@@ -5235,6 +5236,7 @@ function klingMotionControl(tier) {
|
|
|
5235
5236
|
videos: 1,
|
|
5236
5237
|
audios: 0,
|
|
5237
5238
|
videoSeconds: { min: 3, max: 30.05 },
|
|
5239
|
+
videoPixels: { minWidth: 340, minHeight: 340 },
|
|
5238
5240
|
min: { images: 1, videos: 1 }
|
|
5239
5241
|
},
|
|
5240
5242
|
requires: ["references"],
|
|
@@ -5301,6 +5303,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5301
5303
|
references: { ...NO_REFERENCES, images: 4 },
|
|
5302
5304
|
requires: ["sourceVideo"],
|
|
5303
5305
|
sourceVideoSeconds: { min: 3, max: 15.05 },
|
|
5306
|
+
sourceVideoPixels: { minWidth: 720, minHeight: 720 },
|
|
5304
5307
|
// generateAudio keeps (true) or drops (false) the source soundtrack.
|
|
5305
5308
|
supports: ["generateAudio"],
|
|
5306
5309
|
prompt: KLING_PROMPT,
|
|
@@ -5341,7 +5344,8 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5341
5344
|
...NO_REFERENCES,
|
|
5342
5345
|
images: 10,
|
|
5343
5346
|
videos: 5,
|
|
5344
|
-
videoSeconds: { min: 3, max: 30.05, total: 30 }
|
|
5347
|
+
videoSeconds: { min: 3, max: 30.05, total: 30 },
|
|
5348
|
+
videoPixels: { minWidth: 700, minHeight: 700 }
|
|
5345
5349
|
},
|
|
5346
5350
|
supports: ["lastFrame"],
|
|
5347
5351
|
prompt: KLING_V4_PROMPT,
|
|
@@ -5375,6 +5379,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5375
5379
|
references: { ...NO_REFERENCES, images: 10 },
|
|
5376
5380
|
requires: ["sourceVideo"],
|
|
5377
5381
|
sourceVideoSeconds: { min: 3, max: 30.05 },
|
|
5382
|
+
sourceVideoPixels: { minWidth: 700, minHeight: 700 },
|
|
5378
5383
|
supports: [],
|
|
5379
5384
|
prompt: KLING_V4_PROMPT,
|
|
5380
5385
|
audio: KLING_V4_AUDIO
|
|
@@ -7919,6 +7924,10 @@ var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
|
|
|
7919
7924
|
total: import_zod3.z.number().optional(),
|
|
7920
7925
|
editMin: import_zod3.z.number().optional()
|
|
7921
7926
|
});
|
|
7927
|
+
var VideoPixelLimitsSchema = import_zod3.z.looseObject({
|
|
7928
|
+
minWidth: import_zod3.z.number().int().positive().optional(),
|
|
7929
|
+
minHeight: import_zod3.z.number().int().positive().optional()
|
|
7930
|
+
});
|
|
7922
7931
|
var ReferenceLimitsSchema = import_zod3.z.looseObject({
|
|
7923
7932
|
images: import_zod3.z.number().optional(),
|
|
7924
7933
|
imagesWithVideo: import_zod3.z.number().optional(),
|
|
@@ -7927,6 +7936,7 @@ var ReferenceLimitsSchema = import_zod3.z.looseObject({
|
|
|
7927
7936
|
total: import_zod3.z.number().optional(),
|
|
7928
7937
|
audioOnly: import_zod3.z.boolean().optional(),
|
|
7929
7938
|
videoSeconds: VideoSecondsLimitsSchema.optional(),
|
|
7939
|
+
videoPixels: VideoPixelLimitsSchema.optional(),
|
|
7930
7940
|
audioSeconds: import_zod3.z.looseObject({
|
|
7931
7941
|
min: import_zod3.z.number().optional(),
|
|
7932
7942
|
max: import_zod3.z.number().optional(),
|
|
@@ -8016,6 +8026,7 @@ var ModelConstraintsSchema = import_zod3.z.looseObject({
|
|
|
8016
8026
|
}).optional(),
|
|
8017
8027
|
languages: import_zod3.z.array(LanguageOptionSchema).optional(),
|
|
8018
8028
|
outputFormats: import_zod3.z.array(import_zod3.z.string().min(1)).min(1).optional(),
|
|
8029
|
+
sourceVideoPixels: VideoPixelLimitsSchema.optional(),
|
|
8019
8030
|
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: import_zod3.z.boolean().optional() }).optional(),
|
|
8020
8031
|
// segmentSeconds/maxTotalSeconds stay required: a kit before 0.3.0 drops a row whose
|
|
8021
8032
|
// extension lacks them, so every extension block keeps them.
|
|
@@ -17756,6 +17767,28 @@ function videoLengthViolation(model, input) {
|
|
|
17756
17767
|
return `${model.label} takes a source video of at least ${String(sourceMin)} s; this one is ${seconds2(source2, sourceMin)} s.`;
|
|
17757
17768
|
return void 0;
|
|
17758
17769
|
}
|
|
17770
|
+
function undersizedSide(frame, limits) {
|
|
17771
|
+
if (!frame || !limits) return void 0;
|
|
17772
|
+
const { width, height } = frame;
|
|
17773
|
+
if (limits.minWidth !== void 0 && width !== void 0 && width > 0 && width < limits.minWidth)
|
|
17774
|
+
return { side: "wide", min: limits.minWidth, actual: width };
|
|
17775
|
+
if (limits.minHeight !== void 0 && height !== void 0 && height > 0 && height < limits.minHeight)
|
|
17776
|
+
return { side: "tall", min: limits.minHeight, actual: height };
|
|
17777
|
+
return void 0;
|
|
17778
|
+
}
|
|
17779
|
+
function videoSizeViolation(model, input) {
|
|
17780
|
+
const refLimits = model.constraints.references?.videoPixels;
|
|
17781
|
+
const refs = input.referenceVideos ?? [];
|
|
17782
|
+
for (let i = 0; i < refs.length; i++) {
|
|
17783
|
+
const under2 = undersizedSide(refs[i], refLimits);
|
|
17784
|
+
if (under2)
|
|
17785
|
+
return `${model.label} takes reference videos at least ${String(under2.min)} px ${under2.side}; video ${i + 1} is ${String(under2.actual)} px.`;
|
|
17786
|
+
}
|
|
17787
|
+
const under = undersizedSide(input.sourceVideo, model.constraints.sourceVideoPixels);
|
|
17788
|
+
if (under)
|
|
17789
|
+
return `${model.label} takes a source video at least ${String(under.min)} px ${under.side}; this one is ${String(under.actual)} px.`;
|
|
17790
|
+
return void 0;
|
|
17791
|
+
}
|
|
17759
17792
|
function resolveImageOptions(model, request, onUnsupported = "error") {
|
|
17760
17793
|
const warnings = [];
|
|
17761
17794
|
const c = model.constraints;
|
|
@@ -19869,6 +19902,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
19869
19902
|
toGeneratedImage,
|
|
19870
19903
|
validateInputSpec,
|
|
19871
19904
|
videoLengthViolation,
|
|
19905
|
+
videoSizeViolation,
|
|
19872
19906
|
videoToolConstraints,
|
|
19873
19907
|
withRetry,
|
|
19874
19908
|
xaiVideoAdapter,
|