mulmocast 1.2.38 → 1.2.40

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.
@@ -250,9 +250,10 @@ export const generateBeatAudio = async (index, context, args) => {
250
250
  });
251
251
  }
252
252
  await graph.run();
253
+ MulmoStudioContextMethods.setSessionState(context, "audio", false, true);
253
254
  }
254
- finally {
255
- MulmoStudioContextMethods.setSessionState(context, "audio", false);
255
+ catch (__error) {
256
+ MulmoStudioContextMethods.setSessionState(context, "audio", false, false);
256
257
  }
257
258
  };
258
259
  export const audio = async (context, args) => {
@@ -283,12 +284,12 @@ export const audio = async (context, args) => {
283
284
  }
284
285
  const result = await graph.run();
285
286
  writingMessage(audioCombinedFilePath);
286
- MulmoStudioContextMethods.setSessionState(context, "audio", false);
287
+ MulmoStudioContextMethods.setSessionState(context, "audio", false, true);
287
288
  writingMessage(audioArtifactFilePath);
288
289
  return result.combineFiles;
289
290
  }
290
291
  catch (__error) {
291
- MulmoStudioContextMethods.setSessionState(context, "audio", false);
292
+ MulmoStudioContextMethods.setSessionState(context, "audio", false, false);
292
293
  throw __error;
293
294
  }
294
295
  };
@@ -86,9 +86,10 @@ export const captions = async (context, args) => {
86
86
  });
87
87
  }
88
88
  await graph.run();
89
+ MulmoStudioContextMethods.setSessionState(context, "caption", false, true);
89
90
  }
90
- finally {
91
- MulmoStudioContextMethods.setSessionState(context, "caption", false);
91
+ catch (__error) {
92
+ MulmoStudioContextMethods.setSessionState(context, "caption", false, false);
92
93
  }
93
94
  }
94
95
  return context;
@@ -77,8 +77,9 @@ export const html = async (context, imageWidth) => {
77
77
  try {
78
78
  MulmoStudioContextMethods.setSessionState(context, "html", true);
79
79
  await generateHtml(context, imageWidth);
80
+ MulmoStudioContextMethods.setSessionState(context, "html", false, true);
80
81
  }
81
- finally {
82
- MulmoStudioContextMethods.setSessionState(context, "html", false);
82
+ catch (__error) {
83
+ MulmoStudioContextMethods.setSessionState(context, "html", false, false);
83
84
  }
84
85
  };
@@ -272,6 +272,7 @@ export declare const beat_graph_data: {
272
272
  movieFile: string;
273
273
  imageFile: string;
274
274
  soundEffectFile: string;
275
+ index: number;
275
276
  }) => Promise<{
276
277
  hasMovieAudio: boolean;
277
278
  }>;
@@ -280,6 +281,7 @@ export declare const beat_graph_data: {
280
281
  movieFile: string;
281
282
  imageFile: string;
282
283
  soundEffectFile: string;
284
+ index: string;
283
285
  };
284
286
  };
285
287
  soundEffectGenerator: {
@@ -201,7 +201,14 @@ export const beat_graph_data = {
201
201
  }
202
202
  catch (error) {
203
203
  GraphAILogger.error(error);
204
- throw Error("audioChecker: ffmpegGetMediaDuration error.");
204
+ throw new Error("audioChecker: ffmpegGetMediaDuration error.", {
205
+ cause: {
206
+ type: "FileNotExist",
207
+ action: "images",
208
+ agentName: "audioChecker",
209
+ beat_index: namedInputs.index,
210
+ },
211
+ });
205
212
  }
206
213
  },
207
214
  inputs: {
@@ -209,6 +216,7 @@ export const beat_graph_data = {
209
216
  movieFile: ":preprocessor.movieFile",
210
217
  imageFile: ":preprocessor.imagePath",
211
218
  soundEffectFile: ":preprocessor.soundEffectFile",
219
+ index: ":__mapIndex",
212
220
  },
213
221
  },
