mulmocast 1.2.41 → 1.2.42

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,7 +1,7 @@
1
1
  import { GraphAILogger, assert } from "graphai";
2
2
  import { mulmoTransitionSchema, mulmoFillOptionSchema } from "../types/index.js";
3
3
  import { MulmoPresentationStyleMethods } from "../methods/index.js";
4
- import { getAudioArtifactFilePath, getOutputVideoFilePath, writingMessage } from "../utils/file.js";
4
+ import { getAudioArtifactFilePath, getOutputVideoFilePath, writingMessage, isFile } from "../utils/file.js";
5
5
  import { FfmpegContextAddInput, FfmpegContextInit, FfmpegContextPushFormattedAudio, FfmpegContextGenerateOutput, } from "../utils/ffmpeg_utils.js";
6
6
  import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
7
7
  // const isMac = process.platform === "darwin";
@@ -164,6 +164,7 @@ const createVideo = async (audioArtifactFilePath, outputVideoPath, context) => {
164
164
  }
165
165
  const sourceFile = studioBeat.lipSyncFile ?? studioBeat.soundEffectFile ?? studioBeat.movieFile ?? studioBeat.htmlImageFile ?? studioBeat.imageFile;
166
166
  assert(!!sourceFile, `studioBeat.imageFile or studioBeat.movieFile is not set: index=${index}`);
167
+ assert(isFile(sourceFile), `studioBeat.imageFile or studioBeat.movieFile is not exist or not file: index=${index}`);
167
168
  assert(!!studioBeat.duration, `studioBeat.duration is not set: index=${index}`);
168
169
  const extraPadding = (() => {
169
170
  // We need to consider only intro and outro padding because the other paddings were already added to the beat.duration
@@ -2098,6 +2098,7 @@ export declare const mulmoBeatSchema: z.ZodObject<{
2098
2098
  systemPrompt?: string | undefined;
2099
2099
  }>>;
2100
2100
  enableLipSync: z.ZodOptional<z.ZodBoolean>;
2101
+ hidden: z.ZodOptional<z.ZodBoolean>;
2101
2102
  }, "strict", z.ZodTypeAny, {
2102
2103
  text: string;
2103
2104
  image?: {
@@ -2283,6 +2284,7 @@ export declare const mulmoBeatSchema: z.ZodObject<{
2283
2284
  systemPrompt?: string | undefined;
2284
2285
  } | undefined;
2285
2286
  enableLipSync?: boolean | undefined;
2287
+ hidden?: boolean | undefined;
2286
2288
  }, {
2287
2289
  image?: {
2288
2290
  type: "markdown";
@@ -2468,6 +2470,7 @@ export declare const mulmoBeatSchema: z.ZodObject<{
2468
2470
  systemPrompt?: string | undefined;
2469
2471
  } | undefined;
2470
2472
  enableLipSync?: boolean | undefined;
2473
+ hidden?: boolean | undefined;
2471
2474
  }>;
2472
2475
  export declare const mulmoCanvasDimensionSchema: z.ZodDefault<z.ZodObject<{
2473
2476
  width: z.ZodNumber;
@@ -4446,6 +4449,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
4446
4449
  systemPrompt?: string | undefined;
4447
4450
  }>>;
4448
4451
  enableLipSync: z.ZodOptional<z.ZodBoolean>;
4452
+ hidden: z.ZodOptional<z.ZodBoolean>;
4449
4453
  }, "strict", z.ZodTypeAny, {
4450
4454
  text: string;
4451
4455
  image?: {
@@ -4631,6 +4635,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
4631
4635
  systemPrompt?: string | undefined;
4632
4636
  } | undefined;
4633
4637
  enableLipSync?: boolean | undefined;
4638
+ hidden?: boolean | undefined;
4634
4639
  }, {
4635
4640
  image?: {
4636
4641
  type: "markdown";
@@ -4816,6 +4821,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
4816
4821
  systemPrompt?: string | undefined;
4817
4822
  } | undefined;
4818
4823
  enableLipSync?: boolean | undefined;
4824
+ hidden?: boolean | undefined;
4819
4825
  }>, "many">;
4820
4826
  imagePath: z.ZodOptional<z.ZodString>;
4821
4827
  __test_invalid__: z.ZodOptional<z.ZodBoolean>;
@@ -5090,6 +5096,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
5090
5096
  systemPrompt?: string | undefined;
5091
5097
  } | undefined;
5092
5098
  enableLipSync?: boolean | undefined;
5099
+ hidden?: boolean | undefined;
5093
5100
  }[];
