mulmocast 0.1.5 → 0.1.7

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.
Files changed (39) hide show
  1. package/assets/templates/ani.json +48 -0
  2. package/assets/templates/ani_ja.json +45 -0
  3. package/lib/actions/audio.js +2 -0
  4. package/lib/actions/image_agents.d.ts +28 -22
  5. package/lib/actions/image_agents.js +4 -4
  6. package/lib/actions/images.js +12 -21
  7. package/lib/actions/translate.d.ts +4 -1
  8. package/lib/actions/translate.js +6 -3
  9. package/lib/agents/combine_audio_files_agent.js +106 -86
  10. package/lib/agents/movie_replicate_agent.js +4 -3
  11. package/lib/agents/tts_elevenlabs_agent.js +1 -1
  12. package/lib/agents/tts_nijivoice_agent.js +2 -3
  13. package/lib/cli/commands/tool/scripting/builder.js +1 -1
  14. package/lib/cli/commands/tool/scripting/handler.d.ts +1 -1
  15. package/lib/cli/commands/tool/story_to_script/builder.js +1 -1
  16. package/lib/cli/commands/tool/story_to_script/handler.d.ts +1 -1
  17. package/lib/index.browser.d.ts +1 -3
  18. package/lib/index.browser.js +2 -4
  19. package/lib/index.common.d.ts +2 -0
  20. package/lib/index.common.js +3 -0
  21. package/lib/index.node.d.ts +7 -0
  22. package/lib/index.node.js +8 -0
  23. package/lib/methods/mulmo_presentation_style.d.ts +15 -1
  24. package/lib/methods/mulmo_presentation_style.js +10 -11
  25. package/lib/tools/story_to_script.d.ts +1 -1
  26. package/lib/types/schema.d.ts +343 -322
  27. package/lib/types/schema.js +21 -14
  28. package/lib/types/type.d.ts +3 -2
  29. package/lib/utils/context.d.ts +73 -72
  30. package/lib/utils/ffmpeg_utils.js +6 -0
  31. package/lib/utils/image_plugins/image.d.ts +2 -2
  32. package/lib/utils/image_plugins/movie.d.ts +2 -2
  33. package/lib/utils/preprocess.d.ts +37 -36
  34. package/lib/utils/provider2agent.d.ts +9 -7
  35. package/lib/utils/provider2agent.js +12 -7
  36. package/lib/utils/utils.d.ts +1 -2
  37. package/lib/utils/utils.js +7 -2
  38. package/package.json +11 -11
  39. package/scripts/templates/presentation.json~ +0 -119
@@ -1,5 +1,5 @@
1
1
  import { getAvailableTemplates } from "../../../../utils/file.js";
2
- import { llm } from "../../../../utils/utils.js";
2
+ import { llm } from "../../../../utils/provider2agent.js";
3
3
  import { storyToScriptGenerateMode } from "../../../../utils/const.js";
4
4
  const availableTemplateNames = getAvailableTemplates().map((template) => template.filename);
