@qvac/inference 0.18.2 → 0.19.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 +11 -2
- package/README.md +1 -5
- package/dist/api/assess-model-fit.d.ts +16 -0
- package/dist/api/assess-model-fit.js +27 -0
- package/dist/api/audio-gen.d.ts +4 -4
- package/dist/api/audio-gen.js +17 -6
- package/dist/api/completion-stream.d.ts +1 -1
- package/dist/api/completion-stream.js +1 -1
- package/dist/api/download-asset.d.ts +1 -1
- package/dist/api/download-asset.js +2 -2
- package/dist/api/finetune.js +1 -1
- package/dist/api/get-loaded-model-info.d.ts +6 -10
- package/dist/api/get-loaded-model-info.js +6 -10
- package/dist/api/heartbeat.d.ts +5 -22
- package/dist/api/heartbeat.js +6 -23
- package/dist/api/index.d.ts +36 -35
- package/dist/api/index.js +35 -35
- package/dist/api/load-model.d.ts +5 -1
- package/dist/api/load-model.js +3 -5
- package/dist/api/logging-stream-registry.js +1 -1
- package/dist/api/resume.d.ts +0 -3
- package/dist/api/resume.js +0 -3
- package/dist/api/subscribe-logs.js +1 -1
- package/dist/api/suspend.d.ts +0 -4
- package/dist/api/suspend.js +0 -4
- package/dist/api/translate.d.ts +3 -1
- package/dist/api/translate.js +16 -8
- package/dist/api/unload-model.js +3 -5
- package/dist/api/video-request.d.ts +207 -0
- package/dist/api/video-request.js +18 -0
- package/dist/api/video.d.ts +22 -2
- package/dist/api/video.js +25 -15
- package/dist/api/vla-helpers.d.ts +1 -2
- package/dist/api/vla-helpers.js +1 -2
- package/dist/api/vla.js +1 -1
- package/dist/api/world-result.d.ts +71 -0
- package/dist/api/world-result.js +293 -0
- package/dist/api/world.d.ts +143 -0
- package/dist/api/world.js +71 -0
- 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.js +15 -28
- package/dist/errors/index.d.ts +35 -31
- package/dist/errors/index.js +66 -56
- package/dist/handlers/assess-model-fit.d.ts +10 -0
- package/dist/handlers/assess-model-fit.js +75 -0
- package/dist/handlers/cancelHandler.js +1 -1
- package/dist/handlers/completion-orchestrate.js +1 -1
- package/dist/handlers/download-asset.js +6 -5
- package/dist/handlers/finetune.js +1 -1
- package/dist/handlers/get-loaded-model-info.js +0 -12
- package/dist/handlers/get-model-info.js +1 -1
- package/dist/handlers/get-system-resources.js +8 -0
- package/dist/handlers/load-model/download-manager.d.ts +1 -1
- package/dist/handlers/load-model/download-stats.d.ts +3 -3
- package/dist/handlers/load-model/download-stats.js +5 -5
- package/dist/handlers/load-model/handler.js +6 -8
- package/dist/handlers/load-model/http-verify.d.ts +20 -0
- package/dist/handlers/load-model/http-verify.js +54 -0
- package/dist/handlers/load-model/http.d.ts +12 -2
- package/dist/handlers/load-model/http.js +119 -230
- package/dist/handlers/load-model/hyperdrive.d.ts +1 -1
- package/dist/handlers/load-model/hyperdrive.js +1 -1
- 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 +4 -4
- package/dist/handlers/load-model/resolve-session.d.ts +8 -1
- package/dist/handlers/load-model/resolve-session.js +12 -9
- package/dist/handlers/load-model/resolve.d.ts +4 -4
- package/dist/handlers/load-model/resolve.js +18 -16
- package/dist/handlers/load-model/safe-fetch.d.ts +44 -0
- package/dist/handlers/load-model/safe-fetch.js +143 -0
- package/dist/handlers/load-model/types.d.ts +9 -0
- package/dist/handlers/plugin-dispatch.js +1 -4
- package/dist/handlers/plugin-invoke.js +1 -4
- package/dist/handlers/types.d.ts +0 -2
- package/dist/handlers/unload-model.js +1 -4
- 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/models/registry/index.d.ts +1 -1
- package/dist/models/registry/index.js +2 -2
- package/dist/models/registry/models.d.ts +250 -0
- package/dist/models/registry/models.js +2071 -1806
- package/dist/models/registry/resource-profiles.d.ts +18 -0
- package/dist/models/registry/resource-profiles.js +4934 -0
- package/dist/plugins/builtin/audiogen-ggml/config.d.ts +14 -0
- package/dist/plugins/builtin/audiogen-ggml/config.js +23 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +47 -5
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +134 -4
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +47 -28
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +1 -1
- 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/plugin.js +2 -2
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +1 -1
- package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
- package/dist/plugins/builtin/index.d.ts +12 -12
- package/dist/plugins/builtin/index.js +12 -12
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +2 -2
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +37 -26
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.d.ts +12 -11
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.js +133 -41
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +7 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +26 -4
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +19 -8
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +10 -13
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +4 -0
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +13 -2
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +2 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +2 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +3 -3
- package/dist/plugins/builtin/sdcpp-generation/ops/upscale.js +1 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +32 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +126 -0
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +820 -0
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +153 -4
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +134 -13
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +1 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +1 -1
- package/dist/plugins/builtin/tts-ggml/plugin.js +2 -2
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +2 -2
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +3 -3
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/ops/kv-cache-utils.js +1 -1
- package/dist/plugins/ops/load-model.js +1 -1
- package/dist/plugins/ops/transcribe.js +2 -2
- package/dist/plugins/ops/translate.js +4 -12
- package/dist/plugins/ops/unload-model.js +19 -21
- package/dist/plugins/registry.d.ts +1 -0
- package/dist/plugins/registry.js +12 -0
- 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/envelope.d.ts +0 -1
- package/dist/profiling/envelope.js +0 -10
- package/dist/profiling/events.d.ts +2 -3
- package/dist/profiling/events.js +2 -9
- package/dist/profiling/exporters.d.ts +1 -1
- package/dist/profiling/exporters.js +3 -3
- package/dist/profiling/index.d.ts +13 -14
- package/dist/profiling/index.js +12 -13
- package/dist/profiling/operation-metrics.d.ts +1 -1
- package/dist/profiling/operation-metrics.js +35 -2
- package/dist/profiling/operation-wrappers.js +12 -15
- package/dist/profiling/profiler.d.ts +1 -2
- package/dist/profiling/profiler.js +7 -26
- package/dist/profiling/types.d.ts +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 +2 -6
- 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.d.ts +4 -2
- package/dist/rag/rag-workspace-manager.js +268 -15
- package/dist/registry.js +8 -58
- package/dist/resources/collector.d.ts +3 -1
- package/dist/resources/collector.js +91 -9
- package/dist/resources/instance.d.ts +1 -1
- package/dist/resources/instance.js +1 -1
- package/dist/resources/model-fit/assess.d.ts +36 -0
- package/dist/resources/model-fit/assess.js +578 -0
- package/dist/resources/model-fit/calibration/darwin-arm64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/darwin-arm64.js +36 -0
- package/dist/resources/model-fit/calibration/darwin-x64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/darwin-x64.js +38 -0
- package/dist/resources/model-fit/calibration/fit.d.ts +73 -0
- package/dist/resources/model-fit/calibration/fit.js +152 -0
- package/dist/resources/model-fit/calibration/index.d.ts +37 -0
- package/dist/resources/model-fit/calibration/index.js +75 -0
- package/dist/resources/model-fit/calibration/linux-arm64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/linux-arm64.js +38 -0
- package/dist/resources/model-fit/calibration/linux-x64-vulkan.d.ts +8 -0
- package/dist/resources/model-fit/calibration/linux-x64-vulkan.js +39 -0
- package/dist/resources/model-fit/calibration/linux-x64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/linux-x64.js +38 -0
- package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.d.ts +8 -0
- package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.js +39 -0
- package/dist/resources/model-fit/calibration/win32-x64-vulkan.d.ts +8 -0
- package/dist/resources/model-fit/calibration/win32-x64-vulkan.js +36 -0
- package/dist/resources/model-fit/calibration/win32-x64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/win32-x64.js +38 -0
- package/dist/resources/model-fit/estimators/llm.d.ts +45 -0
- package/dist/resources/model-fit/estimators/llm.js +220 -0
- package/dist/resources/model-fit/estimators/whisper.d.ts +10 -0
- package/dist/resources/model-fit/estimators/whisper.js +77 -0
- package/dist/resources/model-fit/types.d.ts +120 -0
- package/dist/resources/model-fit/types.js +1 -0
- package/dist/resources/native.d.ts +1 -1
- package/dist/resources/native.js +14 -0
- package/dist/resources/normalize.d.ts +1 -1
- package/dist/resources/types.d.ts +16 -0
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/lifecycle.js +5 -7
- package/dist/runtime/model-registry.d.ts +0 -14
- package/dist/runtime/model-registry.js +17 -40
- package/dist/runtime/registry-client.js +1 -1
- package/dist/runtime/request-context.d.ts +3 -3
- package/dist/runtime/request-context.js +13 -1
- package/dist/runtime/request-registry.d.ts +1 -1
- package/dist/runtime/request-registry.js +4 -5
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +18 -3
- package/dist/schemas/assess-model-fit.d.ts +271 -0
- package/dist/schemas/assess-model-fit.js +153 -0
- package/dist/schemas/audio-gen.d.ts +434 -4
- package/dist/schemas/audio-gen.js +131 -19
- package/dist/schemas/batch-completion-stream.d.ts +2 -2
- package/dist/schemas/batch-completion-stream.js +3 -3
- package/dist/schemas/bci-config.js +73 -27
- package/dist/schemas/bci.d.ts +2 -2
- package/dist/schemas/bci.js +5 -5
- package/dist/schemas/cancel.d.ts +5 -0
- package/dist/schemas/cancel.js +1 -0
- package/dist/schemas/classification.js +13 -6
- package/dist/schemas/common.d.ts +662 -331
- package/dist/schemas/common.js +33 -31
- package/dist/schemas/completion-event.d.ts +2 -2
- package/dist/schemas/completion-event.js +1 -1
- package/dist/schemas/completion-stream.d.ts +1 -5
- package/dist/schemas/completion-stream.js +4 -8
- package/dist/schemas/config.d.ts +640 -18
- package/dist/schemas/config.js +50 -8
- package/dist/schemas/download-asset.d.ts +19 -1
- package/dist/schemas/download-asset.js +20 -4
- package/dist/schemas/engine-addon-map.d.ts +1 -1
- package/dist/schemas/engine-addon-map.js +3 -3
- package/dist/schemas/error.d.ts +2 -2
- package/dist/schemas/error.js +2 -2
- package/dist/schemas/errors.d.ts +2 -6
- package/dist/schemas/errors.js +30 -40
- package/dist/schemas/heartbeat.d.ts +10 -0
- package/dist/schemas/heartbeat.js +8 -0
- package/dist/schemas/index.d.ts +46 -44
- package/dist/schemas/index.js +45 -43
- package/dist/schemas/llamacpp-config.d.ts +32 -10
- package/dist/schemas/llamacpp-config.js +11 -8
- package/dist/schemas/load-model.d.ts +2933 -1948
- package/dist/schemas/load-model.js +52 -52
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-config-schemas.d.ts +2354 -0
- package/dist/schemas/model-config-schemas.js +46 -0
- package/dist/schemas/model-info.d.ts +10 -20
- package/dist/schemas/model-info.js +4 -25
- package/dist/schemas/model-ops.d.ts +0 -1
- package/dist/schemas/model-ops.js +1 -2
- package/dist/schemas/model-resource-profile.d.ts +109 -0
- package/dist/schemas/model-resource-profile.js +83 -0
- package/dist/schemas/model-src-utils.d.ts +1 -0
- package/dist/schemas/model-src-utils.js +33 -13
- package/dist/schemas/ocr.js +48 -13
- package/dist/schemas/path-validation.js +8 -2
- package/dist/schemas/plugin.d.ts +14 -1
- package/dist/schemas/plugin.js +11 -0
- package/dist/schemas/profiling.d.ts +138 -43
- package/dist/schemas/profiling.js +1 -22
- package/dist/schemas/rag.js +1 -1
- package/dist/schemas/registry.js +1 -1
- package/dist/schemas/reload-config.d.ts +0 -2
- package/dist/schemas/reload-config.js +2 -3
- package/dist/schemas/sdcpp-config.d.ts +344 -4
- package/dist/schemas/sdcpp-config.js +504 -17
- package/dist/schemas/system-resources.d.ts +138 -0
- package/dist/schemas/system-resources.js +3 -1
- package/dist/schemas/text-to-speech.js +183 -76
- package/dist/schemas/transcription-config.js +253 -85
- package/dist/schemas/transcription.d.ts +3 -3
- package/dist/schemas/translate.d.ts +2 -2
- package/dist/schemas/translate.js +1 -1
- package/dist/schemas/translation-config.js +53 -25
- package/dist/schemas/vla.d.ts +1 -1
- package/dist/selection.d.ts +1 -5
- package/dist/selection.js +2 -6
- package/dist/surface.d.ts +1 -1
- 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-input.js +1 -1
- package/dist/utils/cache/auto-history.d.ts +1 -1
- package/dist/utils/cache/auto-history.js +1 -1
- package/dist/utils/cache/paths.js +5 -5
- package/dist/utils/completion-normalizer.js +1 -1
- package/dist/utils/gguf-tensor-extractor.js +1 -1
- package/dist/utils/image-dimensions.d.ts +26 -0
- package/dist/utils/image-dimensions.js +46 -0
- package/dist/utils/index.d.ts +13 -10
- package/dist/utils/index.js +13 -10
- package/dist/utils/mcp-adapter.d.ts +1 -1
- package/dist/utils/mcp-adapter.js +1 -1
- package/dist/utils/path-sanitize.d.ts +7 -0
- package/dist/utils/path-sanitize.js +36 -0
- package/dist/utils/path-security.d.ts +0 -7
- package/dist/utils/path-security.js +1 -36
- package/dist/utils/shard-utils.js +3 -3
- package/dist/utils/tool-integration.js +1 -1
- package/dist/utils/tools/dialect.js +1 -1
- package/dist/utils/tools/index.d.ts +2 -2
- package/dist/utils/tools/index.js +2 -2
- 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 +3 -3
- package/dist/utils/url-security.d.ts +17 -0
- package/dist/utils/url-security.js +75 -0
- package/package.json +31 -26
- package/dist/api/provide.d.ts +0 -23
- package/dist/api/provide.js +0 -32
- package/dist/api/stop-provider.d.ts +0 -20
- package/dist/api/stop-provider.js +0 -30
- package/dist/p2p/cancel-delegated.d.ts +0 -3
- package/dist/p2p/cancel-delegated.js +0 -64
- package/dist/p2p/completion-stream-delegated.d.ts +0 -4
- package/dist/p2p/completion-stream-delegated.js +0 -51
- package/dist/p2p/delegate-client.d.ts +0 -9
- package/dist/p2p/delegate-client.js +0 -219
- package/dist/p2p/delegate-connect-diagnostics.d.ts +0 -8
- package/dist/p2p/delegate-connect-diagnostics.js +0 -38
- package/dist/p2p/delegate-transport.d.ts +0 -18
- package/dist/p2p/delegate-transport.js +0 -237
- package/dist/p2p/error-handlers.d.ts +0 -4
- package/dist/p2p/error-handlers.js +0 -31
- package/dist/p2p/handle-request.d.ts +0 -2
- package/dist/p2p/handle-request.js +0 -171
- package/dist/p2p/handler-utils.d.ts +0 -19
- package/dist/p2p/handler-utils.js +0 -180
- package/dist/p2p/heartbeat-delegated.d.ts +0 -3
- package/dist/p2p/heartbeat-delegated.js +0 -32
- package/dist/p2p/load-model-delegated.d.ts +0 -6
- package/dist/p2p/load-model-delegated.js +0 -132
- package/dist/p2p/progress-throttle.d.ts +0 -7
- package/dist/p2p/progress-throttle.js +0 -47
- package/dist/p2p/provideHandler/connection.d.ts +0 -2
- package/dist/p2p/provideHandler/connection.js +0 -38
- package/dist/p2p/provideHandler/handler.d.ts +0 -2
- package/dist/p2p/provideHandler/handler.js +0 -66
- package/dist/p2p/provideHandler/proxy.d.ts +0 -2
- package/dist/p2p/provideHandler/proxy.js +0 -24
- package/dist/p2p/provideHandler.d.ts +0 -1
- package/dist/p2p/provideHandler.js +0 -2
- package/dist/p2p/rpc-utils.d.ts +0 -4
- package/dist/p2p/rpc-utils.js +0 -8
- package/dist/p2p/stopProvideHandler.d.ts +0 -2
- package/dist/p2p/stopProvideHandler.js +0 -29
- package/dist/p2p/swarm.d.ts +0 -9
- package/dist/p2p/swarm.js +0 -103
- package/dist/p2p/transport-selector.d.ts +0 -2
- package/dist/p2p/transport-selector.js +0 -18
- package/dist/p2p/unload-model-delegated.d.ts +0 -2
- package/dist/p2p/unload-model-delegated.js +0 -31
- package/dist/profiling/delegation-profiler.d.ts +0 -31
- package/dist/profiling/delegation-profiler.js +0 -155
- package/dist/schemas/delegate.d.ts +0 -29
- package/dist/schemas/delegate.js +0 -40
- package/dist/schemas/provide.d.ts +0 -50
- package/dist/schemas/provide.js +0 -32
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { llmConfigBaseSchema, embedConfigBaseSchema } from './llamacpp-config.js';
|
|
2
|
+
import { whisperConfigSchema, parakeetRuntimeConfigSchema } from './transcription-config.js';
|
|
3
|
+
import { bciConfigSchema } from './bci-config.js';
|
|
4
|
+
import { nmtConfigBaseSchema } from './translation-config.js';
|
|
5
|
+
import { ttsLoadConfigSchema } from './text-to-speech.js';
|
|
6
|
+
import { ocrConfigSchema } from './ocr.js';
|
|
7
|
+
import { sdcppConfigSchema } from './sdcpp-config.js';
|
|
8
|
+
import { audioGenConfigSchema } from './audio-gen.js';
|
|
9
|
+
import { vlaConfigSchema } from './vla.js';
|
|
10
|
+
import { classificationConfigSchema } from './classification.js';
|
|
11
|
+
import { ModelType, normalizeModelType } from './model-types.js';
|
|
12
|
+
// Canonical model type -> the `modelConfig` schema whose fields a user
|
|
13
|
+
// configures. This is the describable, user-facing config surface: base/runtime
|
|
14
|
+
// schemas and the load-time discriminated unions (tts / nmt / audiogen),
|
|
15
|
+
// excluding the legacy ONNX deprecation placeholders. It is the single source
|
|
16
|
+
// tools read to document config fields — the describe-guard test checks every
|
|
17
|
+
// entry carries `.describe()` text, and the CLI's `qvac configure` resolves a
|
|
18
|
+
// model's schema through here to render field docs.
|
|
19
|
+
//
|
|
20
|
+
// `satisfies Record<...>` makes a newly added model type a compile error until
|
|
21
|
+
// its config schema is wired here, so a new addon can't silently ship without
|
|
22
|
+
// documented, tool-visible config. `onnx-tts` is a legacy alias that routes to
|
|
23
|
+
// `tts-ggml`, so it is not a key of its own.
|
|
24
|
+
export const MODEL_CONFIG_SCHEMA_BY_TYPE = {
|
|
25
|
+
[ModelType.llamacppCompletion]: llmConfigBaseSchema,
|
|
26
|
+
[ModelType.whispercppTranscription]: whisperConfigSchema,
|
|
27
|
+
[ModelType.bciWhispercppTranscription]: bciConfigSchema,
|
|
28
|
+
[ModelType.llamacppEmbedding]: embedConfigBaseSchema,
|
|
29
|
+
[ModelType.nmtcppTranslation]: nmtConfigBaseSchema,
|
|
30
|
+
[ModelType.ttsGgml]: ttsLoadConfigSchema,
|
|
31
|
+
[ModelType.parakeetTranscription]: parakeetRuntimeConfigSchema,
|
|
32
|
+
[ModelType.ggmlOcr]: ocrConfigSchema,
|
|
33
|
+
[ModelType.sdcppGeneration]: sdcppConfigSchema,
|
|
34
|
+
[ModelType.audiogenGgml]: audioGenConfigSchema,
|
|
35
|
+
[ModelType.ggmlVla]: vlaConfigSchema,
|
|
36
|
+
[ModelType.ggmlClassification]: classificationConfigSchema
|
|
37
|
+
};
|
|
38
|
+
// Resolve a model's `modelConfig` schema from any accepted model-type input: a
|
|
39
|
+
// canonical type (`tts-ggml`), a backward-compat alias (`tts`), or an engine /
|
|
40
|
+
// addon string that normalizes to one. Returns undefined for types with no
|
|
41
|
+
// configurable surface (e.g. `onnx-vad`) or unknown custom plugin types.
|
|
42
|
+
export function configSchemaForModelType(modelType) {
|
|
43
|
+
const canonical = normalizeModelType(modelType);
|
|
44
|
+
const key = canonical === ModelType.onnxTts ? ModelType.ttsGgml : canonical;
|
|
45
|
+
return MODEL_CONFIG_SCHEMA_BY_TYPE[key];
|
|
46
|
+
}
|
|
@@ -134,9 +134,14 @@ export declare const getLoadedModelInfoRequestSchema: z.ZodObject<{
|
|
|
134
134
|
modelId: z.ZodString;
|
|
135
135
|
type: z.ZodLiteral<"getLoadedModelInfo">;
|
|
136
136
|
}, z.core.$strip>;
|
|
137
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Loaded model info: routing plugin known on this node, so modelType +
|
|
139
|
+
* handler vocabulary are authoritative. `toolDialect` is the tool-call dialect
|
|
140
|
+
* the completion normalizer parses for this model (completion-capable models
|
|
141
|
+
* only), letting a consumer replay a prior tool call in the model's own dialect.
|
|
142
|
+
*/
|
|
143
|
+
export declare const loadedModelInfoSchema: z.ZodObject<{
|
|
138
144
|
modelId: z.ZodString;
|
|
139
|
-
isDelegated: z.ZodLiteral<false>;
|
|
140
145
|
modelType: z.ZodString;
|
|
141
146
|
handlers: z.ZodArray<z.ZodString>;
|
|
142
147
|
displayName: z.ZodOptional<z.ZodString>;
|
|
@@ -153,19 +158,11 @@ export declare const loadedModelInfoSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
153
158
|
gemma4: "gemma4";
|
|
154
159
|
dsml: "dsml";
|
|
155
160
|
}>>;
|
|
156
|
-
}, z.core.$strip
|
|
157
|
-
modelId: z.ZodString;
|
|
158
|
-
isDelegated: z.ZodLiteral<true>;
|
|
159
|
-
handlers: z.ZodArray<z.ZodString>;
|
|
160
|
-
providerInfo: z.ZodObject<{
|
|
161
|
-
providerPublicKey: z.ZodString;
|
|
162
|
-
}, z.core.$strip>;
|
|
163
|
-
}, z.core.$strip>], "isDelegated">;
|
|
161
|
+
}, z.core.$strip>;
|
|
164
162
|
export declare const getLoadedModelInfoResponseSchema: z.ZodObject<{
|
|
165
163
|
type: z.ZodLiteral<"getLoadedModelInfo">;
|
|
166
|
-
info: z.
|
|
164
|
+
info: z.ZodObject<{
|
|
167
165
|
modelId: z.ZodString;
|
|
168
|
-
isDelegated: z.ZodLiteral<false>;
|
|
169
166
|
modelType: z.ZodString;
|
|
170
167
|
handlers: z.ZodArray<z.ZodString>;
|
|
171
168
|
displayName: z.ZodOptional<z.ZodString>;
|
|
@@ -182,14 +179,7 @@ export declare const getLoadedModelInfoResponseSchema: z.ZodObject<{
|
|
|
182
179
|
gemma4: "gemma4";
|
|
183
180
|
dsml: "dsml";
|
|
184
181
|
}>>;
|
|
185
|
-
}, z.core.$strip
|
|
186
|
-
modelId: z.ZodString;
|
|
187
|
-
isDelegated: z.ZodLiteral<true>;
|
|
188
|
-
handlers: z.ZodArray<z.ZodString>;
|
|
189
|
-
providerInfo: z.ZodObject<{
|
|
190
|
-
providerPublicKey: z.ZodString;
|
|
191
|
-
}, z.core.$strip>;
|
|
192
|
-
}, z.core.$strip>], "isDelegated">;
|
|
182
|
+
}, z.core.$strip>;
|
|
193
183
|
}, z.core.$strip>;
|
|
194
184
|
export type GetLoadedModelInfoParams = z.input<typeof getLoadedModelInfoParamsSchema>;
|
|
195
185
|
export type GetLoadedModelInfoRequest = z.infer<typeof getLoadedModelInfoRequestSchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { toolDialectSchema } from '
|
|
2
|
+
import { toolDialectSchema } from './completion-stream.js';
|
|
3
3
|
// ============== Model info (catalog) ==============
|
|
4
4
|
export const getModelInfoParamsSchema = z.object({
|
|
5
5
|
name: z.string().describe("The model's registry name (as found in QVAC's built-in catalog).")
|
|
@@ -98,19 +98,15 @@ export const getLoadedModelInfoParamsSchema = z.object({
|
|
|
98
98
|
export const getLoadedModelInfoRequestSchema = getLoadedModelInfoParamsSchema.extend({
|
|
99
99
|
type: z.literal('getLoadedModelInfo')
|
|
100
100
|
});
|
|
101
|
-
const delegatedProviderInfoSchema = z.object({
|
|
102
|
-
providerPublicKey: z.string()
|
|
103
|
-
});
|
|
104
101
|
/**
|
|
105
|
-
* Loaded
|
|
102
|
+
* Loaded model info: routing plugin known on this node, so modelType +
|
|
106
103
|
* handler vocabulary are authoritative. `toolDialect` is the tool-call dialect
|
|
107
104
|
* the completion normalizer parses for this model (completion-capable models
|
|
108
105
|
* only), letting a consumer replay a prior tool call in the model's own dialect.
|
|
109
106
|
*/
|
|
110
|
-
const
|
|
107
|
+
export const loadedModelInfoSchema = z
|
|
111
108
|
.object({
|
|
112
109
|
modelId: z.string(),
|
|
113
|
-
isDelegated: z.literal(false),
|
|
114
110
|
modelType: z.string(),
|
|
115
111
|
handlers: z.array(z.string()),
|
|
116
112
|
displayName: z.string().optional(),
|
|
@@ -120,24 +116,7 @@ const localLoadedModelInfoSchema = z
|
|
|
120
116
|
path: z.string().optional(),
|
|
121
117
|
toolDialect: toolDialectSchema.optional()
|
|
122
118
|
})
|
|
123
|
-
.meta({ title: '
|
|
124
|
-
/**
|
|
125
|
-
* Loaded delegated model: this node only stores routing info, so `modelType`,
|
|
126
|
-
* `displayName`, `addonPackage`, `loadedAt`, `name`, and `path` are absent,
|
|
127
|
-
* and `handlers` is always empty.
|
|
128
|
-
*/
|
|
129
|
-
const delegatedLoadedModelInfoSchema = z
|
|
130
|
-
.object({
|
|
131
|
-
modelId: z.string(),
|
|
132
|
-
isDelegated: z.literal(true),
|
|
133
|
-
handlers: z.array(z.string()),
|
|
134
|
-
providerInfo: delegatedProviderInfoSchema
|
|
135
|
-
})
|
|
136
|
-
.meta({ title: 'DelegatedLoadedModelInfo' });
|
|
137
|
-
export const loadedModelInfoSchema = z.discriminatedUnion('isDelegated', [
|
|
138
|
-
localLoadedModelInfoSchema,
|
|
139
|
-
delegatedLoadedModelInfoSchema
|
|
140
|
-
]);
|
|
119
|
+
.meta({ title: 'LoadedModelInfo' });
|
|
141
120
|
export const getLoadedModelInfoResponseSchema = z.object({
|
|
142
121
|
type: z.literal('getLoadedModelInfo'),
|
|
143
122
|
info: loadedModelInfoSchema
|
|
@@ -29,7 +29,6 @@ export declare const unloadModelResponseSchema: z.ZodObject<{
|
|
|
29
29
|
success: z.ZodBoolean;
|
|
30
30
|
error: z.ZodOptional<z.ZodString>;
|
|
31
31
|
hasActiveModels: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
-
hasActiveProviders: z.ZodOptional<z.ZodBoolean>;
|
|
33
32
|
}, z.core.$strip>;
|
|
34
33
|
export type UnloadModelParams = z.input<typeof unloadModelParamsSchema>;
|
|
35
34
|
export type UnloadModelRequest = z.infer<typeof unloadModelRequestSchema>;
|
|
@@ -35,6 +35,5 @@ export const unloadModelResponseSchema = z.object({
|
|
|
35
35
|
type: z.literal('unloadModel'),
|
|
36
36
|
success: z.boolean(),
|
|
37
37
|
error: z.string().optional(),
|
|
38
|
-
hasActiveModels: z.boolean().optional()
|
|
39
|
-
hasActiveProviders: z.boolean().optional()
|
|
38
|
+
hasActiveModels: z.boolean().optional()
|
|
40
39
|
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* One group of transformer blocks that size their KV cache identically.
|
|
4
|
+
*
|
|
5
|
+
* Files that describe attention per layer (e.g. `gemma4`, whose
|
|
6
|
+
* `head_count_kv` and `sliding_window_pattern` hold one entry per block) are
|
|
7
|
+
* collapsed into these classes, so an estimator can sum the real cache instead
|
|
8
|
+
* of assuming every block is the widest one.
|
|
9
|
+
*/
|
|
10
|
+
export declare const kvLayerClassSchema: z.ZodObject<{
|
|
11
|
+
count: z.ZodNumber;
|
|
12
|
+
headCountKv: z.ZodNumber;
|
|
13
|
+
keyLength: z.ZodNumber;
|
|
14
|
+
valueLength: z.ZodNumber;
|
|
15
|
+
windowed: z.ZodBoolean;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
/**
|
|
18
|
+
* Transformer shape facts read out of a model's GGUF key-value metadata at
|
|
19
|
+
* catalog-generation time, from what the registry captured at ingest.
|
|
20
|
+
*
|
|
21
|
+
* Absent for non-GGUF artifacts and for GGUF files whose metadata extraction
|
|
22
|
+
* failed — that absence is what makes a pre-download estimate unknown rather
|
|
23
|
+
* than wrong.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ggufFactsSchema: z.ZodObject<{
|
|
26
|
+
architecture: z.ZodString;
|
|
27
|
+
blockCount: z.ZodNumber;
|
|
28
|
+
headCount: z.ZodNumber;
|
|
29
|
+
headCountKv: z.ZodNumber;
|
|
30
|
+
keyLength: z.ZodNumber;
|
|
31
|
+
valueLength: z.ZodNumber;
|
|
32
|
+
embeddingLength: z.ZodNumber;
|
|
33
|
+
contextLength: z.ZodNumber;
|
|
34
|
+
parameterCount: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
slidingWindow: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
keyLengthSwa: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
valueLengthSwa: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
kvLayerClasses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
|
+
count: z.ZodNumber;
|
|
40
|
+
headCountKv: z.ZodNumber;
|
|
41
|
+
keyLength: z.ZodNumber;
|
|
42
|
+
valueLength: z.ZodNumber;
|
|
43
|
+
windowed: z.ZodBoolean;
|
|
44
|
+
}, z.core.$strip>>>;
|
|
45
|
+
fullAttentionInterval: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
ssmStateSize: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
ssmConvKernel: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
ssmInnerSize: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
ssmGroupCount: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
assumptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
/**
|
|
53
|
+
* Per-model data the pre-download resource estimators consume. Generated into
|
|
54
|
+
* `models/registry/resource-profiles.ts` alongside the model catalog.
|
|
55
|
+
*
|
|
56
|
+
* Profiles hold facts only — no memory numbers — so re-calibrating an estimator
|
|
57
|
+
* never requires regenerating the catalog.
|
|
58
|
+
*/
|
|
59
|
+
export declare const modelResourceProfileSchema: z.ZodObject<{
|
|
60
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
61
|
+
engine: z.ZodEnum<{
|
|
62
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
63
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
64
|
+
"bci-whispercpp-transcription": "bci-whispercpp-transcription";
|
|
65
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
66
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
67
|
+
"onnx-tts": "onnx-tts";
|
|
68
|
+
"tts-ggml": "tts-ggml";
|
|
69
|
+
"parakeet-transcription": "parakeet-transcription";
|
|
70
|
+
"ggml-ocr": "ggml-ocr";
|
|
71
|
+
"sdcpp-generation": "sdcpp-generation";
|
|
72
|
+
"audiogen-ggml": "audiogen-ggml";
|
|
73
|
+
"ggml-vla": "ggml-vla";
|
|
74
|
+
"ggml-classification": "ggml-classification";
|
|
75
|
+
"onnx-vad": "onnx-vad";
|
|
76
|
+
}>;
|
|
77
|
+
artifactBytes: z.ZodNumber;
|
|
78
|
+
ggufFacts: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
architecture: z.ZodString;
|
|
80
|
+
blockCount: z.ZodNumber;
|
|
81
|
+
headCount: z.ZodNumber;
|
|
82
|
+
headCountKv: z.ZodNumber;
|
|
83
|
+
keyLength: z.ZodNumber;
|
|
84
|
+
valueLength: z.ZodNumber;
|
|
85
|
+
embeddingLength: z.ZodNumber;
|
|
86
|
+
contextLength: z.ZodNumber;
|
|
87
|
+
parameterCount: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
slidingWindow: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
keyLengthSwa: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
valueLengthSwa: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
kvLayerClasses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
92
|
+
count: z.ZodNumber;
|
|
93
|
+
headCountKv: z.ZodNumber;
|
|
94
|
+
keyLength: z.ZodNumber;
|
|
95
|
+
valueLength: z.ZodNumber;
|
|
96
|
+
windowed: z.ZodBoolean;
|
|
97
|
+
}, z.core.$strip>>>;
|
|
98
|
+
fullAttentionInterval: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
ssmStateSize: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
ssmConvKernel: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
ssmInnerSize: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
ssmGroupCount: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
assumptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
assumptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type KvLayerClass = z.infer<typeof kvLayerClassSchema>;
|
|
108
|
+
export type GgufFacts = z.infer<typeof ggufFactsSchema>;
|
|
109
|
+
export type ModelResourceProfile = z.infer<typeof modelResourceProfileSchema>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { modelRegistryEngineSchema } from './registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* One group of transformer blocks that size their KV cache identically.
|
|
5
|
+
*
|
|
6
|
+
* Files that describe attention per layer (e.g. `gemma4`, whose
|
|
7
|
+
* `head_count_kv` and `sliding_window_pattern` hold one entry per block) are
|
|
8
|
+
* collapsed into these classes, so an estimator can sum the real cache instead
|
|
9
|
+
* of assuming every block is the widest one.
|
|
10
|
+
*/
|
|
11
|
+
export const kvLayerClassSchema = z.object({
|
|
12
|
+
count: z.number().describe('Number of blocks in this class.'),
|
|
13
|
+
headCountKv: z.number().describe('KV heads per block in this class.'),
|
|
14
|
+
keyLength: z.number().describe('Key head dimension for this class, in elements.'),
|
|
15
|
+
valueLength: z.number().describe('Value head dimension for this class, in elements.'),
|
|
16
|
+
windowed: z
|
|
17
|
+
.boolean()
|
|
18
|
+
.describe('True when these blocks use sliding-window attention, so their cache is capped at `slidingWindow` tokens rather than the full context.')
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Transformer shape facts read out of a model's GGUF key-value metadata at
|
|
22
|
+
* catalog-generation time, from what the registry captured at ingest.
|
|
23
|
+
*
|
|
24
|
+
* Absent for non-GGUF artifacts and for GGUF files whose metadata extraction
|
|
25
|
+
* failed — that absence is what makes a pre-download estimate unknown rather
|
|
26
|
+
* than wrong.
|
|
27
|
+
*/
|
|
28
|
+
export const ggufFactsSchema = z.object({
|
|
29
|
+
architecture: z.string().describe('`general.architecture`, e.g. `qwen35`, `bert`.'),
|
|
30
|
+
blockCount: z.number().describe('Number of transformer blocks (layers).'),
|
|
31
|
+
headCount: z.number().describe('Attention heads per block.'),
|
|
32
|
+
headCountKv: z
|
|
33
|
+
.number()
|
|
34
|
+
.describe('KV heads per block; the maximum when the file stores one value per layer.'),
|
|
35
|
+
keyLength: z.number().describe('Key head dimension, in elements.'),
|
|
36
|
+
valueLength: z.number().describe('Value head dimension, in elements.'),
|
|
37
|
+
embeddingLength: z.number().describe('Model embedding width, in elements.'),
|
|
38
|
+
contextLength: z.number().describe('Trained context window, in tokens.'),
|
|
39
|
+
parameterCount: z.number().optional().describe('Total parameters, when the file records it.'),
|
|
40
|
+
slidingWindow: z
|
|
41
|
+
.number()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Sliding-window size, in tokens, for sliding-window-attention models.'),
|
|
44
|
+
keyLengthSwa: z.number().optional().describe('Key head dimension on sliding-window blocks.'),
|
|
45
|
+
valueLengthSwa: z.number().optional().describe('Value head dimension on sliding-window blocks.'),
|
|
46
|
+
kvLayerClasses: z
|
|
47
|
+
.array(kvLayerClassSchema)
|
|
48
|
+
.optional()
|
|
49
|
+
.describe('Per-layer KV-cache breakdown, when the file describes attention per block. Absent means the flat fields above describe every block.'),
|
|
50
|
+
fullAttentionInterval: z
|
|
51
|
+
.number()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('For hybrid attention/recurrent models: only every Nth block holds a KV cache, the rest hold a fixed-size state.'),
|
|
54
|
+
ssmStateSize: z.number().optional().describe('SSM state size, for hybrid recurrent models.'),
|
|
55
|
+
ssmConvKernel: z.number().optional().describe('SSM convolution kernel width.'),
|
|
56
|
+
ssmInnerSize: z.number().optional().describe('SSM inner width.'),
|
|
57
|
+
ssmGroupCount: z.number().optional().describe('SSM group count.'),
|
|
58
|
+
assumptions: z
|
|
59
|
+
.array(z.string())
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('Notes on any value that was derived rather than read from the file.')
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Per-model data the pre-download resource estimators consume. Generated into
|
|
65
|
+
* `models/registry/resource-profiles.ts` alongside the model catalog.
|
|
66
|
+
*
|
|
67
|
+
* Profiles hold facts only — no memory numbers — so re-calibrating an estimator
|
|
68
|
+
* never requires regenerating the catalog.
|
|
69
|
+
*/
|
|
70
|
+
export const modelResourceProfileSchema = z.object({
|
|
71
|
+
schemaVersion: z.literal(1).describe('Bumped whenever the emitted profile shape changes.'),
|
|
72
|
+
engine: modelRegistryEngineSchema.describe('Canonical inference engine identifier.'),
|
|
73
|
+
artifactBytes: z
|
|
74
|
+
.number()
|
|
75
|
+
.describe('Total bytes that land on disk for this model: the summed shards, or every file of its companion set.'),
|
|
76
|
+
ggufFacts: ggufFactsSchema
|
|
77
|
+
.optional()
|
|
78
|
+
.describe('Absent when the model is not a GGUF or the registry has no usable metadata for it.'),
|
|
79
|
+
assumptions: z
|
|
80
|
+
.array(z.string())
|
|
81
|
+
.optional()
|
|
82
|
+
.describe('Notes on how the numbers above were derived.')
|
|
83
|
+
});
|
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { modelTypeInputSchema, normalizeModelType, isCanonicalModelType, isModelTypeAlias } from '
|
|
3
|
-
import { resolveCanonicalEngine } from '
|
|
2
|
+
import { modelTypeInputSchema, normalizeModelType, isCanonicalModelType, isModelTypeAlias } from './model-types.js';
|
|
3
|
+
import { resolveCanonicalEngine } from './engine-addon-map.js';
|
|
4
4
|
// Addon field accepts model type inputs plus "vad"
|
|
5
5
|
const addonSchema = z.union([modelTypeInputSchema, z.literal('vad')]);
|
|
6
|
+
// Shared phrasing for the accepted model-source locations, reused by every
|
|
7
|
+
// field-level `.describe()` that documents a model/asset source.
|
|
8
|
+
export const MODEL_SOURCE_URI_HINT = 'a local file path, an HTTP(S) URL, or a `registry://` / `pear://` URI';
|
|
6
9
|
export const modelDescriptorSchema = z.object({
|
|
7
|
-
src: z.string(),
|
|
8
|
-
name: z
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
src: z.string().describe(`Location of the model file: ${MODEL_SOURCE_URI_HINT}.`),
|
|
11
|
+
name: z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('Display name for this model instance; overrides the name derived from the source.'),
|
|
15
|
+
modelId: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Unique identifier used to reference the model in QVAC calls.'),
|
|
19
|
+
registryPath: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Registry-relative path to the model (set for registry-backed models).'),
|
|
23
|
+
registrySource: z.string().optional().describe('Registry source identifier, e.g. `huggingface`.'),
|
|
24
|
+
blobCoreKey: z.string().optional().describe('Hyperdrive blob core key for the model file.'),
|
|
25
|
+
blobIndex: z
|
|
26
|
+
.number()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Internal: index of this shard within its Hyperdrive blob core, for sharded models.'),
|
|
29
|
+
engine: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe('Canonical inference engine identifier, e.g. `llamacpp-completion`.'),
|
|
33
|
+
expectedSize: z.number().optional().describe('Expected total size of the model file in bytes.'),
|
|
34
|
+
sha256Checksum: z.string().optional().describe('Expected SHA-256 checksum of the model file.'),
|
|
35
|
+
addon: addonSchema
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Inference addon / capability category this model belongs to.')
|
|
18
38
|
});
|
|
19
39
|
export const modelSrcInputSchema = z.union([z.string(), modelDescriptorSchema]);
|
|
20
40
|
/**
|
package/dist/schemas/ocr.js
CHANGED
|
@@ -1,21 +1,56 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { modelSrcInputSchema } from '
|
|
2
|
+
import { modelSrcInputSchema } from './model-src-utils.js';
|
|
3
3
|
// Model config — maps to @qvac/ocr-ggml `OcrGgmlParams`. Legacy ONNX-only knobs
|
|
4
4
|
// (useGPU, timeout, pipelineMode, decodingMethod, straightenPages) are dropped;
|
|
5
5
|
// zod's default (non-strict) object strips them silently if still passed.
|
|
6
6
|
export const ocrConfigSchema = z.object({
|
|
7
|
-
langList: z
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
langList: z
|
|
8
|
+
.array(z.string())
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("Languages handled by the recognizer, e.g. `['en']` or `['en', 'fr']`. Required for `easyocr`; ignored by the language-agnostic `doctr` pipeline."),
|
|
11
|
+
pipelineType: z
|
|
12
|
+
.enum(['easyocr', 'doctr'])
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("OCR pipeline: `'easyocr'` (CRAFT detector + CRNN recognizer, default) or `'doctr'` (DBNet detector + doctr recognizer, language-agnostic)."),
|
|
15
|
+
magRatio: z
|
|
16
|
+
.number()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Detection magnification ratio (easyocr only). Default 1.5.'),
|
|
19
|
+
canvasSize: z
|
|
20
|
+
.number()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Detection canvas cap (long side, px) applied after `magRatio` scaling; lower it on memory-constrained targets. Default 2560. easyocr only.'),
|
|
23
|
+
defaultRotationAngles: z
|
|
24
|
+
.array(z.number())
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Rotation angles tried when the primary pass is low-confidence (easyocr only). Default [90, 270].'),
|
|
27
|
+
contrastRetry: z
|
|
28
|
+
.boolean()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Retry low-confidence boxes with contrast adjustment (easyocr only). Default false.'),
|
|
31
|
+
lowConfidenceThreshold: z
|
|
32
|
+
.number()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Confidence threshold below which contrast-retry kicks in (easyocr only). Default 0.4.'),
|
|
35
|
+
recognizerBatchSize: z
|
|
36
|
+
.number()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Recognizer batch size (easyocr only). Default 32.'),
|
|
39
|
+
nThreads: z
|
|
40
|
+
.number()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("GGML CPU thread count: `0` (default) auto-detects physical cores, `> 0` sets an explicit count, `< 0` leaves the backend's default unchanged."),
|
|
43
|
+
backendDevice: z
|
|
44
|
+
.enum(['cpu', 'vulkan', 'metal', 'opencl'])
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("ggml backend device: `'cpu'` (default), `'vulkan'`, `'metal'`, or `'opencl'`. Falls back to CPU when the requested GPU device is unavailable."),
|
|
47
|
+
gpuDevice: z
|
|
48
|
+
.number()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe("0-based GPU device index for `'vulkan'`/`'metal'`/`'opencl'`; when omitted, prefers a discrete GPU. Ignored for `'cpu'`."),
|
|
51
|
+
detectorModelSrc: modelSrcInputSchema
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('Text-detector model source (easyocr: CRAFT; doctr: DBNet). Derived from the recognizer model source when omitted.')
|
|
19
54
|
});
|
|
20
55
|
// Image input types
|
|
21
56
|
export const imageInputSchema = z.discriminatedUnion('type', [
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
// Import from the dependency-free module: this schema is re-exported through
|
|
3
|
+
// the Node-safe `@qvac/inference/surface`, and `@/utils/path-security` pulls in
|
|
4
|
+
// `bare-path` at runtime.
|
|
5
|
+
import { sanitizePathComponent } from '../utils/path-sanitize.js';
|
|
2
6
|
/**
|
|
3
7
|
* Zod refinement for path components that get joined to a base directory.
|
|
4
8
|
* Rejects strings containing traversal sequences (.., null bytes).
|
|
@@ -16,7 +20,9 @@ export const safePathComponent = z.string().refine((s) => {
|
|
|
16
20
|
// Reject URL-encoded traversal (%2e = ".", %2f = "/", %5c = "\")
|
|
17
21
|
if (/%2e/i.test(s))
|
|
18
22
|
return false;
|
|
19
|
-
|
|
23
|
+
// Reject components that resolve to the directory they are joined against.
|
|
24
|
+
const sanitized = sanitizePathComponent(s);
|
|
25
|
+
return sanitized.split('/').some((segment) => segment !== '' && segment !== '.');
|
|
20
26
|
}, {
|
|
21
|
-
message: "Path component must not contain traversal sequences ('..', '%2e'), null bytes, or '%00'"
|
|
27
|
+
message: "Path component must name a child path and not contain traversal sequences ('..', '%2e'), null bytes, or '%00'"
|
|
22
28
|
});
|
package/dist/schemas/plugin.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type Buffer from 'bare-buffer';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TurboVecIndexProvider } from '@qvac/rag';
|
|
4
|
+
import type { ModelSrcInput } from './model-src-utils.js';
|
|
5
|
+
import type { RuntimeContext } from './runtime-context.js';
|
|
4
6
|
/**
|
|
5
7
|
* Granularity at which the addon can cancel.
|
|
6
8
|
* - `"request"` — addon cancels a specific in-flight `requestId`.
|
|
@@ -87,6 +89,9 @@ export interface PluginLogging {
|
|
|
87
89
|
module: unknown;
|
|
88
90
|
namespace: string;
|
|
89
91
|
}
|
|
92
|
+
export interface QvacPluginCapabilities {
|
|
93
|
+
turbovecIndexProvider?: TurboVecIndexProvider;
|
|
94
|
+
}
|
|
90
95
|
/**
|
|
91
96
|
* Function to resolve a model source (URL or path) to a local file path.
|
|
92
97
|
* Passed to resolveConfig hook to allow plugins to resolve their artifacts.
|
|
@@ -101,6 +106,7 @@ export interface ResolveContext {
|
|
|
101
106
|
modelSrc: string;
|
|
102
107
|
modelType: string;
|
|
103
108
|
modelName?: string;
|
|
109
|
+
platform?: RuntimeContext['platform'];
|
|
104
110
|
}
|
|
105
111
|
/**
|
|
106
112
|
* Result from plugin resolveConfig hook.
|
|
@@ -118,6 +124,7 @@ export interface QvacPlugin<TConfig = Record<string, unknown>, TArtifactKeys ext
|
|
|
118
124
|
createModel: (params: CreateModelParams) => PluginModelResult;
|
|
119
125
|
handlers: Record<string, PluginHandlerDefinition>;
|
|
120
126
|
logging?: PluginLogging | undefined;
|
|
127
|
+
capabilities?: QvacPluginCapabilities | undefined;
|
|
121
128
|
/** When true, skips file-existence validation for modelPath. Use for plugins that derive paths from config. */
|
|
122
129
|
skipPrimaryModelPathValidation?: boolean;
|
|
123
130
|
/**
|
|
@@ -238,6 +245,12 @@ export declare const pluginDefinitionRuntimeSchema: z.ZodObject<{
|
|
|
238
245
|
module: z.ZodOptional<z.ZodUnknown>;
|
|
239
246
|
namespace: z.ZodOptional<z.ZodString>;
|
|
240
247
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
248
|
+
capabilities: z.ZodOptional<z.ZodObject<{
|
|
249
|
+
turbovecIndexProvider: z.ZodOptional<z.ZodObject<{
|
|
250
|
+
create: z.ZodCustom<Function, Function>;
|
|
251
|
+
load: z.ZodCustom<Function, Function>;
|
|
252
|
+
}, z.core.$strip>>;
|
|
253
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
241
254
|
resolveConfig: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
242
255
|
skipPrimaryModelPathValidation: z.ZodOptional<z.ZodBoolean>;
|
|
243
256
|
}, z.core.$catchall<z.ZodUnknown>>;
|
package/dist/schemas/plugin.js
CHANGED
|
@@ -119,6 +119,17 @@ export const pluginDefinitionRuntimeSchema = z
|
|
|
119
119
|
})
|
|
120
120
|
.catchall(z.unknown())
|
|
121
121
|
.optional(),
|
|
122
|
+
capabilities: z
|
|
123
|
+
.object({
|
|
124
|
+
turbovecIndexProvider: z
|
|
125
|
+
.object({
|
|
126
|
+
create: functionRuntimeSchema,
|
|
127
|
+
load: functionRuntimeSchema
|
|
128
|
+
})
|
|
129
|
+
.optional()
|
|
130
|
+
})
|
|
131
|
+
.catchall(z.unknown())
|
|
132
|
+
.optional(),
|
|
122
133
|
resolveConfig: functionRuntimeSchema.optional(),
|
|
123
134
|
skipPrimaryModelPathValidation: z.boolean().optional()
|
|
124
135
|
})
|