5094
5101
  title?: string | undefined;
5095
5102
  description?: string | undefined;
@@ -5318,6 +5325,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
5318
5325
  systemPrompt?: string | undefined;
5319
5326
  } | undefined;
5320
5327
  enableLipSync?: boolean | undefined;
5328
+ hidden?: boolean | undefined;
5321
5329
  }[];
5322
5330
  title?: string | undefined;
5323
5331
  description?: string | undefined;
@@ -6971,6 +6979,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
6971
6979
  systemPrompt?: string | undefined;
6972
6980
  }>>;
6973
6981
  enableLipSync: z.ZodOptional<z.ZodBoolean>;
6982
+ hidden: z.ZodOptional<z.ZodBoolean>;
6974
6983
  }, "strict", z.ZodTypeAny, {
6975
6984
  text: string;
6976
6985
  image?: {
@@ -7156,6 +7165,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7156
7165
  systemPrompt?: string | undefined;
7157
7166
  } | undefined;
7158
7167
  enableLipSync?: boolean | undefined;
7168
+ hidden?: boolean | undefined;
7159
7169
  }, {
7160
7170
  image?: {
7161
7171
  type: "markdown";
@@ -7341,6 +7351,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7341
7351
  systemPrompt?: string | undefined;
7342
7352
  } | undefined;
7343
7353
  enableLipSync?: boolean | undefined;
7354
+ hidden?: boolean | undefined;
7344
7355
  }>, "many">;
7345
7356
  imagePath: z.ZodOptional<z.ZodString>;
7346
7357
  __test_invalid__: z.ZodOptional<z.ZodBoolean>;
@@ -7615,6 +7626,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7615
7626
  systemPrompt?: string | undefined;
7616
7627
  } | undefined;
7617
7628
  enableLipSync?: boolean | undefined;
7629
+ hidden?: boolean | undefined;
7618
7630
  }[];
7619
7631
  title?: string | undefined;
7620
7632
  description?: string | undefined;
@@ -7843,6 +7855,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7843
7855
  systemPrompt?: string | undefined;
7844
7856
  } | undefined;
7845
7857
  enableLipSync?: boolean | undefined;
7858
+ hidden?: boolean | undefined;
7846
7859
  }[];
7847
7860
  title?: string | undefined;
7848
7861
  description?: string | undefined;
@@ -8308,6 +8321,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8308
8321
  systemPrompt?: string | undefined;
8309
8322
  } | undefined;
8310
8323
  enableLipSync?: boolean | undefined;
8324
+ hidden?: boolean | undefined;
8311
8325
  }[];
8312
8326
  title?: string | undefined;
8313
8327
  description?: string | undefined;
@@ -8558,6 +8572,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8558
8572
  systemPrompt?: string | undefined;
8559
8573
  } | undefined;
8560
8574
  enableLipSync?: boolean | undefined;
8575
+ hidden?: boolean | undefined;
8561
8576
  }[];
8562
8577
  title?: string | undefined;
8563
8578
  description?: string | undefined;
@@ -39,9 +39,9 @@ export const speakerDictionarySchema = z.record(speakerIdSchema, speakerDataSche
39
39
  }));
