@qvac/sdk 0.11.0 → 0.12.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 +1427 -39
- package/README.md +2 -0
- package/dist/client/api/classify.d.ts +23 -0
- package/dist/client/api/classify.js +43 -0
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/index.d.ts +4 -0
- package/dist/client/api/index.js +4 -0
- package/dist/client/api/load-model.js +24 -1
- package/dist/client/api/transcribe.d.ts +3 -0
- package/dist/client/api/transcribe.js +13 -2
- package/dist/client/api/video.d.ts +64 -0
- package/dist/client/api/video.js +147 -0
- package/dist/client/api/vla-helpers.d.ts +45 -0
- package/dist/client/api/vla-helpers.js +130 -0
- package/dist/client/api/vla.d.ts +65 -0
- package/dist/client/api/vla.js +109 -0
- package/dist/client/config-loader/resolve-config.node.d.ts +16 -0
- package/dist/client/config-loader/resolve-config.node.js +77 -23
- package/dist/client/plugins-factory.d.ts +8 -0
- package/dist/client/plugins-factory.js +10 -0
- package/dist/client/rpc/bare-client.js +62 -66
- package/dist/client/rpc/ensure-worker-ready.d.ts +9 -0
- package/dist/client/rpc/ensure-worker-ready.js +17 -0
- package/dist/client/rpc/node-rpc-client.js +4 -1
- package/dist/client/rpc/rpc-error.js +14 -1
- package/dist/commands/bundle/bare-pack.d.ts +13 -0
- package/dist/commands/bundle/bare-pack.js +54 -0
- package/dist/commands/bundle/constants.d.ts +7 -0
- package/dist/commands/bundle/constants.js +23 -0
- package/dist/commands/bundle/entry-gen.d.ts +2 -0
- package/dist/commands/bundle/entry-gen.js +48 -0
- package/dist/commands/bundle/index.d.ts +20 -0
- package/dist/commands/bundle/index.js +141 -0
- package/dist/commands/bundle/manifest.d.ts +21 -0
- package/dist/commands/bundle/manifest.js +193 -0
- package/dist/commands/bundle/plugins.d.ts +9 -0
- package/dist/commands/bundle/plugins.js +51 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/verify/abi.d.ts +52 -0
- package/dist/commands/verify/abi.js +125 -0
- package/dist/commands/verify/addon-source.d.ts +43 -0
- package/dist/commands/verify/addon-source.js +75 -0
- package/dist/commands/verify/bundle-source.d.ts +12 -0
- package/dist/commands/verify/bundle-source.js +53 -0
- package/dist/commands/verify/index.d.ts +59 -0
- package/dist/commands/verify/index.js +371 -0
- package/dist/commands/verify/node-modules-source.d.ts +11 -0
- package/dist/commands/verify/node-modules-source.js +76 -0
- package/dist/commands/verify/prebuilds.d.ts +15 -0
- package/dist/commands/verify/prebuilds.js +39 -0
- package/dist/examples/classification/classify-image.d.ts +2 -0
- package/dist/examples/classification/classify-image.js +23 -0
- package/dist/examples/diffusion-txt2vid.d.ts +2 -0
- package/dist/examples/diffusion-txt2vid.js +81 -0
- package/dist/examples/plugins.js +3 -7
- package/dist/examples/tools/llamacpp-tools-gemma4.js +2 -5
- package/dist/examples/tools/llamacpp-tools-qwen35.js +2 -3
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +18 -12
- package/dist/examples/transcription/parakeet-microphone-record.js +7 -12
- package/dist/examples/transcription/parakeet-microphone-stream.d.ts +2 -0
- package/dist/examples/transcription/parakeet-microphone-stream.js +79 -0
- package/dist/examples/transcription/parakeet-sortformer-streaming.d.ts +2 -0
- package/dist/examples/transcription/parakeet-sortformer-streaming.js +121 -0
- package/dist/examples/transcription/parakeet-sortformer.js +58 -55
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +18 -15
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +6 -1
- package/dist/examples/tts/chatterbox.js +7 -16
- package/dist/examples/tts/llm-to-tts-streaming.js +3 -10
- package/dist/examples/tts/supertonic-multilingual.js +4 -12
- package/dist/examples/tts/supertonic.js +5 -12
- package/dist/examples/vla-smolvla.d.ts +2 -0
- package/dist/examples/vla-smolvla.js +75 -0
- package/dist/examples/voice-assistant/voice-assistant.js +3 -10
- package/dist/expo/plugins/find-in-ancestor-node-modules.d.ts +14 -0
- package/dist/expo/plugins/find-in-ancestor-node-modules.js +24 -0
- package/dist/expo/plugins/get-project-root.d.ts +22 -0
- package/dist/expo/plugins/get-project-root.js +23 -0
- package/dist/expo/plugins/index.d.ts +4 -0
- package/dist/expo/plugins/index.js +4 -0
- package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +9 -2
- package/dist/expo/plugins/resolve-sdk-package-dir.js +38 -11
- package/dist/expo/plugins/withDeviceInfo.js +2 -1
- package/dist/expo/plugins/withMobileBundle.d.ts +2 -17
- package/dist/expo/plugins/withMobileBundle.js +31 -85
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/models/registry/models.d.ts +3711 -368
- package/dist/models/registry/models.js +7066 -3562
- package/dist/models/update-models/naming.js +22 -8
- package/dist/pear/pre.js +6 -2
- package/dist/schemas/cancel.d.ts +5 -0
- package/dist/schemas/cancel.js +1 -0
- package/dist/schemas/classification.d.ts +53 -0
- package/dist/schemas/classification.js +33 -0
- package/dist/schemas/common.d.ts +1001 -1739
- package/dist/schemas/common.js +6 -1
- package/dist/schemas/completion-event.d.ts +3 -0
- package/dist/schemas/completion-event.js +1 -0
- package/dist/schemas/completion-stream.d.ts +1 -0
- package/dist/schemas/download-asset.d.ts +13 -3
- package/dist/schemas/engine-addon-map.d.ts +3 -0
- package/dist/schemas/engine-addon-map.js +18 -5
- package/dist/schemas/get-model-info.d.ts +4 -0
- package/dist/schemas/get-model-info.js +2 -0
- package/dist/schemas/index.d.ts +3 -0
- package/dist/schemas/index.js +3 -0
- package/dist/schemas/llamacpp-config.d.ts +12 -2
- package/dist/schemas/load-model.d.ts +6152 -10764
- package/dist/schemas/load-model.js +75 -7
- package/dist/schemas/model-src-utils.d.ts +22 -2
- package/dist/schemas/model-types.d.ts +46 -6
- package/dist/schemas/model-types.js +28 -5
- package/dist/schemas/ocr.d.ts +5 -0
- package/dist/schemas/plugin.d.ts +20 -5
- package/dist/schemas/plugin.js +21 -4
- package/dist/schemas/registry.d.ts +44 -0
- package/dist/schemas/registry.js +5 -0
- package/dist/schemas/reload-config.d.ts +22 -2
- package/dist/schemas/sdcpp-config.d.ts +316 -1
- package/dist/schemas/sdcpp-config.js +232 -33
- package/dist/schemas/sdk-config.d.ts +654 -1324
- package/dist/schemas/sdk-config.js +16 -1
- package/dist/schemas/sdk-errors-client.d.ts +5 -0
- package/dist/schemas/sdk-errors-client.js +26 -1
- package/dist/schemas/sdk-errors-server.d.ts +3 -1
- package/dist/schemas/sdk-errors-server.js +20 -5
- package/dist/schemas/text-to-speech.d.ts +79 -696
- package/dist/schemas/text-to-speech.js +46 -19
- package/dist/schemas/transcription-config.d.ts +37 -226
- package/dist/schemas/transcription-config.js +76 -15
- package/dist/schemas/transcription.d.ts +63 -11
- package/dist/schemas/transcription.js +56 -2
- package/dist/schemas/translation-config.d.ts +60 -10
- package/dist/schemas/vla.d.ts +87 -0
- package/dist/schemas/vla.js +108 -0
- package/dist/scripts/run-unit-tests.js +8 -2
- package/dist/server/bare/ops/transcribe.d.ts +2 -1
- package/dist/server/bare/ops/transcribe.js +59 -34
- package/dist/server/bare/plugins/ggml-classification/ops/classify.d.ts +6 -0
- package/dist/server/bare/plugins/ggml-classification/ops/classify.js +30 -0
- package/dist/server/bare/plugins/ggml-classification/plugin.d.ts +32 -0
- package/dist/server/bare/plugins/ggml-classification/plugin.js +55 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.js +12 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +75 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +54 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.js +57 -0
- package/dist/server/bare/plugins/index.d.ts +3 -1
- package/dist/server/bare/plugins/index.js +3 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +3 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.d.ts +29 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.js +65 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +6 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +26 -0
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +25 -0
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +5 -0
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +67 -246
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +66 -97
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.d.ts +3 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +199 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +200 -2
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +61 -8
- package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.js +2 -15
- package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.js +2 -1
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +75 -0
- package/dist/server/bare/plugins/tts-ggml/plugin.js +189 -0
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +29 -4
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +12 -1
- package/dist/server/bare/registry/model-config-utils.js +7 -0
- package/dist/server/bare/runtime/request-context.d.ts +1 -1
- package/dist/server/bare/runtime-lifecycle.js +9 -9
- package/dist/server/bare/types/addon-responses.d.ts +1 -0
- package/dist/server/env.js +4 -1
- package/dist/server/plugins/index.d.ts +1 -1
- package/dist/server/plugins/index.js +1 -1
- package/dist/server/plugins/registry.d.ts +1 -0
- package/dist/server/plugins/registry.js +5 -0
- package/dist/server/rpc/handler-registry.js +4 -0
- package/dist/server/rpc/handler-selection.d.ts +9 -0
- package/dist/server/rpc/handler-selection.js +14 -0
- package/dist/server/rpc/handler-utils.js +5 -13
- package/dist/server/rpc/handlers/classify.d.ts +3 -0
- package/dist/server/rpc/handlers/classify.js +4 -0
- package/dist/server/rpc/handlers/index.d.ts +2 -0
- package/dist/server/rpc/handlers/index.js +2 -0
- package/dist/server/rpc/handlers/load-model/handler.js +4 -1
- package/dist/server/rpc/handlers/load-model/resolve.js +9 -0
- package/dist/server/rpc/handlers/video-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/video-stream.js +4 -0
- package/dist/server/rpc/profiling/operation-metrics.js +23 -0
- package/dist/server/utils/config-transform.js +1 -1
- package/dist/server/worker.js +14 -11
- package/dist/utils/errors-client.d.ts +15 -0
- package/dist/utils/errors-client.js +26 -0
- package/dist/utils/errors-server.d.ts +30 -2
- package/dist/utils/errors-server.js +51 -3
- package/package.json +66 -80
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -490
- package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -272
- package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
- package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
- /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.d.ts +0 -0
- /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.d.ts +0 -0
|
@@ -2,19 +2,53 @@ import { z } from "zod";
|
|
|
2
2
|
import { modelSrcInputSchema } from "./model-src-utils.js";
|
|
3
3
|
const BASE64_PATTERN = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
4
4
|
const ABSOLUTE_PATH_PATTERN = /^(\/|[A-Za-z]:[\\/]|\\\\)/;
|
|
5
|
+
const base64StringSchema = z.string().min(1).regex(BASE64_PATTERN);
|
|
6
|
+
const samplingMethodSchema = z.enum([
|
|
7
|
+
"euler",
|
|
8
|
+
"euler_a",
|
|
9
|
+
"heun",
|
|
10
|
+
"dpm2",
|
|
11
|
+
"dpm++2m",
|
|
12
|
+
"dpm++2mv2",
|
|
13
|
+
"dpm++2s_a",
|
|
14
|
+
"lcm",
|
|
15
|
+
"ipndm",
|
|
16
|
+
"ipndm_v",
|
|
17
|
+
"ddim_trailing",
|
|
18
|
+
"tcd",
|
|
19
|
+
"res_multistep",
|
|
20
|
+
"res_2s",
|
|
21
|
+
]);
|
|
22
|
+
const scheduleTypeSchema = z.enum([
|
|
23
|
+
"discrete", "karras", "exponential", "ays", "gits",
|
|
24
|
+
"sgm_uniform", "simple", "lcm", "smoothstep", "kl_optimal", "bong_tangent",
|
|
25
|
+
]);
|
|
26
|
+
const cacheModeSchema = z.enum([
|
|
27
|
+
"disabled",
|
|
28
|
+
"easycache",
|
|
29
|
+
"ucache",
|
|
30
|
+
"dbcache",
|
|
31
|
+
"taylorseer",
|
|
32
|
+
"cache-dit",
|
|
33
|
+
]);
|
|
5
34
|
export const sdcppConfigSchema = z
|
|
6
35
|
.object({
|
|
7
|
-
mode: z.enum(["diffusion", "upscale"]).default("diffusion")
|
|
36
|
+
mode: z.enum(["diffusion", "upscale", "video"]).default("diffusion")
|
|
8
37
|
.describe("Operation mode for the diffusion plugin. " +
|
|
9
38
|
"`'diffusion'` (default) builds a full SD / SDXL / SD3 / FLUX pipeline from " +
|
|
10
39
|
"the primary model plus optional auxiliary text encoders, VAE, and ESRGAN " +
|
|
11
40
|
"upscaler, and exposes diffusion({ ... }). " +
|
|
12
41
|
"`'upscale'` builds a standalone ESRGAN upscaler from the primary model " +
|
|
13
|
-
"file alone (auxiliary model sources are ignored) and exposes upscale({ ... })."
|
|
42
|
+
"file alone (auxiliary model sources are ignored) and exposes upscale({ ... }). " +
|
|
43
|
+
"`'video'` builds a Wan `VideoStableDiffusion` pipeline and exposes video({ ... }). " +
|
|
44
|
+
"On React Native, loading the video model on-device will likely fail " +
|
|
45
|
+
"because the video diffusion models currently " +
|
|
46
|
+
"shipped by the SDK are too large to load on typical mobile devices; " +
|
|
47
|
+
"pass a `delegate` to `loadModel(...)` to run generation on a desktop peer instead."),
|
|
14
48
|
threads: z.number().optional(),
|
|
15
49
|
device: z.enum(["gpu", "cpu"]).optional(),
|
|
16
50
|
prediction: z
|
|
17
|
-
.enum(["auto", "eps", "v", "edm_v", "flow", "
|
|
51
|
+
.enum(["auto", "eps", "v", "edm_v", "flow", "flux2_flow"])
|
|
18
52
|
.optional()
|
|
19
53
|
.describe("Prediction type; auto-detected from model when omitted"),
|
|
20
54
|
type: z
|
|
@@ -30,7 +64,10 @@ export const sdcppConfigSchema = z
|
|
|
30
64
|
clip_on_cpu: z.boolean().optional().describe("Force CLIP text encoder to run on CPU"),
|
|
31
65
|
vae_on_cpu: z.boolean().optional().describe("Force VAE decoder to run on CPU"),
|
|
32
66
|
vae_tiling: z.boolean().optional().describe("Enable VAE tiling for large images on limited VRAM"),
|
|
67
|
+
offload_to_cpu: z.boolean().optional()
|
|
68
|
+
.describe("Keep model weights in CPU memory and offload them during GPU compute"),
|
|
33
69
|
flash_attn: z.boolean().optional().describe("Enable flash attention to reduce memory usage"),
|
|
70
|
+
diffusion_fa: z.boolean().optional().describe("Enable flash attention for the diffusion transformer only"),
|
|
34
71
|
lora_apply_mode: z.enum(["auto", "immediately", "at_runtime"]).optional()
|
|
35
72
|
.describe("How LoRA adapters passed via diffusion({ lora }) are applied. " +
|
|
36
73
|
"'auto' (default): picked based on weight type — 'at_runtime' for " +
|
|
@@ -50,6 +87,8 @@ export const sdcppConfigSchema = z
|
|
|
50
87
|
.describe("LLM text encoder model (e.g. Qwen3) — required for FLUX.2 [klein]"),
|
|
51
88
|
vaeModelSrc: modelSrcInputSchema.optional()
|
|
52
89
|
.describe("VAE decoder model — required for FLUX.2 [klein], optional for SDXL"),
|
|
90
|
+
highNoiseDiffusionModelSrc: modelSrcInputSchema.optional()
|
|
91
|
+
.describe("High-noise diffusion expert — required for Wan 2.2 mixture-of-experts video models"),
|
|
53
92
|
upscaler: z.object({
|
|
54
93
|
type: z.literal("esrgan").optional()
|
|
55
94
|
.describe("Type of upscaler to use for post-generation upscaling when requested in diffusion({ upscale })."),
|
|
@@ -80,9 +119,10 @@ export const sdcppConfigSchema = z
|
|
|
80
119
|
"requires `model_src`. In `mode: 'upscale'` only the tuning fields " +
|
|
81
120
|
"(tile_size, direct, offload_params_to_cpu, threads) are honored — " +
|
|
82
121
|
"the primary modelSrc IS the ESRGAN model in that mode and " +
|
|
83
|
-
"`model_src` here is ignored.
|
|
84
|
-
"
|
|
85
|
-
"
|
|
122
|
+
"`model_src` here is ignored. In `mode: 'video'` the entire `upscaler` " +
|
|
123
|
+
"object is ignored. Mode-dependent constraints (e.g. `model_src` " +
|
|
124
|
+
"required in diffusion mode) are enforced by the sdcpp-generation " +
|
|
125
|
+
"plugin at load time, not at the schema layer."),
|
|
86
126
|
});
|
|
87
127
|
export const diffusionStatsSchema = z.object({
|
|
88
128
|
modelLoadMs: z
|
|
@@ -130,6 +170,36 @@ export const diffusionStatsSchema = z.object({
|
|
|
130
170
|
.optional()
|
|
131
171
|
.describe("Seed that produced these outputs (randomized when not supplied by the caller)."),
|
|
132
172
|
});
|
|
173
|
+
export const videoStatsSchema = diffusionStatsSchema.pick({
|
|
174
|
+
modelLoadMs: true,
|
|
175
|
+
generationMs: true,
|
|
176
|
+
totalGenerationMs: true,
|
|
177
|
+
totalWallMs: true,
|
|
178
|
+
totalSteps: true,
|
|
179
|
+
totalGenerations: true,
|
|
180
|
+
totalImages: true,
|
|
181
|
+
totalPixels: true,
|
|
182
|
+
width: true,
|
|
183
|
+
height: true,
|
|
184
|
+
seed: true,
|
|
185
|
+
}).extend({
|
|
186
|
+
totalVideos: z
|
|
187
|
+
.number()
|
|
188
|
+
.optional()
|
|
189
|
+
.describe("Total number of videos produced."),
|
|
190
|
+
totalVideoFrames: z
|
|
191
|
+
.number()
|
|
192
|
+
.optional()
|
|
193
|
+
.describe("Total number of video frames produced."),
|
|
194
|
+
videoFrames: z
|
|
195
|
+
.number()
|
|
196
|
+
.optional()
|
|
197
|
+
.describe("Frame count of the most recent generated video."),
|
|
198
|
+
fps: z
|
|
199
|
+
.number()
|
|
200
|
+
.optional()
|
|
201
|
+
.describe("Frames-per-second metadata for the most recent generated video."),
|
|
202
|
+
});
|
|
133
203
|
export const diffusionStreamResponseSchema = z.object({
|
|
134
204
|
type: z.literal("diffusionStream"),
|
|
135
205
|
step: z.number().optional(),
|
|
@@ -140,6 +210,16 @@ export const diffusionStreamResponseSchema = z.object({
|
|
|
140
210
|
done: z.boolean().optional(),
|
|
141
211
|
stats: diffusionStatsSchema.optional(),
|
|
142
212
|
});
|
|
213
|
+
export const videoStreamResponseSchema = z.object({
|
|
214
|
+
type: z.literal("videoStream"),
|
|
215
|
+
step: z.number().optional(),
|
|
216
|
+
totalSteps: z.number().optional(),
|
|
217
|
+
elapsedMs: z.number().optional(),
|
|
218
|
+
data: z.string().optional(),
|
|
219
|
+
outputIndex: z.number().optional(),
|
|
220
|
+
done: z.boolean().optional(),
|
|
221
|
+
stats: videoStatsSchema.optional(),
|
|
222
|
+
});
|
|
143
223
|
export const diffusionRequestSchema = z.object({
|
|
144
224
|
modelId: z
|
|
145
225
|
.string()
|
|
@@ -181,30 +261,10 @@ export const diffusionRequestSchema = z.object({
|
|
|
181
261
|
.number()
|
|
182
262
|
.optional()
|
|
183
263
|
.describe("Distilled guidance for FLUX models; typical range 1–10, default 3.5"),
|
|
184
|
-
sampling_method:
|
|
185
|
-
.enum([
|
|
186
|
-
"euler",
|
|
187
|
-
"euler_a",
|
|
188
|
-
"heun",
|
|
189
|
-
"dpm2",
|
|
190
|
-
"dpm++2m",
|
|
191
|
-
"dpm++2mv2",
|
|
192
|
-
"dpm++2s_a",
|
|
193
|
-
"lcm",
|
|
194
|
-
"ipndm",
|
|
195
|
-
"ipndm_v",
|
|
196
|
-
"ddim_trailing",
|
|
197
|
-
"tcd",
|
|
198
|
-
"res_multistep",
|
|
199
|
-
"res_2s",
|
|
200
|
-
])
|
|
264
|
+
sampling_method: samplingMethodSchema
|
|
201
265
|
.optional()
|
|
202
266
|
.describe("Sampling algorithm used by the diffusion scheduler."),
|
|
203
|
-
scheduler:
|
|
204
|
-
.enum([
|
|
205
|
-
"discrete", "karras", "exponential", "ays", "gits",
|
|
206
|
-
"sgm_uniform", "simple", "lcm", "smoothstep", "kl_optimal", "bong_tangent",
|
|
207
|
-
])
|
|
267
|
+
scheduler: scheduleTypeSchema
|
|
208
268
|
.optional()
|
|
209
269
|
.describe("Noise schedule to apply when sampling."),
|
|
210
270
|
seed: z
|
|
@@ -226,13 +286,10 @@ export const diffusionRequestSchema = z.object({
|
|
|
226
286
|
.string()
|
|
227
287
|
.optional()
|
|
228
288
|
.describe("Optional name of a cached sampler preset to reuse."),
|
|
229
|
-
init_image:
|
|
230
|
-
.string()
|
|
231
|
-
.min(1)
|
|
232
|
-
.regex(BASE64_PATTERN)
|
|
289
|
+
init_image: base64StringSchema
|
|
233
290
|
.optional()
|
|
234
291
|
.describe("Base64-encoded image for img2img generation. Mutually exclusive with init_images."),
|
|
235
|
-
init_images: z.array(
|
|
292
|
+
init_images: z.array(base64StringSchema)
|
|
236
293
|
.min(1)
|
|
237
294
|
.optional()
|
|
238
295
|
.describe("FLUX.2-only multi-reference fusion: array of base64-encoded PNG/JPEG buffers. " +
|
|
@@ -287,6 +344,142 @@ export const diffusionRequestSchema = z.object({
|
|
|
287
344
|
export const diffusionStreamRequestSchema = diffusionRequestSchema.extend({
|
|
288
345
|
type: z.literal("diffusionStream"),
|
|
289
346
|
});
|
|
347
|
+
export const videoRequestSchema = z.object({
|
|
348
|
+
modelId: z
|
|
349
|
+
.string()
|
|
350
|
+
.describe("The identifier of the loaded video model to use for generation. " +
|
|
351
|
+
"On React Native, prefer a `modelId` loaded with a `delegate` because " +
|
|
352
|
+
"the video diffusion models currently shipped by the SDK are too " +
|
|
353
|
+
"large to load on typical mobile devices."),
|
|
354
|
+
requestId: z
|
|
355
|
+
.string()
|
|
356
|
+
.min(1)
|
|
357
|
+
.optional()
|
|
358
|
+
.describe("Stable identifier for this in-flight video generation. Optional on the wire — the server falls back to a server-generated id when the field is missing."),
|
|
359
|
+
mode: z
|
|
360
|
+
.enum(["txt2vid"])
|
|
361
|
+
.describe("Video generation mode. Only `txt2vid` is supported today."),
|
|
362
|
+
prompt: z.string().describe("Positive prompt describing the video to generate."),
|
|
363
|
+
negative_prompt: z
|
|
364
|
+
.string()
|
|
365
|
+
.optional()
|
|
366
|
+
.describe("Optional negative prompt describing what to avoid."),
|
|
367
|
+
width: z
|
|
368
|
+
.number()
|
|
369
|
+
.int()
|
|
370
|
+
.positive()
|
|
371
|
+
.multipleOf(8)
|
|
372
|
+
.optional()
|
|
373
|
+
.describe("Video width in pixels (must be a multiple of 8)."),
|
|
374
|
+
height: z
|
|
375
|
+
.number()
|
|
376
|
+
.int()
|
|
377
|
+
.positive()
|
|
378
|
+
.multipleOf(8)
|
|
379
|
+
.optional()
|
|
380
|
+
.describe("Video height in pixels (must be a multiple of 8)."),
|
|
381
|
+
video_frames: z
|
|
382
|
+
.number()
|
|
383
|
+
.int()
|
|
384
|
+
.refine((value) => value >= 5 && (value - 1) % 4 === 0, {
|
|
385
|
+
message: "video_frames must be an integer >= 5 of the form (4*k + 1)",
|
|
386
|
+
})
|
|
387
|
+
.optional()
|
|
388
|
+
.describe("Frame count for the generated video; must satisfy (4*k + 1), where k>=1."),
|
|
389
|
+
fps: z
|
|
390
|
+
.number()
|
|
391
|
+
.positive()
|
|
392
|
+
.max(120)
|
|
393
|
+
.optional()
|
|
394
|
+
.describe("AVI framerate metadata in frames per second; must be in (0, 120]."),
|
|
395
|
+
seed: z
|
|
396
|
+
.number()
|
|
397
|
+
.int()
|
|
398
|
+
.optional()
|
|
399
|
+
.describe("Random seed; when omitted the SDK picks one and returns it in stats."),
|
|
400
|
+
steps: z
|
|
401
|
+
.number()
|
|
402
|
+
.int()
|
|
403
|
+
.positive()
|
|
404
|
+
.optional()
|
|
405
|
+
.describe("Low-noise or single-expert denoising step count."),
|
|
406
|
+
sampling_method: samplingMethodSchema
|
|
407
|
+
.optional()
|
|
408
|
+
.describe("Sampling algorithm used by the low-noise diffusion scheduler."),
|
|
409
|
+
scheduler: scheduleTypeSchema
|
|
410
|
+
.optional()
|
|
411
|
+
.describe("Noise schedule to apply for the low-noise diffusion path."),
|
|
412
|
+
cfg_scale: z
|
|
413
|
+
.number()
|
|
414
|
+
.optional()
|
|
415
|
+
.describe("Classifier-free guidance scale."),
|
|
416
|
+
flow_shift: z
|
|
417
|
+
.number()
|
|
418
|
+
.optional()
|
|
419
|
+
.describe("Per-request flow-matching guidance shift override."),
|
|
420
|
+
high_noise_steps: z
|
|
421
|
+
.number()
|
|
422
|
+
.int()
|
|
423
|
+
.positive()
|
|
424
|
+
.optional()
|
|
425
|
+
.describe("Wan 2.2 high-noise expert step count."),
|
|
426
|
+
high_noise_sampler: samplingMethodSchema
|
|
427
|
+
.optional()
|
|
428
|
+
.describe("Wan 2.2 high-noise expert sampler."),
|
|
429
|
+
high_noise_scheduler: scheduleTypeSchema
|
|
430
|
+
.optional()
|
|
431
|
+
.describe("Wan 2.2 high-noise expert scheduler."),
|
|
432
|
+
high_noise_cfg_scale: z
|
|
433
|
+
.number()
|
|
434
|
+
.optional()
|
|
435
|
+
.describe("Wan 2.2 high-noise expert CFG scale."),
|
|
436
|
+
high_noise_flow_shift: z
|
|
437
|
+
.number()
|
|
438
|
+
.optional()
|
|
439
|
+
.describe("Wan 2.2 high-noise expert flow shift override."),
|
|
440
|
+
moe_boundary: z
|
|
441
|
+
.number()
|
|
442
|
+
.min(0)
|
|
443
|
+
.max(1)
|
|
444
|
+
.optional()
|
|
445
|
+
.describe("Wan 2.2 mixture-of-experts boundary in [0, 1]."),
|
|
446
|
+
vace_strength: z
|
|
447
|
+
.number()
|
|
448
|
+
.min(0)
|
|
449
|
+
.max(1)
|
|
450
|
+
.optional()
|
|
451
|
+
.describe("Control-frame guidance strength."),
|
|
452
|
+
control_frames: z.array(base64StringSchema)
|
|
453
|
+
.min(1)
|
|
454
|
+
.optional()
|
|
455
|
+
.describe("Optional array of base64-encoded control-frame images."),
|
|
456
|
+
vae_tiling: z
|
|
457
|
+
.boolean()
|
|
458
|
+
.optional()
|
|
459
|
+
.describe("Enable VAE tiling for large videos on constrained VRAM."),
|
|
460
|
+
vae_tile_size: z
|
|
461
|
+
.union([z.number().positive(), z.string().min(1)])
|
|
462
|
+
.optional()
|
|
463
|
+
.describe("VAE tile size override."),
|
|
464
|
+
vae_tile_overlap: z
|
|
465
|
+
.number()
|
|
466
|
+
.optional()
|
|
467
|
+
.describe("VAE tile overlap override."),
|
|
468
|
+
cache_mode: cacheModeSchema
|
|
469
|
+
.optional()
|
|
470
|
+
.describe("Step-caching algorithm."),
|
|
471
|
+
cache_preset: z
|
|
472
|
+
.string()
|
|
473
|
+
.optional()
|
|
474
|
+
.describe("Optional name of a cached sampler preset to reuse."),
|
|
475
|
+
cache_threshold: z
|
|
476
|
+
.number()
|
|
477
|
+
.optional()
|
|
478
|
+
.describe("Direct cache reuse threshold override."),
|
|
479
|
+
});
|
|
480
|
+
export const videoStreamRequestSchema = videoRequestSchema.extend({
|
|
481
|
+
type: z.literal("videoStream"),
|
|
482
|
+
});
|
|
290
483
|
// ============================================
|
|
291
484
|
// Standalone ESRGAN upscale (mode: "upscale")
|
|
292
485
|
// ============================================
|
|
@@ -325,6 +518,12 @@ export const upscaleStatsSchema = z.object({
|
|
|
325
518
|
.number()
|
|
326
519
|
.optional()
|
|
327
520
|
.describe("Number of ESRGAN passes used by the most recent upscale job."),
|
|
521
|
+
backendDevice: z
|
|
522
|
+
.enum(["cpu", "gpu"])
|
|
523
|
+
.optional()
|
|
524
|
+
.describe("Actual compute device used by the ESRGAN upscaler. " +
|
|
525
|
+
"Reflects the backend stable-diffusion.cpp selected (e.g. Android `gpu` " +
|
|
526
|
+
"falls back to `cpu` because the mobile GPU/OpenCL path is unstable)."),
|
|
328
527
|
});
|
|
329
528
|
export const upscaleRequestSchema = z.object({
|
|
330
529
|
modelId: z
|