@shop-os/modelkit 0.23.1 → 0.24.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.
@@ -254,6 +254,12 @@ interface VideoRequest {
254
254
  startSeconds: number;
255
255
  resumeSeconds: number;
256
256
  };
257
+ /** Rows with `constraints.draft`: render the final from this draft task (a draft call's
258
+ * `jobId`). The provider reuses
259
+ * the draft's prompt, inputs, duration, ratio, seed and audio, so the adapter sends none of
260
+ * them; `resolution` must be one of `finalResolutions` (default: the first), and
261
+ * `durationSeconds` is only the usage fallback until the task reports its length. */
262
+ draftTaskId?: string;
257
263
  }
258
264
  /**
259
265
  * What a caller passes to generateVideo. `duration` is the AI SDK spelling of
@@ -845,6 +851,14 @@ interface ModelConstraints {
845
851
  * `new`: it returns only the added footage and the caller joins it (Seedance). */
846
852
  returns?: "new" | "joined";
847
853
  };
854
+ /** A draft row (Seedance 2.5 Draft): every call renders a preview at `resolution`, and a call
855
+ * with `VideoRequest.draftTaskId` renders the final from one at one of `finalResolutions`, for
856
+ * `ttlDays` after the draft task was created. Both steps run and bill as this row. */
857
+ draft?: {
858
+ resolution: VideoResolution;
859
+ finalResolutions: VideoResolution[];
860
+ ttlDays: number;
861
+ };
848
862
  /** What a `video-tool` row accepts. Read it through `videoToolConstraints(row)`. */
849
863
  tool?: VideoToolConstraints;
850
864
  /** Required on `model3d` rows. */
@@ -1500,6 +1514,27 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1500
1514
  joined: "joined";
1501
1515
  }>>;
1502
1516
  }, z.core.$loose>>;
1517
+ draft: z.ZodOptional<z.ZodObject<{
1518
+ resolution: z.ZodEnum<{
1519
+ "360p": "360p";
1520
+ "480p": "480p";
1521
+ "720p": "720p";
1522
+ "768p": "768p";
1523
+ "1080p": "1080p";
1524
+ "2k": "2k";
1525
+ "4k": "4k";
1526
+ }>;
1527
+ finalResolutions: z.ZodArray<z.ZodEnum<{
1528
+ "360p": "360p";
1529
+ "480p": "480p";
1530
+ "720p": "720p";
1531
+ "768p": "768p";
1532
+ "1080p": "1080p";
1533
+ "2k": "2k";
1534
+ "4k": "4k";
1535
+ }>>;
1536
+ ttlDays: z.ZodNumber;
1537
+ }, z.core.$loose>>;
1503
1538
  tool: z.ZodOptional<z.ZodObject<{
1504
1539
  kind: z.ZodEnum<{
1505
1540
  upscale: "upscale";
package/dist/catalog.d.ts CHANGED
@@ -254,6 +254,12 @@ interface VideoRequest {
254
254
  startSeconds: number;
255
255
  resumeSeconds: number;
256
256
  };
257
+ /** Rows with `constraints.draft`: render the final from this draft task (a draft call's
258
+ * `jobId`). The provider reuses
259
+ * the draft's prompt, inputs, duration, ratio, seed and audio, so the adapter sends none of
260
+ * them; `resolution` must be one of `finalResolutions` (default: the first), and
261
+ * `durationSeconds` is only the usage fallback until the task reports its length. */
262
+ draftTaskId?: string;
257
263
  }
258
264
  /**
259
265
  * What a caller passes to generateVideo. `duration` is the AI SDK spelling of
@@ -845,6 +851,14 @@ interface ModelConstraints {
845
851
  * `new`: it returns only the added footage and the caller joins it (Seedance). */
846
852
  returns?: "new" | "joined";
847
853
  };
