@acedatacloud/sdk 2026.727.2 → 2026.804.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/resources/providers/suno.ts +4 -1
- package/src/runtime/tasks.ts +11 -0
package/package.json
CHANGED
|
@@ -33,6 +33,8 @@ export interface SunoGenerateOptions {
|
|
|
33
33
|
prompt?: Record<string, unknown>;
|
|
34
34
|
/** Audio ID used for generating additional audio based on existing audio. This field is required when `action` is `extend` or `concat`. */
|
|
35
35
|
audioId?: string;
|
|
36
|
+
/** Target length of the generated track in seconds, given as an integer, typically between 10 and 360. It is mainly used for generation in custom mode (`custom` is `true`); some models or actions may not support it, in which case the value is ignored or an error is returned. It is a target only — the finished length is reported by the `duration` field in the response and may differ slightly. */
|
|
37
|
+
duration?: number;
|
|
36
38
|
/** The "Weirdness" advanced parameter in the Suno official custom mode has a value range of 0 to 1, with higher values resulting in more creative and experimental outputs. It is only effective in custom mode. */
|
|
37
39
|
weirdness?: number;
|
|
38
40
|
/** A list of reference audio URLs for inspiration, requiring 1 to 4 publicly accessible audio addresses. This field is mandatory when `action` is `inspo`. */
|
|
@@ -227,6 +229,7 @@ export class Suno {
|
|
|
227
229
|
if (options.custom !== undefined) body["custom"] = options.custom;
|
|
228
230
|
body["prompt"] = options.prompt ?? "A song for Christmas";
|
|
229
231
|
if (options.audioId !== undefined) body["audio_id"] = options.audioId;
|
|
232
|
+
if (options.duration !== undefined) body["duration"] = options.duration;
|
|
230
233
|
if (options.weirdness !== undefined) body["weirdness"] = options.weirdness;
|
|
231
234
|
body["audio_urls"] = options.audioUrls ?? ["https://cdn1.suno.ai/b481b17a-bf50-4e10-8adc-4d5635050893.mp3"];
|
|
232
235
|
if (options.personaId !== undefined) body["persona_id"] = options.personaId;
|
|
@@ -248,7 +251,7 @@ export class Suno {
|
|
|
248
251
|
if (options.underpaintingStart !== undefined) body["underpainting_start"] = options.underpaintingStart;
|
|
249
252
|
if (options.replaceSectionStart !== undefined) body["replace_section_start"] = options.replaceSectionStart;
|
|
250
253
|
for (const [key, value] of Object.entries(options)) {
|
|
251
|
-
if (!["action", "async", "audioId", "audioUrls", "audioWeight", "callbackUrl", "continueAt", "custom", "instrumental", "lyric", "lyricPrompt", "mashupAudioIds", "maxWait", "model", "overpaintingEnd", "overpaintingStart", "personaId", "pollInterval", "prompt", "replaceSectionEnd", "replaceSectionStart", "samplesEnd", "samplesStart", "style", "styleInfluence", "styleNegative", "title", "underpaintingEnd", "underpaintingStart", "variationCategory", "vocalGender", "wait", "weirdness"].includes(key) && value !== undefined) {
|
|
254
|
+
if (!["action", "async", "audioId", "audioUrls", "audioWeight", "callbackUrl", "continueAt", "custom", "duration", "instrumental", "lyric", "lyricPrompt", "mashupAudioIds", "maxWait", "model", "overpaintingEnd", "overpaintingStart", "personaId", "pollInterval", "prompt", "replaceSectionEnd", "replaceSectionStart", "samplesEnd", "samplesStart", "style", "styleInfluence", "styleNegative", "title", "underpaintingEnd", "underpaintingStart", "variationCategory", "vocalGender", "wait", "weirdness"].includes(key) && value !== undefined) {
|
|
252
255
|
body[key] = value;
|
|
253
256
|
}
|
|
254
257
|
}
|
package/src/runtime/tasks.ts
CHANGED
|
@@ -137,6 +137,17 @@ export function taskStatus(state: Record<string, unknown>): 'succeeded' | 'faile
|
|
|
137
137
|
}
|
|
138
138
|
if (words.length > 0) return '';
|
|
139
139
|
|
|
140
|
+
// `success: false` alone is ambiguous — some services set it for a transient
|
|
141
|
+
// hiccup mid-run, alongside a bare string, and carry on. A *structured* error
|
|
142
|
+
// (a dict with a code) is the upstream's final answer: hailuo reports an
|
|
143
|
+
// unavailable model that way, with no finished_at, and treating it as still
|
|
144
|
+
// running makes the caller poll until timeout instead of showing the reason.
|
|
145
|
+
if (response.success === false) {
|
|
146
|
+
const error = response.error as Record<string, unknown> | undefined;
|
|
147
|
+
const structured = !!error && typeof error === 'object' && !!error.code;
|
|
148
|
+
if (artifactUrls(state).length > 0 || structured) return 'failed';
|
|
149
|
+
}
|
|
150
|
+
|
|
140
151
|
const finished =
|
|
141
152
|
(response.finished_at !== undefined && response.finished_at !== null) ||
|
|
142
153
|
(state.finished_at !== undefined && state.finished_at !== null);
|