@clipwright/core 0.89.0 → 0.90.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/assets.d.ts +6 -0
- package/dist/film-drafts.d.ts +33 -2
- package/dist/film-drafts.js +13 -2
- package/dist/mascots.d.ts +2 -0
- package/dist/mascots.js +2 -0
- package/dist/own-agent-runs.d.ts +29 -4
- package/dist/own-agent-runs.js +70 -9
- package/dist/voice-admission.d.ts +1 -0
- package/dist/voice-admission.js +12 -2
- package/package.json +1 -1
package/dist/assets.d.ts
CHANGED
|
@@ -224,6 +224,7 @@ export declare const asset: z.ZodObject<{
|
|
|
224
224
|
}>>;
|
|
225
225
|
character: z.ZodNullable<z.ZodString>;
|
|
226
226
|
head: z.ZodOptional<z.ZodBoolean>;
|
|
227
|
+
talking_sprites: z.ZodOptional<z.ZodBoolean>;
|
|
227
228
|
}, z.core.$strict>>;
|
|
228
229
|
url: z.ZodString;
|
|
229
230
|
preview_url: z.ZodOptional<z.ZodString>;
|
|
@@ -354,6 +355,7 @@ export declare const assetItem: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
354
355
|
}>>;
|
|
355
356
|
character: z.ZodNullable<z.ZodString>;
|
|
356
357
|
head: z.ZodOptional<z.ZodBoolean>;
|
|
358
|
+
talking_sprites: z.ZodOptional<z.ZodBoolean>;
|
|
357
359
|
}, z.core.$strict>>;
|
|
358
360
|
url: z.ZodString;
|
|
359
361
|
preview_url: z.ZodOptional<z.ZodString>;
|
|
@@ -491,6 +493,7 @@ export declare const assetList: z.ZodObject<{
|
|
|
491
493
|
}>>;
|
|
492
494
|
character: z.ZodNullable<z.ZodString>;
|
|
493
495
|
head: z.ZodOptional<z.ZodBoolean>;
|
|
496
|
+
talking_sprites: z.ZodOptional<z.ZodBoolean>;
|
|
494
497
|
}, z.core.$strict>>;
|
|
495
498
|
url: z.ZodString;
|
|
496
499
|
preview_url: z.ZodOptional<z.ZodString>;
|
|
@@ -585,6 +588,7 @@ export declare const assetRead: z.ZodObject<{
|
|
|
585
588
|
}>>;
|
|
586
589
|
character: z.ZodNullable<z.ZodString>;
|
|
587
590
|
head: z.ZodOptional<z.ZodBoolean>;
|
|
591
|
+
talking_sprites: z.ZodOptional<z.ZodBoolean>;
|
|
588
592
|
}, z.core.$strict>>;
|
|
589
593
|
url: z.ZodString;
|
|
590
594
|
preview_url: z.ZodOptional<z.ZodString>;
|
|
@@ -647,6 +651,7 @@ export declare const assetItemRead: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
647
651
|
}>>;
|
|
648
652
|
character: z.ZodNullable<z.ZodString>;
|
|
649
653
|
head: z.ZodOptional<z.ZodBoolean>;
|
|
654
|
+
talking_sprites: z.ZodOptional<z.ZodBoolean>;
|
|
650
655
|
}, z.core.$strict>>;
|
|
651
656
|
url: z.ZodString;
|
|
652
657
|
preview_url: z.ZodOptional<z.ZodString>;
|
|
@@ -710,6 +715,7 @@ export declare const assetListRead: z.ZodObject<{
|
|
|
710
715
|
}>>;
|
|
711
716
|
character: z.ZodNullable<z.ZodString>;
|
|
712
717
|
head: z.ZodOptional<z.ZodBoolean>;
|
|
718
|
+
talking_sprites: z.ZodOptional<z.ZodBoolean>;
|
|
713
719
|
}, z.core.$strict>>;
|
|
714
720
|
url: z.ZodString;
|
|
715
721
|
preview_url: z.ZodOptional<z.ZodString>;
|
package/dist/film-drafts.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { type FacelessCustomerSceneImage } from "./faceless-public.js";
|
|
2
3
|
export declare const FILM_DRAFTS_PATH = "/v1/film-drafts";
|
|
3
4
|
export declare const FILM_DRAFT_PATH = "/v1/film-drafts/:id";
|
|
4
5
|
export declare const FILM_DRAFT_FILES_PATH = "/v1/film-drafts/:id/files";
|
|
@@ -29,6 +30,9 @@ export declare const filmStoryboardEvent: z.ZodObject<{
|
|
|
29
30
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
30
31
|
what: z.ZodString;
|
|
31
32
|
}, z.core.$strict>;
|
|
33
|
+
export declare const isPauseRow: (row: {
|
|
34
|
+
phrase: string;
|
|
35
|
+
}) => boolean;
|
|
32
36
|
export declare const filmStoryboardRow: z.ZodObject<{
|
|
33
37
|
phrase: z.ZodString;
|
|
34
38
|
start: z.ZodNumber;
|
|
@@ -356,19 +360,46 @@ export declare const filmSceneVideo: z.ZodObject<{
|
|
|
356
360
|
from: z.ZodDefault<z.ZodNumber>;
|
|
357
361
|
}, z.core.$strict>;
|
|
358
362
|
export type FilmSceneVideo = z.infer<typeof filmSceneVideo>;
|
|
363
|
+
export declare const FILM_MAX_CHARACTER_PICTURES = 8;
|
|
364
|
+
export declare const filmSceneImage: z.ZodObject<{
|
|
365
|
+
image_url: z.ZodString;
|
|
366
|
+
anchor: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
367
|
+
startWord: z.ZodNumber;
|
|
368
|
+
endWord: z.ZodNumber;
|
|
369
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
370
|
+
quote: z.ZodString;
|
|
371
|
+
occurrence: z.ZodOptional<z.ZodNumber>;
|
|
372
|
+
}, z.core.$strict>]>>;
|
|
373
|
+
}, z.core.$strict>;
|
|
374
|
+
export type FilmSceneImage = z.infer<typeof filmSceneImage>;
|
|
375
|
+
export declare const FILM_MAX_SCENE_IMAGES: number;
|
|
376
|
+
export declare const filmSceneImages: z.ZodArray<z.ZodObject<{
|
|
377
|
+
image_url: z.ZodString;
|
|
378
|
+
anchor: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
379
|
+
startWord: z.ZodNumber;
|
|
380
|
+
endWord: z.ZodNumber;
|
|
381
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
382
|
+
quote: z.ZodString;
|
|
383
|
+
occurrence: z.ZodOptional<z.ZodNumber>;
|
|
384
|
+
}, z.core.$strict>]>>;
|
|
385
|
+
}, z.core.$strict>>;
|
|
386
|
+
export declare function splitFilmImages(images: readonly FilmSceneImage[]): {
|
|
387
|
+
products: FacelessCustomerSceneImage[];
|
|
388
|
+
characters: string[];
|
|
389
|
+
};
|
|
359
390
|
export declare const FILM_DRAFT_CHECK_PATH = "/v1/film-drafts/:id/check";
|
|
360
391
|
export declare const checkFilmInput: z.ZodObject<{
|
|
361
392
|
revision: z.ZodNumber;
|
|
362
393
|
voice_run_id: z.ZodString;
|
|
363
394
|
scene_images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
364
395
|
image_url: z.ZodString;
|
|
365
|
-
anchor: z.ZodUnion<readonly [z.ZodObject<{
|
|
396
|
+
anchor: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
366
397
|
startWord: z.ZodNumber;
|
|
367
398
|
endWord: z.ZodNumber;
|
|
368
399
|
}, z.core.$strict>, z.ZodObject<{
|
|
369
400
|
quote: z.ZodString;
|
|
370
401
|
occurrence: z.ZodOptional<z.ZodNumber>;
|
|
371
|
-
}, z.core.$strict>]
|
|
402
|
+
}, z.core.$strict>]>>;
|
|
372
403
|
}, z.core.$strict>>>;
|
|
373
404
|
scene_video: z.ZodOptional<z.ZodObject<{
|
|
374
405
|
asset_id: z.ZodOptional<z.ZodString>;
|
package/dist/film-drafts.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { assetId } from "./asset-identity.js";
|
|
3
3
|
import { brandStyleName } from "./brand-styles.js";
|
|
4
4
|
import { FILM_MAX_BEATS, FILM_STYLES, filmBeat } from "./film-styles.js";
|
|
5
|
-
import { EXPLAINER_MAX_PRODUCT_PICTURES,
|
|
5
|
+
import { EXPLAINER_MAX_PRODUCT_PICTURES, facelessSceneAnchor, qualifiedImageUrl } from "./faceless-public.js";
|
|
6
6
|
import { MASCOT_POSES } from "./mascots.js";
|
|
7
7
|
import { runId } from "./runs.js";
|
|
8
8
|
import { resolvedSkillTheme, skillThemeOverrides } from "./skill-theme.js";
|
|
@@ -36,6 +36,7 @@ export const filmStoryboardEvent = z.strictObject({
|
|
|
36
36
|
offset: z.number().min(-2).max(5).optional().describe("Seconds after the word starts; omitted, on the word"),
|
|
37
37
|
what: z.string().trim().min(1).max(200).describe("What happens on screen"),
|
|
38
38
|
}).refine(e => !(e.anchor !== undefined && e.offset !== undefined), "an event lands on an anchor or on its word plus offset, not both");
|
|
39
|
+
export const isPauseRow = (row) => /^\[[^\]]*\bpause\b[^\]]*\]$/i.test(row.phrase.trim());
|
|
39
40
|
export const filmStoryboardRow = z.strictObject({
|
|
40
41
|
phrase: z.string().trim().min(1).max(400).describe("The phrase's words as the voice speaks them"),
|
|
41
42
|
start: z.number().min(0).max(600).describe("When the phrase starts, from the voice's word timings"),
|
|
@@ -97,11 +98,21 @@ export const filmSceneVideo = z.strictObject({
|
|
|
97
98
|
}).refine(v => (v.asset_id === undefined) !== (v.run_id === undefined), { message: "name exactly one of asset_id and run_id" })
|
|
98
99
|
.describe("The video your <Presenter> plays, without its sound, second by second beside the film; past its end its last frame holds. " +
|
|
99
100
|
"Lips match the film's voice only when the video was made from this same voice");
|
|
101
|
+
export const FILM_MAX_CHARACTER_PICTURES = 8;
|
|
102
|
+
export const filmSceneImage = z.strictObject({ image_url: qualifiedImageUrl, anchor: facelessSceneAnchor.optional() });
|
|
103
|
+
export const FILM_MAX_SCENE_IMAGES = EXPLAINER_MAX_PRODUCT_PICTURES + FILM_MAX_CHARACTER_PICTURES;
|
|
104
|
+
export const filmSceneImages = z.array(filmSceneImage).max(FILM_MAX_SCENE_IMAGES)
|
|
105
|
+
.refine(images => images.filter(i => !i.anchor).length <= FILM_MAX_CHARACTER_PICTURES, `at most ${FILM_MAX_CHARACTER_PICTURES} pictures with no anchor (characters)`)
|
|
106
|
+
.refine(images => images.findIndex(i => !i.anchor) === -1 || images.slice(images.findIndex(i => !i.anchor)).every(i => !i.anchor), "pictures with no anchor (characters) come after the products");
|
|
107
|
+
export function splitFilmImages(images) {
|
|
108
|
+
return { products: images.flatMap(i => (i.anchor ? [{ image_url: i.image_url, anchor: i.anchor }] : [])),
|
|
109
|
+
characters: images.filter(i => !i.anchor).map(i => i.image_url) };
|
|
110
|
+
}
|
|
100
111
|
export const FILM_DRAFT_CHECK_PATH = "/v1/film-drafts/:id/check";
|
|
101
112
|
export const checkFilmInput = z.strictObject({
|
|
102
113
|
revision: z.number().int().min(0).describe("The draft revision to check; a draft that moved on is refused with 409"),
|
|
103
114
|
voice_run_id: runId.describe("A delivered make_voice run of this account: the check reads its words and length"),
|
|
104
|
-
scene_images:
|
|
115
|
+
scene_images: filmSceneImages.optional().describe("The pictures you will send to stills and render"),
|
|
105
116
|
scene_video: filmSceneVideo.optional(),
|
|
106
117
|
files: z.record(z.string(), z.string().max(FILM_FILE_MAX_BYTES).nullable()).optional()
|
|
107
118
|
.describe("Changes to check without saving them, as put_film_files takes them: text replaces a file, null deletes it"),
|
package/dist/mascots.d.ts
CHANGED
|
@@ -146,6 +146,7 @@ export declare const mascotPoses: z.ZodRecord<z.ZodEnum<{
|
|
|
146
146
|
quiet: z.ZodOptional<z.ZodLiteral<true>>;
|
|
147
147
|
}, z.core.$strict>>;
|
|
148
148
|
export type MascotPoses = z.infer<typeof mascotPoses>;
|
|
149
|
+
export declare const mascotTalks: (poses: MascotPoses) => boolean;
|
|
149
150
|
export declare const pinnedMascot: z.ZodObject<{
|
|
150
151
|
asset_id: z.ZodString;
|
|
151
152
|
poses: z.ZodRecord<z.ZodEnum<{
|
|
@@ -227,5 +228,6 @@ export declare const mascotSummary: z.ZodObject<{
|
|
|
227
228
|
}>>;
|
|
228
229
|
character: z.ZodNullable<z.ZodString>;
|
|
229
230
|
head: z.ZodOptional<z.ZodBoolean>;
|
|
231
|
+
talking_sprites: z.ZodOptional<z.ZodBoolean>;
|
|
230
232
|
}, z.core.$strict>;
|
|
231
233
|
export type MascotSummary = z.infer<typeof mascotSummary>;
|
package/dist/mascots.js
CHANGED
|
@@ -66,9 +66,11 @@ export function heroLook(details) {
|
|
|
66
66
|
}
|
|
67
67
|
export const mascotPoses = z.partialRecord(z.enum(MASCOT_POSES), mascotPose)
|
|
68
68
|
.refine((poses) => poses.neutral !== undefined, { message: "a mascot holds its neutral pose" });
|
|
69
|
+
export const mascotTalks = (poses) => Object.values(poses).some(pose => pose?.sprites?.open !== undefined && pose?.sprites?.half !== undefined);
|
|
69
70
|
export const pinnedMascot = z.strictObject({ asset_id: assetId, poses: mascotPoses });
|
|
70
71
|
export const mascotSummary = z.strictObject({
|
|
71
72
|
poses: z.array(z.enum(MASCOT_POSES)).min(1),
|
|
72
73
|
character: z.string().min(1).nullable(),
|
|
73
74
|
head: z.boolean().optional(),
|
|
75
|
+
talking_sprites: z.boolean().optional(),
|
|
74
76
|
});
|
package/dist/own-agent-runs.d.ts
CHANGED
|
@@ -32,13 +32,13 @@ export declare const filmStillsInput: z.ZodObject<{
|
|
|
32
32
|
sheet: z.ZodDefault<z.ZodBoolean>;
|
|
33
33
|
scene_images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
34
|
image_url: z.ZodString;
|
|
35
|
-
anchor: z.ZodUnion<readonly [z.ZodObject<{
|
|
35
|
+
anchor: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
36
36
|
startWord: z.ZodNumber;
|
|
37
37
|
endWord: z.ZodNumber;
|
|
38
38
|
}, z.core.$strict>, z.ZodObject<{
|
|
39
39
|
quote: z.ZodString;
|
|
40
40
|
occurrence: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
}, z.core.$strict>]
|
|
41
|
+
}, z.core.$strict>]>>;
|
|
42
42
|
}, z.core.$strict>>>;
|
|
43
43
|
scene_video: z.ZodOptional<z.ZodObject<{
|
|
44
44
|
asset_id: z.ZodOptional<z.ZodString>;
|
|
@@ -49,9 +49,23 @@ export declare const filmStillsInput: z.ZodObject<{
|
|
|
49
49
|
}, z.core.$strict>;
|
|
50
50
|
export type FilmStillsInput = z.infer<typeof filmStillsInput>;
|
|
51
51
|
export type FilmStillsRequest = z.input<typeof filmStillsInput>;
|
|
52
|
+
export declare const OWN_VOICE_MIN_SPEAKERS = 2, OWN_VOICE_MAX_SPEAKERS = 3, OWN_VOICE_MAX_LINES = 40;
|
|
53
|
+
export declare const FILM_TURN_GAP_SEC = 0.3, FILM_TURN_EDGE_SEC = 0.05;
|
|
54
|
+
export declare const SPEAKER_NAME_PATTERN: RegExp;
|
|
55
|
+
export interface DialogueLine {
|
|
56
|
+
speaker: string;
|
|
57
|
+
text: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function dialogueLines(text: string, speakers: Readonly<Record<string, string>>): {
|
|
60
|
+
lines: DialogueLine[];
|
|
61
|
+
} | {
|
|
62
|
+
error: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const dialogueSpokenText: (lines: readonly DialogueLine[]) => string;
|
|
52
65
|
export declare const filmVoiceInput: z.ZodObject<{
|
|
53
66
|
text: z.ZodString;
|
|
54
67
|
voice: z.ZodOptional<z.ZodString>;
|
|
68
|
+
speakers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
55
69
|
tempo: z.ZodOptional<z.ZodNumber>;
|
|
56
70
|
cut_id: z.ZodOptional<z.ZodString>;
|
|
57
71
|
max_credits: z.ZodOptional<z.ZodNumber>;
|
|
@@ -63,13 +77,13 @@ export declare const filmRenderInput: z.ZodObject<{
|
|
|
63
77
|
voice_run_id: z.ZodString;
|
|
64
78
|
scene_images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
65
79
|
image_url: z.ZodString;
|
|
66
|
-
anchor: z.ZodUnion<readonly [z.ZodObject<{
|
|
80
|
+
anchor: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
67
81
|
startWord: z.ZodNumber;
|
|
68
82
|
endWord: z.ZodNumber;
|
|
69
83
|
}, z.core.$strict>, z.ZodObject<{
|
|
70
84
|
quote: z.ZodString;
|
|
71
85
|
occurrence: z.ZodOptional<z.ZodNumber>;
|
|
72
|
-
}, z.core.$strict>]
|
|
86
|
+
}, z.core.$strict>]>>;
|
|
73
87
|
}, z.core.$strict>>>;
|
|
74
88
|
scene_video: z.ZodOptional<z.ZodObject<{
|
|
75
89
|
asset_id: z.ZodOptional<z.ZodString>;
|
|
@@ -541,6 +555,12 @@ export declare const filmWord: z.ZodObject<{
|
|
|
541
555
|
start: z.ZodNumber;
|
|
542
556
|
end: z.ZodNumber;
|
|
543
557
|
}, z.core.$strict>;
|
|
558
|
+
export declare const filmTurn: z.ZodObject<{
|
|
559
|
+
speaker: z.ZodString;
|
|
560
|
+
start: z.ZodNumber;
|
|
561
|
+
end: z.ZodNumber;
|
|
562
|
+
}, z.core.$strict>;
|
|
563
|
+
export type FilmTurn = z.infer<typeof filmTurn>;
|
|
544
564
|
export declare const filmRun: z.ZodObject<{
|
|
545
565
|
run_id: z.ZodString;
|
|
546
566
|
skill: z.ZodEnum<{
|
|
@@ -579,6 +599,11 @@ export declare const filmRun: z.ZodObject<{
|
|
|
579
599
|
end: z.ZodNumber;
|
|
580
600
|
}, z.core.$strict>>;
|
|
581
601
|
audio_url: z.ZodString;
|
|
602
|
+
turns: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
603
|
+
speaker: z.ZodString;
|
|
604
|
+
start: z.ZodNumber;
|
|
605
|
+
end: z.ZodNumber;
|
|
606
|
+
}, z.core.$strict>>>;
|
|
582
607
|
}, z.core.$strict>>;
|
|
583
608
|
film: z.ZodOptional<z.ZodObject<{
|
|
584
609
|
video_url: z.ZodString;
|
package/dist/own-agent-runs.js
CHANGED
|
@@ -4,13 +4,14 @@ import { adId, adSlotId } from "./ad-ids.js";
|
|
|
4
4
|
import { cutId } from "./cut-ids.js";
|
|
5
5
|
import { diyBlocked, diyNext } from "./diy-next.js";
|
|
6
6
|
import { editMusic } from "./edit-music.js";
|
|
7
|
-
import { EXPLAINER_MAX_PRODUCT_PICTURES,
|
|
7
|
+
import { EXPLAINER_MAX_PRODUCT_PICTURES, qualifiedImageUrl } from "./faceless-public.js";
|
|
8
8
|
import { filmCutPicture } from "./film-cut.js";
|
|
9
|
-
import { filmDraftId, filmSceneVideo } from "./film-drafts.js";
|
|
9
|
+
import { FILM_MAX_CHARACTER_PICTURES, filmDraftId, filmSceneImages, filmSceneVideo } from "./film-drafts.js";
|
|
10
10
|
import { MASCOT_POSES } from "./mascots.js";
|
|
11
11
|
import { maxCreditsField } from "./max-credits.js";
|
|
12
12
|
import { OWN_AGENT_SKILLS, OWN_FREE_STILLS, OWN_FREE_STILLS_WINDOW_HOURS, OWN_STILLS_MAX_PER_CALL, OWN_STILLS_SINGLE_MAX, OWN_VOICE_MAX_SECONDS } from "./own-agent-price.js";
|
|
13
13
|
import { runId } from "./runs.js";
|
|
14
|
+
import { lexicalWords, withoutAudioTags } from "./speech-words.js";
|
|
14
15
|
import { TTS_MODEL_CHAR_CAP, VOICE_NAME_PATTERN } from "./voices.js";
|
|
15
16
|
export const FILM_STILLS_QUOTE_PATH = "/v1/film-stills/quote";
|
|
16
17
|
export const FILM_STILLS_PATH = "/v1/film-stills";
|
|
@@ -37,9 +38,10 @@ export const OWN_VOICE_SLOWEST_CHARS_PER_SECOND = 13, OWN_VOICE_MAX_CHARS = TTS_
|
|
|
37
38
|
export const OWN_VOICE_MIN_TEMPO = 0.85, OWN_VOICE_MAX_TEMPO = 1.2;
|
|
38
39
|
export const OWN_HERO_SCRIPT_MAX_CHARS = 1500;
|
|
39
40
|
const anchor = z.string().regex(/^[A-Za-z_]\w{0,40}$/, "an anchor is an identifier");
|
|
40
|
-
const sceneImages =
|
|
41
|
-
.describe(`Up to ${EXPLAINER_MAX_PRODUCT_PICTURES} of your product pictures, p1 first: each
|
|
42
|
-
"your code with <Product id=\"p1\"/> while those words are spoken
|
|
41
|
+
const sceneImages = filmSceneImages.optional()
|
|
42
|
+
.describe(`Up to ${EXPLAINER_MAX_PRODUCT_PICTURES} of your product pictures, p1 first: each with the script words its anchor names, placed by ` +
|
|
43
|
+
"your code with <Product id=\"p1\"/> while those words are spoken; and up to " + `${FILM_MAX_CHARACTER_PICTURES} pictures of a character you draw, ` +
|
|
44
|
+
"with no anchor, named c1, c2… in order and used by id (<Actor head>), never a <Product>. Send the same list to the stills and the render");
|
|
43
45
|
export const filmStillsInput = z.strictObject({
|
|
44
46
|
draft_id: filmDraftId,
|
|
45
47
|
revision: z.number().int().min(0).describe("The draft revision to draw; a draft that moved on is refused with 409"),
|
|
@@ -53,17 +55,74 @@ export const filmStillsInput = z.strictObject({
|
|
|
53
55
|
scene_video: filmSceneVideo.optional(),
|
|
54
56
|
max_credits: maxCreditsField,
|
|
55
57
|
});
|
|
58
|
+
export const OWN_VOICE_MIN_SPEAKERS = 2, OWN_VOICE_MAX_SPEAKERS = 3, OWN_VOICE_MAX_LINES = 40;
|
|
59
|
+
export const FILM_TURN_GAP_SEC = 0.3, FILM_TURN_EDGE_SEC = 0.05;
|
|
60
|
+
export const SPEAKER_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_]{0,19}$/;
|
|
61
|
+
export function dialogueLines(text, speakers) {
|
|
62
|
+
const keys = Object.keys(speakers), byCase = new Map(keys.map(key => [key.toLowerCase(), key])), names = keys.join(", "), lines = [];
|
|
63
|
+
for (const [i, raw] of text.split(/\r?\n/).entries()) {
|
|
64
|
+
const line = raw.trim();
|
|
65
|
+
if (!line)
|
|
66
|
+
continue;
|
|
67
|
+
const match = /^([A-Za-z][A-Za-z0-9_]{0,19})\s*:\s*(.*)$/.exec(line), speaker = match ? byCase.get(match[1].toLowerCase()) : undefined;
|
|
68
|
+
if (!match)
|
|
69
|
+
return { error: `line ${i + 1} names no speaker: write each line as NAME: words, NAME one of ${names}` };
|
|
70
|
+
if (!speaker)
|
|
71
|
+
return { error: `line ${i + 1}: ${match[1]} is not one of the speakers (${names})` };
|
|
72
|
+
if (!lexicalWords(withoutAudioTags(match[2])).length)
|
|
73
|
+
return { error: `line ${i + 1}: ${speaker} says no word; a tag or a mark alone is not spoken` };
|
|
74
|
+
lines.push({ speaker, text: match[2].trim() });
|
|
75
|
+
}
|
|
76
|
+
if (lines.length > OWN_VOICE_MAX_LINES)
|
|
77
|
+
return { error: `${lines.length} lines, past the ${OWN_VOICE_MAX_LINES} one voice speaks; split it` };
|
|
78
|
+
const silent = keys.filter(key => !lines.some(line => line.speaker === key));
|
|
79
|
+
if (silent.length)
|
|
80
|
+
return { error: `${silent.join(", ")} never speak${silent.length === 1 ? "s" : ""}: give every speaker a line, or drop it` };
|
|
81
|
+
return { lines };
|
|
82
|
+
}
|
|
83
|
+
export const dialogueSpokenText = (lines) => lines.map(line => line.text).join("\n");
|
|
84
|
+
const voiceName = z.string({ error: "voice must be a voice name from list_voices, as a string" })
|
|
85
|
+
.regex(VOICE_NAME_PATTERN, "voice is not a voice name: take one from list_voices with skill=make_faceless");
|
|
56
86
|
export const filmVoiceInput = z.strictObject({
|
|
57
|
-
text: z.string().trim().min(1).max(OWN_VOICE_MAX_CHARS).describe(`The script, spoken exactly as written
|
|
58
|
-
voice:
|
|
59
|
-
.regex(VOICE_NAME_PATTERN, "voice is not a voice name: take one from list_voices with skill=make_faceless").optional()
|
|
87
|
+
text: z.string().trim().min(1).max(OWN_VOICE_MAX_CHARS).describe(`The script, spoken exactly as written, up to ${OWN_VOICE_MAX_CHARS} characters`),
|
|
88
|
+
voice: voiceName.optional()
|
|
60
89
|
.describe("A narrator (list_voices with skill=make_faceless); the fastest of the script's language when omitted. The API refuses a name " +
|
|
61
90
|
"list_voices does not return, before any charge"),
|
|
91
|
+
speakers: z.record(z.string(), z.string()).optional()
|
|
92
|
+
.describe(`A dialogue instead of voice: ${OWN_VOICE_MIN_SPEAKERS}–${OWN_VOICE_MAX_SPEAKERS} speakers, NAME → its voice. text is then lines ` +
|
|
93
|
+
"\"NAME: words\", each spoken in its speaker's voice; the run says who speaks when (turns)"),
|
|
62
94
|
tempo: z.number().min(OWN_VOICE_MIN_TEMPO).max(OWN_VOICE_MAX_TEMPO).optional()
|
|
63
95
|
.describe(`How fast the take plays, ${OWN_VOICE_MIN_TEMPO} to ${OWN_VOICE_MAX_TEMPO} of the narrator's own read, its pitch kept: 1 is the ` +
|
|
64
96
|
"read as spoken, below 1 slower and longer. Omitted, the voice's own tempo"),
|
|
65
97
|
cut_id: cutId.optional().describe("The cut record this voice is for: the record then names it as its voice and says what comes next"),
|
|
66
98
|
max_credits: maxCreditsField,
|
|
99
|
+
}).superRefine((input, ctx) => {
|
|
100
|
+
if (input.speakers === undefined)
|
|
101
|
+
return;
|
|
102
|
+
const keys = Object.keys(input.speakers);
|
|
103
|
+
if (input.voice !== undefined)
|
|
104
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["voice"], message: "speakers name every voice: drop voice" });
|
|
105
|
+
if (keys.length < OWN_VOICE_MIN_SPEAKERS || keys.length > OWN_VOICE_MAX_SPEAKERS)
|
|
106
|
+
return ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["speakers"], message: `name ${OWN_VOICE_MIN_SPEAKERS}–${OWN_VOICE_MAX_SPEAKERS} speakers` });
|
|
107
|
+
let named = true;
|
|
108
|
+
for (const [name, voice] of Object.entries(input.speakers)) {
|
|
109
|
+
if (!SPEAKER_NAME_PATTERN.test(name))
|
|
110
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["speakers"],
|
|
111
|
+
message: `speaker "${name.slice(0, 24)}": a speaker's name is a letter, then up to 19 letters, digits or _` });
|
|
112
|
+
const form = voiceName.safeParse(voice);
|
|
113
|
+
if (!form.success)
|
|
114
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["speakers"], message: `speaker ${name.slice(0, 24)}: ${form.error.issues[0].message}` });
|
|
115
|
+
named &&= SPEAKER_NAME_PATTERN.test(name) && form.success;
|
|
116
|
+
}
|
|
117
|
+
if (!named)
|
|
118
|
+
return;
|
|
119
|
+
if (new Set(keys.map(key => key.toLowerCase())).size < keys.length)
|
|
120
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["speakers"], message: "two speakers' names differ only in case: name them apart" });
|
|
121
|
+
else {
|
|
122
|
+
const read = dialogueLines(input.text, input.speakers);
|
|
123
|
+
if ("error" in read)
|
|
124
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["text"], message: read.error });
|
|
125
|
+
}
|
|
67
126
|
});
|
|
68
127
|
export const filmRenderInput = z.strictObject({
|
|
69
128
|
draft_id: filmDraftId,
|
|
@@ -326,6 +385,7 @@ export const filmStill = z.strictObject({
|
|
|
326
385
|
findings: z.array(z.string()),
|
|
327
386
|
});
|
|
328
387
|
export const filmWord = z.strictObject({ text: z.string(), start: z.number(), end: z.number() });
|
|
388
|
+
export const filmTurn = z.strictObject({ speaker: z.string(), start: z.number(), end: z.number() });
|
|
329
389
|
export const filmRun = z.strictObject({
|
|
330
390
|
run_id: runId,
|
|
331
391
|
skill: z.enum(OWN_AGENT_SKILLS),
|
|
@@ -335,7 +395,8 @@ export const filmRun = z.strictObject({
|
|
|
335
395
|
warnings: z.array(z.string()),
|
|
336
396
|
error: z.string().nullable(),
|
|
337
397
|
stills: z.strictObject({ frames: z.array(filmStill), sheet_url: z.string().url().nullable(), refusals: z.array(z.string()) }).optional(),
|
|
338
|
-
voice: z.strictObject({ duration_sec: z.number().positive(), film_sec: filmSec.optional(), words: z.array(filmWord), audio_url: z.string().url()
|
|
398
|
+
voice: z.strictObject({ duration_sec: z.number().positive(), film_sec: filmSec.optional(), words: z.array(filmWord), audio_url: z.string().url(),
|
|
399
|
+
turns: z.array(filmTurn).optional() }).optional(),
|
|
339
400
|
film: z.strictObject({ video_url: z.string().url(), duration_sec: z.number().positive(),
|
|
340
401
|
thumbnail_url: z.string().url().nullable().default(null) }).optional(),
|
|
341
402
|
hero: z.strictObject({ mascot_id: assetId, poses: z.array(z.enum(MASCOT_POSES)), character: z.string().nullable(),
|
|
@@ -7561,6 +7561,7 @@ export declare function filmVoiceRefusal(voice: string, options?: {
|
|
|
7561
7561
|
export declare function serverFilmVoiceInputWith(voiceRefusal: (voice: string) => string | undefined): z.ZodObject<{
|
|
7562
7562
|
text: z.ZodString;
|
|
7563
7563
|
voice: z.ZodOptional<z.ZodString>;
|
|
7564
|
+
speakers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
7564
7565
|
tempo: z.ZodOptional<z.ZodNumber>;
|
|
7565
7566
|
cut_id: z.ZodOptional<z.ZodString>;
|
|
7566
7567
|
max_credits: z.ZodOptional<z.ZodNumber>;
|
package/dist/voice-admission.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { serverUgcInputWith } from "./skills.js";
|
|
3
3
|
import { makeFacelessInput } from "./faceless-public.js";
|
|
4
4
|
import { isFacelessVoiceName } from "./faceless-voices.js";
|
|
5
|
-
import { filmVoiceInput } from "./own-agent-runs.js";
|
|
5
|
+
import { filmVoiceInput, OWN_VOICE_MAX_SPEAKERS } from "./own-agent-runs.js";
|
|
6
6
|
import { normalizeVoiceLabel } from "./voice-catalog.js";
|
|
7
7
|
import { VOICE_CATALOG } from "./voice-catalog-data.js";
|
|
8
8
|
import { verifiedVoiceModels } from "./voice-verified-models.js";
|
|
@@ -53,7 +53,17 @@ export function filmVoiceRefusal(voice, options = {}) {
|
|
|
53
53
|
return facelessVoiceRefusal(voice);
|
|
54
54
|
}
|
|
55
55
|
export function serverFilmVoiceInputWith(voiceRefusal) {
|
|
56
|
-
return filmVoiceInput.refine((input) => input.voice === undefined || voiceRefusal(input.voice) === undefined, { path: ["voice"], error: (issue) => voiceRefusal(issue.input.voice) })
|
|
56
|
+
return filmVoiceInput.refine((input) => input.voice === undefined || voiceRefusal(input.voice) === undefined, { path: ["voice"], error: (issue) => voiceRefusal(issue.input.voice) })
|
|
57
|
+
.superRefine((input, ctx) => {
|
|
58
|
+
const speakers = Object.entries(input.speakers ?? {});
|
|
59
|
+
if (speakers.length > OWN_VOICE_MAX_SPEAKERS)
|
|
60
|
+
return;
|
|
61
|
+
for (const [name, voice] of speakers) {
|
|
62
|
+
const refusal = voiceRefusal(voice);
|
|
63
|
+
if (refusal !== undefined)
|
|
64
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["speakers"], message: `speaker ${name.slice(0, 24)}: ${refusal}` });
|
|
65
|
+
}
|
|
66
|
+
});
|
|
57
67
|
}
|
|
58
68
|
export function voiceGenderOf(voice, voices = VOICE_CATALOG.voices) {
|
|
59
69
|
const preset = voicePresetOf(voice);
|