@contractspec/lib.voice 0.2.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 (173) hide show
  1. package/dist/audio/audio-concatenator.d.ts +15 -0
  2. package/dist/audio/audio-concatenator.js +57 -0
  3. package/dist/audio/duration-estimator.d.ts +31 -0
  4. package/dist/audio/duration-estimator.js +22 -0
  5. package/dist/audio/format-converter.d.ts +17 -0
  6. package/dist/audio/format-converter.js +28 -0
  7. package/dist/audio/index.d.ts +4 -0
  8. package/dist/audio/index.js +121 -0
  9. package/dist/audio/silence-generator.d.ts +16 -0
  10. package/dist/audio/silence-generator.js +20 -0
  11. package/dist/browser/audio/audio-concatenator.js +56 -0
  12. package/dist/browser/audio/duration-estimator.js +21 -0
  13. package/dist/browser/audio/format-converter.js +27 -0
  14. package/dist/browser/audio/index.js +120 -0
  15. package/dist/browser/audio/silence-generator.js +19 -0
  16. package/dist/browser/conversational/index.js +241 -0
  17. package/dist/browser/conversational/response-orchestrator.js +62 -0
  18. package/dist/browser/conversational/transcript-builder.js +63 -0
  19. package/dist/browser/conversational/turn-detector.js +43 -0
  20. package/dist/browser/conversational/types.js +0 -0
  21. package/dist/browser/conversational/voice-session-manager.js +137 -0
  22. package/dist/browser/docs/conversational.docblock.js +5 -0
  23. package/dist/browser/docs/stt.docblock.js +5 -0
  24. package/dist/browser/docs/sync.docblock.js +5 -0
  25. package/dist/browser/docs/tts.docblock.js +5 -0
  26. package/dist/browser/docs/voice.docblock.js +5 -0
  27. package/dist/browser/i18n/catalogs/en.js +91 -0
  28. package/dist/browser/i18n/catalogs/es.js +91 -0
  29. package/dist/browser/i18n/catalogs/fr.js +91 -0
  30. package/dist/browser/i18n/catalogs/index.js +271 -0
  31. package/dist/browser/i18n/index.js +335 -0
  32. package/dist/browser/i18n/keys.js +38 -0
  33. package/dist/browser/i18n/locale.js +13 -0
  34. package/dist/browser/i18n/messages.js +283 -0
  35. package/dist/browser/index.js +1070 -0
  36. package/dist/browser/stt/diarization-mapper.js +42 -0
  37. package/dist/browser/stt/index.js +222 -0
  38. package/dist/browser/stt/segment-splitter.js +36 -0
  39. package/dist/browser/stt/subtitle-formatter.js +51 -0
  40. package/dist/browser/stt/transcriber.js +219 -0
  41. package/dist/browser/stt/types.js +0 -0
  42. package/dist/browser/sync/duration-negotiator.js +69 -0
  43. package/dist/browser/sync/index.js +165 -0
  44. package/dist/browser/sync/scene-adapter.js +52 -0
  45. package/dist/browser/sync/timing-calculator.js +46 -0
  46. package/dist/browser/tts/audio-assembler.js +120 -0
  47. package/dist/browser/tts/emphasis-planner.js +134 -0
  48. package/dist/browser/tts/index.js +439 -0
  49. package/dist/browser/tts/pace-analyzer.js +67 -0
  50. package/dist/browser/tts/segment-synthesizer.js +36 -0
  51. package/dist/browser/tts/types.js +0 -0
  52. package/dist/browser/tts/voice-synthesizer.js +435 -0
  53. package/dist/browser/types.js +0 -0
  54. package/dist/conversational/index.d.ts +5 -0
  55. package/dist/conversational/index.js +242 -0
  56. package/dist/conversational/response-orchestrator.d.ts +26 -0
  57. package/dist/conversational/response-orchestrator.js +63 -0
  58. package/dist/conversational/transcript-builder.d.ts +25 -0
  59. package/dist/conversational/transcript-builder.js +64 -0
  60. package/dist/conversational/turn-detector.d.ts +31 -0
  61. package/dist/conversational/turn-detector.js +44 -0
  62. package/dist/conversational/types.d.ts +55 -0
  63. package/dist/conversational/types.js +1 -0
  64. package/dist/conversational/voice-session-manager.d.ts +17 -0
  65. package/dist/conversational/voice-session-manager.js +138 -0
  66. package/dist/docs/conversational.docblock.d.ts +14 -0
  67. package/dist/docs/conversational.docblock.js +6 -0
  68. package/dist/docs/stt.docblock.d.ts +12 -0
  69. package/dist/docs/stt.docblock.js +6 -0
  70. package/dist/docs/sync.docblock.d.ts +12 -0
  71. package/dist/docs/sync.docblock.js +6 -0
  72. package/dist/docs/tts.docblock.d.ts +12 -0
  73. package/dist/docs/tts.docblock.js +6 -0
  74. package/dist/docs/voice.docblock.d.ts +22 -0
  75. package/dist/docs/voice.docblock.js +6 -0
  76. package/dist/i18n/catalogs/en.d.ts +6 -0
  77. package/dist/i18n/catalogs/en.js +92 -0
  78. package/dist/i18n/catalogs/es.d.ts +4 -0
  79. package/dist/i18n/catalogs/es.js +92 -0
  80. package/dist/i18n/catalogs/fr.d.ts +4 -0
  81. package/dist/i18n/catalogs/fr.js +92 -0
  82. package/dist/i18n/catalogs/index.d.ts +3 -0
  83. package/dist/i18n/catalogs/index.js +272 -0
  84. package/dist/i18n/index.d.ts +20 -0
  85. package/dist/i18n/index.js +336 -0
  86. package/dist/i18n/keys.d.ts +50 -0
  87. package/dist/i18n/keys.js +39 -0
  88. package/dist/i18n/locale.d.ts +6 -0
  89. package/dist/i18n/locale.js +14 -0
  90. package/dist/i18n/messages.d.ts +13 -0
  91. package/dist/i18n/messages.js +284 -0
  92. package/dist/index.d.ts +6 -0
  93. package/dist/index.js +1071 -0
  94. package/dist/node/audio/audio-concatenator.js +56 -0
  95. package/dist/node/audio/duration-estimator.js +21 -0
  96. package/dist/node/audio/format-converter.js +27 -0
  97. package/dist/node/audio/index.js +120 -0
  98. package/dist/node/audio/silence-generator.js +19 -0
  99. package/dist/node/conversational/index.js +241 -0
  100. package/dist/node/conversational/response-orchestrator.js +62 -0
  101. package/dist/node/conversational/transcript-builder.js +63 -0
  102. package/dist/node/conversational/turn-detector.js +43 -0
  103. package/dist/node/conversational/types.js +0 -0
  104. package/dist/node/conversational/voice-session-manager.js +137 -0
  105. package/dist/node/docs/conversational.docblock.js +5 -0
  106. package/dist/node/docs/stt.docblock.js +5 -0
  107. package/dist/node/docs/sync.docblock.js +5 -0
  108. package/dist/node/docs/tts.docblock.js +5 -0
  109. package/dist/node/docs/voice.docblock.js +5 -0
  110. package/dist/node/i18n/catalogs/en.js +91 -0
  111. package/dist/node/i18n/catalogs/es.js +91 -0
  112. package/dist/node/i18n/catalogs/fr.js +91 -0
  113. package/dist/node/i18n/catalogs/index.js +271 -0
  114. package/dist/node/i18n/index.js +335 -0
  115. package/dist/node/i18n/keys.js +38 -0
  116. package/dist/node/i18n/locale.js +13 -0
  117. package/dist/node/i18n/messages.js +283 -0
  118. package/dist/node/index.js +1070 -0
  119. package/dist/node/stt/diarization-mapper.js +42 -0
  120. package/dist/node/stt/index.js +222 -0
  121. package/dist/node/stt/segment-splitter.js +36 -0
  122. package/dist/node/stt/subtitle-formatter.js +51 -0
  123. package/dist/node/stt/transcriber.js +219 -0
  124. package/dist/node/stt/types.js +0 -0
  125. package/dist/node/sync/duration-negotiator.js +69 -0
  126. package/dist/node/sync/index.js +165 -0
  127. package/dist/node/sync/scene-adapter.js +52 -0
  128. package/dist/node/sync/timing-calculator.js +46 -0
  129. package/dist/node/tts/audio-assembler.js +120 -0
  130. package/dist/node/tts/emphasis-planner.js +134 -0
  131. package/dist/node/tts/index.js +439 -0
  132. package/dist/node/tts/pace-analyzer.js +67 -0
  133. package/dist/node/tts/segment-synthesizer.js +36 -0
  134. package/dist/node/tts/types.js +0 -0
  135. package/dist/node/tts/voice-synthesizer.js +435 -0
  136. package/dist/node/types.js +0 -0
  137. package/dist/stt/diarization-mapper.d.ts +19 -0
  138. package/dist/stt/diarization-mapper.js +43 -0
  139. package/dist/stt/index.d.ts +5 -0
  140. package/dist/stt/index.js +223 -0
  141. package/dist/stt/segment-splitter.d.ts +19 -0
  142. package/dist/stt/segment-splitter.js +37 -0
  143. package/dist/stt/subtitle-formatter.d.ts +19 -0
  144. package/dist/stt/subtitle-formatter.js +52 -0
  145. package/dist/stt/transcriber.d.ts +21 -0
  146. package/dist/stt/transcriber.js +220 -0
  147. package/dist/stt/types.d.ts +44 -0
  148. package/dist/stt/types.js +1 -0
  149. package/dist/sync/duration-negotiator.d.ts +37 -0
  150. package/dist/sync/duration-negotiator.js +70 -0
  151. package/dist/sync/index.d.ts +3 -0
  152. package/dist/sync/index.js +166 -0
  153. package/dist/sync/scene-adapter.d.ts +29 -0
  154. package/dist/sync/scene-adapter.js +53 -0
  155. package/dist/sync/timing-calculator.d.ts +21 -0
  156. package/dist/sync/timing-calculator.js +47 -0
  157. package/dist/tts/audio-assembler.d.ts +19 -0
  158. package/dist/tts/audio-assembler.js +121 -0
  159. package/dist/tts/emphasis-planner.d.ts +24 -0
  160. package/dist/tts/emphasis-planner.js +135 -0
  161. package/dist/tts/index.d.ts +6 -0
  162. package/dist/tts/index.js +440 -0
  163. package/dist/tts/pace-analyzer.d.ts +30 -0
  164. package/dist/tts/pace-analyzer.js +68 -0
  165. package/dist/tts/segment-synthesizer.d.ts +21 -0
  166. package/dist/tts/segment-synthesizer.js +37 -0
  167. package/dist/tts/types.d.ts +76 -0
  168. package/dist/tts/types.js +1 -0
  169. package/dist/tts/voice-synthesizer.d.ts +28 -0
  170. package/dist/tts/voice-synthesizer.js +436 -0
  171. package/dist/types.d.ts +12 -0
  172. package/dist/types.js +1 -0
  173. package/package.json +760 -0
