mulmocast 2.9.2 → 2.11.0

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 (178) hide show
  1. package/lib/actions/image_agents.js +2 -2
  2. package/lib/cli/bin.js +0 -0
  3. package/lib/index.browser.d.ts +7 -0
  4. package/lib/index.browser.js +6 -0
  5. package/lib/methods/mulmo_beat_node.d.ts +3 -3
  6. package/lib/types/const.d.ts +7 -0
  7. package/lib/types/const.js +7 -0
  8. package/lib/types/schema.js +6 -2
  9. package/lib/types/type.d.ts +8 -0
  10. package/lib/utils/beat_html/chart.d.ts +15 -0
  11. package/lib/utils/beat_html/chart.js +21 -0
  12. package/lib/utils/beat_html/html_tailwind.d.ts +19 -0
  13. package/lib/utils/beat_html/html_tailwind.js +20 -0
  14. package/lib/utils/beat_html/index.d.ts +33 -0
  15. package/lib/utils/beat_html/index.js +65 -0
  16. package/lib/utils/beat_html/markdown.d.ts +20 -0
  17. package/lib/utils/beat_html/markdown.js +25 -0
  18. package/lib/utils/beat_html/media.d.ts +14 -0
  19. package/lib/utils/beat_html/media.js +19 -0
  20. package/lib/utils/beat_html/mermaid.d.ts +14 -0
  21. package/lib/utils/beat_html/mermaid.js +22 -0
  22. package/lib/utils/beat_html/slide.d.ts +21 -0
  23. package/lib/utils/beat_html/slide.js +33 -0
  24. package/lib/utils/beat_html/text_slide.d.ts +17 -0
  25. package/lib/utils/beat_html/text_slide.js +24 -0
  26. package/lib/utils/beat_html/type.d.ts +73 -0
  27. package/lib/utils/context.d.ts +24 -0
  28. package/lib/utils/context.js +1 -1
  29. package/lib/utils/element_id.d.ts +26 -0
  30. package/lib/utils/element_id.js +31 -0
  31. package/lib/utils/html_escape.d.ts +14 -0
  32. package/lib/utils/html_escape.js +30 -0
  33. package/lib/utils/image_plugins/beat.d.ts +2 -2
  34. package/lib/utils/image_plugins/bg_image_util.d.ts +4 -1
  35. package/lib/utils/image_plugins/bg_image_util.js +2 -1
  36. package/lib/utils/image_plugins/chart.d.ts +3 -3
  37. package/lib/utils/image_plugins/chart.js +6 -30
  38. package/lib/utils/image_plugins/chart_html.d.ts +24 -0
  39. package/lib/utils/image_plugins/chart_html.js +81 -0
  40. package/lib/utils/image_plugins/html_tailwind.d.ts +3 -3
  41. package/lib/utils/image_plugins/html_tailwind.js +2 -5
  42. package/lib/utils/image_plugins/html_tailwind_markup.d.ts +21 -0
  43. package/lib/utils/image_plugins/html_tailwind_markup.js +8 -0
  44. package/lib/utils/image_plugins/image.d.ts +1 -1
  45. package/lib/utils/image_plugins/index.d.ts +7 -7
  46. package/lib/utils/image_plugins/markdown.d.ts +4 -4
  47. package/lib/utils/image_plugins/markdown.js +41 -30
  48. package/lib/utils/image_plugins/markdown_layout.d.ts +46 -4
  49. package/lib/utils/image_plugins/markdown_layout.js +96 -83
  50. package/lib/utils/image_plugins/media_html.d.ts +16 -0
  51. package/lib/utils/image_plugins/media_html.js +39 -0
  52. package/lib/utils/image_plugins/mermaid.d.ts +5 -4
  53. package/lib/utils/image_plugins/mermaid.js +4 -16
  54. package/lib/utils/image_plugins/mermaid_html.d.ts +22 -0
  55. package/lib/utils/image_plugins/mermaid_html.js +36 -0
  56. package/lib/utils/image_plugins/movie.d.ts +4 -4
  57. package/lib/utils/image_plugins/movie.js +2 -15
  58. package/lib/utils/image_plugins/slide.d.ts +3 -3
  59. package/lib/utils/image_plugins/source.d.ts +2 -2
  60. package/lib/utils/image_plugins/text_slide.d.ts +4 -4
  61. package/lib/utils/image_plugins/utils.d.ts +2 -2
  62. package/lib/utils/image_plugins/vision.d.ts +3 -3
  63. package/lib/utils/image_plugins/voice_over.d.ts +2 -2
  64. package/lib/utils/swipe_to_html.d.ts +18 -0
  65. package/lib/utils/swipe_to_html.js +26 -2
  66. package/package.json +15 -13
  67. package/scripts/test/test_captions_2.json~ +278 -0
  68. package/scripts/test/test_en_portrait.json~ +31 -0
  69. package/scripts/test/test_slide_image_ref_gemini_en.json~ +289 -0
  70. package/scripts/test/test_vertexai.json~ +21 -0
  71. package/lib/agents/image_google_agent.d.ts +0 -5
  72. package/lib/agents/image_google_agent.js +0 -86
  73. package/lib/agents/movie_google_agent.d.ts +0 -9
  74. package/lib/agents/movie_google_agent.js +0 -122
  75. package/lib/agents/mulmo_prompts_agent.d.ts +0 -7
  76. package/lib/agents/mulmo_prompts_agent.js +0 -37
  77. package/lib/agents/prompts_data.d.ts +0 -15
  78. package/lib/agents/prompts_data.js +0 -16
  79. package/lib/agents/tts_nijivoice_agent.d.ts +0 -5
  80. package/lib/agents/tts_nijivoice_agent.js +0 -69
  81. package/lib/agents/validate_mulmo_script_agent.d.ts +0 -17
  82. package/lib/agents/validate_mulmo_script_agent.js +0 -34
  83. package/lib/cli/args.d.ts +0 -15
  84. package/lib/cli/args.js +0 -62
  85. package/lib/cli/cli.d.ts +0 -17
  86. package/lib/cli/cli.js +0 -117
  87. package/lib/cli/run.d.ts +0 -2
  88. package/lib/cli/run.js +0 -3
  89. package/lib/cli/tool-args.d.ts +0 -16
  90. package/lib/cli/tool-args.js +0 -64
  91. package/lib/cli/tool-cli.d.ts +0 -2
  92. package/lib/cli/tool-cli.js +0 -32
  93. package/lib/cli/tool_commands/prompt/builder.d.ts +0 -4
  94. package/lib/cli/tool_commands/prompt/builder.js +0 -11
  95. package/lib/cli/tool_commands/prompt/handler.d.ts +0 -4
  96. package/lib/cli/tool_commands/prompt/handler.js +0 -14
  97. package/lib/cli/tool_commands/prompt/index.d.ts +0 -4
  98. package/lib/cli/tool_commands/prompt/index.js +0 -4
  99. package/lib/cli/tool_commands/schema/builder.d.ts +0 -2
  100. package/lib/cli/tool_commands/schema/builder.js +0 -3
  101. package/lib/cli/tool_commands/schema/handler.d.ts +0 -2
  102. package/lib/cli/tool_commands/schema/handler.js +0 -12
  103. package/lib/cli/tool_commands/schema/index.d.ts +0 -4
  104. package/lib/cli/tool_commands/schema/index.js +0 -4
  105. package/lib/cli/tool_commands/scripting/builder.d.ts +0 -20
  106. package/lib/cli/tool_commands/scripting/builder.js +0 -63
  107. package/lib/cli/tool_commands/scripting/handler.d.ts +0 -12
  108. package/lib/cli/tool_commands/scripting/handler.js +0 -36
  109. package/lib/cli/tool_commands/scripting/index.d.ts +0 -4
  110. package/lib/cli/tool_commands/scripting/index.js +0 -4
  111. package/lib/index.d.ts +0 -8
  112. package/lib/index.js +0 -8
  113. package/lib/methods/mulmo_script_template.d.ts +0 -4
  114. package/lib/methods/mulmo_script_template.js +0 -6
  115. package/lib/methods/mulmo_studio.d.ts +0 -8
  116. package/lib/methods/mulmo_studio.js +0 -25
  117. package/lib/slide/blocks.d.ts +0 -13
  118. package/lib/slide/blocks.js +0 -251
  119. package/lib/slide/index.d.ts +0 -6
  120. package/lib/slide/index.js +0 -7
  121. package/lib/slide/layouts/big_quote.d.ts +0 -2
  122. package/lib/slide/layouts/big_quote.js +0 -19
  123. package/lib/slide/layouts/columns.d.ts +0 -2
  124. package/lib/slide/layouts/columns.js +0 -53
  125. package/lib/slide/layouts/comparison.d.ts +0 -2
  126. package/lib/slide/layouts/comparison.js +0 -25
  127. package/lib/slide/layouts/funnel.d.ts +0 -2
  128. package/lib/slide/layouts/funnel.js +0 -25
  129. package/lib/slide/layouts/grid.d.ts +0 -2
  130. package/lib/slide/layouts/grid.js +0 -38
  131. package/lib/slide/layouts/index.d.ts +0 -3
  132. package/lib/slide/layouts/index.js +0 -46
  133. package/lib/slide/layouts/matrix.d.ts +0 -2
  134. package/lib/slide/layouts/matrix.js +0 -53
  135. package/lib/slide/layouts/split.d.ts +0 -2
  136. package/lib/slide/layouts/split.js +0 -51
  137. package/lib/slide/layouts/stats.d.ts +0 -2
  138. package/lib/slide/layouts/stats.js +0 -23
  139. package/lib/slide/layouts/table.d.ts +0 -2
  140. package/lib/slide/layouts/table.js +0 -10
  141. package/lib/slide/layouts/timeline.d.ts +0 -2
  142. package/lib/slide/layouts/timeline.js +0 -27
  143. package/lib/slide/layouts/title.d.ts +0 -2
  144. package/lib/slide/layouts/title.js +0 -19
  145. package/lib/slide/layouts/waterfall.d.ts +0 -2
  146. package/lib/slide/layouts/waterfall.js +0 -63
  147. package/lib/slide/render.d.ts +0 -17
  148. package/lib/slide/render.js +0 -101
  149. package/lib/slide/schema.d.ts +0 -9309
  150. package/lib/slide/schema.js +0 -434
  151. package/lib/slide/utils.d.ts +0 -76
  152. package/lib/slide/utils.js +0 -243
  153. package/lib/tools/prompt.js +0 -18
  154. package/lib/tools/seed.d.ts +0 -3
  155. package/lib/tools/seed.js +0 -211
  156. package/lib/tools/seed_from_url.d.ts +0 -3
  157. package/lib/tools/seed_from_url.js +0 -188
  158. package/lib/types/slide.d.ts +0 -9309
  159. package/lib/types/slide.js +0 -434
  160. package/lib/utils/assets.d.ts +0 -18
  161. package/lib/utils/assets.js +0 -101
  162. package/lib/utils/cli.d.ts +0 -1
  163. package/lib/utils/cli.js +0 -15
  164. package/lib/utils/const.d.ts +0 -12
  165. package/lib/utils/const.js +0 -12
  166. package/lib/utils/image_preprocess.d.ts +0 -14
  167. package/lib/utils/image_preprocess.js +0 -52
  168. package/lib/utils/markdown.d.ts +0 -3
  169. package/lib/utils/markdown.js +0 -42
  170. package/lib/utils/pdf.d.ts +0 -9
  171. package/lib/utils/pdf.js +0 -77
  172. package/lib/utils/preprocess.d.ts +0 -343
  173. package/lib/utils/preprocess.js +0 -58
  174. package/lib/utils/provider2agent.d.ts +0 -141
  175. package/lib/utils/provider2agent.js +0 -267
  176. package/lib/utils/text_hash.d.ts +0 -1
  177. package/lib/utils/text_hash.js +0 -4
  178. /package/lib/{tools/prompt.d.ts → utils/beat_html/type.js} +0 -0
