@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/index.cjs
CHANGED
|
@@ -283,7 +283,9 @@ function geminiImage(id, label, aliases, sizes, display, exposure, references) {
|
|
|
283
283
|
const constraints = {
|
|
284
284
|
aspectRatios: [...GEMINI_RATIOS],
|
|
285
285
|
sizes,
|
|
286
|
-
supports: ["safetySettings", "temperature"]
|
|
286
|
+
supports: ["safetySettings", "temperature"],
|
|
287
|
+
// google-image sends MediaRef.label as a text part beside each reference.
|
|
288
|
+
prompt: { referenceSyntax: "caption" }
|
|
287
289
|
};
|
|
288
290
|
if (references !== void 0) constraints.references = references;
|
|
289
291
|
const model = {
|
|
@@ -570,6 +572,7 @@ var IMAGE_MODELS = [
|
|
|
570
572
|
constraints: {
|
|
571
573
|
aspectRatios: ["1:1", "2:3", "3:2", "16:9", "9:16", "4:3", "3:4", "4:5", "5:4", "21:9"],
|
|
572
574
|
sizes: ["1K"],
|
|
575
|
+
references: { images: 8 },
|
|
573
576
|
// flux-2-pro's job type always returns image/png; only the seed is forwarded.
|
|
574
577
|
supports: ["seed"]
|
|
575
578
|
},
|
|
@@ -1393,7 +1396,8 @@ var VIDEO_MODELS = [
|
|
|
1393
1396
|
resolutions: ["720p", "1080p", "4k"],
|
|
1394
1397
|
durations: [8],
|
|
1395
1398
|
references: { images: 3 },
|
|
1396
|
-
supports: ["lastFrame", "seed"]
|
|
1399
|
+
supports: ["lastFrame", "seed"],
|
|
1400
|
+
audio: "always"
|
|
1397
1401
|
},
|
|
1398
1402
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1399
1403
|
usage: { ...VIDEO_USAGE, slug: "veo" },
|
|
@@ -1423,7 +1427,8 @@ var VIDEO_MODELS = [
|
|
|
1423
1427
|
resolutions: ["720p", "1080p", "4k"],
|
|
1424
1428
|
durations: [4, 6, 8],
|
|
1425
1429
|
references: { images: 3 },
|
|
1426
|
-
supports: ["lastFrame", "seed"]
|
|
1430
|
+
supports: ["lastFrame", "seed"],
|
|
1431
|
+
audio: "always"
|
|
1427
1432
|
},
|
|
1428
1433
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1429
1434
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1451,7 +1456,8 @@ var VIDEO_MODELS = [
|
|
|
1451
1456
|
aspectRatios: [...OMNI_RATIOS],
|
|
1452
1457
|
resolutions: ["720p", "1080p"],
|
|
1453
1458
|
durations: [4, 6, 8],
|
|
1454
|
-
supports: ["lastFrame", "seed"]
|
|
1459
|
+
supports: ["lastFrame", "seed"],
|
|
1460
|
+
audio: "always"
|
|
1455
1461
|
},
|
|
1456
1462
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1457
1463
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1485,7 +1491,10 @@ var VIDEO_MODELS = [
|
|
|
1485
1491
|
durations: [3, 4, 5, 6, 7, 8, 9, 10],
|
|
1486
1492
|
references: { images: 6, videos: 1, videoSeconds: { max: 10 } },
|
|
1487
1493
|
sourceVideoSeconds: { max: 10 },
|
|
1488
|
-
supports: []
|
|
1494
|
+
supports: [],
|
|
1495
|
+
// generateOmniVideo sends MediaRef.label as a text part beside each image.
|
|
1496
|
+
prompt: { referenceSyntax: "caption" },
|
|
1497
|
+
audio: "always"
|
|
1489
1498
|
},
|
|
1490
1499
|
defaults: {},
|
|
1491
1500
|
usage: { ...VIDEO_USAGE, slug: "gemini_omni" },
|
|
@@ -1519,7 +1528,10 @@ var VIDEO_MODELS = [
|
|
|
1519
1528
|
// chain by `previousInteractionId` (the API rejects the id together
|
|
1520
1529
|
// with a video task, so those calls carry the prompt alone).
|
|
1521
1530
|
supports: ["videoExtension"],
|
|
1522
|
-
extension: { segmentSeconds: 10, maxTotalSeconds: 40 }
|
|
1531
|
+
extension: { segmentSeconds: 10, maxTotalSeconds: 40 },
|
|
1532
|
+
// generateOmniVideo sends MediaRef.label as a text part beside each image.
|
|
1533
|
+
prompt: { referenceSyntax: "caption" },
|
|
1534
|
+
audio: "always"
|
|
1523
1535
|
},
|
|
1524
1536
|
defaults: {},
|
|
1525
1537
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1555,7 +1567,8 @@ var VIDEO_MODELS = [
|
|
|
1555
1567
|
},
|
|
1556
1568
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
1557
1569
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1558
|
-
supports: ["generateAudio", "seed", "lastFrame", "watermark"]
|
|
1570
|
+
supports: ["generateAudio", "seed", "lastFrame", "watermark"],
|
|
1571
|
+
audio: "optional"
|
|
1559
1572
|
},
|
|
1560
1573
|
defaults: {
|
|
1561
1574
|
durationSeconds: 5,
|
|
@@ -1594,7 +1607,8 @@ var VIDEO_MODELS = [
|
|
|
1594
1607
|
},
|
|
1595
1608
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
1596
1609
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1597
|
-
supports: ["generateAudio", "seed", "lastFrame", "watermark"]
|
|
1610
|
+
supports: ["generateAudio", "seed", "lastFrame", "watermark"],
|
|
1611
|
+
audio: "optional"
|
|
1598
1612
|
},
|
|
1599
1613
|
defaults: {
|
|
1600
1614
|
durationSeconds: 5,
|
|
@@ -1634,7 +1648,8 @@ var VIDEO_MODELS = [
|
|
|
1634
1648
|
},
|
|
1635
1649
|
sourceVideoSeconds: { min: 2, max: 30, editMin: 4, inReferenceTotal: true },
|
|
1636
1650
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1637
|
-
supports: ["generateAudio", "seed", "lastFrame", "watermark", "taskType"]
|
|
1651
|
+
supports: ["generateAudio", "seed", "lastFrame", "watermark", "taskType"],
|
|
1652
|
+
audio: "optional"
|
|
1638
1653
|
},
|
|
1639
1654
|
defaults: {
|
|
1640
1655
|
durationSeconds: 5,
|
|
@@ -1667,7 +1682,9 @@ var VIDEO_MODELS = [
|
|
|
1667
1682
|
durations: { min: 1, max: 15 },
|
|
1668
1683
|
durationPresets: [4, 6, 8, 10],
|
|
1669
1684
|
references: { images: 5 },
|
|
1670
|
-
supports: []
|
|
1685
|
+
supports: [],
|
|
1686
|
+
// xAI can switch sound off (generate_audio); xai-video.ts never sends it.
|
|
1687
|
+
audio: "always"
|
|
1671
1688
|
},
|
|
1672
1689
|
// No resolution default: xAI picks its own unless the caller asks.
|
|
1673
1690
|
defaults: { durationSeconds: 8, aspectRatio: "16:9" },
|
|
@@ -1693,7 +1710,8 @@ var VIDEO_MODELS = [
|
|
|
1693
1710
|
aspectRatios: [...KLING_RATIOS],
|
|
1694
1711
|
durations: [5, 10],
|
|
1695
1712
|
requires: ["firstFrame"],
|
|
1696
|
-
supports: ["cfgScale", "negativePrompt", "lastFrame"]
|
|
1713
|
+
supports: ["cfgScale", "negativePrompt", "lastFrame"],
|
|
1714
|
+
audio: "never"
|
|
1697
1715
|
},
|
|
1698
1716
|
defaults: {
|
|
1699
1717
|
durationSeconds: 5,
|
|
@@ -1724,7 +1742,9 @@ var VIDEO_MODELS = [
|
|
|
1724
1742
|
aspectRatios: [...KLING_RATIOS],
|
|
1725
1743
|
durations: { min: 3, max: 15 },
|
|
1726
1744
|
requires: ["firstFrame"],
|
|
1727
|
-
supports: ["cfgScale", "negativePrompt", "lastFrame"]
|
|
1745
|
+
supports: ["cfgScale", "negativePrompt", "lastFrame"],
|
|
1746
|
+
// Higgsfield has a `sound` switch (default on); KlingCreate doesn't send it.
|
|
1747
|
+
audio: "always"
|
|
1728
1748
|
},
|
|
1729
1749
|
defaults: {
|
|
1730
1750
|
durationSeconds: 5,
|
|
@@ -1759,7 +1779,8 @@ var VIDEO_MODELS = [
|
|
|
1759
1779
|
resolutions: ["720p", "1080p"],
|
|
1760
1780
|
durations: { min: 3, max: 15 },
|
|
1761
1781
|
references: { images: 7, imagesWithVideo: 4 },
|
|
1762
|
-
supports: ["generateAudio", "lastFrame"]
|
|
1782
|
+
supports: ["generateAudio", "lastFrame"],
|
|
1783
|
+
audio: "optional"
|
|
1763
1784
|
},
|
|
1764
1785
|
defaults: { durationSeconds: 5, aspectRatio: "16:9", generateAudio: false, mode: "pro" },
|
|
1765
1786
|
usage: { unit: "compute_seconds" },
|
|
@@ -1784,7 +1805,8 @@ var VIDEO_MODELS = [
|
|
|
1784
1805
|
aspectRatios: [...H3_RATIOS],
|
|
1785
1806
|
resolutions: ["480p", "768p", "2k", "4k"],
|
|
1786
1807
|
durations: { min: 5, max: 15 },
|
|
1787
|
-
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"]
|
|
1808
|
+
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
|
|
1809
|
+
audio: "always"
|
|
1788
1810
|
},
|
|
1789
1811
|
defaults: {
|
|
1790
1812
|
durationSeconds: 5,
|
|
@@ -1814,7 +1836,8 @@ var VIDEO_MODELS = [
|
|
|
1814
1836
|
aspectRatios: [...H3_RATIOS],
|
|
1815
1837
|
resolutions: ["480p", "768p"],
|
|
1816
1838
|
durations: { min: 5, max: 15 },
|
|
1817
|
-
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"]
|
|
1839
|
+
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
|
|
1840
|
+
audio: "always"
|
|
1818
1841
|
},
|
|
1819
1842
|
defaults: {
|
|
1820
1843
|
durationSeconds: 5,
|
|
@@ -1852,7 +1875,8 @@ var VIDEO_MODELS = [
|
|
|
1852
1875
|
audioOnly: false,
|
|
1853
1876
|
videoSeconds: { min: 2, max: 15, total: 15 }
|
|
1854
1877
|
},
|
|
1855
|
-
supports: ["seed", "promptExpansion", "safetyChecker"]
|
|
1878
|
+
supports: ["seed", "promptExpansion", "safetyChecker"],
|
|
1879
|
+
audio: "always"
|
|
1856
1880
|
},
|
|
1857
1881
|
defaults: {
|
|
1858
1882
|
durationSeconds: 5,
|
|
@@ -1867,7 +1891,9 @@ var VIDEO_MODELS = [
|
|
|
1867
1891
|
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
|
|
1868
1892
|
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."
|
|
1869
1893
|
},
|
|
1870
|
-
|
|
1894
|
+
// fal's reference-to-video endpoint never reads a frame; the resolver must drop the
|
|
1895
|
+
// references instead of the adapter silently dropping the frame.
|
|
1896
|
+
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1871
1897
|
},
|
|
1872
1898
|
{
|
|
1873
1899
|
id: "minimax-h3-max-reference",
|
|
@@ -1890,7 +1916,8 @@ var VIDEO_MODELS = [
|
|
|
1890
1916
|
audioOnly: false,
|
|
1891
1917
|
videoSeconds: { min: 2, max: 15, total: 15 }
|
|
1892
1918
|
},
|
|
1893
|
-
supports: ["seed", "promptExpansion", "safetyChecker"]
|
|
1919
|
+
supports: ["seed", "promptExpansion", "safetyChecker"],
|
|
1920
|
+
audio: "always"
|
|
1894
1921
|
},
|
|
1895
1922
|
defaults: {
|
|
1896
1923
|
durationSeconds: 5,
|
|
@@ -1905,7 +1932,9 @@ var VIDEO_MODELS = [
|
|
|
1905
1932
|
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
|
|
1906
1933
|
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."
|
|
1907
1934
|
},
|
|
1908
|
-
|
|
1935
|
+
// fal's reference-to-video endpoint never reads a frame; the resolver must drop the
|
|
1936
|
+
// references instead of the adapter silently dropping the frame.
|
|
1937
|
+
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1909
1938
|
},
|
|
1910
1939
|
{
|
|
1911
1940
|
// Duration 3-10s per trigger-workflows mapDuration; the endpoint takes no resolution.
|
|
@@ -1922,7 +1951,8 @@ var VIDEO_MODELS = [
|
|
|
1922
1951
|
durations: { min: 3, max: 10 },
|
|
1923
1952
|
requires: ["sourceVideo"],
|
|
1924
1953
|
sourceVideoSeconds: { min: 3, max: 10.05 },
|
|
1925
|
-
supports: []
|
|
1954
|
+
supports: [],
|
|
1955
|
+
audio: "never"
|
|
1926
1956
|
},
|
|
1927
1957
|
defaults: { durationSeconds: 5, aspectRatio: "16:9" },
|
|
1928
1958
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1946,7 +1976,8 @@ var VIDEO_MODELS = [
|
|
|
1946
1976
|
constraints: {
|
|
1947
1977
|
resolutions: ["768p"],
|
|
1948
1978
|
durations: [6, 10],
|
|
1949
|
-
supports: ["lastFrame"]
|
|
1979
|
+
supports: ["lastFrame"],
|
|
1980
|
+
audio: "never"
|
|
1950
1981
|
},
|
|
1951
1982
|
defaults: { durationSeconds: 6, resolution: "768p" },
|
|
1952
1983
|
usage: { unit: "compute_seconds" },
|
|
@@ -1969,7 +2000,8 @@ var VIDEO_MODELS = [
|
|
|
1969
2000
|
exposure: [],
|
|
1970
2001
|
constraints: {
|
|
1971
2002
|
requires: ["firstFrame"],
|
|
1972
|
-
supports: ["seed", "lastFrame"]
|
|
2003
|
+
supports: ["seed", "lastFrame"],
|
|
2004
|
+
audio: "never"
|
|
1973
2005
|
},
|
|
1974
2006
|
defaults: {},
|
|
1975
2007
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1991,7 +2023,7 @@ var MODELS = [
|
|
|
1991
2023
|
];
|
|
1992
2024
|
|
|
1993
2025
|
// src/catalog/schema.ts
|
|
1994
|
-
var
|
|
2026
|
+
var import_zod3 = require("zod");
|
|
1995
2027
|
|
|
1996
2028
|
// src/catalog/collisions.ts
|
|
1997
2029
|
function collisionIssues(rows) {
|
|
@@ -2038,8 +2070,57 @@ function collisionIssues(rows) {
|
|
|
2038
2070
|
return issues;
|
|
2039
2071
|
}
|
|
2040
2072
|
|
|
2041
|
-
// src/catalog/
|
|
2073
|
+
// src/catalog/conventions.ts
|
|
2042
2074
|
var import_zod = require("zod");
|
|
2075
|
+
var AudioOutputSchema = import_zod.z.enum(["always", "optional", "never"]);
|
|
2076
|
+
var ReferenceSyntaxSchema = import_zod.z.enum(["numbered", "caption", "descriptive"]);
|
|
2077
|
+
var MaxCharsSchema = import_zod.z.number().int().positive();
|
|
2078
|
+
var PromptConventionsSchema = import_zod.z.strictObject({
|
|
2079
|
+
referenceSyntax: ReferenceSyntaxSchema,
|
|
2080
|
+
maxChars: MaxCharsSchema.optional()
|
|
2081
|
+
});
|
|
2082
|
+
var AUDIO_OUTPUTS = AudioOutputSchema.options;
|
|
2083
|
+
var REFERENCE_SYNTAXES = ReferenceSyntaxSchema.options;
|
|
2084
|
+
var ConstraintsReadView = import_zod.z.looseObject({
|
|
2085
|
+
audio: AudioOutputSchema.optional().catch(void 0),
|
|
2086
|
+
prompt: import_zod.z.looseObject({
|
|
2087
|
+
referenceSyntax: ReferenceSyntaxSchema.catch("numbered"),
|
|
2088
|
+
maxChars: MaxCharsSchema.optional().catch(void 0)
|
|
2089
|
+
}).optional().catch(void 0)
|
|
2090
|
+
});
|
|
2091
|
+
var DEFAULT_CONVENTIONS = { referenceSyntax: "numbered" };
|
|
2092
|
+
function promptConventions(row) {
|
|
2093
|
+
const view = ConstraintsReadView.safeParse(row.constraints);
|
|
2094
|
+
const prompt = view.success ? view.data.prompt : void 0;
|
|
2095
|
+
if (prompt === void 0) return { ...DEFAULT_CONVENTIONS };
|
|
2096
|
+
const result = { referenceSyntax: prompt.referenceSyntax };
|
|
2097
|
+
if (prompt.maxChars !== void 0) result.maxChars = prompt.maxChars;
|
|
2098
|
+
return result;
|
|
2099
|
+
}
|
|
2100
|
+
var RawConventionsView = import_zod.z.looseObject({
|
|
2101
|
+
audio: import_zod.z.unknown().optional(),
|
|
2102
|
+
prompt: import_zod.z.unknown().optional()
|
|
2103
|
+
});
|
|
2104
|
+
function normaliseConventions(row) {
|
|
2105
|
+
const view = RawConventionsView.safeParse(row.constraints);
|
|
2106
|
+
if (!view.success) return { row, invalidKeys: [] };
|
|
2107
|
+
const { audio, prompt } = view.data;
|
|
2108
|
+
const badAudio = audio !== void 0 && !AudioOutputSchema.safeParse(audio).success;
|
|
2109
|
+
const badPrompt = prompt !== void 0 && !PromptConventionsSchema.safeParse(prompt).success;
|
|
2110
|
+
if (!badAudio && !badPrompt) return { row, invalidKeys: [] };
|
|
2111
|
+
const invalidKeys = [];
|
|
2112
|
+
if (badAudio) invalidKeys.push("constraints.audio");
|
|
2113
|
+
if (badPrompt) invalidKeys.push("constraints.prompt");
|
|
2114
|
+
const entries = Object.entries(row.constraints).flatMap(([key, value]) => {
|
|
2115
|
+
if (key === "audio" && badAudio) return [];
|
|
2116
|
+
if (key === "prompt" && badPrompt) return [[key, promptConventions(row)]];
|
|
2117
|
+
return [[key, value]];
|
|
2118
|
+
});
|
|
2119
|
+
return { row: { ...row, constraints: Object.fromEntries(entries) }, invalidKeys };
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
// src/catalog/input-spec.ts
|
|
2123
|
+
var import_zod2 = require("zod");
|
|
2043
2124
|
var VIDEO_INPUT_SPEC_KEYS = [
|
|
2044
2125
|
"prompt",
|
|
2045
2126
|
"durationSeconds",
|
|
@@ -2078,8 +2159,8 @@ var ALL_KEY_SET = /* @__PURE__ */ new Set([
|
|
|
2078
2159
|
...VIDEO_INPUT_SPEC_KEYS,
|
|
2079
2160
|
...AUDIO_INPUT_SPEC_KEYS
|
|
2080
2161
|
]);
|
|
2081
|
-
var ProviderScalarSchema =
|
|
2082
|
-
var FieldsSchema =
|
|
2162
|
+
var ProviderScalarSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number(), import_zod2.z.boolean()]);
|
|
2163
|
+
var FieldsSchema = import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string().min(1)).superRefine((fields, ctx) => {
|
|
2083
2164
|
const keys = Object.keys(fields);
|
|
2084
2165
|
if (keys.length === 0) {
|
|
2085
2166
|
ctx.addIssue({
|
|
@@ -2097,7 +2178,7 @@ var FieldsSchema = import_zod.z.record(import_zod.z.string(), import_zod.z.strin
|
|
|
2097
2178
|
}
|
|
2098
2179
|
}
|
|
2099
2180
|
});
|
|
2100
|
-
var ValuesSchema =
|
|
2181
|
+
var ValuesSchema = import_zod2.z.record(import_zod2.z.string(), import_zod2.z.record(import_zod2.z.string(), ProviderScalarSchema)).superRefine((values, ctx) => {
|
|
2101
2182
|
for (const key of Object.keys(values)) {
|
|
2102
2183
|
if (!ALL_KEY_SET.has(key)) {
|
|
2103
2184
|
ctx.addIssue({
|
|
@@ -2107,8 +2188,8 @@ var ValuesSchema = import_zod.z.record(import_zod.z.string(), import_zod.z.recor
|
|
|
2107
2188
|
}
|
|
2108
2189
|
}
|
|
2109
2190
|
});
|
|
2110
|
-
var StaticSchema =
|
|
2111
|
-
var InputSpecSchema =
|
|
2191
|
+
var StaticSchema = import_zod2.z.record(import_zod2.z.string(), ProviderScalarSchema);
|
|
2192
|
+
var InputSpecSchema = import_zod2.z.strictObject({
|
|
2112
2193
|
fields: FieldsSchema,
|
|
2113
2194
|
values: ValuesSchema.optional(),
|
|
2114
2195
|
static: StaticSchema.optional()
|
|
@@ -2215,16 +2296,16 @@ var ADAPTER_IDS = [
|
|
|
2215
2296
|
"higgsfield",
|
|
2216
2297
|
"xai-video"
|
|
2217
2298
|
];
|
|
2218
|
-
var ModelTypeSchema =
|
|
2219
|
-
var LifecycleSchema =
|
|
2220
|
-
var SurfaceSchema =
|
|
2299
|
+
var ModelTypeSchema = import_zod3.z.enum(["text", "image", "video", "audio", "upscale", "bg-remove"]);
|
|
2300
|
+
var LifecycleSchema = import_zod3.z.enum(["active", "deprecated", "retired"]);
|
|
2301
|
+
var SurfaceSchema = import_zod3.z.enum(["cowork", "space_builder"]);
|
|
2221
2302
|
var SURFACES2 = SurfaceSchema.options;
|
|
2222
|
-
var ExposureSchema =
|
|
2303
|
+
var ExposureSchema = import_zod3.z.preprocess(
|
|
2223
2304
|
normalizeExposure,
|
|
2224
|
-
|
|
2305
|
+
import_zod3.z.array(SurfaceSchema)
|
|
2225
2306
|
);
|
|
2226
|
-
var AdapterSchema =
|
|
2227
|
-
var AspectRatioSchema =
|
|
2307
|
+
var AdapterSchema = import_zod3.z.enum(ADAPTER_IDS);
|
|
2308
|
+
var AspectRatioSchema = import_zod3.z.enum([
|
|
2228
2309
|
"1:1",
|
|
2229
2310
|
"16:9",
|
|
2230
2311
|
"9:16",
|
|
@@ -2239,12 +2320,12 @@ var AspectRatioSchema = import_zod2.z.enum([
|
|
|
2239
2320
|
"97:30",
|
|
2240
2321
|
"adaptive"
|
|
2241
2322
|
]);
|
|
2242
|
-
var ImageSizeSchema =
|
|
2243
|
-
var VideoResolutionSchema =
|
|
2244
|
-
var ImageQualitySchema =
|
|
2245
|
-
var OutputFormatSchema =
|
|
2246
|
-
var RequiredInputSchema =
|
|
2247
|
-
var SupportedOptionSchema =
|
|
2323
|
+
var ImageSizeSchema = import_zod3.z.enum(["512", "1K", "2K", "4K"]);
|
|
2324
|
+
var VideoResolutionSchema = import_zod3.z.enum(["360p", "480p", "720p", "768p", "1080p", "2k", "4k"]);
|
|
2325
|
+
var ImageQualitySchema = import_zod3.z.enum(["auto", "low", "medium", "high", "xhigh", "max"]);
|
|
2326
|
+
var OutputFormatSchema = import_zod3.z.enum(["png", "jpeg", "webp"]);
|
|
2327
|
+
var RequiredInputSchema = import_zod3.z.enum(["firstFrame", "sourceVideo", "references"]);
|
|
2328
|
+
var SupportedOptionSchema = import_zod3.z.enum([
|
|
2248
2329
|
"seed",
|
|
2249
2330
|
"quality",
|
|
2250
2331
|
"negativePrompt",
|
|
@@ -2264,142 +2345,146 @@ var SupportedOptionSchema = import_zod2.z.enum([
|
|
|
2264
2345
|
"videoExtension",
|
|
2265
2346
|
"instrumental"
|
|
2266
2347
|
]);
|
|
2267
|
-
var UsageUnitSchema =
|
|
2348
|
+
var UsageUnitSchema = import_zod3.z.enum([
|
|
2268
2349
|
"tokens",
|
|
2269
2350
|
"images",
|
|
2270
2351
|
"seconds",
|
|
2271
2352
|
"reported_cost_usd",
|
|
2272
2353
|
"compute_seconds"
|
|
2273
2354
|
]);
|
|
2274
|
-
var PricingKindSchema =
|
|
2275
|
-
var ProviderOptionValueSchema =
|
|
2276
|
-
() =>
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2355
|
+
var PricingKindSchema = import_zod3.z.enum(["token", "image_size", "video_per_second", "flat"]);
|
|
2356
|
+
var ProviderOptionValueSchema = import_zod3.z.lazy(
|
|
2357
|
+
() => import_zod3.z.union([
|
|
2358
|
+
import_zod3.z.string(),
|
|
2359
|
+
import_zod3.z.number(),
|
|
2360
|
+
import_zod3.z.boolean(),
|
|
2361
|
+
import_zod3.z.array(ProviderOptionValueSchema),
|
|
2362
|
+
import_zod3.z.record(import_zod3.z.string(), ProviderOptionValueSchema)
|
|
2282
2363
|
])
|
|
2283
2364
|
);
|
|
2284
|
-
var ProviderOptionsSchema =
|
|
2285
|
-
var VideoSecondsLimitsSchema =
|
|
2286
|
-
min:
|
|
2287
|
-
max:
|
|
2288
|
-
total:
|
|
2289
|
-
editMin:
|
|
2365
|
+
var ProviderOptionsSchema = import_zod3.z.record(import_zod3.z.string(), import_zod3.z.record(import_zod3.z.string(), ProviderOptionValueSchema));
|
|
2366
|
+
var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
|
|
2367
|
+
min: import_zod3.z.number().optional(),
|
|
2368
|
+
max: import_zod3.z.number().optional(),
|
|
2369
|
+
total: import_zod3.z.number().optional(),
|
|
2370
|
+
editMin: import_zod3.z.number().optional()
|
|
2290
2371
|
});
|
|
2291
|
-
var ReferenceLimitsSchema =
|
|
2292
|
-
images:
|
|
2293
|
-
imagesWithVideo:
|
|
2294
|
-
videos:
|
|
2295
|
-
audios:
|
|
2296
|
-
total:
|
|
2297
|
-
audioOnly:
|
|
2372
|
+
var ReferenceLimitsSchema = import_zod3.z.looseObject({
|
|
2373
|
+
images: import_zod3.z.number().optional(),
|
|
2374
|
+
imagesWithVideo: import_zod3.z.number().optional(),
|
|
2375
|
+
videos: import_zod3.z.number().optional(),
|
|
2376
|
+
audios: import_zod3.z.number().optional(),
|
|
2377
|
+
total: import_zod3.z.number().optional(),
|
|
2378
|
+
audioOnly: import_zod3.z.boolean().optional(),
|
|
2298
2379
|
videoSeconds: VideoSecondsLimitsSchema.optional()
|
|
2299
2380
|
});
|
|
2300
|
-
var ModelConstraintsSchema =
|
|
2301
|
-
aspectRatios:
|
|
2302
|
-
sizes:
|
|
2303
|
-
resolutions:
|
|
2304
|
-
durations:
|
|
2305
|
-
durationPresets:
|
|
2306
|
-
qualityOptions:
|
|
2307
|
-
exactSizes:
|
|
2381
|
+
var ModelConstraintsSchema = import_zod3.z.looseObject({
|
|
2382
|
+
aspectRatios: import_zod3.z.array(AspectRatioSchema).optional(),
|
|
2383
|
+
sizes: import_zod3.z.array(ImageSizeSchema).optional(),
|
|
2384
|
+
resolutions: import_zod3.z.array(VideoResolutionSchema).optional(),
|
|
2385
|
+
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(),
|
|
2386
|
+
durationPresets: import_zod3.z.array(import_zod3.z.number()).optional(),
|
|
2387
|
+
qualityOptions: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
2388
|
+
exactSizes: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string()).optional(),
|
|
2308
2389
|
references: ReferenceLimitsSchema.optional(),
|
|
2309
|
-
requires:
|
|
2310
|
-
supports:
|
|
2311
|
-
ratioIgnoredWith:
|
|
2312
|
-
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal:
|
|
2313
|
-
extension:
|
|
2390
|
+
requires: import_zod3.z.array(RequiredInputSchema).optional(),
|
|
2391
|
+
supports: import_zod3.z.array(SupportedOptionSchema).optional(),
|
|
2392
|
+
ratioIgnoredWith: import_zod3.z.array(import_zod3.z.enum(["firstFrame", "sourceVideo"])).optional(),
|
|
2393
|
+
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: import_zod3.z.boolean().optional() }).optional(),
|
|
2394
|
+
extension: import_zod3.z.looseObject({ segmentSeconds: import_zod3.z.number(), maxTotalSeconds: import_zod3.z.number() }).optional(),
|
|
2395
|
+
// Loose on purpose: the read path keeps a row whose value is invalid (the accessors in
|
|
2396
|
+
// conventions.ts read it as "not set"); CatalogModelSchema below rejects it on write.
|
|
2397
|
+
audio: import_zod3.z.unknown().optional(),
|
|
2398
|
+
prompt: import_zod3.z.unknown().optional()
|
|
2314
2399
|
});
|
|
2315
|
-
var MediaRefSchema =
|
|
2316
|
-
|
|
2317
|
-
url:
|
|
2318
|
-
label:
|
|
2319
|
-
durationSeconds:
|
|
2400
|
+
var MediaRefSchema = import_zod3.z.union([
|
|
2401
|
+
import_zod3.z.looseObject({
|
|
2402
|
+
url: import_zod3.z.string(),
|
|
2403
|
+
label: import_zod3.z.string().optional(),
|
|
2404
|
+
durationSeconds: import_zod3.z.number().optional()
|
|
2320
2405
|
}),
|
|
2321
|
-
|
|
2322
|
-
bytes:
|
|
2323
|
-
mime:
|
|
2324
|
-
label:
|
|
2325
|
-
durationSeconds:
|
|
2406
|
+
import_zod3.z.looseObject({
|
|
2407
|
+
bytes: import_zod3.z.instanceof(Uint8Array),
|
|
2408
|
+
mime: import_zod3.z.string(),
|
|
2409
|
+
label: import_zod3.z.string().optional(),
|
|
2410
|
+
durationSeconds: import_zod3.z.number().optional()
|
|
2326
2411
|
})
|
|
2327
2412
|
]);
|
|
2328
|
-
var ImageSafetySettingSchema =
|
|
2329
|
-
var UpscaleOptionsSchema =
|
|
2330
|
-
enhanceModel:
|
|
2331
|
-
subjectDetection:
|
|
2332
|
-
faceEnhancement:
|
|
2333
|
-
faceEnhancementCreativity:
|
|
2334
|
-
faceEnhancementStrength:
|
|
2413
|
+
var ImageSafetySettingSchema = import_zod3.z.looseObject({ category: import_zod3.z.string(), threshold: import_zod3.z.string() });
|
|
2414
|
+
var UpscaleOptionsSchema = import_zod3.z.looseObject({
|
|
2415
|
+
enhanceModel: import_zod3.z.string().optional(),
|
|
2416
|
+
subjectDetection: import_zod3.z.string().optional(),
|
|
2417
|
+
faceEnhancement: import_zod3.z.boolean().optional(),
|
|
2418
|
+
faceEnhancementCreativity: import_zod3.z.number().optional(),
|
|
2419
|
+
faceEnhancementStrength: import_zod3.z.number().optional()
|
|
2335
2420
|
});
|
|
2336
|
-
var DefaultsSchema =
|
|
2337
|
-
references:
|
|
2421
|
+
var DefaultsSchema = import_zod3.z.looseObject({
|
|
2422
|
+
references: import_zod3.z.array(MediaRefSchema).optional(),
|
|
2338
2423
|
aspectRatio: AspectRatioSchema.optional(),
|
|
2339
2424
|
size: ImageSizeSchema.optional(),
|
|
2340
|
-
exactSize:
|
|
2425
|
+
exactSize: import_zod3.z.string().optional(),
|
|
2341
2426
|
quality: ImageQualitySchema.optional(),
|
|
2342
|
-
seed:
|
|
2343
|
-
count:
|
|
2427
|
+
seed: import_zod3.z.number().optional(),
|
|
2428
|
+
count: import_zod3.z.number().optional(),
|
|
2344
2429
|
outputFormat: OutputFormatSchema.optional(),
|
|
2345
|
-
scaleFactor:
|
|
2346
|
-
safetySettings:
|
|
2347
|
-
temperature:
|
|
2430
|
+
scaleFactor: import_zod3.z.number().optional(),
|
|
2431
|
+
safetySettings: import_zod3.z.array(ImageSafetySettingSchema).optional(),
|
|
2432
|
+
temperature: import_zod3.z.number().optional(),
|
|
2348
2433
|
upscale: UpscaleOptionsSchema.optional(),
|
|
2349
2434
|
firstFrame: MediaRefSchema.optional(),
|
|
2350
2435
|
lastFrame: MediaRefSchema.optional(),
|
|
2351
2436
|
sourceVideo: MediaRefSchema.optional(),
|
|
2352
|
-
referenceImages:
|
|
2353
|
-
referenceVideos:
|
|
2354
|
-
referenceAudios:
|
|
2437
|
+
referenceImages: import_zod3.z.array(MediaRefSchema).optional(),
|
|
2438
|
+
referenceVideos: import_zod3.z.array(MediaRefSchema).optional(),
|
|
2439
|
+
referenceAudios: import_zod3.z.array(MediaRefSchema).optional(),
|
|
2355
2440
|
resolution: VideoResolutionSchema.optional(),
|
|
2356
|
-
durationSeconds:
|
|
2357
|
-
generateAudio:
|
|
2358
|
-
negativePrompt:
|
|
2359
|
-
cfgScale:
|
|
2360
|
-
promptExpansion:
|
|
2361
|
-
watermark:
|
|
2362
|
-
safetyChecker:
|
|
2363
|
-
taskType:
|
|
2364
|
-
mode:
|
|
2365
|
-
instrumental:
|
|
2441
|
+
durationSeconds: import_zod3.z.number().optional(),
|
|
2442
|
+
generateAudio: import_zod3.z.boolean().optional(),
|
|
2443
|
+
negativePrompt: import_zod3.z.string().optional(),
|
|
2444
|
+
cfgScale: import_zod3.z.number().optional(),
|
|
2445
|
+
promptExpansion: import_zod3.z.enum(["fast", "balanced", "quality"]).optional(),
|
|
2446
|
+
watermark: import_zod3.z.boolean().optional(),
|
|
2447
|
+
safetyChecker: import_zod3.z.boolean().optional(),
|
|
2448
|
+
taskType: import_zod3.z.enum(["reference", "edit", "extend"]).optional(),
|
|
2449
|
+
mode: import_zod3.z.enum(["standard", "pro"]).optional(),
|
|
2450
|
+
instrumental: import_zod3.z.boolean().optional()
|
|
2366
2451
|
});
|
|
2367
|
-
var CatalogDisplaySchema =
|
|
2368
|
-
provider:
|
|
2369
|
-
description:
|
|
2370
|
-
logo:
|
|
2371
|
-
costTier:
|
|
2372
|
-
recommended:
|
|
2373
|
-
sortOrder:
|
|
2374
|
-
chat:
|
|
2452
|
+
var CatalogDisplaySchema = import_zod3.z.looseObject({
|
|
2453
|
+
provider: import_zod3.z.string(),
|
|
2454
|
+
description: import_zod3.z.string(),
|
|
2455
|
+
logo: import_zod3.z.string().optional(),
|
|
2456
|
+
costTier: import_zod3.z.union([import_zod3.z.literal(1), import_zod3.z.literal(2), import_zod3.z.literal(3)]).optional(),
|
|
2457
|
+
recommended: import_zod3.z.boolean().optional(),
|
|
2458
|
+
sortOrder: import_zod3.z.number().optional(),
|
|
2459
|
+
chat: import_zod3.z.looseObject({
|
|
2375
2460
|
providerOptions: ProviderOptionsSchema.optional(),
|
|
2376
|
-
temperature:
|
|
2461
|
+
temperature: import_zod3.z.number().optional()
|
|
2377
2462
|
}).optional()
|
|
2378
2463
|
});
|
|
2379
|
-
var CatalogCapabilitiesSchema =
|
|
2380
|
-
acceptsSourceVideo:
|
|
2381
|
-
framesExcludeReferences:
|
|
2382
|
-
reasoning:
|
|
2383
|
-
vision:
|
|
2384
|
-
contextWindow:
|
|
2464
|
+
var CatalogCapabilitiesSchema = import_zod3.z.looseObject({
|
|
2465
|
+
acceptsSourceVideo: import_zod3.z.boolean().optional(),
|
|
2466
|
+
framesExcludeReferences: import_zod3.z.boolean().optional(),
|
|
2467
|
+
reasoning: import_zod3.z.boolean().optional(),
|
|
2468
|
+
vision: import_zod3.z.boolean().optional(),
|
|
2469
|
+
contextWindow: import_zod3.z.number().optional()
|
|
2385
2470
|
});
|
|
2386
|
-
var CatalogModelSchemaBase =
|
|
2387
|
-
id:
|
|
2388
|
-
aliases:
|
|
2389
|
-
label:
|
|
2471
|
+
var CatalogModelSchemaBase = import_zod3.z.looseObject({
|
|
2472
|
+
id: import_zod3.z.string().min(1),
|
|
2473
|
+
aliases: import_zod3.z.array(import_zod3.z.string()).default([]),
|
|
2474
|
+
label: import_zod3.z.string().min(1),
|
|
2390
2475
|
type: ModelTypeSchema,
|
|
2391
2476
|
adapter: AdapterSchema,
|
|
2392
|
-
providerModelId:
|
|
2477
|
+
providerModelId: import_zod3.z.string().min(1),
|
|
2393
2478
|
lifecycle: LifecycleSchema,
|
|
2394
|
-
replacedBy:
|
|
2479
|
+
replacedBy: import_zod3.z.string().optional(),
|
|
2395
2480
|
exposure: ExposureSchema,
|
|
2396
2481
|
constraints: ModelConstraintsSchema,
|
|
2397
2482
|
defaults: DefaultsSchema,
|
|
2398
2483
|
providerOptions: ProviderOptionsSchema.optional(),
|
|
2399
|
-
usage:
|
|
2484
|
+
usage: import_zod3.z.looseObject({
|
|
2400
2485
|
unit: UsageUnitSchema,
|
|
2401
|
-
slug:
|
|
2402
|
-
providerLabel:
|
|
2486
|
+
slug: import_zod3.z.string().optional(),
|
|
2487
|
+
providerLabel: import_zod3.z.string().optional()
|
|
2403
2488
|
}),
|
|
2404
2489
|
pricingKind: PricingKindSchema,
|
|
2405
2490
|
display: CatalogDisplaySchema.optional(),
|
|
@@ -2450,9 +2535,30 @@ var CatalogModelSchema = CatalogModelSchemaBase.superRefine(
|
|
|
2450
2535
|
}
|
|
2451
2536
|
}
|
|
2452
2537
|
}
|
|
2538
|
+
const audio = row.constraints.audio;
|
|
2539
|
+
if (audio !== void 0 && !AudioOutputSchema.safeParse(audio).success) {
|
|
2540
|
+
ctx.addIssue({
|
|
2541
|
+
code: "custom",
|
|
2542
|
+
path: ["constraints", "audio"],
|
|
2543
|
+
message: 'audio must be "always", "optional" or "never"'
|
|
2544
|
+
});
|
|
2545
|
+
}
|
|
2546
|
+
const prompt = row.constraints.prompt;
|
|
2547
|
+
if (prompt !== void 0) {
|
|
2548
|
+
const parsed = PromptConventionsSchema.safeParse(prompt);
|
|
2549
|
+
if (!parsed.success) {
|
|
2550
|
+
for (const issue of parsed.error.issues) {
|
|
2551
|
+
ctx.addIssue({
|
|
2552
|
+
code: "custom",
|
|
2553
|
+
path: ["constraints", "prompt", ...issue.path.map(String)],
|
|
2554
|
+
message: issue.message
|
|
2555
|
+
});
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2453
2559
|
}
|
|
2454
2560
|
);
|
|
2455
|
-
var CatalogSchema =
|
|
2561
|
+
var CatalogSchema = import_zod3.z.array(CatalogModelSchemaBase.transform((row) => normaliseConventions(row).row)).superRefine((rows, ctx) => {
|
|
2456
2562
|
for (const issue of collisionIssues(rows)) {
|
|
2457
2563
|
ctx.addIssue({
|
|
2458
2564
|
code: "custom",
|
|
@@ -2473,7 +2579,7 @@ var import_xai = require("@ai-sdk/xai");
|
|
|
2473
2579
|
var import_deepseek = require("@ai-sdk/deepseek");
|
|
2474
2580
|
var import_moonshotai = require("@ai-sdk/moonshotai");
|
|
2475
2581
|
var import_ai = require("ai");
|
|
2476
|
-
var
|
|
2582
|
+
var import_zod4 = require("zod");
|
|
2477
2583
|
var TEXT_PROVIDERS = [
|
|
2478
2584
|
"openai",
|
|
2479
2585
|
"anthropic",
|
|
@@ -2484,7 +2590,7 @@ var TEXT_PROVIDERS = [
|
|
|
2484
2590
|
"moonshot",
|
|
2485
2591
|
"minimax"
|
|
2486
2592
|
];
|
|
2487
|
-
var textProviderSchema =
|
|
2593
|
+
var textProviderSchema = import_zod4.z.enum(TEXT_PROVIDERS);
|
|
2488
2594
|
function isTextProvider(value) {
|
|
2489
2595
|
return textProviderSchema.safeParse(value).success;
|
|
2490
2596
|
}
|
|
@@ -2777,24 +2883,24 @@ var aiSdkTextAdapter = {
|
|
|
2777
2883
|
};
|
|
2778
2884
|
|
|
2779
2885
|
// src/adapters/ark.ts
|
|
2780
|
-
var
|
|
2886
|
+
var import_zod7 = require("zod");
|
|
2781
2887
|
|
|
2782
2888
|
// src/retry.ts
|
|
2783
|
-
var
|
|
2889
|
+
var import_zod6 = require("zod");
|
|
2784
2890
|
|
|
2785
2891
|
// src/json.ts
|
|
2786
|
-
var
|
|
2787
|
-
var JsonValueSchema =
|
|
2788
|
-
() =>
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2892
|
+
var import_zod5 = require("zod");
|
|
2893
|
+
var JsonValueSchema = import_zod5.z.lazy(
|
|
2894
|
+
() => import_zod5.z.union([
|
|
2895
|
+
import_zod5.z.string(),
|
|
2896
|
+
import_zod5.z.number(),
|
|
2897
|
+
import_zod5.z.boolean(),
|
|
2898
|
+
import_zod5.z.null(),
|
|
2899
|
+
import_zod5.z.array(JsonValueSchema),
|
|
2900
|
+
import_zod5.z.record(import_zod5.z.string(), JsonValueSchema)
|
|
2795
2901
|
])
|
|
2796
2902
|
);
|
|
2797
|
-
var JsonObjectSchema =
|
|
2903
|
+
var JsonObjectSchema = import_zod5.z.record(import_zod5.z.string(), JsonValueSchema);
|
|
2798
2904
|
async function readErrorBody(res) {
|
|
2799
2905
|
const text2 = await res.text().catch(() => "");
|
|
2800
2906
|
try {
|
|
@@ -2803,11 +2909,11 @@ async function readErrorBody(res) {
|
|
|
2803
2909
|
return text2;
|
|
2804
2910
|
}
|
|
2805
2911
|
}
|
|
2806
|
-
var thrownErrorSchema =
|
|
2807
|
-
message:
|
|
2808
|
-
status:
|
|
2809
|
-
statusCode:
|
|
2810
|
-
responseBody:
|
|
2912
|
+
var thrownErrorSchema = import_zod5.z.object({
|
|
2913
|
+
message: import_zod5.z.string().optional(),
|
|
2914
|
+
status: import_zod5.z.number().optional(),
|
|
2915
|
+
statusCode: import_zod5.z.number().optional(),
|
|
2916
|
+
responseBody: import_zod5.z.string().optional()
|
|
2811
2917
|
});
|
|
2812
2918
|
function describeThrown(cause) {
|
|
2813
2919
|
const parsed = thrownErrorSchema.safeParse(cause);
|
|
@@ -2818,7 +2924,7 @@ function describeThrown(cause) {
|
|
|
2818
2924
|
}
|
|
2819
2925
|
|
|
2820
2926
|
// src/retry.ts
|
|
2821
|
-
var textBody =
|
|
2927
|
+
var textBody = import_zod6.z.string();
|
|
2822
2928
|
function classifyHttpError(status, body, provider, model) {
|
|
2823
2929
|
const asText = textBody.safeParse(body);
|
|
2824
2930
|
const text2 = asText.success ? asText.data : JSON.stringify(body);
|
|
@@ -3077,7 +3183,7 @@ function arkKey(ctx) {
|
|
|
3077
3183
|
return key;
|
|
3078
3184
|
}
|
|
3079
3185
|
function throwArkError(status, body, model) {
|
|
3080
|
-
const parsed =
|
|
3186
|
+
const parsed = import_zod7.z.string().safeParse(body);
|
|
3081
3187
|
const text2 = parsed.success ? parsed.data : JSON.stringify(body ?? "");
|
|
3082
3188
|
if (/sensitive.?content|human.?face/i.test(text2)) {
|
|
3083
3189
|
const init = {
|
|
@@ -3115,13 +3221,13 @@ function sniffedImageMime(bytes) {
|
|
|
3115
3221
|
return "image/webp";
|
|
3116
3222
|
return "image/jpeg";
|
|
3117
3223
|
}
|
|
3118
|
-
var SeedreamImageSchema =
|
|
3119
|
-
url:
|
|
3120
|
-
b64_json:
|
|
3224
|
+
var SeedreamImageSchema = import_zod7.z.object({
|
|
3225
|
+
url: import_zod7.z.string().optional(),
|
|
3226
|
+
b64_json: import_zod7.z.string().optional()
|
|
3121
3227
|
});
|
|
3122
|
-
var SeedreamResponseSchema =
|
|
3123
|
-
data:
|
|
3124
|
-
error:
|
|
3228
|
+
var SeedreamResponseSchema = import_zod7.z.object({
|
|
3229
|
+
data: import_zod7.z.array(SeedreamImageSchema).optional(),
|
|
3230
|
+
error: import_zod7.z.object({ message: import_zod7.z.string().optional(), code: import_zod7.z.string().optional() }).optional()
|
|
3125
3231
|
});
|
|
3126
3232
|
function fetchInitFor(ctx, init) {
|
|
3127
3233
|
if (ctx.signal !== void 0) init.signal = ctx.signal;
|
|
@@ -3203,21 +3309,21 @@ async function generateSeedreamImage(req, ctx) {
|
|
|
3203
3309
|
if (req.quality !== void 0) usage2.imageQuality = req.quality;
|
|
3204
3310
|
return { images: [{ bytes, mime: sniffedImageMime(bytes) }], usage: usage2, raw: data };
|
|
3205
3311
|
}
|
|
3206
|
-
var SeedanceUsageSchema =
|
|
3207
|
-
total_tokens:
|
|
3208
|
-
completion_tokens:
|
|
3312
|
+
var SeedanceUsageSchema = import_zod7.z.object({
|
|
3313
|
+
total_tokens: import_zod7.z.number().optional(),
|
|
3314
|
+
completion_tokens: import_zod7.z.number().optional()
|
|
3209
3315
|
});
|
|
3210
|
-
var SeedanceResponseSchema =
|
|
3211
|
-
id:
|
|
3212
|
-
status:
|
|
3213
|
-
content:
|
|
3316
|
+
var SeedanceResponseSchema = import_zod7.z.object({
|
|
3317
|
+
id: import_zod7.z.string().optional(),
|
|
3318
|
+
status: import_zod7.z.string().optional(),
|
|
3319
|
+
content: import_zod7.z.object({ video_url: import_zod7.z.string().optional() }).optional(),
|
|
3214
3320
|
usage: SeedanceUsageSchema.optional(),
|
|
3215
|
-
duration:
|
|
3216
|
-
framespersecond:
|
|
3217
|
-
resolution:
|
|
3218
|
-
error:
|
|
3321
|
+
duration: import_zod7.z.number().optional(),
|
|
3322
|
+
framespersecond: import_zod7.z.number().optional(),
|
|
3323
|
+
resolution: import_zod7.z.string().optional(),
|
|
3324
|
+
error: import_zod7.z.union([import_zod7.z.string(), import_zod7.z.object({ message: import_zod7.z.string().optional() })]).optional()
|
|
3219
3325
|
});
|
|
3220
|
-
var SeedanceErrorMessageSchema =
|
|
3326
|
+
var SeedanceErrorMessageSchema = import_zod7.z.object({ message: import_zod7.z.string().optional() });
|
|
3221
3327
|
function seedanceUsage(ctx, req, duration) {
|
|
3222
3328
|
const usage2 = {
|
|
3223
3329
|
model: ctx.model.id,
|
|
@@ -3231,7 +3337,7 @@ function seedanceUsage(ctx, req, duration) {
|
|
|
3231
3337
|
return usage2;
|
|
3232
3338
|
}
|
|
3233
3339
|
function seedanceErrorMessage(error, status) {
|
|
3234
|
-
const asString =
|
|
3340
|
+
const asString = import_zod7.z.string().safeParse(error);
|
|
3235
3341
|
if (asString.success) return asString.data;
|
|
3236
3342
|
const asObject = SeedanceErrorMessageSchema.safeParse(error);
|
|
3237
3343
|
if (asObject.success && asObject.data.message !== void 0) return asObject.data.message;
|
|
@@ -3404,18 +3510,18 @@ async function generateSeedanceVideo(req, ctx) {
|
|
|
3404
3510
|
}
|
|
3405
3511
|
|
|
3406
3512
|
// src/adapters/fal.ts
|
|
3407
|
-
var
|
|
3513
|
+
var import_zod9 = require("zod");
|
|
3408
3514
|
var import_client = require("@fal-ai/client");
|
|
3409
3515
|
|
|
3410
3516
|
// src/adapters/fal-http.ts
|
|
3411
|
-
var
|
|
3412
|
-
var queueUrl =
|
|
3413
|
-
var submissionSchema =
|
|
3414
|
-
request_id:
|
|
3517
|
+
var import_zod8 = require("zod");
|
|
3518
|
+
var queueUrl = import_zod8.z.url().refine((value) => new URL(value).origin === "https://queue.fal.run");
|
|
3519
|
+
var submissionSchema = import_zod8.z.object({
|
|
3520
|
+
request_id: import_zod8.z.string(),
|
|
3415
3521
|
status_url: queueUrl,
|
|
3416
3522
|
response_url: queueUrl
|
|
3417
3523
|
});
|
|
3418
|
-
var statusSchema =
|
|
3524
|
+
var statusSchema = import_zod8.z.object({ status: import_zod8.z.string() });
|
|
3419
3525
|
function createFalHttpClient(opts) {
|
|
3420
3526
|
const jobs = /* @__PURE__ */ new Map();
|
|
3421
3527
|
async function request(url, input, signal) {
|
|
@@ -3499,7 +3605,7 @@ var KLING_O1_ENDPOINT = "fal-ai/kling-video/o1/video-to-video/reference";
|
|
|
3499
3605
|
var FAL_QUEUE_HOST = "https://queue.fal.run";
|
|
3500
3606
|
var PASSTHROUGH_POLL_MS = 2e3;
|
|
3501
3607
|
var PASSTHROUGH_MAX_WAIT_MS = 18e4;
|
|
3502
|
-
var falSubscribePayloadSchema =
|
|
3608
|
+
var falSubscribePayloadSchema = import_zod9.z.object({ data: JsonValueSchema });
|
|
3503
3609
|
function defaultCreateFalClient(opts) {
|
|
3504
3610
|
if (opts.maxRetries !== void 0)
|
|
3505
3611
|
return createFalHttpClient({
|
|
@@ -3555,7 +3661,7 @@ function createFalAdapter(deps = defaultDeps) {
|
|
|
3555
3661
|
};
|
|
3556
3662
|
}
|
|
3557
3663
|
var falAdapter = createFalAdapter();
|
|
3558
|
-
var falDetailSchema =
|
|
3664
|
+
var falDetailSchema = import_zod9.z.object({ detail: JsonValueSchema });
|
|
3559
3665
|
function liftDetail(body) {
|
|
3560
3666
|
const parsed = falDetailSchema.safeParse(body);
|
|
3561
3667
|
const detail = parsed.success ? parsed.data.detail : void 0;
|
|
@@ -3564,11 +3670,11 @@ function liftDetail(body) {
|
|
|
3564
3670
|
function falError(status, body, model) {
|
|
3565
3671
|
return classifyHttpError(status, liftDetail(body), "fal", model);
|
|
3566
3672
|
}
|
|
3567
|
-
var falSdkThrownSchema =
|
|
3568
|
-
status:
|
|
3569
|
-
statusCode:
|
|
3673
|
+
var falSdkThrownSchema = import_zod9.z.object({
|
|
3674
|
+
status: import_zod9.z.number().optional(),
|
|
3675
|
+
statusCode: import_zod9.z.number().optional(),
|
|
3570
3676
|
body: JsonValueSchema.optional(),
|
|
3571
|
-
message:
|
|
3677
|
+
message: import_zod9.z.string().optional()
|
|
3572
3678
|
});
|
|
3573
3679
|
function falSdkError(cause, model) {
|
|
3574
3680
|
const parsed = falSdkThrownSchema.safeParse(cause);
|
|
@@ -3616,12 +3722,12 @@ async function gatewayFetch(cfg, fetchImpl, targetUrl, init) {
|
|
|
3616
3722
|
if (init.body !== void 0) request.body = init.body;
|
|
3617
3723
|
return fetchImpl(cfg.baseUrl, request);
|
|
3618
3724
|
}
|
|
3619
|
-
var falQueueSubmitSchema =
|
|
3620
|
-
request_id:
|
|
3621
|
-
status_url:
|
|
3622
|
-
response_url:
|
|
3725
|
+
var falQueueSubmitSchema = import_zod9.z.object({
|
|
3726
|
+
request_id: import_zod9.z.string(),
|
|
3727
|
+
status_url: import_zod9.z.string(),
|
|
3728
|
+
response_url: import_zod9.z.string()
|
|
3623
3729
|
});
|
|
3624
|
-
var falQueueStatusSchema =
|
|
3730
|
+
var falQueueStatusSchema = import_zod9.z.object({ status: import_zod9.z.string() });
|
|
3625
3731
|
async function passthroughRequest(ctx, endpoint, input) {
|
|
3626
3732
|
const cfg = gatewayConfig(ctx);
|
|
3627
3733
|
const submitRes = await gatewayFetch(cfg, ctx.fetch, `${FAL_QUEUE_HOST}/${endpoint}`, {
|
|
@@ -3754,11 +3860,11 @@ async function decodeImage(ctx, url, contentType) {
|
|
|
3754
3860
|
const mime = res.headers.get("content-type") ?? contentType ?? "image/png";
|
|
3755
3861
|
return { bytes: new Uint8Array(await res.arrayBuffer()), mime };
|
|
3756
3862
|
}
|
|
3757
|
-
var museImageResultSchema =
|
|
3758
|
-
images:
|
|
3759
|
-
|
|
3760
|
-
url:
|
|
3761
|
-
content_type:
|
|
3863
|
+
var museImageResultSchema = import_zod9.z.object({
|
|
3864
|
+
images: import_zod9.z.array(
|
|
3865
|
+
import_zod9.z.object({
|
|
3866
|
+
url: import_zod9.z.string().optional(),
|
|
3867
|
+
content_type: import_zod9.z.string().nullable().optional()
|
|
3762
3868
|
})
|
|
3763
3869
|
).optional()
|
|
3764
3870
|
});
|
|
@@ -3862,8 +3968,8 @@ function klingO1Input(req) {
|
|
|
3862
3968
|
if (refs.length > 0) input.image_urls = refs;
|
|
3863
3969
|
return input;
|
|
3864
3970
|
}
|
|
3865
|
-
var falVideoResultSchema =
|
|
3866
|
-
video:
|
|
3971
|
+
var falVideoResultSchema = import_zod9.z.object({
|
|
3972
|
+
video: import_zod9.z.object({ url: import_zod9.z.string().optional() }).optional()
|
|
3867
3973
|
});
|
|
3868
3974
|
function extractVideoUrl(result, endpoint, model) {
|
|
3869
3975
|
const parsed = falVideoResultSchema.safeParse(result);
|
|
@@ -4064,11 +4170,11 @@ async function passthroughVideoJob(ctx, req, endpoint, input) {
|
|
|
4064
4170
|
}
|
|
4065
4171
|
|
|
4066
4172
|
// src/adapters/google-genai.ts
|
|
4067
|
-
var
|
|
4173
|
+
var import_zod11 = require("zod");
|
|
4068
4174
|
var import_genai = require("@google/genai");
|
|
4069
4175
|
|
|
4070
4176
|
// src/adapters/google-files.ts
|
|
4071
|
-
var
|
|
4177
|
+
var import_zod10 = require("zod");
|
|
4072
4178
|
var GOOGLE_FILES_BASE = "https://generativelanguage.googleapis.com";
|
|
4073
4179
|
var GOOGLE_FILES_POLL_INTERVAL_MS = 2e3;
|
|
4074
4180
|
var GOOGLE_FILES_POLL_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
@@ -4078,17 +4184,17 @@ var GENERIC_MEDIA_TYPES = /* @__PURE__ */ new Set([
|
|
|
4078
4184
|
"binary/octet-stream",
|
|
4079
4185
|
"application/binary"
|
|
4080
4186
|
]);
|
|
4081
|
-
var uploadedFileSchema =
|
|
4082
|
-
file:
|
|
4083
|
-
uri:
|
|
4084
|
-
name:
|
|
4085
|
-
state:
|
|
4086
|
-
mimeType:
|
|
4187
|
+
var uploadedFileSchema = import_zod10.z.object({
|
|
4188
|
+
file: import_zod10.z.object({
|
|
4189
|
+
uri: import_zod10.z.string().optional(),
|
|
4190
|
+
name: import_zod10.z.string().optional(),
|
|
4191
|
+
state: import_zod10.z.string().optional(),
|
|
4192
|
+
mimeType: import_zod10.z.string().optional()
|
|
4087
4193
|
}).optional()
|
|
4088
4194
|
});
|
|
4089
|
-
var fileStateSchema =
|
|
4090
|
-
state:
|
|
4091
|
-
error:
|
|
4195
|
+
var fileStateSchema = import_zod10.z.object({
|
|
4196
|
+
state: import_zod10.z.string().optional(),
|
|
4197
|
+
error: import_zod10.z.object({ message: import_zod10.z.string().optional() }).optional()
|
|
4092
4198
|
});
|
|
4093
4199
|
function resolveMime(declared, fallback) {
|
|
4094
4200
|
const clean = declared?.split(";")[0]?.trim().toLowerCase();
|
|
@@ -4305,7 +4411,7 @@ var OMNI_POLL_INTERVAL_MS = 1e4;
|
|
|
4305
4411
|
var RESULT_TIMEOUT_MS2 = 15 * 60 * 1e3;
|
|
4306
4412
|
var OMNI_INLINE_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
4307
4413
|
var MEDIA_PART_INLINE_LIMIT_BYTES = 20 * 1024 * 1024;
|
|
4308
|
-
var errorTextSchema =
|
|
4414
|
+
var errorTextSchema = import_zod11.z.string();
|
|
4309
4415
|
function isGoogleGenaiVideoKnown(providerModelId) {
|
|
4310
4416
|
return providerModelId.startsWith("veo-") || providerModelId.startsWith("gemini-omni");
|
|
4311
4417
|
}
|
|
@@ -4914,15 +5020,15 @@ async function prepareGoogleMediaPart(ref, mediaType, ctx) {
|
|
|
4914
5020
|
// src/adapters/google-image.ts
|
|
4915
5021
|
var import_google2 = require("@ai-sdk/google");
|
|
4916
5022
|
var import_ai2 = require("ai");
|
|
4917
|
-
var
|
|
5023
|
+
var import_zod12 = require("zod");
|
|
4918
5024
|
var GEMINI_IMAGE_TIMEOUT_MS = 6e5;
|
|
4919
5025
|
var defaultGoogleImageDeps = {
|
|
4920
5026
|
createGoogleClient: (opts) => (0, import_google2.createGoogleGenerativeAI)(opts),
|
|
4921
5027
|
runTextGeneration: (opts) => (0, import_ai2.generateText)(opts)
|
|
4922
5028
|
};
|
|
4923
|
-
var causeChainNodeSchema =
|
|
4924
|
-
message:
|
|
4925
|
-
cause:
|
|
5029
|
+
var causeChainNodeSchema = import_zod12.z.object({
|
|
5030
|
+
message: import_zod12.z.string().optional(),
|
|
5031
|
+
cause: import_zod12.z.unknown().optional()
|
|
4926
5032
|
});
|
|
4927
5033
|
function extractBlockReason(cause) {
|
|
4928
5034
|
let current = cause;
|
|
@@ -5042,7 +5148,7 @@ function createGoogleImageAdapter(deps = defaultGoogleImageDeps) {
|
|
|
5042
5148
|
var googleImageAdapter = createGoogleImageAdapter();
|
|
5043
5149
|
|
|
5044
5150
|
// src/adapters/higgsfield.ts
|
|
5045
|
-
var
|
|
5151
|
+
var import_zod13 = require("zod");
|
|
5046
5152
|
|
|
5047
5153
|
// src/adapters/higgsfield-motions.ts
|
|
5048
5154
|
var MOTION_MAP = {
|
|
@@ -5241,14 +5347,14 @@ function videoUsage3(ctx, req, duration) {
|
|
|
5241
5347
|
if (req.durationSeconds !== void 0) event.durationSeconds = req.durationSeconds;
|
|
5242
5348
|
return event;
|
|
5243
5349
|
}
|
|
5244
|
-
var klingCreateSchema =
|
|
5245
|
-
var klingStatusSchema =
|
|
5246
|
-
status:
|
|
5247
|
-
video:
|
|
5350
|
+
var klingCreateSchema = import_zod13.z.object({ status_url: import_zod13.z.string() });
|
|
5351
|
+
var klingStatusSchema = import_zod13.z.object({
|
|
5352
|
+
status: import_zod13.z.string().optional(),
|
|
5353
|
+
video: import_zod13.z.object({ url: import_zod13.z.string().optional() }).optional(),
|
|
5248
5354
|
error: JsonValueSchema.optional()
|
|
5249
5355
|
});
|
|
5250
|
-
var errorMessageSchema =
|
|
5251
|
-
var textValueSchema =
|
|
5356
|
+
var errorMessageSchema = import_zod13.z.object({ message: import_zod13.z.string().optional() });
|
|
5357
|
+
var textValueSchema = import_zod13.z.string();
|
|
5252
5358
|
function klingErrorDetail(error) {
|
|
5253
5359
|
if (error === void 0) return "unknown_error";
|
|
5254
5360
|
const asText = textValueSchema.safeParse(error);
|
|
@@ -5384,8 +5490,8 @@ async function generateKlingVideo(req, ctx) {
|
|
|
5384
5490
|
}
|
|
5385
5491
|
};
|
|
5386
5492
|
}
|
|
5387
|
-
var dopMotionOptionsSchema =
|
|
5388
|
-
modelkit:
|
|
5493
|
+
var dopMotionOptionsSchema = import_zod13.z.object({
|
|
5494
|
+
modelkit: import_zod13.z.object({ motion: import_zod13.z.string().optional() }).optional()
|
|
5389
5495
|
});
|
|
5390
5496
|
function dopMotionId(ctx) {
|
|
5391
5497
|
const parsed = dopMotionOptionsSchema.safeParse(ctx.model.providerOptions);
|
|
@@ -5401,7 +5507,7 @@ function dopMotionId(ctx) {
|
|
|
5401
5507
|
});
|
|
5402
5508
|
return id;
|
|
5403
5509
|
}
|
|
5404
|
-
var jsonRecordSchema =
|
|
5510
|
+
var jsonRecordSchema = import_zod13.z.record(import_zod13.z.string(), JsonValueSchema);
|
|
5405
5511
|
var DOP_URL_KEYS = ["url", "video_url", "output_url", "result_url", "download_url"];
|
|
5406
5512
|
var DOP_NESTED_KEYS = ["video", "result", "results"];
|
|
5407
5513
|
function dopUrl(body) {
|
|
@@ -5429,8 +5535,8 @@ function dopUrl(body) {
|
|
|
5429
5535
|
}
|
|
5430
5536
|
return void 0;
|
|
5431
5537
|
}
|
|
5432
|
-
var dopCreateSchema =
|
|
5433
|
-
var dopStatusSchema =
|
|
5538
|
+
var dopCreateSchema = import_zod13.z.object({ id: import_zod13.z.string() });
|
|
5539
|
+
var dopStatusSchema = import_zod13.z.object({ status: import_zod13.z.string().optional() });
|
|
5434
5540
|
async function generateDopVideo(req, ctx) {
|
|
5435
5541
|
const firstFrame = req.firstFrame ? refToUrl(req.firstFrame) : void 0;
|
|
5436
5542
|
if (!firstFrame) {
|
|
@@ -5558,7 +5664,7 @@ var higgsfieldAdapter = {
|
|
|
5558
5664
|
|
|
5559
5665
|
// src/adapters/openai-image.ts
|
|
5560
5666
|
var import_openai2 = __toESM(require("openai"), 1);
|
|
5561
|
-
var
|
|
5667
|
+
var import_zod14 = require("zod");
|
|
5562
5668
|
var MAX_EDIT_REFERENCES = 16;
|
|
5563
5669
|
function aspectRatioToSize(ratio, tier) {
|
|
5564
5670
|
const TIER_LONG_EDGE = {
|
|
@@ -5641,9 +5747,9 @@ function toProviderError2(cause, ctx) {
|
|
|
5641
5747
|
ctx.model.id
|
|
5642
5748
|
);
|
|
5643
5749
|
}
|
|
5644
|
-
var openaiUsageSchema =
|
|
5645
|
-
input_tokens:
|
|
5646
|
-
output_tokens:
|
|
5750
|
+
var openaiUsageSchema = import_zod14.z.object({
|
|
5751
|
+
input_tokens: import_zod14.z.number().optional(),
|
|
5752
|
+
output_tokens: import_zod14.z.number().optional()
|
|
5647
5753
|
});
|
|
5648
5754
|
var openaiImageAdapter = {
|
|
5649
5755
|
id: "openai-image",
|
|
@@ -6054,13 +6160,13 @@ var prodiaAdapter = {
|
|
|
6054
6160
|
var import_replicate = __toESM(require("replicate"), 1);
|
|
6055
6161
|
|
|
6056
6162
|
// src/adapters/replicate-http.ts
|
|
6057
|
-
var
|
|
6058
|
-
var predictionSchema =
|
|
6059
|
-
id:
|
|
6060
|
-
status:
|
|
6163
|
+
var import_zod15 = require("zod");
|
|
6164
|
+
var predictionSchema = import_zod15.z.object({
|
|
6165
|
+
id: import_zod15.z.string(),
|
|
6166
|
+
status: import_zod15.z.string(),
|
|
6061
6167
|
output: JsonValueSchema.optional(),
|
|
6062
6168
|
error: JsonValueSchema.optional(),
|
|
6063
|
-
metrics:
|
|
6169
|
+
metrics: import_zod15.z.object({ predict_time: import_zod15.z.number().optional() }).optional()
|
|
6064
6170
|
});
|
|
6065
6171
|
function createReplicateHttpClient(opts) {
|
|
6066
6172
|
async function request(path, body, signal) {
|
|
@@ -6111,7 +6217,7 @@ function createReplicateHttpClient(opts) {
|
|
|
6111
6217
|
}
|
|
6112
6218
|
|
|
6113
6219
|
// src/adapters/replicate.ts
|
|
6114
|
-
var
|
|
6220
|
+
var import_zod16 = require("zod");
|
|
6115
6221
|
|
|
6116
6222
|
// src/adapters/input-spec-mapper.ts
|
|
6117
6223
|
function canonicalValue(req, key) {
|
|
@@ -6186,8 +6292,8 @@ function route(providerModelId) {
|
|
|
6186
6292
|
if (!providerModelId.includes("/")) return { version: providerModelId };
|
|
6187
6293
|
return { model: providerModelId };
|
|
6188
6294
|
}
|
|
6189
|
-
var replicateResponseStatusSchema =
|
|
6190
|
-
response:
|
|
6295
|
+
var replicateResponseStatusSchema = import_zod16.z.object({
|
|
6296
|
+
response: import_zod16.z.object({ status: import_zod16.z.number() }).partial()
|
|
6191
6297
|
});
|
|
6192
6298
|
function replicateError(cause, ctx) {
|
|
6193
6299
|
if (isModelKitError(cause)) return cause;
|
|
@@ -6214,7 +6320,7 @@ function isUrlFn(value) {
|
|
|
6214
6320
|
function extractOutputUrl(output) {
|
|
6215
6321
|
const root = Array.isArray(output) ? output[0] : output;
|
|
6216
6322
|
if (root === void 0) throw noOutput();
|
|
6217
|
-
const asString =
|
|
6323
|
+
const asString = import_zod16.z.string().safeParse(root);
|
|
6218
6324
|
if (asString.success && asString.data) return asString.data;
|
|
6219
6325
|
if (root instanceof URL) return root.href;
|
|
6220
6326
|
if (isObjectOutput(root)) {
|
|
@@ -6223,15 +6329,15 @@ function extractOutputUrl(output) {
|
|
|
6223
6329
|
if (urlValue !== void 0 && isUrlFn(urlValue)) {
|
|
6224
6330
|
const called = urlValue();
|
|
6225
6331
|
if (called instanceof URL) return called.href;
|
|
6226
|
-
const calledString =
|
|
6332
|
+
const calledString = import_zod16.z.string().safeParse(called);
|
|
6227
6333
|
if (calledString.success && calledString.data) return calledString.data;
|
|
6228
6334
|
} else {
|
|
6229
|
-
const direct =
|
|
6335
|
+
const direct = import_zod16.z.string().safeParse(urlValue);
|
|
6230
6336
|
if (direct.success && direct.data) return direct.data;
|
|
6231
6337
|
}
|
|
6232
6338
|
}
|
|
6233
6339
|
if ("default" in root) {
|
|
6234
|
-
const fallback =
|
|
6340
|
+
const fallback = import_zod16.z.string().safeParse(root.default);
|
|
6235
6341
|
if (fallback.success && fallback.data) return fallback.data;
|
|
6236
6342
|
}
|
|
6237
6343
|
}
|
|
@@ -6292,7 +6398,7 @@ async function runPrediction(ctx, input, deps) {
|
|
|
6292
6398
|
}
|
|
6293
6399
|
return void 0;
|
|
6294
6400
|
}, pollOpts);
|
|
6295
|
-
const predictTime =
|
|
6401
|
+
const predictTime = import_zod16.z.number().safeParse(done.metrics?.predict_time);
|
|
6296
6402
|
if (done.output === void 0) throw noOutput();
|
|
6297
6403
|
return {
|
|
6298
6404
|
url: extractOutputUrl(done.output),
|
|
@@ -6677,7 +6783,7 @@ async function generateReplicateVideo(req, ctx, deps) {
|
|
|
6677
6783
|
throw replicateError(cause, ctx);
|
|
6678
6784
|
}
|
|
6679
6785
|
if (current.status === "succeeded") {
|
|
6680
|
-
const predictTime =
|
|
6786
|
+
const predictTime = import_zod16.z.number().safeParse(current.metrics?.predict_time);
|
|
6681
6787
|
if (current.output === void 0) throw noOutput();
|
|
6682
6788
|
return {
|
|
6683
6789
|
url: extractOutputUrl(current.output),
|
|
@@ -6818,7 +6924,7 @@ async function generateReplicateAudio(req, ctx, deps) {
|
|
|
6818
6924
|
// src/adapters/xai-video.ts
|
|
6819
6925
|
var import_ai3 = require("ai");
|
|
6820
6926
|
var import_xai2 = require("@ai-sdk/xai");
|
|
6821
|
-
var
|
|
6927
|
+
var import_zod17 = require("zod");
|
|
6822
6928
|
var POLL_INTERVAL_MS2 = 1e4;
|
|
6823
6929
|
var POLL_TIMEOUT_MS2 = 15 * 6e4;
|
|
6824
6930
|
var defaultXaiDeps = {
|
|
@@ -6831,8 +6937,8 @@ function createXaiVideoAdapter(deps = defaultXaiDeps) {
|
|
|
6831
6937
|
};
|
|
6832
6938
|
}
|
|
6833
6939
|
var xaiVideoAdapter = createXaiVideoAdapter();
|
|
6834
|
-
var xaiResponseStatusSchema =
|
|
6835
|
-
response:
|
|
6940
|
+
var xaiResponseStatusSchema = import_zod17.z.object({
|
|
6941
|
+
response: import_zod17.z.object({ status: import_zod17.z.number() }).partial()
|
|
6836
6942
|
});
|
|
6837
6943
|
function xaiError(cause, ctx) {
|
|
6838
6944
|
const info = describeThrown(cause);
|
|
@@ -6840,12 +6946,12 @@ function xaiError(cause, ctx) {
|
|
|
6840
6946
|
const status = info.status ?? (nested.success ? nested.data.response?.status : void 0);
|
|
6841
6947
|
return classifyThrown("xai-video", cause, ctx.model.id, { status, body: info.body });
|
|
6842
6948
|
}
|
|
6843
|
-
var xaiMetaSchema =
|
|
6949
|
+
var xaiMetaSchema = import_zod17.z.object({
|
|
6844
6950
|
videoUrl: JsonValueSchema.optional(),
|
|
6845
6951
|
costInUsdTicks: JsonValueSchema.optional(),
|
|
6846
6952
|
duration: JsonValueSchema.optional()
|
|
6847
6953
|
});
|
|
6848
|
-
var xaiProviderMetadataSchema =
|
|
6954
|
+
var xaiProviderMetadataSchema = import_zod17.z.object({ xai: xaiMetaSchema });
|
|
6849
6955
|
function metaOf(result) {
|
|
6850
6956
|
const parsed = xaiProviderMetadataSchema.partial().safeParse(result.providerMetadata);
|
|
6851
6957
|
if (!parsed.success) return {};
|
|
@@ -6953,7 +7059,7 @@ async function mapResult(ctx, req, result) {
|
|
|
6953
7059
|
};
|
|
6954
7060
|
}
|
|
6955
7061
|
const meta = metaOf(result);
|
|
6956
|
-
const videoUrl =
|
|
7062
|
+
const videoUrl = import_zod17.z.string().safeParse(meta.videoUrl);
|
|
6957
7063
|
if (videoUrl.success && videoUrl.data) {
|
|
6958
7064
|
const res = await ctx.fetch(videoUrl.data);
|
|
6959
7065
|
if (!res.ok) {
|
|
@@ -6976,7 +7082,7 @@ async function mapResult(ctx, req, result) {
|
|
|
6976
7082
|
});
|
|
6977
7083
|
}
|
|
6978
7084
|
function usage(ctx, req, meta) {
|
|
6979
|
-
const costTicks =
|
|
7085
|
+
const costTicks = import_zod17.z.number().safeParse(meta.costInUsdTicks);
|
|
6980
7086
|
const cost = costTicks.success ? costTicks.data / 1e10 : void 0;
|
|
6981
7087
|
const event = {
|
|
6982
7088
|
model: ctx.model.id,
|
|
@@ -7109,22 +7215,22 @@ var liveState = store[KEY] ??= {
|
|
|
7109
7215
|
var liveCatalog = liveState.catalog;
|
|
7110
7216
|
|
|
7111
7217
|
// src/catalog/load.ts
|
|
7112
|
-
var
|
|
7218
|
+
var import_zod18 = require("zod");
|
|
7113
7219
|
function rowCount() {
|
|
7114
7220
|
return liveCatalog.list({ lifecycle: ["active", "deprecated", "retired"] }).length;
|
|
7115
7221
|
}
|
|
7116
7222
|
function authHeaders(auth) {
|
|
7117
7223
|
return "bearer" in auth ? { Authorization: `Bearer ${auth.bearer}` } : { "x-api-key": auth.apiKey };
|
|
7118
7224
|
}
|
|
7119
|
-
var EnvelopeSchema =
|
|
7120
|
-
rows:
|
|
7121
|
-
revision:
|
|
7225
|
+
var EnvelopeSchema = import_zod18.z.object({
|
|
7226
|
+
rows: import_zod18.z.array(JsonValueSchema),
|
|
7227
|
+
revision: import_zod18.z.string().optional()
|
|
7122
7228
|
});
|
|
7123
7229
|
function dropReason(path, message) {
|
|
7124
7230
|
return path.length === 0 ? message : `${path.map((part) => String(part)).join(".")} ${message}`;
|
|
7125
7231
|
}
|
|
7126
7232
|
function rowId(raw) {
|
|
7127
|
-
const parsed =
|
|
7233
|
+
const parsed = import_zod18.z.object({ id: import_zod18.z.string().min(1) }).loose().safeParse(raw);
|
|
7128
7234
|
if (!parsed.success) return "?";
|
|
7129
7235
|
return parsed.data.id;
|
|
7130
7236
|
}
|
|
@@ -7152,7 +7258,13 @@ function quarantine(rawRows, logger) {
|
|
|
7152
7258
|
);
|
|
7153
7259
|
}
|
|
7154
7260
|
}
|
|
7155
|
-
|
|
7261
|
+
const normalised = normaliseConventions(row);
|
|
7262
|
+
if (normalised.invalidKeys.length > 0) {
|
|
7263
|
+
logger.warn(
|
|
7264
|
+
`[modelkit] catalog row ${row.id} has an invalid ${normalised.invalidKeys.join(", ")}; read as not set`
|
|
7265
|
+
);
|
|
7266
|
+
}
|
|
7267
|
+
valid.push(normalised.row);
|
|
7156
7268
|
}
|
|
7157
7269
|
let kept = valid;
|
|
7158
7270
|
for (; ; ) {
|
|
@@ -7945,7 +8057,7 @@ function createTextSteps(initial, resolve, callerProviderOptions) {
|
|
|
7945
8057
|
|
|
7946
8058
|
// src/client.ts
|
|
7947
8059
|
var import_ai5 = require("ai");
|
|
7948
|
-
var
|
|
8060
|
+
var import_zod19 = require("zod");
|
|
7949
8061
|
|
|
7950
8062
|
// src/generated-image.ts
|
|
7951
8063
|
function toGeneratedImage(image) {
|
|
@@ -8020,10 +8132,10 @@ function textAbortOptions(sdk, context) {
|
|
|
8020
8132
|
if (abortSignal) return { abortSignal };
|
|
8021
8133
|
return {};
|
|
8022
8134
|
}
|
|
8023
|
-
var catalogId =
|
|
8024
|
-
var exactSize =
|
|
8025
|
-
var sdkRatio =
|
|
8026
|
-
var sizeTier =
|
|
8135
|
+
var catalogId = import_zod19.z.string();
|
|
8136
|
+
var exactSize = import_zod19.z.templateLiteral([import_zod19.z.number(), "x", import_zod19.z.number()]);
|
|
8137
|
+
var sdkRatio = import_zod19.z.templateLiteral([import_zod19.z.number(), ":", import_zod19.z.number()]);
|
|
8138
|
+
var sizeTier = import_zod19.z.enum(["512", "1K", "2K", "4K"]);
|
|
8027
8139
|
function isCatalogId(model) {
|
|
8028
8140
|
return catalogId.safeParse(model).success;
|
|
8029
8141
|
}
|