mulmocast 1.2.40 → 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.
@@ -288,8 +288,8 @@ export const audio = async (context, args) => {
288
288
  writingMessage(audioArtifactFilePath);
289
289
  return result.combineFiles;
290
290
  }
291
- catch (__error) {
291
+ catch (error) {
292
292
  MulmoStudioContextMethods.setSessionState(context, "audio", false, false);
293
- throw __error;
293
+ throw error;
294
294
  }
295
295
  };
@@ -8,4 +8,4 @@ export declare const getAudioPart: (inputIndex: number, duration: number, delay:
8
8
  audioPart: string;
9
9
  };
10
10
  export declare const movieFilePath: (context: MulmoStudioContext) => string;
11
- export declare const movie: (context: MulmoStudioContext) => Promise<void>;
11
+ export declare const movie: (context: MulmoStudioContext) => Promise<boolean>;
@@ -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
@@ -252,8 +253,10 @@ export const movie = async (context) => {
252
253
  writingMessage(outputVideoPath);
253
254
  }
254
255
  MulmoStudioContextMethods.setSessionState(context, "video", false, true);
256
+ return true;
255
257
  }
256
- catch (__error) {
258
+ catch (error) {
257
259
  MulmoStudioContextMethods.setSessionState(context, "video", false, false);
260
+ throw error;
258
261
  }
259
262
  };
@@ -1127,12 +1127,32 @@ export declare const mulmoGoogleImageModelSchema: z.ZodObject<{
1127
1127
  provider: "google";
1128
1128
  model?: string | undefined;
1129
1129
  }>;