854
+ /** A draft row (Seedance 2.5 Draft): every call renders a preview at `resolution`, and a call
855
+ * with `VideoRequest.draftTaskId` renders the final from one at one of `finalResolutions`, for
856
+ * `ttlDays` after the draft task was created. Both steps run and bill as this row. */
857
+ draft?: {
858
+ resolution: VideoResolution;
859
+ finalResolutions: VideoResolution[];
860
+ ttlDays: number;
861
+ };
848
862
  /** What a `video-tool` row accepts. Read it through `videoToolConstraints(row)`. */
849
863
  tool?: VideoToolConstraints;
850
864
  /** Required on `model3d` rows. */
@@ -1500,6 +1514,27 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1500
1514
  joined: "joined";
1501
1515
  }>>;
1502
1516
  }, z.core.$loose>>;
1517
+ draft: z.ZodOptional<z.ZodObject<{
1518
+ resolution: z.ZodEnum<{
1519
+ "360p": "360p";
1520
+ "480p": "480p";
1521
+ "720p": "720p";
1522
+ "768p": "768p";
1523
+ "1080p": "1080p";
1524
+ "2k": "2k";
1525
+ "4k": "4k";
1526
+ }>;
1527
+ finalResolutions: z.ZodArray<z.ZodEnum<{
1528
+ "360p": "360p";
1529
+ "480p": "480p";
1530
+ "720p": "720p";
1531
+ "768p": "768p";
1532
+ "1080p": "1080p";
1533
+ "2k": "2k";
1534
+ "4k": "4k";
1535
+ }>>;
1536
+ ttlDays: z.ZodNumber;
1537
+ }, z.core.$loose>>;
1503
1538
  tool: z.ZodOptional<z.ZodObject<{
1504
1539
  kind: z.ZodEnum<{
1505
1540
  upscale: "upscale";
package/dist/catalog.js CHANGED
@@ -6342,6 +6342,54 @@ var VIDEO_MODELS = [
6342
6342
  },
6343
6343
  capabilities: { acceptsSourceVideo: true, videoEdit: true, ...FRAMES_EXCLUDE_REFERENCES }
6344
6344
  },
6345
+ {
6346
+ // The same BytePlus model in draft mode. Probed 2026-11-17: a draft must be 480p; its
6347
+ // final is a second task on this row (draftTaskId), and 720p or no resolution is refused
6348
+ // there. A 4k final also rendered, but the docs list 1080p only. No alias for the provider
6349
+ // id: that alias resolves usage to seedance-2.5. Edit and extend stay on seedance-2.5.
6350
+ id: "seedance-2.5-draft",
6351
+ aliases: ["seedance-2-5-draft"],
6352
+ label: "Seedance 2.5 Draft",
6353
+ type: "video",
6354
+ adapter: "ark",
6355
+ providerModelId: "dreamina-seedance-2-5-260628",
6356
+ lifecycle: "active",
6357
+ exposure: [],
6358
+ constraints: {
6359
+ aspectRatios: [...SEEDANCE_RATIOS],
6360
+ resolutions: ["480p"],
6361
+ durations: { min: 4, max: 30 },
6362
+ references: {
6363
+ images: 30,
6364
+ videos: 10,
6365
+ audios: 10,
6366
+ videoSeconds: { min: 2, max: 30, total: 30 },
6367
+ ...SEEDANCE_REFERENCE_MEDIA,
6368
+ audioSeconds: { min: 2, max: 30, total: 30 },
6369
+ audioFormats: ["wav", "mp3"],
6370
+ audioMaxBytes: 15 * 1024 * 1024
6371
+ },
6372
+ ratioIgnoredWith: ["firstFrame"],
6373
+ supports: ["generateAudio", "lastFrame", "watermark"],
6374
+ draft: { resolution: "480p", finalResolutions: ["1080p"], ttlDays: 14 },
6375
+ prompt: SEEDANCE_PROMPT,
6376
+ audio: "optional"
6377
+ },
6378
+ defaults: {
6379
+ durationSeconds: 5,
6380
+ resolution: "480p",
6381
+ aspectRatio: "16:9",
6382
+ generateAudio: true
6383
+ },
6384
+ usage: { ...VIDEO_USAGE3 },
6385
+ pricingKind: "video_per_second",
6386
+ display: {
6387
+ provider: "bytedance",
6388
+ logo: BYTEDANCE_LOGO2,
6389
+ description: "A quick 480p Seedance 2.5 preview. Render the 1080p final from it within 14 days; the final keeps the draft's scene and motion."
6390
+ },
6391
+ capabilities: { acceptsSourceVideo: false, videoEdit: false, ...FRAMES_EXCLUDE_REFERENCES }
6392
+ },
6345
6393
  {
6346
6394
  // Limits probed on the live API 2026-11-16 (1080p is refused). Extend probe: a 4 s
6347
6395
  // extend returned 4 s of new footage only and billed input + output tokens, as on 2.5.
@@ -8325,6 +8373,13 @@ var ModelConstraintsSchema = z3.looseObject({
8325
8373
  maxTotalSeconds: z3.number(),
8326
8374
  returns: z3.enum(["new", "joined"]).optional()
8327
8375
  }).optional(),
8376
+ // Loose so a kit before 0.24.0 keeps a row that carries it (an unknown `supports` value
8377
+ // would drop the row there).
8378
+ draft: z3.looseObject({
8379
+ resolution: VideoResolutionSchema,
8380
+ finalResolutions: z3.array(VideoResolutionSchema).min(1),
8381
+ ttlDays: z3.number().positive()
8382
+ }).optional(),
8328
8383
  tool: VideoToolConstraintsSchema.optional(),
8329
8384
  model3d: Model3dConstraintsSchema.optional(),
8330
8385
  // Loose on purpose: the read path keeps a row whose value is invalid (the accessors in
@@ -9933,6 +9988,25 @@ function resolveVideoResolution(requested, model, onUnsupported, warnings) {
9933
9988
  warnings
9934
9989
  );
9935
9990
  }
9991
+ function resolveDraftFinalResolution(requested, draft, model, onUnsupported, warnings) {
9992
+ const [first] = draft.finalResolutions;
9993
+ if (requested === void 0 || draft.finalResolutions.includes(requested))
9994
+ return requested ?? first;
9995
+ if (onUnsupported === "error") {
9996
+ throw new ModelKitError({
9997
+ code: "unsupported_option",
9998
+ message: `${model.id} renders a final from a draft at ${draft.finalResolutions.join(", ")} only`,
9999
+ model: model.id,
10000
+ retryable: false
10001
+ });
10002
+ }
10003
+ warnings.push({
10004
+ code: "resolution_coerced",
10005
+ field: "resolution",
10006
+ message: `${model.id} renders a final at ${String(first)}, not ${requested}`
10007
+ });
10008
+ return first;
10009
+ }
9936
10010
  function resolveDuration(requested, durations, model, onUnsupported, warnings) {
9937
10011
  if (requested === void 0 || !durations) return requested;
9938
10012
  const inSet = Array.isArray(durations) ? durations.includes(requested) : requested >= durations.min && requested <= durations.max;
@@ -10260,7 +10334,13 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
10260
10334
  );
10261
10335
  if (aspectRatio !== void 0) merged.aspectRatio = aspectRatio;
10262
10336
  fillKlingModeResolution(model, merged);
10263
- const resolution = resolveVideoResolution(merged.resolution, model, onUnsupported, warnings);
10337
+ const resolution = merged.draftTaskId !== void 0 && c.draft ? resolveDraftFinalResolution(
10338
+ request.resolution,
10339
+ c.draft,
10340
+ model,
10341
+ onUnsupported,
10342
+ warnings
10343
+ ) : resolveVideoResolution(merged.resolution, model, onUnsupported, warnings);
10264
10344
  if (resolution !== void 0) merged.resolution = resolution;
10265
10345
  if (takesKlingMode(model)) delete merged.mode;
10266
10346
  const duration = resolveDuration(