40
40
  export const mediaSourceSchema = z.discriminatedUnion("kind", [
41
41
  z.object({ kind: z.literal("url"), url: URLStringSchema }).strict(), // https://example.com/foo.pdf
42
- z.object({ kind: z.literal("base64"), data: z.string() }).strict(), // base64
43
- z.object({ kind: z.literal("text"), text: z.string() }).strict(), // plain text
44
- z.object({ kind: z.literal("path"), path: z.string() }).strict(), // foo.pdf
42
+ z.object({ kind: z.literal("base64"), data: z.string().min(1) }).strict(), // base64
43
+ z.object({ kind: z.literal("text"), text: z.string().min(1) }).strict(), // plain text
44
+ z.object({ kind: z.literal("path"), path: z.string().min(1) }).strict(), // foo.pdf
45
45
  ]);
46
46
  // String is easier for AI, string array is easier for human
47
47
  const stringOrStringArray = z.union([z.string(), z.array(z.string())]);
@@ -286,6 +286,7 @@ export const mulmoBeatSchema = z
286
286
  soundEffectPrompt: z.string().optional(),
287
287
  htmlPrompt: htmlPromptParamsSchema.optional(),
288
288
  enableLipSync: z.boolean().optional().describe("Enable lip sync generation for this beat"),
289
+ hidden: z.boolean().optional().describe("Hide this beat from the presentation"),
289
290
  })
290
291
  .strict();
291
292
  export const mulmoCanvasDimensionSchema = z
@@ -290,6 +290,7 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
290
290
  systemPrompt?: string | undefined;
291
291
  } | undefined;
292
292
  enableLipSync?: boolean | undefined;
293
+ hidden?: boolean | undefined;
293
294
  }[];
294
295
  title?: string | undefined;
295
296
  description?: string | undefined;
@@ -625,6 +626,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
625
626
  systemPrompt?: string | undefined;
626
627
  } | undefined;
627
628
  enableLipSync?: boolean | undefined;
629
+ hidden?: boolean | undefined;
628
630
  }[];
629
631
  title?: string | undefined;
630
632
  description?: string | undefined;
@@ -53,6 +53,8 @@ const initSessionState = () => {
53
53
  export const createStudioData = (_mulmoScript, fileName, videoCaptionLang, presentationStyle) => {
54
54
  // validate and insert default value
55
55
  const mulmoScript = _mulmoScript.__test_invalid__ ? _mulmoScript : MulmoScriptMethods.validate(_mulmoScript);
56
+ // filter out hidden beats
57
+ mulmoScript.beats = mulmoScript.beats.filter((beat) => !beat.hidden);
56
58
  // We need to parse it to fill default values
57
59
  const studio = mulmoStudioSchema.parse({
58
60
  script: mulmoScript,
@@ -57,3 +57,4 @@ export declare const writingMessage: (filePath: string) => void;
57
57
  export declare const readAndParseJson: <S extends ZodSchema<any>>(filePath: string, schema: S) => ReturnType<S["parse"]>;
58
58
  export declare const generateTimestampedFileName: (prefix: string) => string;
59
59
  export declare const hashSHA256: (text: string) => string;
60
+ export declare const isFile: (filePath: string) => boolean;
package/lib/utils/file.js CHANGED
@@ -240,3 +240,11 @@ export const generateTimestampedFileName = (prefix) => {
240
240
  export const hashSHA256 = (text) => {
241
241
  return createHash("sha256").update(text, "utf8").digest("hex");
242
242
  };
243
+ export const isFile = (filePath) => {
244
+ try {
245
+ return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
246
+ }
247
+ catch {
248
+ return false;
249
+ }
250
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.41",
3
+ "version": "1.2.42",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -34,6 +34,19 @@
34
34
  }
35
35
  }
36
36
  },
37
+ {
38
+ "id": "hidden",
39
+ "hidden": true,
40
+ "speaker": "Presenter",
41
+ "text": "This is a hidden beat.",
42
+ "image": {
43
+ "type": "textSlide",
44
+ "slide": {
45
+ "title": "Hidden Beat",
46
+ "bullets": ["This is a hidden beat."]
47
+ }
48
+ }
49
+ },
37
50
  {
38
51
  "speaker": "Presenter",
39
52
  "text": "This is a reference beat.",