mulmocast 1.1.6 → 1.1.7

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.
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { htmlLLMProvider, provider2TTSAgent, provider2ImageAgent, provider2MovieAgent, defaultProviders, provider2SoundEffectAgent, } from "../utils/provider2agent.js";
3
+ import { currentMulmoScriptVersion } from "../utils/const.js";
3
4
  export const langSchema = z.string();
4
5
  const URLStringSchema = z.string().url();
5
6
  export const localizedTextSchema = z
@@ -8,7 +9,8 @@ export const localizedTextSchema = z
8
9
  lang: langSchema,
9
10
  // caption: z.string(),
10
11
  texts: z.array(z.string()).optional(),
11
- ttsTexts: z.array(z.string()).optional(),
12
+ ttsTexts: z.array(z.string()).optional(), // TODO remove
13
+ cacheKey: z.string(),
12
14
  duration: z.number().optional(), // generated // video duration time(ms)
13
15
  // filename: z.string().optional(), // generated //
14
16
  })
@@ -283,7 +285,7 @@ export const mulmoCanvasDimensionSchema = z
283
285
  // export const voiceMapSchema = z.record(speakerIdSchema, z.string())
284
286
  export const mulmoCastCreditSchema = z
285
287
  .object({
286
- version: z.literal("1.1"),
288
+ version: z.literal(currentMulmoScriptVersion),
287
289
  credit: z.literal("closing").optional(),
288
290
  })
289
291
  .strict();
@@ -398,8 +400,13 @@ export const mulmoStudioBeatSchema = z
398
400
  .strict();
399
401
  export const mulmoStudioMultiLingualDataSchema = z.object({
400
402
  multiLingualTexts: multiLingualTextsSchema,
403
+ cacheKey: z.string().optional(),
401
404
  });
402
405
  export const mulmoStudioMultiLingualSchema = z.array(mulmoStudioMultiLingualDataSchema).min(1);