@@ -0,0 +1,289 @@
1
+ {
2
+ "$mulmocast": { "version": "1.1" },
3
+ "lang": "en",
4
+ "title": "The Higgs Boson — Exploring the Origin of Mass",
5
+ "slideParams": {
6
+ "theme": {
7
+ "colors": {
8
+ "bg": "0B1120",
9
+ "bgCard": "162032",
10
+ "bgCardAlt": "1E2D45",
11
+ "text": "F0F4F8",
12
+ "textMuted": "A0AEC0",
13
+ "textDim": "4A5568",
14
+ "primary": "63B3ED",
15
+ "accent": "B794F4",
16
+ "success": "68D391",
17
+ "warning": "F6AD55",
18
+ "danger": "FC8181",
19
+ "info": "4FD1C5",
20
+ "highlight": "F687B3"
21
+ },
22
+ "fonts": { "title": "Georgia", "body": "Calibri", "mono": "Consolas" }
23
+ }
24
+ },
25
+ "imageParams": {
26
+ "provider": "genai",
27
+ "model": "gemini-3-pro-image-preview",
28
+ "images": {
29
+ "detector": {
30
+ "type": "imagePrompt",
31
+ "prompt": "A massive cylindrical particle detector at CERN, showing intricate layers of sensors and electronics in warm orange and gold lighting, photorealistic, wide-angle view from inside the detector barrel"
32
+ },
33
+ "lhc": {
34
+ "type": "imagePrompt",
35
+ "prompt": "The Large Hadron Collider tunnel at CERN, a long curved underground tunnel with blue superconducting magnets stretching into the distance, cool blue lighting, photorealistic"
36
+ },
37
+ "higgs_event": {
38
+ "type": "imagePrompt",
39
+ "prompt": "A colorful particle collision event display from the CMS detector at CERN, showing radiating particle tracks in green, red and blue lines emanating from a central collision point on a dark background, scientific visualization style"
40
+ }
41
+ }
42
+ },
43
+ "beats": [
44
+ {
45
+ "text": "What is the Higgs boson? Let's look back at the history of its discovery.",
46
+ "image": {
47
+ "type": "slide",
48
+ "slide": {
49
+ "layout": "title",
50
+ "title": "The Higgs Boson",
51
+ "subtitle": "A Journey to the Origin of Mass",
52
+ "author": "Introduction to Particle Physics"
53
+ }
54
+ }
55
+ },
56
+ {
57
+ "text": "The Higgs boson holds a special place in the Standard Model.",
58
+ "image": {
59
+ "type": "slide",
60
+ "slide": {
61
+ "layout": "columns",
62
+ "title": "Particles of the Standard Model",
63
+ "subtitle": "17 Elementary Particles",
64
+ "columns": [
65
+ {
66
+ "title": "Fermions",
67
+ "accentColor": "primary",
68
+ "content": [
69
+ { "type": "imageRef", "ref": "detector", "alt": "Fermion interactions" },
70
+ { "type": "bullets", "items": ["Quarks (6 types)", "Leptons (6 types)"], "icon": "⚛" },
71
+ { "type": "text", "value": "Particles that make up matter", "dim": true }
72
+ ]
73
+ },
74
+ {
75
+ "title": "Bosons",
76
+ "accentColor": "accent",
77
+ "content": [
78
+ { "type": "imageRef", "ref": "lhc", "alt": "LHC tunnel" },
79
+ { "type": "bullets", "items": ["Photon", "W & Z bosons", "Gluon"], "icon": "⚡" },
80
+ { "type": "text", "value": "Force-carrying particles", "dim": true }
81
+ ]
82
+ },
83
+ {
84
+ "title": "Higgs Boson",
85
+ "accentColor": "highlight",
86
+ "content": [
87
+ { "type": "imageRef", "ref": "higgs_event", "alt": "Higgs boson decay" },
88
+ { "type": "text", "value": "Origin of Mass", "bold": true, "color": "highlight" },
89
+ { "type": "text", "value": "The only scalar particle. Discovered at CERN in 2012.", "dim": true }
90
+ ]
91
+ }
92
+ ]
93
+ }
94
+ }
95
+ },
96
+ {
97
+ "text": "Let's look at the Higgs boson decay event captured by the LHC detector.",
98
+ "image": {
99
+ "type": "slide",
100
+ "slide": {
101
+ "layout": "split",
102
+ "left": {
103
+ "title": "CMS Detector Event",
104
+ "content": [{ "type": "imageRef", "ref": "detector", "alt": "CMS detector event display", "fit": "cover" }]
105
+ },
106
+ "right": {
107
+ "title": "What Are We Seeing?",
108
+ "content": [
109
+ { "type": "text", "value": "Protons are collided at near light speed, and the resulting particle tracks are captured by the detector." },
110
+ {
111
+ "type": "callout",
112
+ "text": "The Higgs boson cannot be observed directly — its existence is inferred from pairs of decay particles.",
113
+ "label": "Key Point",
114
+ "color": "info",
115
+ "style": "info"
116
+ },
117
+ { "type": "metric", "value": "125 GeV", "label": "Mass of the Higgs boson" }
118
+ ]
119
+ }
120
+ }
121
+ }
122
+ },
123
+ {
124
+ "text": "A comparison of the ATLAS and CMS experiments.",
125
+ "image": {
126
+ "type": "slide",
127
+ "slide": {
128
+ "layout": "comparison",
129
+ "title": "Two Experiments, One Discovery",
130
+ "subtitle": "Each independently achieved 5σ significance",
131
+ "left": {
132
+ "title": "ATLAS Experiment",
133
+ "accentColor": "primary",
134
+ "content": [
135
+ { "type": "imageRef", "ref": "detector", "alt": "ATLAS detector" },
136
+ { "type": "metric", "value": "5.9σ", "label": "Statistical significance", "color": "primary" },
137
+ { "type": "text", "value": "25m diameter, 46m long. About 3,000 physicists participated." }
138
+ ]
139
+ },
140
+ "right": {
141
+ "title": "CMS Experiment",
142
+ "accentColor": "accent",
143
+ "content": [
144
+ { "type": "imageRef", "ref": "lhc", "alt": "CMS detector" },
145
+ { "type": "metric", "value": "5.0σ", "label": "Statistical significance", "color": "accent" },
146
+ { "type": "text", "value": "More compact but equipped with a superconducting solenoid magnet. About 4,000 participants." }
147
+ ]
148
+ },
149
+ "callout": {
150
+ "text": "The simultaneous confirmation by two independent experiments dramatically increased confidence in the result",
151
+ "color": "success"
152
+ }
153
+ }
154
+ }
155
+ },
156
+ {
157
+ "text": "Here's a grid overview of CERN's key facilities.",
158
+ "image": {
159
+ "type": "slide",
160
+ "slide": {
161
+ "layout": "grid",
162
+ "title": "CERN Experimental Facilities",
163
+ "subtitle": "The world's largest particle physics laboratory on the Swiss-French border",
164
+ "gridColumns": 2,
165
+ "items": [
166
+ {
167
+ "title": "LHC Accelerator",
168
+ "accentColor": "primary",
169
+ "content": [
170
+ { "type": "imageRef", "ref": "lhc", "alt": "LHC tunnel", "fit": "cover" },
171
+ { "type": "text", "value": "27km circumference, 100m underground", "dim": true }
172
+ ]
173
+ },
174
+ {
175
+ "title": "ATLAS Detector",
176
+ "accentColor": "accent",
177
+ "content": [
178
+ { "type": "imageRef", "ref": "detector", "alt": "ATLAS detector overview", "fit": "cover" },
179
+ { "type": "text", "value": "25m diameter, weighing 7,000 tonnes", "dim": true }
180
+ ]
181
+ },
182
+ {
183
+ "title": "CMS Detector",
184
+ "accentColor": "info",
185
+ "content": [
186
+ { "type": "imageRef", "ref": "higgs_event", "alt": "CMS detector", "fit": "cover" },
187
+ { "type": "text", "value": "Features superconducting solenoid", "dim": true }
188
+ ]
189
+ },
190
+ {
191
+ "title": "CERN Control Centre",
192
+ "accentColor": "warning",
193
+ "content": [
194
+ { "type": "imageRef", "ref": "detector", "alt": "CERN control room", "fit": "cover" },
195
+ { "type": "text", "value": "24/7 accelerator monitoring", "dim": true }
196
+ ]
197
+ }
198
+ ]
199
+ }
200
+ }
201
+ },
202
+ {
203
+ "text": "Here are the key milestones leading to the discovery.",
204
+ "image": {
205
+ "type": "slide",
206
+ "slide": {
207
+ "layout": "timeline",
208
+ "title": "Road to Discovery",
209
+ "items": [
210
+ { "date": "1964", "title": "Higgs Mechanism Proposed", "description": "P. Higgs et al. published the mass acquisition theory", "done": true },
211
+ { "date": "1983", "title": "W & Z Bosons Discovered", "description": "Confirmed at CERN's SPS experiments", "done": true, "color": "accent" },
212
+ {
213
+ "date": "2008",
214
+ "title": "LHC Begins Operation",
215
+ "description": "The world's largest particle accelerator starts up",
216
+ "done": true,
217
+ "color": "info"
218
+ },
219
+ {
220
+ "date": "2012.7.4",
221
+ "title": "Higgs Boson Discovered",
222
+ "description": "ATLAS and CMS experiments announce simultaneously",
223
+ "done": true,
224
+ "color": "highlight"
225
+ },
226
+ { "date": "2013", "title": "Nobel Prize in Physics", "description": "Awarded to Higgs and Englert", "done": true, "color": "success" }
227
+ ]
228
+ }
229
+ }
230
+ },
231
+ {
232
+ "text": "Let's explore the relationship between the Higgs field and mass.",
233
+ "image": {
234
+ "type": "slide",
235
+ "slide": {
236
+ "layout": "split",
237
+ "left": {
238
+ "title": "Visualizing the Higgs Field",
239
+ "content": [
240
+ { "type": "imageRef", "ref": "higgs_event", "alt": "Higgs field concept", "fit": "contain" },
241
+ { "type": "text", "value": "A field that fills all of space", "dim": true, "align": "center" }
242
+ ]
243
+ },
244
+ "right": {
245
+ "title": "Why Does Mass Arise?",
246
+ "content": [
247
+ {
248
+ "type": "callout",
249
+ "text": "The Higgs field exists everywhere in the universe. Particles acquire mass by interacting with this field.",
250
+ "style": "quote"
251
+ },
252
+ { "type": "divider", "color": "accent" },
253
+ {
254
+ "type": "bullets",
255
+ "items": [
256
+ "Photon: no interaction with Higgs field → zero mass",
257
+ "W boson: strong interaction → heavy",
258
+ "Top quark: strongest interaction → heaviest"
259
+ ],
260
+ "icon": "→"
261
+ },
262
+ { "type": "callout", "text": "Mass = strength of coupling to the Higgs field", "label": "Key Insight", "color": "highlight" }
263
+ ]
264
+ }
265
+ }
266
+ }
267
+ },
268
+ {
269
+ "text": "Let's look at the statistical significance of the discovery in numbers.",
270
+ "image": {
271
+ "type": "slide",
272
+ "slide": {
273
+ "layout": "stats",
274
+ "title": "The Higgs Discovery in Numbers",
275
+ "stats": [
276
+ { "value": "5σ", "label": "Statistical significance", "color": "highlight" },
277
+ { "value": "125.25 GeV", "label": "Measured mass" },
278
+ { "value": "~10⁻²² s", "label": "Lifetime" },
279
+ { "value": "10,000+", "label": "Researchers involved", "color": "info" }
280
+ ],
281
+ "callout": {
282
+ "text": "5σ means the probability of a fluke is 1 in 3.5 million — the threshold for 'discovery' in particle physics.",
283
+ "color": "warning"
284
+ }
285
+ }
286
+ }
287
+ }
288
+ ]
289
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "../../assets/schema.json",
3
+ "title": "Vertex AI Test",
4
+ "description": "Test Vertex AI integration",
5
+ "lang": "en",
6
+ "imageParams": {
7
+ "provider": "google",
8
+ "model": "imagen-4.0-generate-001",
9
+ "vertexai_project": "${GOOGLE_PROJECT_ID}",
10
+ "vertexai_location": "us-central1"
11
+ },
12
+ "speechParams": {
13
+ "provider": "mock"
14
+ },
15
+ "beats": [
16
+ {
17
+ "text": "Hello",
18
+ "imagePrompt": "A simple blue circle on white background"
19
+ }
20
+ ]
21
+ }
@@ -1,5 +0,0 @@
1
- import type { AgentFunction, AgentFunctionInfo } from "graphai";
2
- import type { AgentBufferResult, ImageAgentInputs, ImageAgentParams, GoogleImageAgentConfig } from "../types/agent.js";
3
- export declare const imageGoogleAgent: AgentFunction<ImageAgentParams, AgentBufferResult, ImageAgentInputs, GoogleImageAgentConfig>;
4
- declare const imageGoogleAgentInfo: AgentFunctionInfo;
5
- export default imageGoogleAgentInfo;
@@ -1,86 +0,0 @@
1
- import { GraphAILogger } from "graphai";
2
- import { getAspectRatio } from "./movie_google_agent.js";
3
- import { provider2ImageAgent } from "../utils/provider2agent.js";
4
- async function generateImage(projectId, model, token, prompt, aspectRatio) {
5
- const GOOGLE_IMAGEN_ENDPOINT = `https://us-central1-aiplatform.googleapis.com/v1/projects/${projectId}/locations/us-central1/publishers/google/models/${model}:predict`;
6
- try {
7
- // Prepare the payload for the API request
8
- const payload = {
9
- instances: [
10
- {
11
- prompt,
12
- },
13
- ],
14
- parameters: {
15
- sampleCount: 1,
16
- aspectRatio,
17
- safetySetting: "block_only_high",
18
- },
19
- };
20
- // Make the API call using fetch
21
- const response = await fetch(GOOGLE_IMAGEN_ENDPOINT, {
22
- method: "POST",
23
- headers: {
24
- Authorization: `Bearer ${token}`,
25
- "Content-Type": "application/json",
26
- },
27
- body: JSON.stringify(payload),
28
- });
29
- if (!response.ok) {
30
- throw new Error(`Error: ${response.status} - ${response.statusText}`);
31
- }
32
- const responseData = await response.json();
33
- // Parse and return the generated image URL or data
34
- const predictions = responseData.predictions;
35
- if (predictions && predictions.length > 0) {
36
- const base64Image = predictions[0].bytesBase64Encoded;
37
- if (base64Image) {
38
- return Buffer.from(base64Image, "base64"); // Decode the base64 image to a buffer
39
- }
40
- else {
41
- throw new Error("No base64-encoded image data returned from the API.");
42
- }
43
- }
44
- else {
45
- // console.log(response);
46
- GraphAILogger.info("No predictions returned from the API.", responseData, prompt);
47
- return undefined;
48
- }
49
- }
50
- catch (error) {
51
- GraphAILogger.info("Error generating image:", error);
52
- throw error;
53
- }
54
- }
55
- export const imageGoogleAgent = async ({ namedInputs, params, config, }) => {
56
- const { prompt } = namedInputs;
57
- const aspectRatio = getAspectRatio(params.canvasSize);
58
- const model = params.model ?? provider2ImageAgent["google"].defaultModel;
59
- const projectId = config?.projectId;
60
- const token = config?.token;
61
- try {
62
- const buffer = await generateImage(projectId, model, token, prompt, aspectRatio);
63
- if (buffer) {
64
- return { buffer };
65
- }
66
- throw new Error("ERROR: geneateImage returned undefined");
67
- }
68
- catch (error) {
69
- GraphAILogger.info("Failed to generate image:", error);
70
- throw error;
71
- }
72
- };
73
- const imageGoogleAgentInfo = {
74
- name: "imageGoogleAgent",
75
- agent: imageGoogleAgent,
76
- mock: imageGoogleAgent,
77
- samples: [],
78
- description: "Google Image agent",
79
- category: ["image"],
80
- author: "Receptron Team",
81
- repository: "https://github.com/receptron/mulmocast-cli/",
82
- // source: "https://github.com/receptron/mulmocast-cli/blob/main/src/agents/image_google_agent.ts",
83
- license: "MIT",
84
- environmentVariables: [],
85
- };
86
- export default imageGoogleAgentInfo;
@@ -1,9 +0,0 @@
1
- import type { AgentFunction, AgentFunctionInfo } from "graphai";
2
- import type { AgentBufferResult, GoogleImageAgentConfig, GoogleMovieAgentParams, MovieAgentInputs } from "../types/agent.js";
3
- export declare const getAspectRatio: (canvasSize: {
4
- width: number;
5
- height: number;
6
- }) => string;
7
- export declare const movieGoogleAgent: AgentFunction<GoogleMovieAgentParams, AgentBufferResult, MovieAgentInputs, GoogleImageAgentConfig>;
8
- declare const movieGoogleAgentInfo: AgentFunctionInfo;
9
- export default movieGoogleAgentInfo;
@@ -1,122 +0,0 @@
1
- import { readFileSync } from "fs";
2
- import { GraphAILogger, sleep } from "graphai";
3
- async function generateMovie(projectId, model, token, prompt, imagePath, aspectRatio, duration) {
4
- const GOOGLE_IMAGEN_ENDPOINT = `https://us-central1-aiplatform.googleapis.com/v1/projects/${projectId}/locations/us-central1/publishers/google/models/${model}`;
5
- const payload = {
6
- instances: [
7
- {
8
- prompt,
9
- image: undefined,
10
- },
11
- ],
12
- parameters: {
13
- sampleCount: 1,
14
- aspectRatio,
15
- safetySetting: "block_only_high",
16
- personGeneration: "allow_all",
17
- durationSeconds: duration,
18
- },
19
- };
20
- if (imagePath) {
21
- const buffer = readFileSync(imagePath);
22
- const bytesBase64Encoded = buffer.toString("base64");
23
- payload.instances[0].image = {
24
- bytesBase64Encoded,
25
- mimeType: "image/png",
26
- };
27
- }
28
- // Make the API call using fetch
29
- const response = await fetch(`${GOOGLE_IMAGEN_ENDPOINT}:predictLongRunning`, {
30
- method: "POST",
31
- headers: {
32
- Authorization: `Bearer ${token}`,
33
- "Content-Type": "application/json",
34
- },
35
- body: JSON.stringify(payload),
36
- });
37
- if (!response.ok) {
38
- GraphAILogger.info("create project on google cloud console and setup the project. More details see readme.");
39
- throw new Error(`Error: ${response.status} - ${response.statusText}`);
40
- }
41
- const initialResponse = await response.json();
42
- const fetchBody = {
43
- operationName: initialResponse.name,
44
- };
45
- const completeResponse = await (async () => {
46
- while (true) {
47
- GraphAILogger.info("...waiting for movie generation...");
48
- await sleep(3000);
49
- const operationResponse = await fetch(`${GOOGLE_IMAGEN_ENDPOINT}:fetchPredictOperation`, {
50
- method: "POST",
51
- headers: {
52
- Authorization: `Bearer ${token}`,
53
- "Content-Type": "application/json",
54
- },
55
- body: JSON.stringify(fetchBody),
56
- });
57
- if (!operationResponse.ok) {
58
- throw new Error(`Error: ${operationResponse.status} - ${operationResponse.statusText}`);
59
- }
60
- const responseData = await operationResponse.json();
61
- if (responseData.done) {
62
- if (responseData.error) {
63
- GraphAILogger.info("Prompt: ", prompt);
64
- throw new Error(`Error: ${responseData.error.message}`);
65
- }
66
- if (!responseData.response.videos) {
67
- throw new Error(`No video: ${JSON.stringify(responseData, null, 2)}`);
68
- }
69
- return responseData.response;
70
- }
71
- }
72
- })();
73
- const encodedMovie = completeResponse.videos[0].bytesBase64Encoded;
74
- if (encodedMovie) {
75
- return Buffer.from(encodedMovie, "base64");
76
- }
77
- return undefined;
78
- }
79
- export const getAspectRatio = (canvasSize) => {
80
- if (canvasSize.width > canvasSize.height) {
81
- return "16:9";
82
- }
83
- else if (canvasSize.width < canvasSize.height) {
84
- return "9:16";
85
- }
86
- else {
87
- return "1:1";
88
- }
89
- };
90
- export const movieGoogleAgent = async ({ namedInputs, params, config, }) => {
91
- const { prompt, imagePath } = namedInputs;
92
- const aspectRatio = getAspectRatio(params.canvasSize);
93
- const model = params.model ?? "veo-2.0-generate-001"; // "veo-3.0-generate-preview";
94
- const duration = params.duration ?? 8;
95
- const projectId = config?.projectId;
96
- const token = config?.token;
97
- try {
98
- const buffer = await generateMovie(projectId, model, token, prompt, imagePath, aspectRatio, duration);
99
- if (buffer) {
100
- return { buffer };
101
- }
102
- throw new Error("ERROR: geneateImage returned undefined");
103
- }
104
- catch (error) {
105
- GraphAILogger.info("Failed to generate movie:", error.message);
106
- throw error;
107
- }
108
- };
109
- const movieGoogleAgentInfo = {
110
- name: "movieGoogleAgent",
111
- agent: movieGoogleAgent,
112
- mock: movieGoogleAgent,
113
- samples: [],
114
- description: "Google Movie agent",
115
- category: ["movie"],
116
- author: "Receptron Team",
117
- repository: "https://github.com/receptron/mulmocast-cli/",
118
- // source: "https://github.com/receptron/mulmocast-cli/blob/main/src/agents/image_google_agent.ts",
119
- license: "MIT",
120
- environmentVariables: [],
121
- };
122
- export default movieGoogleAgentInfo;
@@ -1,7 +0,0 @@
1
- import { AgentFunction, AgentFunctionInfo } from "graphai";
2
- import { prompts } from "./prompts_data.js";
3
- export declare const mulmoPromptsAgent: AgentFunction<{
4
- promptKey: keyof typeof prompts;
5
- }>;
6
- declare const mulmoPromptsAgentInfo: AgentFunctionInfo;
7
- export default mulmoPromptsAgentInfo;
@@ -1,37 +0,0 @@
1
- import { prompts } from "./prompts_data.js";
2
- export const mulmoPromptsAgent = async ({ params }) => {
3
- const { promptKey } = params;
4
- if (promptKey) {
5
- const prompt = prompts[promptKey];
6
- if (prompt) {
7
- return {
8
- text: prompt,
9
- };
10
- }
11
- }
12
- return prompts;
13
- };
14
- const mulmoPromptsAgentInfo = {
15
- name: "mulmoPromptsAgent",
16
- agent: mulmoPromptsAgent,
17
- mock: mulmoPromptsAgent,
18
- samples: [
19
- {
20
- inputs: {},
21
- params: {
22
- promptKey: "abstract",
23
- },
24
- result: {
25
- text: "We need to add a summary at the beginning of script, which summarizes this episode, which is very engaging. Please come up with a few sentences for the announcer to read, enter them into this script, and present it as an artifact.",
26
- },
27
- },
28
- ],
29
- description: "Prompts Agent",
30
- category: ["prompt"],
31
- author: "Receptron team",
32
- repository: "https://github.com/receptron/mulmocast-cli",
33
- source: "https://github.com/receptron/mulmocast-cli/tree/main/src/agents/prompts_agent.ts",
34
- // package: "@graphai/prompts",
35
- license: "MIT",
36
- };
37
- export default mulmoPromptsAgentInfo;
@@ -1,15 +0,0 @@
1
- export declare const prompts: {
2
- abstract: string;
3
- image_prompt: string;
4
- prompt: string;
5
- prompt2: string;
6
- prompt3: string;
7
- prompt_eng3: string;
8
- prompt_seed: string;
9
- prompt_seed_materials: string;
10
- prompt_taro: string;
11
- prompt_taro3_json: string;
12
- prompt_taro3_json2: string;
13
- prompt_taro_json: string;
14
- summary: string;
15
- };