1130
+ export declare const mulmoBeatImageParamsSchema: z.ZodObject<{
1131
+ provider: z.ZodOptional<z.ZodEnum<[string, ...string[]]>>;
1132
+ model: z.ZodOptional<z.ZodString>;
1133
+ quality: z.ZodOptional<z.ZodString>;
1134
+ style: z.ZodOptional<z.ZodString>;
1135
+ moderation: z.ZodOptional<z.ZodString>;
1136
+ }, "strict", z.ZodTypeAny, {
1137
+ provider?: string | undefined;
1138
+ model?: string | undefined;
1139
+ style?: string | undefined;
1140
+ quality?: string | undefined;
1141
+ moderation?: string | undefined;
1142
+ }, {
1143
+ provider?: string | undefined;
1144
+ model?: string | undefined;
1145
+ style?: string | undefined;
1146
+ quality?: string | undefined;
1147
+ moderation?: string | undefined;
1148
+ }>;
1130
1149
  export declare const mulmoImageParamsSchema: z.ZodObject<{
1131
1150
  provider: z.ZodOptional<z.ZodEnum<[string, ...string[]]>>;
1132
1151
  model: z.ZodOptional<z.ZodString>;
1133
1152
  quality: z.ZodOptional<z.ZodString>;
1134
1153
  style: z.ZodOptional<z.ZodString>;
1135
1154
  moderation: z.ZodOptional<z.ZodString>;
1155
+ } & {
1136
1156
  images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1137
1157
  type: z.ZodLiteral<"image">;
1138
1158
  source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -1954,130 +1974,13 @@ export declare const mulmoBeatSchema: z.ZodObject<{
1954
1974
  quality: z.ZodOptional<z.ZodString>;
1955
1975
  style: z.ZodOptional<z.ZodString>;
1956
1976
  moderation: z.ZodOptional<z.ZodString>;
1957
- images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1958
- type: z.ZodLiteral<"image">;
1959
- source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1960
- kind: z.ZodLiteral<"url">;
1961
- url: z.ZodString;
1962
- }, "strict", z.ZodTypeAny, {
1963
- url: string;
1964
- kind: "url";
1965
- }, {
1966
- url: string;
1967
- kind: "url";
1968
- }>, z.ZodObject<{
1969
- kind: z.ZodLiteral<"base64">;
1970
- data: z.ZodString;
1971
- }, "strict", z.ZodTypeAny, {
1972
- kind: "base64";
1973
- data: string;
1974
- }, {
1975
- kind: "base64";
1976
- data: string;
1977
- }>, z.ZodObject<{
1978
- kind: z.ZodLiteral<"text">;
1979
- text: z.ZodString;
1980
- }, "strict", z.ZodTypeAny, {
1981
- text: string;
1982
- kind: "text";
1983
- }, {
1984
- text: string;
1985
- kind: "text";
1986
- }>, z.ZodObject<{
1987
- kind: z.ZodLiteral<"path">;
1988
- path: z.ZodString;
1989
- }, "strict", z.ZodTypeAny, {
1990
- path: string;
1991
- kind: "path";
1992
- }, {
1993
- path: string;
1994
- kind: "path";
1995
- }>]>;
1996
- }, "strict", z.ZodTypeAny, {
1997
- type: "image";
1998
- source: {
1999
- url: string;
2000
- kind: "url";
2001
- } | {
2002
- kind: "base64";
2003
- data: string;
2004
- } | {
2005
- text: string;
2006
- kind: "text";
2007
- } | {
2008
- path: string;
2009
- kind: "path";
2010
- };
2011
- }, {
2012
- type: "image";
2013
- source: {
2014
- url: string;
2015
- kind: "url";
2016
- } | {
2017
- kind: "base64";
2018
- data: string;
2019
- } | {
2020
- text: string;
2021
- kind: "text";
2022
- } | {
2023
- path: string;
2024
- kind: "path";
2025
- };
2026
- }>, z.ZodObject<{
2027
- type: z.ZodLiteral<"imagePrompt">;
2028
- prompt: z.ZodString;
2029
- }, "strict", z.ZodTypeAny, {
2030
- type: "imagePrompt";
2031
- prompt: string;
2032
- }, {
2033
- type: "imagePrompt";
2034
- prompt: string;
2035
- }>]>>>;
2036
1977
  }, "strict", z.ZodTypeAny, {
2037
- images?: Record<string, {
2038
- type: "image";
2039
- source: {
2040
- url: string;
2041
- kind: "url";
2042
- } | {
2043
- kind: "base64";
2044
- data: string;
2045
- } | {
2046
- text: string;
2047
- kind: "text";
2048
- } | {
2049
- path: string;
2050
- kind: "path";
2051
- };
2052
- } | {
2053
- type: "imagePrompt";
2054
- prompt: string;
2055
- }> | undefined;
2056
1978
  provider?: string | undefined;
2057
1979
  model?: string | undefined;
2058
1980
  style?: string | undefined;
2059
1981
  quality?: string | undefined;
2060
1982
  moderation?: string | undefined;
2061
1983
  }, {
2062
- images?: Record<string, {
2063
- type: "image";
2064
- source: {
2065
- url: string;
2066
- kind: "url";
2067
- } | {
2068
- kind: "base64";
2069
- data: string;
2070
- } | {
2071
- text: string;
2072
- kind: "text";
2073
- } | {
2074
- path: string;
2075
- kind: "path";
2076
- };
2077
- } | {
2078
- type: "imagePrompt";
2079
- prompt: string;
2080
- }> | undefined;
2081
1984
  provider?: string | undefined;
2082
1985
  model?: string | undefined;
2083
1986
  style?: string | undefined;
@@ -2195,6 +2098,7 @@ export declare const mulmoBeatSchema: z.ZodObject<{
2195
2098
  systemPrompt?: string | undefined;
2196
2099
  }>>;
2197
2100
  enableLipSync: z.ZodOptional<z.ZodBoolean>;
2101
+ hidden: z.ZodOptional<z.ZodBoolean>;
2198
2102
  }, "strict", z.ZodTypeAny, {
2199
2103
  text: string;
2200
2104
  image?: {
@@ -2334,25 +2238,6 @@ export declare const mulmoBeatSchema: z.ZodObject<{
2334
2238
  speaker?: string | undefined;
2335
2239
  description?: string | undefined;
2336
2240
  imageParams?: {
2337
- images?: Record<string, {
2338
- type: "image";
2339
- source: {
2340
- url: string;
2341
- kind: "url";
2342
- } | {
2343
- kind: "base64";
2344
- data: string;
2345
- } | {
2346
- text: string;
2347
- kind: "text";
2348
- } | {
2349
- path: string;
2350
- kind: "path";
2351
- };
2352
- } | {
2353
- type: "imagePrompt";
2354
- prompt: string;
2355
- }> | undefined;
2356
2241
  provider?: string | undefined;
2357
2242
  model?: string | undefined;
2358
2243
  style?: string | undefined;
@@ -2399,6 +2284,7 @@ export declare const mulmoBeatSchema: z.ZodObject<{
2399
2284
  systemPrompt?: string | undefined;
2400
2285
  } | undefined;
2401
2286
  enableLipSync?: boolean | undefined;
2287
+ hidden?: boolean | undefined;
2402
2288
  }, {
2403
2289
  image?: {
2404
2290
  type: "markdown";
@@ -2538,25 +2424,6 @@ export declare const mulmoBeatSchema: z.ZodObject<{
2538
2424
  speaker?: string | undefined;
2539
2425
  description?: string | undefined;
2540
2426
  imageParams?: {
2541
- images?: Record<string, {
2542
- type: "image";
2543
- source: {
2544
- url: string;
2545
- kind: "url";
2546
- } | {
2547
- kind: "base64";
2548
- data: string;
2549
- } | {
2550
- text: string;
2551
- kind: "text";
2552
- } | {
2553
- path: string;
2554
- kind: "path";
2555
- };
2556
- } | {
2557
- type: "imagePrompt";
2558
- prompt: string;
2559
- }> | undefined;
2560
2427
  provider?: string | undefined;
2561
2428
  model?: string | undefined;
2562
2429
  style?: string | undefined;
@@ -2603,6 +2470,7 @@ export declare const mulmoBeatSchema: z.ZodObject<{
2603
2470
  systemPrompt?: string | undefined;
2604
2471
  } | undefined;
2605
2472
  enableLipSync?: boolean | undefined;
2473
+ hidden?: boolean | undefined;
2606
2474
  }>;
2607
2475
  export declare const mulmoCanvasDimensionSchema: z.ZodDefault<z.ZodObject<{
2608
2476
  width: z.ZodNumber;
@@ -2869,6 +2737,7 @@ export declare const mulmoPresentationStyleSchema: z.ZodObject<{
2869
2737
  quality: z.ZodOptional<z.ZodString>;
2870
2738
  style: z.ZodOptional<z.ZodString>;
2871
2739
  moderation: z.ZodOptional<z.ZodString>;
2740
+ } & {
2872
2741
  images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
2873
2742
  type: z.ZodLiteral<"image">;
2874
2743
  source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -3587,6 +3456,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
3587
3456
  quality: z.ZodOptional<z.ZodString>;
3588
3457
  style: z.ZodOptional<z.ZodString>;
3589
3458
  moderation: z.ZodOptional<z.ZodString>;
3459
+ } & {
3590
3460
  images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
3591
3461
  type: z.ZodLiteral<"image">;
3592
3462
  source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -4455,130 +4325,13 @@ export declare const mulmoScriptSchema: z.ZodObject<{
4455
4325
  quality: z.ZodOptional<z.ZodString>;
4456
4326
  style: z.ZodOptional<z.ZodString>;
4457
4327
  moderation: z.ZodOptional<z.ZodString>;
4458
- images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
4459
- type: z.ZodLiteral<"image">;
4460
- source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4461
- kind: z.ZodLiteral<"url">;
4462
- url: z.ZodString;
4463
- }, "strict", z.ZodTypeAny, {
4464
- url: string;
4465
- kind: "url";
4466
- }, {
4467
- url: string;
4468
- kind: "url";
4469
- }>, z.ZodObject<{
4470
- kind: z.ZodLiteral<"base64">;
4471
- data: z.ZodString;
4472
- }, "strict", z.ZodTypeAny, {
4473
- kind: "base64";
4474
- data: string;
4475
- }, {
4476
- kind: "base64";
4477
- data: string;
4478
- }>, z.ZodObject<{
4479
- kind: z.ZodLiteral<"text">;
4480
- text: z.ZodString;
4481
- }, "strict", z.ZodTypeAny, {
4482
- text: string;
4483
- kind: "text";
4484
- }, {
4485
- text: string;
4486
- kind: "text";
4487
- }>, z.ZodObject<{
4488
- kind: z.ZodLiteral<"path">;
4489
- path: z.ZodString;
4490
- }, "strict", z.ZodTypeAny, {
4491
- path: string;
4492
- kind: "path";
4493
- }, {
4494
- path: string;
4495
- kind: "path";
4496
- }>]>;
4497
- }, "strict", z.ZodTypeAny, {
4498
- type: "image";
4499
- source: {
4500
- url: string;
4501
- kind: "url";
4502
- } | {
4503
- kind: "base64";
4504
- data: string;
4505
- } | {
4506
- text: string;
4507
- kind: "text";
4508
- } | {
4509
- path: string;
4510
- kind: "path";
4511
- };
4512
- }, {
4513
- type: "image";
4514
- source: {
4515
- url: string;
4516
- kind: "url";
4517
- } | {
4518
- kind: "base64";
4519
- data: string;
4520
- } | {
4521
- text: string;
4522
- kind: "text";
4523
- } | {
4524
- path: string;
4525
- kind: "path";
4526
- };
4527
- }>, z.ZodObject<{
4528
- type: z.ZodLiteral<"imagePrompt">;
4529
- prompt: z.ZodString;
4530
- }, "strict", z.ZodTypeAny, {
4531
- type: "imagePrompt";
4532
- prompt: string;
4533
- }, {
4534
- type: "imagePrompt";
4535
- prompt: string;
4536
- }>]>>>;
4537
4328
  }, "strict", z.ZodTypeAny, {
4538
- images?: Record<string, {
4539
- type: "image";
4540
- source: {
4541
- url: string;
4542
- kind: "url";
4543
- } | {
4544
- kind: "base64";
4545
- data: string;
4546
- } | {
4547
- text: string;
4548
- kind: "text";
4549
- } | {
4550
- path: string;
4551
- kind: "path";
4552
- };
4553
- } | {
4554
- type: "imagePrompt";
4555
- prompt: string;
4556
- }> | undefined;
4557
4329
  provider?: string | undefined;
4558
4330
  model?: string | undefined;
4559
4331
  style?: string | undefined;
4560
4332
  quality?: string | undefined;
4561
4333
  moderation?: string | undefined;
4562
4334
  }, {
4563
- images?: Record<string, {
4564
- type: "image";
4565
- source: {
4566
- url: string;
4567
- kind: "url";
4568
- } | {
4569
- kind: "base64";
4570
- data: string;
4571
- } | {
4572
- text: string;
4573
- kind: "text";
4574
- } | {
4575
- path: string;
4576
- kind: "path";
4577
- };
4578
- } | {
4579
- type: "imagePrompt";
4580
- prompt: string;
4581
- }> | undefined;
4582
4335
  provider?: string | undefined;
4583
4336
  model?: string | undefined;
4584
4337
  style?: string | undefined;
@@ -4696,6 +4449,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
4696
4449
  systemPrompt?: string | undefined;
4697
4450
  }>>;
4698
4451
  enableLipSync: z.ZodOptional<z.ZodBoolean>;
4452
+ hidden: z.ZodOptional<z.ZodBoolean>;
4699
4453
  }, "strict", z.ZodTypeAny, {
4700
4454
  text: string;
4701
4455
  image?: {
@@ -4835,25 +4589,6 @@ export declare const mulmoScriptSchema: z.ZodObject<{
4835
4589
  speaker?: string | undefined;
4836
4590
  description?: string | undefined;
4837
4591
  imageParams?: {
4838
- images?: Record<string, {
4839
- type: "image";
4840
- source: {
4841
- url: string;
4842
- kind: "url";
4843
- } | {
4844
- kind: "base64";
4845
- data: string;
4846
- } | {
4847
- text: string;
4848
- kind: "text";
4849
- } | {
4850
- path: string;
4851
- kind: "path";
4852
- };
4853
- } | {
4854
- type: "imagePrompt";
4855
- prompt: string;
4856
- }> | undefined;
4857
4592
  provider?: string | undefined;
4858
4593
  model?: string | undefined;
4859
4594
  style?: string | undefined;
@@ -4900,6 +4635,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
4900
4635
  systemPrompt?: string | undefined;
4901
4636
  } | undefined;
4902
4637
  enableLipSync?: boolean | undefined;
4638
+ hidden?: boolean | undefined;
4903
4639
  }, {
4904
4640
  image?: {
4905
4641
  type: "markdown";
@@ -5039,25 +4775,6 @@ export declare const mulmoScriptSchema: z.ZodObject<{
5039
4775
  speaker?: string | undefined;
5040
4776
  description?: string | undefined;
5041
4777
  imageParams?: {
5042
- images?: Record<string, {
5043
- type: "image";
5044
- source: {
5045
- url: string;
5046
- kind: "url";
5047
- } | {
5048
- kind: "base64";
5049
- data: string;
5050
- } | {
5051
- text: string;
5052
- kind: "text";
5053
- } | {
5054
- path: string;
5055
- kind: "path";
5056
- };
5057
- } | {
5058
- type: "imagePrompt";
5059
- prompt: string;
5060
- }> | undefined;
5061
4778
  provider?: string | undefined;
5062
4779
  model?: string | undefined;
5063
4780
  style?: string | undefined;
@@ -5104,6 +4821,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
5104
4821
  systemPrompt?: string | undefined;
5105
4822
  } | undefined;
5106
4823
  enableLipSync?: boolean | undefined;
4824
+ hidden?: boolean | undefined;
5107
4825
  }>, "many">;
5108
4826
  imagePath: z.ZodOptional<z.ZodString>;
5109
4827
  __test_invalid__: z.ZodOptional<z.ZodBoolean>;
@@ -5332,25 +5050,6 @@ export declare const mulmoScriptSchema: z.ZodObject<{
5332
5050
  speaker?: string | undefined;
5333
5051
  description?: string | undefined;
5334
5052
  imageParams?: {
5335
- images?: Record<string, {
5336
- type: "image";
5337
- source: {
5338
- url: string;
5339
- kind: "url";
5340
- } | {
5341
- kind: "base64";
5342
- data: string;
5343
- } | {
5344
- text: string;
5345
- kind: "text";
5346
- } | {
5347
- path: string;
5348
- kind: "path";
5349
- };
5350
- } | {
5351
- type: "imagePrompt";
5352
- prompt: string;
5353
- }> | undefined;
5354
5053
  provider?: string | undefined;
5355
5054
  model?: string | undefined;
5356
5055
  style?: string | undefined;
@@ -5397,6 +5096,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
5397
5096
  systemPrompt?: string | undefined;
5398
5097
  } | undefined;
5399
5098
  enableLipSync?: boolean | undefined;
5099
+ hidden?: boolean | undefined;
5400
5100
  }[];
5401
5101
  title?: string | undefined;
5402
5102
  description?: string | undefined;
@@ -5579,25 +5279,6 @@ export declare const mulmoScriptSchema: z.ZodObject<{
5579
5279
  speaker?: string | undefined;
5580
5280
  description?: string | undefined;
5581
5281
  imageParams?: {
5582
- images?: Record<string, {
5583
- type: "image";
5584
- source: {
5585
- url: string;
5586
- kind: "url";
5587
- } | {
5588
- kind: "base64";
5589
- data: string;
5590
- } | {
5591
- text: string;
5592
- kind: "text";
5593
- } | {
5594
- path: string;
5595
- kind: "path";
5596
- };
5597
- } | {
5598
- type: "imagePrompt";
5599
- prompt: string;
5600
- }> | undefined;
5601
5282
  provider?: string | undefined;
5602
5283
  model?: string | undefined;
5603
5284
  style?: string | undefined;
@@ -5644,6 +5325,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
5644
5325
  systemPrompt?: string | undefined;
5645
5326
  } | undefined;
5646
5327
  enableLipSync?: boolean | undefined;
5328
+ hidden?: boolean | undefined;
5647
5329
  }[];
5648
5330
  title?: string | undefined;
5649
5331
  description?: string | undefined;
@@ -6304,6 +5986,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
6304
5986
  quality: z.ZodOptional<z.ZodString>;
6305
5987
  style: z.ZodOptional<z.ZodString>;
6306
5988
  moderation: z.ZodOptional<z.ZodString>;
5989
+ } & {
6307
5990
  images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
6308
5991
  type: z.ZodLiteral<"image">;
6309
5992
  source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -7172,130 +6855,13 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7172
6855
  quality: z.ZodOptional<z.ZodString>;
7173
6856
  style: z.ZodOptional<z.ZodString>;
7174
6857
  moderation: z.ZodOptional<z.ZodString>;
7175
- images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
7176
- type: z.ZodLiteral<"image">;
7177
- source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
7178
- kind: z.ZodLiteral<"url">;
7179
- url: z.ZodString;
7180
- }, "strict", z.ZodTypeAny, {
7181
- url: string;
7182
- kind: "url";
7183
- }, {
7184
- url: string;
7185
- kind: "url";
7186
- }>, z.ZodObject<{
7187
- kind: z.ZodLiteral<"base64">;
7188
- data: z.ZodString;
7189
- }, "strict", z.ZodTypeAny, {
7190
- kind: "base64";
7191
- data: string;
7192
- }, {
7193
- kind: "base64";
7194
- data: string;
7195
- }>, z.ZodObject<{
7196
- kind: z.ZodLiteral<"text">;
7197
- text: z.ZodString;
7198
- }, "strict", z.ZodTypeAny, {
7199
- text: string;
7200
- kind: "text";
7201
- }, {
7202
- text: string;
7203
- kind: "text";
7204
- }>, z.ZodObject<{
7205
- kind: z.ZodLiteral<"path">;
7206
- path: z.ZodString;
7207
- }, "strict", z.ZodTypeAny, {
7208
- path: string;
7209
- kind: "path";
7210
- }, {
7211
- path: string;
7212
- kind: "path";
7213
- }>]>;
7214
- }, "strict", z.ZodTypeAny, {
7215
- type: "image";
7216
- source: {
7217
- url: string;
7218
- kind: "url";
7219
- } | {
7220
- kind: "base64";
7221
- data: string;
7222
- } | {
7223
- text: string;
7224
- kind: "text";
7225
- } | {
7226
- path: string;
7227
- kind: "path";
7228
- };
7229
- }, {
7230
- type: "image";
7231
- source: {
7232
- url: string;
7233
- kind: "url";
7234
- } | {
7235
- kind: "base64";
7236
- data: string;
7237
- } | {
7238
- text: string;
7239
- kind: "text";
7240
- } | {
7241
- path: string;
7242
- kind: "path";
7243
- };
7244
- }>, z.ZodObject<{
7245
- type: z.ZodLiteral<"imagePrompt">;
7246
- prompt: z.ZodString;
7247
- }, "strict", z.ZodTypeAny, {
7248
- type: "imagePrompt";
7249
- prompt: string;
7250
- }, {
7251
- type: "imagePrompt";
7252
- prompt: string;
7253
- }>]>>>;
7254
6858
  }, "strict", z.ZodTypeAny, {
7255
- images?: Record<string, {
7256
- type: "image";
7257
- source: {
7258
- url: string;
7259
- kind: "url";
7260
- } | {
7261
- kind: "base64";
7262
- data: string;
7263
- } | {
7264
- text: string;
7265
- kind: "text";
7266
- } | {
7267
- path: string;
7268
- kind: "path";
7269
- };
7270
- } | {
7271
- type: "imagePrompt";
7272
- prompt: string;
7273
- }> | undefined;
7274
6859
  provider?: string | undefined;
7275
6860
  model?: string | undefined;
7276
6861
  style?: string | undefined;
7277
6862
  quality?: string | undefined;
7278
6863
  moderation?: string | undefined;
7279
6864
  }, {
7280
- images?: Record<string, {
7281
- type: "image";
7282
- source: {
7283
- url: string;
7284
- kind: "url";
7285
- } | {
7286
- kind: "base64";
7287
- data: string;
7288
- } | {
7289
- text: string;
7290
- kind: "text";
7291
- } | {
7292
- path: string;
7293
- kind: "path";
7294
- };
7295
- } | {
7296
- type: "imagePrompt";
7297
- prompt: string;
7298
- }> | undefined;
7299
6865
  provider?: string | undefined;
7300
6866
  model?: string | undefined;
7301
6867
  style?: string | undefined;
@@ -7413,6 +6979,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7413
6979
  systemPrompt?: string | undefined;
7414
6980
  }>>;
7415
6981
  enableLipSync: z.ZodOptional<z.ZodBoolean>;
6982
+ hidden: z.ZodOptional<z.ZodBoolean>;
7416
6983
  }, "strict", z.ZodTypeAny, {
7417
6984
  text: string;
7418
6985
  image?: {
@@ -7552,25 +7119,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7552
7119
  speaker?: string | undefined;
7553
7120
  description?: string | undefined;
7554
7121
  imageParams?: {
7555
- images?: Record<string, {
7556
- type: "image";
7557
- source: {
7558
- url: string;
7559
- kind: "url";
7560
- } | {
7561
- kind: "base64";
7562
- data: string;
7563
- } | {
7564
- text: string;
7565
- kind: "text";
7566
- } | {
7567
- path: string;
7568
- kind: "path";
7569
- };
7570
- } | {
7571
- type: "imagePrompt";
7572
- prompt: string;
7573
- }> | undefined;
7574
7122
  provider?: string | undefined;
7575
7123
  model?: string | undefined;
7576
7124
  style?: string | undefined;
@@ -7617,6 +7165,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7617
7165
  systemPrompt?: string | undefined;
7618
7166
  } | undefined;
7619
7167
  enableLipSync?: boolean | undefined;
7168
+ hidden?: boolean | undefined;
7620
7169
  }, {
7621
7170
  image?: {
7622
7171
  type: "markdown";
@@ -7756,25 +7305,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7756
7305
  speaker?: string | undefined;
7757
7306
  description?: string | undefined;
7758
7307
  imageParams?: {
7759
- images?: Record<string, {
7760
- type: "image";
7761
- source: {
7762
- url: string;
7763
- kind: "url";
7764
- } | {
7765
- kind: "base64";
7766
- data: string;
7767
- } | {
7768
- text: string;
7769
- kind: "text";
7770
- } | {
7771
- path: string;
7772
- kind: "path";
7773
- };
7774
- } | {
7775
- type: "imagePrompt";
7776
- prompt: string;
7777
- }> | undefined;
7778
7308
  provider?: string | undefined;
7779
7309
  model?: string | undefined;
7780
7310
  style?: string | undefined;
@@ -7821,6 +7351,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
7821
7351
  systemPrompt?: string | undefined;
7822
7352
  } | undefined;
7823
7353
  enableLipSync?: boolean | undefined;
7354
+ hidden?: boolean | undefined;
7824
7355
  }>, "many">;
7825
7356
  imagePath: z.ZodOptional<z.ZodString>;
7826
7357
  __test_invalid__: z.ZodOptional<z.ZodBoolean>;
@@ -8049,25 +7580,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8049
7580
  speaker?: string | undefined;
8050
7581
  description?: string | undefined;
8051
7582
  imageParams?: {
8052
- images?: Record<string, {
8053
- type: "image";
8054
- source: {
8055
- url: string;
8056
- kind: "url";
8057
- } | {
8058
- kind: "base64";
8059
- data: string;
8060
- } | {
8061
- text: string;
8062
- kind: "text";
8063
- } | {
8064
- path: string;
8065
- kind: "path";
8066
- };
8067
- } | {
8068
- type: "imagePrompt";
8069
- prompt: string;
8070
- }> | undefined;
8071
7583
  provider?: string | undefined;
8072
7584
  model?: string | undefined;
8073
7585
  style?: string | undefined;
@@ -8114,6 +7626,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8114
7626
  systemPrompt?: string | undefined;
8115
7627
  } | undefined;
8116
7628
  enableLipSync?: boolean | undefined;
7629
+ hidden?: boolean | undefined;
8117
7630
  }[];
8118
7631
  title?: string | undefined;
8119
7632
  description?: string | undefined;
@@ -8296,25 +7809,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8296
7809
  speaker?: string | undefined;
8297
7810
  description?: string | undefined;
8298
7811
  imageParams?: {
8299
- images?: Record<string, {
8300
- type: "image";
8301
- source: {
8302
- url: string;
8303
- kind: "url";
8304
- } | {
8305
- kind: "base64";
8306
- data: string;
8307
- } | {
8308
- text: string;
8309
- kind: "text";
8310
- } | {
8311
- path: string;
8312
- kind: "path";
8313
- };
8314
- } | {
8315
- type: "imagePrompt";
8316
- prompt: string;
8317
- }> | undefined;
8318
7812
  provider?: string | undefined;
8319
7813
  model?: string | undefined;
8320
7814
  style?: string | undefined;
@@ -8361,6 +7855,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8361
7855
  systemPrompt?: string | undefined;
8362
7856
  } | undefined;
8363
7857
  enableLipSync?: boolean | undefined;
7858
+ hidden?: boolean | undefined;
8364
7859
  }[];
8365
7860
  title?: string | undefined;
8366
7861
  description?: string | undefined;
@@ -8780,25 +8275,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8780
8275
  speaker?: string | undefined;
8781
8276
  description?: string | undefined;
8782
8277
  imageParams?: {
8783
- images?: Record<string, {
8784
- type: "image";
8785
- source: {
8786
- url: string;
8787
- kind: "url";
8788
- } | {
8789
- kind: "base64";
8790
- data: string;
8791
- } | {
8792
- text: string;
8793
- kind: "text";
8794
- } | {
8795
- path: string;
8796
- kind: "path";
8797
- };
8798
- } | {
8799
- type: "imagePrompt";
8800
- prompt: string;
8801
- }> | undefined;
8802
8278
  provider?: string | undefined;
8803
8279
  model?: string | undefined;
8804
8280
  style?: string | undefined;
@@ -8845,6 +8321,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
8845
8321
  systemPrompt?: string | undefined;
8846
8322
  } | undefined;
8847
8323
  enableLipSync?: boolean | undefined;
8324
+ hidden?: boolean | undefined;
8848
8325
  }[];
