@clipwright/core 0.46.0 → 0.48.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 (129) hide show
  1. package/dist/ad-pause-trim.d.ts +1 -0
  2. package/dist/ad-pause-trim.js +4 -2
  3. package/dist/ad-pause-trim.js.map +1 -1
  4. package/dist/api-failure.d.ts +2 -0
  5. package/dist/api-failure.js +10 -2
  6. package/dist/api-failure.js.map +1 -1
  7. package/dist/assets.d.ts +85 -0
  8. package/dist/assets.js +5 -0
  9. package/dist/assets.js.map +1 -1
  10. package/dist/caption-language.d.ts +3 -0
  11. package/dist/caption-language.js +13 -0
  12. package/dist/caption-language.js.map +1 -1
  13. package/dist/contract-dispositions.d.ts +163 -42
  14. package/dist/contract-dispositions.js +3 -2
  15. package/dist/contract-dispositions.js.map +1 -1
  16. package/dist/contracts/v1/workflow-brief.d.ts +472 -94
  17. package/dist/contracts/v1/workflow-brief.js +2 -0
  18. package/dist/contracts/v1/workflow-brief.js.map +1 -1
  19. package/dist/contracts/v1/workflow-catalog.d.ts +474 -94
  20. package/dist/contracts/v1/workflow-client.d.ts +253 -47
  21. package/dist/contracts/v1/workflow-client.js +2 -1
  22. package/dist/contracts/v1/workflow-client.js.map +1 -1
  23. package/dist/contracts/v1/workflow-execution.d.ts +41 -0
  24. package/dist/contracts/v1/workflow-next.d.ts +13 -0
  25. package/dist/contracts/v1/workflow-plan.d.ts +710 -141
  26. package/dist/contracts/v1/workflow-run-read.d.ts +14 -0
  27. package/dist/design.d.ts +2 -0
  28. package/dist/design.js +4 -2
  29. package/dist/design.js.map +1 -1
  30. package/dist/endpoints.js +21 -0
  31. package/dist/endpoints.js.map +1 -1
  32. package/dist/errors.d.ts +1 -1
  33. package/dist/errors.js +8 -0
  34. package/dist/errors.js.map +1 -1
  35. package/dist/explainer-fit.d.ts +8 -2
  36. package/dist/explainer-fit.js +28 -5
  37. package/dist/explainer-fit.js.map +1 -1
  38. package/dist/faceless-price.d.ts +66 -2
  39. package/dist/faceless-price.js +66 -7
  40. package/dist/faceless-price.js.map +1 -1
  41. package/dist/faceless-public.d.ts +272 -50
  42. package/dist/faceless-public.js +84 -15
  43. package/dist/faceless-public.js.map +1 -1
  44. package/dist/faceless-voices.d.ts +37 -1
  45. package/dist/faceless-voices.js +41 -1
  46. package/dist/faceless-voices.js.map +1 -1
  47. package/dist/film-drafts.d.ts +251 -0
  48. package/dist/film-drafts.js +92 -0
  49. package/dist/film-drafts.js.map +1 -0
  50. package/dist/film-guide.d.ts +74 -0
  51. package/dist/film-guide.js +42 -0
  52. package/dist/film-guide.js.map +1 -0
  53. package/dist/film-styles.d.ts +109 -0
  54. package/dist/film-styles.js +29 -0
  55. package/dist/film-styles.js.map +1 -0
  56. package/dist/generation-shot.d.ts +100 -0
  57. package/dist/generation-shot.js +129 -0
  58. package/dist/generation-shot.js.map +1 -0
  59. package/dist/generations.d.ts +69 -3
  60. package/dist/generations.js +37 -3
  61. package/dist/generations.js.map +1 -1
  62. package/dist/idempotency.d.ts +3 -0
  63. package/dist/idempotency.js +6 -0
  64. package/dist/idempotency.js.map +1 -1
  65. package/dist/index.d.ts +10 -0
  66. package/dist/index.js +10 -0
  67. package/dist/index.js.map +1 -1
  68. package/dist/mascots.d.ts +118 -0
  69. package/dist/mascots.js +30 -0
  70. package/dist/mascots.js.map +1 -0
  71. package/dist/music.d.ts +2 -0
  72. package/dist/music.js +4 -1
  73. package/dist/music.js.map +1 -1
  74. package/dist/naming.d.ts +6 -0
  75. package/dist/naming.js +137 -0
  76. package/dist/naming.js.map +1 -0
  77. package/dist/openapi.js +14 -0
  78. package/dist/openapi.js.map +1 -1
  79. package/dist/own-agent-price.d.ts +53 -0
  80. package/dist/own-agent-price.js +67 -0
  81. package/dist/own-agent-price.js.map +1 -0
  82. package/dist/own-agent-runs.d.ts +186 -0
  83. package/dist/own-agent-runs.js +110 -0
  84. package/dist/own-agent-runs.js.map +1 -0
  85. package/dist/prices.js +27 -10
  86. package/dist/prices.js.map +1 -1
  87. package/dist/reference-lyrics.d.ts +47 -0
  88. package/dist/reference-lyrics.js +39 -0
  89. package/dist/reference-lyrics.js.map +1 -0
  90. package/dist/resolved-timeline.d.ts +3 -3
  91. package/dist/run-static-warnings.js +4 -1
  92. package/dist/run-static-warnings.js.map +1 -1
  93. package/dist/runs.d.ts +12 -0
  94. package/dist/runs.js +4 -0
  95. package/dist/runs.js.map +1 -1
  96. package/dist/scene-place.d.ts +5 -2
  97. package/dist/scene-place.js +8 -2
  98. package/dist/scene-place.js.map +1 -1
  99. package/dist/skill-theme-explainer.d.ts +2 -0
  100. package/dist/skill-theme-explainer.js +64 -0
  101. package/dist/skill-theme-explainer.js.map +1 -0
  102. package/dist/skill-theme.d.ts +161 -0
  103. package/dist/skill-theme.js +274 -0
  104. package/dist/skill-theme.js.map +1 -0
  105. package/dist/skills.d.ts +740 -120
  106. package/dist/skills.js +39 -11
  107. package/dist/skills.js.map +1 -1
  108. package/dist/tts-model-languages.generated.json +10 -1
  109. package/dist/ugc-scenes.d.ts +9 -4
  110. package/dist/ugc-scenes.js +27 -3
  111. package/dist/ugc-scenes.js.map +1 -1
  112. package/dist/voice-admission.d.ts +235 -47
  113. package/dist/voice-catalog.generated.json +1129 -691
  114. package/dist/workflows/methods/faceless-explainer.d.ts +109 -0
  115. package/dist/workflows/methods/faceless-explainer.js +2 -2
  116. package/dist/workflows/methods/faceless-explainer.js.map +1 -1
  117. package/dist/workflows/methods/kinetic-launch.d.ts +109 -0
  118. package/dist/workflows/methods/product-image-story.d.ts +109 -0
  119. package/dist/workflows/methods/reference-remake.d.ts +109 -0
  120. package/dist/workflows/methods/shared.d.ts +109 -0
  121. package/dist/workflows/methods/ugc-faq-answer.d.ts +109 -0
  122. package/dist/workflows/methods/ugc-product-intro.d.ts +109 -0
  123. package/dist/workflows/methods/website-proof-demo.d.ts +109 -0
  124. package/dist/workflows/reference-remake.d.ts +57 -0
  125. package/dist/workflows/reference-remake.js +139 -11
  126. package/dist/workflows/reference-remake.js.map +1 -1
  127. package/dist/workflows/validate.js +1 -1
  128. package/dist/workflows/validate.js.map +1 -1
  129. package/package.json +1 -1
