@qvac/sdk 0.10.2 → 0.12.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 +1455 -29
- package/README.md +2 -0
- package/dist/client/api/cancel.d.ts +24 -32
- package/dist/client/api/cancel.js +58 -31
- package/dist/client/api/classify.d.ts +23 -0
- package/dist/client/api/classify.js +43 -0
- package/dist/client/api/client-request-id.d.ts +17 -0
- package/dist/client/api/client-request-id.js +27 -0
- package/dist/client/api/completion-stream.d.ts +1 -1
- package/dist/client/api/completion-stream.js +34 -3
- package/dist/client/api/diffusion.d.ts +46 -0
- package/dist/client/api/diffusion.js +50 -1
- package/dist/client/api/download-asset.d.ts +12 -2
- package/dist/client/api/download-asset.js +21 -3
- package/dist/client/api/embed.d.ts +8 -4
- package/dist/client/api/embed.js +14 -1
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/index.d.ts +5 -0
- package/dist/client/api/index.js +5 -0
- package/dist/client/api/load-model.d.ts +12 -4
- package/dist/client/api/load-model.js +49 -2
- package/dist/client/api/rag.d.ts +9 -3
- package/dist/client/api/rag.js +23 -3
- package/dist/client/api/transcribe.d.ts +23 -8
- package/dist/client/api/transcribe.js +69 -4
- package/dist/client/api/unload-model.d.ts +5 -2
- package/dist/client/api/unload-model.js +9 -4
- package/dist/client/api/upscale.d.ts +45 -0
- package/dist/client/api/upscale.js +99 -0
- package/dist/client/api/video.d.ts +64 -0
- package/dist/client/api/video.js +147 -0
- package/dist/client/api/vla-helpers.d.ts +45 -0
- package/dist/client/api/vla-helpers.js +130 -0
- package/dist/client/api/vla.d.ts +65 -0
- package/dist/client/api/vla.js +109 -0
- package/dist/client/config-loader/resolve-config.node.d.ts +16 -0
- package/dist/client/config-loader/resolve-config.node.js +77 -23
- package/dist/client/plugins-factory.d.ts +8 -0
- package/dist/client/plugins-factory.js +10 -0
- package/dist/client/rpc/bare-client.js +62 -66
- package/dist/client/rpc/ensure-worker-ready.d.ts +9 -0
- package/dist/client/rpc/ensure-worker-ready.js +17 -0
- package/dist/client/rpc/expo-rpc-client.js +2 -1
- package/dist/client/rpc/node-rpc-client.js +22 -8
- package/dist/client/rpc/rpc-client.d.ts +2 -2
- package/dist/client/rpc/rpc-client.js +10 -4
- package/dist/client/rpc/rpc-error.d.ts +9 -0
- package/dist/client/rpc/rpc-error.js +105 -0
- package/dist/commands/bundle/bare-pack.d.ts +13 -0
- package/dist/commands/bundle/bare-pack.js +54 -0
- package/dist/commands/bundle/constants.d.ts +7 -0
- package/dist/commands/bundle/constants.js +23 -0
- package/dist/commands/bundle/entry-gen.d.ts +2 -0
- package/dist/commands/bundle/entry-gen.js +48 -0
- package/dist/commands/bundle/index.d.ts +20 -0
- package/dist/commands/bundle/index.js +141 -0
- package/dist/commands/bundle/manifest.d.ts +21 -0
- package/dist/commands/bundle/manifest.js +193 -0
- package/dist/commands/bundle/plugins.d.ts +9 -0
- package/dist/commands/bundle/plugins.js +51 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/verify/abi.d.ts +52 -0
- package/dist/commands/verify/abi.js +125 -0
- package/dist/commands/verify/addon-source.d.ts +43 -0
- package/dist/commands/verify/addon-source.js +75 -0
- package/dist/commands/verify/bundle-source.d.ts +12 -0
- package/dist/commands/verify/bundle-source.js +53 -0
- package/dist/commands/verify/index.d.ts +59 -0
- package/dist/commands/verify/index.js +371 -0
- package/dist/commands/verify/node-modules-source.d.ts +11 -0
- package/dist/commands/verify/node-modules-source.js +76 -0
- package/dist/commands/verify/prebuilds.d.ts +15 -0
- package/dist/commands/verify/prebuilds.js +39 -0
- package/dist/examples/cancel-by-request-id.d.ts +38 -0
- package/dist/examples/cancel-by-request-id.js +103 -0
- package/dist/examples/classification/classify-image.d.ts +2 -0
- package/dist/examples/classification/classify-image.js +23 -0
- package/dist/examples/diffusion-esrgan-upscale.d.ts +2 -0
- package/dist/examples/diffusion-esrgan-upscale.js +78 -0
- package/dist/examples/diffusion-txt2vid.d.ts +2 -0
- package/dist/examples/diffusion-txt2vid.js +81 -0
- package/dist/examples/download-with-cancel.js +10 -10
- package/dist/examples/embed-multi-gpu.d.ts +2 -0
- package/dist/examples/embed-multi-gpu.js +46 -0
- package/dist/examples/llamacpp-multi-gpu.d.ts +2 -0
- package/dist/examples/llamacpp-multi-gpu.js +57 -0
- package/dist/examples/plugins.js +3 -7
- package/dist/examples/rag/rag-hyperdb/cancellation.js +20 -17
- package/dist/examples/tools/llamacpp-tools-gemma4.d.ts +2 -0
- package/dist/examples/tools/llamacpp-tools-gemma4.js +73 -0
- package/dist/examples/tools/llamacpp-tools-qwen35.d.ts +2 -0
- package/dist/examples/tools/llamacpp-tools-qwen35.js +69 -0
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +18 -12
- package/dist/examples/transcription/parakeet-microphone-record.js +7 -12
- package/dist/examples/transcription/parakeet-microphone-stream.d.ts +2 -0
- package/dist/examples/transcription/parakeet-microphone-stream.js +79 -0
- package/dist/examples/transcription/parakeet-sortformer-streaming.d.ts +2 -0
- package/dist/examples/transcription/parakeet-sortformer-streaming.js +121 -0
- package/dist/examples/transcription/parakeet-sortformer.js +58 -55
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +18 -15
- package/dist/examples/transcription/whispercpp-microphone-conversation.d.ts +2 -0
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +107 -0
- package/dist/examples/tts/chatterbox.js +7 -16
- package/dist/examples/tts/llm-to-tts-streaming.js +3 -10
- package/dist/examples/tts/supertonic-multilingual.js +4 -12
- package/dist/examples/tts/supertonic.js +5 -12
- package/dist/examples/vla-smolvla.d.ts +2 -0
- package/dist/examples/vla-smolvla.js +75 -0
- package/dist/examples/voice-assistant/voice-assistant.js +3 -10
- package/dist/expo/plugins/find-in-ancestor-node-modules.d.ts +14 -0
- package/dist/expo/plugins/find-in-ancestor-node-modules.js +24 -0
- package/dist/expo/plugins/get-project-root.d.ts +22 -0
- package/dist/expo/plugins/get-project-root.js +23 -0
- package/dist/expo/plugins/index.d.ts +4 -0
- package/dist/expo/plugins/index.js +4 -0
- package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +9 -2
- package/dist/expo/plugins/resolve-sdk-package-dir.js +38 -11
- package/dist/expo/plugins/withDeviceInfo.js +2 -1
- package/dist/expo/plugins/withMobileBundle.d.ts +5 -4
- package/dist/expo/plugins/withMobileBundle.js +42 -58
- package/dist/index.d.ts +6 -2
- package/dist/index.js +23 -2
- package/dist/models/registry/models.d.ts +3725 -514
- package/dist/models/registry/models.js +7269 -3910
- package/dist/models/update-models/naming.js +22 -8
- package/dist/pear/pre.d.ts +3 -0
- package/dist/pear/pre.js +9 -2
- package/dist/schemas/cancel.d.ts +172 -28
- package/dist/schemas/cancel.js +120 -19
- package/dist/schemas/classification.d.ts +53 -0
- package/dist/schemas/classification.js +33 -0
- package/dist/schemas/common.d.ts +860 -1379
- package/dist/schemas/common.js +8 -1
- package/dist/schemas/completion-event.d.ts +17 -0
- package/dist/schemas/completion-event.js +12 -1
- package/dist/schemas/completion-stream.d.ts +16 -1
- package/dist/schemas/completion-stream.js +25 -7
- package/dist/schemas/download-asset.d.ts +25 -9
- package/dist/schemas/download-asset.js +17 -6
- package/dist/schemas/embed.d.ts +1 -0
- package/dist/schemas/embed.js +5 -0
- package/dist/schemas/engine-addon-map.d.ts +3 -0
- package/dist/schemas/engine-addon-map.js +18 -5
- package/dist/schemas/error.d.ts +31 -0
- package/dist/schemas/error.js +29 -1
- package/dist/schemas/finetune.d.ts +2 -0
- package/dist/schemas/finetune.js +5 -0
- package/dist/schemas/get-model-info.d.ts +10 -6
- package/dist/schemas/get-model-info.js +2 -0
- package/dist/schemas/index.d.ts +3 -0
- package/dist/schemas/index.js +3 -0
- package/dist/schemas/llamacpp-config.d.ts +64 -8
- package/dist/schemas/llamacpp-config.js +12 -0
- package/dist/schemas/load-model.d.ts +4644 -8605
- package/dist/schemas/load-model.js +90 -7
- package/dist/schemas/model-src-utils.d.ts +34 -14
- package/dist/schemas/model-types.d.ts +54 -14
- package/dist/schemas/model-types.js +28 -5
- package/dist/schemas/ocr.d.ts +8 -3
- package/dist/schemas/plugin.d.ts +60 -6
- package/dist/schemas/plugin.js +31 -5
- package/dist/schemas/rag.d.ts +9 -0
- package/dist/schemas/rag.js +17 -9
- package/dist/schemas/registry.d.ts +74 -30
- package/dist/schemas/registry.js +5 -0
- package/dist/schemas/reload-config.d.ts +34 -14
- package/dist/schemas/sdcpp-config.d.ts +445 -16
- package/dist/schemas/sdcpp-config.js +387 -26
- package/dist/schemas/sdk-config.d.ts +2431 -2723
- package/dist/schemas/sdk-config.js +16 -1
- package/dist/schemas/sdk-errors-client.d.ts +6 -0
- package/dist/schemas/sdk-errors-client.js +31 -1
- package/dist/schemas/sdk-errors-server.d.ts +8 -1
- package/dist/schemas/sdk-errors-server.js +45 -5
- package/dist/schemas/text-to-speech.d.ts +81 -698
- package/dist/schemas/text-to-speech.js +46 -19
- package/dist/schemas/transcription-config.d.ts +40 -229
- package/dist/schemas/transcription-config.js +76 -15
- package/dist/schemas/transcription.d.ts +108 -2
- package/dist/schemas/transcription.js +81 -0
- package/dist/schemas/translate.d.ts +2 -0
- package/dist/schemas/translate.js +13 -2
- package/dist/schemas/translation-config.d.ts +90 -40
- package/dist/schemas/unload-model.d.ts +2 -1
- package/dist/schemas/unload-model.js +4 -1
- package/dist/schemas/vla.d.ts +87 -0
- package/dist/schemas/vla.js +108 -0
- package/dist/scripts/run-unit-tests.js +22 -3
- package/dist/server/bare/ops/cancel.d.ts +27 -1
- package/dist/server/bare/ops/cancel.js +36 -10
- package/dist/server/bare/ops/embed.d.ts +3 -3
- package/dist/server/bare/ops/embed.js +144 -28
- package/dist/server/bare/ops/kv-cache-utils.d.ts +0 -7
- package/dist/server/bare/ops/kv-cache-utils.js +8 -47
- package/dist/server/bare/ops/transcribe.d.ts +11 -5
- package/dist/server/bare/ops/transcribe.js +230 -50
- package/dist/server/bare/ops/translate.d.ts +1 -1
- package/dist/server/bare/ops/translate.js +197 -88
- package/dist/server/bare/plugins/ggml-classification/ops/classify.d.ts +6 -0
- package/dist/server/bare/plugins/ggml-classification/ops/classify.js +30 -0
- package/dist/server/bare/plugins/ggml-classification/plugin.d.ts +32 -0
- package/dist/server/bare/plugins/ggml-classification/plugin.js +55 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.js +12 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +75 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +54 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.js +57 -0
- package/dist/server/bare/plugins/index.d.ts +3 -1
- package/dist/server/bare/plugins/index.js +3 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +12 -3
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +173 -172
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.d.ts +29 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.js +65 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +125 -21
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.d.ts +154 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.js +448 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +21 -73
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +18 -101
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +36 -3
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +183 -85
- package/dist/server/bare/plugins/llamacpp-completion/transform.d.ts +10 -0
- package/dist/server/bare/plugins/llamacpp-completion/transform.js +34 -0
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +7 -0
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +10 -1
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +42 -15
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +5 -1
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +8 -3
- package/dist/server/bare/plugins/onnx-ocr/plugin.js +3 -0
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +73 -244
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +68 -96
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +8 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.d.ts +3 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.js +40 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.d.ts +3 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +199 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +288 -15
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +150 -7
- package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.js +2 -15
- package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.js +2 -1
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +75 -0
- package/dist/server/bare/plugins/tts-ggml/plugin.js +189 -0
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +47 -3
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +61 -14
- package/dist/server/bare/rag-hyperdb/index.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/index.js +1 -1
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.d.ts +26 -4
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +65 -28
- package/dist/server/bare/registry/model-config-utils.js +7 -0
- package/dist/server/bare/runtime/disposable-scope.d.ts +36 -0
- package/dist/server/bare/runtime/disposable-scope.js +69 -0
- package/dist/server/bare/runtime/index.d.ts +8 -0
- package/dist/server/bare/runtime/index.js +3 -0
- package/dist/server/bare/runtime/request-context.d.ts +49 -0
- package/dist/server/bare/runtime/request-context.js +1 -0
- package/dist/server/bare/runtime/request-id.d.ts +12 -0
- package/dist/server/bare/runtime/request-id.js +14 -0
- package/dist/server/bare/runtime/request-registry-singleton.d.ts +4 -0
- package/dist/server/bare/runtime/request-registry-singleton.js +27 -0
- package/dist/server/bare/runtime/request-registry.d.ts +136 -0
- package/dist/server/bare/runtime/request-registry.js +297 -0
- package/dist/server/bare/runtime/with-request-context.d.ts +22 -0
- package/dist/server/bare/runtime/with-request-context.js +53 -0
- package/dist/server/bare/runtime-lifecycle.js +9 -9
- package/dist/server/bare/types/addon-responses.d.ts +12 -1
- package/dist/server/env.js +4 -1
- 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 -0
- package/dist/server/plugins/registry.js +5 -0
- package/dist/server/rpc/handler-registry.js +30 -7
- package/dist/server/rpc/handler-selection.d.ts +9 -0
- package/dist/server/rpc/handler-selection.js +14 -0
- package/dist/server/rpc/handler-utils.js +5 -13
- package/dist/server/rpc/handlers/cancel-delegated.js +28 -31
- package/dist/server/rpc/handlers/cancelHandler.d.ts +30 -1
- package/dist/server/rpc/handlers/cancelHandler.js +54 -22
- package/dist/server/rpc/handlers/classify.d.ts +3 -0
- package/dist/server/rpc/handlers/classify.js +4 -0
- package/dist/server/rpc/handlers/delete-cache.d.ts +9 -0
- package/dist/server/rpc/handlers/delete-cache.js +13 -15
- package/dist/server/rpc/handlers/download-asset.js +133 -40
- package/dist/server/rpc/handlers/index.d.ts +4 -0
- package/dist/server/rpc/handlers/index.js +4 -0
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +60 -2
- package/dist/server/rpc/handlers/load-model/download-manager.js +141 -8
- package/dist/server/rpc/handlers/load-model/handler.js +216 -98
- package/dist/server/rpc/handlers/load-model/http.js +3 -3
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +1 -1
- package/dist/server/rpc/handlers/load-model/registry.js +1 -1
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +20 -1
- package/dist/server/rpc/handlers/load-model/resolve-session.js +6 -5
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -2
- package/dist/server/rpc/handlers/load-model/resolve.js +18 -6
- package/dist/server/rpc/handlers/load-model/types.d.ts +24 -0
- package/dist/server/rpc/handlers/rag.js +133 -15
- package/dist/server/rpc/handlers/upscale-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/upscale-stream.js +4 -0
- package/dist/server/rpc/handlers/video-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/video-stream.js +4 -0
- package/dist/server/rpc/profiling/operation-metrics.js +23 -0
- package/dist/server/utils/completion-normalizer.js +8 -0
- package/dist/server/utils/config-transform.js +1 -1
- package/dist/server/utils/tools/dialect.js +4 -0
- package/dist/server/utils/tools/parser.js +16 -1
- package/dist/server/utils/tools/parsers/gemma4native.d.ts +4 -0
- package/dist/server/utils/tools/parsers/gemma4native.js +60 -0
- package/dist/server/utils/tools/parsers/qwen35.d.ts +4 -0
- package/dist/server/utils/tools/parsers/qwen35.js +120 -0
- package/dist/server/worker.js +14 -11
- package/dist/utils/aggregate-events.d.ts +9 -0
- package/dist/utils/aggregate-events.js +18 -3
- package/dist/utils/decorate-promise.d.ts +34 -0
- package/dist/utils/decorate-promise.js +35 -0
- package/dist/utils/errors-client.d.ts +18 -0
- package/dist/utils/errors-client.js +31 -0
- package/dist/utils/errors-server.d.ts +115 -2
- package/dist/utils/errors-server.js +148 -3
- package/package.json +68 -77
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -490
- package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -266
- package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
- package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
- /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.d.ts +0 -0
- /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.d.ts +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SmolVLA (vision-language-action) example using the QVAC SDK.
|
|
3
|
+
*
|
|
4
|
+
* Loads the SmolVLA-LIBERO GGUF model, runs a single inference pass with
|
|
5
|
+
* synthetic inputs (zero-filled gray images + BOS-only tokens + zero state +
|
|
6
|
+
* zero noise), and prints the produced action chunk + per-stage timings.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* bun examples/vla-smolvla.ts [path-to-smolvla.gguf]
|
|
10
|
+
*
|
|
11
|
+
* By default the example pulls the registry-baked SmolVLA-LIBERO GGUF
|
|
12
|
+
* (~1.9 GB) on first run and caches it locally. Pass an absolute path on
|
|
13
|
+
* the command line to override and load a local GGUF instead.
|
|
14
|
+
*/
|
|
15
|
+
import { close, loadModel, SMOLVLA_LIBERO_VISION_Q8, unloadModel, vla, vlaHparams, vlaPadState, vlaPreprocessImage, } from "@qvac/sdk";
|
|
16
|
+
const modelSrcOverride = process.argv[2];
|
|
17
|
+
const modelSrc = modelSrcOverride ?? SMOLVLA_LIBERO_VISION_Q8;
|
|
18
|
+
try {
|
|
19
|
+
console.log("Loading SmolVLA model...");
|
|
20
|
+
const modelId = await loadModel({
|
|
21
|
+
modelSrc,
|
|
22
|
+
modelType: "vla",
|
|
23
|
+
modelConfig: { backend: "cpu" },
|
|
24
|
+
onProgress: (p) => typeof modelSrc === "string"
|
|
25
|
+
? undefined
|
|
26
|
+
: process.stdout.write(`\rDownloading: ${p.percentage.toFixed(1)}%`),
|
|
27
|
+
});
|
|
28
|
+
if (typeof modelSrc !== "string")
|
|
29
|
+
process.stdout.write("\n");
|
|
30
|
+
console.log(`Model loaded: ${modelId}`);
|
|
31
|
+
const { hparams, backendName } = await vlaHparams({ modelId });
|
|
32
|
+
console.log(`Backend: ${backendName ?? "(unknown)"}`);
|
|
33
|
+
console.log("Hparams:", hparams);
|
|
34
|
+
// Build synthetic inputs sized to the model's expectations. A real
|
|
35
|
+
// consumer would: read camera frames, tokenize the instruction with the
|
|
36
|
+
// SmolVLM2 tokenizer, and read the robot's current end-effector pose.
|
|
37
|
+
const size = hparams.visionImageSize;
|
|
38
|
+
const dummyPixels = new Uint8Array(size * size * 3).fill(128);
|
|
39
|
+
const front = vlaPreprocessImage(dummyPixels, size, size, { size });
|
|
40
|
+
const wrist = vlaPreprocessImage(dummyPixels, size, size, { size });
|
|
41
|
+
const tokens = new Int32Array(hparams.tokenizerMaxLength);
|
|
42
|
+
const mask = new Uint8Array(hparams.tokenizerMaxLength);
|
|
43
|
+
// BOS-only "instruction" for the smoke test.
|
|
44
|
+
tokens[0] = 1;
|
|
45
|
+
mask[0] = 1;
|
|
46
|
+
const state = vlaPadState([0, 0, 0, 0, 0, 0], hparams.maxStateDim);
|
|
47
|
+
const noise = new Float32Array(hparams.chunkSize * hparams.maxActionDim);
|
|
48
|
+
console.log("Running VLA inference...");
|
|
49
|
+
const { actions, actionDim, chunkSize, stats } = await vla({
|
|
50
|
+
modelId,
|
|
51
|
+
images: [front, wrist],
|
|
52
|
+
imgWidth: size,
|
|
53
|
+
imgHeight: size,
|
|
54
|
+
state,
|
|
55
|
+
tokens,
|
|
56
|
+
mask,
|
|
57
|
+
noise,
|
|
58
|
+
});
|
|
59
|
+
console.log(`Got ${chunkSize} action steps of dim ${actionDim}.`);
|
|
60
|
+
console.log("First step:", Array.from(actions.subarray(0, actionDim)));
|
|
61
|
+
if (stats) {
|
|
62
|
+
console.log(`Timing: vision=${stats.vision_ms?.toFixed(0)}ms ` +
|
|
63
|
+
`smollm2=${stats.smollm2_total_ms?.toFixed(0)}ms ` +
|
|
64
|
+
`ode=${stats.ode_ms?.toFixed(0)}ms ` +
|
|
65
|
+
`total=${stats.total_ms?.toFixed(0)}ms`);
|
|
66
|
+
}
|
|
67
|
+
await unloadModel({ modelId, clearStorage: false });
|
|
68
|
+
console.log("Model unloaded.");
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.error("VLA example failed:", error);
|
|
73
|
+
await close();
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Requirements: FFmpeg installed, microphone access, speakers.
|
|
12
12
|
*/
|
|
13
|
-
import { loadModel, unloadModel, transcribeStream, completion, textToSpeech, WHISPER_TINY, VAD_SILERO_5_1_2, LLAMA_3_2_1B_INST_Q4_0,
|
|
13
|
+
import { loadModel, unloadModel, transcribeStream, completion, textToSpeech, WHISPER_TINY, VAD_SILERO_5_1_2, LLAMA_3_2_1B_INST_Q4_0, TTS_EN_SUPERTONIC_Q8_0, } from "@qvac/sdk";
|
|
14
14
|
import { spawnSync } from "child_process";
|
|
15
15
|
import { startMicrophone } from "../audio/mic-input";
|
|
16
16
|
import { createWavHeader, int16ArrayToBuffer, playAudio } from "../tts/utils";
|
|
@@ -100,21 +100,14 @@ const llmModelId = await loadModel({
|
|
|
100
100
|
});
|
|
101
101
|
console.log("Loading Supertonic TTS...");
|
|
102
102
|
const ttsModelId = await loadModel({
|
|
103
|
-
modelSrc:
|
|
103
|
+
modelSrc: TTS_EN_SUPERTONIC_Q8_0.src,
|
|
104
104
|
modelType: "tts",
|
|
105
105
|
modelConfig: {
|
|
106
106
|
ttsEngine: "supertonic",
|
|
107
107
|
language: "en",
|
|
108
|
+
voice: "F1",
|
|
108
109
|
ttsSpeed: 1.05,
|
|
109
110
|
ttsNumInferenceSteps: 5,
|
|
110
|
-
ttsSupertonicMultilingual: false,
|
|
111
|
-
ttsTextEncoderSrc: TTS_SUPERTONIC2_OFFICIAL_TEXT_ENCODER_SUPERTONE_FP32.src,
|
|
112
|
-
ttsDurationPredictorSrc: TTS_SUPERTONIC2_OFFICIAL_DURATION_PREDICTOR_SUPERTONE_FP32.src,
|
|
113
|
-
ttsVectorEstimatorSrc: TTS_SUPERTONIC2_OFFICIAL_VECTOR_ESTIMATOR_SUPERTONE_FP32.src,
|
|
114
|
-
ttsVocoderSrc: TTS_SUPERTONIC2_OFFICIAL_VOCODER_SUPERTONE_FP32.src,
|
|
115
|
-
ttsUnicodeIndexerSrc: TTS_SUPERTONIC2_OFFICIAL_UNICODE_INDEXER_SUPERTONE_FP32.src,
|
|
116
|
-
ttsTtsConfigSrc: TTS_SUPERTONIC2_OFFICIAL_TTS_CONFIG_SUPERTONE.src,
|
|
117
|
-
ttsVoiceStyleSrc: TTS_SUPERTONIC2_OFFICIAL_VOICE_STYLE_SUPERTONE.src,
|
|
118
111
|
},
|
|
119
112
|
});
|
|
120
113
|
console.log("All models loaded.\n");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walks from `startDir` up to the filesystem root, returning the first
|
|
3
|
+
* `<dir>/node_modules/<name>` that exists, or `null`. Matches Node's own
|
|
4
|
+
* module resolution so packages hoisted to a monorepo root (e.g. by bun or
|
|
5
|
+
* yarn workspaces) are found from a nested project directory.
|
|
6
|
+
*
|
|
7
|
+
* Use this as the building block for any plugin lookup that historically
|
|
8
|
+
* checked only `<projectRoot>/node_modules`. For SDK resolution specifically
|
|
9
|
+
* use `resolveSDKPackageDir`, which layers multi-package disambiguation and
|
|
10
|
+
* shadowed-copy warnings on top of this.
|
|
11
|
+
*/
|
|
12
|
+
declare function findInAncestorNodeModules(startDir: string, name: string): string | null;
|
|
13
|
+
export { findInAncestorNodeModules };
|
|
14
|
+
//# sourceMappingURL=find-in-ancestor-node-modules.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Walks from `startDir` up to the filesystem root, returning the first
|
|
5
|
+
* `<dir>/node_modules/<name>` that exists, or `null`. Matches Node's own
|
|
6
|
+
* module resolution so packages hoisted to a monorepo root (e.g. by bun or
|
|
7
|
+
* yarn workspaces) are found from a nested project directory.
|
|
8
|
+
*
|
|
9
|
+
* Use this as the building block for any plugin lookup that historically
|
|
10
|
+
* checked only `<projectRoot>/node_modules`. For SDK resolution specifically
|
|
11
|
+
* use `resolveSDKPackageDir`, which layers multi-package disambiguation and
|
|
12
|
+
* shadowed-copy warnings on top of this.
|
|
13
|
+
*/
|
|
14
|
+
function findInAncestorNodeModules(startDir, name) {
|
|
15
|
+
let dir = startDir;
|
|
16
|
+
let parent = path.dirname(dir);
|
|
17
|
+
for (; dir !== parent; dir = parent, parent = path.dirname(dir)) {
|
|
18
|
+
const candidate = path.join(dir, "node_modules", name);
|
|
19
|
+
if (fs.existsSync(candidate))
|
|
20
|
+
return candidate;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
export { findInAncestorNodeModules };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ExportedConfigWithProps } from "@expo/config-plugins";
|
|
2
|
+
import type { ExpoConfig } from "expo/config";
|
|
3
|
+
/**
|
|
4
|
+
* `projectRoot` resolution in Expo plugins depends on plugin type:
|
|
5
|
+
*
|
|
6
|
+
* - **Mod plugins** (callbacks passed to `withDangerousMod` etc.) receive an
|
|
7
|
+
* `ExportedConfigWithProps<...>` whose `modRequest.projectRoot` is the
|
|
8
|
+
* documented public API for the consumer's project directory.
|
|
9
|
+
* - **Base plugins** (called with the bare `ExpoConfig`) run before any mod
|
|
10
|
+
* cycle and have no `modRequest`. The only way to recover the project root
|
|
11
|
+
* is the (undocumented but stable) `_internal.projectRoot` escape hatch
|
|
12
|
+
* Expo's config-plugins runtime attaches to the config it hands plugins.
|
|
13
|
+
*
|
|
14
|
+
* Both helpers exist so the two access patterns are picked deliberately —
|
|
15
|
+
* call the one that matches the plugin shape you're in. Don't reach into the
|
|
16
|
+
* raw fields directly; that's how `withMobileBundle` and `withDeviceInfo`
|
|
17
|
+
* silently disagreed on which directory they were resolving against.
|
|
18
|
+
*/
|
|
19
|
+
declare function getProjectRootFromMod(config: ExportedConfigWithProps<unknown>): string;
|
|
20
|
+
declare function getProjectRootFromBaseConfig(config: ExpoConfig): string | undefined;
|
|
21
|
+
export { getProjectRootFromMod, getProjectRootFromBaseConfig };
|
|
22
|
+
//# sourceMappingURL=get-project-root.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `projectRoot` resolution in Expo plugins depends on plugin type:
|
|
3
|
+
*
|
|
4
|
+
* - **Mod plugins** (callbacks passed to `withDangerousMod` etc.) receive an
|
|
5
|
+
* `ExportedConfigWithProps<...>` whose `modRequest.projectRoot` is the
|
|
6
|
+
* documented public API for the consumer's project directory.
|
|
7
|
+
* - **Base plugins** (called with the bare `ExpoConfig`) run before any mod
|
|
8
|
+
* cycle and have no `modRequest`. The only way to recover the project root
|
|
9
|
+
* is the (undocumented but stable) `_internal.projectRoot` escape hatch
|
|
10
|
+
* Expo's config-plugins runtime attaches to the config it hands plugins.
|
|
11
|
+
*
|
|
12
|
+
* Both helpers exist so the two access patterns are picked deliberately —
|
|
13
|
+
* call the one that matches the plugin shape you're in. Don't reach into the
|
|
14
|
+
* raw fields directly; that's how `withMobileBundle` and `withDeviceInfo`
|
|
15
|
+
* silently disagreed on which directory they were resolving against.
|
|
16
|
+
*/
|
|
17
|
+
function getProjectRootFromMod(config) {
|
|
18
|
+
return config.modRequest.projectRoot;
|
|
19
|
+
}
|
|
20
|
+
function getProjectRootFromBaseConfig(config) {
|
|
21
|
+
return config._internal?.["projectRoot"];
|
|
22
|
+
}
|
|
23
|
+
export { getProjectRootFromMod, getProjectRootFromBaseConfig };
|
|
@@ -4,5 +4,9 @@ export { default as withDeviceInfo } from "./withDeviceInfo";
|
|
|
4
4
|
export { default as withMobileBundle } from "./withMobileBundle";
|
|
5
5
|
export { default as withOpenCL } from "./withOpenCL";
|
|
6
6
|
export { default as withQvacSDK } from "./withQvacSDK";
|
|
7
|
+
export { getProjectRootFromMod, getProjectRootFromBaseConfig, } from "./get-project-root";
|
|
8
|
+
export { resolveSDKPackageDir, SDK_PACKAGE_NAMES, } from "./resolve-sdk-package-dir";
|
|
9
|
+
export type { SDKPackageInfo } from "./resolve-sdk-package-dir";
|
|
10
|
+
export { findInAncestorNodeModules } from "./find-in-ancestor-node-modules";
|
|
7
11
|
export { default } from "./withQvacSDK";
|
|
8
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,5 +4,9 @@ export { default as withDeviceInfo } from "./withDeviceInfo.js";
|
|
|
4
4
|
export { default as withMobileBundle } from "./withMobileBundle.js";
|
|
5
5
|
export { default as withOpenCL } from "./withOpenCL.js";
|
|
6
6
|
export { default as withQvacSDK } from "./withQvacSDK.js";
|
|
7
|
+
// Helpers for downstream plugin authors composing on top of these plugins.
|
|
8
|
+
export { getProjectRootFromMod, getProjectRootFromBaseConfig, } from "./get-project-root.js";
|
|
9
|
+
export { resolveSDKPackageDir, SDK_PACKAGE_NAMES, } from "./resolve-sdk-package-dir.js";
|
|
10
|
+
export { findInAncestorNodeModules } from "./find-in-ancestor-node-modules.js";
|
|
7
11
|
// Export the main plugin as default for easy usage
|
|
8
12
|
export { default } from "./withQvacSDK.js";
|
|
@@ -6,8 +6,15 @@ type SDKPackageInfo = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Resolves the installed SDK package directory from node_modules.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Walks from `projectRoot` up to the filesystem root, checking each
|
|
10
|
+
* `node_modules` directory along the way. This matches Node's own module
|
|
11
|
+
* resolution so packages hoisted to a monorepo root (e.g. by bun or yarn
|
|
12
|
+
* workspaces) are found correctly.
|
|
13
|
+
*
|
|
14
|
+
* When multiple SDK installs are found across the tree, the one closest to
|
|
15
|
+
* `projectRoot` wins and a warning lists the others. Only throws
|
|
16
|
+
* `MultipleSDKInstallationsError` when two *different* SDK package names
|
|
17
|
+
* coexist at the same nesting level (a real ambiguity in package selection).
|
|
11
18
|
*/
|
|
12
19
|
declare function resolveSDKPackageDir(projectRoot: string): SDKPackageInfo;
|
|
13
20
|
export { resolveSDKPackageDir, SDK_PACKAGE_NAMES };
|
|
@@ -6,26 +6,53 @@ const SDK_PACKAGE_NAMES = [
|
|
|
6
6
|
"@tetherto/sdk-mono",
|
|
7
7
|
"@tetherto/sdk-dev",
|
|
8
8
|
];
|
|
9
|
+
function findAllInAncestorNodeModules(startDir, name) {
|
|
10
|
+
const matches = [];
|
|
11
|
+
let dir = startDir;
|
|
12
|
+
let parent = path.dirname(dir);
|
|
13
|
+
let depth = 0;
|
|
14
|
+
for (; dir !== parent; dir = parent, parent = path.dirname(dir), depth++) {
|
|
15
|
+
const candidate = path.join(dir, "node_modules", name);
|
|
16
|
+
if (fs.existsSync(candidate)) {
|
|
17
|
+
matches.push({ name, dir: candidate, depth });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return matches;
|
|
21
|
+
}
|
|
9
22
|
/**
|
|
10
23
|
* Resolves the installed SDK package directory from node_modules.
|
|
11
24
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
25
|
+
* Walks from `projectRoot` up to the filesystem root, checking each
|
|
26
|
+
* `node_modules` directory along the way. This matches Node's own module
|
|
27
|
+
* resolution so packages hoisted to a monorepo root (e.g. by bun or yarn
|
|
28
|
+
* workspaces) are found correctly.
|
|
29
|
+
*
|
|
30
|
+
* When multiple SDK installs are found across the tree, the one closest to
|
|
31
|
+
* `projectRoot` wins and a warning lists the others. Only throws
|
|
32
|
+
* `MultipleSDKInstallationsError` when two *different* SDK package names
|
|
33
|
+
* coexist at the same nesting level (a real ambiguity in package selection).
|
|
14
34
|
*/
|
|
15
35
|
function resolveSDKPackageDir(projectRoot) {
|
|
16
|
-
const
|
|
36
|
+
const allMatches = [];
|
|
17
37
|
for (const name of SDK_PACKAGE_NAMES) {
|
|
18
|
-
|
|
19
|
-
if (fs.existsSync(dir)) {
|
|
20
|
-
found.push({ name, dir });
|
|
21
|
-
}
|
|
38
|
+
allMatches.push(...findAllInAncestorNodeModules(projectRoot, name));
|
|
22
39
|
}
|
|
23
|
-
if (
|
|
40
|
+
if (allMatches.length === 0) {
|
|
24
41
|
throw new SDKNotFoundInNodeModulesError();
|
|
25
42
|
}
|
|
26
|
-
|
|
27
|
-
|
|
43
|
+
const minDepth = Math.min(...allMatches.map((m) => m.depth));
|
|
44
|
+
const closest = allMatches.filter((m) => m.depth === minDepth);
|
|
45
|
+
if (closest.length > 1) {
|
|
46
|
+
throw new MultipleSDKInstallationsError(closest.map((m) => m.name).join(", "));
|
|
47
|
+
}
|
|
48
|
+
const winner = closest[0];
|
|
49
|
+
const shadowed = allMatches.filter((m) => m !== winner);
|
|
50
|
+
if (shadowed.length > 0) {
|
|
51
|
+
const others = shadowed.map((m) => `"${m.name}" at "${m.dir}"`).join(", ");
|
|
52
|
+
console.warn(`[resolveSDKPackageDir] Multiple SDK installations found; using ` +
|
|
53
|
+
`"${winner.name}" at "${winner.dir}" (closest to projectRoot). ` +
|
|
54
|
+
`Ignoring: ${others}.`);
|
|
28
55
|
}
|
|
29
|
-
return
|
|
56
|
+
return { name: winner.name, dir: winner.dir };
|
|
30
57
|
}
|
|
31
58
|
export { resolveSDKPackageDir, SDK_PACKAGE_NAMES };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { resolveSDKPackageDir } from "./resolve-sdk-package-dir.js";
|
|
4
|
+
import { getProjectRootFromBaseConfig } from "./get-project-root.js";
|
|
4
5
|
let didRun = false;
|
|
5
6
|
/**
|
|
6
7
|
* Expo plugin that stubs expo-device-info when expo-device is not a declared
|
|
@@ -13,7 +14,7 @@ function withDeviceInfo(config) {
|
|
|
13
14
|
return config;
|
|
14
15
|
}
|
|
15
16
|
didRun = true;
|
|
16
|
-
const projectRoot = config
|
|
17
|
+
const projectRoot = getProjectRootFromBaseConfig(config);
|
|
17
18
|
if (!projectRoot) {
|
|
18
19
|
return config;
|
|
19
20
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ExpoConfig } from "expo/config";
|
|
2
|
+
declare const MOBILE_HOSTS: string[];
|
|
2
3
|
/**
|
|
3
|
-
* Expo plugin
|
|
4
|
+
* Expo plugin: bundle, verify, then copy the mobile worker bundle.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
* Uses qvac.config
|
|
7
|
-
* Output: node_modules/<sdk-package>/dist/worker.mobile.bundle.js
|
|
6
|
+
* Flow: bundleSdk -> verifyBundle -> copy to `<sdkPackageDir>/dist/worker.mobile.bundle.js`.
|
|
7
|
+
* Uses `qvac.config.*` if present.
|
|
8
8
|
*/
|
|
9
9
|
declare function withMobileBundle(config: ExpoConfig): ExpoConfig;
|
|
10
|
+
export { MOBILE_HOSTS };
|
|
10
11
|
export default withMobileBundle;
|
|
11
12
|
//# sourceMappingURL=withMobileBundle.d.ts.map
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import configPlugins from "@expo/config-plugins";
|
|
2
|
-
import { execSync } from "child_process";
|
|
3
2
|
import * as fs from "fs";
|
|
4
3
|
import * as path from "path";
|
|
4
|
+
import { bundleSdk, verifyBundle, hasErrors, formatVerifyBundleResult } from "../../commands/index.js";
|
|
5
|
+
import { CONFIG_CANDIDATES } from "../../client/config-loader/resolve-config.node.js";
|
|
5
6
|
import { resolveSDKPackageDir } from "./resolve-sdk-package-dir.js";
|
|
7
|
+
import { getProjectRootFromMod } from "./get-project-root.js";
|
|
8
|
+
import { findInAncestorNodeModules } from "./find-in-ancestor-node-modules.js";
|
|
9
|
+
import { BundleVerificationFailedError } from "../../utils/errors-client.js";
|
|
6
10
|
const { withDangerousMod } = configPlugins;
|
|
7
|
-
const CONFIG_CANDIDATES = [
|
|
8
|
-
"qvac.config.json",
|
|
9
|
-
"qvac.config.js",
|
|
10
|
-
"qvac.config.mjs",
|
|
11
|
-
];
|
|
12
11
|
/** Modules to defer from mobile bundles (not available at bundle time) */
|
|
13
12
|
const DEFERRED_MODULES = ["expo-file-system", "react-native-bare-kit"];
|
|
14
13
|
const MOBILE_HOSTS = [
|
|
@@ -18,19 +17,16 @@ const MOBILE_HOSTS = [
|
|
|
18
17
|
"ios-x64-simulator",
|
|
19
18
|
];
|
|
20
19
|
/**
|
|
21
|
-
* Expo plugin
|
|
20
|
+
* Expo plugin: bundle, verify, then copy the mobile worker bundle.
|
|
22
21
|
*
|
|
23
|
-
*
|
|
24
|
-
* Uses qvac.config
|
|
25
|
-
* Output: node_modules/<sdk-package>/dist/worker.mobile.bundle.js
|
|
22
|
+
* Flow: bundleSdk -> verifyBundle -> copy to `<sdkPackageDir>/dist/worker.mobile.bundle.js`.
|
|
23
|
+
* Uses `qvac.config.*` if present.
|
|
26
24
|
*/
|
|
27
25
|
function withMobileBundle(config) {
|
|
28
|
-
function buildMobileBundle(config) {
|
|
29
|
-
const projectRoot = config
|
|
26
|
+
async function buildMobileBundle(config) {
|
|
27
|
+
const projectRoot = getProjectRootFromMod(config);
|
|
30
28
|
const sdkPackage = resolveSDKPackageDir(projectRoot);
|
|
31
29
|
const outputPath = path.join(sdkPackage.dir, "dist", "worker.mobile.bundle.js");
|
|
32
|
-
// Generate bundle via qvac CLI
|
|
33
|
-
// (uses qvac.config.* if exists, else includes all built-in plugins)
|
|
34
30
|
const configPath = findConfigFile(projectRoot);
|
|
35
31
|
if (configPath) {
|
|
36
32
|
console.log(`🕚 QVAC: Found ${path.basename(configPath)}, generating tree-shaken bundle...`);
|
|
@@ -42,15 +38,11 @@ function withMobileBundle(config) {
|
|
|
42
38
|
...DEFERRED_MODULES,
|
|
43
39
|
`${sdkPackage.name}/worker.mobile.bundle`,
|
|
44
40
|
];
|
|
45
|
-
runBundler(projectRoot, sdkPackage.dir, configPath, deferredModules);
|
|
46
|
-
// Copy the generated bundle to SDK location
|
|
41
|
+
await runBundler(projectRoot, sdkPackage.dir, configPath, deferredModules);
|
|
47
42
|
const generatedBundle = path.join(projectRoot, "qvac", "worker.bundle.js");
|
|
48
|
-
|
|
49
|
-
throw new Error(`QVAC: Bundle generation failed — ${generatedBundle} not found. ` +
|
|
50
|
-
`Check qvac CLI output above for errors.`);
|
|
51
|
-
}
|
|
43
|
+
await runVerifier(projectRoot, generatedBundle, configPath);
|
|
52
44
|
fs.copyFileSync(generatedBundle, outputPath);
|
|
53
|
-
console.log("🫡 QVAC: Mobile bundle generated");
|
|
45
|
+
console.log("🫡 QVAC: Mobile bundle generated and verified");
|
|
54
46
|
return config;
|
|
55
47
|
}
|
|
56
48
|
config = withDangerousMod(config, ["android", buildMobileBundle]);
|
|
@@ -67,49 +59,42 @@ function findConfigFile(projectRoot) {
|
|
|
67
59
|
}
|
|
68
60
|
return null;
|
|
69
61
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
62
|
+
async function runVerifier(projectRoot, generatedBundle, configPath) {
|
|
63
|
+
if (!configPath) {
|
|
64
|
+
console.log("⚠️ QVAC: no qvac.config.* found — Bare runtime will be auto-detected " +
|
|
65
|
+
"from node_modules (bare-runtime, then bare). Add qvac.config.json " +
|
|
66
|
+
"with `bareRuntimeVersion` to pin ABI checks deterministically.");
|
|
67
|
+
}
|
|
68
|
+
const result = await verifyBundle({
|
|
69
|
+
projectRoot,
|
|
70
|
+
addonsSource: generatedBundle,
|
|
71
|
+
hosts: MOBILE_HOSTS,
|
|
72
|
+
...(configPath ? { configPath } : {}),
|
|
73
|
+
});
|
|
74
|
+
if (hasErrors(result)) {
|
|
75
|
+
throw new BundleVerificationFailedError(generatedBundle, new Error(formatVerifyBundleResult(result)));
|
|
80
76
|
}
|
|
81
|
-
console.log("⚠️ QVAC: @qvac/cli not found in node_modules, falling back to npx");
|
|
82
|
-
console.log(" Tip: Add @qvac/cli as a dependency for consistent versioning");
|
|
83
|
-
return "npx --package=@qvac/cli qvac";
|
|
84
77
|
}
|
|
85
|
-
|
|
86
|
-
function runBundler(projectRoot, qvacSdkPath, configPath, deferredModules) {
|
|
87
|
-
// Patch bare-kit linkers to use addons manifest
|
|
78
|
+
async function runBundler(projectRoot, qvacSdkPath, configPath, deferredModules) {
|
|
88
79
|
patchBareKitLinkers(projectRoot, qvacSdkPath);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
console.error("❌ QVAC: Failed to generate bundle:", error);
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
80
|
+
await bundleSdk({
|
|
81
|
+
projectRoot,
|
|
82
|
+
sdkPath: qvacSdkPath,
|
|
83
|
+
...(configPath ? { configPath } : {}),
|
|
84
|
+
hosts: MOBILE_HOSTS,
|
|
85
|
+
defer: deferredModules,
|
|
86
|
+
quiet: true,
|
|
87
|
+
});
|
|
101
88
|
}
|
|
102
89
|
/**
|
|
103
90
|
* Patches react-native-bare-kit linkers to use the addons manifest.
|
|
104
|
-
*
|
|
105
|
-
* Copies the manifest-aware link.mjs files over the originals so that
|
|
106
|
-
* bare-link only links the native addons actually required by the bundle.
|
|
107
|
-
* This reduces app size by excluding unused native addon binaries.
|
|
108
91
|
*/
|
|
109
92
|
function patchBareKitLinkers(projectRoot, qvacSdkPath) {
|
|
110
|
-
const bareKitPath =
|
|
111
|
-
if (
|
|
112
|
-
console.
|
|
93
|
+
const bareKitPath = findInAncestorNodeModules(projectRoot, "react-native-bare-kit");
|
|
94
|
+
if (bareKitPath === null) {
|
|
95
|
+
console.warn("⚠️ QVAC: react-native-bare-kit not found in any ancestor node_modules, " +
|
|
96
|
+
"skipping linker patch. The bundle will link all native addons " +
|
|
97
|
+
"rather than only those required by your bundle.");
|
|
113
98
|
return;
|
|
114
99
|
}
|
|
115
100
|
const patchesDir = path.join(qvacSdkPath, "expo", "plugins", "patches");
|
|
@@ -117,7 +102,6 @@ function patchBareKitLinkers(projectRoot, qvacSdkPath) {
|
|
|
117
102
|
console.log(`⚠️ QVAC: patches directory not found (${patchesDir}), skipping linker patch`);
|
|
118
103
|
return;
|
|
119
104
|
}
|
|
120
|
-
// Patch Android linker
|
|
121
105
|
const androidPatch = path.join(patchesDir, "android-link.mjs");
|
|
122
106
|
const androidTarget = path.join(bareKitPath, "android", "link.mjs");
|
|
123
107
|
if (fs.existsSync(androidPatch)) {
|
|
@@ -127,7 +111,6 @@ function patchBareKitLinkers(projectRoot, qvacSdkPath) {
|
|
|
127
111
|
else {
|
|
128
112
|
console.log(`⚠️ QVAC: Android linker patch not found (${androidPatch})`);
|
|
129
113
|
}
|
|
130
|
-
// Patch iOS linker
|
|
131
114
|
const iosPatch = path.join(patchesDir, "ios-link.mjs");
|
|
132
115
|
const iosTarget = path.join(bareKitPath, "ios", "link.mjs");
|
|
133
116
|
if (fs.existsSync(iosPatch)) {
|
|
@@ -138,4 +121,5 @@ function patchBareKitLinkers(projectRoot, qvacSdkPath) {
|
|
|
138
121
|
console.log(`⚠️ QVAC: iOS linker patch not found (${iosPatch})`);
|
|
139
122
|
}
|
|
140
123
|
}
|
|
124
|
+
export { MOBILE_HOSTS };
|
|
141
125
|
export default withMobileBundle;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import "#polyfill-bare-globals";
|
|
2
|
-
export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, type FinetuneHandle, } from "./client/api/index";
|
|
2
|
+
export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, classify, video, type VideoProgressTick, upscale, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, type FinetuneHandle, } from "./client/api/index";
|
|
3
3
|
export { close } from "./client/index";
|
|
4
|
-
export {
|
|
4
|
+
export { plugins } from "./client/plugins-factory";
|
|
5
|
+
export { type LifecycleState, type ModelProgressUpdate, type LoadModelOptions, type LoadCustomPluginModelOptions, type DownloadAssetOptions, type Tool, type ToolCall, type ToolCallWithCall, type ToolCallError, type ToolCallEvent, type CompletionEvent, type CompletionFinal, type CompletionRun, type CompletionStats, type EmbedStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, type CompletionParams, type ToolDialect, type RagSearchResult, type RagSaveEmbeddingsResult, type RagReindexResult, type RagEmbeddedDoc, type RagDoc, type RagWorkspaceInfo, type RagCloseWorkspaceParams, type RagDeleteWorkspaceParams, type RagIngestStage, type RagReindexStage, type RagSaveStage, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, RAG_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type LoadedInstance, type CacheFileInfo, toolSchema, TOOLS_MODE, type ToolsMode, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type ClassifyClientParams, type ClassificationResult, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, type VideoClientParams, type VideoStreamResponse, type VideoStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, type VlaConfig, type VlaClientRunParams, type VlaClientRunResult, type VlaHparams, type VlaStats, definePlugin, defineHandler, defineDuplexHandler, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult, } from "./schemas/index";
|
|
5
6
|
export { type ToolInput, type ToolHandler } from "./utils/tool-helpers";
|
|
6
7
|
export { MODEL_TYPES, ModelType } from "./schemas/index";
|
|
7
8
|
export * from "./models/registry/index";
|
|
8
9
|
export { SUPPORTED_AUDIO_FORMATS } from "./constants/audio";
|
|
10
|
+
export { InferenceCancelledError } from "./utils/errors-server";
|
|
11
|
+
export type { InferenceCancelledPartial } from "./utils/errors-server";
|
|
12
|
+
export { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, } from "./utils/errors-server";
|
|
9
13
|
export { getLogger, SDK_LOG_ID } from "./logging/index";
|
|
10
14
|
export type { Logger, LogTransport, LoggerOptions } from "./logging/index";
|
|
11
15
|
export { profiler } from "./profiling/index";
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import "#polyfill-bare-globals";
|
|
2
2
|
// Public API exports only
|
|
3
|
-
export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, } from "./client/api/index.js";
|
|
3
|
+
export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, classify, video, upscale, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, } from "./client/api/index.js";
|
|
4
4
|
export { close } from "./client/index.js";
|
|
5
|
-
export {
|
|
5
|
+
export { plugins } from "./client/plugins-factory.js";
|
|
6
|
+
export { VERBOSITY, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, RAG_ERROR_CODES, toolSchema, TOOLS_MODE, definePlugin, defineHandler, defineDuplexHandler, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS, } from "./schemas/index.js";
|
|
6
7
|
export {} from "./utils/tool-helpers.js";
|
|
7
8
|
// Model types - canonical naming with backward-compatible aliases
|
|
8
9
|
export { MODEL_TYPES, ModelType } from "./schemas/index.js";
|
|
9
10
|
// Model registry constants
|
|
10
11
|
export * from "./models/registry/index.js";
|
|
11
12
|
export { SUPPORTED_AUDIO_FORMATS } from "./constants/audio.js";
|
|
13
|
+
// Error classes that clients need for `instanceof` checks on rejected
|
|
14
|
+
// promises. `InferenceCancelledError` rides the standard `QvacError`
|
|
15
|
+
// envelope, but consumers reach for it through `instanceof` on
|
|
16
|
+
// `await run.final` / `run.text` / `run.toolCalls` / `run.stats`
|
|
17
|
+
// rejections. `RequestRejectedByPolicyError` is thrown by
|
|
18
|
+
// `RequestRegistry.begin(...)` when a registered concurrency policy
|
|
19
|
+
// (e.g. `oneAtATimePerModel` on `completion`) rejects a new request;
|
|
20
|
+
// it propagates out through the worker so the client can distinguish
|
|
21
|
+
// "the request collided with another one" from "the request failed".
|
|
22
|
+
//
|
|
23
|
+
// `RequestIdConflictError` and `RequestNotFoundError` are thrown by
|
|
24
|
+
// `RequestRegistry.begin(...)` / `.end(...)` on UUID collisions and
|
|
25
|
+
// missing-target cancels. They're surfaced here so consumers using
|
|
26
|
+
// the decorated-promise `requestId` can pattern-match on rejected
|
|
27
|
+
// cancel paths. All three classes round-trip the RPC boundary via
|
|
28
|
+
// the typed-error reconstructor in `client/rpc/rpc-error.ts` so
|
|
29
|
+
// `err instanceof <Class>` works on the consumer side, not just on
|
|
30
|
+
// the worker side.
|
|
31
|
+
export { InferenceCancelledError } from "./utils/errors-server.js";
|
|
32
|
+
export { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, } from "./utils/errors-server.js";
|
|
12
33
|
// Logging exports
|
|
13
34
|
export { getLogger, SDK_LOG_ID } from "./logging/index.js";
|
|
14
35
|
// Profiler exports
|