8849
8326
  title?: string | undefined;
8850
8327
  description?: string | undefined;
@@ -9049,25 +8526,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
9049
8526
  speaker?: string | undefined;
9050
8527
  description?: string | undefined;
9051
8528
  imageParams?: {
9052
- images?: Record<string, {
9053
- type: "image";
9054
- source: {
9055
- url: string;
9056
- kind: "url";
9057
- } | {
9058
- kind: "base64";
9059
- data: string;
9060
- } | {
9061
- text: string;
9062
- kind: "text";
9063
- } | {
9064
- path: string;
9065
- kind: "path";
9066
- };
9067
- } | {
9068
- type: "imagePrompt";
9069
- prompt: string;
9070
- }> | undefined;
9071
8529
  provider?: string | undefined;
9072
8530
  model?: string | undefined;
9073
8531
  style?: string | undefined;
@@ -9114,6 +8572,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
9114
8572
  systemPrompt?: string | undefined;
9115
8573
  } | undefined;
9116
8574
  enableLipSync?: boolean | undefined;
8575
+ hidden?: boolean | undefined;
9117
8576
  }[];
9118
8577
  title?: string | undefined;
9119
8578
  description?: string | undefined;
@@ -9411,6 +8870,7 @@ export declare const mulmoPromptTemplateSchema: z.ZodObject<{
9411
8870
  quality: z.ZodOptional<z.ZodString>;
9412
8871
  style: z.ZodOptional<z.ZodString>;
9413
8872
  moderation: z.ZodOptional<z.ZodString>;
8873
+ } & {
9414
8874
  images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
9415
8875
  type: z.ZodLiteral<"image">;
9416
8876
  source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -10353,6 +9813,7 @@ export declare const mulmoPromptTemplateFileSchema: z.ZodObject<{
10353
9813
  quality: z.ZodOptional<z.ZodString>;
10354
9814
  style: z.ZodOptional<z.ZodString>;
10355
9815
  moderation: z.ZodOptional<z.ZodString>;
9816
+ } & {
10356
9817
  images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
10357
9818
  type: z.ZodLiteral<"image">;
10358
9819
  source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -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())]);
