@qvac/sdk 0.21.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +131 -62
- package/README.md +31 -326
- package/dist/examples/abot-world.js +1 -1
- package/dist/examples/advisory-model-fit.d.ts +0 -58
- package/dist/examples/advisory-model-fit.js +23 -150
- package/dist/examples/asr/moss-transcribe-filesystem.d.ts +2 -0
- package/dist/examples/asr/moss-transcribe-filesystem.js +84 -0
- package/dist/examples/asr/moss-transcribe-fit.d.ts +2 -0
- package/dist/examples/asr/moss-transcribe-fit.js +40 -0
- package/dist/examples/asr/nemotron-diarization-filesystem.d.ts +2 -0
- package/dist/examples/asr/nemotron-diarization-filesystem.js +64 -0
- package/dist/examples/asr/parakeet-ctc-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-microphone-record.js +1 -1
- package/dist/examples/asr/parakeet-microphone-stream.js +1 -1
- package/dist/examples/asr/parakeet-nemotron-filesystem.js +3 -3
- package/dist/examples/asr/parakeet-sortformer-streaming.js +2 -2
- package/dist/examples/asr/parakeet-sortformer.js +1 -1
- package/dist/examples/asr/parakeet-tdt-filesystem-chunked.js +2 -2
- package/dist/examples/asr/parakeet-tdt-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-transcribepsy-filesystem.d.ts +2 -0
- package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +76 -0
- package/dist/examples/asr/parakeet-unified-coreml.js +2 -2
- package/dist/examples/asr/parakeet-unified-filesystem.js +2 -2
- package/dist/examples/asr/whispercpp-filesystem-streaming.js +1 -1
- package/dist/examples/asr/whispercpp-filesystem.js +1 -1
- package/dist/examples/asr/whispercpp-microphone-record.js +1 -1
- package/dist/examples/asr/whispercpp-prompt.js +1 -1
- package/dist/examples/assess-model-fit.js +3 -6
- package/dist/examples/audiogen/edit-music.js +2 -2
- package/dist/examples/audiogen/generate-cover.js +2 -2
- package/dist/examples/audiogen/generate-music-minimax.js +1 -1
- package/dist/examples/audiogen/generate-music.js +1 -1
- package/dist/examples/audiogen/understand-music.js +2 -2
- package/dist/examples/batch-completion.d.ts +1 -1
- package/dist/examples/batch-completion.js +1 -1
- package/dist/examples/bci/bci-filesystem-streaming.js +2 -2
- package/dist/examples/bci/bci-filesystem.js +2 -2
- package/dist/examples/concurrent-completion-collision.js +1 -1
- package/dist/examples/config-reload.js +1 -1
- package/dist/examples/decisions.d.ts +2 -0
- package/dist/examples/decisions.js +38 -0
- package/dist/examples/diffusion-esrgan-upscale.js +1 -1
- package/dist/examples/diffusion-flux2-klein-img2img.js +1 -1
- package/dist/examples/diffusion-img2img.js +1 -1
- package/dist/examples/diffusion-img2vid-ltx.js +8 -15
- package/dist/examples/diffusion-img2vid-minimax-h3.d.ts +2 -0
- package/dist/examples/diffusion-img2vid-minimax-h3.js +72 -0
- package/dist/examples/diffusion-img2vid.js +1 -1
- package/dist/examples/diffusion-qwen-image-21.d.ts +2 -0
- package/dist/examples/diffusion-qwen-image-21.js +104 -0
- package/dist/examples/diffusion-txt2vid-ltx.js +7 -14
- package/dist/examples/finetune/llamacpp-finetune.js +9 -4
- package/dist/examples/llamacpp-filesystem.js +1 -1
- package/dist/examples/llamacpp-multi-gpu.js +2 -2
- package/dist/examples/llamacpp-multimodal.js +3 -1
- package/dist/examples/llamacpp-structured-output.js +1 -1
- package/dist/examples/mcp-websearch.d.ts +2 -2
- package/dist/examples/mcp-websearch.js +4 -4
- package/dist/examples/model-fit-ui/server.d.ts +1 -1
- package/dist/examples/model-fit-ui/server.js +1 -1
- package/dist/examples/multi-job-completion.d.ts +1 -1
- package/dist/examples/multi-job-completion.js +1 -1
- package/dist/examples/ocr-fasttext.js +1 -1
- package/dist/examples/plugins.js +1 -1
- package/dist/examples/rerank.d.ts +2 -0
- package/dist/examples/rerank.js +33 -0
- package/dist/examples/tools/llamacpp-deferred-tools.js +5 -5
- package/dist/examples/tools/llamacpp-tools-auto-dialect.js +5 -4
- package/dist/examples/tools/llamacpp-tools-gemma4.js +4 -4
- package/dist/examples/tools/llamacpp-tools-qwen35.js +5 -4
- package/dist/examples/tts/llm-to-tts-streaming.d.ts +2 -2
- package/dist/examples/tts/llm-to-tts-streaming.js +2 -2
- package/dist/examples/tts/moss-sound-effect-controls.d.ts +2 -0
- package/dist/examples/tts/moss-sound-effect-controls.js +88 -0
- package/dist/examples/tts/moss-sound-effect.d.ts +2 -0
- package/dist/examples/tts/moss-sound-effect.js +86 -0
- package/dist/examples/tts/moss-speech-audio.d.ts +2 -0
- package/dist/examples/tts/moss-speech-audio.js +159 -0
- package/dist/examples/tts/moss-speech.d.ts +2 -0
- package/dist/examples/tts/moss-speech.js +70 -0
- package/dist/examples/vla-groot.js +2 -2
- package/dist/examples/vla-pi05.js +2 -2
- package/dist/examples/vla-smolvla.js +2 -2
- package/dist/examples/voice-assistant/voice-assistant.js +1 -1
- package/dist/scripts/contract/build-contract.d.ts +3 -1
- package/dist/scripts/contract/build-contract.js +40 -2
- package/dist/scripts/contract/build-model-type-maps.d.ts +6 -1
- package/dist/scripts/contract/build-model-type-maps.js +3 -2
- package/dist/scripts/contract/constants-registry.d.ts +6 -0
- package/dist/scripts/contract/constants-registry.js +4 -1
- package/dist/scripts/contract/method-shapes.d.ts +2 -0
- package/dist/scripts/contract/method-shapes.js +2 -0
- package/dist/scripts/export-contract.js +20 -7
- package/dist/scripts/run-unit-tests.js +10 -5
- package/dist/src/client/api/assess-model-fit.d.ts +5 -5
- package/dist/src/client/api/assess-model-fit.js +6 -7
- package/dist/src/client/api/audio-edit.d.ts +14 -2
- package/dist/src/client/api/audio-edit.js +16 -4
- package/dist/src/client/api/audio-gen-result.js +2 -2
- package/dist/src/client/api/audio-gen.d.ts +10 -2
- package/dist/src/client/api/audio-gen.js +12 -4
- package/dist/src/client/api/audio-understand.d.ts +1 -1
- package/dist/src/client/api/audio-understand.js +3 -3
- package/dist/src/client/api/batch-completion.js +3 -3
- package/dist/src/client/api/bci-transcribe.js +3 -3
- package/dist/src/client/api/cancel.js +1 -1
- package/dist/src/client/api/classify.js +1 -1
- package/dist/src/client/api/completion-stream.d.ts +2 -1
- package/dist/src/client/api/completion-stream.js +6 -4
- package/dist/src/client/api/decide.d.ts +31 -0
- package/dist/src/client/api/decide.js +29 -0
- package/dist/src/client/api/delete-cache.js +1 -1
- package/dist/src/client/api/diffusion.d.ts +18 -1
- package/dist/src/client/api/diffusion.js +19 -2
- package/dist/src/client/api/download-asset.js +3 -3
- package/dist/src/client/api/embed.js +2 -2
- package/dist/src/client/api/finetune.js +3 -3
- package/dist/src/client/api/get-loaded-model-info.js +1 -1
- package/dist/src/client/api/get-model-info.js +1 -1
- package/dist/src/client/api/get-system-resources.js +1 -1
- package/dist/src/client/api/heartbeat.js +1 -1
- package/dist/src/client/api/index.d.ts +5 -3
- package/dist/src/client/api/index.js +5 -3
- package/dist/src/client/api/invoke-plugin.js +1 -1
- package/dist/src/client/api/load-model.d.ts +1 -0
- package/dist/src/client/api/load-model.js +4 -4
- package/dist/src/client/api/logging-stream.d.ts +11 -2
- package/dist/src/client/api/logging-stream.js +12 -3
- package/dist/src/client/api/ocr.js +1 -1
- package/dist/src/client/api/rag.js +2 -2
- package/dist/src/client/api/registry.d.ts +2 -1
- package/dist/src/client/api/registry.js +6 -5
- package/dist/src/client/api/rerank.d.ts +22 -0
- package/dist/src/client/api/rerank.js +39 -0
- package/dist/src/client/api/resume.js +1 -1
- package/dist/src/client/api/rpc-server.js +2 -2
- package/dist/src/client/api/state.js +1 -1
- package/dist/src/client/api/subscribe-logs.js +3 -2
- package/dist/src/client/api/suspend.js +1 -1
- package/dist/src/client/api/text-to-speech.d.ts +1 -0
- package/dist/src/client/api/text-to-speech.js +18 -25
- package/dist/src/client/api/transcribe.d.ts +1 -1
- package/dist/src/client/api/transcribe.js +7 -4
- package/dist/src/client/api/translate.js +2 -2
- package/dist/src/client/api/unload-model.js +2 -2
- package/dist/src/client/api/upscale.js +1 -1
- package/dist/src/client/api/vector-index.d.ts +1 -1
- package/dist/src/client/api/vector-index.js +1 -1
- package/dist/src/client/api/video-request.d.ts +5 -5
- package/dist/src/client/api/video.d.ts +23 -3
- package/dist/src/client/api/video.js +26 -6
- package/dist/src/client/api/world-result.js +2 -2
- package/dist/src/client/api/world.d.ts +1 -1
- package/dist/src/client/api/world.js +2 -2
- package/dist/src/client/logging-stream-registry.js +9 -6
- package/dist/src/client/plugins-factory.d.ts +1 -1
- package/dist/src/client/plugins-factory.js +1 -1
- package/dist/src/client/rpc/expo-rpc-client.js +3 -3
- package/dist/src/client/rpc/ipc-socket-path.d.ts +11 -0
- package/dist/src/client/rpc/ipc-socket-path.js +30 -0
- package/dist/src/client/rpc/node-rpc-client.js +14 -25
- package/dist/src/client/rpc/rpc-client.d.ts +3 -2
- package/dist/src/client/rpc/rpc-client.js +46 -12
- package/dist/src/client/rpc/rpc-error.js +4 -1
- package/dist/src/commands/bundle/bare-pack.d.ts +8 -0
- package/dist/src/commands/bundle/bare-pack.js +28 -5
- package/dist/src/commands/bundle/constants.js +3 -0
- package/dist/src/commands/bundle/entry-gen.js +1 -1
- package/dist/src/commands/bundle/index.d.ts +8 -7
- package/dist/src/commands/bundle/index.js +135 -52
- package/dist/src/commands/bundle/manifest.d.ts +2 -0
- package/dist/src/commands/bundle/manifest.js +3 -2
- package/dist/src/commands/bundle/plugins.js +1 -1
- package/dist/src/commands/host-prebuilds/index.d.ts +18 -10
- package/dist/src/commands/host-prebuilds/index.js +39 -20
- package/dist/src/commands/index.d.ts +13 -13
- package/dist/src/commands/index.js +8 -8
- package/dist/src/commands/verify/abi.d.ts +1 -1
- package/dist/src/commands/verify/abi.js +1 -1
- package/dist/src/commands/verify/addon-source.d.ts +12 -0
- package/dist/src/commands/verify/addon-source.js +36 -3
- package/dist/src/commands/verify/bare-kit-runtime.d.ts +1 -1
- package/dist/src/commands/verify/bare-kit-runtime.js +1 -1
- package/dist/src/commands/verify/bare-kit-runtimes.js +2 -1
- package/dist/src/commands/verify/bundle-source.d.ts +1 -1
- package/dist/src/commands/verify/bundle-source.js +3 -3
- package/dist/src/commands/verify/engines-advice.d.ts +4 -4
- package/dist/src/commands/verify/engines-advice.js +4 -4
- package/dist/src/commands/verify/index.d.ts +5 -5
- package/dist/src/commands/verify/index.js +7 -7
- package/dist/src/commands/verify/node-modules-source.d.ts +1 -1
- package/dist/src/commands/verify/node-modules-source.js +11 -2
- package/dist/src/{expo/plugins/patches/qvac-platform-addons.d.ts → commands/verify/platform-addons.d.ts} +6 -10
- package/dist/src/{expo/plugins/patches/qvac-platform-addons.js → commands/verify/platform-addons.js} +2 -45
- package/dist/src/commands/verify/prebuilds.d.ts +8 -11
- package/dist/src/commands/verify/prebuilds.js +44 -35
- package/dist/src/commands/verify/resource-collectors.js +2 -2
- package/dist/src/expo/plugins/link-addons.d.ts +18 -0
- package/dist/src/expo/plugins/link-addons.js +65 -0
- package/dist/src/expo/plugins/withAndroidNdkVersion.js +16 -10
- package/dist/src/expo/plugins/withDeviceInfo.js +19 -5
- package/dist/src/expo/plugins/withMobileBundle.d.ts +13 -23
- package/dist/src/expo/plugins/withMobileBundle.js +27 -117
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +3 -3
- package/dist/src/logging/addon.d.ts +1 -1
- package/dist/src/pear/pre.js +4 -0
- package/dist/src/plugin-ids.d.ts +4 -1
- package/dist/src/plugin-ids.js +6 -0
- package/dist/src/schemas/public.d.ts +2 -1
- package/dist/src/schemas/public.js +2 -1
- package/dist/src/schemas/sdk-errors-client.d.ts +3 -0
- package/dist/src/schemas/sdk-errors-client.js +16 -0
- package/dist/src/schemas/sdk-errors-server.d.ts +2 -0
- package/dist/src/schemas/sdk-errors-server.js +11 -1
- package/dist/src/server/rpc/rpc-utils.d.ts +5 -0
- package/dist/src/server/rpc/rpc-utils.js +7 -0
- package/dist/src/server/utils/qvac-paths.js +1 -1
- package/dist/src/server/utils/worker-lock.js +1 -1
- package/dist/src/utils/aggregate-events.d.ts +1 -1
- package/dist/src/utils/aggregate-events.js +2 -2
- package/dist/src/utils/errors-client.d.ts +10 -0
- package/dist/src/utils/errors-client.js +18 -0
- package/dist/src/utils/errors-server.d.ts +6 -0
- package/dist/src/utils/errors-server.js +12 -0
- package/dist/src/utils/mcp-adapter.d.ts +1 -1
- package/dist/src/utils/mcp-adapter.js +13 -9
- package/dist/src/utils/tool-helpers.d.ts +1 -1
- package/dist/src/utils/tool-helpers.js +21 -53
- package/dist/src/worker/create-server.d.ts +1 -0
- package/dist/src/worker/create-server.js +5 -0
- package/dist/src/worker/handle-request.js +4 -2
- package/dist/src/worker/handler-utils.js +1 -1
- package/dist/src/worker/index.js +7 -1
- package/dist/src/worker/lifecycle.js +10 -2
- package/dist/src/worker/plugins/llamacpp-decision.d.ts +2 -0
- package/dist/src/worker/plugins/llamacpp-decision.js +1 -0
- package/dist/src/worker/plugins/llamacpp-rerank.d.ts +2 -0
- package/dist/src/worker/plugins/llamacpp-rerank.js +1 -0
- package/dist/src/worker/plugins/moss-transcribe.d.ts +2 -0
- package/dist/src/worker/plugins/moss-transcribe.js +1 -0
- package/package.json +63 -53
- package/src/electron-forge/index.cjs +12 -71
- package/dist/scripts/link-workspace-inference.d.ts +0 -2
- package/dist/scripts/link-workspace-inference.js +0 -31
- package/src/expo/plugins/patches/android-link.mjs +0 -67
- package/src/expo/plugins/patches/ios-link.mjs +0 -67
- package/src/expo/plugins/patches/qvac-platform-addons.ts +0 -124
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@qvac/inference/llamacpp-rerank/plugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@qvac/inference/moss-transcribe/plugin';
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qvac/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
|
+
"qvacIpcAuthentication": "token-v1",
|
|
4
5
|
"license": "Apache-2.0",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -162,6 +163,18 @@
|
|
|
162
163
|
"./ggml-rpc-server/provider": {
|
|
163
164
|
"types": "./dist/src/worker/ggml-rpc-server-provider.d.ts",
|
|
164
165
|
"import": "./dist/src/worker/ggml-rpc-server-provider.js"
|
|
166
|
+
},
|
|
167
|
+
"./moss-transcribe/plugin": {
|
|
168
|
+
"types": "./dist/src/worker/plugins/moss-transcribe.d.ts",
|
|
169
|
+
"import": "./dist/src/worker/plugins/moss-transcribe.js"
|
|
170
|
+
},
|
|
171
|
+
"./llamacpp-decision/plugin": {
|
|
172
|
+
"types": "./dist/src/worker/plugins/llamacpp-decision.d.ts",
|
|
173
|
+
"import": "./dist/src/worker/plugins/llamacpp-decision.js"
|
|
174
|
+
},
|
|
175
|
+
"./llamacpp-rerank/plugin": {
|
|
176
|
+
"types": "./dist/src/worker/plugins/llamacpp-rerank.d.ts",
|
|
177
|
+
"import": "./dist/src/worker/plugins/llamacpp-rerank.js"
|
|
165
178
|
}
|
|
166
179
|
},
|
|
167
180
|
"imports": {
|
|
@@ -180,7 +193,6 @@
|
|
|
180
193
|
"bare-imports.json",
|
|
181
194
|
"dist/**/*",
|
|
182
195
|
"src/electron-forge/**/*",
|
|
183
|
-
"src/expo/plugins/patches/**/*",
|
|
184
196
|
"!dist/**/*.map",
|
|
185
197
|
"!**/package-lock.json",
|
|
186
198
|
"!**/yarn.lock",
|
|
@@ -190,48 +202,25 @@
|
|
|
190
202
|
"NOTICE",
|
|
191
203
|
"docs/system-resources-support-matrix.md"
|
|
192
204
|
],
|
|
193
|
-
"scripts": {
|
|
194
|
-
"test:unit": "bun run scripts/run-unit-tests.ts",
|
|
195
|
-
"format": "prettier --check .",
|
|
196
|
-
"format:fix": "prettier --write .",
|
|
197
|
-
"lint": "lunte && npm run enforce-inference-versions",
|
|
198
|
-
"lint:fix": "lunte --fix",
|
|
199
|
-
"enforce-inference-versions": "bun scripts/enforce-inference-versions.ts",
|
|
200
|
-
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p test/tsconfig.types.json",
|
|
201
|
-
"postcompile:aliases": "tsc-alias -p tsconfig.alias.json",
|
|
202
|
-
"build": "rm -rf dist && npm run lint && tsc --project tsconfig.json && npm run postcompile:aliases",
|
|
203
|
-
"build:pack": "bun run build && bun pm pack --destination dist/",
|
|
204
|
-
"sdk-source:workspace": "bun run ./scripts/link-workspace-inference.ts",
|
|
205
|
-
"watch": "nodemon --watch src --ext ts --exec 'bun run build'",
|
|
206
|
-
"bare:ensureprebuilds:llamacpp": "cp -r node_modules/@qvac/llm-llamacpp/prebuilds/android-arm64 node_modules/@qvac/llm-llamacpp/prebuilds/android-ia32 && cp -r node_modules/@qvac/llm-llamacpp/prebuilds/android-arm64 node_modules/@qvac/llm-llamacpp/prebuilds/android-arm && cp -r node_modules/@qvac/llm-llamacpp/prebuilds/android-arm64 node_modules/@qvac/llm-llamacpp/prebuilds/android-x64",
|
|
207
|
-
"bare:ensureprebuilds:asr": "cp -r node_modules/@qvac/asr-ggml/prebuilds/android-arm64 node_modules/@qvac/asr-ggml/prebuilds/android-ia32 && cp -r node_modules/@qvac/asr-ggml/prebuilds/android-arm64 node_modules/@qvac/asr-ggml/prebuilds/android-arm && cp -r node_modules/@qvac/asr-ggml/prebuilds/android-arm64 node_modules/@qvac/asr-ggml/prebuilds/android-x64",
|
|
208
|
-
"bare:ensureprebuilds:embeddings": "cp -r node_modules/@qvac/embed-llamacpp/prebuilds/android-arm64 node_modules/@qvac/embed-llamacpp/prebuilds/android-ia32 && cp -r node_modules/@qvac/embed-llamacpp/prebuilds/android-arm64 node_modules/@qvac/embed-llamacpp/prebuilds/android-arm && cp -r node_modules/@qvac/embed-llamacpp/prebuilds/android-arm64 node_modules/@qvac/embed-llamacpp/prebuilds/android-x64",
|
|
209
|
-
"bare:ensureprebuilds": "bun run bare:ensureprebuilds:llamacpp && bun run bare:ensureprebuilds:asr && bun run bare:ensureprebuilds:embeddings",
|
|
210
|
-
"prepare:husky": "bun run husky",
|
|
211
|
-
"contract:export": "tsx ./scripts/export-contract.ts",
|
|
212
|
-
"contract:check": "tsx ./scripts/export-contract.ts --check",
|
|
213
|
-
"check:resource-collectors": "tsx ./scripts/check-resource-collectors-packaging.ts",
|
|
214
|
-
"bare-kit-runtimes:generate": "tsx ./scripts/generate-bare-kit-runtimes.ts",
|
|
215
|
-
"changelog:generate": "node ../../scripts/sdk/generate-changelog-sdk-pod.cjs --package=sdk && prettier --write changelog"
|
|
216
|
-
},
|
|
217
205
|
"dependencies": {
|
|
218
|
-
"@qvac/asr-ggml": "^0.
|
|
219
|
-
"@qvac/audiogen-ggml": "^0.
|
|
220
|
-
"@qvac/bci-whispercpp": "^0.
|
|
221
|
-
"@qvac/classification-ggml": "^0.
|
|
222
|
-
"@qvac/decoder-audio": "^0.
|
|
223
|
-
"@qvac/diffusion-cpp": "^0.
|
|
224
|
-
"@qvac/embed-llamacpp": "^0.
|
|
206
|
+
"@qvac/asr-ggml": "^0.11.1",
|
|
207
|
+
"@qvac/audiogen-ggml": "^0.9.0",
|
|
208
|
+
"@qvac/bci-whispercpp": "^0.14.0",
|
|
209
|
+
"@qvac/classification-ggml": "^0.34.0",
|
|
210
|
+
"@qvac/decoder-audio": "^0.8.1",
|
|
211
|
+
"@qvac/diffusion-cpp": "^0.31.0",
|
|
212
|
+
"@qvac/embed-llamacpp": "^0.53.0",
|
|
225
213
|
"@qvac/error": "^0.1.1",
|
|
226
|
-
"@qvac/ggml-rpc-server": "^0.
|
|
227
|
-
"@qvac/inference": "^0.
|
|
214
|
+
"@qvac/ggml-rpc-server": "^0.7.0",
|
|
215
|
+
"@qvac/inference": "^0.23.0",
|
|
228
216
|
"@qvac/langdetect-text": "^0.1.2",
|
|
229
|
-
"@qvac/llm-llamacpp": "^0.
|
|
217
|
+
"@qvac/llm-llamacpp": "^0.65.0",
|
|
230
218
|
"@qvac/logging": "^0.1.0",
|
|
231
|
-
"@qvac/ocr-ggml": "^0.
|
|
232
|
-
"@qvac/translation-nmtcpp": "^0.
|
|
233
|
-
"@qvac/tts-ggml": "^0.
|
|
234
|
-
"@qvac/
|
|
219
|
+
"@qvac/ocr-ggml": "^0.31.0",
|
|
220
|
+
"@qvac/translation-nmtcpp": "^0.23.0",
|
|
221
|
+
"@qvac/tts-ggml": "^0.14.0",
|
|
222
|
+
"@qvac/turbovec-ggml": "^0.3.0",
|
|
223
|
+
"@qvac/vla-ggml": "^0.34.0",
|
|
235
224
|
"bare-abort-controller": "^1.0.0",
|
|
236
225
|
"bare-cpu-info": "0.1.1",
|
|
237
226
|
"bare-crypto": "^1.15.0",
|
|
@@ -239,13 +228,14 @@
|
|
|
239
228
|
"bare-events": "2.9.1",
|
|
240
229
|
"bare-fs": "^4.5.1",
|
|
241
230
|
"bare-gpu-info": "0.1.1",
|
|
231
|
+
"bare-link": "^4.0.1",
|
|
242
232
|
"bare-net": "^2.3.2",
|
|
243
233
|
"bare-os": "^3.6.2",
|
|
244
|
-
"bare-pack": "^
|
|
234
|
+
"bare-pack": "^3.0.2",
|
|
245
235
|
"bare-path": "^3.0.1",
|
|
246
236
|
"bare-rpc": "^1.3.2",
|
|
247
|
-
"bare-runtime": "^1.
|
|
248
|
-
"bare-signals": "^
|
|
237
|
+
"bare-runtime": "^1.34.1",
|
|
238
|
+
"bare-signals": "^5.0.0",
|
|
249
239
|
"bare-stream": "2.13.3",
|
|
250
240
|
"bare-zlib": "^1.3.1",
|
|
251
241
|
"compact-encoding": "^3.0.0",
|
|
@@ -256,13 +246,13 @@
|
|
|
256
246
|
"semver": "^7.8.0",
|
|
257
247
|
"tar-stream": "^3.1.8",
|
|
258
248
|
"which-runtime": "^1.3.2",
|
|
259
|
-
"zod": "
|
|
249
|
+
"zod": "4.6.5",
|
|
260
250
|
"bare-buffer": "^3.4.2"
|
|
261
251
|
},
|
|
262
252
|
"devDependencies": {
|
|
263
253
|
"@electron-forge/plugin-base": "^7.11.1",
|
|
264
254
|
"@expo/config-plugins": "^54.0.4",
|
|
265
|
-
"bare-module": "^
|
|
255
|
+
"bare-module": "^7.2.1",
|
|
266
256
|
"@lancedb/lancedb": "^0.21.3",
|
|
267
257
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
268
258
|
"apache-arrow": "^18.1.0",
|
|
@@ -288,7 +278,7 @@
|
|
|
288
278
|
"pear-pipe": "^1.0.6",
|
|
289
279
|
"prettier": "^3.9.4",
|
|
290
280
|
"prettier-config-holepunch": "^2.0.0",
|
|
291
|
-
"react-native-bare-kit": "^0.
|
|
281
|
+
"react-native-bare-kit": "^0.16.0",
|
|
292
282
|
"tsc-alias": "^1.8.17",
|
|
293
283
|
"tsx": "4.23.1",
|
|
294
284
|
"typescript": "^5.9.3",
|
|
@@ -296,22 +286,18 @@
|
|
|
296
286
|
},
|
|
297
287
|
"peerDependencies": {
|
|
298
288
|
"@electron-forge/plugin-base": "^7.11.1",
|
|
299
|
-
"bare-link": ">=3.0.0",
|
|
300
289
|
"expo-build-properties": ">=0.12.0",
|
|
301
290
|
"expo-device": ">=8.0.0",
|
|
302
291
|
"expo-file-system": ">=19.0.0",
|
|
303
292
|
"expo-modules-core": ">=3.0.0",
|
|
304
293
|
"pear-pipe": ">=1.0.0",
|
|
305
|
-
"react-native-bare-kit": "
|
|
294
|
+
"react-native-bare-kit": ">=0.16.0",
|
|
306
295
|
"tsx": "*"
|
|
307
296
|
},
|
|
308
297
|
"peerDependenciesMeta": {
|
|
309
298
|
"@electron-forge/plugin-base": {
|
|
310
299
|
"optional": true
|
|
311
300
|
},
|
|
312
|
-
"bare-link": {
|
|
313
|
-
"optional": true
|
|
314
|
-
},
|
|
315
301
|
"expo-build-properties": {
|
|
316
302
|
"optional": true
|
|
317
303
|
},
|
|
@@ -339,5 +325,29 @@
|
|
|
339
325
|
"shell-quote": "^1.10.0",
|
|
340
326
|
"@electron/rebuild": "^4.2.0"
|
|
341
327
|
},
|
|
342
|
-
"
|
|
343
|
-
|
|
328
|
+
"gitHead": "4badf6ff1900bbf099b63792fe663a33cc0e6c82",
|
|
329
|
+
"scripts": {
|
|
330
|
+
"test:unit": "tsx scripts/run-unit-tests.ts",
|
|
331
|
+
"format": "prettier --check .",
|
|
332
|
+
"format:fix": "prettier --write .",
|
|
333
|
+
"lint": "lunte && npm run enforce-inference-versions",
|
|
334
|
+
"lint:fix": "lunte --fix",
|
|
335
|
+
"enforce-inference-versions": "tsx scripts/enforce-inference-versions.ts",
|
|
336
|
+
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p test/tsconfig.types.json",
|
|
337
|
+
"postcompile:aliases": "tsc-alias -p tsconfig.alias.json",
|
|
338
|
+
"build": "rm -rf dist && npm run lint && tsc --project tsconfig.json && npm run postcompile:aliases",
|
|
339
|
+
"build:pack": "npm run build && npm pack --ignore-scripts --pack-destination dist/",
|
|
340
|
+
"sdk-source:workspace": "node ./scripts/link-workspace-inference.mjs",
|
|
341
|
+
"watch": "nodemon --watch src --ext ts --exec 'npm run build'",
|
|
342
|
+
"bare:ensureprebuilds:llamacpp": "cp -r node_modules/@qvac/llm-llamacpp/prebuilds/android-arm64 node_modules/@qvac/llm-llamacpp/prebuilds/android-ia32 && cp -r node_modules/@qvac/llm-llamacpp/prebuilds/android-arm64 node_modules/@qvac/llm-llamacpp/prebuilds/android-arm && cp -r node_modules/@qvac/llm-llamacpp/prebuilds/android-arm64 node_modules/@qvac/llm-llamacpp/prebuilds/android-x64",
|
|
343
|
+
"bare:ensureprebuilds:asr": "cp -r node_modules/@qvac/asr-ggml/prebuilds/android-arm64 node_modules/@qvac/asr-ggml/prebuilds/android-ia32 && cp -r node_modules/@qvac/asr-ggml/prebuilds/android-arm64 node_modules/@qvac/asr-ggml/prebuilds/android-arm && cp -r node_modules/@qvac/asr-ggml/prebuilds/android-arm64 node_modules/@qvac/asr-ggml/prebuilds/android-x64",
|
|
344
|
+
"bare:ensureprebuilds:embeddings": "cp -r node_modules/@qvac/embed-llamacpp/prebuilds/android-arm64 node_modules/@qvac/embed-llamacpp/prebuilds/android-ia32 && cp -r node_modules/@qvac/embed-llamacpp/prebuilds/android-arm64 node_modules/@qvac/embed-llamacpp/prebuilds/android-arm && cp -r node_modules/@qvac/embed-llamacpp/prebuilds/android-arm64 node_modules/@qvac/embed-llamacpp/prebuilds/android-x64",
|
|
345
|
+
"bare:ensureprebuilds": "npm run bare:ensureprebuilds:llamacpp && npm run bare:ensureprebuilds:asr && npm run bare:ensureprebuilds:embeddings",
|
|
346
|
+
"prepare:husky": "husky",
|
|
347
|
+
"contract:export": "tsx ./scripts/export-contract.ts",
|
|
348
|
+
"contract:check": "tsx ./scripts/export-contract.ts --check",
|
|
349
|
+
"check:resource-collectors": "tsx ./scripts/check-resource-collectors-packaging.ts",
|
|
350
|
+
"bare-kit-runtimes:generate": "tsx ./scripts/generate-bare-kit-runtimes.ts",
|
|
351
|
+
"changelog:generate": "node ../../scripts/sdk/generate-changelog-sdk-pod.cjs --package=sdk && prettier --write changelog"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @qvac/sdk/electron-forge
|
|
3
3
|
*
|
|
4
4
|
* Electron Forge plugin: bundles the QVAC worker, verifies its native addons,
|
|
5
|
-
* then configures Electron Packager to tree-shake unused @qvac/* addons
|
|
6
|
-
*
|
|
5
|
+
* then configures Electron Packager to tree-shake unused @qvac/* addons
|
|
6
|
+
* (per-platform packages of split addons included) and non-target prebuilds.
|
|
7
7
|
*
|
|
8
8
|
* macOS universal (`arch: "universal"`) is not supported — native addon
|
|
9
9
|
* prebuilds are arch-specific. Build darwin-arm64 and darwin-x64 separately.
|
|
@@ -146,38 +146,14 @@ function findQvacScopeDir(startDir) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* `@qvac/
|
|
153
|
-
*
|
|
154
|
-
* `@qvac/<addon>-ios`). Those packages carry no top-level `addon: true`;
|
|
155
|
-
* instead they embed an inner `addon/` package named after the meta addon.
|
|
156
|
-
* Returns that addon name, or null when `pkgDir` is not a platform package.
|
|
157
|
-
* Exposed for unit testing.
|
|
158
|
-
*/
|
|
159
|
-
function readPlatformPackageAddon(pkgDir) {
|
|
160
|
-
const addonPkgJsonPath = path.join(pkgDir, 'addon', 'package.json')
|
|
161
|
-
if (!fs.existsSync(addonPkgJsonPath)) return null
|
|
162
|
-
|
|
163
|
-
try {
|
|
164
|
-
const pkg = JSON.parse(fs.readFileSync(addonPkgJsonPath, 'utf8'))
|
|
165
|
-
if (pkg.addon === true && typeof pkg.name === 'string' && pkg.name.length > 0) {
|
|
166
|
-
return pkg.name
|
|
167
|
-
}
|
|
168
|
-
} catch (err) {
|
|
169
|
-
logger.warn(`Failed to parse ${addonPkgJsonPath}: ${err.message}`)
|
|
170
|
-
}
|
|
171
|
-
return null
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Discovers installed @qvac packages by scanning node_modules/@qvac: the
|
|
176
|
-
* addons (`addon: true` in package.json) and the per-platform prebuild
|
|
177
|
-
* packages, each mapped to the addon it belongs to.
|
|
149
|
+
* Discovers installed @qvac addons (`addon: true` in package.json) by
|
|
150
|
+
* scanning node_modules/@qvac. Split addons (`@qvac/fabric`, the ggml speech
|
|
151
|
+
* addons) ship their native code in per-platform packages such as
|
|
152
|
+
* `@qvac/fabric-darwin-arm64`, which are ordinary addons: the bundle names
|
|
153
|
+
* the one each host links, and the meta package itself carries no binaries.
|
|
178
154
|
*/
|
|
179
155
|
function discoverQvacAddonPackages(projectDir) {
|
|
180
|
-
const nothing = { addons: []
|
|
156
|
+
const nothing = { addons: [] }
|
|
181
157
|
|
|
182
158
|
let scopeDir
|
|
183
159
|
try {
|
|
@@ -196,7 +172,6 @@ function discoverQvacAddonPackages(projectDir) {
|
|
|
196
172
|
}
|
|
197
173
|
|
|
198
174
|
const addons = []
|
|
199
|
-
const platformPackages = []
|
|
200
175
|
|
|
201
176
|
for (const name of entries) {
|
|
202
177
|
const pkgDir = path.join(scopeDir, name)
|
|
@@ -208,22 +183,14 @@ function discoverQvacAddonPackages(projectDir) {
|
|
|
208
183
|
const packageName = `@qvac/${name}`
|
|
209
184
|
try {
|
|
210
185
|
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))
|
|
211
|
-
if (pkg.addon === true)
|
|
212
|
-
addons.push(packageName)
|
|
213
|
-
continue
|
|
214
|
-
}
|
|
186
|
+
if (pkg.addon === true) addons.push(packageName)
|
|
215
187
|
} catch (err) {
|
|
216
188
|
logger.warn(`Failed to parse ${pkgJsonPath}: ${err.message}`)
|
|
217
|
-
continue
|
|
218
189
|
}
|
|
219
|
-
|
|
220
|
-
const addon = readPlatformPackageAddon(pkgDir)
|
|
221
|
-
if (addon !== null) platformPackages.push({ name: packageName, addon })
|
|
222
190
|
}
|
|
223
191
|
|
|
224
192
|
addons.sort()
|
|
225
|
-
|
|
226
|
-
return { addons, platformPackages }
|
|
193
|
+
return { addons }
|
|
227
194
|
}
|
|
228
195
|
|
|
229
196
|
/**
|
|
@@ -240,27 +207,11 @@ function diffAddons(installed, required) {
|
|
|
240
207
|
}
|
|
241
208
|
|
|
242
209
|
/**
|
|
243
|
-
*
|
|
244
|
-
* required set. A platform package ships only its addon's binaries, so it
|
|
245
|
-
* follows that addon's include/exclude decision.
|
|
246
|
-
* Exposed for unit testing.
|
|
247
|
-
*/
|
|
248
|
-
function diffPlatformPackages(platformPackages, required) {
|
|
249
|
-
const requiredSet = new Set(required)
|
|
250
|
-
const exclusions = []
|
|
251
|
-
for (const { name, addon } of platformPackages) {
|
|
252
|
-
if (!requiredSet.has(addon)) exclusions.push(name)
|
|
253
|
-
}
|
|
254
|
-
return exclusions
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Computes the list of installed @qvac addons that aren't in `required`,
|
|
259
|
-
* plus the per-platform prebuild packages of those excluded addons.
|
|
210
|
+
* Computes the list of installed @qvac addons that aren't in `required`.
|
|
260
211
|
* Logs include/exclude decisions for each discovered package.
|
|
261
212
|
*/
|
|
262
213
|
function computeExclusions(required, projectDir) {
|
|
263
|
-
const { addons
|
|
214
|
+
const { addons } = discoverQvacAddonPackages(projectDir)
|
|
264
215
|
|
|
265
216
|
if (addons.length === 0) {
|
|
266
217
|
logger.warn('No @qvac addon packages discovered. Skipping addon exclusions.')
|
|
@@ -277,14 +228,6 @@ function computeExclusions(required, projectDir) {
|
|
|
277
228
|
exclusions.push(pkg)
|
|
278
229
|
}
|
|
279
230
|
}
|
|
280
|
-
for (const { name, addon } of platformPackages) {
|
|
281
|
-
if (requiredSet.has(addon)) {
|
|
282
|
-
logger.info(`Including platform package ${name} (prebuilds for ${addon})`)
|
|
283
|
-
} else {
|
|
284
|
-
logger.info(`Excluding platform package ${name} (prebuilds for unused addon ${addon})`)
|
|
285
|
-
exclusions.push(name)
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
231
|
return exclusions
|
|
289
232
|
}
|
|
290
233
|
|
|
@@ -842,8 +785,6 @@ module.exports.QvacForgePluginError = QvacForgePluginError
|
|
|
842
785
|
// Internal helpers exposed for unit tests. Not part of the stable API.
|
|
843
786
|
module.exports.createIgnore = createIgnore
|
|
844
787
|
module.exports.diffAddons = diffAddons
|
|
845
|
-
module.exports.diffPlatformPackages = diffPlatformPackages
|
|
846
|
-
module.exports.readPlatformPackageAddon = readPlatformPackageAddon
|
|
847
788
|
module.exports.detectTargetHosts = detectTargetHosts
|
|
848
789
|
module.exports.resolveHosts = resolveHosts
|
|
849
790
|
module.exports.runBundleAndVerify = runBundleAndVerify
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Overrides the SDK's @qvac/inference dependency with the in-monorepo sibling
|
|
2
|
-
// for the "workspace" pod-check leg, so the SDK builds and tests against the
|
|
3
|
-
// engine at the same commit.
|
|
4
|
-
import { readFileSync, writeFileSync } from 'fs';
|
|
5
|
-
import { join, resolve, dirname } from 'path';
|
|
6
|
-
import { spawnSync } from 'child_process';
|
|
7
|
-
import { fileURLToPath } from 'url';
|
|
8
|
-
const sdkDir = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
9
|
-
const inferenceDir = resolve(sdkDir, '..', 'inference');
|
|
10
|
-
function declaresInference() {
|
|
11
|
-
const pkg = JSON.parse(readFileSync(join(sdkDir, 'package.json'), 'utf8'));
|
|
12
|
-
return Boolean(pkg.dependencies?.['@qvac/inference']);
|
|
13
|
-
}
|
|
14
|
-
function run(command, args, cwd) {
|
|
15
|
-
const { status, error } = spawnSync(command, args, { cwd, stdio: 'inherit' });
|
|
16
|
-
if (error)
|
|
17
|
-
throw error;
|
|
18
|
-
if (status !== 0)
|
|
19
|
-
process.exit(status ?? 1);
|
|
20
|
-
}
|
|
21
|
-
if (!declaresInference()) {
|
|
22
|
-
console.log('[link-workspace-inference] @qvac/inference is not a dependency; skipping');
|
|
23
|
-
process.exit(0);
|
|
24
|
-
}
|
|
25
|
-
run('bun', ['install'], inferenceDir);
|
|
26
|
-
run('bun', ['run', 'build'], inferenceDir);
|
|
27
|
-
const manifestPath = join(sdkDir, 'package.json');
|
|
28
|
-
const pkg = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
29
|
-
pkg.dependencies['@qvac/inference'] = 'file:../inference';
|
|
30
|
-
writeFileSync(manifestPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
31
|
-
run('bun', ['install'], sdkDir);
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Patched android/link.mjs for manifest-aware native addon linking.
|
|
3
|
-
*
|
|
4
|
-
* If qvac/addons.manifest.json exists, only links the allowlisted addons.
|
|
5
|
-
* Otherwise, falls back to linking all installed addons.
|
|
6
|
-
*
|
|
7
|
-
* This file is copied over react-native-bare-kit/android/link.mjs
|
|
8
|
-
* by withMobileBundle.ts during expo prebuild. The resolver it imports is
|
|
9
|
-
* compiled from qvac-platform-addons.ts and installed beside this file as
|
|
10
|
-
* qvac-platform-addons.mjs.
|
|
11
|
-
*/
|
|
12
|
-
import fs from 'fs'
|
|
13
|
-
import path from 'path'
|
|
14
|
-
import { fileURLToPath } from 'url'
|
|
15
|
-
import link from 'bare-link'
|
|
16
|
-
import { resolvePlatformAddonRoots } from './qvac-platform-addons.mjs'
|
|
17
|
-
|
|
18
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
19
|
-
const projectRoot = path.join(__dirname, '..', '..', '..')
|
|
20
|
-
const addonsDir = path.join(__dirname, 'src', 'main', 'addons')
|
|
21
|
-
|
|
22
|
-
if (fs.existsSync(addonsDir)) {
|
|
23
|
-
console.log('[QVAC] Cleaning existing addons directory...')
|
|
24
|
-
fs.rmSync(addonsDir, { recursive: true, force: true })
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const manifestPath = path.join(projectRoot, 'qvac', 'addons.manifest.json')
|
|
28
|
-
|
|
29
|
-
let pkg = null
|
|
30
|
-
let addonNames = []
|
|
31
|
-
if (fs.existsSync(manifestPath)) {
|
|
32
|
-
try {
|
|
33
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
|
34
|
-
const addons = Array.isArray(manifest.addons) ? manifest.addons : []
|
|
35
|
-
addonNames = addons
|
|
36
|
-
|
|
37
|
-
if (addons.length > 0) {
|
|
38
|
-
console.log(`[QVAC] Using addons manifest (${addons.length} addons): ${addons.join(', ')}`)
|
|
39
|
-
pkg = {
|
|
40
|
-
name: 'qvac-addon-linker',
|
|
41
|
-
version: '0.0.0',
|
|
42
|
-
dependencies: Object.fromEntries(addons.map((name) => [name, '*']))
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
console.log('[QVAC] Addons manifest is empty, linking all addons')
|
|
46
|
-
}
|
|
47
|
-
} catch (err) {
|
|
48
|
-
console.warn('[QVAC] Failed to parse addons manifest, linking all addons:', err.message)
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
console.log('[QVAC] No addons manifest found, linking all addons')
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const hosts = ['android-arm64', 'android-arm', 'android-ia32', 'android-x64']
|
|
55
|
-
|
|
56
|
-
for await (const resource of link(projectRoot, { hosts, out: addonsDir }, pkg)) {
|
|
57
|
-
console.log('Wrote', resource)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Split addons keep their binaries in a per-platform package; bare-link only
|
|
61
|
-
// reaches the meta, which has shipped no prebuilds/ since the split.
|
|
62
|
-
for (const addon of resolvePlatformAddonRoots(projectRoot, addonNames, 'android')) {
|
|
63
|
-
console.log(`[QVAC] Linking split addon ${addon.pkg.name} from its platform package`)
|
|
64
|
-
for await (const resource of link(addon.dir, { hosts, out: addonsDir }, addon.pkg)) {
|
|
65
|
-
console.log('Wrote', resource)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Patched ios/link.mjs for manifest-aware native addon linking.
|
|
3
|
-
*
|
|
4
|
-
* If qvac/addons.manifest.json exists, only links the allowlisted addons.
|
|
5
|
-
* Otherwise, falls back to linking all installed addons.
|
|
6
|
-
*
|
|
7
|
-
* This file is copied over react-native-bare-kit/ios/link.mjs
|
|
8
|
-
* by withMobileBundle.ts during expo prebuild. The resolver it imports is
|
|
9
|
-
* compiled from qvac-platform-addons.ts and installed beside this file as
|
|
10
|
-
* qvac-platform-addons.mjs.
|
|
11
|
-
*/
|
|
12
|
-
import fs from 'fs'
|
|
13
|
-
import path from 'path'
|
|
14
|
-
import { fileURLToPath } from 'url'
|
|
15
|
-
import link from 'bare-link'
|
|
16
|
-
import { resolvePlatformAddonRoots } from './qvac-platform-addons.mjs'
|
|
17
|
-
|
|
18
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
19
|
-
const projectRoot = path.join(__dirname, '..', '..', '..')
|
|
20
|
-
const addonsDir = path.join(__dirname, 'addons')
|
|
21
|
-
|
|
22
|
-
if (fs.existsSync(addonsDir)) {
|
|
23
|
-
console.log('[QVAC] Cleaning existing addons directory...')
|
|
24
|
-
fs.rmSync(addonsDir, { recursive: true, force: true })
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const manifestPath = path.join(projectRoot, 'qvac', 'addons.manifest.json')
|
|
28
|
-
|
|
29
|
-
let pkg = null
|
|
30
|
-
let addonNames = []
|
|
31
|
-
if (fs.existsSync(manifestPath)) {
|
|
32
|
-
try {
|
|
33
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
|
34
|
-
const addons = Array.isArray(manifest.addons) ? manifest.addons : []
|
|
35
|
-
addonNames = addons
|
|
36
|
-
|
|
37
|
-
if (addons.length > 0) {
|
|
38
|
-
console.log(`[QVAC] Using addons manifest (${addons.length} addons): ${addons.join(', ')}`)
|
|
39
|
-
pkg = {
|
|
40
|
-
name: 'qvac-addon-linker',
|
|
41
|
-
version: '0.0.0',
|
|
42
|
-
dependencies: Object.fromEntries(addons.map((name) => [name, '*']))
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
console.log('[QVAC] Addons manifest is empty, linking all addons')
|
|
46
|
-
}
|
|
47
|
-
} catch (err) {
|
|
48
|
-
console.warn('[QVAC] Failed to parse addons manifest, linking all addons:', err.message)
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
console.log('[QVAC] No addons manifest found, linking all addons')
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const hosts = ['ios-arm64', 'ios-arm64-simulator', 'ios-x64-simulator']
|
|
55
|
-
|
|
56
|
-
for await (const resource of link(projectRoot, { hosts, out: addonsDir }, pkg)) {
|
|
57
|
-
console.log('Wrote', resource)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Split addons keep their binaries in a per-platform package; bare-link only
|
|
61
|
-
// reaches the meta, which has shipped no prebuilds/ since the split.
|
|
62
|
-
for (const addon of resolvePlatformAddonRoots(projectRoot, addonNames, 'ios')) {
|
|
63
|
-
console.log(`[QVAC] Linking split addon ${addon.pkg.name} from its platform package`)
|
|
64
|
-
for await (const resource of link(addon.dir, { hosts, out: addonsDir }, addon.pkg)) {
|
|
65
|
-
console.log('Wrote', resource)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves split-addon platform packages from the meta package's `#host-addon`
|
|
3
|
-
* map. Linker, verify, and the missing-prebuild error all call this module so
|
|
4
|
-
* the slice name cannot drift from what the addon actually imports.
|
|
5
|
-
*
|
|
6
|
-
* Keep this file free of `@/` imports: the compiled JS is copied next to the
|
|
7
|
-
* patched `link.mjs` as `qvac-platform-addons.mjs`.
|
|
8
|
-
*/
|
|
9
|
-
import * as fs from 'fs'
|
|
10
|
-
import * as path from 'path'
|
|
11
|
-
|
|
12
|
-
export const HOST_ADDON_IMPORT = '#host-addon'
|
|
13
|
-
|
|
14
|
-
const DEFAULT_ANDROID_CPU = 'arm64'
|
|
15
|
-
|
|
16
|
-
export interface PlatformAddonRoot {
|
|
17
|
-
dir: string
|
|
18
|
-
pkg: { name?: string; version?: string; addon?: boolean }
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function resolvePlatformAddonRoots(
|
|
22
|
-
projectRoot: string,
|
|
23
|
-
addonNames: string[],
|
|
24
|
-
platform: string
|
|
25
|
-
): PlatformAddonRoot[] {
|
|
26
|
-
const roots: PlatformAddonRoot[] = []
|
|
27
|
-
for (const name of addonNames) {
|
|
28
|
-
const root = resolvePlatformAddonRoot(projectRoot, name, platform)
|
|
29
|
-
if (root !== null) roots.push(root)
|
|
30
|
-
}
|
|
31
|
-
return roots
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function resolvePlatformAddonRoot(
|
|
35
|
-
projectRoot: string,
|
|
36
|
-
metaName: string,
|
|
37
|
-
platform: string
|
|
38
|
-
): PlatformAddonRoot | null {
|
|
39
|
-
const metaManifest = readManifest(packageDir(projectRoot, metaName))
|
|
40
|
-
if (metaManifest === null) return null
|
|
41
|
-
|
|
42
|
-
const platformPackage = resolveAddonPlatformPackage(
|
|
43
|
-
metaName,
|
|
44
|
-
metaManifest.imports?.[HOST_ADDON_IMPORT],
|
|
45
|
-
platform
|
|
46
|
-
)
|
|
47
|
-
if (platformPackage === null) return null
|
|
48
|
-
|
|
49
|
-
const addonDir = path.join(packageDir(projectRoot, platformPackage), 'addon')
|
|
50
|
-
const addonManifest = readManifest(addonDir)
|
|
51
|
-
if (addonManifest === null || addonManifest.addon !== true) return null
|
|
52
|
-
if (!fs.existsSync(path.join(addonDir, 'prebuilds'))) return null
|
|
53
|
-
|
|
54
|
-
return { dir: addonDir, pkg: addonManifest }
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function packageDir(projectRoot: string, packageName: string): string {
|
|
58
|
-
return path.join(projectRoot, 'node_modules', ...packageName.split('/'))
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
interface AddonManifest {
|
|
62
|
-
name?: string
|
|
63
|
-
version?: string
|
|
64
|
-
addon?: boolean
|
|
65
|
-
imports?: Record<string, unknown>
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function readManifest(dir: string): AddonManifest | null {
|
|
69
|
-
try {
|
|
70
|
-
const parsed: unknown = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'))
|
|
71
|
-
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null
|
|
72
|
-
return parsed as AddonManifest
|
|
73
|
-
} catch {
|
|
74
|
-
return null
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Package `#host-addon` names for `host`, if that name belongs to `metaName`.
|
|
80
|
-
* `host` is a Bare host (`android-arm64`, `ios-arm64-simulator`, `darwin-arm64`)
|
|
81
|
-
* or a mobile build target (`android`, `ios`).
|
|
82
|
-
*/
|
|
83
|
-
export function resolveAddonPlatformPackage(
|
|
84
|
-
metaName: string,
|
|
85
|
-
hostAddon: unknown,
|
|
86
|
-
host: string
|
|
87
|
-
): string | null {
|
|
88
|
-
const name = resolvePlatformPackageName(hostAddon, host)
|
|
89
|
-
if (name === null) return null
|
|
90
|
-
if (!name.startsWith(`${metaName}-`)) return null
|
|
91
|
-
return name
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* First package name a `#host-addon` map points at for `host`.
|
|
96
|
-
* Android nests the package under its architecture; iOS is a flat list.
|
|
97
|
-
* A platform-only `android` target uses arm64, matching the current mobile host.
|
|
98
|
-
*/
|
|
99
|
-
export function resolvePlatformPackageName(hostAddon: unknown, host: string): string | null {
|
|
100
|
-
if (typeof host !== 'string' || host.length === 0) return null
|
|
101
|
-
|
|
102
|
-
const separator = host.indexOf('-')
|
|
103
|
-
const platform = separator === -1 ? host : host.slice(0, separator)
|
|
104
|
-
const cpu = separator === -1 ? '' : host.slice(separator + 1)
|
|
105
|
-
|
|
106
|
-
const branch = readBranch(hostAddon, platform)
|
|
107
|
-
const direct = packageName(branch)
|
|
108
|
-
if (direct !== null) return direct
|
|
109
|
-
|
|
110
|
-
const cpuKey = cpu.length > 0 ? cpu : DEFAULT_ANDROID_CPU
|
|
111
|
-
return packageName(readBranch(branch, cpuKey))
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function packageName(candidate: unknown): string | null {
|
|
115
|
-
const name = Array.isArray(candidate) ? candidate[0] : candidate
|
|
116
|
-
if (typeof name !== 'string' || name.startsWith('.')) return null
|
|
117
|
-
return name
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function readBranch(value: unknown, key: string): unknown {
|
|
121
|
-
if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined
|
|
122
|
-
if (!Object.hasOwn(value, key)) return undefined
|
|
123
|
-
return (value as Record<string, unknown>)[key]
|
|
124
|
-
}
|