mulmocast 0.0.18 → 0.0.19

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 (45) hide show
  1. package/lib/actions/audio.js +13 -11
  2. package/lib/actions/captions.js +2 -3
  3. package/lib/actions/images.d.ts +5 -0
  4. package/lib/actions/images.js +41 -17
  5. package/lib/actions/movie.js +17 -3
  6. package/lib/actions/translate.js +3 -3
  7. package/lib/agents/add_bgm_agent.js +2 -2
  8. package/lib/agents/combine_audio_files_agent.js +96 -53
  9. package/lib/agents/image_openai_agent.js +2 -1
  10. package/lib/agents/validate_schema_agent.d.ts +1 -1
  11. package/lib/agents/validate_schema_agent.js +3 -3
  12. package/lib/cli/helpers.js +6 -1
  13. package/lib/index.browser.d.ts +3 -0
  14. package/lib/index.browser.js +4 -0
  15. package/lib/methods/mulmo_presentation_style.js +2 -1
  16. package/lib/types/schema.d.ts +197 -129
  17. package/lib/types/schema.js +9 -5
  18. package/lib/utils/const.d.ts +1 -0
  19. package/lib/utils/const.js +1 -0
  20. package/lib/utils/file.d.ts +1 -0
  21. package/lib/utils/file.js +4 -0
  22. package/lib/utils/image_plugins/beat.d.ts +1 -0
  23. package/lib/utils/image_plugins/beat.js +3 -0
  24. package/lib/utils/image_plugins/chart.d.ts +1 -0
  25. package/lib/utils/image_plugins/chart.js +2 -0
  26. package/lib/utils/image_plugins/html_tailwind.d.ts +1 -0
  27. package/lib/utils/image_plugins/html_tailwind.js +2 -0
  28. package/lib/utils/image_plugins/image.d.ts +1 -0
  29. package/lib/utils/image_plugins/image.js +1 -0
  30. package/lib/utils/image_plugins/index.d.ts +3 -3
  31. package/lib/utils/image_plugins/index.js +6 -3
  32. package/lib/utils/image_plugins/markdown.d.ts +1 -0
  33. package/lib/utils/image_plugins/markdown.js +2 -0
  34. package/lib/utils/image_plugins/mermaid.d.ts +1 -0
  35. package/lib/utils/image_plugins/mermaid.js +3 -1
  36. package/lib/utils/image_plugins/movie.d.ts +1 -0
  37. package/lib/utils/image_plugins/movie.js +1 -0
  38. package/lib/utils/image_plugins/source.js +1 -1
  39. package/lib/utils/image_plugins/text_slide.d.ts +1 -0
  40. package/lib/utils/image_plugins/text_slide.js +2 -0
  41. package/lib/utils/image_plugins/utils.d.ts +2 -0
  42. package/lib/utils/image_plugins/utils.js +3 -0
  43. package/lib/utils/preprocess.d.ts +3 -1
  44. package/package.json +15 -2
  45. package/scripts/templates/image_prompt_only_template.json +33 -0
@@ -162,11 +162,13 @@ export const beatAudioParamsSchema = z
162
162
  // Note: we can't extend beatAudioParamsSchema because it has padding as optional
163
163
  export const audioParamsSchema = z
164
164
  .object({
165
- padding: z.number().describe("Padding between beats"), // seconds
166
- introPadding: z.number().describe("Padding at the beginning of the audio"), // seconds
167
- closingPadding: z.number().describe("Padding before the last beat"), // seconds
168
- outroPadding: z.number().describe("Padding at the end of the audio"), // seconds
165
+ padding: z.number().default(0.3).describe("Padding between beats"), // seconds
166
+ introPadding: z.number().default(1.0).describe("Padding at the beginning of the audio"), // seconds
167
+ closingPadding: z.number().default(0.8).describe("Padding before the last beat"), // seconds
168
+ outroPadding: z.number().default(1.0).describe("Padding at the end of the audio"), // seconds
169
169
  bgm: mediaSourceSchema.optional(),
170
+ bgmVolume: z.number().default(0.2).describe("Volume of the background music"),
171
+ audioVolume: z.number().default(1.0).describe("Volume of the audio"),
170
172
  })
