mulmocast 1.2.10 → 1.2.11

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.
@@ -6,7 +6,8 @@ import { ttsNijivoiceAgent, ttsOpenaiAgent, ttsGoogleAgent, ttsElevenlabsAgent,
6
6
  import { text2SpeechProviderSchema } from "../types/index.js";
7
7
  import { fileCacheAgentFilter, nijovoiceTextAgentFilter } from "../utils/filters.js";
8
8
  import { getAudioArtifactFilePath, getAudioFilePath, getOutputStudioFilePath, resolveDirPath, defaultBGMPath, mkdir, writingMessage } from "../utils/file.js";
9
- import { text2hash, localizedText, settings2GraphAIConfig } from "../utils/utils.js";
9
+ import { localizedText, settings2GraphAIConfig } from "../utils/utils.js";
10
+ import { text2hash } from "../utils/utils_node.js";
10
11
  import { provider2TTSAgent } from "../utils/provider2agent.js";
11
12
  import { MulmoPresentationStyleMethods } from "../methods/index.js";
12
13
  import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
@@ -5,8 +5,7 @@ import * as agents from "@graphai/vanilla";
5
5
  import { openAIAgent } from "@graphai/openai_agent";
6
6
  import { fileWriteAgent } from "@graphai/vanilla_node_agents";
7
7
  import { splitText } from "../utils/string.js";
8
- import { settings2GraphAIConfig, multiLingualObjectToArray } from "../utils/utils.js";
9
- import { beatId } from "../utils/common.js";
8
+ import { settings2GraphAIConfig, beatId, multiLingualObjectToArray } from "../utils/utils.js";
10
9
  import { getMultiLingual } from "../utils/context.js";
11
10
  import { currentMulmoScriptVersion } from "../utils/const.js";
12
11
  import { getOutputMultilingualFilePath, mkdir, writingMessage, hashSHA256 } from "../utils/file.js";
@@ -2,4 +2,6 @@ export * from "./types/index.js";
2
2
  export * from "./utils/provider2agent.js";
3
3
  export * from "./utils/const.js";
4
4
  export * from "./utils/string.js";
5
- export * from "./utils/common.js";
5
+ export * from "./utils/utils.js";
6
+ export * from "./methods/mulmo_presentation_style.js";
7
+ export * from "./methods/mulmo_script.js";
@@ -3,4 +3,6 @@ export * from "./types/index.js";
3
3
  export * from "./utils/provider2agent.js";
4
4
  export * from "./utils/const.js";
5
5
  export * from "./utils/string.js";
6
- export * from "./utils/common.js";
6
+ export * from "./utils/utils.js";
7
+ export * from "./methods/mulmo_presentation_style.js";
8
+ export * from "./methods/mulmo_script.js";
@@ -1,4 +1,3 @@
1
- import "dotenv/config";
2
1
  import { MulmoCanvasDimension, MulmoBeat, Text2SpeechProvider, Text2ImageAgentInfo, Text2HtmlAgentInfo, BeatMediaType, MulmoPresentationStyle, SpeakerData, Text2ImageProvider, MulmoStudioContext } from "../types/index.js";
3
2
  export declare const MulmoPresentationStyleMethods: {
4
3
  getCanvasSize(presentationStyle: MulmoPresentationStyle): MulmoCanvasDimension;
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ // node & browser
2
2
  import { isNull } from "graphai";
3
3
  import { userAssert } from "../utils/utils.js";
4
4
  import { text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoCanvasDimensionSchema, } from "../types/schema.js";
@@ -1,6 +1,7 @@
1
+ // node & browser
1
2
  import { GraphAILogger } from "graphai";
2
3
  import { mulmoScriptSchema, mulmoStudioMultiLingualFileSchema } from "../types/index.js";
3
- import { beatId } from "../utils/common.js";
4
+ import { beatId } from "../utils/utils.js";
4
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
6
  const validate_1_0 = (script) => {
6
7
  if (script.speechParams?.provider) {
@@ -1,5 +1,5 @@
1
1
  import path from "path";
2
- import { beatId } from "../utils/common.js";
2
+ import { beatId } from "../utils/utils.js";
3
3
  import { GraphAILogger } from "graphai";
4
4
  const sessionProgressCallbacks = new Set();
5
5
  export const addSessionProgressCallback = (cb) => {
@@ -1,8 +1,7 @@
1
1
  import { GraphAILogger } from "graphai";
2
2
  import fs from "fs";
3
3
  import { readMulmoScriptFile, fetchMulmoScriptFile } from "./file.js";
4
- import { multiLingualObjectToArray } from "./utils.js";
5
- import { beatId } from "./common.js";
4
+ import { beatId, multiLingualObjectToArray } from "./utils.js";
6
5
  import { mulmoStudioSchema, mulmoCaptionParamsSchema, mulmoPresentationStyleSchema } from "../types/schema.js";
7
6
  import { MulmoPresentationStyleMethods, MulmoScriptMethods, MulmoStudioMultiLingualMethod } from "../methods/index.js";
8
7
  const mulmoCredit = (speaker) => {
@@ -4,7 +4,7 @@ import path from "path";
4
4
  import fsPromise from "fs/promises";
5
5
  import { GraphAILogger } from "graphai";
6
6
  import { writingMessage } from "./file.js";
7
- import { text2hash } from "./utils.js";
7
+ import { text2hash } from "./utils_node.js";
8
8
  import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
9
9
  import { replacementsJa, replacePairsJa } from "../utils/string.js";
10
10
  export const nijovoiceTextAgentFilter = async (context, next) => {
@@ -1,6 +1,6 @@
1
1
  import type { ConfigDataDictionary, DefaultConfigData } from "graphai";
2
2
  import { MulmoBeat, MulmoStudioBeat, MulmoStudioMultiLingual, MulmoStudioMultiLingualData } from "../types/index.js";
3
- import type { LLM } from "./provider2agent.js";
3
+ import { type LLM } from "./provider2agent.js";
4
4
  export declare const llmPair: (_llm?: LLM, _model?: string) => {
5
5
  agent: "mediaMockAgent" | "openAIAgent" | "anthropicAgent" | "geminiAgent" | "groqAgent";
6
6
  model: string;
@@ -8,7 +8,6 @@ export declare const llmPair: (_llm?: LLM, _model?: string) => {
8
8
  };
9
9
  export declare const chunkArray: <T>(array: T[], size?: number) => T[][];
10
10
  export declare const isHttp: (fileOrUrl: string) => boolean;
11
- export declare const text2hash: (input: string) => string;
12
11
  export declare const localizedText: (beat: MulmoBeat, multiLingualData?: MulmoStudioMultiLingualData, targetLang?: string, defaultLang?: string) => string;
13
12
  export declare function userAssert(condition: boolean, message: string): asserts condition;
14
13
  export declare const settings2GraphAIConfig: (settings?: Record<string, string>, env?: Record<string, string | undefined>) => ConfigDataDictionary<DefaultConfigData>;
@@ -19,6 +18,7 @@ type CleanableObject = {
19
18
  [key: string]: CleanableValue;
20
19
  };
21
20
  export declare const deepClean: <T extends CleanableValue>(input: T) => T | undefined;
21
+ export declare const beatId: (id: string | undefined, index: number) => string;
22
22
  export declare const multiLingualObjectToArray: (multiLingual: MulmoStudioMultiLingual | undefined, beats: MulmoStudioBeat[]) => {
23
23
  multiLingualTexts: Record<string, {
24
24
  text: string;
@@ -1,6 +1,5 @@
1
- import * as crypto from "crypto";
1
+ // node & browser
2
2
  import { provider2LLMAgent } from "./provider2agent.js";
3
- import { beatId } from "./common.js";
4
3
  export const llmPair = (_llm, _model) => {
5
4
  const llmKey = _llm ?? "openai";
6
5
  const agent = provider2LLMAgent[llmKey]?.agentName ?? provider2LLMAgent.openai.agentName;
@@ -18,9 +17,6 @@ export const chunkArray = (array, size = 3) => {
18
17
  export const isHttp = (fileOrUrl) => {
19
18
  return /^https?:\/\//.test(fileOrUrl);
20
19
  };
21
- export const text2hash = (input) => {
22
- return crypto.createHash("sha256").update(input).digest("hex");
23
- };
24
20
  export const localizedText = (beat, multiLingualData, targetLang, defaultLang) => {
25
21
  if (targetLang === defaultLang) {
26
22
  return beat.text;
@@ -118,6 +114,10 @@ export const deepClean = (input) => {
118
114
  }
119
115
  return input;
120
116
  };
117
+ export const beatId = (id, index) => {
118
+ const key = id ?? `__index__${index}`;
119
+ return key;
120
+ };
121
121
  export const multiLingualObjectToArray = (multiLingual, beats) => {
122
122
  return beats.map((beat, index) => {
123
123
  const key = beatId(beat?.id, index);
@@ -0,0 +1 @@
1
+ export declare const text2hash: (input: string) => string;
@@ -0,0 +1,4 @@
1
+ import * as crypto from "crypto";
2
+ export const text2hash = (input) => {
3
+ return crypto.createHash("sha256").update(input).digest("hex");
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",