@clipwright/core 0.78.0 → 0.79.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.
Files changed (51) hide show
  1. package/dist/account.d.ts +1 -0
  2. package/dist/account.js +1 -0
  3. package/dist/ad-guide.d.ts +2 -1
  4. package/dist/ad-guide.js +4 -4
  5. package/dist/api-failure.d.ts +1 -0
  6. package/dist/api-failure.js +6 -3
  7. package/dist/contract-dispositions.d.ts +20 -4
  8. package/dist/contract-dispositions.js +3 -0
  9. package/dist/contracts/v1/workflow-brief.d.ts +34 -4
  10. package/dist/contracts/v1/workflow-brief.js +12 -3
  11. package/dist/contracts/v1/workflow-catalog.d.ts +52 -4
  12. package/dist/contracts/v1/workflow-client.d.ts +17 -2
  13. package/dist/contracts/v1/workflow-execution.d.ts +26 -0
  14. package/dist/contracts/v1/workflow-next.d.ts +13 -0
  15. package/dist/contracts/v1/workflow-plan.d.ts +69 -6
  16. package/dist/contracts/v1/workflow-run-read.d.ts +36 -0
  17. package/dist/edit-style-names.d.ts +9 -0
  18. package/dist/edit-style-names.js +4 -0
  19. package/dist/edit-style.d.ts +70 -0
  20. package/dist/edit-style.js +202 -0
  21. package/dist/errors.d.ts +1 -1
  22. package/dist/errors.js +1 -0
  23. package/dist/film-guide.d.ts +2 -1
  24. package/dist/film-guide.js +2 -2
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.js +2 -0
  27. package/dist/mcp-ugc-descriptions.d.ts +2 -1
  28. package/dist/mcp-ugc-descriptions.js +5 -3
  29. package/dist/reference-analysis.d.ts +13 -0
  30. package/dist/reference-analysis.js +10 -1
  31. package/dist/reference-display.d.ts +2 -0
  32. package/dist/reference-display.js +9 -1
  33. package/dist/run-static-warnings.js +2 -2
  34. package/dist/skills.d.ts +186 -111
  35. package/dist/skills.js +97 -39
  36. package/dist/voice-admission.d.ts +33 -27
  37. package/dist/workflows/methods/faceless-explainer.d.ts +7 -2
  38. package/dist/workflows/methods/kinetic-launch.d.ts +14 -4
  39. package/dist/workflows/methods/product-image-story.d.ts +7 -2
  40. package/dist/workflows/methods/reference-remake.d.ts +7 -2
  41. package/dist/workflows/methods/reference-remake.js +1 -1
  42. package/dist/workflows/methods/shared.d.ts +7 -2
  43. package/dist/workflows/methods/ugc-faq-answer.d.ts +7 -2
  44. package/dist/workflows/methods/ugc-faq-answer.js +1 -1
  45. package/dist/workflows/methods/ugc-product-intro.d.ts +7 -2
  46. package/dist/workflows/methods/ugc-product-intro.js +1 -1
  47. package/dist/workflows/methods/website-proof-demo.d.ts +14 -4
  48. package/dist/workflows/reference-remake.d.ts +9 -1
  49. package/dist/workflows/reference-remake.js +3 -2
  50. package/dist/workflows/validate.js +4 -2
  51. package/package.json +1 -1
@@ -1101,8 +1101,8 @@ export declare const workflowPlanDocument: z.ZodObject<{
1101
1101
  no_actor: "no_actor";
1102
1102
  no_people: "no_people";
1103
1103
  }>>;