@@ -194,13 +194,17 @@ export const mulmoGoogleImageModelSchema = z
194
194
  model: z.enum(provider2ImageAgent["google"].models).optional(),
195
195
  })
196
196
  .strict();
197
- export const mulmoImageParamsSchema = z
197
+ export const mulmoBeatImageParamsSchema = z
198
198
  .object({
199
199
  provider: text2ImageProviderSchema, // has no default value (do not change it)
200
200
  model: z.string().optional(), // default: provider specific
201
201
  quality: z.string().optional(), // optional image quality (model specific)
202
202
  style: z.string().optional(), // optional image style
203
203
  moderation: z.string().optional(), // optional image style
204
+ })
205
+ .strict();
206
+ export const mulmoImageParamsSchema = mulmoBeatImageParamsSchema
207
+ .extend({
204
208
  images: mulmoImageParamsImagesSchema.optional(),
205
209
  })
206
210
  .strict();
@@ -260,7 +264,7 @@ export const mulmoBeatSchema = z
260
264
  image: mulmoImageAssetSchema.optional(),
261
265
  audio: mulmoAudioAssetSchema.optional(),
262
266
  duration: z.number().optional().describe("Duration of the beat. Used only when the text is empty"),
263
- imageParams: mulmoImageParamsSchema.optional(), // beat specific parameters
267
+ imageParams: mulmoBeatImageParamsSchema.optional(), // beat specific parameters
264
268
  audioParams: beatAudioParamsSchema.optional(), // beat specific parameters
