@moises.ai/extension 1.0.0 → 1.0.2
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/Readme.md +19 -1
- package/dist/{client-Bt6Snfq-.js → client-BuA0RRm3.js} +29 -32
- package/dist/client.js +1 -1
- package/dist/index.d.ts +243 -23
- package/dist/index.js +91 -29
- package/package.json +3 -2
- package/src/client.d.ts +243 -23
- package/src/index.d.ts +243 -23
package/Readme.md
CHANGED
@@ -1 +1,19 @@
|
|
1
|
-
# Moises Extensions SDK
|
1
|
+
# Moises AI | Extensions SDK
|
2
|
+
|
3
|
+
Create powerful extensions for the Moises AI Studio.
|
4
|
+
|
5
|
+
## Documentation
|
6
|
+
|
7
|
+
📖 **[Full Documentation](https://extensions.moises.ai/)** - Complete API reference, guides, and examples
|
8
|
+
|
9
|
+
## Quick Start
|
10
|
+
|
11
|
+
The best way to get started is to bootstrap a new extension project:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
npm create @moises.ai/extension <my-extension>
|
15
|
+
```
|
16
|
+
|
17
|
+
This will create a new extension project with all the necessary files and dependencies to begin development.
|
18
|
+
|
19
|
+
For detailed setup instructions and API reference, visit our [documentation](https://extensions.moises.ai/).
|
@@ -12,29 +12,29 @@ class h {
|
|
12
12
|
this.connected = !1;
|
13
13
|
}
|
14
14
|
handleMessage(e) {
|
15
|
-
const { data: s, source:
|
16
|
-
if (
|
15
|
+
const { data: s, source: n, origin: t } = e;
|
16
|
+
if (n === this.target) {
|
17
17
|
if (s.type === "response") {
|
18
|
-
const { requestId: r, result:
|
19
|
-
|
18
|
+
const { requestId: r, result: c, error: o } = s, d = this.pendingRequests.get(r);
|
19
|
+
d && (o ? d.reject(new Error(o)) : d.resolve(c), this.pendingRequests.delete(r));
|
20
20
|
return;
|
21
21
|
}
|
22
22
|
if (s.type === "request") {
|
23
|
-
const { method: r, params:
|
24
|
-
if (!
|
25
|
-
this.sendResponse(
|
23
|
+
const { method: r, params: c, requestId: o } = s, d = this.handlers.get(r);
|
24
|
+
if (!d) {
|
25
|
+
this.sendResponse(n, o, null, `No handler for method: ${r}`);
|
26
26
|
return;
|
27
27
|
}
|
28
|
-
Promise.resolve().then(() => c
|
28
|
+
Promise.resolve().then(() => d(c)).then((a) => this.sendResponse(n, o, a)).catch((a) => this.sendResponse(n, o, null, a.message));
|
29
29
|
}
|
30
30
|
}
|
31
31
|
}
|
32
|
-
sendResponse(e, s,
|
32
|
+
sendResponse(e, s, n, t = null) {
|
33
33
|
e.postMessage({
|
34
34
|
type: "response",
|
35
35
|
requestId: s,
|
36
|
-
result:
|
37
|
-
error:
|
36
|
+
result: n,
|
37
|
+
error: t
|
38
38
|
}, "*");
|
39
39
|
}
|
40
40
|
on(e, s) {
|
@@ -44,17 +44,17 @@ class h {
|
|
44
44
|
this.handlers.delete(e);
|
45
45
|
}
|
46
46
|
once(e, s) {
|
47
|
-
const
|
48
|
-
this.on(e,
|
47
|
+
const n = async (t) => (this.off(e), s(t));
|
48
|
+
this.on(e, n);
|
49
49
|
}
|
50
50
|
async call(e, s) {
|
51
|
-
const
|
52
|
-
return new Promise((
|
53
|
-
this.pendingRequests.set(
|
51
|
+
const n = this.requestId++;
|
52
|
+
return new Promise((t, r) => {
|
53
|
+
this.pendingRequests.set(n, { resolve: t, reject: r }), this.target.postMessage({
|
54
54
|
type: "request",
|
55
55
|
method: e,
|
56
56
|
params: s,
|
57
|
-
requestId:
|
57
|
+
requestId: n
|
58
58
|
}, "*");
|
59
59
|
});
|
60
60
|
}
|
@@ -66,9 +66,12 @@ class u {
|
|
66
66
|
createProxy() {
|
67
67
|
return new Proxy(this.rpc, {
|
68
68
|
get: (e, s) => s in e ? e[s] : new Proxy({}, {
|
69
|
-
get: (
|
70
|
-
const
|
71
|
-
|
69
|
+
get: (n, t) => s === "link" ? async (r, c) => {
|
70
|
+
const o = await e.call("register.link", { category: t, options: r });
|
71
|
+
this.rpc.on(`${o.id}`, c);
|
72
|
+
} : async (r) => {
|
73
|
+
const c = `${s}.${t}`;
|
74
|
+
return e.call(c, r);
|
72
75
|
}
|
73
76
|
})
|
74
77
|
});
|
@@ -88,19 +91,13 @@ function l(i) {
|
|
88
91
|
version: i.version,
|
89
92
|
isLoaded: !1,
|
90
93
|
events: {}
|
91
|
-
}, { proxy: s, rpc:
|
94
|
+
}, { proxy: s, rpc: n } = new u({
|
92
95
|
target: window.parent
|
93
|
-
})
|
94
|
-
|
95
|
-
s
|
96
|
-
|
97
|
-
|
98
|
-
const c = await n.register.link({ category: r, options: d });
|
99
|
-
t.on(`${c.id}`, o);
|
100
|
-
}, n.connect = async function() {
|
101
|
-
const r = n.register.extension(e);
|
102
|
-
return e.isLoaded = !0, r;
|
103
|
-
}, n.plugin = e, n;
|
96
|
+
});
|
97
|
+
return s.connect = async function() {
|
98
|
+
const t = s.register.extension(e);
|
99
|
+
return e.isLoaded = !0, t;
|
100
|
+
}, s.plugin = e, s;
|
104
101
|
}
|
105
102
|
export {
|
106
103
|
l as M,
|
package/dist/client.js
CHANGED
package/dist/index.d.ts
CHANGED
@@ -2,21 +2,11 @@
|
|
2
2
|
/** Controlling common UI elements */
|
3
3
|
export interface UiApi {
|
4
4
|
|
5
|
-
/** Sets the extension size in the interface */
|
6
|
-
setPluginSize: (params: {
|
7
|
-
|
8
|
-
/** Width in pixels */
|
9
|
-
width: number;
|
10
|
-
|
11
|
-
/** Height in pixels */
|
12
|
-
height: number;
|
13
|
-
}) => void;
|
14
|
-
|
15
5
|
/** Displays a progress bar or loading indicator */
|
16
6
|
progress: (options: {
|
17
7
|
|
18
|
-
/** Progress
|
19
|
-
|
8
|
+
/** Progress title */
|
9
|
+
title?: string;
|
20
10
|
|
21
11
|
/** Progress value (0-100) */
|
22
12
|
value?: number;
|
@@ -26,10 +16,16 @@ export interface UiApi {
|
|
26
16
|
alert: (options: {
|
27
17
|
|
28
18
|
/** Alert title */
|
29
|
-
title
|
19
|
+
title?: string;
|
20
|
+
|
21
|
+
/** Alert description */
|
22
|
+
description?: string;
|
23
|
+
|
24
|
+
/** Alert CTA label */
|
25
|
+
ctaLabel?: string;
|
30
26
|
|
31
|
-
/** Alert
|
32
|
-
|
27
|
+
/** Alert CTA color */
|
28
|
+
ctaColor?: string;
|
33
29
|
}) => Promise<void>;
|
34
30
|
|
35
31
|
/** Displays a confirmation dialog */
|
@@ -38,8 +34,14 @@ export interface UiApi {
|
|
38
34
|
/** Confirmation title */
|
39
35
|
title: string;
|
40
36
|
|
41
|
-
/** Confirmation
|
42
|
-
|
37
|
+
/** Confirmation description */
|
38
|
+
description: string;
|
39
|
+
|
40
|
+
/** Confirmation CTA label */
|
41
|
+
ctaLabel?: string;
|
42
|
+
|
43
|
+
/** Confirmation CTA color */
|
44
|
+
ctaColor?: string;
|
43
45
|
}) => Promise<boolean>;
|
44
46
|
|
45
47
|
/** Displays a text input dialog */
|
@@ -48,11 +50,20 @@ export interface UiApi {
|
|
48
50
|
/** Prompt title */
|
49
51
|
title: string;
|
50
52
|
|
51
|
-
/** Prompt
|
52
|
-
|
53
|
+
/** Prompt description */
|
54
|
+
description: string;
|
55
|
+
|
56
|
+
/** Prompt label */
|
57
|
+
label?: string;
|
53
58
|
|
54
|
-
/**
|
59
|
+
/** Prompt default value */
|
55
60
|
defaultValue?: string;
|
61
|
+
|
62
|
+
/** Prompt CTA label */
|
63
|
+
ctaLabel?: string;
|
64
|
+
|
65
|
+
/** Prompt CTA color */
|
66
|
+
ctaColor?: string;
|
56
67
|
}) => Promise<string>;
|
57
68
|
|
58
69
|
/** Creates a panel in the interface */
|
@@ -129,10 +140,10 @@ export interface TrackApi {
|
|
129
140
|
arrayBuffer: any;
|
130
141
|
|
131
142
|
/** The name of the track */
|
132
|
-
name
|
143
|
+
name: string;
|
133
144
|
|
134
|
-
/**
|
135
|
-
|
145
|
+
/** The start position of the track in seconds */
|
146
|
+
startPositionSec: number;
|
136
147
|
}) => Promise<any>;
|
137
148
|
|
138
149
|
/** Updates a track */
|
@@ -153,6 +164,209 @@ export interface TrackApi {
|
|
153
164
|
}
|
154
165
|
|
155
166
|
|
167
|
+
/** Group API for managing audio groups */
|
168
|
+
export interface GroupApi {
|
169
|
+
|
170
|
+
/** Creates a new group */
|
171
|
+
create: (params: {
|
172
|
+
|
173
|
+
/** The name of the group */
|
174
|
+
name: string;
|
175
|
+
|
176
|
+
/** The ID of the group */
|
177
|
+
id: string;
|
178
|
+
|
179
|
+
/** The type of the group */
|
180
|
+
type: string;
|
181
|
+
|
182
|
+
/** The order of the group */
|
183
|
+
order: number;
|
184
|
+
|
185
|
+
/** Whether the group is solo */
|
186
|
+
solo: boolean;
|
187
|
+
|
188
|
+
/** Whether the group is muted */
|
189
|
+
muted: boolean;
|
190
|
+
|
191
|
+
/** The pan of the group */
|
192
|
+
pan: number;
|
193
|
+
|
194
|
+
/** The volume of the group */
|
195
|
+
volume: number;
|
196
|
+
|
197
|
+
/** Additional options for the group */
|
198
|
+
options: any;
|
199
|
+
}) => Promise<any>;
|
200
|
+
|
201
|
+
/** Updates a group */
|
202
|
+
update: (params: {
|
203
|
+
|
204
|
+
/** The ID of the group to update */
|
205
|
+
groupId: string;
|
206
|
+
|
207
|
+
/** The name of the group */
|
208
|
+
name: string;
|
209
|
+
|
210
|
+
/** The type of the group */
|
211
|
+
type: string;
|
212
|
+
|
213
|
+
/** The order of the group */
|
214
|
+
order: number;
|
215
|
+
|
216
|
+
/** Whether the group is solo */
|
217
|
+
solo: boolean;
|
218
|
+
|
219
|
+
/** Whether the group is muted */
|
220
|
+
muted: boolean;
|
221
|
+
|
222
|
+
/** The pan of the group */
|
223
|
+
pan: number;
|
224
|
+
|
225
|
+
/** The volume of the group */
|
226
|
+
volume: number;
|
227
|
+
}) => Promise<any>;
|
228
|
+
}
|
229
|
+
|
230
|
+
|
231
|
+
/** Storage API for managing audio files */
|
232
|
+
export interface StorageApi {
|
233
|
+
|
234
|
+
/** Uploads a buffer to the storage */
|
235
|
+
upload: (params: {
|
236
|
+
|
237
|
+
/** The audio data to upload */
|
238
|
+
buffer: any;
|
239
|
+
}) => Promise<any>;
|
240
|
+
|
241
|
+
/** Downloads an audio file from the storage */
|
242
|
+
download: (params: {
|
243
|
+
|
244
|
+
/** The URL of the audio file to download */
|
245
|
+
url: string;
|
246
|
+
}) => Promise<any>;
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
/** Compute API for managing audio computations */
|
251
|
+
export interface ComputeApi {
|
252
|
+
|
253
|
+
/** Generates a session player */
|
254
|
+
sessionPlayerGenerate: (params: {
|
255
|
+
|
256
|
+
/** The context audio for the session player */
|
257
|
+
contextAudio: any;
|
258
|
+
|
259
|
+
/** The conditioning audio for the session player */
|
260
|
+
conditioningAudio: any;
|
261
|
+
|
262
|
+
/** The conditioning text for the session player */
|
263
|
+
conditioningText: string;
|
264
|
+
|
265
|
+
/** The number of steps for the session player */
|
266
|
+
steps: number;
|
267
|
+
|
268
|
+
/** The guidance scale for the session player */
|
269
|
+
guidanceScale: number;
|
270
|
+
|
271
|
+
/** The weight schedule for the session player */
|
272
|
+
weightSchedule: number;
|
273
|
+
|
274
|
+
/** The instrument for the session player */
|
275
|
+
instrument: string;
|
276
|
+
|
277
|
+
/** The preset ID for the session player */
|
278
|
+
presetId: string;
|
279
|
+
|
280
|
+
/** Whether to use chroma for the session player */
|
281
|
+
chroma: boolean;
|
282
|
+
|
283
|
+
/** The timestamps for the session player */
|
284
|
+
inpaintingTimestamps: any[];
|
285
|
+
|
286
|
+
/** The target for the session player */
|
287
|
+
inpaintingTarget: any[];
|
288
|
+
}) => Promise<void>;
|
289
|
+
|
290
|
+
/** Gets the list of session player presets */
|
291
|
+
sessionPlayerPresets: () => Promise<void>;
|
292
|
+
|
293
|
+
/** Inpaints an audio file */
|
294
|
+
sessionPlayerInpaint: (params: {
|
295
|
+
|
296
|
+
/** The input audio data */
|
297
|
+
input: any;
|
298
|
+
|
299
|
+
/** The mask for the inpainting */
|
300
|
+
mask: any;
|
301
|
+
}) => Promise<void>;
|
302
|
+
|
303
|
+
/** Runs a workflow */
|
304
|
+
workflow: (params: {
|
305
|
+
|
306
|
+
/** The ID of the workflow to run */
|
307
|
+
workflowId: string;
|
308
|
+
|
309
|
+
/** The parameters for the workflow TODO: add type */
|
310
|
+
params: any;
|
311
|
+
}) => Promise<void>;
|
312
|
+
|
313
|
+
/** Runs an automix job */
|
314
|
+
automix: (params: {
|
315
|
+
|
316
|
+
/** The ID of the workflow to run TODO: add type */
|
317
|
+
workflowId: string;
|
318
|
+
|
319
|
+
/** The parameters for the workflow TODO: add type */
|
320
|
+
params: any;
|
321
|
+
}) => Promise<void>;
|
322
|
+
|
323
|
+
/** Detects instruments in an audio file */
|
324
|
+
instruments: (params: {
|
325
|
+
|
326
|
+
/** The input audio data */
|
327
|
+
input: string;
|
328
|
+
}) => Promise<void>;
|
329
|
+
|
330
|
+
/** Detects chords in an audio file */
|
331
|
+
chords: (params: {
|
332
|
+
|
333
|
+
/** The input audio data */
|
334
|
+
input: string;
|
335
|
+
}) => Promise<void>;
|
336
|
+
|
337
|
+
/** Detects beats in an audio file */
|
338
|
+
beats: (params: {
|
339
|
+
|
340
|
+
/** The input audio data */
|
341
|
+
input: string;
|
342
|
+
}) => Promise<void>;
|
343
|
+
|
344
|
+
/** Detects sections in an audio file */
|
345
|
+
sections: (params: {
|
346
|
+
|
347
|
+
/** The input audio data */
|
348
|
+
input: string;
|
349
|
+
}) => Promise<void>;
|
350
|
+
|
351
|
+
/** Detects lyrics in an audio file */
|
352
|
+
lyrics: (params: {
|
353
|
+
|
354
|
+
/** The input audio data */
|
355
|
+
input: string;
|
356
|
+
}) => Promise<void>;
|
357
|
+
|
358
|
+
/** Extracts stems from an audio file */
|
359
|
+
stems: (params: {
|
360
|
+
|
361
|
+
/** The input audio data */
|
362
|
+
input: string;
|
363
|
+
|
364
|
+
/** The stems to extract */
|
365
|
+
stemsToExtract: any[];
|
366
|
+
}) => void;
|
367
|
+
}
|
368
|
+
|
369
|
+
|
156
370
|
/** Registration methods for extensions */
|
157
371
|
export interface RegisterApi {
|
158
372
|
|
@@ -171,6 +385,12 @@ export interface MoisesAPI {
|
|
171
385
|
session: SessionApi;
|
172
386
|
/** Track API for managing audio tracks */
|
173
387
|
track: TrackApi;
|
388
|
+
/** Group API for managing audio groups */
|
389
|
+
group: GroupApi;
|
390
|
+
/** Storage API for managing audio files */
|
391
|
+
storage: StorageApi;
|
392
|
+
/** Compute API for managing audio computations */
|
393
|
+
compute: ComputeApi;
|
174
394
|
/** Registration methods for extensions */
|
175
395
|
register: RegisterApi;
|
176
396
|
|
package/dist/index.js
CHANGED
@@ -1,45 +1,47 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { useState as
|
3
|
-
import { M as
|
4
|
-
|
1
|
+
import { jsx as l, jsxs as b } from "react/jsx-runtime";
|
2
|
+
import { useState as C, useEffect as g } from "react";
|
3
|
+
import { M as k, R as M } from "./client-BuA0RRm3.js";
|
4
|
+
import { Box as m, HeaderPanel as h } from "@moises.ai/design-system";
|
5
|
+
import { Cross1Icon as S } from "@moises.ai/design-system/icons";
|
6
|
+
function P(i) {
|
5
7
|
i.id;
|
6
|
-
let t = null,
|
8
|
+
let t = null, s = !1;
|
7
9
|
function r() {
|
8
|
-
const [c,
|
10
|
+
const [c, o] = C({
|
9
11
|
plugin: null,
|
10
|
-
isConnected:
|
12
|
+
isConnected: s,
|
11
13
|
moises: null
|
12
14
|
});
|
13
15
|
g(() => {
|
14
|
-
t || (t =
|
16
|
+
t || (t = k(i), o((n) => ({
|
15
17
|
...n,
|
16
18
|
plugin: t.plugin,
|
17
19
|
moises: t
|
18
20
|
// The entire pluginInstance IS the moises API
|
19
21
|
})));
|
20
22
|
}, [i]), g(() => {
|
21
|
-
t && !
|
22
|
-
|
23
|
+
t && !s && t.connect().then(() => {
|
24
|
+
s = !0, o((n) => ({
|
23
25
|
...n,
|
24
26
|
isConnected: !0
|
25
27
|
}));
|
26
28
|
});
|
27
29
|
}, []);
|
28
|
-
function
|
30
|
+
function p({ children: n, width: a, height: d }) {
|
29
31
|
const { moises: e } = c;
|
30
32
|
return g(() => {
|
31
|
-
e && e.ui.setPluginSize({ width:
|
32
|
-
}, [
|
33
|
+
e && e.ui.setPluginSize({ width: a, height: d });
|
34
|
+
}, [a, d, e]), /* @__PURE__ */ l("div", { height: "100vh", style: { height: "100vh", backgroundColor: "var(--gray-1)" }, children: /* @__PURE__ */ l("div", { p: "4", children: n }) });
|
33
35
|
}
|
34
36
|
return {
|
35
37
|
...c,
|
36
|
-
ModalLayout:
|
38
|
+
ModalLayout: p
|
37
39
|
};
|
38
40
|
}
|
39
41
|
return r;
|
40
42
|
}
|
41
|
-
function
|
42
|
-
const
|
43
|
+
function I({ id: i, url: t, exposedAPI: s, iframeRef: r, onRegisterMetadata: c, onRegisterLink: o }) {
|
44
|
+
const p = {
|
43
45
|
id: i,
|
44
46
|
url: t
|
45
47
|
};
|
@@ -49,24 +51,84 @@ function j({ id: i, url: t, exposedAPI: o, iframeRef: r, onRegisterMetadata: c,
|
|
49
51
|
});
|
50
52
|
n.on("register.extension", async (e) => {
|
51
53
|
c(e);
|
52
|
-
}), n.on("register.link", async ({ category: e, options:
|
53
|
-
const f = `link:${e}:${
|
54
|
-
return
|
54
|
+
}), n.on("register.link", async ({ category: e, options: u }) => {
|
55
|
+
const f = `link:${e}:${u.label}`;
|
56
|
+
return o({ id: f, category: e, options: u }), { id: f };
|
55
57
|
});
|
56
|
-
for (const [e,
|
57
|
-
for (const [f,
|
58
|
-
const
|
59
|
-
n.on(
|
58
|
+
for (const [e, u] of Object.entries(s))
|
59
|
+
for (const [f, x] of Object.entries(u)) {
|
60
|
+
const v = `${e}.${f}`;
|
61
|
+
n.on(v, async (y) => await x(y));
|
60
62
|
}
|
61
|
-
function
|
62
|
-
return n.call(e,
|
63
|
+
function a(e, u) {
|
64
|
+
return n.call(e, u);
|
63
65
|
}
|
64
|
-
function
|
66
|
+
function d() {
|
65
67
|
n.disconnect();
|
66
68
|
}
|
67
|
-
return { plugin:
|
69
|
+
return { plugin: p, rpc: n, call: a, disconnect: d };
|
70
|
+
}
|
71
|
+
function B({
|
72
|
+
children: i,
|
73
|
+
init: t = {},
|
74
|
+
title: s = "Sidebar Menu",
|
75
|
+
width: r = "300px",
|
76
|
+
height: c = "600px"
|
77
|
+
}) {
|
78
|
+
const { moises: o } = P(t);
|
79
|
+
return g(() => {
|
80
|
+
o && o.ui.setPluginSize({ width: r, height: c });
|
81
|
+
}, [r, c, o]), /* @__PURE__ */ b(
|
82
|
+
m,
|
83
|
+
{
|
84
|
+
height: "100vh",
|
85
|
+
style: {
|
86
|
+
height: "100vh",
|
87
|
+
backgroundColor: "var(--gray-1)",
|
88
|
+
display: "flex",
|
89
|
+
flexDirection: "column",
|
90
|
+
overflow: "hidden"
|
91
|
+
},
|
92
|
+
children: [
|
93
|
+
/* @__PURE__ */ l(
|
94
|
+
m,
|
95
|
+
{
|
96
|
+
p: "4",
|
97
|
+
style: {
|
98
|
+
position: "sticky",
|
99
|
+
top: 0,
|
100
|
+
zIndex: 10,
|
101
|
+
backgroundColor: "var(--neutral-2)"
|
102
|
+
},
|
103
|
+
children: /* @__PURE__ */ l(h, { title: s, children: /* @__PURE__ */ l(
|
104
|
+
h.Button,
|
105
|
+
{
|
106
|
+
onClick: () => {
|
107
|
+
o.ui.close();
|
108
|
+
},
|
109
|
+
children: /* @__PURE__ */ l(S, {})
|
110
|
+
}
|
111
|
+
) })
|
112
|
+
}
|
113
|
+
),
|
114
|
+
/* @__PURE__ */ l(
|
115
|
+
m,
|
116
|
+
{
|
117
|
+
px: "4",
|
118
|
+
style: {
|
119
|
+
flex: 1,
|
120
|
+
overflowY: "auto",
|
121
|
+
backgroundColor: "var(--neutral-2)"
|
122
|
+
},
|
123
|
+
children: i
|
124
|
+
}
|
125
|
+
)
|
126
|
+
]
|
127
|
+
}
|
128
|
+
);
|
68
129
|
}
|
69
130
|
export {
|
70
|
-
|
71
|
-
|
131
|
+
I as MoisesExtensionHost,
|
132
|
+
B as SidebarMenu,
|
133
|
+
P as initMoisesExtension
|
72
134
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@moises.ai/extension",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
4
4
|
"description": "SDK for Moises AI extensions",
|
5
5
|
"private": false,
|
6
6
|
"type": "module",
|
@@ -47,7 +47,8 @@
|
|
47
47
|
"@vitejs/plugin-react": "^4.2.1",
|
48
48
|
"react": "^19.0.0",
|
49
49
|
"react-dom": "^19.0.0",
|
50
|
-
"vite": "^5.1.0"
|
50
|
+
"vite": "^5.1.0",
|
51
|
+
"@moises.ai/design-system": "^2.0.33"
|
51
52
|
},
|
52
53
|
"publishConfig": {
|
53
54
|
"access": "public"
|
package/src/client.d.ts
CHANGED
@@ -2,21 +2,11 @@
|
|
2
2
|
/** Controlling common UI elements */
|
3
3
|
export interface UiApi {
|
4
4
|
|
5
|
-
/** Sets the extension size in the interface */
|
6
|
-
setPluginSize: (params: {
|
7
|
-
|
8
|
-
/** Width in pixels */
|
9
|
-
width: number;
|
10
|
-
|
11
|
-
/** Height in pixels */
|
12
|
-
height: number;
|
13
|
-
}) => void;
|
14
|
-
|
15
5
|
/** Displays a progress bar or loading indicator */
|
16
6
|
progress: (options: {
|
17
7
|
|
18
|
-
/** Progress
|
19
|
-
|
8
|
+
/** Progress title */
|
9
|
+
title?: string;
|
20
10
|
|
21
11
|
/** Progress value (0-100) */
|
22
12
|
value?: number;
|
@@ -26,10 +16,16 @@ export interface UiApi {
|
|
26
16
|
alert: (options: {
|
27
17
|
|
28
18
|
/** Alert title */
|
29
|
-
title
|
19
|
+
title?: string;
|
20
|
+
|
21
|
+
/** Alert description */
|
22
|
+
description?: string;
|
23
|
+
|
24
|
+
/** Alert CTA label */
|
25
|
+
ctaLabel?: string;
|
30
26
|
|
31
|
-
/** Alert
|
32
|
-
|
27
|
+
/** Alert CTA color */
|
28
|
+
ctaColor?: string;
|
33
29
|
}) => Promise<void>;
|
34
30
|
|
35
31
|
/** Displays a confirmation dialog */
|
@@ -38,8 +34,14 @@ export interface UiApi {
|
|
38
34
|
/** Confirmation title */
|
39
35
|
title: string;
|
40
36
|
|
41
|
-
/** Confirmation
|
42
|
-
|
37
|
+
/** Confirmation description */
|
38
|
+
description: string;
|
39
|
+
|
40
|
+
/** Confirmation CTA label */
|
41
|
+
ctaLabel?: string;
|
42
|
+
|
43
|
+
/** Confirmation CTA color */
|
44
|
+
ctaColor?: string;
|
43
45
|
}) => Promise<boolean>;
|
44
46
|
|
45
47
|
/** Displays a text input dialog */
|
@@ -48,11 +50,20 @@ export interface UiApi {
|
|
48
50
|
/** Prompt title */
|
49
51
|
title: string;
|
50
52
|
|
51
|
-
/** Prompt
|
52
|
-
|
53
|
+
/** Prompt description */
|
54
|
+
description: string;
|
55
|
+
|
56
|
+
/** Prompt label */
|
57
|
+
label?: string;
|
53
58
|
|
54
|
-
/**
|
59
|
+
/** Prompt default value */
|
55
60
|
defaultValue?: string;
|
61
|
+
|
62
|
+
/** Prompt CTA label */
|
63
|
+
ctaLabel?: string;
|
64
|
+
|
65
|
+
/** Prompt CTA color */
|
66
|
+
ctaColor?: string;
|
56
67
|
}) => Promise<string>;
|
57
68
|
|
58
69
|
/** Creates a panel in the interface */
|
@@ -129,10 +140,10 @@ export interface TrackApi {
|
|
129
140
|
arrayBuffer: any;
|
130
141
|
|
131
142
|
/** The name of the track */
|
132
|
-
name
|
143
|
+
name: string;
|
133
144
|
|
134
|
-
/**
|
135
|
-
|
145
|
+
/** The start position of the track in seconds */
|
146
|
+
startPositionSec: number;
|
136
147
|
}) => Promise<any>;
|
137
148
|
|
138
149
|
/** Updates a track */
|
@@ -153,6 +164,209 @@ export interface TrackApi {
|
|
153
164
|
}
|
154
165
|
|
155
166
|
|
167
|
+
/** Group API for managing audio groups */
|
168
|
+
export interface GroupApi {
|
169
|
+
|
170
|
+
/** Creates a new group */
|
171
|
+
create: (params: {
|
172
|
+
|
173
|
+
/** The name of the group */
|
174
|
+
name: string;
|
175
|
+
|
176
|
+
/** The ID of the group */
|
177
|
+
id: string;
|
178
|
+
|
179
|
+
/** The type of the group */
|
180
|
+
type: string;
|
181
|
+
|
182
|
+
/** The order of the group */
|
183
|
+
order: number;
|
184
|
+
|
185
|
+
/** Whether the group is solo */
|
186
|
+
solo: boolean;
|
187
|
+
|
188
|
+
/** Whether the group is muted */
|
189
|
+
muted: boolean;
|
190
|
+
|
191
|
+
/** The pan of the group */
|
192
|
+
pan: number;
|
193
|
+
|
194
|
+
/** The volume of the group */
|
195
|
+
volume: number;
|
196
|
+
|
197
|
+
/** Additional options for the group */
|
198
|
+
options: any;
|
199
|
+
}) => Promise<any>;
|
200
|
+
|
201
|
+
/** Updates a group */
|
202
|
+
update: (params: {
|
203
|
+
|
204
|
+
/** The ID of the group to update */
|
205
|
+
groupId: string;
|
206
|
+
|
207
|
+
/** The name of the group */
|
208
|
+
name: string;
|
209
|
+
|
210
|
+
/** The type of the group */
|
211
|
+
type: string;
|
212
|
+
|
213
|
+
/** The order of the group */
|
214
|
+
order: number;
|
215
|
+
|
216
|
+
/** Whether the group is solo */
|
217
|
+
solo: boolean;
|
218
|
+
|
219
|
+
/** Whether the group is muted */
|
220
|
+
muted: boolean;
|
221
|
+
|
222
|
+
/** The pan of the group */
|
223
|
+
pan: number;
|
224
|
+
|
225
|
+
/** The volume of the group */
|
226
|
+
volume: number;
|
227
|
+
}) => Promise<any>;
|
228
|
+
}
|
229
|
+
|
230
|
+
|
231
|
+
/** Storage API for managing audio files */
|
232
|
+
export interface StorageApi {
|
233
|
+
|
234
|
+
/** Uploads a buffer to the storage */
|
235
|
+
upload: (params: {
|
236
|
+
|
237
|
+
/** The audio data to upload */
|
238
|
+
buffer: any;
|
239
|
+
}) => Promise<any>;
|
240
|
+
|
241
|
+
/** Downloads an audio file from the storage */
|
242
|
+
download: (params: {
|
243
|
+
|
244
|
+
/** The URL of the audio file to download */
|
245
|
+
url: string;
|
246
|
+
}) => Promise<any>;
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
/** Compute API for managing audio computations */
|
251
|
+
export interface ComputeApi {
|
252
|
+
|
253
|
+
/** Generates a session player */
|
254
|
+
sessionPlayerGenerate: (params: {
|
255
|
+
|
256
|
+
/** The context audio for the session player */
|
257
|
+
contextAudio: any;
|
258
|
+
|
259
|
+
/** The conditioning audio for the session player */
|
260
|
+
conditioningAudio: any;
|
261
|
+
|
262
|
+
/** The conditioning text for the session player */
|
263
|
+
conditioningText: string;
|
264
|
+
|
265
|
+
/** The number of steps for the session player */
|
266
|
+
steps: number;
|
267
|
+
|
268
|
+
/** The guidance scale for the session player */
|
269
|
+
guidanceScale: number;
|
270
|
+
|
271
|
+
/** The weight schedule for the session player */
|
272
|
+
weightSchedule: number;
|
273
|
+
|
274
|
+
/** The instrument for the session player */
|
275
|
+
instrument: string;
|
276
|
+
|
277
|
+
/** The preset ID for the session player */
|
278
|
+
presetId: string;
|
279
|
+
|
280
|
+
/** Whether to use chroma for the session player */
|
281
|
+
chroma: boolean;
|
282
|
+
|
283
|
+
/** The timestamps for the session player */
|
284
|
+
inpaintingTimestamps: any[];
|
285
|
+
|
286
|
+
/** The target for the session player */
|
287
|
+
inpaintingTarget: any[];
|
288
|
+
}) => Promise<void>;
|
289
|
+
|
290
|
+
/** Gets the list of session player presets */
|
291
|
+
sessionPlayerPresets: () => Promise<void>;
|
292
|
+
|
293
|
+
/** Inpaints an audio file */
|
294
|
+
sessionPlayerInpaint: (params: {
|
295
|
+
|
296
|
+
/** The input audio data */
|
297
|
+
input: any;
|
298
|
+
|
299
|
+
/** The mask for the inpainting */
|
300
|
+
mask: any;
|
301
|
+
}) => Promise<void>;
|
302
|
+
|
303
|
+
/** Runs a workflow */
|
304
|
+
workflow: (params: {
|
305
|
+
|
306
|
+
/** The ID of the workflow to run */
|
307
|
+
workflowId: string;
|
308
|
+
|
309
|
+
/** The parameters for the workflow TODO: add type */
|
310
|
+
params: any;
|
311
|
+
}) => Promise<void>;
|
312
|
+
|
313
|
+
/** Runs an automix job */
|
314
|
+
automix: (params: {
|
315
|
+
|
316
|
+
/** The ID of the workflow to run TODO: add type */
|
317
|
+
workflowId: string;
|
318
|
+
|
319
|
+
/** The parameters for the workflow TODO: add type */
|
320
|
+
params: any;
|
321
|
+
}) => Promise<void>;
|
322
|
+
|
323
|
+
/** Detects instruments in an audio file */
|
324
|
+
instruments: (params: {
|
325
|
+
|
326
|
+
/** The input audio data */
|
327
|
+
input: string;
|
328
|
+
}) => Promise<void>;
|
329
|
+
|
330
|
+
/** Detects chords in an audio file */
|
331
|
+
chords: (params: {
|
332
|
+
|
333
|
+
/** The input audio data */
|
334
|
+
input: string;
|
335
|
+
}) => Promise<void>;
|
336
|
+
|
337
|
+
/** Detects beats in an audio file */
|
338
|
+
beats: (params: {
|
339
|
+
|
340
|
+
/** The input audio data */
|
341
|
+
input: string;
|
342
|
+
}) => Promise<void>;
|
343
|
+
|
344
|
+
/** Detects sections in an audio file */
|
345
|
+
sections: (params: {
|
346
|
+
|
347
|
+
/** The input audio data */
|
348
|
+
input: string;
|
349
|
+
}) => Promise<void>;
|
350
|
+
|
351
|
+
/** Detects lyrics in an audio file */
|
352
|
+
lyrics: (params: {
|
353
|
+
|
354
|
+
/** The input audio data */
|
355
|
+
input: string;
|
356
|
+
}) => Promise<void>;
|
357
|
+
|
358
|
+
/** Extracts stems from an audio file */
|
359
|
+
stems: (params: {
|
360
|
+
|
361
|
+
/** The input audio data */
|
362
|
+
input: string;
|
363
|
+
|
364
|
+
/** The stems to extract */
|
365
|
+
stemsToExtract: any[];
|
366
|
+
}) => void;
|
367
|
+
}
|
368
|
+
|
369
|
+
|
156
370
|
/** Registration methods for extensions */
|
157
371
|
export interface RegisterApi {
|
158
372
|
|
@@ -171,6 +385,12 @@ export interface MoisesAPI {
|
|
171
385
|
session: SessionApi;
|
172
386
|
/** Track API for managing audio tracks */
|
173
387
|
track: TrackApi;
|
388
|
+
/** Group API for managing audio groups */
|
389
|
+
group: GroupApi;
|
390
|
+
/** Storage API for managing audio files */
|
391
|
+
storage: StorageApi;
|
392
|
+
/** Compute API for managing audio computations */
|
393
|
+
compute: ComputeApi;
|
174
394
|
/** Registration methods for extensions */
|
175
395
|
register: RegisterApi;
|
176
396
|
|
package/src/index.d.ts
CHANGED
@@ -2,21 +2,11 @@
|
|
2
2
|
/** Controlling common UI elements */
|
3
3
|
export interface UiApi {
|
4
4
|
|
5
|
-
/** Sets the extension size in the interface */
|
6
|
-
setPluginSize: (params: {
|
7
|
-
|
8
|
-
/** Width in pixels */
|
9
|
-
width: number;
|
10
|
-
|
11
|
-
/** Height in pixels */
|
12
|
-
height: number;
|
13
|
-
}) => void;
|
14
|
-
|
15
5
|
/** Displays a progress bar or loading indicator */
|
16
6
|
progress: (options: {
|
17
7
|
|
18
|
-
/** Progress
|
19
|
-
|
8
|
+
/** Progress title */
|
9
|
+
title?: string;
|
20
10
|
|
21
11
|
/** Progress value (0-100) */
|
22
12
|
value?: number;
|
@@ -26,10 +16,16 @@ export interface UiApi {
|
|
26
16
|
alert: (options: {
|
27
17
|
|
28
18
|
/** Alert title */
|
29
|
-
title
|
19
|
+
title?: string;
|
20
|
+
|
21
|
+
/** Alert description */
|
22
|
+
description?: string;
|
23
|
+
|
24
|
+
/** Alert CTA label */
|
25
|
+
ctaLabel?: string;
|
30
26
|
|
31
|
-
/** Alert
|
32
|
-
|
27
|
+
/** Alert CTA color */
|
28
|
+
ctaColor?: string;
|
33
29
|
}) => Promise<void>;
|
34
30
|
|
35
31
|
/** Displays a confirmation dialog */
|
@@ -38,8 +34,14 @@ export interface UiApi {
|
|
38
34
|
/** Confirmation title */
|
39
35
|
title: string;
|
40
36
|
|
41
|
-
/** Confirmation
|
42
|
-
|
37
|
+
/** Confirmation description */
|
38
|
+
description: string;
|
39
|
+
|
40
|
+
/** Confirmation CTA label */
|
41
|
+
ctaLabel?: string;
|
42
|
+
|
43
|
+
/** Confirmation CTA color */
|
44
|
+
ctaColor?: string;
|
43
45
|
}) => Promise<boolean>;
|
44
46
|
|
45
47
|
/** Displays a text input dialog */
|
@@ -48,11 +50,20 @@ export interface UiApi {
|
|
48
50
|
/** Prompt title */
|
49
51
|
title: string;
|
50
52
|
|
51
|
-
/** Prompt
|
52
|
-
|
53
|
+
/** Prompt description */
|
54
|
+
description: string;
|
55
|
+
|
56
|
+
/** Prompt label */
|
57
|
+
label?: string;
|
53
58
|
|
54
|
-
/**
|
59
|
+
/** Prompt default value */
|
55
60
|
defaultValue?: string;
|
61
|
+
|
62
|
+
/** Prompt CTA label */
|
63
|
+
ctaLabel?: string;
|
64
|
+
|
65
|
+
/** Prompt CTA color */
|
66
|
+
ctaColor?: string;
|
56
67
|
}) => Promise<string>;
|
57
68
|
|
58
69
|
/** Creates a panel in the interface */
|
@@ -129,10 +140,10 @@ export interface TrackApi {
|
|
129
140
|
arrayBuffer: any;
|
130
141
|
|
131
142
|
/** The name of the track */
|
132
|
-
name
|
143
|
+
name: string;
|
133
144
|
|
134
|
-
/**
|
135
|
-
|
145
|
+
/** The start position of the track in seconds */
|
146
|
+
startPositionSec: number;
|
136
147
|
}) => Promise<any>;
|
137
148
|
|
138
149
|
/** Updates a track */
|
@@ -153,6 +164,209 @@ export interface TrackApi {
|
|
153
164
|
}
|
154
165
|
|
155
166
|
|
167
|
+
/** Group API for managing audio groups */
|
168
|
+
export interface GroupApi {
|
169
|
+
|
170
|
+
/** Creates a new group */
|
171
|
+
create: (params: {
|
172
|
+
|
173
|
+
/** The name of the group */
|
174
|
+
name: string;
|
175
|
+
|
176
|
+
/** The ID of the group */
|
177
|
+
id: string;
|
178
|
+
|
179
|
+
/** The type of the group */
|
180
|
+
type: string;
|
181
|
+
|
182
|
+
/** The order of the group */
|
183
|
+
order: number;
|
184
|
+
|
185
|
+
/** Whether the group is solo */
|
186
|
+
solo: boolean;
|
187
|
+
|
188
|
+
/** Whether the group is muted */
|
189
|
+
muted: boolean;
|
190
|
+
|
191
|
+
/** The pan of the group */
|
192
|
+
pan: number;
|
193
|
+
|
194
|
+
/** The volume of the group */
|
195
|
+
volume: number;
|
196
|
+
|
197
|
+
/** Additional options for the group */
|
198
|
+
options: any;
|
199
|
+
}) => Promise<any>;
|
200
|
+
|
201
|
+
/** Updates a group */
|
202
|
+
update: (params: {
|
203
|
+
|
204
|
+
/** The ID of the group to update */
|
205
|
+
groupId: string;
|
206
|
+
|
207
|
+
/** The name of the group */
|
208
|
+
name: string;
|
209
|
+
|
210
|
+
/** The type of the group */
|
211
|
+
type: string;
|
212
|
+
|
213
|
+
/** The order of the group */
|
214
|
+
order: number;
|
215
|
+
|
216
|
+
/** Whether the group is solo */
|
217
|
+
solo: boolean;
|
218
|
+
|
219
|
+
/** Whether the group is muted */
|
220
|
+
muted: boolean;
|
221
|
+
|
222
|
+
/** The pan of the group */
|
223
|
+
pan: number;
|
224
|
+
|
225
|
+
/** The volume of the group */
|
226
|
+
volume: number;
|
227
|
+
}) => Promise<any>;
|
228
|
+
}
|
229
|
+
|
230
|
+
|
231
|
+
/** Storage API for managing audio files */
|
232
|
+
export interface StorageApi {
|
233
|
+
|
234
|
+
/** Uploads a buffer to the storage */
|
235
|
+
upload: (params: {
|
236
|
+
|
237
|
+
/** The audio data to upload */
|
238
|
+
buffer: any;
|
239
|
+
}) => Promise<any>;
|
240
|
+
|
241
|
+
/** Downloads an audio file from the storage */
|
242
|
+
download: (params: {
|
243
|
+
|
244
|
+
/** The URL of the audio file to download */
|
245
|
+
url: string;
|
246
|
+
}) => Promise<any>;
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
/** Compute API for managing audio computations */
|
251
|
+
export interface ComputeApi {
|
252
|
+
|
253
|
+
/** Generates a session player */
|
254
|
+
sessionPlayerGenerate: (params: {
|
255
|
+
|
256
|
+
/** The context audio for the session player */
|
257
|
+
contextAudio: any;
|
258
|
+
|
259
|
+
/** The conditioning audio for the session player */
|
260
|
+
conditioningAudio: any;
|
261
|
+
|
262
|
+
/** The conditioning text for the session player */
|
263
|
+
conditioningText: string;
|
264
|
+
|
265
|
+
/** The number of steps for the session player */
|
266
|
+
steps: number;
|
267
|
+
|
268
|
+
/** The guidance scale for the session player */
|
269
|
+
guidanceScale: number;
|
270
|
+
|
271
|
+
/** The weight schedule for the session player */
|
272
|
+
weightSchedule: number;
|
273
|
+
|
274
|
+
/** The instrument for the session player */
|
275
|
+
instrument: string;
|
276
|
+
|
277
|
+
/** The preset ID for the session player */
|
278
|
+
presetId: string;
|
279
|
+
|
280
|
+
/** Whether to use chroma for the session player */
|
281
|
+
chroma: boolean;
|
282
|
+
|
283
|
+
/** The timestamps for the session player */
|
284
|
+
inpaintingTimestamps: any[];
|
285
|
+
|
286
|
+
/** The target for the session player */
|
287
|
+
inpaintingTarget: any[];
|
288
|
+
}) => Promise<void>;
|
289
|
+
|
290
|
+
/** Gets the list of session player presets */
|
291
|
+
sessionPlayerPresets: () => Promise<void>;
|
292
|
+
|
293
|
+
/** Inpaints an audio file */
|
294
|
+
sessionPlayerInpaint: (params: {
|
295
|
+
|
296
|
+
/** The input audio data */
|
297
|
+
input: any;
|
298
|
+
|
299
|
+
/** The mask for the inpainting */
|
300
|
+
mask: any;
|
301
|
+
}) => Promise<void>;
|
302
|
+
|
303
|
+
/** Runs a workflow */
|
304
|
+
workflow: (params: {
|
305
|
+
|
306
|
+
/** The ID of the workflow to run */
|
307
|
+
workflowId: string;
|
308
|
+
|
309
|
+
/** The parameters for the workflow TODO: add type */
|
310
|
+
params: any;
|
311
|
+
}) => Promise<void>;
|
312
|
+
|
313
|
+
/** Runs an automix job */
|
314
|
+
automix: (params: {
|
315
|
+
|
316
|
+
/** The ID of the workflow to run TODO: add type */
|
317
|
+
workflowId: string;
|
318
|
+
|
319
|
+
/** The parameters for the workflow TODO: add type */
|
320
|
+
params: any;
|
321
|
+
}) => Promise<void>;
|
322
|
+
|
323
|
+
/** Detects instruments in an audio file */
|
324
|
+
instruments: (params: {
|
325
|
+
|
326
|
+
/** The input audio data */
|
327
|
+
input: string;
|
328
|
+
}) => Promise<void>;
|
329
|
+
|
330
|
+
/** Detects chords in an audio file */
|
331
|
+
chords: (params: {
|
332
|
+
|
333
|
+
/** The input audio data */
|
334
|
+
input: string;
|
335
|
+
}) => Promise<void>;
|
336
|
+
|
337
|
+
/** Detects beats in an audio file */
|
338
|
+
beats: (params: {
|
339
|
+
|
340
|
+
/** The input audio data */
|
341
|
+
input: string;
|
342
|
+
}) => Promise<void>;
|
343
|
+
|
344
|
+
/** Detects sections in an audio file */
|
345
|
+
sections: (params: {
|
346
|
+
|
347
|
+
/** The input audio data */
|
348
|
+
input: string;
|
349
|
+
}) => Promise<void>;
|
350
|
+
|
351
|
+
/** Detects lyrics in an audio file */
|
352
|
+
lyrics: (params: {
|
353
|
+
|
354
|
+
/** The input audio data */
|
355
|
+
input: string;
|
356
|
+
}) => Promise<void>;
|
357
|
+
|
358
|
+
/** Extracts stems from an audio file */
|
359
|
+
stems: (params: {
|
360
|
+
|
361
|
+
/** The input audio data */
|
362
|
+
input: string;
|
363
|
+
|
364
|
+
/** The stems to extract */
|
365
|
+
stemsToExtract: any[];
|
366
|
+
}) => void;
|
367
|
+
}
|
368
|
+
|
369
|
+
|
156
370
|
/** Registration methods for extensions */
|
157
371
|
export interface RegisterApi {
|
158
372
|
|
@@ -171,6 +385,12 @@ export interface MoisesAPI {
|
|
171
385
|
session: SessionApi;
|
172
386
|
/** Track API for managing audio tracks */
|
173
387
|
track: TrackApi;
|
388
|
+
/** Group API for managing audio groups */
|
389
|
+
group: GroupApi;
|
390
|
+
/** Storage API for managing audio files */
|
391
|
+
storage: StorageApi;
|
392
|
+
/** Compute API for managing audio computations */
|
393
|
+
compute: ComputeApi;
|
174
394
|
/** Registration methods for extensions */
|
175
395
|
register: RegisterApi;
|
176
396
|
|