@shop-os/modelkit 0.31.0 → 0.33.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 +37 -0
- package/dist/catalog.cjs +80 -16
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +14 -0
- package/dist/catalog.d.ts +14 -0
- package/dist/catalog.js +80 -16
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +94 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +94 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,43 @@ header in the release PR.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.33.0] - Unreleased
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `claude-sonnet-5-5` (Claude Sonnet 5.5), a hidden text row (`exposure: []`) for server callers
|
|
16
|
+
such as vibe-api's Microdrama writer. Bedrock id derives as `<profile>.anthropic.claude-sonnet-5-5`.
|
|
17
|
+
- `providerOptions.modelkit.structuredOutputMode` on an Anthropic text row: on the Bedrock
|
|
18
|
+
transport, a JSON-schema call that sets no `providerOptions.anthropic.structuredOutputMode`
|
|
19
|
+
gets the row's value. `claude-sonnet-5-5` sets `"outputFormat"`: the Bedrock SDK otherwise
|
|
20
|
+
matches it as Sonnet 5, asks for JSON through a forced tool (`tool_choice: any`), and
|
|
21
|
+
Sonnet 5.5 rejects a forced tool choice with a 400.
|
|
22
|
+
|
|
23
|
+
## [0.32.0] - Unreleased
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- `constraints.maxSecondsByResolution` (`Partial<Record<VideoResolution, number>>`): the longest
|
|
27
|
+
output a video row renders at a resolution that is shorter than its `durations`. The resolver
|
|
28
|
+
enforces it for every row ("renders at most N s at 4K" under `"error"`; snaps to the cap with a
|
|
29
|
+
`duration_coerced` warning under `"coerce"`). The write schema needs whole seconds within the
|
|
30
|
+
row's `durations`. `kling-4.0` and `kling-4.0-edit` set `{ "4k": 15 }`. The Kling 4.0 rule keeps
|
|
31
|
+
15 s as its floor, so a row may lower the 4K cap but never lift it, and an edit at 4K still needs
|
|
32
|
+
a measured source. Kits before 0.32.0 ignore the field and keep their built-in 15 s.
|
|
33
|
+
- `constraints.preferDefaultDuration`: pickers pre-select the row's `defaults.durationSeconds`
|
|
34
|
+
over their own product default. Set on `wan-3.0`, `wan-3.0-prime`, `kling-4.0` and
|
|
35
|
+
`kling-4.0-flash`, so their 5 s default holds now that every second is listed.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- `wan-3.0`, `wan-3.0-prime`, `kling-4.0`, `kling-4.0-flash` and `gemini-omni-1.2-flash` drop
|
|
39
|
+
`durationPresets`: the providers take any whole second in the row's `durations` and bill per
|
|
40
|
+
second, so pickers list every second. `defaults.durationSeconds` is unchanged (5 s for Wan 3,
|
|
41
|
+
Wan 3 Prime, Kling 4.0 and Kling 4.0 Flash; Omni has none).
|
|
42
|
+
|
|
43
|
+
### Rollout
|
|
44
|
+
- pro-backend syncs `model_catalog` from its kit's `MODELS` on boot, so the live rows change once
|
|
45
|
+
pro-backend runs 0.32.0. Apps can take 0.32.0 in any order: the 4K floor holds whatever the live
|
|
46
|
+
row says. Until cowork runs 0.32.0 with its Studio change, a 0.31.0 cowork that reads re-synced
|
|
47
|
+
rows lists every second and defaults the four rows above to 8 s.
|
|
48
|
+
|
|
12
49
|
## [0.31.0] - Unreleased
|
|
13
50
|
|
|
14
51
|
### Added
|
package/dist/catalog.cjs
CHANGED
|
@@ -5239,6 +5239,22 @@ var TEXT_MODELS = [
|
|
|
5239
5239
|
contextWindow: 1e6
|
|
5240
5240
|
}
|
|
5241
5241
|
}),
|
|
5242
|
+
text("claude-sonnet-5-5", "Claude Sonnet 5.5", "claude-sonnet-5-5", {
|
|
5243
|
+
exposure: [],
|
|
5244
|
+
// Sonnet 5.5 rejects a forced tool_choice, which is how Bedrock's SDK asks for JSON on Sonnet 5.
|
|
5245
|
+
providerOptions: { modelkit: { structuredOutputMode: "outputFormat" } },
|
|
5246
|
+
display: {
|
|
5247
|
+
chat: { providerOptions: ANTHROPIC_ADAPTIVE },
|
|
5248
|
+
provider: "anthropic",
|
|
5249
|
+
costTier: 3,
|
|
5250
|
+
description: "Anthropic Claude Sonnet 5.5 balanced model; text and image input, 1M-token context."
|
|
5251
|
+
},
|
|
5252
|
+
capabilities: {
|
|
5253
|
+
reasoning: true,
|
|
5254
|
+
vision: true,
|
|
5255
|
+
contextWindow: 1e6
|
|
5256
|
+
}
|
|
5257
|
+
}),
|
|
5242
5258
|
text("claude-opus-4-8", "Claude Opus 4.8", "claude-opus-4-8", {
|
|
5243
5259
|
exposure: ["cowork", "space_builder"],
|
|
5244
5260
|
aliases: ["claude-opus-4.8", "claude-opus-4", "claude-opus-4.0", "claude-opus-4-20250514"],
|
|
@@ -5829,7 +5845,9 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5829
5845
|
aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
|
|
5830
5846
|
resolutions: ["720p", "1080p", "4k"],
|
|
5831
5847
|
durations: { min: 3, max: 30 },
|
|
5832
|
-
|
|
5848
|
+
preferDefaultDuration: true,
|
|
5849
|
+
// A 3 s 4K clip took 138 s on fal; 30 s could outlast the 15-minute result wait.
|
|
5850
|
+
maxSecondsByResolution: { "4k": 15 },
|
|
5833
5851
|
references: {
|
|
5834
5852
|
...NO_REFERENCES,
|
|
5835
5853
|
images: 10,
|
|
@@ -5868,6 +5886,8 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5868
5886
|
inputBilling: "kling-v4",
|
|
5869
5887
|
resolutions: ["720p", "1080p", "4k"],
|
|
5870
5888
|
durations: { min: 3, max: 30 },
|
|
5889
|
+
// A 3 s 4K clip took 138 s on fal; 30 s could outlast the 15-minute result wait.
|
|
5890
|
+
maxSecondsByResolution: { "4k": 15 },
|
|
5871
5891
|
references: { ...NO_REFERENCES, images: 10 },
|
|
5872
5892
|
requires: ["sourceVideo"],
|
|
5873
5893
|
sourceVideoSeconds: { min: 3, max: 30.05 },
|
|
@@ -5905,7 +5925,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5905
5925
|
aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
|
|
5906
5926
|
resolutions: ["720p"],
|
|
5907
5927
|
durations: { min: 3, max: 20 },
|
|
5908
|
-
|
|
5928
|
+
preferDefaultDuration: true,
|
|
5909
5929
|
references: {
|
|
5910
5930
|
...NO_REFERENCES,
|
|
5911
5931
|
images: 10,
|
|
@@ -6760,7 +6780,6 @@ var VIDEO_MODELS = [
|
|
|
6760
6780
|
aspectRatios: [...OMNI_RATIOS],
|
|
6761
6781
|
resolutions: ["360p", "720p", "1080p", "4k"],
|
|
6762
6782
|
durations: { min: 3, max: 15 },
|
|
6763
|
-
durationPresets: [3, 5, 8, 10, 15],
|
|
6764
6783
|
references: { images: 6, videos: 1, videoSeconds: { max: 10 } },
|
|
6765
6784
|
sourceVideoSeconds: { max: 15 },
|
|
6766
6785
|
supports: ["videoExtension", "lastFrame"],
|
|
@@ -7327,7 +7346,7 @@ var VIDEO_MODELS = [
|
|
|
7327
7346
|
aspectRatios: [...WAN_RATIOS],
|
|
7328
7347
|
resolutions: ["480p", "720p", "1080p"],
|
|
7329
7348
|
durations: { min: 2, max: 30 },
|
|
7330
|
-
|
|
7349
|
+
preferDefaultDuration: true,
|
|
7331
7350
|
references: {
|
|
7332
7351
|
images: 10,
|
|
7333
7352
|
videos: 5,
|
|
@@ -7369,7 +7388,7 @@ var VIDEO_MODELS = [
|
|
|
7369
7388
|
aspectRatios: [...WAN_RATIOS],
|
|
7370
7389
|
resolutions: ["480p", "720p", "1080p"],
|
|
7371
7390
|
durations: { min: 2, max: 30 },
|
|
7372
|
-
|
|
7391
|
+
preferDefaultDuration: true,
|
|
7373
7392
|
references: {
|
|
7374
7393
|
images: 10,
|
|
7375
7394
|
videos: 5,
|
|
@@ -8927,6 +8946,8 @@ var ModelConstraintsSchema = import_zod3.z.looseObject({
|
|
|
8927
8946
|
resolutions: import_zod3.z.array(VideoResolutionSchema).optional(),
|
|
8928
8947
|
durations: import_zod3.z.union([import_zod3.z.looseObject({ min: import_zod3.z.number(), max: import_zod3.z.number() }), import_zod3.z.array(import_zod3.z.number())]).optional(),
|
|
8929
8948
|
durationPresets: import_zod3.z.array(import_zod3.z.number()).optional(),
|
|
8949
|
+
maxSecondsByResolution: import_zod3.z.partialRecord(VideoResolutionSchema, import_zod3.z.number().positive()).optional(),
|
|
8950
|
+
preferDefaultDuration: import_zod3.z.boolean().optional(),
|
|
8930
8951
|
qualityOptions: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
8931
8952
|
scaleFactors: import_zod3.z.array(import_zod3.z.number().positive()).min(1).optional(),
|
|
8932
8953
|
exactSizes: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string()).optional(),
|
|
@@ -9153,6 +9174,19 @@ var CatalogModelSchema = CatalogModelSchemaBase.superRefine(
|
|
|
9153
9174
|
}
|
|
9154
9175
|
}
|
|
9155
9176
|
}
|
|
9177
|
+
const durations = row2.constraints.durations;
|
|
9178
|
+
for (const [resolution, max] of Object.entries(
|
|
9179
|
+
row2.constraints.maxSecondsByResolution ?? {}
|
|
9180
|
+
)) {
|
|
9181
|
+
const inRange = durations === void 0 || (Array.isArray(durations) ? durations.some((d) => d <= max) && max <= Math.max(...durations) : max >= durations.min && max <= durations.max);
|
|
9182
|
+
if (!Number.isInteger(max) || !inRange) {
|
|
9183
|
+
ctx.addIssue({
|
|
9184
|
+
code: "custom",
|
|
9185
|
+
path: ["constraints", "maxSecondsByResolution", resolution],
|
|
9186
|
+
message: "a resolution cap must be whole seconds within the row's durations"
|
|
9187
|
+
});
|
|
9188
|
+
}
|
|
9189
|
+
}
|
|
9156
9190
|
const audio = row2.constraints.audio;
|
|
9157
9191
|
if (audio !== void 0 && !AudioOutputSchema.safeParse(audio).success) {
|
|
9158
9192
|
ctx.addIssue({
|
|
@@ -10391,15 +10425,16 @@ function hasReferences(req) {
|
|
|
10391
10425
|
return count(req.referenceImages) + count(req.referenceVideos) > 0;
|
|
10392
10426
|
}
|
|
10393
10427
|
var KLING_V4_4K_MAX_SECONDS = 15;
|
|
10394
|
-
function klingV4FourK(seconds3, req) {
|
|
10428
|
+
function klingV4FourK(seconds3, req, model) {
|
|
10395
10429
|
if (req.resolution !== "4k") return void 0;
|
|
10430
|
+
const max = model.constraints.maxSecondsByResolution?.["4k"] ?? KLING_V4_4K_MAX_SECONDS;
|
|
10396
10431
|
if (seconds3 === void 0) {
|
|
10397
|
-
return missing(`needs a measured source video of up to ${
|
|
10432
|
+
return missing(`needs a measured source video of up to ${max} s at 4K`);
|
|
10398
10433
|
}
|
|
10399
|
-
return seconds3 >
|
|
10434
|
+
return seconds3 > max ? unsupported2(`renders at most ${max} s at 4K`) : void 0;
|
|
10400
10435
|
}
|
|
10401
|
-
function klingV4(req) {
|
|
10402
|
-
const fourK = klingV4FourK(req.durationSeconds ?? 5, req);
|
|
10436
|
+
function klingV4(req, model) {
|
|
10437
|
+
const fourK = klingV4FourK(req.durationSeconds ?? 5, req, model);
|
|
10403
10438
|
if (fourK !== void 0) return fourK;
|
|
10404
10439
|
if (hasReferences(req)) {
|
|
10405
10440
|
if (req.lastFrame !== void 0) {
|
|
@@ -10414,10 +10449,10 @@ function klingV4(req) {
|
|
|
10414
10449
|
}
|
|
10415
10450
|
return needsPrompt(req);
|
|
10416
10451
|
}
|
|
10417
|
-
function klingV4Flash(req) {
|
|
10452
|
+
function klingV4Flash(req, model) {
|
|
10418
10453
|
if (req.lastFrame !== void 0) return unsupported2("takes no end frame");
|
|
10419
10454
|
if (!hasReferences(req) && req.firstFrame !== void 0) return void 0;
|
|
10420
|
-
return klingV4(req);
|
|
10455
|
+
return klingV4(req, model);
|
|
10421
10456
|
}
|
|
10422
10457
|
function h3Turbo(req) {
|
|
10423
10458
|
if (count(req.referenceImages) + count(req.referenceVideos) > 0) {
|
|
@@ -10520,7 +10555,7 @@ var RULES = new Map([
|
|
|
10520
10555
|
[KLING_V4, klingV4],
|
|
10521
10556
|
[
|
|
10522
10557
|
KLING_V4_EDIT,
|
|
10523
|
-
(req) => needsSource(req) ?? klingV4FourK(req.durationSeconds ?? req.sourceVideo?.durationSeconds, req) ?? needsPrompt(req)
|
|
10558
|
+
(req, model) => needsSource(req) ?? klingV4FourK(req.durationSeconds ?? req.sourceVideo?.durationSeconds, req, model) ?? needsPrompt(req)
|
|
10524
10559
|
],
|
|
10525
10560
|
[KLING_V4_FLASH, klingV4Flash],
|
|
10526
10561
|
[KLING_V4_FLASH_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
|
|
@@ -10540,8 +10575,8 @@ var RULES = new Map([
|
|
|
10540
10575
|
[LTX25_T2V, ltx(null)],
|
|
10541
10576
|
[LTX25_FAST_T2V, ltx(["720p", "1080p"])]
|
|
10542
10577
|
]);
|
|
10543
|
-
function falVideoProblem(
|
|
10544
|
-
return RULES.get(providerModelId.toLowerCase())?.(req);
|
|
10578
|
+
function falVideoProblem(model, req) {
|
|
10579
|
+
return RULES.get(model.providerModelId.toLowerCase())?.(req, model);
|
|
10545
10580
|
}
|
|
10546
10581
|
function viduSilentWarning(model) {
|
|
10547
10582
|
return {
|
|
@@ -10572,7 +10607,7 @@ function fillKlingModeResolution(model, req) {
|
|
|
10572
10607
|
}
|
|
10573
10608
|
function applyFalVideoRules(model, req, callerRatio, warnings) {
|
|
10574
10609
|
if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
|
|
10575
|
-
const problem = falVideoProblem(model
|
|
10610
|
+
const problem = falVideoProblem(model, withPromptForResolve(req));
|
|
10576
10611
|
if (problem !== void 0) throw ruleRefusal(model, problem.message, problem.code);
|
|
10577
10612
|
const id = model.providerModelId.toLowerCase();
|
|
10578
10613
|
const references = count(req.referenceImages) + count(req.referenceAudios);
|
|
@@ -10713,6 +10748,27 @@ function resolveDuration(requested, durations, model, onUnsupported, warnings) {
|
|
|
10713
10748
|
});
|
|
10714
10749
|
return to;
|
|
10715
10750
|
}
|
|
10751
|
+
function capDurationAtResolution(seconds3, resolution, model, onUnsupported, warnings) {
|
|
10752
|
+
if (seconds3 === void 0 || resolution === void 0) return seconds3;
|
|
10753
|
+
const max = model.constraints.maxSecondsByResolution?.[resolution];
|
|
10754
|
+
if (max === void 0 || seconds3 <= max) return seconds3;
|
|
10755
|
+
const shown = resolution.endsWith("k") ? resolution.toUpperCase() : resolution;
|
|
10756
|
+
if (onUnsupported === "error") {
|
|
10757
|
+
throw new ModelKitError({
|
|
10758
|
+
code: "unsupported_option",
|
|
10759
|
+
message: `${model.id} renders at most ${max} s at ${shown}`,
|
|
10760
|
+
model: model.id
|
|
10761
|
+
});
|
|
10762
|
+
}
|
|
10763
|
+
warnings.push({
|
|
10764
|
+
code: "duration_coerced",
|
|
10765
|
+
field: "durationSeconds",
|
|
10766
|
+
from: seconds3,
|
|
10767
|
+
to: max,
|
|
10768
|
+
message: `duration ${seconds3}s coerced to ${max}s for ${model.id} at ${shown}`
|
|
10769
|
+
});
|
|
10770
|
+
return max;
|
|
10771
|
+
}
|
|
10716
10772
|
function resolveAspectRatio(requested, supported, model, onUnsupported, warnings) {
|
|
10717
10773
|
if (requested === void 0 || requested === "adaptive" || !supported) return requested;
|
|
10718
10774
|
if (supported.includes(requested)) return requested;
|
|
@@ -11032,6 +11088,14 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
|
|
|
11032
11088
|
warnings
|
|
11033
11089
|
);
|
|
11034
11090
|
if (duration !== void 0) merged.durationSeconds = duration;
|
|
11091
|
+
const capped = capDurationAtResolution(
|
|
11092
|
+
merged.durationSeconds,
|
|
11093
|
+
resolution,
|
|
11094
|
+
model,
|
|
11095
|
+
onUnsupported,
|
|
11096
|
+
warnings
|
|
11097
|
+
);
|
|
11098
|
+
if (capped !== void 0) merged.durationSeconds = capped;
|
|
11035
11099
|
const limits = c.references ?? {};
|
|
11036
11100
|
let images = trim(
|
|
11037
11101
|
"referenceImages",
|