265
269
  movieParams: z
266
270
  .object({
@@ -282,6 +286,7 @@ export const mulmoBeatSchema = z
282
286
  soundEffectPrompt: z.string().optional(),
283
287
  htmlPrompt: htmlPromptParamsSchema.optional(),
284
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"),
285
290
  })
286
291
  .strict();
287
292
  export const mulmoCanvasDimensionSchema = z
@@ -244,25 +244,6 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
244
244
  speaker?: string | undefined;
245
245
  description?: string | undefined;
246
246
  imageParams?: {
247
- images?: Record<string, {
248
- type: "image";
249
- source: {
250
- url: string;
251
- kind: "url";
252
- } | {
253
- kind: "base64";
254
- data: string;
255
- } | {
256
- text: string;
257
- kind: "text";
258
- } | {
259
- path: string;
260
- kind: "path";
261
- };
262
- } | {
263
- type: "imagePrompt";
264
- prompt: string;
265
- }> | undefined;
266
247
  provider?: string | undefined;
267
248
  model?: string | undefined;
268
249
  style?: string | undefined;
@@ -309,6 +290,7 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
309
290
  systemPrompt?: string | undefined;
310
291
  } | undefined;
311
292
  enableLipSync?: boolean | undefined;
293
+ hidden?: boolean | undefined;
312
294
  }[];