171
173
  .strict();
172
174
  export const mulmoBeatSchema = z
@@ -209,7 +211,7 @@ export const mulmoSpeechParamsSchema = z
209
211
  export const text2ImageProviderSchema = z.union([z.literal("openai"), z.literal("google")]).default("openai");
210
212
  export const text2MovieProviderSchema = z.union([z.literal("openai"), z.literal("google")]).default("google");
211
213
  export const mulmoTransitionSchema = z.object({
212
- type: z.enum(["fade"]),
214
+ type: z.enum(["fade", "slideout_left"]),
213
215
  duration: z.number().min(0).max(2).default(0.3), // transition duration in seconds
214
216
  });
215
217
  export const mulmoMovieParamsSchema = z
@@ -245,6 +247,8 @@ export const mulmoPresentationStyleSchema = z.object({
245
247
  padding: 0.3,
246
248
  closingPadding: 0.8,
247
249
  outroPadding: 1.0,
250
+ bgmVolume: 0.2,
251
+ audioVolume: 1.0,
248
252
  }),
249
253
  });
250
254
  export const mulmoReferenceSchema = z.object({
@@ -9,3 +9,4 @@ export declare const storyToScriptGenerateMode: {
9
9
  stepWise: string;
10
10
  oneStep: string;
11
11
  };
12
+ export declare const defaultOpenAIImageModel = "dall-e-3";
@@ -9,3 +9,4 @@ export const storyToScriptGenerateMode = {
9
9
  stepWise: "step_wise",
10
10
  oneStep: "one_step",
11
11
  };
12
+ export const defaultOpenAIImageModel = "dall-e-3";
@@ -27,6 +27,7 @@ export declare const imageSuffix = "p";
27
27
  export declare const getBeatPngImagePath: (context: MulmoStudioContext, index: number) => string;
28
28
  export declare const getBeatMoviePath: (context: MulmoStudioContext, index: number) => string;
29
29
  export declare const getReferenceImagePath: (context: MulmoStudioContext, key: string, extension: string) => string;
30
+ export declare const getCaptionImagePath: (context: MulmoStudioContext, index: number) => string;
30
31
  export declare const getOutputPdfFilePath: (outDirPath: string, fileName: string, pdfMode: PDFMode, lang?: string) => string;
31
32
  export declare const getTemplateFilePath: (templateName: string) => string;
32
33
  export declare const mkdir: (dirPath: string) => void;
package/lib/utils/file.js CHANGED
@@ -91,6 +91,10 @@ export const getReferenceImagePath = (context, key, extension) => {
91
91
  const imageProjectDirPath = MulmoStudioContextMethods.getImageProjectDirPath(context);
92
92
  return `${imageProjectDirPath}/${key}.${extension}`;
93
93
  };
94
+ export const getCaptionImagePath = (context, index) => {
95
+ const imageProjectDirPath = MulmoStudioContextMethods.getImageProjectDirPath(context);
96
+ return `${imageProjectDirPath}/${index}_caption.png`;
97
+ };
94
98
  // pdf
95
99
  export const getOutputPdfFilePath = (outDirPath, fileName, pdfMode, lang) => {
96
100
  if (lang) {
@@ -2,3 +2,4 @@ import { ImageProcessorParams } from "../../types/index.js";
2
2
  export declare const imageType = "beat";
3
3
  export declare const processBeatReference: (__: ImageProcessorParams) => Promise<undefined>;
4
4
  export declare const process: (__: ImageProcessorParams) => Promise<undefined>;
5
+ export declare const path: (__: ImageProcessorParams) => undefined;
@@ -5,3 +5,6 @@ export const processBeatReference = async (__) => {
5
5
  return undefined;
6
6
  };
7
7
  export const process = processBeatReference;
8
+ export const path = (__) => {
9
+ return undefined;
10
+ };
@@ -1,3 +1,4 @@
1
1
  import { ImageProcessorParams } from "../../types/index.js";
2
2
  export declare const imageType = "chart";
3
3
  export declare const process: (params: ImageProcessorParams) => Promise<string | undefined>;
4
+ export declare const path: (params: ImageProcessorParams) => string;
@@ -1,5 +1,6 @@
1
1
  import { getHTMLFile } from "../file.js";
2
2
  import { renderHTMLToImage, interpolate } from "../markdown.js";
3
+ import { parrotingImagePath } from "./utils.js";
3
4
  export const imageType = "chart";
4
5
  const processChart = async (params) => {
5
6
  const { beat, imagePath, canvasSize, textSlideStyle } = params;
@@ -21,3 +22,4 @@ const processChart = async (params) => {
21
22
  return imagePath;
22
23
  };
23
24
  export const process = processChart;
25
+ export const path = parrotingImagePath;
@@ -1,3 +1,4 @@
1
1
  import { ImageProcessorParams } from "../../types/index.js";
2
2
  export declare const imageType = "html_tailwind";
3
3
  export declare const process: (params: ImageProcessorParams) => Promise<string | undefined>;
4
+ export declare const path: (params: ImageProcessorParams) => string;
@@ -1,5 +1,6 @@
1
1
  import { getHTMLFile } from "../file.js";
2
2
  import { renderHTMLToImage, interpolate } from "../markdown.js";
3
+ import { parrotingImagePath } from "./utils.js";
3
4
  export const imageType = "html_tailwind";
4
5
  const processHtmlTailwind = async (params) => {
5
6
  const { beat, imagePath, canvasSize } = params;
@@ -16,3 +17,4 @@ const processHtmlTailwind = async (params) => {
16
17
  return imagePath;
17
18
  };
18
19
  export const process = processHtmlTailwind;
20
+ export const path = parrotingImagePath;
@@ -1,2 +1,3 @@
1
1
  export declare const imageType = "image";
2
2
  export declare const process: (params: import("../../index.js").ImageProcessorParams) => string | undefined;
3
+ export declare const path: (params: import("../../index.js").ImageProcessorParams) => string | undefined;
@@ -1,3 +1,4 @@
1
1
  import { processSource } from "./source.js";
2
2
  export const imageType = "image";
3
3
  export const process = processSource(imageType);
4
+ export const path = processSource(imageType);
@@ -1,9 +1,9 @@
1
1
  import * as pluginTextSlide from "./text_slide.js";
2
2
  import * as pluginMarkdown from "./markdown.js";
3
- import * as pluginImage from "./image.js";
4
3
  import * as pluginChart from "./chart.js";
5
4
  import * as pluginMermaid from "./mermaid.js";
6
- import * as pluginMovie from "./movie.js";
7
5
  import * as pluginHtmlTailwind from "./html_tailwind.js";
6
+ import * as pluginImage from "./image.js";
7
+ import * as pluginMovie from "./movie.js";
8
8
  import * as pluginBeat from "./beat.js";
9
- export declare const imagePlugins: (typeof pluginTextSlide | typeof pluginMarkdown | typeof pluginImage | typeof pluginChart | typeof pluginMermaid | typeof pluginMovie | typeof pluginHtmlTailwind | typeof pluginBeat)[];
9
+ export declare const findImagePlugin: (imageType?: string) => typeof pluginTextSlide | typeof pluginMarkdown | typeof pluginChart | typeof pluginMermaid | typeof pluginHtmlTailwind | typeof pluginImage | typeof pluginMovie | typeof pluginBeat | undefined;
@@ -1,9 +1,12 @@
1
1
  import * as pluginTextSlide from "./text_slide.js";
2
2
  import * as pluginMarkdown from "./markdown.js";
3
- import * as pluginImage from "./image.js";
4
3
  import * as pluginChart from "./chart.js";
5
4
  import * as pluginMermaid from "./mermaid.js";
6
- import * as pluginMovie from "./movie.js";
7
5
  import * as pluginHtmlTailwind from "./html_tailwind.js";
6
+ import * as pluginImage from "./image.js";
7
+ import * as pluginMovie from "./movie.js";
8
8
  import * as pluginBeat from "./beat.js";
9
- export const imagePlugins = [pluginTextSlide, pluginMarkdown, pluginImage, pluginChart, pluginMermaid, pluginMovie, pluginHtmlTailwind, pluginBeat];
9
+ const imagePlugins = [pluginTextSlide, pluginMarkdown, pluginImage, pluginChart, pluginMermaid, pluginMovie, pluginHtmlTailwind, pluginBeat];
10
+ export const findImagePlugin = (imageType) => {
11
+ return imagePlugins.find((plugin) => plugin.imageType === imageType);
12
+ };
@@ -1,3 +1,4 @@
1
1
  import { ImageProcessorParams } from "../../types/index.js";
2
2
  export declare const imageType = "markdown";
3
3
  export declare const process: (params: ImageProcessorParams) => Promise<string | undefined>;
4
+ export declare const path: (params: ImageProcessorParams) => string;
@@ -1,4 +1,5 @@
1
1
  import { renderMarkdownToImage } from "../markdown.js";
2
+ import { parrotingImagePath } from "./utils.js";
2
3
  export const imageType = "markdown";
3
4
  const processMarkdown = async (params) => {
4
5
  const { beat, imagePath, textSlideStyle, canvasSize } = params;
@@ -9,3 +10,4 @@ const processMarkdown = async (params) => {
9
10
  return imagePath;
10
11
  };
11
12
  export const process = processMarkdown;
13
+ export const path = parrotingImagePath;
@@ -1,3 +1,4 @@
1
1
  import { ImageProcessorParams } from "../../types/index.js";
2
2
  export declare const imageType = "mermaid";
3
3
  export declare const process: (params: ImageProcessorParams) => Promise<string | undefined>;
4
+ export declare const path: (params: ImageProcessorParams) => string;
@@ -1,10 +1,11 @@
1
1
  import { MulmoMediaSourceMethods } from "../../methods/index.js";
2
2
  import { getHTMLFile } from "../file.js";
3
3
  import { renderHTMLToImage, interpolate } from "../markdown.js";
4
+ import { parrotingImagePath } from "./utils.js";
4
5
  export const imageType = "mermaid";
5
6
  const processMermaid = async (params) => {
6
7
  const { beat, imagePath, canvasSize, context, textSlideStyle } = params;
7
- if (!beat.image || beat.image.type !== imageType)
8
+ if (!beat || !beat.image || beat.image.type !== imageType)
8
9
  return;
9
10
  const template = getHTMLFile("mermaid");
10
11
  const diagram_code = await MulmoMediaSourceMethods.getText(beat.image.code, context);
@@ -19,3 +20,4 @@ const processMermaid = async (params) => {
19
20
  return imagePath;
20
21
  };
21
22
  export const process = processMermaid;
23
+ export const path = parrotingImagePath;
@@ -1,2 +1,3 @@
1
1
  export declare const imageType = "movie";
2
2
  export declare const process: (params: import("../../index.js").ImageProcessorParams) => string | undefined;
3
+ export declare const path: (params: import("../../index.js").ImageProcessorParams) => string | undefined;
@@ -1,3 +1,4 @@
1
1
  import { processSource } from "./source.js";
2
2
  export const imageType = "movie";
3
3
  export const process = processSource(imageType);
4
+ export const path = processSource(imageType);
@@ -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.image || beat.image.type !== imageType)
6
+ if (!beat || !beat.image || beat.image.type !== imageType)
7
7
  return;
8
8
  const path = MulmoMediaSourceMethods.resolve(beat.image.source, context);
9
9
  if (path) {
@@ -1,3 +1,4 @@
1
1
  import { ImageProcessorParams } from "../../types/index.js";
2
2
  export declare const imageType = "textSlide";
3
3
  export declare const process: (params: ImageProcessorParams) => Promise<string | undefined>;
4
+ export declare const path: (params: ImageProcessorParams) => string;
@@ -1,4 +1,5 @@
1
1
  import { renderMarkdownToImage } from "../markdown.js";
2
+ import { parrotingImagePath } from "./utils.js";
2
3
  export const imageType = "textSlide";
3
4
  const processTextSlide = async (params) => {
4
5
  const { beat, imagePath, textSlideStyle, canvasSize } = params;
@@ -17,3 +18,4 @@ const processTextSlide = async (params) => {
17
18
  return imagePath;
18
19
  };
19
20
  export const process = processTextSlide;
21
+ export const path = parrotingImagePath;
@@ -0,0 +1,2 @@
1
+ import { ImageProcessorParams } from "../../types/index.js";
2
+ export declare const parrotingImagePath: (params: ImageProcessorParams) => string;
@@ -0,0 +1,3 @@
1
+ export const parrotingImagePath = (params) => {
2
+ return params.imagePath;
3
+ };
@@ -14,6 +14,8 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
14
14
  introPadding: number;
15
15
  closingPadding: number;
16
16
  outroPadding: number;
17
+ bgmVolume: number;
18
+ audioVolume: number;
17
19
  bgm?: {
18
20
  url: string;
19
21
  kind: "url";
@@ -242,7 +244,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
242
244
  provider?: "openai" | "google" | undefined;
243
245
  model?: string | undefined;
244
246
  transition?: {
245
- type: "fade";
247
+ type: "fade" | "slideout_left";
246
248
  duration: number;
247
249
  } | undefined;
248
250
  } | undefined;
package/package.json CHANGED
@@ -1,9 +1,21 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": {
10
+ "node": "./lib/index.d.ts",
11
+ "browser": "./lib/index.browser.d.ts",
12
+ "default": "./lib/index.d.ts"
13
+ },
14
+ "node": "./lib/index.js",
15
+ "browser": "./lib/index.browser.js",
16
+ "default": "./lib/index.js"
17
+ }
18
+ },
7
19
  "bin": {
8
20
  "mulmo": "lib/cli/bin.js"
9
21
  },
@@ -38,7 +50,8 @@
38
50
  "story_to_script": "npx tsx ./src/cli/bin.ts tool story_to_script",
39
51
  "latest": "yarn upgrade-interactive --latest",
40
52
  "format": "prettier --write '{src,scripts,assets/templates,assets/styles,draft,ideason,scripts_mag2,proto,test,graphai,output,docs/scripts}/**/*.{ts,json,yaml}'",
41
- "deep_research": "npx tsx ./src/tools/deep_research.ts"
53
+ "deep_research": "npx tsx ./src/tools/deep_research.ts",
54
+ "fake_data": "npx tsx test/fake/sample.ts"
42
55
  },
43
56
  "repository": "git+ssh://git@github.com/receptron/mulmocast-cli.git",
44
57
  "author": "snakajima",
@@ -0,0 +1,33 @@
1
+ {
2
+ "$mulmocast": {
3
+ "version": "1.0",
4
+ "credit": "closing"
5
+ },
6
+ "title": "[TITLE: Brief, engaging title for the topic]",
7
+ "beats": [
8
+ {
9
+ "duration": 5,
10
+ "imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
11
+ },
12
+ {
13
+ "duration": 5,
14
+ "imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
15
+ },
16
+ {
17
+ "duration": 5,
18
+ "imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
19
+ },
20
+ {
21
+ "duration": 5,
22
+ "imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
23
+ },
24
+ {
25
+ "duration": 5,
26
+ "imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
27
+ },
28
+ {
29
+ "duration": 5,
30
+ "imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
31
+ }
32
+ ]
33
+ }