@shop-os/modelkit 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -129,7 +129,7 @@ interface Model3dConstraints {
129
129
  };
130
130
  }
131
131
  /** What a `video-tool` row does to its source clip. */
132
- type VideoToolKind = "upscale" | "interpolate" | "hdr" | "bg-remove" | "subtitles";
132
+ type VideoToolKind = "upscale" | "interpolate" | "hdr" | "bg-remove" | "subtitles" | "depth";
133
133
  /** Container/codec a video-tool row can write. */
134
134
  /** `exr`: a ZIP of 16-bit EXR frames in `VideoToolResult.frames`, with an MP4 preview as `video`. */
135
135
  type VideoToolOutputFormat = "h265" | "prores" | "exr";
@@ -1322,6 +1322,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1322
1322
  interpolate: "interpolate";
1323
1323
  hdr: "hdr";
1324
1324
  subtitles: "subtitles";
1325
+ depth: "depth";
1325
1326
  }>;
1326
1327
  upscaleFactor: z.ZodOptional<z.ZodObject<{
1327
1328
  min: z.ZodNumber;
package/dist/catalog.d.ts CHANGED
@@ -129,7 +129,7 @@ interface Model3dConstraints {
129
129
  };
130
130
  }
131
131
  /** What a `video-tool` row does to its source clip. */
132
- type VideoToolKind = "upscale" | "interpolate" | "hdr" | "bg-remove" | "subtitles";
132
+ type VideoToolKind = "upscale" | "interpolate" | "hdr" | "bg-remove" | "subtitles" | "depth";
133
133
  /** Container/codec a video-tool row can write. */
134
134
  /** `exr`: a ZIP of 16-bit EXR frames in `VideoToolResult.frames`, with an MP4 preview as `video`. */
135
135
  type VideoToolOutputFormat = "h265" | "prores" | "exr";
@@ -1322,6 +1322,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1322
1322
  interpolate: "interpolate";
1323
1323
  hdr: "hdr";
1324
1324
  subtitles: "subtitles";
1325
+ depth: "depth";
1325
1326
  }>;
1326
1327
  upscaleFactor: z.ZodOptional<z.ZodObject<{
1327
1328
  min: z.ZodNumber;
package/dist/catalog.js CHANGED
@@ -6558,6 +6558,33 @@ var VIDEO_TOOL_MODELS = [
6558
6558
  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."
6559
6559
  }
6560
6560
  },
6561
+ {
6562
+ // https://fal.ai/models/fal-ai/depth-anything-video/api: greyscale depth (white = near)
6563
+ // at the source's frame rate, short edge capped at 1080 px (a 2160x3840 source came
6564
+ // back 1080x1920), at most 2400 frames; one fal price of $0.04 per second for every
6565
+ // model size. The adapter always sends VDA-Small, the only Apache-2.0 size. 100 s is
6566
+ // 2400 frames at 24 fps; the frame check refuses faster clips sooner.
6567
+ id: "depth-anything-video",
6568
+ aliases: [],
6569
+ label: "Video Depth Anything",
6570
+ type: "video-tool",
6571
+ adapter: "fal",
6572
+ providerModelId: "fal-ai/depth-anything-video",
6573
+ lifecycle: "active",
6574
+ exposure: ["cowork"],
6575
+ constraints: {
6576
+ supports: [],
6577
+ sourceVideoSeconds: { max: 100 },
6578
+ tool: { kind: "depth", maxOutputShortEdge: 1080, maxOutputFrames: 2400 }
6579
+ },
6580
+ defaults: {},
6581
+ usage: SECONDS_USAGE,
6582
+ pricingKind: "video_per_second",
6583
+ display: {
6584
+ provider: "depth-anything",
6585
+ description: "Video Depth Anything: a greyscale depth map of the clip (near is white), frame for frame, for motion and camera control."
6586
+ }
6587
+ },
6561
6588
  {
6562
6589
  id: "flux-video-upscale-precise",
6563
6590
  aliases: [],
@@ -7781,7 +7808,7 @@ var LanguageOptionSchema = z3.looseObject({
7781
7808
  name: z3.string().min(1)
7782
7809
  });
7783
7810
  var VideoToolConstraintsSchema = z3.looseObject({
7784
- kind: z3.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles"]),
7811
+ kind: z3.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles", "depth"]),
7785
7812
  upscaleFactor: RangeSchema.optional(),
7786
7813
  maxOutputLongEdge: z3.number().positive().optional(),
7787
7814
  prompt: z3.boolean().optional(),
@@ -8387,7 +8414,7 @@ function subtitleProblem(label, tool, options, resolution, durationSeconds) {
8387
8414
  // src/catalog/video-tools-spec.ts
8388
8415
  var RangeSchema2 = z6.object({ min: z6.number(), max: z6.number() });
8389
8416
  var ToolSchema = z6.object({
8390
- kind: z6.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles"]),
8417
+ kind: z6.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles", "depth"]),
8391
8418
  upscaleFactor: RangeSchema2.optional(),
8392
8419
  maxOutputLongEdge: z6.number().positive().optional(),
8393
8420
  prompt: z6.boolean().optional(),
@@ -8525,6 +8552,25 @@ function planVideoTool(row2, req) {
8525
8552
  }
8526
8553
  };
8527
8554
  }
8555
+ if (tool.kind === "depth") {
8556
+ const limit = tool.maxOutputFrames;
8557
+ if (limit !== void 0) {
8558
+ if (fps === void 0) return fail("The source video's frame rate is required");
8559
+ if (durationSeconds * fps > limit) {
8560
+ return fail(`${row2.label} renders up to ${limit} frames (${seconds(limit, fps)}).`);
8561
+ }
8562
+ }
8563
+ const out2 = shrinkToShortEdge(width, height, tool.maxOutputShortEdge);
8564
+ return {
8565
+ ok: true,
8566
+ output: {
8567
+ ...base,
8568
+ ...out2,
8569
+ resolution: resolutionTier(out2.width, out2.height),
8570
+ format: "h264"
8571
+ }
8572
+ };
8573
+ }
8528
8574
  if (tool.kind === "subtitles") {
8529
8575
  const resolution = resolutionTier(width, height);
8530
8576
  const problem = subtitleProblem(