@shop-os/modelkit 0.2.19 → 0.2.20
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 +14 -0
- package/dist/catalog.cjs +281 -161
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +25 -1
- package/dist/catalog.d.ts +25 -1
- package/dist/catalog.js +281 -161
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +380 -268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +380 -268
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.js
CHANGED
|
@@ -162,7 +162,9 @@ function geminiImage(id, label, aliases, sizes, display, exposure, references) {
|
|
|
162
162
|
const constraints = {
|
|
163
163
|
aspectRatios: [...GEMINI_RATIOS],
|
|
164
164
|
sizes,
|
|
165
|
-
supports: ["safetySettings", "temperature"]
|
|
165
|
+
supports: ["safetySettings", "temperature"],
|
|
166
|
+
// google-image sends MediaRef.label as a text part beside each reference.
|
|
167
|
+
prompt: { referenceSyntax: "caption" }
|
|
166
168
|
};
|
|
167
169
|
if (references !== void 0) constraints.references = references;
|
|
168
170
|
const model = {
|
|
@@ -449,6 +451,7 @@ var IMAGE_MODELS = [
|
|
|
449
451
|
constraints: {
|
|
450
452
|
aspectRatios: ["1:1", "2:3", "3:2", "16:9", "9:16", "4:3", "3:4", "4:5", "5:4", "21:9"],
|
|
451
453
|
sizes: ["1K"],
|
|
454
|
+
references: { images: 8 },
|
|
452
455
|
// flux-2-pro's job type always returns image/png; only the seed is forwarded.
|
|
453
456
|
supports: ["seed"]
|
|
454
457
|
},
|
|
@@ -1272,7 +1275,8 @@ var VIDEO_MODELS = [
|
|
|
1272
1275
|
resolutions: ["720p", "1080p", "4k"],
|
|
1273
1276
|
durations: [8],
|
|
1274
1277
|
references: { images: 3 },
|
|
1275
|
-
supports: ["lastFrame", "seed"]
|
|
1278
|
+
supports: ["lastFrame", "seed"],
|
|
1279
|
+
audio: "always"
|
|
1276
1280
|
},
|
|
1277
1281
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1278
1282
|
usage: { ...VIDEO_USAGE, slug: "veo" },
|
|
@@ -1302,7 +1306,8 @@ var VIDEO_MODELS = [
|
|
|
1302
1306
|
resolutions: ["720p", "1080p", "4k"],
|
|
1303
1307
|
durations: [4, 6, 8],
|
|
1304
1308
|
references: { images: 3 },
|
|
1305
|
-
supports: ["lastFrame", "seed"]
|
|
1309
|
+
supports: ["lastFrame", "seed"],
|
|
1310
|
+
audio: "always"
|
|
1306
1311
|
},
|
|
1307
1312
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1308
1313
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1330,7 +1335,8 @@ var VIDEO_MODELS = [
|
|
|
1330
1335
|
aspectRatios: [...OMNI_RATIOS],
|
|
1331
1336
|
resolutions: ["720p", "1080p"],
|
|
1332
1337
|
durations: [4, 6, 8],
|
|
1333
|
-
supports: ["lastFrame", "seed"]
|
|
1338
|
+
supports: ["lastFrame", "seed"],
|
|
1339
|
+
audio: "always"
|
|
1334
1340
|
},
|
|
1335
1341
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1336
1342
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1364,7 +1370,10 @@ var VIDEO_MODELS = [
|
|
|
1364
1370
|
durations: [3, 4, 5, 6, 7, 8, 9, 10],
|
|
1365
1371
|
references: { images: 6, videos: 1, videoSeconds: { max: 10 } },
|
|
1366
1372
|
sourceVideoSeconds: { max: 10 },
|
|
1367
|
-
supports: []
|
|
1373
|
+
supports: [],
|
|
1374
|
+
// generateOmniVideo sends MediaRef.label as a text part beside each image.
|
|
1375
|
+
prompt: { referenceSyntax: "caption" },
|
|
1376
|
+
audio: "always"
|
|
1368
1377
|
},
|
|
1369
1378
|
defaults: {},
|
|
1370
1379
|
usage: { ...VIDEO_USAGE, slug: "gemini_omni" },
|
|
@@ -1398,7 +1407,10 @@ var VIDEO_MODELS = [
|
|
|
1398
1407
|
// chain by `previousInteractionId` (the API rejects the id together
|
|
1399
1408
|
// with a video task, so those calls carry the prompt alone).
|
|
1400
1409
|
supports: ["videoExtension"],
|
|
1401
|
-
extension: { segmentSeconds: 10, maxTotalSeconds: 40 }
|
|
1410
|
+
extension: { segmentSeconds: 10, maxTotalSeconds: 40 },
|
|
1411
|
+
// generateOmniVideo sends MediaRef.label as a text part beside each image.
|
|
1412
|
+
prompt: { referenceSyntax: "caption" },
|
|
1413
|
+
audio: "always"
|
|
1402
1414
|
},
|
|
1403
1415
|
defaults: {},
|
|
1404
1416
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1434,7 +1446,8 @@ var VIDEO_MODELS = [
|
|
|
1434
1446
|
},
|
|
1435
1447
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
1436
1448
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1437
|
-
supports: ["generateAudio", "seed", "lastFrame", "watermark"]
|
|
1449
|
+
supports: ["generateAudio", "seed", "lastFrame", "watermark"],
|
|
1450
|
+
audio: "optional"
|
|
1438
1451
|
},
|
|
1439
1452
|
defaults: {
|
|
1440
1453
|
durationSeconds: 5,
|
|
@@ -1473,7 +1486,8 @@ var VIDEO_MODELS = [
|
|
|
1473
1486
|
},
|
|
1474
1487
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
1475
1488
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1476
|
-
supports: ["generateAudio", "seed", "lastFrame", "watermark"]
|
|
1489
|
+
supports: ["generateAudio", "seed", "lastFrame", "watermark"],
|
|
1490
|
+
audio: "optional"
|
|
1477
1491
|
},
|
|
1478
1492
|
defaults: {
|
|
1479
1493
|
durationSeconds: 5,
|
|
@@ -1513,7 +1527,8 @@ var VIDEO_MODELS = [
|
|
|
1513
1527
|
},
|
|
1514
1528
|
sourceVideoSeconds: { min: 2, max: 30, editMin: 4, inReferenceTotal: true },
|
|
1515
1529
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1516
|
-
supports: ["generateAudio", "seed", "lastFrame", "watermark", "taskType"]
|
|
1530
|
+
supports: ["generateAudio", "seed", "lastFrame", "watermark", "taskType"],
|
|
1531
|
+
audio: "optional"
|
|
1517
1532
|
},
|
|
1518
1533
|
defaults: {
|
|
1519
1534
|
durationSeconds: 5,
|
|
@@ -1546,7 +1561,9 @@ var VIDEO_MODELS = [
|
|
|
1546
1561
|
durations: { min: 1, max: 15 },
|
|
1547
1562
|
durationPresets: [4, 6, 8, 10],
|
|
1548
1563
|
references: { images: 5 },
|
|
1549
|
-
supports: []
|
|
1564
|
+
supports: [],
|
|
1565
|
+
// xAI can switch sound off (generate_audio); xai-video.ts never sends it.
|
|
1566
|
+
audio: "always"
|
|
1550
1567
|
},
|
|
1551
1568
|
// No resolution default: xAI picks its own unless the caller asks.
|
|
1552
1569
|
defaults: { durationSeconds: 8, aspectRatio: "16:9" },
|
|
@@ -1572,7 +1589,8 @@ var VIDEO_MODELS = [
|
|
|
1572
1589
|
aspectRatios: [...KLING_RATIOS],
|
|
1573
1590
|
durations: [5, 10],
|
|
1574
1591
|
requires: ["firstFrame"],
|
|
1575
|
-
supports: ["cfgScale", "negativePrompt", "lastFrame"]
|
|
1592
|
+
supports: ["cfgScale", "negativePrompt", "lastFrame"],
|
|
1593
|
+
audio: "never"
|
|
1576
1594
|
},
|
|
1577
1595
|
defaults: {
|
|
1578
1596
|
durationSeconds: 5,
|
|
@@ -1603,7 +1621,9 @@ var VIDEO_MODELS = [
|
|
|
1603
1621
|
aspectRatios: [...KLING_RATIOS],
|
|
1604
1622
|
durations: { min: 3, max: 15 },
|
|
1605
1623
|
requires: ["firstFrame"],
|
|
1606
|
-
supports: ["cfgScale", "negativePrompt", "lastFrame"]
|
|
1624
|
+
supports: ["cfgScale", "negativePrompt", "lastFrame"],
|
|
1625
|
+
// Higgsfield has a `sound` switch (default on); KlingCreate doesn't send it.
|
|
1626
|
+
audio: "always"
|
|
1607
1627
|
},
|
|
1608
1628
|
defaults: {
|
|
1609
1629
|
durationSeconds: 5,
|
|
@@ -1638,7 +1658,8 @@ var VIDEO_MODELS = [
|
|
|
1638
1658
|
resolutions: ["720p", "1080p"],
|
|
1639
1659
|
durations: { min: 3, max: 15 },
|
|
1640
1660
|
references: { images: 7, imagesWithVideo: 4 },
|
|
1641
|
-
supports: ["generateAudio", "lastFrame"]
|
|
1661
|
+
supports: ["generateAudio", "lastFrame"],
|
|
1662
|
+
audio: "optional"
|
|
1642
1663
|
},
|
|
1643
1664
|
defaults: { durationSeconds: 5, aspectRatio: "16:9", generateAudio: false, mode: "pro" },
|
|
1644
1665
|
usage: { unit: "compute_seconds" },
|
|
@@ -1663,7 +1684,8 @@ var VIDEO_MODELS = [
|
|
|
1663
1684
|
aspectRatios: [...H3_RATIOS],
|
|
1664
1685
|
resolutions: ["480p", "768p", "2k", "4k"],
|
|
1665
1686
|
durations: { min: 5, max: 15 },
|
|
1666
|
-
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"]
|
|
1687
|
+
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
|
|
1688
|
+
audio: "always"
|
|
1667
1689
|
},
|
|
1668
1690
|
defaults: {
|
|
1669
1691
|
durationSeconds: 5,
|
|
@@ -1693,7 +1715,8 @@ var VIDEO_MODELS = [
|
|
|
1693
1715
|
aspectRatios: [...H3_RATIOS],
|
|
1694
1716
|
resolutions: ["480p", "768p"],
|
|
1695
1717
|
durations: { min: 5, max: 15 },
|
|
1696
|
-
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"]
|
|
1718
|
+
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
|
|
1719
|
+
audio: "always"
|
|
1697
1720
|
},
|
|
1698
1721
|
defaults: {
|
|
1699
1722
|
durationSeconds: 5,
|
|
@@ -1731,7 +1754,8 @@ var VIDEO_MODELS = [
|
|
|
1731
1754
|
audioOnly: false,
|
|
1732
1755
|
videoSeconds: { min: 2, max: 15, total: 15 }
|
|
1733
1756
|
},
|
|
1734
|
-
supports: ["seed", "promptExpansion", "safetyChecker"]
|
|
1757
|
+
supports: ["seed", "promptExpansion", "safetyChecker"],
|
|
1758
|
+
audio: "always"
|
|
1735
1759
|
},
|
|
1736
1760
|
defaults: {
|
|
1737
1761
|
durationSeconds: 5,
|
|
@@ -1746,7 +1770,9 @@ var VIDEO_MODELS = [
|
|
|
1746
1770
|
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
|
|
1747
1771
|
description: "MiniMax H3 reference-to-video mode guided by up to 9 reference images, 3 reference videos, and 3 audio clips; reference and image-to-video inputs cannot be mixed."
|
|
1748
1772
|
},
|
|
1749
|
-
|
|
1773
|
+
// fal's reference-to-video endpoint never reads a frame; the resolver must drop the
|
|
1774
|
+
// references instead of the adapter silently dropping the frame.
|
|
1775
|
+
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1750
1776
|
},
|
|
1751
1777
|
{
|
|
1752
1778
|
id: "minimax-h3-max-reference",
|
|
@@ -1769,7 +1795,8 @@ var VIDEO_MODELS = [
|
|
|
1769
1795
|
audioOnly: false,
|
|
1770
1796
|
videoSeconds: { min: 2, max: 15, total: 15 }
|
|
1771
1797
|
},
|
|
1772
|
-
supports: ["seed", "promptExpansion", "safetyChecker"]
|
|
1798
|
+
supports: ["seed", "promptExpansion", "safetyChecker"],
|
|
1799
|
+
audio: "always"
|
|
1773
1800
|
},
|
|
1774
1801
|
defaults: {
|
|
1775
1802
|
durationSeconds: 5,
|
|
@@ -1784,7 +1811,9 @@ var VIDEO_MODELS = [
|
|
|
1784
1811
|
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
|
|
1785
1812
|
description: "MiniMax H3 Max reference-to-video on fal; conditions on reference images, videos, and audio. MiniMax's own docs do not list a reference mode for H3 Max."
|
|
1786
1813
|
},
|
|
1787
|
-
|
|
1814
|
+
// fal's reference-to-video endpoint never reads a frame; the resolver must drop the
|
|
1815
|
+
// references instead of the adapter silently dropping the frame.
|
|
1816
|
+
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1788
1817
|
},
|
|
1789
1818
|
{
|
|
1790
1819
|
// Duration 3-10s per trigger-workflows mapDuration; the endpoint takes no resolution.
|
|
@@ -1801,7 +1830,8 @@ var VIDEO_MODELS = [
|
|
|
1801
1830
|
durations: { min: 3, max: 10 },
|
|
1802
1831
|
requires: ["sourceVideo"],
|
|
1803
1832
|
sourceVideoSeconds: { min: 3, max: 10.05 },
|
|
1804
|
-
supports: []
|
|
1833
|
+
supports: [],
|
|
1834
|
+
audio: "never"
|
|
1805
1835
|
},
|
|
1806
1836
|
defaults: { durationSeconds: 5, aspectRatio: "16:9" },
|
|
1807
1837
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1825,7 +1855,8 @@ var VIDEO_MODELS = [
|
|
|
1825
1855
|
constraints: {
|
|
1826
1856
|
resolutions: ["768p"],
|
|
1827
1857
|
durations: [6, 10],
|
|
1828
|
-
supports: ["lastFrame"]
|
|
1858
|
+
supports: ["lastFrame"],
|
|
1859
|
+
audio: "never"
|
|
1829
1860
|
},
|
|
1830
1861
|
defaults: { durationSeconds: 6, resolution: "768p" },
|
|
1831
1862
|
usage: { unit: "compute_seconds" },
|
|
@@ -1848,7 +1879,8 @@ var VIDEO_MODELS = [
|
|
|
1848
1879
|
exposure: [],
|
|
1849
1880
|
constraints: {
|
|
1850
1881
|
requires: ["firstFrame"],
|
|
1851
|
-
supports: ["seed", "lastFrame"]
|
|
1882
|
+
supports: ["seed", "lastFrame"],
|
|
1883
|
+
audio: "never"
|
|
1852
1884
|
},
|
|
1853
1885
|
defaults: {},
|
|
1854
1886
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1870,7 +1902,7 @@ var MODELS = [
|
|
|
1870
1902
|
];
|
|
1871
1903
|
|
|
1872
1904
|
// src/catalog/schema.ts
|
|
1873
|
-
import { z as
|
|
1905
|
+
import { z as z3 } from "zod";
|
|
1874
1906
|
|
|
1875
1907
|
// src/catalog/collisions.ts
|
|
1876
1908
|
function collisionIssues(rows) {
|
|
@@ -1917,8 +1949,61 @@ function collisionIssues(rows) {
|
|
|
1917
1949
|
return issues;
|
|
1918
1950
|
}
|
|
1919
1951
|
|
|
1920
|
-
// src/catalog/
|
|
1952
|
+
// src/catalog/conventions.ts
|
|
1921
1953
|
import { z } from "zod";
|
|
1954
|
+
var AudioOutputSchema = z.enum(["always", "optional", "never"]);
|
|
1955
|
+
var ReferenceSyntaxSchema = z.enum(["numbered", "caption", "descriptive"]);
|
|
1956
|
+
var MaxCharsSchema = z.number().int().positive();
|
|
1957
|
+
var PromptConventionsSchema = z.strictObject({
|
|
1958
|
+
referenceSyntax: ReferenceSyntaxSchema,
|
|
1959
|
+
maxChars: MaxCharsSchema.optional()
|
|
1960
|
+
});
|
|
1961
|
+
var AUDIO_OUTPUTS = AudioOutputSchema.options;
|
|
1962
|
+
var REFERENCE_SYNTAXES = ReferenceSyntaxSchema.options;
|
|
1963
|
+
var ConstraintsReadView = z.looseObject({
|
|
1964
|
+
audio: AudioOutputSchema.optional().catch(void 0),
|
|
1965
|
+
prompt: z.looseObject({
|
|
1966
|
+
referenceSyntax: ReferenceSyntaxSchema.catch("numbered"),
|
|
1967
|
+
maxChars: MaxCharsSchema.optional().catch(void 0)
|
|
1968
|
+
}).optional().catch(void 0)
|
|
1969
|
+
});
|
|
1970
|
+
var DEFAULT_CONVENTIONS = { referenceSyntax: "numbered" };
|
|
1971
|
+
function outputAudio(row) {
|
|
1972
|
+
const view = ConstraintsReadView.safeParse(row.constraints);
|
|
1973
|
+
return view.success ? view.data.audio : void 0;
|
|
1974
|
+
}
|
|
1975
|
+
function promptConventions(row) {
|
|
1976
|
+
const view = ConstraintsReadView.safeParse(row.constraints);
|
|
1977
|
+
const prompt = view.success ? view.data.prompt : void 0;
|
|
1978
|
+
if (prompt === void 0) return { ...DEFAULT_CONVENTIONS };
|
|
1979
|
+
const result = { referenceSyntax: prompt.referenceSyntax };
|
|
1980
|
+
if (prompt.maxChars !== void 0) result.maxChars = prompt.maxChars;
|
|
1981
|
+
return result;
|
|
1982
|
+
}
|
|
1983
|
+
var RawConventionsView = z.looseObject({
|
|
1984
|
+
audio: z.unknown().optional(),
|
|
1985
|
+
prompt: z.unknown().optional()
|
|
1986
|
+
});
|
|
1987
|
+
function normaliseConventions(row) {
|
|
1988
|
+
const view = RawConventionsView.safeParse(row.constraints);
|
|
1989
|
+
if (!view.success) return { row, invalidKeys: [] };
|
|
1990
|
+
const { audio, prompt } = view.data;
|
|
1991
|
+
const badAudio = audio !== void 0 && !AudioOutputSchema.safeParse(audio).success;
|
|
1992
|
+
const badPrompt = prompt !== void 0 && !PromptConventionsSchema.safeParse(prompt).success;
|
|
1993
|
+
if (!badAudio && !badPrompt) return { row, invalidKeys: [] };
|
|
1994
|
+
const invalidKeys = [];
|
|
1995
|
+
if (badAudio) invalidKeys.push("constraints.audio");
|
|
1996
|
+
if (badPrompt) invalidKeys.push("constraints.prompt");
|
|
1997
|
+
const entries = Object.entries(row.constraints).flatMap(([key, value]) => {
|
|
1998
|
+
if (key === "audio" && badAudio) return [];
|
|
1999
|
+
if (key === "prompt" && badPrompt) return [[key, promptConventions(row)]];
|
|
2000
|
+
return [[key, value]];
|
|
2001
|
+
});
|
|
2002
|
+
return { row: { ...row, constraints: Object.fromEntries(entries) }, invalidKeys };
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
// src/catalog/input-spec.ts
|
|
2006
|
+
import { z as z2 } from "zod";
|
|
1922
2007
|
var VIDEO_INPUT_SPEC_KEYS = [
|
|
1923
2008
|
"prompt",
|
|
1924
2009
|
"durationSeconds",
|
|
@@ -1957,8 +2042,8 @@ var ALL_KEY_SET = /* @__PURE__ */ new Set([
|
|
|
1957
2042
|
...VIDEO_INPUT_SPEC_KEYS,
|
|
1958
2043
|
...AUDIO_INPUT_SPEC_KEYS
|
|
1959
2044
|
]);
|
|
1960
|
-
var ProviderScalarSchema =
|
|
1961
|
-
var FieldsSchema =
|
|
2045
|
+
var ProviderScalarSchema = z2.union([z2.string(), z2.number(), z2.boolean()]);
|
|
2046
|
+
var FieldsSchema = z2.record(z2.string(), z2.string().min(1)).superRefine((fields, ctx) => {
|
|
1962
2047
|
const keys = Object.keys(fields);
|
|
1963
2048
|
if (keys.length === 0) {
|
|
1964
2049
|
ctx.addIssue({
|
|
@@ -1976,7 +2061,7 @@ var FieldsSchema = z.record(z.string(), z.string().min(1)).superRefine((fields,
|
|
|
1976
2061
|
}
|
|
1977
2062
|
}
|
|
1978
2063
|
});
|
|
1979
|
-
var ValuesSchema =
|
|
2064
|
+
var ValuesSchema = z2.record(z2.string(), z2.record(z2.string(), ProviderScalarSchema)).superRefine((values, ctx) => {
|
|
1980
2065
|
for (const key of Object.keys(values)) {
|
|
1981
2066
|
if (!ALL_KEY_SET.has(key)) {
|
|
1982
2067
|
ctx.addIssue({
|
|
@@ -1986,8 +2071,8 @@ var ValuesSchema = z.record(z.string(), z.record(z.string(), ProviderScalarSchem
|
|
|
1986
2071
|
}
|
|
1987
2072
|
}
|
|
1988
2073
|
});
|
|
1989
|
-
var StaticSchema =
|
|
1990
|
-
var InputSpecSchema =
|
|
2074
|
+
var StaticSchema = z2.record(z2.string(), ProviderScalarSchema);
|
|
2075
|
+
var InputSpecSchema = z2.strictObject({
|
|
1991
2076
|
fields: FieldsSchema,
|
|
1992
2077
|
values: ValuesSchema.optional(),
|
|
1993
2078
|
static: StaticSchema.optional()
|
|
@@ -2091,16 +2176,16 @@ var ADAPTER_IDS = [
|
|
|
2091
2176
|
"higgsfield",
|
|
2092
2177
|
"xai-video"
|
|
2093
2178
|
];
|
|
2094
|
-
var ModelTypeSchema =
|
|
2095
|
-
var LifecycleSchema =
|
|
2096
|
-
var SurfaceSchema =
|
|
2179
|
+
var ModelTypeSchema = z3.enum(["text", "image", "video", "audio", "upscale", "bg-remove"]);
|
|
2180
|
+
var LifecycleSchema = z3.enum(["active", "deprecated", "retired"]);
|
|
2181
|
+
var SurfaceSchema = z3.enum(["cowork", "space_builder"]);
|
|
2097
2182
|
var SURFACES2 = SurfaceSchema.options;
|
|
2098
|
-
var ExposureSchema =
|
|
2183
|
+
var ExposureSchema = z3.preprocess(
|
|
2099
2184
|
normalizeExposure,
|
|
2100
|
-
|
|
2185
|
+
z3.array(SurfaceSchema)
|
|
2101
2186
|
);
|
|
2102
|
-
var AdapterSchema =
|
|
2103
|
-
var AspectRatioSchema =
|
|
2187
|
+
var AdapterSchema = z3.enum(ADAPTER_IDS);
|
|
2188
|
+
var AspectRatioSchema = z3.enum([
|
|
2104
2189
|
"1:1",
|
|
2105
2190
|
"16:9",
|
|
2106
2191
|
"9:16",
|
|
@@ -2115,12 +2200,12 @@ var AspectRatioSchema = z2.enum([
|
|
|
2115
2200
|
"97:30",
|
|
2116
2201
|
"adaptive"
|
|
2117
2202
|
]);
|
|
2118
|
-
var ImageSizeSchema =
|
|
2119
|
-
var VideoResolutionSchema =
|
|
2120
|
-
var ImageQualitySchema =
|
|
2121
|
-
var OutputFormatSchema =
|
|
2122
|
-
var RequiredInputSchema =
|
|
2123
|
-
var SupportedOptionSchema =
|
|
2203
|
+
var ImageSizeSchema = z3.enum(["512", "1K", "2K", "4K"]);
|
|
2204
|
+
var VideoResolutionSchema = z3.enum(["360p", "480p", "720p", "768p", "1080p", "2k", "4k"]);
|
|
2205
|
+
var ImageQualitySchema = z3.enum(["auto", "low", "medium", "high", "xhigh", "max"]);
|
|
2206
|
+
var OutputFormatSchema = z3.enum(["png", "jpeg", "webp"]);
|
|
2207
|
+
var RequiredInputSchema = z3.enum(["firstFrame", "sourceVideo", "references"]);
|
|
2208
|
+
var SupportedOptionSchema = z3.enum([
|
|
2124
2209
|
"seed",
|
|
2125
2210
|
"quality",
|
|
2126
2211
|
"negativePrompt",
|
|
@@ -2140,142 +2225,146 @@ var SupportedOptionSchema = z2.enum([
|
|
|
2140
2225
|
"videoExtension",
|
|
2141
2226
|
"instrumental"
|
|
2142
2227
|
]);
|
|
2143
|
-
var UsageUnitSchema =
|
|
2228
|
+
var UsageUnitSchema = z3.enum([
|
|
2144
2229
|
"tokens",
|
|
2145
2230
|
"images",
|
|
2146
2231
|
"seconds",
|
|
2147
2232
|
"reported_cost_usd",
|
|
2148
2233
|
"compute_seconds"
|
|
2149
2234
|
]);
|
|
2150
|
-
var PricingKindSchema =
|
|
2151
|
-
var ProviderOptionValueSchema =
|
|
2152
|
-
() =>
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2235
|
+
var PricingKindSchema = z3.enum(["token", "image_size", "video_per_second", "flat"]);
|
|
2236
|
+
var ProviderOptionValueSchema = z3.lazy(
|
|
2237
|
+
() => z3.union([
|
|
2238
|
+
z3.string(),
|
|
2239
|
+
z3.number(),
|
|
2240
|
+
z3.boolean(),
|
|
2241
|
+
z3.array(ProviderOptionValueSchema),
|
|
2242
|
+
z3.record(z3.string(), ProviderOptionValueSchema)
|
|
2158
2243
|
])
|
|
2159
2244
|
);
|
|
2160
|
-
var ProviderOptionsSchema =
|
|
2161
|
-
var VideoSecondsLimitsSchema =
|
|
2162
|
-
min:
|
|
2163
|
-
max:
|
|
2164
|
-
total:
|
|
2165
|
-
editMin:
|
|
2245
|
+
var ProviderOptionsSchema = z3.record(z3.string(), z3.record(z3.string(), ProviderOptionValueSchema));
|
|
2246
|
+
var VideoSecondsLimitsSchema = z3.looseObject({
|
|
2247
|
+
min: z3.number().optional(),
|
|
2248
|
+
max: z3.number().optional(),
|
|
2249
|
+
total: z3.number().optional(),
|
|
2250
|
+
editMin: z3.number().optional()
|
|
2166
2251
|
});
|
|
2167
|
-
var ReferenceLimitsSchema =
|
|
2168
|
-
images:
|
|
2169
|
-
imagesWithVideo:
|
|
2170
|
-
videos:
|
|
2171
|
-
audios:
|
|
2172
|
-
total:
|
|
2173
|
-
audioOnly:
|
|
2252
|
+
var ReferenceLimitsSchema = z3.looseObject({
|
|
2253
|
+
images: z3.number().optional(),
|
|
2254
|
+
imagesWithVideo: z3.number().optional(),
|
|
2255
|
+
videos: z3.number().optional(),
|
|
2256
|
+
audios: z3.number().optional(),
|
|
2257
|
+
total: z3.number().optional(),
|
|
2258
|
+
audioOnly: z3.boolean().optional(),
|
|
2174
2259
|
videoSeconds: VideoSecondsLimitsSchema.optional()
|
|
2175
2260
|
});
|
|
2176
|
-
var ModelConstraintsSchema =
|
|
2177
|
-
aspectRatios:
|
|
2178
|
-
sizes:
|
|
2179
|
-
resolutions:
|
|
2180
|
-
durations:
|
|
2181
|
-
durationPresets:
|
|
2182
|
-
qualityOptions:
|
|
2183
|
-
exactSizes:
|
|
2261
|
+
var ModelConstraintsSchema = z3.looseObject({
|
|
2262
|
+
aspectRatios: z3.array(AspectRatioSchema).optional(),
|
|
2263
|
+
sizes: z3.array(ImageSizeSchema).optional(),
|
|
2264
|
+
resolutions: z3.array(VideoResolutionSchema).optional(),
|
|
2265
|
+
durations: z3.union([z3.looseObject({ min: z3.number(), max: z3.number() }), z3.array(z3.number())]).optional(),
|
|
2266
|
+
durationPresets: z3.array(z3.number()).optional(),
|
|
2267
|
+
qualityOptions: z3.array(z3.string()).optional(),
|
|
2268
|
+
exactSizes: z3.record(z3.string(), z3.string()).optional(),
|
|
2184
2269
|
references: ReferenceLimitsSchema.optional(),
|
|
2185
|
-
requires:
|
|
2186
|
-
supports:
|
|
2187
|
-
ratioIgnoredWith:
|
|
2188
|
-
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal:
|
|
2189
|
-
extension:
|
|
2270
|
+
requires: z3.array(RequiredInputSchema).optional(),
|
|
2271
|
+
supports: z3.array(SupportedOptionSchema).optional(),
|
|
2272
|
+
ratioIgnoredWith: z3.array(z3.enum(["firstFrame", "sourceVideo"])).optional(),
|
|
2273
|
+
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: z3.boolean().optional() }).optional(),
|
|
2274
|
+
extension: z3.looseObject({ segmentSeconds: z3.number(), maxTotalSeconds: z3.number() }).optional(),
|
|
2275
|
+
// Loose on purpose: the read path keeps a row whose value is invalid (the accessors in
|
|
2276
|
+
// conventions.ts read it as "not set"); CatalogModelSchema below rejects it on write.
|
|
2277
|
+
audio: z3.unknown().optional(),
|
|
2278
|
+
prompt: z3.unknown().optional()
|
|
2190
2279
|
});
|
|
2191
|
-
var MediaRefSchema =
|
|
2192
|
-
|
|
2193
|
-
url:
|
|
2194
|
-
label:
|
|
2195
|
-
durationSeconds:
|
|
2280
|
+
var MediaRefSchema = z3.union([
|
|
2281
|
+
z3.looseObject({
|
|
2282
|
+
url: z3.string(),
|
|
2283
|
+
label: z3.string().optional(),
|
|
2284
|
+
durationSeconds: z3.number().optional()
|
|
2196
2285
|
}),
|
|
2197
|
-
|
|
2198
|
-
bytes:
|
|
2199
|
-
mime:
|
|
2200
|
-
label:
|
|
2201
|
-
durationSeconds:
|
|
2286
|
+
z3.looseObject({
|
|
2287
|
+
bytes: z3.instanceof(Uint8Array),
|
|
2288
|
+
mime: z3.string(),
|
|
2289
|
+
label: z3.string().optional(),
|
|
2290
|
+
durationSeconds: z3.number().optional()
|
|
2202
2291
|
})
|
|
2203
2292
|
]);
|
|
2204
|
-
var ImageSafetySettingSchema =
|
|
2205
|
-
var UpscaleOptionsSchema =
|
|
2206
|
-
enhanceModel:
|
|
2207
|
-
subjectDetection:
|
|
2208
|
-
faceEnhancement:
|
|
2209
|
-
faceEnhancementCreativity:
|
|
2210
|
-
faceEnhancementStrength:
|
|
2293
|
+
var ImageSafetySettingSchema = z3.looseObject({ category: z3.string(), threshold: z3.string() });
|
|
2294
|
+
var UpscaleOptionsSchema = z3.looseObject({
|
|
2295
|
+
enhanceModel: z3.string().optional(),
|
|
2296
|
+
subjectDetection: z3.string().optional(),
|
|
2297
|
+
faceEnhancement: z3.boolean().optional(),
|
|
2298
|
+
faceEnhancementCreativity: z3.number().optional(),
|
|
2299
|
+
faceEnhancementStrength: z3.number().optional()
|
|
2211
2300
|
});
|
|
2212
|
-
var DefaultsSchema =
|
|
2213
|
-
references:
|
|
2301
|
+
var DefaultsSchema = z3.looseObject({
|
|
2302
|
+
references: z3.array(MediaRefSchema).optional(),
|
|
2214
2303
|
aspectRatio: AspectRatioSchema.optional(),
|
|
2215
2304
|
size: ImageSizeSchema.optional(),
|
|
2216
|
-
exactSize:
|
|
2305
|
+
exactSize: z3.string().optional(),
|
|
2217
2306
|
quality: ImageQualitySchema.optional(),
|
|
2218
|
-
seed:
|
|
2219
|
-
count:
|
|
2307
|
+
seed: z3.number().optional(),
|
|
2308
|
+
count: z3.number().optional(),
|
|
2220
2309
|
outputFormat: OutputFormatSchema.optional(),
|
|
2221
|
-
scaleFactor:
|
|
2222
|
-
safetySettings:
|
|
2223
|
-
temperature:
|
|
2310
|
+
scaleFactor: z3.number().optional(),
|
|
2311
|
+
safetySettings: z3.array(ImageSafetySettingSchema).optional(),
|
|
2312
|
+
temperature: z3.number().optional(),
|
|
2224
2313
|
upscale: UpscaleOptionsSchema.optional(),
|
|
2225
2314
|
firstFrame: MediaRefSchema.optional(),
|
|
2226
2315
|
lastFrame: MediaRefSchema.optional(),
|
|
2227
2316
|
sourceVideo: MediaRefSchema.optional(),
|
|
2228
|
-
referenceImages:
|
|
2229
|
-
referenceVideos:
|
|
2230
|
-
referenceAudios:
|
|
2317
|
+
referenceImages: z3.array(MediaRefSchema).optional(),
|
|
2318
|
+
referenceVideos: z3.array(MediaRefSchema).optional(),
|
|
2319
|
+
referenceAudios: z3.array(MediaRefSchema).optional(),
|
|
2231
2320
|
resolution: VideoResolutionSchema.optional(),
|
|
2232
|
-
durationSeconds:
|
|
2233
|
-
generateAudio:
|
|
2234
|
-
negativePrompt:
|
|
2235
|
-
cfgScale:
|
|
2236
|
-
promptExpansion:
|
|
2237
|
-
watermark:
|
|
2238
|
-
safetyChecker:
|
|
2239
|
-
taskType:
|
|
2240
|
-
mode:
|
|
2241
|
-
instrumental:
|
|
2321
|
+
durationSeconds: z3.number().optional(),
|
|
2322
|
+
generateAudio: z3.boolean().optional(),
|
|
2323
|
+
negativePrompt: z3.string().optional(),
|
|
2324
|
+
cfgScale: z3.number().optional(),
|
|
2325
|
+
promptExpansion: z3.enum(["fast", "balanced", "quality"]).optional(),
|
|
2326
|
+
watermark: z3.boolean().optional(),
|
|
2327
|
+
safetyChecker: z3.boolean().optional(),
|
|
2328
|
+
taskType: z3.enum(["reference", "edit", "extend"]).optional(),
|
|
2329
|
+
mode: z3.enum(["standard", "pro"]).optional(),
|
|
2330
|
+
instrumental: z3.boolean().optional()
|
|
2242
2331
|
});
|
|
2243
|
-
var CatalogDisplaySchema =
|
|
2244
|
-
provider:
|
|
2245
|
-
description:
|
|
2246
|
-
logo:
|
|
2247
|
-
costTier:
|
|
2248
|
-
recommended:
|
|
2249
|
-
sortOrder:
|
|
2250
|
-
chat:
|
|
2332
|
+
var CatalogDisplaySchema = z3.looseObject({
|
|
2333
|
+
provider: z3.string(),
|
|
2334
|
+
description: z3.string(),
|
|
2335
|
+
logo: z3.string().optional(),
|
|
2336
|
+
costTier: z3.union([z3.literal(1), z3.literal(2), z3.literal(3)]).optional(),
|
|
2337
|
+
recommended: z3.boolean().optional(),
|
|
2338
|
+
sortOrder: z3.number().optional(),
|
|
2339
|
+
chat: z3.looseObject({
|
|
2251
2340
|
providerOptions: ProviderOptionsSchema.optional(),
|
|
2252
|
-
temperature:
|
|
2341
|
+
temperature: z3.number().optional()
|
|
2253
2342
|
}).optional()
|
|
2254
2343
|
});
|
|
2255
|
-
var CatalogCapabilitiesSchema =
|
|
2256
|
-
acceptsSourceVideo:
|
|
2257
|
-
framesExcludeReferences:
|
|
2258
|
-
reasoning:
|
|
2259
|
-
vision:
|
|
2260
|
-
contextWindow:
|
|
2344
|
+
var CatalogCapabilitiesSchema = z3.looseObject({
|
|
2345
|
+
acceptsSourceVideo: z3.boolean().optional(),
|
|
2346
|
+
framesExcludeReferences: z3.boolean().optional(),
|
|
2347
|
+
reasoning: z3.boolean().optional(),
|
|
2348
|
+
vision: z3.boolean().optional(),
|
|
2349
|
+
contextWindow: z3.number().optional()
|
|
2261
2350
|
});
|
|
2262
|
-
var CatalogModelSchemaBase =
|
|
2263
|
-
id:
|
|
2264
|
-
aliases:
|
|
2265
|
-
label:
|
|
2351
|
+
var CatalogModelSchemaBase = z3.looseObject({
|
|
2352
|
+
id: z3.string().min(1),
|
|
2353
|
+
aliases: z3.array(z3.string()).default([]),
|
|
2354
|
+
label: z3.string().min(1),
|
|
2266
2355
|
type: ModelTypeSchema,
|
|
2267
2356
|
adapter: AdapterSchema,
|
|
2268
|
-
providerModelId:
|
|
2357
|
+
providerModelId: z3.string().min(1),
|
|
2269
2358
|
lifecycle: LifecycleSchema,
|
|
2270
|
-
replacedBy:
|
|
2359
|
+
replacedBy: z3.string().optional(),
|
|
2271
2360
|
exposure: ExposureSchema,
|
|
2272
2361
|
constraints: ModelConstraintsSchema,
|
|
2273
2362
|
defaults: DefaultsSchema,
|
|
2274
2363
|
providerOptions: ProviderOptionsSchema.optional(),
|
|
2275
|
-
usage:
|
|
2364
|
+
usage: z3.looseObject({
|
|
2276
2365
|
unit: UsageUnitSchema,
|
|
2277
|
-
slug:
|
|
2278
|
-
providerLabel:
|
|
2366
|
+
slug: z3.string().optional(),
|
|
2367
|
+
providerLabel: z3.string().optional()
|
|
2279
2368
|
}),
|
|
2280
2369
|
pricingKind: PricingKindSchema,
|
|
2281
2370
|
display: CatalogDisplaySchema.optional(),
|
|
@@ -2326,9 +2415,30 @@ var CatalogModelSchema = CatalogModelSchemaBase.superRefine(
|
|
|
2326
2415
|
}
|
|
2327
2416
|
}
|
|
2328
2417
|
}
|
|
2418
|
+
const audio = row.constraints.audio;
|
|
2419
|
+
if (audio !== void 0 && !AudioOutputSchema.safeParse(audio).success) {
|
|
2420
|
+
ctx.addIssue({
|
|
2421
|
+
code: "custom",
|
|
2422
|
+
path: ["constraints", "audio"],
|
|
2423
|
+
message: 'audio must be "always", "optional" or "never"'
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
const prompt = row.constraints.prompt;
|
|
2427
|
+
if (prompt !== void 0) {
|
|
2428
|
+
const parsed = PromptConventionsSchema.safeParse(prompt);
|
|
2429
|
+
if (!parsed.success) {
|
|
2430
|
+
for (const issue of parsed.error.issues) {
|
|
2431
|
+
ctx.addIssue({
|
|
2432
|
+
code: "custom",
|
|
2433
|
+
path: ["constraints", "prompt", ...issue.path.map(String)],
|
|
2434
|
+
message: issue.message
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2329
2439
|
}
|
|
2330
2440
|
);
|
|
2331
|
-
var CatalogSchema =
|
|
2441
|
+
var CatalogSchema = z3.array(CatalogModelSchemaBase.transform((row) => normaliseConventions(row).row)).superRefine((rows, ctx) => {
|
|
2332
2442
|
for (const issue of collisionIssues(rows)) {
|
|
2333
2443
|
ctx.addIssue({
|
|
2334
2444
|
code: "custom",
|
|
@@ -2351,42 +2461,42 @@ var liveState = store[KEY] ??= {
|
|
|
2351
2461
|
var liveCatalog = liveState.catalog;
|
|
2352
2462
|
|
|
2353
2463
|
// src/json.ts
|
|
2354
|
-
import { z as
|
|
2355
|
-
var JsonValueSchema =
|
|
2356
|
-
() =>
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2464
|
+
import { z as z4 } from "zod";
|
|
2465
|
+
var JsonValueSchema = z4.lazy(
|
|
2466
|
+
() => z4.union([
|
|
2467
|
+
z4.string(),
|
|
2468
|
+
z4.number(),
|
|
2469
|
+
z4.boolean(),
|
|
2470
|
+
z4.null(),
|
|
2471
|
+
z4.array(JsonValueSchema),
|
|
2472
|
+
z4.record(z4.string(), JsonValueSchema)
|
|
2363
2473
|
])
|
|
2364
2474
|
);
|
|
2365
|
-
var JsonObjectSchema =
|
|
2366
|
-
var thrownErrorSchema =
|
|
2367
|
-
message:
|
|
2368
|
-
status:
|
|
2369
|
-
statusCode:
|
|
2370
|
-
responseBody:
|
|
2475
|
+
var JsonObjectSchema = z4.record(z4.string(), JsonValueSchema);
|
|
2476
|
+
var thrownErrorSchema = z4.object({
|
|
2477
|
+
message: z4.string().optional(),
|
|
2478
|
+
status: z4.number().optional(),
|
|
2479
|
+
statusCode: z4.number().optional(),
|
|
2480
|
+
responseBody: z4.string().optional()
|
|
2371
2481
|
});
|
|
2372
2482
|
|
|
2373
2483
|
// src/catalog/load.ts
|
|
2374
|
-
import { z as
|
|
2484
|
+
import { z as z5 } from "zod";
|
|
2375
2485
|
function rowCount() {
|
|
2376
2486
|
return liveCatalog.list({ lifecycle: ["active", "deprecated", "retired"] }).length;
|
|
2377
2487
|
}
|
|
2378
2488
|
function authHeaders(auth) {
|
|
2379
2489
|
return "bearer" in auth ? { Authorization: `Bearer ${auth.bearer}` } : { "x-api-key": auth.apiKey };
|
|
2380
2490
|
}
|
|
2381
|
-
var EnvelopeSchema =
|
|
2382
|
-
rows:
|
|
2383
|
-
revision:
|
|
2491
|
+
var EnvelopeSchema = z5.object({
|
|
2492
|
+
rows: z5.array(JsonValueSchema),
|
|
2493
|
+
revision: z5.string().optional()
|
|
2384
2494
|
});
|
|
2385
2495
|
function dropReason(path, message) {
|
|
2386
2496
|
return path.length === 0 ? message : `${path.map((part) => String(part)).join(".")} ${message}`;
|
|
2387
2497
|
}
|
|
2388
2498
|
function rowId(raw) {
|
|
2389
|
-
const parsed =
|
|
2499
|
+
const parsed = z5.object({ id: z5.string().min(1) }).loose().safeParse(raw);
|
|
2390
2500
|
if (!parsed.success) return "?";
|
|
2391
2501
|
return parsed.data.id;
|
|
2392
2502
|
}
|
|
@@ -2414,7 +2524,13 @@ function quarantine(rawRows, logger) {
|
|
|
2414
2524
|
);
|
|
2415
2525
|
}
|
|
2416
2526
|
}
|
|
2417
|
-
|
|
2527
|
+
const normalised = normaliseConventions(row);
|
|
2528
|
+
if (normalised.invalidKeys.length > 0) {
|
|
2529
|
+
logger.warn(
|
|
2530
|
+
`[modelkit] catalog row ${row.id} has an invalid ${normalised.invalidKeys.join(", ")}; read as not set`
|
|
2531
|
+
);
|
|
2532
|
+
}
|
|
2533
|
+
valid.push(normalised.row);
|
|
2418
2534
|
}
|
|
2419
2535
|
let kept = valid;
|
|
2420
2536
|
for (; ; ) {
|
|
@@ -3028,6 +3144,7 @@ function resolveOptions(model, request, onUnsupported = "error") {
|
|
|
3028
3144
|
}
|
|
3029
3145
|
export {
|
|
3030
3146
|
ADAPTER_IDS,
|
|
3147
|
+
AUDIO_OUTPUTS,
|
|
3031
3148
|
Catalog,
|
|
3032
3149
|
CatalogModelSchema,
|
|
3033
3150
|
CatalogModelSchemaBase,
|
|
@@ -3037,6 +3154,7 @@ export {
|
|
|
3037
3154
|
MODELS,
|
|
3038
3155
|
ModelKitError,
|
|
3039
3156
|
OTHER_MODELS,
|
|
3157
|
+
REFERENCE_SYNTAXES,
|
|
3040
3158
|
SURFACES2 as SURFACES,
|
|
3041
3159
|
SurfaceSchema,
|
|
3042
3160
|
TEXT_MODELS,
|
|
@@ -3049,7 +3167,9 @@ export {
|
|
|
3049
3167
|
liveState,
|
|
3050
3168
|
nearestAspectRatio,
|
|
3051
3169
|
normalizeExposure,
|
|
3170
|
+
outputAudio,
|
|
3052
3171
|
primeCatalog,
|
|
3172
|
+
promptConventions,
|
|
3053
3173
|
resetLiveCatalog,
|
|
3054
3174
|
resolveAudioOptions,
|
|
3055
3175
|
resolveImageOptions,
|