mulmocast 1.2.29 → 1.2.30

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.
@@ -0,0 +1,3 @@
1
+ import { MulmoStudioContext } from "../types/index.js";
2
+ export declare const htmlFilePath: (context: MulmoStudioContext) => string;
3
+ export declare const html: (context: MulmoStudioContext, imageWidth?: string) => Promise<void>;
@@ -0,0 +1,62 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { isNull } from "graphai";
4
+ import { localizedText } from "../utils/utils.js";
5
+ import { writingMessage } from "../utils/file.js";
6
+ import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
7
+ const generateHtmlContent = (context, imageWidth) => {
8
+ const { studio, multiLingual, lang = "en" } = context;
9
+ const title = studio.script.title || "MulmoCast Content";
10
+ const description = studio.script.description || "";
11
+ let html = `<h1>${title}</h1>\n\n`;
12
+ if (description) {
13
+ html += `${description}\n\n`;
14
+ }
15
+ studio.script.beats.forEach((beat, index) => {
16
+ const text = localizedText(beat, multiLingual?.[index], lang);
17
+ const studioBeat = studio.beats[index];
18
+ if (text.trim() || studioBeat?.html || studioBeat?.imageFile) {
19
+ if (studioBeat?.html) {
20
+ html += `${studioBeat.html}\n\n`;
21
+ }
22
+ else if (studioBeat?.imageFile && isNull(studioBeat.html)) {
23
+ const imagePath = path.relative(context.fileDirs.outDirPath, studioBeat.imageFile);
24
+ const altText = `Beat ${index + 1}`;
25
+ if (imageWidth) {
26
+ // Use HTML img tag for width control
27
+ html += `<img src="${imagePath}" alt="${altText}" width="${imageWidth}" />\n\n`;
28
+ }
29
+ else {
30
+ // Use standard html image syntax
31
+ html += `<img src="${imagePath}" alt="${altText}" />\n\n`;
32
+ }
33
+ }
34
+ if (text.trim()) {
35
+ html += `${text}\n\n`;
36
+ }
37
+ }
38
+ });
39
+ return html;
40
+ };
41
+ export const htmlFilePath = (context) => {
42
+ const { studio, fileDirs, lang = "en" } = context;
43
+ // Add language suffix only when target language is different from script's original language
44
+ const langSuffix = studio.script.lang !== lang ? `_${lang}` : "";
45
+ const filename = `${studio.filename}${langSuffix}.html`;
46
+ return path.join(fileDirs.outDirPath, filename);
47
+ };
48
+ const generateHtml = async (context, imageWidth) => {
49
+ const outputHtmlPath = htmlFilePath(context);
50
+ const htmlContent = generateHtmlContent(context, imageWidth);
51
+ fs.writeFileSync(outputHtmlPath, htmlContent, "utf8");
52
+ writingMessage(outputHtmlPath);
53
+ };
54
+ export const html = async (context, imageWidth) => {
55
+ try {
56
+ MulmoStudioContextMethods.setSessionState(context, "html", true);
57
+ await generateHtml(context, imageWidth);
58
+ }
59
+ finally {
60
+ MulmoStudioContextMethods.setSessionState(context, "html", false);
61
+ }
62
+ };
@@ -12,9 +12,9 @@ export declare const imagePreprocessAgent: (namedInputs: {
12
12
  htmlImageSystemPrompt: string;
13
13
  } | {
14
14
  imagePath: string | undefined;
15
+ movieFile: string | undefined;
15
16
  referenceImageForMovie: string | undefined;
16
17
  imageParams: MulmoImageParams;
17
- movieFile: string | undefined;
18
18
  soundEffectFile?: string;
19
19
  soundEffectPrompt?: string;
20
20
  soundEffectModel?: string;
@@ -63,8 +63,14 @@ export const imagePreprocessAgent = async (namedInputs) => {
63
63
  if (plugin.markdown) {
64
64
  returnValue.markdown = plugin.markdown({ beat, context, imagePath, ...htmlStyle(context, beat) });
65
65
  }
66
+ const isTypeMovie = beat.image.type === "movie";
66
67
  // undefined prompt indicates that image generation is not needed
67
- return { ...returnValue, imagePath: pluginPath, referenceImageForMovie: pluginPath };
68
+ return {
69
+ ...returnValue,
70
+ imagePath: isTypeMovie ? undefined : pluginPath,
71
+ movieFile: isTypeMovie ? pluginPath : undefined,
72
+ referenceImageForMovie: pluginPath,
73
+ };
68
74
  }
69
75
  if (beat.moviePrompt && !beat.imagePrompt) {
70
76
  return { ...returnValue, imagePath, imageFromMovie: true }; // no image prompt, only movie prompt
@@ -35,9 +35,9 @@ export declare const beat_graph_data: {
35
35
  htmlImageSystemPrompt: string;
36
36
  } | {
37
37
  imagePath: string | undefined;
38
+ movieFile: string | undefined;
38
39
  referenceImageForMovie: string | undefined;
39
40
  imageParams: MulmoImageParams;
40
- movieFile: string | undefined;
41
41
  soundEffectFile?: string;
42
42
  soundEffectPrompt?: string;
43
43
  soundEffectModel?: string;
@@ -7,3 +7,4 @@ export * from "./movie.js";
7
7
  export * from "./pdf.js";
8
8
  export * from "./translate.js";
9
9
  export * from "./markdown.js";
10
+ export * from "./html.js";
@@ -7,3 +7,4 @@ export * from "./movie.js";
7
7
  export * from "./pdf.js";
8
8
  export * from "./translate.js";
9
9
  export * from "./markdown.js";
10
+ export * from "./html.js";
@@ -18,7 +18,7 @@ const generateMarkdownContent = (context, imageWidth) => {
18
18
  if (studioBeat?.markdown) {
19
19
  markdown += `${studioBeat.markdown}\n\n`;
20
20
  }
21
- else if (studioBeat?.imageFile && studioBeat.markdown !== "") {
21
+ else if (studioBeat?.imageFile) {
22
22
  const imagePath = path.relative(context.fileDirs.outDirPath, studioBeat.imageFile);
23
23
  if (imageWidth) {
24
24
  // Use HTML img tag for width control
package/lib/cli/bin.js CHANGED
@@ -11,6 +11,7 @@ import * as imagesCmd from "./commands/image/index.js";
11
11
  import * as movieCmd from "./commands/movie/index.js";
12
12
  import * as pdfCmd from "./commands/pdf/index.js";
13
13
  import * as markdownCmd from "./commands/markdown/index.js";
14
+ import * as htmlCmd from "./commands/html/index.js";
14
15
  import * as toolCmd from "./commands/tool/index.js";
15
16
  import { GraphAILogger } from "graphai";
16
17
  const __filename = fileURLToPath(import.meta.url);
@@ -34,6 +35,7 @@ export const main = async () => {
34
35
  .command(movieCmd)
35
36
  .command(pdfCmd)
36
37
  .command(markdownCmd)
38
+ .command(htmlCmd)
37
39
  .command(toolCmd)
38
40
  .demandCommand()
39
41
  .strict()
@@ -0,0 +1,16 @@
1
+ import type { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{
3
+ o: string | undefined;
4
+ } & {
5
+ b: string | undefined;
6
+ } & {
7
+ l: string | undefined;
8
+ } & {
9
+ f: boolean;
10
+ } & {
11
+ p: string | undefined;
12
+ } & {
13
+ file: string | undefined;
14
+ } & {
15
+ image_width: string | undefined;
16
+ }>;
@@ -0,0 +1,5 @@
1
+ import { commonOptions } from "../../common.js";
2
+ export const builder = (yargs) => commonOptions(yargs).option("image_width", {
3
+ describe: "Image width (e.g., 400px, 50%, auto)",
4
+ type: "string",
5
+ });
@@ -0,0 +1,4 @@
1
+ import { CliArgs } from "../../../types/cli_types.js";
2
+ export declare const handler: (argv: CliArgs<{
3
+ image_width?: string;
4
+ }>) => Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { images, html } from "../../../actions/index.js";
2
+ import { initializeContext, runTranslateIfNeeded } from "../../helpers.js";
3
+ export const handler = async (argv) => {
4
+ const context = await initializeContext(argv);
5
+ if (!context) {
6
+ process.exit(1);
7
+ }
8
+ await runTranslateIfNeeded(context);
9
+ await images(context);
10
+ await html(context, argv.image_width);
11
+ };
@@ -0,0 +1,4 @@
1
+ export declare const command = "html <file>";
2
+ export declare const desc = "Generate html files";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,4 @@
1
+ export const command = "html <file>";
2
+ export const desc = "Generate html files";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -5778,9 +5778,11 @@ export declare const mulmoStudioBeatSchema: z.ZodObject<{
5778
5778
  captionFile: z.ZodOptional<z.ZodString>;
5779
5779
  htmlImageFile: z.ZodOptional<z.ZodString>;
5780
5780
  markdown: z.ZodOptional<z.ZodString>;
5781
+ html: z.ZodOptional<z.ZodString>;
5781
5782
  }, "strict", z.ZodTypeAny, {
5782
5783
  duration?: number | undefined;
5783
5784
  markdown?: string | undefined;
5785
+ html?: string | undefined;
5784
5786
  id?: string | undefined;
5785
5787
  startAt?: number | undefined;
5786
5788
  hash?: string | undefined;
@@ -5798,6 +5800,7 @@ export declare const mulmoStudioBeatSchema: z.ZodObject<{
5798
5800
  }, {
5799
5801
  duration?: number | undefined;
5800
5802
  markdown?: string | undefined;
5803
+ html?: string | undefined;
5801
5804
  id?: string | undefined;
5802
5805
  startAt?: number | undefined;
5803
5806
  hash?: string | undefined;
@@ -6031,12 +6034,14 @@ export declare const mulmoSessionStateSchema: z.ZodObject<{
6031
6034
  caption: z.ZodBoolean;
6032
6035
  pdf: z.ZodBoolean;
6033
6036
  markdown: z.ZodBoolean;
6037
+ html: z.ZodBoolean;
6034
6038
  }, "strip", z.ZodTypeAny, {
6035
6039
  image: boolean;
6036
6040
  video: boolean;
6037
6041
  audio: boolean;
6038
6042
  markdown: boolean;
6039
6043
  pdf: boolean;
6044
+ html: boolean;
6040
6045
  multiLingual: boolean;
6041
6046
  caption: boolean;
6042
6047
  }, {
@@ -6045,6 +6050,7 @@ export declare const mulmoSessionStateSchema: z.ZodObject<{
6045
6050
  audio: boolean;
6046
6051
  markdown: boolean;
6047
6052
  pdf: boolean;
6053
+ html: boolean;
6048
6054
  multiLingual: boolean;
6049
6055
  caption: boolean;
6050
6056
  }>;
@@ -6086,6 +6092,7 @@ export declare const mulmoSessionStateSchema: z.ZodObject<{
6086
6092
  audio: boolean;
6087
6093
  markdown: boolean;
6088
6094
  pdf: boolean;
6095
+ html: boolean;
6089
6096
  multiLingual: boolean;
6090
6097
  caption: boolean;
6091
6098
  };
@@ -6107,6 +6114,7 @@ export declare const mulmoSessionStateSchema: z.ZodObject<{
6107
6114
  audio: boolean;
6108
6115
  markdown: boolean;
6109
6116
  pdf: boolean;
6117
+ html: boolean;
6110
6118
  multiLingual: boolean;
6111
6119
  caption: boolean;
6112
6120
  };
@@ -8488,9 +8496,11 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8488
8496
  captionFile: z.ZodOptional<z.ZodString>;
8489
8497
  htmlImageFile: z.ZodOptional<z.ZodString>;
8490
8498
  markdown: z.ZodOptional<z.ZodString>;
8499
+ html: z.ZodOptional<z.ZodString>;
8491
8500
  }, "strict", z.ZodTypeAny, {
8492
8501
  duration?: number | undefined;
8493
8502
  markdown?: string | undefined;
8503
+ html?: string | undefined;
8494
8504
  id?: string | undefined;
8495
8505
  startAt?: number | undefined;
8496
8506
  hash?: string | undefined;
@@ -8508,6 +8518,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8508
8518
  }, {
8509
8519
  duration?: number | undefined;
8510
8520
  markdown?: string | undefined;
8521
+ html?: string | undefined;
8511
8522
  id?: string | undefined;
8512
8523
  startAt?: number | undefined;
8513
8524
  hash?: string | undefined;
@@ -8527,6 +8538,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8527
8538
  beats: {
8528
8539
  duration?: number | undefined;
8529
8540
  markdown?: string | undefined;
8541
+ html?: string | undefined;
8530
8542
  id?: string | undefined;
8531
8543
  startAt?: number | undefined;
8532
8544
  hash?: string | undefined;
@@ -8875,6 +8887,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8875
8887
  beats: {
8876
8888
  duration?: number | undefined;
8877
8889
  markdown?: string | undefined;
8890
+ html?: string | undefined;
8878
8891
  id?: string | undefined;
8879
8892
  startAt?: number | undefined;
8880
8893
  hash?: string | undefined;
@@ -405,6 +405,7 @@ export const mulmoStudioBeatSchema = z
405
405
  captionFile: z.string().optional(), // path to the caption image
406
406
  htmlImageFile: z.string().optional(), // path to the html image
407
407
  markdown: z.string().optional(), // markdown string (alternative to image)
408
+ html: z.string().optional(), // html string (alternative to image)
408
409
  })
409
410
  .strict();
410
411
  export const mulmoStudioMultiLingualDataSchema = z.object({
@@ -426,6 +427,7 @@ export const mulmoSessionStateSchema = z.object({
426
427
  caption: z.boolean(),
427
428
  pdf: z.boolean(),
428
429
  markdown: z.boolean(),
430
+ html: z.boolean(),
429
431
  }),
430
432
  inBeatSession: z.object({
431
433
  audio: z.record(z.string(), z.boolean()),
@@ -85,7 +85,7 @@ export type Text2HtmlAgentInfo = {
85
85
  };
86
86
  export type BeatMediaType = "movie" | "image";
87
87
  export type StoryToScriptGenerateMode = (typeof storyToScriptGenerateMode)[keyof typeof storyToScriptGenerateMode];
88
- export type SessionType = "audio" | "image" | "video" | "multiLingual" | "caption" | "pdf" | "markdown";
88
+ export type SessionType = "audio" | "image" | "video" | "multiLingual" | "caption" | "pdf" | "markdown" | "html";
89
89
  export type BeatSessionType = "audio" | "image" | "multiLingual" | "caption" | "movie" | "html" | "imageReference" | "soundEffect" | "lipSync";
90
90
  export type SessionProgressEvent = {
91
91
  kind: "session";
@@ -3,6 +3,7 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
3
3
  beats: {
4
4
  duration?: number | undefined;
5
5
  markdown?: string | undefined;
6
+ html?: string | undefined;
6
7
  id?: string | undefined;
7
8
  startAt?: number | undefined;
8
9
  hash?: string | undefined;
@@ -356,6 +357,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
356
357
  beats: {
357
358
  duration?: number | undefined;
358
359
  markdown?: string | undefined;
360
+ html?: string | undefined;
359
361
  id?: string | undefined;
360
362
  startAt?: number | undefined;
361
363
  hash?: string | undefined;
@@ -834,6 +836,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
834
836
  caption: boolean;
835
837
  pdf: boolean;
836
838
  markdown: boolean;
839
+ html: boolean;
837
840
  };
838
841
  inBeatSession: {
839
842
  audio: {};
@@ -35,6 +35,7 @@ const initSessionState = () => {
35
35
  caption: false,
36
36
  pdf: false,
37
37
  markdown: false,
38
+ html: false,
38
39
  },
39
40
  inBeatSession: {
40
41
  audio: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.29",
3
+ "version": "1.2.30",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -50,6 +50,7 @@
50
50
  "prompt": "npx tsx ./src/cli/bin.ts tool prompt",
51
51
  "schema": "npx tsx ./src/cli/bin.ts tool schema",
52
52
  "markdown": "npx tsx ./src/cli/bin.ts markdown",
53
+ "html": "npx tsx ./src/cli/bin.ts html",
53
54
  "story_to_script": "npx tsx ./src/cli/bin.ts tool story_to_script",
54
55
  "whisper": "npx tsx ./src/cli/bin.ts tool whisper",
55
56
  "latest": "yarn upgrade-interactive --latest",
@@ -68,7 +69,7 @@
68
69
  "homepage": "https://github.com/receptron/mulmocast-cli#readme",
69
70
  "dependencies": {
70
71
  "@google-cloud/text-to-speech": "^6.3.0",
71
- "@google/genai": "^1.17.0",
72
+ "@google/genai": "^1.19.0",
72
73
  "@graphai/anthropic_agent": "^2.0.11",
73
74
  "@graphai/browserless_agent": "^2.0.1",
74
75
  "@graphai/gemini_agent": "^2.0.1",
@@ -78,18 +79,18 @@
78
79
  "@graphai/stream_agent_filter": "^2.0.2",
79
80
  "@graphai/vanilla": "^2.0.12",
80
81
  "@graphai/vanilla_node_agents": "^2.0.4",
81
- "@inquirer/input": "^4.2.2",
82
- "@inquirer/select": "^4.3.2",
83
- "@modelcontextprotocol/sdk": "^1.17.5",
82
+ "@inquirer/input": "^4.2.4",
83
+ "@inquirer/select": "^4.3.4",
84
+ "@modelcontextprotocol/sdk": "^1.18.0",
84
85
  "@mozilla/readability": "^0.6.0",
85
86
  "@tavily/core": "^0.5.11",
86
87
  "clipboardy": "^4.0.0",
87
88
  "dotenv": "^17.2.2",
88
89
  "fluent-ffmpeg": "^2.1.3",
89
90
  "graphai": "^2.0.14",
90
- "jsdom": "^26.1.0",
91
- "marked": "^16.2.1",
92
- "mulmocast-vision": "^0.1.4",
91
+ "jsdom": "^27.0.0",
92
+ "marked": "^16.3.0",
93
+ "mulmocast-vision": "^1.0.2",
93
94
  "ora": "^8.2.0",
94
95
  "puppeteer": "^24.20.0",
95
96
  "replicate": "^1.1.0",