@contractspec/lib.video-gen 2.7.16 → 2.7.18
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/browser/compositions/api-overview.js +1 -645
- package/dist/browser/compositions/index.js +1 -1133
- package/dist/browser/compositions/primitives/animated-text.js +1 -144
- package/dist/browser/compositions/primitives/brand-frame.js +1 -181
- package/dist/browser/compositions/primitives/code-block.js +1 -226
- package/dist/browser/compositions/primitives/index.js +1 -656
- package/dist/browser/compositions/primitives/progress-bar.js +1 -59
- package/dist/browser/compositions/primitives/terminal.js +1 -265
- package/dist/browser/compositions/primitives/transition.js +1 -98
- package/dist/browser/compositions/social-clip.js +1 -500
- package/dist/browser/compositions/terminal-demo.js +1 -558
- package/dist/browser/design/index.js +1 -155
- package/dist/browser/design/layouts.js +1 -50
- package/dist/browser/design/motion.js +1 -43
- package/dist/browser/design/tokens.js +1 -28
- package/dist/browser/design/typography.js +1 -61
- package/dist/browser/docs/compositions.docblock.js +1 -182
- package/dist/browser/docs/design.docblock.js +2 -17
- package/dist/browser/docs/generators.docblock.js +2 -24
- package/dist/browser/docs/rendering.docblock.js +2 -24
- package/dist/browser/docs/video-gen.docblock.js +2 -17
- package/dist/browser/generators/index.js +7 -769
- package/dist/browser/generators/scene-planner.js +7 -651
- package/dist/browser/generators/script-generator.js +7 -599
- package/dist/browser/generators/video-generator.js +7 -768
- package/dist/browser/i18n/catalogs/en.js +3 -135
- package/dist/browser/i18n/catalogs/es.js +3 -135
- package/dist/browser/i18n/catalogs/fr.js +3 -135
- package/dist/browser/i18n/catalogs/index.js +7 -387
- package/dist/browser/i18n/index.js +7 -459
- package/dist/browser/i18n/keys.js +1 -54
- package/dist/browser/i18n/locale.js +1 -21
- package/dist/browser/i18n/messages.js +7 -399
- package/dist/browser/index.js +7 -1903
- package/dist/browser/player/demo-player.js +1 -1136
- package/dist/browser/player/index.js +1 -1136
- package/dist/browser/remotion/Root.js +2 -1172
- package/dist/browser/remotion/index.js +2 -1173
- package/dist/browser/renderers/config.js +1 -40
- package/dist/browser/renderers/index.js +1 -160
- package/dist/browser/renderers/local.js +1 -156
- package/dist/browser/types.js +1 -13
- package/dist/compositions/api-overview.js +1 -639
- package/dist/compositions/index.js +1 -1127
- package/dist/compositions/primitives/animated-text.js +1 -138
- package/dist/compositions/primitives/brand-frame.js +1 -175
- package/dist/compositions/primitives/code-block.js +1 -220
- package/dist/compositions/primitives/index.js +1 -650
- package/dist/compositions/primitives/progress-bar.js +1 -53
- package/dist/compositions/primitives/terminal.js +1 -259
- package/dist/compositions/primitives/transition.js +1 -92
- package/dist/compositions/social-clip.js +1 -494
- package/dist/compositions/terminal-demo.js +1 -552
- package/dist/design/index.js +1 -149
- package/dist/design/layouts.js +1 -44
- package/dist/design/motion.js +1 -37
- package/dist/design/tokens.js +1 -22
- package/dist/design/typography.js +1 -55
- package/dist/docs/compositions.docblock.js +1 -182
- package/dist/docs/design.docblock.js +2 -17
- package/dist/docs/generators.docblock.js +2 -24
- package/dist/docs/rendering.docblock.js +2 -24
- package/dist/docs/video-gen.docblock.js +2 -17
- package/dist/generators/index.js +7 -763
- package/dist/generators/scene-planner.js +7 -645
- package/dist/generators/script-generator.js +7 -593
- package/dist/generators/video-generator.js +7 -762
- package/dist/i18n/catalogs/en.js +3 -129
- package/dist/i18n/catalogs/es.js +3 -129
- package/dist/i18n/catalogs/fr.js +3 -129
- package/dist/i18n/catalogs/index.js +7 -381
- package/dist/i18n/index.js +7 -453
- package/dist/i18n/keys.js +1 -48
- package/dist/i18n/locale.js +1 -15
- package/dist/i18n/messages.js +7 -393
- package/dist/index.js +7 -1897
- package/dist/node/compositions/api-overview.js +1 -640
- package/dist/node/compositions/index.js +1 -1128
- package/dist/node/compositions/primitives/animated-text.js +1 -139
- package/dist/node/compositions/primitives/brand-frame.js +1 -176
- package/dist/node/compositions/primitives/code-block.js +1 -221
- package/dist/node/compositions/primitives/index.js +1 -651
- package/dist/node/compositions/primitives/progress-bar.js +1 -54
- package/dist/node/compositions/primitives/terminal.js +1 -260
- package/dist/node/compositions/primitives/transition.js +1 -93
- package/dist/node/compositions/social-clip.js +1 -495
- package/dist/node/compositions/terminal-demo.js +1 -553
- package/dist/node/design/index.js +1 -150
- package/dist/node/design/layouts.js +1 -45
- package/dist/node/design/motion.js +1 -38
- package/dist/node/design/tokens.js +1 -23
- package/dist/node/design/typography.js +1 -56
- package/dist/node/docs/compositions.docblock.js +1 -182
- package/dist/node/docs/design.docblock.js +2 -17
- package/dist/node/docs/generators.docblock.js +2 -24
- package/dist/node/docs/rendering.docblock.js +2 -24
- package/dist/node/docs/video-gen.docblock.js +2 -17
- package/dist/node/generators/index.js +7 -764
- package/dist/node/generators/scene-planner.js +7 -646
- package/dist/node/generators/script-generator.js +7 -594
- package/dist/node/generators/video-generator.js +7 -763
- package/dist/node/i18n/catalogs/en.js +3 -130
- package/dist/node/i18n/catalogs/es.js +3 -130
- package/dist/node/i18n/catalogs/fr.js +3 -130
- package/dist/node/i18n/catalogs/index.js +7 -382
- package/dist/node/i18n/index.js +7 -454
- package/dist/node/i18n/keys.js +1 -49
- package/dist/node/i18n/locale.js +1 -16
- package/dist/node/i18n/messages.js +7 -394
- package/dist/node/index.js +7 -1898
- package/dist/node/player/demo-player.js +1 -1131
- package/dist/node/player/index.js +1 -1131
- package/dist/node/remotion/Root.js +2 -1167
- package/dist/node/remotion/index.js +2 -1168
- package/dist/node/renderers/config.js +1 -35
- package/dist/node/renderers/index.js +1 -155
- package/dist/node/renderers/local.js +1 -151
- package/dist/node/types.js +1 -8
- package/dist/player/demo-player.js +1 -1130
- package/dist/player/index.js +1 -1130
- package/dist/remotion/Root.js +2 -1166
- package/dist/remotion/index.js +2 -1167
- package/dist/renderers/config.js +1 -34
- package/dist/renderers/index.js +1 -154
- package/dist/renderers/local.js +1 -150
- package/dist/types.js +1 -7
- package/package.json +18 -18
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
// src/i18n/catalogs/en.ts
|
|
5
|
-
import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
|
|
6
|
-
var enMessages = defineTranslation({
|
|
7
|
-
meta: {
|
|
8
|
-
key: "video-gen.messages",
|
|
9
|
-
version: "1.0.0",
|
|
10
|
-
domain: "video-gen",
|
|
11
|
-
description: "All user-facing, LLM-facing, and developer-facing strings for the video-gen package",
|
|
12
|
-
owners: ["platform"],
|
|
13
|
-
stability: "experimental"
|
|
14
|
-
},
|
|
15
|
-
locale: "en",
|
|
16
|
-
fallback: "en",
|
|
17
|
-
messages: {
|
|
18
|
-
"prompt.script.system": {
|
|
19
|
-
value: `You are a video narration script writer.
|
|
2
|
+
var d=import.meta.require;import{defineTranslation as v}from"@contractspec/lib.contracts-spec/translations";var D=v({meta:{key:"video-gen.messages",version:"1.0.0",domain:"video-gen",description:"All user-facing, LLM-facing, and developer-facing strings for the video-gen package",owners:["platform"],stability:"experimental"},locale:"en",fallback:"en",messages:{"prompt.script.system":{value:`You are a video narration script writer.
|
|
20
3
|
Write a narration script for a short video (30-60 seconds).
|
|
21
4
|
{styleGuide}
|
|
22
5
|
|
|
@@ -27,12 +10,7 @@ Return JSON with shape:
|
|
|
27
10
|
}
|
|
28
11
|
|
|
29
12
|
Scene IDs should be: "intro", "problems", "solutions", "metrics", "cta".
|
|
30
|
-
Only include segments that are relevant to the brief content.`,
|
|
31
|
-
description: "Script generator LLM system prompt",
|
|
32
|
-
placeholders: [{ name: "styleGuide", type: "string" }]
|
|
33
|
-
},
|
|
34
|
-
"prompt.scenePlanner.system": {
|
|
35
|
-
value: `You are a video scene planner for ContractSpec marketing/documentation videos.
|
|
13
|
+
Only include segments that are relevant to the brief content.`,description:"Script generator LLM system prompt",placeholders:[{name:"styleGuide",type:"string"}]},"prompt.scenePlanner.system":{value:`You are a video scene planner for ContractSpec marketing/documentation videos.
|
|
36
14
|
Given a content brief, break it into video scenes.
|
|
37
15
|
|
|
38
16
|
Each scene must have:
|
|
@@ -48,125 +26,7 @@ Return a JSON object with shape:
|
|
|
48
26
|
}
|
|
49
27
|
|
|
50
28
|
Keep the total duration around {targetSeconds} seconds.
|
|
51
|
-
Prioritize clarity and pacing. Each scene should communicate one idea.`,
|
|
52
|
-
description: "Scene planner LLM system prompt",
|
|
53
|
-
placeholders: [
|
|
54
|
-
{ name: "fps", type: "number" },
|
|
55
|
-
{ name: "targetSeconds", type: "number" }
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
"prompt.style.professional": {
|
|
59
|
-
value: "Use a clear, authoritative, professional tone. Be concise and direct.",
|
|
60
|
-
description: "Style guide for professional narration"
|
|
61
|
-
},
|
|
62
|
-
"prompt.style.casual": {
|
|
63
|
-
value: "Use a friendly, conversational tone. Be approachable and relatable.",
|
|
64
|
-
description: "Style guide for casual narration"
|
|
65
|
-
},
|
|
66
|
-
"prompt.style.technical": {
|
|
67
|
-
value: "Use precise technical language. Be detailed and accurate.",
|
|
68
|
-
description: "Style guide for technical narration"
|
|
69
|
-
},
|
|
70
|
-
"script.segment.challenge": {
|
|
71
|
-
value: "The challenge: {content}",
|
|
72
|
-
description: "Narration segment prefix for problems",
|
|
73
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
74
|
-
},
|
|
75
|
-
"script.segment.solution": {
|
|
76
|
-
value: "The solution: {content}",
|
|
77
|
-
description: "Narration segment prefix for solutions",
|
|
78
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
79
|
-
},
|
|
80
|
-
"script.segment.results": {
|
|
81
|
-
value: "The results: {content}",
|
|
82
|
-
description: "Narration segment prefix for metrics",
|
|
83
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
84
|
-
},
|
|
85
|
-
"scene.cta.default": {
|
|
86
|
-
value: "Learn more",
|
|
87
|
-
description: "Default call-to-action text for scenes"
|
|
88
|
-
},
|
|
89
|
-
"scene.hook.problem": {
|
|
90
|
-
value: "The Problem",
|
|
91
|
-
description: "Scene hook label for problem statement"
|
|
92
|
-
},
|
|
93
|
-
"scene.narration.problem": {
|
|
94
|
-
value: "The problem: {content}",
|
|
95
|
-
description: "Scene narration for problem statement",
|
|
96
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
97
|
-
},
|
|
98
|
-
"scene.hook.solution": {
|
|
99
|
-
value: "The Solution",
|
|
100
|
-
description: "Scene hook label for solution"
|
|
101
|
-
},
|
|
102
|
-
"scene.narration.solution": {
|
|
103
|
-
value: "The solution: {content}",
|
|
104
|
-
description: "Scene narration for solution",
|
|
105
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
106
|
-
},
|
|
107
|
-
"scene.hook.results": {
|
|
108
|
-
value: "Results",
|
|
109
|
-
description: "Scene hook label for results/metrics"
|
|
110
|
-
},
|
|
111
|
-
"composition.apiOverview.generates": {
|
|
112
|
-
value: "Generates:",
|
|
113
|
-
description: "ApiOverview heading for generated outputs"
|
|
114
|
-
},
|
|
115
|
-
"composition.apiOverview.tagline": {
|
|
116
|
-
value: "One spec. Every surface.",
|
|
117
|
-
description: "ApiOverview default tagline"
|
|
118
|
-
},
|
|
119
|
-
"composition.apiOverview.output.rest": {
|
|
120
|
-
value: "REST Endpoint",
|
|
121
|
-
description: "Generated output label: REST"
|
|
122
|
-
},
|
|
123
|
-
"composition.apiOverview.output.graphql": {
|
|
124
|
-
value: "GraphQL Mutation",
|
|
125
|
-
description: "Generated output label: GraphQL"
|
|
126
|
-
},
|
|
127
|
-
"composition.apiOverview.output.prisma": {
|
|
128
|
-
value: "Prisma Model",
|
|
129
|
-
description: "Generated output label: Prisma"
|
|
130
|
-
},
|
|
131
|
-
"composition.apiOverview.output.typescript": {
|
|
132
|
-
value: "TypeScript SDK",
|
|
133
|
-
description: "Generated output label: TypeScript SDK"
|
|
134
|
-
},
|
|
135
|
-
"composition.apiOverview.output.mcp": {
|
|
136
|
-
value: "MCP Tool",
|
|
137
|
-
description: "Generated output label: MCP Tool"
|
|
138
|
-
},
|
|
139
|
-
"composition.apiOverview.output.openapi": {
|
|
140
|
-
value: "OpenAPI Spec",
|
|
141
|
-
description: "Generated output label: OpenAPI"
|
|
142
|
-
},
|
|
143
|
-
"composition.socialClip.cta": {
|
|
144
|
-
value: "Learn more",
|
|
145
|
-
description: "SocialClip default CTA"
|
|
146
|
-
},
|
|
147
|
-
"composition.terminal.title": {
|
|
148
|
-
value: "Terminal",
|
|
149
|
-
description: "TerminalDemo default window title"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// src/i18n/catalogs/es.ts
|
|
155
|
-
import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
|
|
156
|
-
var esMessages = defineTranslation2({
|
|
157
|
-
meta: {
|
|
158
|
-
key: "video-gen.messages",
|
|
159
|
-
version: "1.0.0",
|
|
160
|
-
domain: "video-gen",
|
|
161
|
-
description: "Spanish translations for the video-gen package",
|
|
162
|
-
owners: ["platform"],
|
|
163
|
-
stability: "experimental"
|
|
164
|
-
},
|
|
165
|
-
locale: "es",
|
|
166
|
-
fallback: "en",
|
|
167
|
-
messages: {
|
|
168
|
-
"prompt.script.system": {
|
|
169
|
-
value: `Eres un redactor de guiones de narraci\xF3n para v\xEDdeo.
|
|
29
|
+
Prioritize clarity and pacing. Each scene should communicate one idea.`,description:"Scene planner LLM system prompt",placeholders:[{name:"fps",type:"number"},{name:"targetSeconds",type:"number"}]},"prompt.style.professional":{value:"Use a clear, authoritative, professional tone. Be concise and direct.",description:"Style guide for professional narration"},"prompt.style.casual":{value:"Use a friendly, conversational tone. Be approachable and relatable.",description:"Style guide for casual narration"},"prompt.style.technical":{value:"Use precise technical language. Be detailed and accurate.",description:"Style guide for technical narration"},"script.segment.challenge":{value:"The challenge: {content}",description:"Narration segment prefix for problems",placeholders:[{name:"content",type:"string"}]},"script.segment.solution":{value:"The solution: {content}",description:"Narration segment prefix for solutions",placeholders:[{name:"content",type:"string"}]},"script.segment.results":{value:"The results: {content}",description:"Narration segment prefix for metrics",placeholders:[{name:"content",type:"string"}]},"scene.cta.default":{value:"Learn more",description:"Default call-to-action text for scenes"},"scene.hook.problem":{value:"The Problem",description:"Scene hook label for problem statement"},"scene.narration.problem":{value:"The problem: {content}",description:"Scene narration for problem statement",placeholders:[{name:"content",type:"string"}]},"scene.hook.solution":{value:"The Solution",description:"Scene hook label for solution"},"scene.narration.solution":{value:"The solution: {content}",description:"Scene narration for solution",placeholders:[{name:"content",type:"string"}]},"scene.hook.results":{value:"Results",description:"Scene hook label for results/metrics"},"composition.apiOverview.generates":{value:"Generates:",description:"ApiOverview heading for generated outputs"},"composition.apiOverview.tagline":{value:"One spec. Every surface.",description:"ApiOverview default tagline"},"composition.apiOverview.output.rest":{value:"REST Endpoint",description:"Generated output label: REST"},"composition.apiOverview.output.graphql":{value:"GraphQL Mutation",description:"Generated output label: GraphQL"},"composition.apiOverview.output.prisma":{value:"Prisma Model",description:"Generated output label: Prisma"},"composition.apiOverview.output.typescript":{value:"TypeScript SDK",description:"Generated output label: TypeScript SDK"},"composition.apiOverview.output.mcp":{value:"MCP Tool",description:"Generated output label: MCP Tool"},"composition.apiOverview.output.openapi":{value:"OpenAPI Spec",description:"Generated output label: OpenAPI"},"composition.socialClip.cta":{value:"Learn more",description:"SocialClip default CTA"},"composition.terminal.title":{value:"Terminal",description:"TerminalDemo default window title"}}});import{defineTranslation as B}from"@contractspec/lib.contracts-spec/translations";var K=B({meta:{key:"video-gen.messages",version:"1.0.0",domain:"video-gen",description:"Spanish translations for the video-gen package",owners:["platform"],stability:"experimental"},locale:"es",fallback:"en",messages:{"prompt.script.system":{value:`Eres un redactor de guiones de narraci\xF3n para v\xEDdeo.
|
|
170
30
|
Escribe un gui\xF3n de narraci\xF3n para un v\xEDdeo corto (30-60 segundos).
|
|
171
31
|
{styleGuide}
|
|
172
32
|
|
|
@@ -177,12 +37,7 @@ Devuelve JSON con la forma:
|
|
|
177
37
|
}
|
|
178
38
|
|
|
179
39
|
Los identificadores de escena deben ser: "intro", "problems", "solutions", "metrics", "cta".
|
|
180
|
-
Incluye solo los segmentos relevantes para el brief.`,
|
|
181
|
-
description: "Script generator LLM system prompt",
|
|
182
|
-
placeholders: [{ name: "styleGuide", type: "string" }]
|
|
183
|
-
},
|
|
184
|
-
"prompt.scenePlanner.system": {
|
|
185
|
-
value: `Eres un planificador de escenas de v\xEDdeo para v\xEDdeos de marketing/documentaci\xF3n de ContractSpec.
|
|
40
|
+
Incluye solo los segmentos relevantes para el brief.`,description:"Script generator LLM system prompt",placeholders:[{name:"styleGuide",type:"string"}]},"prompt.scenePlanner.system":{value:`Eres un planificador de escenas de v\xEDdeo para v\xEDdeos de marketing/documentaci\xF3n de ContractSpec.
|
|
186
41
|
Dado un brief de contenido, div\xEDdelo en escenas de v\xEDdeo.
|
|
187
42
|
|
|
188
43
|
Cada escena debe tener:
|
|
@@ -198,125 +53,7 @@ Devuelve un objeto JSON con la forma:
|
|
|
198
53
|
}
|
|
199
54
|
|
|
200
55
|
Mant\xE9n la duraci\xF3n total alrededor de {targetSeconds} segundos.
|
|
201
|
-
Prioriza la claridad y el ritmo. Cada escena debe comunicar una idea.`,
|
|
202
|
-
description: "Scene planner LLM system prompt",
|
|
203
|
-
placeholders: [
|
|
204
|
-
{ name: "fps", type: "number" },
|
|
205
|
-
{ name: "targetSeconds", type: "number" }
|
|
206
|
-
]
|
|
207
|
-
},
|
|
208
|
-
"prompt.style.professional": {
|
|
209
|
-
value: "Usa un tono claro, autoritario y profesional. S\xE9 conciso y directo.",
|
|
210
|
-
description: "Style guide for professional narration"
|
|
211
|
-
},
|
|
212
|
-
"prompt.style.casual": {
|
|
213
|
-
value: "Usa un tono amigable y conversacional. S\xE9 accesible y cercano.",
|
|
214
|
-
description: "Style guide for casual narration"
|
|
215
|
-
},
|
|
216
|
-
"prompt.style.technical": {
|
|
217
|
-
value: "Usa un lenguaje t\xE9cnico preciso. S\xE9 detallado y exacto.",
|
|
218
|
-
description: "Style guide for technical narration"
|
|
219
|
-
},
|
|
220
|
-
"script.segment.challenge": {
|
|
221
|
-
value: "El desaf\xEDo: {content}",
|
|
222
|
-
description: "Narration segment prefix for problems",
|
|
223
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
224
|
-
},
|
|
225
|
-
"script.segment.solution": {
|
|
226
|
-
value: "La soluci\xF3n: {content}",
|
|
227
|
-
description: "Narration segment prefix for solutions",
|
|
228
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
229
|
-
},
|
|
230
|
-
"script.segment.results": {
|
|
231
|
-
value: "Los resultados: {content}",
|
|
232
|
-
description: "Narration segment prefix for metrics",
|
|
233
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
234
|
-
},
|
|
235
|
-
"scene.cta.default": {
|
|
236
|
-
value: "M\xE1s informaci\xF3n",
|
|
237
|
-
description: "Default call-to-action text for scenes"
|
|
238
|
-
},
|
|
239
|
-
"scene.hook.problem": {
|
|
240
|
-
value: "El problema",
|
|
241
|
-
description: "Scene hook label for problem statement"
|
|
242
|
-
},
|
|
243
|
-
"scene.narration.problem": {
|
|
244
|
-
value: "El problema: {content}",
|
|
245
|
-
description: "Scene narration for problem statement",
|
|
246
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
247
|
-
},
|
|
248
|
-
"scene.hook.solution": {
|
|
249
|
-
value: "La soluci\xF3n",
|
|
250
|
-
description: "Scene hook label for solution"
|
|
251
|
-
},
|
|
252
|
-
"scene.narration.solution": {
|
|
253
|
-
value: "La soluci\xF3n: {content}",
|
|
254
|
-
description: "Scene narration for solution",
|
|
255
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
256
|
-
},
|
|
257
|
-
"scene.hook.results": {
|
|
258
|
-
value: "Resultados",
|
|
259
|
-
description: "Scene hook label for results/metrics"
|
|
260
|
-
},
|
|
261
|
-
"composition.apiOverview.generates": {
|
|
262
|
-
value: "Genera:",
|
|
263
|
-
description: "ApiOverview heading for generated outputs"
|
|
264
|
-
},
|
|
265
|
-
"composition.apiOverview.tagline": {
|
|
266
|
-
value: "Una spec. Todas las superficies.",
|
|
267
|
-
description: "ApiOverview default tagline"
|
|
268
|
-
},
|
|
269
|
-
"composition.apiOverview.output.rest": {
|
|
270
|
-
value: "Endpoint REST",
|
|
271
|
-
description: "Generated output label: REST"
|
|
272
|
-
},
|
|
273
|
-
"composition.apiOverview.output.graphql": {
|
|
274
|
-
value: "Mutaci\xF3n GraphQL",
|
|
275
|
-
description: "Generated output label: GraphQL"
|
|
276
|
-
},
|
|
277
|
-
"composition.apiOverview.output.prisma": {
|
|
278
|
-
value: "Modelo Prisma",
|
|
279
|
-
description: "Generated output label: Prisma"
|
|
280
|
-
},
|
|
281
|
-
"composition.apiOverview.output.typescript": {
|
|
282
|
-
value: "SDK TypeScript",
|
|
283
|
-
description: "Generated output label: TypeScript SDK"
|
|
284
|
-
},
|
|
285
|
-
"composition.apiOverview.output.mcp": {
|
|
286
|
-
value: "Herramienta MCP",
|
|
287
|
-
description: "Generated output label: MCP Tool"
|
|
288
|
-
},
|
|
289
|
-
"composition.apiOverview.output.openapi": {
|
|
290
|
-
value: "Spec OpenAPI",
|
|
291
|
-
description: "Generated output label: OpenAPI"
|
|
292
|
-
},
|
|
293
|
-
"composition.socialClip.cta": {
|
|
294
|
-
value: "M\xE1s informaci\xF3n",
|
|
295
|
-
description: "SocialClip default CTA"
|
|
296
|
-
},
|
|
297
|
-
"composition.terminal.title": {
|
|
298
|
-
value: "Terminal",
|
|
299
|
-
description: "TerminalDemo default window title"
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// src/i18n/catalogs/fr.ts
|
|
305
|
-
import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
|
|
306
|
-
var frMessages = defineTranslation3({
|
|
307
|
-
meta: {
|
|
308
|
-
key: "video-gen.messages",
|
|
309
|
-
version: "1.0.0",
|
|
310
|
-
domain: "video-gen",
|
|
311
|
-
description: "French translations for the video-gen package",
|
|
312
|
-
owners: ["platform"],
|
|
313
|
-
stability: "experimental"
|
|
314
|
-
},
|
|
315
|
-
locale: "fr",
|
|
316
|
-
fallback: "en",
|
|
317
|
-
messages: {
|
|
318
|
-
"prompt.script.system": {
|
|
319
|
-
value: `Vous \xEAtes un r\xE9dacteur de scripts de narration vid\xE9o.
|
|
56
|
+
Prioriza la claridad y el ritmo. Cada escena debe comunicar una idea.`,description:"Scene planner LLM system prompt",placeholders:[{name:"fps",type:"number"},{name:"targetSeconds",type:"number"}]},"prompt.style.professional":{value:"Usa un tono claro, autoritario y profesional. S\xE9 conciso y directo.",description:"Style guide for professional narration"},"prompt.style.casual":{value:"Usa un tono amigable y conversacional. S\xE9 accesible y cercano.",description:"Style guide for casual narration"},"prompt.style.technical":{value:"Usa un lenguaje t\xE9cnico preciso. S\xE9 detallado y exacto.",description:"Style guide for technical narration"},"script.segment.challenge":{value:"El desaf\xEDo: {content}",description:"Narration segment prefix for problems",placeholders:[{name:"content",type:"string"}]},"script.segment.solution":{value:"La soluci\xF3n: {content}",description:"Narration segment prefix for solutions",placeholders:[{name:"content",type:"string"}]},"script.segment.results":{value:"Los resultados: {content}",description:"Narration segment prefix for metrics",placeholders:[{name:"content",type:"string"}]},"scene.cta.default":{value:"M\xE1s informaci\xF3n",description:"Default call-to-action text for scenes"},"scene.hook.problem":{value:"El problema",description:"Scene hook label for problem statement"},"scene.narration.problem":{value:"El problema: {content}",description:"Scene narration for problem statement",placeholders:[{name:"content",type:"string"}]},"scene.hook.solution":{value:"La soluci\xF3n",description:"Scene hook label for solution"},"scene.narration.solution":{value:"La soluci\xF3n: {content}",description:"Scene narration for solution",placeholders:[{name:"content",type:"string"}]},"scene.hook.results":{value:"Resultados",description:"Scene hook label for results/metrics"},"composition.apiOverview.generates":{value:"Genera:",description:"ApiOverview heading for generated outputs"},"composition.apiOverview.tagline":{value:"Una spec. Todas las superficies.",description:"ApiOverview default tagline"},"composition.apiOverview.output.rest":{value:"Endpoint REST",description:"Generated output label: REST"},"composition.apiOverview.output.graphql":{value:"Mutaci\xF3n GraphQL",description:"Generated output label: GraphQL"},"composition.apiOverview.output.prisma":{value:"Modelo Prisma",description:"Generated output label: Prisma"},"composition.apiOverview.output.typescript":{value:"SDK TypeScript",description:"Generated output label: TypeScript SDK"},"composition.apiOverview.output.mcp":{value:"Herramienta MCP",description:"Generated output label: MCP Tool"},"composition.apiOverview.output.openapi":{value:"Spec OpenAPI",description:"Generated output label: OpenAPI"},"composition.socialClip.cta":{value:"M\xE1s informaci\xF3n",description:"SocialClip default CTA"},"composition.terminal.title":{value:"Terminal",description:"TerminalDemo default window title"}}});import{defineTranslation as F}from"@contractspec/lib.contracts-spec/translations";var P=F({meta:{key:"video-gen.messages",version:"1.0.0",domain:"video-gen",description:"French translations for the video-gen package",owners:["platform"],stability:"experimental"},locale:"fr",fallback:"en",messages:{"prompt.script.system":{value:`Vous \xEAtes un r\xE9dacteur de scripts de narration vid\xE9o.
|
|
320
57
|
\xC9crivez un script de narration pour une courte vid\xE9o (30-60 secondes).
|
|
321
58
|
{styleGuide}
|
|
322
59
|
|
|
@@ -327,12 +64,7 @@ Retournez du JSON avec la forme\xA0:
|
|
|
327
64
|
}
|
|
328
65
|
|
|
329
66
|
Les identifiants de sc\xE8ne doivent \xEAtre\xA0: "intro", "problems", "solutions", "metrics", "cta".
|
|
330
|
-
N'incluez que les segments pertinents au brief.`,
|
|
331
|
-
description: "Script generator LLM system prompt",
|
|
332
|
-
placeholders: [{ name: "styleGuide", type: "string" }]
|
|
333
|
-
},
|
|
334
|
-
"prompt.scenePlanner.system": {
|
|
335
|
-
value: `Vous \xEAtes un planificateur de sc\xE8nes vid\xE9o pour les vid\xE9os marketing/documentation de ContractSpec.
|
|
67
|
+
N'incluez que les segments pertinents au brief.`,description:"Script generator LLM system prompt",placeholders:[{name:"styleGuide",type:"string"}]},"prompt.scenePlanner.system":{value:`Vous \xEAtes un planificateur de sc\xE8nes vid\xE9o pour les vid\xE9os marketing/documentation de ContractSpec.
|
|
336
68
|
\xC0 partir d'un brief, d\xE9composez-le en sc\xE8nes vid\xE9o.
|
|
337
69
|
|
|
338
70
|
Chaque sc\xE8ne doit avoir\xA0:
|
|
@@ -348,322 +80,4 @@ Retournez un objet JSON avec la forme\xA0:
|
|
|
348
80
|
}
|
|
349
81
|
|
|
350
82
|
Gardez la dur\xE9e totale autour de {targetSeconds} secondes.
|
|
351
|
-
Privil\xE9giez la clart\xE9 et le rythme. Chaque sc\xE8ne doit communiquer une id\xE9e.`,
|
|
352
|
-
description: "Scene planner LLM system prompt",
|
|
353
|
-
placeholders: [
|
|
354
|
-
{ name: "fps", type: "number" },
|
|
355
|
-
{ name: "targetSeconds", type: "number" }
|
|
356
|
-
]
|
|
357
|
-
},
|
|
358
|
-
"prompt.style.professional": {
|
|
359
|
-
value: "Utilisez un ton clair, autoritaire et professionnel. Soyez concis et direct.",
|
|
360
|
-
description: "Style guide for professional narration"
|
|
361
|
-
},
|
|
362
|
-
"prompt.style.casual": {
|
|
363
|
-
value: "Utilisez un ton amical et conversationnel. Soyez accessible et proche.",
|
|
364
|
-
description: "Style guide for casual narration"
|
|
365
|
-
},
|
|
366
|
-
"prompt.style.technical": {
|
|
367
|
-
value: "Utilisez un langage technique pr\xE9cis. Soyez d\xE9taill\xE9 et exact.",
|
|
368
|
-
description: "Style guide for technical narration"
|
|
369
|
-
},
|
|
370
|
-
"script.segment.challenge": {
|
|
371
|
-
value: "Le d\xE9fi\xA0: {content}",
|
|
372
|
-
description: "Narration segment prefix for problems",
|
|
373
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
374
|
-
},
|
|
375
|
-
"script.segment.solution": {
|
|
376
|
-
value: "La solution\xA0: {content}",
|
|
377
|
-
description: "Narration segment prefix for solutions",
|
|
378
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
379
|
-
},
|
|
380
|
-
"script.segment.results": {
|
|
381
|
-
value: "Les r\xE9sultats\xA0: {content}",
|
|
382
|
-
description: "Narration segment prefix for metrics",
|
|
383
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
384
|
-
},
|
|
385
|
-
"scene.cta.default": {
|
|
386
|
-
value: "En savoir plus",
|
|
387
|
-
description: "Default call-to-action text for scenes"
|
|
388
|
-
},
|
|
389
|
-
"scene.hook.problem": {
|
|
390
|
-
value: "Le probl\xE8me",
|
|
391
|
-
description: "Scene hook label for problem statement"
|
|
392
|
-
},
|
|
393
|
-
"scene.narration.problem": {
|
|
394
|
-
value: "Le probl\xE8me\xA0: {content}",
|
|
395
|
-
description: "Scene narration for problem statement",
|
|
396
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
397
|
-
},
|
|
398
|
-
"scene.hook.solution": {
|
|
399
|
-
value: "La solution",
|
|
400
|
-
description: "Scene hook label for solution"
|
|
401
|
-
},
|
|
402
|
-
"scene.narration.solution": {
|
|
403
|
-
value: "La solution\xA0: {content}",
|
|
404
|
-
description: "Scene narration for solution",
|
|
405
|
-
placeholders: [{ name: "content", type: "string" }]
|
|
406
|
-
},
|
|
407
|
-
"scene.hook.results": {
|
|
408
|
-
value: "R\xE9sultats",
|
|
409
|
-
description: "Scene hook label for results/metrics"
|
|
410
|
-
},
|
|
411
|
-
"composition.apiOverview.generates": {
|
|
412
|
-
value: "G\xE9n\xE8re\xA0:",
|
|
413
|
-
description: "ApiOverview heading for generated outputs"
|
|
414
|
-
},
|
|
415
|
-
"composition.apiOverview.tagline": {
|
|
416
|
-
value: "Un spec. Toutes les surfaces.",
|
|
417
|
-
description: "ApiOverview default tagline"
|
|
418
|
-
},
|
|
419
|
-
"composition.apiOverview.output.rest": {
|
|
420
|
-
value: "Endpoint REST",
|
|
421
|
-
description: "Generated output label: REST"
|
|
422
|
-
},
|
|
423
|
-
"composition.apiOverview.output.graphql": {
|
|
424
|
-
value: "Mutation GraphQL",
|
|
425
|
-
description: "Generated output label: GraphQL"
|
|
426
|
-
},
|
|
427
|
-
"composition.apiOverview.output.prisma": {
|
|
428
|
-
value: "Mod\xE8le Prisma",
|
|
429
|
-
description: "Generated output label: Prisma"
|
|
430
|
-
},
|
|
431
|
-
"composition.apiOverview.output.typescript": {
|
|
432
|
-
value: "SDK TypeScript",
|
|
433
|
-
description: "Generated output label: TypeScript SDK"
|
|
434
|
-
},
|
|
435
|
-
"composition.apiOverview.output.mcp": {
|
|
436
|
-
value: "Outil MCP",
|
|
437
|
-
description: "Generated output label: MCP Tool"
|
|
438
|
-
},
|
|
439
|
-
"composition.apiOverview.output.openapi": {
|
|
440
|
-
value: "Spec OpenAPI",
|
|
441
|
-
description: "Generated output label: OpenAPI"
|
|
442
|
-
},
|
|
443
|
-
"composition.socialClip.cta": {
|
|
444
|
-
value: "En savoir plus",
|
|
445
|
-
description: "SocialClip default CTA"
|
|
446
|
-
},
|
|
447
|
-
"composition.terminal.title": {
|
|
448
|
-
value: "Terminal",
|
|
449
|
-
description: "TerminalDemo default window title"
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
// src/i18n/keys.ts
|
|
455
|
-
var PROMPT_KEYS = {
|
|
456
|
-
"prompt.script.system": "prompt.script.system",
|
|
457
|
-
"prompt.scenePlanner.system": "prompt.scenePlanner.system",
|
|
458
|
-
"prompt.style.professional": "prompt.style.professional",
|
|
459
|
-
"prompt.style.casual": "prompt.style.casual",
|
|
460
|
-
"prompt.style.technical": "prompt.style.technical"
|
|
461
|
-
};
|
|
462
|
-
var SCRIPT_KEYS = {
|
|
463
|
-
"script.segment.challenge": "script.segment.challenge",
|
|
464
|
-
"script.segment.solution": "script.segment.solution",
|
|
465
|
-
"script.segment.results": "script.segment.results"
|
|
466
|
-
};
|
|
467
|
-
var SCENE_KEYS = {
|
|
468
|
-
"scene.cta.default": "scene.cta.default",
|
|
469
|
-
"scene.hook.problem": "scene.hook.problem",
|
|
470
|
-
"scene.narration.problem": "scene.narration.problem",
|
|
471
|
-
"scene.hook.solution": "scene.hook.solution",
|
|
472
|
-
"scene.narration.solution": "scene.narration.solution",
|
|
473
|
-
"scene.hook.results": "scene.hook.results"
|
|
474
|
-
};
|
|
475
|
-
var COMPOSITION_KEYS = {
|
|
476
|
-
"composition.apiOverview.generates": "composition.apiOverview.generates",
|
|
477
|
-
"composition.apiOverview.tagline": "composition.apiOverview.tagline",
|
|
478
|
-
"composition.apiOverview.output.rest": "composition.apiOverview.output.rest",
|
|
479
|
-
"composition.apiOverview.output.graphql": "composition.apiOverview.output.graphql",
|
|
480
|
-
"composition.apiOverview.output.prisma": "composition.apiOverview.output.prisma",
|
|
481
|
-
"composition.apiOverview.output.typescript": "composition.apiOverview.output.typescript",
|
|
482
|
-
"composition.apiOverview.output.mcp": "composition.apiOverview.output.mcp",
|
|
483
|
-
"composition.apiOverview.output.openapi": "composition.apiOverview.output.openapi",
|
|
484
|
-
"composition.socialClip.cta": "composition.socialClip.cta",
|
|
485
|
-
"composition.terminal.title": "composition.terminal.title"
|
|
486
|
-
};
|
|
487
|
-
var I18N_KEYS = {
|
|
488
|
-
...PROMPT_KEYS,
|
|
489
|
-
...SCRIPT_KEYS,
|
|
490
|
-
...SCENE_KEYS,
|
|
491
|
-
...COMPOSITION_KEYS
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
// src/i18n/locale.ts
|
|
495
|
-
import {
|
|
496
|
-
DEFAULT_LOCALE,
|
|
497
|
-
isSupportedLocale,
|
|
498
|
-
resolveLocale,
|
|
499
|
-
SUPPORTED_LOCALES
|
|
500
|
-
} from "@contractspec/lib.contracts-spec/translations";
|
|
501
|
-
|
|
502
|
-
// src/i18n/messages.ts
|
|
503
|
-
import {
|
|
504
|
-
createI18nFactory
|
|
505
|
-
} from "@contractspec/lib.contracts-spec/translations";
|
|
506
|
-
var factory = createI18nFactory({
|
|
507
|
-
specKey: "video-gen.messages",
|
|
508
|
-
catalogs: [enMessages, frMessages, esMessages]
|
|
509
|
-
});
|
|
510
|
-
var createVideoGenI18n = factory.create;
|
|
511
|
-
var getDefaultI18n = factory.getDefault;
|
|
512
|
-
var resetI18nRegistry = factory.resetRegistry;
|
|
513
|
-
// src/generators/script-generator.ts
|
|
514
|
-
class ScriptGenerator {
|
|
515
|
-
llm;
|
|
516
|
-
model;
|
|
517
|
-
temperature;
|
|
518
|
-
i18n;
|
|
519
|
-
modelSelector;
|
|
520
|
-
selectionContext;
|
|
521
|
-
constructor(options) {
|
|
522
|
-
this.llm = options?.llm;
|
|
523
|
-
this.model = options?.model;
|
|
524
|
-
this.temperature = options?.temperature ?? 0.5;
|
|
525
|
-
this.i18n = createVideoGenI18n(options?.locale);
|
|
526
|
-
this.modelSelector = options?.modelSelector;
|
|
527
|
-
this.selectionContext = options?.selectionContext;
|
|
528
|
-
}
|
|
529
|
-
async generate(brief, config) {
|
|
530
|
-
const style = config?.style ?? "professional";
|
|
531
|
-
if (this.llm) {
|
|
532
|
-
return this.generateWithLlm(brief, style);
|
|
533
|
-
}
|
|
534
|
-
return this.generateDeterministic(brief, style);
|
|
535
|
-
}
|
|
536
|
-
generateDeterministic(brief, style) {
|
|
537
|
-
const { t } = this.i18n;
|
|
538
|
-
const segments = [];
|
|
539
|
-
const intro = this.formatForStyle(`${brief.title}. ${brief.summary}`, style);
|
|
540
|
-
segments.push({
|
|
541
|
-
sceneId: "intro",
|
|
542
|
-
text: intro,
|
|
543
|
-
estimatedDurationSeconds: this.estimateDuration(intro)
|
|
544
|
-
});
|
|
545
|
-
if (brief.problems.length > 0) {
|
|
546
|
-
const problemText = this.formatForStyle(t("script.segment.challenge", {
|
|
547
|
-
content: brief.problems.join(". ")
|
|
548
|
-
}), style);
|
|
549
|
-
segments.push({
|
|
550
|
-
sceneId: "problems",
|
|
551
|
-
text: problemText,
|
|
552
|
-
estimatedDurationSeconds: this.estimateDuration(problemText)
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
if (brief.solutions.length > 0) {
|
|
556
|
-
const solutionText = this.formatForStyle(t("script.segment.solution", {
|
|
557
|
-
content: brief.solutions.join(". ")
|
|
558
|
-
}), style);
|
|
559
|
-
segments.push({
|
|
560
|
-
sceneId: "solutions",
|
|
561
|
-
text: solutionText,
|
|
562
|
-
estimatedDurationSeconds: this.estimateDuration(solutionText)
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
if (brief.metrics && brief.metrics.length > 0) {
|
|
566
|
-
const metricsText = this.formatForStyle(t("script.segment.results", {
|
|
567
|
-
content: brief.metrics.join(". ")
|
|
568
|
-
}), style);
|
|
569
|
-
segments.push({
|
|
570
|
-
sceneId: "metrics",
|
|
571
|
-
text: metricsText,
|
|
572
|
-
estimatedDurationSeconds: this.estimateDuration(metricsText)
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
if (brief.callToAction) {
|
|
576
|
-
const ctaText = this.formatForStyle(brief.callToAction, style);
|
|
577
|
-
segments.push({
|
|
578
|
-
sceneId: "cta",
|
|
579
|
-
text: ctaText,
|
|
580
|
-
estimatedDurationSeconds: this.estimateDuration(ctaText)
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
const fullText = segments.map((s) => s.text).join(" ");
|
|
584
|
-
const totalDuration = segments.reduce((sum, s) => sum + s.estimatedDurationSeconds, 0);
|
|
585
|
-
return {
|
|
586
|
-
fullText,
|
|
587
|
-
segments,
|
|
588
|
-
estimatedDurationSeconds: totalDuration,
|
|
589
|
-
style
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
async resolveModel() {
|
|
593
|
-
if (this.model)
|
|
594
|
-
return this.model;
|
|
595
|
-
if (this.modelSelector) {
|
|
596
|
-
const ctx = this.selectionContext ?? {
|
|
597
|
-
taskDimension: "reasoning"
|
|
598
|
-
};
|
|
599
|
-
const result = await this.modelSelector.select(ctx);
|
|
600
|
-
return result.modelId;
|
|
601
|
-
}
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
async generateWithLlm(brief, style) {
|
|
605
|
-
const { t } = this.i18n;
|
|
606
|
-
const styleGuide = {
|
|
607
|
-
professional: t("prompt.style.professional"),
|
|
608
|
-
casual: t("prompt.style.casual"),
|
|
609
|
-
technical: t("prompt.style.technical")
|
|
610
|
-
};
|
|
611
|
-
const styleKey = style ?? "professional";
|
|
612
|
-
const messages = [
|
|
613
|
-
{
|
|
614
|
-
role: "system",
|
|
615
|
-
content: [
|
|
616
|
-
{
|
|
617
|
-
type: "text",
|
|
618
|
-
text: t("prompt.script.system", {
|
|
619
|
-
styleGuide: styleGuide[styleKey]
|
|
620
|
-
})
|
|
621
|
-
}
|
|
622
|
-
]
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
role: "user",
|
|
626
|
-
content: [{ type: "text", text: JSON.stringify(brief) }]
|
|
627
|
-
}
|
|
628
|
-
];
|
|
629
|
-
if (!this.llm) {
|
|
630
|
-
return this.generateDeterministic(brief, style);
|
|
631
|
-
}
|
|
632
|
-
try {
|
|
633
|
-
const model = await this.resolveModel();
|
|
634
|
-
const response = await this.llm.chat(messages, {
|
|
635
|
-
model,
|
|
636
|
-
temperature: this.temperature,
|
|
637
|
-
responseFormat: "json"
|
|
638
|
-
});
|
|
639
|
-
const text = response.message.content.find((p) => p.type === "text");
|
|
640
|
-
if (!text || text.type !== "text") {
|
|
641
|
-
return this.generateDeterministic(brief, style);
|
|
642
|
-
}
|
|
643
|
-
const parsed = JSON.parse(text.text);
|
|
644
|
-
const segments = parsed.segments.map((s) => ({
|
|
645
|
-
sceneId: s.sceneId,
|
|
646
|
-
text: s.text,
|
|
647
|
-
estimatedDurationSeconds: this.estimateDuration(s.text)
|
|
648
|
-
}));
|
|
649
|
-
return {
|
|
650
|
-
fullText: parsed.fullText,
|
|
651
|
-
segments,
|
|
652
|
-
estimatedDurationSeconds: segments.reduce((sum, s) => sum + s.estimatedDurationSeconds, 0),
|
|
653
|
-
style
|
|
654
|
-
};
|
|
655
|
-
} catch {
|
|
656
|
-
return this.generateDeterministic(brief, style);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
formatForStyle(text, _style) {
|
|
660
|
-
return text;
|
|
661
|
-
}
|
|
662
|
-
estimateDuration(text) {
|
|
663
|
-
const wordCount = text.split(/\s+/).length;
|
|
664
|
-
return Math.ceil(wordCount / 150 * 60);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
export {
|
|
668
|
-
ScriptGenerator
|
|
669
|
-
};
|
|
83
|
+
Privil\xE9giez la clart\xE9 et le rythme. Chaque sc\xE8ne doit communiquer une id\xE9e.`,description:"Scene planner LLM system prompt",placeholders:[{name:"fps",type:"number"},{name:"targetSeconds",type:"number"}]},"prompt.style.professional":{value:"Utilisez un ton clair, autoritaire et professionnel. Soyez concis et direct.",description:"Style guide for professional narration"},"prompt.style.casual":{value:"Utilisez un ton amical et conversationnel. Soyez accessible et proche.",description:"Style guide for casual narration"},"prompt.style.technical":{value:"Utilisez un langage technique pr\xE9cis. Soyez d\xE9taill\xE9 et exact.",description:"Style guide for technical narration"},"script.segment.challenge":{value:"Le d\xE9fi\xA0: {content}",description:"Narration segment prefix for problems",placeholders:[{name:"content",type:"string"}]},"script.segment.solution":{value:"La solution\xA0: {content}",description:"Narration segment prefix for solutions",placeholders:[{name:"content",type:"string"}]},"script.segment.results":{value:"Les r\xE9sultats\xA0: {content}",description:"Narration segment prefix for metrics",placeholders:[{name:"content",type:"string"}]},"scene.cta.default":{value:"En savoir plus",description:"Default call-to-action text for scenes"},"scene.hook.problem":{value:"Le probl\xE8me",description:"Scene hook label for problem statement"},"scene.narration.problem":{value:"Le probl\xE8me\xA0: {content}",description:"Scene narration for problem statement",placeholders:[{name:"content",type:"string"}]},"scene.hook.solution":{value:"La solution",description:"Scene hook label for solution"},"scene.narration.solution":{value:"La solution\xA0: {content}",description:"Scene narration for solution",placeholders:[{name:"content",type:"string"}]},"scene.hook.results":{value:"R\xE9sultats",description:"Scene hook label for results/metrics"},"composition.apiOverview.generates":{value:"G\xE9n\xE8re\xA0:",description:"ApiOverview heading for generated outputs"},"composition.apiOverview.tagline":{value:"Un spec. Toutes les surfaces.",description:"ApiOverview default tagline"},"composition.apiOverview.output.rest":{value:"Endpoint REST",description:"Generated output label: REST"},"composition.apiOverview.output.graphql":{value:"Mutation GraphQL",description:"Generated output label: GraphQL"},"composition.apiOverview.output.prisma":{value:"Mod\xE8le Prisma",description:"Generated output label: Prisma"},"composition.apiOverview.output.typescript":{value:"SDK TypeScript",description:"Generated output label: TypeScript SDK"},"composition.apiOverview.output.mcp":{value:"Outil MCP",description:"Generated output label: MCP Tool"},"composition.apiOverview.output.openapi":{value:"Spec OpenAPI",description:"Generated output label: OpenAPI"},"composition.socialClip.cta":{value:"En savoir plus",description:"SocialClip default CTA"},"composition.terminal.title":{value:"Terminal",description:"TerminalDemo default window title"}}});var N={"prompt.script.system":"prompt.script.system","prompt.scenePlanner.system":"prompt.scenePlanner.system","prompt.style.professional":"prompt.style.professional","prompt.style.casual":"prompt.style.casual","prompt.style.technical":"prompt.style.technical"},U={"script.segment.challenge":"script.segment.challenge","script.segment.solution":"script.segment.solution","script.segment.results":"script.segment.results"},Y={"scene.cta.default":"scene.cta.default","scene.hook.problem":"scene.hook.problem","scene.narration.problem":"scene.narration.problem","scene.hook.solution":"scene.hook.solution","scene.narration.solution":"scene.narration.solution","scene.hook.results":"scene.hook.results"},j={"composition.apiOverview.generates":"composition.apiOverview.generates","composition.apiOverview.tagline":"composition.apiOverview.tagline","composition.apiOverview.output.rest":"composition.apiOverview.output.rest","composition.apiOverview.output.graphql":"composition.apiOverview.output.graphql","composition.apiOverview.output.prisma":"composition.apiOverview.output.prisma","composition.apiOverview.output.typescript":"composition.apiOverview.output.typescript","composition.apiOverview.output.mcp":"composition.apiOverview.output.mcp","composition.apiOverview.output.openapi":"composition.apiOverview.output.openapi","composition.socialClip.cta":"composition.socialClip.cta","composition.terminal.title":"composition.terminal.title"},H={...N,...U,...Y,...j};import{DEFAULT_LOCALE as J,isSupportedLocale as Q,resolveLocale as W,SUPPORTED_LOCALES as X}from"@contractspec/lib.contracts-spec/translations";import{createI18nFactory as Z}from"@contractspec/lib.contracts-spec/translations";var R=Z({specKey:"video-gen.messages",catalogs:[D,P,K]}),h=R.create,$=R.getDefault,k=R.resetRegistry;class w{llm;model;temperature;i18n;modelSelector;selectionContext;constructor(L){this.llm=L?.llm,this.model=L?.model,this.temperature=L?.temperature??0.5,this.i18n=h(L?.locale),this.modelSelector=L?.modelSelector,this.selectionContext=L?.selectionContext}async generate(L,I){let E=I?.style??"professional";if(this.llm)return this.generateWithLlm(L,E);return this.generateDeterministic(L,E)}generateDeterministic(L,I){let{t:E}=this.i18n,V=[],_=this.formatForStyle(`${L.title}. ${L.summary}`,I);if(V.push({sceneId:"intro",text:_,estimatedDurationSeconds:this.estimateDuration(_)}),L.problems.length>0){let S=this.formatForStyle(E("script.segment.challenge",{content:L.problems.join(". ")}),I);V.push({sceneId:"problems",text:S,estimatedDurationSeconds:this.estimateDuration(S)})}if(L.solutions.length>0){let S=this.formatForStyle(E("script.segment.solution",{content:L.solutions.join(". ")}),I);V.push({sceneId:"solutions",text:S,estimatedDurationSeconds:this.estimateDuration(S)})}if(L.metrics&&L.metrics.length>0){let S=this.formatForStyle(E("script.segment.results",{content:L.metrics.join(". ")}),I);V.push({sceneId:"metrics",text:S,estimatedDurationSeconds:this.estimateDuration(S)})}if(L.callToAction){let S=this.formatForStyle(L.callToAction,I);V.push({sceneId:"cta",text:S,estimatedDurationSeconds:this.estimateDuration(S)})}let A=V.map((S)=>S.text).join(" "),C=V.reduce((S,O)=>S+O.estimatedDurationSeconds,0);return{fullText:A,segments:V,estimatedDurationSeconds:C,style:I}}async resolveModel(){if(this.model)return this.model;if(this.modelSelector){let L=this.selectionContext??{taskDimension:"reasoning"};return(await this.modelSelector.select(L)).modelId}return}async generateWithLlm(L,I){let{t:E}=this.i18n,V={professional:E("prompt.style.professional"),casual:E("prompt.style.casual"),technical:E("prompt.style.technical")},A=[{role:"system",content:[{type:"text",text:E("prompt.script.system",{styleGuide:V[I??"professional"]})}]},{role:"user",content:[{type:"text",text:JSON.stringify(L)}]}];if(!this.llm)return this.generateDeterministic(L,I);try{let C=await this.resolveModel(),O=(await this.llm.chat(A,{model:C,temperature:this.temperature,responseFormat:"json"})).message.content.find((G)=>G.type==="text");if(!O||O.type!=="text")return this.generateDeterministic(L,I);let z=JSON.parse(O.text),M=z.segments.map((G)=>({sceneId:G.sceneId,text:G.text,estimatedDurationSeconds:this.estimateDuration(G.text)}));return{fullText:z.fullText,segments:M,estimatedDurationSeconds:M.reduce((G,q)=>G+q.estimatedDurationSeconds,0),style:I}}catch{return this.generateDeterministic(L,I)}}formatForStyle(L,I){return L}estimateDuration(L){let I=L.split(/\s+/).length;return Math.ceil(I/150*60)}}export{w as ScriptGenerator};
|