mulmocast 1.2.49 → 1.2.51

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.
@@ -228,7 +228,6 @@ const audioAgents = {
228
228
  export const generateBeatAudio = async (index, context, args) => {
229
229
  const { settings, callbacks, langs } = args ?? {};
230
230
  try {
231
- // MulmoStudioContextMethods.setSessionState(context, "audio", true);
232
231
  const fileName = MulmoStudioContextMethods.getFileName(context);
233
232
  const audioDirPath = MulmoStudioContextMethods.getAudioDirPath(context);
234
233
  const outDirPath = MulmoStudioContextMethods.getOutDirPath(context);
@@ -255,10 +254,10 @@ export const generateBeatAudio = async (index, context, args) => {
255
254
  });
256
255
  }
257
256
  await graph.run();
258
- // MulmoStudioContextMethods.setSessionState(context, "audio", false, true);
259
257
  }
260
- catch (__error) {
261
- // MulmoStudioContextMethods.setSessionState(context, "audio", false, false);
258
+ catch (error) {
259
+ GraphAILogger.error(error);
260
+ throw error;
262
261
  }
263
262
  };
264
263
  export const audio = async (context, args) => {
@@ -88,8 +88,9 @@ export const captions = async (context, args) => {
88
88
  await graph.run();
89
89
  MulmoStudioContextMethods.setSessionState(context, "caption", false, true);
90
90
  }
91
- catch (__error) {
91
+ catch (error) {
92
92
  MulmoStudioContextMethods.setSessionState(context, "caption", false, false);
93
+ throw error;
93
94
  }
94
95
  }
95
96
  return context;
@@ -79,7 +79,8 @@ export const html = async (context, imageWidth) => {
79
79
  await generateHtml(context, imageWidth);
80
80
  MulmoStudioContextMethods.setSessionState(context, "html", false, true);
81
81
  }
82
- catch (__error) {
82
+ catch (error) {
83
83
  MulmoStudioContextMethods.setSessionState(context, "html", false, false);
84
+ throw error;
84
85
  }
85
86
  };
@@ -3,6 +3,7 @@ import { getReferenceImagePath } from "../utils/file.js";
3
3
  import { graphOption } from "./images.js";
4
4
  import { MulmoPresentationStyleMethods, MulmoMediaSourceMethods } from "../methods/index.js";
5
5
  import { imageOpenaiAgent, mediaMockAgent, imageGenAIAgent, imageReplicateAgent } from "../agents/index.js";
6
+ import { agentGenerationError, imageReferenceAction, imageFileTarget } from "../utils/error_cause.js";
6
7
  // public api
7
8
  // Application may call this function directly to generate reference image.
8
9
  export const generateReferenceImage = async (inputs) => {
@@ -37,10 +38,18 @@ export const generateReferenceImage = async (inputs) => {
37
38
  },
38
39
  },
39
40
  };
40
- const options = await graphOption(context);
41
- const graph = new GraphAI(image_graph_data, { imageGenAIAgent, imageOpenaiAgent, mediaMockAgent, imageReplicateAgent }, options);
42
- await graph.run();
43
- return imagePath;
41
+ try {
42
+ const options = await graphOption(context);
43
+ const graph = new GraphAI(image_graph_data, { imageGenAIAgent, imageOpenaiAgent, mediaMockAgent, imageReplicateAgent }, options);
44
+ await graph.run();
45
+ return imagePath;
46
+ }
47
+ catch (error) {
48
+ GraphAILogger.error(error);
49
+ throw new Error(`generateReferenceImage: generate error: key=${key}`, {
50
+ cause: agentGenerationError("imageReference", imageReferenceAction, imageFileTarget),
51
+ });
52
+ }
44
53
  };
45
54
  export const getImageRefs = async (context) => {
46
55
  const images = context.presentationStyle.imageParams?.images;
@@ -56,7 +56,8 @@ export const markdown = async (context, imageWidth) => {
56
56
  await generateMarkdown(context, imageWidth);
57
57
  MulmoStudioContextMethods.setSessionState(context, "markdown", false, true);
58
58
  }
59
- catch (__error) {
59
+ catch (error) {
60
60
  MulmoStudioContextMethods.setSessionState(context, "markdown", false, false);
61
+ throw error;
61
62
  }
62
63
  };
@@ -161,7 +161,8 @@ export const pdf = async (context, pdfMode, pdfSize) => {
161
161
  await generatePDF(context, pdfMode, pdfSize);
162
162
  MulmoStudioContextMethods.setSessionState(context, "pdf", false, true);
163
163
  }
164
- catch (__error) {
164
+ catch (error) {
165
165
  MulmoStudioContextMethods.setSessionState(context, "pdf", false, false);
166
+ throw error;
166
167
  }
167
168
  };
@@ -266,6 +266,7 @@ export const translateBeat = async (index, context, targetLangs, args) => {
266
266
  }
267
267
  catch (error) {
268
268
  GraphAILogger.log(error);
269
+ throw error;
269
270
  }
270
271
  };
271
272
  export const translate = async (context, args) => {
@@ -295,8 +296,9 @@ export const translate = async (context, args) => {
295
296
  }
296
297
  MulmoStudioContextMethods.setSessionState(context, "multiLingual", false, true);
297
298
  }
298
- catch (__error) {
299
+ catch (error) {
299
300
  MulmoStudioContextMethods.setSessionState(context, "multiLingual", false, false);
301
+ throw error;
300
302
  }
301
303
  return context;
302
304
  };
@@ -35,12 +35,12 @@ export const ttsOpenaiAgent = async ({ namedInputs, params, config, }) => {
35
35
  GraphAILogger.error(error);
36
36
  if (error instanceof AuthenticationError) {
37
37
  throw new Error("Failed to generate image: 401 Incorrect API key provided with OpenAI", {
38
- cause: agentIncorrectAPIKeyError("imageOpenaiAgent", audioAction, audioFileTarget),
38
+ cause: agentIncorrectAPIKeyError("ttsOpenaiAgent", audioAction, audioFileTarget),
39
39
  });
40
40
  }
41
41
  if (error instanceof RateLimitError) {
42
42
  throw new Error("You exceeded your current quota", {
43
- cause: agentAPIRateLimitError("imageOpenaiAgent", audioAction, audioFileTarget),
43
+ cause: agentAPIRateLimitError("ttsOpenaiAgent", audioAction, audioFileTarget),
44
44
  });
45
45
  }
46
46
  if (error && typeof error === "object" && "error" in error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.49",
3
+ "version": "1.2.51",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -85,7 +85,7 @@
85
85
  "@modelcontextprotocol/sdk": "^1.19.1",
86
86
  "@mozilla/readability": "^0.6.0",
87
87
  "@tavily/core": "^0.5.11",
88
- "clipboardy": "^5.0.0",
88
+ "clipboardy": "^4.0.0",
89
89
  "dotenv": "^17.2.3",
90
90
  "fluent-ffmpeg": "^2.1.3",
91
91
  "graphai": "^2.0.16",