@@ -1677,6 +1677,39 @@ export declare const websiteProofDemo: {
1677
1677
  brief: string;
1678
1678
  text?: string | undefined;
1679
1679
  colors?: string[] | undefined;
1680
+ place?: {
1681
+ fit?: "contain" | "cover" | undefined;
1682
+ allow_face?: true | undefined;
1683
+ relative_to: "captions" | "face" | {
1684
+ layer: string;
1685
+ };
1686
+ side: "above" | "below" | "left" | "over" | "right";
1687
+ gap?: number | undefined;
1688
+ align?: "center" | "end" | "start" | undefined;
1689
+ width?: number | undefined;
1690
+ height?: number | undefined;
1691
+ size_unit?: "face" | "frame" | undefined;
1692
+ } | {
1693
+ fit?: "contain" | "cover" | undefined;
1694
+ allow_face?: true | undefined;
1695
+ relative_to: "frame";
1696
+ rect: {
1697
+ left: number;
1698
+ top: number;
1699
+ width: number;
1700
+ height: number;
1701
+ };
1702
+ } | {
1703
+ fit?: "contain" | "cover" | undefined;
1704
+ allow_face?: true | undefined;
1705
+ relative_to: "face";
1706
+ rect: {
1707
+ left: number;
1708
+ top: number;
1709
+ width: number;
1710
+ height: number;
1711
+ };
1712
+ } | undefined;
1680
1713
  }[] | undefined;
