@qvac/inference 0.22.0 → 0.23.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 +59 -40
- package/README.md +1 -1
- package/dist/api/audio-gen.js +1 -1
- package/dist/api/completion-stream.d.ts +2 -1
- package/dist/api/completion-stream.js +3 -1
- package/dist/api/decide.js +1 -1
- package/dist/api/diffusion.d.ts +18 -1
- package/dist/api/diffusion.js +18 -1
- package/dist/api/download-asset.js +1 -1
- package/dist/api/finetune.js +1 -1
- package/dist/api/index.d.ts +39 -38
- package/dist/api/index.js +38 -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/registry.d.ts +2 -1
- package/dist/api/registry.js +5 -4
- 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/unload-model.js +1 -1
- 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 +3 -2
- package/dist/dispatch.js +16 -4
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.js +13 -1
- package/dist/handlers/assess-model-fit.d.ts +1 -1
- package/dist/handlers/assess-model-fit.js +4 -4
- package/dist/handlers/cancelHandler.js +1 -1
- package/dist/handlers/completion-orchestrate.js +2 -2
- package/dist/handlers/download-asset.js +2 -2
- package/dist/handlers/finetune.js +1 -1
- package/dist/handlers/get-loaded-model-info.js +2 -3
- package/dist/handlers/get-model-info.js +1 -1
- package/dist/handlers/load-model/coreml-sidecars.d.ts +15 -0
- package/dist/handlers/load-model/coreml-sidecars.js +71 -8
- package/dist/handlers/load-model/download-manager.d.ts +1 -1
- 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 +10 -7
- 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 +3 -3
- package/dist/handlers/load-model/hyperdrive.d.ts +1 -1
- package/dist/handlers/load-model/hyperdrive.js +2 -2
- 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-companion-set.d.ts +1 -1
- package/dist/handlers/load-model/registry-companion-set.js +1 -1
- package/dist/handlers/load-model/registry-download-utils.d.ts +3 -3
- package/dist/handlers/load-model/registry-download-utils.js +2 -2
- package/dist/handlers/load-model/registry.d.ts +2 -2
- package/dist/handlers/load-model/registry.js +5 -5
- 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 +5 -5
- package/dist/handlers/logging-stream.d.ts +2 -1
- package/dist/handlers/logging-stream.js +23 -7
- package/dist/handlers/registry.js +4 -2
- package/dist/handlers/types.d.ts +7 -1
- package/dist/handlers/vector-index.js +2 -2
- 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 +1 -1
- package/dist/{resources/model-fit → model-fit}/assess.d.ts +4 -4
- package/dist/{resources/model-fit → model-fit}/assess.js +3 -3
- package/dist/{resources/model-fit/native-probe/classify-fit.d.ts → model-fit/classify.d.ts} +2 -2
- package/dist/{resources/model-fit/native-probe/classify-fit.js → model-fit/classify.js} +4 -4
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.d.ts → model-fit/description/fetch.d.ts} +1 -1
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.js → model-fit/description/fetch.js} +5 -5
- package/dist/{resources/model-fit/fit-stub/project-fit-from-load.d.ts → model-fit/description/project.d.ts} +3 -3
- package/dist/{resources/model-fit/fit-stub/project-fit-from-load.js → model-fit/description/project.js} +2 -2
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.d.ts → model-fit/description/resolve-load.d.ts} +3 -3
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.js → model-fit/description/resolve-load.js} +6 -6
- package/dist/{resources/model-fit → model-fit}/floor.d.ts +2 -2
- package/dist/{resources/model-fit → model-fit}/floor.js +1 -1
- package/dist/{resources/model-fit → model-fit}/kv-cache.d.ts +1 -1
- package/dist/{resources/model-fit/native-probe/advisory-fit.d.ts → model-fit/load-check.d.ts} +8 -10
- package/dist/{resources/model-fit/native-probe/advisory-fit.js → model-fit/load-check.js} +14 -40
- package/dist/{resources/model-fit/types.d.ts → model-fit/platform.d.ts} +8 -0
- package/dist/{resources/model-fit/native-probe/create-fit-request.d.ts → model-fit/request/create.d.ts} +3 -3
- package/dist/{resources/model-fit/native-probe/create-fit-request.js → model-fit/request/create.js} +8 -8
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/asr.d.ts +2 -2
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/asr.js +9 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/audiogen.d.ts +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/audiogen.js +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/diffusion.d.ts +1 -1
- package/dist/model-fit/request/engines/diffusion.js +93 -0
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/llama.d.ts +2 -2
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/llama.js +13 -10
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/nmt.d.ts +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/nmt.js +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/ocr.d.ts +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/ocr.js +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/tts.d.ts +2 -2
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/tts.js +1 -1
- package/dist/{resources/model-fit/native-probe/engine-fit.d.ts → model-fit/run/engine.d.ts} +3 -4
- package/dist/{resources/model-fit/native-probe/engine-fit.js → model-fit/run/engine.js} +1 -1
- package/dist/model-fit/run/run.d.ts +43 -0
- package/dist/model-fit/run/run.js +204 -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 +510 -0
- package/dist/models/registry/models.js +2946 -2410
- package/dist/models/registry/resource-profiles.js +203 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +2 -2
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +2 -2
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +2 -2
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +60 -54
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +4 -4
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +26 -25
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +4 -4
- package/dist/plugins/builtin/ggml-classification/plugin.d.ts +4 -4
- package/dist/plugins/builtin/ggml-classification/plugin.js +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +11 -10
- package/dist/plugins/builtin/ggml-ocr/plugin.js +4 -4
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +12 -12
- package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
- package/dist/plugins/builtin/index.d.ts +15 -14
- package/dist/plugins/builtin/index.js +15 -14
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +5 -7
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +2 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +6 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +1 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +36 -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 +169 -78
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +26 -17
- 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.js +1 -1
- package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +39 -33
- package/dist/plugins/builtin/llamacpp-decision/plugin.js +4 -3
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +7 -6
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +16 -6
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +6 -0
- 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 +5 -0
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.js +117 -0
- package/dist/plugins/builtin/llamacpp-rerank/plugin.d.ts +91 -0
- package/dist/plugins/builtin/llamacpp-rerank/plugin.js +45 -0
- package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +16 -16
- package/dist/plugins/builtin/moss-transcribe/plugin.js +4 -4
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +18 -13
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +4 -4
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +29 -29
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +4 -4
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.d.ts +5 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.js +168 -52
- package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +5 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +19 -8
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +2 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +1 -1
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +90 -34
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +45 -45
- 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/ops/text-to-speech-stream.d.ts +1 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +2 -2
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +2 -2
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +47 -32
- package/dist/plugins/builtin/tts-ggml/plugin.js +3 -3
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +34 -33
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +4 -4
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/ops/kv-cache-utils.d.ts +4 -3
- package/dist/plugins/ops/kv-cache-utils.js +15 -8
- package/dist/plugins/ops/load-model.d.ts +8 -2
- package/dist/plugins/ops/load-model.js +14 -5
- package/dist/plugins/ops/transcribe.js +1 -1
- package/dist/plugins/ops/translate.js +3 -3
- package/dist/plugins/ops/unload-model.js +1 -1
- package/dist/plugins/turbovec-backend.js +5 -5
- 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 +2 -2
- package/dist/profiling/operation-wrappers.js +3 -3
- package/dist/profiling/profiler.js +1 -1
- package/dist/rag/handler.js +1 -1
- 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 +1 -1
- 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.js +1 -1
- package/dist/rag/index.d.ts +11 -11
- package/dist/rag/index.js +11 -11
- package/dist/rag/rag-workspace-manager.js +1 -1
- package/dist/registry.js +2 -1
- package/dist/resources/collector.d.ts +1 -1
- package/dist/resources/collector.js +1 -1
- 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/rpc/inventory.js +3 -3
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/lifecycle.js +7 -7
- package/dist/runtime/model-config-utils.js +3 -0
- package/dist/runtime/model-registry.d.ts +3 -1
- package/dist/runtime/model-registry.js +2 -1
- package/dist/runtime/registry-client.js +1 -1
- package/dist/runtime/request-context.d.ts +3 -3
- package/dist/runtime/request-context.js +14 -1
- package/dist/runtime/request-registry.d.ts +1 -1
- package/dist/runtime/request-registry.js +1 -1
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/vector-index-backend.d.ts +2 -2
- package/dist/runtime/vector-index-registry.d.ts +5 -5
- package/dist/runtime/vector-index-registry.js +36 -13
- package/dist/schemas/assess-model-fit.d.ts +6 -0
- package/dist/schemas/assess-model-fit.js +4 -4
- package/dist/schemas/audio-gen.d.ts +13 -1
- package/dist/schemas/audio-gen.js +3 -3
- package/dist/schemas/batch-completion-stream.d.ts +8 -2
- package/dist/schemas/batch-completion-stream.js +3 -3
- package/dist/schemas/bci-config.d.ts +1 -0
- package/dist/schemas/bci-config.js +2 -2
- package/dist/schemas/bci.d.ts +1 -1
- package/dist/schemas/bci.js +2 -2
- package/dist/schemas/cancel.d.ts +5 -0
- package/dist/schemas/cancel.js +1 -0
- package/dist/schemas/common.d.ts +478 -100
- package/dist/schemas/common.js +35 -32
- package/dist/schemas/completion-event.d.ts +8 -2
- package/dist/schemas/completion-event.js +4 -1
- package/dist/schemas/completion-stream.d.ts +11 -2
- package/dist/schemas/completion-stream.js +37 -10
- package/dist/schemas/config.d.ts +849 -6
- package/dist/schemas/config.js +12 -10
- package/dist/schemas/decision.d.ts +8 -0
- package/dist/schemas/decision.js +14 -0
- package/dist/schemas/download-asset.d.ts +6 -4
- package/dist/schemas/download-asset.js +1 -1
- package/dist/schemas/engine-addon-map.d.ts +2 -1
- package/dist/schemas/engine-addon-map.js +4 -3
- package/dist/schemas/errors.d.ts +1 -0
- package/dist/schemas/errors.js +6 -1
- package/dist/schemas/index.d.ts +51 -50
- package/dist/schemas/index.js +50 -49
- package/dist/schemas/llamacpp-config.d.ts +182 -6
- package/dist/schemas/llamacpp-config.js +102 -7
- package/dist/schemas/load-model.d.ts +3176 -646
- package/dist/schemas/load-model.js +34 -1
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-config-schemas.d.ts +195 -1
- package/dist/schemas/model-config-schemas.js +14 -12
- package/dist/schemas/model-fit-policy.d.ts +1 -1
- package/dist/schemas/model-info.js +2 -2
- package/dist/schemas/model-resource-profile.d.ts +1 -0
- package/dist/schemas/model-resource-profile.js +1 -1
- package/dist/schemas/model-src-utils.d.ts +6 -2
- package/dist/schemas/model-src-utils.js +2 -2
- package/dist/schemas/model-types.d.ts +5 -1
- package/dist/schemas/model-types.js +1 -0
- package/dist/schemas/ocr.d.ts +2 -0
- package/dist/schemas/ocr.js +1 -1
- package/dist/schemas/plugin.d.ts +9 -3
- package/dist/schemas/plugin.js +6 -0
- package/dist/schemas/profiling.js +1 -1
- package/dist/schemas/rag.js +1 -1
- package/dist/schemas/registry.d.ts +8 -0
- package/dist/schemas/registry.js +2 -1
- package/dist/schemas/reload-config.d.ts +6 -2
- package/dist/schemas/reload-config.js +2 -2
- package/dist/schemas/rerank.d.ts +131 -0
- package/dist/schemas/rerank.js +102 -0
- package/dist/schemas/sdcpp-config.d.ts +56 -0
- package/dist/schemas/sdcpp-config.js +33 -15
- package/dist/schemas/text-to-speech.d.ts +61 -0
- package/dist/schemas/transcription-config.d.ts +5 -0
- package/dist/schemas/transcription-config.js +16 -1
- package/dist/schemas/transcription.d.ts +1 -1
- package/dist/schemas/transcription.js +1 -1
- package/dist/schemas/translate.d.ts +2 -2
- package/dist/schemas/translate.js +1 -1
- package/dist/schemas/translation-config.d.ts +20 -10
- package/dist/schemas/translation-config.js +1 -1
- package/dist/surface.d.ts +2 -1
- package/dist/surface.js +2 -1
- package/dist/utils/addon-responses.d.ts +2 -0
- package/dist/utils/aggregate-events.d.ts +1 -1
- package/dist/utils/aggregate-events.js +2 -2
- package/dist/utils/archive.js +2 -2
- 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 +2 -2
- package/dist/utils/cache/paths.js +6 -6
- package/dist/utils/checksum.d.ts +2 -0
- package/dist/utils/checksum.js +41 -2
- package/dist/utils/completion-normalizer.js +1 -1
- package/dist/utils/gguf-architecture.d.ts +7 -0
- package/dist/utils/gguf-architecture.js +142 -0
- package/dist/utils/gguf-tensor-extractor.js +1 -1
- 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 +5 -0
- package/dist/utils/shard-utils.js +19 -3
- package/dist/utils/tool-integration.d.ts +1 -0
- package/dist/utils/tool-integration.js +3 -6
- package/dist/utils/tools/defer.d.ts +16 -26
- package/dist/utils/tools/defer.js +50 -41
- 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/tts-stats.d.ts +1 -1
- package/dist/utils/until-aborted.d.ts +7 -0
- package/dist/utils/until-aborted.js +34 -0
- package/package.json +53 -45
- 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/engines/diffusion.js +0 -65
- package/dist/resources/model-fit/native-probe/fit-outcome.d.ts +0 -16
- package/dist/resources/model-fit/native-probe/fit-outcome.js +0 -1
- 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/types.js +0 -1
- /package/dist/{resources/model-fit → model-fit}/kv-cache.js +0 -0
- /package/dist/{resources/model-fit → model-fit}/platform.js +0 -0
- /package/dist/{resources/model-fit/native-probe/engines → model-fit/request}/gpu.d.ts +0 -0
- /package/dist/{resources/model-fit/native-probe/engines → model-fit/request}/gpu.js +0 -0
|
@@ -5,7 +5,7 @@ export declare const parakeetPlugin: {
|
|
|
5
5
|
addonPackage: "@qvac/asr-ggml";
|
|
6
6
|
loadConfigSchema: import("zod").ZodObject<{
|
|
7
7
|
[x: string]: import("zod").ZodOptional<import("zod").ZodUnknown>;
|
|
8
|
-
}, import("zod/v4/core
|
|
8
|
+
}, import("zod/v4/core").$strict>;
|
|
9
9
|
assessFit: typeof import("node_modules/@qvac/asr-ggml/lib/fit").assessFit;
|
|
10
10
|
resolveConfig(cfg: ParakeetConfig): Promise<ResolveResult<ParakeetConfig>>;
|
|
11
11
|
createModel(params: CreateModelParams): PluginModelResult;
|
|
@@ -17,15 +17,15 @@ export declare const parakeetPlugin: {
|
|
|
17
17
|
audioChunk: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
18
18
|
type: import("zod").ZodLiteral<"base64">;
|
|
19
19
|
value: import("zod").ZodString;
|
|
20
|
-
}, import("zod/v4/core
|
|
20
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
21
21
|
type: import("zod").ZodLiteral<"filePath">;
|
|
22
22
|
value: import("zod").ZodString;
|
|
23
|
-
}, import("zod/v4/core
|
|
23
|
+
}, import("zod/v4/core").$strip>], "type">;
|
|
24
24
|
hotwords: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
25
25
|
maxNewTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
26
26
|
type: import("zod").ZodLiteral<"transcribe">;
|
|
27
27
|
requestId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
28
|
-
}, import("zod/v4/core
|
|
28
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
29
29
|
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
30
30
|
done: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
31
31
|
stats: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -56,7 +56,7 @@ export declare const parakeetPlugin: {
|
|
|
56
56
|
totalEncodedFrames: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
57
57
|
encoderOnCoreml: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
58
58
|
encoderUsedCoreml: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
59
|
-
}, import("zod/v4/core
|
|
59
|
+
}, import("zod/v4/core").$strip>>;
|
|
60
60
|
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
61
61
|
segment: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
62
62
|
text: import("zod").ZodString;
|
|
@@ -70,10 +70,10 @@ export declare const parakeetPlugin: {
|
|
|
70
70
|
speakerId: import("zod").ZodNumber;
|
|
71
71
|
startMs: import("zod").ZodNumber;
|
|
72
72
|
endMs: import("zod").ZodNumber;
|
|
73
|
-
}, import("zod/v4/core
|
|
73
|
+
}, import("zod/v4/core").$strip>>>;
|
|
74
74
|
isEndOfTurn: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
75
75
|
startsWord: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
76
|
-
}, import("zod/v4/core
|
|
76
|
+
}, import("zod/v4/core").$strip>>;
|
|
77
77
|
vad: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
78
78
|
speakerId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
79
79
|
speaking: import("zod").ZodBoolean;
|
|
@@ -83,13 +83,13 @@ export declare const parakeetPlugin: {
|
|
|
83
83
|
energy: "energy";
|
|
84
84
|
sortformer: "sortformer";
|
|
85
85
|
}>>;
|
|
86
|
-
}, import("zod/v4/core
|
|
86
|
+
}, import("zod/v4/core").$strip>>;
|
|
87
87
|
endOfTurn: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
88
88
|
source: import("zod").ZodLiteral<"whisper">;
|
|
89
89
|
silenceDurationMs: import("zod").ZodNumber;
|
|
90
|
-
}, import("zod/v4/core
|
|
90
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
91
91
|
source: import("zod").ZodLiteral<"parakeet">;
|
|
92
|
-
}, import("zod/v4/core
|
|
92
|
+
}, import("zod/v4/core").$strip>], "source">, unknown>>;
|
|
93
93
|
diagnostics: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
94
94
|
selectedBackend: import("zod").ZodString;
|
|
95
95
|
selectedDevice: import("zod").ZodEnum<{
|
|
@@ -111,7 +111,7 @@ export declare const parakeetPlugin: {
|
|
|
111
111
|
driver: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
112
112
|
name: import("zod").ZodString;
|
|
113
113
|
version: import("zod").ZodOptional<import("zod").ZodString>;
|
|
114
|
-
}, import("zod/v4/core
|
|
114
|
+
}, import("zod/v4/core").$strip>>;
|
|
115
115
|
gpuId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
116
116
|
fallback: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
117
117
|
requestedBackend: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -120,7 +120,7 @@ export declare const parakeetPlugin: {
|
|
|
120
120
|
gpu: "gpu";
|
|
121
121
|
}>>;
|
|
122
122
|
reason: import("zod").ZodString;
|
|
123
|
-
}, import("zod/v4/core
|
|
123
|
+
}, import("zod/v4/core").$strip>>;
|
|
124
124
|
probe: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
125
125
|
status: import("zod").ZodEnum<{
|
|
126
126
|
unknown: "unknown";
|
|
@@ -129,10 +129,10 @@ export declare const parakeetPlugin: {
|
|
|
129
129
|
}>;
|
|
130
130
|
backend: import("zod").ZodString;
|
|
131
131
|
reason: import("zod").ZodOptional<import("zod").ZodString>;
|
|
132
|
-
}, import("zod/v4/core
|
|
133
|
-
}, import("zod/v4/core
|
|
132
|
+
}, import("zod/v4/core").$strip>>;
|
|
133
|
+
}, import("zod/v4/core").$strip>>;
|
|
134
134
|
type: import("zod").ZodLiteral<"transcribe">;
|
|
135
|
-
}, import("zod/v4/core
|
|
135
|
+
}, import("zod/v4/core").$strip>>;
|
|
136
136
|
transcribeStream: import("../../../schemas/index.js").PluginHandlerDefinition<import("zod").ZodObject<{
|
|
137
137
|
modelId: import("zod").ZodString;
|
|
138
138
|
prompt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -157,9 +157,9 @@ export declare const parakeetPlugin: {
|
|
|
157
157
|
chunkLeftContextMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
158
158
|
chunkRightContextMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
159
159
|
spkCacheUpdatePeriod: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
160
|
-
}, import("zod/v4/core
|
|
160
|
+
}, import("zod/v4/core").$strip>>;
|
|
161
161
|
requestId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
162
|
-
}, import("zod/v4/core
|
|
162
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
163
163
|
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
164
164
|
done: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
165
165
|
stats: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -190,7 +190,7 @@ export declare const parakeetPlugin: {
|
|
|
190
190
|
totalEncodedFrames: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
191
191
|
encoderOnCoreml: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
192
192
|
encoderUsedCoreml: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
193
|
-
}, import("zod/v4/core
|
|
193
|
+
}, import("zod/v4/core").$strip>>;
|
|
194
194
|
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
195
195
|
segment: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
196
196
|
text: import("zod").ZodString;
|
|
@@ -204,10 +204,10 @@ export declare const parakeetPlugin: {
|
|
|
204
204
|
speakerId: import("zod").ZodNumber;
|
|
205
205
|
startMs: import("zod").ZodNumber;
|
|
206
206
|
endMs: import("zod").ZodNumber;
|
|
207
|
-
}, import("zod/v4/core
|
|
207
|
+
}, import("zod/v4/core").$strip>>>;
|
|
208
208
|
isEndOfTurn: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
209
209
|
startsWord: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
210
|
-
}, import("zod/v4/core
|
|
210
|
+
}, import("zod/v4/core").$strip>>;
|
|
211
211
|
vad: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
212
212
|
speakerId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
213
213
|
speaking: import("zod").ZodBoolean;
|
|
@@ -217,13 +217,13 @@ export declare const parakeetPlugin: {
|
|
|
217
217
|
energy: "energy";
|
|
218
218
|
sortformer: "sortformer";
|
|
219
219
|
}>>;
|
|
220
|
-
}, import("zod/v4/core
|
|
220
|
+
}, import("zod/v4/core").$strip>>;
|
|
221
221
|
endOfTurn: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
222
222
|
source: import("zod").ZodLiteral<"whisper">;
|
|
223
223
|
silenceDurationMs: import("zod").ZodNumber;
|
|
224
|
-
}, import("zod/v4/core
|
|
224
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
225
225
|
source: import("zod").ZodLiteral<"parakeet">;
|
|
226
|
-
}, import("zod/v4/core
|
|
226
|
+
}, import("zod/v4/core").$strip>], "source">, unknown>>;
|
|
227
227
|
diagnostics: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
228
228
|
selectedBackend: import("zod").ZodString;
|
|
229
229
|
selectedDevice: import("zod").ZodEnum<{
|
|
@@ -245,7 +245,7 @@ export declare const parakeetPlugin: {
|
|
|
245
245
|
driver: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
246
246
|
name: import("zod").ZodString;
|
|
247
247
|
version: import("zod").ZodOptional<import("zod").ZodString>;
|
|
248
|
-
}, import("zod/v4/core
|
|
248
|
+
}, import("zod/v4/core").$strip>>;
|
|
249
249
|
gpuId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
250
250
|
fallback: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
251
251
|
requestedBackend: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -254,7 +254,7 @@ export declare const parakeetPlugin: {
|
|
|
254
254
|
gpu: "gpu";
|
|
255
255
|
}>>;
|
|
256
256
|
reason: import("zod").ZodString;
|
|
257
|
-
}, import("zod/v4/core
|
|
257
|
+
}, import("zod/v4/core").$strip>>;
|
|
258
258
|
probe: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
259
259
|
status: import("zod").ZodEnum<{
|
|
260
260
|
unknown: "unknown";
|
|
@@ -263,13 +263,13 @@ export declare const parakeetPlugin: {
|
|
|
263
263
|
}>;
|
|
264
264
|
backend: import("zod").ZodString;
|
|
265
265
|
reason: import("zod").ZodOptional<import("zod").ZodString>;
|
|
266
|
-
}, import("zod/v4/core
|
|
267
|
-
}, import("zod/v4/core
|
|
266
|
+
}, import("zod/v4/core").$strip>>;
|
|
267
|
+
}, import("zod/v4/core").$strip>>;
|
|
268
268
|
type: import("zod").ZodLiteral<"transcribeStream">;
|
|
269
|
-
}, import("zod/v4/core
|
|
269
|
+
}, import("zod/v4/core").$strip>>;
|
|
270
270
|
};
|
|
271
271
|
logging: {
|
|
272
|
-
module: () => Promise<typeof import("@qvac/asr-ggml/addonLogging
|
|
272
|
+
module: () => Promise<typeof import("@qvac/asr-ggml/addonLogging")>;
|
|
273
273
|
namespace: "@qvac/asr-ggml";
|
|
274
274
|
};
|
|
275
275
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import ASRGgml from '@qvac/asr-ggml';
|
|
2
2
|
import { definePlugin, defineHandler, defineDuplexHandler, transcribeRequestSchema, transcribeResponseSchema, transcribeStreamRequestSchema, transcribeStreamResponseSchema, ModelType, parakeetLoadConfigSchema, LEGACY_PARAKEET_ONNX_MODEL_CONFIG_FIELDS, ADDON_ASR } from '../../../schemas/index.js';
|
|
3
3
|
import { ModelLoadFailedError, LegacyParakeetModelDeprecatedError } from '../../../errors/index.js';
|
|
4
|
-
import { transcribe, transcribeStream } from '
|
|
4
|
+
import { transcribe, transcribeStream } from '../../../plugins/ops/transcribe.js';
|
|
5
5
|
import { attachModelExecutionMs } from '../../../profiling/model-execution.js';
|
|
6
6
|
import { attachBackendDiagnostics } from '../../../profiling/backend-diagnostics.js';
|
|
7
|
-
import { buildParakeetEngineConfig } from '
|
|
8
|
-
import { createAsrModelLogger } from '
|
|
7
|
+
import { buildParakeetEngineConfig } from '../../../plugins/builtin/asr-ggml/config.js';
|
|
8
|
+
import { createAsrModelLogger } from '../../../plugins/builtin/asr-ggml/logging.js';
|
|
9
9
|
function resolveParakeetConfig(cfg) {
|
|
10
10
|
const cfgRecord = cfg;
|
|
11
11
|
const legacyFields = LEGACY_PARAKEET_ONNX_MODEL_CONFIG_FIELDS.filter((name) => cfgRecord[name] !== undefined);
|
|
@@ -178,7 +178,7 @@ export const parakeetPlugin = definePlugin({
|
|
|
178
178
|
})
|
|
179
179
|
},
|
|
180
180
|
logging: {
|
|
181
|
-
module: () => import('@qvac/asr-ggml/addonLogging
|
|
181
|
+
module: () => import('@qvac/asr-ggml/addonLogging'),
|
|
182
182
|
namespace: ADDON_ASR
|
|
183
183
|
}
|
|
184
184
|
});
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import type { DiffusionRequest, DiffusionStreamResponse } from '../../../../schemas/sdcpp-config.js';
|
|
2
|
-
export
|
|
1
|
+
import type { DiffusionRequest, DiffusionStreamResponse, DiffusionStats } from '../../../../schemas/sdcpp-config.js';
|
|
2
|
+
export type DiffusionOpResult = {
|
|
3
|
+
stats: DiffusionStats | undefined;
|
|
4
|
+
};
|
|
5
|
+
export declare function diffusion(request: DiffusionRequest): AsyncGenerator<DiffusionStreamResponse, DiffusionOpResult>;
|
|
@@ -1,64 +1,180 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
1
53
|
import { getModel } from '../../../../runtime/model-registry.js';
|
|
2
54
|
import Buffer from 'bare-buffer';
|
|
55
|
+
import { getRequestRegistry, withRequestContext } from '../../../../runtime/index.js';
|
|
56
|
+
import { generateRandomRequestId } from '../../../../runtime/request-id.js';
|
|
57
|
+
import { getEngineLogger } from '../../../../logging/index.js';
|
|
58
|
+
import { InferenceCancelledError } from '../../../../errors/index.js';
|
|
3
59
|
export async function* diffusion(request) {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
61
|
+
try {
|
|
62
|
+
const ctx = __addDisposableResource(env_1, await getRequestRegistry().begin({
|
|
63
|
+
requestId: generateRandomRequestId(),
|
|
64
|
+
kind: 'diffusion',
|
|
65
|
+
modelId: request.modelId
|
|
66
|
+
}), true);
|
|
67
|
+
if (ctx.signal.aborted)
|
|
68
|
+
throw new InferenceCancelledError(ctx.requestId);
|
|
69
|
+
const model = getModel(request.modelId);
|
|
70
|
+
const cancellable = model;
|
|
71
|
+
const logger = withRequestContext(getEngineLogger(), ctx);
|
|
72
|
+
let cancelPromise;
|
|
73
|
+
const onAbort = () => {
|
|
74
|
+
cancelPromise ??= cancellable.cancel().catch((error) => {
|
|
75
|
+
logger.warn(`Diffusion cancel failed: ${String(error)}`);
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
ctx.signal.addEventListener('abort', onAbort, { once: true });
|
|
79
|
+
ctx.scope.defer(async () => {
|
|
80
|
+
ctx.signal.removeEventListener('abort', onAbort);
|
|
81
|
+
// A delayed native cancel must finish before another request owns the model.
|
|
82
|
+
await cancelPromise;
|
|
83
|
+
});
|
|
84
|
+
if (ctx.signal.aborted)
|
|
85
|
+
throw new InferenceCancelledError(ctx.requestId);
|
|
86
|
+
const init_image = request.init_image ? Buffer.from(request.init_image, 'base64') : undefined;
|
|
87
|
+
const init_images = request.init_images
|
|
88
|
+
? request.init_images.map((b64) => Buffer.from(b64, 'base64'))
|
|
89
|
+
: undefined;
|
|
90
|
+
try {
|
|
91
|
+
const response = await model.run({
|
|
92
|
+
prompt: request.prompt,
|
|
93
|
+
negative_prompt: request.negative_prompt,
|
|
94
|
+
width: request.width,
|
|
95
|
+
height: request.height,
|
|
96
|
+
steps: request.steps,
|
|
97
|
+
cfg_scale: request.cfg_scale,
|
|
98
|
+
img_cfg_scale: request.img_cfg_scale ?? -1,
|
|
99
|
+
guidance: request.guidance,
|
|
100
|
+
sampling_method: request.sampling_method,
|
|
101
|
+
scheduler: request.scheduler,
|
|
102
|
+
seed: request.seed,
|
|
103
|
+
batch_count: request.batch_count,
|
|
104
|
+
vae_tiling: request.vae_tiling,
|
|
105
|
+
cache_preset: request.cache_preset,
|
|
106
|
+
init_image,
|
|
107
|
+
init_images,
|
|
108
|
+
increase_ref_index: request.increase_ref_index,
|
|
109
|
+
auto_resize_ref_image: request.auto_resize_ref_image,
|
|
110
|
+
strength: request.strength,
|
|
111
|
+
lora: request.lora,
|
|
112
|
+
upscale: request.upscale === false ? undefined : request.upscale
|
|
113
|
+
});
|
|
114
|
+
// Keep ownership until native work settles, including an early consumer exit.
|
|
115
|
+
let drained = false;
|
|
116
|
+
ctx.scope.defer(async () => {
|
|
117
|
+
if (drained)
|
|
118
|
+
return;
|
|
119
|
+
onAbort();
|
|
120
|
+
try {
|
|
121
|
+
await response.await();
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// The stream carries the original failure or cancellation.
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
let outputIndex = 0;
|
|
128
|
+
for await (const chunk of response.iterate()) {
|
|
129
|
+
if (ctx.signal.aborted)
|
|
130
|
+
continue;
|
|
131
|
+
if (chunk instanceof Uint8Array) {
|
|
45
132
|
yield {
|
|
46
133
|
type: 'diffusionStream',
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
elapsedMs: tick['elapsed_ms']
|
|
134
|
+
data: Buffer.from(chunk).toString('base64'),
|
|
135
|
+
outputIndex: outputIndex++
|
|
50
136
|
};
|
|
51
137
|
}
|
|
138
|
+
else if (typeof chunk === 'string') {
|
|
139
|
+
try {
|
|
140
|
+
const tick = JSON.parse(chunk);
|
|
141
|
+
if ('step' in tick) {
|
|
142
|
+
yield {
|
|
143
|
+
type: 'diffusionStream',
|
|
144
|
+
step: tick['step'],
|
|
145
|
+
totalSteps: tick['total'],
|
|
146
|
+
elapsedMs: tick['elapsed_ms']
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
// Ignore non-JSON output.
|
|
152
|
+
}
|
|
153
|
+
}
|
|
52
154
|
}
|
|
53
|
-
|
|
54
|
-
|
|
155
|
+
drained = true;
|
|
156
|
+
if (ctx.signal.aborted)
|
|
157
|
+
throw new InferenceCancelledError(ctx.requestId);
|
|
158
|
+
const responseWithStats = response;
|
|
159
|
+
return { stats: responseWithStats.stats ?? undefined };
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (ctx.signal.aborted) {
|
|
163
|
+
if (error instanceof InferenceCancelledError)
|
|
164
|
+
throw error;
|
|
165
|
+
throw new InferenceCancelledError(ctx.requestId, {}, error);
|
|
55
166
|
}
|
|
167
|
+
ctx.state = 'failed';
|
|
168
|
+
throw error;
|
|
56
169
|
}
|
|
57
170
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
171
|
+
catch (e_1) {
|
|
172
|
+
env_1.error = e_1;
|
|
173
|
+
env_1.hasError = true;
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
const result_1 = __disposeResources(env_1);
|
|
177
|
+
if (result_1)
|
|
178
|
+
await result_1;
|
|
179
|
+
}
|
|
64
180
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { VideoStableDiffusion } from '@qvac/diffusion-cpp';
|
|
2
|
-
import { type VideoRequest, type VideoStreamResponse } from '../../../../schemas/sdcpp-config.js';
|
|
2
|
+
import { type VideoRequest, type VideoStreamResponse, type VideoStats } from '../../../../schemas/sdcpp-config.js';
|
|
3
3
|
export declare function markLtxVideoModel(model: VideoStableDiffusion): void;
|
|
4
4
|
export declare function markH3VideoModel(model: VideoStableDiffusion): void;
|
|
5
5
|
export declare function markMoeCapableVideoModel(model: VideoStableDiffusion): void;
|
|
6
|
-
export
|
|
6
|
+
export type VideoOpResult = {
|
|
7
|
+
stats: VideoStats | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare function video(request: VideoRequest): AsyncGenerator<VideoStreamResponse, VideoOpResult>;
|
|
@@ -134,16 +134,18 @@ export async function* video(request) {
|
|
|
134
134
|
if (request.lora !== undefined && loraApplyMode !== 'at_runtime') {
|
|
135
135
|
requestLogger.warn(`[video] lora_apply_mode="${loraApplyMode}" may persist the request LoRA across later generations; use "at_runtime" for per-call application.`);
|
|
136
136
|
}
|
|
137
|
+
let cancelPromise;
|
|
137
138
|
const onAbort = () => {
|
|
138
|
-
model.cancel().catch((err) => {
|
|
139
|
+
cancelPromise ??= model.cancel().catch((err) => {
|
|
139
140
|
requestLogger.warn(`[cancel] model.cancel() rejected during abort for modelId=${request.modelId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
140
141
|
});
|
|
141
142
|
};
|
|
142
143
|
ctx.signal.addEventListener('abort', onAbort, { once: true });
|
|
143
144
|
if (ctx.signal.aborted)
|
|
144
145
|
onAbort();
|
|
145
|
-
ctx.scope.defer(() => {
|
|
146
|
+
ctx.scope.defer(async () => {
|
|
146
147
|
ctx.signal.removeEventListener('abort', onAbort);
|
|
148
|
+
await cancelPromise;
|
|
147
149
|
});
|
|
148
150
|
const runParams = {
|
|
149
151
|
prompt: request.prompt,
|
|
@@ -232,10 +234,22 @@ export async function* video(request) {
|
|
|
232
234
|
init_image: Buffer.from(request.init_image, 'base64')
|
|
233
235
|
})
|
|
234
236
|
: await model.run({ ...runParams, mode: 'txt2vid' });
|
|
237
|
+
let drained = false;
|
|
238
|
+
ctx.scope.defer(async () => {
|
|
239
|
+
if (drained)
|
|
240
|
+
return;
|
|
241
|
+
onAbort();
|
|
242
|
+
try {
|
|
243
|
+
await response.await();
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
// Preserve the stream's original failure or consumer exit.
|
|
247
|
+
}
|
|
248
|
+
});
|
|
235
249
|
let outputIndex = 0;
|
|
236
250
|
for await (const chunk of response.iterate()) {
|
|
237
251
|
if (ctx.signal.aborted)
|
|
238
|
-
|
|
252
|
+
continue;
|
|
239
253
|
if (chunk instanceof Uint8Array) {
|
|
240
254
|
yield {
|
|
241
255
|
type: 'videoStream',
|
|
@@ -260,12 +274,9 @@ export async function* video(request) {
|
|
|
260
274
|
}
|
|
261
275
|
}
|
|
262
276
|
}
|
|
277
|
+
drained = true;
|
|
263
278
|
const responseWithStats = response;
|
|
264
|
-
|
|
265
|
-
type: 'videoStream',
|
|
266
|
-
done: true,
|
|
267
|
-
stats: toVideoStats(responseWithStats.stats)
|
|
268
|
-
};
|
|
279
|
+
return { stats: toVideoStats(responseWithStats.stats) };
|
|
269
280
|
}
|
|
270
281
|
catch (e_1) {
|
|
271
282
|
env_1.error = e_1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import WorldStableDiffusion from '@qvac/diffusion-cpp/world
|
|
2
|
-
import type { WorldConfig } from '@qvac/diffusion-cpp/world
|
|
1
|
+
import WorldStableDiffusion from '@qvac/diffusion-cpp/world';
|
|
2
|
+
import type { WorldConfig } from '@qvac/diffusion-cpp/world';
|
|
3
3
|
import type QvacLogger from '@qvac/logging';
|
|
4
4
|
import type { WorldSceneRequest, WorldSceneStreamResponse, WorldStepRequest, WorldStepStreamResponse } from '../../../../schemas/sdcpp-config.js';
|
|
5
5
|
interface WorldSessionArgs {
|
|
@@ -52,7 +52,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
52
52
|
});
|
|
53
53
|
import fs, { promises as fsPromises } from 'bare-fs';
|
|
54
54
|
import path from 'bare-path';
|
|
55
|
-
import WorldStableDiffusion from '@qvac/diffusion-cpp/world
|
|
55
|
+
import WorldStableDiffusion from '@qvac/diffusion-cpp/world';
|
|
56
56
|
import { getEngineLogger } from '../../../../logging/index.js';
|
|
57
57
|
import { getModel, getModelEntry } from '../../../../runtime/model-registry.js';
|
|
58
58
|
import { getRequestRegistry, withRequestContext } from '../../../../runtime/index.js';
|