@j-o-r/hello-dave 0.1.1 → 0.1.5

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 (173) hide show
  1. package/CHANGELOG.md +42 -25
  2. package/README.md +81 -221
  3. package/TODO.md +173 -35
  4. package/agents/agent_creator.js +105 -0
  5. package/agents/agent_creator.prompt.md +371 -0
  6. package/agents/ask_agent.js +64 -127
  7. package/agents/claude_agent.js +68 -0
  8. package/agents/code_agent.js +55 -135
  9. package/agents/code_agent.prompt.md +50 -0
  10. package/agents/echo_agent.js +76 -0
  11. package/agents/financial_expert.js +75 -0
  12. package/agents/gpt_agent.js +52 -103
  13. package/agents/gpt_code.js +81 -0
  14. package/agents/grok_agent.js +58 -114
  15. package/agents/minimax_agent.js +92 -0
  16. package/agents/mureka_agent.js +77 -0
  17. package/agents/planner_agent.js +172 -0
  18. package/agents/stability_agent.js +87 -0
  19. package/agents/test_agent.js +75 -157
  20. package/agents/weather_agent.js +73 -0
  21. package/agents/workflow_agent.js +189 -0
  22. package/bin/dave.js +436 -184
  23. package/docs/bin-dave.md +85 -35
  24. package/docs/cdn-ssh.md +100 -0
  25. package/docs/creating-agents.md +301 -0
  26. package/docs/creating-toolsets.md +336 -0
  27. package/docs/docs-organization.md +48 -0
  28. package/docs/project-overview.md +86 -51
  29. package/lib/API/elevenlabs.io/music.compose.md +441 -0
  30. package/lib/API/elevenlabs.io/music.create-composition-plan.md +370 -0
  31. package/lib/API/elevenlabs.io/music.stream.md +425 -0
  32. package/lib/API/lalal.ai/lalal.js +445 -0
  33. package/lib/API/lalal.ai/openapi.json +2614 -0
  34. package/lib/API/minimax/ImageToolset.js +82 -37
  35. package/lib/API/minimax/MusicToolset.js +125 -79
  36. package/lib/API/minimax/VideoToolset.js +170 -167
  37. package/lib/API/minimax/image.js +5 -1
  38. package/lib/API/minimax/music.js +210 -23
  39. package/lib/API/minimax/video.js +242 -53
  40. package/lib/API/mureka/MusicToolset.js +646 -0
  41. package/lib/API/mureka/README.md +41 -0
  42. package/lib/API/mureka/index.js +7 -0
  43. package/lib/API/mureka/music.js +658 -0
  44. package/lib/API/openai.com/index.js +7 -0
  45. package/lib/API/openai.com/{reponses/text.js → responses.js} +64 -18
  46. package/lib/API/openai.com/video.create.character.md +40 -0
  47. package/lib/API/openai.com/video.create.md +219 -0
  48. package/lib/API/openai.com/video.delete.md +44 -0
  49. package/lib/API/openai.com/video.download.md +31 -0
  50. package/lib/API/openai.com/video.edit.md +155 -0
  51. package/lib/API/openai.com/video.extend.md +166 -0
  52. package/lib/API/openai.com/video.fetch.character.md +43 -0
  53. package/lib/API/openai.com/video.js +784 -0
  54. package/lib/API/openai.com/video.list.md +201 -0
  55. package/lib/API/openai.com/video.remix.md +175 -0
  56. package/lib/API/openai.com/video.retrieve.md +139 -0
  57. package/lib/API/openai.com/videoToolset.js +616 -0
  58. package/lib/API/stability.ai/ImageToolset.js +131 -40
  59. package/lib/API/stability.ai/MusicToolset.js +79 -47
  60. package/lib/API/stability.ai/audio.js +63 -131
  61. package/lib/API/x.ai/chat.responses.md +1040 -0
  62. package/lib/API/x.ai/image.js +229 -59
  63. package/lib/API/x.ai/imageToolset.js +376 -0
  64. package/lib/API/x.ai/index.js +1 -1
  65. package/lib/API/x.ai/responses.js +9 -18
  66. package/lib/Agent.js +271 -0
  67. package/lib/Agent.js.old +284 -0
  68. package/lib/AgentLauncher.js +593 -0
  69. package/lib/Cli.js +87 -13
  70. package/lib/Prompt.js +23 -1
  71. package/lib/Session.js +5 -4
  72. package/lib/ToolSet.js +102 -6
  73. package/lib/agentLoader.js +369 -0
  74. package/lib/cdn.js +67 -231
  75. package/lib/{CdnToolset.js → cdnToolset.js} +47 -64
  76. package/lib/defaultToolsets.js +43 -0
  77. package/lib/fafs.js +1 -1
  78. package/lib/genericToolset.js +442 -119
  79. package/lib/handOffToolset.js +179 -0
  80. package/lib/index.js +34 -27
  81. package/lib/toolsetLoader.js +248 -0
  82. package/package.json +10 -4
  83. package/types/API/lalal.ai/lalal.d.ts +116 -0
  84. package/types/API/minimax/image.d.ts +2 -1
  85. package/types/API/minimax/music.d.ts +189 -26
  86. package/types/API/minimax/video.d.ts +100 -31
  87. package/types/API/mureka/index.d.ts +7 -0
  88. package/types/API/mureka/music.d.ts +472 -0
  89. package/types/API/openai.com/index.d.ts +7 -0
  90. package/types/API/openai.com/{reponses/text.d.ts → responses.d.ts} +11 -11
  91. package/types/API/openai.com/video.d.ts +409 -0
  92. package/types/API/openai.com/videoToolset.d.ts +24 -0
  93. package/types/API/stability.ai/audio.d.ts +14 -103
  94. package/types/API/stability.ai/image.d.ts +2 -2
  95. package/types/API/x.ai/image.d.ts +138 -26
  96. package/types/API/x.ai/imageToolset.d.ts +3 -0
  97. package/types/API/x.ai/index.d.ts +1 -1
  98. package/types/API/x.ai/responses.d.ts +4 -4
  99. package/types/Agent.d.ts +123 -0
  100. package/types/AgentLauncher.d.ts +250 -0
  101. package/types/Cli.d.ts +28 -8
  102. package/types/Prompt.d.ts +23 -5
  103. package/types/Session.d.ts +1 -1
  104. package/types/ToolSet.d.ts +10 -0
  105. package/types/agentLoader.d.ts +78 -0
  106. package/types/cdn.d.ts +15 -90
  107. package/types/defaultToolsets.d.ts +9 -0
  108. package/types/fafs.d.ts +1 -1
  109. package/types/genericToolset.d.ts +1 -1
  110. package/types/handOffToolset.d.ts +28 -0
  111. package/types/index.d.ts +19 -17
  112. package/types/toolsetLoader.d.ts +114 -0
  113. package/utils/format_log.js +101 -23
  114. package/utils/launch_agent.js +18 -0
  115. package/utils/list_sessions.sh +13 -5
  116. package/utils/search_sessions.sh +65 -29
  117. package/utils/toolsets.js +33 -0
  118. package/README.md.bak.1779452127 +0 -240
  119. package/agents/codeserver.sh +0 -47
  120. package/agents/daisy_agent.js +0 -173
  121. package/agents/docs_agent.js +0 -148
  122. package/agents/memory_agent.js +0 -263
  123. package/agents/minimax.js +0 -173
  124. package/agents/npm_agent.js +0 -202
  125. package/agents/prompt_agent.js +0 -133
  126. package/agents/readme_agent.js +0 -148
  127. package/agents/spawn_agent.js +0 -160
  128. package/agents/stability.js +0 -173
  129. package/agents/todo_agent.js +0 -175
  130. package/bin/codeDave +0 -58
  131. package/docs/agent-dave-websocket-protocol.md +0 -180
  132. package/docs/agent-manager.md +0 -244
  133. package/docs/codeserver-pattern.md +0 -191
  134. package/docs/generic-toolset.md +0 -326
  135. package/docs/howtos/agent-networking.md +0 -253
  136. package/docs/howtos/spawn-agents.md.bak +0 -200
  137. package/docs/howtos/spawn-agents.md.bak_new +0 -200
  138. package/docs/multi-agent-clusters.md +0 -265
  139. package/docs/music-toolsets.md +0 -137
  140. package/docs/path-resolution-best-practices.md +0 -104
  141. package/docs/plans/minimax-music-generation.md +0 -80
  142. package/docs/plans/unified-agent-architecture.md +0 -146
  143. package/docs/plans/websocket-streaming-plan.md.bak +0 -317
  144. package/docs/prompt/spawn_agent.md +0 -175
  145. package/docs/prompt/spawn_agent.md.bak +0 -201
  146. package/docs/prompt/task_clarification_and_documentation.md +0 -35
  147. package/docs/prompt-class.md +0 -141
  148. package/docs/todo-archive-infra-2026-04-21.md +0 -15
  149. package/docs/todo-archive-v0.0.8.md +0 -1
  150. package/docs/todo-archive-v0.1.0.md +0 -32
  151. package/docs/todo-archive.md +0 -44
  152. package/docs/tools-syntax-validation.md +0 -121
  153. package/docs/toolset.md +0 -164
  154. package/docs/xai-responses.md +0 -111
  155. package/docs/xai_collections.md +0 -106
  156. package/lib/API/x.ai/ImageToolset.js +0 -165
  157. package/lib/API/x.ai/text.js +0 -415
  158. package/lib/AgentClient.js +0 -248
  159. package/lib/AgentManager.js +0 -245
  160. package/lib/AgentServer.js +0 -404
  161. package/lib/wsCli.js +0 -287
  162. package/lib/wsIO.js +0 -90
  163. package/types/API/x.ai/text.d.ts +0 -286
  164. package/types/AgentClient.d.ts +0 -109
  165. package/types/AgentManager.d.ts +0 -100
  166. package/types/AgentServer.d.ts +0 -89
  167. package/types/wsCli.d.ts +0 -17
  168. package/types/wsIO.d.ts +0 -30
  169. package/utils/test.sh +0 -46
  170. /package/docs/{suggestions.md → _notes/token-counts.md} +0 -0
  171. /package/lib/API/openai.com/{reponses/MESSAGES.md → MESSAGES.md} +0 -0
  172. /package/types/API/{x.ai/ImageToolset.d.ts → mureka/MusicToolset.d.ts} +0 -0
  173. /package/types/{CdnToolset.d.ts → cdnToolset.d.ts} +0 -0