1681
1714
  presenter_gaze?: {
1682
1715
  anchor: {
@@ -1712,6 +1745,44 @@ export declare const websiteProofDemo: {
1712
1745
  action?: string | undefined;
1713
1746
  }[] | undefined;
1714
1747
  transition?: "cut" | "flash" | "light_leak" | "whoosh" | undefined;
1748
+ shot?: {
1749
+ framing: {
1750
+ size: "close_up" | "extreme_close_up" | "full" | "medium" | "medium_close_up" | "wide";
1751
+ angle?: "eye_level" | "high" | "low" | "overhead" | undefined;
1752
+ lens_mm?: number | undefined;
1753
+ depth?: "deep" | "shallow" | undefined;
1754
+ };
1755
+ subject: {
1756
+ label: string;
1757
+ fixed: string[];
1758
+ objects?: {
1759
+ name: string;
1760
+ count: number;
1761
+ at_start: string;
1762
+ }[] | undefined;
1763
+ };
1764
+ start_state: string;
1765
+ beats: {
1766
+ from_s: number;
1767
+ to_s: number;
1768
+ action: string;
1769
+ end_state: string;
1770
+ objects?: string[] | undefined;
1771
+ }[];
1772
+ camera: {
1773
+ move: "handheld" | "pan" | "pull_back" | "push_in" | "static";
1774
+ speed?: "medium" | "slow" | undefined;
1775
+ };
1776
+ light: {
1777
+ key: string;
1778
+ direction?: string | undefined;
1779
+ };
1780
+ continuity: {
1781
+ persistent: string[];
1782
+ end_state: string;
1783
+ continues_from?: string | undefined;
1784
+ };
1785
+ } | undefined;
1715
1786
  }[] | undefined;
1716
1787
  caption_emphasis?: (string | {
1717
1788
  quote: string;
@@ -1726,6 +1797,7 @@ export declare const websiteProofDemo: {
1726
1797
  style_reference?: string | undefined;
1727
1798
  character_reference?: string | undefined;
1728
1799
  character_details?: string | undefined;
1800
+ mascot_id?: string | undefined;
1729
1801
  scene_images?: {
1730
1802
  image_url: string;
1731
1803
  anchor: {
@@ -1763,6 +1835,7 @@ export declare const websiteProofDemo: {
1763
1835
  }[] | undefined;
1764
1836
  } | undefined;
1765
1837
  format?: "explainer" | "standard" | undefined;
1838
+ tier?: "pro" | "standard" | undefined;
1766
1839
  input_mode: "brief";
1767
1840
  brief: string;
1768
1841
  transitions?: false | {
@@ -1779,6 +1852,7 @@ export declare const websiteProofDemo: {
1779
1852
  style_reference?: string | undefined;
1780
1853
  character_reference?: string | undefined;
1781
1854
  character_details?: string | undefined;
1855
+ mascot_id?: string | undefined;
1782
1856
  scene_images?: {
1783
1857
  image_url: string;
1784
1858
  anchor: {
@@ -1816,6 +1890,7 @@ export declare const websiteProofDemo: {
1816
1890
  }[] | undefined;
1817
1891
  } | undefined;
1818
1892
  format?: "explainer" | "standard" | undefined;
1893
+ tier?: "pro" | "standard" | undefined;
1819
1894
  input_mode: "script";
1820
1895
  transitions?: false | {
1821
1896
  look: "flash" | "light_leak";
@@ -3152,6 +3227,39 @@ export declare const websiteProofDemo: {
3152
3227
  brief: string;
3153
3228
  text?: string | undefined;
3154
3229
  colors?: string[] | undefined;
3230
+ place?: {
3231
+ fit?: "contain" | "cover" | undefined;
3232
+ allow_face?: true | undefined;
3233
+ relative_to: "captions" | "face" | {
3234
+ layer: string;
3235
+ };
3236
+ side: "above" | "below" | "left" | "over" | "right";
3237
+ gap?: number | undefined;
3238
+ align?: "center" | "end" | "start" | undefined;
3239
+ width?: number | undefined;
3240
+ height?: number | undefined;
3241
+ size_unit?: "face" | "frame" | undefined;
3242
+ } | {
3243
+ fit?: "contain" | "cover" | undefined;
3244
+ allow_face?: true | undefined;
3245
+ relative_to: "frame";
3246
+ rect: {
3247
+ left: number;
3248
+ top: number;
3249
+ width: number;
3250
+ height: number;
3251
+ };
3252
+ } | {
3253
+ fit?: "contain" | "cover" | undefined;
3254
+ allow_face?: true | undefined;
3255
+ relative_to: "face";
3256
+ rect: {
3257
+ left: number;
3258
+ top: number;
3259
+ width: number;
3260
+ height: number;
3261
+ };
3262
+ } | undefined;
3155
3263
  }[] | undefined;
3156
3264
  moves?: {
3157
3265
  name: string;
@@ -3551,6 +3659,7 @@ export declare const websiteProofDemo: {
3551
3659
  move_warnings?: string[] | undefined;
3552
3660
  voice_warnings?: string[] | undefined;
3553
3661
  review_notes?: string[] | undefined;
3662
+ review_warnings?: string[] | undefined;
3554
3663
  };
3555
3664
  beats: {
3556
3665
  id: string;
@@ -1,9 +1,13 @@
1
1
  import { z } from 'zod';
2
2
  import { type ReferenceProfileInput as ReferenceProfile } from '../reference-profile.js';
3
+ import { type GenerationShot } from '../generation-shot.js';
4
+ import { LIVE_SHOT_PRODUCT_PLACEMENTS } from '../skills.js';
3
5
  import type { CapabilityProfile } from '../contracts/v1/workflow-catalog.js';
4
6
  import { type WorkflowPlanDocument } from '../contracts/v1/workflow-plan.js';
5
7
  import { type WorkflowIssue } from '../contracts/v1/workflow-primitives.js';
6
8
  import { type RemakeChooser } from './remake-chooser.js';
9
+ /** The steps a product demo takes, then a still hold (#1307 S2): with the hold, at most four beats in one clip. */
10
+ export declare const DEMO_MAX_STEPS = 3;
7
11
  /** What the compiler reads: the profile itself. */
8
12
  export declare const planReferenceRemake: z.ZodObject<{
9
13
  plan_id: z.ZodOptional<z.ZodString>;
@@ -955,6 +959,23 @@ export declare const planReferenceRemake: z.ZodObject<{
955
959
  role: z.ZodString;
956
960
  action: z.ZodOptional<z.ZodString>;
957
961
  }, z.core.$strict>>>;
962
+ pause_trim: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
963
+ sentence_end_s: z.ZodOptional<z.ZodNumber>;
964
+ comma_s: z.ZodOptional<z.ZodNumber>;
965
+ mid_phrase_s: z.ZodOptional<z.ZodNumber>;
966
+ }, z.core.$strict>]>>;
967
+ product: z.ZodOptional<z.ZodObject<{
968
+ asset_id: z.ZodString;
969
+ placement: z.ZodDefault<z.ZodEnum<{
970
+ beside: "beside";
971
+ hand: "hand";
972
+ }>>;
973
+ name: z.ZodDefault<z.ZodString>;
974
+ demo: z.ZodOptional<z.ZodArray<z.ZodObject<{
975
+ action: z.ZodString;
976
+ end_state: z.ZodString;
977
+ }, z.core.$strict>>>;
978
+ }, z.core.$strict>>;
958
979
  }, z.core.$strict>;
959
980
  /** What a client sends (#1172): the profile, or the analysis_id of an analysis the server reads it from. */
960
981
  export declare const planReferenceRemakeRequest: z.ZodObject<{
@@ -1094,6 +1115,23 @@ export declare const planReferenceRemakeRequest: z.ZodObject<{
1094
1115
  role: z.ZodString;
1095
1116
  action: z.ZodOptional<z.ZodString>;
1096
1117
  }, z.core.$strict>>>;
1118
+ pause_trim: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
1119
+ sentence_end_s: z.ZodOptional<z.ZodNumber>;
1120
+ comma_s: z.ZodOptional<z.ZodNumber>;
1121
+ mid_phrase_s: z.ZodOptional<z.ZodNumber>;
1122
+ }, z.core.$strict>]>>;
1123
+ product: z.ZodOptional<z.ZodObject<{
1124
+ asset_id: z.ZodString;
1125
+ placement: z.ZodDefault<z.ZodEnum<{
1126
+ beside: "beside";
1127
+ hand: "hand";
1128
+ }>>;
1129
+ name: z.ZodDefault<z.ZodString>;
1130
+ demo: z.ZodOptional<z.ZodArray<z.ZodObject<{
1131
+ action: z.ZodString;
1132
+ end_state: z.ZodString;
1133
+ }, z.core.$strict>>>;
1134
+ }, z.core.$strict>>;
1097
1135
  reference_profile: z.ZodOptional<z.ZodObject<{
1098
1136
  version: z.ZodLiteral<"reference-profile-v1">;
1099
1137
  source: z.ZodObject<{
@@ -1936,6 +1974,25 @@ export type ReferenceSpanPlanner = (input: {
1936
1974
  profile: ReferenceProfile;
1937
1975
  words: readonly ReferenceScriptWord[];
1938
1976
  }) => ReferenceSpan[];
1977
+ /** The longest demo clip: the longest live shot take the run renders. Words past it are the presenter's usual take. */
1978
+ export declare const DEMO_CLIP_MAX_S = 15;
1979
+ type RemakeProduct = {
1980
+ asset_id: string;
1981
+ placement: (typeof LIVE_SHOT_PRODUCT_PLACEMENTS)[number];
1982
+ name: string;
1983
+ demo?: {
1984
+ action: string;
1985
+ end_state: string;
1986
+ }[] | undefined;
1987
+ };
1988
+ /** The demo as one clip of `seconds` (#1307 S2): it opens on one product already where the shots hold it, each step once, then a still hold;
1989
+ * every second is owned by a beat, so the clip has no seconds to repeat a step in. */
1990
+ export declare function demoShot(product: RemakeProduct & {
1991
+ demo: {
1992
+ action: string;
1993
+ end_state: string;
1994
+ }[];
1995
+ }, seconds: number): GenerationShot;
1939
1996
  type ReferenceGraphic = ReferenceProfile['beats'][number]['graphics'][number];
1940
1997
  /** What the asset library says of a request's asset (#1170): the server reads it, a direct compile may pass none. */
1941
1998
  /** `seconds`: a video asset's measured length, which caps the words its clip covers. */
@@ -11,7 +11,8 @@ import { referenceProfileInput } from '../reference-profile.js';
11
11
  import { narrationPaceFromVoice, PAUSE_TRIM_CEILING_S, pauseTrimFromVoice } from '../reference-voice.js';
12
12
  import { AD_PAUSE_TRIM } from '../ad-pause-trim.js';
13
13
  import { countActorShots, coverWordOf, lexicalTokens, planSemanticInserts, quoteOccurrences } from '../semantic-inserts.js';
14
- import { actorId, callStage, insertBox, isNarratedUgcInput, makeUgcInput, makeUgcInputShape, MAX_INSERTS, MAX_LIVE_SHOTS, MAX_NARRATED_ACTOR_SHOTS, MAX_PRESENTER_TAKES, MAX_SHOT_CAST, motionStyle, ugcCall, ugcLiveShotCastMember, ugcTemplate } from '../skills.js';
14
+ import { negationIn, SHOT_BEAT_MAX_S } from '../generation-shot.js';
15
+ import { actorId, callStage, insertBox, isNarratedUgcInput, LIVE_SHOT_PRODUCT_PLACEMENTS, makeUgcInput, makeUgcInputShape, MAX_INSERTS, MAX_LIVE_SHOTS, MAX_NARRATED_ACTOR_SHOTS, MAX_PRESENTER_TAKES, MAX_SHOT_CAST, motionStyle, ugcCall, ugcLiveShotCastMember, ugcTemplate } from '../skills.js';
15
16
  import { ugcMarkedComponentsRefusal } from '../presenter-takes.js';
16
17
  import { CALL_PHONE_DEFAULTS, CALL_STAGE_SIDES } from '../ugc-call.js';
17
18
  import { MAX_TEMPLATES, TEMPLATE_ENTER_FRAMES, TEMPLATE_KIND_IDS, TEMPLATE_KINDS, TEMPLATE_PLACEMENTS, templateFaceWarnings, templateMediaOf, templateTextRefusal } from '../templates/index.js';
@@ -32,6 +33,8 @@ import { lookName } from './motion-director.js';
32
33
  import { preferChosen } from './remake-chooser.js';
33
34
  import { beatCue, FLASH_SNAP_S, planMotion } from './remake-motion.js';
34
35
  // The reference-remake compiler (#857 S2a): a profile and an accepted script become a complete plan whose native input is a make_ugc input.
36
+ /** The steps a product demo takes, then a still hold (#1307 S2): with the hold, at most four beats in one clip. */
37
+ export const DEMO_MAX_STEPS = 3;
35
38
  const remakeFields = {
36
39
  plan_id: workflowId.optional(), base_version: saveWorkflowPlan.shape.base_version.optional(),
37
40
  review_notes: z.array(workflowText(2000)).max(50).optional(),
@@ -67,6 +70,20 @@ const remakeFields = {
67
70
  .refine(cast => new Set(cast.map(person => person.asset_id)).size === cast.length, { message: 'each cast picture appears once' }).optional()
68
71
  .describe(`Up to ${MAX_SHOT_CAST} more people beside the actor in every acting live shot, as make_ugc shots cast: a picture, a role and ` +
69
72
  'what they do. Without an acting live shot the plan names it undrawn.'),
73
+ pause_trim: makeUgcInputShape.pause_trim.describe('Narration pauses, as make_ugc pause_trim; it wins over the reference\'s pauses. ' +
74
+ `Omitted: the reference presenter's measured pauses, else ${AD_PAUSE_TRIM.sentence_end_s} and ${AD_PAUSE_TRIM.comma_s}.`),
75
+ product: z.strictObject({
76
+ asset_id: assetId.describe('Your product image (ast_…), as make_ugc product_asset_id.'),
77
+ placement: z.enum(LIVE_SHOT_PRODUCT_PLACEMENTS).default('hand').describe('hand: every acting live shot starts with it in the actor\'s hand; ' +
78
+ 'beside: standing within reach.'),
79
+ name: z.string().trim().min(1).max(40).default('product').describe('What it is, as the shots name it: jar, bottle, drill.'),
80
+ demo: z.array(z.strictObject({
81
+ action: z.string().trim().min(1).max(300).describe('One step of using it, done once, as cause, contact and result: her fingertip dips ' +
82
+ 'into the jar once and lifts a dab of cream.'),
83
+ end_state: z.string().trim().min(1).max(200).describe('What the frame shows when the step ends: a dab of cream sits on her fingertip.'),
84
+ })).min(1).max(DEMO_MAX_STEPS).optional().describe('The reference\'s demo beats become one live shot of the actor using it, from a first ' +
85
+ 'frame with it in hand, in these steps, then a still hold. Describe what is visible.'),
86
+ }).optional().describe('Your product in the actor\'s hand (or beside them) in every acting live shot.'),
70
87
  };
71
88
  const revisionPair = (value, context) => {
72
89
  if ((value.plan_id === undefined) !== (value.base_version === undefined)) {
@@ -119,6 +136,43 @@ const GESTURE_ACTIONS = { both_hands_to_viewer: 'reaches both hands toward the v
119
136
  hold_object: 'holds an object up to the camera', open_palms: 'opens both palms toward the viewer', wave: 'waves at the viewer', shrug: 'shrugs',
120
137
  thumbs_up: 'gives a thumbs up', other: undefined };
121
138
  const REACTION = 'reacts to the words with a warm smile and a nod';
139
+ /** The longest demo clip: the longest live shot take the run renders. Words past it are the presenter's usual take. */
140
+ export const DEMO_CLIP_MAX_S = 15;
141
+ const heldAt = (product) => product.placement === 'hand' ? `in one hand at chest height, its label to the camera`
142
+ : 'standing beside the presenter within reach, its label to the camera';
143
+ /** A gesture's action with the product named when the gesture holds something. */
144
+ const gestureAction = (kind, product) => kind === 'hold_object' && product ? `holds the ${product.name} up to the camera, its label toward the lens` : GESTURE_ACTIONS[kind];
145
+ /** The demo as one clip of `seconds` (#1307 S2): it opens on one product already where the shots hold it, each step once, then a still hold;
146
+ * every second is owned by a beat, so the clip has no seconds to repeat a step in. */
147
+ export function demoShot(product, seconds) {
148
+ const hold = product.placement === 'hand'
149
+ ? { action: `The presenter holds the ${product.name} still at chest height, its label to the camera, and smiles`,
150
+ end_state: `The presenter holds the ${product.name} at chest height, its label to the camera` }
151
+ : { action: `The presenter rests both hands beside the ${product.name} and smiles at the camera`,
152
+ end_state: `The ${product.name} stands beside the presenter, its label to the camera` };
153
+ // The hold goes last whenever the clip has a second for it: without it the clip's last seconds repeat a step. Short of seconds, the steps
154
+ // become one beat that does each in turn.
155
+ const merged = { action: product.demo.map(step => step.action.replace(/[.!?]+$/, '')).join(', then '), end_state: product.demo.at(-1).end_state };
156
+ const steps = seconds >= product.demo.length + 1 ? [...product.demo, hold] : seconds >= 2 ? [merged, hold] : [merged];
157
+ const length = Math.max(steps.length, Math.min(seconds, steps.length * SHOT_BEAT_MAX_S)), base = Math.floor(length / steps.length);
158
+ let from = 0;
159
+ const beats = steps.map((step, at) => {
160
+ const to = from + base + (at < length - base * steps.length ? 1 : 0), beat = { from_s: from, to_s: to, action: step.action, end_state: step.end_state };
161
+ from = to;
162
+ return beat;
163
+ });
164
+ return {
165
+ framing: { size: 'medium' },
166
+ subject: { label: 'the presenter', fixed: ['the face, hair and clothes of Image 1', `the ${product.name}'s shape, colours and printed label`],
167
+ objects: [{ name: product.name, count: 1, at_start: heldAt(product) }] },
168
+ start_state: product.placement === 'hand' ? `The presenter holds one ${product.name} in one hand at chest height, its label to the camera`
169
+ : `One ${product.name} stands beside the presenter within reach, its label to the camera`,
170
+ beats,
171
+ camera: { move: 'static' },
172
+ light: { key: 'the light of Image 1' },
173
+ continuity: { persistent: [`exactly one ${product.name}`, 'the same place as Image 1'], end_state: beats.at(-1).end_state },
174
+ };
175
+ }
122
176
  const SHOT_SIZE_RANK = { close: 0, wide: 1, full: 2 };
123
177
  /** An acting shot's first frame, wider than the take (#1175 S7): the beat's measured size when wider (medium and wide are the wide view), else */
124
178
  /** wide on a close take, since an action needs the hands in frame; undefined keeps the take's view. */
@@ -320,6 +374,14 @@ export function compileReferenceRemake(input, capabilities, planSpans = proporti
320
374
  if (!parsed.success)
321
375
  return { kind: 'invalid', issues: parsed.error.issues.map(issue => ({ kind: 'invalid_request', path: issue.path.join('.'), message: issue.message })) };
322
376
  const request = parsed.data, { script } = request, profile = request.reference_profile;
377
+ // The product's words reach a clip model, which draws what a sentence names: they describe what is visible (#1307 S2).
378
+ const said = request.product ? [['product.name', request.product.name], ...(request.product.demo ?? []).flatMap((step, at) => [[`product.demo.${at}.action`, step.action], [`product.demo.${at}.end_state`, step.end_state]]),
379
+ // The cast acts in the demo clip beside its words.
380
+ ...request.product.demo ? (request.cast ?? []).flatMap((person, at) => person.action ? [[`cast.${at}.action`, person.action]] : []) : []] : [];
381
+ const negated = said.flatMap(([path, text]) => { const word = negationIn(text); return word === null ? [] : [{ path, word }]; });
382
+ if (negated.length)
383
+ return { kind: 'invalid', issues: negated.map(({ path, word }) => ({ kind: 'invalid_request', path,
384
+ message: `"${word}" describes what is absent; describe what is visible instead (her fingertips are clean, the jar is closed)` })) };
323
385
  const words = referenceScriptWords(script), tokens = lexicalTokens(script), language = captionLanguageOf(script);
324
386
  if (words.length === 0)
325
387
  return { kind: 'invalid', issues: [{ kind: 'invalid_request', path: 'script', message: 'The script has no words to place beats on.' }] };
@@ -1298,8 +1360,58 @@ export function compileReferenceRemake(input, capabilities, planSpans = proporti
1298
1360
  const meets = (layer, start, end) => { const range = rangeOf(layer); return !!range && range.startWord < end && start < range.coverWord; };
1299
1361
  const covers = (layer) => layer.field === 'inserts' || layer.field === 'layout_windows' || ((layer.field === 'templates' || layer.field === 'scenes')
1300
1362
  && (layer.item.placement ?? TEMPLATE_KINDS.find(entry => entry.kind === layer.kind)?.placements[0]) === 'full');
1363
+ const product = request.product;
1364
+ const holding = product ? { product: { placement: product.placement } } : {};
1365
+ // The reference's demo, with the product's steps given, is one clip of the actor using it (#1307 S2): adjacent demo beats join the first.
1366
+ const demoBeat = (index) => profile.beats[index].role === 'demo' && profile.beats[index].presenter_behaviour !== 'listening';
1367
+ const demoEnds = new Map(), joined = new Map();
1368
+ let lead;
1369
+ for (const { beat } of onScreen) {
1370
+ if (!demoBeat(beat)) {
1371
+ lead = undefined;
1372
+ continue;
1373
+ }
1374
+ if (lead !== undefined && spans[beat].start <= demoEnds.get(lead)) {
1375
+ demoEnds.set(lead, Math.max(demoEnds.get(lead), spans[beat].end));
1376
+ joined.set(beat, lead);
1377
+ }
1378
+ else {
1379
+ lead = beat;
1380
+ demoEnds.set(beat, spans[beat].end);
1381
+ }
1382
+ }
1383
+ if (product && !product.demo && shotsOn && shotsAsked) {
1384
+ for (const beat of demoEnds.keys()) {
1385
+ const group = [beat, ...[...joined].filter(([, head]) => head === beat).map(([at]) => at)].map(at => at + 1).join(', ');
1386
+ note(beat, `the reference's demo of the product (beats ${group})`, `the presenter's usual take: pass product.demo, the steps of using your ${product.name}, to show it in the presenter's hands`);
1387
+ }
1388
+ }
1389
+ /** The words a demo clip covers: up to the longest clip at the slowest pace, cut at a clause end inside it; the presenter says the rest. */
1390
+ const clipEnd = (start, end) => {
1391
+ const most = Math.floor(DEMO_CLIP_MAX_S * WORDS_PER_SECOND_MIN + 1e-9);
1392
+ if (end - start <= most)
1393
+ return end;
1394
+ const stop = words.slice(start, start + most).findLastIndex(word => word.stop !== undefined);
1395
+ return start + (stop >= 0 ? stop + 1 : most);
1396
+ };
1301
1397
  const wanted = !shotsAsked || !shotsOn ? [] : onScreen.flatMap(({ beat: index }, at) => {
1302
1398
  const beat = profile.beats[index], span = spans[index];
1399
+ if (product?.demo && demoEnds.has(index)) {
1400
+ const end = clipEnd(span.start, demoEnds.get(index));
1401
+ if ((call && resumeAt > span.start && resumeAt < end) || layers.some(layer => covers(layer) && meets(layer, span.start, end)))
1402
+ return [];
1403
+ if (end < demoEnds.get(index)) {
1404
+ note(index, `the demo's words past one clip (${DEMO_CLIP_MAX_S} s)`, `the presenter's usual take on the last ${demoEnds.get(index) - end} words`);
1405
+ }
1406
+ const wider = shotFramingOf(beat.shot_size, framing), demo = { ...product, demo: product.demo };
1407
+ const shot = { id: `ref-${index + 1}-shot`, kind: 'action', anchor: { startWord: span.start, endWord: end },
1408
+ action: demo.demo.map(step => step.action.replace(/[.!?]+$/u, '')).join(', then '), ...holding, ...wider ? { framing: wider } : {},
1409
+ ...request.cast ? { cast: request.cast } : {}, shot: demoShot(demo, Math.ceil(((end - span.start) * duration) / words.length)) };
1410
+ const last = Math.max(index, ...[...joined].filter(([, head]) => head === index).map(([at]) => at));
1411
+ return [{ beat: index, words: end - span.start, shot, demo: last }];
1412
+ }
1413
+ if (joined.has(index) && product?.demo)
1414
+ return [];
1303
1415
  if (beat.presenter_behaviour !== 'speaking' && beat.presenter_behaviour !== 'reacting')
1304
1416
  return [];
1305
1417
  if (request.live_shots === undefined && !beat.gestures?.length)
@@ -1309,17 +1421,19 @@ export function compileReferenceRemake(input, capabilities, planSpans = proporti
1309
1421
  return [];
1310
1422
  if (layers.some(layer => covers(layer) && meets(layer, span.start, span.end)))
1311
1423
  return [];
1312
- const action = [...new Set([...beat.gestures ?? []].sort((a, b) => a.at_s - b.at_s).flatMap(entry => GESTURE_ACTIONS[entry.kind] ?? []))].join(', then ');
1424
+ const action = [...new Set([...beat.gestures ?? []].sort((a, b) => a.at_s - b.at_s).flatMap(entry => gestureAction(entry.kind, product) ?? []))].join(', then ');
1313
1425
  const acted = beat.presenter_behaviour === 'reacting' || !!action;
1314
1426
  const wider = shotFramingOf(beat.shot_size, framing);
1315
- // The request's cast stands beside the actor in every acting shot (#1192): those shots share one setup, so one cast.
1427
+ // The request's cast stands beside the actor in every acting shot (#1192): those shots share one setup, so one cast; so does the product.
1316
1428
  const shot = { id: `ref-${index + 1}-shot`, anchor: { startWord: span.start, endWord: span.end },
1317
1429
  ...beat.presenter_behaviour === 'reacting' ? { kind: 'action', action: action || REACTION }
1318
1430
  : action ? { kind: 'talking_action', action } : { kind: 'talking' },
1319
- ...acted && wider ? { framing: wider } : {}, ...acted && request.cast ? { cast: request.cast } : {} };
1320
- return [{ beat: index, words: span.end - span.start, shot }];
1431
+ ...acted && wider ? { framing: wider } : {}, ...acted && request.cast ? { cast: request.cast } : {}, ...acted ? holding : {} };
1432
+ return [{ beat: index, words: span.end - span.start, shot, demo: undefined }];
1321
1433
  });
1322
1434
  const kept = new Set([...wanted].sort((a, b) => b.words - a.words || a.beat - b.beat).slice(0, MAX_LIVE_SHOTS));
1435
+ /** Each demo clip's layer, with the last reference beat it shows. */
1436
+ const demos = new Map();
1323
1437
  for (const entry of wanted) {
1324
1438
  const { beat, shot } = entry;
1325
1439
  if (!kept.has(entry)) {
@@ -1349,6 +1463,8 @@ export function compileReferenceRemake(input, capabilities, planSpans = proporti
1349
1463
  moves.set(layer, { keys: ['transition'], added: [{ beat_index: beat,
1350
1464
  what: `${lookName(look)} on the cuts into and out of the hook's live shot (beat ${beat + 1})` }] });
1351
1465
  }
1466
+ if (entry.demo !== undefined)
1467
+ demos.set(layer, entry.demo);
1352
1468
  layers.push(layer);
1353
1469
  }
1354
1470
  const soundsOn = longForm && !['warned', 'rejected', 'stored'].includes(executor?.field_dispositions.edit_sounds ?? '');
@@ -1389,10 +1505,11 @@ export function compileReferenceRemake(input, capabilities, planSpans = proporti
1389
1505
  else if (pace.clamped) {
1390
1506
  note(0, `narration pace ${pace.target_wps} words/s of the reference presenter (speed ${pace.wanted} wanted)`, `voice_pace ${pace.voice_pace}, the end of the speed range: the narration may run ${pace.wanted > pace.voice_pace ? 'slower' : 'faster'} than the reference`);
1391
1507
  }
1392
- // Speed first, then the residual: pauses longer than the presenter's word-gap medians are cut in silence only.
1508
+ // Speed first, then pauses past the presenter's word-gap medians are cut; the request's own win, as a reference's gaps may be a song's (#1308).
1393
1509
  // A remake is an ad: without the reference's own pauses it takes the ad-style default (#1136).
1394
- const pauseTrim = pauseTrimFromVoice(profile.voice), pauseTargets = pauseTrim?.targets ?? { ...AD_PAUSE_TRIM };
1395
- if (!pauseTrim?.targets)
1510
+ const pauseTrim = request.pause_trim === undefined ? pauseTrimFromVoice(profile.voice) : undefined;
1511
+ const pauseTargets = request.pause_trim ?? pauseTrim?.targets ?? { ...AD_PAUSE_TRIM };
1512
+ if (request.pause_trim === undefined && !pauseTrim?.targets)
1396
1513
  note(0, 'narration pauses (the reference presenter\'s pauses were not measured)', `pause_trim ${AD_PAUSE_TRIM.sentence_end_s} s after a sentence and ${AD_PAUSE_TRIM.comma_s} s after a comma, the default for an ad`);
1397
1514
  for (const { key, median_s } of pauseTrim?.capped ?? []) {
1398
1515
  note(0, `narration pauses ${key} ${Math.round(median_s * 100) / 100} s of the reference presenter`, `pause_trim ${key} ${PAUSE_TRIM_CEILING_S}, the longest target: these pauses may run shorter than the reference`);
@@ -1433,10 +1550,11 @@ export function compileReferenceRemake(input, capabilities, planSpans = proporti
1433
1550
  const field = (name) => { const items = layers.filter(layer => layer.field === name).map(layer => layer.item); return items.length ? { [name]: items } : {}; };
1434
1551
  native = { script, actor_id: request.actor_id, ...(framing !== 'close' ? { presenter_framing: framing } : {}), ...(mic ? { presenter_mic: true } : {}),
1435
1552
  ...(request.voice ? { voice: request.voice } : {}), ...(request.voice_id ? { voice_id: request.voice_id } : {}),
1436
- ...(pace.kind === 'paced' && !fixedPace ? { voice_pace: pace.voice_pace } : {}), ...(pauseTargets ? { pause_trim: pauseTargets } : {}),
1553
+ ...(pace.kind === 'paced' && !fixedPace ? { voice_pace: pace.voice_pace } : {}), pause_trim: pauseTargets,
1437
1554
  ...(profile.captions.present ? { captions: true, caption_style: captionStyle, ...(captionsPlaced ? { caption_position: captionPosition } : {}) } : {}),
1438
1555
  ...field('caption_emphasis'), ...field('templates'), ...field('scenes'), ...field('overlays'), ...field('inserts'), ...field('layout_windows'), ...field('framing'),
1439
- ...(call ? { call } : {}), ...field('shots') };
1556
+ ...(call ? { call } : {}), ...field('shots'),
1557
+ ...product && layers.some(layer => layer.field === 'shots' && layer.item.product) ? { product_asset_id: product.asset_id } : {} };
1440
1558
  // Cut sounds only when the client asks: on a remake they sounded too loud on every cut (#1076).
1441
1559
  if (request.edit_sounds === true && soundsOn && cutToSound())
1442
1560
  native.edit_sounds = true;
@@ -1575,6 +1693,14 @@ export function compileReferenceRemake(input, capabilities, planSpans = proporti
1575
1693
  }
1576
1694
  break;
1577
1695
  }
1696
+ if (product && !native.product_asset_id) {
1697
+ note(0, `your product ${product.asset_id} in the presenter's ${product.placement === 'hand' ? 'hand' : 'shots'}`, `not shown: no live shot acts on this plan ` +
1698
+ `(${!shotsOn ? 'live shots are not available here' : request.live_shots === false ? 'live_shots is false' : 'no beat of the reference acts, and no product.demo'})`);
1699
+ }
1700
+ else if (product) {
1701
+ note(0, `your product in every talking second`, 'only in the live shots: the usual take shows the actor as the actor view does; an actor view ' +
1702
+ 'holding it (create_actor holding) shows it throughout');
1703
+ }
1578
1704
  if (request.cast && !layers.some(layer => layer.field === 'shots' && layer.item.cast)) {
1579
1705
  note(0, `your cast (${request.cast.map(person => person.role).join(', ')})`, 'not drawn: the plan has no acting live shot, where the reference presenter gestures or reacts');
1580
1706
  }
@@ -1589,7 +1715,9 @@ export function compileReferenceRemake(input, capabilities, planSpans = proporti
1589
1715
  ...native.edit_sounds ? [`a sound on every cut, as you asked${motion.sounded.length ? `; the reference has a whoosh or a click on beats ${sounded}` : ''}`] : [],
1590
1716
  ...native.music ? [`music under the voice, as you asked${music >= 0 ? '; the reference has a music bed' : ''}`] : [],
1591
1717
  ...native.shots ? [`live shots of the presenter on beats ${beatsOf(layers.filter(layer => layer.field === 'shots').map(layer => layer.beat))}, as you asked; ` +
1592
- 'each shot kind bills its own presenter-second price'] : []];
1718
+ 'each shot kind bills its own presenter-second price'] : [],
1719
+ ...[...demos].filter(([layer]) => layers.includes(layer)).map(([layer, last]) => `the demo on beats ${layer.beat + 1}${last > layer.beat ? `–${last + 1}` : ''}: ` +
1720
+ `one live shot of the presenter using your ${product.name}, from a first frame with it ${product.placement === 'hand' ? 'in hand' : 'beside them'}`)];
1593
1721
  // Every place the compiler chose for an unpinned asset is named (#1170): the line its name matches, else its order in assets.
1594
1722
  const shownBy = (asset) => layers.find(layer => JSON.stringify(layer.item).includes(`"${asset.asset_id}"`));
1595
1723
  for (const { asset, beat } of guessed.filter(entry => entry.how === 'name' && shownBy(entry.asset))) {