@clipwright/core 0.66.0 → 0.67.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.
package/dist/ads.d.ts CHANGED
@@ -17,6 +17,7 @@ export type AdBrief = z.infer<typeof adBrief>;
17
17
  export declare const adSlot: z.ZodObject<{
18
18
  id: z.ZodString;
19
19
  shot: z.ZodString;
20
+ people_only: z.ZodOptional<z.ZodBoolean>;
20
21
  }, z.core.$strict>;
21
22
  export type AdSlot = z.infer<typeof adSlot>;
22
23
  export declare const createAdInput: z.ZodObject<{
@@ -29,6 +30,7 @@ export declare const createAdInput: z.ZodObject<{
29
30
  slots: z.ZodArray<z.ZodObject<{
30
31
  id: z.ZodString;
31
32
  shot: z.ZodString;
33
+ people_only: z.ZodOptional<z.ZodBoolean>;
32
34
  }, z.core.$strict>>;
33
35
  }, z.core.$strict>;
34
36
  export type CreateAdInput = z.infer<typeof createAdInput>;
@@ -42,6 +44,7 @@ export declare const updateAdInput: z.ZodObject<{
42
44
  slots: z.ZodOptional<z.ZodArray<z.ZodObject<{
43
45
  id: z.ZodString;
44
46
  shot: z.ZodString;
47
+ people_only: z.ZodOptional<z.ZodBoolean>;
45
48
  }, z.core.$strict>>>;
46
49
  }, z.core.$strict>;
47
50
  export type UpdateAdInput = z.infer<typeof updateAdInput>;
@@ -123,6 +126,7 @@ export declare const adRecord: z.ZodObject<{
123
126
  slots: z.ZodArray<z.ZodObject<{
124
127
  id: z.ZodString;
125
128
  shot: z.ZodString;
129
+ people_only: z.ZodBoolean;
126
130
  state: z.ZodEnum<{
127
131
  checking: "checking";
128
132
  failed: "failed";
package/dist/ads.js CHANGED
@@ -20,6 +20,9 @@ export const adBrief = z.strictObject({
20
20
  export const adSlot = z.strictObject({
21
21
  id: adSlotId,
22
22
  shot: z.string().trim().min(1).max(500).describe("What the shot shows, in a line: its action and the spoken line it carries"),
23
+ people_only: z.boolean().optional().describe("Only people in this shot, with no product, label or detail anywhere in it (a face for " +
24
+ "the hook, a person talking): a take made with generate_video goes into the edit without check_take. Once a slot has a check, this " +
25
+ "cannot be turned on"),
23
26
  });
24
27
  const slots = z.array(adSlot).min(1).max(AD_MAX_SLOTS)
25
28
  .refine(list => new Set(list.map(slot => slot.id)).size === list.length, "each slot id is used once")
@@ -48,7 +51,7 @@ export const adRecord = z.strictObject({
48
51
  ad_id: adId,
49
52
  brief: adBrief,
50
53
  guide_version: z.string(),
51
- slots: z.array(z.strictObject({ id: adSlotId, shot: z.string(), state: z.enum(AD_SLOT_STATES), takes: z.array(adTake) })),
54
+ slots: z.array(z.strictObject({ id: adSlotId, shot: z.string(), people_only: z.boolean(), state: z.enum(AD_SLOT_STATES), takes: z.array(adTake) })),
52
55
  edits: z.array(z.strictObject({ run_id: runId, state: z.string(), credits_charged: z.number().int().nonnegative().nullable(), created_at: z.string() })),
53
56
  next: diyNext.nullable(),
54
57
  blocked: diyBlocked.nullable(),
package/dist/film-cut.js CHANGED
@@ -163,6 +163,7 @@ export const filmCutCheck = z.strictObject({
163
163
  live_sec: z.number().nonnegative(),
164
164
  }).nullable(),
165
165
  warnings: z.array(z.string()),
166
- next: diyNext.optional().describe("A passed sheet: its quote_cut; a take not yet cleared to play: its check_take quote"),
166
+ next: diyNext.optional().describe("A passed sheet: its quote_cut; a take not yet cleared to play: its check_take quote; a refused " +
167
+ "sheet: check_cut again, add naming the fields to fix"),
167
168
  blocked: diyBlocked.optional().describe("Why a take of the cut cannot play yet, and what unblocks it"),
168
169
  });
@@ -24,6 +24,10 @@ export declare const guideCatalog: z.ZodArray<z.ZodObject<{
24
24
  version: z.ZodString;
25
25
  }, z.core.$strict>>;
26
26
  export type GuideCatalog = z.infer<typeof guideCatalog>;
27
+ export declare function guideModesOf(guides: GuideCatalog | undefined): {
28
+ adGuide: boolean;
29
+ facelessDiy: boolean;
30
+ };
27
31
  export declare const filmGuideQuery: z.ZodObject<{
28
32
  format: z.ZodOptional<z.ZodEnum<{
29
33
  cartoon: "cartoon";
@@ -27,6 +27,11 @@ export const guideCatalog = z.array(z.strictObject({
27
27
  use_when: z.string().min(1),
28
28
  version: z.string().regex(/^[a-f0-9]{12}$/),
29
29
  })).describe("Every guide this account can read, each with its version: read the one that fits the video before its first tool call");
30
+ export function guideModesOf(guides) {
31
+ const listed = guides ?? [];
32
+ return { adGuide: listed.some(entry => entry.tool === "get_ad_guide"),
33
+ facelessDiy: listed.some(entry => entry.tool === "get_film_guide" && entry.format !== undefined && entry.format !== "explainer") };
34
+ }
30
35
  export const filmGuideQuery = z.strictObject({
31
36
  format: z.enum(FILM_GUIDE_FORMATS).optional().describe("The video to make: explainer (the default, a coded film), story, list (facts or " +
32
37
  "tips), own_pictures (the user's own pictures) or cartoon (a drawn hero in generated pictures)"),
@@ -4,7 +4,7 @@ export declare const GENERATE_IMAGE_QUOTE_PATH = "/v1/skills/generate_image/quot
4
4
  export declare const GENERATE_IMAGE_RUN_PATH = "/v1/skills/generate_image/run";
5
5
  export declare const GENERATE_VIDEO_QUOTE_PATH = "/v1/skills/generate_video/quote";
6
6
  export declare const GENERATE_VIDEO_RUN_PATH = "/v1/skills/generate_video/run";
7
- export declare const GENERATION_IMAGE_MODELS: readonly ["seedream-5.0-flash", "flare", "gemini-3-pro-image", "gemini-nano-banana-2.1"];
7
+ export declare const GENERATION_IMAGE_MODELS: readonly ["seedream-5.0-flash", "seedream-5.5", "flare", "gemini-3-pro-image", "gemini-nano-banana-2.1"];
8
8
  export declare const GENERATION_VIDEO_MODELS: readonly ["seedance-2.0", "seedance-2.0-mini", "seedance-2.0-fast", "seedance-2.5", "seedance-2.5-flash", "kling-3.0", "kling-4.0", "kling-4.0-flash", "gemini-omni-flash-1.1", "gemini-omni-flash-1.2"];
9
9
  export type GenerationImageModel = (typeof GENERATION_IMAGE_MODELS)[number];
10
10
  export type GenerationVideoModel = (typeof GENERATION_VIDEO_MODELS)[number];
@@ -44,6 +44,7 @@ export interface GenerationVideoRow {
44
44
  export interface GenerationImageCapability {
45
45
  kind: "image";
46
46
  max_references?: number;
47
+ min_references?: number;
47
48
  rows: readonly GenerationImageRow[];
48
49
  }
49
50
  export interface GenerationVideoCapability {
@@ -87,6 +88,7 @@ export declare const generateImageRequest: z.ZodObject<{
87
88
  "gemini-3-pro-image": "gemini-3-pro-image";
88
89
  "gemini-nano-banana-2.1": "gemini-nano-banana-2.1";
89
90
  "seedream-5.0-flash": "seedream-5.0-flash";
91
+ "seedream-5.5": "seedream-5.5";
90
92
  }>;
91
93
  aspect_ratio: z.ZodEnum<{
92
94
  "16:9": "16:9";
@@ -301,6 +303,7 @@ declare const listedModel: z.ZodObject<{
301
303
  }, z.core.$strict>>;
302
304
  duration_values: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
303
305
  max_references: z.ZodNumber;
306
+ min_references: z.ZodOptional<z.ZodNumber>;
304
307
  audio: z.ZodOptional<z.ZodLiteral<true>>;
305
308
  rows: z.ZodArray<z.ZodObject<{
306
309
  aspect_ratio: z.ZodString;
@@ -338,6 +341,7 @@ export declare const generationModels: z.ZodObject<{
338
341
  }, z.core.$strict>>;
339
342
  duration_values: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
340
343
  max_references: z.ZodNumber;
344
+ min_references: z.ZodOptional<z.ZodNumber>;
341
345
  audio: z.ZodOptional<z.ZodLiteral<true>>;
342
346
  rows: z.ZodArray<z.ZodObject<{
343
347
  aspect_ratio: z.ZodString;
@@ -10,7 +10,7 @@ export const GENERATE_IMAGE_QUOTE_PATH = "/v1/skills/generate_image/quote";
10
10
  export const GENERATE_IMAGE_RUN_PATH = "/v1/skills/generate_image/run";
11
11
  export const GENERATE_VIDEO_QUOTE_PATH = "/v1/skills/generate_video/quote";
12
12
  export const GENERATE_VIDEO_RUN_PATH = "/v1/skills/generate_video/run";
13
- export const GENERATION_IMAGE_MODELS = ["seedream-5.0-flash", "flare", "gemini-3-pro-image", "gemini-nano-banana-2.1"];
13
+ export const GENERATION_IMAGE_MODELS = ["seedream-5.0-flash", "seedream-5.5", "flare", "gemini-3-pro-image", "gemini-nano-banana-2.1"];
14
14
  export const GENERATION_VIDEO_MODELS = [
15
15
  "seedance-2.0", "seedance-2.0-mini", "seedance-2.0-fast", "seedance-2.5", "seedance-2.5-flash", "kling-3.0", "kling-4.0", "kling-4.0-flash",
16
16
  "gemini-omni-flash-1.1", "gemini-omni-flash-1.2",
@@ -56,9 +56,14 @@ export const GENERATION_CAPABILITIES = deepFreeze({
56
56
  kind: "image",
57
57
  rows: [image("9:16", 1440, 2560, 5, true), image("16:9", 2560, 1440, 5, true), image("1:1", 2048, 2048, 5, true)],
58
58
  },
59
+ "seedream-5.5": {
60
+ kind: "image",
61
+ min_references: 1,
62
+ rows: [image("9:16", 1440, 2560, 17, true), image("21:9", 3024, 1296, 17, true)],
63
+ },
59
64
  flare: {
60
65
  kind: "image",
61
- rows: [image("9:16", 1008, 1792, 6, true), image("16:9", 1792, 1008, 6), image("1:1", 1024, 1024, 6), image("21:9", 2352, 1008, 15, true)],
66
+ rows: [image("9:16", 1008, 1792, 7, true), image("16:9", 1792, 1008, 7), image("1:1", 1024, 1024, 7), image("21:9", 2352, 1008, 16, true)],
62
67
  },
63
68
  "gemini-3-pro-image": {
64
69
  kind: "image",
@@ -179,19 +184,26 @@ export function withNoTextClause(promptText, options) {
179
184
  return `${promptText}\n${GENERATION_NO_TEXT_CLAUSE}`;
180
185
  }
181
186
  const imageMaxReferences = (model) => GENERATION_CAPABILITIES[model].max_references ?? GENERATION_MAX_REFERENCES;
187
+ const imageMinReferences = (model) => GENERATION_CAPABILITIES[model].min_references ?? 0;
182
188
  export const generateImageRequest = z.strictObject({
183
189
  prompt,
184
190
  keep_text: keepText,
185
191
  model: z.enum(GENERATION_IMAGE_MODELS),
186
192
  aspect_ratio: z.enum(GENERATION_IMAGE_ASPECTS),
187
193
  references: z.array(generationReference).max(Math.max(...GENERATION_IMAGE_MODELS.map(imageMaxReferences))).optional()
188
- .describe("Pictures the image is made from; each model takes up to its max_references (list_generation_models)."),
194
+ .describe("Pictures the image is made from; each model takes up to its max_references, and at least its min_references where it " +
195
+ "lists one (list_generation_models)."),
189
196
  max_credits: maxCreditsField,
190
197
  }).superRefine((request, context) => {
191
198
  const most = imageMaxReferences(request.model);
192
- if ((request.references?.length ?? 0) > most) {
199
+ const count = request.references?.length ?? 0;
200
+ if (count > most) {
193
201
  context.addIssue({ code: z.ZodIssueCode.custom, path: ["references"], message: `${request.model} takes up to ${most} references` });
194
202
  }
203
+ if (count < imageMinReferences(request.model)) {
204
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["references"],
205
+ message: `${request.model} cleans up a picture: pass the picture, and any product photos, as references` });
206
+ }
195
207
  });
196
208
  const SHOT_DESCRIPTION = "The clip as a shot, in place of prompt: framing, subject, start_state, timed beats, camera, light and " +
197
209
  "continuity. Write every field as what the frame shows: a state reads \"her fingertips are clean\", never as an absence.";
@@ -273,6 +285,8 @@ export function findCapabilityRow(request) {
273
285
  return row?.measured ? { kind: "video", model: request.model, capability, row } : null;
274
286
  }
275
287
  const capability = GENERATION_CAPABILITIES[request.model];
288
+ if ((request.references?.length ?? 0) < imageMinReferences(request.model))
289
+ return null;
276
290
  const row = capability.rows.find((one) => one.aspect_ratio === request.aspect_ratio);
277
291
  return row?.measured ? { kind: "image", model: request.model, capability, row } : null;
278
292
  }
@@ -313,6 +327,8 @@ const listedModel = z.strictObject({
313
327
  duration_s: z.strictObject({ min: z.number().int().positive(), max: z.number().int().positive() }).nullable(),
314
328
  duration_values: z.array(z.number().int().positive()).min(1).optional(),
315
329
  max_references: z.number().int().nonnegative(),
330
+ min_references: z.number().int().positive().optional()
331
+ .describe("Present on a picture model that only cleans up pictures it is given: the fewest references a request takes."),
316
332
  audio: z.literal(true).optional().describe("Present on a clip model that keeps its own sound on audio: true, at the same price."),
317
333
  rows: z.array(listedRow).min(1),
318
334
  });
@@ -326,8 +342,9 @@ export function listGenerationModels(options = {}) {
326
342
  if (capability.kind === "image") {
327
343
  const rows = capability.rows.filter((row) => row.measured)
328
344
  .map(({ aspect_ratio, width, height, unit_credits }) => ({ aspect_ratio, resolution: null, width, height, unit_credits }));
345
+ const fewest = imageMinReferences(model);
329
346
  return rows.length === 0 ? [] : [{ model, kind: "image", unit: "image", modes: null, duration_s: null,
330
- max_references: imageMaxReferences(model), rows }];
347
+ max_references: imageMaxReferences(model), ...(fewest > 0 ? { min_references: fewest } : {}), rows }];
331
348
  }
332
349
  const modes = GENERATION_VIDEO_MODES.filter((mode) => capability.modes[mode]);
333
350
  const rows = capability.rows.filter((row) => row.measured)
@@ -367,6 +367,7 @@ export declare const takeCheckVerdict: z.ZodObject<{
367
367
  }, z.core.$strict>;
368
368
  export type TakeCheckVerdict = z.infer<typeof takeCheckVerdict>;
369
369
  export declare const takeCheckPassed: (verdict: Pick<TakeCheckVerdict, "findings" | "clean">) => boolean;
370
+ export declare const TAKE_VOICE_MISMATCH: "VOICE_MISMATCH";
370
371
  export declare const FILM_HERO_SOURCE_FIELDS: readonly ["character_reference", "character_details", "script", "voice_run_id"];
371
372
  export declare const filmHeroInput: z.ZodObject<{
372
373
  character_reference: z.ZodOptional<z.ZodString>;
@@ -120,7 +120,7 @@ export const filmEditInput = z.strictObject({
120
120
  music: editMusic.optional().describe("Music from at to the end: a library track (free) or one made for the cut (paid on delivery); " +
121
121
  "under a voice it plays lower"),
122
122
  ad_id: adId.optional().describe("The ad record this cut belongs to: every clip then names its slot, and a clip made with generate_video " +
123
- "that has not passed check_take in its slot is refused before any credits; your own footage needs no check"),
123
+ "that has not passed check_take in its slot is refused before any credits, unless the slot is people_only; your own footage needs no check"),
124
124
  max_credits: maxCreditsField,
125
125
  }).refine(edit => edit.ad_id !== undefined || edit.clips.every(clip => clip.slot === undefined), "a clip's slot needs ad_id")
126
126
  .refine(edit => edit.ad_id === undefined || edit.clips.every(clip => clip.slot !== undefined), "with ad_id, every clip names its slot");
@@ -230,6 +230,7 @@ export const takeCheckVerdict = z.strictObject({ duration_sec: z.number().positi
230
230
  subject: z.strictObject({ x: z.number().min(0).max(1), y: z.number().min(0).max(1), w: z.number().min(0).max(1), h: z.number().min(0).max(1) })
231
231
  .nullable().optional().describe("Against picture: the main subject's box at that second, shares of the frame from its top-left corner") });
232
232
  export const takeCheckPassed = (verdict) => verdict.clean.length > 0 && !verdict.findings.some(finding => finding.whole_take);
233
+ export const TAKE_VOICE_MISMATCH = "VOICE_MISMATCH";
233
234
  export const FILM_HERO_SOURCE_FIELDS = ["character_reference", "character_details", "script", "voice_run_id"];
234
235
  export const filmHeroInput = z.strictObject({
235
236
  character_reference: qualifiedImageUrl.optional().describe("https image of the character the poses are drawn after: a public picture, your upload, a " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipwright/core",
3
- "version": "0.66.0",
3
+ "version": "0.67.0",
4
4
  "description": "Zod schemas and the shared request/response contract of the Clipwright UGC video API",
5
5
  "repository": {
6
6
  "type": "git",