mulmocast 1.2.31 → 1.2.32

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,4 +1,3 @@
1
- import "dotenv/config";
2
1
  import type { GraphData } from "graphai";
3
2
  import { MulmoStudioContext, MulmoBeat, PublicAPIArgs } from "../types/index.js";
4
3
  export declare const getBeatAudioPath: (text: string, context: MulmoStudioContext, beat: MulmoBeat, lang?: string) => string | undefined;
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ import dotenv from "dotenv";
2
2
  import { GraphAI, TaskManager, GraphAILogger } from "graphai";
3
3
  import * as agents from "@graphai/vanilla";
4
4
  import { fileWriteAgent } from "@graphai/vanilla_node_agents";
@@ -12,6 +12,7 @@ import { provider2TTSAgent } from "../utils/provider2agent.js";
12
12
  import { MulmoPresentationStyleMethods } from "../methods/index.js";
13
13
  import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
14
14
  import { MulmoMediaSourceMethods } from "../methods/mulmo_media_source.js";
15
+ dotenv.config({ quiet: true });
15
16
  const vanillaAgents = agents.default ?? agents;
16
17
  const getAudioPath = (context, beat, audioFile) => {
17
18
  if (beat.audio?.type === "audio") {
@@ -41,7 +41,7 @@ const defaultAgents = {
41
41
  openAIAgent,
42
42
  anthropicAgent,
43
43
  };
44
- dotenv.config();
44
+ dotenv.config({ quiet: true });
45
45
  export const beat_graph_data = {
46
46
  version: 0.5,
47
47
  concurrency: 4,
@@ -1,4 +1,3 @@
1
- import "dotenv/config";
2
1
  import type { GraphData } from "graphai";
3
2
  import type { LANG, MulmoStudioContext, PublicAPIArgs } from "../types/index.js";
4
3
  export declare const translateTextGraph: {
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ import dotenv from "dotenv";
2
2
  import fs from "fs";
3
3
  import { GraphAI, assert, isNull, GraphAILogger } from "graphai";
4
4
  import * as agents from "@graphai/vanilla";
@@ -12,6 +12,7 @@ import { getOutputMultilingualFilePath, mkdir, writingMessage, hashSHA256 } from
12
12
  import { translateSystemPrompt, translatePrompts } from "../utils/prompt.js";
13
13
  import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
14
14
  const vanillaAgents = agents.default ?? agents;
15
+ dotenv.config({ quiet: true });
15
16
  // 1. translateGraph / map each beats.
16
17
  // 2. beatGraph / map each target lang.
17
18
  // 3. translateTextGraph / translate text.
package/lib/cli/bin.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import "dotenv/config";
3
2
  export declare const main: () => Promise<void>;
package/lib/cli/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "dotenv/config";
2
+ import dotenv from "dotenv";
3
3
  import yargs from "yargs/yargs";
4
4
  import { hideBin } from "yargs/helpers";
5
5
  import { readFileSync } from "fs";
@@ -14,6 +14,7 @@ import * as markdownCmd from "./commands/markdown/index.js";
14
14
  import * as htmlCmd from "./commands/html/index.js";
15
15
  import * as toolCmd from "./commands/tool/index.js";
16
16
  import { GraphAILogger } from "graphai";
17
+ dotenv.config({ quiet: true });
17
18
  const __filename = fileURLToPath(import.meta.url);
18
19
  const __dirname = dirname(__filename);
19
20
  const packageJson = JSON.parse(readFileSync(join(__dirname, "../../package.json"), "utf8"));
@@ -1,4 +1,3 @@
1
- import "dotenv/config";
2
1
  import { ToolCliArgs } from "../../../../types/cli_types.js";
3
2
  export declare const handler: (argv: ToolCliArgs<{
4
3
  file: string;
@@ -1,10 +1,11 @@
1
- import "dotenv/config";
1
+ import dotenv from "dotenv";
2
2
  import { existsSync, createReadStream, writeFileSync, mkdirSync } from "fs";
3
3
  import { resolve, basename, extname, join } from "path";
4
4
  import OpenAI from "openai";
5
5
  import { mulmoScriptSchema } from "../../../../types/index.js";
6
6
  import { ffmpegGetMediaDuration } from "../../../../utils/ffmpeg_utils.js";
7
7
  import { GraphAILogger } from "graphai";
8
+ dotenv.config({ quiet: true });
8
9
  const createMulmoScript = (fullPath, beats) => {
9
10
  return mulmoScriptSchema.parse({
10
11
  $mulmocast: {
@@ -26,6 +26,7 @@ export const setGraphAILogger = (verbose, logValues) => {
26
26
  GraphAILogger.setLevelEnabled("error", false);
27
27
  GraphAILogger.setLevelEnabled("log", false);
28
28
  GraphAILogger.setLevelEnabled("warn", false);
29
+ GraphAILogger.setLevelEnabled("debug", false);
29
30
  }
30
31
  };
31
32
  export const getFileObject = (args) => {
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import "dotenv/config";
2
+ export {};
package/lib/mcp/server.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "dotenv/config";
2
+ import dotenv from "dotenv";
3
3
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
@@ -12,6 +12,7 @@ import { initializeContext, runTranslateIfNeeded } from "../cli/helpers.js";
12
12
  import { outDirName } from "../utils/const.js";
13
13
  import { resolveDirPath, mkdir, generateTimestampedFileName } from "../utils/file.js";
14
14
  import { MulmoScriptMethods } from "../methods/index.js";
15
+ dotenv.config({ quiet: true });
15
16
  const __filename = fileURLToPath(import.meta.url);
16
17
  const __dirname = path.dirname(__filename);
17
18
  // Load MulmoScript JSON Schema from file
@@ -1,4 +1,3 @@
1
- import "dotenv/config";
2
1
  import { ScriptingParams } from "../types/index.js";
3
2
  export declare const createMulmoScriptFromUrl: ({ urls, templateName, outDirPath, filename, cacheDirPath, llm, llm_model }: ScriptingParams) => Promise<void>;
4
3
  export declare const createMulmoScriptFromFile: (fileName: string, { templateName, outDirPath, filename, cacheDirPath, llm, llm_model, verbose }: ScriptingParams) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ import dotenv from "dotenv";
2
2
  import path from "path";
3
3
  import { GraphAI, GraphAILogger } from "graphai";
4
4
  import { openAIAgent } from "@graphai/openai_agent";
@@ -16,6 +16,7 @@ import { cliLoadingPlugin } from "../utils/plugins.js";
16
16
  import { graphDataScriptFromUrlPrompt } from "../utils/prompt.js";
17
17
  import { llmPair } from "../utils/utils.js";
18
18
  import { readFileSync } from "fs";
19
+ dotenv.config({ quiet: true });
19
20
  const vanillaAgents = agents.default ?? agents;
20
21
  const showErrorMessage = (text) => {
21
22
  GraphAILogger.info("\x1b[31m" + text + "\x1b[0m");
@@ -1,3 +1,2 @@
1
- import "dotenv/config";
2
1
  import { ScriptingParams } from "../types/index.js";
3
2
  export declare const createMulmoScriptInteractively: ({ outDirPath, cacheDirPath, filename, templateName, urls, llm, llm_model }: ScriptingParams) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ import dotenv from "dotenv";
2
2
  import { GraphAILogger, GraphAI } from "graphai";
3
3
  import { textInputAgent } from "@graphai/input_agents";
4
4
  import { consoleStreamDataAgentFilter } from "@graphai/stream_agent_filter/node";
@@ -16,6 +16,7 @@ import validateSchemaAgent from "../agents/validate_schema_agent.js";
16
16
  import { llmPair } from "../utils/utils.js";
17
17
  import { interactiveClarificationPrompt, prefixPrompt } from "../utils/prompt.js";
18
18
  // import { cliLoadingPlugin } from "../utils/plugins.js";
19
+ dotenv.config({ quiet: true });
19
20
  const vanillaAgents = agents.default ?? agents;
20
21
  const agentHeader = "\x1b[34m● \x1b[0m\x1b[1mAgent\x1b[0m:\x1b[0m";
21
22
  const graphDataForScraping = {
@@ -1,2 +1 @@
1
- import "dotenv/config";
2
1
  export declare const deepResearch: () => Promise<void>;
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ import dotenv from "dotenv";
2
2
  import { GraphAILogger, GraphAI } from "graphai";
3
3
  import { textInputAgent } from "@graphai/input_agents";
4
4
  import { consoleStreamDataAgentFilter } from "@graphai/stream_agent_filter/node";
@@ -7,6 +7,7 @@ import * as agents from "@graphai/vanilla";
7
7
  import tavilySearchAgent from "../agents/tavily_agent.js";
8
8
  import { cliLoadingPlugin } from "../utils/plugins.js";
9
9
  import { searchQueryPrompt, reflectionPrompt, finalAnswerPrompt } from "../utils/prompt.js";
10
+ dotenv.config({ quiet: true });
10
11
  const vanillaAgents = agents.default ?? agents;
11
12
  const agentHeader = "\x1b[34m● \x1b[0m\x1b[1mAgent\x1b[0m:\x1b[0m";
12
13
  const graphData = {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ // ``` ``` / ~~~ ~~~ fence
2
+ const fenceRe = /(^|\n)(```|~~~)[^\n]*\n([\s\S]*?)\n\2/g;
3
+ let m;
4
+ while ((m = fenceRe.exec(text))) {
5
+ const body = m[3].trim();
6
+ if (/^[\[{]/.test(body))
7
+ blocks.push(body);
8
+ }
9
+ // linene `...`
10
+ const inlineRe = /`([^`]+)`/g;
11
+ while ((m = inlineRe.exec(text))) {
12
+ const body = m[1].trim();
13
+ if (/^[\[{]/.test(body))
14
+ blocks.push(body);
15
+ }
16
+ export {};
@@ -1,4 +1,3 @@
1
- import "dotenv/config";
2
1
  import type { AgentFilterFunction } from "graphai";
3
2
  export declare const nijovoiceTextAgentFilter: AgentFilterFunction;
4
3
  export declare const fileCacheAgentFilter: AgentFilterFunction;
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ import dotenv from "dotenv";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import fsPromise from "fs/promises";
@@ -7,6 +7,7 @@ import { writingMessage } from "./file.js";
7
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
+ dotenv.config({ quiet: true });
10
11
  export const nijovoiceTextAgentFilter = async (context, next) => {
11
12
  const { text, provider, lang } = context.namedInputs;
12
13
  if (provider === "nijivoice" && lang === "ja") {
@@ -0,0 +1,2 @@
1
+ export declare const findFirstJson: (text: string) => any;
2
+ export declare const findAllJson: (text: string) => any[];
@@ -0,0 +1,59 @@
1
+ // greedy-json-lite.js
2
+ export const findFirstJson = (text) => {
3
+ for (const block of extractBlocks(text)) {
4
+ try {
5
+ return JSON.parse(block);
6
+ }
7
+ catch { }
8
+ }
9
+ return null;
10
+ };
11
+ export const findAllJson = (text) => {
12
+ const out = [];
13
+ for (const block of extractBlocks(text)) {
14
+ try {
15
+ out.push(JSON.parse(block));
16
+ }
17
+ catch { }
18
+ }
19
+ return out;
20
+ };
21
+ const extractBlocks = (text) => {
22
+ const blocks = [];
23
+ // greedy( {…} / […])
24
+ const starts = [];
25
+ for (let i = 0; i < text.length; i++) {
26
+ if (text[i] === '{' || text[i] === '[') {
27
+ starts.push(i);
28
+ }
29
+ }
30
+ for (const s of starts) {
31
+ const open = text[s];
32
+ const close = open === '{' ? '}' : ']';
33
+ let depth = 0, inStr = null, prev = "";
34
+ for (let j = s; j < text.length; j++) {
35
+ const ch = text[j];
36
+ if (inStr) {
37
+ if (ch === inStr && prev !== '\\')
38
+ inStr = null;
39
+ }
40
+ else {
41
+ if (ch === '"' || ch === "'" || ch === '`')
42
+ inStr = ch;
43
+ else if (ch === open)
44
+ depth++;
45
+ else if (ch === close) {
46
+ depth--;
47
+ if (depth === 0) {
48
+ blocks.push(text.slice(s, j + 1).trim());
49
+ break;
50
+ }
51
+ else if (depth < 0)
52
+ break;
53
+ }
54
+ }
55
+ prev = ch;
56
+ }
57
+ }
58
+ return blocks;
59
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.31",
3
+ "version": "1.2.32",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -87,7 +87,7 @@
87
87
  "clipboardy": "^4.0.0",
88
88
  "dotenv": "^17.2.2",
89
89
  "fluent-ffmpeg": "^2.1.3",
90
- "graphai": "^2.0.14",
90
+ "graphai": "^2.0.15",
91
91
  "jsdom": "^27.0.0",
92
92
  "marked": "^16.3.0",
93
93
  "mulmocast-vision": "^1.0.3",