mulmocast 1.2.3 → 1.2.5

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,6 +1,5 @@
1
1
  import "dotenv/config";
2
- import type { CallbackFunction } from "graphai";
3
- import { MulmoStudioContext, MulmoBeat } from "../types/index.js";
2
+ import { MulmoStudioContext, MulmoBeat, PublicAPIArgs } from "../types/index.js";
4
3
  export declare const getBeatAudioPath: (text: string, context: MulmoStudioContext, beat: MulmoBeat, lang?: string) => string | undefined;
5
- export declare const generateBeatAudio: (index: number, context: MulmoStudioContext, settings?: Record<string, string>, callbacks?: CallbackFunction[]) => Promise<void>;
6
- export declare const audio: (context: MulmoStudioContext, settings?: Record<string, string>, callbacks?: CallbackFunction[]) => Promise<MulmoStudioContext>;
4
+ export declare const generateBeatAudio: (index: number, context: MulmoStudioContext, args?: PublicAPIArgs) => Promise<void>;
5
+ export declare const audio: (context: MulmoStudioContext, args?: PublicAPIArgs) => Promise<MulmoStudioContext>;
@@ -186,7 +186,8 @@ const audioAgents = {
186
186
  addBGMAgent,
187
187
  combineAudioFilesAgent,
188
188
  };
