@qvac/inference 0.21.1 → 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 +89 -41
- package/README.md +44 -1
- package/dist/api/assess-model-fit.d.ts +4 -4
- package/dist/api/assess-model-fit.js +4 -4
- package/dist/api/audio-gen.d.ts +4 -1
- package/dist/api/audio-gen.js +5 -2
- package/dist/api/batch-completion.js +1 -1
- package/dist/api/completion-stream.d.ts +2 -1
- package/dist/api/completion-stream.js +4 -2
- package/dist/api/decide.d.ts +26 -0
- package/dist/api/decide.js +26 -0
- 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/get-model-info.d.ts +1 -1
- package/dist/api/index.d.ts +39 -37
- package/dist/api/index.js +38 -36
- 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/text-to-speech.d.ts +1 -0
- package/dist/api/text-to-speech.js +15 -19
- package/dist/api/transcribe.js +5 -2
- package/dist/api/unload-model.js +1 -1
- package/dist/api/video-request.d.ts +5 -5
- package/dist/api/video.d.ts +5 -4
- package/dist/api/video.js +6 -5
- 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 +9 -0
- package/dist/errors/index.js +18 -1
- package/dist/handlers/assess-model-fit.d.ts +5 -3
- package/dist/handlers/assess-model-fit.js +84 -32
- 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 +3 -5
- 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/load-model/safe-fetch.js +5 -6
- package/dist/handlers/logging-stream.d.ts +2 -1
- package/dist/handlers/logging-stream.js +23 -7
- package/dist/handlers/registry.d.ts +3 -1
- package/dist/handlers/registry.js +7 -5
- 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 +2 -2
- package/dist/{resources/model-fit → model-fit}/assess.d.ts +18 -26
- package/dist/{resources/model-fit → model-fit}/assess.js +210 -274
- 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} +36 -5
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.d.ts → model-fit/description/fetch.d.ts} +4 -2
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.js → model-fit/description/fetch.js} +11 -6
- 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} +4 -2
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.d.ts → model-fit/description/resolve-load.d.ts} +6 -4
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.js → model-fit/description/resolve-load.js} +14 -6
- package/dist/model-fit/floor.d.ts +31 -0
- package/dist/{resources/model-fit → model-fit}/floor.js +13 -13
- package/dist/model-fit/kv-cache.d.ts +23 -0
- package/dist/model-fit/kv-cache.js +85 -0
- package/dist/{resources/model-fit/native-probe/advisory-fit.d.ts → model-fit/load-check.d.ts} +17 -14
- package/dist/{resources/model-fit/native-probe/advisory-fit.js → model-fit/load-check.js} +23 -64
- package/dist/model-fit/platform.d.ts +14 -0
- package/dist/model-fit/platform.js +26 -0
- package/dist/{resources/model-fit/native-probe/create-fit-request.d.ts → model-fit/request/create.d.ts} +5 -2
- package/dist/model-fit/request/create.js +61 -0
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/asr.d.ts +5 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/asr.js +32 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/audiogen.d.ts +1 -1
- package/dist/model-fit/request/engines/audiogen.js +63 -0
- 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 -3
- package/dist/model-fit/request/engines/llama.js +44 -0
- package/dist/model-fit/request/engines/nmt.d.ts +8 -0
- package/dist/model-fit/request/engines/nmt.js +11 -0
- package/dist/model-fit/request/engines/ocr.d.ts +9 -0
- package/dist/model-fit/request/engines/ocr.js +13 -0
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/tts.d.ts +3 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/tts.js +50 -4
- package/dist/{resources/model-fit/native-probe/engine-fit.d.ts → model-fit/run/engine.d.ts} +17 -4
- package/dist/{resources/model-fit/native-probe/engine-fit.js → model-fit/run/engine.js} +2 -2
- 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 +1072 -815
- package/dist/models/registry/models.js +3704 -3405
- package/dist/models/registry/resource-profiles.d.ts +1 -2
- package/dist/models/registry/resource-profiles.js +406 -3
- package/dist/plugins/builtin/asr-ggml/config.d.ts +7 -1
- package/dist/plugins/builtin/asr-ggml/config.js +6 -0
- package/dist/plugins/builtin/asr-ggml/logging.d.ts +1 -1
- package/dist/plugins/builtin/audiogen-ggml/config.d.ts +1 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +29 -11
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.d.ts +27 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.js +23 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +7 -28
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +2 -2
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +106 -13
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +5 -4
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +20 -3
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +3 -3
- package/dist/plugins/builtin/ggml-classification/plugin.js +1 -1
- package/dist/plugins/builtin/ggml-ocr/params.d.ts +18 -0
- package/dist/plugins/builtin/ggml-ocr/params.js +37 -0
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +9 -0
- package/dist/plugins/builtin/ggml-ocr/plugin.js +17 -39
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +9 -2
- package/dist/plugins/builtin/ggml-vla/plugin.js +4 -4
- package/dist/plugins/builtin/index.d.ts +15 -12
- package/dist/plugins/builtin/index.js +15 -12
- 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 +10 -7
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +141 -204
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +36 -92
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +67 -216
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.d.ts +2 -49
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.js +2 -46
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +208 -19
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +28 -20
- package/dist/plugins/builtin/llamacpp-completion/transform.js +5 -1
- package/dist/plugins/builtin/llamacpp-decision/helpers.d.ts +5 -0
- package/dist/plugins/builtin/llamacpp-decision/helpers.js +89 -0
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.d.ts +91 -0
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +129 -0
- package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +222 -0
- package/dist/plugins/builtin/llamacpp-decision/plugin.js +44 -0
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +9 -1
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +15 -5
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +9 -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 +143 -0
- package/dist/plugins/builtin/moss-transcribe/plugin.js +96 -0
- package/dist/plugins/builtin/nmtcpp-translation/load-files.d.ts +6 -0
- package/dist/plugins/builtin/nmtcpp-translation/load-files.js +70 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +17 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +10 -74
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +25 -4
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +20 -5
- 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 +28 -13
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +83 -1
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +55 -52
- 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/moss-options.d.ts +22 -0
- package/dist/plugins/builtin/tts-ggml/ops/moss-options.js +79 -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 +5 -2
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +19 -7
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +151 -1
- package/dist/plugins/builtin/tts-ggml/plugin.js +39 -2
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +28 -4
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +8 -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 +5 -4
- package/dist/plugins/ops/kv-cache-utils.js +25 -33
- package/dist/plugins/ops/load-model.d.ts +8 -2
- package/dist/plugins/ops/load-model.js +33 -19
- package/dist/plugins/ops/transcribe.js +18 -2
- 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 +3 -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 +5 -7
- package/dist/runtime/env.d.ts +0 -2
- package/dist/runtime/env.js +2 -9
- 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 +9 -1
- 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 +22 -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 +7 -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 +106 -43
- package/dist/schemas/assess-model-fit.js +69 -32
- package/dist/schemas/audio-gen.d.ts +199 -19
- package/dist/schemas/audio-gen.js +183 -51
- package/dist/schemas/batch-completion-stream.d.ts +210 -36
- package/dist/schemas/batch-completion-stream.js +3 -3
- package/dist/schemas/bci-config.d.ts +3 -0
- package/dist/schemas/bci-config.js +2 -2
- package/dist/schemas/bci.d.ts +24 -3
- package/dist/schemas/bci.js +2 -2
- package/dist/schemas/cancel.d.ts +10 -0
- package/dist/schemas/cancel.js +2 -0
- package/dist/schemas/common.d.ts +1465 -162
- package/dist/schemas/common.js +37 -31
- package/dist/schemas/completion-event.d.ts +8 -2
- package/dist/schemas/completion-event.js +4 -1
- package/dist/schemas/completion-stream.d.ts +243 -39
- package/dist/schemas/completion-stream.js +100 -29
- package/dist/schemas/config.d.ts +1326 -18
- package/dist/schemas/config.js +30 -8
- package/dist/schemas/decision.d.ts +610 -0
- package/dist/schemas/decision.js +219 -0
- package/dist/schemas/download-asset.d.ts +10 -4
- package/dist/schemas/download-asset.js +1 -1
- package/dist/schemas/engine-addon-map.d.ts +9 -1
- package/dist/schemas/engine-addon-map.js +26 -5
- package/dist/schemas/errors.d.ts +2 -0
- package/dist/schemas/errors.js +11 -1
- package/dist/schemas/index.d.ts +51 -48
- package/dist/schemas/index.js +50 -47
- package/dist/schemas/llamacpp-config.d.ts +222 -6
- package/dist/schemas/llamacpp-config.js +129 -7
- package/dist/schemas/load-model.d.ts +7960 -1492
- package/dist/schemas/load-model.js +122 -10
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-config-schemas.d.ts +428 -9
- package/dist/schemas/model-config-schemas.js +16 -11
- package/dist/schemas/model-fit-policy.d.ts +17 -0
- package/dist/schemas/model-fit-policy.js +17 -0
- package/dist/schemas/model-info.d.ts +20 -2
- package/dist/schemas/model-info.js +4 -3
- package/dist/schemas/model-resource-profile.d.ts +4 -4
- package/dist/schemas/model-resource-profile.js +2 -5
- package/dist/schemas/model-src-utils.d.ts +14 -2
- package/dist/schemas/model-src-utils.js +2 -2
- package/dist/schemas/model-types.d.ts +14 -1
- package/dist/schemas/model-types.js +4 -0
- package/dist/schemas/ocr.d.ts +76 -0
- package/dist/schemas/ocr.js +43 -1
- package/dist/schemas/plugin.d.ts +16 -4
- package/dist/schemas/plugin.js +12 -0
- package/dist/schemas/profiling.d.ts +4 -4
- package/dist/schemas/profiling.js +1 -1
- package/dist/schemas/rag.js +1 -1
- package/dist/schemas/registry.d.ts +34 -0
- package/dist/schemas/registry.js +5 -1
- package/dist/schemas/reload-config.d.ts +14 -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/rpc-server.js +3 -3
- package/dist/schemas/sdcpp-config.d.ts +82 -0
- package/dist/schemas/sdcpp-config.js +41 -22
- package/dist/schemas/system-resources.d.ts +4 -4
- package/dist/schemas/text-to-speech.d.ts +463 -3
- package/dist/schemas/text-to-speech.js +129 -11
- package/dist/schemas/tools.d.ts +13 -4
- package/dist/schemas/tools.js +18 -6
- package/dist/schemas/transcription-config.d.ts +20 -0
- package/dist/schemas/transcription-config.js +54 -4
- package/dist/schemas/transcription.d.ts +47 -5
- package/dist/schemas/transcription.js +52 -5
- package/dist/schemas/translate.d.ts +2 -2
- package/dist/schemas/translate.js +1 -1
- package/dist/schemas/translation-config.d.ts +40 -10
- package/dist/schemas/translation-config.js +1 -1
- package/dist/schemas/vla.d.ts +9 -2
- package/dist/schemas/vla.js +9 -5
- package/dist/surface.d.ts +3 -2
- package/dist/surface.js +3 -2
- package/dist/utils/addon-responses.d.ts +3 -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/asr-events.d.ts +1 -0
- package/dist/utils/asr-events.js +2 -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 +2 -2
- package/dist/utils/cache/paths.js +6 -6
- package/dist/utils/cache/types.d.ts +7 -0
- 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 +13 -9
- 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-helpers.d.ts +1 -1
- package/dist/utils/tool-helpers.js +20 -52
- 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 +8 -5
- 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 +7 -4
- package/dist/utils/tools/shared.d.ts +3 -0
- package/dist/utils/tools/shared.js +62 -0
- package/dist/utils/transcribe-metadata.d.ts +8 -1
- package/dist/utils/transcribe-metadata.js +13 -3
- package/dist/utils/tts-stats.d.ts +2 -1
- package/dist/utils/until-aborted.d.ts +7 -0
- package/dist/utils/until-aborted.js +34 -0
- package/package.json +68 -51
- package/dist/resources/model-fit/calibration/darwin-arm64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/darwin-arm64.js +0 -36
- package/dist/resources/model-fit/calibration/darwin-x64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/darwin-x64.js +0 -38
- package/dist/resources/model-fit/calibration/fit.d.ts +0 -73
- package/dist/resources/model-fit/calibration/fit.js +0 -152
- package/dist/resources/model-fit/calibration/index.d.ts +0 -37
- package/dist/resources/model-fit/calibration/index.js +0 -75
- package/dist/resources/model-fit/calibration/linux-arm64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/linux-arm64.js +0 -38
- package/dist/resources/model-fit/calibration/linux-x64-vulkan.d.ts +0 -8
- package/dist/resources/model-fit/calibration/linux-x64-vulkan.js +0 -39
- package/dist/resources/model-fit/calibration/linux-x64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/linux-x64.js +0 -38
- package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.d.ts +0 -8
- package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.js +0 -39
- package/dist/resources/model-fit/calibration/win32-x64-vulkan.d.ts +0 -8
- package/dist/resources/model-fit/calibration/win32-x64-vulkan.js +0 -36
- package/dist/resources/model-fit/calibration/win32-x64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/win32-x64.js +0 -38
- package/dist/resources/model-fit/estimators/llm.d.ts +0 -46
- package/dist/resources/model-fit/estimators/llm.js +0 -222
- package/dist/resources/model-fit/estimators/whisper.d.ts +0 -10
- package/dist/resources/model-fit/estimators/whisper.js +0 -76
- package/dist/resources/model-fit/floor.d.ts +0 -31
- 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 -41
- package/dist/resources/model-fit/native-probe/create-fit-request.js +0 -51
- package/dist/resources/model-fit/native-probe/engines/audiogen.js +0 -35
- package/dist/resources/model-fit/native-probe/engines/diffusion.js +0 -55
- package/dist/resources/model-fit/native-probe/engines/llama.js +0 -145
- 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 -22
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +0 -108
- 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 -28
- package/dist/resources/model-fit/types.d.ts +0 -120
- package/dist/resources/model-fit/types.js +0 -1
- /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
package/dist/api/diffusion.js
CHANGED
|
@@ -6,8 +6,11 @@ import { decodeBase64, encodeBase64 } from '../utils/encoding.js';
|
|
|
6
6
|
*
|
|
7
7
|
* @param params - Diffusion request parameters (model, prompt, dimensions, sampler, seed, etc.).
|
|
8
8
|
* @returns A result object exposing `progressStream` (async iterator of `{ step, totalSteps, elapsedMs }`), `outputs` (promise of the generated image buffers), and `stats` (promise of generation statistics).
|
|
9
|
+
* @throws {InferenceCancelledError} The run's promises reject and progress stream throws when an active generation is cancelled.
|
|
10
|
+
* @throws {RequestRejectedByPolicyError} The run rejects when another image or video generation owns the model.
|
|
9
11
|
*
|
|
10
|
-
* Supports
|
|
12
|
+
* Supports txt2img without input images, img2img via `init_image`,
|
|
13
|
+
* and ordered multi-reference editing via `init_images` on supported models.
|
|
11
14
|
*
|
|
12
15
|
* @example
|
|
13
16
|
* ```typescript
|
|
@@ -41,6 +44,20 @@ import { decodeBase64, encodeBase64 } from '../utils/encoding.js';
|
|
|
41
44
|
* height: 768,
|
|
42
45
|
* });
|
|
43
46
|
*
|
|
47
|
+
* // Qwen-Image-2.1 reference editing. Load the matching Qwen3-VL encoder,
|
|
48
|
+
* // vision projector, and 2.1 VAE from your local files first.
|
|
49
|
+
* const { outputs: edited } = diffusion({
|
|
50
|
+
* modelId,
|
|
51
|
+
* prompt: "Place the two referenced people together in one office.",
|
|
52
|
+
* init_images: [refA, refB],
|
|
53
|
+
* width: 512,
|
|
54
|
+
* height: 512,
|
|
55
|
+
* steps: 30,
|
|
56
|
+
* cfg_scale: 6,
|
|
57
|
+
* sampling_method: "euler",
|
|
58
|
+
* seed: 42,
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
44
61
|
* // LoRA adapter for this generation (absolute path required).
|
|
45
62
|
* // Persistence across subsequent diffusion() calls is controlled at
|
|
46
63
|
* // loadModel time via `modelConfig.lora_apply_mode`.
|
|
@@ -2,7 +2,7 @@ import { send, stream } from '../dispatch.js';
|
|
|
2
2
|
import { downloadAssetOptionsToRequestSchema } from '../schemas/index.js';
|
|
3
3
|
import { DownloadAssetFailedError, StreamEndedError, InvalidResponseError } from '../errors/index.js';
|
|
4
4
|
import { decoratePromise } from '../utils/decorate-promise.js';
|
|
5
|
-
import { parseClientInput } from '
|
|
5
|
+
import { parseClientInput } from '../api/parse-input.js';
|
|
6
6
|
import { generateRequestId } from '../runtime/request-id.js';
|
|
7
7
|
/**
|
|
8
8
|
* Downloads an asset (model file) without loading it into memory.
|
package/dist/api/finetune.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { send, stream as streamRpc } from '../dispatch.js';
|
|
2
2
|
import { finetuneRunParamsSchema, finetuneRunRequestSchema, finetuneStopRequestSchema, finetuneGetStateParamsSchema, finetuneGetStateRequestSchema, finetuneProgressResponseSchema, finetuneResponseSchema } from '../schemas/index.js';
|
|
3
3
|
import { InvalidResponseError, StreamEndedError } from '../errors/index.js';
|
|
4
|
-
import { parseClientInput } from '
|
|
4
|
+
import { parseClientInput } from '../api/parse-input.js';
|
|
5
5
|
function isFinetuneReplyParams(params) {
|
|
6
6
|
return (params.operation === 'pause' || params.operation === 'cancel' || params.operation === 'getState');
|
|
7
7
|
}
|
|
@@ -12,7 +12,7 @@ export declare function getModelInfo(params: GetModelInfoParams): Promise<{
|
|
|
12
12
|
modelId: string;
|
|
13
13
|
expectedSize: number;
|
|
14
14
|
sha256Checksum: string;
|
|
15
|
-
addon: "embeddings" | "diffusion" | "audiogen" | "tts" | "ocr" | "vla" | "llm" | "whisper" | "bci" | "nmt" | "parakeet" | "classification" | "vad" | "other";
|
|
15
|
+
addon: "embeddings" | "diffusion" | "audiogen" | "tts" | "ocr" | "vla" | "moss-transcribe" | "llm" | "whisper" | "bci" | "nmt" | "parakeet" | "classification" | "vad" | "other";
|
|
16
16
|
isCached: boolean;
|
|
17
17
|
isLoaded: boolean;
|
|
18
18
|
cacheFiles: {
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
export { loadModel } from '
|
|
2
|
-
export { downloadAsset } from '
|
|
3
|
-
export { completion } from '
|
|
4
|
-
export { batchCompletion } from '
|
|
5
|
-
export { deleteCache } from '
|
|
6
|
-
export { unloadModel } from '
|
|
7
|
-
export { loggingStream } from '
|
|
8
|
-
export { subscribeServerLogs, type ServerLogHandler } from '
|
|
9
|
-
export { heartbeat } from '
|
|
10
|
-
export { transcribe, transcribeStream } from '
|
|
11
|
-
export { bciTranscribe, bciTranscribeStream } from '
|
|
12
|
-
export { embed } from '
|
|
13
|
-
export { finetune, type FinetuneHandle } from '
|
|
14
|
-
export { translate } from '
|
|
15
|
-
export { cancel } from '
|
|
16
|
-
export { ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace } from '
|
|
17
|
-
export { createVectorIndex, loadVectorIndex, type VectorIndex } from '
|
|
18
|
-
export { textToSpeech, textToSpeechStream } from '
|
|
19
|
-
export { getModelInfo } from '
|
|
20
|
-
export { getLoadedModelInfo } from '
|
|
21
|
-
export { getSystemResources } from '
|
|
22
|
-
export { assessModelFit } from '
|
|
23
|
-
export { ocr } from '
|
|
24
|
-
export { invokePlugin, invokePluginStream } from '
|
|
25
|
-
export { diffusion, type DiffusionProgressTick } from '
|
|
26
|
-
export { audioGen, audioEdit, audioUnderstand } from '
|
|
27
|
-
export { classify } from '
|
|
28
|
-
export { video, type VideoProgressTick } from '
|
|
29
|
-
export { upscale } from '
|
|
30
|
-
export { worldCreateScene, worldStep } from '
|
|
31
|
-
export { type WorldStepResult, type WorldStepProgressTick, type WorldSceneResult, type WorldSceneResultWithPack } from '
|
|
32
|
-
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams } from '
|
|
33
|
-
export { suspend } from '
|
|
34
|
-
export { resume } from '
|
|
35
|
-
export { state } from '
|
|
36
|
-
export { vla, vlaHparams, vlaSetEmbodiment } from '
|
|
37
|
-
export { vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE } from '
|
|
1
|
+
export { loadModel } from '../api/load-model.js';
|
|
2
|
+
export { downloadAsset } from '../api/download-asset.js';
|
|
3
|
+
export { completion } from '../api/completion-stream.js';
|
|
4
|
+
export { batchCompletion } from '../api/batch-completion.js';
|
|
5
|
+
export { deleteCache } from '../api/delete-cache.js';
|
|
6
|
+
export { unloadModel } from '../api/unload-model.js';
|
|
7
|
+
export { loggingStream } from '../api/logging-stream.js';
|
|
8
|
+
export { subscribeServerLogs, type ServerLogHandler } from '../api/subscribe-logs.js';
|
|
9
|
+
export { heartbeat } from '../api/heartbeat.js';
|
|
10
|
+
export { transcribe, transcribeStream } from '../api/transcribe.js';
|
|
11
|
+
export { bciTranscribe, bciTranscribeStream } from '../api/bci-transcribe.js';
|
|
12
|
+
export { embed } from '../api/embed.js';
|
|
13
|
+
export { finetune, type FinetuneHandle } from '../api/finetune.js';
|
|
14
|
+
export { translate } from '../api/translate.js';
|
|
15
|
+
export { cancel } from '../api/cancel.js';
|
|
16
|
+
export { ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace } from '../api/rag.js';
|
|
17
|
+
export { createVectorIndex, loadVectorIndex, type VectorIndex } from '../api/vector-index.js';
|
|
18
|
+
export { textToSpeech, textToSpeechStream } from '../api/text-to-speech.js';
|
|
19
|
+
export { getModelInfo } from '../api/get-model-info.js';
|
|
20
|
+
export { getLoadedModelInfo } from '../api/get-loaded-model-info.js';
|
|
21
|
+
export { getSystemResources } from '../api/get-system-resources.js';
|
|
22
|
+
export { assessModelFit } from '../api/assess-model-fit.js';
|
|
23
|
+
export { ocr } from '../api/ocr.js';
|
|
24
|
+
export { invokePlugin, invokePluginStream } from '../api/invoke-plugin.js';
|
|
25
|
+
export { diffusion, type DiffusionProgressTick } from '../api/diffusion.js';
|
|
26
|
+
export { audioGen, audioEdit, audioUnderstand } from '../api/audio-gen.js';
|
|
27
|
+
export { classify } from '../api/classify.js';
|
|
28
|
+
export { video, type VideoProgressTick } from '../api/video.js';
|
|
29
|
+
export { upscale } from '../api/upscale.js';
|
|
30
|
+
export { worldCreateScene, worldStep } from '../api/world.js';
|
|
31
|
+
export { type WorldStepResult, type WorldStepProgressTick, type WorldSceneResult, type WorldSceneResultWithPack } from '../api/world-result.js';
|
|
32
|
+
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams } from '../api/registry.js';
|
|
33
|
+
export { suspend } from '../api/suspend.js';
|
|
34
|
+
export { resume } from '../api/resume.js';
|
|
35
|
+
export { state } from '../api/state.js';
|
|
36
|
+
export { vla, vlaHparams, vlaSetEmbodiment } from '../api/vla.js';
|
|
37
|
+
export { vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE } from '../api/vla-helpers.js';
|
|
38
38
|
export { startRpcServer, stopRpcServer, discoverRpcServers } from './rpc-server.js';
|
|
39
|
+
export { decide } from '../api/decide.js';
|
|
40
|
+
export { rerank } from '../api/rerank.js';
|
package/dist/api/index.js
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
export { loadModel } from '
|
|
2
|
-
export { downloadAsset } from '
|
|
3
|
-
export { completion } from '
|
|
4
|
-
export { batchCompletion } from '
|
|
5
|
-
export { deleteCache } from '
|
|
6
|
-
export { unloadModel } from '
|
|
7
|
-
export { loggingStream } from '
|
|
8
|
-
export { subscribeServerLogs } from '
|
|
9
|
-
export { heartbeat } from '
|
|
10
|
-
export { transcribe, transcribeStream } from '
|
|
11
|
-
export { bciTranscribe, bciTranscribeStream } from '
|
|
12
|
-
export { embed } from '
|
|
13
|
-
export { finetune } from '
|
|
14
|
-
export { translate } from '
|
|
15
|
-
export { cancel } from '
|
|
16
|
-
export { ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace } from '
|
|
17
|
-
export { createVectorIndex, loadVectorIndex } from '
|
|
18
|
-
export { textToSpeech, textToSpeechStream } from '
|
|
19
|
-
export { getModelInfo } from '
|
|
20
|
-
export { getLoadedModelInfo } from '
|
|
21
|
-
export { getSystemResources } from '
|
|
22
|
-
export { assessModelFit } from '
|
|
23
|
-
export { ocr } from '
|
|
24
|
-
export { invokePlugin, invokePluginStream } from '
|
|
25
|
-
export { diffusion } from '
|
|
26
|
-
export { audioGen, audioEdit, audioUnderstand } from '
|
|
27
|
-
export { classify } from '
|
|
28
|
-
export { video } from '
|
|
29
|
-
export { upscale } from '
|
|
30
|
-
export { worldCreateScene, worldStep } from '
|
|
31
|
-
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel } from '
|
|
32
|
-
export { suspend } from '
|
|
33
|
-
export { resume } from '
|
|
34
|
-
export { state } from '
|
|
35
|
-
export { vla, vlaHparams, vlaSetEmbodiment } from '
|
|
36
|
-
export { vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE } from '
|
|
1
|
+
export { loadModel } from '../api/load-model.js';
|
|
2
|
+
export { downloadAsset } from '../api/download-asset.js';
|
|
3
|
+
export { completion } from '../api/completion-stream.js';
|
|
4
|
+
export { batchCompletion } from '../api/batch-completion.js';
|
|
5
|
+
export { deleteCache } from '../api/delete-cache.js';
|
|
6
|
+
export { unloadModel } from '../api/unload-model.js';
|
|
7
|
+
export { loggingStream } from '../api/logging-stream.js';
|
|
8
|
+
export { subscribeServerLogs } from '../api/subscribe-logs.js';
|
|
9
|
+
export { heartbeat } from '../api/heartbeat.js';
|
|
10
|
+
export { transcribe, transcribeStream } from '../api/transcribe.js';
|
|
11
|
+
export { bciTranscribe, bciTranscribeStream } from '../api/bci-transcribe.js';
|
|
12
|
+
export { embed } from '../api/embed.js';
|
|
13
|
+
export { finetune } from '../api/finetune.js';
|
|
14
|
+
export { translate } from '../api/translate.js';
|
|
15
|
+
export { cancel } from '../api/cancel.js';
|
|
16
|
+
export { ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace } from '../api/rag.js';
|
|
17
|
+
export { createVectorIndex, loadVectorIndex } from '../api/vector-index.js';
|
|
18
|
+
export { textToSpeech, textToSpeechStream } from '../api/text-to-speech.js';
|
|
19
|
+
export { getModelInfo } from '../api/get-model-info.js';
|
|
20
|
+
export { getLoadedModelInfo } from '../api/get-loaded-model-info.js';
|
|
21
|
+
export { getSystemResources } from '../api/get-system-resources.js';
|
|
22
|
+
export { assessModelFit } from '../api/assess-model-fit.js';
|
|
23
|
+
export { ocr } from '../api/ocr.js';
|
|
24
|
+
export { invokePlugin, invokePluginStream } from '../api/invoke-plugin.js';
|
|
25
|
+
export { diffusion } from '../api/diffusion.js';
|
|
26
|
+
export { audioGen, audioEdit, audioUnderstand } from '../api/audio-gen.js';
|
|
27
|
+
export { classify } from '../api/classify.js';
|
|
28
|
+
export { video } from '../api/video.js';
|
|
29
|
+
export { upscale } from '../api/upscale.js';
|
|
30
|
+
export { worldCreateScene, worldStep } from '../api/world.js';
|
|
31
|
+
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel } from '../api/registry.js';
|
|
32
|
+
export { suspend } from '../api/suspend.js';
|
|
33
|
+
export { resume } from '../api/resume.js';
|
|
34
|
+
export { state } from '../api/state.js';
|
|
35
|
+
export { vla, vlaHparams, vlaSetEmbodiment } from '../api/vla.js';
|
|
36
|
+
export { vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE } from '../api/vla-helpers.js';
|
|
37
37
|
export { startRpcServer, stopRpcServer, discoverRpcServers } from './rpc-server.js';
|
|
38
|
+
export { decide } from '../api/decide.js';
|
|
39
|
+
export { rerank } from '../api/rerank.js';
|
package/dist/api/load-model.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { send, stream } from '../dispatch.js';
|
|
2
|
-
import { startLoggingStreamForModel } from '
|
|
2
|
+
import { startLoggingStreamForModel } from '../api/logging-stream-registry.js';
|
|
3
3
|
import { loadBuiltinToRequestSchema, loadCustomPluginToRequestSchema, reloadConfigOptionsToRequestSchema, isBuiltInModelType, isModelTypeAlias, normalizeModelType, inferModelTypeFromModelSrc, ModelType } from '../schemas/index.js';
|
|
4
4
|
import { ModelLoadFailedError, ModelTypeRequiredError, StreamEndedError, InvalidResponseError } from '../errors/index.js';
|
|
5
5
|
import { assertModelSrcMatchesModelType } from '../utils/load-model-validation.js';
|
|
6
|
-
import { parseClientInput } from '
|
|
6
|
+
import { parseClientInput } from '../api/parse-input.js';
|
|
7
7
|
import { getAppLogger } from '../logging/index.js';
|
|
8
8
|
import { decoratePromise } from '../utils/decorate-promise.js';
|
|
9
9
|
import { generateRequestId } from '../runtime/request-id.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AbortController } from 'bare-abort-controller';
|
|
1
2
|
import { getAppLogger } from '../logging/index.js';
|
|
2
|
-
import { loggingStream } from '
|
|
3
|
+
import { loggingStream } from '../api/logging-stream.js';
|
|
3
4
|
const logger = getAppLogger();
|
|
4
5
|
const activeStreams = new Map();
|
|
5
6
|
export function startLoggingStreamForModel(modelId, modelLogger) {
|
|
@@ -7,8 +8,10 @@ export function startLoggingStreamForModel(modelId, modelLogger) {
|
|
|
7
8
|
logger.warn(`Logging stream already active for model ${modelId}`);
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
11
|
+
const controller = new AbortController();
|
|
12
|
+
const streamIterator = loggingStream({ id: modelId }, { signal: controller.signal });
|
|
13
|
+
const entry = { logger: modelLogger, controller };
|
|
14
|
+
activeStreams.set(modelId, entry);
|
|
12
15
|
try {
|
|
13
16
|
void (async () => {
|
|
14
17
|
try {
|
|
@@ -36,7 +39,9 @@ export function startLoggingStreamForModel(modelId, modelLogger) {
|
|
|
36
39
|
logger.error(`Logging stream error for model ${modelId}:`, error);
|
|
37
40
|
}
|
|
38
41
|
finally {
|
|
39
|
-
|
|
42
|
+
// A reload may have replaced this entry.
|
|
43
|
+
if (activeStreams.get(modelId) === entry)
|
|
44
|
+
activeStreams.delete(modelId);
|
|
40
45
|
}
|
|
41
46
|
})();
|
|
42
47
|
}
|
|
@@ -50,9 +55,8 @@ export function stopLoggingStreamForModel(modelId) {
|
|
|
50
55
|
const stream = activeStreams.get(modelId);
|
|
51
56
|
if (stream) {
|
|
52
57
|
activeStreams.delete(modelId);
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
void stream.streamIterator.return(undefined);
|
|
58
|
+
// `return()` would wait for a log an unloaded model never sends.
|
|
59
|
+
stream.controller.abort(undefined);
|
|
56
60
|
logger.debug(`Stopped logging stream for model ${modelId}`);
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { LoggingStreamResponse, LoggingParams } from '../schemas/logging-stream.js';
|
|
2
|
+
import type { AbortableRPCOptions } from '../schemas/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* Opens a logging stream to receive real-time logs.
|
|
4
5
|
*
|
|
5
6
|
* @param params - The arguments for the logging stream
|
|
6
7
|
* @param params.id - The unique identifier to stream logs for
|
|
8
|
+
* @param options - Call options
|
|
9
|
+
* @param options.signal - Abort to end the stream and release the subscription
|
|
10
|
+
* at once, from outside the loop.
|
|
7
11
|
* @returns AsyncGenerator yielding logging stream responses
|
|
8
12
|
* @throws {QvacErrorBase} When the response type is invalid or when the stream fails
|
|
9
13
|
*
|
|
@@ -18,6 +22,12 @@ import type { LoggingStreamResponse, LoggingParams } from '../schemas/logging-st
|
|
|
18
22
|
* for await (const logMessage of logStream) {
|
|
19
23
|
* console.log(`[${logMessage.level}] ${logMessage.namespace}: ${logMessage.message}`);
|
|
20
24
|
* }
|
|
25
|
+
*
|
|
26
|
+
* // Stop from outside the loop (on Bare, AbortController is from bare-abort-controller)
|
|
27
|
+
* const controller = new AbortController();
|
|
28
|
+
* const modelLogs = loggingStream({ id: 'my-model-id' }, { signal: controller.signal });
|
|
29
|
+
* // later
|
|
30
|
+
* controller.abort();
|
|
21
31
|
* ```
|
|
22
32
|
*/
|
|
23
|
-
export declare function loggingStream(params: LoggingParams): AsyncGenerator<LoggingStreamResponse>;
|
|
33
|
+
export declare function loggingStream(params: LoggingParams, options?: AbortableRPCOptions): AsyncGenerator<LoggingStreamResponse>;
|
|
@@ -5,6 +5,9 @@ import { InvalidResponseError } from '../errors/index.js';
|
|
|
5
5
|
*
|
|
6
6
|
* @param params - The arguments for the logging stream
|
|
7
7
|
* @param params.id - The unique identifier to stream logs for
|
|
8
|
+
* @param options - Call options
|
|
9
|
+
* @param options.signal - Abort to end the stream and release the subscription
|
|
10
|
+
* at once, from outside the loop.
|
|
8
11
|
* @returns AsyncGenerator yielding logging stream responses
|
|
9
12
|
* @throws {QvacErrorBase} When the response type is invalid or when the stream fails
|
|
10
13
|
*
|
|
@@ -19,14 +22,20 @@ import { InvalidResponseError } from '../errors/index.js';
|
|
|
19
22
|
* for await (const logMessage of logStream) {
|
|
20
23
|
* console.log(`[${logMessage.level}] ${logMessage.namespace}: ${logMessage.message}`);
|
|
21
24
|
* }
|
|
25
|
+
*
|
|
26
|
+
* // Stop from outside the loop (on Bare, AbortController is from bare-abort-controller)
|
|
27
|
+
* const controller = new AbortController();
|
|
28
|
+
* const modelLogs = loggingStream({ id: 'my-model-id' }, { signal: controller.signal });
|
|
29
|
+
* // later
|
|
30
|
+
* controller.abort();
|
|
22
31
|
* ```
|
|
23
32
|
*/
|
|
24
|
-
export async function* loggingStream(params) {
|
|
33
|
+
export async function* loggingStream(params, options) {
|
|
25
34
|
const request = {
|
|
26
35
|
type: 'loggingStream',
|
|
27
36
|
...params
|
|
28
37
|
};
|
|
29
|
-
const responseStream = stream(request);
|
|
38
|
+
const responseStream = stream(request, options);
|
|
30
39
|
for await (const response of responseStream) {
|
|
31
40
|
if (response.type !== 'loggingStream') {
|
|
32
41
|
throw new InvalidResponseError('loggingStream');
|
package/dist/api/registry.d.ts
CHANGED
|
@@ -33,7 +33,8 @@ declare function modelRegistrySearch(params?: ModelRegistrySearchParams): Promis
|
|
|
33
33
|
* @param registryPath - Registry-relative path of the model to fetch.
|
|
34
34
|
* @param registrySource - Registry source identifier (e.g., `"huggingface"`, `"local"`).
|
|
35
35
|
* @returns A promise resolving to the matching `ModelRegistryEntry`.
|
|
36
|
-
* @throws {
|
|
36
|
+
* @throws {ModelRegistryModelNotFoundError} When the registry has no model at this source and path.
|
|
37
|
+
* @throws {ModelRegistryQueryFailedError} When the registry query fails.
|
|
37
38
|
*/
|
|
38
39
|
declare function modelRegistryGetModel(registryPath: string, registrySource: string): Promise<ModelRegistryEntry>;
|
|
39
40
|
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel };
|
package/dist/api/registry.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { send } from '../dispatch.js';
|
|
2
2
|
import { ModelRegistryQueryFailedError } from '../errors/index.js';
|
|
3
|
-
function validateRegistryResponse(response
|
|
3
|
+
function validateRegistryResponse(response) {
|
|
4
4
|
if (!response.success) {
|
|
5
|
-
throw new ModelRegistryQueryFailedError(response.error ??
|
|
5
|
+
throw new ModelRegistryQueryFailedError(response.error ?? 'Unknown registry error');
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
@@ -48,7 +48,8 @@ async function modelRegistrySearch(params = {}) {
|
|
|
48
48
|
* @param registryPath - Registry-relative path of the model to fetch.
|
|
49
49
|
* @param registrySource - Registry source identifier (e.g., `"huggingface"`, `"local"`).
|
|
50
50
|
* @returns A promise resolving to the matching `ModelRegistryEntry`.
|
|
51
|
-
* @throws {
|
|
51
|
+
* @throws {ModelRegistryModelNotFoundError} When the registry has no model at this source and path.
|
|
52
|
+
* @throws {ModelRegistryQueryFailedError} When the registry query fails.
|
|
52
53
|
*/
|
|
53
54
|
async function modelRegistryGetModel(registryPath, registrySource) {
|
|
54
55
|
const request = {
|
|
@@ -57,7 +58,7 @@ async function modelRegistryGetModel(registryPath, registrySource) {
|
|
|
57
58
|
registrySource
|
|
58
59
|
};
|
|
59
60
|
const response = (await send(request));
|
|
60
|
-
validateRegistryResponse(response
|
|
61
|
+
validateRegistryResponse(response);
|
|
61
62
|
return response.model;
|
|
62
63
|
}
|
|
63
64
|
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RerankParams, type RerankScores, type RPCOptions } from '../schemas/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Scores documents by relevance to a query with a reranker model.
|
|
4
|
+
*
|
|
5
|
+
* @param params - Model ID, query, and the documents to score.
|
|
6
|
+
* @param options - Dispatch options.
|
|
7
|
+
* @returns A promise with a synchronous requestId for cancel(). Resolves to
|
|
8
|
+
* one score per document, in input order; higher is more relevant. Scores are
|
|
9
|
+
* the model's raw output, so compare them within one model only.
|
|
10
|
+
* @throws {RequestValidationFailedError} If the request is invalid.
|
|
11
|
+
* @throws {InferenceCancelledError} If the request is cancelled.
|
|
12
|
+
* @throws {RequestRejectedByPolicyError} If this model's rerank queue is full.
|
|
13
|
+
* @throws {InvalidResponseError} If the handler returns a malformed result.
|
|
14
|
+
*/
|
|
15
|
+
export declare function rerank(params: RerankParams, options?: RPCOptions): Promise<RerankScores> & {
|
|
16
|
+
requestId: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { send } from '../dispatch.js';
|
|
2
|
+
import { rerankParamsSchema, rerankResponseSchema } from '../schemas/index.js';
|
|
3
|
+
import { InvalidResponseError } from '../errors/index.js';
|
|
4
|
+
import { decoratePromise } from '../utils/decorate-promise.js';
|
|
5
|
+
import { generateRequestId } from '../runtime/request-id.js';
|
|
6
|
+
import { parseClientInput } from '../api/parse-input.js';
|
|
7
|
+
/**
|
|
8
|
+
* Scores documents by relevance to a query with a reranker model.
|
|
9
|
+
*
|
|
10
|
+
* @param params - Model ID, query, and the documents to score.
|
|
11
|
+
* @param options - Dispatch options.
|
|
12
|
+
* @returns A promise with a synchronous requestId for cancel(). Resolves to
|
|
13
|
+
* one score per document, in input order; higher is more relevant. Scores are
|
|
14
|
+
* the model's raw output, so compare them within one model only.
|
|
15
|
+
* @throws {RequestValidationFailedError} If the request is invalid.
|
|
16
|
+
* @throws {InferenceCancelledError} If the request is cancelled.
|
|
17
|
+
* @throws {RequestRejectedByPolicyError} If this model's rerank queue is full.
|
|
18
|
+
* @throws {InvalidResponseError} If the handler returns a malformed result.
|
|
19
|
+
*/
|
|
20
|
+
export function rerank(params, options) {
|
|
21
|
+
const requestId = generateRequestId();
|
|
22
|
+
return decoratePromise(runRerank(params, requestId, options), { requestId });
|
|
23
|
+
}
|
|
24
|
+
async function runRerank(params, requestId, options) {
|
|
25
|
+
const input = parseClientInput(rerankParamsSchema, params);
|
|
26
|
+
const response = await send({ ...input, type: 'rerank', requestId }, options);
|
|
27
|
+
if (response.type !== 'rerank')
|
|
28
|
+
throw new InvalidResponseError('rerank');
|
|
29
|
+
const parsed = rerankResponseSchema.safeParse(response);
|
|
30
|
+
if (!parsed.success)
|
|
31
|
+
throw new InvalidResponseError('rerank', parsed.error);
|
|
32
|
+
const { scores } = parsed.data;
|
|
33
|
+
if (scores.length !== input.documents.length)
|
|
34
|
+
throw new InvalidResponseError('rerank');
|
|
35
|
+
return scores;
|
|
36
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AbortController } from 'bare-abort-controller';
|
|
1
2
|
import { getAppLogger, ALL_LOG_ID } from '../logging/index.js';
|
|
2
|
-
import { loggingStream } from '
|
|
3
|
+
import { loggingStream } from '../api/logging-stream.js';
|
|
3
4
|
const logger = getAppLogger();
|
|
4
5
|
/**
|
|
5
6
|
* Subscribes to every log through a single stream: the engine's own logs, per-model
|
|
@@ -26,7 +27,8 @@ const logger = getAppLogger();
|
|
|
26
27
|
* ```
|
|
27
28
|
*/
|
|
28
29
|
export function subscribeServerLogs(handler) {
|
|
29
|
-
const
|
|
30
|
+
const controller = new AbortController();
|
|
31
|
+
const streamIterator = loggingStream({ id: ALL_LOG_ID }, { signal: controller.signal });
|
|
30
32
|
void (async () => {
|
|
31
33
|
try {
|
|
32
34
|
for await (const log of streamIterator) {
|
|
@@ -38,6 +40,6 @@ export function subscribeServerLogs(handler) {
|
|
|
38
40
|
}
|
|
39
41
|
})();
|
|
40
42
|
return () => {
|
|
41
|
-
|
|
43
|
+
controller.abort(undefined);
|
|
42
44
|
};
|
|
43
45
|
}
|
|
@@ -83,6 +83,7 @@ export declare function textToSpeech(params: TtsClientParamsInput, options?: RPC
|
|
|
83
83
|
* so `await result.sampleRate` can never hang or reject on its own.
|
|
84
84
|
*/
|
|
85
85
|
export type TtsSideChannel = {
|
|
86
|
+
text: Promise<string | undefined>;
|
|
86
87
|
sampleRate: Promise<number | undefined>;
|
|
87
88
|
stats: Promise<TtsStats | undefined>;
|
|
88
89
|
stopReason: Promise<'completed' | 'cancelled' | undefined>;
|
|
@@ -132,29 +132,12 @@ export class TtsMulticast {
|
|
|
132
132
|
}
|
|
133
133
|
function buildTtsRequest(params, requestId) {
|
|
134
134
|
return {
|
|
135
|
+
...params,
|
|
135
136
|
type: 'textToSpeech',
|
|
136
|
-
modelId: params.modelId,
|
|
137
137
|
requestId,
|
|
138
138
|
inputType: params.inputType ?? 'text',
|
|
139
|
-
text: params.text,
|
|
140
139
|
stream: params.stream ?? true,
|
|
141
|
-
sentenceStream: params.sentenceStream ?? false
|
|
142
|
-
...(params.sentenceStreamLocale !== undefined && {
|
|
143
|
-
sentenceStreamLocale: params.sentenceStreamLocale
|
|
144
|
-
}),
|
|
145
|
-
...(params.sentenceStreamMaxChunkScalars !== undefined && {
|
|
146
|
-
sentenceStreamMaxChunkScalars: params.sentenceStreamMaxChunkScalars
|
|
147
|
-
}),
|
|
148
|
-
...(params.description !== undefined && { description: params.description }),
|
|
149
|
-
...(params.voiceDescription !== undefined && { voiceDescription: params.voiceDescription }),
|
|
150
|
-
...(params.voice !== undefined && { voice: params.voice }),
|
|
151
|
-
...(params.emotion !== undefined && { emotion: params.emotion }),
|
|
152
|
-
...(params.pitch !== undefined && { pitch: params.pitch }),
|
|
153
|
-
...(params.pace !== undefined && { pace: params.pace }),
|
|
154
|
-
...(params.expressivity !== undefined && { expressivity: params.expressivity }),
|
|
155
|
-
...(params.noise !== undefined && { noise: params.noise }),
|
|
156
|
-
...(params.reverb !== undefined && { reverb: params.reverb }),
|
|
157
|
-
...(params.quality !== undefined && { quality: params.quality })
|
|
140
|
+
sentenceStream: params.sentenceStream ?? false
|
|
158
141
|
};
|
|
159
142
|
}
|
|
160
143
|
function buildTextToSpeechStreamRequest(params, requestId) {
|
|
@@ -253,6 +236,11 @@ export function textToSpeech(params, options) {
|
|
|
253
236
|
}
|
|
254
237
|
/** Exported for test use; not part of the public API surface. */
|
|
255
238
|
export function createTtsSideChannel() {
|
|
239
|
+
let resolveText;
|
|
240
|
+
const text = new Promise((resolve) => {
|
|
241
|
+
resolveText = resolve;
|
|
242
|
+
});
|
|
243
|
+
let seenText;
|
|
256
244
|
let resolveSampleRate;
|
|
257
245
|
let resolveStats;
|
|
258
246
|
let resolveStopReason;
|
|
@@ -270,10 +258,13 @@ export function createTtsSideChannel() {
|
|
|
270
258
|
let seenStopReason;
|
|
271
259
|
let settled = false;
|
|
272
260
|
return {
|
|
261
|
+
text,
|
|
273
262
|
sampleRate,
|
|
274
263
|
stats,
|
|
275
264
|
stopReason,
|
|
276
265
|
observe(response) {
|
|
266
|
+
if (response.text !== undefined)
|
|
267
|
+
seenText = response.text;
|
|
277
268
|
// Resolve on the FIRST frame that carries a rate, not at end of stream:
|
|
278
269
|
// a caller opening an audio device wants it before draining the audio.
|
|
279
270
|
// Promise resolution is idempotent, so settle() can still resolve the
|
|
@@ -291,6 +282,7 @@ export function createTtsSideChannel() {
|
|
|
291
282
|
if (settled)
|
|
292
283
|
return;
|
|
293
284
|
settled = true;
|
|
285
|
+
resolveText(seenText);
|
|
294
286
|
resolveSampleRate(seenSampleRate);
|
|
295
287
|
resolveStats(latestStats);
|
|
296
288
|
resolveStopReason(seenStopReason);
|
|
@@ -331,6 +323,7 @@ function sentenceStreamTts(request, options) {
|
|
|
331
323
|
buffer: Promise.resolve([]),
|
|
332
324
|
done: multicast.done,
|
|
333
325
|
requestId: request.requestId,
|
|
326
|
+
text: side.text,
|
|
334
327
|
sampleRate: side.sampleRate,
|
|
335
328
|
stats: side.stats,
|
|
336
329
|
stopReason: side.stopReason
|
|
@@ -379,6 +372,7 @@ function plainStreamTts(request, options) {
|
|
|
379
372
|
buffer: Promise.resolve([]),
|
|
380
373
|
done,
|
|
381
374
|
requestId: request.requestId,
|
|
375
|
+
text: side.text,
|
|
382
376
|
sampleRate: side.sampleRate,
|
|
383
377
|
stats: side.stats,
|
|
384
378
|
stopReason: side.stopReason
|
|
@@ -431,6 +425,7 @@ function collectTts(request, options) {
|
|
|
431
425
|
buffer: collectTtsBuffer(request, options, resolveDone, rejectDone, side),
|
|
432
426
|
done,
|
|
433
427
|
requestId: request.requestId,
|
|
428
|
+
text: side.text,
|
|
434
429
|
sampleRate: side.sampleRate,
|
|
435
430
|
stats: side.stats,
|
|
436
431
|
stopReason: side.stopReason
|
|
@@ -449,6 +444,7 @@ async function collectTtsBuffer(request, options, resolveDone, rejectDone, side)
|
|
|
449
444
|
buffer = buffer.concat(response.buffer);
|
|
450
445
|
if (response.done) {
|
|
451
446
|
resolveDone(true);
|
|
447
|
+
break;
|
|
452
448
|
}
|
|
453
449
|
}
|
|
454
450
|
return buffer;
|
package/dist/api/transcribe.js
CHANGED
|
@@ -12,7 +12,9 @@ function buildTranscribeRequest(params, requestId) {
|
|
|
12
12
|
audioChunk: typeof params.audioChunk === 'string'
|
|
13
13
|
? { type: 'filePath', value: params.audioChunk }
|
|
14
14
|
: { type: 'base64', value: params.audioChunk.toString('base64') },
|
|
15
|
-
...(params.prompt && { prompt: params.prompt }),
|
|
15
|
+
...(params.prompt !== undefined && params.prompt !== null && { prompt: params.prompt }),
|
|
16
|
+
...(params.hotwords !== undefined && { hotwords: params.hotwords }),
|
|
17
|
+
...(params.maxNewTokens !== undefined && { maxNewTokens: params.maxNewTokens }),
|
|
16
18
|
...(params.metadata === true && { metadata: true }),
|
|
17
19
|
requestId
|
|
18
20
|
};
|
|
@@ -297,7 +299,8 @@ export function processLineConversation(line, wantsMetadata, onTerminal) {
|
|
|
297
299
|
type: 'vad',
|
|
298
300
|
speaking: response.vad.speaking,
|
|
299
301
|
probability: response.vad.probability,
|
|
300
|
-
...(response.vad.source && { source: response.vad.source })
|
|
302
|
+
...(response.vad.source && { source: response.vad.source }),
|
|
303
|
+
...(response.vad.speakerId !== undefined && { speakerId: response.vad.speakerId })
|
|
301
304
|
};
|
|
302
305
|
}
|
|
303
306
|
if (response.endOfTurn) {
|
package/dist/api/unload-model.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { send, close } from '../dispatch.js';
|
|
2
|
-
import { stopLoggingStreamForModel } from '
|
|
2
|
+
import { stopLoggingStreamForModel } from '../api/logging-stream-registry.js';
|
|
3
3
|
import { InvalidResponseError, ModelUnloadFailedError } from '../errors/index.js';
|
|
4
4
|
import { getAppLogger } from '../logging/index.js';
|
|
5
5
|
const logger = getAppLogger();
|