@shop-os/modelkit 0.3.3 → 0.3.5
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 +19 -0
- package/dist/catalog.cjs +69 -8
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +10 -1
- package/dist/catalog.d.ts +10 -1
- package/dist/catalog.js +69 -8
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +80 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +80 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2132,8 +2132,16 @@ var VIDEO_MODELS = [
|
|
|
2132
2132
|
|
|
2133
2133
|
// src/catalog/video-tools.ts
|
|
2134
2134
|
var TOPAZ_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/topazlabs.png";
|
|
2135
|
+
var FLUX_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/flux.png";
|
|
2135
2136
|
var TOPAZ_SOURCE_SECONDS = { max: 300 };
|
|
2136
|
-
var
|
|
2137
|
+
var SECONDS_USAGE = { unit: "seconds" };
|
|
2138
|
+
var FLUX_SOURCE_SECONDS = { max: 20 };
|
|
2139
|
+
var FLUX_UPSCALE_TOOL = {
|
|
2140
|
+
kind: "upscale",
|
|
2141
|
+
upscaleFactor: { min: 1.5, max: 3 },
|
|
2142
|
+
maxOutputLongEdge: 3840,
|
|
2143
|
+
prompt: true
|
|
2144
|
+
};
|
|
2137
2145
|
var VIDEO_TOOL_MODELS = [
|
|
2138
2146
|
{
|
|
2139
2147
|
id: "topaz-precision",
|
|
@@ -2143,7 +2151,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2143
2151
|
adapter: "fal",
|
|
2144
2152
|
providerModelId: "topaz/upscale/video/precision",
|
|
2145
2153
|
lifecycle: "active",
|
|
2146
|
-
exposure: ["cowork"],
|
|
2154
|
+
exposure: ["cowork", "space_builder"],
|
|
2147
2155
|
constraints: {
|
|
2148
2156
|
supports: [],
|
|
2149
2157
|
sourceVideoSeconds: TOPAZ_SOURCE_SECONDS,
|
|
@@ -2151,7 +2159,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2151
2159
|
},
|
|
2152
2160
|
defaults: {},
|
|
2153
2161
|
providerOptions: { fal: { model: "Proteus" } },
|
|
2154
|
-
usage:
|
|
2162
|
+
usage: SECONDS_USAGE,
|
|
2155
2163
|
pricingKind: "video_per_second",
|
|
2156
2164
|
display: {
|
|
2157
2165
|
provider: "topaz",
|
|
@@ -2168,7 +2176,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2168
2176
|
adapter: "fal",
|
|
2169
2177
|
providerModelId: "topaz/upscale/video/generative",
|
|
2170
2178
|
lifecycle: "active",
|
|
2171
|
-
exposure: ["cowork"],
|
|
2179
|
+
exposure: ["cowork", "space_builder"],
|
|
2172
2180
|
constraints: {
|
|
2173
2181
|
supports: [],
|
|
2174
2182
|
sourceVideoSeconds: TOPAZ_SOURCE_SECONDS,
|
|
@@ -2176,7 +2184,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2176
2184
|
},
|
|
2177
2185
|
defaults: {},
|
|
2178
2186
|
providerOptions: { fal: { model: "Starlight Precise 2.6" } },
|
|
2179
|
-
usage:
|
|
2187
|
+
usage: SECONDS_USAGE,
|
|
2180
2188
|
pricingKind: "video_per_second",
|
|
2181
2189
|
display: {
|
|
2182
2190
|
provider: "topaz",
|
|
@@ -2201,7 +2209,7 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2201
2209
|
},
|
|
2202
2210
|
defaults: {},
|
|
2203
2211
|
providerOptions: { fal: { model: "Apollo" } },
|
|
2204
|
-
usage:
|
|
2212
|
+
usage: SECONDS_USAGE,
|
|
2205
2213
|
pricingKind: "video_per_second",
|
|
2206
2214
|
display: {
|
|
2207
2215
|
provider: "topaz",
|
|
@@ -2224,13 +2232,63 @@ var VIDEO_TOOL_MODELS = [
|
|
|
2224
2232
|
tool: { kind: "hdr", outputFormats: ["h265", "prores"] }
|
|
2225
2233
|
},
|
|
2226
2234
|
defaults: {},
|
|
2227
|
-
usage:
|
|
2235
|
+
usage: SECONDS_USAGE,
|
|
2228
2236
|
pricingKind: "video_per_second",
|
|
2229
2237
|
display: {
|
|
2230
2238
|
provider: "topaz",
|
|
2231
2239
|
logo: TOPAZ_LOGO,
|
|
2232
2240
|
description: "Topaz Hyperion 2.5 SDR to HDR: a 10-bit HDR master in H.265 (HDR10) or ProRes 422 HQ, at the source's size and frame rate."
|
|
2233
2241
|
}
|
|
2242
|
+
},
|
|
2243
|
+
{
|
|
2244
|
+
id: "flux-video-upscale-precise",
|
|
2245
|
+
aliases: [],
|
|
2246
|
+
label: "FLUX Upscale Precise",
|
|
2247
|
+
type: "video-tool",
|
|
2248
|
+
adapter: "fal",
|
|
2249
|
+
providerModelId: "blackforestlabs/flux-video-upscale",
|
|
2250
|
+
lifecycle: "active",
|
|
2251
|
+
exposure: ["space_builder"],
|
|
2252
|
+
constraints: {
|
|
2253
|
+
supports: [],
|
|
2254
|
+
sourceVideoSeconds: FLUX_SOURCE_SECONDS,
|
|
2255
|
+
tool: FLUX_UPSCALE_TOOL
|
|
2256
|
+
},
|
|
2257
|
+
defaults: {},
|
|
2258
|
+
providerOptions: { fal: { input: { creativity: 0 } } },
|
|
2259
|
+
usage: SECONDS_USAGE,
|
|
2260
|
+
pricingKind: "video_per_second",
|
|
2261
|
+
display: {
|
|
2262
|
+
provider: "black-forest-labs",
|
|
2263
|
+
logo: FLUX_LOGO,
|
|
2264
|
+
description: "FLUX 3 super-resolution, source-faithful: 1.5x to 3x, up to 4K, for clips up to 20 seconds.",
|
|
2265
|
+
sortOrder: 30
|
|
2266
|
+
}
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
id: "flux-video-upscale-creative",
|
|
2270
|
+
aliases: [],
|
|
2271
|
+
label: "FLUX Upscale Creative",
|
|
2272
|
+
type: "video-tool",
|
|
2273
|
+
adapter: "fal",
|
|
2274
|
+
providerModelId: "blackforestlabs/flux-video-upscale",
|
|
2275
|
+
lifecycle: "active",
|
|
2276
|
+
exposure: ["space_builder"],
|
|
2277
|
+
constraints: {
|
|
2278
|
+
supports: [],
|
|
2279
|
+
sourceVideoSeconds: FLUX_SOURCE_SECONDS,
|
|
2280
|
+
tool: FLUX_UPSCALE_TOOL
|
|
2281
|
+
},
|
|
2282
|
+
defaults: {},
|
|
2283
|
+
providerOptions: { fal: { input: { creativity: 1 } } },
|
|
2284
|
+
usage: SECONDS_USAGE,
|
|
2285
|
+
pricingKind: "video_per_second",
|
|
2286
|
+
display: {
|
|
2287
|
+
provider: "black-forest-labs",
|
|
2288
|
+
logo: FLUX_LOGO,
|
|
2289
|
+
description: "FLUX 3 super-resolution that adds fine detail, optionally guided by a prompt: 1.5x to 3x, up to 4K, for clips up to 20 seconds. Costs more than Precise.",
|
|
2290
|
+
sortOrder: 40
|
|
2291
|
+
}
|
|
2234
2292
|
}
|
|
2235
2293
|
];
|
|
2236
2294
|
|
|
@@ -2731,6 +2789,7 @@ var VideoToolConstraintsSchema = import_zod3.z.looseObject({
|
|
|
2731
2789
|
kind: import_zod3.z.enum(["upscale", "interpolate", "hdr"]),
|
|
2732
2790
|
upscaleFactor: RangeSchema.optional(),
|
|
2733
2791
|
maxOutputLongEdge: import_zod3.z.number().positive().optional(),
|
|
2792
|
+
prompt: import_zod3.z.boolean().optional(),
|
|
2734
2793
|
fps: RangeSchema.optional(),
|
|
2735
2794
|
outputFormats: import_zod3.z.array(import_zod3.z.enum(["h265", "prores"])).min(1).optional()
|
|
2736
2795
|
});
|
|
@@ -4026,6 +4085,7 @@ var ToolSchema = import_zod10.z.object({
|
|
|
4026
4085
|
kind: import_zod10.z.enum(["upscale", "interpolate", "hdr"]),
|
|
4027
4086
|
upscaleFactor: RangeSchema2.optional(),
|
|
4028
4087
|
maxOutputLongEdge: import_zod10.z.number().positive().optional(),
|
|
4088
|
+
prompt: import_zod10.z.boolean().optional(),
|
|
4029
4089
|
fps: RangeSchema2.optional(),
|
|
4030
4090
|
outputFormats: import_zod10.z.array(import_zod10.z.enum(["h265", "prores"])).min(1).optional()
|
|
4031
4091
|
});
|
|
@@ -4033,11 +4093,12 @@ function videoToolConstraints(row) {
|
|
|
4033
4093
|
if (row.type !== "video-tool") return void 0;
|
|
4034
4094
|
const parsed = ToolSchema.safeParse(row.constraints.tool);
|
|
4035
4095
|
if (!parsed.success) return void 0;
|
|
4036
|
-
const { kind, upscaleFactor, maxOutputLongEdge, fps, outputFormats } = parsed.data;
|
|
4096
|
+
const { kind, upscaleFactor, maxOutputLongEdge, prompt, fps, outputFormats } = parsed.data;
|
|
4037
4097
|
return {
|
|
4038
4098
|
kind,
|
|
4039
4099
|
...upscaleFactor !== void 0 && { upscaleFactor },
|
|
4040
4100
|
...maxOutputLongEdge !== void 0 && { maxOutputLongEdge },
|
|
4101
|
+
...prompt !== void 0 && { prompt },
|
|
4041
4102
|
...fps !== void 0 && { fps },
|
|
4042
4103
|
...outputFormats !== void 0 && { outputFormats }
|
|
4043
4104
|
};
|
|
@@ -4193,14 +4254,21 @@ async function readJson(ctx, res) {
|
|
|
4193
4254
|
function providerModelName(ctx) {
|
|
4194
4255
|
return import_zod11.z.string().safeParse(ctx.model.providerOptions?.["fal"]?.["model"]).data;
|
|
4195
4256
|
}
|
|
4257
|
+
function staticInput(ctx) {
|
|
4258
|
+
return JsonObjectSchema.safeParse(ctx.model.providerOptions?.["fal"]?.["input"]).data ?? {};
|
|
4259
|
+
}
|
|
4196
4260
|
function toolInput(ctx, req, output) {
|
|
4197
4261
|
const tool = videoToolConstraints(ctx.model);
|
|
4198
4262
|
const model = providerModelName(ctx);
|
|
4199
|
-
const input = { video_url: req.source.url };
|
|
4263
|
+
const input = { ...staticInput(ctx), video_url: req.source.url };
|
|
4200
4264
|
if (tool?.kind === "upscale") {
|
|
4201
|
-
if (model !== void 0) input["model"] = model;
|
|
4202
4265
|
input["upscale_factor"] = req.upscaleFactor ?? 1;
|
|
4203
|
-
|
|
4266
|
+
if (model !== void 0) {
|
|
4267
|
+
input["model"] = model;
|
|
4268
|
+
input["H264_output"] = true;
|
|
4269
|
+
}
|
|
4270
|
+
const prompt = req.prompt?.trim();
|
|
4271
|
+
if (tool.prompt === true && prompt) input["prompt"] = prompt;
|
|
4204
4272
|
} else if (tool?.kind === "interpolate") {
|
|
4205
4273
|
if (model !== void 0) input["model"] = model;
|
|
4206
4274
|
input["target_fps"] = req.targetFps ?? 60;
|
|
@@ -7931,6 +7999,7 @@ function adapterServesType(adapter, type) {
|
|
|
7931
7999
|
}
|
|
7932
8000
|
if (type === "video") return adapter.generateVideo !== void 0;
|
|
7933
8001
|
if (type === "audio") return adapter.generateAudio !== void 0;
|
|
8002
|
+
if (type === "video-tool") return adapter.submitVideoTool !== void 0;
|
|
7934
8003
|
return adapter.languageModel !== void 0;
|
|
7935
8004
|
}
|
|
7936
8005
|
function dataOnlyCapable(row) {
|