189
- export const generateBeatAudio = async (index, context, settings, callbacks) => {
189
+ export const generateBeatAudio = async (index, context, args) => {
190
+ const { settings, callbacks } = args ?? {};
190
191
  try {
191
192
  MulmoStudioContextMethods.setSessionState(context, "audio", true);
192
193
  const fileName = MulmoStudioContextMethods.getFileName(context);
@@ -214,7 +215,8 @@ export const generateBeatAudio = async (index, context, settings, callbacks) =>
214
215
  MulmoStudioContextMethods.setSessionState(context, "audio", false);
215
216
  }
216
217
  };
217
- export const audio = async (context, settings, callbacks) => {
218
+ export const audio = async (context, args) => {
219
+ const { settings, callbacks } = args ?? {};
218
220
  try {
219
221
  MulmoStudioContextMethods.setSessionState(context, "audio", true);
220
222
  const fileName = MulmoStudioContextMethods.getFileName(context);
@@ -1,3 +1,2 @@
1
- import { MulmoStudioContext } from "../types/index.js";
2
- import type { CallbackFunction } from "graphai";
3
- export declare const captions: (context: MulmoStudioContext, callbacks?: CallbackFunction[]) => Promise<MulmoStudioContext>;
1
+ import { MulmoStudioContext, PublicAPIArgs } from "../types/index.js";
2
+ export declare const captions: (context: MulmoStudioContext, args?: PublicAPIArgs) => Promise<MulmoStudioContext>;
@@ -69,7 +69,8 @@ const graph_data = {
69
69
  },
70
70
  },
71
71
  };
72
- export const captions = async (context, callbacks) => {
72
+ export const captions = async (context, args) => {
73
+ const { callbacks } = args ?? {};
73
74
  if (MulmoStudioContextMethods.getCaption(context)) {
74
75
  try {
75
76
  MulmoStudioContextMethods.setSessionState(context, "caption", true);
@@ -1,20 +1,18 @@
1
- import type { GraphOptions, CallbackFunction } from "graphai";
2
- import { MulmoStudioContext } from "../types/index.js";
1
+ import type { GraphOptions } from "graphai";
2
+ import { MulmoStudioContext, PublicAPIArgs } from "../types/index.js";
3
3
  export declare const graphOption: (context: MulmoStudioContext, settings?: Record<string, string>) => Promise<GraphOptions>;
4
4
  type ImageOptions = {
5
5
  imageAgents: Record<string, unknown>;
6
6
  };
7
- export declare const images: (context: MulmoStudioContext, args?: {
8
- settings?: Record<string, string>;
9
- callbacks?: CallbackFunction[];
7
+ export declare const images: (context: MulmoStudioContext, args?: PublicAPIArgs & {
10
8
  options?: ImageOptions;
11
9
  }) => Promise<MulmoStudioContext>;
12
10
  export declare const generateBeatImage: (inputs: {
13
11
  index: number;
14
12
  context: MulmoStudioContext;
15
- settings?: Record<string, string>;
16
- callbacks?: CallbackFunction[];
17
- forceMovie?: boolean;
18
- forceImage?: boolean;
13
+ args?: PublicAPIArgs & {
14
+ forceMovie?: boolean;
15
+ forceImage?: boolean;
16
+ };
19
17
  }) => Promise<void>;
20
18
  export {};
@@ -346,8 +346,8 @@ export const graphOption = async (context, settings) => {
346
346
  },
347
347
  ],
348
348
  taskManager: new TaskManager(MulmoPresentationStyleMethods.getConcurrency(context.presentationStyle)),
349
+ config: settings2GraphAIConfig(settings, process.env),
349
350
  };
350
- options.config = settings2GraphAIConfig(settings, process.env);
351
351
  return options;
352
352
  };
353
353
  const prepareGenerateImages = async (context) => {
@@ -367,7 +367,8 @@ const prepareGenerateImages = async (context) => {
367
367
  };
368
368
  return injections;
369
369
  };
370
- const generateImages = async (context, settings, callbacks, options) => {
370
+ const generateImages = async (context, args) => {
371
+ const { settings, callbacks, options } = args ?? {};
371
372
  const optionImageAgents = options?.imageAgents ?? {};
372
373
  const injections = await prepareGenerateImages(context);
373
374
  const graphaiAgent = {
@@ -388,10 +389,9 @@ const generateImages = async (context, settings, callbacks, options) => {
388
389
  };
389
390
  // public api
390
391
  export const images = async (context, args) => {
391
- const { settings, callbacks, options } = args ?? {};
392
392
  try {
393
393
  MulmoStudioContextMethods.setSessionState(context, "image", true);
394
- const newContext = await generateImages(context, settings, callbacks, options);
394
+ const newContext = await generateImages(context, args);
395
395
  MulmoStudioContextMethods.setSessionState(context, "image", false);
396
396
  return newContext;
397
397
  }
@@ -402,7 +402,8 @@ export const images = async (context, args) => {
402
402
  };
403
403
  // public api
404
404
  export const generateBeatImage = async (inputs) => {
405
- const { index, context, settings, callbacks, forceMovie, forceImage } = inputs;
405
+ const { index, context, args } = inputs;
406
+ const { settings, callbacks, forceMovie, forceImage } = args ?? {};
406
407
  const options = await graphOption(context, settings);
407
408
  const injections = await prepareGenerateImages(context);
408
409
  const graph = new GraphAI(beat_graph_data, defaultAgents, options);
@@ -1,6 +1,5 @@
1
1
  import "dotenv/config";
2
- import type { CallbackFunction } from "graphai";
3
- import type { LANG, MulmoStudioContext } from "../types/index.js";
2
+ import type { LANG, MulmoStudioContext, PublicAPIArgs } from "../types/index.js";
4
3
  export declare const translateTextGraph: {
5
4
  version: number;
6
5
  nodes: {
@@ -50,11 +49,5 @@ export declare const getOutputMultilingualFilePathAndMkdir: (context: MulmoStudi
50
49
  outputMultilingualFilePath: string;
51
50
  outDirPath: string;
52
51
  };
53
- export declare const translateBeat: (index: number, context: MulmoStudioContext, targetLangs: string[], args?: {
54
- settings?: Record<string, string>;
55
- callbacks?: CallbackFunction[];
56
- }) => Promise<void>;
57
- export declare const translate: (context: MulmoStudioContext, args?: {
58
- callbacks?: CallbackFunction[];
59
- settings?: Record<string, string>;
60
- }) => Promise<MulmoStudioContext>;
52
+ export declare const translateBeat: (index: number, context: MulmoStudioContext, targetLangs: string[], args?: PublicAPIArgs) => Promise<void>;
53
+ export declare const translate: (context: MulmoStudioContext, args?: PublicAPIArgs) => Promise<MulmoStudioContext>;
@@ -8,7 +8,7 @@ export const imageGenAIAgent = async ({ namedInputs, params, config, }) => {
8
8
  const model = params.model ?? provider2ImageAgent["google"].defaultModel;
9
9
  const apiKey = config?.apiKey;
10
10
  if (!apiKey) {
11
- throw new Error("API key is required for Google GenAI agent");
11
+ throw new Error("Google GenAI API key is required (GEMINI_API_KEY)");
12
12
  }
13
13
  try {
14
14
  const ai = new GoogleGenAI({ apiKey });
@@ -8,6 +8,9 @@ export const imageOpenaiAgent = async ({ namedInputs, params, config, }) => {
8
8
  const { prompt, referenceImages } = namedInputs;
9
9
  const { moderation, canvasSize, quality } = params;
10
10
  const { apiKey, baseURL } = { ...config };
11
+ if (!apiKey) {
12
+ throw new Error("OpenAI API key is required (OPENAI_API_KEY)");
13
+ }
11
14
  const model = params.model ?? provider2ImageAgent["openai"].defaultModel;
12
15
  const openai = new OpenAI({ apiKey, baseURL });
13
16
  const size = (() => {
@@ -7,7 +7,7 @@ export const lipSyncReplicateAgent = async ({ namedInputs, params, config, }) =>
7
7
  const apiKey = config?.apiKey;
8
8
  const model = params.model ?? provider2LipSyncAgent.replicate.defaultModel;
9
9
  if (!apiKey) {
10
- throw new Error("REPLICATE_API_TOKEN environment variable is required");
10
+ throw new Error("Replicate API key is required (REPLICATE_API_TOKEN)");
11
11
  }
12
12
  const replicate = new Replicate({
13
13
  auth: apiKey,
@@ -19,7 +19,7 @@ export const movieGenAIAgent = async ({ namedInputs, params, config, }) => {
19
19
  const duration = params.duration ?? 8;
20
20
  const apiKey = config?.apiKey;
21
21
  if (!apiKey) {
22
- throw new Error("API key is required for Google GenAI agent");
22
+ throw new Error("Google GenAI API key is required (GEMINI_API_KEY)");
23
23
  }
24
24
  try {
25
25
  const ai = new GoogleGenAI({ apiKey });
@@ -86,7 +86,7 @@ export const movieReplicateAgent = async ({ namedInputs, params, config, }) => {
86
86
  }
87
87
  const apiKey = config?.apiKey;
88
88
  if (!apiKey) {
89
- throw new Error("REPLICATE_API_TOKEN environment variable is required");
89
+ throw new Error("Replicate API key is required (REPLICATE_API_TOKEN)");
90
90
  }
91
91
  try {
92
92
  const buffer = await generateMovie(model, apiKey, prompt, imagePath, aspectRatio, duration);
@@ -7,7 +7,7 @@ export const soundEffectReplicateAgent = async ({ namedInputs, params, config })
7
7
  const apiKey = config?.apiKey;
8
8
  const model = params.model ?? provider2SoundEffectAgent.replicate.defaultModel;
9
9
  if (!apiKey) {
10
- throw new Error("REPLICATE_API_TOKEN environment variable is required");
10
+ throw new Error("Replicate API key is required (REPLICATE_API_TOKEN)");
11
11
  }
12
12
  const replicate = new Replicate({
13
13
  auth: apiKey,
@@ -5,7 +5,7 @@ export const ttsElevenlabsAgent = async ({ namedInputs, params, config, }) => {
5
5
  const { voice, model, stability, similarityBoost, suppressError } = params;
6
6
  const apiKey = config?.apiKey;
7
7
  if (!apiKey) {
8
- throw new Error("ELEVENLABS_API_KEY environment variable is required");
8
+ throw new Error("ElevenLabs API key is required (ELEVENLABS_API_KEY)");
9
9
  }
10
10
  if (!voice) {
11
11
  throw new Error("ELEVENLABS Voice ID is required");
@@ -1,15 +1,19 @@
1
- import { GraphAILogger, assert } from "graphai";
1
+ import { GraphAILogger } from "graphai";
2
+ /*
2
3
  const errorMessage = [
3
- "TTS NijiVoice: No API key. ",
4
- "You have the following options:",
5
- "1. Obtain an API key from Niji Voice (https://platform.nijivoice.com/) and set it as the NIJIVOICE_API_KEY environment variable.",
6
- '2. Use OpenAI\'s TTS instead of Niji Voice by changing speechParams.provider from "nijivoice" to "openai".',
4
+ "TTS NijiVoice: No API key. ",
5
+ "You have the following options:",
6
+ "1. Obtain an API key from Niji Voice (https://platform.nijivoice.com/) and set it as the NIJIVOICE_API_KEY environment variable.",
7
+ '2. Use OpenAI\'s TTS instead of Niji Voice by changing speechParams.provider from "nijivoice" to "openai".',
7
8
  ].join("\n");
9
+ */
8
10
  export const ttsNijivoiceAgent = async ({ params, namedInputs, config, }) => {
9
11
  const { suppressError, voice, speed, speed_global } = params;
10
12
  const { apiKey } = config ?? {};
11
13
  const { text } = namedInputs;
12
- assert(!!apiKey, errorMessage);
14
+ if (!apiKey) {
15
+ throw new Error("NijiVoice API key is required (NIJIVOICE_API_KEY)");
16
+ }
13
17
  const url = `https://api.nijivoice.com/api/platform/v1/voice-actors/${voice}/generate-voice`;
14
18
  const options = {
15
19
  method: "POST",
@@ -5,6 +5,9 @@ export const ttsOpenaiAgent = async ({ namedInputs, params, config, }) => {
5
5
  const { text } = namedInputs;
6
6
  const { model, voice, suppressError, instructions } = params;
7
7
  const { apiKey, baseURL } = config ?? {};
8
+ if (!apiKey) {
9
+ throw new Error("OpenAI API key is required (OPENAI_API_KEY)");
10
+ }
8
11
  const openai = new OpenAI({ apiKey, baseURL });
9
12
  try {
10
13
  const tts_options = {
@@ -1,3 +1,4 @@
1
+ import { type CallbackFunction } from "graphai";
1
2
  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
3
  import { pdf_modes, pdf_sizes, storyToScriptGenerateMode } from "../utils/const.js";
3
4
  import type { LLM } from "../utils/provider2agent.js";
@@ -128,3 +129,7 @@ export type InitOptions = {
128
129
  c?: string;
129
130
  p?: string;
130
131
  };
132
+ export type PublicAPIArgs = {
133
+ settings?: Record<string, string>;
134
+ callbacks?: CallbackFunction[];
135
+ };
@@ -95,26 +95,31 @@ export declare const provider2LLMAgent: {
95
95
  readonly agentName: "openAIAgent";
96
96
  readonly defaultModel: "gpt-5";
97
97
  readonly max_tokens: 8192;
98
+ readonly models: readonly ["gpt-5", "gpt-5-nano", "gpt-5-mini", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "o3", "o3-mini", "o3-pro", "o1", "o1-pro", "gpt-4o", "gpt-4o-mini"];
98
99
  };
99
100
  readonly anthropic: {
100
101
  readonly agentName: "anthropicAgent";
101
102
  readonly defaultModel: "claude-3-7-sonnet-20250219";
102
103
  readonly max_tokens: 8192;
104
+ readonly models: readonly ["claude-opus-4-1-20250805", "claude-opus-4-20250514", "claude-sonnet-4-20250514", "claude-3-7-sonnet-20250219", "claude-3-haiku-20240307"];
103
105
  };
104
106
  readonly gemini: {
105
107
  readonly agentName: "geminiAgent";
106
- readonly defaultModel: "gemini-1.5-flash";
108
+ readonly defaultModel: "gemini-2.5-flash";
107
109
  readonly max_tokens: 8192;
110
+ readonly models: readonly ["gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite", "gemini-2.0-flash"];
108
111
  };
109
112
  readonly groq: {
110
113
  readonly agentName: "groqAgent";
111
- readonly defaultModel: "llama3-8b-8192";
114
+ readonly defaultModel: "llama-3.1-8b-instant";
112
115
  readonly max_tokens: 4096;
116
+ readonly models: readonly ["llama-3.1-8b-instant", "llama-3.3-70b-versatile", "deepseek-r1-distill-llama-70b", "openai/gpt-oss-120b", "openai/gpt-oss-20b"];
113
117
  };
114
118
  readonly mock: {
115
119
  readonly agentName: "mediaMockAgent";
116
120
  readonly defaultModel: "mock";
117
121
  readonly max_tokens: 4096;
122
+ readonly models: readonly ["mock"];
118
123
  };
119
124
  };
120
125
  export declare const defaultProviders: {
@@ -208,26 +208,45 @@ export const provider2LLMAgent = {
208
208
  agentName: "openAIAgent",
209
209
  defaultModel: "gpt-5",
210
210
  max_tokens: 8192,
211
+ models: [
212
+ "gpt-5",
213
+ "gpt-5-nano",
214
+ "gpt-5-mini",
215
+ "gpt-4.1",
216
+ "gpt-4.1-mini",
217
+ "gpt-4.1-nano",
218
+ "o3",
219
+ "o3-mini",
220
+ "o3-pro",
221
+ "o1",
222
+ "o1-pro",
223
+ "gpt-4o",
224
+ "gpt-4o-mini",
225
+ ],
211
226
  },
212
227
  anthropic: {
213
228
  agentName: "anthropicAgent",
214
229
  defaultModel: "claude-3-7-sonnet-20250219",
215
230
  max_tokens: 8192,
231
+ models: ["claude-opus-4-1-20250805", "claude-opus-4-20250514", "claude-sonnet-4-20250514", "claude-3-7-sonnet-20250219", "claude-3-haiku-20240307"],
216
232
  },
217
233
  gemini: {
218
234
  agentName: "geminiAgent",
219
- defaultModel: "gemini-1.5-flash",
235
+ defaultModel: "gemini-2.5-flash",
220
236
  max_tokens: 8192,
237
+ models: ["gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite", "gemini-2.0-flash"],
221
238
  },
222
239
  groq: {
223
240
  agentName: "groqAgent",
224
- defaultModel: "llama3-8b-8192",
241
+ defaultModel: "llama-3.1-8b-instant",
225
242
  max_tokens: 4096,
243
+ models: ["llama-3.1-8b-instant", "llama-3.3-70b-versatile", "deepseek-r1-distill-llama-70b", "openai/gpt-oss-120b", "openai/gpt-oss-20b"],
226
244
  },
227
245
  mock: {
228
246
  agentName: "mediaMockAgent",
229
247
  defaultModel: "mock",
230
248
  max_tokens: 4096,
249
+ models: ["mock"],
231
250
  },
232
251
  };
233
252
  export const defaultProviders = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -67,27 +67,27 @@
67
67
  "dependencies": {
68
68
  "@google-cloud/text-to-speech": "^6.2.0",
69
69
  "@google/genai": "^1.13.0",
70
- "@graphai/anthropic_agent": "^2.0.5",
70
+ "@graphai/anthropic_agent": "^2.0.11",
71
71
  "@graphai/browserless_agent": "^2.0.1",
72
- "@graphai/gemini_agent": "^2.0.0",
73
- "@graphai/groq_agent": "^2.0.0",
72
+ "@graphai/gemini_agent": "^2.0.1",
73
+ "@graphai/groq_agent": "^2.0.2",
74
74
  "@graphai/input_agents": "^1.0.2",
75
- "@graphai/openai_agent": "^2.0.3",
75
+ "@graphai/openai_agent": "^2.0.5",
76
76
  "@graphai/stream_agent_filter": "^2.0.2",
77
- "@graphai/vanilla": "^2.0.6",
78
- "@graphai/vanilla_node_agents": "^2.0.1",
77
+ "@graphai/vanilla": "^2.0.12",
78
+ "@graphai/vanilla_node_agents": "^2.0.4",
79
79
  "@inquirer/input": "^4.2.1",
80
80
  "@inquirer/select": "^4.3.1",
81
81
  "@modelcontextprotocol/sdk": "^1.15.1",
82
82
  "@tavily/core": "^0.5.9",
83
- "canvas": "^3.1.2",
83
+ "canvas": "^3.2.0",
84
84
  "clipboardy": "^4.0.0",
85
85
  "dotenv": "^17.2.1",
86
86
  "fluent-ffmpeg": "^2.1.3",
87
- "graphai": "^2.0.13",
88
- "marked": "^16.1.2",
87
+ "graphai": "^2.0.14",
88
+ "marked": "^16.2.0",
89
89
  "ora": "^8.2.0",
90
- "puppeteer": "^24.16.0",
90
+ "puppeteer": "^24.16.2",
91
91
  "replicate": "^1.0.1",
92
92
  "yaml": "^2.8.1",
93
93
  "yargs": "^18.0.0",
@@ -97,7 +97,7 @@
97
97
  "devDependencies": {
98
98
  "@anatine/zod-mock": "^3.14.0",
99
99
  "@faker-js/faker": "^9.9.0",
100
- "@receptron/test_utils": "^2.0.0",
100
+ "@receptron/test_utils": "^2.0.3",
101
101
  "@types/fluent-ffmpeg": "^2.1.26",
102
102
  "@types/yargs": "^17.0.33",
103
103
  "eslint": "^9.33.0",
@@ -106,9 +106,9 @@
106
106
  "eslint-plugin-sonarjs": "^3.0.4",
107
107
  "prettier": "^3.6.2",
108
108
  "ts-node": "^10.9.2",
109
- "tsx": "^4.20.3",
109
+ "tsx": "^4.20.4",
110
110
  "typescript": "^5.9.2",
111
- "typescript-eslint": "^8.39.0"
111
+ "typescript-eslint": "^8.40.0"
112
112
  },
113
113
  "engines": {
114
114
  "node": ">=18.0.0"
@@ -1,21 +0,0 @@
1
- {
2
- "$mulmocast": {
3
- "version": "1.1"
4
- },
5
- "lang": "en",
6
- "captionParams": {
7
- "lang": "en"
8
- },
9
- "beats": [
10
- {
11
- "text": "Hello World",
12
- "image": {
13
- "type": "textSlide",
14
- "slide": {
15
- "title": "Hello World",
16
- "bullets": ["Hello", "World"]
17
- }
18
- }
19
- }
20
- ]
21
- }
@@ -1,18 +0,0 @@
1
- {
2
- "$mulmocast": {
3
- "version": "1.1"
4
- },
5
- "lang": "en",
6
- "beats": [
7
- {
8
- "text": "Hello World",
9
- "image": {
10
- "type": "textSlide",
11
- "slide": {
12
- "title": "Hello World",
13
- "bullets": ["Hello", "World"]
14
- }
15
- }
16
- }
17
- ]
18
- }