5
5
  export const builder = (yargs) => {
@@ -1,5 +1,5 @@
1
1
  import { ToolCliArgs } from "../../../../types/cli_types.js";
2
- import { LLM } from "../../../../utils/utils.js";
2
+ import type { LLM } from "../../../../utils/provider2agent.js";
3
3
  export declare const handler: (argv: ToolCliArgs<{
4
4
  o?: string;
5
5
  b?: string;
@@ -1,4 +1,2 @@
1
- export * from "./types/type.js";
2
- export * from "./types/schema.js";
3
- export * from "./utils/provider2agent.js";
1
+ export * from "./index.common.js";
4
2
  export * from "./agents/validate_schema_agent.js";
@@ -1,5 +1,3 @@
1
- // Entry point that exposes only APIs available for use in the browser
2
- export * from "./types/type.js";
3
- export * from "./types/schema.js";
4
- export * from "./utils/provider2agent.js";
1
+ // Entry point for browser code
2
+ export * from "./index.common.js";
5
3
  export * from "./agents/validate_schema_agent.js";
@@ -0,0 +1,2 @@
1
+ export * from "./types/index.js";
2
+ export * from "./utils/provider2agent.js";
@@ -0,0 +1,3 @@
1
+ // Entry point for universal code
2
+ export * from "./types/index.js";
3
+ export * from "./utils/provider2agent.js";
@@ -0,0 +1,7 @@
1
+ export * from "./index.common.js";
2
+ export * from "./actions/index.js";
3
+ export * from "./cli/helpers.js";
4
+ export * from "./utils/file.js";
5
+ export * from "./utils/ffmpeg_utils.js";
6
+ export * from "./methods/index.js";
7
+ export * from "./agents/index.js";
@@ -0,0 +1,8 @@
1
+ // Entry point for node.js code
2
+ export * from "./index.common.js";
3
+ export * from "./actions/index.js";
4
+ export * from "./cli/helpers.js";
5
+ export * from "./utils/file.js";
6
+ export * from "./utils/ffmpeg_utils.js";
7
+ export * from "./methods/index.js";
8
+ export * from "./agents/index.js";
@@ -12,7 +12,21 @@ export declare const MulmoPresentationStyleMethods: {
12
12
  getVoiceId(presentationStyle: MulmoPresentationStyle, beat: MulmoBeat): string;
13
13
  getText2ImageProvider(provider: Text2ImageProvider | undefined): Text2ImageProvider;
14
14
  getImageAgentInfo(presentationStyle: MulmoPresentationStyle, beat?: MulmoBeat): Text2ImageAgentInfo;
15
- getMovieAgent(presentationStyle: MulmoPresentationStyle): string;
15
+ getMovieAgentInfo(presentationStyle: MulmoPresentationStyle, beat?: MulmoBeat): {
16
+ agent: string;
17
+ movieParams: {
18
+ speed?: number | undefined;
19
+ provider?: string | undefined;
20
+ model?: string | undefined;
21
+ fillOption?: {
22
+ style: "aspectFit" | "aspectFill";
23
+ } | undefined;
24
+ transition?: {
25
+ type: "fade" | "slideout_left";
26
+ duration: number;
27
+ } | undefined;
28
+ };
29
+ };
16
30
  getConcurrency(presentationStyle: MulmoPresentationStyle): 4 | 16;
17
31
  getHtmlImageAgentInfo(presentationStyle: MulmoPresentationStyle): Text2HtmlAgentInfo;
18
32
  getImageType(_: MulmoPresentationStyle, beat: MulmoBeat): BeatMediaType;
@@ -1,7 +1,7 @@
1
1
  import "dotenv/config";
2
2
  import { userAssert } from "../utils/utils.js";
3
- import { text2ImageProviderSchema, text2HtmlImageProviderSchema, text2SpeechProviderSchema, mulmoCanvasDimensionSchema } from "../types/schema.js";
4
- import { defaultProviders, provider2ImageAgent, provider2MovieAgent, provider2LLMAgent } from "../utils/provider2agent.js";
3
+ import { text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoCanvasDimensionSchema, } from "../types/schema.js";
4
+ import { provider2ImageAgent, provider2MovieAgent, provider2LLMAgent } from "../utils/provider2agent.js";
5
5
  const defaultTextSlideStyles = [
6
6
  '*,*::before,*::after{box-sizing:border-box}body,h1,h2,h3,h4,p,figure,blockquote,dl,dd{margin:0}ul[role="list"],ol[role="list"]{list-style:none}html:focus-within{scroll-behavior:smooth}body{min-height:100vh;text-rendering:optimizeSpeed;line-height:1.5}a:not([class]){text-decoration-skip-ink:auto}img,picture{max-width:100%;display:block}input,button,textarea,select{font:inherit}@media(prefers-reduced-motion:reduce){html:focus-within{scroll-behavior:auto}*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}',
7
7
  "body { margin: 60px; margin-top: 40px; color:#333; font-size: 30px; font-family: Arial, sans-serif; box-sizing: border-box; height: 100vh }",
@@ -80,17 +80,16 @@ export const MulmoPresentationStyleMethods = {
80
80
  imageParams: { ...defaultImageParams, ...imageParams },
81
81
  };
82
82
  },
83
- // Determine movie agent based on provider
84
- getMovieAgent(presentationStyle) {
85
- const movieProvider = (presentationStyle.movieParams?.provider ?? defaultProviders.text2movie);
86
- return provider2MovieAgent[movieProvider].agentName;
83
+ getMovieAgentInfo(presentationStyle, beat) {
84
+ const movieParams = { ...presentationStyle.movieParams, ...beat?.movieParams };
85
+ const movieProvider = text2MovieProviderSchema.parse(movieParams?.provider);
86
+ const agentInfo = provider2MovieAgent[movieProvider];
87
+ return {
88
+ agent: agentInfo.agentName,
89
+ movieParams,
90
+ };
87
91
  },
88
92
  getConcurrency(presentationStyle) {
89
- /*
90
- if (presentationStyle.movieParams?.provider === "replicate") {
91
- return 4;
92
- }
93
- */
94
93
  const imageAgentInfo = MulmoPresentationStyleMethods.getImageAgentInfo(presentationStyle);
95
94
  if (imageAgentInfo.imageParams.provider === "openai") {
96
95
  // NOTE: Here are the rate limits of OpenAI's text2image API (1token = 32x32 patch).
@@ -1,5 +1,5 @@
1
1
  import { MulmoStoryboard, StoryToScriptGenerateMode } from "../types/index.js";
2
- import { LLM } from "../utils/utils.js";
2
+ import type { LLM } from "../utils/provider2agent.js";
3
3
  export declare const storyToScript: ({ story, beatsPerScene, templateName, outdir, fileName, llm, llmModel, generateMode, }: {
4
4
  story: MulmoStoryboard;
5
5
  beatsPerScene: number;