@qvac/inference 0.22.0 → 0.24.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 +111 -60
- package/README.md +4 -2
- package/dist/api/assess-model-fit.d.ts +14 -14
- package/dist/api/assess-model-fit.js +14 -14
- package/dist/api/audio-gen.d.ts +2 -2
- package/dist/api/audio-gen.js +136 -45
- package/dist/api/batch-completion.js +2 -1
- package/dist/api/calc-tokens.d.ts +30 -0
- package/dist/api/calc-tokens.js +41 -0
- package/dist/api/classify.d.ts +5 -2
- package/dist/api/classify.js +5 -2
- package/dist/api/completion-stream.d.ts +2 -1
- package/dist/api/completion-stream.js +4 -1
- package/dist/api/decide.js +1 -1
- package/dist/api/delete-cache.d.ts +7 -1
- package/dist/api/delete-cache.js +11 -1
- package/dist/api/diffusion.d.ts +32 -2
- package/dist/api/diffusion.js +32 -2
- package/dist/api/download-asset.js +1 -1
- package/dist/api/embed.d.ts +82 -29
- package/dist/api/embed.js +64 -18
- package/dist/api/finetune.js +1 -1
- package/dist/api/get-model-info.d.ts +1 -1
- package/dist/api/index.d.ts +40 -38
- package/dist/api/index.js +39 -37
- package/dist/api/load-model.js +2 -2
- package/dist/api/logging-stream-registry.js +11 -7
- package/dist/api/logging-stream.d.ts +11 -1
- package/dist/api/logging-stream.js +11 -2
- package/dist/api/rag.d.ts +1 -1
- package/dist/api/rag.js +1 -1
- package/dist/api/registry.d.ts +18 -7
- package/dist/api/registry.js +37 -13
- package/dist/api/rerank.d.ts +17 -0
- package/dist/api/rerank.js +36 -0
- package/dist/api/subscribe-logs.js +5 -3
- package/dist/api/text-to-speech.d.ts +14 -5
- package/dist/api/text-to-speech.js +83 -29
- package/dist/api/transcribe.d.ts +6 -2
- package/dist/api/transcribe.js +7 -1
- package/dist/api/unload-model.js +1 -1
- package/dist/api/vector-index.d.ts +25 -3
- package/dist/api/vector-index.js +17 -2
- package/dist/api/video-request.d.ts +15 -15
- package/dist/api/video.js +1 -1
- package/dist/api/vla.js +1 -1
- package/dist/api/world-result.js +1 -1
- package/dist/api/world.d.ts +1 -1
- package/dist/api/world.js +1 -1
- package/dist/config/resolve-config.d.ts +1 -1
- package/dist/config/resolve-config.js +1 -1
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +2 -2
- package/dist/dispatch.d.ts +11 -4
- package/dist/dispatch.js +80 -18
- package/dist/engine.d.ts +1 -1
- package/dist/errors/index.d.ts +76 -0
- package/dist/errors/index.js +141 -1
- package/dist/handlers/assess-model-fit.d.ts +3 -21
- package/dist/handlers/assess-model-fit.js +4 -303
- package/dist/handlers/cancelHandler.d.ts +10 -9
- package/dist/handlers/cancelHandler.js +18 -14
- package/dist/handlers/completion-orchestrate.d.ts +14 -2
- package/dist/handlers/completion-orchestrate.js +166 -24
- package/dist/handlers/delete-cache.d.ts +2 -1
- package/dist/handlers/delete-cache.js +6 -1
- package/dist/handlers/download-asset.js +13 -6
- package/dist/handlers/finetune.js +1 -1
- package/dist/handlers/get-loaded-model-info.js +3 -3
- package/dist/handlers/get-model-info.js +72 -3
- package/dist/handlers/load-model/coreml-sidecars.d.ts +15 -11
- package/dist/handlers/load-model/coreml-sidecars.js +51 -91
- package/dist/handlers/load-model/download-lock.d.ts +20 -0
- package/dist/handlers/load-model/download-lock.js +213 -0
- package/dist/handlers/load-model/download-manager.d.ts +11 -3
- package/dist/handlers/load-model/download-manager.js +62 -11
- package/dist/handlers/load-model/download-stats.d.ts +2 -2
- package/dist/handlers/load-model/download-stats.js +3 -3
- package/dist/handlers/load-model/handler.js +97 -41
- package/dist/handlers/load-model/http-verify.d.ts +1 -1
- package/dist/handlers/load-model/http.d.ts +1 -1
- package/dist/handlers/load-model/http.js +330 -208
- package/dist/handlers/load-model/hyperdrive.d.ts +16 -1
- package/dist/handlers/load-model/hyperdrive.js +125 -52
- package/dist/handlers/load-model/index.d.ts +2 -2
- package/dist/handlers/load-model/index.js +2 -2
- package/dist/handlers/load-model/registry-client-options.d.ts +2 -0
- package/dist/handlers/load-model/registry-client-options.js +4 -2
- package/dist/handlers/load-model/registry-companion-set.d.ts +6 -1
- package/dist/handlers/load-model/registry-companion-set.js +20 -2
- package/dist/handlers/load-model/registry-delete.d.ts +5 -0
- package/dist/handlers/load-model/registry-delete.js +269 -0
- package/dist/handlers/load-model/registry-download-utils.d.ts +7 -5
- package/dist/handlers/load-model/registry-download-utils.js +95 -24
- package/dist/handlers/load-model/registry.d.ts +22 -2
- package/dist/handlers/load-model/registry.js +312 -179
- package/dist/handlers/load-model/resolve-session.d.ts +1 -1
- package/dist/handlers/load-model/resolve-session.js +11 -3
- package/dist/handlers/load-model/resolve.d.ts +1 -1
- package/dist/handlers/load-model/resolve.js +9 -6
- package/dist/handlers/load-model/types.d.ts +2 -0
- package/dist/handlers/logging-stream.d.ts +2 -1
- package/dist/handlers/logging-stream.js +35 -7
- package/dist/handlers/plugin-invoke.js +152 -39
- package/dist/handlers/registry.d.ts +2 -2
- package/dist/handlers/registry.js +108 -29
- package/dist/handlers/rpc-server.js +7 -7
- package/dist/handlers/session.d.ts +11 -0
- package/dist/handlers/session.js +40 -0
- package/dist/handlers/types.d.ts +7 -1
- package/dist/handlers/unload-model.js +8 -3
- package/dist/handlers/vector-index.js +118 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/logging/addon.d.ts +1 -1
- package/dist/logging/addon.js +1 -1
- package/dist/logging/index.d.ts +5 -5
- package/dist/logging/index.js +4 -4
- package/dist/logging/logger.d.ts +1 -1
- package/dist/logging/logger.js +3 -3
- package/dist/logging/utils.js +11 -3
- package/dist/model-cache-layout.d.ts +1 -0
- package/dist/model-cache-layout.js +2 -0
- package/dist/model-fit/assess.d.ts +23 -0
- package/dist/model-fit/assess.js +110 -0
- package/dist/model-fit/describe.d.ts +12 -0
- package/dist/model-fit/describe.js +29 -0
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.d.ts → model-fit/description/fetch.d.ts} +2 -2
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.js → model-fit/description/fetch.js} +98 -19
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.d.ts → model-fit/description/resolve-load.d.ts} +8 -6
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.js → model-fit/description/resolve-load.js} +20 -20
- package/dist/model-fit/fit-load.d.ts +23 -0
- package/dist/model-fit/fit-load.js +29 -0
- package/dist/model-fit/load-check.d.ts +34 -0
- package/dist/model-fit/load-check.js +77 -0
- package/dist/model-fit/run/engine.d.ts +12 -0
- package/dist/model-fit/run/engine.js +9 -0
- package/dist/model-fit/run/run.d.ts +46 -0
- package/dist/model-fit/run/run.js +208 -0
- package/dist/model-fit/sum.d.ts +32 -0
- package/dist/model-fit/sum.js +60 -0
- package/dist/models/registry/index.d.ts +1 -1
- package/dist/models/registry/index.js +2 -2
- package/dist/models/registry/models.d.ts +1377 -130
- package/dist/models/registry/models.js +3622 -2312
- package/dist/plugins/builtin/asr-ggml/config.d.ts +19 -4
- package/dist/plugins/builtin/asr-ggml/config.js +39 -3
- package/dist/plugins/builtin/asr-ggml/fit.d.ts +18 -0
- package/dist/plugins/builtin/asr-ggml/fit.js +118 -0
- package/dist/plugins/builtin/audiogen-ggml/config.d.ts +6 -0
- package/dist/plugins/builtin/audiogen-ggml/config.js +9 -0
- package/dist/plugins/builtin/audiogen-ggml/fit.d.ts +3 -0
- package/dist/{resources/model-fit/native-probe/engines/audiogen.js → plugins/builtin/audiogen-ggml/fit.js} +28 -18
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +4 -3
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-encode.d.ts +17 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-encode.js +68 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.d.ts +11 -3
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.js +47 -11
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +4 -3
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +4 -3
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +203 -72
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +17 -5
- package/dist/plugins/builtin/bci-whispercpp-transcription/fit.d.ts +3 -0
- package/dist/plugins/builtin/bci-whispercpp-transcription/fit.js +22 -0
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +71 -29
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +12 -10
- package/dist/plugins/builtin/ggml-classification/plugin.d.ts +8 -5
- package/dist/plugins/builtin/ggml-classification/plugin.js +89 -9
- package/dist/plugins/builtin/ggml-image-embedding/ops/embed.d.ts +24 -0
- package/dist/plugins/builtin/ggml-image-embedding/ops/embed.js +184 -0
- package/dist/plugins/builtin/ggml-image-embedding/plugin.d.ts +120 -0
- package/dist/plugins/builtin/ggml-image-embedding/plugin.js +39 -0
- package/dist/plugins/builtin/ggml-ocr/fit.d.ts +6 -0
- package/dist/plugins/builtin/ggml-ocr/fit.js +19 -0
- package/dist/plugins/builtin/ggml-ocr/params.d.ts +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +20 -13
- package/dist/plugins/builtin/ggml-ocr/plugin.js +111 -25
- package/dist/plugins/builtin/ggml-vla/ops/vla-run.d.ts +2 -2
- package/dist/plugins/builtin/ggml-vla/ops/vla-run.js +18 -2
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +15 -15
- package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
- package/dist/plugins/builtin/index.d.ts +16 -14
- package/dist/plugins/builtin/index.js +16 -14
- package/dist/plugins/builtin/llamacpp-completion/fit.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-completion/fit.js +28 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +6 -8
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.js +15 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/calc-tokens.d.ts +2 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/calc-tokens.js +32 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +3 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +6 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +18 -3
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +94 -21
- package/dist/plugins/builtin/llamacpp-completion/ops/finetune.d.ts +5 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/finetune.js +54 -19
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +5 -3
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +9 -7
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +315 -95
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +51 -25
- package/dist/plugins/builtin/llamacpp-completion/transform.js +4 -0
- package/dist/plugins/builtin/llamacpp-decision/helpers.d.ts +0 -1
- package/dist/plugins/builtin/llamacpp-decision/helpers.js +7 -15
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.d.ts +3 -1
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +6 -3
- package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +43 -35
- package/dist/plugins/builtin/llamacpp-decision/plugin.js +4 -3
- package/dist/plugins/builtin/llamacpp-embedding/fit.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-embedding/fit.js +23 -0
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +201 -10
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +52 -16
- package/dist/plugins/builtin/llamacpp-embedding/transform.d.ts +2 -2
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +29 -2
- package/dist/plugins/builtin/llamacpp-rerank/helpers.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-rerank/helpers.js +16 -0
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.d.ts +7 -0
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.js +120 -0
- package/dist/plugins/builtin/llamacpp-rerank/plugin.d.ts +92 -0
- package/dist/plugins/builtin/llamacpp-rerank/plugin.js +44 -0
- package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +46 -19
- package/dist/plugins/builtin/moss-transcribe/plugin.js +9 -7
- package/dist/plugins/builtin/nmtcpp-translation/fit.d.ts +3 -0
- package/dist/plugins/builtin/nmtcpp-translation/fit.js +11 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +32 -18
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +8 -6
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +234 -38
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +42 -16
- package/dist/plugins/builtin/sdcpp-generation/fit.d.ts +3 -0
- package/dist/plugins/builtin/sdcpp-generation/fit.js +68 -0
- package/dist/plugins/builtin/sdcpp-generation/load-files.d.ts +30 -0
- package/dist/plugins/builtin/sdcpp-generation/load-files.js +121 -0
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.d.ts +8 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.js +174 -53
- package/dist/plugins/builtin/sdcpp-generation/ops/upscale.d.ts +4 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/upscale.js +107 -22
- package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +7 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +23 -9
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +6 -4
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +8 -3
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +166 -47
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +67 -155
- package/dist/plugins/builtin/sdcpp-generation/upscaler-config.d.ts +15 -0
- package/dist/plugins/builtin/sdcpp-generation/upscaler-config.js +19 -0
- package/dist/plugins/builtin/sdcpp-generation/world-config.d.ts +8 -0
- package/dist/plugins/builtin/sdcpp-generation/world-config.js +9 -0
- package/dist/plugins/builtin/tts-ggml/fit.d.ts +3 -0
- package/dist/plugins/builtin/tts-ggml/fit.js +162 -0
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.d.ts +2 -1
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.js +4 -1
- package/dist/plugins/builtin/tts-ggml/ops/moss-options.d.ts +1 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +3 -2
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +24 -11
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.d.ts +2 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +53 -18
- package/dist/plugins/builtin/tts-ggml/ops/voice-options.d.ts +50 -0
- package/dist/plugins/builtin/tts-ggml/ops/voice-options.js +74 -0
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +415 -57
- package/dist/plugins/builtin/tts-ggml/plugin.js +183 -34
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +104 -40
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +12 -10
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/ops/bci-transcribe.d.ts +5 -4
- package/dist/plugins/ops/bci-transcribe.js +18 -4
- package/dist/plugins/ops/cancel.d.ts +1 -0
- package/dist/plugins/ops/cancel.js +11 -2
- package/dist/plugins/ops/embed.d.ts +5 -3
- package/dist/plugins/ops/embed.js +89 -34
- package/dist/plugins/ops/kv-cache-utils.d.ts +5 -3
- package/dist/plugins/ops/kv-cache-utils.js +21 -10
- package/dist/plugins/ops/load-model.d.ts +10 -2
- package/dist/plugins/ops/load-model.js +45 -19
- package/dist/plugins/ops/transcribe.d.ts +5 -4
- package/dist/plugins/ops/transcribe.js +63 -28
- package/dist/plugins/ops/translate.d.ts +2 -1
- package/dist/plugins/ops/translate.js +7 -4
- package/dist/plugins/ops/unload-model.d.ts +17 -1
- package/dist/plugins/ops/unload-model.js +32 -3
- package/dist/plugins/turbovec-backend.d.ts +1 -1
- package/dist/plugins/turbovec-backend.js +21 -6
- package/dist/profiling/aggregator.d.ts +1 -1
- package/dist/profiling/aggregator.js +1 -1
- package/dist/profiling/controller.d.ts +1 -1
- package/dist/profiling/controller.js +2 -2
- package/dist/profiling/events.d.ts +1 -1
- package/dist/profiling/events.js +2 -2
- package/dist/profiling/exporters.d.ts +1 -1
- package/dist/profiling/exporters.js +3 -3
- package/dist/profiling/index.d.ts +13 -13
- package/dist/profiling/index.js +12 -12
- package/dist/profiling/operation-metrics.d.ts +1 -1
- package/dist/profiling/operation-metrics.js +24 -21
- package/dist/profiling/operation-wrappers.js +3 -3
- package/dist/profiling/profiler.js +1 -1
- package/dist/rag/embedding-scope.d.ts +16 -0
- package/dist/rag/embedding-scope.js +81 -0
- package/dist/rag/handler.d.ts +25 -0
- package/dist/rag/handler.js +51 -17
- package/dist/rag/handlers/close-workspace.js +1 -1
- package/dist/rag/handlers/delete-embeddings.js +1 -1
- package/dist/rag/handlers/delete-workspace.js +1 -1
- package/dist/rag/handlers/ingest.js +3 -7
- package/dist/rag/handlers/list-workspaces.d.ts +1 -1
- package/dist/rag/handlers/list-workspaces.js +1 -1
- package/dist/rag/handlers/reindex.js +1 -1
- package/dist/rag/handlers/save-embeddings.js +1 -1
- package/dist/rag/handlers/search.d.ts +10 -1
- package/dist/rag/handlers/search.js +17 -8
- package/dist/rag/index.d.ts +11 -11
- package/dist/rag/index.js +11 -11
- package/dist/rag/rag-operation-manager.d.ts +27 -3
- package/dist/rag/rag-operation-manager.js +10 -27
- package/dist/rag/rag-workspace-manager.js +1 -1
- package/dist/registry.js +7 -1
- package/dist/resources/collector.d.ts +71 -37
- package/dist/resources/collector.js +9 -2
- package/dist/resources/instance.d.ts +1 -1
- package/dist/resources/instance.js +1 -1
- package/dist/resources/native.d.ts +1 -1
- package/dist/resources/normalize.d.ts +1 -1
- package/dist/resources/types.d.ts +2 -0
- package/dist/rpc/inventory.js +1 -12
- package/dist/runtime/env.d.ts +5 -1
- package/dist/runtime/env.js +6 -21
- package/dist/runtime/index.d.ts +8 -5
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/lifecycle.d.ts +6 -4
- package/dist/runtime/lifecycle.js +16 -12
- package/dist/runtime/model-config-utils.js +8 -1
- package/dist/runtime/model-registry.d.ts +30 -4
- package/dist/runtime/model-registry.js +48 -2
- package/dist/runtime/model-work-lock.d.ts +13 -0
- package/dist/runtime/model-work-lock.js +48 -0
- package/dist/runtime/registry-client.d.ts +47 -1
- package/dist/runtime/registry-client.js +446 -88
- package/dist/runtime/request-context.d.ts +11 -3
- package/dist/runtime/request-context.js +39 -2
- package/dist/runtime/request-registry.d.ts +56 -8
- package/dist/runtime/request-registry.js +190 -72
- package/dist/runtime/runtime-lifecycle.js +10 -1
- package/dist/runtime/session-id.d.ts +18 -0
- package/dist/runtime/session-id.js +20 -0
- package/dist/runtime/session-registry.d.ts +39 -0
- package/dist/runtime/session-registry.js +114 -0
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/vector-index-backend.d.ts +6 -2
- package/dist/runtime/vector-index-registry.d.ts +26 -5
- package/dist/runtime/vector-index-registry.js +88 -27
- package/dist/schemas/abort-signal.d.ts +8 -0
- package/dist/schemas/assess-model-fit.d.ts +138 -282
- package/dist/schemas/assess-model-fit.js +85 -219
- package/dist/schemas/audio-gen.d.ts +291 -25
- package/dist/schemas/audio-gen.js +130 -26
- package/dist/schemas/batch-completion-stream.d.ts +113 -15
- package/dist/schemas/batch-completion-stream.js +10 -6
- package/dist/schemas/bci-config.d.ts +3 -1
- package/dist/schemas/bci-config.js +2 -2
- package/dist/schemas/bci.d.ts +55 -4
- package/dist/schemas/bci.js +13 -18
- package/dist/schemas/calc-tokens.d.ts +141 -0
- package/dist/schemas/calc-tokens.js +53 -0
- package/dist/schemas/cancel.d.ts +31 -0
- package/dist/schemas/cancel.js +11 -2
- package/dist/schemas/classification.d.ts +3 -0
- package/dist/schemas/classification.js +6 -2
- package/dist/schemas/common.d.ts +2209 -348
- package/dist/schemas/common.js +52 -33
- package/dist/schemas/completion-event.d.ts +11 -2
- package/dist/schemas/completion-event.js +5 -2
- package/dist/schemas/completion-stream.d.ts +173 -19
- package/dist/schemas/completion-stream.js +117 -20
- package/dist/schemas/config.d.ts +2064 -178
- package/dist/schemas/config.js +21 -23
- package/dist/schemas/decision.d.ts +12 -2
- package/dist/schemas/decision.js +16 -1
- package/dist/schemas/download-asset.d.ts +13 -6
- package/dist/schemas/download-asset.js +4 -7
- package/dist/schemas/embed.d.ts +286 -3
- package/dist/schemas/embed.js +162 -16
- package/dist/schemas/engine-addon-map.d.ts +3 -1
- package/dist/schemas/engine-addon-map.js +5 -3
- package/dist/schemas/errors.d.ts +13 -0
- package/dist/schemas/errors.js +71 -1
- package/dist/schemas/finetune.d.ts +14 -4
- package/dist/schemas/finetune.js +5 -6
- package/dist/schemas/heartbeat.d.ts +1 -0
- package/dist/schemas/heartbeat.js +5 -2
- package/dist/schemas/image-embedding.d.ts +27 -0
- package/dist/schemas/image-embedding.js +107 -0
- package/dist/schemas/index.d.ts +55 -50
- package/dist/schemas/index.js +54 -49
- package/dist/schemas/lifecycle.d.ts +3 -0
- package/dist/schemas/lifecycle.js +13 -6
- package/dist/schemas/llamacpp-config.d.ts +443 -20
- package/dist/schemas/llamacpp-config.js +188 -14
- package/dist/schemas/load-model.d.ts +8940 -1952
- package/dist/schemas/load-model.js +73 -9
- package/dist/schemas/logging-stream.d.ts +1 -0
- package/dist/schemas/logging-stream.js +5 -2
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-config-schemas.d.ts +731 -111
- package/dist/schemas/model-config-schemas.js +16 -12
- package/dist/schemas/model-fit-policy.d.ts +2 -2
- package/dist/schemas/model-info.d.ts +54 -56
- package/dist/schemas/model-info.js +18 -7
- package/dist/schemas/model-ops.d.ts +12 -0
- package/dist/schemas/model-ops.js +33 -5
- package/dist/schemas/model-src-utils.d.ts +14 -6
- package/dist/schemas/model-src-utils.js +2 -2
- package/dist/schemas/model-types.d.ts +12 -4
- package/dist/schemas/model-types.js +2 -0
- package/dist/schemas/ocr.d.ts +11 -4
- package/dist/schemas/ocr.js +7 -3
- package/dist/schemas/plugin.d.ts +70 -8
- package/dist/schemas/plugin.js +32 -4
- package/dist/schemas/profiling.d.ts +32 -32
- package/dist/schemas/profiling.js +1 -1
- package/dist/schemas/rag.d.ts +9 -0
- package/dist/schemas/rag.js +11 -17
- package/dist/schemas/registry.d.ts +38 -10
- package/dist/schemas/registry.js +16 -7
- package/dist/schemas/reload-config.d.ts +45 -6
- package/dist/schemas/reload-config.js +13 -6
- package/dist/schemas/request-base.d.ts +39 -0
- package/dist/schemas/request-base.js +64 -0
- package/dist/schemas/rerank.d.ts +132 -0
- package/dist/schemas/rerank.js +104 -0
- package/dist/schemas/rpc-server.d.ts +3 -0
- package/dist/schemas/rpc-server.js +15 -15
- package/dist/schemas/sdcpp-config.d.ts +144 -18
- package/dist/schemas/sdcpp-config.js +123 -28
- package/dist/schemas/session.d.ts +37 -0
- package/dist/schemas/session.js +53 -0
- package/dist/schemas/system-resources.d.ts +364 -179
- package/dist/schemas/system-resources.js +8 -3
- package/dist/schemas/text-to-speech.d.ts +1408 -275
- package/dist/schemas/text-to-speech.js +547 -33
- package/dist/schemas/tools.d.ts +7 -0
- package/dist/schemas/tools.js +29 -0
- package/dist/schemas/transcription-config.d.ts +267 -2
- package/dist/schemas/transcription-config.js +138 -7
- package/dist/schemas/transcription.d.ts +94 -7
- package/dist/schemas/transcription.js +99 -22
- package/dist/schemas/translate.d.ts +4 -2
- package/dist/schemas/translate.js +6 -10
- package/dist/schemas/translation-config.d.ts +40 -20
- package/dist/schemas/translation-config.js +1 -1
- package/dist/schemas/tts-pcm.d.ts +35 -0
- package/dist/schemas/tts-pcm.js +69 -0
- package/dist/schemas/vector-index.d.ts +47 -1
- package/dist/schemas/vector-index.js +37 -10
- package/dist/schemas/vla.d.ts +3 -3
- package/dist/surface.d.ts +4 -3
- package/dist/surface.js +4 -3
- package/dist/utils/addon-responses.d.ts +71 -2
- package/dist/utils/aggregate-events.d.ts +1 -1
- package/dist/utils/aggregate-events.js +2 -2
- package/dist/utils/archive.d.ts +7 -0
- package/dist/utils/archive.js +89 -30
- package/dist/utils/asr-events.d.ts +5 -0
- package/dist/utils/asr-events.js +10 -1
- package/dist/utils/audio/decoder.js +3 -1
- package/dist/utils/audio-input.js +1 -1
- package/dist/utils/cache/auto-history.d.ts +2 -1
- package/dist/utils/cache/auto-history.js +5 -3
- package/dist/utils/cache/layout.d.ts +48 -0
- package/dist/utils/cache/layout.js +190 -0
- package/dist/utils/cache/paths.js +8 -10
- package/dist/utils/cache/types.d.ts +2 -1
- package/dist/utils/checksum.d.ts +7 -0
- package/dist/utils/checksum.js +59 -2
- package/dist/utils/completion-normalizer.js +287 -88
- package/dist/utils/gguf-architecture.d.ts +7 -0
- package/dist/utils/gguf-architecture.js +142 -0
- package/dist/utils/gguf-tensor-extractor.d.ts +0 -6
- package/dist/utils/gguf-tensor-extractor.js +1 -50
- package/dist/utils/index.d.ts +13 -13
- package/dist/utils/index.js +13 -13
- package/dist/utils/mcp-adapter.d.ts +1 -1
- package/dist/utils/mcp-adapter.js +1 -1
- package/dist/utils/path-security.js +1 -1
- package/dist/utils/shard-utils.d.ts +0 -16
- package/dist/utils/shard-utils.js +14 -48
- package/dist/utils/tool-integration.d.ts +3 -2
- package/dist/utils/tool-integration.js +3 -6
- package/dist/utils/tools/defer.d.ts +50 -31
- package/dist/utils/tools/defer.js +115 -51
- package/dist/utils/tools/dialect.d.ts +15 -4
- package/dist/utils/tools/dialect.js +34 -5
- package/dist/utils/tools/index.d.ts +3 -3
- package/dist/utils/tools/index.js +3 -3
- package/dist/utils/tools/parser.js +8 -8
- package/dist/utils/tools/parsers/dsml.d.ts +1 -1
- package/dist/utils/tools/parsers/dsml.js +1 -1
- package/dist/utils/tools/parsers/gemma4native.d.ts +1 -1
- package/dist/utils/tools/parsers/gemma4native.js +1 -1
- package/dist/utils/tools/parsers/harmony.d.ts +1 -1
- package/dist/utils/tools/parsers/harmony.js +1 -1
- package/dist/utils/tools/parsers/hermes.d.ts +1 -1
- package/dist/utils/tools/parsers/hermes.js +1 -1
- package/dist/utils/tools/parsers/json.d.ts +1 -1
- package/dist/utils/tools/parsers/json.js +1 -1
- package/dist/utils/tools/parsers/pythonic.d.ts +1 -1
- package/dist/utils/tools/parsers/pythonic.js +1 -1
- package/dist/utils/tools/parsers/qwen35.d.ts +1 -1
- package/dist/utils/tools/parsers/qwen35.js +1 -1
- package/dist/utils/transcribe-metadata.d.ts +28 -2
- package/dist/utils/transcribe-metadata.js +16 -0
- package/dist/utils/tts-stats.d.ts +43 -1
- package/dist/utils/tts-stats.js +120 -22
- package/dist/utils/until-aborted.d.ts +7 -0
- package/dist/utils/until-aborted.js +34 -0
- package/package.json +67 -55
- package/dist/models/registry/resource-profiles.d.ts +0 -17
- package/dist/models/registry/resource-profiles.js +0 -5657
- package/dist/resources/model-fit/assess.d.ts +0 -72
- package/dist/resources/model-fit/assess.js +0 -679
- package/dist/resources/model-fit/fit-stub/project-fit-from-load.d.ts +0 -27
- package/dist/resources/model-fit/fit-stub/project-fit-from-load.js +0 -33
- package/dist/resources/model-fit/floor.d.ts +0 -31
- package/dist/resources/model-fit/floor.js +0 -65
- package/dist/resources/model-fit/kv-cache.d.ts +0 -23
- package/dist/resources/model-fit/kv-cache.js +0 -85
- package/dist/resources/model-fit/native-probe/advisory-fit.d.ts +0 -54
- package/dist/resources/model-fit/native-probe/advisory-fit.js +0 -248
- package/dist/resources/model-fit/native-probe/child-engine-fit.d.ts +0 -2
- package/dist/resources/model-fit/native-probe/child-engine-fit.js +0 -49
- package/dist/resources/model-fit/native-probe/classify-fit.d.ts +0 -6
- package/dist/resources/model-fit/native-probe/classify-fit.js +0 -166
- package/dist/resources/model-fit/native-probe/create-fit-request.d.ts +0 -31
- package/dist/resources/model-fit/native-probe/create-fit-request.js +0 -61
- package/dist/resources/model-fit/native-probe/engine-fit.d.ts +0 -73
- package/dist/resources/model-fit/native-probe/engine-fit.js +0 -13
- package/dist/resources/model-fit/native-probe/engines/asr.d.ts +0 -14
- package/dist/resources/model-fit/native-probe/engines/asr.js +0 -126
- package/dist/resources/model-fit/native-probe/engines/audiogen.d.ts +0 -8
- package/dist/resources/model-fit/native-probe/engines/diffusion.d.ts +0 -7
- package/dist/resources/model-fit/native-probe/engines/diffusion.js +0 -65
- package/dist/resources/model-fit/native-probe/engines/llama.d.ts +0 -12
- package/dist/resources/model-fit/native-probe/engines/llama.js +0 -41
- package/dist/resources/model-fit/native-probe/engines/nmt.d.ts +0 -8
- package/dist/resources/model-fit/native-probe/engines/nmt.js +0 -11
- package/dist/resources/model-fit/native-probe/engines/ocr.d.ts +0 -9
- package/dist/resources/model-fit/native-probe/engines/ocr.js +0 -13
- package/dist/resources/model-fit/native-probe/engines/tts.d.ts +0 -10
- package/dist/resources/model-fit/native-probe/engines/tts.js +0 -152
- package/dist/resources/model-fit/native-probe/fit-outcome.d.ts +0 -16
- package/dist/resources/model-fit/native-probe/fit-process.d.ts +0 -27
- package/dist/resources/model-fit/native-probe/fit-process.js +0 -55
- package/dist/resources/model-fit/native-probe/fit-runner.d.ts +0 -1
- package/dist/resources/model-fit/native-probe/fit-runner.js +0 -58
- package/dist/resources/model-fit/native-probe/run-fit.d.ts +0 -24
- package/dist/resources/model-fit/native-probe/run-fit.js +0 -20
- package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +0 -24
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +0 -123
- package/dist/resources/model-fit/native-probe/run-isolated-fit.d.ts +0 -63
- package/dist/resources/model-fit/native-probe/run-isolated-fit.js +0 -377
- package/dist/resources/model-fit/platform.d.ts +0 -9
- package/dist/resources/model-fit/platform.js +0 -26
- package/dist/resources/model-fit/types.d.ts +0 -6
- package/dist/resources/model-fit/types.js +0 -1
- package/dist/schemas/model-resource-profile.d.ts +0 -108
- package/dist/schemas/model-resource-profile.js +0 -80
- /package/dist/{resources/model-fit/native-probe/engines → model-fit}/gpu.d.ts +0 -0
- /package/dist/{resources/model-fit/native-probe/engines → model-fit}/gpu.js +0 -0
- /package/dist/{resources/model-fit/native-probe/fit-outcome.js → schemas/abort-signal.js} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { modelSrcInputSchema } from './model-src-utils.js';
|
|
3
|
+
import { trackedRequestSchema } from './request-base.js';
|
|
3
4
|
// Chatterbox multilingual supported languages (23). The engines support
|
|
4
5
|
// different language sets, so the language enum is validated per engine.
|
|
5
6
|
export const TTS_CHATTERBOX_LANGUAGES = [
|
|
@@ -123,6 +124,24 @@ export const TTS_COSYVOICE3_INSTRUCT_DIALECTS = [
|
|
|
123
124
|
];
|
|
124
125
|
export const TTS_COSYVOICE3_INSTRUCT_VOLUMES = ['loud', 'soft'];
|
|
125
126
|
export const TTS_COSYVOICE3_INSTRUCT_STYLES = ['peppa', 'robot'];
|
|
127
|
+
// Parler's Core ML compute policy (@qvac/tts-ggml `PARLER_COREML_COMPUTE_UNITS`).
|
|
128
|
+
export const TTS_PARLER_COREML_COMPUTE_UNITS = [
|
|
129
|
+
'all',
|
|
130
|
+
'cpu_and_ane',
|
|
131
|
+
'cpu_and_gpu',
|
|
132
|
+
'cpu_only'
|
|
133
|
+
];
|
|
134
|
+
// The LavaSR stages' Core ML compute policy (@qvac/tts-ggml
|
|
135
|
+
// `LavaSRCoreMLComputeUnits`); a different spelling from Parler's because each
|
|
136
|
+
// mirrors its own native enum.
|
|
137
|
+
export const TTS_LAVASR_COREML_COMPUTE_UNITS = [
|
|
138
|
+
'CPU_ONLY',
|
|
139
|
+
'CPU_AND_GPU',
|
|
140
|
+
'CPU_AND_NE',
|
|
141
|
+
'ALL'
|
|
142
|
+
];
|
|
143
|
+
// Supertonic weight precision (@qvac/tts-ggml `precision`).
|
|
144
|
+
export const TTS_SUPERTONIC_PRECISIONS = ['auto', 'f32', 'f16', 'q8_0'];
|
|
126
145
|
// Supertonic languages not already present in the Chatterbox set, used to keep
|
|
127
146
|
// TTS_LANGUAGES a true union across engines without duplicates.
|
|
128
147
|
const TTS_SUPERTONIC_ONLY_LANGUAGES = [
|
|
@@ -157,6 +176,11 @@ const ttsIntegerSchema = z.number().int();
|
|
|
157
176
|
const ttsInt32Schema = ttsIntegerSchema.min(-2147483648).max(2147483647);
|
|
158
177
|
const ttsNonNegativeInt32Schema = ttsInt32Schema.nonnegative();
|
|
159
178
|
const ttsPositiveInt32Schema = ttsInt32Schema.positive();
|
|
179
|
+
// A CosyVoice3 speech token travels both ways: the response hands them out as
|
|
180
|
+
// `speechTokenIds`, the load config takes them back as `forceSpeechTokens`.
|
|
181
|
+
// One titled scalar keeps the two interchangeable in every generated client
|
|
182
|
+
// (one shared Python class instead of a differently named wrapper per field).
|
|
183
|
+
const ttsSpeechTokenIdSchema = ttsInt32Schema.meta({ title: 'TtsSpeechTokenId' });
|
|
160
184
|
// Describe text shared by fields repeated across engine arms.
|
|
161
185
|
const TTS_USE_GPU_DESC = 'Route inference through a GPU backend (Metal / CUDA / Vulkan / OpenCL) when available. Default false.';
|
|
162
186
|
const TTS_SEED_DESC = 'RNG seed for the engine’s stochastic stages (e.g. Chatterbox CFM/SineGen, Supertonic latent generation).';
|
|
@@ -164,6 +188,7 @@ const TTS_THREADS_DESC = 'CPU thread count; overrides the hardware default.';
|
|
|
164
188
|
const TTS_NGPU_LAYERS_DESC = 'Model layers to offload to the GPU backend (99 = all, 0 = CPU). Takes effect on its own and wins over `useGPU`; when both are set they must agree.';
|
|
165
189
|
const TTS_STREAM_CHUNK_TOKENS_DESC = 'Speech tokens per native streaming chunk; 0 disables native chunk streaming.';
|
|
166
190
|
const TTS_STREAM_FIRST_CHUNK_TOKENS_DESC = 'Smaller first streaming chunk for lower first-audio latency.';
|
|
191
|
+
const TTS_VULKAN_DEVICE_DESC = 'Vulkan adapter index, also used by the LavaSR enhancer: 0 = the first adapter, N = the Nth, -1 = auto-pick by free VRAM preferring a discrete adapter. Only consulted on Vulkan.';
|
|
167
192
|
const TTS_TEMPERATURE_DESC = 'Sampling temperature; unset defers to the engine default (Parler 1.0, Audio8 0.7).';
|
|
168
193
|
const TTS_TOP_K_DESC = 'Top-k sampling cutoff; unset defers to the engine default (50).';
|
|
169
194
|
const TTS_TOP_P_DESC = 'Top-p (nucleus) sampling cutoff (0 < p ≤ 1); unset defers to the engine default.';
|
|
@@ -172,12 +197,27 @@ const TTS_MAX_FRAMES_DESC = 'Generation-length cap in decoder frames; 0 = engine
|
|
|
172
197
|
// generic ggml backend-loading knobs, not TTS-specific ones.
|
|
173
198
|
const TTS_BACKENDS_DIR_DESC = 'Directory scanned as given for dynamically-loaded ggml backend `.so` files. Unset scans the directory the native module was loaded from.';
|
|
174
199
|
const TTS_OPENCL_CACHE_DIR_DESC = "Persistent directory for ggml-opencl's compiled-program cache (Android only).";
|
|
200
|
+
const TTS_BACKEND_DESC = 'Explicit native backend: `auto`, `cpu`, `opencl`, `webgpu`, or an exact registered device name such as `MTL0`, `CUDA0` or `Vulkan0` (device names depend on the host). An unavailable explicit backend fails the load; unset keeps the `useGPU` policy. WebGPU is available to Supertonic 3, Parler, CosyVoice3 and Audio8 only.';
|
|
175
201
|
// The ggml backend knobs every engine honours. `openclCacheDir` is added only
|
|
176
202
|
// on the three engines whose native config reads it (Parler and Audio8 build
|
|
177
203
|
// their params through the addon's _assignBackendParams, which does not).
|
|
178
204
|
const ttsBackendDirFieldsShape = {
|
|
205
|
+
backend: z.string().trim().min(1).optional().describe(TTS_BACKEND_DESC),
|
|
179
206
|
backendsDir: z.string().min(1).optional().describe(TTS_BACKENDS_DIR_DESC)
|
|
180
207
|
};
|
|
208
|
+
// Mirrors the addon's validateBackendOption: a WebGPU selector is accepted only
|
|
209
|
+
// on the engines whose native library has established WebGPU support
|
|
210
|
+
// (Supertonic 3, Parler, CosyVoice3, Audio8); the others reject it before any
|
|
211
|
+
// weight is loaded, and so does this schema, naming the field.
|
|
212
|
+
function refineNoWebgpuBackend(config, ctx) {
|
|
213
|
+
if (config.backend === undefined || !/^webgpu/i.test(config.backend))
|
|
214
|
+
return;
|
|
215
|
+
ctx.addIssue({
|
|
216
|
+
code: 'custom',
|
|
217
|
+
path: ['backend'],
|
|
218
|
+
message: `WebGPU has no established support for ${config.ttsEngine}; it is available to Supertonic 3, Parler, CosyVoice3 and Audio8 only.`
|
|
219
|
+
});
|
|
220
|
+
}
|
|
181
221
|
const ttsOpenclCacheFieldShape = {
|
|
182
222
|
openclCacheDir: z.string().min(1).optional().describe(TTS_OPENCL_CACHE_DIR_DESC)
|
|
183
223
|
};
|
|
@@ -337,6 +377,62 @@ export const ttsChatterboxRuntimeConfigSchema = z
|
|
|
337
377
|
.nonnegative()
|
|
338
378
|
.optional()
|
|
339
379
|
.describe('Chatterbox S3Gen classifier-free-guidance rate; `0` skips the unconditioned pass, a positive value overrides the model’s baked rate. Omit to keep the baked rate.'),
|
|
380
|
+
streamLeftContextTokens: ttsNonNegativeInt32Schema
|
|
381
|
+
.optional()
|
|
382
|
+
.describe('Already-emitted speech tokens S3Gen keeps as left context per native streaming chunk (typically 25–50), bounding the per-chunk cost on long utterances; 0 = the whole emitted prefix.'),
|
|
383
|
+
batchCfmSteps: ttsNonNegativeInt32Schema
|
|
384
|
+
.optional()
|
|
385
|
+
.describe('CFM Euler step count for batch synthesis; 0 = the library default (2-step meanflow on Turbo, the model’s full schedule on multilingual). The multilingual engine does not floor it, so values well below its schedule under-integrate. `cfmSteps` keeps driving native streaming.'),
|
|
386
|
+
nPredict: ttsPositiveInt32Schema
|
|
387
|
+
.optional()
|
|
388
|
+
.describe('Cap on speech tokens T3 decodes per synthesis (~25 tokens ≈ 1 s); engine default 1000 (~40 s). Longer single calls also need `nCtx` to cover prompt plus generated tokens, or use `maxSentenceChars`.'),
|
|
389
|
+
maxSentenceChars: ttsNonNegativeInt32Schema
|
|
390
|
+
.optional()
|
|
391
|
+
.describe('Sentence auto-split: T3 + S3Gen run per segment of at most this many bytes (the reference CLI uses 180); 0 = off. `nPredict` then applies per segment.'),
|
|
392
|
+
crossfadeMs: ttsNonNegativeInt32Schema
|
|
393
|
+
.optional()
|
|
394
|
+
.describe('Raised-cosine crossfade between auto-split batch segments, in milliseconds (engine default 30). Native streaming stays gapless.'),
|
|
395
|
+
// T3 samples its speech tokens; the defaults are the addon's, not Parler's
|
|
396
|
+
// or Audio8's, so these do not share TTS_TEMPERATURE_DESC and friends.
|
|
397
|
+
temperature: z
|
|
398
|
+
.number()
|
|
399
|
+
.nonnegative()
|
|
400
|
+
.optional()
|
|
401
|
+
.describe('T3 sampling temperature (engine default 0.8); 0 decodes greedily.'),
|
|
402
|
+
topK: ttsNonNegativeInt32Schema
|
|
403
|
+
.optional()
|
|
404
|
+
.describe('T3 top-k sampling cutoff (engine default 1000); 0 disables the cutoff.'),
|
|
405
|
+
topP: z
|
|
406
|
+
.number()
|
|
407
|
+
.positive()
|
|
408
|
+
.max(1)
|
|
409
|
+
.optional()
|
|
410
|
+
.describe('T3 top-p (nucleus) sampling cutoff, 0 < p ≤ 1 (engine default 0.95).'),
|
|
411
|
+
repeatPenalty: z
|
|
412
|
+
.number()
|
|
413
|
+
.positive()
|
|
414
|
+
.optional()
|
|
415
|
+
.describe('T3 repetition penalty (engine default 1.2); 1 = off.'),
|
|
416
|
+
exaggeration: z
|
|
417
|
+
.number()
|
|
418
|
+
.optional()
|
|
419
|
+
.describe('Multilingual only: prosody intensity, above 0 more expressive, below 0 flatter (engine default 0.5). The Turbo variant ignores it.'),
|
|
420
|
+
cfgWeight: z
|
|
421
|
+
.number()
|
|
422
|
+
.nonnegative()
|
|
423
|
+
.optional()
|
|
424
|
+
.describe('Multilingual only: T3 classifier-free-guidance scale (engine default 0.5); 0 disables it. Separate from `cfgRate`, which steers S3Gen.'),
|
|
425
|
+
minP: z
|
|
426
|
+
.number()
|
|
427
|
+
.min(0)
|
|
428
|
+
.max(1)
|
|
429
|
+
.optional()
|
|
430
|
+
.describe('Multilingual only: min-p sampling threshold (engine default 0); 0 = off.'),
|
|
431
|
+
voiceDir: z
|
|
432
|
+
.string()
|
|
433
|
+
.min(1)
|
|
434
|
+
.optional()
|
|
435
|
+
.describe('Directory of pre-baked voice-conditioning tensors (the upstream CLI’s `--save-voice` output), loaded instead of preprocessing a reference recording. With `referenceAudioSrc` too, tensors missing from the directory are backfilled from the recording.'),
|
|
340
436
|
// Int32 like the other engines: the addon narrows with `| 0`, so a wider
|
|
341
437
|
// value would wrap silently rather than fail.
|
|
342
438
|
threads: ttsPositiveInt32Schema.optional().describe(TTS_THREADS_DESC),
|
|
@@ -345,12 +441,28 @@ export const ttsChatterboxRuntimeConfigSchema = z
|
|
|
345
441
|
...ttsBackendDirFieldsShape,
|
|
346
442
|
...ttsOpenclCacheFieldShape
|
|
347
443
|
})
|
|
348
|
-
.superRefine(
|
|
444
|
+
.superRefine(refineChatterboxRuntimeConfig);
|
|
445
|
+
function refineChatterboxRuntimeConfig(config, ctx) {
|
|
446
|
+
refineGpuIntent(config, ctx);
|
|
447
|
+
refineNoWebgpuBackend(config, ctx);
|
|
448
|
+
}
|
|
449
|
+
// Supertonic's in-memory voice tensors come as a pair: the addon rejects one
|
|
450
|
+
// without the other, so the schema does too, naming the missing half.
|
|
451
|
+
function refineSupertonicVoiceStyle(config, ctx) {
|
|
452
|
+
if ((config.voiceStyleTtl === undefined) === (config.voiceStyleDp === undefined))
|
|
453
|
+
return;
|
|
454
|
+
ctx.addIssue({
|
|
455
|
+
code: 'custom',
|
|
456
|
+
path: [config.voiceStyleTtl === undefined ? 'voiceStyleTtl' : 'voiceStyleDp'],
|
|
457
|
+
message: 'voiceStyleTtl and voiceStyleDp must be supplied together.'
|
|
458
|
+
});
|
|
459
|
+
}
|
|
349
460
|
// Supertonic drives its duration predictor from either an exact multiplier
|
|
350
461
|
// (`ttsSpeed`) or the canonical pace vocabulary, never both — the engine
|
|
351
462
|
// rejects the pair rather than picking a winner.
|
|
352
463
|
function refineSupertonicRateControls(config, ctx) {
|
|
353
464
|
refineGpuIntent(config, ctx);
|
|
465
|
+
refineSupertonicVoiceStyle(config, ctx);
|
|
354
466
|
if (config.ttsSpeed !== undefined && config.pace !== undefined) {
|
|
355
467
|
ctx.addIssue({
|
|
356
468
|
code: 'custom',
|
|
@@ -359,8 +471,7 @@ function refineSupertonicRateControls(config, ctx) {
|
|
|
359
471
|
});
|
|
360
472
|
}
|
|
361
473
|
}
|
|
362
|
-
|
|
363
|
-
.object({
|
|
474
|
+
const ttsSupertonicRuntimeConfigShape = {
|
|
364
475
|
ttsEngine: z.literal('supertonic').describe('TTS engine: Supertonic.'),
|
|
365
476
|
language: ttsSupertonicLanguageSchema.describe('Language code. Default `en`.'),
|
|
366
477
|
voice: z.string().optional().describe('Supertonic baked voice id, e.g. `F1` or `M1`.'),
|
|
@@ -390,9 +501,65 @@ export const ttsSupertonicRuntimeConfigSchema = z
|
|
|
390
501
|
.min(1)
|
|
391
502
|
.optional()
|
|
392
503
|
.describe('Supertonic + `useGPU` only: directory where the Vulkan backend persists its compiled pipeline cache.'),
|
|
504
|
+
vulkanDevice: ttsInt32Schema.min(-1).optional().describe(TTS_VULKAN_DEVICE_DESC),
|
|
505
|
+
prewarmText: z
|
|
506
|
+
.string()
|
|
507
|
+
.trim()
|
|
508
|
+
.min(1)
|
|
509
|
+
.optional()
|
|
510
|
+
.describe('Text synthesized once at load so GPU pipelines (and a Core ML vocoder sidecar) are ready before the first request; skipped on a plain CPU run. Use a sentence of representative length. Wins over the `vulkanCacheDir` default pre-warm.'),
|
|
511
|
+
// Supertonic chunks on text tokens, not speech tokens, so its native
|
|
512
|
+
// streaming controls carry their own wording.
|
|
513
|
+
streamChunkTokens: ttsNonNegativeInt32Schema
|
|
514
|
+
.optional()
|
|
515
|
+
.describe('Text tokens (Unicode code points) per native streaming chunk, about 50 for English and 25–30 for CJK; 0 disables native chunk streaming. Cannot be combined with the LavaSR enhancer or denoiser.'),
|
|
516
|
+
streamFirstChunkTokens: ttsNonNegativeInt32Schema
|
|
517
|
+
.optional()
|
|
518
|
+
.describe(TTS_STREAM_FIRST_CHUNK_TOKENS_DESC),
|
|
519
|
+
streamChunkTolerancePct: ttsNonNegativeInt32Schema
|
|
520
|
+
.optional()
|
|
521
|
+
.describe('Boundary-snap window for clause and whitespace chunk boundaries, as a percentage of the chunk target (engine default 20).'),
|
|
522
|
+
streamMinChunkTokens: ttsNonNegativeInt32Schema
|
|
523
|
+
.optional()
|
|
524
|
+
.describe('Floor on every streamed chunk’s size in text tokens (engine default 30); shorter trailing chunks merge into the previous one.'),
|
|
525
|
+
// Native precision and environment controls, forwarded to the engine as
|
|
526
|
+
// given; -1 on the integer overrides leaves the engine's automatic choice.
|
|
527
|
+
precision: z
|
|
528
|
+
.enum(TTS_SUPERTONIC_PRECISIONS)
|
|
529
|
+
.optional()
|
|
530
|
+
.describe('Weight precision the engine loads at: `auto` keeps the GGUF’s own, `f32` / `f16` / `q8_0` convert on load and change the weight footprint.'),
|
|
531
|
+
f16Attn: ttsInt32Schema
|
|
532
|
+
.optional()
|
|
533
|
+
.describe('Attention precision override: `-1` automatic (default), `0` f32, `1` f16.'),
|
|
534
|
+
f16Weights: ttsInt32Schema
|
|
535
|
+
.optional()
|
|
536
|
+
.describe('Weight precision override: `-1` automatic (default), `0` off, `1` f16.'),
|
|
537
|
+
kvAttnType: ttsInt32Schema
|
|
538
|
+
.optional()
|
|
539
|
+
.describe('Native KV attention type code; `-1` leaves the automatic selection.'),
|
|
540
|
+
f16WeightsDenyList: z
|
|
541
|
+
.array(z.string().min(1))
|
|
542
|
+
.optional()
|
|
543
|
+
.describe('Tensor-name patterns kept at their original precision when `f16Weights` is on.'),
|
|
544
|
+
vulkanEnvOverrides: z
|
|
545
|
+
.record(z.string(), z.string())
|
|
546
|
+
.optional()
|
|
547
|
+
.describe('Vulkan environment overrides (string values) passed to the engine; explicit entries win over the `vulkanCacheDir` convenience setting.'),
|
|
548
|
+
voiceStyleTtl: z
|
|
549
|
+
.array(z.number())
|
|
550
|
+
.min(1)
|
|
551
|
+
.optional()
|
|
552
|
+
.describe('In-memory voice: the flattened `style_ttl` tensor of a cloned voice. Paired with `voiceStyleDp`; the engine checks the sizes against the model, and the pair wins over `voiceJsonSrc` and the baked `voice`.'),
|
|
553
|
+
voiceStyleDp: z
|
|
554
|
+
.array(z.number())
|
|
555
|
+
.min(1)
|
|
556
|
+
.optional()
|
|
557
|
+
.describe('In-memory voice: the flattened `style_dp` tensor, paired with `voiceStyleTtl`.'),
|
|
393
558
|
...ttsBackendDirFieldsShape,
|
|
394
559
|
...ttsOpenclCacheFieldShape
|
|
395
|
-
}
|
|
560
|
+
};
|
|
561
|
+
export const ttsSupertonicRuntimeConfigSchema = z
|
|
562
|
+
.object(ttsSupertonicRuntimeConfigShape)
|
|
396
563
|
.superRefine(refineSupertonicRateControls);
|
|
397
564
|
// A shape rather than a schema so the load schema below can be built from it
|
|
398
565
|
// and carry its own refinement set (the enhancer waiver needs the load-only
|
|
@@ -424,6 +591,20 @@ const ttsParlerRuntimeConfigShape = {
|
|
|
424
591
|
.boolean()
|
|
425
592
|
.optional()
|
|
426
593
|
.describe('Parler prompt digit expansion (engine default: enabled).'),
|
|
594
|
+
// Apple Core ML sidecars (macOS / iOS). The DAC sidecar is presence-driven;
|
|
595
|
+
// these three steer the optional decoder sidecar and the compute policy.
|
|
596
|
+
coremlDecoder: z
|
|
597
|
+
.boolean()
|
|
598
|
+
.optional()
|
|
599
|
+
.describe('macOS / iOS: run the decoder steps on the `<model>-decoder.mlmodelc` sidecar beside the GGUF (the DAC sidecar is picked up by presence); unset keeps the engine default.'),
|
|
600
|
+
coremlComputeUnits: z
|
|
601
|
+
.enum(TTS_PARLER_COREML_COMPUTE_UNITS)
|
|
602
|
+
.optional()
|
|
603
|
+
.describe('macOS / iOS: Core ML compute policy for the Parler sidecars; unset inherits the engine’s environment default.'),
|
|
604
|
+
coremlStrict: z
|
|
605
|
+
.boolean()
|
|
606
|
+
.optional()
|
|
607
|
+
.describe('macOS / iOS: `true` fails the load when a sidecar is unusable instead of falling back to ggml, `false` permits the fallback; unset inherits the engine’s strict mode.'),
|
|
427
608
|
...ttsBackendDirFieldsShape
|
|
428
609
|
};
|
|
429
610
|
export const ttsParlerRuntimeConfigSchema = z
|
|
@@ -502,7 +683,7 @@ const ttsCosyvoice3RuntimeConfigShape = {
|
|
|
502
683
|
.describe("Speaking rate: `'slow'`, `'moderate'`, or `'fast'`; `'moderate'` disengages the pace channel."),
|
|
503
684
|
instruct: ttsCosyvoice3InstructSchema
|
|
504
685
|
.optional()
|
|
505
|
-
.describe('Natural-language control: a structured object (one of dialect / volume / style) or a raw instruction string. One conditioning control per synthesis.'),
|
|
686
|
+
.describe('Natural-language control: a structured object (one of dialect / volume / style) or a raw instruction string. One conditioning control per synthesis; a request-level `instruct` replaces it for that synthesis.'),
|
|
506
687
|
// Trimmed for the same reason as the instruct string: a whitespace-only
|
|
507
688
|
// transcript would reach the engine as a non-empty prompt.
|
|
508
689
|
promptText: z
|
|
@@ -511,6 +692,19 @@ const ttsCosyvoice3RuntimeConfigShape = {
|
|
|
511
692
|
.min(1)
|
|
512
693
|
.optional()
|
|
513
694
|
.describe('Verbatim transcript of `referenceAudioSrc`. Setting it selects zero-shot cloning (best fidelity in the reference’s own language); omitting it selects cross-lingual cloning (timbre only). Without a reference it overrides the baked voice’s transcript metadata.'),
|
|
695
|
+
flowCutPrompt: z
|
|
696
|
+
.boolean()
|
|
697
|
+
.optional()
|
|
698
|
+
.describe('Treat the baked-voice prompt frames as attention-only conditioning in the flow: a faster flow whose output deviates slightly from the reference (engine default off).'),
|
|
699
|
+
vulkanDevice: ttsInt32Schema.min(-1).optional().describe(TTS_VULKAN_DEVICE_DESC),
|
|
700
|
+
greedy: z
|
|
701
|
+
.boolean()
|
|
702
|
+
.optional()
|
|
703
|
+
.describe('Greedy LM decoding: take the argmax speech token instead of sampling (engine default off).'),
|
|
704
|
+
forceSpeechTokens: z
|
|
705
|
+
.array(ttsSpeechTokenIdSchema)
|
|
706
|
+
.optional()
|
|
707
|
+
.describe('Speech-token trajectory of ONE native synthesis to replay instead of generating, as a previous batch run, native chunk stream or single sentence returned it in `speechTokenIds`. Fixed at load: every synthesis of the model replays this same array, so a joined sentence stream cannot be replayed sentence by sentence. An empty array restores generation.'),
|
|
514
708
|
useGPU: z.boolean().optional().describe(TTS_USE_GPU_DESC),
|
|
515
709
|
outputSampleRate: ttsOutputSampleRateSchema.optional(),
|
|
516
710
|
streamChunkTokens: ttsNonNegativeInt32Schema.optional().describe(TTS_STREAM_CHUNK_TOKENS_DESC),
|
|
@@ -554,10 +748,70 @@ const ttsAudio8RuntimeConfigShape = {
|
|
|
554
748
|
export const ttsAudio8RuntimeConfigSchema = z
|
|
555
749
|
.object(ttsAudio8RuntimeConfigShape)
|
|
556
750
|
.superRefine(refineGpuIntent);
|
|
557
|
-
// @qvac/tts-ggml's
|
|
558
|
-
//
|
|
559
|
-
|
|
751
|
+
// @qvac/tts-ggml's MOSS generation budget: 2048 rows when `maxNewTokens` is
|
|
752
|
+
// unset, of which 31 delay-pattern drain rows and two termination rows are
|
|
753
|
+
// never audio, so `durationTokens` fits at most `maxNewTokens - 33` (2015 by
|
|
754
|
+
// default).
|
|
755
|
+
const TTS_MOSS_DEFAULT_MAX_NEW_TOKENS = 2048;
|
|
756
|
+
const TTS_MOSS_RESERVED_ROWS = 33;
|
|
560
757
|
const TTS_MOSS_MAX_DIALOGUE_SPEAKERS = 5;
|
|
758
|
+
// Mirrors the addon's assertMossDurationTokens with the configured budget: a
|
|
759
|
+
// target that does not fit the generation budget is refused at load rather
|
|
760
|
+
// than by the engine.
|
|
761
|
+
function refineMossDurationBudget(config, ctx) {
|
|
762
|
+
if (config.durationTokens === undefined || config.durationTokens === 0)
|
|
763
|
+
return;
|
|
764
|
+
const budget = (config.maxNewTokens ?? TTS_MOSS_DEFAULT_MAX_NEW_TOKENS) - TTS_MOSS_RESERVED_ROWS;
|
|
765
|
+
if (config.durationTokens <= budget)
|
|
766
|
+
return;
|
|
767
|
+
ctx.addIssue({
|
|
768
|
+
code: 'custom',
|
|
769
|
+
path: ['durationTokens'],
|
|
770
|
+
message: `durationTokens must be an integer from 0 to ${Math.max(0, budget)} (maxNewTokens less the 33 delay/EOS rows; 0 = free length).`
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
function refineMossRuntimeConfig(config, ctx) {
|
|
774
|
+
refineGpuIntent(config, ctx);
|
|
775
|
+
refineNoWebgpuBackend(config, ctx);
|
|
776
|
+
refineMossDurationBudget(config, ctx);
|
|
777
|
+
}
|
|
778
|
+
// MOSS samples its text and audio channels separately; the defaults are the
|
|
779
|
+
// engine's, so these do not share the Parler / Audio8 sampling descriptions.
|
|
780
|
+
const ttsMossSamplingFieldsShape = {
|
|
781
|
+
textTemperature: z
|
|
782
|
+
.number()
|
|
783
|
+
.nonnegative()
|
|
784
|
+
.optional()
|
|
785
|
+
.describe('Text-channel sampling temperature; unset keeps the engine default.'),
|
|
786
|
+
textTopP: z
|
|
787
|
+
.number()
|
|
788
|
+
.positive()
|
|
789
|
+
.max(1)
|
|
790
|
+
.optional()
|
|
791
|
+
.describe('Text-channel top-p (nucleus) cutoff, 0 < p ≤ 1; unset keeps the engine default.'),
|
|
792
|
+
textTopK: ttsNonNegativeInt32Schema
|
|
793
|
+
.optional()
|
|
794
|
+
.describe('Text-channel top-k cutoff; unset keeps the engine default.'),
|
|
795
|
+
audioTemperature: z
|
|
796
|
+
.number()
|
|
797
|
+
.nonnegative()
|
|
798
|
+
.optional()
|
|
799
|
+
.describe('Audio-channel sampling temperature; unset keeps the engine default.'),
|
|
800
|
+
audioTopP: z
|
|
801
|
+
.number()
|
|
802
|
+
.positive()
|
|
803
|
+
.max(1)
|
|
804
|
+
.optional()
|
|
805
|
+
.describe('Audio-channel top-p (nucleus) cutoff, 0 < p ≤ 1; unset keeps the engine default.'),
|
|
806
|
+
audioTopK: ttsNonNegativeInt32Schema
|
|
807
|
+
.optional()
|
|
808
|
+
.describe('Audio-channel top-k cutoff; unset keeps the engine default.'),
|
|
809
|
+
audioRepetitionPenalty: z
|
|
810
|
+
.number()
|
|
811
|
+
.positive()
|
|
812
|
+
.optional()
|
|
813
|
+
.describe('Audio-channel repetition penalty; 1 = off, unset keeps the engine default.')
|
|
814
|
+
};
|
|
561
815
|
// MOSS emits its native 24 kHz only (the addon rejects any other
|
|
562
816
|
// `outputSampleRate`) and supports neither the LavaSR stages nor a smaller
|
|
563
817
|
// first streaming chunk, so none of those fields exist on this arm.
|
|
@@ -573,14 +827,20 @@ const ttsMossRuntimeConfigShape = {
|
|
|
573
827
|
.min(1)
|
|
574
828
|
.optional()
|
|
575
829
|
.describe('Language hint written into the model prompt, e.g. `en` or `zh`. Default `en`.'),
|
|
576
|
-
durationTokens:
|
|
830
|
+
durationTokens: ttsInt32Schema
|
|
577
831
|
.min(0)
|
|
578
|
-
.max(TTS_MOSS_MAX_DURATION_TOKENS)
|
|
579
832
|
.optional()
|
|
580
|
-
.describe('Target length of each synthesis in codec frames (12.5 per second, so 38 ≈ 3 s),
|
|
833
|
+
.describe('Target length of each synthesis in codec frames (12.5 per second, so 38 ≈ 3 s), at most `maxNewTokens` − 33 (2015 by default); 0 or unset keeps the length free.'),
|
|
581
834
|
streamChunkTokens: ttsNonNegativeInt32Schema
|
|
582
835
|
.optional()
|
|
583
836
|
.describe('Codec frames per native streaming chunk (12.5 per second, so 25 ≈ 2 s); 0 or unset synthesizes the whole text before emitting.'),
|
|
837
|
+
nCtx: ttsPositiveInt32Schema
|
|
838
|
+
.optional()
|
|
839
|
+
.describe('Context capacity of the backbone in rows; unset keeps the native value.'),
|
|
840
|
+
maxNewTokens: ttsPositiveInt32Schema
|
|
841
|
+
.optional()
|
|
842
|
+
.describe('Generation budget in rows (engine default 2048), of which 33 are delay/EOS rows; bounds `durationTokens`.'),
|
|
843
|
+
...ttsMossSamplingFieldsShape,
|
|
584
844
|
useGPU: z.boolean().optional().describe(TTS_USE_GPU_DESC),
|
|
585
845
|
threads: ttsPositiveInt32Schema.optional().describe(TTS_THREADS_DESC),
|
|
586
846
|
// Not TTS_NGPU_LAYERS_DESC: MOSS does not offload per layer, so a layer
|
|
@@ -593,7 +853,7 @@ const ttsMossRuntimeConfigShape = {
|
|
|
593
853
|
};
|
|
594
854
|
export const ttsMossRuntimeConfigSchema = z
|
|
595
855
|
.object(ttsMossRuntimeConfigShape)
|
|
596
|
-
.superRefine(
|
|
856
|
+
.superRefine(refineMossRuntimeConfig);
|
|
597
857
|
// JSON PCM keeps the client and wire portable; converted to Float32Array at the addon boundary.
|
|
598
858
|
const ttsSpeechPcmSchema = z.array(z.number().min(-1).max(1)).min(1);
|
|
599
859
|
const ttsSpeechRateSchema = z.number().int().min(8000).max(192000);
|
|
@@ -675,19 +935,23 @@ const ttsBatchBackendShape = {
|
|
|
675
935
|
seed: ttsInt32Schema.optional().describe(TTS_SEED_DESC),
|
|
676
936
|
...ttsBackendDirFieldsShape
|
|
677
937
|
};
|
|
938
|
+
function refineMossBatchRuntimeConfig(config, ctx) {
|
|
939
|
+
refineGpuIntent(config, ctx);
|
|
940
|
+
refineNoWebgpuBackend(config, ctx);
|
|
941
|
+
}
|
|
678
942
|
export const ttsMossSoundEffectRuntimeConfigSchema = z
|
|
679
943
|
.object({
|
|
680
944
|
ttsEngine: z.literal('moss-sfx').describe('TTS engine: MOSS-SoundEffect-v2.'),
|
|
681
945
|
...ttsBatchBackendShape,
|
|
682
946
|
...ttsSoundEffectFieldsShape
|
|
683
947
|
})
|
|
684
|
-
.superRefine(
|
|
948
|
+
.superRefine(refineMossBatchRuntimeConfig);
|
|
685
949
|
export const ttsMossSpeechRuntimeConfigSchema = z
|
|
686
950
|
.object({
|
|
687
951
|
ttsEngine: z.literal('moss-speech').describe('TTS engine: MOSS-Speech.'),
|
|
688
952
|
...ttsBatchBackendShape
|
|
689
953
|
})
|
|
690
|
-
.superRefine(
|
|
954
|
+
.superRefine(refineMossBatchRuntimeConfig);
|
|
691
955
|
export const ttsMossSoundEffectLoadConfigSchema = ttsMossSoundEffectRuntimeConfigSchema;
|
|
692
956
|
export const ttsMossSpeechLoadConfigSchema = ttsMossSpeechRuntimeConfigSchema.extend({
|
|
693
957
|
mossSpeechCodecModelSrc: modelSrcInputSchema.describe('MOSS-Speech codec GGUF source; modelSrc is the language model.')
|
|
@@ -712,8 +976,56 @@ const ttsLavasrLoadFieldsShape = {
|
|
|
712
976
|
.describe('LavaSR enhancer model source; bandwidth-extends the output to 48 kHz.'),
|
|
713
977
|
lavasrDenoiserModelSrc: modelSrcInputSchema
|
|
714
978
|
.optional()
|
|
715
|
-
.describe('LavaSR denoiser model source; runs before the enhancer, rate-preserving (batch synthesis only).')
|
|
979
|
+
.describe('LavaSR denoiser model source; runs before the enhancer, rate-preserving (batch synthesis only).'),
|
|
980
|
+
// The Core ML models are compiled `.mlmodelc` directories, not single files,
|
|
981
|
+
// so they are host paths rather than model sources. Each stage takes its
|
|
982
|
+
// path and compute policy together, beside its GGUF source.
|
|
983
|
+
lavasrEnhancerCoremlModelPath: z
|
|
984
|
+
.string()
|
|
985
|
+
.min(1)
|
|
986
|
+
.optional()
|
|
987
|
+
.describe('macOS / iOS: compiled Core ML model directory (`.mlmodelc`) on the inference host for the LavaSR enhancer’s neural core; requires `lavasrEnhancerModelSrc` and `lavasrEnhancerCoremlComputeUnits`. A model that cannot load fails the load rather than falling back to ggml.'),
|
|
988
|
+
lavasrEnhancerCoremlComputeUnits: z
|
|
989
|
+
.enum(TTS_LAVASR_COREML_COMPUTE_UNITS)
|
|
990
|
+
.optional()
|
|
991
|
+
.describe('macOS / iOS: Core ML compute policy for the LavaSR enhancer; required with `lavasrEnhancerCoremlModelPath`. Stats then report the stage as device `2` (Core ML-managed), backend `99`.'),
|
|
992
|
+
lavasrDenoiserCoremlModelPath: z
|
|
993
|
+
.string()
|
|
994
|
+
.min(1)
|
|
995
|
+
.optional()
|
|
996
|
+
.describe('macOS / iOS: compiled Core ML model directory (`.mlmodelc`) on the inference host for the LavaSR denoiser’s neural core; requires `lavasrDenoiserModelSrc` and `lavasrDenoiserCoremlComputeUnits`. A model that cannot load fails the load rather than falling back to ggml.'),
|
|
997
|
+
lavasrDenoiserCoremlComputeUnits: z
|
|
998
|
+
.enum(TTS_LAVASR_COREML_COMPUTE_UNITS)
|
|
999
|
+
.optional()
|
|
1000
|
+
.describe('macOS / iOS: Core ML compute policy for the LavaSR denoiser; required with `lavasrDenoiserCoremlModelPath`. Stats then report the stage as device `2` (Core ML-managed), backend `99`.')
|
|
716
1001
|
};
|
|
1002
|
+
// Mirrors the addon's validateLavaSRCoreML: the path and the policy come as a
|
|
1003
|
+
// pair, and a pair without the stage's GGUF has no stage to attach to.
|
|
1004
|
+
function refineLavasrCoreml(config, ctx) {
|
|
1005
|
+
for (const stage of ['Enhancer', 'Denoiser']) {
|
|
1006
|
+
const pathField = `lavasr${stage}CoremlModelPath`;
|
|
1007
|
+
const unitsField = `lavasr${stage}CoremlComputeUnits`;
|
|
1008
|
+
const srcField = `lavasr${stage}ModelSrc`;
|
|
1009
|
+
const path = config[pathField];
|
|
1010
|
+
const units = config[unitsField];
|
|
1011
|
+
if (path === undefined && units === undefined)
|
|
1012
|
+
continue;
|
|
1013
|
+
if (path === undefined || units === undefined) {
|
|
1014
|
+
ctx.addIssue({
|
|
1015
|
+
code: 'custom',
|
|
1016
|
+
path: [path === undefined ? pathField : unitsField],
|
|
1017
|
+
message: `${pathField} and ${unitsField} must be supplied together.`
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
if (config[srcField] === undefined) {
|
|
1021
|
+
ctx.addIssue({
|
|
1022
|
+
code: 'custom',
|
|
1023
|
+
path: [srcField],
|
|
1024
|
+
message: `${srcField} is required when the LavaSR ${stage.toLowerCase()} runs on Core ML (${pathField}).`
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
717
1029
|
// The denoiser needs the whole utterance, so every engine with native chunk
|
|
718
1030
|
// streaming rejects the pair at load. Shared so Chatterbox, Parler and
|
|
719
1031
|
// CosyVoice3 fail the same way with the same message.
|
|
@@ -744,11 +1056,46 @@ export const ttsChatterboxLoadConfigSchema = ttsChatterboxRuntimeConfigSchema
|
|
|
744
1056
|
.describe('Chatterbox MTL only: Cangjie TSV source for Chinese romanisation (required for language `zh`).'),
|
|
745
1057
|
...ttsLavasrLoadFieldsShape
|
|
746
1058
|
})
|
|
747
|
-
.superRefine(
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}
|
|
1059
|
+
.superRefine(refineChatterboxLoadConfig);
|
|
1060
|
+
function refineChatterboxLoadConfig(config, ctx) {
|
|
1061
|
+
refineLavasrDenoiserStreaming(config, ctx);
|
|
1062
|
+
refineLavasrCoreml(config, ctx);
|
|
1063
|
+
}
|
|
1064
|
+
// Supertonic native chunk streaming rejects BOTH LavaSR stages, not just the
|
|
1065
|
+
// denoiser: tts-cpp only has one-shot enhance / denoise for this engine, and
|
|
1066
|
+
// it reports no native rate before synthesis. Sentence streaming still works
|
|
1067
|
+
// with either stage loaded.
|
|
1068
|
+
function refineSupertonicLoadConfig(config, ctx) {
|
|
1069
|
+
refineSupertonicRateControls(config, ctx);
|
|
1070
|
+
refineLavasrCoreml(config, ctx);
|
|
1071
|
+
if ((config.streamChunkTokens ?? 0) <= 0)
|
|
1072
|
+
return;
|
|
1073
|
+
for (const field of ['lavasrEnhancerModelSrc', 'lavasrDenoiserModelSrc']) {
|
|
1074
|
+
if (config[field] === undefined)
|
|
1075
|
+
continue;
|
|
1076
|
+
ctx.addIssue({
|
|
1077
|
+
code: 'custom',
|
|
1078
|
+
path: [field],
|
|
1079
|
+
message: 'Supertonic native chunk streaming (streamChunkTokens > 0) cannot be combined with the LavaSR enhancer or denoiser; ' +
|
|
1080
|
+
'use sentence streaming (stream: true without streamChunkTokens, sentenceStream, or textToSpeechStream) for enhanced output.'
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
// Supertonic's external voice JSON and fixed CFM noise tensor are single files,
|
|
1085
|
+
// so they ride the same source resolution as the LavaSR GGUFs and reach the
|
|
1086
|
+
// addon as `voiceJsonPath` / `noiseNpyPath`.
|
|
1087
|
+
export const ttsSupertonicLoadConfigSchema = z
|
|
1088
|
+
.object({
|
|
1089
|
+
...ttsSupertonicRuntimeConfigShape,
|
|
1090
|
+
...ttsLavasrLoadFieldsShape,
|
|
1091
|
+
voiceJsonSrc: modelSrcInputSchema
|
|
1092
|
+
.optional()
|
|
1093
|
+
.describe('External voice JSON source (`{ style_ttl, style_dp }`, e.g. a cloned voice) that overrides the baked `voice` preset; the engine checks the tensor sizes against the loaded model.'),
|
|
1094
|
+
noiseNpySrc: modelSrcInputSchema
|
|
1095
|
+
.optional()
|
|
1096
|
+
.describe('Fixed CFM initial-noise `.npy` tensor source, for reproducible output.')
|
|
1097
|
+
})
|
|
1098
|
+
.superRefine(refineSupertonicLoadConfig);
|
|
752
1099
|
function refineParlerLoadConfig(config, ctx) {
|
|
753
1100
|
refineParlerDescriptionFields(config, ctx);
|
|
754
1101
|
refineGpuIntent(config, ctx);
|
|
@@ -758,6 +1105,7 @@ function refineParlerLoadConfig(config, ctx) {
|
|
|
758
1105
|
refineParlerNativeStreamingRate(config, ctx);
|
|
759
1106
|
}
|
|
760
1107
|
refineLavasrDenoiserStreaming(config, ctx);
|
|
1108
|
+
refineLavasrCoreml(config, ctx);
|
|
761
1109
|
}
|
|
762
1110
|
export const ttsParlerLoadConfigSchema = z
|
|
763
1111
|
.object({
|
|
@@ -821,6 +1169,7 @@ function refineCosyvoice3LoadConfig(config, ctx) {
|
|
|
821
1169
|
refineCosyvoice3NativeStreamingRate(config, ctx);
|
|
822
1170
|
}
|
|
823
1171
|
refineLavasrDenoiserStreaming(config, ctx);
|
|
1172
|
+
refineLavasrCoreml(config, ctx);
|
|
824
1173
|
refineCosyvoice3Cloning(config, ctx);
|
|
825
1174
|
}
|
|
826
1175
|
// CosyVoice3 loads from a model *directory* (LLM/flow/HiFT GGUFs plus
|
|
@@ -877,9 +1226,10 @@ export const ttsAudio8LoadConfigSchema = z
|
|
|
877
1226
|
})
|
|
878
1227
|
.superRefine(refineAudio8LoadConfig);
|
|
879
1228
|
// The addon enforces the same three rules at construction; catching them here
|
|
880
|
-
// names the SDK field instead of the addon's `files.*` option.
|
|
1229
|
+
// names the SDK field instead of the addon's `files.*` option. Built from the
|
|
1230
|
+
// runtime *shape*, so the runtime refinements are re-run here too.
|
|
881
1231
|
function refineMossLoadConfig(config, ctx) {
|
|
882
|
-
|
|
1232
|
+
refineMossRuntimeConfig(config, ctx);
|
|
883
1233
|
if (config.referenceAudioSrc !== undefined && config.dialogueReferenceSrcs !== undefined) {
|
|
884
1234
|
ctx.addIssue({
|
|
885
1235
|
code: 'custom',
|
|
@@ -1005,6 +1355,55 @@ const ttsRequestIdSchema = z
|
|
|
1005
1355
|
.min(1)
|
|
1006
1356
|
.optional()
|
|
1007
1357
|
.describe('Client-generated id for targeting this run with `cancel({ requestId })`.');
|
|
1358
|
+
// Per-request voice controls the addon takes on `run()`, `runStream()` and
|
|
1359
|
+
// `runStreaming()` alike. A request carries only an opaque modelId, so the
|
|
1360
|
+
// engine check (CosyVoice3 for `instruct`, Audio8 for the reference pair)
|
|
1361
|
+
// happens in the op once the model is known; the shape rules below hold on
|
|
1362
|
+
// every engine.
|
|
1363
|
+
const ttsRequestVoiceFieldsShape = {
|
|
1364
|
+
instruct: ttsCosyvoice3InstructSchema
|
|
1365
|
+
.optional()
|
|
1366
|
+
.describe('CosyVoice3 only: natural-language control for this synthesis (a structured object with one of dialect / volume / style, or a raw instruction string), replacing the loaded `instruct`, `emotion` or `pace`. One conditioning control per synthesis.'),
|
|
1367
|
+
referenceAudioSrc: modelSrcInputSchema
|
|
1368
|
+
.optional()
|
|
1369
|
+
.describe('Audio8 only: reference recording to clone for this request, replacing the loaded voice; requires `referenceText` and a loaded codec encoder (`audio8CodecEncoderModelSrc`). A remote source that is not cached yet downloads inside the request, which holds the model until it finishes: pre-fetch it with `downloadAsset()` or pass a local path.'),
|
|
1370
|
+
// Trimmed like the load-time referenceText: a whitespace-only transcript
|
|
1371
|
+
// would reach the engine as a non-empty value.
|
|
1372
|
+
referenceText: z
|
|
1373
|
+
.string()
|
|
1374
|
+
.trim()
|
|
1375
|
+
.min(1)
|
|
1376
|
+
.optional()
|
|
1377
|
+
.describe('Audio8 only: transcript of the reference recording. With `referenceAudioSrc`, what that recording says; alone, it corrects the transcript of the loaded recording.')
|
|
1378
|
+
};
|
|
1379
|
+
// Mirrors the addon's per-call rules that hold regardless of the loaded
|
|
1380
|
+
// engine: a per-call recording must bring its own transcript (the configured
|
|
1381
|
+
// one describes a different recording), and `instruct` is a CosyVoice3
|
|
1382
|
+
// control, so pairing it with an emotion or a non-moderate pace always breaks
|
|
1383
|
+
// the one-instruction rule.
|
|
1384
|
+
function refineTtsRequestVoiceFields(value, ctx) {
|
|
1385
|
+
if (value.referenceAudioSrc !== undefined && value.referenceText === undefined) {
|
|
1386
|
+
ctx.addIssue({
|
|
1387
|
+
code: 'custom',
|
|
1388
|
+
path: ['referenceText'],
|
|
1389
|
+
message: 'referenceText (the transcript of the reference recording) is required with referenceAudioSrc.'
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
if (value.instruct === undefined)
|
|
1393
|
+
return;
|
|
1394
|
+
const conflicting = value.emotion !== undefined
|
|
1395
|
+
? 'emotion'
|
|
1396
|
+
: value.pace !== undefined && value.pace !== 'moderate'
|
|
1397
|
+
? 'pace'
|
|
1398
|
+
: undefined;
|
|
1399
|
+
if (conflicting !== undefined) {
|
|
1400
|
+
ctx.addIssue({
|
|
1401
|
+
code: 'custom',
|
|
1402
|
+
path: [conflicting],
|
|
1403
|
+
message: `CosyVoice3 accepts one conditioning control per synthesis; got instruct and ${conflicting}. Set exactly one (pace "moderate" disengages the pace channel).`
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1008
1407
|
const ttsClientParamsShape = {
|
|
1009
1408
|
modelId: z.string(),
|
|
1010
1409
|
requestId: ttsRequestIdSchema,
|
|
@@ -1015,11 +1414,13 @@ const ttsClientParamsShape = {
|
|
|
1015
1414
|
sentenceStreamLocale: z.string().optional(),
|
|
1016
1415
|
sentenceStreamMaxChunkScalars: z.number().positive().optional(),
|
|
1017
1416
|
...ttsParlerDescriptionFieldsShape,
|
|
1417
|
+
...ttsRequestVoiceFieldsShape,
|
|
1018
1418
|
...ttsSoundEffectFieldsShape,
|
|
1019
1419
|
...ttsSpeechFieldsShape
|
|
1020
1420
|
};
|
|
1021
1421
|
function refineTtsRequest(value, ctx) {
|
|
1022
1422
|
refineParlerDescriptionFields(value, ctx);
|
|
1423
|
+
refineTtsRequestVoiceFields(value, ctx);
|
|
1023
1424
|
refineSpeechAudio(value, ctx);
|
|
1024
1425
|
if ((value.replyVoice !== undefined) !== (value.replyVoiceSampleRate !== undefined)) {
|
|
1025
1426
|
ctx.addIssue({
|
|
@@ -1039,6 +1440,7 @@ export const ttsRequestSchema = z
|
|
|
1039
1440
|
...ttsClientParamsShape,
|
|
1040
1441
|
type: z.literal('textToSpeech')
|
|
1041
1442
|
})
|
|
1443
|
+
.extend(trackedRequestSchema.shape)
|
|
1042
1444
|
.superRefine(refineTtsRequest);
|
|
1043
1445
|
// Mirrors @qvac/tts-ggml's `RuntimeStats`, using the same field names as the
|
|
1044
1446
|
// transcription and audio-gen stats so a caller reads one vocabulary across
|
|
@@ -1047,15 +1449,22 @@ export const ttsRequestSchema = z
|
|
|
1047
1449
|
// `realTimeFactor` = `totalTime` * 1000 / `audioDuration`.
|
|
1048
1450
|
//
|
|
1049
1451
|
// The chunked paths (`stream: true`, `sentenceStream`, and the duplex session)
|
|
1050
|
-
// run one native job per sentence
|
|
1051
|
-
//
|
|
1052
|
-
//
|
|
1053
|
-
// last sentence that reported them
|
|
1054
|
-
//
|
|
1452
|
+
// run one native job per sentence. The addon's aggregate sums the four
|
|
1453
|
+
// summable fields (totalTime, audioDuration, totalSamples, generatedFrames)
|
|
1454
|
+
// and keeps the backend fields below and Audio8's two Core ML flags from the
|
|
1455
|
+
// last sentence that reported them, so a chunked run reports where it ran
|
|
1456
|
+
// just as batch synthesis (`stream: false`) does. A field no sentence
|
|
1457
|
+
// reported stays absent.
|
|
1458
|
+
// Milliseconds, like every other `*Ms` field below.
|
|
1459
|
+
const ttsStageMsSchema = (stage) => z.number().optional().describe(`${stage} wall time of the last synthesis, in milliseconds.`);
|
|
1055
1460
|
export const ttsStatsSchema = z.object({
|
|
1056
1461
|
audioDuration: z.number().optional(),
|
|
1057
1462
|
totalTime: z.number().optional(),
|
|
1058
1463
|
realTimeFactor: z.number().optional(),
|
|
1464
|
+
firstAudioMs: z
|
|
1465
|
+
.number()
|
|
1466
|
+
.optional()
|
|
1467
|
+
.describe('Milliseconds from the start of the run to the first audio, where the engine reports it; a chunked run keeps the first sentence’s value.'),
|
|
1059
1468
|
tokensPerSecond: z.number().optional(),
|
|
1060
1469
|
totalSamples: z.number().optional(),
|
|
1061
1470
|
// Audio8 (on a fixed 46 ms grid) and MOSS (12.5 per second) count codec
|
|
@@ -1064,13 +1473,24 @@ export const ttsStatsSchema = z.object({
|
|
|
1064
1473
|
generatedFrames: z.number().optional(),
|
|
1065
1474
|
// Backend selection captured once at model load. `0` CPU / `1` GPU;
|
|
1066
1475
|
// `backendId` codes the family (0 CPU, 1 Metal, 2 CUDA, 3 Vulkan, 4 OpenCL,
|
|
1067
|
-
// 99 other GPU). The enhancer fields report
|
|
1068
|
-
// are `-1` when
|
|
1476
|
+
// 5 WebGPU, 99 other GPU). The enhancer and denoiser fields report each
|
|
1477
|
+
// LavaSR stage separately and are `-1` when that stage is not loaded.
|
|
1069
1478
|
backendDevice: z.number().optional(),
|
|
1070
|
-
backendId: z
|
|
1479
|
+
backendId: z
|
|
1480
|
+
.number()
|
|
1481
|
+
.optional()
|
|
1482
|
+
.describe('Backend family the engine ran on: `0` CPU, `1` Metal, `2` CUDA, `3` Vulkan, `4` OpenCL, `5` WebGPU, `99` other.'),
|
|
1071
1483
|
gpuUnsupported: z.number().optional(),
|
|
1072
1484
|
enhancerBackendDevice: z.number().optional(),
|
|
1073
1485
|
enhancerBackendId: z.number().optional(),
|
|
1486
|
+
denoiserBackendDevice: z
|
|
1487
|
+
.number()
|
|
1488
|
+
.optional()
|
|
1489
|
+
.describe('LavaSR denoiser device: `-1` not loaded, `0` CPU, `1` GPU, `2` Core ML-managed.'),
|
|
1490
|
+
denoiserBackendId: z
|
|
1491
|
+
.number()
|
|
1492
|
+
.optional()
|
|
1493
|
+
.describe('LavaSR denoiser backend family, same codes as `backendId`.'),
|
|
1074
1494
|
codecSidecarLoaded: z
|
|
1075
1495
|
.number()
|
|
1076
1496
|
.optional()
|
|
@@ -1078,7 +1498,76 @@ export const ttsStatsSchema = z.object({
|
|
|
1078
1498
|
codecOnCoreml: z
|
|
1079
1499
|
.number()
|
|
1080
1500
|
.optional()
|
|
1081
|
-
.describe('Audio8: `1` when this synthesis ran its codec on the Core ML sidecar, `0` when it ran on the ggml backend `backendId` reports.')
|
|
1501
|
+
.describe('Audio8: `1` when this synthesis ran its codec on the Core ML sidecar, `0` when it ran on the ggml backend `backendId` reports.'),
|
|
1502
|
+
// Parler Core ML sidecars (macOS / iOS): availability flags keep the last
|
|
1503
|
+
// report, the "used" flags are 1 only when every reported sentence used the
|
|
1504
|
+
// stage. None of them says which hardware Core ML scheduled the work on.
|
|
1505
|
+
decoderSidecarLoaded: z
|
|
1506
|
+
.number()
|
|
1507
|
+
.optional()
|
|
1508
|
+
.describe('Parler on macOS / iOS: `1` while the Core ML decoder sidecar is attached, `0` once a fallback retired it.'),
|
|
1509
|
+
dacSidecarLoaded: z
|
|
1510
|
+
.number()
|
|
1511
|
+
.optional()
|
|
1512
|
+
.describe('Parler on macOS / iOS: `1` while the Core ML DAC sidecar is attached, `0` once a fallback retired it.'),
|
|
1513
|
+
decoderOnCoreml: z
|
|
1514
|
+
.number()
|
|
1515
|
+
.optional()
|
|
1516
|
+
.describe('Parler: `1` when this synthesis ran its decoder steps on Core ML, `0` for ggml or a mixed run.'),
|
|
1517
|
+
dacOnCoreml: z
|
|
1518
|
+
.number()
|
|
1519
|
+
.optional()
|
|
1520
|
+
.describe('Parler: `1` when this synthesis ran its DAC on Core ML, `0` for ggml or a mixed run.'),
|
|
1521
|
+
// Chatterbox stage timings and counters.
|
|
1522
|
+
t3Ms: ttsStageMsSchema('Chatterbox T3 decode'),
|
|
1523
|
+
s3genMs: ttsStageMsSchema('Chatterbox S3Gen + HiFT'),
|
|
1524
|
+
t3Tokens: z
|
|
1525
|
+
.number()
|
|
1526
|
+
.optional()
|
|
1527
|
+
.describe('Chatterbox: speech tokens T3 emitted in the last synthesis.'),
|
|
1528
|
+
// CosyVoice3 and Audio8: the engine's own wall time, the sum of its stages.
|
|
1529
|
+
stageTotalMs: z
|
|
1530
|
+
.number()
|
|
1531
|
+
.optional()
|
|
1532
|
+
.describe('CosyVoice3 / Audio8: the engine’s own wall time for the last synthesis in milliseconds (the sum of its stages), excluding the addon’s post-processing.'),
|
|
1533
|
+
// CosyVoice3 stage timings.
|
|
1534
|
+
lmPrefillMs: ttsStageMsSchema('CosyVoice3 LM prefill'),
|
|
1535
|
+
lmDecodeMs: ttsStageMsSchema('CosyVoice3 LM decode'),
|
|
1536
|
+
flowFrontendMs: ttsStageMsSchema('CosyVoice3 flow front-end'),
|
|
1537
|
+
ditEulerMs: ttsStageMsSchema('CosyVoice3 DiT Euler'),
|
|
1538
|
+
hiftF0Ms: ttsStageMsSchema('CosyVoice3 HiFT F0'),
|
|
1539
|
+
hiftSourceMs: ttsStageMsSchema('CosyVoice3 HiFT source'),
|
|
1540
|
+
hiftStftMs: ttsStageMsSchema('CosyVoice3 HiFT STFT'),
|
|
1541
|
+
hiftDecodeMs: ttsStageMsSchema('CosyVoice3 HiFT decode'),
|
|
1542
|
+
// CosyVoice3 work counters.
|
|
1543
|
+
decodeSteps: z.number().optional().describe('CosyVoice3: LM decode steps of the last synthesis.'),
|
|
1544
|
+
speechTokens: z
|
|
1545
|
+
.number()
|
|
1546
|
+
.optional()
|
|
1547
|
+
.describe('CosyVoice3: speech tokens generated in the last synthesis.'),
|
|
1548
|
+
flowFrames: z
|
|
1549
|
+
.number()
|
|
1550
|
+
.optional()
|
|
1551
|
+
.describe('CosyVoice3: flow frames in (prompt + generated) of the last synthesis.'),
|
|
1552
|
+
melFrames: z.number().optional().describe('CosyVoice3: mel frames out of the last synthesis.'),
|
|
1553
|
+
textIds: z
|
|
1554
|
+
.number()
|
|
1555
|
+
.optional()
|
|
1556
|
+
.describe('CosyVoice3: text ids in the LM prefill of the last synthesis.'),
|
|
1557
|
+
promptSpeechTokens: z
|
|
1558
|
+
.number()
|
|
1559
|
+
.optional()
|
|
1560
|
+
.describe('CosyVoice3: prompt speech tokens the LM continued from.'),
|
|
1561
|
+
// Audio8 stage timings.
|
|
1562
|
+
voiceEncodeMs: ttsStageMsSchema('Audio8 reference-voice encode'),
|
|
1563
|
+
promptMs: ttsStageMsSchema('Audio8 prompt build'),
|
|
1564
|
+
prefillMs: ttsStageMsSchema('Audio8 prefill'),
|
|
1565
|
+
sampleMs: ttsStageMsSchema('Audio8 sampling'),
|
|
1566
|
+
fastDecodeMs: ttsStageMsSchema('Audio8 fast (local) decoder'),
|
|
1567
|
+
slowDecodeMs: ttsStageMsSchema('Audio8 slow (global) decoder'),
|
|
1568
|
+
codecLatentMs: ttsStageMsSchema('Audio8 codec latent'),
|
|
1569
|
+
codecSynthMs: ttsStageMsSchema('Audio8 codec synthesis'),
|
|
1570
|
+
resampleMs: ttsStageMsSchema('Audio8 resample')
|
|
1082
1571
|
});
|
|
1083
1572
|
// The rate of `buffer`. It is not a constant of the engine: `outputSampleRate`
|
|
1084
1573
|
// and the LavaSR enhancer both move it, so a caller writing a WAV or feeding
|
|
@@ -1089,10 +1578,23 @@ const ttsResponseSampleRateSchema = z
|
|
|
1089
1578
|
.positive()
|
|
1090
1579
|
.optional()
|
|
1091
1580
|
.describe('Sample rate in Hz of the signed 16-bit mono PCM in `buffer`.');
|
|
1581
|
+
// CosyVoice3 owns its speech-token trajectory and hands it back: with the PCM
|
|
1582
|
+
// in batch synthesis, on a final `isLast` frame with no audio under native
|
|
1583
|
+
// chunk streaming. One frame's array replays that one native synthesis through
|
|
1584
|
+
// the load config's `forceSpeechTokens`; the sentence paths run one synthesis
|
|
1585
|
+
// per sentence, so their arrays replay sentence by sentence, not joined.
|
|
1586
|
+
const ttsResponseSpeechTokenIdsSchema = z
|
|
1587
|
+
.array(ttsSpeechTokenIdSchema)
|
|
1588
|
+
.optional()
|
|
1589
|
+
.describe('CosyVoice3: the speech tokens of this native synthesis. Batch synthesis carries them with the PCM; native chunk streaming on a final `isLast` frame with no audio; the sentence paths once per sentence. Pass one array back as `forceSpeechTokens` to replay that synthesis (a joined sentence stream cannot be replayed as one).');
|
|
1092
1590
|
export const ttsResponseSchema = z.object({
|
|
1093
1591
|
type: z.literal('textToSpeech'),
|
|
1094
1592
|
text: z.string().optional().describe('MOSS-Speech reply text, including text-only replies.'),
|
|
1095
1593
|
buffer: z.array(z.number()),
|
|
1594
|
+
pcm: z
|
|
1595
|
+
.string()
|
|
1596
|
+
.optional()
|
|
1597
|
+
.describe('Base64 of the little-endian signed 16-bit PCM of this frame. When present, `buffer` is empty and this field carries the samples; decode with `withDecodedTtsPcm`.'),
|
|
1096
1598
|
done: z.boolean().default(false),
|
|
1097
1599
|
sampleRate: ttsResponseSampleRateSchema,
|
|
1098
1600
|
stats: ttsStatsSchema.optional(),
|
|
@@ -1102,6 +1604,7 @@ export const ttsResponseSchema = z.object({
|
|
|
1102
1604
|
.boolean()
|
|
1103
1605
|
.optional()
|
|
1104
1606
|
.describe('True on the final audio-bearing chunk of a pre-chunked synthesis. Absent when the chunk count is not known up front (streamed text in).'),
|
|
1607
|
+
speechTokenIds: ttsResponseSpeechTokenIdsSchema,
|
|
1105
1608
|
// On the terminal frame only: how the run ended. A run stopped by
|
|
1106
1609
|
// `cancel()` ends cleanly with `cancelled` rather than as an error.
|
|
1107
1610
|
stopReason: z.enum(['completed', 'cancelled']).optional()
|
|
@@ -1117,17 +1620,27 @@ const textToSpeechStreamRequestBaseShape = {
|
|
|
1117
1620
|
sentenceDelimiterPreset: z.enum(TTS_SENTENCE_DELIMITER_PRESETS).optional(),
|
|
1118
1621
|
maxBufferScalars: z.number().positive().optional(),
|
|
1119
1622
|
flushAfterMs: z.number().positive().optional(),
|
|
1120
|
-
...ttsParlerDescriptionFieldsShape
|
|
1623
|
+
...ttsParlerDescriptionFieldsShape,
|
|
1624
|
+
...ttsRequestVoiceFieldsShape
|
|
1121
1625
|
};
|
|
1626
|
+
function refineTextToSpeechStreamRequest(value, ctx) {
|
|
1627
|
+
refineParlerDescriptionFields(value, ctx);
|
|
1628
|
+
refineTtsRequestVoiceFields(value, ctx);
|
|
1629
|
+
}
|
|
1122
1630
|
export const textToSpeechStreamRequestSchema = z
|
|
1123
1631
|
.object({
|
|
1124
1632
|
...textToSpeechStreamRequestBaseShape,
|
|
1125
1633
|
type: z.literal('textToSpeechStream')
|
|
1126
1634
|
})
|
|
1127
|
-
.
|
|
1635
|
+
.extend(trackedRequestSchema.shape)
|
|
1636
|
+
.superRefine(refineTextToSpeechStreamRequest);
|
|
1128
1637
|
export const textToSpeechStreamResponseSchema = z.object({
|
|
1129
1638
|
type: z.literal('textToSpeechStream'),
|
|
1130
1639
|
buffer: z.array(z.number()),
|
|
1640
|
+
pcm: z
|
|
1641
|
+
.string()
|
|
1642
|
+
.optional()
|
|
1643
|
+
.describe('Base64 of the little-endian signed 16-bit PCM of this frame. When present, `buffer` is empty and this field carries the samples; decode with `withDecodedTtsPcm`.'),
|
|
1131
1644
|
done: z.boolean().default(false),
|
|
1132
1645
|
sampleRate: ttsResponseSampleRateSchema,
|
|
1133
1646
|
stats: ttsStatsSchema.optional(),
|
|
@@ -1137,6 +1650,7 @@ export const textToSpeechStreamResponseSchema = z.object({
|
|
|
1137
1650
|
.boolean()
|
|
1138
1651
|
.optional()
|
|
1139
1652
|
.describe('True on the final audio-bearing chunk of a pre-chunked synthesis. Absent when the chunk count is not known up front (streamed text in).'),
|
|
1653
|
+
speechTokenIds: ttsResponseSpeechTokenIdsSchema,
|
|
1140
1654
|
// On the terminal frame only: how the run ended. A run stopped by
|
|
1141
1655
|
// `cancel()` ends cleanly with `cancelled` rather than as an error.
|
|
1142
1656
|
stopReason: z.enum(['completed', 'cancelled']).optional()
|