@effectnode/media 0.1.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 (133) hide show
  1. package/bin/effectnode-media +2 -0
  2. package/dist/backend/index.d.ts +8 -0
  3. package/dist/backend/index.js +13 -0
  4. package/dist/backend/movie-backend/agent/agent-backend.d.ts +16 -0
  5. package/dist/backend/movie-backend/agent/agent-backend.js +703 -0
  6. package/dist/backend/movie-backend/agent/storyprompt.d.ts +1 -0
  7. package/dist/backend/movie-backend/agent/storyprompt.js +90 -0
  8. package/dist/backend/movie-backend/agent/tools/edit-image.d.ts +3 -0
  9. package/dist/backend/movie-backend/agent/tools/edit-image.js +192 -0
  10. package/dist/backend/movie-backend/agent/tools/get-time.d.ts +3 -0
  11. package/dist/backend/movie-backend/agent/tools/get-time.js +7 -0
  12. package/dist/backend/movie-backend/agent/tools/grep-files.d.ts +3 -0
  13. package/dist/backend/movie-backend/agent/tools/grep-files.js +59 -0
  14. package/dist/backend/movie-backend/agent/tools/image-to-video-generation.d.ts +3 -0
  15. package/dist/backend/movie-backend/agent/tools/image-to-video-generation.js +160 -0
  16. package/dist/backend/movie-backend/agent/tools/index.d.ts +7 -0
  17. package/dist/backend/movie-backend/agent/tools/index.js +59 -0
  18. package/dist/backend/movie-backend/agent/tools/list-files.d.ts +3 -0
  19. package/dist/backend/movie-backend/agent/tools/list-files.js +17 -0
  20. package/dist/backend/movie-backend/agent/tools/read-file.d.ts +3 -0
  21. package/dist/backend/movie-backend/agent/tools/read-file.js +28 -0
  22. package/dist/backend/movie-backend/agent/tools/remove-file.d.ts +3 -0
  23. package/dist/backend/movie-backend/agent/tools/remove-file.js +22 -0
  24. package/dist/backend/movie-backend/agent/tools/rename-file.d.ts +3 -0
  25. package/dist/backend/movie-backend/agent/tools/rename-file.js +37 -0
  26. package/dist/backend/movie-backend/agent/tools/show-image.d.ts +3 -0
  27. package/dist/backend/movie-backend/agent/tools/show-image.js +28 -0
  28. package/dist/backend/movie-backend/agent/tools/stitch-videos.d.ts +3 -0
  29. package/dist/backend/movie-backend/agent/tools/stitch-videos.js +96 -0
  30. package/dist/backend/movie-backend/agent/tools/text-to-video-generation.d.ts +3 -0
  31. package/dist/backend/movie-backend/agent/tools/text-to-video-generation.js +125 -0
  32. package/dist/backend/movie-backend/agent/tools/types.d.ts +15 -0
  33. package/dist/backend/movie-backend/agent/tools/types.js +1 -0
  34. package/dist/backend/movie-backend/agent/tools/update-file.d.ts +3 -0
  35. package/dist/backend/movie-backend/agent/tools/update-file.js +27 -0
  36. package/dist/backend/movie-backend/agent/tools/write-file.d.ts +3 -0
  37. package/dist/backend/movie-backend/agent/tools/write-file.js +26 -0
  38. package/dist/backend/movie-backend/agent/workspace.d.ts +25 -0
  39. package/dist/backend/movie-backend/agent/workspace.js +124 -0
  40. package/dist/backend/movie-backend/core.d.ts +4 -0
  41. package/dist/backend/movie-backend/core.js +1167 -0
  42. package/dist/backend/movie-backend/generation-queue.d.ts +24 -0
  43. package/dist/backend/movie-backend/generation-queue.js +766 -0
  44. package/dist/backend/movie-backend/process.d.ts +21 -0
  45. package/dist/backend/movie-backend/process.js +98 -0
  46. package/dist/backend/movie-backend/render-media.d.ts +48 -0
  47. package/dist/backend/movie-backend/render-media.js +3311 -0
  48. package/dist/backend/routes/health.d.ts +1 -0
  49. package/dist/backend/routes/health.js +9 -0
  50. package/dist/backend/routes/index.d.ts +1 -0
  51. package/dist/backend/routes/index.js +11 -0
  52. package/dist/backend/routes/media.d.ts +1 -0
  53. package/dist/backend/routes/media.js +13 -0
  54. package/dist/backend/routes/projects.d.ts +8 -0
  55. package/dist/backend/routes/projects.js +68 -0
  56. package/dist/backend/routes/voice.d.ts +1 -0
  57. package/dist/backend/routes/voice.js +39 -0
  58. package/dist/backend/routes.d.ts +1 -0
  59. package/dist/backend/routes.js +20 -0
  60. package/dist/backend/server.d.ts +1 -0
  61. package/dist/backend/server.js +23 -0
  62. package/dist/backend/workspace.d.ts +5 -0
  63. package/dist/backend/workspace.js +27 -0
  64. package/dist/backend/ws/index.d.ts +3 -0
  65. package/dist/backend/ws/index.js +27 -0
  66. package/dist/backend/ws/messages.d.ts +8 -0
  67. package/dist/backend/ws/messages.js +21 -0
  68. package/dist/backend/ws.d.ts +3 -0
  69. package/dist/backend/ws.js +29 -0
  70. package/dist/index.d.ts +2 -0
  71. package/dist/index.js +80 -0
  72. package/frontend/index.html +22 -0
  73. package/frontend/public/ffmpeg/ffmpeg-core.js +16 -0
  74. package/frontend/public/ffmpeg/ffmpeg-core.wasm +0 -0
  75. package/frontend/src/index.css +46 -0
  76. package/frontend/src/main.tsx +13 -0
  77. package/frontend/src/movie-app/AppRouter.tsx +14 -0
  78. package/frontend/src/movie-app/MediaStudio.tsx +9 -0
  79. package/frontend/src/movie-app/SetupPage.tsx +293 -0
  80. package/frontend/src/movie-app/components/AgentWorkspace.tsx +574 -0
  81. package/frontend/src/movie-app/components/ChatUI/ChatUI.tsx +655 -0
  82. package/frontend/src/movie-app/components/ChatUI/MarkdownMessage.tsx +267 -0
  83. package/frontend/src/movie-app/components/EditorTabs/AgentTab.tsx +61 -0
  84. package/frontend/src/movie-app/components/EditorTabs/BatchImageToVideoTab.tsx +927 -0
  85. package/frontend/src/movie-app/components/EditorTabs/BatchVideoTab.tsx +777 -0
  86. package/frontend/src/movie-app/components/EditorTabs/BatchVoiceVideoTab.tsx +913 -0
  87. package/frontend/src/movie-app/components/EditorTabs/CharacterSheet.tsx +234 -0
  88. package/frontend/src/movie-app/components/EditorTabs/CharactersTab.tsx +664 -0
  89. package/frontend/src/movie-app/components/EditorTabs/CropTool.tsx +251 -0
  90. package/frontend/src/movie-app/components/EditorTabs/ExtendVideoTab.tsx +305 -0
  91. package/frontend/src/movie-app/components/EditorTabs/ExtractImageTab.tsx +249 -0
  92. package/frontend/src/movie-app/components/EditorTabs/FastImageEditTab.tsx +555 -0
  93. package/frontend/src/movie-app/components/EditorTabs/GenerateVideoTab.tsx +722 -0
  94. package/frontend/src/movie-app/components/EditorTabs/LlmServerTab.tsx +40 -0
  95. package/frontend/src/movie-app/components/EditorTabs/MlxVlmServerPanel.tsx +490 -0
  96. package/frontend/src/movie-app/components/EditorTabs/MovieStudioTab.tsx +938 -0
  97. package/frontend/src/movie-app/components/EditorTabs/ReferencesToVideoTab.tsx +881 -0
  98. package/frontend/src/movie-app/components/EditorTabs/SceneVisualTab.tsx +267 -0
  99. package/frontend/src/movie-app/components/EditorTabs/StoryWriterTab.tsx +51 -0
  100. package/frontend/src/movie-app/components/EditorTabs/TaskQueuePanel.tsx +246 -0
  101. package/frontend/src/movie-app/components/EditorTabs/TerminalLogPanel.tsx +49 -0
  102. package/frontend/src/movie-app/components/EditorTabs/TextToImageTab.tsx +574 -0
  103. package/frontend/src/movie-app/components/EditorTabs/VoiceChatPanel.tsx +320 -0
  104. package/frontend/src/movie-app/components/ProjectEditorPage.tsx +636 -0
  105. package/frontend/src/movie-app/components/ProjectManager.tsx +381 -0
  106. package/frontend/src/movie-app/index.css +46 -0
  107. package/frontend/src/movie-app/index.html +16 -0
  108. package/frontend/src/movie-app/lambobo.png +0 -0
  109. package/frontend/src/movie-app/lib/batchImageToVideoStorage.ts +69 -0
  110. package/frontend/src/movie-app/lib/batchVideoStorage.ts +68 -0
  111. package/frontend/src/movie-app/lib/batchVoiceStorage.ts +75 -0
  112. package/frontend/src/movie-app/lib/ffmpeg.ts +42 -0
  113. package/frontend/src/movie-app/lib/referencesToVideoStorage.ts +64 -0
  114. package/frontend/src/movie-app/lib/textToImageStorage.ts +61 -0
  115. package/frontend/src/movie-app/public/ffmpeg/ffmpeg-core.js +16 -0
  116. package/frontend/src/movie-app/public/ffmpeg/ffmpeg-core.wasm +0 -0
  117. package/frontend/src/movie-app/stores/batchImageToVideoStore.ts +736 -0
  118. package/frontend/src/movie-app/stores/batchVideoStore.ts +670 -0
  119. package/frontend/src/movie-app/stores/batchVoiceStore.ts +990 -0
  120. package/frontend/src/movie-app/stores/characterStore.ts +109 -0
  121. package/frontend/src/movie-app/stores/chatStore.ts +459 -0
  122. package/frontend/src/movie-app/stores/generationStore.ts +2140 -0
  123. package/frontend/src/movie-app/stores/logStore.ts +25 -0
  124. package/frontend/src/movie-app/stores/movieStudioStore.ts +709 -0
  125. package/frontend/src/movie-app/stores/projectStore.ts +124 -0
  126. package/frontend/src/movie-app/stores/queueStore.ts +214 -0
  127. package/frontend/src/movie-app/stores/referencesToVideoStore.ts +467 -0
  128. package/frontend/src/movie-app/stores/sceneVisualStore.ts +251 -0
  129. package/frontend/src/movie-app/stores/voiceChatStore.ts +170 -0
  130. package/frontend/src/movie-app/stores/workspaceStore.ts +158 -0
  131. package/frontend/src/vite-env.d.ts +1 -0
  132. package/frontend/tsconfig.json +19 -0
  133. package/package.json +65 -0
