mulmocast 0.0.1
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 +74 -0
- package/assets/audio/silent300.mp3 +0 -0
- package/assets/audio/silent800.mp3 +0 -0
- package/assets/music/StarsBeyondEx.mp3 +0 -0
- package/assets/templates/business.json +89 -0
- package/assets/templates/children_book.json +135 -0
- package/assets/templates/podcast_standard.json +5 -0
- package/assets/templates/sensei_and_taro.json +123 -0
- package/lib/actions/audio.d.ts +3 -0
- package/lib/actions/audio.js +186 -0
- package/lib/actions/images.d.ts +2 -0
- package/lib/actions/images.js +211 -0
- package/lib/actions/movie.d.ts +2 -0
- package/lib/actions/movie.js +81 -0
- package/lib/actions/translate.d.ts +3 -0
- package/lib/actions/translate.js +236 -0
- package/lib/agents/add_bgm_agent.d.ts +3 -0
- package/lib/agents/add_bgm_agent.js +61 -0
- package/lib/agents/combine_audio_files_agent.d.ts +3 -0
- package/lib/agents/combine_audio_files_agent.js +57 -0
- package/lib/agents/image_google_agent.d.ts +15 -0
- package/lib/agents/image_google_agent.js +88 -0
- package/lib/agents/image_openai_agent.d.ts +15 -0
- package/lib/agents/image_openai_agent.js +59 -0
- package/lib/agents/index.d.ts +13 -0
- package/lib/agents/index.js +31 -0
- package/lib/agents/mulmo_prompts_agent.d.ts +7 -0
- package/lib/agents/mulmo_prompts_agent.js +41 -0
- package/lib/agents/prompts_data.d.ts +15 -0
- package/lib/agents/prompts_data.js +19 -0
- package/lib/agents/tts_nijivoice_agent.d.ts +4 -0
- package/lib/agents/tts_nijivoice_agent.js +68 -0
- package/lib/agents/tts_openai_agent.d.ts +4 -0
- package/lib/agents/tts_openai_agent.js +50 -0
- package/lib/agents/validate_mulmo_script_agent.d.ts +17 -0
- package/lib/agents/validate_mulmo_script_agent.js +38 -0
- package/lib/cli/args.d.ts +10 -0
- package/lib/cli/args.js +38 -0
- package/lib/cli/cli.d.ts +2 -0
- package/lib/cli/cli.js +78 -0
- package/lib/cli/common.d.ts +8 -0
- package/lib/cli/common.js +26 -0
- package/lib/cli/tool-args.d.ts +12 -0
- package/lib/cli/tool-args.js +53 -0
- package/lib/cli/tool-cli.d.ts +2 -0
- package/lib/cli/tool-cli.js +78 -0
- package/lib/methods/index.d.ts +3 -0
- package/lib/methods/index.js +19 -0
- package/lib/methods/mulmo_script.d.ts +11 -0
- package/lib/methods/mulmo_script.js +45 -0
- package/lib/methods/mulmo_script_template.d.ts +4 -0
- package/lib/methods/mulmo_script_template.js +22 -0
- package/lib/methods/mulmo_studio_context.d.ts +4 -0
- package/lib/methods/mulmo_studio_context.js +12 -0
- package/lib/tools/dump_prompt.d.ts +3 -0
- package/lib/tools/dump_prompt.js +9 -0
- package/lib/tools/prompt.d.ts +1 -0
- package/lib/tools/prompt.js +20 -0
- package/lib/tools/seed.d.ts +3 -0
- package/lib/tools/seed.js +201 -0
- package/lib/tools/seed_from_url.d.ts +3 -0
- package/lib/tools/seed_from_url.js +178 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +17 -0
- package/lib/types/schema.d.ts +5817 -0
- package/lib/types/schema.js +207 -0
- package/lib/types/type.d.ts +33 -0
- package/lib/types/type.js +2 -0
- package/lib/utils/const.d.ts +3 -0
- package/lib/utils/const.js +6 -0
- package/lib/utils/file.d.ts +28 -0
- package/lib/utils/file.js +112 -0
- package/lib/utils/filters.d.ts +3 -0
- package/lib/utils/filters.js +32 -0
- package/lib/utils/markdown.d.ts +1 -0
- package/lib/utils/markdown.js +27 -0
- package/lib/utils/preprocess.d.ts +247 -0
- package/lib/utils/preprocess.js +53 -0
- package/lib/utils/string.d.ts +9 -0
- package/lib/utils/string.js +60 -0
- package/lib/utils/text_hash.d.ts +1 -0
- package/lib/utils/text_hash.js +41 -0
- package/package.json +77 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.createMulmoScriptFromUrl = void 0;
|
|
40
|
+
require("dotenv/config");
|
|
41
|
+
const graphai_1 = require("graphai");
|
|
42
|
+
const openai_agent_1 = require("@graphai/openai_agent");
|
|
43
|
+
const vanilla = __importStar(require("@graphai/vanilla"));
|
|
44
|
+
const vanilla_node_agents_1 = require("@graphai/vanilla_node_agents");
|
|
45
|
+
const browserless_agent_1 = require("@graphai/browserless_agent");
|
|
46
|
+
const validate_mulmo_script_agent_1 = __importDefault(require("../agents/validate_mulmo_script_agent"));
|
|
47
|
+
const file_1 = require("../utils/file");
|
|
48
|
+
const schema_1 = require("../types/schema");
|
|
49
|
+
const graphData = {
|
|
50
|
+
version: 0.5,
|
|
51
|
+
// Execute sequentially because the free version of browserless API doesn't support concurrent execution.
|
|
52
|
+
concurrency: 1,
|
|
53
|
+
nodes: {
|
|
54
|
+
urls: {
|
|
55
|
+
value: [],
|
|
56
|
+
},
|
|
57
|
+
prompt: {
|
|
58
|
+
value: "",
|
|
59
|
+
},
|
|
60
|
+
outdir: {
|
|
61
|
+
value: "",
|
|
62
|
+
},
|
|
63
|
+
fileName: {
|
|
64
|
+
value: "",
|
|
65
|
+
},
|
|
66
|
+
// get the text content of the urls
|
|
67
|
+
fetchResults: {
|
|
68
|
+
agent: "mapAgent",
|
|
69
|
+
inputs: {
|
|
70
|
+
rows: ":urls",
|
|
71
|
+
},
|
|
72
|
+
params: {
|
|
73
|
+
compositeResult: true,
|
|
74
|
+
},
|
|
75
|
+
graph: {
|
|
76
|
+
nodes: {
|
|
77
|
+
fetcher: {
|
|
78
|
+
agent: "browserlessAgent",
|
|
79
|
+
inputs: {
|
|
80
|
+
url: ":row",
|
|
81
|
+
text_content: true,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
copyAgent: {
|
|
85
|
+
agent: "copyAgent",
|
|
86
|
+
inputs: {
|
|
87
|
+
text: '{ url: "${:row}", text: "${:fetcher.text}" }',
|
|
88
|
+
},
|
|
89
|
+
params: {
|
|
90
|
+
namedKey: "text",
|
|
91
|
+
},
|
|
92
|
+
isResult: true,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
// join the text content
|
|
98
|
+
sourceText: {
|
|
99
|
+
agent: "arrayJoinAgent",
|
|
100
|
+
inputs: {
|
|
101
|
+
array: ":fetchResults.copyAgent",
|
|
102
|
+
},
|
|
103
|
+
params: {
|
|
104
|
+
separator: ",",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
// generate the mulmo script
|
|
108
|
+
mulmoScript: {
|
|
109
|
+
agent: "nestedAgent",
|
|
110
|
+
inputs: {
|
|
111
|
+
sourceText: ":sourceText",
|
|
112
|
+
prompt: ":prompt",
|
|
113
|
+
},
|
|
114
|
+
graph: {
|
|
115
|
+
loop: {
|
|
116
|
+
// If the script is not valid and the counter is less than 3, continue the loop
|
|
117
|
+
while: ":continue",
|
|
118
|
+
},
|
|
119
|
+
nodes: {
|
|
120
|
+
counter: {
|
|
121
|
+
value: 0,
|
|
122
|
+
update: ":counter.add(1)",
|
|
123
|
+
},
|
|
124
|
+
openAIAgent: {
|
|
125
|
+
agent: "openAIAgent",
|
|
126
|
+
inputs: {
|
|
127
|
+
model: "gpt-4o",
|
|
128
|
+
system: ":prompt",
|
|
129
|
+
prompt: "Please create a script using the information from the following URLs as reference: ${:sourceText.text}",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
validateMulmoScriptAgent: {
|
|
133
|
+
agent: "validateMulmoScriptAgent",
|
|
134
|
+
inputs: {
|
|
135
|
+
text: ":openAIAgent.text.codeBlock()",
|
|
136
|
+
},
|
|
137
|
+
isResult: true,
|
|
138
|
+
},
|
|
139
|
+
continue: {
|
|
140
|
+
agent: ({ isValid, counter }) => {
|
|
141
|
+
return !isValid && counter < 3;
|
|
142
|
+
},
|
|
143
|
+
inputs: {
|
|
144
|
+
isValid: ":validateMulmoScriptAgent.isValid",
|
|
145
|
+
counter: ":counter",
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
writeJSON: {
|
|
152
|
+
if: ":mulmoScript.validateMulmoScriptAgent.isValid",
|
|
153
|
+
agent: "fileWriteAgent",
|
|
154
|
+
inputs: {
|
|
155
|
+
file: "${:outdir}/${:fileName}-${@now}.json",
|
|
156
|
+
text: ":mulmoScript.validateMulmoScriptAgent.data.toJSON()",
|
|
157
|
+
},
|
|
158
|
+
isResult: true,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
const createMulmoScriptFromUrl = async ({ urls, templateName, outDirPath, filename }) => {
|
|
163
|
+
(0, file_1.mkdir)(outDirPath);
|
|
164
|
+
const parsedUrls = schema_1.urlsSchema.parse(urls);
|
|
165
|
+
const graph = new graphai_1.GraphAI(graphData, {
|
|
166
|
+
...vanilla,
|
|
167
|
+
openAIAgent: openai_agent_1.openAIAgent,
|
|
168
|
+
browserlessAgent: browserless_agent_1.browserlessAgent,
|
|
169
|
+
validateMulmoScriptAgent: validate_mulmo_script_agent_1.default,
|
|
170
|
+
fileWriteAgent: vanilla_node_agents_1.fileWriteAgent,
|
|
171
|
+
});
|
|
172
|
+
graph.injectValue("urls", parsedUrls);
|
|
173
|
+
graph.injectValue("prompt", (0, file_1.readTemplatePrompt)(templateName));
|
|
174
|
+
graph.injectValue("outdir", outDirPath);
|
|
175
|
+
graph.injectValue("fileName", filename);
|
|
176
|
+
await graph.run();
|
|
177
|
+
};
|
|
178
|
+
exports.createMulmoScriptFromUrl = createMulmoScriptFromUrl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./type";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./type"), exports);
|