@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.
- package/CHANGELOG.md +42 -25
- package/README.md +81 -221
- package/TODO.md +173 -35
- package/agents/agent_creator.js +105 -0
- package/agents/agent_creator.prompt.md +371 -0
- package/agents/ask_agent.js +64 -127
- package/agents/claude_agent.js +68 -0
- package/agents/code_agent.js +55 -135
- package/agents/code_agent.prompt.md +50 -0
- package/agents/echo_agent.js +76 -0
- package/agents/financial_expert.js +75 -0
- package/agents/gpt_agent.js +52 -103
- package/agents/gpt_code.js +81 -0
- package/agents/grok_agent.js +58 -114
- package/agents/minimax_agent.js +92 -0
- package/agents/mureka_agent.js +77 -0
- package/agents/planner_agent.js +172 -0
- package/agents/stability_agent.js +87 -0
- package/agents/test_agent.js +75 -157
- package/agents/weather_agent.js +73 -0
- package/agents/workflow_agent.js +189 -0
- package/bin/dave.js +436 -184
- package/docs/bin-dave.md +85 -35
- package/docs/cdn-ssh.md +100 -0
- package/docs/creating-agents.md +301 -0
- package/docs/creating-toolsets.md +336 -0
- package/docs/docs-organization.md +48 -0
- package/docs/project-overview.md +86 -51
- package/lib/API/elevenlabs.io/music.compose.md +441 -0
- package/lib/API/elevenlabs.io/music.create-composition-plan.md +370 -0
- package/lib/API/elevenlabs.io/music.stream.md +425 -0
- package/lib/API/lalal.ai/lalal.js +445 -0
- package/lib/API/lalal.ai/openapi.json +2614 -0
- package/lib/API/minimax/ImageToolset.js +82 -37
- package/lib/API/minimax/MusicToolset.js +125 -79
- package/lib/API/minimax/VideoToolset.js +170 -167
- package/lib/API/minimax/image.js +5 -1
- package/lib/API/minimax/music.js +210 -23
- package/lib/API/minimax/video.js +242 -53
- package/lib/API/mureka/MusicToolset.js +646 -0
- package/lib/API/mureka/README.md +41 -0
- package/lib/API/mureka/index.js +7 -0
- package/lib/API/mureka/music.js +658 -0
- package/lib/API/openai.com/index.js +7 -0
- package/lib/API/openai.com/{reponses/text.js → responses.js} +64 -18
- package/lib/API/openai.com/video.create.character.md +40 -0
- package/lib/API/openai.com/video.create.md +219 -0
- package/lib/API/openai.com/video.delete.md +44 -0
- package/lib/API/openai.com/video.download.md +31 -0
- package/lib/API/openai.com/video.edit.md +155 -0
- package/lib/API/openai.com/video.extend.md +166 -0
- package/lib/API/openai.com/video.fetch.character.md +43 -0
- package/lib/API/openai.com/video.js +784 -0
- package/lib/API/openai.com/video.list.md +201 -0
- package/lib/API/openai.com/video.remix.md +175 -0
- package/lib/API/openai.com/video.retrieve.md +139 -0
- package/lib/API/openai.com/videoToolset.js +616 -0
- package/lib/API/stability.ai/ImageToolset.js +131 -40
- package/lib/API/stability.ai/MusicToolset.js +79 -47
- package/lib/API/stability.ai/audio.js +63 -131
- package/lib/API/x.ai/chat.responses.md +1040 -0
- package/lib/API/x.ai/image.js +229 -59
- package/lib/API/x.ai/imageToolset.js +376 -0
- package/lib/API/x.ai/index.js +1 -1
- package/lib/API/x.ai/responses.js +9 -18
- package/lib/Agent.js +271 -0
- package/lib/Agent.js.old +284 -0
- package/lib/AgentLauncher.js +593 -0
- package/lib/Cli.js +87 -13
- package/lib/Prompt.js +23 -1
- package/lib/Session.js +5 -4
- package/lib/ToolSet.js +102 -6
- package/lib/agentLoader.js +369 -0
- package/lib/cdn.js +67 -231
- package/lib/{CdnToolset.js → cdnToolset.js} +47 -64
- package/lib/defaultToolsets.js +43 -0
- package/lib/fafs.js +1 -1
- package/lib/genericToolset.js +442 -119
- package/lib/handOffToolset.js +179 -0
- package/lib/index.js +34 -27
- package/lib/toolsetLoader.js +248 -0
- package/package.json +10 -4
- package/types/API/lalal.ai/lalal.d.ts +116 -0
- package/types/API/minimax/image.d.ts +2 -1
- package/types/API/minimax/music.d.ts +189 -26
- package/types/API/minimax/video.d.ts +100 -31
- package/types/API/mureka/index.d.ts +7 -0
- package/types/API/mureka/music.d.ts +472 -0
- package/types/API/openai.com/index.d.ts +7 -0
- package/types/API/openai.com/{reponses/text.d.ts → responses.d.ts} +11 -11
- package/types/API/openai.com/video.d.ts +409 -0
- package/types/API/openai.com/videoToolset.d.ts +24 -0
- package/types/API/stability.ai/audio.d.ts +14 -103
- package/types/API/stability.ai/image.d.ts +2 -2
- package/types/API/x.ai/image.d.ts +138 -26
- package/types/API/x.ai/imageToolset.d.ts +3 -0
- package/types/API/x.ai/index.d.ts +1 -1
- package/types/API/x.ai/responses.d.ts +4 -4
- package/types/Agent.d.ts +123 -0
- package/types/AgentLauncher.d.ts +250 -0
- package/types/Cli.d.ts +28 -8
- package/types/Prompt.d.ts +23 -5
- package/types/Session.d.ts +1 -1
- package/types/ToolSet.d.ts +10 -0
- package/types/agentLoader.d.ts +78 -0
- package/types/cdn.d.ts +15 -90
- package/types/defaultToolsets.d.ts +9 -0
- package/types/fafs.d.ts +1 -1
- package/types/genericToolset.d.ts +1 -1
- package/types/handOffToolset.d.ts +28 -0
- package/types/index.d.ts +19 -17
- package/types/toolsetLoader.d.ts +114 -0
- package/utils/format_log.js +101 -23
- package/utils/launch_agent.js +18 -0
- package/utils/list_sessions.sh +13 -5
- package/utils/search_sessions.sh +65 -29
- package/utils/toolsets.js +33 -0
- package/README.md.bak.1779452127 +0 -240
- package/agents/codeserver.sh +0 -47
- package/agents/daisy_agent.js +0 -173
- package/agents/docs_agent.js +0 -148
- package/agents/memory_agent.js +0 -263
- package/agents/minimax.js +0 -173
- package/agents/npm_agent.js +0 -202
- package/agents/prompt_agent.js +0 -133
- package/agents/readme_agent.js +0 -148
- package/agents/spawn_agent.js +0 -160
- package/agents/stability.js +0 -173
- package/agents/todo_agent.js +0 -175
- package/bin/codeDave +0 -58
- package/docs/agent-dave-websocket-protocol.md +0 -180
- package/docs/agent-manager.md +0 -244
- package/docs/codeserver-pattern.md +0 -191
- package/docs/generic-toolset.md +0 -326
- package/docs/howtos/agent-networking.md +0 -253
- package/docs/howtos/spawn-agents.md.bak +0 -200
- package/docs/howtos/spawn-agents.md.bak_new +0 -200
- package/docs/multi-agent-clusters.md +0 -265
- package/docs/music-toolsets.md +0 -137
- package/docs/path-resolution-best-practices.md +0 -104
- package/docs/plans/minimax-music-generation.md +0 -80
- package/docs/plans/unified-agent-architecture.md +0 -146
- package/docs/plans/websocket-streaming-plan.md.bak +0 -317
- package/docs/prompt/spawn_agent.md +0 -175
- package/docs/prompt/spawn_agent.md.bak +0 -201
- package/docs/prompt/task_clarification_and_documentation.md +0 -35
- package/docs/prompt-class.md +0 -141
- package/docs/todo-archive-infra-2026-04-21.md +0 -15
- package/docs/todo-archive-v0.0.8.md +0 -1
- package/docs/todo-archive-v0.1.0.md +0 -32
- package/docs/todo-archive.md +0 -44
- package/docs/tools-syntax-validation.md +0 -121
- package/docs/toolset.md +0 -164
- package/docs/xai-responses.md +0 -111
- package/docs/xai_collections.md +0 -106
- package/lib/API/x.ai/ImageToolset.js +0 -165
- package/lib/API/x.ai/text.js +0 -415
- package/lib/AgentClient.js +0 -248
- package/lib/AgentManager.js +0 -245
- package/lib/AgentServer.js +0 -404
- package/lib/wsCli.js +0 -287
- package/lib/wsIO.js +0 -90
- package/types/API/x.ai/text.d.ts +0 -286
- package/types/AgentClient.d.ts +0 -109
- package/types/AgentManager.d.ts +0 -100
- package/types/AgentServer.d.ts +0 -89
- package/types/wsCli.d.ts +0 -17
- package/types/wsIO.d.ts +0 -30
- package/utils/test.sh +0 -46
- /package/docs/{suggestions.md → _notes/token-counts.md} +0 -0
- /package/lib/API/openai.com/{reponses/MESSAGES.md → MESSAGES.md} +0 -0
- /package/types/API/{x.ai/ImageToolset.d.ts → mureka/MusicToolset.d.ts} +0 -0
- /package/types/{CdnToolset.d.ts → cdnToolset.d.ts} +0 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON-compatible primitive value.
|
|
3
|
+
*/
|
|
4
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
5
|
+
/**
|
|
6
|
+
* JSON-compatible value accepted in OpenAI JSON request bodies.
|
|
7
|
+
*/
|
|
8
|
+
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
9
|
+
/**
|
|
10
|
+
* JSON-compatible object accepted in OpenAI JSON request bodies.
|
|
11
|
+
*/
|
|
12
|
+
export type JsonObject = {
|
|
13
|
+
[key: string]: JsonValue | undefined;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* JSON-compatible array accepted in OpenAI JSON request bodies.
|
|
17
|
+
*/
|
|
18
|
+
export type JsonArray = Array<JsonValue | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* HTTP header map used for OpenAI requests.
|
|
21
|
+
*/
|
|
22
|
+
export type OpenAIHeaders = {
|
|
23
|
+
/**
|
|
24
|
+
* 'User-Agent'] - User-Agent header value.
|
|
25
|
+
*/
|
|
26
|
+
""?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* - Bearer token authorization header.
|
|
29
|
+
*/
|
|
30
|
+
Authorization: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Common wrapper request options.
|
|
34
|
+
*/
|
|
35
|
+
export type RequestOptions = {
|
|
36
|
+
/**
|
|
37
|
+
* - User-Agent header value.
|
|
38
|
+
*/
|
|
39
|
+
userAgent?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Query parameters serialized onto an OpenAI request URL.
|
|
43
|
+
* Undefined and null values are skipped.
|
|
44
|
+
*/
|
|
45
|
+
export type QueryParams = {
|
|
46
|
+
[key: string]: string | number | boolean | null | undefined;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Parsed response body returned by fetch helpers.
|
|
50
|
+
*/
|
|
51
|
+
export type ParsedResponseBody = JsonValue | string | ArrayBuffer | Blob | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Downloadable video content variant.
|
|
54
|
+
*/
|
|
55
|
+
export type VideoAssetVariant = "video" | "thumbnail" | "spritesheet";
|
|
56
|
+
/**
|
|
57
|
+
* Supported OpenAI video model identifier.
|
|
58
|
+
*/
|
|
59
|
+
export type VideoModel = "sora-2" | "sora-2-pro" | "sora-2-2025-10-06" | "sora-2-pro-2025-10-06" | "sora-2-2025-12-08" | string;
|
|
60
|
+
/**
|
|
61
|
+
* Supported base clip duration for video creation.
|
|
62
|
+
*/
|
|
63
|
+
export type VideoSeconds = "4" | "8" | "12" | 4 | 8 | 12 | number;
|
|
64
|
+
/**
|
|
65
|
+
* Supported generated segment duration for video extensions.
|
|
66
|
+
*/
|
|
67
|
+
export type VideoExtensionSeconds = "4" | "8" | "12" | "16" | "20" | 4 | 8 | 12 | 16 | 20 | number;
|
|
68
|
+
/**
|
|
69
|
+
* Supported generated video output resolution.
|
|
70
|
+
*/
|
|
71
|
+
export type VideoSize = "720x1280" | "1280x720" | "1024x1792" | "1792x1024";
|
|
72
|
+
/**
|
|
73
|
+
* Lifecycle status of an OpenAI video job.
|
|
74
|
+
*/
|
|
75
|
+
export type VideoStatus = "queued" | "in_progress" | "completed" | "failed" | string;
|
|
76
|
+
/**
|
|
77
|
+
* Error payload returned for a failed video generation job.
|
|
78
|
+
*/
|
|
79
|
+
export type VideoCreateError = {
|
|
80
|
+
/**
|
|
81
|
+
* - Machine-readable error code.
|
|
82
|
+
*/
|
|
83
|
+
code: string;
|
|
84
|
+
/**
|
|
85
|
+
* - Human-readable error description.
|
|
86
|
+
*/
|
|
87
|
+
message: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Optional image reference object used to guide video creation.
|
|
91
|
+
* Exactly one of `image_url` or `file_id` should be provided.
|
|
92
|
+
*/
|
|
93
|
+
export type VideoInputReference = {
|
|
94
|
+
/**
|
|
95
|
+
* - Fully-qualified image URL or base64 data URL.
|
|
96
|
+
*/
|
|
97
|
+
image_url?: string | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* - OpenAI file identifier for an uploaded image reference.
|
|
100
|
+
*/
|
|
101
|
+
file_id?: string | undefined;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Reference to an existing generated video.
|
|
105
|
+
*/
|
|
106
|
+
export type VideoReference = {
|
|
107
|
+
/**
|
|
108
|
+
* - Identifier of the completed source video.
|
|
109
|
+
*/
|
|
110
|
+
id: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Structured metadata for an OpenAI video generation job.
|
|
114
|
+
*/
|
|
115
|
+
export type VideoObject = {
|
|
116
|
+
/**
|
|
117
|
+
* - Unique identifier for the video job.
|
|
118
|
+
*/
|
|
119
|
+
id: string;
|
|
120
|
+
/**
|
|
121
|
+
* - Unix timestamp in seconds for completion, when finished.
|
|
122
|
+
*/
|
|
123
|
+
completed_at?: number | null | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* - Unix timestamp in seconds when the job was created.
|
|
126
|
+
*/
|
|
127
|
+
created_at?: number | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* - Error payload when generation failed.
|
|
130
|
+
*/
|
|
131
|
+
error?: VideoCreateError | null | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* - Unix timestamp in seconds when downloadable assets expire.
|
|
134
|
+
*/
|
|
135
|
+
expires_at?: number | null | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* - Video generation model that produced the job.
|
|
138
|
+
*/
|
|
139
|
+
model?: string | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* - Object type marker for video job responses.
|
|
142
|
+
*/
|
|
143
|
+
object?: "video" | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* - Approximate completion percentage from 0 to 100.
|
|
146
|
+
*/
|
|
147
|
+
progress?: number | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* - Prompt used to generate, edit, extend, or remix the video.
|
|
150
|
+
*/
|
|
151
|
+
prompt?: string | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* - Source video id when this video is a remix.
|
|
154
|
+
*/
|
|
155
|
+
remixed_from_video_id?: string | null | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* - Duration of the generated clip, or stitched total duration for extensions.
|
|
158
|
+
*/
|
|
159
|
+
seconds?: string | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* - Output resolution.
|
|
162
|
+
*/
|
|
163
|
+
size?: VideoSize | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* - Current lifecycle status of the video job.
|
|
166
|
+
*/
|
|
167
|
+
status: VideoStatus;
|
|
168
|
+
/**
|
|
169
|
+
* - Downloaded media data when a wrapper is called with download enabled.
|
|
170
|
+
*/
|
|
171
|
+
content?: VideoDownloadResult | undefined;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Response returned after deleting a video.
|
|
175
|
+
*/
|
|
176
|
+
export type VideoDeleteResponse = {
|
|
177
|
+
/**
|
|
178
|
+
* - Identifier of the deleted video.
|
|
179
|
+
*/
|
|
180
|
+
id: string;
|
|
181
|
+
/**
|
|
182
|
+
* - Whether the resource was deleted.
|
|
183
|
+
*/
|
|
184
|
+
deleted: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* - Object type marker for delete responses.
|
|
187
|
+
*/
|
|
188
|
+
object: "video.deleted";
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Query parameters for listing generated videos.
|
|
192
|
+
*/
|
|
193
|
+
export type VideoListQuery = {
|
|
194
|
+
/**
|
|
195
|
+
* - Pagination cursor from the previous response.
|
|
196
|
+
*/
|
|
197
|
+
after?: string | undefined;
|
|
198
|
+
/**
|
|
199
|
+
* - Maximum number of videos to retrieve.
|
|
200
|
+
*/
|
|
201
|
+
limit?: number | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* - Sort order by timestamp.
|
|
204
|
+
*/
|
|
205
|
+
order?: "desc" | "asc" | undefined;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Paginated list response for generated videos.
|
|
209
|
+
*/
|
|
210
|
+
export type VideoListResponse = {
|
|
211
|
+
/**
|
|
212
|
+
* - Page of video jobs.
|
|
213
|
+
*/
|
|
214
|
+
data: VideoObject[];
|
|
215
|
+
/**
|
|
216
|
+
* - Identifier of the first item in the page.
|
|
217
|
+
*/
|
|
218
|
+
first_id?: string | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* - Whether more items are available.
|
|
221
|
+
*/
|
|
222
|
+
has_more?: boolean | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* - Identifier of the last item in the page.
|
|
225
|
+
*/
|
|
226
|
+
last_id?: string | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* - Object type marker for list responses.
|
|
229
|
+
*/
|
|
230
|
+
object: "list";
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Response returned for character creation and retrieval.
|
|
234
|
+
*/
|
|
235
|
+
export type VideoCharacter = {
|
|
236
|
+
/**
|
|
237
|
+
* - Identifier for the character cameo.
|
|
238
|
+
*/
|
|
239
|
+
id: string;
|
|
240
|
+
/**
|
|
241
|
+
* - Unix timestamp in seconds when the character was created.
|
|
242
|
+
*/
|
|
243
|
+
created_at: number;
|
|
244
|
+
/**
|
|
245
|
+
* - Display name for the character.
|
|
246
|
+
*/
|
|
247
|
+
name: string;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Result returned by authenticated media download helpers.
|
|
251
|
+
*/
|
|
252
|
+
export type VideoDownloadResult = {
|
|
253
|
+
/**
|
|
254
|
+
* - Downloaded media bytes.
|
|
255
|
+
*/
|
|
256
|
+
buffer: Buffer;
|
|
257
|
+
/**
|
|
258
|
+
* - Response content type.
|
|
259
|
+
*/
|
|
260
|
+
contentType: string;
|
|
261
|
+
/**
|
|
262
|
+
* - Number of downloaded bytes.
|
|
263
|
+
*/
|
|
264
|
+
bytes: number;
|
|
265
|
+
/**
|
|
266
|
+
* - Absolute local path when media was saved to disk.
|
|
267
|
+
*/
|
|
268
|
+
local_path?: string | undefined;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Options for polling a video job until it reaches a terminal state.
|
|
272
|
+
*/
|
|
273
|
+
export type PollOptions = RequestOptions & Object;
|
|
274
|
+
/**
|
|
275
|
+
* Options for submitting a create-video request.
|
|
276
|
+
*/
|
|
277
|
+
export type SubmitVideoOptions = RequestOptions & PollOptions & Object;
|
|
278
|
+
/**
|
|
279
|
+
* Options for creating a video and optionally downloading the completed result.
|
|
280
|
+
*/
|
|
281
|
+
export type CreateVideoOptions = SubmitVideoOptions & Object;
|
|
282
|
+
/**
|
|
283
|
+
* Options for emergency polling after a previous create/edit/extend/remix timeout.
|
|
284
|
+
*/
|
|
285
|
+
export type EmergencyPollVideoOptions = PollOptions & Object;
|
|
286
|
+
/**
|
|
287
|
+
* Options for downloading generated video media or preview assets.
|
|
288
|
+
*/
|
|
289
|
+
export type DownloadVideoOptions = RequestOptions & Object;
|
|
290
|
+
/**
|
|
291
|
+
* Options for edit, extension, and remix requests.
|
|
292
|
+
*/
|
|
293
|
+
export type VideoMutationOptions = RequestOptions & PollOptions & Object;
|
|
294
|
+
/**
|
|
295
|
+
* Local or in-memory video input accepted by createCharacter().
|
|
296
|
+
*/
|
|
297
|
+
export type CharacterVideoInput = string | Buffer | Blob | ArrayBuffer;
|
|
298
|
+
/**
|
|
299
|
+
* Blob conversion result used for multipart character upload.
|
|
300
|
+
*/
|
|
301
|
+
export type VideoBlobResult = {
|
|
302
|
+
/**
|
|
303
|
+
* - Blob ready to append to FormData.
|
|
304
|
+
*/
|
|
305
|
+
blob: Blob;
|
|
306
|
+
/**
|
|
307
|
+
* - Filename sent with the multipart upload.
|
|
308
|
+
*/
|
|
309
|
+
filename: string;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Create a video and wait until the job completes.
|
|
313
|
+
* @param {string} prompt - Prompt describing the video.
|
|
314
|
+
* @param {CreateVideoOptions} [options={}] - Create and polling options.
|
|
315
|
+
* @param {boolean} [options.download=false] - Download final video after completion.
|
|
316
|
+
* @returns {Promise<VideoObject>} Completed video response, optionally with `content`.
|
|
317
|
+
*/
|
|
318
|
+
export function createVideo(prompt: string, options?: CreateVideoOptions): Promise<VideoObject>;
|
|
319
|
+
/**
|
|
320
|
+
* Retrieve the latest metadata for a generated video.
|
|
321
|
+
* @param {string} videoId - OpenAI video id.
|
|
322
|
+
* @param {RequestOptions} [options={}] - Request options.
|
|
323
|
+
* @returns {Promise<VideoObject>} Video object.
|
|
324
|
+
*/
|
|
325
|
+
export function retrieveVideo(videoId: string, options?: RequestOptions): Promise<VideoObject>;
|
|
326
|
+
/**
|
|
327
|
+
* List recently generated videos for the current project.
|
|
328
|
+
* @param {VideoListQuery} [query={}] - List query parameters.
|
|
329
|
+
* @param {string} [query.after] - Pagination cursor.
|
|
330
|
+
* @param {number} [query.limit] - Number of items to retrieve.
|
|
331
|
+
* @param {'asc'|'desc'} [query.order] - Sort order.
|
|
332
|
+
* @param {RequestOptions} [options={}] - Request options.
|
|
333
|
+
* @returns {Promise<VideoListResponse>} List response.
|
|
334
|
+
*/
|
|
335
|
+
export function listVideos(query?: VideoListQuery, options?: RequestOptions): Promise<VideoListResponse>;
|
|
336
|
+
/**
|
|
337
|
+
* Delete a completed or failed video and its stored assets.
|
|
338
|
+
* @param {string} videoId - OpenAI video id.
|
|
339
|
+
* @param {RequestOptions} [options={}] - Request options.
|
|
340
|
+
* @returns {Promise<VideoDeleteResponse>} Delete response.
|
|
341
|
+
*/
|
|
342
|
+
export function deleteVideo(videoId: string, options?: RequestOptions): Promise<VideoDeleteResponse>;
|
|
343
|
+
/**
|
|
344
|
+
* Download generated video bytes or a preview asset.
|
|
345
|
+
* @param {string} videoId - OpenAI video id.
|
|
346
|
+
* @param {DownloadVideoOptions} [options={}] - Download options.
|
|
347
|
+
* @param {VideoAssetVariant} [options.variant='video'] - Asset variant.
|
|
348
|
+
* @param {boolean} [options.save=false] - Save bytes to `.cache/openai/`.
|
|
349
|
+
* @param {string} [options.filenamePrefix='openai-video'] - Local filename prefix.
|
|
350
|
+
* @returns {Promise<VideoDownloadResult>}
|
|
351
|
+
*/
|
|
352
|
+
export function downloadVideoContent(videoId: string, options?: DownloadVideoOptions): Promise<VideoDownloadResult>;
|
|
353
|
+
/**
|
|
354
|
+
* Emergency polling call for jobs that outlive a previous request timeout.
|
|
355
|
+
*
|
|
356
|
+
* Call this with the video id from a timed-out create/edit/extend/remix response
|
|
357
|
+
* or from the thrown timeout error's `videoId` property. Defaults are longer and
|
|
358
|
+
* less aggressive than normal polling.
|
|
359
|
+
*
|
|
360
|
+
* @param {string} videoId - OpenAI video id.
|
|
361
|
+
* @param {PollOptions} [options={}] - Polling options.
|
|
362
|
+
* @param {number} [options.maxWaitMs=3600000] - Maximum wait time in ms.
|
|
363
|
+
* @param {number} [options.pollIntervalMs=30000] - Delay between polls in ms.
|
|
364
|
+
* @param {boolean} [options.download=false] - Download final media when completed.
|
|
365
|
+
* @param {VideoAssetVariant} [options.variant='video'] - Asset variant to download.
|
|
366
|
+
* @param {string} [options.userAgent='@j-o-r/agents'] - User-Agent header value.
|
|
367
|
+
* @returns {Promise<VideoObject>} Completed video response, optionally with download data.
|
|
368
|
+
*/
|
|
369
|
+
export function emergencyPollVideo(videoId: string, options?: PollOptions): Promise<VideoObject>;
|
|
370
|
+
/**
|
|
371
|
+
* Edit a video and wait until the job completes.
|
|
372
|
+
* @param {string} videoId - Completed source video id.
|
|
373
|
+
* @param {string} prompt - Edit prompt.
|
|
374
|
+
* @param {VideoMutationOptions} [options={}] - Request and polling options.
|
|
375
|
+
* @returns {Promise<VideoObject>} Completed video response.
|
|
376
|
+
*/
|
|
377
|
+
export function editVideo(videoId: string, prompt: string, options?: VideoMutationOptions): Promise<VideoObject>;
|
|
378
|
+
/**
|
|
379
|
+
* Extend a video and wait until the job completes.
|
|
380
|
+
* @param {string} videoId - Completed source video id.
|
|
381
|
+
* @param {string} prompt - Extension prompt.
|
|
382
|
+
* @param {VideoExtensionSeconds} [seconds='4'] - New segment length.
|
|
383
|
+
* @param {VideoMutationOptions} [options={}] - Request and polling options.
|
|
384
|
+
* @returns {Promise<VideoObject>} Completed video response.
|
|
385
|
+
*/
|
|
386
|
+
export function extendVideo(videoId: string, prompt: string, seconds?: VideoExtensionSeconds, options?: VideoMutationOptions): Promise<VideoObject>;
|
|
387
|
+
/**
|
|
388
|
+
* Remix a video and wait until the job completes.
|
|
389
|
+
* @param {string} videoId - Completed source video id.
|
|
390
|
+
* @param {string} prompt - Remix prompt.
|
|
391
|
+
* @param {VideoMutationOptions} [options={}] - Request and polling options.
|
|
392
|
+
* @returns {Promise<VideoObject>} Completed video response.
|
|
393
|
+
*/
|
|
394
|
+
export function remixVideo(videoId: string, prompt: string, options?: VideoMutationOptions): Promise<VideoObject>;
|
|
395
|
+
/**
|
|
396
|
+
* Create a character from an uploaded video.
|
|
397
|
+
* @param {string} name - Display name for the character.
|
|
398
|
+
* @param {CharacterVideoInput} video - Local file path or video bytes.
|
|
399
|
+
* @param {RequestOptions} [options={}] - Request options.
|
|
400
|
+
* @returns {Promise<VideoCharacter>} Character response.
|
|
401
|
+
*/
|
|
402
|
+
export function createCharacter(name: string, video: CharacterVideoInput, options?: RequestOptions): Promise<VideoCharacter>;
|
|
403
|
+
/**
|
|
404
|
+
* Fetch a character by id.
|
|
405
|
+
* @param {string} characterId - Character id.
|
|
406
|
+
* @param {RequestOptions} [options={}] - Request options.
|
|
407
|
+
* @returns {Promise<VideoCharacter>} Character response.
|
|
408
|
+
*/
|
|
409
|
+
export function fetchCharacter(characterId: string, options?: RequestOptions): Promise<VideoCharacter>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default tools;
|
|
2
|
+
/**
|
|
3
|
+
* Supported downloadable video asset variants.
|
|
4
|
+
*/
|
|
5
|
+
export type VideoAssetVariant = "video" | "thumbnail" | "spritesheet";
|
|
6
|
+
/**
|
|
7
|
+
* JSON-serializable summary returned for downloaded media content.
|
|
8
|
+
*/
|
|
9
|
+
export type DownloadSummary = {
|
|
10
|
+
/**
|
|
11
|
+
* - Response content type.
|
|
12
|
+
*/
|
|
13
|
+
contentType: string;
|
|
14
|
+
/**
|
|
15
|
+
* - Number of downloaded bytes.
|
|
16
|
+
*/
|
|
17
|
+
bytes: number;
|
|
18
|
+
/**
|
|
19
|
+
* - Local saved file path when available.
|
|
20
|
+
*/
|
|
21
|
+
local_path?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
declare const tools: ToolSet;
|
|
24
|
+
import ToolSet from '../../ToolSet.js';
|
|
@@ -20,7 +20,7 @@ export function getHeaders(acceptHeader?: string): Object;
|
|
|
20
20
|
* - base64 string: decoded
|
|
21
21
|
* - Blob/ArrayBuffer: converted
|
|
22
22
|
* @param {string} [filenamePrefix='stability-audio'] - Prefix for the generated filename.
|
|
23
|
-
* @param {string} [ext='mp3'] - File extension (
|
|
23
|
+
* @param {string} [ext='mp3'] - File extension (forced to 'mp3' in MP3-only mode).
|
|
24
24
|
* @returns {Promise<string>} Absolute local file path of the saved audio.
|
|
25
25
|
* @throws {Error} For unsupported formats or download failures.
|
|
26
26
|
*/
|
|
@@ -28,18 +28,7 @@ export function saveAudioToLocal(audioData: Buffer | string | Blob | ArrayBuffer
|
|
|
28
28
|
/**
|
|
29
29
|
* Generates high-quality audio from a text prompt using Stable Audio 3.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
* parameters, receives a generation ID (202), polls until ready, and returns
|
|
33
|
-
* the generated audio saved locally plus metadata.
|
|
34
|
-
*
|
|
35
|
-
* **Constraints** (from Stable Audio 3 spec):
|
|
36
|
-
* - Prompt: English only, max 10,000 characters, descriptive (instruments, mood, genre, style).
|
|
37
|
-
* - Duration: 1–380 seconds (default 190).
|
|
38
|
-
* - Steps: 4–8 (default 8).
|
|
39
|
-
* - CFG Scale: 1–25 (default 1).
|
|
40
|
-
* - Seed: 0 (random) or 0–4,294,967,294.
|
|
41
|
-
* - Output: mp3 (default) or wav at 44.1 kHz stereo.
|
|
42
|
-
* - Cost: Flat 26 credits per successful generation.
|
|
31
|
+
* **MP3 ONLY** — Output is always MP3. `output_format` is ignored and forced to 'mp3'.
|
|
43
32
|
*
|
|
44
33
|
* @async
|
|
45
34
|
* @function textToAudio
|
|
@@ -50,43 +39,11 @@ export function saveAudioToLocal(audioData: Buffer | string | Blob | ArrayBuffer
|
|
|
50
39
|
* @param {number} [options.seed=0] - Random seed for reproducibility (0 = random).
|
|
51
40
|
* @param {number} [options.steps=8] - Number of sampling steps (4–8).
|
|
52
41
|
* @param {number} [options.cfg_scale=1] - Prompt adherence strength (1–25).
|
|
53
|
-
* @param {string} [options.
|
|
54
|
-
* @param {string} [options.accept='audio/*'] - Response format: `'audio/*'` (binary) or `'application/json'`.
|
|
42
|
+
* @param {string} [options.accept='audio/*'] - Response format.
|
|
55
43
|
* @param {string} [options.filenamePrefix='stability-text-to-audio'] - Prefix for saved file.
|
|
56
|
-
* @returns {Promise<Object>} Result object
|
|
57
|
-
* ```js
|
|
58
|
-
* {
|
|
59
|
-
* local_path: '/path/to/.cache/stability/stability-text-to-audio-1234567890.mp3',
|
|
60
|
-
* finish_reason: 'SUCCESS',
|
|
61
|
-
* seed: 123456789,
|
|
62
|
-
* x_request_id: 'req_...',
|
|
63
|
-
* raw: { headers: {...} } // or full JSON if accept=application/json
|
|
64
|
-
* }
|
|
65
|
-
* ```
|
|
44
|
+
* @returns {Promise<Object>} Result object (always .mp3).
|
|
66
45
|
* @throws {Error} - 'Missing STABILITY_API_KEY', invalid prompt, unsupported model,
|
|
67
|
-
* API errors (
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* // Basic usage
|
|
71
|
-
* const result = await textToAudio('upbeat electronic synthwave with driving bass');
|
|
72
|
-
* console.log('Saved to:', result.local_path);
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* // Advanced with options
|
|
76
|
-
* const result = await textToAudio(
|
|
77
|
-
* 'cinematic orchestral music, epic brass, strings, choir, 120 BPM',
|
|
78
|
-
* {
|
|
79
|
-
* duration: 240,
|
|
80
|
-
* seed: 42,
|
|
81
|
-
* steps: 8,
|
|
82
|
-
* cfg_scale: 7,
|
|
83
|
-
* output_format: 'wav',
|
|
84
|
-
* accept: 'application/json'
|
|
85
|
-
* }
|
|
86
|
-
* );
|
|
87
|
-
* if (result.audio_base64) {
|
|
88
|
-
* // handle base64
|
|
89
|
-
* }
|
|
46
|
+
* API errors, or non-MP3 input (if any reference audio were passed).
|
|
90
47
|
*/
|
|
91
48
|
export function textToAudio(prompt: string, options?: {
|
|
92
49
|
model?: string | undefined;
|
|
@@ -94,100 +51,54 @@ export function textToAudio(prompt: string, options?: {
|
|
|
94
51
|
seed?: number | undefined;
|
|
95
52
|
steps?: number | undefined;
|
|
96
53
|
cfg_scale?: number | undefined;
|
|
97
|
-
output_format?: string | undefined;
|
|
98
54
|
accept?: string | undefined;
|
|
99
55
|
filenamePrefix?: string | undefined;
|
|
100
56
|
}): Promise<Object>;
|
|
101
57
|
/**
|
|
102
58
|
* Transforms an existing audio sample using a text prompt (audio-to-audio / style transfer).
|
|
103
59
|
*
|
|
104
|
-
*
|
|
105
|
-
* composition that incorporates elements of the input while following the text description.
|
|
106
|
-
*
|
|
107
|
-
* **Additional Parameter**:
|
|
108
|
-
* - `strength`: Denoising strength (0.0 = identical to input, 1.0 = no influence from input).
|
|
109
|
-
*
|
|
110
|
-
* All other constraints and behavior are identical to `textToAudio`.
|
|
60
|
+
* **MP3 ONLY** — Input must be MP3. Output is always MP3.
|
|
111
61
|
*
|
|
112
62
|
* @async
|
|
113
63
|
* @function audioToAudio
|
|
114
64
|
* @param {string} prompt - Descriptive text prompt (English, max 10k chars).
|
|
115
|
-
* @param {string|Buffer|Blob} audioInput - Reference audio
|
|
116
|
-
*
|
|
117
|
-
* - Remote HTTP/HTTPS URL (string) – auto-downloaded with proper MIME
|
|
118
|
-
* - Buffer (raw bytes)
|
|
119
|
-
* - Blob (with optional name/type)
|
|
120
|
-
* @param {Object} [options={}] - Generation options (see textToAudio for common params).
|
|
65
|
+
* @param {string|Buffer|Blob} audioInput - Reference audio (**must be MP3**).
|
|
66
|
+
* @param {Object} [options={}] - Generation options.
|
|
121
67
|
* @param {number} [options.strength=1] - Denoising strength (0–1).
|
|
122
|
-
* @
|
|
123
|
-
* @
|
|
124
|
-
* @throws {Error} Same as textToAudio plus audio input validation errors.
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* const result = await audioToAudio(
|
|
128
|
-
* 'transform into orchestral version with strings and choir',
|
|
129
|
-
* './reference-track.mp3',
|
|
130
|
-
* { strength: 0.75, duration: 180 }
|
|
131
|
-
* );
|
|
68
|
+
* @returns {Promise<Object>} Same structure as textToAudio result (always .mp3).
|
|
69
|
+
* @throws {Error} Same as textToAudio plus non-MP3 input validation errors.
|
|
132
70
|
*/
|
|
133
71
|
export function audioToAudio(prompt: string, audioInput: string | Buffer | Blob, options?: {
|
|
134
72
|
strength?: number | undefined;
|
|
135
|
-
filenamePrefix?: string | undefined;
|
|
136
73
|
}): Promise<Object>;
|
|
137
74
|
/**
|
|
138
75
|
* Performs audio inpainting: replaces a specified time segment of an audio file
|
|
139
76
|
* with new content generated from a text prompt.
|
|
140
77
|
*
|
|
141
|
-
*
|
|
142
|
-
* The model fills the masked section while preserving the rest of the audio.
|
|
143
|
-
*
|
|
144
|
-
* Default mask: 30s → 380s (inpaint most of a long track).
|
|
78
|
+
* **MP3 ONLY** — Input must be MP3. Output is always MP3.
|
|
145
79
|
*
|
|
146
80
|
* @async
|
|
147
81
|
* @function inpaint
|
|
148
82
|
* @param {string} prompt - Text prompt describing the desired replacement content.
|
|
149
|
-
* @param {string|Buffer|Blob} audioInput - Reference audio (
|
|
83
|
+
* @param {string|Buffer|Blob} audioInput - Reference audio (**must be MP3**).
|
|
150
84
|
* @param {Object} [options={}] - Generation options.
|
|
151
85
|
* @param {number} [options.mask_start=30] - Start time (seconds) of the inpaint mask (0–380).
|
|
152
86
|
* @param {number} [options.mask_end=380] - End time (seconds) of the inpaint mask (0–380).
|
|
153
|
-
* @
|
|
154
|
-
* @returns {Promise<Object>} Same result structure as other generation methods.
|
|
87
|
+
* @returns {Promise<Object>} Same result structure as other generation methods (always .mp3).
|
|
155
88
|
* @throws {Error} Validation errors for mask ranges, audio input, etc.
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* // Inpaint the middle section
|
|
159
|
-
* const result = await inpaint(
|
|
160
|
-
* 'add a soaring guitar solo in this section',
|
|
161
|
-
* 'full-track.mp3',
|
|
162
|
-
* { mask_start: 60, mask_end: 120, duration: 180 }
|
|
163
|
-
* );
|
|
164
89
|
*/
|
|
165
90
|
export function inpaint(prompt: string, audioInput: string | Buffer | Blob, options?: {
|
|
166
91
|
mask_start?: number | undefined;
|
|
167
92
|
mask_end?: number | undefined;
|
|
168
|
-
filenamePrefix?: string | undefined;
|
|
169
93
|
}): Promise<Object>;
|
|
170
94
|
/**
|
|
171
95
|
* Manually fetches or checks the status of a generation using its ID.
|
|
172
|
-
* Useful for custom polling logic or resuming after a previous submission.
|
|
173
96
|
*
|
|
174
97
|
* @async
|
|
175
98
|
* @function fetchResult
|
|
176
99
|
* @param {string} id - Generation ID (from a previous 202 response).
|
|
177
100
|
* @param {string} [acceptHeader='audio/*'] - `'audio/*'` or `'application/json'`.
|
|
178
|
-
* @returns {Promise<Object>} Either
|
|
179
|
-
* - Completed result (same as processResult)
|
|
180
|
-
* - `{ status: 'in-progress', id, raw }` if still 202
|
|
101
|
+
* @returns {Promise<Object>} Either completed result or in-progress status.
|
|
181
102
|
* @throws {Error} If ID missing, 404 (expired), or other API error.
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* // Manual polling example
|
|
185
|
-
* const id = await submit...; // or from previous call
|
|
186
|
-
* let result;
|
|
187
|
-
* while (true) {
|
|
188
|
-
* result = await fetchResult(id);
|
|
189
|
-
* if (result.status !== 'in-progress') break;
|
|
190
|
-
* await new Promise(r => setTimeout(r, 5000));
|
|
191
|
-
* }
|
|
192
103
|
*/
|
|
193
104
|
export function fetchResult(id: string, acceptHeader?: string): Promise<Object>;
|
|
@@ -79,7 +79,7 @@ export function generateUltra(prompt: string, options?: {
|
|
|
79
79
|
aspect_ratio?: string | undefined;
|
|
80
80
|
seed?: number | undefined;
|
|
81
81
|
output_format?: string | undefined;
|
|
82
|
-
image?: string | Buffer |
|
|
82
|
+
image?: string | Blob | Buffer<ArrayBufferLike> | undefined;
|
|
83
83
|
strength?: number | undefined;
|
|
84
84
|
style_preset?: string | undefined;
|
|
85
85
|
accept?: string | undefined;
|
|
@@ -157,7 +157,7 @@ export function upscaleConservative(imageInput: string | Buffer | Blob, prompt:
|
|
|
157
157
|
* @returns {Promise<Object>} Result with edited image.
|
|
158
158
|
*/
|
|
159
159
|
export function editErase(imageInput: string | Buffer | Blob, options?: {
|
|
160
|
-
mask?: string | Buffer |
|
|
160
|
+
mask?: string | Blob | Buffer<ArrayBufferLike> | undefined;
|
|
161
161
|
grow_mask?: number | undefined;
|
|
162
162
|
seed?: number | undefined;
|
|
163
163
|
output_format?: string | undefined;
|