@qvac/sdk 0.17.0 → 0.18.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/NOTICE +83 -18
- package/README.md +19 -0
- package/dist/client/api/audio-gen.d.ts +17 -0
- package/dist/client/api/audio-gen.js +17 -0
- package/dist/client/api/finetune.d.ts +2 -0
- package/dist/client/api/finetune.js +7 -1
- package/dist/client/api/index.d.ts +1 -1
- package/dist/client/api/index.js +1 -1
- package/dist/client/api/load-model.d.ts +8 -0
- package/dist/client/api/transcribe.d.ts +19 -2
- package/dist/client/api/transcribe.js +66 -27
- package/dist/client/api/translate.d.ts +3 -2
- package/dist/client/api/translate.js +42 -21
- package/dist/client/api/vla.d.ts +42 -1
- package/dist/client/api/vla.js +50 -1
- package/dist/commands/bundle/entry-gen.d.ts +4 -0
- package/dist/commands/bundle/entry-gen.js +6 -0
- package/dist/commands/bundle/index.js +19 -12
- package/dist/examples/asr/parakeet-indic-conformer-filesystem.d.ts +2 -0
- package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +52 -0
- package/dist/examples/audiogen/generate-cover.d.ts +2 -0
- package/dist/examples/audiogen/generate-cover.js +100 -0
- package/dist/examples/llamacpp-fallback.d.ts +2 -0
- package/dist/examples/llamacpp-fallback.js +34 -0
- package/dist/examples/multi-job-completion.d.ts +28 -0
- package/dist/examples/multi-job-completion.js +128 -0
- package/dist/examples/profiling/basic.js +32 -1
- package/dist/examples/system-resources.d.ts +2 -0
- package/dist/examples/system-resources.js +86 -0
- package/dist/examples/tts/audio8.d.ts +2 -0
- package/dist/examples/tts/audio8.js +54 -0
- package/dist/examples/tts/cosyvoice3.d.ts +2 -0
- package/dist/examples/tts/cosyvoice3.js +52 -0
- package/dist/examples/vla-groot.js +92 -49
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/models/registry/models.d.ts +782 -6
- package/dist/models/registry/models.js +2664 -1859
- package/dist/schemas/audio-gen.d.ts +103 -0
- package/dist/schemas/audio-gen.js +135 -4
- package/dist/schemas/common.d.ts +550 -11
- package/dist/schemas/constants-registry.d.ts +18 -4
- package/dist/schemas/constants-registry.js +16 -3
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/llamacpp-config.d.ts +10 -10
- package/dist/schemas/llamacpp-config.js +12 -5
- package/dist/schemas/load-model.d.ts +3678 -323
- package/dist/schemas/load-model.js +21 -3
- package/dist/schemas/sdk-config.d.ts +60 -24
- package/dist/schemas/sdk-errors-server.d.ts +1 -0
- package/dist/schemas/sdk-errors-server.js +5 -0
- package/dist/schemas/text-to-speech.d.ts +1086 -110
- package/dist/schemas/text-to-speech.js +194 -4
- package/dist/schemas/tools.d.ts +0 -16
- package/dist/schemas/tools.js +0 -15
- package/dist/schemas/transcription-config.d.ts +2 -0
- package/dist/schemas/transcription-config.js +10 -4
- package/dist/schemas/transcription.d.ts +3 -0
- package/dist/schemas/vla.d.ts +83 -0
- package/dist/schemas/vla.js +105 -2
- package/dist/scripts/link-workspace-inference.d.ts +2 -0
- package/dist/scripts/link-workspace-inference.js +31 -0
- package/dist/server/bare/ops/cancel.d.ts +1 -1
- package/dist/server/bare/ops/cancel.js +1 -1
- package/dist/server/bare/ops/kv-cache-retention.js +11 -0
- package/dist/server/bare/ops/kv-cache-utils.d.ts +1 -1
- package/dist/server/bare/ops/kv-cache-utils.js +40 -12
- package/dist/server/bare/ops/transcribe.d.ts +2 -2
- package/dist/server/bare/ops/transcribe.js +54 -48
- package/dist/server/bare/ops/translate-stats.d.ts +5 -0
- package/dist/server/bare/ops/translate-stats.js +11 -0
- package/dist/server/bare/ops/translate.js +66 -38
- package/dist/server/bare/ops/unload-model.js +30 -24
- package/dist/server/bare/plugins/audiogen-ggml/ops/audio-gen-input.d.ts +20 -0
- package/dist/server/bare/plugins/audiogen-ggml/ops/audio-gen-input.js +153 -0
- package/dist/server/bare/plugins/audiogen-ggml/ops/audio-gen-stream.js +52 -1
- package/dist/server/bare/plugins/audiogen-ggml/plugin.d.ts +28 -0
- package/dist/server/bare/plugins/ggml-ocr/plugin.js +3 -1
- package/dist/server/bare/plugins/ggml-vla/ops/vla-set-embodiment.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-set-embodiment.js +9 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +37 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.js +21 -4
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-completion-stream.js +16 -15
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.d.ts +1 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +2 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.d.ts +6 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.js +10 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +1 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +131 -123
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +110 -20
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.d.ts +49 -23
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.js +308 -143
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +1 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +2 -2
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +6 -6
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +55 -36
- package/dist/server/bare/plugins/llamacpp-completion/transform.js +1 -7
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +2 -3
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +6 -5
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +27 -16
- package/dist/server/bare/plugins/tts-ggml/ops/parler-options.js +23 -3
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +302 -4
- package/dist/server/bare/plugins/tts-ggml/plugin.js +131 -0
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +48 -39
- package/dist/server/bare/registry/model-registry.d.ts +1 -0
- package/dist/server/bare/runtime/request-registry-singleton.js +29 -15
- package/dist/server/bare/runtime/request-registry.d.ts +27 -0
- package/dist/server/bare/runtime/request-registry.js +246 -76
- package/dist/server/bare/types/addon-responses.d.ts +4 -12
- package/dist/server/rpc/handlers/load-model/handler.js +2 -2
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +1 -1
- package/dist/server/rpc/handlers/load-model/resolve-session.js +3 -3
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +12 -2
- package/dist/server/rpc/handlers/load-model/resolve.js +90 -12
- package/dist/server/utils/audio/decoder.d.ts +37 -1
- package/dist/server/utils/audio/decoder.js +81 -51
- package/dist/server/utils/config-transform.d.ts +3 -0
- package/dist/server/utils/config-transform.js +6 -0
- package/dist/server/utils/index.d.ts +0 -1
- package/dist/server/utils/index.js +0 -1
- package/dist/server/utils/shard-utils.d.ts +1 -0
- package/dist/server/utils/shard-utils.js +14 -0
- package/dist/server/utils/tool-integration.d.ts +3 -10
- package/dist/server/utils/tool-integration.js +3 -12
- package/dist/utils/errors-server.d.ts +3 -0
- package/dist/utils/errors-server.js +5 -0
- package/package.json +12 -14
- package/dist/examples/llamacpp-dynamic-tools.d.ts +0 -2
- package/dist/examples/llamacpp-dynamic-tools.js +0 -152
- package/dist/models/update-models/codegen.d.ts +0 -3
- package/dist/models/update-models/codegen.js +0 -196
- package/dist/models/update-models/companions.d.ts +0 -30
- package/dist/models/update-models/companions.js +0 -296
- package/dist/models/update-models/history.d.ts +0 -24
- package/dist/models/update-models/history.js +0 -107
- package/dist/models/update-models/index.d.ts +0 -2
- package/dist/models/update-models/index.js +0 -123
- package/dist/models/update-models/naming.d.ts +0 -4
- package/dist/models/update-models/naming.js +0 -396
- package/dist/models/update-models/processing.d.ts +0 -8
- package/dist/models/update-models/processing.js +0 -65
- package/dist/models/update-models/registry.d.ts +0 -5
- package/dist/models/update-models/registry.js +0 -87
- package/dist/models/update-models/shards.d.ts +0 -4
- package/dist/models/update-models/shards.js +0 -57
- package/dist/models/update-models/types.d.ts +0 -88
- package/dist/models/update-models/types.js +0 -1
- package/dist/models/update-models/utils.d.ts +0 -3
- package/dist/models/update-models/utils.js +0 -21
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-cancelled.d.ts +0 -23
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-cancelled.js +0 -30
- package/dist/server/utils/expand-gguf-shards.d.ts +0 -3
- package/dist/server/utils/expand-gguf-shards.js +0 -22
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/** Sample rate the ACE-Step engine expects for reference and source audio. */
|
|
3
|
+
export declare const AUDIOGEN_INPUT_SAMPLE_RATE = 48000;
|
|
4
|
+
/** Channel count (interleaved stereo) the ACE-Step engine expects for input audio. */
|
|
5
|
+
export declare const AUDIOGEN_INPUT_CHANNELS = 2;
|
|
6
|
+
/**
|
|
7
|
+
* Longest reference/source clip the SDK accepts (10 minutes). Bounds the PCM
|
|
8
|
+
* the server materializes per input — a 48 kHz stereo Float32 clip weighs
|
|
9
|
+
* 384 KB per second — so a request cannot exhaust the inference process.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AUDIOGEN_INPUT_MAX_SECONDS = 600;
|
|
12
|
+
/**
|
|
13
|
+
* ACE-Step task discriminators reachable through the SDK. `text2music` is the
|
|
14
|
+
* default caption-driven generation; `cover-nofsq` re-renders `sourceAudio`
|
|
15
|
+
* with a new caption while keeping its structure. The engine also reserves an
|
|
16
|
+
* FSQ-roundtrip `cover` task that is not implemented yet, so it is not offered
|
|
17
|
+
* here.
|
|
18
|
+
*/
|
|
19
|
+
export declare const AUDIOGEN_TASK_TYPES: readonly ["text2music", "cover-nofsq"];
|
|
20
|
+
export declare const audioGenTaskTypeSchema: z.ZodEnum<{
|
|
21
|
+
text2music: "text2music";
|
|
22
|
+
"cover-nofsq": "cover-nofsq";
|
|
23
|
+
}>;
|
|
2
24
|
export declare const audioGenRuntimeConfigSchema: z.ZodObject<{
|
|
3
25
|
useGPU: z.ZodOptional<z.ZodBoolean>;
|
|
4
26
|
inferenceSteps: z.ZodOptional<z.ZodNumber>;
|
|
@@ -171,7 +193,44 @@ export declare const audioGenConfigSchema: z.ZodObject<{
|
|
|
171
193
|
}>, z.ZodLiteral<"vad">]>>;
|
|
172
194
|
}, z.core.$strip>]>;
|
|
173
195
|
}, z.core.$strict>;
|
|
196
|
+
/**
|
|
197
|
+
* Wire form of a reference/source audio input. `filePath` inputs are decoded
|
|
198
|
+
* server-side (any format the SDK's audio decoder supports, plus raw PCM);
|
|
199
|
+
* `base64` inputs must already be interleaved stereo 48 kHz Float32 LE PCM.
|
|
200
|
+
*/
|
|
201
|
+
export declare const audioGenAudioInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
202
|
+
type: z.ZodLiteral<"base64">;
|
|
203
|
+
value: z.ZodString;
|
|
204
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
205
|
+
type: z.ZodLiteral<"filePath">;
|
|
206
|
+
value: z.ZodString;
|
|
207
|
+
}, z.core.$strip>], "type">;
|
|
208
|
+
/**
|
|
209
|
+
* Client form of a reference/source audio input: a file path, or raw
|
|
210
|
+
* interleaved stereo 48 kHz Float32 LE PCM bytes. Normalized to the wire form.
|
|
211
|
+
*/
|
|
212
|
+
export declare const audioGenClientAudioInputSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>, z.ZodTransform<{
|
|
213
|
+
type: "base64";
|
|
214
|
+
value: string;
|
|
215
|
+
} | {
|
|
216
|
+
type: "filePath";
|
|
217
|
+
value: string;
|
|
218
|
+
}, string | Uint8Array<ArrayBuffer>>>;
|
|
174
219
|
export declare const audioGenClientParamsSchema: z.ZodObject<{
|
|
220
|
+
referenceAudio: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>, z.ZodTransform<{
|
|
221
|
+
type: "base64";
|
|
222
|
+
value: string;
|
|
223
|
+
} | {
|
|
224
|
+
type: "filePath";
|
|
225
|
+
value: string;
|
|
226
|
+
}, string | Uint8Array<ArrayBuffer>>>>;
|
|
227
|
+
sourceAudio: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>, z.ZodTransform<{
|
|
228
|
+
type: "base64";
|
|
229
|
+
value: string;
|
|
230
|
+
} | {
|
|
231
|
+
type: "filePath";
|
|
232
|
+
value: string;
|
|
233
|
+
}, string | Uint8Array<ArrayBuffer>>>>;
|
|
175
234
|
modelId: z.ZodString;
|
|
176
235
|
caption: z.ZodString;
|
|
177
236
|
lyrics: z.ZodOptional<z.ZodString>;
|
|
@@ -181,10 +240,38 @@ export declare const audioGenClientParamsSchema: z.ZodObject<{
|
|
|
181
240
|
keyscale: z.ZodOptional<z.ZodString>;
|
|
182
241
|
timesignature: z.ZodOptional<z.ZodString>;
|
|
183
242
|
duration: z.ZodOptional<z.ZodNumber>;
|
|
243
|
+
lmTemperature: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
lmTopP: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
lmTopK: z.ZodOptional<z.ZodNumber>;
|
|
246
|
+
lmCfgScale: z.ZodOptional<z.ZodNumber>;
|
|
247
|
+
lmPhase1: z.ZodOptional<z.ZodBoolean>;
|
|
248
|
+
dcwEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
249
|
+
dcwScaler: z.ZodOptional<z.ZodNumber>;
|
|
250
|
+
dcwHighScaler: z.ZodOptional<z.ZodNumber>;
|
|
251
|
+
taskType: z.ZodOptional<z.ZodEnum<{
|
|
252
|
+
text2music: "text2music";
|
|
253
|
+
"cover-nofsq": "cover-nofsq";
|
|
254
|
+
}>>;
|
|
255
|
+
audioCoverStrength: z.ZodOptional<z.ZodNumber>;
|
|
256
|
+
coverNoiseStrength: z.ZodOptional<z.ZodNumber>;
|
|
184
257
|
}, z.core.$strict>;
|
|
185
258
|
export declare const audioGenStreamRequestSchema: z.ZodObject<{
|
|
186
259
|
type: z.ZodLiteral<"audioGenStream">;
|
|
187
260
|
requestId: z.ZodOptional<z.ZodString>;
|
|
261
|
+
referenceAudio: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
262
|
+
type: z.ZodLiteral<"base64">;
|
|
263
|
+
value: z.ZodString;
|
|
264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
+
type: z.ZodLiteral<"filePath">;
|
|
266
|
+
value: z.ZodString;
|
|
267
|
+
}, z.core.$strip>], "type">>;
|
|
268
|
+
sourceAudio: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
269
|
+
type: z.ZodLiteral<"base64">;
|
|
270
|
+
value: z.ZodString;
|
|
271
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
272
|
+
type: z.ZodLiteral<"filePath">;
|
|
273
|
+
value: z.ZodString;
|
|
274
|
+
}, z.core.$strip>], "type">>;
|
|
188
275
|
modelId: z.ZodString;
|
|
189
276
|
caption: z.ZodString;
|
|
190
277
|
lyrics: z.ZodOptional<z.ZodString>;
|
|
@@ -194,6 +281,20 @@ export declare const audioGenStreamRequestSchema: z.ZodObject<{
|
|
|
194
281
|
keyscale: z.ZodOptional<z.ZodString>;
|
|
195
282
|
timesignature: z.ZodOptional<z.ZodString>;
|
|
196
283
|
duration: z.ZodOptional<z.ZodNumber>;
|
|
284
|
+
lmTemperature: z.ZodOptional<z.ZodNumber>;
|
|
285
|
+
lmTopP: z.ZodOptional<z.ZodNumber>;
|
|
286
|
+
lmTopK: z.ZodOptional<z.ZodNumber>;
|
|
287
|
+
lmCfgScale: z.ZodOptional<z.ZodNumber>;
|
|
288
|
+
lmPhase1: z.ZodOptional<z.ZodBoolean>;
|
|
289
|
+
dcwEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
290
|
+
dcwScaler: z.ZodOptional<z.ZodNumber>;
|
|
291
|
+
dcwHighScaler: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
taskType: z.ZodOptional<z.ZodEnum<{
|
|
293
|
+
text2music: "text2music";
|
|
294
|
+
"cover-nofsq": "cover-nofsq";
|
|
295
|
+
}>>;
|
|
296
|
+
audioCoverStrength: z.ZodOptional<z.ZodNumber>;
|
|
297
|
+
coverNoiseStrength: z.ZodOptional<z.ZodNumber>;
|
|
197
298
|
}, z.core.$strict>;
|
|
198
299
|
export declare const audioGenProgressSchema: z.ZodObject<{
|
|
199
300
|
stage: z.ZodString;
|
|
@@ -231,6 +332,8 @@ export declare const audioGenStreamResponseSchema: z.ZodObject<{
|
|
|
231
332
|
backendId: z.ZodOptional<z.ZodNumber>;
|
|
232
333
|
}, z.core.$strip>>;
|
|
233
334
|
}, z.core.$strict>;
|
|
335
|
+
export type AudioGenTaskType = z.infer<typeof audioGenTaskTypeSchema>;
|
|
336
|
+
export type AudioGenAudioInput = z.infer<typeof audioGenAudioInputSchema>;
|
|
234
337
|
export type AudioGenRuntimeConfig = z.infer<typeof audioGenRuntimeConfigSchema>;
|
|
235
338
|
export type AudioGenConfig = z.infer<typeof audioGenConfigSchema>;
|
|
236
339
|
export type AudioGenClientParams = z.input<typeof audioGenClientParamsSchema>;
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { modelSrcInputSchema } from '../schemas/model-src-utils.js';
|
|
3
|
+
import { audioInputSchema } from '../schemas/transcription.js';
|
|
4
|
+
import { encodeBase64 } from '../utils/encoding.js';
|
|
3
5
|
const base64Schema = z.string().min(1);
|
|
6
|
+
/** Sample rate the ACE-Step engine expects for reference and source audio. */
|
|
7
|
+
export const AUDIOGEN_INPUT_SAMPLE_RATE = 48000;
|
|
8
|
+
/** Channel count (interleaved stereo) the ACE-Step engine expects for input audio. */
|
|
9
|
+
export const AUDIOGEN_INPUT_CHANNELS = 2;
|
|
10
|
+
/**
|
|
11
|
+
* Longest reference/source clip the SDK accepts (10 minutes). Bounds the PCM
|
|
12
|
+
* the server materializes per input — a 48 kHz stereo Float32 clip weighs
|
|
13
|
+
* 384 KB per second — so a request cannot exhaust the inference process.
|
|
14
|
+
*/
|
|
15
|
+
export const AUDIOGEN_INPUT_MAX_SECONDS = 600;
|
|
16
|
+
/**
|
|
17
|
+
* ACE-Step task discriminators reachable through the SDK. `text2music` is the
|
|
18
|
+
* default caption-driven generation; `cover-nofsq` re-renders `sourceAudio`
|
|
19
|
+
* with a new caption while keeping its structure. The engine also reserves an
|
|
20
|
+
* FSQ-roundtrip `cover` task that is not implemented yet, so it is not offered
|
|
21
|
+
* here.
|
|
22
|
+
*/
|
|
23
|
+
export const AUDIOGEN_TASK_TYPES = ['text2music', 'cover-nofsq'];
|
|
24
|
+
export const audioGenTaskTypeSchema = z.enum(AUDIOGEN_TASK_TYPES);
|
|
4
25
|
export const audioGenRuntimeConfigSchema = z
|
|
5
26
|
.object({
|
|
6
27
|
useGPU: z.boolean().optional(),
|
|
@@ -19,7 +40,31 @@ export const audioGenConfigSchema = audioGenRuntimeConfigSchema
|
|
|
19
40
|
vaeModelSrc: modelSrcInputSchema
|
|
20
41
|
})
|
|
21
42
|
.strict();
|
|
22
|
-
const
|
|
43
|
+
const unitIntervalSchema = z.number().min(0).max(1);
|
|
44
|
+
/**
|
|
45
|
+
* Wire form of a reference/source audio input. `filePath` inputs are decoded
|
|
46
|
+
* server-side (any format the SDK's audio decoder supports, plus raw PCM);
|
|
47
|
+
* `base64` inputs must already be interleaved stereo 48 kHz Float32 LE PCM.
|
|
48
|
+
*/
|
|
49
|
+
export const audioGenAudioInputSchema = audioInputSchema;
|
|
50
|
+
/**
|
|
51
|
+
* Client form of a reference/source audio input: a file path, or raw
|
|
52
|
+
* interleaved stereo 48 kHz Float32 LE PCM bytes. Normalized to the wire form.
|
|
53
|
+
*/
|
|
54
|
+
export const audioGenClientAudioInputSchema = z
|
|
55
|
+
.union([z.string().min(1), z.instanceof(Uint8Array)])
|
|
56
|
+
.transform((value) => {
|
|
57
|
+
if (typeof value === 'string')
|
|
58
|
+
return { type: 'filePath', value };
|
|
59
|
+
return { type: 'base64', value: bytesToBase64(value) };
|
|
60
|
+
});
|
|
61
|
+
function bytesToBase64(bytes) {
|
|
62
|
+
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(bytes)) {
|
|
63
|
+
return bytes.toString('base64');
|
|
64
|
+
}
|
|
65
|
+
return encodeBase64(bytes);
|
|
66
|
+
}
|
|
67
|
+
const audioGenGenerationShape = {
|
|
23
68
|
modelId: z.string().min(1),
|
|
24
69
|
caption: z.string().trim().min(1, 'caption must not be empty or whitespace-only'),
|
|
25
70
|
lyrics: z.string().optional(),
|
|
@@ -32,16 +77,102 @@ const audioGenParamsShape = {
|
|
|
32
77
|
.number()
|
|
33
78
|
.positive()
|
|
34
79
|
.optional()
|
|
35
|
-
.describe('Approximate requested duration in seconds. ACE-Step rounds to its latent frame grid; use output frames or stats.audioDurationMs as authoritative.')
|
|
80
|
+
.describe('Approximate requested duration in seconds. ACE-Step rounds to its latent frame grid; use output frames or stats.audioDurationMs as authoritative.'),
|
|
81
|
+
lmTemperature: z
|
|
82
|
+
.number()
|
|
83
|
+
.nonnegative()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe('LM sampling temperature (ACE-Step default: 0.85).'),
|
|
86
|
+
lmTopP: unitIntervalSchema
|
|
87
|
+
.optional()
|
|
88
|
+
.describe('LM nucleus-sampling probability (ACE-Step default: 0.9).'),
|
|
89
|
+
lmTopK: z
|
|
90
|
+
.number()
|
|
91
|
+
.int()
|
|
92
|
+
.nonnegative()
|
|
93
|
+
.optional()
|
|
94
|
+
.describe('LM top-k cutoff; 0 disables top-k filtering.'),
|
|
95
|
+
lmCfgScale: z
|
|
96
|
+
.number()
|
|
97
|
+
.nonnegative()
|
|
98
|
+
.optional()
|
|
99
|
+
.describe('Classifier-free guidance scale used by the LM.'),
|
|
100
|
+
lmPhase1: z
|
|
101
|
+
.boolean()
|
|
102
|
+
.optional()
|
|
103
|
+
.describe('Allow the LM to infer missing metadata before semantic-code generation.'),
|
|
104
|
+
dcwEnabled: z
|
|
105
|
+
.boolean()
|
|
106
|
+
.optional()
|
|
107
|
+
.describe('Apply the official ACE-Step Haar DCW correction during DiT sampling (default: true).'),
|
|
108
|
+
dcwScaler: z
|
|
109
|
+
.number()
|
|
110
|
+
.nonnegative()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe('DCW low-frequency correction strength (official default: 0.05).'),
|
|
113
|
+
dcwHighScaler: z
|
|
114
|
+
.number()
|
|
115
|
+
.nonnegative()
|
|
116
|
+
.optional()
|
|
117
|
+
.describe('DCW high-frequency correction strength (official default: 0.02).'),
|
|
118
|
+
taskType: audioGenTaskTypeSchema
|
|
119
|
+
.optional()
|
|
120
|
+
.describe('Generation task: text2music (default) or cover-nofsq (requires sourceAudio).'),
|
|
121
|
+
audioCoverStrength: unitIntervalSchema
|
|
122
|
+
.optional()
|
|
123
|
+
.describe('Fraction of DiT steps that keep the source context (0..1, default 1). cover-nofsq currently requires 1.'),
|
|
124
|
+
coverNoiseStrength: unitIntervalSchema
|
|
125
|
+
.optional()
|
|
126
|
+
.describe('Blend of the initial DiT noise toward the clean source latent (0..1). 0 = pure noise, 1 ≈ source latent. Default 0.')
|
|
127
|
+
};
|
|
128
|
+
const audioGenParamsShape = {
|
|
129
|
+
...audioGenGenerationShape,
|
|
130
|
+
referenceAudio: audioGenAudioInputSchema
|
|
131
|
+
.optional()
|
|
132
|
+
.describe('Optional timbre reference audio; omit to keep the engine default.'),
|
|
133
|
+
sourceAudio: audioGenAudioInputSchema
|
|
134
|
+
.optional()
|
|
135
|
+
.describe('Source audio to re-render; required for cover tasks.')
|
|
36
136
|
};
|
|
37
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Cross-field rules for cover tasks: `sourceAudio` is mandatory, and the engine
|
|
139
|
+
* currently only implements full source context, so an explicit
|
|
140
|
+
* `audioCoverStrength` must be `1` until context switching lands upstream.
|
|
141
|
+
*/
|
|
142
|
+
function validateCoverTask(value, ctx) {
|
|
143
|
+
if (value.taskType !== 'cover-nofsq')
|
|
144
|
+
return;
|
|
145
|
+
if (value.sourceAudio === undefined) {
|
|
146
|
+
ctx.addIssue({
|
|
147
|
+
code: 'custom',
|
|
148
|
+
path: ['sourceAudio'],
|
|
149
|
+
message: "taskType 'cover-nofsq' requires sourceAudio"
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (value.audioCoverStrength !== undefined && value.audioCoverStrength !== 1) {
|
|
153
|
+
ctx.addIssue({
|
|
154
|
+
code: 'custom',
|
|
155
|
+
path: ['audioCoverStrength'],
|
|
156
|
+
message: "taskType 'cover-nofsq' currently requires audioCoverStrength 1"
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
export const audioGenClientParamsSchema = z
|
|
161
|
+
.object({
|
|
162
|
+
...audioGenGenerationShape,
|
|
163
|
+
referenceAudio: audioGenClientAudioInputSchema.optional(),
|
|
164
|
+
sourceAudio: audioGenClientAudioInputSchema.optional()
|
|
165
|
+
})
|
|
166
|
+
.strict()
|
|
167
|
+
.superRefine(validateCoverTask);
|
|
38
168
|
export const audioGenStreamRequestSchema = z
|
|
39
169
|
.object({
|
|
40
170
|
...audioGenParamsShape,
|
|
41
171
|
type: z.literal('audioGenStream'),
|
|
42
172
|
requestId: z.string().min(1).optional()
|
|
43
173
|
})
|
|
44
|
-
.strict()
|
|
174
|
+
.strict()
|
|
175
|
+
.superRefine(validateCoverTask);
|
|
45
176
|
export const audioGenProgressSchema = z.object({
|
|
46
177
|
stage: z.string(),
|
|
47
178
|
step: z.number().int().nonnegative(),
|