214
222
  soundEffectGenerator: {
@@ -431,11 +439,11 @@ export const images = async (context, args) => {
431
439
  try {
432
440
  MulmoStudioContextMethods.setSessionState(context, "image", true);
433
441
  const newContext = await generateImages(context, args);
434
- MulmoStudioContextMethods.setSessionState(context, "image", false);
442
+ MulmoStudioContextMethods.setSessionState(context, "image", false, true);
435
443
  return newContext;
436
444
  }
437
445
  catch (error) {
438
- MulmoStudioContextMethods.setSessionState(context, "image", false);
446
+ MulmoStudioContextMethods.setSessionState(context, "image", false, false);
439
447
  throw error;
440
448
  }
441
449
  };
@@ -54,8 +54,9 @@ export const markdown = async (context, imageWidth) => {
54
54
  try {
55
55
  MulmoStudioContextMethods.setSessionState(context, "markdown", true);
56
56
  await generateMarkdown(context, imageWidth);
57
+ MulmoStudioContextMethods.setSessionState(context, "markdown", false, true);
57
58
  }
58
- finally {
59
- MulmoStudioContextMethods.setSessionState(context, "markdown", false);
59
+ catch (__error) {
60
+ MulmoStudioContextMethods.setSessionState(context, "markdown", false, false);
60
61
  }
61
62
  };
@@ -251,8 +251,9 @@ export const movie = async (context) => {
251
251
  if (await createVideo(audioArtifactFilePath, outputVideoPath, context)) {
252
252
  writingMessage(outputVideoPath);
253
253
  }
254
+ MulmoStudioContextMethods.setSessionState(context, "video", false, true);
254
255
  }
255
- finally {
256
- MulmoStudioContextMethods.setSessionState(context, "video", false);
256
+ catch (__error) {
257
+ MulmoStudioContextMethods.setSessionState(context, "video", false, false);
257
258
  }
258
259
  };
@@ -159,8 +159,9 @@ export const pdf = async (context, pdfMode, pdfSize) => {
159
159
  try {
160
160
  MulmoStudioContextMethods.setSessionState(context, "pdf", true);
161
161
  await generatePDF(context, pdfMode, pdfSize);
162
+ MulmoStudioContextMethods.setSessionState(context, "pdf", false, true);
162
163
  }
163
- finally {
164
- MulmoStudioContextMethods.setSessionState(context, "pdf", false);
164
+ catch (__error) {
165
+ MulmoStudioContextMethods.setSessionState(context, "pdf", false, false);
165
166
  }
166
167
  };
@@ -292,9 +292,10 @@ export const translate = async (context, args) => {
292
292
  if (results.mergeStudioResult) {
293
293
  context.multiLingual = multiLingualObjectToArray(results?.mergeStudioResult?.multiLingual, context.studio.script.beats);
294
294
  }
295
+ MulmoStudioContextMethods.setSessionState(context, "multiLingual", false, true);
295
296
  }
296
- finally {
297
- MulmoStudioContextMethods.setSessionState(context, "multiLingual", false);
297
+ catch (__error) {
298
+ MulmoStudioContextMethods.setSessionState(context, "multiLingual", false, false);
298
299
  }
299
300
  return context;
300
301
  };
@@ -41,7 +41,7 @@ export const MulmoPresentationStyleMethods = {
41
41
  return [...defaultTextSlideStyles, ...[styles], ...[extraStyles]].flat().join("\n");
42
42
  },
43
43
  getDefaultSpeaker(presentationStyle) {
44
- const speakers = presentationStyle.speechParams.speakers ?? {};
44
+ const speakers = presentationStyle?.speechParams?.speakers ?? {};
45
45
  const keys = Object.keys(speakers).sort();
46
46
  userAssert(keys.length !== 0, "presentationStyle.speechParams.speakers is not set!!");
47
47
  const defaultSpeaker = keys.find((key) => speakers[key].isDefault);
@@ -57,7 +57,7 @@ export const MulmoPresentationStyleMethods = {
57
57
  userAssert(!!speaker, `speaker is not set: speaker "${speakerId}"`);
58
58
  // Check if the speaker has a language-specific version.
59
59
  // Normally, lang is determined by the context, but lang may be specified when using the API.
60
- const lang = targetLang ?? context.lang ?? context.studio.script.lang;
60
+ const lang = targetLang ?? context.lang ?? context?.studio?.script?.lang;
61
61
  if (speaker.lang && lang && speaker.lang[lang]) {
62
62
  return speaker.lang[lang];
63
63
  }
@@ -3,7 +3,8 @@
3
3
  * (No Node.js built-ins like fs, path, dotenv, etc.)
4
4
  * Works in both Node.js and modern browsers.
5
5
  */
6
- import { BeatSessionType, MulmoStudioContext, SessionProgressCallback, SessionType, MulmoBeat } from "../types/index.js";
6
+ import { BeatSessionType, MulmoStudioContext, SessionProgressCallback, SessionType, MulmoBeat, SpeechOptions } from "../types/index.js";
7
+ import { provider2TTSAgent } from "../utils/provider2agent.js";
7
8
  export declare const addSessionProgressCallback: (cb: SessionProgressCallback) => void;
8
9
  export declare const removeSessionProgressCallback: (cb: SessionProgressCallback) => void;
9
10
  export declare const MulmoStudioContextMethods: {
@@ -13,17 +14,14 @@ export declare const MulmoStudioContextMethods: {
13
14
  getOutDirPath(context: MulmoStudioContext): string;
14
15
  getFileName(context: MulmoStudioContext): string;
15
16
  getCaption(context: MulmoStudioContext): string | undefined;
16
- setSessionState(context: MulmoStudioContext, sessionType: SessionType, value: boolean): void;
17
+ setSessionState(context: MulmoStudioContext, sessionType: SessionType, value: boolean, result?: boolean): void;
17
18
  setBeatSessionState(context: MulmoStudioContext, sessionType: BeatSessionType | undefined, index: number, id: string | undefined, value: boolean): void;
18
19
  needTranslate(context: MulmoStudioContext, includeCaption?: boolean): boolean | "" | undefined;
19
20
  getIntroPadding(context: MulmoStudioContext): number;
20
21
  getAudioParam(context: MulmoStudioContext, beat: MulmoBeat, lang?: string): {
22
+ provider: keyof typeof provider2TTSAgent;
21
23
  voiceId: string;
22
- provider: "google" | "mock" | "nijivoice" | "openai" | "elevenlabs";
23
- speechOptions: {
24
- speed?: number | undefined;
25
- instruction?: string | undefined;
26
- };
27
- model: string | undefined;
24
+ model?: string;
25
+ speechOptions: SpeechOptions;
28
26
  };
29
27
  };
@@ -3,7 +3,7 @@
3
3
  * (No Node.js built-ins like fs, path, dotenv, etc.)
4
4
  * Works in both Node.js and modern browsers.
5
5
  */
6
- import { text2SpeechProviderSchema } from "../types/index.js";
6
+ import { text2SpeechProviderSchema, } from "../types/index.js";
7
7
  import { beatId } from "../utils/utils.js";
8
8
  import { GraphAILogger } from "graphai";
9
9
  import { MulmoPresentationStyleMethods } from "./mulmo_presentation_style.js";
@@ -14,12 +14,17 @@ export const addSessionProgressCallback = (cb) => {
14
14
  export const removeSessionProgressCallback = (cb) => {
15
15
  sessionProgressCallbacks.delete(cb);
16
16
  };
17
- const notifyStateChange = (context, sessionType) => {
17
+ const notifyStateChange = (context, sessionType, result) => {
18
18
  const inSession = context.sessionState.inSession[sessionType] ?? false;
19
19
  const prefix = inSession ? "<" : " >";
20
20
  GraphAILogger.info(`${prefix} ${sessionType}`);
21
21
  for (const callback of sessionProgressCallbacks) {
22
- callback({ kind: "session", sessionType, inSession });
22
+ if (result !== undefined) {
23
+ callback({ kind: "session", sessionType, inSession, result });
24
+ }
25
+ else {
26
+ callback({ kind: "session", sessionType, inSession });
27
+ }
23
28
  }
24
29
  };
25
30
  const notifyBeatStateChange = (context, sessionType, id) => {
@@ -50,9 +55,9 @@ export const MulmoStudioContextMethods = {
50
55
  getCaption(context) {
51
56
  return context.studio.script.captionParams?.lang;
52
57
  },
53
- setSessionState(context, sessionType, value) {
58
+ setSessionState(context, sessionType, value, result) {
54
59
  context.sessionState.inSession[sessionType] = value;
55
- notifyStateChange(context, sessionType);
60
+ notifyStateChange(context, sessionType, result);
56
61
  },
57
62
  setBeatSessionState(context, sessionType, index, id, value) {
58
63
  if (!sessionType) {
@@ -2696,6 +2696,7 @@ export declare const mulmoMovieParamsSchema: z.ZodObject<{
2696
2696
  duration?: number | undefined;
2697
2697
  } | undefined;
2698
2698
  }>;
2699
+ export declare const defaultSpeaker = "Presenter";
2699
2700
  export declare const mulmoPresentationStyleSchema: z.ZodObject<{
2700
2701
  $mulmocast: z.ZodObject<{
2701
2702
  version: z.ZodLiteral<"1.1">;
@@ -324,7 +324,7 @@ export const mulmoMovieParamsSchema = z
324
324
  fillOption: mulmoFillOptionSchema.optional(), // for movie.ts
325
325
  })
326
326
  .strict();
327
- const defaultSpeaker = "Presenter";
327
+ export const defaultSpeaker = "Presenter";
328
328
  export const mulmoPresentationStyleSchema = z.object({
329
329
  $mulmocast: mulmoCastCreditSchema,
330
330
  canvasSize: mulmoCanvasDimensionSchema, // has default value
@@ -92,6 +92,7 @@ export type SessionProgressEvent = {
92
92
  kind: "session";
93
93
  sessionType: SessionType;
94
94
  inSession: boolean;
95
+ result?: boolean;
95
96
  } | {
96
97
  kind: "beat";
97
98
  sessionType: BeatSessionType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.38",
3
+ "version": "1.2.40",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -115,6 +115,6 @@
115
115
  "typescript-eslint": "^8.44.1"
116
116
  },
117
117
  "engines": {
118
- "node": ">=18.0.0"
118
+ "node": ">=20.0.0"
119
119
  }
120
120
  }