@@ -1,38 +1,201 @@
1
- export function getHeaders(): {
2
- 'Content-Type': string;
3
- Authorization: string;
4
- };
5
- export function saveAudioToLocal(audioData: any, filenamePrefix?: string): Promise<any>;
6
- export function createMusic(prompt: any, options?: {}): Promise<{
7
- audio_url: any;
8
- local_path: any;
1
+ /**
2
+ * Get authentication headers for Minimax API.
3
+ *
4
+ * @returns {Object} Headers object with Authorization Bearer token.
5
+ * @throws {Error} If MINIMAX_API_KEY environment variable is not set.
6
+ */
7
+ export function getHeaders(): Object;
8
+ /**
9
+ * Saves audio data (URL or hex) to a local temporary MP3 file.
10
+ *
11
+ * @param {string} audioData - Either a URL or hex-encoded audio data.
12
+ * @param {string} [filenamePrefix='minimax-music'] - Prefix for the local filename.
13
+ * @returns {Promise<string>} Absolute path to the saved local file.
14
+ */
15
+ export function saveAudioToLocal(audioData: string, filenamePrefix?: string): Promise<string>;
16
+ /**
17
+ * Generate music from a text prompt (text-to-music workflow).
18
+ *
19
+ * Uses models `music-2.6` or `music-2.6-free`.
20
+ * Does NOT support reference audio (use changeMusic() or analyzeMusic() instead).
21
+ *
22
+ * @param {string} prompt - Description of the music (style, mood, scenario). Max 2000 chars.
23
+ * @param {Object} [options={}] - Generation options.
24
+ *
25
+ * @param {string} [options.model='music-2.6'] - Model to use.
26
+ * - 'music-2.6' (default, recommended, higher RPM)
27
+ * - 'music-2.6-free' (free tier, lower RPM)
28
+ *
29
+ * @param {string} [options.lyrics] - Song lyrics with structure tags (e.g. [Verse], [Chorus]).
30
+ * Required for non-instrumental. Max 3500 chars.
31
+ *
32
+ * @param {boolean} [options.is_instrumental=false] - Generate instrumental music (no vocals).
33
+ * When true, lyrics are optional.
34
+ *
35
+ * @param {boolean} [options.lyrics_optimizer=false] - Auto-generate lyrics from prompt when lyrics is empty.
36
+ *
37
+ * @param {string} [options.output_format='url'] - 'url' or 'hex'. URL links expire after 24h.
38
+ *
39
+ * @param {Object} [options.extra] - Any additional undocumented parameters.
40
+ *
41
+ * @returns {Promise<{
42
+ * audio_url: string, // Original URL or hex data
43
+ * local_path: string, // Path in .cache/minimax/
44
+ * duration: number, // API call time in ms
45
+ * raw: object // Full API response
46
+ * }>}
47
+ *
48
+ * @throws {Error} If reference audio params are provided or invalid model.
49
+ *
50
+ * @example
51
+ * const result = await createMusic("Indie folk, melancholic", {
52
+ * model: "music-2.6",
53
+ * lyrics: "[Verse]\n...",
54
+ * is_instrumental: false
55
+ * });
56
+ */
57
+ export function createMusic(prompt: string, options?: {
58
+ model?: string | undefined;
59
+ lyrics?: string | undefined;
60
+ is_instrumental?: boolean | undefined;
61
+ lyrics_optimizer?: boolean | undefined;
62
+ output_format?: string | undefined;
63
+ extra?: Object | undefined;
64
+ }): Promise<{
65
+ audio_url: string;
66
+ local_path: string;
9
67
  duration: number;
10
- raw: any;
68
+ raw: object;
11
69
  }>;
12
- export function changeMusic(prompt: any, options?: {}): Promise<{
13
- audio_url: any;
14
- local_path: any;
70
+ /**
71
+ * Generate a cover version of reference music (music-cover workflow).
72
+ *
73
+ * **Model is fixed to 'music-cover'** (the recommended paid model).
74
+ * The free variant ('music-cover-free') is not supported for changeMusic().
75
+ *
76
+ * Requires either direct reference audio OR a preprocessed cover_feature_id.
77
+ *
78
+ * **Critical rule for two-step covers (cover_feature_id)**:
79
+ * - When `cover_feature_id` is used **and** `is_instrumental` is false (non-instrumental),
80
+ * the `lyrics` parameter is **mandatory**.
81
+ * - When using direct `audio_url`/`audio_base64`, lyrics are optional (API can extract via ASR).
82
+ *
83
+ * **Prompt limit**: Max 300 characters (strictly enforced for music-cover models).
84
+ * **audio_setting**: Fixed internally to { sample_rate: 44100, bitrate: 256000, format: 'mp3' }.
85
+ * User-provided audio_setting is ignored.
86
+ *
87
+ * @param {string} prompt - Description of the target cover style. Max 300 chars.
88
+ * @param {Object} [options={}] - Generation options (model is ignored — always 'music-cover').
89
+ *
90
+ * @param {string} [options.audio_url] - URL of reference audio (6s–6min, ≤50MB).
91
+ * Mutually exclusive with cover_feature_id.
92
+ *
93
+ * @param {string} [options.audio_base64] - Base64 reference audio (alternative to audio_url).
94
+ *
95
+ * @param {string} [options.cover_feature_id] - Feature ID from analyzeMusic() for two-step covers.
96
+ * **Requires lyrics** when is_instrumental=false. Valid for 24h. Mutually exclusive with audio refs.
97
+ *
98
+ * @param {string} [options.lyrics] - Lyrics for the cover (mandatory for cover_feature_id + non-instrumental).
99
+ *
100
+ * @param {boolean} [options.lyrics_optimizer=false] - Auto-generate lyrics from prompt.
101
+ *
102
+ * @param {string} [options.output_format='url'] - 'url' or 'hex'.
103
+ *
104
+ * @param {Object} [options.extra] - Additional parameters.
105
+ *
106
+ * @returns {Promise<{audio_url: string, local_path: string, duration: number, raw: object}>}
107
+ *
108
+ * @throws {Error} On missing reference, conflicting params, prompt > 300 chars, or missing lyrics for two-step non-instrumental.
109
+ *
110
+ * @example
111
+ * // One-step cover
112
+ * const result = await changeMusic("Pop cover style", {
113
+ * audio_url: "https://example.com/reference.mp3"
114
+ * });
115
+ *
116
+ * @example
117
+ * // Two-step cover (after analyzeMusic) — lyrics REQUIRED
118
+ * const result = await changeMusic("New lyrics style", {
119
+ * cover_feature_id: "abc123...",
120
+ * lyrics: "[Verse]\nNew lyrics...",
121
+ * is_instrumental: false
122
+ * });
123
+ */
124
+ export function changeMusic(prompt: string, options?: {
125
+ audio_url?: string | undefined;
126
+ audio_base64?: string | undefined;
127
+ cover_feature_id?: string | undefined;
128
+ lyrics?: string | undefined;
129
+ lyrics_optimizer?: boolean | undefined;
130
+ output_format?: string | undefined;
131
+ extra?: Object | undefined;
132
+ }): Promise<{
133
+ audio_url: string;
134
+ local_path: string;
15
135
  duration: number;
16
- raw: any;
136
+ raw: object;
17
137
  }>;
18
- export function analyzeMusic(audioUrl: any, options?: {}): Promise<{
19
- cover_feature_id: any;
20
- formatted_lyrics: any;
21
- structure_result: any;
22
- audio_duration: any;
23
- trace_id: any;
24
- raw: any;
138
+ /**
139
+ * Preprocess a reference audio to extract features and structured lyrics.
140
+ *
141
+ * Used for the two-step cover workflow (analyze → changeMusic with cover_feature_id).
142
+ * **Model is fixed to 'music-cover'**.
143
+ *
144
+ * @param {string} audioUrl - URL of the reference audio (6s–6min, ≤50MB).
145
+ * @param {Object} [options={}] - Optional parameters (model is ignored).
146
+ *
147
+ * @returns {Promise<{
148
+ * cover_feature_id: string, // Valid 24h, use in changeMusic()
149
+ * formatted_lyrics: string, // Structured lyrics with [Verse] etc.
150
+ * structure_result: string, // JSON song structure analysis
151
+ * audio_duration: number,
152
+ * trace_id: string,
153
+ * raw: object
154
+ * }>}
155
+ *
156
+ * @example
157
+ * const analysis = await analyzeMusic("https://example.com/song.mp3");
158
+ * // Then pass analysis.cover_feature_id to changeMusic()
159
+ */
160
+ export function analyzeMusic(audioUrl: string, options?: Object): Promise<{
161
+ cover_feature_id: string;
162
+ formatted_lyrics: string;
163
+ structure_result: string;
164
+ audio_duration: number;
165
+ trace_id: string;
166
+ raw: object;
25
167
  }>;
26
168
  /**
27
169
  * Generate complete song lyrics or edit/continue existing lyrics.
28
170
  *
29
- * @param {string} prompt - Theme, style, or editing instruction.
30
- * @param {Object} [options]
31
- * @param {'write_full_song'|'edit'} [options.mode='write_full_song']
32
- * @param {string} [options.lyrics] - Existing lyrics (required for edit mode)
33
- * @param {string} [options.title]
171
+ * @param {string} prompt - Theme, style, or editing instruction. Max 2000 chars.
172
+ * @param {Object} [options={}] - Lyrics options.
173
+ *
174
+ * @param {'write_full_song'|'edit'} [options.mode='write_full_song'] - Generation mode.
175
+ * - 'write_full_song': Create a new complete song.
176
+ * - 'edit': Edit or continue existing lyrics (requires options.lyrics).
177
+ *
178
+ * @param {string} [options.lyrics] - Existing lyrics (required for 'edit' mode). Max 3500 chars.
179
+ *
180
+ * @param {string} [options.title] - Desired song title (preserved if provided).
181
+ *
182
+ * @returns {Promise<{
183
+ * song_title: string,
184
+ * style_tags: string, // Comma-separated tags
185
+ * lyrics: string, // Structured lyrics ready for music generation
186
+ * raw: object
187
+ * }>}
188
+ *
189
+ * @example
190
+ * // Full song
191
+ * const lyrics = await generateLyrics("Cheerful love song about summer beach");
34
192
  *
35
- * @returns {Promise<{song_title: string, style_tags: string, lyrics: string, raw: object}>}
193
+ * @example
194
+ * // Edit mode
195
+ * const edited = await generateLyrics("Make it more upbeat", {
196
+ * mode: "edit",
197
+ * lyrics: existingLyrics
198
+ * });
36
199
  */
37
200
  export function generateLyrics(prompt: string, options?: {
38
201
  mode?: "write_full_song" | "edit" | undefined;
@@ -20,23 +20,58 @@ export function saveVideoToLocal(videoUrl: string, filenamePrefix?: string): Pro
20
20
  * Uses POST /v1/video_generation.
21
21
  * Supports all documented models and input types via options.
22
22
  *
23
- * @param {string} [prompt] - Text description (required for most modes).
24
- * @param {Object} [options]
23
+ * The function now includes **clear validation** so you get an explicit error
24
+ * instead of a cryptic API rejection.
25
25
  *
26
- * @param {string} [options.model='MiniMax-Hailuo-2.3'] - Default model.
27
- * Supported: MiniMax-Hailuo-2.3, MiniMax-Hailuo-02, T2V-01, I2V-01, S2V-01, etc.
26
+ * @param {string} [prompt=''] - Text description (required for most modes). Max 2000 chars.
27
+ * Supports camera commands in [] for supported models, e.g. [Pan left], [Truck right].
28
+ * @param {Object} [options={}] - Generation options.
28
29
  *
29
- * @param {string} [options.first_frame_image] - URL or data: URL for image-to-video / first-last.
30
- * @param {string} [options.last_frame_image] - For first & last frame mode.
31
- * @param {Array<Object>} [options.subject_reference] - For subject-reference mode.
30
+ * @param {string} [options.model] - Model name. If omitted, a sensible default is chosen based on mode.
31
+ * See the mapping table at the top of this file.
32
32
  *
33
- * @param {boolean} [options.prompt_optimizer=true]
34
- * @param {boolean} [options.fast_pretreatment=false]
35
- * @param {number} [options.duration=6]
36
- * @param {string} [options.resolution] - e.g. '768P', '1080P'
37
- * @param {string} [options.callback_url]
33
+ * @param {string} [options.first_frame_image] - **Public HTTP/HTTPS URL only** (no Base64/data: URLs).
38
34
  *
39
- * @returns {Promise<{task_id: string, raw: object}>}
35
+ * @param {string} [options.last_frame_image] - **Public HTTP/HTTPS URL only** (no Base64/data: URLs) — First & Last Frame mode only.
36
+ *
37
+ * @param {Array<Object>} [options.subject_reference] - For subject-reference mode (S2V-01 only).
38
+ * Each item must be `{ type: "character", image: ["https://..."] }` with **exactly one URL** in the image array.
39
+ *
40
+ * @param {boolean} [options.prompt_optimizer=true] - Auto-optimize prompt (default true).
41
+ *
42
+ * @param {boolean} [options.fast_pretreatment=false] - Reduce optimization time (Hailuo models only).
43
+ *
44
+ * @param {number} [options.duration=6] - Video length in seconds (model/resolution dependent).
45
+ *
46
+ * @param {string} [options.resolution] - e.g. '768P', '1080P', '720P' (model dependent).
47
+ *
48
+ * @param {string} [options.callback_url] - Optional webhook for async status updates.
49
+ *
50
+ * @param {Object} [options.extra] - Any additional parameters.
51
+ *
52
+ * @returns {Promise<{task_id: string, duration: number, raw: object}>}
53
+ *
54
+ * @example
55
+ * // Text-to-Video (default)
56
+ * await createVideoGenerationTask("A cat jumping [Pan left]", { model: "MiniMax-Hailuo-2.3" });
57
+ *
58
+ * @example
59
+ * // First & Last Frame — MUST use MiniMax-Hailuo-02 + public URLs
60
+ * await createVideoGenerationTask("", {
61
+ * model: "MiniMax-Hailuo-02",
62
+ * first_frame_image: "https://example.com/first.jpg",
63
+ * last_frame_image: "https://example.com/last.jpg"
64
+ * });
65
+ *
66
+ * @example
67
+ * // Subject-Reference (S2V-01) — exactly one image per reference
68
+ * await createVideoGenerationTask("...", {
69
+ * model: "S2V-01",
70
+ * subject_reference: [
71
+ * { type: "character", image: ["https://example.com/puppet.jpg"] },
72
+ * { type: "character", image: ["https://example.com/girl.png"] }
73
+ * ]
74
+ * });
40
75
  */
41
76
  export function createVideoGenerationTask(prompt?: string, options?: {
42
77
  model?: string | undefined;
@@ -48,8 +83,10 @@ export function createVideoGenerationTask(prompt?: string, options?: {
48
83
  duration?: number | undefined;
49
84
  resolution?: string | undefined;
50
85
  callback_url?: string | undefined;
86
+ extra?: Object | undefined;
51
87
  }): Promise<{
52
88
  task_id: string;
89
+ duration: number;
53
90
  raw: object;
54
91
  }>;
55
92
  /**
@@ -57,7 +94,7 @@ export function createVideoGenerationTask(prompt?: string, options?: {
57
94
  *
58
95
  * GET /v1/query/video_generation?task_id=...
59
96
  *
60
- * @param {string} taskId
97
+ * @param {string} taskId - The task_id returned by createVideoGenerationTask.
61
98
  * @returns {Promise<{
62
99
  * task_id: string,
63
100
  * status: 'Preparing' | 'Queueing' | 'Processing' | 'Success' | 'Fail',
@@ -80,7 +117,7 @@ export function queryVideoGenerationTask(taskId: string): Promise<{
80
117
  *
81
118
  * GET /v1/files/retrieve?file_id=...
82
119
  *
83
- * @param {string|number} fileId
120
+ * @param {string|number} fileId - The file_id from a successful query.
84
121
  * @returns {Promise<{
85
122
  * file_id: string,
86
123
  * filename: string,
@@ -101,13 +138,13 @@ export function retrieveVideoFile(fileId: string | number): Promise<{
101
138
  * Handles the full async flow: create task → poll until ready → retrieve → download to .cache/minimax/
102
139
  *
103
140
  * Supports all video generation modes (text, image-to-video, first-last, subject-ref)
104
- * by passing the appropriate options.
141
+ * by passing the appropriate options. **Model validation + strict public-URL validation** are enforced.
105
142
  *
106
143
  * @param {string} prompt - Text prompt (can be empty for some modes).
107
- * @param {Object} [options] - Same as createVideoGenerationTask + polling options.
144
+ * @param {Object} [options={}] - Same as createVideoGenerationTask + polling options.
108
145
  *
109
- * @param {number} [options.max_wait_ms=300000]
110
- * @param {number} [options.poll_interval_ms=5000]
146
+ * @param {number} [options.max_wait_ms=300000] - Max polling time (5 minutes).
147
+ * @param {number} [options.poll_interval_ms=5000] - Polling interval in ms.
111
148
  *
112
149
  * @returns {Promise<{
113
150
  * task_id: string,
@@ -121,18 +158,11 @@ export function retrieveVideoFile(fileId: string | number): Promise<{
121
158
  * }>}
122
159
  *
123
160
  * @example
124
- * // Text-to-Video
125
- * const result = await generateVideo("A cat jumping on a table [Pan left]", {
126
- * model: "MiniMax-Hailuo-2.3",
127
- * duration: 6,
128
- * resolution: "768P"
129
- * });
130
- *
131
- * @example
132
- * // Image-to-Video
133
- * const result = await generateVideo("The character walks forward", {
134
- * model: "MiniMax-Hailuo-2.3",
135
- * first_frame_image: "https://example.com/image.jpg"
161
+ * // First & Last Frame (correct model + public URLs only)
162
+ * const result = await generateVideo("", {
163
+ * model: "MiniMax-Hailuo-02",
164
+ * first_frame_image: "https://example.com/first.jpg",
165
+ * last_frame_image: "https://example.com/last.jpg"
136
166
  * });
137
167
  */
138
168
  export function generateVideo(prompt?: string, options?: {
@@ -163,3 +193,42 @@ export function waitForVideoReady(taskId: string, maxWaitMs?: number, pollInterv
163
193
  video_height?: number;
164
194
  raw: object;
165
195
  }>;
196
+ /**
197
+ * Returns the list of officially supported models for a given mode.
198
+ * @param {string} mode - 'text' | 'image' | 'first-last' | 'subject'
199
+ * @returns {string[]}
200
+ */
201
+ export function getSupportedModelsForMode(mode: string): string[];
202
+ /**
203
+ * Auto-detects the most likely mode based on provided options.
204
+ * @param {Object} options
205
+ * @returns {string} one of SUPPORTED_MODES
206
+ */
207
+ export function detectMode(options?: Object): string;
208
+ /**
209
+ * Validates that the chosen model is compatible with the detected/provided mode.
210
+ * Throws a clear, helpful error if not.
211
+ */
212
+ export function validateModelForMode(model: any, mode: any, options?: {}): void;
213
+ /**
214
+ * Checks if a string is a valid public HTTP/HTTPS URL.
215
+ * Rejects data: URLs, Base64, and non-HTTP schemes.
216
+ * @param {string} str
217
+ * @returns {boolean}
218
+ */
219
+ export function isValidPublicUrl(str: string): boolean;
220
+ /**
221
+ * Validates that an image reference is a public URL (rejects Base64).
222
+ * Throws a clear error if invalid.
223
+ * @param {string} fieldName - e.g. 'first_frame_image'
224
+ * @param {string} value
225
+ */
226
+ export function validateImageUrl(fieldName: string, value: string): void;
227
+ /**
228
+ * Validates subject_reference array for S2V-01.
229
+ * - Each reference must have `image` as an array of **exactly length 1**.
230
+ * - The single image must be a public HTTP/HTTPS URL (no Base64).
231
+ * Throws a clear, actionable error on any violation.
232
+ * @param {Array} subjectRef
233
+ */
234
+ export function validateSubjectReference(subjectRef: any[]): void;
@@ -0,0 +1,7 @@
1
+ declare namespace _default {
2
+ export { music };
3
+ export { musicToolset };
4
+ }
5
+ export default _default;
6
+ import * as music from './music.js';
7
+ import musicToolset from './MusicToolset.js';