@@ -0,0 +1,21 @@
1
+ export interface Subprocess {
2
+ stdout: ReadableStream<Uint8Array> | null;
3
+ stderr: ReadableStream<Uint8Array> | null;
4
+ /** Resolves to the process exit code (or -1 when the process failed to spawn). */
5
+ exited: Promise<number>;
6
+ /** True once the process has been killed or has already exited. */
7
+ readonly killed: boolean;
8
+ kill(): void;
9
+ }
10
+ export interface SpawnOptions {
11
+ cwd?: string;
12
+ env?: NodeJS.ProcessEnv;
13
+ stdout?: "pipe" | "ignore" | "inherit";
14
+ stderr?: "pipe" | "ignore" | "inherit";
15
+ onExit?: (proc: Subprocess, exitCode: number, signalCode: NodeJS.Signals | null, error?: Error) => void;
16
+ }
17
+ export declare function spawn(args: string[], options?: SpawnOptions): Subprocess;
18
+ /** Synchronously resolve an executable from PATH (Bun's `Bun.which`). */
19
+ export declare function whichSync(cmd: string): string | null;
20
+ /** Guess a content type from a filename extension (Bun's `Bun.file().type`). */
21
+ export declare function mimeType(path: string): string;
@@ -0,0 +1,98 @@
1
+ // Node.js replacement for the `bun` process API used across the backend.
2
+ //
3
+ // Bun's `spawn` returns a `Subprocess` whose stdout/stderr are WHATWG
4
+ // `ReadableStream`s and whose `exited` is a Promise<number>. Node's
5
+ // `child_process.spawn` returns a `ChildProcess` with Node streams and an
6
+ // `exit` event instead. This module adapts Node's API to the Bun-shaped API so
7
+ // the rest of the codebase keeps working unchanged.
8
+ import { spawn as nodeSpawn } from "node:child_process";
9
+ import { Readable } from "node:stream";
10
+ import { accessSync, constants } from "node:fs";
11
+ import { delimiter, join } from "node:path";
12
+ /** Convert a Node readable stream into a WHATWG ReadableStream (null-safe). */
13
+ function toWeb(stream) {
14
+ if (!stream)
15
+ return null;
16
+ return Readable.toWeb(stream);
17
+ }
18
+ export function spawn(args, options = {}) {
19
+ const [command, ...rest] = args;
20
+ const child = nodeSpawn(command, rest, {
21
+ cwd: options.cwd,
22
+ env: options.env,
23
+ stdio: ["ignore", options.stdout ?? "pipe", options.stderr ?? "pipe"],
24
+ shell: false,
25
+ });
26
+ let killed = false;
27
+ const proc = {
28
+ stdout: toWeb(child.stdout),
29
+ stderr: toWeb(child.stderr),
30
+ get killed() {
31
+ return killed || child.killed || child.exitCode !== null;
32
+ },
33
+ kill() {
34
+ killed = true;
35
+ child.kill();
36
+ },
37
+ exited: new Promise((resolve) => {
38
+ child.once("error", (err) => {
39
+ killed = true;
40
+ options.onExit?.(proc, -1, null, err);
41
+ resolve(-1);
42
+ });
43
+ child.once("exit", (code, signal) => {
44
+ options.onExit?.(proc, code ?? -1, signal, undefined);
45
+ resolve(code ?? -1);
46
+ });
47
+ }),
48
+ };
49
+ return proc;
50
+ }
51
+ /** Synchronously resolve an executable from PATH (Bun's `Bun.which`). */
52
+ export function whichSync(cmd) {
53
+ if (cmd.includes("/") || cmd.includes("\\")) {
54
+ return isExecutable(cmd) ? cmd : null;
55
+ }
56
+ const path = process.env.PATH ?? "";
57
+ for (const dir of path.split(delimiter).filter(Boolean)) {
58
+ const full = join(dir, cmd);
59
+ if (isExecutable(full))
60
+ return full;
61
+ }
62
+ return null;
63
+ }
64
+ function isExecutable(path) {
65
+ try {
66
+ accessSync(path, constants.X_OK);
67
+ return true;
68
+ }
69
+ catch {
70
+ return false;
71
+ }
72
+ }
73
+ const MIME_TYPES = {
74
+ ".png": "image/png",
75
+ ".jpg": "image/jpeg",
76
+ ".jpeg": "image/jpeg",
77
+ ".webp": "image/webp",
78
+ ".gif": "image/gif",
79
+ ".bmp": "image/bmp",
80
+ ".svg": "image/svg+xml",
81
+ ".mp4": "video/mp4",
82
+ ".mov": "video/quicktime",
83
+ ".webm": "video/webm",
84
+ ".mp3": "audio/mpeg",
85
+ ".wav": "audio/wav",
86
+ ".m4a": "audio/mp4",
87
+ ".flac": "audio/flac",
88
+ ".aac": "audio/aac",
89
+ ".ogg": "audio/ogg",
90
+ ".opus": "audio/opus",
91
+ };
92
+ /** Guess a content type from a filename extension (Bun's `Bun.file().type`). */
93
+ export function mimeType(path) {
94
+ const i = path.lastIndexOf(".");
95
+ if (i === -1)
96
+ return "application/octet-stream";
97
+ return MIME_TYPES[path.slice(i).toLowerCase()] ?? "application/octet-stream";
98
+ }
@@ -0,0 +1,48 @@
1
+ import { type Application } from "express";
2
+ /** Port the app started the mlx-vlm server on (null when the server is not running). */
3
+ export declare function getAgentServerPort(): number | null;
4
+ export interface Project {
5
+ id: string;
6
+ name: string;
7
+ description: string;
8
+ createdAt: string;
9
+ updatedAt: string;
10
+ }
11
+ export interface Character {
12
+ id: string;
13
+ projectId: string;
14
+ name: string;
15
+ filename: string;
16
+ source: "upload" | "generated";
17
+ createdAt: string;
18
+ }
19
+ /** Kill the currently active spawn process (used to cancel a running task). */
20
+ export declare function cancelActiveRender(): void;
21
+ /** Generate a single character/place image (text-to-image) and back it up. */
22
+ export declare function generateAssetImage(projectId: string, kind: "character" | "place", slug: string, prompt: string, onLog?: (text: string) => void): Promise<{
23
+ filename: string;
24
+ url: string;
25
+ } | {
26
+ error: string;
27
+ }>;
28
+ /** Generate a single scene video (LTX-2.3) from its scene image, and back it up. */
29
+ export declare function generateSceneVideo(uvPath: string, projectId: string, scene: any, characters: any[], onLog?: (text: string) => void): Promise<{
30
+ filename: string;
31
+ url: string;
32
+ } | {
33
+ error: string;
34
+ }>;
35
+ /**
36
+ * Generate a single scene image via fast-image-edit (FLUX.2 Klein), using the
37
+ * already-generated character/place images referenced by the scene's slugs.
38
+ */
39
+ export declare function generateSceneImage(projectId: string, scene: any, onLog?: (text: string) => void): Promise<{
40
+ filename: string;
41
+ url: string;
42
+ } | {
43
+ error: string;
44
+ }>;
45
+ export declare function renderMediaRoutes({ app, getUvPath, }: {
46
+ app: Application;
47
+ getUvPath: () => Promise<string>;
48
+ }): Promise<void>;