@elizaos/plugin-suno 0.25.6-alpha.1 → 1.0.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/LICENSE +21 -21
- package/dist/index.cjs +458 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.js +58 -48
- package/dist/index.js.map +1 -1
- package/package.json +73 -31
- package/.turbo/turbo-build.log +0 -17
- package/biome.json +0 -41
- package/src/actions/customGenerate.ts +0 -156
- package/src/actions/extend.ts +0 -134
- package/src/actions/generate.ts +0 -145
- package/src/index.ts +0 -22
- package/src/providers/suno.ts +0 -78
- package/src/types/index.ts +0 -34
- package/tsconfig.json +0 -11
- package/tsup.config.ts +0 -11
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ElizaOS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
// src/providers/suno.ts
|
|
6
|
+
var SunoApiClient = class _SunoApiClient {
|
|
7
|
+
apiKey;
|
|
8
|
+
baseUrl;
|
|
9
|
+
static async get(runtime, _message, _state) {
|
|
10
|
+
const apiKey = runtime.getSetting("SUNO_API_KEY");
|
|
11
|
+
if (!apiKey) {
|
|
12
|
+
throw new Error("SUNO_API_KEY is required");
|
|
13
|
+
}
|
|
14
|
+
return new _SunoApiClient({ apiKey });
|
|
15
|
+
}
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.apiKey = config.apiKey;
|
|
18
|
+
this.baseUrl = config.baseUrl || "https://api.suno.ai/v1";
|
|
19
|
+
}
|
|
20
|
+
async request(endpoint, options = {}) {
|
|
21
|
+
const url = `${this.baseUrl}${endpoint}`;
|
|
22
|
+
const headers = {
|
|
23
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
...options.headers
|
|
26
|
+
};
|
|
27
|
+
const response = await fetch(url, {
|
|
28
|
+
...options,
|
|
29
|
+
headers
|
|
30
|
+
});
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw new Error(`Suno API error: ${response.statusText}`);
|
|
33
|
+
}
|
|
34
|
+
return response.json();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var SunoProvider = {
|
|
38
|
+
name: "suno",
|
|
39
|
+
description: "Provides Suno AI music generation context and status",
|
|
40
|
+
get: async (runtime, _message, _state) => {
|
|
41
|
+
const apiKey = runtime.getSetting("SUNO_API_KEY");
|
|
42
|
+
return {
|
|
43
|
+
values: {
|
|
44
|
+
apiKeyConfigured: !!apiKey,
|
|
45
|
+
status: apiKey ? "ready" : "not_configured",
|
|
46
|
+
serviceUrl: "https://api.suno.ai/v1"
|
|
47
|
+
},
|
|
48
|
+
text: `Suno AI music generation service is ${apiKey ? "ready" : "not configured"}. API key ${apiKey ? "is set" : "is missing"}.`
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/actions/generate.ts
|
|
54
|
+
var generateMusic = {
|
|
55
|
+
name: "generate-music",
|
|
56
|
+
description: "Generate music using Suno AI",
|
|
57
|
+
similes: [
|
|
58
|
+
"CREATE_MUSIC",
|
|
59
|
+
"MAKE_MUSIC",
|
|
60
|
+
"COMPOSE_MUSIC",
|
|
61
|
+
"GENERATE_AUDIO",
|
|
62
|
+
"CREATE_SONG",
|
|
63
|
+
"MAKE_SONG"
|
|
64
|
+
],
|
|
65
|
+
validate: async (runtime, _message) => {
|
|
66
|
+
return !!runtime.getSetting("SUNO_API_KEY");
|
|
67
|
+
},
|
|
68
|
+
handler: async (runtime, message, state, _options, callback) => {
|
|
69
|
+
try {
|
|
70
|
+
const provider = await SunoApiClient.get(runtime, message, state);
|
|
71
|
+
const content = message.content;
|
|
72
|
+
if (!content.prompt) {
|
|
73
|
+
throw new Error("Missing required parameter: prompt");
|
|
74
|
+
}
|
|
75
|
+
const response = await provider.request("/generate", {
|
|
76
|
+
method: "POST",
|
|
77
|
+
body: JSON.stringify({
|
|
78
|
+
prompt: content.prompt,
|
|
79
|
+
duration: content.duration || 30,
|
|
80
|
+
temperature: content.temperature || 1,
|
|
81
|
+
top_k: content.topK || 250,
|
|
82
|
+
top_p: content.topP || 0.95,
|
|
83
|
+
classifier_free_guidance: content.classifier_free_guidance || 3
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
if (callback) {
|
|
87
|
+
callback({
|
|
88
|
+
text: "Successfully generated music based on your prompt",
|
|
89
|
+
content: response
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
if (callback) {
|
|
95
|
+
callback({
|
|
96
|
+
text: `Failed to generate music: ${error.message}`,
|
|
97
|
+
error
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
examples: [
|
|
104
|
+
[
|
|
105
|
+
{
|
|
106
|
+
name: "user1",
|
|
107
|
+
content: {
|
|
108
|
+
text: "Create a happy and energetic song",
|
|
109
|
+
prompt: "A cheerful and energetic melody with upbeat rhythm",
|
|
110
|
+
duration: 30,
|
|
111
|
+
temperature: 1
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "agent",
|
|
116
|
+
content: {
|
|
117
|
+
text: "I'll generate a happy and energetic song for you.",
|
|
118
|
+
action: "generate-music"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "agent",
|
|
123
|
+
content: {
|
|
124
|
+
text: "Successfully generated your upbeat and energetic song."
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
{
|
|
130
|
+
name: "user1",
|
|
131
|
+
content: {
|
|
132
|
+
text: "Generate a relaxing ambient track",
|
|
133
|
+
prompt: "A peaceful ambient soundscape with gentle waves and soft pads",
|
|
134
|
+
duration: 45,
|
|
135
|
+
temperature: 0.8,
|
|
136
|
+
classifier_free_guidance: 4
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "agent",
|
|
141
|
+
content: {
|
|
142
|
+
text: "I'll create a calming ambient piece for you.",
|
|
143
|
+
action: "generate-music"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "agent",
|
|
148
|
+
content: {
|
|
149
|
+
text: "Successfully generated your relaxing ambient soundscape."
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
{
|
|
155
|
+
name: "user1",
|
|
156
|
+
content: {
|
|
157
|
+
text: "Make a short jingle for my podcast",
|
|
158
|
+
prompt: "A catchy and professional podcast intro jingle",
|
|
159
|
+
duration: 15,
|
|
160
|
+
temperature: 1.2,
|
|
161
|
+
top_k: 300
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "agent",
|
|
166
|
+
content: {
|
|
167
|
+
text: "I'll generate a podcast jingle for you.",
|
|
168
|
+
action: "generate-music"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "agent",
|
|
173
|
+
content: {
|
|
174
|
+
text: "Successfully generated your podcast jingle."
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
var generate_default = generateMusic;
|
|
181
|
+
|
|
182
|
+
// src/actions/customGenerate.ts
|
|
183
|
+
var customGenerateMusic = {
|
|
184
|
+
name: "custom-generate-music",
|
|
185
|
+
description: "Generate music with custom parameters using Suno AI",
|
|
186
|
+
similes: [
|
|
187
|
+
"CREATE_CUSTOM_MUSIC",
|
|
188
|
+
"GENERATE_CUSTOM_AUDIO",
|
|
189
|
+
"MAKE_CUSTOM_MUSIC",
|
|
190
|
+
"COMPOSE_CUSTOM_MUSIC",
|
|
191
|
+
"CUSTOM_MUSIC_GENERATION",
|
|
192
|
+
"ADVANCED_MUSIC_CREATION",
|
|
193
|
+
"PERSONALIZED_MUSIC_GENERATION"
|
|
194
|
+
],
|
|
195
|
+
validate: async (runtime, _message) => {
|
|
196
|
+
return !!runtime.getSetting("SUNO_API_KEY");
|
|
197
|
+
},
|
|
198
|
+
handler: async (runtime, message, state, _options, callback) => {
|
|
199
|
+
try {
|
|
200
|
+
const provider = await SunoApiClient.get(runtime, message, state);
|
|
201
|
+
const content = message.content;
|
|
202
|
+
if (!content.prompt) {
|
|
203
|
+
throw new Error("Missing required parameter: prompt");
|
|
204
|
+
}
|
|
205
|
+
const response = await provider.request("/custom-generate", {
|
|
206
|
+
method: "POST",
|
|
207
|
+
body: JSON.stringify({
|
|
208
|
+
prompt: content.prompt,
|
|
209
|
+
duration: content.duration || 30,
|
|
210
|
+
temperature: content.temperature || 1,
|
|
211
|
+
top_k: content.topK || 250,
|
|
212
|
+
top_p: content.topP || 0.95,
|
|
213
|
+
classifier_free_guidance: content.classifier_free_guidance || 3,
|
|
214
|
+
reference_audio: content.reference_audio,
|
|
215
|
+
style: content.style,
|
|
216
|
+
bpm: content.bpm,
|
|
217
|
+
key: content.key,
|
|
218
|
+
mode: content.mode
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
if (callback) {
|
|
222
|
+
callback({
|
|
223
|
+
text: "Successfully generated custom music",
|
|
224
|
+
content: response
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return true;
|
|
228
|
+
} catch (error) {
|
|
229
|
+
if (callback) {
|
|
230
|
+
callback({
|
|
231
|
+
text: `Failed to generate custom music: ${error.message}`,
|
|
232
|
+
error
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
examples: [
|
|
239
|
+
[
|
|
240
|
+
{
|
|
241
|
+
name: "user1",
|
|
242
|
+
content: {
|
|
243
|
+
text: "Create an upbeat electronic dance track with heavy bass",
|
|
244
|
+
prompt: "An upbeat electronic dance track with heavy bass and energetic synths",
|
|
245
|
+
duration: 60,
|
|
246
|
+
style: "electronic",
|
|
247
|
+
bpm: 128
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: "agent",
|
|
252
|
+
content: {
|
|
253
|
+
text: "I'll generate an energetic EDM track for you.",
|
|
254
|
+
action: "custom-generate-music"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: "agent",
|
|
259
|
+
content: {
|
|
260
|
+
text: "Successfully generated your EDM track with heavy bass and synths."
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
[
|
|
265
|
+
{
|
|
266
|
+
name: "user1",
|
|
267
|
+
content: {
|
|
268
|
+
text: "Generate a calm piano melody in C major",
|
|
269
|
+
prompt: "A gentle, flowing piano melody with soft dynamics",
|
|
270
|
+
duration: 45,
|
|
271
|
+
style: "classical",
|
|
272
|
+
key: "C",
|
|
273
|
+
mode: "major",
|
|
274
|
+
temperature: 0.8
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: "agent",
|
|
279
|
+
content: {
|
|
280
|
+
text: "I'll create a calming piano piece in C major for you.",
|
|
281
|
+
action: "custom-generate-music"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: "agent",
|
|
286
|
+
content: {
|
|
287
|
+
text: "Successfully generated your peaceful piano melody in C major."
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
[
|
|
292
|
+
{
|
|
293
|
+
name: "user1",
|
|
294
|
+
content: {
|
|
295
|
+
text: "Make a rock song with guitar solos",
|
|
296
|
+
prompt: "A rock song with powerful electric guitar solos and driving drums",
|
|
297
|
+
duration: 90,
|
|
298
|
+
style: "rock",
|
|
299
|
+
bpm: 120,
|
|
300
|
+
classifier_free_guidance: 4
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: "agent",
|
|
305
|
+
content: {
|
|
306
|
+
text: "I'll generate a rock track with guitar solos for you.",
|
|
307
|
+
action: "custom-generate-music"
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: "agent",
|
|
312
|
+
content: {
|
|
313
|
+
text: "Successfully generated your rock song with guitar solos."
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
]
|
|
318
|
+
};
|
|
319
|
+
var customGenerate_default = customGenerateMusic;
|
|
320
|
+
|
|
321
|
+
// src/actions/extend.ts
|
|
322
|
+
var extendAudio = {
|
|
323
|
+
name: "extend-audio",
|
|
324
|
+
description: "Extend the duration of an existing audio generation",
|
|
325
|
+
similes: [
|
|
326
|
+
"EXTEND_AUDIO",
|
|
327
|
+
"LENGTHEN_AUDIO",
|
|
328
|
+
"PROLONG_AUDIO",
|
|
329
|
+
"INCREASE_DURATION",
|
|
330
|
+
"MAKE_AUDIO_LONGER"
|
|
331
|
+
],
|
|
332
|
+
validate: async (runtime, _message) => {
|
|
333
|
+
return !!runtime.getSetting("SUNO_API_KEY");
|
|
334
|
+
},
|
|
335
|
+
handler: async (runtime, message, state, _options, callback) => {
|
|
336
|
+
try {
|
|
337
|
+
const provider = await SunoApiClient.get(runtime, message, state);
|
|
338
|
+
const content = message.content;
|
|
339
|
+
if (!content.audio_id || !content.duration) {
|
|
340
|
+
throw new Error("Missing required parameters: audio_id and duration");
|
|
341
|
+
}
|
|
342
|
+
const response = await provider.request("/extend", {
|
|
343
|
+
method: "POST",
|
|
344
|
+
body: JSON.stringify({
|
|
345
|
+
audio_id: content.audio_id,
|
|
346
|
+
duration: content.duration
|
|
347
|
+
})
|
|
348
|
+
});
|
|
349
|
+
if (callback) {
|
|
350
|
+
callback({
|
|
351
|
+
text: `Successfully extended audio ${content.audio_id}`,
|
|
352
|
+
content: response
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return true;
|
|
356
|
+
} catch (error) {
|
|
357
|
+
if (callback) {
|
|
358
|
+
callback({
|
|
359
|
+
text: `Failed to extend audio: ${error.message}`,
|
|
360
|
+
error
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
examples: [
|
|
367
|
+
[
|
|
368
|
+
{
|
|
369
|
+
name: "user1",
|
|
370
|
+
content: {
|
|
371
|
+
text: "Make this song longer by 30 seconds",
|
|
372
|
+
audio_id: "abc123",
|
|
373
|
+
duration: 30
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
name: "agent",
|
|
378
|
+
content: {
|
|
379
|
+
text: "I'll extend your song by 30 seconds.",
|
|
380
|
+
action: "extend-audio"
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
name: "agent",
|
|
385
|
+
content: {
|
|
386
|
+
text: "Successfully extended your song by 30 seconds."
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
[
|
|
391
|
+
{
|
|
392
|
+
name: "user1",
|
|
393
|
+
content: {
|
|
394
|
+
text: "Double the length of this track",
|
|
395
|
+
audio_id: "xyz789",
|
|
396
|
+
duration: 60
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
name: "agent",
|
|
401
|
+
content: {
|
|
402
|
+
text: "I'll double the duration of your track.",
|
|
403
|
+
action: "extend-audio"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: "agent",
|
|
408
|
+
content: {
|
|
409
|
+
text: "Successfully doubled the length of your track to 60 seconds."
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
],
|
|
413
|
+
[
|
|
414
|
+
{
|
|
415
|
+
name: "user1",
|
|
416
|
+
content: {
|
|
417
|
+
text: "Add 15 more seconds to this melody",
|
|
418
|
+
audio_id: "def456",
|
|
419
|
+
duration: 15
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: "agent",
|
|
424
|
+
content: {
|
|
425
|
+
text: "I'll add 15 seconds to your melody.",
|
|
426
|
+
action: "extend-audio"
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "agent",
|
|
431
|
+
content: {
|
|
432
|
+
text: "Successfully added 15 seconds to your melody."
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
]
|
|
437
|
+
};
|
|
438
|
+
var extend_default = extendAudio;
|
|
439
|
+
|
|
440
|
+
// src/index.ts
|
|
441
|
+
var sunoPlugin = {
|
|
442
|
+
name: "suno",
|
|
443
|
+
description: "Suno AI Music Generation Plugin for Eliza",
|
|
444
|
+
actions: [generate_default, customGenerate_default, extend_default],
|
|
445
|
+
evaluators: [],
|
|
446
|
+
providers: [SunoProvider]
|
|
447
|
+
};
|
|
448
|
+
var index_default = sunoPlugin;
|
|
449
|
+
|
|
450
|
+
exports.CustomGenerateMusic = customGenerate_default;
|
|
451
|
+
exports.ExtendAudio = extend_default;
|
|
452
|
+
exports.GenerateMusic = generate_default;
|
|
453
|
+
exports.SunoApiClient = SunoApiClient;
|
|
454
|
+
exports.SunoProvider = SunoProvider;
|
|
455
|
+
exports.default = index_default;
|
|
456
|
+
exports.sunoPlugin = sunoPlugin;
|
|
457
|
+
//# sourceMappingURL=index.cjs.map
|
|
458
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers/suno.ts","../src/actions/generate.ts","../src/actions/customGenerate.ts","../src/actions/extend.ts","../src/index.ts"],"names":[],"mappings":";;;;;AAOO,IAAM,aAAA,GAAN,MAAM,cAAA,CAAc;AAAA,EACjB,MAAA;AAAA,EACA,OAAA;AAAA,EAER,aAAa,GAAA,CACX,OAAA,EACA,QAAA,EACA,MAAA,EACwB;AACxB,IAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,UAAA,CAAW,cAAc,CAAA;AAChD,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,MAAM,IAAI,MAAM,0BAA0B,CAAA;AAAA;AAE5C,IAAA,OAAO,IAAI,cAAA,CAAc,EAAE,MAAA,EAAQ,CAAA;AAAA;AACrC,EAEA,YAAY,MAAA,EAAoB;AAC9B,IAAA,IAAA,CAAK,SAAS,MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK,OAAA,GAAU,OAAO,OAAA,IAAW,wBAAA;AAAA;AACnC,EAEA,MAAM,OAAA,CAAQ,QAAA,EAAkB,OAAA,GAAuB,EAAC,EAAG;AACzD,IAAA,MAAM,GAAA,GAAM,CAAA,EAAG,IAAA,CAAK,OAAO,GAAG,QAAQ,CAAA,CAAA;AACtC,IAAA,MAAM,OAAA,GAAU;AAAA,MACd,aAAA,EAAe,CAAA,OAAA,EAAU,IAAA,CAAK,MAAM,CAAA,CAAA;AAAA,MACpC,cAAA,EAAgB,kBAAA;AAAA,MAChB,GAAG,OAAA,CAAQ;AAAA,KACb;AAEA,IA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e,sBAAA,EAAqB,cAAW,CAAA;AAAA,EACzD,YAAY,EAAC;AAAA,EACb,SAAA,EAAW,CAAC,YAAY;AAC1B;AAEA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["import type { IAgentRuntime, Memory, State, Provider } from '@elizaos/core';\n\nexport interface SunoConfig {\n apiKey: string;\n baseUrl?: string;\n}\n\nexport class SunoApiClient {\n private apiKey: string;\n private baseUrl: string;\n\n static async get(\n runtime: IAgentRuntime,\n _message: Memory,\n _state?: State\n ): Promise<SunoApiClient> {\n const apiKey = runtime.getSetting('SUNO_API_KEY');\n if (!apiKey) {\n throw new Error('SUNO_API_KEY is required');\n }\n return new SunoApiClient({ apiKey });\n }\n\n constructor(config: SunoConfig) {\n this.apiKey = config.apiKey;\n this.baseUrl = config.baseUrl || 'https://api.suno.ai/v1';\n }\n\n async request(endpoint: string, options: RequestInit = {}) {\n const url = `${this.baseUrl}${endpoint}`;\n const headers = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n ...options.headers,\n };\n\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n if (!response.ok) {\n throw new Error(`Suno API error: ${response.statusText}`);\n }\n\n return response.json();\n }\n}\n\nexport const SunoProvider: Provider = {\n name: 'suno',\n description: 'Provides Suno AI music generation context and status',\n get: async (runtime: IAgentRuntime, _message: Memory, _state: State) => {\n const apiKey = runtime.getSetting('SUNO_API_KEY');\n return {\n values: {\n apiKeyConfigured: !!apiKey,\n status: apiKey ? 'ready' : 'not_configured',\n serviceUrl: 'https://api.suno.ai/v1',\n },\n text: `Suno AI music generation service is ${apiKey ? 'ready' : 'not configured'}. API key ${apiKey ? 'is set' : 'is missing'}.`,\n };\n },\n};\n\nexport interface GenerateParams {\n prompt: string;\n duration?: number;\n temperature?: number;\n topK?: number;\n topP?: number;\n classifier_free_guidance?: number;\n}\n\nexport interface CustomGenerateParams extends GenerateParams {\n reference_audio?: string;\n style?: string;\n bpm?: number;\n key?: string;\n mode?: string;\n}\n\nexport interface ExtendParams {\n audio_id: string;\n duration: number;\n}\n\nexport interface GenerationResponse {\n id: string;\n status: 'pending' | 'processing' | 'completed' | 'failed';\n audio_url?: string;\n error?: string;\n}\n","import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from '@elizaos/core';\nimport { SunoApiClient } from '../providers/suno';\nimport type { GenerateParams } from '../types';\n\nconst generateMusic: Action = {\n name: 'generate-music',\n description: 'Generate music using Suno AI',\n similes: [\n 'CREATE_MUSIC',\n 'MAKE_MUSIC',\n 'COMPOSE_MUSIC',\n 'GENERATE_AUDIO',\n 'CREATE_SONG',\n 'MAKE_SONG',\n ],\n\n validate: async (runtime: IAgentRuntime, _message: Memory) => {\n return !!runtime.getSetting('SUNO_API_KEY');\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n state?: State,\n _options?: { [key: string]: unknown },\n callback?: HandlerCallback\n ): Promise<boolean> => {\n try {\n const provider = await SunoApiClient.get(runtime, message, state);\n const content = message.content as unknown as GenerateParams;\n\n if (!content.prompt) {\n throw new Error('Missing required parameter: prompt');\n }\n\n const response = await provider.request('/generate', {\n method: 'POST',\n body: JSON.stringify({\n prompt: content.prompt,\n duration: content.duration || 30,\n temperature: content.temperature || 1.0,\n top_k: content.topK || 250,\n top_p: content.topP || 0.95,\n classifier_free_guidance: content.classifier_free_guidance || 3.0,\n }),\n });\n\n if (callback) {\n callback({\n text: 'Successfully generated music based on your prompt',\n content: response,\n });\n }\n\n return true;\n } catch (error) {\n if (callback) {\n callback({\n text: `Failed to generate music: ${(error as Error).message}`,\n error: error,\n });\n }\n return false;\n }\n },\n\n examples: [\n [\n {\n name: 'user1',\n content: {\n text: 'Create a happy and energetic song',\n prompt: 'A cheerful and energetic melody with upbeat rhythm',\n duration: 30,\n temperature: 1.0,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll generate a happy and energetic song for you.\",\n action: 'generate-music',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully generated your upbeat and energetic song.',\n },\n },\n ],\n [\n {\n name: 'user1',\n content: {\n text: 'Generate a relaxing ambient track',\n prompt: 'A peaceful ambient soundscape with gentle waves and soft pads',\n duration: 45,\n temperature: 0.8,\n classifier_free_guidance: 4.0,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll create a calming ambient piece for you.\",\n action: 'generate-music',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully generated your relaxing ambient soundscape.',\n },\n },\n ],\n [\n {\n name: 'user1',\n content: {\n text: 'Make a short jingle for my podcast',\n prompt: 'A catchy and professional podcast intro jingle',\n duration: 15,\n temperature: 1.2,\n top_k: 300,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll generate a podcast jingle for you.\",\n action: 'generate-music',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully generated your podcast jingle.',\n },\n },\n ],\n ],\n};\n\nexport default generateMusic;\n","import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from '@elizaos/core';\nimport { SunoApiClient } from '../providers/suno';\nimport type { CustomGenerateParams } from '../types';\n\nconst customGenerateMusic: Action = {\n name: 'custom-generate-music',\n description: 'Generate music with custom parameters using Suno AI',\n similes: [\n 'CREATE_CUSTOM_MUSIC',\n 'GENERATE_CUSTOM_AUDIO',\n 'MAKE_CUSTOM_MUSIC',\n 'COMPOSE_CUSTOM_MUSIC',\n 'CUSTOM_MUSIC_GENERATION',\n 'ADVANCED_MUSIC_CREATION',\n 'PERSONALIZED_MUSIC_GENERATION',\n ],\n\n validate: async (runtime: IAgentRuntime, _message: Memory) => {\n return !!runtime.getSetting('SUNO_API_KEY');\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n state?: State,\n _options?: { [key: string]: unknown },\n callback?: HandlerCallback\n ): Promise<boolean> => {\n try {\n const provider = await SunoApiClient.get(runtime, message, state);\n const content = message.content as unknown as CustomGenerateParams;\n\n if (!content.prompt) {\n throw new Error('Missing required parameter: prompt');\n }\n\n const response = await provider.request('/custom-generate', {\n method: 'POST',\n body: JSON.stringify({\n prompt: content.prompt,\n duration: content.duration || 30,\n temperature: content.temperature || 1.0,\n top_k: content.topK || 250,\n top_p: content.topP || 0.95,\n classifier_free_guidance: content.classifier_free_guidance || 3.0,\n reference_audio: content.reference_audio,\n style: content.style,\n bpm: content.bpm,\n key: content.key,\n mode: content.mode,\n }),\n });\n\n if (callback) {\n callback({\n text: 'Successfully generated custom music',\n content: response,\n });\n }\n\n return true;\n } catch (error) {\n if (callback) {\n callback({\n text: `Failed to generate custom music: ${(error as Error).message}`,\n error: error,\n });\n }\n return false;\n }\n },\n\n examples: [\n [\n {\n name: 'user1',\n content: {\n text: 'Create an upbeat electronic dance track with heavy bass',\n prompt: 'An upbeat electronic dance track with heavy bass and energetic synths',\n duration: 60,\n style: 'electronic',\n bpm: 128,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll generate an energetic EDM track for you.\",\n action: 'custom-generate-music',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully generated your EDM track with heavy bass and synths.',\n },\n },\n ],\n [\n {\n name: 'user1',\n content: {\n text: 'Generate a calm piano melody in C major',\n prompt: 'A gentle, flowing piano melody with soft dynamics',\n duration: 45,\n style: 'classical',\n key: 'C',\n mode: 'major',\n temperature: 0.8,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll create a calming piano piece in C major for you.\",\n action: 'custom-generate-music',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully generated your peaceful piano melody in C major.',\n },\n },\n ],\n [\n {\n name: 'user1',\n content: {\n text: 'Make a rock song with guitar solos',\n prompt: 'A rock song with powerful electric guitar solos and driving drums',\n duration: 90,\n style: 'rock',\n bpm: 120,\n classifier_free_guidance: 4.0,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll generate a rock track with guitar solos for you.\",\n action: 'custom-generate-music',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully generated your rock song with guitar solos.',\n },\n },\n ],\n ],\n};\n\nexport default customGenerateMusic;\n","import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from '@elizaos/core';\nimport { SunoApiClient } from '../providers/suno';\nimport type { ExtendParams } from '../types';\n\nconst extendAudio: Action = {\n name: 'extend-audio',\n description: 'Extend the duration of an existing audio generation',\n similes: [\n 'EXTEND_AUDIO',\n 'LENGTHEN_AUDIO',\n 'PROLONG_AUDIO',\n 'INCREASE_DURATION',\n 'MAKE_AUDIO_LONGER',\n ],\n\n validate: async (runtime: IAgentRuntime, _message: Memory) => {\n return !!runtime.getSetting('SUNO_API_KEY');\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n state?: State,\n _options?: { [key: string]: unknown },\n callback?: HandlerCallback\n ): Promise<boolean> => {\n try {\n const provider = await SunoApiClient.get(runtime, message, state);\n const content = message.content as unknown as ExtendParams;\n\n if (!content.audio_id || !content.duration) {\n throw new Error('Missing required parameters: audio_id and duration');\n }\n\n const response = await provider.request('/extend', {\n method: 'POST',\n body: JSON.stringify({\n audio_id: content.audio_id,\n duration: content.duration,\n }),\n });\n\n if (callback) {\n callback({\n text: `Successfully extended audio ${content.audio_id}`,\n content: response,\n });\n }\n\n return true;\n } catch (error) {\n if (callback) {\n callback({\n text: `Failed to extend audio: ${(error as Error).message}`,\n error: error,\n });\n }\n return false;\n }\n },\n\n examples: [\n [\n {\n name: 'user1',\n content: {\n text: 'Make this song longer by 30 seconds',\n audio_id: 'abc123',\n duration: 30,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll extend your song by 30 seconds.\",\n action: 'extend-audio',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully extended your song by 30 seconds.',\n },\n },\n ],\n [\n {\n name: 'user1',\n content: {\n text: 'Double the length of this track',\n audio_id: 'xyz789',\n duration: 60,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll double the duration of your track.\",\n action: 'extend-audio',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully doubled the length of your track to 60 seconds.',\n },\n },\n ],\n [\n {\n name: 'user1',\n content: {\n text: 'Add 15 more seconds to this melody',\n audio_id: 'def456',\n duration: 15,\n },\n },\n {\n name: 'agent',\n content: {\n text: \"I'll add 15 seconds to your melody.\",\n action: 'extend-audio',\n },\n },\n {\n name: 'agent',\n content: {\n text: 'Successfully added 15 seconds to your melody.',\n },\n },\n ],\n ],\n};\n\nexport default extendAudio;\n","import type { Plugin } from '@elizaos/core';\nimport generateMusic from './actions/generate';\nimport customGenerateMusic from './actions/customGenerate';\nimport extendAudio from './actions/extend';\nimport { SunoProvider, SunoApiClient } from './providers/suno';\n\nexport {\n SunoProvider,\n SunoApiClient,\n generateMusic as GenerateMusic,\n customGenerateMusic as CustomGenerateMusic,\n extendAudio as ExtendAudio,\n};\n\nexport const sunoPlugin: Plugin = {\n name: 'suno',\n description: 'Suno AI Music Generation Plugin for Eliza',\n actions: [generateMusic, customGenerateMusic, extendAudio],\n evaluators: [],\n providers: [SunoProvider],\n};\n\nexport default sunoPlugin;\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action, Provider, IAgentRuntime, Memory, State, Plugin } from '@elizaos/core';
|
|
2
|
+
|
|
3
|
+
declare const generateMusic: Action;
|
|
4
|
+
|
|
5
|
+
declare const customGenerateMusic: Action;
|
|
6
|
+
|
|
7
|
+
declare const extendAudio: Action;
|
|
8
|
+
|
|
9
|
+
interface SunoConfig {
|
|
10
|
+
apiKey: string;
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
}
|
|
13
|
+
declare class SunoApiClient {
|
|
14
|
+
private apiKey;
|
|
15
|
+
private baseUrl;
|
|
16
|
+
static get(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<SunoApiClient>;
|
|
17
|
+
constructor(config: SunoConfig);
|
|
18
|
+
request(endpoint: string, options?: RequestInit): Promise<unknown>;
|
|
19
|
+
}
|
|
20
|
+
declare const SunoProvider: Provider;
|
|
21
|
+
|
|
22
|
+
declare const sunoPlugin: Plugin;
|
|
23
|
+
|
|
24
|
+
export { customGenerateMusic as CustomGenerateMusic, extendAudio as ExtendAudio, generateMusic as GenerateMusic, SunoApiClient, SunoProvider, sunoPlugin as default, sunoPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,17 +10,15 @@ interface SunoConfig {
|
|
|
10
10
|
apiKey: string;
|
|
11
11
|
baseUrl?: string;
|
|
12
12
|
}
|
|
13
|
-
declare class
|
|
13
|
+
declare class SunoApiClient {
|
|
14
14
|
private apiKey;
|
|
15
15
|
private baseUrl;
|
|
16
|
-
static get(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<
|
|
16
|
+
static get(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<SunoApiClient>;
|
|
17
17
|
constructor(config: SunoConfig);
|
|
18
|
-
|
|
19
|
-
status: string;
|
|
20
|
-
}>;
|
|
21
|
-
request(endpoint: string, options?: RequestInit): Promise<any>;
|
|
18
|
+
request(endpoint: string, options?: RequestInit): Promise<unknown>;
|
|
22
19
|
}
|
|
20
|
+
declare const SunoProvider: Provider;
|
|
23
21
|
|
|
24
22
|
declare const sunoPlugin: Plugin;
|
|
25
23
|
|
|
26
|
-
export { customGenerateMusic as CustomGenerateMusic, extendAudio as ExtendAudio, generateMusic as GenerateMusic, SunoProvider, sunoPlugin as default, sunoPlugin };
|
|
24
|
+
export { customGenerateMusic as CustomGenerateMusic, extendAudio as ExtendAudio, generateMusic as GenerateMusic, SunoApiClient, SunoProvider, sunoPlugin as default, sunoPlugin };
|