406
+ export const mulmoStudioMultiLingualFileSchema = z.object({
407
+ version: z.literal(currentMulmoScriptVersion),
408
+ multiLingual: mulmoStudioMultiLingualSchema,
409
+ });
403
410
  export const mulmoSessionStateSchema = z.object({
404
411
  inSession: z.object({
405
412
  audio: z.boolean(),
@@ -1,4 +1,4 @@
1
- import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualDataSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoImageParamsImagesSchema, mulmoFillOptionSchema, mulmoMovieParamsSchema, textSlideParamsSchema, speechOptionsSchema, speakerDataSchema, mulmoCanvasDimensionSchema, mulmoPromptTemplateSchema, mulmoPromptTemplateFileSchema, text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoImageAssetSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mulmoSessionStateSchema, mulmoOpenAIImageModelSchema, mulmoGoogleImageModelSchema, mulmoGoogleMovieModelSchema, mulmoReplicateMovieModelSchema, mulmoImagePromptMediaSchema } from "./schema.js";
1
+ import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualDataSchema, mulmoStudioMultiLingualFileSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoImageParamsImagesSchema, mulmoFillOptionSchema, mulmoMovieParamsSchema, textSlideParamsSchema, speechOptionsSchema, speakerDataSchema, mulmoCanvasDimensionSchema, mulmoPromptTemplateSchema, mulmoPromptTemplateFileSchema, text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoImageAssetSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mulmoSessionStateSchema, mulmoOpenAIImageModelSchema, mulmoGoogleImageModelSchema, mulmoGoogleMovieModelSchema, mulmoReplicateMovieModelSchema, mulmoImagePromptMediaSchema } from "./schema.js";
2
2
  import { pdf_modes, pdf_sizes, storyToScriptGenerateMode } from "../utils/const.js";
3
3
  import type { LLM } from "../utils/provider2agent.js";
4
4
  import { z } from "zod";
@@ -28,6 +28,7 @@ export type MulmoPromptTemplate = z.infer<typeof mulmoPromptTemplateSchema>;
28
28
  export type MulmoPromptTemplateFile = z.infer<typeof mulmoPromptTemplateFileSchema>;
29
29
  export type MulmoStudioMultiLingual = z.infer<typeof mulmoStudioMultiLingualSchema>;
30
30
  export type MulmoStudioMultiLingualData = z.infer<typeof mulmoStudioMultiLingualDataSchema>;
31
+ export type MulmoStudioMultiLingualFile = z.infer<typeof mulmoStudioMultiLingualFileSchema>;
31
32
  export type MultiLingualTexts = z.infer<typeof multiLingualTextsSchema>;
32
33
  export type MulmoMovieParams = z.infer<typeof mulmoMovieParamsSchema>;
33
34
  export type MulmoOpenAIImageModel = z.infer<typeof mulmoOpenAIImageModelSchema>;
@@ -1,3 +1,4 @@
1
+ export declare const currentMulmoScriptVersion = "1.1";
1
2
  export declare const outDirName = "output";
2
3
  export declare const audioDirName = "audio";
3
4
  export declare const imageDirName = "images";
@@ -1,3 +1,4 @@
1
+ export const currentMulmoScriptVersion = "1.1";
1
2
  export const outDirName = "output";
2
3
  export const audioDirName = "audio";
3
4
  export const imageDirName = "images";
@@ -1,5 +1,4 @@
1
- import type { MulmoScript, MulmoPresentationStyle, MulmoStudioMultiLingual } from "../types/type.js";
2
- import { FileObject } from "../types/index.js";
1
+ import type { MulmoScript, MulmoPresentationStyle, MulmoStudioMultiLingual, FileObject } from "../types/type.js";
3
2
  export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: string, videoCaptionLang?: string, presentationStyle?: MulmoPresentationStyle | null) => {
4
3
  beats: {
5
4
  duration?: number | undefined;
@@ -20,10 +19,6 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
20
19
  lang: string;
21
20
  imageParams: {
22
21
  provider: string;
23
- model?: string | undefined;
24
- style?: string | undefined;
25
- quality?: string | undefined;
26
- moderation?: string | undefined;
27
22
  images?: Record<string, {
28
23
  type: "image";
29
24
  source: {
@@ -43,6 +38,10 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
43
38
  type: "imagePrompt";
44
39
  prompt: string;
45
40
  }> | undefined;
41
+ model?: string | undefined;
42
+ style?: string | undefined;
43
+ quality?: string | undefined;
44
+ moderation?: string | undefined;
46
45
  };
47
46
  audioParams: {
48
47
  padding: number;
@@ -182,12 +181,12 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
182
181
  kind: "path";
183
182
  };
184
183
  } | {
185
- type: "textSlide";
186
184
  slide: {
187
185
  title: string;
188
186
  subtitle?: string | undefined;
189
187
  bullets?: string[] | undefined;
190
188
  };
189
+ type: "textSlide";
191
190
  } | {
192
191
  type: "chart";
193
192
  title: string;
@@ -249,10 +248,6 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
249
248
  description?: string | undefined;
250
249
  imageParams?: {
251
250
  provider: string;
252
- model?: string | undefined;
253
- style?: string | undefined;
254
- quality?: string | undefined;
255
- moderation?: string | undefined;
256
251
  images?: Record<string, {
257
252
  type: "image";
258
253
  source: {
@@ -272,6 +267,10 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
272
267
  type: "imagePrompt";
273
268
  prompt: string;
274
269
  }> | undefined;
270
+ model?: string | undefined;
271
+ style?: string | undefined;
272
+ quality?: string | undefined;
273
+ moderation?: string | undefined;
275
274
  } | undefined;
276
275
  audioParams?: {
277
276
  movieVolume: number;
@@ -308,8 +307,8 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
308
307
  soundEffectPrompt?: string | undefined;
309
308
  htmlPrompt?: {
310
309
  prompt: string;
311
- data?: any;
312
310
  images?: Record<string, any> | undefined;
311
+ data?: any;
313
312
  systemPrompt?: string | undefined;
314
313
  } | undefined;
315
314
  enableLipSync?: boolean | undefined;
@@ -366,10 +365,6 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
366
365
  lang: string;
367
366
  imageParams: {
368
367
  provider: string;
369
- model?: string | undefined;
370
- style?: string | undefined;
371
- quality?: string | undefined;
372
- moderation?: string | undefined;
373
368
  images?: Record<string, {
374
369
  type: "image";
375
370
  source: {
@@ -389,6 +384,10 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
389
384
  type: "imagePrompt";
390
385
  prompt: string;
391
386
  }> | undefined;
387
+ model?: string | undefined;
388
+ style?: string | undefined;
389
+ quality?: string | undefined;
390
+ moderation?: string | undefined;
392
391
  };
393
392
  audioParams: {
394
393
  padding: number;
@@ -528,12 +527,12 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
528
527
  kind: "path";
529
528
  };
530
529
  } | {
531
- type: "textSlide";
532
530
  slide: {
533
531
  title: string;
534
532
  subtitle?: string | undefined;
535
533
  bullets?: string[] | undefined;
536
534
  };
535
+ type: "textSlide";
537
536
  } | {
538
537
  type: "chart";
539
538
  title: string;
@@ -595,10 +594,6 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
595
594
  description?: string | undefined;
596
595
  imageParams?: {
597
596
  provider: string;
598
- model?: string | undefined;
599
- style?: string | undefined;
600
- quality?: string | undefined;
601
- moderation?: string | undefined;
602
597
  images?: Record<string, {
603
598
  type: "image";
604
599
  source: {
@@ -618,6 +613,10 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
618
613
  type: "imagePrompt";
619
614
  prompt: string;
620
615
  }> | undefined;
616
+ model?: string | undefined;
617
+ style?: string | undefined;
618
+ quality?: string | undefined;
619
+ moderation?: string | undefined;
621
620
  } | undefined;
622
621
  audioParams?: {
623
622
  movieVolume: number;
@@ -654,8 +653,8 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
654
653
  soundEffectPrompt?: string | undefined;
655
654
  htmlPrompt?: {
656
655
  prompt: string;
657
- data?: any;
658
656
  images?: Record<string, any> | undefined;
657
+ data?: any;
659
658
  systemPrompt?: string | undefined;
660
659
  } | undefined;
661
660
  enableLipSync?: boolean | undefined;
@@ -692,19 +691,17 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
692
691
  multiLingualTexts: Record<string, {
693
692
  text: string;
694
693
  lang: string;
694
+ cacheKey: string;
695
695
  texts?: string[] | undefined;
696
696
  ttsTexts?: string[] | undefined;
697
697
  duration?: number | undefined;
698
698
  }>;
699
+ cacheKey?: string | undefined;
699
700
  }[];
700
701
  fileDirs: FileObject;
701
702
  presentationStyle: {
702
703
  imageParams: {
703
704
  provider: string;
704
- model?: string | undefined;
705
- style?: string | undefined;
706
- quality?: string | undefined;
707
- moderation?: string | undefined;
708
705
  images?: Record<string, {
709
706
  type: "image";
710
707
  source: {
@@ -724,6 +721,10 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
724
721
  type: "imagePrompt";
725
722
  prompt: string;
726
723
  }> | undefined;
724
+ model?: string | undefined;
725
+ style?: string | undefined;
726
+ quality?: string | undefined;
727
+ moderation?: string | undefined;
727
728
  };
728
729
  audioParams: {
729
730
  padding: number;
@@ -1,9 +1,8 @@
1
1
  import { GraphAILogger } from "graphai";
2
2
  import fs from "fs";
3
3
  import { readMulmoScriptFile, fetchMulmoScriptFile } from "./file.js";
4
- import { mulmoStudioSchema, mulmoCaptionParamsSchema } from "../types/index.js";
5
- import { MulmoPresentationStyleMethods, MulmoScriptMethods } from "../methods/index.js";
6
- import { mulmoPresentationStyleSchema, mulmoStudioMultiLingualSchema } from "../types/index.js";
4
+ import { mulmoStudioSchema, mulmoCaptionParamsSchema, mulmoPresentationStyleSchema } from "../types/schema.js";
5
+ import { MulmoPresentationStyleMethods, MulmoScriptMethods, MulmoStudioMultiLingualMethod } from "../methods/index.js";
7
6
  const mulmoCredit = (speaker) => {
8
7
  return {
9
8
  speaker,
@@ -92,12 +91,7 @@ export const getMultiLingual = (multilingualFilePath, studioBeatsLength) => {
92
91
  return [...Array(studioBeatsLength)].map(() => ({ multiLingualTexts: {} }));
93
92
  }
94
93
  const jsonData = readMulmoScriptFile(multilingualFilePath, "ERROR: File does not exist " + multilingualFilePath)?.mulmoData ?? null;
95
- const dataSet = mulmoStudioMultiLingualSchema.parse(jsonData);
96
- while (dataSet.length < studioBeatsLength) {
97
- dataSet.push({ multiLingualTexts: {} });
98
- }
99
- dataSet.length = studioBeatsLength;
100
- return dataSet;
94
+ return MulmoStudioMultiLingualMethod.validate(jsonData, studioBeatsLength);
101
95
  };
102
96
  export const getPresentationStyle = (presentationStylePath) => {
103
97
  if (!presentationStylePath) {
@@ -5,7 +5,7 @@ import { parrotingImagePath } from "./utils.js";
5
5
  export const imageType = "mermaid";
6
6
  const processMermaid = async (params) => {
7
7
  const { beat, imagePath, canvasSize, context, textSlideStyle } = params;
8
- if (!beat || !beat.image || beat.image.type !== imageType)
8
+ if (!beat?.image || beat.image.type !== imageType)
9
9
  return;
10
10
  const template = getHTMLFile("mermaid");
11
11
  const diagram_code = await MulmoMediaSourceMethods.getText(beat.image.code, context);
@@ -3,7 +3,7 @@ import { MulmoMediaSourceMethods } from "../../methods/mulmo_media_source.js";
3
3
  export const processSource = (imageType) => {
4
4
  return (params) => {
5
5
  const { beat, context } = params;
6
- if (!beat || !beat.image || beat.image.type !== imageType)
6
+ if (!beat?.image || beat.image.type !== imageType)
7
7
  return;
8
8
  const path = MulmoMediaSourceMethods.resolve(beat.image.source, context);
9
9
  if (path) {
@@ -54,4 +54,5 @@ export const replacementsJa = [
54
54
  { from: "危険な面", to: "危険なめん" },
55
55
  { from: "その通り!", to: "その通り。" },
56
56
  { from: "%", to: "パーセント" },
57
+ { from: "IPO", to: "アイピーオー" },
57
58
  ];
@@ -21,12 +21,8 @@ export const text2hash = (input) => {
21
21
  return crypto.createHash("sha256").update(input).digest("hex");
22
22
  };
23
23
  export const localizedText = (beat, multiLingualData, lang) => {
24
- if (lang &&
25
- multiLingualData &&
26
- multiLingualData?.multiLingualTexts &&
27
- multiLingualData?.multiLingualTexts[lang] &&
28
- multiLingualData?.multiLingualTexts[lang].text) {
29
- return multiLingualData?.multiLingualTexts[lang].text;
24
+ if (lang && multiLingualData?.multiLingualTexts?.[lang]?.text) {
25
+ return multiLingualData.multiLingualTexts[lang].text;
30
26
  }
31
27
  return beat.text;
32
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -105,7 +105,7 @@
105
105
  "prettier": "^3.6.2",
106
106
  "ts-node": "^10.9.2",
107
107
  "tsx": "^4.20.3",
108
- "typescript": "^5.7.3",
108
+ "typescript": "^5.9.2",
109
109
  "typescript-eslint": "^8.37.0"
110
110
  },
111
111
  "engines": {
@@ -66,7 +66,7 @@
66
66
  }
67
67
  },
68
68
  {
69
- "text": "The yield of TSMC's 3nm process exceeeds 70%.",
69
+ "text": "The yield of TSMC's 3nm process exceeds 70%.",
70
70
  "image": {
71
71
  "type": "textSlide",
72
72
  "slide": {