@@ -0,0 +1,335 @@
1
+ // src/i18n/catalogs/en.ts
2
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
3
+ var enMessages = defineTranslation({
4
+ meta: {
5
+ key: "voice.messages",
6
+ version: "1.0.0",
7
+ domain: "voice",
8
+ description: "All user-facing, LLM-facing, and developer-facing strings for the voice package",
9
+ owners: ["platform"],
10
+ stability: "experimental"
11
+ },
12
+ locale: "en",
13
+ fallback: "en",
14
+ messages: {
15
+ "prompt.tts.system": {
16
+ value: `You are a voice narration script writer.
17
+ Analyze the content and produce a narration script with pacing directives.
18
+ Return JSON with segments, each having sceneId, text, and contentType.`,
19
+ description: "TTS system prompt for LLM-enhanced script generation"
20
+ },
21
+ "prompt.pace.sceneMatched": {
22
+ value: "Match voice pacing to scene durations. Adjust rate and emphasis per segment to fit the video timeline.",
23
+ description: "Prompt for scene-matched pacing strategy"
24
+ },
25
+ "prompt.emphasis.system": {
26
+ value: "You are a voice director. For each segment, determine the optimal emphasis, tone, and speaking rate.",
27
+ description: "Emphasis planner LLM system prompt"
28
+ },
29
+ "pace.intro.description": {
30
+ value: "Authoritative opening at a measured pace",
31
+ description: "Description for intro pacing"
32
+ },
33
+ "pace.problem.description": {
34
+ value: "Urgent emphasis on the challenge",
35
+ description: "Description for problem pacing"
36
+ },
37
+ "pace.solution.description": {
38
+ value: "Calm, clear delivery of the solution",
39
+ description: "Description for solution pacing"
40
+ },
41
+ "pace.metric.description": {
42
+ value: "Excited emphasis on key results",
43
+ description: "Description for metric pacing"
44
+ },
45
+ "pace.cta.description": {
46
+ value: "Authoritative call to action",
47
+ description: "Description for CTA pacing"
48
+ },
49
+ "pace.transition.description": {
50
+ value: "Quick neutral transition",
51
+ description: "Description for transition pacing"
52
+ },
53
+ "stt.transcribing": {
54
+ value: "Transcribing audio...",
55
+ description: "Status message during transcription"
56
+ },
57
+ "stt.diarization.speaker": {
58
+ value: "Speaker {index}",
59
+ description: "Default speaker label",
60
+ placeholders: [{ name: "index", type: "number" }]
61
+ },
62
+ "stt.subtitle.timestamp": {
63
+ value: "{start} --> {end}",
64
+ description: "Subtitle timestamp format",
65
+ placeholders: [
66
+ { name: "start", type: "string" },
67
+ { name: "end", type: "string" }
68
+ ]
69
+ },
70
+ "conv.session.started": {
71
+ value: "Voice session started",
72
+ description: "Session start notification"
73
+ },
74
+ "conv.turn.user": {
75
+ value: "User is speaking",
76
+ description: "User turn indicator"
77
+ },
78
+ "conv.turn.agent": {
79
+ value: "Agent is responding",
80
+ description: "Agent turn indicator"
81
+ },
82
+ "conv.session.ended": {
83
+ value: "Voice session ended. Duration: {durationMs}ms",
84
+ description: "Session end notification",
85
+ placeholders: [{ name: "durationMs", type: "number" }]
86
+ }
87
+ }
88
+ });
89
+
90
+ // src/i18n/catalogs/es.ts
91
+ import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
92
+ var esMessages = defineTranslation2({
93
+ meta: {
94
+ key: "voice.messages",
95
+ version: "1.0.0",
96
+ domain: "voice",
97
+ description: "Spanish translations for the voice package",
98
+ owners: ["platform"],
99
+ stability: "experimental"
100
+ },
101
+ locale: "es",
102
+ fallback: "en",
103
+ messages: {
104
+ "prompt.tts.system": {
105
+ value: `Eres un escritor de guiones de narracion vocal.
106
+ Analiza el contenido y produce un guion de narracion con directivas de ritmo.
107
+ Devuelve JSON con segmentos, cada uno con sceneId, text y contentType.`,
108
+ description: "Prompt del sistema TTS para generacion de guiones mejorada con LLM"
109
+ },
110
+ "prompt.pace.sceneMatched": {
111
+ value: "Ajusta el ritmo vocal a la duracion de las escenas. Modifica la velocidad y el enfasis por segmento para coincidir con la linea de tiempo del video.",
112
+ description: "Prompt para la estrategia de ritmo sincronizado con escenas"
113
+ },
114
+ "prompt.emphasis.system": {
115
+ value: "Eres un director vocal. Para cada segmento, determina el enfasis, tono y velocidad optimos.",
116
+ description: "Prompt del sistema LLM para el planificador de enfasis"
117
+ },
118
+ "pace.intro.description": {
119
+ value: "Apertura autoritaria a un ritmo medido",
120
+ description: "Descripcion del ritmo de introduccion"
121
+ },
122
+ "pace.problem.description": {
123
+ value: "Enfasis urgente en el desafio",
124
+ description: "Descripcion del ritmo de problema"
125
+ },
126
+ "pace.solution.description": {
127
+ value: "Entrega calmada y clara de la solucion",
128
+ description: "Descripcion del ritmo de solucion"
129
+ },
130
+ "pace.metric.description": {
131
+ value: "Enfasis entusiasta en los resultados clave",
132
+ description: "Descripcion del ritmo de metrica"
133
+ },
134
+ "pace.cta.description": {
135
+ value: "Llamada a la accion autoritaria",
136
+ description: "Descripcion del ritmo CTA"
137
+ },
138
+ "pace.transition.description": {
139
+ value: "Transicion rapida y neutral",
140
+ description: "Descripcion del ritmo de transicion"
141
+ },
142
+ "stt.transcribing": {
143
+ value: "Transcribiendo audio...",
144
+ description: "Mensaje de estado durante la transcripcion"
145
+ },
146
+ "stt.diarization.speaker": {
147
+ value: "Hablante {index}",
148
+ description: "Etiqueta de hablante predeterminada",
149
+ placeholders: [{ name: "index", type: "number" }]
150
+ },
151
+ "stt.subtitle.timestamp": {
152
+ value: "{start} --> {end}",
153
+ description: "Formato de marca de tiempo para subtitulos",
154
+ placeholders: [
155
+ { name: "start", type: "string" },
156
+ { name: "end", type: "string" }
157
+ ]
158
+ },
159
+ "conv.session.started": {
160
+ value: "Sesion de voz iniciada",
161
+ description: "Notificacion de inicio de sesion"
162
+ },
163
+ "conv.turn.user": {
164
+ value: "El usuario esta hablando",
165
+ description: "Indicador de turno del usuario"
166
+ },
167
+ "conv.turn.agent": {
168
+ value: "El agente esta respondiendo",
169
+ description: "Indicador de turno del agente"
170
+ },
171
+ "conv.session.ended": {
172
+ value: "Sesion de voz finalizada. Duracion: {durationMs}ms",
173
+ description: "Notificacion de fin de sesion",
174
+ placeholders: [{ name: "durationMs", type: "number" }]
175
+ }
176
+ }
177
+ });
178
+
179
+ // src/i18n/catalogs/fr.ts
180
+ import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
181
+ var frMessages = defineTranslation3({
182
+ meta: {
183
+ key: "voice.messages",
184
+ version: "1.0.0",
185
+ domain: "voice",
186
+ description: "French translations for the voice package",
187
+ owners: ["platform"],
188
+ stability: "experimental"
189
+ },
190
+ locale: "fr",
191
+ fallback: "en",
192
+ messages: {
193
+ "prompt.tts.system": {
194
+ value: `Vous etes un redacteur de scripts de narration vocale.
195
+ Analysez le contenu et produisez un script de narration avec des directives de rythme.
196
+ Retournez du JSON avec des segments, chacun ayant sceneId, text et contentType.`,
197
+ description: "Prompt systeme TTS pour la generation de scripts amelioree par LLM"
198
+ },
199
+ "prompt.pace.sceneMatched": {
200
+ value: "Adaptez le rythme vocal aux durees des scenes. Ajustez le debit et l'emphase par segment pour correspondre a la timeline video.",
201
+ description: "Prompt pour la strategie de rythme alignee sur les scenes"
202
+ },
203
+ "prompt.emphasis.system": {
204
+ value: "Vous etes un directeur vocal. Pour chaque segment, determinez l'emphase, le ton et le debit optimaux.",
205
+ description: "Prompt systeme LLM pour le planificateur d'emphase"
206
+ },
207
+ "pace.intro.description": {
208
+ value: "Ouverture autoritaire a un rythme mesure",
209
+ description: "Description du rythme d'introduction"
210
+ },
211
+ "pace.problem.description": {
212
+ value: "Emphase urgente sur le defi",
213
+ description: "Description du rythme de probleme"
214
+ },
215
+ "pace.solution.description": {
216
+ value: "Livraison calme et claire de la solution",
217
+ description: "Description du rythme de solution"
218
+ },
219
+ "pace.metric.description": {
220
+ value: "Emphase enthousiaste sur les resultats cles",
221
+ description: "Description du rythme de metrique"
222
+ },
223
+ "pace.cta.description": {
224
+ value: "Appel a l'action autoritaire",
225
+ description: "Description du rythme CTA"
226
+ },
227
+ "pace.transition.description": {
228
+ value: "Transition rapide et neutre",
229
+ description: "Description du rythme de transition"
230
+ },
231
+ "stt.transcribing": {
232
+ value: "Transcription en cours...",
233
+ description: "Message de statut pendant la transcription"
234
+ },
235
+ "stt.diarization.speaker": {
236
+ value: "Locuteur {index}",
237
+ description: "Label de locuteur par defaut",
238
+ placeholders: [{ name: "index", type: "number" }]
239
+ },
240
+ "stt.subtitle.timestamp": {
241
+ value: "{start} --> {end}",
242
+ description: "Format de timestamp pour les sous-titres",
243
+ placeholders: [
244
+ { name: "start", type: "string" },
245
+ { name: "end", type: "string" }
246
+ ]
247
+ },
248
+ "conv.session.started": {
249
+ value: "Session vocale demarree",
250
+ description: "Notification de debut de session"
251
+ },
252
+ "conv.turn.user": {
253
+ value: "L'utilisateur parle",
254
+ description: "Indicateur de tour de l'utilisateur"
255
+ },
256
+ "conv.turn.agent": {
257
+ value: "L'agent repond",
258
+ description: "Indicateur de tour de l'agent"
259
+ },
260
+ "conv.session.ended": {
261
+ value: "Session vocale terminee. Duree : {durationMs}ms",
262
+ description: "Notification de fin de session",
263
+ placeholders: [{ name: "durationMs", type: "number" }]
264
+ }
265
+ }
266
+ });
267
+
268
+ // src/i18n/messages.ts
269
+ import {
270
+ createI18nFactory
271
+ } from "@contractspec/lib.contracts-spec/translations";
272
+ var factory = createI18nFactory({
273
+ specKey: "voice.messages",
274
+ catalogs: [enMessages, frMessages, esMessages]
275
+ });
276
+ var createVoiceI18n = factory.create;
277
+ var getDefaultI18n = factory.getDefault;
278
+ var resetI18nRegistry = factory.resetRegistry;
279
+
280
+ // src/i18n/locale.ts
281
+ import {
282
+ DEFAULT_LOCALE,
283
+ SUPPORTED_LOCALES,
284
+ resolveLocale,
285
+ isSupportedLocale
286
+ } from "@contractspec/lib.contracts-spec/translations";
287
+
288
+ // src/i18n/keys.ts
289
+ var TTS_PROMPT_KEYS = {
290
+ "prompt.tts.system": "prompt.tts.system",
291
+ "prompt.pace.sceneMatched": "prompt.pace.sceneMatched",
292
+ "prompt.emphasis.system": "prompt.emphasis.system"
293
+ };
294
+ var TTS_PACE_KEYS = {
295
+ "pace.intro.description": "pace.intro.description",
296
+ "pace.problem.description": "pace.problem.description",
297
+ "pace.solution.description": "pace.solution.description",
298
+ "pace.metric.description": "pace.metric.description",
299
+ "pace.cta.description": "pace.cta.description",
300
+ "pace.transition.description": "pace.transition.description"
301
+ };
302
+ var STT_KEYS = {
303
+ "stt.transcribing": "stt.transcribing",
304
+ "stt.diarization.speaker": "stt.diarization.speaker",
305
+ "stt.subtitle.timestamp": "stt.subtitle.timestamp"
306
+ };
307
+ var CONVERSATIONAL_KEYS = {
308
+ "conv.session.started": "conv.session.started",
309
+ "conv.turn.user": "conv.turn.user",
310
+ "conv.turn.agent": "conv.turn.agent",
311
+ "conv.session.ended": "conv.session.ended"
312
+ };
313
+ var I18N_KEYS = {
314
+ ...TTS_PROMPT_KEYS,
315
+ ...TTS_PACE_KEYS,
316
+ ...STT_KEYS,
317
+ ...CONVERSATIONAL_KEYS
318
+ };
319
+ export {
320
+ resolveLocale,
321
+ resetI18nRegistry,
322
+ isSupportedLocale,
323
+ getDefaultI18n,
324
+ frMessages,
325
+ esMessages,
326
+ enMessages,
327
+ createVoiceI18n,
328
+ TTS_PROMPT_KEYS,
329
+ TTS_PACE_KEYS,
330
+ SUPPORTED_LOCALES,
331
+ STT_KEYS,
332
+ I18N_KEYS,
333
+ DEFAULT_LOCALE,
334
+ CONVERSATIONAL_KEYS
335
+ };
@@ -0,0 +1,38 @@
1
+ // src/i18n/keys.ts
2
+ var TTS_PROMPT_KEYS = {
3
+ "prompt.tts.system": "prompt.tts.system",
4
+ "prompt.pace.sceneMatched": "prompt.pace.sceneMatched",
5
+ "prompt.emphasis.system": "prompt.emphasis.system"
6
+ };
7
+ var TTS_PACE_KEYS = {
8
+ "pace.intro.description": "pace.intro.description",
9
+ "pace.problem.description": "pace.problem.description",
10
+ "pace.solution.description": "pace.solution.description",
11
+ "pace.metric.description": "pace.metric.description",
12
+ "pace.cta.description": "pace.cta.description",
13
+ "pace.transition.description": "pace.transition.description"
14
+ };
15
+ var STT_KEYS = {
16
+ "stt.transcribing": "stt.transcribing",
17
+ "stt.diarization.speaker": "stt.diarization.speaker",
18
+ "stt.subtitle.timestamp": "stt.subtitle.timestamp"
19
+ };
20
+ var CONVERSATIONAL_KEYS = {
21
+ "conv.session.started": "conv.session.started",
22
+ "conv.turn.user": "conv.turn.user",
23
+ "conv.turn.agent": "conv.turn.agent",
24
+ "conv.session.ended": "conv.session.ended"
25
+ };
26
+ var I18N_KEYS = {
27
+ ...TTS_PROMPT_KEYS,
28
+ ...TTS_PACE_KEYS,
29
+ ...STT_KEYS,
30
+ ...CONVERSATIONAL_KEYS
31
+ };
32
+ export {
33
+ TTS_PROMPT_KEYS,
34
+ TTS_PACE_KEYS,
35
+ STT_KEYS,
36
+ I18N_KEYS,
37
+ CONVERSATIONAL_KEYS
38
+ };
@@ -0,0 +1,13 @@
1
+ // src/i18n/locale.ts
2
+ import {
3
+ DEFAULT_LOCALE,
4
+ SUPPORTED_LOCALES,
5
+ resolveLocale,
6
+ isSupportedLocale
7
+ } from "@contractspec/lib.contracts-spec/translations";
8
+ export {
9
+ resolveLocale,
10
+ isSupportedLocale,
11
+ SUPPORTED_LOCALES,
12
+ DEFAULT_LOCALE
13
+ };
@@ -0,0 +1,283 @@
1
+ // src/i18n/catalogs/en.ts
2
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
3
+ var enMessages = defineTranslation({
4
+ meta: {
5
+ key: "voice.messages",
6
+ version: "1.0.0",
7
+ domain: "voice",
8
+ description: "All user-facing, LLM-facing, and developer-facing strings for the voice package",
9
+ owners: ["platform"],
10
+ stability: "experimental"
11
+ },
12
+ locale: "en",
13
+ fallback: "en",
14
+ messages: {
15
+ "prompt.tts.system": {
16
+ value: `You are a voice narration script writer.
17
+ Analyze the content and produce a narration script with pacing directives.
18
+ Return JSON with segments, each having sceneId, text, and contentType.`,
19
+ description: "TTS system prompt for LLM-enhanced script generation"
20
+ },
21
+ "prompt.pace.sceneMatched": {
22
+ value: "Match voice pacing to scene durations. Adjust rate and emphasis per segment to fit the video timeline.",
23
+ description: "Prompt for scene-matched pacing strategy"
24
+ },
25
+ "prompt.emphasis.system": {
26
+ value: "You are a voice director. For each segment, determine the optimal emphasis, tone, and speaking rate.",
27
+ description: "Emphasis planner LLM system prompt"
28
+ },
29
+ "pace.intro.description": {
30
+ value: "Authoritative opening at a measured pace",
31
+ description: "Description for intro pacing"
32
+ },
33
+ "pace.problem.description": {
34
+ value: "Urgent emphasis on the challenge",
35
+ description: "Description for problem pacing"
36
+ },
37
+ "pace.solution.description": {
38
+ value: "Calm, clear delivery of the solution",
39
+ description: "Description for solution pacing"
40
+ },
41
+ "pace.metric.description": {
42
+ value: "Excited emphasis on key results",
43
+ description: "Description for metric pacing"
44
+ },
45
+ "pace.cta.description": {
46
+ value: "Authoritative call to action",
47
+ description: "Description for CTA pacing"
48
+ },
49
+ "pace.transition.description": {
50
+ value: "Quick neutral transition",
51
+ description: "Description for transition pacing"
52
+ },
53
+ "stt.transcribing": {
54
+ value: "Transcribing audio...",
55
+ description: "Status message during transcription"
56
+ },
57
+ "stt.diarization.speaker": {
58
+ value: "Speaker {index}",
59
+ description: "Default speaker label",
60
+ placeholders: [{ name: "index", type: "number" }]
61
+ },
62
+ "stt.subtitle.timestamp": {
63
+ value: "{start} --> {end}",
64
+ description: "Subtitle timestamp format",
65
+ placeholders: [
66
+ { name: "start", type: "string" },
67
+ { name: "end", type: "string" }
68
+ ]
69
+ },
70
+ "conv.session.started": {
71
+ value: "Voice session started",
72
+ description: "Session start notification"
73
+ },
74
+ "conv.turn.user": {
75
+ value: "User is speaking",
76
+ description: "User turn indicator"
77
+ },
78
+ "conv.turn.agent": {
79
+ value: "Agent is responding",
80
+ description: "Agent turn indicator"
81
+ },
82
+ "conv.session.ended": {
83
+ value: "Voice session ended. Duration: {durationMs}ms",
84
+ description: "Session end notification",
85
+ placeholders: [{ name: "durationMs", type: "number" }]
86
+ }
87
+ }
88
+ });
89
+
90
+ // src/i18n/catalogs/es.ts
91
+ import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
92
+ var esMessages = defineTranslation2({
93
+ meta: {
94
+ key: "voice.messages",
95
+ version: "1.0.0",
96
+ domain: "voice",
97
+ description: "Spanish translations for the voice package",
98
+ owners: ["platform"],
99
+ stability: "experimental"
100
+ },
101
+ locale: "es",
102
+ fallback: "en",
103
+ messages: {
104
+ "prompt.tts.system": {
105
+ value: `Eres un escritor de guiones de narracion vocal.
106
+ Analiza el contenido y produce un guion de narracion con directivas de ritmo.
107
+ Devuelve JSON con segmentos, cada uno con sceneId, text y contentType.`,
108
+ description: "Prompt del sistema TTS para generacion de guiones mejorada con LLM"
109
+ },
110
+ "prompt.pace.sceneMatched": {
111
+ value: "Ajusta el ritmo vocal a la duracion de las escenas. Modifica la velocidad y el enfasis por segmento para coincidir con la linea de tiempo del video.",
112
+ description: "Prompt para la estrategia de ritmo sincronizado con escenas"
113
+ },
114
+ "prompt.emphasis.system": {
115
+ value: "Eres un director vocal. Para cada segmento, determina el enfasis, tono y velocidad optimos.",
116
+ description: "Prompt del sistema LLM para el planificador de enfasis"
117
+ },
118
+ "pace.intro.description": {
119
+ value: "Apertura autoritaria a un ritmo medido",
120
+ description: "Descripcion del ritmo de introduccion"
121
+ },
122
+ "pace.problem.description": {
123
+ value: "Enfasis urgente en el desafio",
124
+ description: "Descripcion del ritmo de problema"
125
+ },
126
+ "pace.solution.description": {
127
+ value: "Entrega calmada y clara de la solucion",
128
+ description: "Descripcion del ritmo de solucion"
129
+ },
130
+ "pace.metric.description": {
131
+ value: "Enfasis entusiasta en los resultados clave",
132
+ description: "Descripcion del ritmo de metrica"
133
+ },
134
+ "pace.cta.description": {
135
+ value: "Llamada a la accion autoritaria",
136
+ description: "Descripcion del ritmo CTA"
137
+ },
138
+ "pace.transition.description": {
139
+ value: "Transicion rapida y neutral",
140
+ description: "Descripcion del ritmo de transicion"
141
+ },
142
+ "stt.transcribing": {
143
+ value: "Transcribiendo audio...",
144
+ description: "Mensaje de estado durante la transcripcion"
145
+ },
146
+ "stt.diarization.speaker": {
147
+ value: "Hablante {index}",
148
+ description: "Etiqueta de hablante predeterminada",
149
+ placeholders: [{ name: "index", type: "number" }]
150
+ },
151
+ "stt.subtitle.timestamp": {
152
+ value: "{start} --> {end}",
153
+ description: "Formato de marca de tiempo para subtitulos",
154
+ placeholders: [
155
+ { name: "start", type: "string" },
156
+ { name: "end", type: "string" }
157
+ ]
158
+ },
159
+ "conv.session.started": {
160
+ value: "Sesion de voz iniciada",
161
+ description: "Notificacion de inicio de sesion"
162
+ },
163
+ "conv.turn.user": {
164
+ value: "El usuario esta hablando",
165
+ description: "Indicador de turno del usuario"
166
+ },
167
+ "conv.turn.agent": {
168
+ value: "El agente esta respondiendo",
169
+ description: "Indicador de turno del agente"
170
+ },
171
+ "conv.session.ended": {
172
+ value: "Sesion de voz finalizada. Duracion: {durationMs}ms",
173
+ description: "Notificacion de fin de sesion",
174
+ placeholders: [{ name: "durationMs", type: "number" }]
175
+ }
176
+ }
177
+ });
178
+
179
+ // src/i18n/catalogs/fr.ts
180
+ import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
181
+ var frMessages = defineTranslation3({
182
+ meta: {
183
+ key: "voice.messages",
184
+ version: "1.0.0",
185
+ domain: "voice",
186
+ description: "French translations for the voice package",
187
+ owners: ["platform"],
188
+ stability: "experimental"
189
+ },
190
+ locale: "fr",
191
+ fallback: "en",
192
+ messages: {
193
+ "prompt.tts.system": {
194
+ value: `Vous etes un redacteur de scripts de narration vocale.
195
+ Analysez le contenu et produisez un script de narration avec des directives de rythme.
196
+ Retournez du JSON avec des segments, chacun ayant sceneId, text et contentType.`,
197
+ description: "Prompt systeme TTS pour la generation de scripts amelioree par LLM"
198
+ },
199
+ "prompt.pace.sceneMatched": {
200
+ value: "Adaptez le rythme vocal aux durees des scenes. Ajustez le debit et l'emphase par segment pour correspondre a la timeline video.",
201
+ description: "Prompt pour la strategie de rythme alignee sur les scenes"
202
+ },
203
+ "prompt.emphasis.system": {
204
+ value: "Vous etes un directeur vocal. Pour chaque segment, determinez l'emphase, le ton et le debit optimaux.",
205
+ description: "Prompt systeme LLM pour le planificateur d'emphase"
206
+ },
207
+ "pace.intro.description": {
208
+ value: "Ouverture autoritaire a un rythme mesure",
209
+ description: "Description du rythme d'introduction"
210
+ },
211
+ "pace.problem.description": {
212
+ value: "Emphase urgente sur le defi",
213
+ description: "Description du rythme de probleme"
214
+ },
215
+ "pace.solution.description": {
216
+ value: "Livraison calme et claire de la solution",
217
+ description: "Description du rythme de solution"
218
+ },
219
+ "pace.metric.description": {
220
+ value: "Emphase enthousiaste sur les resultats cles",
221
+ description: "Description du rythme de metrique"
222
+ },
223
+ "pace.cta.description": {
224
+ value: "Appel a l'action autoritaire",
225
+ description: "Description du rythme CTA"
226
+ },
227
+ "pace.transition.description": {
228
+ value: "Transition rapide et neutre",
229
+ description: "Description du rythme de transition"
230
+ },
231
+ "stt.transcribing": {
232
+ value: "Transcription en cours...",
233
+ description: "Message de statut pendant la transcription"
234
+ },
235
+ "stt.diarization.speaker": {
236
+ value: "Locuteur {index}",
237
+ description: "Label de locuteur par defaut",
238
+ placeholders: [{ name: "index", type: "number" }]
239
+ },
240
+ "stt.subtitle.timestamp": {
241
+ value: "{start} --> {end}",
242
+ description: "Format de timestamp pour les sous-titres",
243
+ placeholders: [
244
+ { name: "start", type: "string" },
245
+ { name: "end", type: "string" }
246
+ ]
247
+ },
248
+ "conv.session.started": {
249
+ value: "Session vocale demarree",
250
+ description: "Notification de debut de session"
251
+ },
252
+ "conv.turn.user": {
253
+ value: "L'utilisateur parle",
254
+ description: "Indicateur de tour de l'utilisateur"
255
+ },
256
+ "conv.turn.agent": {
257
+ value: "L'agent repond",
258
+ description: "Indicateur de tour de l'agent"
259
+ },
260
+ "conv.session.ended": {
261
+ value: "Session vocale terminee. Duree : {durationMs}ms",
262
+ description: "Notification de fin de session",
263
+ placeholders: [{ name: "durationMs", type: "number" }]
264
+ }
265
+ }
266
+ });
267
+
268
+ // src/i18n/messages.ts
269
+ import {
270
+ createI18nFactory
271
+ } from "@contractspec/lib.contracts-spec/translations";
272
+ var factory = createI18nFactory({
273
+ specKey: "voice.messages",
274
+ catalogs: [enMessages, frMessages, esMessages]
275
+ });
276
+ var createVoiceI18n = factory.create;
277
+ var getDefaultI18n = factory.getDefault;
278
+ var resetI18nRegistry = factory.resetRegistry;
279
+ export {
280
+ resetI18nRegistry,
281
+ getDefaultI18n,
282
+ createVoiceI18n
283
+ };