1104
- captions: z.ZodDefault<z.ZodBoolean>;
1105
- caption_style: z.ZodDefault<z.ZodEnum<{
1104
+ captions: z.ZodOptional<z.ZodBoolean>;
1105
+ caption_style: z.ZodOptional<z.ZodEnum<{
1106
1106
  accent: "accent";
1107
1107
  arcade: "arcade";
1108
1108
  bassdrop: "bassdrop";
@@ -1129,6 +1129,12 @@ export declare const workflowPlanDocument: z.ZodObject<{
1129
1129
  tiktok: "tiktok";
1130
1130
  youtube: "youtube";
1131
1131
  }>>;
1132
+ edit_style: z.ZodOptional<z.ZodEnum<{
1133
+ bare: "bare";
1134
+ "bold-v1": "bold-v1";
1135
+ "calm-v1": "calm-v1";
1136
+ "house-v1": "house-v1";
1137
+ }>>;
1132
1138
  caption_mode: z.ZodOptional<z.ZodEnum<{
1133
1139
  full: "full";
1134
1140
  highlights: "highlights";
@@ -8502,6 +8508,15 @@ export declare const workflowPlanDocument: z.ZodObject<{
8502
8508
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
8503
8509
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
8504
8510
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
8511
+ edit_style_default: z.ZodOptional<z.ZodObject<{
8512
+ fields: z.ZodArray<z.ZodEnum<{
8513
+ caption_emphasis: "caption_emphasis";
8514
+ caption_style: "caption_style";
8515
+ captions: "captions";
8516
+ edit_sounds: "edit_sounds";
8517
+ }>>;
8518
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
8519
+ }, z.core.$strict>>;
8505
8520
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
8506
8521
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
8507
8522
  }, z.core.$strict>;
@@ -8596,6 +8611,15 @@ export declare const workflowPlanDocumentRead: z.ZodObject<{
8596
8611
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
8597
8612
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
8598
8613
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
8614
+ edit_style_default: z.ZodOptional<z.ZodObject<{
8615
+ fields: z.ZodArray<z.ZodEnum<{
8616
+ caption_emphasis: "caption_emphasis";
8617
+ caption_style: "caption_style";
8618
+ captions: "captions";
8619
+ edit_sounds: "edit_sounds";
8620
+ }>>;
8621
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
8622
+ }, z.core.$strict>>;
8599
8623
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
8600
8624
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
8601
8625
  requested_format: z.ZodOptional<z.ZodObject<{
@@ -9780,8 +9804,8 @@ export declare const createWorkflowPlan: z.ZodObject<{
9780
9804
  no_actor: "no_actor";
9781
9805
  no_people: "no_people";
9782
9806
  }>>;
9783
- captions: z.ZodDefault<z.ZodBoolean>;
9784
- caption_style: z.ZodDefault<z.ZodEnum<{
9807
+ captions: z.ZodOptional<z.ZodBoolean>;
9808
+ caption_style: z.ZodOptional<z.ZodEnum<{
9785
9809
  accent: "accent";
9786
9810
  arcade: "arcade";
9787
9811
  bassdrop: "bassdrop";
@@ -9808,6 +9832,12 @@ export declare const createWorkflowPlan: z.ZodObject<{
9808
9832
  tiktok: "tiktok";
9809
9833
  youtube: "youtube";
9810
9834
  }>>;
9835
+ edit_style: z.ZodOptional<z.ZodEnum<{
9836
+ bare: "bare";
9837
+ "bold-v1": "bold-v1";
9838
+ "calm-v1": "calm-v1";
9839
+ "house-v1": "house-v1";
9840
+ }>>;
9811
9841
  caption_mode: z.ZodOptional<z.ZodEnum<{
9812
9842
  full: "full";
9813
9843
  highlights: "highlights";
@@ -17181,6 +17211,15 @@ export declare const createWorkflowPlan: z.ZodObject<{
17181
17211
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
17182
17212
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
17183
17213
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
17214
+ edit_style_default: z.ZodOptional<z.ZodObject<{
17215
+ fields: z.ZodArray<z.ZodEnum<{
17216
+ caption_emphasis: "caption_emphasis";
17217
+ caption_style: "caption_style";
17218
+ captions: "captions";
17219
+ edit_sounds: "edit_sounds";
17220
+ }>>;
17221
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
17222
+ }, z.core.$strict>>;
17184
17223
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
17185
17224
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
17186
17225
  }, z.core.$strict>;
@@ -18357,8 +18396,8 @@ export declare const saveWorkflowPlan: z.ZodObject<{
18357
18396
  no_actor: "no_actor";
18358
18397
  no_people: "no_people";
18359
18398
  }>>;
18360
- captions: z.ZodDefault<z.ZodBoolean>;
18361
- caption_style: z.ZodDefault<z.ZodEnum<{
18399
+ captions: z.ZodOptional<z.ZodBoolean>;
18400
+ caption_style: z.ZodOptional<z.ZodEnum<{
18362
18401
  accent: "accent";
18363
18402
  arcade: "arcade";
18364
18403
  bassdrop: "bassdrop";
@@ -18385,6 +18424,12 @@ export declare const saveWorkflowPlan: z.ZodObject<{
18385
18424
  tiktok: "tiktok";
18386
18425
  youtube: "youtube";
18387
18426
  }>>;
18427
+ edit_style: z.ZodOptional<z.ZodEnum<{
18428
+ bare: "bare";
18429
+ "bold-v1": "bold-v1";
18430
+ "calm-v1": "calm-v1";
18431
+ "house-v1": "house-v1";
18432
+ }>>;
18388
18433
  caption_mode: z.ZodOptional<z.ZodEnum<{
18389
18434
  full: "full";
18390
18435
  highlights: "highlights";
@@ -25758,6 +25803,15 @@ export declare const saveWorkflowPlan: z.ZodObject<{
25758
25803
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
25759
25804
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
25760
25805
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
25806
+ edit_style_default: z.ZodOptional<z.ZodObject<{
25807
+ fields: z.ZodArray<z.ZodEnum<{
25808
+ caption_emphasis: "caption_emphasis";
25809
+ caption_style: "caption_style";
25810
+ captions: "captions";
25811
+ edit_sounds: "edit_sounds";
25812
+ }>>;
25813
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
25814
+ }, z.core.$strict>>;
25761
25815
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
25762
25816
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
25763
25817
  }, z.core.$strict>;
@@ -25861,6 +25915,15 @@ export declare const workflowPlanRead: z.ZodObject<{
25861
25915
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
25862
25916
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
25863
25917
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
25918
+ edit_style_default: z.ZodOptional<z.ZodObject<{
25919
+ fields: z.ZodArray<z.ZodEnum<{
25920
+ caption_emphasis: "caption_emphasis";
25921
+ caption_style: "caption_style";
25922
+ captions: "captions";
25923
+ edit_sounds: "edit_sounds";
25924
+ }>>;
25925
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
25926
+ }, z.core.$strict>>;
25864
25927
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
25865
25928
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
25866
25929
  requested_format: z.ZodOptional<z.ZodObject<{
@@ -76,6 +76,15 @@ export declare const workflowRunOutcomeRead: z.ZodObject<{
76
76
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
77
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
78
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
+ edit_style_default: z.ZodOptional<z.ZodObject<{
80
+ fields: z.ZodArray<z.ZodEnum<{
81
+ caption_emphasis: "caption_emphasis";
82
+ caption_style: "caption_style";
83
+ captions: "captions";
84
+ edit_sounds: "edit_sounds";
85
+ }>>;
86
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ }, z.core.$strict>>;
79
88
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
89
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
90
  requested_format: z.ZodOptional<z.ZodObject<{
@@ -239,6 +248,15 @@ export declare const workflowRunIdentityRead: z.ZodObject<{
239
248
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
240
249
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
241
250
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
251
+ edit_style_default: z.ZodOptional<z.ZodObject<{
252
+ fields: z.ZodArray<z.ZodEnum<{
253
+ caption_emphasis: "caption_emphasis";
254
+ caption_style: "caption_style";
255
+ captions: "captions";
256
+ edit_sounds: "edit_sounds";
257
+ }>>;
258
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
259
+ }, z.core.$strict>>;
242
260
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
243
261
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
262
  requested_format: z.ZodOptional<z.ZodObject<{
@@ -677,6 +695,15 @@ export declare const workflowRun: z.ZodObject<{
677
695
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
678
696
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
679
697
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
698
+ edit_style_default: z.ZodOptional<z.ZodObject<{
699
+ fields: z.ZodArray<z.ZodEnum<{
700
+ caption_emphasis: "caption_emphasis";
701
+ caption_style: "caption_style";
702
+ captions: "captions";
703
+ edit_sounds: "edit_sounds";
704
+ }>>;
705
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
706
+ }, z.core.$strict>>;
680
707
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
681
708
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
682
709
  requested_format: z.ZodOptional<z.ZodObject<{
@@ -1085,6 +1112,15 @@ export declare const workflowRunRead: z.ZodObject<{
1085
1112
  added: z.ZodOptional<z.ZodArray<z.ZodString>>;
1086
1113
  move_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
1087
1114
  voice_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
1115
+ edit_style_default: z.ZodOptional<z.ZodObject<{
1116
+ fields: z.ZodArray<z.ZodEnum<{
1117
+ caption_emphasis: "caption_emphasis";
1118
+ caption_style: "caption_style";
1119
+ captions: "captions";
1120
+ edit_sounds: "edit_sounds";
1121
+ }>>;
1122
+ left_out: z.ZodOptional<z.ZodArray<z.ZodString>>;
1123
+ }, z.core.$strict>>;
1088
1124
  review_notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1089
1125
  review_warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
1090
1126
  requested_format: z.ZodOptional<z.ZodObject<{
@@ -0,0 +1,9 @@
1
+ export declare const EDIT_STYLE_NAMES: readonly ["house-v1", "calm-v1", "bold-v1", "bare"];
2
+ export type EditStyleName = (typeof EDIT_STYLE_NAMES)[number];
3
+ export declare const DEFAULT_EDIT_STYLE: EditStyleName;
4
+ export declare const EDIT_STYLE_SOURCES: readonly ["asked", "default"];
5
+ export type EditStyleSource = (typeof EDIT_STYLE_SOURCES)[number];
6
+ export declare const STYLE_FIELD_DEFAULTS: {
7
+ readonly captions: false;
8
+ readonly caption_style: "hormozi";
9
+ };
@@ -0,0 +1,4 @@
1
+ export const EDIT_STYLE_NAMES = ["house-v1", "calm-v1", "bold-v1", "bare"];
2
+ export const DEFAULT_EDIT_STYLE = "house-v1";
3
+ export const EDIT_STYLE_SOURCES = ["asked", "default"];
4
+ export const STYLE_FIELD_DEFAULTS = { captions: false, caption_style: "hormozi" };
@@ -0,0 +1,70 @@
1
+ import type { z } from "zod";
2
+ import { type EditStyleName, type EditStyleSource } from "./edit-style-names.js";
3
+ import { type CaptionPresetId } from "./skills.js";
4
+ export declare const EMPHASIS_KINDS: readonly ["number", "offer", "name", "cta", "negation", "look"];
5
+ export type EmphasisKind = (typeof EMPHASIS_KINDS)[number];
6
+ export interface EditStyle {
7
+ readonly captions: boolean;
8
+ readonly caption_style?: CaptionPresetId;
9
+ readonly emphasis: readonly EmphasisKind[];
10
+ readonly edit_sounds: boolean;
11
+ readonly punch_in: boolean;
12
+ }
13
+ export declare const EDIT_STYLES: Readonly<Record<EditStyleName, EditStyle>>;
14
+ export declare const EDIT_STYLE_FIELDS: readonly ["caption_emphasis", "edit_sounds", "caption_style", "captions"];
15
+ export type EditStyleField = (typeof EDIT_STYLE_FIELDS)[number];
16
+ type StyleField = EditStyleField;
17
+ export interface AppliedEditStyle {
18
+ name: EditStyleName;
19
+ source: EditStyleSource;
20
+ fields: StyleField[];
21
+ left_out: string[];
22
+ }
23
+ export interface StyleExpansion {
24
+ body: unknown;
25
+ style?: AppliedEditStyle;
26
+ }
27
+ export interface ExpandEditStyleOptions {
28
+ defaultStyle: boolean;
29
+ longForm: boolean;
30
+ emphasis?: (script: string, kinds: readonly EmphasisKind[]) => readonly string[];
31
+ }
32
+ export declare function expandEditStyle(raw: unknown, options: ExpandEditStyleOptions): StyleExpansion;
33
+ export declare function leaveOutStyleFields(expansion: StyleExpansion, hits: readonly {
34
+ field: string;
35
+ reason: string;
36
+ }[]): StyleExpansion;
37
+ export declare function parseStyled<T>(schema: z.ZodType<T>, expansion: StyleExpansion): {
38
+ success: true;
39
+ data: T;
40
+ expansion: StyleExpansion;
41
+ } | {
42
+ success: false;
43
+ error: z.ZodError;
44
+ };
45
+ export interface EditStylePins {
46
+ edit_style?: string | undefined;
47
+ edit_style_source?: EditStyleSource | undefined;
48
+ edit_style_fields?: string[] | undefined;
49
+ edit_style_left_out?: string[] | undefined;
50
+ }
51
+ export interface RequestStylePins {
52
+ edit_style?: EditStyleName;
53
+ edit_style_source?: EditStyleSource;
54
+ edit_style_fields?: string[];
55
+ edit_style_left_out?: string[];
56
+ }
57
+ export declare const editStylePins: (style: AppliedEditStyle | undefined) => RequestStylePins;
58
+ export declare const editStylePinsOf: (input: object) => RequestStylePins;
59
+ export declare function askedUgcBody<T extends object>(input: T): T;
60
+ export declare function withoutStyleCaptions<T extends object>(input: T, reason: string): T;
61
+ export declare function styleCaptionsRefusal(input: object, reason: string): string | undefined;
62
+ export declare function withStyleEmphasisOn<T extends object>(input: T, script: string, reason: string): T;
63
+ export declare function editStyleLines(input: object): string[];
64
+ export declare function editStyleApplied(input: object): {
65
+ name: string;
66
+ source: EditStyleSource;
67
+ fields: Record<string, unknown>;
68
+ left_out?: string[];
69
+ } | undefined;
70
+ export {};
@@ -0,0 +1,202 @@
1
+ import { DEFAULT_EDIT_STYLE, EDIT_STYLE_NAMES, STYLE_FIELD_DEFAULTS } from "./edit-style-names.js";
2
+ import { captionEmphasisOf, isNarratedUgcInput, MAX_CAPTION_EMPHASIS, MAX_CAPTION_EMPHASIS_CHARS, speechModelRefusals } from "./skills.js";
3
+ import { lexicalTokens, quoteOccurrences } from "./semantic-inserts.js";
4
+ import { hasFullFrameTemplate } from "./templates/index.js";
5
+ import { MAX_SCRIPT_CHARS } from "./voices.js";
6
+ export const EMPHASIS_KINDS = ["number", "offer", "name", "cta", "negation", "look"];
7
+ export const EDIT_STYLES = Object.freeze({
8
+ "house-v1": { captions: true, caption_style: "hormozi", emphasis: ["number", "offer", "name", "cta"], edit_sounds: true, punch_in: false },
9
+ "calm-v1": { captions: true, caption_style: "accent", emphasis: ["name", "cta"], edit_sounds: false, punch_in: false },
10
+ "bold-v1": { captions: true, caption_style: "hormozi", emphasis: EMPHASIS_KINDS, edit_sounds: true, punch_in: true },
11
+ bare: { captions: false, emphasis: [], edit_sounds: false, punch_in: false },
12
+ });
13
+ export const EDIT_STYLE_FIELDS = ["caption_emphasis", "edit_sounds", "caption_style", "captions"];
14
+ const CAPTION_DEPENDENTS = ["caption_emphasis", "caption_style"];
15
+ const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
16
+ const text = (value) => (typeof value === "string" ? value : undefined);
17
+ const isStyleName = (value) => EDIT_STYLE_NAMES.includes(value);
18
+ function hasCuts(raw) {
19
+ if (raw.inserts !== undefined || raw.layout_windows !== undefined || raw.framing !== undefined)
20
+ return true;
21
+ try {
22
+ return hasFullFrameTemplate(raw.templates);
23
+ }
24
+ catch {
25
+ return false;
26
+ }
27
+ }
28
+ export function expandEditStyle(raw, options) {
29
+ if (!isRecord(raw))
30
+ return { body: raw };
31
+ const asked = raw.edit_style;
32
+ if (asked !== undefined && !isStyleName(asked))
33
+ return { body: raw };
34
+ const name = asked ?? (options.defaultStyle ? DEFAULT_EDIT_STYLE : undefined);
35
+ if (name === undefined)
36
+ return { body: raw };
37
+ const style = EDIT_STYLES[name], body = { ...raw }, fields = [], leftOut = [];
38
+ const applied = () => ({ name, source: asked === undefined ? "default" : "asked", fields, left_out: leftOut });
39
+ if (!style.captions)
40
+ return { body, style: applied() };
41
+ let captions = raw.captions === true;
42
+ if (!("captions" in raw)) {
43
+ const refused = speechModelRefusals({ tts_model: text(raw.tts_model), voice: text(raw.voice), captions: true }).some(one => one.field === "captions");
44
+ if (raw.segments !== undefined)
45
+ leftOut.push("captions: a video of segments takes none");
46
+ else if (refused)
47
+ leftOut.push("captions: the voice's speech model returns no word timings");
48
+ else {
49
+ body.captions = true;
50
+ fields.push("captions");
51
+ captions = true;
52
+ }
53
+ }
54
+ if (captions && style.caption_style !== undefined && !("caption_style" in raw)) {
55
+ body.caption_style = style.caption_style;
56
+ fields.push("caption_style");
57
+ }
58
+ const script = text(raw.script), readable = script !== undefined && script.length <= MAX_SCRIPT_CHARS;
59
+ if (captions && style.emphasis.length > 0 && !("caption_emphasis" in raw) && readable && options.emphasis) {
60
+ const quotes = [...new Set(options.emphasis(script, style.emphasis))]
61
+ .filter(quote => quote.trim().length > 0 && quote.length <= MAX_CAPTION_EMPHASIS_CHARS).slice(0, MAX_CAPTION_EMPHASIS);
62
+ const punch = style.punch_in && options.longForm && isNarratedUgcInput(raw);
63
+ if (quotes.length > 0) {
64
+ body.caption_emphasis = quotes.map(quote => (punch ? { quote, punch_in: true } : quote));
65
+ fields.push("caption_emphasis");
66
+ }
67
+ }
68
+ if (style.edit_sounds && !("edit_sounds" in raw) && raw.template_sounds !== false && hasCuts(raw)) {
69
+ body.edit_sounds = true;
70
+ fields.push("edit_sounds");
71
+ }
72
+ return { body, style: applied() };
73
+ }
74
+ function withStyleFields(expansion, keep) {
75
+ if (!expansion.style || !isRecord(expansion.body))
76
+ return expansion;
77
+ const body = { ...expansion.body };
78
+ for (const field of expansion.style.fields)
79
+ if (!keep.includes(field))
80
+ delete body[field];
81
+ return { body, style: { ...expansion.style, fields: expansion.style.fields.filter(field => keep.includes(field)) } };
82
+ }
83
+ export function leaveOutStyleFields(expansion, hits) {
84
+ const style = expansion.style;
85
+ if (!style)
86
+ return expansion;
87
+ const why = new Map(hits.filter(hit => style.fields.includes(hit.field)).map(hit => [hit.field, hit.reason]));
88
+ const captions = why.get("captions");
89
+ if (captions !== undefined)
90
+ for (const dependent of CAPTION_DEPENDENTS)
91
+ if (style.fields.includes(dependent) && !why.has(dependent))
92
+ why.set(dependent, captions);
93
+ if (why.size === 0)
94
+ return expansion;
95
+ const kept = withStyleFields(expansion, style.fields.filter(field => !why.has(field)));
96
+ kept.style.left_out = [...style.left_out, ...style.fields.filter(field => why.has(field)).map(field => `${field}: ${shortReason(why.get(field))}`)];
97
+ return kept;
98
+ }
99
+ const REASON_CHARS = 200;
100
+ const shortReason = (message) => (message.length > REASON_CHARS ? `${message.slice(0, REASON_CHARS - 1)}…` : message);
101
+ export function parseStyled(schema, expansion) {
102
+ let current = expansion;
103
+ for (;;) {
104
+ const parsed = schema.safeParse(current.body);
105
+ if (parsed.success)
106
+ return { success: true, data: parsed.data, expansion: current };
107
+ const style = current.style;
108
+ if (!style || style.fields.length === 0)
109
+ return { success: false, error: parsed.error };
110
+ const hit = new Set(parsed.error.issues.map(issue => String(issue.path[0])).filter((field) => style.fields.includes(field)));
111
+ if (hit.has("captions"))
112
+ for (const dependent of CAPTION_DEPENDENTS)
113
+ hit.add(dependent);
114
+ const dropped = hit.size > 0 ? style.fields.filter(field => hit.has(field)) : style.fields;
115
+ if (hit.size === 0 && !schema.safeParse(withStyleFields(current, []).body).success)
116
+ return { success: false, error: parsed.error };
117
+ const reason = shortReason(parsed.error.issues[0].message);
118
+ current = withStyleFields(current, style.fields.filter(field => !dropped.includes(field)));
119
+ current.style.left_out = [...style.left_out, ...dropped.map(field => `${field}: ${reason}`)];
120
+ }
121
+ }
122
+ export const editStylePins = (style) => style
123
+ ? { edit_style: style.name, edit_style_source: style.source, edit_style_fields: [...style.fields], ...(style.left_out.length ? { edit_style_left_out: [...style.left_out] } : {}) }
124
+ : {};
125
+ export const editStylePinsOf = (input) => {
126
+ const { edit_style, edit_style_source, edit_style_fields = [], edit_style_left_out } = input;
127
+ return edit_style_source === undefined || !isStyleName(edit_style) ? {} : { edit_style, edit_style_source, edit_style_fields: [...edit_style_fields],
128
+ ...(edit_style_left_out?.length ? { edit_style_left_out: [...edit_style_left_out] } : {}) };
129
+ };
130
+ export function askedUgcBody(input) {
131
+ const pins = input;
132
+ if (pins.edit_style_source === undefined)
133
+ return input;
134
+ const { edit_style_source: _source, edit_style_fields: fields = [], edit_style_left_out: _left, ...rest } = input;
135
+ const body = { ...rest };
136
+ if (pins.edit_style_source === "default")
137
+ delete body.edit_style;
138
+ for (const field of fields)
139
+ delete body[field];
140
+ return body;
141
+ }
142
+ export function withoutStyleCaptions(input, reason) {
143
+ const fields = input.edit_style_fields ?? [];
144
+ if (!fields.includes("captions"))
145
+ return input;
146
+ const body = { ...input };
147
+ const given = ["captions", ...CAPTION_DEPENDENTS].filter(field => fields.includes(field));
148
+ for (const field of given) {
149
+ if (field in STYLE_FIELD_DEFAULTS)
150
+ body[field] = STYLE_FIELD_DEFAULTS[field];
151
+ else
152
+ delete body[field];
153
+ }
154
+ body.edit_style_fields = fields.filter(field => !given.includes(field));
155
+ body.edit_style_left_out = [...input.edit_style_left_out ?? [], `captions: ${reason}`];
156
+ return body;
157
+ }
158
+ const NEEDS_CAPTIONS = ["caption_emphasis", "caption_position", "caption_place", "caption_mode"];
159
+ export function styleCaptionsRefusal(input, reason) {
160
+ const values = input, fields = input.edit_style_fields ?? [];
161
+ if (values.captions === true)
162
+ return undefined;
163
+ const own = NEEDS_CAPTIONS.filter(field => values[field] !== undefined && !fields.includes(field) && (field !== "caption_mode" || values[field] === "highlights"));
164
+ return own.length === 0 ? undefined : `${own.join(", ")} ${own.length === 1 ? "needs" : "need"} captions, which the style turned on and then left out: ` +
165
+ `${reason}. Pick a voice whose speech model times words, or drop ${own.join(", ")}`;
166
+ }
167
+ export function withStyleEmphasisOn(input, script, reason) {
168
+ const values = input, fields = input.edit_style_fields ?? [];
169
+ const items = values.caption_emphasis;
170
+ if (!fields.includes("caption_emphasis") || !items?.length)
171
+ return input;
172
+ const tokens = lexicalTokens(script);
173
+ const said = items.filter(item => quoteOccurrences(tokens, captionEmphasisOf(item).quote).length > 0);
174
+ if (said.length === items.length)
175
+ return input;
176
+ const gone = items.filter(item => !said.includes(item)).map(item => `"${captionEmphasisOf(item).quote}"`).join(", ");
177
+ const body = { ...values, edit_style_left_out: [...input.edit_style_left_out ?? [],
178
+ shortReason(`caption_emphasis ${gone}: ${reason}`)] };
179
+ if (said.length > 0)
180
+ body.caption_emphasis = said;
181
+ else {
182
+ delete body.caption_emphasis;
183
+ body.edit_style_fields = fields.filter(field => field !== "caption_emphasis");
184
+ }
185
+ return body;
186
+ }
187
+ export function editStyleLines(input) {
188
+ const { edit_style: name, edit_style_source: source, edit_style_fields: fields = [], edit_style_left_out: leftOut = [] } = input;
189
+ if (source === undefined || name === undefined)
190
+ return [];
191
+ const choice = name === "bare" ? `Style: bare (${source}): no captions, emphasis or cut sounds added.`
192
+ : fields.length === 0 ? `Style: ${name} (${source}): it set no field; the request sets them itself.`
193
+ : `Style: ${name} (${source}) set ${fields.join(", ")}. A field you pass wins over it; edit_style "bare" sets none.`;
194
+ return [choice, ...(leftOut.length ? [`Style ${name} left out ${leftOut.join("; ")}.`] : [])];
195
+ }
196
+ export function editStyleApplied(input) {
197
+ const { edit_style: name, edit_style_source: source, edit_style_fields: fields = [], edit_style_left_out: leftOut = [] } = input;
198
+ if (source === undefined || name === undefined)
199
+ return undefined;
200
+ const values = input;
201
+ return { name, source, fields: Object.fromEntries(fields.map(field => [field, values[field]])), ...(leftOut.length ? { left_out: leftOut } : {}) };
202
+ }
package/dist/errors.d.ts CHANGED
@@ -246,7 +246,7 @@ export type EditCeilingReachedError = z.infer<typeof editCeilingReachedError>;
246
246
  export declare function editCeilingReachedBody(args: Omit<EditCeilingReachedError["error"], "code" | "message">, counting?: "revision" | "candidate"): EditCeilingReachedError;
247
247
  export declare function unusableSourceMessage(errorClass: string, detail: string): string;
248
248
  export declare const MALFORMED_BODY_MESSAGE: string;
249
- declare const BARE_ERROR_CODES: readonly ["analysis_enqueue_failed", "aspect_conflict", "actor_unavailable", "actor_format_unavailable", "actor_storage_unavailable", "actor_generation_disabled", "actor_in_use", "ad_limited", "ad_not_found", "ad_slot_in_use", "ad_slot_unchecked", "asset_cap_exceeded", "asset_ingest_cap_exceeded", "asset_not_found", "asset_not_ready", "assets_disabled", "creator_profile_limited", "creator_profile_not_found", "creator_url_unsupported", "cut_busy", "cut_limited", "cut_not_found", "cut_preview_limited", "cut_slot_in_use", "deletion_held", "editing_window_not_set", "explainer_busy", "feedback_limited", "film_asset_not_ready", "film_draft_limited", "film_draft_not_found", "film_draft_stale", "film_hero_limited", "film_run_not_found", "film_voice_not_ready", "generations_disabled", "generations_marking_pending", "idempotency_key_required", "idempotency_key_reused", "ingest_enqueue_failed", "insufficient_scope", "internal_error", "invalid_image", "invalid_request", "malformed_body", "no_changes", "not_found", "own_agent_disabled", "own_agent_marking_pending", "paid_render_disabled", "payload_too_large", "reference_analysis_disabled", "reference_analysis_limited", "reference_analysis_not_found", "reference_not_analyzable", "reference_not_usable", "reference_url_unsupported", "revision_needs_generated_unit", "rights_not_confirmed", "run_media_in_use", "run_not_finished", "run_not_found", "source_aspect_mismatch", "source_not_usable", "take_check_limited", "take_frames_limited", "trend_page_unavailable", "trend_search_limited", "trend_search_not_found", "trends_unavailable", "unauthorized", "unsupported_combination", "unsupported_media_type", "unusable_source", "upload_cap_exceeded", "upload_digest_mismatch", "upload_expired", "upload_in_use", "upload_not_finished", "upload_page_rate_limited", "upload_page_used", "upload_size_mismatch", "upstream_error", "url_fetch_busy", "url_fetch_failed", "url_fetch_rate_limited", "url_fetch_refused", "url_import_disabled"];
249
+ declare const BARE_ERROR_CODES: readonly ["analysis_enqueue_failed", "aspect_conflict", "actor_unavailable", "actor_format_unavailable", "actor_storage_unavailable", "actor_generation_disabled", "actor_in_use", "ad_limited", "ad_not_found", "ad_slot_in_use", "ad_slot_unchecked", "asset_cap_exceeded", "asset_ingest_cap_exceeded", "asset_not_found", "asset_not_ready", "assets_disabled", "creator_profile_limited", "creator_profile_not_found", "creator_url_unsupported", "cut_busy", "cut_limited", "cut_not_found", "cut_preview_limited", "cut_slot_in_use", "deletion_held", "editing_window_not_set", "explainer_busy", "feedback_limited", "film_asset_not_ready", "film_draft_limited", "film_draft_not_found", "film_draft_stale", "film_hero_limited", "film_run_not_found", "film_voice_not_ready", "generations_disabled", "generations_marking_pending", "idempotency_key_required", "idempotency_key_reused", "ingest_enqueue_failed", "insufficient_scope", "internal_error", "invalid_image", "invalid_request", "malformed_body", "no_changes", "not_found", "own_agent_disabled", "own_agent_marking_pending", "paid_render_disabled", "payload_too_large", "reference_analysis_disabled", "reference_analysis_limited", "reference_analysis_not_found", "reference_not_analyzable", "reference_not_usable", "reference_url_unsupported", "revision_needs_generated_unit", "rights_not_confirmed", "run_media_in_use", "run_not_finished", "run_not_found", "source_aspect_mismatch", "source_not_usable", "take_check_limited", "take_frames_limited", "trend_page_unavailable", "trend_search_limited", "trend_search_not_found", "trends_unavailable", "trial_excludes_generation", "unauthorized", "unsupported_combination", "unsupported_media_type", "unusable_source", "upload_cap_exceeded", "upload_digest_mismatch", "upload_expired", "upload_in_use", "upload_not_finished", "upload_page_rate_limited", "upload_page_used", "upload_size_mismatch", "upstream_error", "url_fetch_busy", "url_fetch_failed", "url_fetch_rate_limited", "url_fetch_refused", "url_import_disabled"];
250
250
  export type BareApiErrorCode = (typeof BARE_ERROR_CODES)[number];
251
251
  export declare const API_ERROR_CODES: readonly string[];
252
252
  export declare function apiErrorBody(args: {
package/dist/errors.js CHANGED
@@ -354,6 +354,7 @@ const BARE_ERROR_CODES = [
354
354
  "trend_search_limited",
355
355
  "trend_search_not_found",
356
356
  "trends_unavailable",
357
+ "trial_excludes_generation",
357
358
  "unauthorized",
358
359
  "unsupported_combination",
359
360
  "unsupported_media_type",
@@ -6,7 +6,7 @@ export type FilmKitFile = (typeof FILM_KIT_FILES)[number];
6
6
  export declare const isFilmKitFile: (path: string) => path is FilmKitFile;
7
7
  export declare const FILM_GUIDE_FORMATS: readonly ["explainer", "story", "list", "own_pictures", "cartoon"];
8
8
  export type FilmGuideFormat = (typeof FILM_GUIDE_FORMATS)[number];
9
- export declare const FILM_GUIDE_SECTIONS: readonly ["steps", "story", "words", "captions", "voice", "consistency", "pictures", "motion", "density", "repair"];
9
+ export declare const FILM_GUIDE_SECTIONS: readonly ["workflow", "steps", "story", "words", "captions", "voice", "consistency", "pictures", "motion", "density", "repair"];
10
10
  export type FilmGuideSection = (typeof FILM_GUIDE_SECTIONS)[number];
11
11
  export declare const RECENT_LOOKS_MAX = 5;
12
12
  export declare const guideCatalog: z.ZodArray<z.ZodObject<{
@@ -48,6 +48,7 @@ export declare const filmGuideQuery: z.ZodObject<{
48
48
  story: "story";
49
49
  voice: "voice";
50
50
  words: "words";
51
+ workflow: "workflow";
51
52
  }>>;
52
53
  }, z.core.$strict>;
53
54
  export type FilmGuideQuery = z.infer<typeof filmGuideQuery>;
@@ -50,7 +50,7 @@ export const FILM_KIT_FILES = [
50
50
  export const isFilmKitFile = (path) => FILM_KIT_FILES.includes(path);
51
51
  const kitPath = z.string().min(1);
52
52
  export const FILM_GUIDE_FORMATS = ["explainer", "story", "list", "own_pictures", "cartoon"];
53
- export const FILM_GUIDE_SECTIONS = ["steps", "story", "words", "captions", "voice", "consistency", "pictures", "motion", "density", "repair"];
53
+ export const FILM_GUIDE_SECTIONS = ["workflow", "steps", "story", "words", "captions", "voice", "consistency", "pictures", "motion", "density", "repair"];
54
54
  export const RECENT_LOOKS_MAX = 5;
55
55
  export const guideCatalog = z.array(z.strictObject({
56
56
  tool: z.enum(["get_ad_guide", "get_film_guide"]),
@@ -67,7 +67,7 @@ export const filmGuideQuery = z.strictObject({
67
67
  format: z.enum(FILM_GUIDE_FORMATS).optional().describe("The video to make: explainer (the default, a coded film), story, list (facts or " +
68
68
  "tips), own_pictures (the user's own pictures) or cartoon (a drawn hero in generated pictures)"),
69
69
  section: z.enum(FILM_GUIDE_SECTIONS).optional()
70
- .describe("One part of a story, list, own_pictures or cartoon guide instead of all of it: steps, or one theme of the craft"),
70
+ .describe("One part of a story, list, own_pictures or cartoon guide instead of all of it: workflow, steps, or one theme of the craft"),
71
71
  }).refine(query => query.section === undefined || (query.format !== undefined && query.format !== "explainer"), { message: "section reads one part of a story, list, own_pictures or cartoon guide: name that format too", path: ["section"] });
72
72
  export const FILM_KEPT_SOUNDS_MAX = 60;
73
73
  const kitVersion = z.string().regex(/^[a-f0-9]{12}$/).describe("The kit's version: a digest of its files, which changes when any of them does");
package/dist/index.d.ts CHANGED
@@ -29,6 +29,8 @@ export * from "./caption-language.js";
29
29
  export * from "./templates/index.js";
30
30
  export * from "./ugc-video-media.js";
31
31
  export * from "./ad-pause-trim.js";
32
+ export * from "./edit-style-names.js";
33
+ export * from "./edit-style.js";
32
34
  export * from "./faceless-public.js";
33
35
  export * from "./faceless-customer-anchors.js";
34
36
  export * from "./faceless-action-shots.js";
package/dist/index.js CHANGED
@@ -29,6 +29,8 @@ export * from "./caption-language.js";
29
29
  export * from "./templates/index.js";
30
30
  export * from "./ugc-video-media.js";
31
31
  export * from "./ad-pause-trim.js";
32
+ export * from "./edit-style-names.js";
33
+ export * from "./edit-style.js";
32
34
  export * from "./faceless-public.js";
33
35
  export * from "./faceless-customer-anchors.js";
34
36
  export * from "./faceless-action-shots.js";
@@ -9,7 +9,8 @@ export declare const MCP_UGC_DESCRIPTIONS: {
9
9
  readonly voice: string;
10
10
  readonly inserts: string;
11
11
  readonly segments: string;
12
- readonly captions: "Burn word-timed captions in, over the presenter and inserts; not with segments.";
12
+ readonly captions: "Burn word-timed captions in, over the presenter and inserts; not with segments. Omitted: as edit_style sets it, otherwise off.";
13
+ readonly edit_style: string;
13
14
  readonly caption_position: "top, middle, lower or bottom (80% of the height); omitted, the caption_style's own place. Requires captions=true.";
14
15
  readonly actor_id: "Saved actor ID from list_actors; not with image or actor_gender. Without voice or voice_id the voice follows its gender.";
15
16
  readonly voice_id: string;
@@ -51,7 +51,7 @@ export function compactTemplateCatalogText(kinds = offeredTemplateKinds()) {
51
51
  return `${kind.kind} (${kind.placements.join("|")})${gist === null ? "" : `: ${gist}`}; data ${data(kind)}`;
52
52
  }).join(". ") + ".";
53
53
  }
54
- const CAPTION_STYLE_TEXT = "Caption look when captions=true; hormozi is the default. " +
54
+ const CAPTION_STYLE_TEXT = "Caption look when captions=true; omitted, edit_style's, otherwise hormozi. " +
55
55
  Object.entries(CAPTION_STYLE_ALIASES).map(([alias, preset]) => `${alias} draws ${preset}`).join("; ") +
56
56
  ". Every style's look and preview: https://clipwright.io/captions";
57
57
  const SCRIPT_TEXT = "The words the actor says; required unless segments supplies the spoken text. Segments and text-anchored inserts require " +
@@ -71,7 +71,7 @@ export const MCP_UGC_DESCRIPTIONS = {
71
71
  caption_emphasis: "Script words or phrases to emphasise, every occurrence, matched as an insert quote. An item is the quote or " +
72
72
  "{ quote, look }: punch (a lead-in line over a large glowing keyword), pill (alone in a pill), color (accent colour) or box (soft " +
73
73
  "accent box). Without look: punch draws punch, hormozi and accent color, others larger in their highlight colour. Needs " +
74
- "captions=true; a quote not in script is refused before any charge.",
74
+ "captions=true; a quote not in script is refused before any charge. Omitted: the words edit_style picks.",
75
75
  voice: "Voice name from list_voices (presets sarah | george | eric | daria_ru_female); another name is refused before any charge. " +
76
76
  "Omitted: the default voice of the actor's gender (actor_id's or actor_gender's; george for the default actor and for image " +
77
77
  "alone). A gemini-3.8-flash-tts voice selects that model; a tts_model not speaking the voice is refused. Not with voice_id.",
@@ -79,7 +79,9 @@ export const MCP_UGC_DESCRIPTIONS = {
79
79
  "qualification on the server and broll_policy=anyone. Captions draw over them.",
80
80
  segments: "Ordered actor and image segments; need long-form qualification on the server and captions=false; image media " +
81
81
  "needs broll_policy=anyone.",
82
- captions: "Burn word-timed captions in, over the presenter and inserts; not with segments.",
82
+ captions: "Burn word-timed captions in, over the presenter and inserts; not with segments. Omitted: as edit_style sets it, otherwise off.",
83
+ edit_style: "house-v1 | calm-v1 | bold-v1 | bare: a named set of captions, caption_style, caption_emphasis and edit_sounds; a field you " +
84
+ "pass wins. Omitted: the server's default style where it applies one. The quote's edit_style_applied names it. Price unchanged.",
83
85
  caption_position: "top, middle, lower or bottom (80% of the height); omitted, the caption_style's own place. Requires captions=true.",
84
86
  actor_id: "Saved actor ID from list_actors; not with image or actor_gender. Without voice or voice_id the voice follows its gender.",
85
87
  voice_id: "Raw vendor voice id (16–32 letters and digits) outside the catalog; an unknown id fails the run, not the request. Not with " +