mulmocast 0.0.1 → 0.0.3
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.
- package/README.md +129 -15
- package/assets/font/NotoSansJP-Regular.ttf +0 -0
- package/assets/html/chart.html +38 -0
- package/assets/html/mermaid.html +51 -0
- package/assets/templates/business.json +57 -14
- package/assets/templates/children_book.json +1 -3
- package/assets/templates/coding.json +140 -0
- package/lib/actions/audio.d.ts +2 -2
- package/lib/actions/audio.js +88 -101
- package/lib/actions/images.d.ts +1 -1
- package/lib/actions/images.js +50 -88
- package/lib/actions/index.d.ts +5 -0
- package/lib/actions/index.js +5 -0
- package/lib/actions/movie.d.ts +9 -1
- package/lib/actions/movie.js +124 -65
- package/lib/actions/pdf.d.ts +2 -0
- package/lib/actions/pdf.js +211 -0
- package/lib/actions/pdf2.d.ts +2 -0
- package/lib/actions/pdf2.js +203 -0
- package/lib/actions/translate.d.ts +1 -1
- package/lib/actions/translate.js +38 -61
- package/lib/agents/add_bgm_agent.d.ts +1 -1
- package/lib/agents/add_bgm_agent.js +10 -14
- package/lib/agents/anthropic_agent.d.ts +23 -0
- package/lib/agents/anthropic_agent.js +162 -0
- package/lib/agents/combine_audio_files_agent.d.ts +1 -1
- package/lib/agents/combine_audio_files_agent.js +33 -32
- package/lib/agents/image_google_agent.d.ts +1 -1
- package/lib/agents/image_google_agent.js +8 -11
- package/lib/agents/image_openai_agent.js +7 -14
- package/lib/agents/index.d.ts +8 -8
- package/lib/agents/index.js +13 -30
- package/lib/agents/mulmo_prompts_agent.d.ts +1 -1
- package/lib/agents/mulmo_prompts_agent.js +7 -11
- package/lib/agents/nested_agent.d.ts +9 -0
- package/lib/agents/nested_agent.js +138 -0
- package/lib/agents/prompts_data.js +1 -4
- package/lib/agents/tts_nijivoice_agent.d.ts +1 -1
- package/lib/agents/tts_nijivoice_agent.js +8 -12
- package/lib/agents/tts_openai_agent.js +9 -16
- package/lib/agents/validate_mulmo_script_agent.d.ts +1 -1
- package/lib/agents/validate_mulmo_script_agent.js +6 -10
- package/lib/cli/args.d.ts +5 -2
- package/lib/cli/args.js +52 -35
- package/lib/cli/cli.d.ts +14 -0
- package/lib/cli/cli.js +74 -57
- package/lib/cli/common.js +1 -5
- package/lib/cli/tool-args.d.ts +4 -1
- package/lib/cli/tool-args.js +29 -18
- package/lib/cli/tool-cli.js +34 -51
- package/lib/methods/index.d.ts +4 -3
- package/lib/methods/index.js +4 -19
- package/lib/methods/mulmo_media_source.d.ts +4 -0
- package/lib/methods/mulmo_media_source.js +21 -0
- package/lib/methods/mulmo_script.d.ts +6 -5
- package/lib/methods/mulmo_script.js +29 -16
- package/lib/methods/mulmo_script_template.d.ts +1 -1
- package/lib/methods/mulmo_script_template.js +4 -10
- package/lib/methods/mulmo_studio_context.d.ts +1 -1
- package/lib/methods/mulmo_studio_context.js +3 -9
- package/lib/tools/create_mulmo_script_from_url.d.ts +3 -0
- package/lib/tools/create_mulmo_script_from_url.js +152 -0
- package/lib/tools/create_mulmo_script_interactively.d.ts +3 -0
- package/lib/tools/create_mulmo_script_interactively.js +258 -0
- package/lib/tools/dump_prompt.js +5 -8
- package/lib/tools/prompt.js +9 -11
- package/lib/tools/seed_from_url2.d.ts +3 -0
- package/lib/tools/seed_from_url2.js +154 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.js +2 -17
- package/lib/types/schema.d.ts +3624 -2798
- package/lib/types/schema.js +172 -123
- package/lib/types/type.d.ts +34 -3
- package/lib/types/type.js +1 -2
- package/lib/utils/const.d.ts +4 -1
- package/lib/utils/const.js +6 -6
- package/lib/utils/file.d.ts +22 -4
- package/lib/utils/file.js +100 -79
- package/lib/utils/filters.d.ts +1 -0
- package/lib/utils/filters.js +47 -26
- package/lib/utils/image_plugins/chart.d.ts +3 -0
- package/lib/utils/image_plugins/chart.js +18 -0
- package/lib/utils/image_plugins/image.d.ts +2 -0
- package/lib/utils/image_plugins/image.js +3 -0
- package/lib/utils/image_plugins/index.d.ts +7 -0
- package/lib/utils/image_plugins/index.js +7 -0
- package/lib/utils/image_plugins/markdown.d.ts +3 -0
- package/lib/utils/image_plugins/markdown.js +11 -0
- package/lib/utils/image_plugins/mermaid.d.ts +3 -0
- package/lib/utils/image_plugins/mermaid.js +21 -0
- package/lib/utils/image_plugins/movie.d.ts +2 -0
- package/lib/utils/image_plugins/movie.js +3 -0
- package/lib/utils/image_plugins/source.d.ts +4 -0
- package/lib/utils/image_plugins/source.js +15 -0
- package/lib/utils/image_plugins/text_slide.d.ts +3 -0
- package/lib/utils/image_plugins/text_slide.js +12 -0
- package/lib/utils/image_plugins/type_guards.d.ts +6 -0
- package/lib/utils/image_plugins/type_guards.js +21 -0
- package/lib/utils/image_preprocess.d.ts +14 -0
- package/lib/utils/image_preprocess.js +52 -0
- package/lib/utils/inquirer.d.ts +2 -0
- package/lib/utils/inquirer.js +33 -0
- package/lib/utils/markdown.d.ts +3 -1
- package/lib/utils/markdown.js +20 -19
- package/lib/utils/pdf.d.ts +8 -0
- package/lib/utils/pdf.js +75 -0
- package/lib/utils/plugins.d.ts +5 -0
- package/lib/utils/plugins.js +11 -0
- package/lib/utils/preprocess.d.ts +70 -123
- package/lib/utils/preprocess.js +37 -43
- package/lib/utils/string.js +4 -10
- package/lib/utils/text_hash.js +2 -39
- package/lib/utils/utils.d.ts +12 -0
- package/lib/utils/utils.js +34 -0
- package/package.json +23 -8
package/lib/types/schema.js
CHANGED
|
@@ -1,207 +1,256 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.object({
|
|
9
|
-
text: zod_1.z.string(),
|
|
10
|
-
lang: zod_1.z.string(),
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const langSchema = z.string();
|
|
3
|
+
const URLStringSchema = z.string().url();
|
|
4
|
+
export const localizedTextSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
text: z.string(),
|
|
7
|
+
lang: z.string(),
|
|
11
8
|
// caption: z.string(),
|
|
12
|
-
texts:
|
|
13
|
-
ttsTexts:
|
|
14
|
-
duration:
|
|
9
|
+
texts: z.array(z.string()).optional(),
|
|
10
|
+
ttsTexts: z.array(z.string()).optional(),
|
|
11
|
+
duration: z.number().optional(), // generated // video duration time(ms)
|
|
15
12
|
// filename: z.string().optional(), // generated //
|
|
16
13
|
})
|
|
17
14
|
.strict();
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export const multiLingualTextsSchema = z.record(langSchema, localizedTextSchema);
|
|
16
|
+
export const speechOptionsSchema = z
|
|
20
17
|
.object({
|
|
21
|
-
speed:
|
|
22
|
-
instruction:
|
|
18
|
+
speed: z.number().optional(), // default: 1.0
|
|
19
|
+
instruction: z.string().optional(),
|
|
23
20
|
})
|
|
24
21
|
.strict();
|
|
25
|
-
const speakerIdSchema =
|
|
26
|
-
const speakerDataSchema =
|
|
22
|
+
const speakerIdSchema = z.string();
|
|
23
|
+
const speakerDataSchema = z
|
|
27
24
|
.object({
|
|
28
|
-
displayName:
|
|
29
|
-
voiceId:
|
|
30
|
-
speechOptions:
|
|
25
|
+
displayName: z.record(langSchema, z.string()).optional(),
|
|
26
|
+
voiceId: z.string(),
|
|
27
|
+
speechOptions: speechOptionsSchema.optional(),
|
|
31
28
|
})
|
|
32
29
|
.strict();
|
|
33
|
-
|
|
34
|
-
const mediaSourceSchema =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
export const speakerDictionarySchema = z.record(speakerIdSchema, speakerDataSchema);
|
|
31
|
+
export const mediaSourceSchema = z.discriminatedUnion("kind", [
|
|
32
|
+
z.object({ kind: z.literal("url"), url: URLStringSchema }).strict(), // https://example.com/foo.pdf
|
|
33
|
+
z.object({ kind: z.literal("base64"), data: z.string() }).strict(), // base64
|
|
34
|
+
z.object({ kind: z.literal("text"), text: z.string() }).strict(), // plain text
|
|
35
|
+
z.object({ kind: z.literal("path"), path: z.string() }).strict(), // foo.pdf
|
|
38
36
|
]);
|
|
39
37
|
// String is easier for AI, string array is easier for human
|
|
40
|
-
const stringOrStringArray =
|
|
41
|
-
const
|
|
38
|
+
const stringOrStringArray = z.union([z.string(), z.array(z.string())]);
|
|
39
|
+
export const mulmoMarkdownMediaSchema = z
|
|
42
40
|
.object({
|
|
43
|
-
type:
|
|
41
|
+
type: z.literal("markdown"),
|
|
44
42
|
markdown: stringOrStringArray,
|
|
45
43
|
})
|
|
46
44
|
.strict();
|
|
47
|
-
const
|
|
45
|
+
const mulmoWebMediaSchema = z
|
|
48
46
|
.object({
|
|
49
|
-
type:
|
|
47
|
+
type: z.literal("web"),
|
|
50
48
|
url: URLStringSchema,
|
|
51
49
|
})
|
|
52
50
|
.strict();
|
|
53
|
-
const
|
|
51
|
+
const mulmoPdfMediaSchema = z
|
|
54
52
|
.object({
|
|
55
|
-
type:
|
|
53
|
+
type: z.literal("pdf"),
|
|
56
54
|
source: mediaSourceSchema,
|
|
57
55
|
})
|
|
58
56
|
.strict();
|
|
59
|
-
const
|
|
57
|
+
export const mulmoImageMediaSchema = z
|
|
60
58
|
.object({
|
|
61
|
-
type:
|
|
59
|
+
type: z.literal("image"),
|
|
62
60
|
source: mediaSourceSchema,
|
|
63
61
|
})
|
|
64
62
|
.strict();
|
|
65
|
-
const
|
|
63
|
+
const mulmoSvgMediaSchema = z
|
|
66
64
|
.object({
|
|
67
|
-
type:
|
|
65
|
+
type: z.literal("svg"),
|
|
68
66
|
source: mediaSourceSchema,
|
|
69
67
|
})
|
|
70
68
|
.strict();
|
|
71
|
-
const
|
|
69
|
+
const mulmoMovieMediaSchema = z
|
|
72
70
|
.object({
|
|
73
|
-
type:
|
|
71
|
+
type: z.literal("movie"),
|
|
74
72
|
source: mediaSourceSchema,
|
|
75
73
|
})
|
|
76
74
|
.strict();
|
|
77
|
-
const
|
|
75
|
+
export const mulmoTextSlideMediaSchema = z
|
|
78
76
|
.object({
|
|
79
|
-
type:
|
|
80
|
-
slide:
|
|
81
|
-
title:
|
|
82
|
-
bullets:
|
|
77
|
+
type: z.literal("textSlide"),
|
|
78
|
+
slide: z.object({
|
|
79
|
+
title: z.string(),
|
|
80
|
+
bullets: z.array(z.string()),
|
|
83
81
|
}),
|
|
84
82
|
})
|
|
85
83
|
.strict();
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
export const mulmoChartMediaSchema = z
|
|
85
|
+
.object({
|
|
86
|
+
type: z.literal("chart"),
|
|
87
|
+
title: z.string(),
|
|
88
|
+
chartData: z.record(z.any()),
|
|
89
|
+
})
|
|
90
|
+
.strict();
|
|
91
|
+
export const mulmoMermaidMediaSchema = z
|
|
92
|
+
.object({
|
|
93
|
+
type: z.literal("mermaid"),
|
|
94
|
+
title: z.string().describe("The title of the diagram"),
|
|
95
|
+
code: mediaSourceSchema.describe("The code of the mermaid diagram"),
|
|
96
|
+
appendix: z.array(z.string()).optional().describe("The appendix of the mermaid diagram; typically, style information."),
|
|
97
|
+
})
|
|
98
|
+
.strict();
|
|
99
|
+
export const mulmoImageAssetSchema = z.union([
|
|
100
|
+
mulmoMarkdownMediaSchema,
|
|
101
|
+
mulmoWebMediaSchema,
|
|
102
|
+
mulmoPdfMediaSchema,
|
|
103
|
+
mulmoImageMediaSchema,
|
|
104
|
+
mulmoSvgMediaSchema,
|
|
105
|
+
mulmoMovieMediaSchema,
|
|
106
|
+
mulmoTextSlideMediaSchema,
|
|
107
|
+
mulmoChartMediaSchema,
|
|
108
|
+
mulmoMermaidMediaSchema,
|
|
94
109
|
]);
|
|
95
|
-
const
|
|
110
|
+
const mulmoAudioMediaSchema = z
|
|
96
111
|
.object({
|
|
97
|
-
type:
|
|
112
|
+
type: z.literal("audio"),
|
|
98
113
|
source: mediaSourceSchema,
|
|
99
114
|
})
|
|
100
115
|
.strict();
|
|
101
|
-
const
|
|
116
|
+
const mulmoMidiMediaSchema = z
|
|
102
117
|
.object({
|
|
103
|
-
type:
|
|
104
|
-
source:
|
|
118
|
+
type: z.literal("midi"),
|
|
119
|
+
source: z.string(), // TODO: define it later
|
|
105
120
|
})
|
|
106
121
|
.strict();
|
|
107
|
-
|
|
108
|
-
|
|
122
|
+
export const mulmoAudioAssetSchema = z.union([mulmoAudioMediaSchema, mulmoMidiMediaSchema]);
|
|
123
|
+
export const mulmoImageParamsSchema = z
|
|
109
124
|
.object({
|
|
110
|
-
model:
|
|
111
|
-
size:
|
|
112
|
-
style:
|
|
113
|
-
moderation:
|
|
125
|
+
model: z.string().optional(), // default: provider specific
|
|
126
|
+
size: z.string().optional(), // default: provider specific
|
|
127
|
+
style: z.string().optional(), // optional image style
|
|
128
|
+
moderation: z.string().optional(), // optional image style
|
|
114
129
|
})
|
|
115
130
|
.strict();
|
|
116
|
-
|
|
131
|
+
export const textSlideParamsSchema = z
|
|
117
132
|
.object({
|
|
118
|
-
cssStyles:
|
|
133
|
+
cssStyles: stringOrStringArray,
|
|
119
134
|
})
|
|
120
135
|
.strict();
|
|
121
|
-
|
|
136
|
+
export const videoParamsSchema = z
|
|
122
137
|
.object({
|
|
123
|
-
padding:
|
|
138
|
+
padding: z.number().optional(), // msec
|
|
124
139
|
})
|
|
125
140
|
.strict();
|
|
126
|
-
|
|
141
|
+
export const mulmoBeatSchema = z
|
|
127
142
|
.object({
|
|
128
|
-
speaker: speakerIdSchema,
|
|
129
|
-
text:
|
|
130
|
-
image:
|
|
131
|
-
audio:
|
|
132
|
-
imageParams:
|
|
133
|
-
speechOptions:
|
|
134
|
-
textSlideParams:
|
|
135
|
-
imagePrompt:
|
|
143
|
+
speaker: speakerIdSchema.default("Presenter"),
|
|
144
|
+
text: z.string(),
|
|
145
|
+
image: mulmoImageAssetSchema.optional(),
|
|
146
|
+
audio: mulmoAudioAssetSchema.optional(),
|
|
147
|
+
imageParams: mulmoImageParamsSchema.optional(), // beat specific parameters
|
|
148
|
+
speechOptions: speechOptionsSchema.optional(),
|
|
149
|
+
textSlideParams: textSlideParamsSchema.optional(),
|
|
150
|
+
imagePrompt: z.string().optional(), // specified or inserted by preprocessor
|
|
136
151
|
})
|
|
137
152
|
.strict();
|
|
138
|
-
|
|
153
|
+
export const mulmoCanvasDimensionSchema = z
|
|
139
154
|
.object({
|
|
140
|
-
width:
|
|
141
|
-
height:
|
|
155
|
+
width: z.number(),
|
|
156
|
+
height: z.number(),
|
|
142
157
|
})
|
|
143
|
-
.
|
|
158
|
+
.default({ width: 1280, height: 720 });
|
|
144
159
|
// export const voiceMapSchema = z.record(speakerIdSchema, z.string())
|
|
145
|
-
|
|
160
|
+
export const mulmoCastCreditSchema = z
|
|
146
161
|
.object({
|
|
147
|
-
version:
|
|
148
|
-
credit:
|
|
162
|
+
version: z.literal("1.0"),
|
|
163
|
+
credit: z.literal("closing").optional(),
|
|
149
164
|
})
|
|
150
165
|
.strict();
|
|
151
|
-
|
|
166
|
+
export const text2SpeechProviderSchema = z.union([z.literal("openai"), z.literal("nijivoice")]).default("openai");
|
|
167
|
+
export const mulmoSpeechParamsSchema = z
|
|
152
168
|
.object({
|
|
153
|
-
provider:
|
|
154
|
-
speakers:
|
|
169
|
+
provider: text2SpeechProviderSchema, // has default value
|
|
170
|
+
speakers: speakerDictionarySchema,
|
|
155
171
|
})
|
|
156
172
|
.strict();
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
export const text2ImageProviderSchema = z.union([z.literal("openai"), z.literal("google")]).default("openai");
|
|
174
|
+
export const mulmoPresentationStyleSchema = z.object({
|
|
175
|
+
$mulmocast: mulmoCastCreditSchema,
|
|
176
|
+
canvasSize: mulmoCanvasDimensionSchema, // has default value
|
|
177
|
+
speechParams: mulmoSpeechParamsSchema.default({
|
|
178
|
+
speakers: {
|
|
179
|
+
Presenter: {
|
|
180
|
+
voiceId: "shimmer",
|
|
181
|
+
displayName: {
|
|
182
|
+
en: "Presenter",
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
}),
|
|
187
|
+
imageParams: mulmoImageParamsSchema
|
|
169
188
|
.extend({
|
|
170
|
-
provider:
|
|
189
|
+
provider: text2ImageProviderSchema, // has default value
|
|
171
190
|
})
|
|
172
191
|
.optional(),
|
|
173
192
|
// for textSlides
|
|
174
|
-
textSlideParams:
|
|
175
|
-
videoParams:
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
|
|
193
|
+
textSlideParams: textSlideParamsSchema.optional(),
|
|
194
|
+
videoParams: videoParamsSchema.optional(),
|
|
195
|
+
// TODO: Switch to showCaptions later
|
|
196
|
+
omitCaptions: z.boolean().optional(), // default is false
|
|
197
|
+
});
|
|
198
|
+
export const mulmoReferenceSchema = z.object({
|
|
199
|
+
url: URLStringSchema,
|
|
200
|
+
title: z.string().optional(),
|
|
201
|
+
description: z.string().optional(),
|
|
202
|
+
type: z.union([z.literal("article"), z.literal("image"), z.literal("video"), z.literal("audio")]).default("article"),
|
|
203
|
+
});
|
|
204
|
+
export const mulmoScriptSchema = mulmoPresentationStyleSchema
|
|
205
|
+
.extend({
|
|
206
|
+
title: z.string().optional(),
|
|
207
|
+
description: z.string().optional(),
|
|
208
|
+
references: z.array(mulmoReferenceSchema).optional(),
|
|
209
|
+
lang: langSchema.optional(), // default "en"
|
|
210
|
+
beats: z.array(mulmoBeatSchema).min(1),
|
|
211
|
+
// TODO: Delete it later
|
|
212
|
+
imagePath: z.string().optional(), // for keynote images movie ??
|
|
179
213
|
// for debugging
|
|
180
|
-
__test_invalid__:
|
|
214
|
+
__test_invalid__: z.boolean().optional(),
|
|
181
215
|
})
|
|
182
216
|
.strict();
|
|
183
|
-
|
|
184
|
-
.
|
|
185
|
-
multiLingualTexts:
|
|
186
|
-
hash:
|
|
187
|
-
duration:
|
|
188
|
-
audioFile:
|
|
189
|
-
imageFile:
|
|
217
|
+
export const mulmoStudioBeatSchema = z
|
|
218
|
+
.object({
|
|
219
|
+
multiLingualTexts: multiLingualTextsSchema.optional(),
|
|
220
|
+
hash: z.string().optional(),
|
|
221
|
+
duration: z.number().optional(),
|
|
222
|
+
audioFile: z.string().optional(),
|
|
223
|
+
imageFile: z.string().optional(), // path to the image
|
|
224
|
+
})
|
|
225
|
+
.strict();
|
|
226
|
+
export const mulmoStudioSchema = z
|
|
227
|
+
.object({
|
|
228
|
+
script: mulmoScriptSchema,
|
|
229
|
+
filename: z.string(),
|
|
230
|
+
beats: z.array(mulmoStudioBeatSchema).min(1),
|
|
231
|
+
})
|
|
232
|
+
.strict();
|
|
233
|
+
export const mulmoScriptTemplateSchema = z
|
|
234
|
+
.object({
|
|
235
|
+
title: z.string(),
|
|
236
|
+
description: z.string(),
|
|
237
|
+
systemPrompt: z.string(),
|
|
238
|
+
script: mulmoScriptSchema.optional(),
|
|
190
239
|
})
|
|
191
240
|
.strict();
|
|
192
|
-
|
|
241
|
+
export const mulmoStoryboardSceneSchema = z
|
|
193
242
|
.object({
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
beats: zod_1.z.array(exports.mulmoStudioBeatSchema),
|
|
243
|
+
description: z.string(),
|
|
244
|
+
references: z.array(mulmoReferenceSchema).optional(),
|
|
197
245
|
})
|
|
246
|
+
.describe("A detailed description of the content of the scene, not the presentation style")
|
|
198
247
|
.strict();
|
|
199
|
-
|
|
248
|
+
export const mulmoStoryboardSchema = z
|
|
200
249
|
.object({
|
|
201
|
-
title:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
script: exports.mulmoScriptSchema.optional(),
|
|
250
|
+
title: z.string(),
|
|
251
|
+
references: z.array(mulmoReferenceSchema).optional(),
|
|
252
|
+
scenes: z.array(mulmoStoryboardSceneSchema),
|
|
205
253
|
})
|
|
254
|
+
.describe("A storyboard for a presentation, a story, a video, etc.")
|
|
206
255
|
.strict();
|
|
207
|
-
|
|
256
|
+
export const urlsSchema = z.array(z.string().url({ message: "Invalid URL format" }));
|
package/lib/types/type.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoSpeechParamsSchema, textSlideParamsSchema, speechOptionsSchema,
|
|
1
|
+
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoSpeechParamsSchema, textSlideParamsSchema, speechOptionsSchema, mulmoCanvasDimensionSchema, mulmoScriptTemplateSchema, text2ImageProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema } from "./schema.js";
|
|
2
|
+
import { pdf_modes, pdf_sizes } from "../utils/const.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
export type LANG = z.infer<typeof langSchema>;
|
|
4
5
|
export type MulmoBeat = z.infer<typeof mulmoBeatSchema>;
|
|
@@ -7,27 +8,57 @@ export type MulmoSpeechParams = z.infer<typeof mulmoSpeechParamsSchema>;
|
|
|
7
8
|
export type SpeechOptions = z.infer<typeof speechOptionsSchema>;
|
|
8
9
|
export type MulmoImageParams = z.infer<typeof mulmoImageParamsSchema>;
|
|
9
10
|
export type TextSlideParams = z.infer<typeof textSlideParamsSchema>;
|
|
11
|
+
export type Text2ImageProvider = z.infer<typeof text2ImageProviderSchema>;
|
|
12
|
+
export type Text2SpeechProvider = z.infer<typeof text2SpeechProviderSchema>;
|
|
10
13
|
export type LocalizedText = z.infer<typeof localizedTextSchema>;
|
|
11
14
|
export type MulmoScript = z.infer<typeof mulmoScriptSchema>;
|
|
12
|
-
export type
|
|
15
|
+
export type MulmoPresentationStyle = z.infer<typeof mulmoPresentationStyleSchema>;
|
|
16
|
+
export type MulmoCanvasDimension = z.infer<typeof mulmoCanvasDimensionSchema>;
|
|
17
|
+
export type MulmoStoryboardScene = z.infer<typeof mulmoStoryboardSceneSchema>;
|
|
18
|
+
export type MulmoStoryboard = z.infer<typeof mulmoStoryboardSchema>;
|
|
13
19
|
export type MulmoStudioBeat = z.infer<typeof mulmoStudioBeatSchema>;
|
|
20
|
+
export type MulmoMediaSource = z.infer<typeof mediaSourceSchema>;
|
|
14
21
|
export type MulmoStudio = z.infer<typeof mulmoStudioSchema>;
|
|
15
22
|
export type MulmoScriptTemplate = z.infer<typeof mulmoScriptTemplateSchema>;
|
|
23
|
+
export type MulmoTextSlideMedia = z.infer<typeof mulmoTextSlideMediaSchema>;
|
|
24
|
+
export type MulmoMarkdownMedia = z.infer<typeof mulmoMarkdownMediaSchema>;
|
|
25
|
+
export type MulmoImageMedia = z.infer<typeof mulmoImageMediaSchema>;
|
|
26
|
+
export type MulmoChartMedia = z.infer<typeof mulmoChartMediaSchema>;
|
|
27
|
+
export type MulmoMermaidMedia = z.infer<typeof mulmoMermaidMediaSchema>;
|
|
16
28
|
export type FileDirs = {
|
|
17
29
|
mulmoFilePath: string;
|
|
18
30
|
mulmoFileDirPath: string;
|
|
19
31
|
baseDirPath: string;
|
|
20
32
|
outDirPath: string;
|
|
21
33
|
imageDirPath: string;
|
|
22
|
-
|
|
34
|
+
audioDirPath: string;
|
|
23
35
|
};
|
|
24
36
|
export type MulmoStudioContext = {
|
|
25
37
|
fileDirs: FileDirs;
|
|
26
38
|
studio: MulmoStudio;
|
|
39
|
+
force: boolean;
|
|
27
40
|
};
|
|
28
41
|
export type ScriptingParams = {
|
|
29
42
|
urls: string[];
|
|
30
43
|
outDirPath: string;
|
|
44
|
+
cacheDirPath: string;
|
|
31
45
|
templateName: string;
|
|
32
46
|
filename: string;
|
|
47
|
+
llm_model?: string;
|
|
48
|
+
llm_agent?: string;
|
|
33
49
|
};
|
|
50
|
+
export type ImageProcessorParams = {
|
|
51
|
+
beat: MulmoBeat;
|
|
52
|
+
context: MulmoStudioContext;
|
|
53
|
+
imagePath: string;
|
|
54
|
+
textSlideStyle: string;
|
|
55
|
+
canvasSize: MulmoCanvasDimension;
|
|
56
|
+
};
|
|
57
|
+
export type PDFMode = (typeof pdf_modes)[number];
|
|
58
|
+
export type PDFSize = (typeof pdf_sizes)[number];
|
|
59
|
+
export type Text2ImageAgentInfo = {
|
|
60
|
+
provider: Text2ImageProvider;
|
|
61
|
+
agent: string;
|
|
62
|
+
imageParams: MulmoImageParams;
|
|
63
|
+
};
|
|
64
|
+
export type BeatMediaType = "movie" | "image";
|
package/lib/types/type.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/utils/const.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export declare const outDirName = "output";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const audioDirName = "audio";
|
|
3
3
|
export declare const imageDirName = "images";
|
|
4
|
+
export declare const cacheDirName = "cache";
|
|
5
|
+
export declare const pdf_modes: string[];
|
|
6
|
+
export declare const pdf_sizes: string[];
|
package/lib/utils/const.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export const outDirName = "output";
|
|
2
|
+
export const audioDirName = "audio";
|
|
3
|
+
export const imageDirName = "images";
|
|
4
|
+
export const cacheDirName = "cache";
|
|
5
|
+
export const pdf_modes = ["slide", "talk", "handout"];
|
|
6
|
+
export const pdf_sizes = ["letter", "a4"];
|
package/lib/utils/file.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { MulmoScript, MulmoScriptTemplate } from "../types";
|
|
1
|
+
import { MulmoScript, MulmoScriptTemplate, MulmoMediaSource, MulmoStudioContext } from "../types/index.js";
|
|
2
|
+
import { PDFMode } from "../types/index.js";
|
|
2
3
|
export declare function readMulmoScriptFile<T = MulmoScript>(path: string, errorMessage: string): {
|
|
3
4
|
mulmoData: T;
|
|
4
5
|
mulmoDataPath: string;
|
|
@@ -9,16 +10,32 @@ export declare function readMulmoScriptFile<T = MulmoScript>(path: string): {
|
|
|
9
10
|
mulmoDataPath: string;
|
|
10
11
|
fileName: string;
|
|
11
12
|
} | null;
|
|
13
|
+
export declare const fetchMulmoScriptFile: (url: string) => Promise<{
|
|
14
|
+
result: boolean;
|
|
15
|
+
status: number;
|
|
16
|
+
script?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
result: boolean;
|
|
19
|
+
script: any;
|
|
20
|
+
status?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
result: boolean;
|
|
23
|
+
status: string;
|
|
24
|
+
script?: undefined;
|
|
25
|
+
}>;
|
|
12
26
|
export declare const getOutputStudioFilePath: (outDirPath: string, fileName: string) => string;
|
|
13
|
-
export declare const
|
|
27
|
+
export declare const getAudioSegmentDirPath: (audioDirPath: string, studioFileName: string) => string;
|
|
28
|
+
export declare const getAudioSegmentFilePath: (audioDirPath: string, studioFileName: string, fileName: string) => string;
|
|
29
|
+
export declare const getAudioCombinedFilePath: (audioDirPath: string, fileName: string) => string;
|
|
30
|
+
export declare const getAudioArtifactFilePath: (outDirPath: string, fileName: string) => string;
|
|
14
31
|
export declare const getOutputVideoFilePath: (outDirPath: string, fileName: string) => string;
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const getScratchpadFilePath: (scratchpadDirName: string, fileName: string) => string;
|
|
32
|
+
export declare const getOutputPdfFilePath: (outDirPath: string, fileName: string, pdfMode: PDFMode) => string;
|
|
17
33
|
export declare const getTemplateFilePath: (templateName: string) => string;
|
|
18
34
|
export declare const mkdir: (dirPath: string) => void;
|
|
19
35
|
export declare const silentPath: string;
|
|
20
36
|
export declare const silentLastPath: string;
|
|
21
37
|
export declare const defaultBGMPath: string;
|
|
38
|
+
export declare const getHTMLFile: (filename: string) => string;
|
|
22
39
|
export declare const getBaseDirPath: (basedir?: string) => string;
|
|
23
40
|
export declare const getFullPath: (baseDirPath: string | undefined, file: string) => string;
|
|
24
41
|
export declare const readTemplatePrompt: (templateName: string) => string;
|
|
@@ -26,3 +43,4 @@ export declare const getAvailableTemplates: () => (MulmoScriptTemplate & {
|
|
|
26
43
|
filename: string;
|
|
27
44
|
})[];
|
|
28
45
|
export declare const writingMessage: (filePath: string) => void;
|
|
46
|
+
export declare const resolveMediaSource: (source: MulmoMediaSource, context: MulmoStudioContext) => string | null;
|