@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,13 +1,13 @@
|
|
|
1
|
-
import { requestSchema, responseSchema, PROFILING_TRAILER_KEY
|
|
2
|
-
import { reconstructError } from
|
|
3
|
-
import { withTimeout, withTimeoutStream } from
|
|
4
|
-
import { getClientLogger, summarizeRequest } from
|
|
5
|
-
import { getRPC, close as closeRPC, createDuplexSession, getWorkerLifeSignal, } from
|
|
6
|
-
import { WorkerCrashedError, RequestValidationFailedError
|
|
7
|
-
import { formatZodError } from
|
|
8
|
-
import { z } from
|
|
9
|
-
import { nowMs, shouldProfile, shouldIncludeServerBreakdown, generateId as createProfileId, createProfilingMeta, createProfilingDisabledMeta, injectProfilingMetaIntoObject, extractProfilingMeta, stripProfilingMeta, recordFailure
|
|
10
|
-
import { createClientTimings, createClientStreamTimings, recordClientEvents, recordClientStreamEvents, cacheConnectionTime, flushConnectionTime, resetConnectionTracking
|
|
1
|
+
import { requestSchema, responseSchema, PROFILING_TRAILER_KEY } from '../../schemas/index.js';
|
|
2
|
+
import { reconstructError } from './rpc-error.js';
|
|
3
|
+
import { withTimeout, withTimeoutStream, OperationTimeoutError } from '../../utils/withTimeout.js';
|
|
4
|
+
import { getClientLogger, summarizeRequest } from '../../logging/index.js';
|
|
5
|
+
import { getRPC, close as closeRPC, createDuplexSession, getWorkerLifeSignal, notifyChannelClosed } from '#rpc';
|
|
6
|
+
import { WorkerCrashedError, RequestValidationFailedError } from '../../utils/errors-client.js';
|
|
7
|
+
import { formatZodError } from '../../utils/zod-error.js';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { nowMs, shouldProfile, shouldIncludeServerBreakdown, generateId as createProfileId, createProfilingMeta, createProfilingDisabledMeta, injectProfilingMetaIntoObject, extractProfilingMeta, stripProfilingMeta, recordFailure } from '../../profiling/index.js';
|
|
10
|
+
import { createClientTimings, createClientStreamTimings, recordClientEvents, recordClientStreamEvents, cacheConnectionTime, flushConnectionTime, resetConnectionTracking } from './profiling/index.js';
|
|
11
11
|
const logger = getClientLogger();
|
|
12
12
|
let rpcInstance = null;
|
|
13
13
|
let commandCounter = 0;
|
|
@@ -18,14 +18,14 @@ function getNextCommandId() {
|
|
|
18
18
|
}
|
|
19
19
|
function memberDiscriminator(option) {
|
|
20
20
|
const direct = option.shape?.type?.value;
|
|
21
|
-
if (typeof direct ===
|
|
21
|
+
if (typeof direct === 'string')
|
|
22
22
|
return direct;
|
|
23
23
|
const nested = option.options?.[0]?.shape?.type?.value;
|
|
24
|
-
return typeof nested ===
|
|
24
|
+
return typeof nested === 'string' ? nested : undefined;
|
|
25
25
|
}
|
|
26
26
|
function pinpointRequestError(request, fallback) {
|
|
27
27
|
const type = request?.type;
|
|
28
|
-
if (typeof type !==
|
|
28
|
+
if (typeof type !== 'string')
|
|
29
29
|
return fallback;
|
|
30
30
|
for (const option of requestSchema.options) {
|
|
31
31
|
if (memberDiscriminator(option) !== type)
|
|
@@ -47,9 +47,25 @@ function parseRequest(request) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
// Race in-flight reply/stream pulls against the worker-life signal ā
|
|
50
|
-
// bare-rpc's `_onerror`
|
|
51
|
-
//
|
|
50
|
+
// bare-rpc's `_onerror`/`_onclose` reject a pending reply or destroy a
|
|
51
|
+
// stream with its own generic `RPCError` (e.g. `CHANNEL_CLOSED`) as soon
|
|
52
|
+
// as the channel dies, which can beat the SDK's own crash detection
|
|
53
|
+
// (driven by the child process's `'exit'` event). Since `req.reply()` and
|
|
54
|
+
// response streams never reject with an application-level error ā those
|
|
55
|
+
// always arrive as a resolved payload handled by `checkAndThrowError` ā
|
|
56
|
+
// any rejection reaching these helpers other than our own `withTimeout`
|
|
57
|
+
// is transport failure. Under our IPC transport a channel close always
|
|
58
|
+
// means the worker is gone, so remapping it to the life signal's reason
|
|
59
|
+
// (or a generic crash if the signal hasn't fired yet) is safe.
|
|
60
|
+
//
|
|
61
|
+
// When we win that race, the life signal hasn't aborted yet, so nothing
|
|
62
|
+
// has invalidated the cached RPC connection ā the next call would reuse
|
|
63
|
+
// the same dead channel and fail again. `notifyChannelClosed()` tears it
|
|
64
|
+
// down eagerly instead of waiting on the slow exit event; it's a no-op
|
|
65
|
+
// once the signal is already aborted, so this is safe to call every time.
|
|
52
66
|
function lifeSignalAbortError(signal) {
|
|
67
|
+
if (!signal.aborted)
|
|
68
|
+
notifyChannelClosed();
|
|
53
69
|
if (signal.reason instanceof Error)
|
|
54
70
|
return signal.reason;
|
|
55
71
|
return new WorkerCrashedError(null, null);
|
|
@@ -59,31 +75,36 @@ async function awaitWithLifeSignal(p) {
|
|
|
59
75
|
const lifeSignal = getWorkerLifeSignal();
|
|
60
76
|
if (!lifeSignal)
|
|
61
77
|
return p;
|
|
62
|
-
if (lifeSignal.aborted)
|
|
78
|
+
if (lifeSignal.aborted) {
|
|
79
|
+
// `p` (e.g. `req.reply()`) may already be a rejected promise ā bare-rpc
|
|
80
|
+
// 1.3.8 rejects synchronously once its channel is closed. We're
|
|
81
|
+
// discarding it in favour of the life signal's classification, so give
|
|
82
|
+
// it a handler or its rejection surfaces as an unhandled rejection.
|
|
83
|
+
p.catch(() => { });
|
|
63
84
|
throw lifeSignalAbortError(lifeSignal);
|
|
85
|
+
}
|
|
64
86
|
return await new Promise((resolve, reject) => {
|
|
65
87
|
let settled = false;
|
|
66
88
|
const onAbort = () => {
|
|
67
89
|
if (settled)
|
|
68
90
|
return;
|
|
69
91
|
settled = true;
|
|
70
|
-
lifeSignal.removeEventListener(
|
|
92
|
+
lifeSignal.removeEventListener('abort', onAbort);
|
|
71
93
|
reject(lifeSignalAbortError(lifeSignal));
|
|
72
94
|
};
|
|
73
|
-
lifeSignal.addEventListener(
|
|
95
|
+
lifeSignal.addEventListener('abort', onAbort, { once: true });
|
|
74
96
|
p.then((value) => {
|
|
75
97
|
if (settled)
|
|
76
98
|
return;
|
|
77
99
|
settled = true;
|
|
78
|
-
lifeSignal.removeEventListener(
|
|
100
|
+
lifeSignal.removeEventListener('abort', onAbort);
|
|
79
101
|
resolve(value);
|
|
80
102
|
}, (err) => {
|
|
81
103
|
if (settled)
|
|
82
104
|
return;
|
|
83
105
|
settled = true;
|
|
84
|
-
lifeSignal.removeEventListener(
|
|
85
|
-
|
|
86
|
-
reject(err);
|
|
106
|
+
lifeSignal.removeEventListener('abort', onAbort);
|
|
107
|
+
reject(err instanceof OperationTimeoutError ? err : lifeSignalAbortError(lifeSignal));
|
|
87
108
|
});
|
|
88
109
|
});
|
|
89
110
|
}
|
|
@@ -105,23 +126,22 @@ async function* iterateWithLifeSignal(source) {
|
|
|
105
126
|
if (settled)
|
|
106
127
|
return;
|
|
107
128
|
settled = true;
|
|
108
|
-
lifeSignal.removeEventListener(
|
|
129
|
+
lifeSignal.removeEventListener('abort', onAbort);
|
|
109
130
|
reject(lifeSignalAbortError(lifeSignal));
|
|
110
131
|
};
|
|
111
|
-
lifeSignal.addEventListener(
|
|
132
|
+
lifeSignal.addEventListener('abort', onAbort, { once: true });
|
|
112
133
|
nextP.then((value) => {
|
|
113
134
|
if (settled)
|
|
114
135
|
return;
|
|
115
136
|
settled = true;
|
|
116
|
-
lifeSignal.removeEventListener(
|
|
137
|
+
lifeSignal.removeEventListener('abort', onAbort);
|
|
117
138
|
resolve(value);
|
|
118
139
|
}, (err) => {
|
|
119
140
|
if (settled)
|
|
120
141
|
return;
|
|
121
142
|
settled = true;
|
|
122
|
-
lifeSignal.removeEventListener(
|
|
123
|
-
|
|
124
|
-
reject(err);
|
|
143
|
+
lifeSignal.removeEventListener('abort', onAbort);
|
|
144
|
+
reject(err instanceof OperationTimeoutError ? err : lifeSignalAbortError(lifeSignal));
|
|
125
145
|
});
|
|
126
146
|
});
|
|
127
147
|
if (result.done)
|
|
@@ -139,7 +159,7 @@ async function* iterateWithLifeSignal(source) {
|
|
|
139
159
|
}
|
|
140
160
|
}
|
|
141
161
|
function checkAndThrowError(response) {
|
|
142
|
-
if (response.type ===
|
|
162
|
+
if (response.type === 'error') {
|
|
143
163
|
// Use the typed-error reconstructor map in `rpc-error.ts` so the
|
|
144
164
|
// original class (e.g. `RequestRejectedByPolicyError`) survives
|
|
145
165
|
// the RPC boundary intact and `err instanceof <Class>` works in
|
|
@@ -166,8 +186,8 @@ async function getRPCInstance() {
|
|
|
166
186
|
invalidateRPCInstance();
|
|
167
187
|
}
|
|
168
188
|
else if (lifeSignal) {
|
|
169
|
-
lifeSignal.addEventListener(
|
|
170
|
-
once: true
|
|
189
|
+
lifeSignal.addEventListener('abort', invalidateRPCInstance, {
|
|
190
|
+
once: true
|
|
171
191
|
});
|
|
172
192
|
}
|
|
173
193
|
if (connectionStart !== null && firstConnectionPending) {
|
|
@@ -198,15 +218,15 @@ export async function send(request, options, rpc) {
|
|
|
198
218
|
async function sendBase(request, rpc, options, signalDisable = false) {
|
|
199
219
|
const parsedRequest = parseRequest(request);
|
|
200
220
|
const req = rpc.request(getNextCommandId());
|
|
201
|
-
logger.debug(
|
|
221
|
+
logger.debug('RPC Client sending:', summarizeRequest(request));
|
|
202
222
|
const payloadObj = signalDisable
|
|
203
223
|
? injectProfilingMetaIntoObject(parsedRequest, createProfilingDisabledMeta())
|
|
204
224
|
: parsedRequest;
|
|
205
225
|
const payload = JSON.stringify(payloadObj);
|
|
206
|
-
req.send(payload,
|
|
207
|
-
const response = await awaitWithLifeSignal(withTimeout(req.reply(
|
|
208
|
-
const resPayload = responseSchema.parse(JSON.parse(response?.toString() ||
|
|
209
|
-
logger.debug(
|
|
226
|
+
req.send(payload, 'utf-8');
|
|
227
|
+
const response = await awaitWithLifeSignal(withTimeout(req.reply('utf-8'), options?.timeout));
|
|
228
|
+
const resPayload = responseSchema.parse(JSON.parse(response?.toString() || '{}'));
|
|
229
|
+
logger.debug('ResPayload', { type: resPayload.type });
|
|
210
230
|
checkAndThrowError(resPayload);
|
|
211
231
|
return resPayload;
|
|
212
232
|
}
|
|
@@ -220,18 +240,18 @@ async function sendProfiled(request, rpc, options) {
|
|
|
220
240
|
const parsedRequest = parseRequest(request);
|
|
221
241
|
timings.requestZodValidationMs = nowMs() - zodStart;
|
|
222
242
|
const req = rpc.request(getNextCommandId());
|
|
223
|
-
logger.debug(
|
|
243
|
+
logger.debug('RPC Client sending:', summarizeRequest(request));
|
|
224
244
|
const profilingMeta = createProfilingMeta(profileId, includeServer);
|
|
225
245
|
const requestWithMeta = injectProfilingMetaIntoObject(parsedRequest, profilingMeta);
|
|
226
246
|
const stringifyStart = nowMs();
|
|
227
247
|
const payload = JSON.stringify(requestWithMeta);
|
|
228
248
|
timings.requestStringifyMs = nowMs() - stringifyStart;
|
|
229
249
|
timings.sendStart = nowMs();
|
|
230
|
-
req.send(payload,
|
|
231
|
-
const response = await awaitWithLifeSignal(withTimeout(req.reply(
|
|
250
|
+
req.send(payload, 'utf-8');
|
|
251
|
+
const response = await awaitWithLifeSignal(withTimeout(req.reply('utf-8'), options?.timeout));
|
|
232
252
|
timings.firstResponseAt = nowMs();
|
|
233
253
|
const parseStart = nowMs();
|
|
234
|
-
const rawParsed = JSON.parse(response?.toString() ||
|
|
254
|
+
const rawParsed = JSON.parse(response?.toString() || '{}');
|
|
235
255
|
timings.responseJsonParseMs = nowMs() - parseStart;
|
|
236
256
|
const responseMeta = extractProfilingMeta(rawParsed);
|
|
237
257
|
const cleanPayload = stripProfilingMeta(rawParsed);
|
|
@@ -239,7 +259,7 @@ async function sendProfiled(request, rpc, options) {
|
|
|
239
259
|
const resPayload = responseSchema.parse(cleanPayload);
|
|
240
260
|
timings.responseZodValidationMs = nowMs() - zodValidateStart;
|
|
241
261
|
timings.requestEnd = nowMs();
|
|
242
|
-
logger.debug(
|
|
262
|
+
logger.debug('ResPayload', { type: resPayload.type });
|
|
243
263
|
recordClientEvents(timings, responseMeta);
|
|
244
264
|
checkAndThrowError(resPayload);
|
|
245
265
|
return resPayload;
|
|
@@ -249,8 +269,8 @@ async function sendProfiled(request, rpc, options) {
|
|
|
249
269
|
const base = {
|
|
250
270
|
ts: nowMs(),
|
|
251
271
|
op: timings.requestType,
|
|
252
|
-
kind:
|
|
253
|
-
profileId: timings.profileId
|
|
272
|
+
kind: 'rpc',
|
|
273
|
+
profileId: timings.profileId
|
|
254
274
|
};
|
|
255
275
|
recordFailure(base, timings.requestStart, error);
|
|
256
276
|
}
|
|
@@ -268,13 +288,13 @@ export async function* stream(request, options = {}, rpc) {
|
|
|
268
288
|
async function* streamBase(request, rpc, options = {}, signalDisable = false) {
|
|
269
289
|
const parsedRequest = parseRequest(request);
|
|
270
290
|
const req = rpc.request(getNextCommandId());
|
|
271
|
-
logger.debug(
|
|
291
|
+
logger.debug('RPC Client streaming:', summarizeRequest(request));
|
|
272
292
|
const payloadObj = signalDisable
|
|
273
293
|
? injectProfilingMetaIntoObject(parsedRequest, createProfilingDisabledMeta())
|
|
274
294
|
: parsedRequest;
|
|
275
|
-
req.send(JSON.stringify(payloadObj),
|
|
276
|
-
const responseStream = req.createResponseStream({ encoding:
|
|
277
|
-
let buffer =
|
|
295
|
+
req.send(JSON.stringify(payloadObj), 'utf-8');
|
|
296
|
+
const responseStream = req.createResponseStream({ encoding: 'utf-8' });
|
|
297
|
+
let buffer = '';
|
|
278
298
|
async function* processStream() {
|
|
279
299
|
for await (const chunk of responseStream) {
|
|
280
300
|
yield chunk;
|
|
@@ -284,8 +304,8 @@ async function* streamBase(request, rpc, options = {}, signalDisable = false) {
|
|
|
284
304
|
for await (const chunk of iterateWithLifeSignal(streamWithTimeout)) {
|
|
285
305
|
buffer += chunk.toString();
|
|
286
306
|
// Process complete lines (newline-delimited JSON)
|
|
287
|
-
const lines = buffer.split(
|
|
288
|
-
buffer = lines.pop() ||
|
|
307
|
+
const lines = buffer.split('\n');
|
|
308
|
+
buffer = lines.pop() || ''; // Keep incomplete line in buffer
|
|
289
309
|
for (const line of lines) {
|
|
290
310
|
if (line.trim()) {
|
|
291
311
|
const response = responseSchema.parse(JSON.parse(line));
|
|
@@ -306,16 +326,16 @@ async function* streamProfiled(request, rpc, options = {}) {
|
|
|
306
326
|
const parsedRequest = parseRequest(request);
|
|
307
327
|
timings.requestZodValidationMs = nowMs() - zodStart;
|
|
308
328
|
const req = rpc.request(getNextCommandId());
|
|
309
|
-
logger.debug(
|
|
329
|
+
logger.debug('RPC Client streaming:', summarizeRequest(request));
|
|
310
330
|
const requestMeta = createProfilingMeta(profileId, includeServer);
|
|
311
331
|
const requestWithMeta = injectProfilingMetaIntoObject(parsedRequest, requestMeta);
|
|
312
332
|
const stringifyStart = nowMs();
|
|
313
333
|
const payload = JSON.stringify(requestWithMeta);
|
|
314
334
|
timings.requestStringifyMs = nowMs() - stringifyStart;
|
|
315
335
|
timings.sendStart = nowMs();
|
|
316
|
-
req.send(payload,
|
|
317
|
-
const responseStream = req.createResponseStream({ encoding:
|
|
318
|
-
let buffer =
|
|
336
|
+
req.send(payload, 'utf-8');
|
|
337
|
+
const responseStream = req.createResponseStream({ encoding: 'utf-8' });
|
|
338
|
+
let buffer = '';
|
|
319
339
|
async function* processStream() {
|
|
320
340
|
for await (const chunk of responseStream) {
|
|
321
341
|
yield chunk;
|
|
@@ -329,8 +349,8 @@ async function* streamProfiled(request, rpc, options = {}) {
|
|
|
329
349
|
}
|
|
330
350
|
timings.lastChunkAt = chunkTime;
|
|
331
351
|
buffer += chunk.toString();
|
|
332
|
-
const lines = buffer.split(
|
|
333
|
-
buffer = lines.pop() ||
|
|
352
|
+
const lines = buffer.split('\n');
|
|
353
|
+
buffer = lines.pop() || '';
|
|
334
354
|
for (const line of lines) {
|
|
335
355
|
if (line.trim()) {
|
|
336
356
|
const rawParsed = JSON.parse(line);
|
|
@@ -354,8 +374,8 @@ async function* streamProfiled(request, rpc, options = {}) {
|
|
|
354
374
|
const base = {
|
|
355
375
|
ts: nowMs(),
|
|
356
376
|
op: timings.requestType,
|
|
357
|
-
kind:
|
|
358
|
-
profileId: timings.profileId
|
|
377
|
+
kind: 'rpc',
|
|
378
|
+
profileId: timings.profileId
|
|
359
379
|
};
|
|
360
380
|
recordFailure(base, timings.requestStart, error);
|
|
361
381
|
}
|
|
@@ -368,6 +388,27 @@ async function* streamProfiled(request, rpc, options = {}) {
|
|
|
368
388
|
}
|
|
369
389
|
}
|
|
370
390
|
}
|
|
391
|
+
// bare-rpc's own teardown can destroy the duplex streams with the raw
|
|
392
|
+
// transport error before the worker-life-signal's onAbort handler (in
|
|
393
|
+
// `createDuplexSession`) gets to destroy them with the classified one ā
|
|
394
|
+
// same race as the plain reply/stream paths above, so route consumption
|
|
395
|
+
// through the same remap.
|
|
396
|
+
function toAsyncGenerator(iterable) {
|
|
397
|
+
return (async function* () {
|
|
398
|
+
yield* iterable;
|
|
399
|
+
})();
|
|
400
|
+
}
|
|
401
|
+
function withLifeSignalDuplex(raw) {
|
|
402
|
+
const generator = iterateWithLifeSignal(toAsyncGenerator(raw));
|
|
403
|
+
return {
|
|
404
|
+
[Symbol.asyncIterator]() {
|
|
405
|
+
return generator[Symbol.asyncIterator]();
|
|
406
|
+
},
|
|
407
|
+
destroy() {
|
|
408
|
+
raw.destroy();
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
371
412
|
export async function duplex(request, options) {
|
|
372
413
|
const ctx = await prepareRPCContext(request.type, options?.profiling);
|
|
373
414
|
if (!ctx.profilingEnabled) {
|
|
@@ -377,7 +418,7 @@ export async function duplex(request, options) {
|
|
|
377
418
|
}
|
|
378
419
|
async function duplexBase(request, signalDisable, timeout) {
|
|
379
420
|
const parsedRequest = parseRequest(request);
|
|
380
|
-
logger.debug(
|
|
421
|
+
logger.debug('RPC Client duplex:', summarizeRequest(request));
|
|
381
422
|
const payloadObj = signalDisable
|
|
382
423
|
? injectProfilingMetaIntoObject(parsedRequest, createProfilingDisabledMeta())
|
|
383
424
|
: parsedRequest;
|
|
@@ -386,7 +427,7 @@ async function duplexBase(request, signalDisable, timeout) {
|
|
|
386
427
|
const session = await withTimeout(sessionPromise, timeout);
|
|
387
428
|
return {
|
|
388
429
|
requestStream: session.requestStream,
|
|
389
|
-
responseStream: session.responseStream
|
|
430
|
+
responseStream: withLifeSignalDuplex(session.responseStream)
|
|
390
431
|
};
|
|
391
432
|
}
|
|
392
433
|
async function duplexProfiled(request, options = {}) {
|
|
@@ -399,7 +440,7 @@ async function duplexProfiled(request, options = {}) {
|
|
|
399
440
|
const zodStart = nowMs();
|
|
400
441
|
const parsedRequest = parseRequest(request);
|
|
401
442
|
timings.requestZodValidationMs = nowMs() - zodStart;
|
|
402
|
-
logger.debug(
|
|
443
|
+
logger.debug('RPC Client duplex:', summarizeRequest(request));
|
|
403
444
|
const requestMeta = createProfilingMeta(profileId, includeServer);
|
|
404
445
|
const requestWithMeta = injectProfilingMetaIntoObject(parsedRequest, requestMeta);
|
|
405
446
|
const stringifyStart = nowMs();
|
|
@@ -413,16 +454,16 @@ async function duplexProfiled(request, options = {}) {
|
|
|
413
454
|
const base = {
|
|
414
455
|
ts: nowMs(),
|
|
415
456
|
op: timings.requestType,
|
|
416
|
-
kind:
|
|
417
|
-
profileId: timings.profileId
|
|
457
|
+
kind: 'rpc',
|
|
458
|
+
profileId: timings.profileId
|
|
418
459
|
};
|
|
419
460
|
recordFailure(base, timings.requestStart, error);
|
|
420
461
|
throw error;
|
|
421
462
|
}
|
|
422
463
|
let profilingMeta = undefined;
|
|
423
|
-
const rawReadable = session.responseStream;
|
|
464
|
+
const rawReadable = withLifeSignalDuplex(session.responseStream);
|
|
424
465
|
async function* profiledResponseStream() {
|
|
425
|
-
let lineBuffer =
|
|
466
|
+
let lineBuffer = '';
|
|
426
467
|
try {
|
|
427
468
|
for await (const chunk of rawReadable) {
|
|
428
469
|
const chunkTime = nowMs();
|
|
@@ -431,8 +472,8 @@ async function duplexProfiled(request, options = {}) {
|
|
|
431
472
|
}
|
|
432
473
|
timings.lastChunkAt = chunkTime;
|
|
433
474
|
lineBuffer += chunk.toString();
|
|
434
|
-
const lines = lineBuffer.split(
|
|
435
|
-
lineBuffer = lines.pop() ||
|
|
475
|
+
const lines = lineBuffer.split('\n');
|
|
476
|
+
lineBuffer = lines.pop() || '';
|
|
436
477
|
const outputParts = [];
|
|
437
478
|
for (const line of lines) {
|
|
438
479
|
if (!line.trim())
|
|
@@ -458,12 +499,12 @@ async function duplexProfiled(request, options = {}) {
|
|
|
458
499
|
if (outputParts.length > 0) {
|
|
459
500
|
timings.chunkCount += outputParts.length;
|
|
460
501
|
// Yield strings (not Buffer) ā RN/Hermes has no global `Buffer`; consumers call `.toString()` either way.
|
|
461
|
-
yield outputParts.join(
|
|
502
|
+
yield outputParts.join('\n') + '\n';
|
|
462
503
|
}
|
|
463
504
|
}
|
|
464
505
|
if (lineBuffer.trim()) {
|
|
465
506
|
timings.chunkCount++;
|
|
466
|
-
yield lineBuffer +
|
|
507
|
+
yield lineBuffer + '\n';
|
|
467
508
|
}
|
|
468
509
|
}
|
|
469
510
|
catch (error) {
|
|
@@ -471,8 +512,8 @@ async function duplexProfiled(request, options = {}) {
|
|
|
471
512
|
const base = {
|
|
472
513
|
ts: nowMs(),
|
|
473
514
|
op: timings.requestType,
|
|
474
|
-
kind:
|
|
475
|
-
profileId: timings.profileId
|
|
515
|
+
kind: 'rpc',
|
|
516
|
+
profileId: timings.profileId
|
|
476
517
|
};
|
|
477
518
|
recordFailure(base, timings.requestStart, error);
|
|
478
519
|
}
|
|
@@ -492,11 +533,11 @@ async function duplexProfiled(request, options = {}) {
|
|
|
492
533
|
},
|
|
493
534
|
destroy() {
|
|
494
535
|
rawReadable.destroy();
|
|
495
|
-
}
|
|
536
|
+
}
|
|
496
537
|
};
|
|
497
538
|
return {
|
|
498
539
|
requestStream: session.requestStream,
|
|
499
|
-
responseStream: wrappedResponseStream
|
|
540
|
+
responseStream: wrappedResponseStream
|
|
500
541
|
};
|
|
501
542
|
}
|
|
502
543
|
export async function close() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError
|
|
1
|
+
import { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError } from '../../utils/errors-server.js';
|
|
2
2
|
export class RPCError extends Error {
|
|
3
3
|
timestamp;
|
|
4
4
|
remoteStack;
|
|
@@ -15,7 +15,7 @@ export class RPCError extends Error {
|
|
|
15
15
|
this.isQvacError = true;
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
|
-
this.name =
|
|
18
|
+
this.name = 'RPCError';
|
|
19
19
|
this.isQvacError = false;
|
|
20
20
|
}
|
|
21
21
|
if (errorResponse.timestamp) {
|
|
@@ -34,7 +34,7 @@ export class RPCError extends Error {
|
|
|
34
34
|
stack: this.stack,
|
|
35
35
|
cause: this.cause,
|
|
36
36
|
timestamp: this.timestamp,
|
|
37
|
-
isQvacError: this.isQvacError
|
|
37
|
+
isQvacError: this.isQvacError
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -46,10 +46,12 @@ export class RPCError extends Error {
|
|
|
46
46
|
*/
|
|
47
47
|
function attachRemoteContext(err, response) {
|
|
48
48
|
if (response.stack) {
|
|
49
|
+
;
|
|
49
50
|
err.remoteStack = response.stack;
|
|
50
51
|
err.stack = `${err.stack}\n--- Worker Stack ---\n${response.stack}`;
|
|
51
52
|
}
|
|
52
53
|
if (response.timestamp) {
|
|
54
|
+
;
|
|
53
55
|
err.timestamp = response.timestamp;
|
|
54
56
|
}
|
|
55
57
|
return err;
|
|
@@ -57,17 +59,17 @@ function attachRemoteContext(err, response) {
|
|
|
57
59
|
/** Read a string field from the `typedFields` envelope, defaulting to `fallback` if missing or non-string. */
|
|
58
60
|
function readStringField(fields, key, fallback) {
|
|
59
61
|
const value = fields?.[key];
|
|
60
|
-
return typeof value ===
|
|
62
|
+
return typeof value === 'string' ? value : fallback;
|
|
61
63
|
}
|
|
62
64
|
/** Read a number field from the `typedFields` envelope, returning `undefined` if missing or non-number. */
|
|
63
65
|
function readOptionalNumberField(fields, key) {
|
|
64
66
|
const value = fields?.[key];
|
|
65
|
-
return typeof value ===
|
|
67
|
+
return typeof value === 'number' ? value : undefined;
|
|
66
68
|
}
|
|
67
69
|
/** Read a string field, returning `undefined` (not a fallback string) if missing. */
|
|
68
70
|
function readOptionalStringField(fields, key) {
|
|
69
71
|
const value = fields?.[key];
|
|
70
|
-
return typeof value ===
|
|
72
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
75
|
* Map of server-thrown `QvacErrorBase` subclasses that need to survive
|
|
@@ -100,17 +102,17 @@ function readOptionalStringField(fields, key) {
|
|
|
100
102
|
*/
|
|
101
103
|
const RECONSTRUCTORS = {
|
|
102
104
|
REQUEST_ID_CONFLICT: (response) => {
|
|
103
|
-
return new RequestIdConflictError(readStringField(response.typedFields,
|
|
105
|
+
return new RequestIdConflictError(readStringField(response.typedFields, 'requestId', ''), response.cause);
|
|
104
106
|
},
|
|
105
107
|
REQUEST_NOT_FOUND: (response) => {
|
|
106
|
-
return new RequestNotFoundError(readStringField(response.typedFields,
|
|
108
|
+
return new RequestNotFoundError(readStringField(response.typedFields, 'requestId', ''), response.cause);
|
|
107
109
|
},
|
|
108
110
|
REQUEST_REJECTED_BY_POLICY: (response) => {
|
|
109
|
-
return new RequestRejectedByPolicyError(readStringField(response.typedFields,
|
|
111
|
+
return new RequestRejectedByPolicyError(readStringField(response.typedFields, 'requestId', ''), readStringField(response.typedFields, 'kind', ''), readStringField(response.typedFields, 'modelId', ''), readStringField(response.typedFields, 'reason', response.message), response.cause);
|
|
110
112
|
},
|
|
111
113
|
CONTEXT_OVERFLOW: (response) => {
|
|
112
|
-
return new ContextOverflowError(readOptionalNumberField(response.typedFields,
|
|
113
|
-
}
|
|
114
|
+
return new ContextOverflowError(readOptionalNumberField(response.typedFields, 'promptTokens'), readOptionalNumberField(response.typedFields, 'ctxSize'), readOptionalStringField(response.typedFields, 'modelId'), response.cause);
|
|
115
|
+
}
|
|
114
116
|
};
|
|
115
117
|
/**
|
|
116
118
|
* Rebuild the original server-thrown typed error from its serialised
|
|
@@ -121,9 +123,7 @@ const RECONSTRUCTORS = {
|
|
|
121
123
|
* code-based predicates.
|
|
122
124
|
*/
|
|
123
125
|
export function reconstructError(response) {
|
|
124
|
-
const reconstructor = response.name
|
|
125
|
-
? RECONSTRUCTORS[response.name]
|
|
126
|
-
: undefined;
|
|
126
|
+
const reconstructor = response.name ? RECONSTRUCTORS[response.name] : undefined;
|
|
127
127
|
if (!reconstructor) {
|
|
128
128
|
return new RPCError(response);
|
|
129
129
|
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
3
|
-
import { createRequire } from
|
|
4
|
-
import { spawn } from
|
|
5
|
-
import { platform, execPath } from
|
|
6
|
-
import { BarePackNotInstalledError, BarePackError
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import { platform, execPath } from 'node:process';
|
|
6
|
+
import { BarePackNotInstalledError, BarePackError } from '../../utils/errors-client.js';
|
|
7
7
|
const require = createRequire(import.meta.url);
|
|
8
8
|
function resolveBarePackBin() {
|
|
9
9
|
try {
|
|
10
|
-
const barePackPkgPath = require.resolve(
|
|
10
|
+
const barePackPkgPath = require.resolve('bare-pack/package');
|
|
11
11
|
const barePackDir = path.dirname(barePackPkgPath);
|
|
12
|
-
return path.join(barePackDir,
|
|
12
|
+
return path.join(barePackDir, 'bin.js');
|
|
13
13
|
}
|
|
14
14
|
catch {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export async function runBarePack(options) {
|
|
19
|
-
const { entryPath, outputPath, hosts, importsMapPath, deferModules, quiet, logger
|
|
19
|
+
const { entryPath, outputPath, hosts, importsMapPath, deferModules, quiet, logger } = options;
|
|
20
20
|
const barePackBin = resolveBarePackBin();
|
|
21
21
|
if (!barePackBin || !fs.existsSync(barePackBin)) {
|
|
22
22
|
throw new BarePackNotInstalledError();
|
|
23
23
|
}
|
|
24
24
|
return new Promise((resolve, reject) => {
|
|
25
|
-
const hostArgs = hosts.flatMap((h) => [
|
|
26
|
-
const deferArgs = deferModules.flatMap((m) => [
|
|
25
|
+
const hostArgs = hosts.flatMap((h) => ['--host', h]);
|
|
26
|
+
const deferArgs = deferModules.flatMap((m) => ['--defer', m]);
|
|
27
27
|
const args = [
|
|
28
28
|
...hostArgs,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
'--linked',
|
|
30
|
+
'--imports',
|
|
31
31
|
importsMapPath,
|
|
32
32
|
...deferArgs,
|
|
33
|
-
|
|
33
|
+
'--out',
|
|
34
34
|
outputPath,
|
|
35
|
-
entryPath
|
|
35
|
+
entryPath
|
|
36
36
|
];
|
|
37
|
-
const isWindows = platform ===
|
|
37
|
+
const isWindows = platform === 'win32';
|
|
38
38
|
const command = isWindows ? execPath : barePackBin;
|
|
39
39
|
const spawnArgs = isWindows ? [barePackBin, ...args] : args;
|
|
40
|
-
logger.debug(`\nš¦ Running: ${command} ${spawnArgs.join(
|
|
40
|
+
logger.debug(`\nš¦ Running: ${command} ${spawnArgs.join(' ')}`);
|
|
41
41
|
const proc = spawn(command, spawnArgs, {
|
|
42
|
-
stdio: quiet ?
|
|
42
|
+
stdio: quiet ? 'ignore' : 'inherit'
|
|
43
43
|
});
|
|
44
|
-
proc.on(
|
|
44
|
+
proc.on('close', (code) => {
|
|
45
45
|
if (code === 0) {
|
|
46
46
|
resolve();
|
|
47
47
|
}
|
|
@@ -49,6 +49,6 @@ export async function runBarePack(options) {
|
|
|
49
49
|
reject(new BarePackError(code ?? 1, entryPath, outputPath));
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
proc.on(
|
|
52
|
+
proc.on('error', reject);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
export const BUILTIN_PLUGINS = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
'llamacpp-completion': { exportName: 'llmPlugin' },
|
|
3
|
+
'llamacpp-embedding': { exportName: 'embeddingsPlugin' },
|
|
4
|
+
'whispercpp-transcription': { exportName: 'whisperPlugin' },
|
|
5
|
+
'bci-whispercpp-transcription': { exportName: 'bciPlugin' },
|
|
6
|
+
'parakeet-transcription': { exportName: 'parakeetPlugin' },
|
|
7
|
+
'nmtcpp-translation': { exportName: 'nmtPlugin' },
|
|
8
|
+
'tts-ggml': { exportName: 'ttsPlugin' },
|
|
9
|
+
'ggml-ocr': { exportName: 'ocrPlugin' },
|
|
10
|
+
'sdcpp-generation': { exportName: 'diffusionPlugin' },
|
|
11
|
+
'ggml-vla': { exportName: 'vlaPlugin' },
|
|
12
|
+
'ggml-classification': { exportName: 'classificationPlugin' }
|
|
13
13
|
};
|
|
14
14
|
export const BUILTIN_SUFFIXES = Object.keys(BUILTIN_PLUGINS);
|
|
15
15
|
export const DEFAULT_HOSTS = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
'darwin-arm64',
|
|
17
|
+
'darwin-x64',
|
|
18
|
+
'linux-arm64',
|
|
19
|
+
'linux-x64',
|
|
20
|
+
'win32-x64',
|
|
21
|
+
'android-arm64',
|
|
22
|
+
'ios-arm64',
|
|
23
|
+
'ios-arm64-simulator',
|
|
24
|
+
'ios-x64-simulator'
|
|
25
25
|
];
|
|
26
|
-
export const DEFAULT_SDK_NAME =
|
|
26
|
+
export const DEFAULT_SDK_NAME = '@qvac/sdk';
|