313
295
  title?: string | undefined;
314
296
  description?: string | undefined;
@@ -598,25 +580,6 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
598
580
  speaker?: string | undefined;
599
581
  description?: string | undefined;
600
582
  imageParams?: {
601
- images?: Record<string, {
602
- type: "image";
603
- source: {
604
- url: string;
605
- kind: "url";
606
- } | {
607
- kind: "base64";
608
- data: string;
609
- } | {
610
- text: string;
611
- kind: "text";
612
- } | {
613
- path: string;
614
- kind: "path";
615
- };
616
- } | {
617
- type: "imagePrompt";
618
- prompt: string;
619
- }> | undefined;
620
583
  provider?: string | undefined;
621
584
  model?: string | undefined;
622
585
  style?: string | undefined;
@@ -663,6 +626,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
663
626
  systemPrompt?: string | undefined;
664
627
  } | undefined;
665
628
  enableLipSync?: boolean | undefined;
629
+ hidden?: boolean | undefined;
666
630
  }[];
667
631
  title?: string | undefined;
668
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
@@ -199,7 +199,9 @@ const getPromptTemplates = (dirPath, schema) => {
199
199
  return [];
200
200
  }
201
201
  const files = fs.readdirSync(templatesDir);
202
- return files.map((file) => {
202
+ return files
203
+ .filter((file) => file.endsWith(".json"))
204
+ .map((file) => {
203
205
  try {
204
206
  const promptTemplate = JSON.parse(fs.readFileSync(path.resolve(templatesDir, file), "utf-8"));
205
207
  return {
@@ -238,3 +240,11 @@ export const generateTimestampedFileName = (prefix) => {
238
240
  export const hashSHA256 = (text) => {
239
241
  return createHash("sha256").update(text, "utf8").digest("hex");
240
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.40",
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.",