vidspotai-shared 1.0.122 → 1.0.123

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.
@@ -485,7 +485,7 @@ export declare const ScriptSchema: z.ZodObject<{
485
485
  fullText: z.ZodString;
486
486
  wordCount: z.ZodOptional<z.ZodNumber>;
487
487
  estimatedDurationMs: z.ZodOptional<z.ZodNumber>;
488
- wpm: z.ZodOptional<z.ZodNumber>;
488
+ wpm: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNumber>>;
489
489
  }, z.core.$strip>;
490
490
  export type Script = z.infer<typeof ScriptSchema>;
491
491
  export declare const VideoPlanSchema: z.ZodObject<{
@@ -680,7 +680,7 @@ export declare const VideoPlanSchema: z.ZodObject<{
680
680
  fullText: z.ZodString;
681
681
  wordCount: z.ZodOptional<z.ZodNumber>;
682
682
  estimatedDurationMs: z.ZodOptional<z.ZodNumber>;
683
- wpm: z.ZodOptional<z.ZodNumber>;
683
+ wpm: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNumber>>;
684
684
  }, z.core.$strip>>>;
685
685
  music: z.ZodOptional<z.ZodObject<{
686
686
  strategy: z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"videoPlan.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/videoPlan.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB;;;;;iBAc5B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;iBASjC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;EASnC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;EAS/B,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc;;;;;;;;EAQ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M,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgM1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -451,8 +451,21 @@ exports.ScriptSchema = zod_1.z.object({
451
451
  wordCount: zod_1.z.number().int().nonnegative().optional(),
452
452
  /** Estimated spoken duration in ms at `wpm`. */
453
453
  estimatedDurationMs: zod_1.z.number().nonnegative().optional(),
454
- /** Words-per-minute used for the estimate (typical narration ≈ 150). */
455
- wpm: zod_1.z.number().int().positive().optional(),
454
+ /**
455
+ * Words-per-minute used for the estimate (typical narration ≈ 150).
456
+ *
457
+ * Coercion: the scene-first planner prompt (S1/S2/M1) never mentions this
458
+ * field, yet the LLM occasionally emits a `script` object on a scene-first
459
+ * plan anyway and invents a `wpm` value from nothing — observed in prod as
460
+ * `0`, which fails `positive()` and burns all 3 retries with the same
461
+ * generic duration-shaped correction text, killing the whole project
462
+ * (2026-09-28 incident). Every consumer already falls back with
463
+ * `?? TTS_DEFAULT_WPM` when `wpm` is absent (generateScript/chapterOutline/
464
+ * matchBrollToScript tools), so a non-positive value is strictly worse than
465
+ * no value — drop it at the schema boundary instead of hard-failing.
466
+ */
467
+ wpm: zod_1.z
468
+ .preprocess((v) => (typeof v === "number" && v <= 0 ? undefined : v), zod_1.z.number().int().positive().optional()),
456
469
  });
