@elizaos/plugin-suno 1.0.6-alpha.3 → 2.0.0-beta.1

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.
@@ -1,145 +0,0 @@
1
- import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from "@elizaos/core";
2
- import { SunoProvider } from "../providers/suno";
3
- import type { GenerateParams } from "../types";
4
-
5
- const generateMusic: Action = {
6
- name: "generate-music",
7
- description: "Generate music using Suno AI",
8
- similes: [
9
- "CREATE_MUSIC",
10
- "MAKE_MUSIC",
11
- "COMPOSE_MUSIC",
12
- "GENERATE_AUDIO",
13
- "CREATE_SONG",
14
- "MAKE_SONG"
15
- ],
16
-
17
- validate: async (runtime: IAgentRuntime, _message: Memory) => {
18
- return !!runtime.getSetting("SUNO_API_KEY");
19
- },
20
-
21
- handler: async (
22
- runtime: IAgentRuntime,
23
- message: Memory,
24
- state: State,
25
- _options: { [key: string]: unknown },
26
- callback?: HandlerCallback
27
- ): Promise<boolean> => {
28
- try {
29
- const provider = await SunoProvider.get(runtime, message, state);
30
- const content = message.content as unknown as GenerateParams;
31
-
32
- if (!content.prompt) {
33
- throw new Error("Missing required parameter: prompt");
34
- }
35
-
36
- const response = await provider.request('/generate', {
37
- method: 'POST',
38
- body: JSON.stringify({
39
- prompt: content.prompt,
40
- duration: content.duration || 30,
41
- temperature: content.temperature || 1.0,
42
- top_k: content.topK || 250,
43
- top_p: content.topP || 0.95,
44
- classifier_free_guidance: content.classifier_free_guidance || 3.0
45
- })
46
- });
47
-
48
- if (callback) {
49
- callback({
50
- text: 'Successfully generated music based on your prompt',
51
- content: response
52
- });
53
- }
54
-
55
- return true;
56
- } catch (error) {
57
- if (callback) {
58
- callback({
59
- text: `Failed to extend audio: ${(error as Error).message}`,
60
- error: error
61
- });
62
- }
63
- return false;
64
- }
65
- },
66
-
67
- examples: [
68
- [
69
- {
70
- user: "{{user1}}",
71
- content: {
72
- text: "Create a happy and energetic song",
73
- prompt: "A cheerful and energetic melody with upbeat rhythm",
74
- duration: 30,
75
- temperature: 1.0
76
- }
77
- },
78
- {
79
- user: "{{agent}}",
80
- content: {
81
- text: "I'll generate a happy and energetic song for you.",
82
- action: "generate-music"
83
- }
84
- },
85
- {
86
- user: "{{agent}}",
87
- content: {
88
- text: "Successfully generated your upbeat and energetic song."
89
- }
90
- }
91
- ],
92
- [
93
- {
94
- user: "{{user1}}",
95
- content: {
96
- text: "Generate a relaxing ambient track",
97
- prompt: "A peaceful ambient soundscape with gentle waves and soft pads",
98
- duration: 45,
99
- temperature: 0.8,
100
- classifier_free_guidance: 4.0
101
- }
102
- },
103
- {
104
- user: "{{agent}}",
105
- content: {
106
- text: "I'll create a calming ambient piece for you.",
107
- action: "generate-music"
108
- }
109
- },
110
- {
111
- user: "{{agent}}",
112
- content: {
113
- text: "Successfully generated your relaxing ambient soundscape."
114
- }
115
- }
116
- ],
117
- [
118
- {
119
- user: "{{user1}}",
120
- content: {
121
- text: "Make a short jingle for my podcast",
122
- prompt: "A catchy and professional podcast intro jingle",
123
- duration: 15,
124
- temperature: 1.2,
125
- top_k: 300
126
- }
127
- },
128
- {
129
- user: "{{agent}}",
130
- content: {
131
- text: "I'll generate a podcast jingle for you.",
132
- action: "generate-music"
133
- }
134
- },
135
- {
136
- user: "{{agent}}",
137
- content: {
138
- text: "Successfully generated your podcast jingle."
139
- }
140
- }
141
- ]
142
- ]
143
- };
144
-
145
- export default generateMusic;
package/src/index.ts DELETED
@@ -1,22 +0,0 @@
1
- import type { Plugin } from "@elizaos/core";
2
- import generateMusic from "./actions/generate";
3
- import customGenerateMusic from "./actions/customGenerate";
4
- import extendAudio from "./actions/extend";
5
- import { SunoProvider } from "./providers/suno";
6
-
7
- export {
8
- SunoProvider,
9
- generateMusic as GenerateMusic,
10
- customGenerateMusic as CustomGenerateMusic,
11
- extendAudio as ExtendAudio
12
- };
13
-
14
- export const sunoPlugin: Plugin = {
15
- name: "suno",
16
- description: "Suno AI Music Generation Plugin for Eliza",
17
- actions: [generateMusic, customGenerateMusic, extendAudio],
18
- evaluators: [],
19
- providers: [SunoProvider],
20
- };
21
-
22
- export default sunoPlugin;
@@ -1,78 +0,0 @@
1
- import type { IAgentRuntime, Memory, State } from "@elizaos/core"; // Added type keyword
2
- import type { Provider } from "@elizaos/core"; // Added type keyword
3
-
4
- export interface SunoConfig {
5
- apiKey: string;
6
- baseUrl?: string;
7
- }
8
-
9
- export class SunoProvider implements Provider {
10
- private apiKey: string;
11
- private baseUrl: string;
12
-
13
- static async get(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<SunoProvider> {
14
- const apiKey = runtime.getSetting("SUNO_API_KEY");
15
- if (!apiKey) {
16
- throw new Error("SUNO_API_KEY is required");
17
- }
18
- return new SunoProvider({ apiKey });
19
- }
20
-
21
- constructor(config: SunoConfig) {
22
- this.apiKey = config.apiKey;
23
- this.baseUrl = config.baseUrl || 'https://api.suno.ai/v1';
24
- }
25
-
26
- async get(_runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<{ status: string }> {
27
- return { status: 'ready' };
28
- }
29
-
30
- async request(endpoint: string, options: RequestInit = {}) {
31
- const url = `${this.baseUrl}${endpoint}`;
32
- const headers = {
33
- 'Authorization': `Bearer ${this.apiKey}`,
34
- 'Content-Type': 'application/json',
35
- ...options.headers,
36
- };
37
-
38
- const response = await fetch(url, {
39
- ...options,
40
- headers,
41
- });
42
-
43
- if (!response.ok) {
44
- throw new Error(`Suno API error: ${response.statusText}`);
45
- }
46
-
47
- return response.json();
48
- }
49
- }
50
-
51
- export interface GenerateParams {
52
- prompt: string;
53
- duration?: number;
54
- temperature?: number;
55
- topK?: number;
56
- topP?: number;
57
- classifier_free_guidance?: number;
58
- }
59
-
60
- export interface CustomGenerateParams extends GenerateParams {
61
- reference_audio?: string;
62
- style?: string;
63
- bpm?: number;
64
- key?: string;
65
- mode?: string;
66
- }
67
-
68
- export interface ExtendParams {
69
- audio_id: string;
70
- duration: number;
71
- }
72
-
73
- export interface GenerationResponse {
74
- id: string;
75
- status: 'pending' | 'processing' | 'completed' | 'failed';
76
- audio_url?: string;
77
- error?: string;
78
- }
@@ -1,34 +0,0 @@
1
- export interface GenerateParams {
2
- prompt: string;
3
- duration?: number;
4
- temperature?: number;
5
- topK?: number;
6
- topP?: number;
7
- classifier_free_guidance?: number;
8
- }
9
-
10
- export interface CustomGenerateParams {
11
- prompt: string;
12
- duration?: number;
13
- temperature?: number;
14
- topK?: number;
15
- topP?: number;
16
- classifier_free_guidance?: number;
17
- reference_audio?: string;
18
- style?: string;
19
- bpm?: number;
20
- key?: string;
21
- mode?: string;
22
- }
23
-
24
- export interface ExtendParams {
25
- audio_id: string;
26
- duration: number;
27
- }
28
-
29
- export interface GenerationResponse {
30
- id: string;
31
- status: string;
32
- url?: string;
33
- error?: string;
34
- }
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "dist",
4
- "rootDir": "src",
5
- "lib": ["ESNext", "dom"],
6
- "module": "Preserve",
7
- "moduleResolution": "Bundler",
8
- "strict": false,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": false,
12
- "allowImportingTsExtensions": true,
13
- "declaration": true,
14
- "emitDeclarationOnly": true,
15
- "resolveJsonModule": true,
16
- "noImplicitAny": false,
17
- "allowJs": true,
18
- "checkJs": false,
19
- "noEmitOnError": false,
20
- "moduleDetection": "force",
21
- "allowArbitraryExtensions": true
22
- },
23
- "include": ["src/**/*.ts"]
24
- }
package/tsup.config.ts DELETED
@@ -1,11 +0,0 @@
1
- import { defineConfig } from "tsup";
2
-
3
- export default defineConfig({
4
- entry: ["src/index.ts"],
5
- format: ["cjs", "esm"],
6
- dts: false,
7
- splitting: false,
8
- sourcemap: true,
9
- clean: true,
10
- external: ["@elizaos/core"]
11
- });