@j-o-r/hello-dave 0.0.9 → 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 (82) hide show
  1. package/README.md +2 -0
  2. package/README.md.bak.1779452127 +240 -0
  3. package/TODO.md +31 -20
  4. package/agents/code_agent.js +6 -6
  5. package/agents/daisy_agent.js +10 -7
  6. package/agents/minimax.js +173 -0
  7. package/agents/spawn_agent.js +33 -10
  8. package/agents/stability.js +173 -0
  9. package/bin/codeDave +1 -1
  10. package/bin/dave.js +1 -1
  11. package/docs/dependencies.md +7 -0
  12. package/docs/music-toolsets.md +137 -0
  13. package/docs/plans/minimax-music-generation.md +80 -0
  14. package/docs/plans/unified-agent-architecture.md +146 -0
  15. package/docs/plans/websocket-streaming-plan.md.bak +317 -0
  16. package/docs/prompt/spawn_agent.md +46 -44
  17. package/docs/prompt/task_clarification_and_documentation.md +35 -0
  18. package/docs/todo-archive-infra-2026-04-21.md +15 -0
  19. package/docs/todo-archive-v0.1.0.md +32 -0
  20. package/lib/API/minimax/ImageToolset.js +169 -0
  21. package/lib/API/minimax/MusicToolset.js +290 -0
  22. package/lib/API/minimax/VideoToolset.js +296 -0
  23. package/lib/API/minimax/image.generation.md +239 -0
  24. package/lib/API/minimax/image.js +219 -0
  25. package/lib/API/minimax/image.to.image.md +257 -0
  26. package/lib/API/minimax/index.js +16 -0
  27. package/lib/API/minimax/music.cover.preprocess.md +206 -0
  28. package/lib/API/minimax/music.generation.md +346 -0
  29. package/lib/API/minimax/music.js +257 -0
  30. package/lib/API/minimax/music.lyrics.generation.md +205 -0
  31. package/lib/API/minimax/video.download.md +133 -0
  32. package/lib/API/minimax/video.first.last.image.md +186 -0
  33. package/lib/API/minimax/video.from.image.md +206 -0
  34. package/lib/API/minimax/video.from.subject.md +164 -0
  35. package/lib/API/minimax/video.generation.md +192 -0
  36. package/lib/API/minimax/video.js +339 -0
  37. package/lib/API/minimax/video.query.md +128 -0
  38. package/lib/API/stability.ai/ImageToolset.js +357 -0
  39. package/lib/API/stability.ai/MusicToolset.js +302 -0
  40. package/lib/API/stability.ai/audio-3.md +205 -0
  41. package/lib/API/stability.ai/audio.js +679 -0
  42. package/lib/API/stability.ai/image.js +911 -0
  43. package/lib/API/stability.ai/image.md +271 -0
  44. package/lib/API/stability.ai/index.js +11 -0
  45. package/lib/API/stability.ai/openapi.json +17118 -0
  46. package/lib/API/x.ai/ImageToolset.js +165 -0
  47. package/lib/API/x.ai/image.editing.md +86 -0
  48. package/lib/API/x.ai/image.js +393 -0
  49. package/lib/API/x.ai/image.md +213 -0
  50. package/lib/API/x.ai/image.to.generation.md +494 -0
  51. package/lib/API/x.ai/image.to.video.md +23 -0
  52. package/lib/API/x.ai/index.js +9 -0
  53. package/lib/AgentManager.js +1 -1
  54. package/lib/CdnToolset.js +191 -0
  55. package/lib/ToolSet.js +19 -1
  56. package/lib/cdn.js +373 -0
  57. package/lib/fafs.js +5 -3
  58. package/lib/genericToolset.js +75 -210
  59. package/lib/index.js +9 -1
  60. package/package.json +2 -2
  61. package/types/API/minimax/ImageToolset.d.ts +3 -0
  62. package/types/API/minimax/MusicToolset.d.ts +3 -0
  63. package/types/API/minimax/VideoToolset.d.ts +3 -0
  64. package/types/API/minimax/image.d.ts +109 -0
  65. package/types/API/minimax/index.d.ts +15 -0
  66. package/types/API/minimax/music.d.ts +46 -0
  67. package/types/API/minimax/video.d.ts +165 -0
  68. package/types/API/stability.ai/ImageToolset.d.ts +3 -0
  69. package/types/API/stability.ai/MusicToolset.d.ts +3 -0
  70. package/types/API/stability.ai/audio.d.ts +193 -0
  71. package/types/API/stability.ai/image.d.ts +274 -0
  72. package/types/API/stability.ai/index.d.ts +11 -0
  73. package/types/API/x.ai/ImageToolset.d.ts +3 -0
  74. package/types/API/x.ai/image.d.ts +82 -0
  75. package/types/API/x.ai/index.d.ts +9 -0
  76. package/types/AgentManager.d.ts +1 -1
  77. package/types/CdnToolset.d.ts +20 -0
  78. package/types/ToolSet.d.ts +8 -0
  79. package/types/cdn.d.ts +141 -0
  80. package/types/index.d.ts +8 -2
  81. package/utils/syntax_check.sh +59 -15
  82. package/docs/multi-agent-clusters.md.bak +0 -229
