@qvac/inference 0.23.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 +60 -28
- package/README.md +3 -1
- 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 +135 -44
- 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 +1 -1
- package/dist/api/completion-stream.js +2 -1
- package/dist/api/delete-cache.d.ts +7 -1
- package/dist/api/delete-cache.js +11 -1
- package/dist/api/diffusion.d.ts +14 -1
- package/dist/api/diffusion.js +14 -1
- package/dist/api/embed.d.ts +82 -29
- package/dist/api/embed.js +64 -18
- package/dist/api/get-model-info.d.ts +1 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +2 -1
- package/dist/api/rag.d.ts +1 -1
- package/dist/api/rag.js +1 -1
- package/dist/api/registry.d.ts +16 -6
- package/dist/api/registry.js +32 -9
- 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/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/dispatch.d.ts +10 -4
- package/dist/dispatch.js +65 -15
- package/dist/engine.d.ts +1 -1
- package/dist/errors/index.d.ts +70 -0
- package/dist/errors/index.js +128 -0
- 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 +17 -13
- package/dist/handlers/completion-orchestrate.d.ts +14 -2
- package/dist/handlers/completion-orchestrate.js +164 -22
- package/dist/handlers/delete-cache.d.ts +2 -1
- package/dist/handlers/delete-cache.js +6 -1
- package/dist/handlers/download-asset.js +11 -4
- package/dist/handlers/get-loaded-model-info.js +1 -0
- package/dist/handlers/get-model-info.js +71 -2
- package/dist/handlers/load-model/coreml-sidecars.d.ts +2 -13
- package/dist/handlers/load-model/coreml-sidecars.js +16 -119
- 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 +10 -2
- package/dist/handlers/load-model/download-manager.js +62 -11
- package/dist/handlers/load-model/handler.js +88 -35
- package/dist/handlers/load-model/http.js +327 -205
- package/dist/handlers/load-model/hyperdrive.d.ts +15 -0
- package/dist/handlers/load-model/hyperdrive.js +123 -50
- 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 +5 -0
- package/dist/handlers/load-model/registry-companion-set.js +19 -1
- 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 +4 -2
- package/dist/handlers/load-model/registry-download-utils.js +93 -22
- package/dist/handlers/load-model/registry.d.ts +20 -0
- package/dist/handlers/load-model/registry.js +308 -175
- package/dist/handlers/load-model/resolve.js +4 -1
- package/dist/handlers/load-model/types.d.ts +2 -0
- package/dist/handlers/logging-stream.js +17 -5
- package/dist/handlers/plugin-invoke.js +152 -39
- package/dist/handlers/registry.d.ts +2 -2
- package/dist/handlers/registry.js +105 -28
- 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/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/utils.js +10 -2
- package/dist/model-cache-layout.d.ts +1 -0
- package/dist/model-cache-layout.js +2 -0
- package/dist/model-fit/assess.d.ts +18 -67
- package/dist/model-fit/assess.js +96 -665
- package/dist/model-fit/describe.d.ts +12 -0
- package/dist/model-fit/describe.js +29 -0
- package/dist/model-fit/description/fetch.d.ts +1 -1
- package/dist/model-fit/description/fetch.js +95 -16
- package/dist/model-fit/description/resolve-load.d.ts +5 -3
- package/dist/model-fit/description/resolve-load.js +14 -14
- 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 +15 -33
- package/dist/model-fit/load-check.js +50 -195
- package/dist/model-fit/run/engine.d.ts +12 -72
- package/dist/model-fit/run/engine.js +4 -8
- package/dist/model-fit/run/run.d.ts +10 -7
- package/dist/model-fit/run/run.js +22 -18
- package/dist/model-fit/sum.d.ts +32 -0
- package/dist/model-fit/sum.js +60 -0
- package/dist/models/registry/models.d.ts +865 -128
- package/dist/models/registry/models.js +3737 -2963
- 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/{model-fit/request/engines/asr.js → plugins/builtin/asr-ggml/fit.js} +55 -71
- 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/{model-fit/request/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 +2 -1
- 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 +2 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +2 -1
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +143 -18
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +13 -1
- 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 +45 -4
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +8 -6
- package/dist/plugins/builtin/ggml-classification/plugin.d.ts +4 -1
- package/dist/plugins/builtin/ggml-classification/plugin.js +88 -8
- 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 +9 -3
- package/dist/plugins/builtin/ggml-ocr/plugin.js +107 -21
- 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 +3 -3
- package/dist/plugins/builtin/index.d.ts +1 -0
- package/dist/plugins/builtin/index.js +1 -0
- 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 +1 -1
- 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 +1 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +17 -3
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +61 -5
- 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/plugin.d.ts +148 -19
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +26 -9
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.d.ts +3 -1
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +5 -2
- package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +4 -2
- package/dist/plugins/builtin/llamacpp-decision/plugin.js +2 -2
- 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 +194 -4
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +37 -11
- package/dist/plugins/builtin/llamacpp-embedding/transform.d.ts +2 -2
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +23 -2
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.d.ts +3 -1
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.js +5 -2
- package/dist/plugins/builtin/llamacpp-rerank/plugin.d.ts +6 -5
- package/dist/plugins/builtin/llamacpp-rerank/plugin.js +2 -3
- package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +30 -3
- package/dist/plugins/builtin/moss-transcribe/plugin.js +5 -3
- 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 +14 -5
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +4 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +205 -9
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +39 -13
- 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 +4 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.js +8 -3
- 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 +3 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +4 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +4 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +7 -2
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +79 -16
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +29 -117
- 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 +2 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +22 -9
- 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 +51 -16
- 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 +368 -25
- package/dist/plugins/builtin/tts-ggml/plugin.js +180 -31
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +70 -7
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +8 -6
- 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 +1 -0
- package/dist/plugins/ops/kv-cache-utils.js +6 -2
- package/dist/plugins/ops/load-model.d.ts +2 -0
- package/dist/plugins/ops/load-model.js +33 -16
- package/dist/plugins/ops/transcribe.d.ts +5 -4
- package/dist/plugins/ops/transcribe.js +62 -27
- package/dist/plugins/ops/translate.d.ts +2 -1
- package/dist/plugins/ops/translate.js +4 -1
- package/dist/plugins/ops/unload-model.d.ts +17 -1
- package/dist/plugins/ops/unload-model.js +31 -2
- package/dist/plugins/turbovec-backend.d.ts +1 -1
- package/dist/plugins/turbovec-backend.js +16 -1
- package/dist/profiling/operation-metrics.js +22 -19
- 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 +50 -16
- package/dist/rag/handlers/ingest.js +2 -6
- package/dist/rag/handlers/search.d.ts +10 -1
- package/dist/rag/handlers/search.js +16 -7
- package/dist/rag/rag-operation-manager.d.ts +27 -3
- package/dist/rag/rag-operation-manager.js +10 -27
- package/dist/registry.js +5 -0
- package/dist/resources/collector.d.ts +70 -36
- package/dist/resources/collector.js +8 -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 +4 -1
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/lifecycle.d.ts +6 -4
- package/dist/runtime/lifecycle.js +9 -5
- package/dist/runtime/model-config-utils.js +5 -1
- package/dist/runtime/model-registry.d.ts +28 -4
- package/dist/runtime/model-registry.js +46 -1
- 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 +9 -1
- package/dist/runtime/request-context.js +25 -1
- package/dist/runtime/request-registry.d.ts +55 -7
- package/dist/runtime/request-registry.js +189 -71
- 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/vector-index-backend.d.ts +4 -0
- package/dist/runtime/vector-index-registry.d.ts +21 -0
- package/dist/runtime/vector-index-registry.js +56 -18
- package/dist/schemas/abort-signal.d.ts +8 -0
- package/dist/schemas/abort-signal.js +1 -0
- package/dist/schemas/assess-model-fit.d.ts +132 -282
- package/dist/schemas/assess-model-fit.js +82 -216
- package/dist/schemas/audio-gen.d.ts +278 -24
- package/dist/schemas/audio-gen.js +127 -23
- package/dist/schemas/batch-completion-stream.d.ts +105 -13
- package/dist/schemas/batch-completion-stream.js +8 -4
- package/dist/schemas/bci-config.d.ts +2 -1
- package/dist/schemas/bci.d.ts +54 -3
- package/dist/schemas/bci.js +11 -16
- package/dist/schemas/calc-tokens.d.ts +141 -0
- package/dist/schemas/calc-tokens.js +53 -0
- package/dist/schemas/cancel.d.ts +26 -0
- package/dist/schemas/cancel.js +10 -2
- package/dist/schemas/classification.d.ts +3 -0
- package/dist/schemas/classification.js +6 -2
- package/dist/schemas/common.d.ts +1831 -348
- package/dist/schemas/common.js +18 -2
- package/dist/schemas/completion-event.d.ts +3 -0
- package/dist/schemas/completion-event.js +1 -1
- package/dist/schemas/completion-stream.d.ts +162 -17
- package/dist/schemas/completion-stream.js +83 -13
- package/dist/schemas/config.d.ts +1212 -169
- package/dist/schemas/config.js +9 -13
- package/dist/schemas/decision.d.ts +4 -2
- package/dist/schemas/decision.js +2 -1
- package/dist/schemas/download-asset.d.ts +10 -5
- package/dist/schemas/download-asset.js +3 -6
- package/dist/schemas/embed.d.ts +286 -3
- package/dist/schemas/embed.js +162 -16
- package/dist/schemas/engine-addon-map.d.ts +1 -0
- package/dist/schemas/engine-addon-map.js +1 -0
- package/dist/schemas/errors.d.ts +12 -0
- package/dist/schemas/errors.js +66 -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 +7 -3
- package/dist/schemas/index.js +7 -3
- package/dist/schemas/lifecycle.d.ts +3 -0
- package/dist/schemas/lifecycle.js +13 -6
- package/dist/schemas/llamacpp-config.d.ts +269 -22
- package/dist/schemas/llamacpp-config.js +86 -7
- package/dist/schemas/load-model.d.ts +6418 -1960
- package/dist/schemas/load-model.js +39 -8
- package/dist/schemas/logging-stream.d.ts +1 -0
- package/dist/schemas/logging-stream.js +5 -2
- package/dist/schemas/model-config-schemas.d.ts +542 -116
- package/dist/schemas/model-config-schemas.js +2 -0
- 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 +17 -6
- 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 +10 -6
- package/dist/schemas/model-types.d.ts +8 -4
- package/dist/schemas/model-types.js +1 -0
- package/dist/schemas/ocr.d.ts +9 -4
- package/dist/schemas/ocr.js +6 -2
- package/dist/schemas/plugin.d.ts +62 -6
- package/dist/schemas/plugin.js +26 -4
- package/dist/schemas/profiling.d.ts +32 -32
- package/dist/schemas/rag.d.ts +9 -0
- package/dist/schemas/rag.js +10 -16
- package/dist/schemas/registry.d.ts +30 -10
- package/dist/schemas/registry.js +14 -6
- package/dist/schemas/reload-config.d.ts +41 -6
- package/dist/schemas/reload-config.js +11 -4
- package/dist/schemas/request-base.d.ts +39 -0
- package/dist/schemas/request-base.js +64 -0
- package/dist/schemas/rerank.d.ts +8 -7
- package/dist/schemas/rerank.js +6 -4
- package/dist/schemas/rpc-server.d.ts +3 -0
- package/dist/schemas/rpc-server.js +15 -15
- package/dist/schemas/sdcpp-config.d.ts +90 -20
- package/dist/schemas/sdcpp-config.js +96 -19
- 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 +1343 -271
- 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 +262 -2
- package/dist/schemas/transcription-config.js +122 -6
- package/dist/schemas/transcription.d.ts +93 -6
- package/dist/schemas/transcription.js +98 -21
- package/dist/schemas/translate.d.ts +2 -0
- package/dist/schemas/translate.js +5 -9
- package/dist/schemas/translation-config.d.ts +30 -20
- 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 +3 -3
- package/dist/surface.js +3 -3
- package/dist/utils/addon-responses.d.ts +69 -2
- package/dist/utils/archive.d.ts +7 -0
- package/dist/utils/archive.js +88 -29
- package/dist/utils/asr-events.d.ts +5 -0
- package/dist/utils/asr-events.js +10 -1
- package/dist/utils/cache/auto-history.js +3 -1
- package/dist/utils/cache/layout.d.ts +48 -0
- package/dist/utils/cache/layout.js +190 -0
- package/dist/utils/cache/paths.js +2 -4
- package/dist/utils/cache/types.d.ts +2 -1
- package/dist/utils/checksum.d.ts +5 -0
- package/dist/utils/checksum.js +18 -0
- package/dist/utils/completion-normalizer.js +286 -87
- package/dist/utils/gguf-tensor-extractor.d.ts +0 -6
- package/dist/utils/gguf-tensor-extractor.js +1 -50
- package/dist/utils/shard-utils.d.ts +0 -21
- package/dist/utils/shard-utils.js +12 -62
- package/dist/utils/tool-integration.d.ts +2 -2
- package/dist/utils/tools/defer.d.ts +39 -10
- package/dist/utils/tools/defer.js +72 -17
- package/dist/utils/tools/index.d.ts +1 -1
- package/dist/utils/tools/index.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 +42 -0
- package/dist/utils/tts-stats.js +120 -22
- package/package.json +43 -39
- package/dist/model-fit/classify.d.ts +0 -6
- package/dist/model-fit/classify.js +0 -166
- package/dist/model-fit/description/project.d.ts +0 -27
- package/dist/model-fit/description/project.js +0 -33
- package/dist/model-fit/floor.d.ts +0 -31
- package/dist/model-fit/floor.js +0 -65
- package/dist/model-fit/kv-cache.d.ts +0 -23
- package/dist/model-fit/kv-cache.js +0 -85
- package/dist/model-fit/platform.d.ts +0 -14
- package/dist/model-fit/platform.js +0 -26
- package/dist/model-fit/request/create.d.ts +0 -31
- package/dist/model-fit/request/create.js +0 -61
- package/dist/model-fit/request/engines/asr.d.ts +0 -14
- package/dist/model-fit/request/engines/audiogen.d.ts +0 -8
- package/dist/model-fit/request/engines/diffusion.d.ts +0 -7
- package/dist/model-fit/request/engines/diffusion.js +0 -93
- package/dist/model-fit/request/engines/llama.d.ts +0 -12
- package/dist/model-fit/request/engines/llama.js +0 -44
- package/dist/model-fit/request/engines/nmt.d.ts +0 -8
- package/dist/model-fit/request/engines/nmt.js +0 -11
- package/dist/model-fit/request/engines/ocr.d.ts +0 -9
- package/dist/model-fit/request/engines/ocr.js +0 -13
- package/dist/model-fit/request/engines/tts.d.ts +0 -10
- package/dist/model-fit/request/engines/tts.js +0 -152
- package/dist/models/registry/resource-profiles.d.ts +0 -17
- package/dist/models/registry/resource-profiles.js +0 -5859
- package/dist/schemas/model-resource-profile.d.ts +0 -109
- package/dist/schemas/model-resource-profile.js +0 -80
- /package/dist/model-fit/{request/gpu.d.ts → gpu.d.ts} +0 -0
- /package/dist/model-fit/{request/gpu.js → gpu.js} +0 -0
|
@@ -56,9 +56,10 @@ import { ttsRequestSchema } from '../../../../schemas/index.js';
|
|
|
56
56
|
import { nowMs } from '../../../../profiling/index.js';
|
|
57
57
|
import { buildStreamResult, hasDefinedValues } from '../../../../profiling/model-execution.js';
|
|
58
58
|
import { PluginRequestValidationFailedError, TextToSpeechFailedError } from '../../../../errors/index.js';
|
|
59
|
-
import {
|
|
59
|
+
import { carriesSpeechTokenIds, collectTtsStats, chunkMetadata, concatPcm, pcmFrame } from '../../../../utils/tts-stats.js';
|
|
60
60
|
import { assertParlerJobOptionsSupported, getParlerJobOptions, getTtsEngineType } from '../../../../plugins/builtin/tts-ggml/ops/parler-options.js';
|
|
61
61
|
import { bindTtsCancel, cancelIfAborted } from '../../../../plugins/builtin/tts-ggml/ops/cancel-binding.js';
|
|
62
|
+
import { assertVoiceJobOptionsSupported, resolveVoiceJobOptions } from '../../../../plugins/builtin/tts-ggml/ops/voice-options.js';
|
|
62
63
|
function hasRunStream(model) {
|
|
63
64
|
return (typeof model === 'object' &&
|
|
64
65
|
model !== null &&
|
|
@@ -79,7 +80,7 @@ function rethrowUnlessCancelled(error, signal) {
|
|
|
79
80
|
if (!signal.aborted)
|
|
80
81
|
throw error;
|
|
81
82
|
}
|
|
82
|
-
export async function* textToSpeech(params) {
|
|
83
|
+
export async function* textToSpeech(params, context) {
|
|
83
84
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
84
85
|
try {
|
|
85
86
|
const request = ttsRequestSchema.parse(params);
|
|
@@ -88,6 +89,7 @@ export async function* textToSpeech(params) {
|
|
|
88
89
|
const model = getModel(modelId);
|
|
89
90
|
const mossJobOptions = getMossJobOptions(model, request);
|
|
90
91
|
assertParlerJobOptionsSupported(model, parlerJobOptions, 'textToSpeech');
|
|
92
|
+
assertVoiceJobOptionsSupported(model, request, 'textToSpeech');
|
|
91
93
|
// MOSS streams natively: one job over the whole text, emitting a chunk every
|
|
92
94
|
// `streamChunkTokens` codec frames while the backbone is still generating.
|
|
93
95
|
// The sentence chunker behind `streamOutput` would restart the prompt per
|
|
@@ -102,9 +104,19 @@ export async function* textToSpeech(params) {
|
|
|
102
104
|
(sentenceStreamLocale !== undefined || sentenceStreamMaxChunkScalars !== undefined)) {
|
|
103
105
|
throw new PluginRequestValidationFailedError('textToSpeech', 'sentenceStreamLocale and sentenceStreamMaxChunkScalars need the sentence chunker; MOSS streams the whole text natively, so they only apply with sentenceStream: true');
|
|
104
106
|
}
|
|
105
|
-
const ctx = __addDisposableResource(env_1, await bindTtsCancel(model, modelId, request.requestId), true);
|
|
107
|
+
const ctx = __addDisposableResource(env_1, await bindTtsCancel(model, modelId, request.requestId, request.sessionId, context), true);
|
|
106
108
|
if (ctx.signal.aborted)
|
|
107
109
|
return { ...buildStreamResult(0), cancelled: true };
|
|
110
|
+
// Resolved inside the request context: an uncached remote reference
|
|
111
|
+
// recording downloads here, and a cancel has to be able to stop that.
|
|
112
|
+
const voiceJobOptions = await resolveVoiceJobOptions(request, {
|
|
113
|
+
signal: ctx.signal,
|
|
114
|
+
scope: ctx.scope,
|
|
115
|
+
requestId: ctx.requestId,
|
|
116
|
+
sessionId: ctx.sessionId
|
|
117
|
+
});
|
|
118
|
+
if (voiceJobOptions === null)
|
|
119
|
+
return { ...buildStreamResult(0), cancelled: true };
|
|
108
120
|
const modelStart = nowMs();
|
|
109
121
|
if (sentenceStream) {
|
|
110
122
|
if (!hasRunStream(model)) {
|
|
@@ -112,19 +124,23 @@ export async function* textToSpeech(params) {
|
|
|
112
124
|
}
|
|
113
125
|
const streamOpts = sentenceStreamLocale !== undefined ||
|
|
114
126
|
sentenceStreamMaxChunkScalars !== undefined ||
|
|
115
|
-
Object.keys(parlerJobOptions).length > 0
|
|
127
|
+
Object.keys(parlerJobOptions).length > 0 ||
|
|
128
|
+
Object.keys(voiceJobOptions).length > 0
|
|
116
129
|
? {
|
|
117
130
|
...(sentenceStreamLocale !== undefined ? { locale: sentenceStreamLocale } : {}),
|
|
118
131
|
...(sentenceStreamMaxChunkScalars !== undefined
|
|
119
132
|
? { maxChunkScalars: sentenceStreamMaxChunkScalars }
|
|
120
133
|
: {}),
|
|
121
|
-
...parlerJobOptions
|
|
134
|
+
...parlerJobOptions,
|
|
135
|
+
...voiceJobOptions
|
|
122
136
|
}
|
|
123
137
|
: undefined;
|
|
124
138
|
const response = await model.runStream(text, streamOpts);
|
|
125
139
|
if (!stream) {
|
|
126
|
-
const
|
|
140
|
+
const parts = [];
|
|
127
141
|
let sampleRate;
|
|
142
|
+
const speechTokenIds = [];
|
|
143
|
+
let sawSpeechTokenIds = false;
|
|
128
144
|
try {
|
|
129
145
|
for await (const data of response.iterate()) {
|
|
130
146
|
if (await cancelIfAborted(model, ctx.signal))
|
|
@@ -132,7 +148,11 @@ export async function* textToSpeech(params) {
|
|
|
132
148
|
// lunte-disable-next-line eqeqeq -- `!= null` intentionally matches null and undefined
|
|
133
149
|
if (data.outputArray != null) {
|
|
134
150
|
sampleRate ??= data.sampleRate;
|
|
135
|
-
|
|
151
|
+
parts.push(data.outputArray);
|
|
152
|
+
}
|
|
153
|
+
if (data.speechTokenIds !== undefined) {
|
|
154
|
+
sawSpeechTokenIds = true;
|
|
155
|
+
speechTokenIds.push(...data.speechTokenIds);
|
|
136
156
|
}
|
|
137
157
|
}
|
|
138
158
|
}
|
|
@@ -142,7 +162,11 @@ export async function* textToSpeech(params) {
|
|
|
142
162
|
// A cancelled collect must not hand back a partial buffer as if complete.
|
|
143
163
|
if (ctx.signal.aborted)
|
|
144
164
|
return finish(modelStart, response, true);
|
|
145
|
-
yield {
|
|
165
|
+
yield {
|
|
166
|
+
...pcmFrame(concatPcm(parts)),
|
|
167
|
+
...(sampleRate !== undefined ? { sampleRate } : {}),
|
|
168
|
+
...(sawSpeechTokenIds ? { speechTokenIds } : {})
|
|
169
|
+
};
|
|
146
170
|
return finish(modelStart, response, false);
|
|
147
171
|
}
|
|
148
172
|
try {
|
|
@@ -152,10 +176,11 @@ export async function* textToSpeech(params) {
|
|
|
152
176
|
// lunte-disable-next-line eqeqeq -- `== null` intentionally matches null and undefined
|
|
153
177
|
if (data.outputArray == null)
|
|
154
178
|
continue;
|
|
155
|
-
|
|
156
|
-
|
|
179
|
+
// An empty chunk is a native end marker, unless it carries the run's
|
|
180
|
+
// speech tokens (CosyVoice3 native streaming), which the caller wants.
|
|
181
|
+
if (data.outputArray.length === 0 && !carriesSpeechTokenIds(data))
|
|
157
182
|
continue;
|
|
158
|
-
yield {
|
|
183
|
+
yield { ...pcmFrame(data.outputArray), ...chunkMetadata(data) };
|
|
159
184
|
}
|
|
160
185
|
}
|
|
161
186
|
catch (error) {
|
|
@@ -184,12 +209,17 @@ export async function* textToSpeech(params) {
|
|
|
184
209
|
? { maxChunkScalars: sentenceStreamMaxChunkScalars }
|
|
185
210
|
: {}),
|
|
186
211
|
...parlerJobOptions,
|
|
212
|
+
...voiceJobOptions,
|
|
187
213
|
...mossJobOptions
|
|
188
214
|
}));
|
|
189
215
|
if (!stream || batchEngine) {
|
|
190
|
-
const
|
|
216
|
+
const parts = [];
|
|
191
217
|
let sampleRate;
|
|
192
218
|
let replyText;
|
|
219
|
+
// CosyVoice3 batch output carries the run's speech tokens with the PCM;
|
|
220
|
+
// under native chunk streaming they arrive on the final empty chunk.
|
|
221
|
+
const speechTokenIds = [];
|
|
222
|
+
let sawSpeechTokenIds = false;
|
|
193
223
|
try {
|
|
194
224
|
for await (const data of response.iterate()) {
|
|
195
225
|
if (await cancelIfAborted(model, ctx.signal))
|
|
@@ -197,7 +227,11 @@ export async function* textToSpeech(params) {
|
|
|
197
227
|
sampleRate ??= data.sampleRate;
|
|
198
228
|
if (data.text !== undefined)
|
|
199
229
|
replyText = data.text;
|
|
200
|
-
|
|
230
|
+
if (data.speechTokenIds !== undefined) {
|
|
231
|
+
sawSpeechTokenIds = true;
|
|
232
|
+
speechTokenIds.push(...data.speechTokenIds);
|
|
233
|
+
}
|
|
234
|
+
parts.push(data.outputArray);
|
|
201
235
|
}
|
|
202
236
|
}
|
|
203
237
|
catch (error) {
|
|
@@ -206,9 +240,10 @@ export async function* textToSpeech(params) {
|
|
|
206
240
|
if (ctx.signal.aborted)
|
|
207
241
|
return finish(modelStart, response, true);
|
|
208
242
|
yield {
|
|
209
|
-
|
|
243
|
+
...pcmFrame(concatPcm(parts)),
|
|
210
244
|
...(sampleRate !== undefined ? { sampleRate } : {}),
|
|
211
|
-
...(replyText !== undefined ? { text: replyText } : {})
|
|
245
|
+
...(replyText !== undefined ? { text: replyText } : {}),
|
|
246
|
+
...(sawSpeechTokenIds ? { speechTokenIds } : {})
|
|
212
247
|
};
|
|
213
248
|
return finish(modelStart, response, false);
|
|
214
249
|
}
|
|
@@ -216,7 +251,7 @@ export async function* textToSpeech(params) {
|
|
|
216
251
|
for await (const data of response.iterate()) {
|
|
217
252
|
if (await cancelIfAborted(model, ctx.signal))
|
|
218
253
|
continue;
|
|
219
|
-
yield {
|
|
254
|
+
yield { ...pcmFrame(data.outputArray), ...chunkMetadata(data) };
|
|
220
255
|
}
|
|
221
256
|
}
|
|
222
257
|
catch (error) {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TextToSpeechStreamRequest, TtsRequest, TtsCosyvoice3Instruct } from '../../../../schemas/index.js';
|
|
2
|
+
import type { DownloadRequestBinding } from '../../../../handlers/load-model/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Per-request voice controls, spelled as @qvac/tts-ggml takes them on `run()`,
|
|
5
|
+
* `runStream()` and `runStreaming()`: CosyVoice3's `instruct` and Audio8's
|
|
6
|
+
* per-call reference recording (a resolved local path) with its transcript.
|
|
7
|
+
*/
|
|
8
|
+
export type VoiceJobOptions = {
|
|
9
|
+
instruct?: string | {
|
|
10
|
+
dialect?: string;
|
|
11
|
+
volume?: string;
|
|
12
|
+
style?: string;
|
|
13
|
+
};
|
|
14
|
+
referenceAudio?: string;
|
|
15
|
+
referenceText?: string;
|
|
16
|
+
};
|
|
17
|
+
type VoiceOptionsRequest = Pick<TtsRequest | TextToSpeechStreamRequest, 'instruct' | 'referenceAudioSrc' | 'referenceText'>;
|
|
18
|
+
export declare function toAddonInstruct(instruct: TtsCosyvoice3Instruct): string | {
|
|
19
|
+
style?: "peppa" | "robot";
|
|
20
|
+
volume?: "loud" | "soft";
|
|
21
|
+
dialect?: "cantonese" | "northeastern" | "gansu" | "guizhou" | "henan" | "hubei" | "hunan" | "jiangxi" | "minnan" | "ningxia" | "shanxi" | "shaanxi" | "shandong" | "shanghai" | "sichuan" | "tianjin" | "yunnan";
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Rejects per-request voice controls the loaded engine does not take. The
|
|
25
|
+
* request schema only knows an opaque modelId, so the engine check lives here:
|
|
26
|
+
* the addon would reject the same fields with its own throw, and naming the SDK
|
|
27
|
+
* field and the engine that takes it is clearer than surfacing that.
|
|
28
|
+
*
|
|
29
|
+
* Synchronous on purpose: both ops call it before they open their request
|
|
30
|
+
* context, so a request that can never run fails without queueing for the
|
|
31
|
+
* model.
|
|
32
|
+
*/
|
|
33
|
+
export declare function assertVoiceJobOptionsSupported(model: unknown, request: VoiceOptionsRequest, handlerName: 'textToSpeech' | 'textToSpeechStream'): void;
|
|
34
|
+
/**
|
|
35
|
+
* The per-request voice controls in the addon's spelling, or `null` when the
|
|
36
|
+
* request was cancelled while its reference recording was being resolved,
|
|
37
|
+
* whether that resolution then failed or succeeded.
|
|
38
|
+
*
|
|
39
|
+
* `referenceAudioSrc` goes through the same source resolution as the load-time
|
|
40
|
+
* `referenceAudioSrc` (a local path, or a registry / remote source cached on
|
|
41
|
+
* first use), so a request can name a voice the same way a load config does.
|
|
42
|
+
* An uncached remote source downloads here, which can take as long as the
|
|
43
|
+
* synthesis itself. The op therefore resolves it inside its request context
|
|
44
|
+
* and hands that context over as `binding`: the request is already in the
|
|
45
|
+
* registry, so `cancel({ modelId })` finds it, and the download is subscribed
|
|
46
|
+
* to its abort signal, so that cancel and `cancel({ requestId })` both stop
|
|
47
|
+
* the transfer instead of letting speech generation follow it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveVoiceJobOptions(request: VoiceOptionsRequest, binding: DownloadRequestBinding): Promise<VoiceJobOptions | null>;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { PluginRequestValidationFailedError } from '../../../../errors/index.js';
|
|
2
|
+
import { resolveModelPath } from '../../../../handlers/load-model/resolve.js';
|
|
3
|
+
import { getTtsEngineType } from '../../../../plugins/builtin/tts-ggml/ops/parler-options.js';
|
|
4
|
+
// Rebuild the structured instruct without explicit-undefined keys so it
|
|
5
|
+
// satisfies the addon's exactOptionalPropertyTypes typing.
|
|
6
|
+
export function toAddonInstruct(instruct) {
|
|
7
|
+
if (typeof instruct === 'string')
|
|
8
|
+
return instruct;
|
|
9
|
+
return {
|
|
10
|
+
...(instruct.dialect !== undefined ? { dialect: instruct.dialect } : {}),
|
|
11
|
+
...(instruct.volume !== undefined ? { volume: instruct.volume } : {}),
|
|
12
|
+
...(instruct.style !== undefined ? { style: instruct.style } : {})
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Rejects per-request voice controls the loaded engine does not take. The
|
|
17
|
+
* request schema only knows an opaque modelId, so the engine check lives here:
|
|
18
|
+
* the addon would reject the same fields with its own throw, and naming the SDK
|
|
19
|
+
* field and the engine that takes it is clearer than surfacing that.
|
|
20
|
+
*
|
|
21
|
+
* Synchronous on purpose: both ops call it before they open their request
|
|
22
|
+
* context, so a request that can never run fails without queueing for the
|
|
23
|
+
* model.
|
|
24
|
+
*/
|
|
25
|
+
export function assertVoiceJobOptionsSupported(model, request, handlerName) {
|
|
26
|
+
const engine = getTtsEngineType(model);
|
|
27
|
+
if (request.instruct !== undefined && engine !== 'cosyvoice3') {
|
|
28
|
+
throw new PluginRequestValidationFailedError(handlerName, `instruct is only supported by CosyVoice3 models (engine is ${engine ?? 'unknown'})`);
|
|
29
|
+
}
|
|
30
|
+
const referenceKeys = ['referenceAudioSrc', 'referenceText'].filter((key) => request[key] !== undefined);
|
|
31
|
+
if (referenceKeys.length > 0 && engine !== 'audio8') {
|
|
32
|
+
throw new PluginRequestValidationFailedError(handlerName, `${referenceKeys.join(', ')} ${referenceKeys.length === 1 ? 'is' : 'are'} only supported per request by Audio8 models (engine is ${engine ?? 'unknown'})`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The per-request voice controls in the addon's spelling, or `null` when the
|
|
37
|
+
* request was cancelled while its reference recording was being resolved,
|
|
38
|
+
* whether that resolution then failed or succeeded.
|
|
39
|
+
*
|
|
40
|
+
* `referenceAudioSrc` goes through the same source resolution as the load-time
|
|
41
|
+
* `referenceAudioSrc` (a local path, or a registry / remote source cached on
|
|
42
|
+
* first use), so a request can name a voice the same way a load config does.
|
|
43
|
+
* An uncached remote source downloads here, which can take as long as the
|
|
44
|
+
* synthesis itself. The op therefore resolves it inside its request context
|
|
45
|
+
* and hands that context over as `binding`: the request is already in the
|
|
46
|
+
* registry, so `cancel({ modelId })` finds it, and the download is subscribed
|
|
47
|
+
* to its abort signal, so that cancel and `cancel({ requestId })` both stop
|
|
48
|
+
* the transfer instead of letting speech generation follow it.
|
|
49
|
+
*/
|
|
50
|
+
export async function resolveVoiceJobOptions(request, binding) {
|
|
51
|
+
let referenceAudio;
|
|
52
|
+
if (request.referenceAudioSrc !== undefined) {
|
|
53
|
+
try {
|
|
54
|
+
referenceAudio = await resolveModelPath(request.referenceAudioSrc, undefined, undefined, binding.signal, { requestBinding: binding });
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (binding.signal.aborted)
|
|
58
|
+
return null;
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
// A resolution that succeeds does not mean the request is still wanted: a
|
|
62
|
+
// local or cached source only awaits a file check, which no signal
|
|
63
|
+
// interrupts. A cancel that lands during that wait has already fired the
|
|
64
|
+
// op's once-only `model.cancel()`, before any job existed, so starting the
|
|
65
|
+
// engine now would run a cancelled request to completion.
|
|
66
|
+
if (binding.signal.aborted)
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...(request.instruct !== undefined ? { instruct: toAddonInstruct(request.instruct) } : {}),
|
|
71
|
+
...(referenceAudio !== undefined ? { referenceAudio } : {}),
|
|
72
|
+
...(request.referenceText !== undefined ? { referenceText: request.referenceText } : {})
|
|
73
|
+
};
|
|
74
|
+
}
|