@qvac/sdk 0.14.1 → 0.15.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 +27 -11
- package/README.md +34 -35
- package/dist/client/api/batch-completion.d.ts +15 -0
- package/dist/client/api/batch-completion.js +332 -0
- package/dist/client/api/bci-transcribe.d.ts +1 -1
- package/dist/client/api/bci-transcribe.js +31 -31
- package/dist/client/api/cancel.d.ts +1 -1
- package/dist/client/api/cancel.js +18 -18
- package/dist/client/api/classify.d.ts +1 -1
- package/dist/client/api/classify.js +9 -6
- package/dist/client/api/client-request-id.js +1 -1
- package/dist/client/api/completion-stream.d.ts +3 -3
- package/dist/client/api/completion-stream.js +18 -18
- package/dist/client/api/delete-cache.js +9 -9
- package/dist/client/api/diffusion.d.ts +1 -1
- package/dist/client/api/diffusion.js +17 -11
- package/dist/client/api/download-asset.d.ts +1 -1
- package/dist/client/api/download-asset.js +11 -11
- package/dist/client/api/embed.d.ts +1 -1
- package/dist/client/api/embed.js +10 -10
- package/dist/client/api/finetune.d.ts +1 -1
- package/dist/client/api/finetune.js +25 -27
- package/dist/client/api/get-loaded-model-info.d.ts +2 -2
- package/dist/client/api/get-loaded-model-info.js +8 -8
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/get-model-info.js +7 -7
- package/dist/client/api/heartbeat.d.ts +2 -2
- package/dist/client/api/heartbeat.js +7 -7
- package/dist/client/api/index.d.ts +33 -32
- package/dist/client/api/index.js +33 -32
- package/dist/client/api/invoke-plugin.d.ts +1 -1
- package/dist/client/api/invoke-plugin.js +10 -10
- package/dist/client/api/load-model.d.ts +1 -1
- package/dist/client/api/load-model.js +32 -32
- package/dist/client/api/logging-stream.d.ts +1 -1
- package/dist/client/api/logging-stream.js +6 -6
- package/dist/client/api/ocr.d.ts +1 -1
- package/dist/client/api/ocr.js +11 -11
- package/dist/client/api/provide.d.ts +1 -1
- package/dist/client/api/provide.js +7 -7
- package/dist/client/api/rag.d.ts +1 -1
- package/dist/client/api/rag.js +65 -66
- package/dist/client/api/registry.d.ts +1 -1
- package/dist/client/api/registry.js +8 -8
- package/dist/client/api/resume.js +5 -5
- package/dist/client/api/state.d.ts +1 -1
- package/dist/client/api/state.js +5 -5
- package/dist/client/api/stop-provider.js +6 -6
- package/dist/client/api/subscribe-logs.d.ts +1 -1
- package/dist/client/api/subscribe-logs.js +3 -3
- package/dist/client/api/suspend.js +5 -5
- package/dist/client/api/text-to-speech.d.ts +1 -1
- package/dist/client/api/text-to-speech.js +37 -39
- package/dist/client/api/transcribe.d.ts +2 -2
- package/dist/client/api/transcribe.js +44 -45
- package/dist/client/api/translate.d.ts +1 -1
- package/dist/client/api/translate.js +14 -14
- package/dist/client/api/unload-model.d.ts +1 -1
- package/dist/client/api/unload-model.js +11 -11
- package/dist/client/api/upscale.d.ts +1 -1
- package/dist/client/api/upscale.js +9 -9
- package/dist/client/api/video.d.ts +1 -1
- package/dist/client/api/video.js +16 -14
- package/dist/client/api/vla-helpers.d.ts +2 -2
- package/dist/client/api/vla-helpers.js +6 -11
- package/dist/client/api/vla.d.ts +1 -1
- package/dist/client/api/vla.js +13 -13
- package/dist/client/config-loader/config-utils.d.ts +1 -1
- package/dist/client/config-loader/config-utils.js +3 -3
- package/dist/client/config-loader/resolve-config.bare.d.ts +1 -1
- package/dist/client/config-loader/resolve-config.bare.js +11 -11
- package/dist/client/config-loader/resolve-config.expo.d.ts +1 -1
- package/dist/client/config-loader/resolve-config.expo.js +6 -6
- package/dist/client/config-loader/resolve-config.node.d.ts +1 -1
- package/dist/client/config-loader/resolve-config.node.js +27 -27
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/init-hooks.d.ts +1 -1
- package/dist/client/init-hooks.js +12 -12
- package/dist/client/logging-stream-registry.d.ts +1 -1
- package/dist/client/logging-stream-registry.js +6 -6
- package/dist/client/parse-input.d.ts +1 -1
- package/dist/client/parse-input.js +3 -3
- package/dist/client/plugins-factory.d.ts +2 -2
- package/dist/client/plugins-factory.js +2 -2
- package/dist/client/rpc/bare-client.d.ts +2 -1
- package/dist/client/rpc/bare-client.js +37 -39
- package/dist/client/rpc/ensure-worker-ready.js +4 -4
- package/dist/client/rpc/expo-device-info.d.ts +1 -1
- package/dist/client/rpc/expo-device-info.js +11 -11
- package/dist/client/rpc/expo-rpc-client.d.ts +2 -1
- package/dist/client/rpc/expo-rpc-client.js +38 -47
- package/dist/client/rpc/node-rpc-client.d.ts +2 -1
- package/dist/client/rpc/node-rpc-client.js +103 -75
- package/dist/client/rpc/profiling/index.d.ts +1 -1
- package/dist/client/rpc/profiling/index.js +1 -1
- package/dist/client/rpc/profiling/profiler.d.ts +2 -2
- package/dist/client/rpc/profiling/profiler.js +31 -34
- package/dist/client/rpc/rpc-client.d.ts +2 -2
- package/dist/client/rpc/rpc-client.js +113 -72
- package/dist/client/rpc/rpc-error.d.ts +1 -1
- package/dist/client/rpc/rpc-error.js +14 -14
- package/dist/commands/bundle/bare-pack.d.ts +1 -1
- package/dist/commands/bundle/bare-pack.js +20 -20
- package/dist/commands/bundle/constants.js +21 -21
- package/dist/commands/bundle/entry-gen.js +4 -4
- package/dist/commands/bundle/index.js +45 -47
- package/dist/commands/bundle/manifest.d.ts +1 -1
- package/dist/commands/bundle/manifest.js +44 -46
- package/dist/commands/bundle/plugins.d.ts +2 -2
- package/dist/commands/bundle/plugins.js +7 -7
- package/dist/commands/bundle/resolve-sdk-import.js +6 -13
- package/dist/commands/index.d.ts +4 -4
- package/dist/commands/index.js +2 -2
- package/dist/commands/verify/abi.d.ts +9 -9
- package/dist/commands/verify/abi.js +31 -31
- package/dist/commands/verify/addon-source.d.ts +1 -1
- package/dist/commands/verify/addon-source.js +13 -14
- package/dist/commands/verify/bundle-source.d.ts +1 -1
- package/dist/commands/verify/bundle-source.js +7 -7
- package/dist/commands/verify/index.d.ts +3 -3
- package/dist/commands/verify/index.js +18 -17
- package/dist/commands/verify/node-modules-source.d.ts +1 -1
- package/dist/commands/verify/node-modules-source.js +11 -11
- package/dist/commands/verify/prebuilds.d.ts +3 -3
- package/dist/commands/verify/prebuilds.js +8 -8
- package/dist/constants/audio.d.ts +1 -1
- package/dist/constants/audio.js +1 -1
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +2 -2
- package/dist/constants/registry.js +1 -1
- package/dist/examples/audio/mic-input.d.ts +1 -1
- package/dist/examples/audio/mic-input.js +31 -31
- package/dist/examples/batch-completion.d.ts +38 -0
- package/dist/examples/batch-completion.js +100 -0
- package/dist/examples/bci/bci-filesystem-streaming.js +20 -20
- package/dist/examples/bci/bci-filesystem.js +17 -17
- package/dist/examples/cache-management.js +32 -32
- package/dist/examples/cancel-by-request-id.js +11 -11
- package/dist/examples/classification/classify-image.js +5 -5
- package/dist/examples/completion-events.js +16 -18
- package/dist/examples/completion-stop-reason.js +13 -13
- package/dist/examples/concurrent-completion-collision.js +20 -20
- package/dist/examples/config/blind-relay/blind-relay.config.js +4 -4
- package/dist/examples/config/default/default.config.js +2 -2
- package/dist/examples/config/plugins/plugins.config.js +2 -2
- package/dist/examples/config-reload.js +14 -14
- package/dist/examples/default-config-usage.js +10 -13
- package/dist/examples/delegated-inference/composite.js +23 -23
- package/dist/examples/delegated-inference/consumer-profiled.js +19 -19
- package/dist/examples/delegated-inference/consumer.js +11 -11
- package/dist/examples/delegated-inference/provider.js +24 -24
- package/dist/examples/diffusion-esrgan-upscale.js +19 -19
- package/dist/examples/diffusion-flux2-klein-img2img.js +17 -17
- package/dist/examples/diffusion-flux2-klein.js +14 -14
- package/dist/examples/diffusion-img2img.js +13 -13
- package/dist/examples/diffusion-img2vid.js +22 -23
- package/dist/examples/diffusion-simple.js +7 -7
- package/dist/examples/diffusion-txt2img.js +13 -14
- package/dist/examples/diffusion-txt2vid.js +18 -18
- package/dist/examples/download-with-blind-relays.js +7 -8
- package/dist/examples/download-with-cancel.js +9 -9
- package/dist/examples/embed-multi-gpu.js +9 -9
- package/dist/examples/embed-p2p.js +24 -24
- package/dist/examples/finetune/llamacpp-finetune.js +21 -21
- package/dist/examples/kv-cache-cleanup.js +34 -34
- package/dist/examples/kv-cache-custom-key.js +30 -30
- package/dist/examples/kv-cache-example.js +18 -20
- package/dist/examples/llamacpp-cache.js +33 -33
- package/dist/examples/llamacpp-dynamic-tools.js +38 -38
- package/dist/examples/llamacpp-filesystem.js +13 -15
- package/dist/examples/llamacpp-http.js +12 -14
- package/dist/examples/llamacpp-multi-gpu.js +12 -12
- package/dist/examples/llamacpp-multimodal.js +16 -16
- package/dist/examples/llamacpp-p2p.js +11 -11
- package/dist/examples/llamacpp-sharded.js +12 -12
- package/dist/examples/llamacpp-structured-output.js +37 -37
- package/dist/examples/logging-file-transport.js +19 -21
- package/dist/examples/logging-global.js +8 -8
- package/dist/examples/logging-streaming.js +16 -18
- package/dist/examples/mcp-websearch.js +44 -44
- package/dist/examples/multi-model-demo.js +33 -33
- package/dist/examples/ocr-fasttext.js +17 -17
- package/dist/examples/parallel-download.js +11 -13
- package/dist/examples/plugins.js +43 -43
- package/dist/examples/profiling/basic.js +34 -36
- package/dist/examples/profiling/per-call.js +16 -16
- package/dist/examples/quickstart.bare.js +4 -6
- package/dist/examples/quickstart.js +7 -7
- package/dist/examples/rag/rag-chromadb.js +26 -26
- package/dist/examples/rag/rag-hyperdb/cancellation.js +19 -20
- package/dist/examples/rag/rag-hyperdb/ingest.js +19 -19
- package/dist/examples/rag/rag-hyperdb/pipeline.js +26 -26
- package/dist/examples/rag/rag-hyperdb/workspaces.js +46 -46
- package/dist/examples/rag/rag-lancedb.js +29 -32
- package/dist/examples/rag/rag-sqlite.js +25 -25
- package/dist/examples/registry-query.js +15 -15
- package/dist/examples/seed-p2p.js +8 -8
- package/dist/examples/suspend-resume.js +20 -20
- package/dist/examples/tools/llamacpp-native-tools.js +25 -25
- package/dist/examples/tools/llamacpp-tools-gemma4.js +14 -14
- package/dist/examples/tools/llamacpp-tools-harmony-multiturn.js +15 -15
- package/dist/examples/tools/llamacpp-tools-pythonic.js +15 -15
- package/dist/examples/tools/llamacpp-tools-qwen35.js +14 -14
- package/dist/examples/tools/shared.d.ts +2 -2
- package/dist/examples/tools/shared.js +17 -17
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +12 -12
- package/dist/examples/transcription/parakeet-microphone-record.js +19 -19
- package/dist/examples/transcription/parakeet-microphone-stream.js +23 -23
- package/dist/examples/transcription/parakeet-sortformer-streaming.js +18 -28
- package/dist/examples/transcription/parakeet-sortformer.js +21 -21
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +13 -13
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +34 -34
- package/dist/examples/transcription/whispercpp-filesystem.js +19 -19
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +27 -27
- package/dist/examples/transcription/whispercpp-microphone-record.js +21 -21
- package/dist/examples/transcription/whispercpp-prompt.js +18 -18
- package/dist/examples/translation/translation-bergamot-batch.js +17 -17
- package/dist/examples/translation/translation-bergamot-pivot.js +16 -16
- package/dist/examples/translation/translation-bergamot.js +11 -11
- package/dist/examples/translation/translation-indic.js +10 -10
- package/dist/examples/translation/translation-llm-afriquegemma.js +10 -10
- package/dist/examples/translation/translation-llm-context.js +10 -10
- package/dist/examples/translation/translation-llm.js +13 -13
- package/dist/examples/translation/translation-stream.js +11 -11
- package/dist/examples/tts/chatterbox-enhanced.d.ts +2 -0
- package/dist/examples/tts/chatterbox-enhanced.js +55 -0
- package/dist/examples/tts/chatterbox-multilingual.d.ts +2 -0
- package/dist/examples/tts/chatterbox-multilingual.js +54 -0
- package/dist/examples/tts/chatterbox.js +18 -18
- package/dist/examples/tts/llm-to-tts-streaming.js +30 -30
- package/dist/examples/tts/supertonic-enhanced.d.ts +2 -0
- package/dist/examples/tts/supertonic-enhanced.js +57 -0
- package/dist/examples/tts/supertonic-multilingual.js +19 -19
- package/dist/examples/tts/supertonic.js +18 -18
- package/dist/examples/tts/utils.js +24 -32
- package/dist/examples/vla-pi05.js +14 -14
- package/dist/examples/vla-smolvla.js +14 -14
- package/dist/examples/voice-assistant/voice-assistant.js +46 -46
- package/dist/expo/plugins/find-in-ancestor-node-modules.js +3 -3
- package/dist/expo/plugins/get-project-root.d.ts +2 -2
- package/dist/expo/plugins/get-project-root.js +1 -1
- package/dist/expo/plugins/index.d.ts +11 -11
- package/dist/expo/plugins/index.js +10 -10
- package/dist/expo/plugins/resolve-sdk-package-dir.js +7 -11
- package/dist/expo/plugins/withAndroidArchitecture.d.ts +1 -1
- package/dist/expo/plugins/withAndroidArchitecture.js +12 -12
- package/dist/expo/plugins/withAndroidNdkVersion.d.ts +1 -1
- package/dist/expo/plugins/withAndroidNdkVersion.js +9 -9
- package/dist/expo/plugins/withDeviceInfo.d.ts +1 -1
- package/dist/expo/plugins/withDeviceInfo.js +13 -13
- package/dist/expo/plugins/withMobileBundle.d.ts +1 -1
- package/dist/expo/plugins/withMobileBundle.js +34 -42
- package/dist/expo/plugins/withOpenCL.d.ts +1 -1
- package/dist/expo/plugins/withOpenCL.js +14 -16
- package/dist/expo/plugins/withQvacSDK.d.ts +1 -1
- package/dist/expo/plugins/withQvacSDK.js +12 -12
- package/dist/index.d.ts +16 -16
- package/dist/index.js +16 -17
- package/dist/logging/addon.d.ts +1 -1
- package/dist/logging/addon.js +13 -13
- package/dist/logging/base-logger.d.ts +2 -2
- package/dist/logging/base-logger.js +6 -6
- package/dist/logging/client-logger.d.ts +1 -1
- package/dist/logging/client-logger.js +3 -3
- package/dist/logging/index.d.ts +9 -9
- package/dist/logging/index.js +8 -8
- package/dist/logging/logger.d.ts +1 -1
- package/dist/logging/logger.js +4 -4
- package/dist/logging/namespaces.d.ts +1 -1
- package/dist/logging/namespaces.js +5 -5
- package/dist/logging/registry.d.ts +2 -2
- package/dist/logging/registry.js +3 -3
- package/dist/logging/server-logger.d.ts +1 -1
- package/dist/logging/server-logger.js +2 -2
- package/dist/logging/stream-logger.d.ts +1 -1
- package/dist/logging/stream-logger.js +4 -4
- package/dist/logging/transport.d.ts +1 -1
- package/dist/logging/types.d.ts +1 -1
- package/dist/logging/utils.d.ts +2 -2
- package/dist/logging/utils.js +40 -41
- package/dist/models/registry/index.d.ts +1 -1
- package/dist/models/registry/index.js +5 -5
- package/dist/models/registry/models.d.ts +429 -122
- package/dist/models/registry/models.js +13693 -13369
- package/dist/models/update-models/codegen.d.ts +1 -1
- package/dist/models/update-models/codegen.js +8 -8
- package/dist/models/update-models/companions.d.ts +6 -1
- package/dist/models/update-models/companions.js +104 -39
- package/dist/models/update-models/history.d.ts +1 -1
- package/dist/models/update-models/history.js +11 -11
- package/dist/models/update-models/index.js +32 -34
- package/dist/models/update-models/naming.d.ts +2 -2
- package/dist/models/update-models/naming.js +177 -186
- package/dist/models/update-models/processing.d.ts +2 -2
- package/dist/models/update-models/processing.js +17 -19
- package/dist/models/update-models/registry.d.ts +2 -2
- package/dist/models/update-models/registry.js +9 -9
- package/dist/models/update-models/shards.d.ts +1 -1
- package/dist/models/update-models/shards.js +3 -3
- package/dist/models/update-models/types.d.ts +1 -1
- package/dist/models/update-models/utils.js +5 -5
- package/dist/pear/pre.js +84 -84
- package/dist/profiling/aggregator.d.ts +1 -1
- package/dist/profiling/aggregator.js +6 -6
- package/dist/profiling/clock.d.ts +1 -1
- package/dist/profiling/clock.js +10 -10
- package/dist/profiling/controller.d.ts +2 -2
- package/dist/profiling/controller.js +11 -12
- package/dist/profiling/envelope.d.ts +1 -1
- package/dist/profiling/envelope.js +4 -6
- package/dist/profiling/events.d.ts +2 -2
- package/dist/profiling/events.js +8 -10
- package/dist/profiling/exporters.d.ts +1 -1
- package/dist/profiling/exporters.js +81 -79
- package/dist/profiling/index.d.ts +8 -8
- package/dist/profiling/index.js +7 -7
- package/dist/profiling/model-execution.js +2 -1
- package/dist/profiling/ring-buffer.js +2 -2
- package/dist/profiling/types.d.ts +3 -3
- package/dist/schemas/archive.d.ts +1 -1
- package/dist/schemas/archive.js +8 -14
- package/dist/schemas/batch-completion-stream.d.ts +463 -0
- package/dist/schemas/batch-completion-stream.js +124 -0
- package/dist/schemas/bci-config.d.ts +1 -1
- package/dist/schemas/bci-config.js +7 -7
- package/dist/schemas/bci.d.ts +3 -3
- package/dist/schemas/bci.js +25 -31
- package/dist/schemas/cancel.d.ts +6 -1
- package/dist/schemas/cancel.js +33 -34
- package/dist/schemas/classification.d.ts +1 -1
- package/dist/schemas/classification.js +7 -7
- package/dist/schemas/common.d.ts +194 -25
- package/dist/schemas/common.js +40 -37
- package/dist/schemas/completion-event.d.ts +11 -8
- package/dist/schemas/completion-event.js +27 -26
- package/dist/schemas/completion-stream.d.ts +4 -3
- package/dist/schemas/completion-stream.js +51 -67
- package/dist/schemas/delegate.d.ts +1 -1
- package/dist/schemas/delegate.js +7 -7
- package/dist/schemas/delete-cache.d.ts +1 -1
- package/dist/schemas/delete-cache.js +8 -8
- package/dist/schemas/download-asset.d.ts +2 -2
- package/dist/schemas/download-asset.js +21 -21
- package/dist/schemas/embed.d.ts +3 -3
- package/dist/schemas/embed.js +16 -27
- package/dist/schemas/engine-addon-map.d.ts +2 -2
- package/dist/schemas/engine-addon-map.js +24 -24
- package/dist/schemas/error.d.ts +1 -1
- package/dist/schemas/error.js +12 -13
- package/dist/schemas/finetune.d.ts +1 -1
- package/dist/schemas/finetune.js +35 -41
- package/dist/schemas/get-loaded-model-info.d.ts +1 -1
- package/dist/schemas/get-loaded-model-info.js +10 -10
- package/dist/schemas/get-model-info.d.ts +1 -1
- package/dist/schemas/get-model-info.js +48 -91
- package/dist/schemas/heartbeat.d.ts +1 -1
- package/dist/schemas/heartbeat.js +6 -6
- package/dist/schemas/index.d.ts +52 -51
- package/dist/schemas/index.js +52 -51
- package/dist/schemas/json-schema.d.ts +1 -1
- package/dist/schemas/llamacpp-config.d.ts +33 -25
- package/dist/schemas/llamacpp-config.js +43 -30
- package/dist/schemas/load-model.d.ts +160 -128
- package/dist/schemas/load-model.js +120 -126
- package/dist/schemas/logging-stream.d.ts +1 -1
- package/dist/schemas/logging-stream.js +6 -12
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-src-utils.d.ts +1 -1
- package/dist/schemas/model-src-utils.js +13 -13
- package/dist/schemas/model-types.d.ts +1 -1
- package/dist/schemas/model-types.js +27 -27
- package/dist/schemas/ocr.d.ts +1 -1
- package/dist/schemas/ocr.js +18 -18
- package/dist/schemas/path-validation.d.ts +1 -1
- package/dist/schemas/path-validation.js +4 -4
- package/dist/schemas/plugin.d.ts +9 -10
- package/dist/schemas/plugin.js +47 -47
- package/dist/schemas/profiling.d.ts +1 -1
- package/dist/schemas/profiling.js +16 -16
- package/dist/schemas/provide.d.ts +1 -1
- package/dist/schemas/provide.js +8 -8
- package/dist/schemas/rag.d.ts +3 -3
- package/dist/schemas/rag.js +65 -70
- package/dist/schemas/registry.d.ts +1 -1
- package/dist/schemas/registry.js +44 -66
- package/dist/schemas/reload-config.d.ts +1 -1
- package/dist/schemas/reload-config.js +14 -18
- package/dist/schemas/resume.d.ts +1 -1
- package/dist/schemas/resume.js +3 -3
- package/dist/schemas/runtime-context.d.ts +1 -1
- package/dist/schemas/runtime-context.js +4 -4
- package/dist/schemas/sdcpp-config.d.ts +9 -9
- package/dist/schemas/sdcpp-config.js +298 -300
- package/dist/schemas/sdk-config.d.ts +55 -43
- package/dist/schemas/sdk-config.js +25 -29
- package/dist/schemas/sdk-errors-client.d.ts +1 -1
- package/dist/schemas/sdk-errors-client.js +80 -80
- package/dist/schemas/sdk-errors-registry.js +1 -1
- package/dist/schemas/sdk-errors-server.d.ts +1 -1
- package/dist/schemas/sdk-errors-server.js +200 -199
- package/dist/schemas/shard.d.ts +1 -1
- package/dist/schemas/shard.js +4 -4
- package/dist/schemas/state.d.ts +1 -1
- package/dist/schemas/state.js +5 -10
- package/dist/schemas/stop-provide.d.ts +1 -1
- package/dist/schemas/stop-provide.js +4 -4
- package/dist/schemas/suspend.d.ts +1 -1
- package/dist/schemas/suspend.js +3 -3
- package/dist/schemas/text-to-speech.d.ts +455 -3
- package/dist/schemas/text-to-speech.js +146 -110
- package/dist/schemas/tools.d.ts +1 -1
- package/dist/schemas/tools.js +17 -24
- package/dist/schemas/transcription-config.d.ts +1 -1
- package/dist/schemas/transcription-config.js +18 -18
- package/dist/schemas/transcription.d.ts +5 -5
- package/dist/schemas/transcription.js +31 -33
- package/dist/schemas/translate.d.ts +3 -3
- package/dist/schemas/translate.js +38 -67
- package/dist/schemas/translation-config.d.ts +1 -1
- package/dist/schemas/translation-config.js +116 -123
- package/dist/schemas/unload-model.d.ts +1 -1
- package/dist/schemas/unload-model.js +6 -6
- package/dist/schemas/vla.d.ts +1 -1
- package/dist/schemas/vla.js +30 -30
- package/dist/scripts/run-security-tests.js +9 -10
- package/dist/scripts/run-unit-tests.js +11 -12
- package/dist/server/bare/delegate-connect-diagnostics.js +13 -19
- package/dist/server/bare/delegate-rpc-client.d.ts +2 -2
- package/dist/server/bare/delegate-rpc-client.js +32 -34
- package/dist/server/bare/hyperswarm.d.ts +3 -3
- package/dist/server/bare/hyperswarm.js +14 -14
- package/dist/server/bare/ops/bci-transcribe.d.ts +1 -1
- package/dist/server/bare/ops/bci-transcribe.js +44 -44
- package/dist/server/bare/ops/cancel.d.ts +2 -2
- package/dist/server/bare/ops/cancel.js +6 -6
- package/dist/server/bare/ops/embed.d.ts +1 -1
- package/dist/server/bare/ops/embed.js +26 -16
- package/dist/server/bare/ops/kv-cache-utils.d.ts +1 -1
- package/dist/server/bare/ops/kv-cache-utils.js +17 -19
- package/dist/server/bare/ops/load-model.d.ts +2 -2
- package/dist/server/bare/ops/load-model.js +14 -18
- package/dist/server/bare/ops/transcribe.d.ts +3 -3
- package/dist/server/bare/ops/transcribe.js +62 -62
- package/dist/server/bare/ops/translate.d.ts +1 -1
- package/dist/server/bare/ops/translate.js +39 -30
- package/dist/server/bare/ops/unload-model.d.ts +1 -1
- package/dist/server/bare/ops/unload-model.js +12 -12
- package/dist/server/bare/plugins/bci-whispercpp-transcription/args.d.ts +2 -2
- package/dist/server/bare/plugins/bci-whispercpp-transcription/args.js +3 -3
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.d.ts +2 -2
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.js +33 -33
- package/dist/server/bare/plugins/bci-whispercpp-transcription/resolve-config.d.ts +1 -1
- package/dist/server/bare/plugins/bci-whispercpp-transcription/resolve-config.js +1 -1
- package/dist/server/bare/plugins/ggml-classification/ops/classify.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-classification/ops/classify.js +8 -8
- package/dist/server/bare/plugins/ggml-classification/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-classification/plugin.js +14 -14
- package/dist/server/bare/plugins/ggml-ocr/ops/ocr-stream.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-ocr/ops/ocr-stream.js +27 -26
- package/dist/server/bare/plugins/ggml-ocr/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-ocr/plugin.js +38 -38
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.js +3 -3
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +23 -23
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-vla/plugin.js +15 -15
- package/dist/server/bare/plugins/index.d.ts +11 -11
- package/dist/server/bare/plugins/index.js +11 -11
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-cancelled.d.ts +23 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-cancelled.js +30 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-completion-stream.d.ts +32 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-completion-stream.js +99 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.d.ts +1 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +8 -8
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.d.ts +3 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.js +4 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +22 -4
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +55 -59
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.js +5 -5
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.d.ts +2 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +34 -34
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.d.ts +7 -7
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.js +19 -23
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +4 -6
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +186 -17
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +235 -70
- package/dist/server/bare/plugins/llamacpp-completion/transform.d.ts +1 -1
- package/dist/server/bare/plugins/llamacpp-completion/transform.js +15 -15
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +3 -3
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +27 -29
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +38 -39
- package/dist/server/bare/plugins/nmtcpp-translation/resolve-vocab.d.ts +1 -1
- package/dist/server/bare/plugins/nmtcpp-translation/resolve-vocab.js +19 -22
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +36 -36
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.d.ts +1 -1
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +15 -17
- package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.d.ts +1 -1
- package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.js +11 -11
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.d.ts +1 -1
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +42 -44
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +4 -4
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +69 -63
- package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech-stream.d.ts +2 -2
- package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech-stream.js +19 -21
- package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech.d.ts +2 -2
- package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech.js +22 -24
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +3 -2
- package/dist/server/bare/plugins/tts-ggml/plugin.js +95 -49
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +52 -52
- package/dist/server/bare/rag-hyperdb/handlers/chunk.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/chunk.js +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.js +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.js +4 -4
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.js +3 -3
- package/dist/server/bare/rag-hyperdb/handlers/ingest.d.ts +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/ingest.js +4 -4
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.js +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/reindex.d.ts +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/reindex.js +5 -5
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.d.ts +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.js +3 -3
- package/dist/server/bare/rag-hyperdb/handlers/search.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/search.js +3 -3
- package/dist/server/bare/rag-hyperdb/index.d.ts +11 -11
- package/dist/server/bare/rag-hyperdb/index.js +11 -11
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +3 -3
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +20 -20
- package/dist/server/bare/registry/config-registry.d.ts +1 -1
- package/dist/server/bare/registry/config-registry.js +13 -16
- package/dist/server/bare/registry/logging-stream-registry.d.ts +1 -1
- package/dist/server/bare/registry/logging-stream-registry.js +2 -2
- package/dist/server/bare/registry/model-config-registry.d.ts +2 -2
- package/dist/server/bare/registry/model-config-registry.js +6 -6
- package/dist/server/bare/registry/model-config-utils.d.ts +2 -2
- package/dist/server/bare/registry/model-config-utils.js +35 -35
- package/dist/server/bare/registry/model-registry.d.ts +3 -3
- package/dist/server/bare/registry/model-registry.js +11 -11
- package/dist/server/bare/registry/registry-client.d.ts +1 -1
- package/dist/server/bare/registry/registry-client.js +18 -18
- package/dist/server/bare/registry/runtime-context-registry.d.ts +1 -1
- package/dist/server/bare/registry/runtime-context-registry.js +3 -3
- package/dist/server/bare/runtime/disposable-scope.js +3 -3
- package/dist/server/bare/runtime/index.d.ts +7 -7
- package/dist/server/bare/runtime/index.js +3 -3
- package/dist/server/bare/runtime/request-context.d.ts +4 -4
- package/dist/server/bare/runtime/request-id.js +1 -1
- package/dist/server/bare/runtime/request-registry-singleton.d.ts +1 -1
- package/dist/server/bare/runtime/request-registry-singleton.js +23 -4
- package/dist/server/bare/runtime/request-registry.d.ts +27 -12
- package/dist/server/bare/runtime/request-registry.js +39 -34
- package/dist/server/bare/runtime/with-request-context.d.ts +1 -1
- package/dist/server/bare/runtime/with-request-context.js +11 -11
- package/dist/server/bare/runtime-lifecycle.d.ts +1 -1
- package/dist/server/bare/runtime-lifecycle.js +27 -31
- package/dist/server/bare/types/addon-responses.d.ts +5 -4
- package/dist/server/bare/utils/audio-input.d.ts +2 -2
- package/dist/server/bare/utils/audio-input.js +7 -7
- package/dist/server/bare/utils/transcribe-metadata.d.ts +1 -1
- package/dist/server/bare/utils/transcribe-metadata.js +4 -4
- package/dist/server/bare/utils/tts-stats.d.ts +1 -1
- package/dist/server/bare/utils/tts-stats.js +3 -3
- package/dist/server/env.js +8 -8
- package/dist/server/error-handlers.d.ts +3 -3
- package/dist/server/error-handlers.js +11 -11
- package/dist/server/plugins/index.d.ts +1 -1
- package/dist/server/plugins/index.js +1 -1
- package/dist/server/plugins/registry.d.ts +1 -1
- package/dist/server/plugins/registry.js +12 -14
- package/dist/server/rpc/create-server.d.ts +1 -1
- package/dist/server/rpc/create-server.js +11 -12
- package/dist/server/rpc/delegate-transport.d.ts +3 -3
- package/dist/server/rpc/delegate-transport.js +43 -44
- package/dist/server/rpc/handle-request.d.ts +1 -1
- package/dist/server/rpc/handle-request.js +28 -30
- package/dist/server/rpc/handler-registry.d.ts +1 -1
- package/dist/server/rpc/handler-registry.js +97 -92
- package/dist/server/rpc/handler-selection.d.ts +3 -3
- package/dist/server/rpc/handler-selection.js +3 -3
- package/dist/server/rpc/handler-utils.d.ts +7 -7
- package/dist/server/rpc/handler-utils.js +32 -35
- package/dist/server/rpc/handlers/batch-completion-stream.d.ts +78 -0
- package/dist/server/rpc/handlers/batch-completion-stream.js +4 -0
- package/dist/server/rpc/handlers/bci-transcribe-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/bci-transcribe-stream.js +2 -2
- package/dist/server/rpc/handlers/bci-transcribe.d.ts +1 -1
- package/dist/server/rpc/handlers/bci-transcribe.js +2 -2
- package/dist/server/rpc/handlers/cancel-delegated.d.ts +2 -2
- package/dist/server/rpc/handlers/cancel-delegated.js +13 -13
- package/dist/server/rpc/handlers/cancelHandler.d.ts +1 -1
- package/dist/server/rpc/handlers/cancelHandler.js +11 -11
- package/dist/server/rpc/handlers/classify.d.ts +1 -1
- package/dist/server/rpc/handlers/classify.js +2 -2
- package/dist/server/rpc/handlers/completion-stream-delegated.d.ts +2 -2
- package/dist/server/rpc/handlers/completion-stream-delegated.js +14 -14
- package/dist/server/rpc/handlers/completion-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/completion-stream.js +2 -2
- package/dist/server/rpc/handlers/delete-cache.d.ts +1 -1
- package/dist/server/rpc/handlers/delete-cache.js +10 -10
- package/dist/server/rpc/handlers/diffusion-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/diffusion-stream.js +2 -2
- package/dist/server/rpc/handlers/download-asset.d.ts +1 -1
- package/dist/server/rpc/handlers/download-asset.js +20 -20
- package/dist/server/rpc/handlers/embed.d.ts +1 -1
- package/dist/server/rpc/handlers/embed.js +2 -2
- package/dist/server/rpc/handlers/finetune.d.ts +1 -1
- package/dist/server/rpc/handlers/finetune.js +8 -6
- package/dist/server/rpc/handlers/get-loaded-model-info.d.ts +1 -1
- package/dist/server/rpc/handlers/get-loaded-model-info.js +9 -9
- package/dist/server/rpc/handlers/get-model-info.d.ts +1 -1
- package/dist/server/rpc/handlers/get-model-info.js +20 -20
- package/dist/server/rpc/handlers/heartbeat-delegated.d.ts +2 -2
- package/dist/server/rpc/handlers/heartbeat-delegated.js +7 -7
- package/dist/server/rpc/handlers/heartbeat.d.ts +1 -1
- package/dist/server/rpc/handlers/heartbeat.js +1 -1
- package/dist/server/rpc/handlers/index.d.ts +33 -31
- package/dist/server/rpc/handlers/index.js +34 -32
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +4 -4
- package/dist/server/rpc/handlers/load-model/download-manager.js +19 -17
- package/dist/server/rpc/handlers/load-model/download-stats.d.ts +4 -3
- package/dist/server/rpc/handlers/load-model/download-stats.js +9 -11
- package/dist/server/rpc/handlers/load-model/handler.d.ts +1 -1
- package/dist/server/rpc/handlers/load-model/handler.js +42 -43
- package/dist/server/rpc/handlers/load-model/http.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/http.js +100 -107
- package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +72 -74
- package/dist/server/rpc/handlers/load-model/index.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/index.js +2 -2
- package/dist/server/rpc/handlers/load-model/registry-client-options.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/registry-client-options.js +2 -3
- package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +5 -5
- package/dist/server/rpc/handlers/load-model/registry-companion-set.js +19 -21
- package/dist/server/rpc/handlers/load-model/registry-download-utils.d.ts +6 -6
- package/dist/server/rpc/handlers/load-model/registry-download-utils.js +16 -18
- package/dist/server/rpc/handlers/load-model/registry-metadata.d.ts +11 -0
- package/dist/server/rpc/handlers/load-model/registry-metadata.js +23 -0
- package/dist/server/rpc/handlers/load-model/registry.d.ts +4 -3
- package/dist/server/rpc/handlers/load-model/registry.js +50 -56
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/resolve-session.js +7 -7
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/resolve.js +36 -35
- package/dist/server/rpc/handlers/load-model/types.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/types.js +7 -7
- package/dist/server/rpc/handlers/load-model-delegated.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model-delegated.js +31 -30
- package/dist/server/rpc/handlers/logging-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/logging-stream.js +3 -3
- package/dist/server/rpc/handlers/ocr-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/ocr-stream.js +2 -2
- package/dist/server/rpc/handlers/plugin-dispatch.js +9 -9
- package/dist/server/rpc/handlers/plugin-invoke.d.ts +1 -1
- package/dist/server/rpc/handlers/plugin-invoke.js +16 -16
- package/dist/server/rpc/handlers/provideHandler/connection.d.ts +1 -1
- package/dist/server/rpc/handlers/provideHandler/connection.js +16 -16
- package/dist/server/rpc/handlers/provideHandler/handler.d.ts +1 -1
- package/dist/server/rpc/handlers/provideHandler/handler.js +18 -18
- package/dist/server/rpc/handlers/provideHandler/proxy.d.ts +1 -1
- package/dist/server/rpc/handlers/provideHandler/proxy.js +11 -11
- package/dist/server/rpc/handlers/provideHandler.d.ts +1 -1
- package/dist/server/rpc/handlers/provideHandler.js +1 -1
- package/dist/server/rpc/handlers/rag.d.ts +1 -1
- package/dist/server/rpc/handlers/rag.js +50 -50
- package/dist/server/rpc/handlers/registry.d.ts +1 -1
- package/dist/server/rpc/handlers/registry.js +34 -36
- package/dist/server/rpc/handlers/resume.d.ts +1 -1
- package/dist/server/rpc/handlers/resume.js +3 -3
- package/dist/server/rpc/handlers/state.d.ts +1 -1
- package/dist/server/rpc/handlers/state.js +3 -3
- package/dist/server/rpc/handlers/stopProvideHandler.d.ts +1 -1
- package/dist/server/rpc/handlers/stopProvideHandler.js +7 -7
- package/dist/server/rpc/handlers/suspend.d.ts +1 -1
- package/dist/server/rpc/handlers/suspend.js +3 -3
- package/dist/server/rpc/handlers/text-to-speech-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/text-to-speech-stream.js +2 -2
- package/dist/server/rpc/handlers/text-to-speech.d.ts +1 -1
- package/dist/server/rpc/handlers/text-to-speech.js +2 -2
- package/dist/server/rpc/handlers/transcribe-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/transcribe-stream.js +2 -2
- package/dist/server/rpc/handlers/transcribe.d.ts +1 -1
- package/dist/server/rpc/handlers/transcribe.js +2 -2
- package/dist/server/rpc/handlers/translate.d.ts +1 -1
- package/dist/server/rpc/handlers/translate.js +2 -2
- package/dist/server/rpc/handlers/unload-model-delegated.d.ts +1 -1
- package/dist/server/rpc/handlers/unload-model-delegated.js +10 -10
- package/dist/server/rpc/handlers/unload-model.d.ts +1 -1
- package/dist/server/rpc/handlers/unload-model.js +10 -10
- package/dist/server/rpc/handlers/upscale-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/upscale-stream.js +2 -2
- package/dist/server/rpc/handlers/video-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/video-stream.js +2 -2
- package/dist/server/rpc/index.d.ts +2 -2
- package/dist/server/rpc/index.js +2 -2
- package/dist/server/rpc/profiling/context.d.ts +1 -1
- package/dist/server/rpc/profiling/context.js +9 -10
- package/dist/server/rpc/profiling/delegation-profiler.d.ts +2 -2
- package/dist/server/rpc/profiling/delegation-profiler.js +23 -24
- package/dist/server/rpc/profiling/index.d.ts +4 -4
- package/dist/server/rpc/profiling/index.js +4 -4
- package/dist/server/rpc/profiling/operation-metrics.d.ts +2 -2
- package/dist/server/rpc/profiling/operation-metrics.js +102 -102
- package/dist/server/rpc/profiling/operation-wrappers.d.ts +1 -1
- package/dist/server/rpc/profiling/operation-wrappers.js +16 -14
- package/dist/server/rpc/profiling/profiler.d.ts +2 -2
- package/dist/server/rpc/profiling/profiler.js +9 -13
- package/dist/server/rpc/rpc-utils.js +1 -4
- package/dist/server/rpc/transport-selector.d.ts +1 -1
- package/dist/server/rpc/transport-selector.js +4 -4
- package/dist/server/utils/archive.js +27 -29
- package/dist/server/utils/audio/decoder.d.ts +2 -2
- package/dist/server/utils/audio/decoder.js +11 -11
- package/dist/server/utils/cache/auto-history.d.ts +1 -1
- package/dist/server/utils/cache/auto-history.js +5 -5
- package/dist/server/utils/cache/paths.d.ts +2 -2
- package/dist/server/utils/cache/paths.js +14 -14
- package/dist/server/utils/checksum.d.ts +1 -1
- package/dist/server/utils/checksum.js +10 -12
- package/dist/server/utils/clear-storage.d.ts +1 -1
- package/dist/server/utils/clear-storage.js +8 -11
- package/dist/server/utils/completion-normalizer.d.ts +1 -1
- package/dist/server/utils/completion-normalizer.js +106 -113
- package/dist/server/utils/config-transform.d.ts +1 -1
- package/dist/server/utils/config-transform.js +2 -2
- package/dist/server/utils/expand-gguf-shards.js +4 -4
- package/dist/server/utils/formatting.js +6 -12
- package/dist/server/utils/gguf-tensor-extractor.js +17 -21
- package/dist/server/utils/index.d.ts +11 -11
- package/dist/server/utils/index.js +11 -11
- package/dist/server/utils/multi-gpu-mobile.js +1 -1
- package/dist/server/utils/path-security.d.ts +1 -1
- package/dist/server/utils/path-security.js +6 -6
- package/dist/server/utils/qvac-paths.js +3 -3
- package/dist/server/utils/response-format.d.ts +1 -1
- package/dist/server/utils/response-format.js +4 -4
- package/dist/server/utils/shard-utils.d.ts +1 -1
- package/dist/server/utils/shard-utils.js +14 -16
- package/dist/server/utils/tool-integration.d.ts +1 -1
- package/dist/server/utils/tool-integration.js +5 -9
- package/dist/server/utils/tools/dialect.d.ts +1 -1
- package/dist/server/utils/tools/dialect.js +7 -7
- package/dist/server/utils/tools/index.d.ts +2 -2
- package/dist/server/utils/tools/index.js +2 -2
- package/dist/server/utils/tools/parser.d.ts +1 -1
- package/dist/server/utils/tools/parser.js +14 -14
- package/dist/server/utils/tools/parsers/gemma4native.d.ts +2 -2
- package/dist/server/utils/tools/parsers/gemma4native.js +13 -8
- package/dist/server/utils/tools/parsers/harmony.d.ts +2 -2
- package/dist/server/utils/tools/parsers/harmony.js +9 -11
- package/dist/server/utils/tools/parsers/hermes.d.ts +2 -2
- package/dist/server/utils/tools/parsers/hermes.js +16 -16
- package/dist/server/utils/tools/parsers/json.d.ts +2 -2
- package/dist/server/utils/tools/parsers/json.js +14 -14
- package/dist/server/utils/tools/parsers/pythonic.d.ts +2 -2
- package/dist/server/utils/tools/parsers/pythonic.js +43 -43
- package/dist/server/utils/tools/parsers/qwen35.d.ts +2 -2
- package/dist/server/utils/tools/parsers/qwen35.js +20 -20
- package/dist/server/utils/tools/shared.d.ts +1 -1
- package/dist/server/utils/tools/shared.js +10 -12
- package/dist/server/utils/worker-lock.js +10 -10
- package/dist/server/worker-core.d.ts +1 -1
- package/dist/server/worker-core.js +44 -43
- package/dist/server/worker.js +9 -9
- package/dist/utils/aggregate-events.d.ts +2 -2
- package/dist/utils/aggregate-events.js +17 -19
- package/dist/utils/cache-normalize.js +1 -4
- package/dist/utils/encoding.js +1 -1
- package/dist/utils/errors-base.d.ts +1 -1
- package/dist/utils/errors-base.js +1 -1
- package/dist/utils/errors-client.d.ts +1 -1
- package/dist/utils/errors-client.js +5 -5
- package/dist/utils/errors-server.d.ts +3 -3
- package/dist/utils/errors-server.js +19 -18
- package/dist/utils/load-model-validation.js +3 -3
- package/dist/utils/mcp-adapter.d.ts +4 -4
- package/dist/utils/mcp-adapter.js +31 -38
- package/dist/utils/path-sanitize.js +14 -17
- package/dist/utils/tool-helpers.d.ts +2 -2
- package/dist/utils/tool-helpers.js +25 -26
- package/dist/utils/withTimeout.d.ts +7 -0
- package/dist/utils/withTimeout.js +11 -1
- package/dist/utils/zod-error.d.ts +1 -1
- package/dist/utils/zod-error.js +1 -1
- package/electron-forge/index.cjs +274 -317
- package/expo/plugins/patches/android-link.mjs +25 -30
- package/expo/plugins/patches/ios-link.mjs +25 -30
- package/package.json +17 -16
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { CanonicalModelType } from
|
|
2
|
-
import type BaseInference from
|
|
1
|
+
import type { CanonicalModelType } from '../../../schemas/index';
|
|
2
|
+
import type BaseInference from '@qvac/infer-base';
|
|
3
3
|
interface AddonInterface {
|
|
4
4
|
cancel(jobId?: string): Promise<void>;
|
|
5
5
|
}
|
|
6
|
-
export type AnyModel = Omit<BaseInference,
|
|
6
|
+
export type AnyModel = Omit<BaseInference, 'addon'> & {
|
|
7
7
|
reload?(config: unknown): Promise<void>;
|
|
8
8
|
addon?: AddonInterface;
|
|
9
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModelAlreadyRegisteredError, ModelNotFoundError, ModelIsDelegatedError
|
|
2
|
-
import { getServerLogger } from
|
|
1
|
+
import { ModelAlreadyRegisteredError, ModelNotFoundError, ModelIsDelegatedError } from '../../../utils/errors-server.js';
|
|
2
|
+
import { getServerLogger } from '../../../logging/index.js';
|
|
3
3
|
const logger = getServerLogger();
|
|
4
4
|
// Global registry state - using stateless functions to manage it
|
|
5
5
|
const modelRegistry = new Map();
|
|
@@ -7,7 +7,7 @@ export function registerModel(id, options) {
|
|
|
7
7
|
if (modelRegistry.has(id)) {
|
|
8
8
|
throw new ModelAlreadyRegisteredError(id);
|
|
9
9
|
}
|
|
10
|
-
const isDelegated =
|
|
10
|
+
const isDelegated = 'providerPublicKey' in options;
|
|
11
11
|
if (isDelegated) {
|
|
12
12
|
const { providerPublicKey, timeout, healthCheckTimeout } = options;
|
|
13
13
|
modelRegistry.set(id, {
|
|
@@ -16,8 +16,8 @@ export function registerModel(id, options) {
|
|
|
16
16
|
delegated: {
|
|
17
17
|
providerPublicKey,
|
|
18
18
|
timeout,
|
|
19
|
-
healthCheckTimeout
|
|
20
|
-
}
|
|
19
|
+
healthCheckTimeout
|
|
20
|
+
}
|
|
21
21
|
});
|
|
22
22
|
logger.info(`Delegated model registered: ${id} -> provider: ${providerPublicKey}, timeout: ${timeout}ms`);
|
|
23
23
|
}
|
|
@@ -31,10 +31,10 @@ export function registerModel(id, options) {
|
|
|
31
31
|
loadedAt: new Date(),
|
|
32
32
|
config: options.config,
|
|
33
33
|
modelType: options.modelType,
|
|
34
|
-
name: options.name
|
|
35
|
-
}
|
|
34
|
+
name: options.name
|
|
35
|
+
}
|
|
36
36
|
});
|
|
37
|
-
const nameStr = options.name ? ` (${options.name})` :
|
|
37
|
+
const nameStr = options.name ? ` (${options.name})` : '';
|
|
38
38
|
logger.info(`Local model registered: ${id}${nameStr} -> ${options.path}`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -75,7 +75,7 @@ export function getModelInfo(id) {
|
|
|
75
75
|
id: entry.id,
|
|
76
76
|
path: entry.local.path,
|
|
77
77
|
loadedAt: entry.local.loadedAt,
|
|
78
|
-
config: entry.local.config
|
|
78
|
+
config: entry.local.config
|
|
79
79
|
};
|
|
80
80
|
if (entry.local.name) {
|
|
81
81
|
result.name = entry.local.name;
|
|
@@ -101,12 +101,12 @@ export function updateModelConfig(id, config) {
|
|
|
101
101
|
}
|
|
102
102
|
export function clearRegistry() {
|
|
103
103
|
modelRegistry.clear();
|
|
104
|
-
logger.info(
|
|
104
|
+
logger.info('Model registry cleared');
|
|
105
105
|
}
|
|
106
106
|
export function getRegistryStats() {
|
|
107
107
|
return {
|
|
108
108
|
totalModels: modelRegistry.size,
|
|
109
|
-
modelIds: Array.from(modelRegistry.keys())
|
|
109
|
+
modelIds: Array.from(modelRegistry.keys())
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
export async function unloadAllModels() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QVACRegistryClient } from
|
|
1
|
+
import { QVACRegistryClient } from '@qvac/registry-client';
|
|
2
2
|
export declare function getRegistryClient(): Promise<QVACRegistryClient>;
|
|
3
3
|
export declare function closeRegistryClient(): Promise<void>;
|
|
4
4
|
export declare function hasActiveRegistryClient(): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { QVACRegistryClient } from
|
|
2
|
-
import { getCacheDir } from
|
|
3
|
-
import { registerSwarm, unregisterSwarm, registerCorestore, unregisterCorestore
|
|
4
|
-
import { getServerLogger } from
|
|
5
|
-
import { DEFAULT_REGISTRY_CORE_KEY } from
|
|
1
|
+
import { QVACRegistryClient } from '@qvac/registry-client';
|
|
2
|
+
import { getCacheDir } from '../../utils/cache/paths.js';
|
|
3
|
+
import { registerSwarm, unregisterSwarm, registerCorestore, unregisterCorestore } from '../runtime-lifecycle.js';
|
|
4
|
+
import { getServerLogger } from '../../../logging/index.js';
|
|
5
|
+
import { DEFAULT_REGISTRY_CORE_KEY } from '../../../constants/index.js';
|
|
6
6
|
const logger = getServerLogger();
|
|
7
7
|
// fd-lock retry budget for the registry corestore.
|
|
8
8
|
//
|
|
@@ -24,7 +24,7 @@ let registryClient = null;
|
|
|
24
24
|
let inflightInit = null;
|
|
25
25
|
function isFdLockError(error) {
|
|
26
26
|
if (error instanceof Error) {
|
|
27
|
-
return error.message.includes(
|
|
27
|
+
return error.message.includes('File descriptor could not be locked');
|
|
28
28
|
}
|
|
29
29
|
return false;
|
|
30
30
|
}
|
|
@@ -39,23 +39,23 @@ async function initRegistryClient() {
|
|
|
39
39
|
const client = new QVACRegistryClient({
|
|
40
40
|
registryCoreKey: DEFAULT_REGISTRY_CORE_KEY,
|
|
41
41
|
storage: getCacheDir(`registry-corestore/${DEFAULT_REGISTRY_CORE_KEY}`),
|
|
42
|
-
corestoreOpts: { wait: false }
|
|
42
|
+
corestoreOpts: { wait: false }
|
|
43
43
|
});
|
|
44
44
|
await client.ready();
|
|
45
45
|
registryClient = client;
|
|
46
46
|
if (registryClient.corestore) {
|
|
47
47
|
registerCorestore(registryClient.corestore, {
|
|
48
|
-
label:
|
|
49
|
-
createdAt: Date.now()
|
|
48
|
+
label: 'registry-client',
|
|
49
|
+
createdAt: Date.now()
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
if (registryClient.hyperswarm) {
|
|
53
53
|
registerSwarm(registryClient.hyperswarm, {
|
|
54
|
-
label:
|
|
55
|
-
createdAt: Date.now()
|
|
54
|
+
label: 'registry-client',
|
|
55
|
+
createdAt: Date.now()
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
logger.info(
|
|
58
|
+
logger.info('✅ Registry client ready');
|
|
59
59
|
return client;
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
|
@@ -78,14 +78,14 @@ async function initRegistryClient() {
|
|
|
78
78
|
}
|
|
79
79
|
export async function getRegistryClient() {
|
|
80
80
|
if (registryClient) {
|
|
81
|
-
logger.debug(
|
|
81
|
+
logger.debug('Registry client reused');
|
|
82
82
|
return registryClient;
|
|
83
83
|
}
|
|
84
84
|
if (inflightInit) {
|
|
85
|
-
logger.debug(
|
|
85
|
+
logger.debug('Registry client init already in progress, waiting...');
|
|
86
86
|
return inflightInit;
|
|
87
87
|
}
|
|
88
|
-
logger.info(
|
|
88
|
+
logger.info('🔗 Creating new registry client...');
|
|
89
89
|
inflightInit = initRegistryClient().finally(() => {
|
|
90
90
|
inflightInit = null;
|
|
91
91
|
});
|
|
@@ -98,13 +98,13 @@ export async function closeRegistryClient() {
|
|
|
98
98
|
registryClient = null;
|
|
99
99
|
const corestore = client.corestore;
|
|
100
100
|
const hyperswarm = client.hyperswarm;
|
|
101
|
-
logger.info(
|
|
101
|
+
logger.info('🔌 Closing registry client...');
|
|
102
102
|
try {
|
|
103
103
|
await client.close();
|
|
104
|
-
logger.info(
|
|
104
|
+
logger.info('✅ Registry client closed');
|
|
105
105
|
}
|
|
106
106
|
catch (error) {
|
|
107
|
-
logger.error(
|
|
107
|
+
logger.error('❌ Error closing registry client:', error instanceof Error ? error.message : String(error));
|
|
108
108
|
}
|
|
109
109
|
finally {
|
|
110
110
|
if (corestore)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeContext } from
|
|
1
|
+
import type { RuntimeContext } from '../../../schemas/index';
|
|
2
2
|
export declare function setRuntimeContext(ctx: RuntimeContext): void;
|
|
3
3
|
export declare function getRuntimeContext(): RuntimeContext;
|
|
4
4
|
export declare function isMobile(): boolean;
|
|
@@ -16,11 +16,11 @@ export function getRuntimeContext() {
|
|
|
16
16
|
// Convenience helpers
|
|
17
17
|
// ============================================
|
|
18
18
|
export function isMobile() {
|
|
19
|
-
return context.runtime ===
|
|
19
|
+
return context.runtime === 'react-native';
|
|
20
20
|
}
|
|
21
21
|
export function isAndroid() {
|
|
22
|
-
return context.platform ===
|
|
22
|
+
return context.platform === 'android';
|
|
23
23
|
}
|
|
24
24
|
export function isIOS() {
|
|
25
|
-
return context.platform ===
|
|
25
|
+
return context.platform === 'ios';
|
|
26
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncDisposeUnavailableError } from
|
|
1
|
+
import { AsyncDisposeUnavailableError } from '../../../utils/errors-server.js';
|
|
2
2
|
/**
|
|
3
3
|
* Module-load guard. The whole request-lifecycle primitive stack (scopes,
|
|
4
4
|
* the registry's `ManagedRequestContext`, `await using ctx = ...`) is
|
|
@@ -10,7 +10,7 @@ import { AsyncDisposeUnavailableError } from "../../../utils/errors-server.js";
|
|
|
10
10
|
* registry entries forever. Better to fail loudly at import time with a
|
|
11
11
|
* clear error than to debug a slow registry leak in production.
|
|
12
12
|
*/
|
|
13
|
-
if (typeof Symbol.asyncDispose !==
|
|
13
|
+
if (typeof Symbol.asyncDispose !== 'symbol') {
|
|
14
14
|
throw new AsyncDisposeUnavailableError();
|
|
15
15
|
}
|
|
16
16
|
export function createDisposableScope() {
|
|
@@ -64,6 +64,6 @@ export function createDisposableScope() {
|
|
|
64
64
|
[Symbol.asyncDispose]: dispose,
|
|
65
65
|
get disposed() {
|
|
66
66
|
return disposed;
|
|
67
|
-
}
|
|
67
|
+
}
|
|
68
68
|
};
|
|
69
69
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { createDisposableScope } from
|
|
2
|
-
export type { DisposableScope } from
|
|
3
|
-
export type { RequestContext, RequestKind, RequestState
|
|
4
|
-
export { createRequestRegistry, getRequestRegistry
|
|
5
|
-
export type { BeginOpts, CancelByModelId, CancelByRequestId, CancelTarget, ConcurrencyPolicy, ManagedRequestContext, RequestOutcome, RequestRegistry
|
|
6
|
-
export { withRequestContext } from
|
|
7
|
-
export type { RequestLogContext } from
|
|
1
|
+
export { createDisposableScope } from './disposable-scope';
|
|
2
|
+
export type { DisposableScope } from './disposable-scope';
|
|
3
|
+
export type { RequestContext, RequestKind, RequestState } from './request-context';
|
|
4
|
+
export { createRequestRegistry, getRequestRegistry } from './request-registry-singleton';
|
|
5
|
+
export type { BeginOpts, CancelByModelId, CancelByRequestId, CancelTarget, ConcurrencyPolicy, ManagedRequestContext, RequestOutcome, RequestRegistry } from './request-registry';
|
|
6
|
+
export { withRequestContext } from './with-request-context';
|
|
7
|
+
export type { RequestLogContext } from './with-request-context';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createDisposableScope } from
|
|
2
|
-
export { createRequestRegistry, getRequestRegistry
|
|
3
|
-
export { withRequestContext } from
|
|
1
|
+
export { createDisposableScope } from './disposable-scope.js';
|
|
2
|
+
export { createRequestRegistry, getRequestRegistry } from './request-registry-singleton.js';
|
|
3
|
+
export { withRequestContext } from './with-request-context.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AbortSignal } from
|
|
2
|
-
import type { DisposableScope } from
|
|
1
|
+
import type { AbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import type { DisposableScope } from './disposable-scope';
|
|
3
3
|
/**
|
|
4
4
|
* Coarse classification of a long-running request. Used by
|
|
5
5
|
* `RequestRegistry.cancel({ modelId, kind })` so a broad cancel can target
|
|
@@ -9,7 +9,7 @@ import type { DisposableScope } from "./disposable-scope";
|
|
|
9
9
|
* The set is intentionally open-coded — adding a new kind is a one-line
|
|
10
10
|
* change and the union surfaces in editor autocomplete at every call site.
|
|
11
11
|
*/
|
|
12
|
-
export type RequestKind =
|
|
12
|
+
export type RequestKind = 'completion' | 'batchCompletion' | 'embeddings' | 'transcribe' | 'translate' | 'diffusion' | 'tts' | 'ocr' | 'vla' | 'finetune' | 'loadModel' | 'downloadAsset' | 'rag';
|
|
13
13
|
/**
|
|
14
14
|
* Lifecycle states a request transitions through. A new context starts in
|
|
15
15
|
* `"running"`. `cancel(...)` flips it to `"cancelling"` and aborts the
|
|
@@ -20,7 +20,7 @@ export type RequestKind = "completion" | "embeddings" | "transcribe" | "translat
|
|
|
20
20
|
* `state` defensively at most a couple of points and a flat enum is easier
|
|
21
21
|
* to log/assert than a transition table.
|
|
22
22
|
*/
|
|
23
|
-
export type RequestState =
|
|
23
|
+
export type RequestState = 'running' | 'cancelling' | 'completed' | 'failed' | 'cancelled';
|
|
24
24
|
/**
|
|
25
25
|
* Per-request lifecycle handle. Created by `RequestRegistry.begin(...)`
|
|
26
26
|
* and consumed by long-running handlers as the single owner of:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequestRegistry as createRegistry, type RequestRegistry } from
|
|
1
|
+
import { createRequestRegistry as createRegistry, type RequestRegistry } from './request-registry';
|
|
2
2
|
export declare function getRequestRegistry(): RequestRegistry;
|
|
3
3
|
export { createRegistry as createRequestRegistry };
|
|
4
4
|
//# sourceMappingURL=request-registry-singleton.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequestRegistry as createRegistry
|
|
1
|
+
import { createRequestRegistry as createRegistry } from './request-registry.js';
|
|
2
2
|
/**
|
|
3
3
|
* Worker-process singleton. Every long-running request in this Bare
|
|
4
4
|
* worker registers under this registry, so a `cancel({ requestId })` RPC
|
|
@@ -11,17 +11,36 @@ import { createRequestRegistry as createRegistry, } from "./request-registry.js"
|
|
|
11
11
|
* baseline concurrency policies.
|
|
12
12
|
*/
|
|
13
13
|
let registry = null;
|
|
14
|
+
// `completion` and `batchCompletion` both run on the same `@qvac/llm-llamacpp`
|
|
15
|
+
// instance, which funnels every `run()` (single-prompt and batch alike) through
|
|
16
|
+
// one per-instance exclusive run queue plus a single-job native runner. They
|
|
17
|
+
// therefore can't actually execute at once on the same model. Sharing one
|
|
18
|
+
// admission lane makes the SDK queue reflect that reality: a completion and a
|
|
19
|
+
// batch on the same model serialize FIFO at the SDK layer instead of both being
|
|
20
|
+
// admitted and silently serializing inside the addon (which hides them from the
|
|
21
|
+
// registry's queue-depth accounting, `requestId` diagnostics, and cancel).
|
|
22
|
+
const LLAMACPP_COMPLETION_SLOT_GROUP = 'llamacppCompletion';
|
|
14
23
|
function installDefaultPolicies(r) {
|
|
15
24
|
// A loaded model is a single native context (one KV-cache, single-slot
|
|
16
25
|
// decode), so two same-model completions can't run in parallel. Serialize
|
|
17
26
|
// rather than reject: the second waits FIFO. maxConcurrentPerModel: 1 is
|
|
18
27
|
// today's reality — raise it once continuous batching lands. The depth cap
|
|
19
|
-
// bounds queue memory.
|
|
28
|
+
// bounds queue memory. The shared slot group extends that serialization
|
|
29
|
+
// across `completion` + `batchCompletion` on the same model (see note
|
|
30
|
+
// above).
|
|
20
31
|
r.policy({
|
|
21
|
-
kind:
|
|
32
|
+
kind: 'completion',
|
|
22
33
|
maxConcurrentPerModel: 1,
|
|
23
|
-
onOverflow:
|
|
34
|
+
onOverflow: 'queue',
|
|
24
35
|
maxQueueDepthPerModel: 64,
|
|
36
|
+
sharedSlotGroup: LLAMACPP_COMPLETION_SLOT_GROUP
|
|
37
|
+
});
|
|
38
|
+
r.policy({
|
|
39
|
+
kind: 'batchCompletion',
|
|
40
|
+
maxConcurrentPerModel: 1,
|
|
41
|
+
onOverflow: 'queue',
|
|
42
|
+
maxQueueDepthPerModel: 64,
|
|
43
|
+
sharedSlotGroup: LLAMACPP_COMPLETION_SLOT_GROUP
|
|
25
44
|
});
|
|
26
45
|
}
|
|
27
46
|
export function getRequestRegistry() {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type AbortSignal } from
|
|
2
|
-
import type { RequestContext, RequestKind } from
|
|
3
|
-
import type { Logger } from
|
|
1
|
+
import { type AbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import type { RequestContext, RequestKind } from './request-context';
|
|
3
|
+
import type { Logger } from '../../../logging/types';
|
|
4
4
|
/**
|
|
5
5
|
* Outcome the caller declares when terminating a request through
|
|
6
6
|
* `registry.end(...)`. The registry maps it to a terminal `RequestState`
|
|
7
7
|
* before disposing the scope so observers see a coherent final state.
|
|
8
8
|
*/
|
|
9
|
-
export type RequestOutcome =
|
|
9
|
+
export type RequestOutcome = 'completed' | 'failed' | 'cancelled';
|
|
10
10
|
export interface BeginOpts {
|
|
11
11
|
/** Stable identity. Caller-provided so the client and server agree. */
|
|
12
12
|
requestId: string;
|
|
@@ -35,9 +35,9 @@ export type CancelTarget = CancelByRequestId | CancelByModelId;
|
|
|
35
35
|
* admission control (every `begin(...)` is accepted as long as the
|
|
36
36
|
* request id is unique).
|
|
37
37
|
*
|
|
38
|
-
* The policy turns admission into a per-`(
|
|
38
|
+
* The policy turns admission into a per-`(lane, modelId)` FIFO queue with
|
|
39
39
|
* a configurable concurrency limit. A second concurrent request to the
|
|
40
|
-
* same `(
|
|
40
|
+
* same `(lane, modelId)` *waits its turn* (default) rather than colliding
|
|
41
41
|
* on the single native llama.cpp context. The limit is forward-compatible
|
|
42
42
|
* with addon-side continuous batching: bump `maxConcurrentPerModel` to the
|
|
43
43
|
* addon's slot count to flip serial execution to N-way concurrent without
|
|
@@ -49,21 +49,21 @@ export type CancelTarget = CancelByRequestId | CancelByModelId;
|
|
|
49
49
|
export interface ConcurrencyPolicy {
|
|
50
50
|
kind: RequestKind;
|
|
51
51
|
/**
|
|
52
|
-
* Max simultaneously in-flight requests per `(
|
|
52
|
+
* Max simultaneously in-flight requests per `(lane, modelId)`.
|
|
53
53
|
* Default: `Infinity` (no admission limit). Set `1` to serialize, or
|
|
54
54
|
* `N` for N-way concurrency (the future continuous-batching slot
|
|
55
55
|
* count). Non-finite values disable gating entirely.
|
|
56
56
|
*/
|
|
57
57
|
maxConcurrentPerModel?: number;
|
|
58
58
|
/**
|
|
59
|
-
* What a `begin(...)` does when the `(
|
|
59
|
+
* What a `begin(...)` does when the `(lane, modelId)` is at capacity:
|
|
60
60
|
* - `"queue"` (default): wait FIFO for a slot to free.
|
|
61
61
|
* - `"reject"`: throw `RequestRejectedByPolicyError` immediately
|
|
62
62
|
* (the legacy `oneAtATimePerModel` behavior).
|
|
63
63
|
*/
|
|
64
|
-
onOverflow?:
|
|
64
|
+
onOverflow?: 'queue' | 'reject';
|
|
65
65
|
/**
|
|
66
|
-
* Max waiters allowed to queue per `(
|
|
66
|
+
* Max waiters allowed to queue per `(lane, modelId)` before further
|
|
67
67
|
* begins reject with `RequestRejectedByPolicyError`. Bounds memory so a
|
|
68
68
|
* runaway client can't grow the queue without limit. Default: `64`.
|
|
69
69
|
* Only consulted when `onOverflow` is `"queue"`.
|
|
@@ -82,6 +82,21 @@ export interface ConcurrencyPolicy {
|
|
|
82
82
|
* `maxConcurrentPerModel` is set explicitly.
|
|
83
83
|
*/
|
|
84
84
|
oneAtATimePerModel?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Opt several kinds into one shared admission lane per model. When set,
|
|
87
|
+
* the slot is keyed on `(sharedSlotGroup, modelId)` instead of
|
|
88
|
+
* `(kind, modelId)`, so requests of *different* kinds that target the
|
|
89
|
+
* same model contend for the same slot pool.
|
|
90
|
+
*
|
|
91
|
+
* This exists to mirror an addon that serializes unrelated request
|
|
92
|
+
* kinds on a single native context — e.g. `@qvac/llm-llamacpp` funnels
|
|
93
|
+
* single-prompt `completion` and `batchCompletion` through one
|
|
94
|
+
* per-instance run queue, so the two can't actually run at once on the
|
|
95
|
+
* same model. Sharing a lane makes the SDK's admission queue the
|
|
96
|
+
* authoritative serialization point rather than relying on the addon's
|
|
97
|
+
* internal queue.
|
|
98
|
+
*/
|
|
99
|
+
sharedSlotGroup?: string;
|
|
85
100
|
}
|
|
86
101
|
/**
|
|
87
102
|
* `ManagedRequestContext` is the value `begin(...)` resolves to. It extends
|
|
@@ -100,7 +115,7 @@ export interface ManagedRequestContext extends RequestContext {
|
|
|
100
115
|
export interface RequestRegistry {
|
|
101
116
|
/**
|
|
102
117
|
* Open a new request. Returns a promise because admission may *queue*:
|
|
103
|
-
* when a concurrency policy caps the `(
|
|
118
|
+
* when a concurrency policy caps the `(lane, modelId)` and it's at
|
|
104
119
|
* capacity with `onOverflow: "queue"`, the promise resolves once a slot
|
|
105
120
|
* frees (FIFO). Callers write `await using ctx = await registry.begin(...)`.
|
|
106
121
|
*
|
|
@@ -153,7 +168,7 @@ export interface RequestRegistry {
|
|
|
153
168
|
* Resolves once all targeted contexts have flipped to `"cancelling"`;
|
|
154
169
|
* scope unwinding still happens on each handler's own dispose path.
|
|
155
170
|
*/
|
|
156
|
-
cancelAll(reason:
|
|
171
|
+
cancelAll(reason: 'shutdown' | 'modelUnload'): Promise<void>;
|
|
157
172
|
/**
|
|
158
173
|
* Mark a request finished and dispose its scope. Equivalent to
|
|
159
174
|
* `await ctx[Symbol.asyncDispose]()` with an explicit outcome.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AbortController } from
|
|
2
|
-
import { createDisposableScope
|
|
3
|
-
import { RequestIdConflictError, RequestRejectedByPolicyError
|
|
4
|
-
import { getServerLogger } from
|
|
1
|
+
import { AbortController } from 'bare-abort-controller';
|
|
2
|
+
import { createDisposableScope } from './disposable-scope.js';
|
|
3
|
+
import { RequestIdConflictError, RequestRejectedByPolicyError } from '../../../utils/errors-server.js';
|
|
4
|
+
import { getServerLogger } from '../../../logging/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Tuning knobs for the "cancelled-before-begin" bookkeeping set.
|
|
7
7
|
*
|
|
@@ -25,7 +25,7 @@ import { getServerLogger } from "../../../logging/index.js";
|
|
|
25
25
|
const CANCEL_BEFORE_BEGIN_MAX_ENTRIES = 128;
|
|
26
26
|
const CANCEL_BEFORE_BEGIN_TTL_MS = 30_000;
|
|
27
27
|
/**
|
|
28
|
-
* Default cap on waiters queued per `(
|
|
28
|
+
* Default cap on waiters queued per `(lane, modelId)` when a policy uses
|
|
29
29
|
* `onOverflow: "queue"` without an explicit `maxQueueDepthPerModel`.
|
|
30
30
|
* Bounds memory so a misbehaving client firing a flood of same-model
|
|
31
31
|
* requests can't grow the queue without limit — the (depth + 1)th begin
|
|
@@ -49,13 +49,13 @@ export function createRequestRegistry(options) {
|
|
|
49
49
|
*/
|
|
50
50
|
const waitersById = new Map();
|
|
51
51
|
function logLifecycle(event, ctx, durationMs) {
|
|
52
|
-
const modelId = ctx.modelId !== undefined ? ctx.modelId :
|
|
52
|
+
const modelId = ctx.modelId !== undefined ? ctx.modelId : '-';
|
|
53
53
|
const base = `[request-lifecycle] ${event} requestId=${ctx.requestId} kind=${ctx.kind} modelId=${modelId} state=${ctx.state}`;
|
|
54
54
|
const line = durationMs !== undefined ? `${base} durationMs=${durationMs}` : base;
|
|
55
55
|
// `failed` end emits at `warn` so log shippers can alert on
|
|
56
56
|
// `level>=warn` for this prefix without parsing `state=failed`
|
|
57
57
|
// out of the message body. Everything else stays at `info`.
|
|
58
|
-
if (event ===
|
|
58
|
+
if (event === 'end' && ctx.state === 'failed') {
|
|
59
59
|
logger.warn(line);
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
@@ -119,10 +119,11 @@ export function createRequestRegistry(options) {
|
|
|
119
119
|
cancelledBeforeBegin.delete(requestId);
|
|
120
120
|
return entry;
|
|
121
121
|
}
|
|
122
|
-
function slotKey(
|
|
123
|
-
// NUL separator can't appear in a
|
|
124
|
-
//
|
|
125
|
-
|
|
122
|
+
function slotKey(lane, modelId) {
|
|
123
|
+
// NUL separator can't appear in a lane (a closed-union kind or an
|
|
124
|
+
// SDK-controlled `sharedSlotGroup` label) or a modelId (sdkModelId is a
|
|
125
|
+
// generated handle), so the join is unambiguous.
|
|
126
|
+
return `${lane}\u0000${modelId}`;
|
|
126
127
|
}
|
|
127
128
|
/**
|
|
128
129
|
* Pull a waiter out of its queue and tidy up: clear its timeout, drop
|
|
@@ -173,7 +174,10 @@ export function createRequestRegistry(options) {
|
|
|
173
174
|
if (opts.parentSignal?.aborted)
|
|
174
175
|
return { slotKey: undefined };
|
|
175
176
|
const modelId = opts.modelId;
|
|
176
|
-
|
|
177
|
+
// A shared lane lets unrelated kinds (e.g. completion + batchCompletion)
|
|
178
|
+
// contend for one slot pool per model, matching an addon that serializes
|
|
179
|
+
// them on a single native context.
|
|
180
|
+
const key = slotKey(policy.slotGroup ?? opts.kind, modelId);
|
|
177
181
|
let st = keyStates.get(key);
|
|
178
182
|
if (!st) {
|
|
179
183
|
st = { active: 0, waiters: [] };
|
|
@@ -183,7 +187,7 @@ export function createRequestRegistry(options) {
|
|
|
183
187
|
st.active++;
|
|
184
188
|
return { slotKey: key };
|
|
185
189
|
}
|
|
186
|
-
if (policy.onOverflow ===
|
|
190
|
+
if (policy.onOverflow === 'reject') {
|
|
187
191
|
throw new RequestRejectedByPolicyError(opts.requestId, opts.kind, modelId, `another ${opts.kind} request is already running on this model`);
|
|
188
192
|
}
|
|
189
193
|
if (st.waiters.length >= policy.maxQueueDepth) {
|
|
@@ -198,7 +202,7 @@ export function createRequestRegistry(options) {
|
|
|
198
202
|
enqueuedAt: Date.now(),
|
|
199
203
|
resolve,
|
|
200
204
|
reject,
|
|
201
|
-
timer: undefined
|
|
205
|
+
timer: undefined
|
|
202
206
|
};
|
|
203
207
|
if (policy.queueTimeoutMs !== undefined) {
|
|
204
208
|
const timeoutMs = policy.queueTimeoutMs;
|
|
@@ -240,9 +244,9 @@ export function createRequestRegistry(options) {
|
|
|
240
244
|
function cancelEntry(entry, reason) {
|
|
241
245
|
if (entry.controller.signal.aborted)
|
|
242
246
|
return false;
|
|
243
|
-
entry.ctx.state =
|
|
247
|
+
entry.ctx.state = 'cancelling';
|
|
244
248
|
entry.controller.abort(reason);
|
|
245
|
-
logLifecycle(
|
|
249
|
+
logLifecycle('cancel', entry.ctx);
|
|
246
250
|
return true;
|
|
247
251
|
}
|
|
248
252
|
async function disposeEntry(entry, outcome) {
|
|
@@ -250,7 +254,7 @@ export function createRequestRegistry(options) {
|
|
|
250
254
|
return;
|
|
251
255
|
entry.ctx.state = outcome;
|
|
252
256
|
entry.detachParent();
|
|
253
|
-
logLifecycle(
|
|
257
|
+
logLifecycle('end', entry.ctx, Date.now() - entry.startedAt);
|
|
254
258
|
// Pull the entry out before unwinding so observers (e.g. a `cancel(...)`
|
|
255
259
|
// racing with dispose) don't see a half-disposed context.
|
|
256
260
|
entries.delete(entry.ctx.requestId);
|
|
@@ -313,8 +317,8 @@ export function createRequestRegistry(options) {
|
|
|
313
317
|
}
|
|
314
318
|
else {
|
|
315
319
|
const onParentAbort = () => controller.abort(parent.reason);
|
|
316
|
-
parent.addEventListener(
|
|
317
|
-
detachParent = () => parent.removeEventListener(
|
|
320
|
+
parent.addEventListener('abort', onParentAbort, { once: true });
|
|
321
|
+
detachParent = () => parent.removeEventListener('abort', onParentAbort);
|
|
318
322
|
}
|
|
319
323
|
}
|
|
320
324
|
const ctx = {
|
|
@@ -329,7 +333,7 @@ export function createRequestRegistry(options) {
|
|
|
329
333
|
// already aborted at begin time. Both branches abort the
|
|
330
334
|
// controller above, so without this guard observers would see a
|
|
331
335
|
// momentarily-`running` context with an already-aborted signal.
|
|
332
|
-
state: preCancel || opts.parentSignal?.aborted ?
|
|
336
|
+
state: preCancel || opts.parentSignal?.aborted ? 'cancelling' : 'running'
|
|
333
337
|
};
|
|
334
338
|
const entry = {
|
|
335
339
|
ctx,
|
|
@@ -337,10 +341,10 @@ export function createRequestRegistry(options) {
|
|
|
337
341
|
scope,
|
|
338
342
|
detachParent,
|
|
339
343
|
startedAt: Date.now(),
|
|
340
|
-
slotKey
|
|
344
|
+
slotKey
|
|
341
345
|
};
|
|
342
346
|
entries.set(opts.requestId, entry);
|
|
343
|
-
logLifecycle(
|
|
347
|
+
logLifecycle('begin', ctx);
|
|
344
348
|
return {
|
|
345
349
|
get requestId() {
|
|
346
350
|
return ctx.requestId;
|
|
@@ -365,7 +369,7 @@ export function createRequestRegistry(options) {
|
|
|
365
369
|
},
|
|
366
370
|
[Symbol.asyncDispose]: async () => {
|
|
367
371
|
await disposeEntry(entry, derivedTerminalState(ctx));
|
|
368
|
-
}
|
|
372
|
+
}
|
|
369
373
|
};
|
|
370
374
|
}
|
|
371
375
|
function get(requestId) {
|
|
@@ -388,7 +392,7 @@ export function createRequestRegistry(options) {
|
|
|
388
392
|
}
|
|
389
393
|
function cancel(target) {
|
|
390
394
|
let cancelled = 0;
|
|
391
|
-
if (
|
|
395
|
+
if ('requestId' in target) {
|
|
392
396
|
const entry = entries.get(target.requestId);
|
|
393
397
|
if (entry) {
|
|
394
398
|
if (cancelEntry(entry, target.reason))
|
|
@@ -483,7 +487,7 @@ export function createRequestRegistry(options) {
|
|
|
483
487
|
// Test-only: the number of live per-`(kind, modelId)` admission
|
|
484
488
|
// states. Lets the queue tests assert the map empties on drain /
|
|
485
489
|
// dispose (no `KeyState` leak). Also off the public interface.
|
|
486
|
-
__keyStateSize: () => keyStates.size
|
|
490
|
+
__keyStateSize: () => keyStates.size
|
|
487
491
|
};
|
|
488
492
|
}
|
|
489
493
|
/**
|
|
@@ -496,17 +500,17 @@ function normalizePolicy(opts) {
|
|
|
496
500
|
let onOverflow;
|
|
497
501
|
if (opts.maxConcurrentPerModel !== undefined) {
|
|
498
502
|
maxConcurrent = opts.maxConcurrentPerModel;
|
|
499
|
-
onOverflow = opts.onOverflow ??
|
|
503
|
+
onOverflow = opts.onOverflow ?? 'queue';
|
|
500
504
|
}
|
|
501
505
|
else if (opts.oneAtATimePerModel === true) {
|
|
502
506
|
// Legacy alias: at most one in-flight per model, reject the rest.
|
|
503
507
|
maxConcurrent = 1;
|
|
504
|
-
onOverflow = opts.onOverflow ??
|
|
508
|
+
onOverflow = opts.onOverflow ?? 'reject';
|
|
505
509
|
}
|
|
506
510
|
else {
|
|
507
511
|
// Nothing configured (includes `oneAtATimePerModel: false`) ⇒ no gating.
|
|
508
512
|
maxConcurrent = Infinity;
|
|
509
|
-
onOverflow = opts.onOverflow ??
|
|
513
|
+
onOverflow = opts.onOverflow ?? 'queue';
|
|
510
514
|
}
|
|
511
515
|
// A finite limit below 1 would gate every request forever; clamp to the
|
|
512
516
|
// smallest sensible serial limit.
|
|
@@ -517,6 +521,7 @@ function normalizePolicy(opts) {
|
|
|
517
521
|
onOverflow,
|
|
518
522
|
maxQueueDepth: opts.maxQueueDepthPerModel ?? DEFAULT_MAX_QUEUE_DEPTH_PER_MODEL,
|
|
519
523
|
queueTimeoutMs: opts.queueTimeoutMs,
|
|
524
|
+
slotGroup: opts.sharedSlotGroup
|
|
520
525
|
};
|
|
521
526
|
}
|
|
522
527
|
/**
|
|
@@ -529,12 +534,12 @@ function normalizePolicy(opts) {
|
|
|
529
534
|
export const __requestRegistryTestHooks = {
|
|
530
535
|
cancelBeforeBeginMaxEntries: CANCEL_BEFORE_BEGIN_MAX_ENTRIES,
|
|
531
536
|
cancelBeforeBeginTtlMs: CANCEL_BEFORE_BEGIN_TTL_MS,
|
|
532
|
-
defaultMaxQueueDepthPerModel: DEFAULT_MAX_QUEUE_DEPTH_PER_MODEL
|
|
537
|
+
defaultMaxQueueDepthPerModel: DEFAULT_MAX_QUEUE_DEPTH_PER_MODEL
|
|
533
538
|
};
|
|
534
539
|
function derivedTerminalState(ctx) {
|
|
535
|
-
if (ctx.state ===
|
|
536
|
-
return
|
|
537
|
-
if (ctx.signal.aborted || ctx.state ===
|
|
538
|
-
return
|
|
539
|
-
return
|
|
540
|
+
if (ctx.state === 'failed')
|
|
541
|
+
return 'failed';
|
|
542
|
+
if (ctx.signal.aborted || ctx.state === 'cancelled')
|
|
543
|
+
return 'cancelled';
|
|
544
|
+
return 'completed';
|
|
540
545
|
}
|