mulmocast 0.1.1 → 0.1.2
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/lib/actions/images.d.ts +4 -0
- package/lib/actions/images.js +25 -8
- package/lib/types/schema.d.ts +5 -0
- package/lib/types/schema.js +1 -0
- package/lib/types/type.d.ts +1 -1
- package/lib/utils/context.d.ts +1 -0
- package/lib/utils/context.js +1 -0
- package/lib/utils/filters.js +8 -3
- package/package.json +6 -6
package/lib/actions/images.d.ts
CHANGED
|
@@ -32,10 +32,12 @@ export declare const imagePreprocessAgent: (namedInputs: {
|
|
|
32
32
|
imagePath: string | undefined;
|
|
33
33
|
referenceImage: string | undefined;
|
|
34
34
|
htmlPrompt?: undefined;
|
|
35
|
+
htmlPath?: undefined;
|
|
35
36
|
htmlImageSystemPrompt?: undefined;
|
|
36
37
|
} | {
|
|
37
38
|
imagePath: string;
|
|
38
39
|
htmlPrompt: string;
|
|
40
|
+
htmlPath: string;
|
|
39
41
|
htmlImageSystemPrompt: string[];
|
|
40
42
|
} | {
|
|
41
43
|
imagePath: string;
|
|
@@ -65,6 +67,7 @@ export declare const imagePreprocessAgent: (namedInputs: {
|
|
|
65
67
|
};
|
|
66
68
|
movieFile: string | undefined;
|
|
67
69
|
htmlPrompt?: undefined;
|
|
70
|
+
htmlPath?: undefined;
|
|
68
71
|
htmlImageSystemPrompt?: undefined;
|
|
69
72
|
} | {
|
|
70
73
|
images: string[];
|
|
@@ -96,6 +99,7 @@ export declare const imagePreprocessAgent: (namedInputs: {
|
|
|
96
99
|
referenceImage: string;
|
|
97
100
|
prompt: string;
|
|
98
101
|
htmlPrompt?: undefined;
|
|
102
|
+
htmlPath?: undefined;
|
|
99
103
|
htmlImageSystemPrompt?: undefined;
|
|
100
104
|
}>;
|
|
101
105
|
export declare const imagePluginAgent: (namedInputs: {
|
package/lib/actions/images.js
CHANGED
|
@@ -44,7 +44,8 @@ export const imagePreprocessAgent = async (namedInputs) => {
|
|
|
44
44
|
}
|
|
45
45
|
if (beat.htmlPrompt) {
|
|
46
46
|
const htmlPrompt = beat.htmlPrompt.prompt + (beat.htmlPrompt.data ? "\n\n data\n" + JSON.stringify(beat.htmlPrompt.data, null, 2) : "");
|
|
47
|
-
|
|
47
|
+
const htmlPath = imagePath.replace(/\.[^/.]+$/, ".html");
|
|
48
|
+
return { imagePath, htmlPrompt, htmlPath, htmlImageSystemPrompt: htmlImageSystemPrompt(context.presentationStyle.canvasSize) };
|
|
48
49
|
}
|
|
49
50
|
// images for "edit_image"
|
|
50
51
|
const images = (() => {
|
|
@@ -77,11 +78,8 @@ export const imagePluginAgent = async (namedInputs) => {
|
|
|
77
78
|
}
|
|
78
79
|
};
|
|
79
80
|
const htmlImageGeneratorAgent = async (namedInputs) => {
|
|
80
|
-
const {
|
|
81
|
-
|
|
82
|
-
const htmlFile = file.replace(/\.[^/.]+$/, ".html");
|
|
83
|
-
await fs.promises.writeFile(htmlFile, html, "utf8");
|
|
84
|
-
await renderHTMLToImage(html, file, canvasSize.width, canvasSize.height);
|
|
81
|
+
const { file, canvasSize, htmlText } = namedInputs;
|
|
82
|
+
await renderHTMLToImage(htmlText, file, canvasSize.width, canvasSize.height);
|
|
85
83
|
};
|
|
86
84
|
const beat_graph_data = {
|
|
87
85
|
version: 0.5,
|
|
@@ -124,14 +122,33 @@ const beat_graph_data = {
|
|
|
124
122
|
model: ":htmlImageAgentInfo.model",
|
|
125
123
|
max_tokens: ":htmlImageAgentInfo.max_tokens",
|
|
126
124
|
},
|
|
125
|
+
file: ":preprocessor.htmlPath", // only for fileCacheAgentFilter
|
|
126
|
+
mulmoContext: ":context", // for fileCacheAgentFilter
|
|
127
|
+
index: ":__mapIndex", // for fileCacheAgentFilter
|
|
128
|
+
sessionType: "html", // for fileCacheAgentFilter
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
htmlReader: {
|
|
132
|
+
if: ":preprocessor.htmlPrompt",
|
|
133
|
+
agent: async (namedInputs) => {
|
|
134
|
+
const html = await fs.promises.readFile(namedInputs.htmlPath, "utf8");
|
|
135
|
+
return { html };
|
|
127
136
|
},
|
|
137
|
+
inputs: {
|
|
138
|
+
onComplete: ":htmlImageAgent", // to wait for htmlImageAgent to finish
|
|
139
|
+
htmlPath: ":preprocessor.htmlPath",
|
|
140
|
+
},
|
|
141
|
+
output: {
|
|
142
|
+
htmlText: ".html.codeBlockOrRaw()",
|
|
143
|
+
},
|
|
144
|
+
defaultValue: {},
|
|
128
145
|
},
|
|
129
146
|
htmlImageGenerator: {
|
|
130
147
|
if: ":preprocessor.htmlPrompt",
|
|
131
148
|
defaultValue: {},
|
|
132
149
|
agent: htmlImageGeneratorAgent,
|
|
133
150
|
inputs: {
|
|
134
|
-
|
|
151
|
+
htmlText: ":htmlReader.htmlText",
|
|
135
152
|
canvasSize: ":context.presentationStyle.canvasSize",
|
|
136
153
|
file: ":preprocessor.imagePath", // only for fileCacheAgentFilter
|
|
137
154
|
mulmoContext: ":context", // for fileCacheAgentFilter
|
|
@@ -295,7 +312,7 @@ const graphOption = async (context, settings) => {
|
|
|
295
312
|
{
|
|
296
313
|
name: "fileCacheAgentFilter",
|
|
297
314
|
agent: fileCacheAgentFilter,
|
|
298
|
-
nodeIds: ["imageGenerator", "movieGenerator", "htmlImageGenerator"],
|
|
315
|
+
nodeIds: ["imageGenerator", "movieGenerator", "htmlImageGenerator", "htmlImageAgent"],
|
|
299
316
|
},
|
|
300
317
|
];
|
|
301
318
|
const taskManager = new TaskManager(getConcurrency(context));
|
package/lib/types/schema.d.ts
CHANGED
|
@@ -5207,15 +5207,18 @@ export declare const mulmoSessionStateSchema: z.ZodObject<{
|
|
|
5207
5207
|
movie: z.ZodRecord<z.ZodNumber, z.ZodBoolean>;
|
|
5208
5208
|
multiLingual: z.ZodRecord<z.ZodNumber, z.ZodBoolean>;
|
|
5209
5209
|
caption: z.ZodRecord<z.ZodNumber, z.ZodBoolean>;
|
|
5210
|
+
html: z.ZodRecord<z.ZodNumber, z.ZodBoolean>;
|
|
5210
5211
|
}, "strip", z.ZodTypeAny, {
|
|
5211
5212
|
image: Record<number, boolean>;
|
|
5212
5213
|
movie: Record<number, boolean>;
|
|
5214
|
+
html: Record<number, boolean>;
|
|
5213
5215
|
audio: Record<number, boolean>;
|
|
5214
5216
|
multiLingual: Record<number, boolean>;
|
|
5215
5217
|
caption: Record<number, boolean>;
|
|
5216
5218
|
}, {
|
|
5217
5219
|
image: Record<number, boolean>;
|
|
5218
5220
|
movie: Record<number, boolean>;
|
|
5221
|
+
html: Record<number, boolean>;
|
|
5219
5222
|
audio: Record<number, boolean>;
|
|
5220
5223
|
multiLingual: Record<number, boolean>;
|
|
5221
5224
|
caption: Record<number, boolean>;
|
|
@@ -5232,6 +5235,7 @@ export declare const mulmoSessionStateSchema: z.ZodObject<{
|
|
|
5232
5235
|
inBeatSession: {
|
|
5233
5236
|
image: Record<number, boolean>;
|
|
5234
5237
|
movie: Record<number, boolean>;
|
|
5238
|
+
html: Record<number, boolean>;
|
|
5235
5239
|
audio: Record<number, boolean>;
|
|
5236
5240
|
multiLingual: Record<number, boolean>;
|
|
5237
5241
|
caption: Record<number, boolean>;
|
|
@@ -5248,6 +5252,7 @@ export declare const mulmoSessionStateSchema: z.ZodObject<{
|
|
|
5248
5252
|
inBeatSession: {
|
|
5249
5253
|
image: Record<number, boolean>;
|
|
5250
5254
|
movie: Record<number, boolean>;
|
|
5255
|
+
html: Record<number, boolean>;
|
|
5251
5256
|
audio: Record<number, boolean>;
|
|
5252
5257
|
multiLingual: Record<number, boolean>;
|
|
5253
5258
|
caption: Record<number, boolean>;
|
package/lib/types/schema.js
CHANGED
|
@@ -377,6 +377,7 @@ export const mulmoSessionStateSchema = z.object({
|
|
|
377
377
|
movie: z.record(z.number().int(), z.boolean()),
|
|
378
378
|
multiLingual: z.record(z.number().int(), z.boolean()),
|
|
379
379
|
caption: z.record(z.number().int(), z.boolean()),
|
|
380
|
+
html: z.record(z.number().int(), z.boolean()),
|
|
380
381
|
}),
|
|
381
382
|
});
|
|
382
383
|
export const mulmoStudioSchema = z
|
package/lib/types/type.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ export type Text2HtmlAgentInfo = {
|
|
|
90
90
|
export type BeatMediaType = "movie" | "image";
|
|
91
91
|
export type StoryToScriptGenerateMode = (typeof storyToScriptGenerateMode)[keyof typeof storyToScriptGenerateMode];
|
|
92
92
|
export type SessionType = "audio" | "image" | "video" | "multiLingual" | "caption" | "pdf";
|
|
93
|
-
export type BeatSessionType = "audio" | "image" | "multiLingual" | "caption" | "movie";
|
|
93
|
+
export type BeatSessionType = "audio" | "image" | "multiLingual" | "caption" | "movie" | "html";
|
|
94
94
|
export type SessionProgressEvent = {
|
|
95
95
|
kind: "session";
|
|
96
96
|
sessionType: SessionType;
|
package/lib/utils/context.d.ts
CHANGED
package/lib/utils/context.js
CHANGED
package/lib/utils/filters.js
CHANGED
|
@@ -22,18 +22,23 @@ export const fileCacheAgentFilter = async (context, next) => {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
if (await shouldUseCache()) {
|
|
25
|
-
GraphAILogger.debug(
|
|
25
|
+
GraphAILogger.debug(`cache: ${path.basename(file)}`);
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
28
28
|
try {
|
|
29
29
|
MulmoStudioContextMethods.setBeatSessionState(mulmoContext, sessionType, index, true);
|
|
30
|
-
const output = (await next(context));
|
|
31
|
-
const buffer
|
|
30
|
+
const output = (await next(context)) || undefined;
|
|
31
|
+
const { buffer, text } = output ?? {};
|
|
32
32
|
if (buffer) {
|
|
33
33
|
writingMessage(file);
|
|
34
34
|
await fsPromise.writeFile(file, buffer);
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
|
+
else if (text) {
|
|
38
|
+
writingMessage(file);
|
|
39
|
+
await fsPromise.writeFile(file, text, "utf-8");
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
37
42
|
GraphAILogger.log("no cache, no buffer: " + file);
|
|
38
43
|
return false;
|
|
39
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mulmocast",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -73,18 +73,18 @@
|
|
|
73
73
|
"@tavily/core": "^0.5.9",
|
|
74
74
|
"canvas": "^3.1.2",
|
|
75
75
|
"clipboardy": "^4.0.0",
|
|
76
|
-
"dotenv": "^17.0
|
|
76
|
+
"dotenv": "^17.1.0",
|
|
77
77
|
"fluent-ffmpeg": "^2.1.3",
|
|
78
78
|
"google-auth-library": "^9.15.1",
|
|
79
|
-
"graphai": "^2.0.
|
|
79
|
+
"graphai": "^2.0.12",
|
|
80
80
|
"inquirer": "^12.7.0",
|
|
81
81
|
"marked": "^16.0.0",
|
|
82
82
|
"ora": "^8.2.0",
|
|
83
|
-
"puppeteer": "^24.
|
|
83
|
+
"puppeteer": "^24.12.0",
|
|
84
84
|
"replicate": "^1.0.1",
|
|
85
85
|
"yaml": "^2.8.0",
|
|
86
86
|
"yargs": "^18.0.0",
|
|
87
|
-
"zod": "^3.25.
|
|
87
|
+
"zod": "^3.25.76",
|
|
88
88
|
"zod-to-json-schema": "^3.24.6"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"ts-node": "^10.9.2",
|
|
101
101
|
"tsx": "^4.20.3",
|
|
102
102
|
"typescript": "^5.7.3",
|
|
103
|
-
"typescript-eslint": "^8.
|
|
103
|
+
"typescript-eslint": "^8.36.0"
|
|
104
104
|
},
|
|
105
105
|
"engines": {
|
|
106
106
|
"node": ">=18.0.0"
|