@@ -0,0 +1,296 @@
1
+ /**
2
+ * @file lib/API/minimax/VideoToolset.js
3
+ * @module minimax/VideoToolset
4
+ * @description Comprehensive ToolSet for the Minimax Video Generation API.
5
+ *
6
+ * This ToolSet exposes the full Minimax Video API with every available option
7
+ * and detailed return values, following the same pattern as lib/genericToolset.js,
8
+ * MusicToolset.js, and ImageToolset.js.
9
+ *
10
+ * It is designed to be used directly by AI agents or merged into larger toolsets.
11
+ *
12
+ * Video generation is asynchronous. The main `generate_video` tool automatically
13
+ * waits for completion and downloads the MP4 to .cache/minimax/.
14
+ *
15
+ * @example
16
+ * import videoToolset from './lib/API/minimax/VideoToolset.js';
17
+ *
18
+ * // Use in an agent:
19
+ * const toolset = agent.getToolset();
20
+ * toolset.merge(videoToolset);
21
+ */
22
+
23
+ import ToolSet from '../../ToolSet.js';
24
+ import * as minimax from './video.js';
25
+
26
+ const tools = new ToolSet('auto');
27
+
28
+ /* ============================================================
29
+ CORE VIDEO GENERATION (Full async flow with auto-download)
30
+ ============================================================ */
31
+
32
+ tools.add(
33
+ 'generate_video',
34
+ 'Generate a video using the Minimax Video Generation API. ' +
35
+ 'Supports Text-to-Video, Image-to-Video, First & Last Frame, and Subject-Reference modes. ' +
36
+ 'Automatically polls until the video is ready, then downloads the MP4 to .cache/minimax/. ' +
37
+ 'This is the recommended high-level tool for video generation.',
38
+ {
39
+ type: 'object',
40
+ properties: {
41
+ prompt: {
42
+ type: 'string',
43
+ description: 'Text description of the video, up to 2000 characters. ' +
44
+ 'Supports camera movement commands in [brackets] for supported models. ' +
45
+ 'Example: "A cute cat jumping on a wooden table [Static shot]"'
46
+ },
47
+ model: {
48
+ type: 'string',
49
+ enum: [
50
+ 'MiniMax-Hailuo-2.3',
51
+ 'MiniMax-Hailuo-02',
52
+ 'T2V-01-Director',
53
+ 'T2V-01',
54
+ 'MiniMax-Hailuo-2.3-Fast',
55
+ 'I2V-01-Director',
56
+ 'I2V-01-live',
57
+ 'I2V-01',
58
+ 'S2V-01'
59
+ ],
60
+ default: 'MiniMax-Hailuo-2.3',
61
+ description: 'Video generation model. ' +
62
+ '"MiniMax-Hailuo-2.3" = recommended for text-to-video and image-to-video. ' +
63
+ '"MiniMax-Hailuo-02" = good for first-last frame. ' +
64
+ '"S2V-01" = subject reference mode.'
65
+ },
66
+ first_frame_image: {
67
+ type: 'string',
68
+ description: 'Public URL or data: URL of the first frame image (for Image-to-Video or First-Last mode). ' +
69
+ 'Formats: JPG, JPEG, PNG, WebP. Size < 20MB. Short side > 300px.'
70
+ },
71
+ last_frame_image: {
72
+ type: 'string',
73
+ description: 'Public URL or data: URL of the last frame image (for First & Last Frame mode only).'
74
+ },
75
+ subject_reference: {
76
+ type: 'array',
77
+ items: {
78
+ type: 'object',
79
+ properties: {
80
+ type: { type: 'string', enum: ['character'], description: 'Subject type. Currently only "character" supported.' },
81
+ image: {
82
+ type: 'array',
83
+ items: { type: 'string' },
84
+ description: 'Array of reference image URLs (usually one image).'
85
+ }
86
+ },
87
+ required: ['type', 'image']
88
+ },
89
+ description: 'For Subject-Reference to Video (S2V-01 model). Array of character references.'
90
+ },
91
+ prompt_optimizer: {
92
+ type: 'boolean',
93
+ default: true,
94
+ description: 'Automatically optimize the prompt. Default true.'
95
+ },
96
+ fast_pretreatment: {
97
+ type: 'boolean',
98
+ default: false,
99
+ description: 'Reduces optimization time when prompt_optimizer is enabled (Hailuo models only).'
100
+ },
101
+ duration: {
102
+ type: 'integer',
103
+ enum: [6, 10],
104
+ default: 6,
105
+ description: 'Video duration in seconds. Available values depend on model and resolution.'
106
+ },
107
+ resolution: {
108
+ type: 'string',
109
+ enum: ['512P', '720P', '768P', '1080P'],
110
+ description: 'Video resolution. Options depend on model and duration. ' +
111
+ 'Example: "768P" or "1080P".'
112
+ },
113
+ callback_url: {
114
+ type: 'string',
115
+ description: 'Optional callback URL for async status updates.'
116
+ },
117
+ max_wait_ms: {
118
+ type: 'integer',
119
+ default: 300000,
120
+ description: 'Maximum wait time for polling (default 5 minutes).'
121
+ },
122
+ poll_interval_ms: {
123
+ type: 'integer',
124
+ default: 5000,
125
+ description: 'Polling interval in milliseconds (default 5 seconds).'
126
+ },
127
+ extra: {
128
+ type: 'object',
129
+ description: 'Additional parameters not yet documented.'
130
+ }
131
+ },
132
+ required: ['prompt']
133
+ },
134
+ async (params) => {
135
+ const result = await minimax.generateVideo(params.prompt, params);
136
+
137
+ return JSON.stringify({
138
+ task_id: result.task_id,
139
+ file_id: result.file_id,
140
+ video_url: result.video_url,
141
+ local_path: result.local_path,
142
+ video_width: result.video_width,
143
+ video_height: result.video_height,
144
+ total_duration_ms: result.duration,
145
+ raw_responses: result.raw,
146
+ note: 'Video has been automatically saved to local_path. ' +
147
+ 'The generation was polled until completion. Use max_wait_ms to adjust timeout.'
148
+ }, null, 2);
149
+ }
150
+ );
151
+
152
+ /* ============================================================
153
+ LOW-LEVEL: CREATE TASK ONLY
154
+ ============================================================ */
155
+
156
+ tools.add(
157
+ 'create_video_task',
158
+ 'Create a video generation task without waiting. ' +
159
+ 'Returns a task_id that can be polled manually with query_video_task. ' +
160
+ 'Useful for advanced workflows or when using callbacks.',
161
+ {
162
+ type: 'object',
163
+ properties: {
164
+ prompt: {
165
+ type: 'string',
166
+ description: 'Text description of the video.'
167
+ },
168
+ model: {
169
+ type: 'string',
170
+ default: 'MiniMax-Hailuo-2.3',
171
+ description: 'Video model to use.'
172
+ },
173
+ first_frame_image: { type: 'string' },
174
+ last_frame_image: { type: 'string' },
175
+ subject_reference: { type: 'array' },
176
+ prompt_optimizer: { type: 'boolean', default: true },
177
+ duration: { type: 'integer', default: 6 },
178
+ resolution: { type: 'string' },
179
+ callback_url: { type: 'string' },
180
+ extra: { type: 'object' }
181
+ },
182
+ required: ['prompt']
183
+ },
184
+ async (params) => {
185
+ const result = await minimax.createVideoGenerationTask(params.prompt, params);
186
+
187
+ return JSON.stringify({
188
+ task_id: result.task_id,
189
+ duration_ms: result.duration,
190
+ raw_response: result.raw,
191
+ note: 'Use query_video_task with this task_id to check status.'
192
+ }, null, 2);
193
+ }
194
+ );
195
+
196
+ /* ============================================================
197
+ LOW-LEVEL: QUERY TASK STATUS
198
+ ============================================================ */
199
+
200
+ tools.add(
201
+ 'query_video_task',
202
+ 'Query the current status of a video generation task. ' +
203
+ 'Returns status (Preparing, Queueing, Processing, Success, Fail) and file_id when ready.',
204
+ {
205
+ type: 'object',
206
+ properties: {
207
+ task_id: {
208
+ type: 'string',
209
+ description: 'The task_id returned by create_video_task or generate_video.'
210
+ }
211
+ },
212
+ required: ['task_id']
213
+ },
214
+ async (params) => {
215
+ const result = await minimax.queryVideoGenerationTask(params.task_id);
216
+
217
+ return JSON.stringify({
218
+ task_id: result.task_id,
219
+ status: result.status,
220
+ file_id: result.file_id,
221
+ video_width: result.video_width,
222
+ video_height: result.video_height,
223
+ raw_response: result.raw,
224
+ note: 'Poll this until status === "Success" to get the file_id.'
225
+ }, null, 2);
226
+ }
227
+ );
228
+
229
+ /* ============================================================
230
+ LOW-LEVEL: RETRIEVE FILE
231
+ ============================================================ */
232
+
233
+ tools.add(
234
+ 'retrieve_video_file',
235
+ 'Retrieve the download URL and metadata for a completed video using its file_id.',
236
+ {
237
+ type: 'object',
238
+ properties: {
239
+ file_id: {
240
+ type: 'string',
241
+ description: 'The file_id returned when a video task reaches Success status.'
242
+ }
243
+ },
244
+ required: ['file_id']
245
+ },
246
+ async (params) => {
247
+ const result = await minimax.retrieveVideoFile(params.file_id);
248
+
249
+ return JSON.stringify({
250
+ file_id: result.file_id,
251
+ filename: result.filename,
252
+ download_url: result.download_url,
253
+ bytes: result.bytes,
254
+ raw_response: result.raw,
255
+ note: 'Use save_video_to_local with the download_url to download the file.'
256
+ }, null, 2);
257
+ }
258
+ );
259
+
260
+ /* ============================================================
261
+ HELPER: DIRECT LOCAL SAVE
262
+ ============================================================ */
263
+
264
+ tools.add(
265
+ 'save_video_to_local',
266
+ 'Save a video from a download URL to a local file in .cache/minimax/. ' +
267
+ 'Useful when you already have a download_url from retrieve_video_file.',
268
+ {
269
+ type: 'object',
270
+ properties: {
271
+ video_url: {
272
+ type: 'string',
273
+ description: 'Public download URL of the video (from retrieve_video_file).'
274
+ },
275
+ filename_prefix: {
276
+ type: 'string',
277
+ default: 'minimax-video',
278
+ description: 'Prefix for the generated filename.'
279
+ }
280
+ },
281
+ required: ['video_url']
282
+ },
283
+ async (params) => {
284
+ const localPath = await minimax.saveVideoToLocal(
285
+ params.video_url,
286
+ params.filename_prefix
287
+ );
288
+
289
+ return JSON.stringify({
290
+ local_path: localPath,
291
+ note: 'Video file saved successfully.'
292
+ });
293
+ }
294
+ );
295
+
296
+ export default tools;
@@ -0,0 +1,239 @@
1
+ > ## Documentation Index
2
+ > Fetch the complete documentation index at: https://platform.minimax.io/docs/llms.txt
3
+ > Use this file to discover all available pages before exploring further.
4
+
5
+ # Text to Image Generation
6
+
7
+ > Use this API to generate images from text input.
8
+
9
+
10
+
11
+ ## OpenAPI
12
+
13
+ ````yaml /api-reference/image/generation/api/text-to-image.json POST /v1/image_generation
14
+ openapi: 3.1.0
15
+ info:
16
+ title: MiniMax Image Generation API
17
+ description: MiniMax image generation API for creating images from text prompts
18
+ license:
19
+ name: MIT
20
+ version: 1.0.0
21
+ servers:
22
+ - url: https://api.minimax.io
23
+ security:
24
+ - bearerAuth: []
25
+ paths:
26
+ /v1/image_generation:
27
+ post:
28
+ tags:
29
+ - Image
30
+ summary: Image Generation
31
+ operationId: imageGeneration
32
+ parameters:
33
+ - name: Content-Type
34
+ in: header
35
+ required: true
36
+ description: >-
37
+ The media type of the request body. Must be set to
38
+ `application/json` to ensure the data is sent in JSON format.
39
+ schema:
40
+ type: string
41
+ enum:
42
+ - application/json
43
+ default: application/json
44
+ requestBody:
45
+ description: ''
46
+ content:
47
+ application/json:
48
+ schema:
49
+ $ref: '#/components/schemas/ImageGenerationReq'
50
+ required: true
51
+ responses:
52
+ '200':
53
+ description: ''
54
+ content:
55
+ application/json:
56
+ schema:
57
+ $ref: '#/components/schemas/ImageGenerationResp'
58
+ components:
59
+ schemas:
60
+ ImageGenerationReq:
61
+ type: object
62
+ required:
63
+ - prompt
64
+ - model
65
+ properties:
66
+ model:
67
+ type: string
68
+ description: 'Model name. Options: `image-01`.'
69
+ enum:
70
+ - image-01
71
+ prompt:
72
+ type: string
73
+ description: Text description of the image, max length 1500 characters.
74
+ aspect_ratio:
75
+ type: string
76
+ description: |-
77
+ Image aspect ratio, default `1:1`. Options:
78
+ - `1:1` (1024x1024)
79
+ - `16:9` (1280x720)
80
+ - `4:3` (1152x864)
81
+ - `3:2` (1248x832)
82
+ - `2:3` (832x1248)
83
+ - `3:4` (864x1152)
84
+ - `9:16` (720x1280)
85
+ - `21:9` (1344x576)
86
+ enum:
87
+ - '1:1'
88
+ - '16:9'
89
+ - '4:3'
90
+ - '3:2'
91
+ - '2:3'
92
+ - '3:4'
93
+ - '9:16'
94
+ - '21:9'
95
+ width:
96
+ type: integer
97
+ description: >-
98
+ Image width (px). Only effective for `image-01`. Must be set
99
+ together with `height`. Range [512, 2048], must be divisible by 8.
100
+ If both `width/height` and `aspect_ratio` are provided,
101
+ `aspect_ratio` takes priority.
102
+ height:
103
+ type: integer
104
+ description: >-
105
+ Image height (px). Only effective for `image-01`. Must be set
106
+ together with `width`. Range [512, 2048], must be divisible by 8. If
107
+ both `width/height` and `aspect_ratio` are provided, `aspect_ratio`
108
+ takes priority.
109
+ response_format:
110
+ type: string
111
+ enum:
112
+ - url
113
+ - base64
114
+ default: url
115
+ description: |-
116
+ Response format for images. Default: url. Options: url, base64.
117
+ ⚠️ Note: url expires in 24 hours.
118
+ seed:
119
+ type: integer
120
+ format: int64
121
+ description: >-
122
+ Random seed. Using the same seed and parameters produces
123
+ reproducible images. If not provided, a random seed is generated for
124
+ each image.
125
+ 'n':
126
+ type: integer
127
+ default: 1
128
+ minimum: 1
129
+ maximum: 9
130
+ description: 'Number of images to generate per request. Range [1, 9]. Default: 1.'
131
+ prompt_optimizer:
132
+ type: boolean
133
+ default: false
134
+ description: 'Enable automatic optimization of prompt. Default: `false`.'
135
+ example:
136
+ model: image-01
137
+ prompt: >-
138
+ A man in a white t-shirt, full-body, standing front view, outdoors,
139
+ with the Venice Beach sign in the background, Los Angeles. Fashion
140
+ photography in 90s documentary style, film grain, photorealistic.
141
+ aspect_ratio: '16:9'
142
+ response_format: url
143
+ 'n': 3
144
+ prompt_optimizer: true
145
+ ImageGenerationResp:
146
+ type: object
147
+ properties:
148
+ data:
149
+ $ref: '#/components/schemas/DataObject'
150
+ metadata:
151
+ type: object
152
+ properties:
153
+ success_count:
154
+ type: integer
155
+ description: Number of successfully generated images.
156
+ failed_count:
157
+ type: integer
158
+ description: Number of images blocked due to content safety.
159
+ description: Additional metadata about the generation.
160
+ id:
161
+ type: string
162
+ description: Trace ID for request tracking
163
+ base_resp:
164
+ $ref: '#/components/schemas/BaseResp'
165
+ example:
166
+ id: 03ff3cd0820949eb8a410056b5f21d38
167
+ data:
168
+ image_urls:
169
+ - XXX
170
+ - XXX
171
+ - XXX
172
+ metadata:
173
+ failed_count: '0'
174
+ success_count: '3'
175
+ base_resp:
176
+ status_code: 0
177
+ status_msg: success
178
+ DataObject:
179
+ type: object
180
+ properties:
181
+ image_urls:
182
+ type: array
183
+ items:
184
+ type: string
185
+ description: >-
186
+ Returned when `response_format` = `url`, contains an array of image
187
+ links.
188
+ image_base64:
189
+ type: array
190
+ items:
191
+ type: string
192
+ description: >-
193
+ Returned when `response_format` = `base64`, contains an array of
194
+ base64-encoded images.
195
+ BaseResp:
196
+ type: object
197
+ properties:
198
+ status_code:
199
+ type: integer
200
+ description: >-
201
+ The status codes and their meanings are as follows:
202
+
203
+ - `0`, Request successful
204
+
205
+ - `1002`, Rate limit triggered, please try again later
206
+
207
+ - `1004`, Account authentication failed, please check if the API Key
208
+ is correct
209
+
210
+ - `1008`, Insufficient account balance
211
+
212
+ - `1026`, Sensitive content detected in prompt
213
+
214
+ - `2013`, Invalid input parameters, please check if the parameters
215
+ are filled in as required
216
+
217
+ - `2049`, Invalid API key
218
+
219
+
220
+ For more information, please refer to the [Error Code
221
+ Reference](/api-reference/errorcode).
222
+ status_msg:
223
+ type: string
224
+ description: Status details.
225
+ securitySchemes:
226
+ bearerAuth:
227
+ type: http
228
+ scheme: bearer
229
+ bearerFormat: JWT
230
+ description: >-
231
+ `HTTP: Bearer Auth`
232
+
233
+ - Security Scheme Type: http
234
+
235
+ - HTTP Authorization Scheme: `Bearer API_key`, can be found in [Account
236
+ Management>API
237
+ Keys](https://platform.minimax.io/user-center/basic-information/interface-key).
238
+
239
+ ````