457
470
  exports.VideoPlanSchema = zod_1.z.object({
458
471
  briefId: zod_1.z.string().optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"plannerMessages.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/plannerMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAehF;;;;;GAKG;AAEH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,WAAW,EAAE,iBAAiB,GAAG,IAAI,EACrC,KAAK,EAAE,gBAAgB,GAAG,IAAI,EAC9B,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,UAAQ;;;;;;KAsJxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAiChE"}
1
+ {"version":3,"file":"plannerMessages.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/plannerMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAehF;;;;;GAKG;AAEH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,WAAW,EAAE,iBAAiB,GAAG,IAAI,EACrC,KAAK,EAAE,gBAAgB,GAAG,IAAI,EAC9B,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,UAAQ;;;;;;KA0JxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAiChE"}
@@ -63,6 +63,10 @@ function buildPlannerMessages(brief, persona, brandKit, styleMemory, bible, last
63
63
  "You are a video-production planner.",
64
64
  "Given a VideoBrief, produce a VideoPlan: an ordered list of scenes",
65
65
  "with per-scene asset strategy, tier, prompt, duration, and voiceover.",
66
+ "Do NOT set the top-level `script` field — it is only used by long-form",
67
+ "script-first authoring and is populated by a separate pipeline step, not",
68
+ "by you. Leave it out entirely; per-scene voiceoverLine is where narration",
69
+ "goes for this plan.",
66
70
  researchSection,
67
71
  "",
68
72
  "Tier rules — respect brief.tierBudget as the maximum tier:",
@@ -167,7 +167,7 @@ declare const OutputSchema: z.ZodObject<{
167
167
  fullText: z.ZodString;
168
168
  wordCount: z.ZodOptional<z.ZodNumber>;
169
169
  estimatedDurationMs: z.ZodOptional<z.ZodNumber>;
170
- wpm: z.ZodOptional<z.ZodNumber>;
170
+ wpm: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNumber>>;
171
171
  }, z.core.$strip>;
172
172
  suggestedTitle: z.ZodOptional<z.ZodString>;
173
173
  }, z.core.$strip>;
@@ -337,7 +337,7 @@ declare const OutputSchema: z.ZodObject<{
337
337
  fullText: z.ZodString;
338
338
  wordCount: z.ZodOptional<z.ZodNumber>;
339
339
  estimatedDurationMs: z.ZodOptional<z.ZodNumber>;
340
- wpm: z.ZodOptional<z.ZodNumber>;
340
+ wpm: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNumber>>;
341
341
  }, z.core.$strip>>>;
342
342
  music: z.ZodOptional<z.ZodObject<{
343
343
  strategy: z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"translation.service.d.ts","sourceRoot":"","sources":["../../../src/services/translation/translation.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAwIvD;;;;GAIG;AACH,iBAAe,SAAS,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,EAAE,GAAE,cAAkC,EACtC,OAAO,GAAE,IAAI,GAAG,IAAW,GAC1B,OAAO,CAAC,MAAM,CAAC,CAsCjB;AAuDD;;;;;;;;;;;;;;GAcG;AACH,iBAAe,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8ChE;AAOD,eAAO,MAAM,kBAAkB;;;CAG9B,CAAC;AAGF,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,kBAAY,CAAC;AAC/C,0DAA0D;AAC1D,eAAO,MAAM,UAAU,uBAAiB,CAAC"}
1
+ {"version":3,"file":"translation.service.d.ts","sourceRoot":"","sources":["../../../src/services/translation/translation.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAmJvD;;;;GAIG;AACH,iBAAe,SAAS,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,EAAE,GAAE,cAAkC,EACtC,OAAO,GAAE,IAAI,GAAG,IAAW,GAC1B,OAAO,CAAC,MAAM,CAAC,CAsCjB;AAqDD;;;;;;;;;;;;;;GAcG;AACH,iBAAe,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8ChE;AAOD,eAAO,MAAM,kBAAkB;;;CAG9B,CAAC;AAGF,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,kBAAY,CAAC;AAC/C,0DAA0D;AAC1D,eAAO,MAAM,UAAU,uBAAiB,CAAC"}
@@ -130,12 +130,21 @@ async function withTimeout(promise, ms, label) {
130
130
  clearTimeout(timer);
131
131
  }
132
132
  }
133
- /** One un-retried LLM translate attempt. Lazy-imports the provider factory so
134
- * this module stays light (utils/helpers re-exports it) and to avoid an
135
- * import cycle with the aiGen layer. */
136
- async function callLlmTranslateOnce(text, from, to) {
133
+ /** Lazy-loads the provider factory so this module stays light (utils/helpers
134
+ * re-exports it) and to avoid an import cycle with the aiGen layer.
135
+ *
136
+ * 2026-09-28: the retry loops await this BEFORE starting the per-attempt
137
+ * timer. The import pulls in the whole provider graph, and on a cold or busy
138
+ * api instance (concurrency 80) that alone could burn most of an 8s attempt —
139
+ * prod logged both attempts "timed out after 8000ms" (kk→en) while OpenAI
140
+ * itself answers the same prompt in ~2-4s. */
141
+ async function loadFallbackService() {
137
142
  const { getAiGenProviderService } = await Promise.resolve().then(() => __importStar(require("../aiGen/aiGenFactory.service")));
138
- const service = getAiGenProviderService(FALLBACK_MODEL);
143
+ return getAiGenProviderService(FALLBACK_MODEL);
144
+ }
145
+ /** One un-retried LLM translate attempt. */
146
+ async function callLlmTranslateOnce(text, from, to) {
147
+ const service = await loadFallbackService();
139
148
  const target = languageLabel(to);
140
149
  const system = `You are a professional translation engine. Translate the user's text into ${target}. ` +
141
150
  `Preserve meaning, tone, names, numbers, hashtags, emojis and line breaks. ` +
@@ -158,6 +167,7 @@ async function callLlmTranslateOnce(text, from, to) {
158
167
  /** FALLBACK: translate via a cheap LLM, with a real retry — see the
159
168
  * FALLBACK_ATTEMPT_TIMEOUT_MS comment above for why one shot wasn't enough. */
160
169
  async function callLlmTranslate(text, from, to) {
170
+ await loadFallbackService(); // outside the timer — see loadFallbackService
161
171
  let lastErr;
162
172
  for (let attempt = 1; attempt <= FALLBACK_MAX_ATTEMPTS; attempt++) {
163
173
  try {
@@ -216,8 +226,7 @@ async function translate(text, from, to = types_1.ELANGUAGE_CODE.en, version = "
216
226
  }
217
227
  /** One un-retried LLM detect attempt. */
218
228
  async function callLlmDetectOnce(text) {
219
- const { getAiGenProviderService } = await Promise.resolve().then(() => __importStar(require("../aiGen/aiGenFactory.service")));
220
- const service = getAiGenProviderService(FALLBACK_MODEL);
229
+ const service = await loadFallbackService();
221
230
  const system = "You are a language identification engine. Reply with ONLY the ISO 639-1 " +
222
231
  "code of the language the user's text is written in — two lowercase " +
223
232
  'letters, nothing else (e.g. "es", "ja", "ar"). Use "zh-cn" or "zh-tw" ' +
@@ -248,6 +257,7 @@ async function callLlmDetectOnce(text) {
248
257
  * "default to en" path below — hence the same per-attempt bound as translate.
249
258
  */
250
259
  async function callLlmDetect(text) {
260
+ await loadFallbackService(); // outside the timer — see loadFallbackService
251
261
  let lastErr;
252
262
  for (let attempt = 1; attempt <= FALLBACK_MAX_ATTEMPTS; attempt++) {
253
263
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidspotai-shared",
3
- "version": "1.0.122",
3
+ "version": "1.0.123",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "exports": {