@qvac/sdk 0.21.1 → 0.22.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.
Files changed (167) hide show
  1. package/NOTICE +84 -55
  2. package/README.md +167 -24
  3. package/dist/examples/abot-world.js +1 -1
  4. package/dist/examples/advisory-model-fit.d.ts +0 -58
  5. package/dist/examples/advisory-model-fit.js +23 -150
  6. package/dist/examples/asr/moss-transcribe-filesystem.d.ts +2 -0
  7. package/dist/examples/asr/moss-transcribe-filesystem.js +84 -0
  8. package/dist/examples/asr/moss-transcribe-fit.d.ts +2 -0
  9. package/dist/examples/asr/moss-transcribe-fit.js +40 -0
  10. package/dist/examples/asr/nemotron-diarization-filesystem.d.ts +2 -0
  11. package/dist/examples/asr/nemotron-diarization-filesystem.js +64 -0
  12. package/dist/examples/asr/parakeet-ctc-filesystem.js +2 -2
  13. package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +2 -2
  14. package/dist/examples/asr/parakeet-microphone-record.js +1 -1
  15. package/dist/examples/asr/parakeet-microphone-stream.js +1 -1
  16. package/dist/examples/asr/parakeet-nemotron-filesystem.js +3 -3
  17. package/dist/examples/asr/parakeet-sortformer-streaming.js +2 -2
  18. package/dist/examples/asr/parakeet-sortformer.js +1 -1
  19. package/dist/examples/asr/parakeet-tdt-filesystem-chunked.js +2 -2
  20. package/dist/examples/asr/parakeet-tdt-filesystem.js +2 -2
  21. package/dist/examples/asr/parakeet-unified-coreml.js +2 -2
  22. package/dist/examples/asr/parakeet-unified-filesystem.js +2 -2
  23. package/dist/examples/asr/whispercpp-filesystem-streaming.js +1 -1
  24. package/dist/examples/asr/whispercpp-filesystem.js +1 -1
  25. package/dist/examples/asr/whispercpp-microphone-record.js +1 -1
  26. package/dist/examples/asr/whispercpp-prompt.js +1 -1
  27. package/dist/examples/assess-model-fit.js +3 -6
  28. package/dist/examples/audiogen/edit-music.js +2 -2
  29. package/dist/examples/audiogen/generate-cover.js +2 -2
  30. package/dist/examples/audiogen/generate-music-minimax.js +1 -1
  31. package/dist/examples/audiogen/generate-music.js +1 -1
  32. package/dist/examples/audiogen/understand-music.js +2 -2
  33. package/dist/examples/batch-completion.d.ts +1 -1
  34. package/dist/examples/batch-completion.js +1 -1
  35. package/dist/examples/bci/bci-filesystem-streaming.js +2 -2
  36. package/dist/examples/bci/bci-filesystem.js +2 -2
  37. package/dist/examples/concurrent-completion-collision.js +1 -1
  38. package/dist/examples/config-reload.js +1 -1
  39. package/dist/examples/decisions.d.ts +2 -0
  40. package/dist/examples/decisions.js +38 -0
  41. package/dist/examples/diffusion-esrgan-upscale.js +1 -1
  42. package/dist/examples/diffusion-flux2-klein-img2img.js +1 -1
  43. package/dist/examples/diffusion-img2img.js +1 -1
  44. package/dist/examples/diffusion-img2vid-ltx.js +1 -1
  45. package/dist/examples/diffusion-img2vid-minimax-h3.d.ts +2 -0
  46. package/dist/examples/diffusion-img2vid-minimax-h3.js +72 -0
  47. package/dist/examples/diffusion-img2vid.js +1 -1
  48. package/dist/examples/llamacpp-filesystem.js +1 -1
  49. package/dist/examples/llamacpp-multi-gpu.js +2 -2
  50. package/dist/examples/llamacpp-structured-output.js +1 -1
  51. package/dist/examples/mcp-websearch.d.ts +2 -2
  52. package/dist/examples/mcp-websearch.js +3 -3
  53. package/dist/examples/model-fit-ui/server.d.ts +1 -1
  54. package/dist/examples/model-fit-ui/server.js +1 -1
  55. package/dist/examples/multi-job-completion.d.ts +1 -1
  56. package/dist/examples/multi-job-completion.js +1 -1
  57. package/dist/examples/ocr-fasttext.js +1 -1
  58. package/dist/examples/tools/llamacpp-tools-auto-dialect.js +1 -1
  59. package/dist/examples/tools/llamacpp-tools-gemma4.js +1 -1
  60. package/dist/examples/tools/llamacpp-tools-qwen35.js +1 -1
  61. package/dist/examples/tts/llm-to-tts-streaming.d.ts +2 -2
  62. package/dist/examples/tts/llm-to-tts-streaming.js +2 -2
  63. package/dist/examples/tts/moss-sound-effect-controls.d.ts +2 -0
  64. package/dist/examples/tts/moss-sound-effect-controls.js +88 -0
  65. package/dist/examples/tts/moss-sound-effect.d.ts +2 -0
  66. package/dist/examples/tts/moss-sound-effect.js +86 -0
  67. package/dist/examples/tts/moss-speech-audio.d.ts +2 -0
  68. package/dist/examples/tts/moss-speech-audio.js +159 -0
  69. package/dist/examples/tts/moss-speech.d.ts +2 -0
  70. package/dist/examples/tts/moss-speech.js +70 -0
  71. package/dist/examples/vla-groot.js +2 -2
  72. package/dist/examples/vla-pi05.js +2 -2
  73. package/dist/examples/vla-smolvla.js +2 -2
  74. package/dist/examples/voice-assistant/voice-assistant.js +1 -1
  75. package/dist/scripts/contract/build-contract.d.ts +3 -1
  76. package/dist/scripts/contract/build-contract.js +40 -2
  77. package/dist/scripts/contract/build-model-type-maps.d.ts +6 -1
  78. package/dist/scripts/contract/build-model-type-maps.js +3 -2
  79. package/dist/scripts/contract/constants-registry.d.ts +4 -0
  80. package/dist/scripts/contract/constants-registry.js +3 -1
  81. package/dist/scripts/contract/method-shapes.d.ts +1 -0
  82. package/dist/scripts/contract/method-shapes.js +1 -0
  83. package/dist/scripts/export-contract.js +20 -7
  84. package/dist/scripts/run-unit-tests.js +10 -5
  85. package/dist/src/client/api/assess-model-fit.d.ts +5 -5
  86. package/dist/src/client/api/assess-model-fit.js +5 -6
  87. package/dist/src/client/api/audio-edit.d.ts +14 -2
  88. package/dist/src/client/api/audio-edit.js +14 -2
  89. package/dist/src/client/api/audio-gen.d.ts +10 -2
  90. package/dist/src/client/api/audio-gen.js +10 -2
  91. package/dist/src/client/api/audio-understand.d.ts +1 -1
  92. package/dist/src/client/api/audio-understand.js +1 -1
  93. package/dist/src/client/api/batch-completion.js +1 -1
  94. package/dist/src/client/api/completion-stream.js +1 -1
  95. package/dist/src/client/api/decide.d.ts +31 -0
  96. package/dist/src/client/api/decide.js +29 -0
  97. package/dist/src/client/api/index.d.ts +1 -0
  98. package/dist/src/client/api/index.js +1 -0
  99. package/dist/src/client/api/load-model.d.ts +1 -0
  100. package/dist/src/client/api/text-to-speech.d.ts +1 -0
  101. package/dist/src/client/api/text-to-speech.js +15 -22
  102. package/dist/src/client/api/transcribe.js +5 -2
  103. package/dist/src/client/api/video-request.d.ts +5 -5
  104. package/dist/src/client/api/video.d.ts +23 -3
  105. package/dist/src/client/api/video.js +23 -3
  106. package/dist/src/commands/bundle/bare-pack.d.ts +8 -0
  107. package/dist/src/commands/bundle/bare-pack.js +28 -5
  108. package/dist/src/commands/bundle/constants.js +2 -0
  109. package/dist/src/commands/bundle/index.d.ts +7 -6
  110. package/dist/src/commands/bundle/index.js +126 -43
  111. package/dist/src/commands/bundle/manifest.d.ts +2 -0
  112. package/dist/src/commands/bundle/manifest.js +3 -2
  113. package/dist/src/commands/host-prebuilds/index.d.ts +15 -7
  114. package/dist/src/commands/host-prebuilds/index.js +35 -16
  115. package/dist/src/commands/index.d.ts +1 -1
  116. package/dist/src/commands/index.js +1 -1
  117. package/dist/src/commands/verify/addon-source.d.ts +12 -0
  118. package/dist/src/commands/verify/addon-source.js +36 -3
  119. package/dist/src/commands/verify/bare-kit-runtimes.js +2 -1
  120. package/dist/src/commands/verify/node-modules-source.js +10 -1
  121. package/dist/src/{expo/plugins/patches/qvac-platform-addons.d.ts → commands/verify/platform-addons.d.ts} +6 -10
  122. package/dist/src/{expo/plugins/patches/qvac-platform-addons.js → commands/verify/platform-addons.js} +2 -45
  123. package/dist/src/commands/verify/prebuilds.d.ts +7 -10
  124. package/dist/src/commands/verify/prebuilds.js +43 -34
  125. package/dist/src/expo/plugins/get-project-root.d.ts +1 -1
  126. package/dist/src/expo/plugins/link-addons.d.ts +18 -0
  127. package/dist/src/expo/plugins/link-addons.js +65 -0
  128. package/dist/src/expo/plugins/withAndroidArchitecture.d.ts +1 -1
  129. package/dist/src/expo/plugins/withAndroidNdkVersion.d.ts +1 -1
  130. package/dist/src/expo/plugins/withDeviceInfo.d.ts +1 -1
  131. package/dist/src/expo/plugins/withMobileBundle.d.ts +11 -21
  132. package/dist/src/expo/plugins/withMobileBundle.js +22 -112
  133. package/dist/src/expo/plugins/withOpenCL.d.ts +1 -1
  134. package/dist/src/expo/plugins/withQvacSDK.d.ts +1 -1
  135. package/dist/src/index.d.ts +3 -3
  136. package/dist/src/index.js +2 -2
  137. package/dist/src/logging/base-logger.js +1 -1
  138. package/dist/src/logging/utils.js +1 -1
  139. package/dist/src/pear/pre.js +2 -0
  140. package/dist/src/plugin-ids.d.ts +3 -1
  141. package/dist/src/plugin-ids.js +4 -0
  142. package/dist/src/schemas/public.d.ts +2 -1
  143. package/dist/src/schemas/public.js +2 -1
  144. package/dist/src/schemas/sdk-errors-client.d.ts +3 -0
  145. package/dist/src/schemas/sdk-errors-client.js +16 -0
  146. package/dist/src/schemas/sdk-errors-server.d.ts +1 -0
  147. package/dist/src/schemas/sdk-errors-server.js +5 -0
  148. package/dist/src/utils/errors-client.d.ts +10 -0
  149. package/dist/src/utils/errors-client.js +18 -0
  150. package/dist/src/utils/mcp-adapter.js +12 -8
  151. package/dist/src/utils/tool-helpers.d.ts +1 -1
  152. package/dist/src/utils/tool-helpers.js +20 -52
  153. package/dist/src/worker/create-server.d.ts +1 -0
  154. package/dist/src/worker/create-server.js +5 -0
  155. package/dist/src/worker/index.js +4 -0
  156. package/dist/src/worker/lifecycle.js +9 -1
  157. package/dist/src/worker/plugins/llamacpp-decision.d.ts +2 -0
  158. package/dist/src/worker/plugins/llamacpp-decision.js +1 -0
  159. package/dist/src/worker/plugins/moss-transcribe.d.ts +2 -0
  160. package/dist/src/worker/plugins/moss-transcribe.js +1 -0
  161. package/package.json +39 -35
  162. package/src/electron-forge/index.cjs +12 -71
  163. package/dist/scripts/link-workspace-inference.d.ts +0 -2
  164. package/dist/scripts/link-workspace-inference.js +0 -31
  165. package/src/expo/plugins/patches/android-link.mjs +0 -67
  166. package/src/expo/plugins/patches/ios-link.mjs +0 -67
  167. package/src/expo/plugins/patches/qvac-platform-addons.ts +0 -124
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@qvac/sdk",
3
- "version": "0.21.1",
3
+ "version": "0.22.0",
4
+ "qvacIpcAuthentication": "token-v1",
4
5
  "license": "Apache-2.0",
5
6
  "repository": {
6
7
  "type": "git",
@@ -162,6 +163,14 @@
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"
165
174
  }
166
175
  },
167
176
  "imports": {
@@ -180,7 +189,6 @@
180
189
  "bare-imports.json",
181
190
  "dist/**/*",
182
191
  "src/electron-forge/**/*",
183
- "src/expo/plugins/patches/**/*",
184
192
  "!dist/**/*.map",
185
193
  "!**/package-lock.json",
186
194
  "!**/yarn.lock",
@@ -191,23 +199,23 @@
191
199
  "docs/system-resources-support-matrix.md"
192
200
  ],
193
201
  "scripts": {
194
- "test:unit": "bun run scripts/run-unit-tests.ts",
202
+ "test:unit": "tsx scripts/run-unit-tests.ts",
195
203
  "format": "prettier --check .",
196
204
  "format:fix": "prettier --write .",
197
205
  "lint": "lunte && npm run enforce-inference-versions",
198
206
  "lint:fix": "lunte --fix",
199
- "enforce-inference-versions": "bun scripts/enforce-inference-versions.ts",
207
+ "enforce-inference-versions": "tsx scripts/enforce-inference-versions.ts",
200
208
  "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p test/tsconfig.types.json",
201
209
  "postcompile:aliases": "tsc-alias -p tsconfig.alias.json",
202
210
  "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'",
211
+ "build:pack": "npm run build && npm pack --ignore-scripts --pack-destination dist/",
212
+ "sdk-source:workspace": "node ./scripts/link-workspace-inference.mjs",
213
+ "watch": "nodemon --watch src --ext ts --exec 'npm run build'",
206
214
  "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
215
  "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
216
  "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",
217
+ "bare:ensureprebuilds": "npm run bare:ensureprebuilds:llamacpp && npm run bare:ensureprebuilds:asr && npm run bare:ensureprebuilds:embeddings",
218
+ "prepare:husky": "husky",
211
219
  "contract:export": "tsx ./scripts/export-contract.ts",
212
220
  "contract:check": "tsx ./scripts/export-contract.ts --check",
213
221
  "check:resource-collectors": "tsx ./scripts/check-resource-collectors-packaging.ts",
@@ -215,23 +223,23 @@
215
223
  "changelog:generate": "node ../../scripts/sdk/generate-changelog-sdk-pod.cjs --package=sdk && prettier --write changelog"
216
224
  },
217
225
  "dependencies": {
218
- "@qvac/asr-ggml": "^0.7.1",
219
- "@qvac/audiogen-ggml": "^0.5.2",
220
- "@qvac/bci-whispercpp": "^0.10.2",
221
- "@qvac/classification-ggml": "^0.28.2",
222
- "@qvac/decoder-audio": "^0.7.0",
223
- "@qvac/diffusion-cpp": "^0.26.1",
224
- "@qvac/embed-llamacpp": "^0.43.2",
226
+ "@qvac/asr-ggml": "^0.10.0",
227
+ "@qvac/audiogen-ggml": "^0.8.0",
228
+ "@qvac/bci-whispercpp": "^0.12.0",
229
+ "@qvac/classification-ggml": "^0.31.1",
230
+ "@qvac/decoder-audio": "^0.8.1",
231
+ "@qvac/diffusion-cpp": "^0.30.0",
232
+ "@qvac/embed-llamacpp": "^0.48.1",
225
233
  "@qvac/error": "^0.1.1",
226
- "@qvac/ggml-rpc-server": "^0.1.2",
227
- "@qvac/inference": "^0.21.1",
234
+ "@qvac/ggml-rpc-server": "^0.5.1",
235
+ "@qvac/inference": "^0.22.0",
228
236
  "@qvac/langdetect-text": "^0.1.2",
229
- "@qvac/llm-llamacpp": "^0.55.2",
237
+ "@qvac/llm-llamacpp": "^0.61.1",
230
238
  "@qvac/logging": "^0.1.0",
231
- "@qvac/ocr-ggml": "^0.26.2",
232
- "@qvac/translation-nmtcpp": "^0.18.2",
233
- "@qvac/tts-ggml": "^0.10.2",
234
- "@qvac/vla-ggml": "^0.29.2",
239
+ "@qvac/ocr-ggml": "^0.29.1",
240
+ "@qvac/translation-nmtcpp": "^0.21.1",
241
+ "@qvac/tts-ggml": "^0.13.0",
242
+ "@qvac/vla-ggml": "^0.32.2",
235
243
  "bare-abort-controller": "^1.0.0",
236
244
  "bare-cpu-info": "0.1.1",
237
245
  "bare-crypto": "^1.15.0",
@@ -239,13 +247,14 @@
239
247
  "bare-events": "2.9.1",
240
248
  "bare-fs": "^4.5.1",
241
249
  "bare-gpu-info": "0.1.1",
250
+ "bare-link": "^4.0.1",
242
251
  "bare-net": "^2.3.2",
243
252
  "bare-os": "^3.6.2",
244
253
  "bare-pack": "^2.0.1",
245
254
  "bare-path": "^3.0.1",
246
255
  "bare-rpc": "^1.3.2",
247
- "bare-runtime": "^1.30.3",
248
- "bare-signals": "^4.2.0",
256
+ "bare-runtime": "^1.34.1",
257
+ "bare-signals": "^5.0.0",
249
258
  "bare-stream": "2.13.3",
250
259
  "bare-zlib": "^1.3.1",
251
260
  "compact-encoding": "^3.0.0",
@@ -256,13 +265,13 @@
256
265
  "semver": "^7.8.0",
257
266
  "tar-stream": "^3.1.8",
258
267
  "which-runtime": "^1.3.2",
259
- "zod": "^4.3.0",
268
+ "zod": "4.6.5",
260
269
  "bare-buffer": "^3.4.2"
261
270
  },
262
271
  "devDependencies": {
263
272
  "@electron-forge/plugin-base": "^7.11.1",
264
273
  "@expo/config-plugins": "^54.0.4",
265
- "bare-module": "^6.2.0",
274
+ "bare-module": "^7.2.1",
266
275
  "@lancedb/lancedb": "^0.21.3",
267
276
  "@modelcontextprotocol/sdk": "^1.12.1",
268
277
  "apache-arrow": "^18.1.0",
@@ -288,7 +297,7 @@
288
297
  "pear-pipe": "^1.0.6",
289
298
  "prettier": "^3.9.4",
290
299
  "prettier-config-holepunch": "^2.0.0",
291
- "react-native-bare-kit": "^0.15.5",
300
+ "react-native-bare-kit": "^0.16.0",
292
301
  "tsc-alias": "^1.8.17",
293
302
  "tsx": "4.23.1",
294
303
  "typescript": "^5.9.3",
@@ -296,22 +305,18 @@
296
305
  },
297
306
  "peerDependencies": {
298
307
  "@electron-forge/plugin-base": "^7.11.1",
299
- "bare-link": ">=3.0.0",
300
308
  "expo-build-properties": ">=0.12.0",
301
309
  "expo-device": ">=8.0.0",
302
310
  "expo-file-system": ">=19.0.0",
303
311
  "expo-modules-core": ">=3.0.0",
304
312
  "pear-pipe": ">=1.0.0",
305
- "react-native-bare-kit": "*",
313
+ "react-native-bare-kit": ">=0.16.0",
306
314
  "tsx": "*"
307
315
  },
308
316
  "peerDependenciesMeta": {
309
317
  "@electron-forge/plugin-base": {
310
318
  "optional": true
311
319
  },
312
- "bare-link": {
313
- "optional": true
314
- },
315
320
  "expo-build-properties": {
316
321
  "optional": true
317
322
  },
@@ -338,6 +343,5 @@
338
343
  "tar": "^7.5.22",
339
344
  "shell-quote": "^1.10.0",
340
345
  "@electron/rebuild": "^4.2.0"
341
- },
342
- "patchedDependencies": {}
346
+ }
343
347
  }
@@ -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 (along
6
- * with their per-platform prebuild packages) and non-target prebuilds.
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
- * Reads the addon a per-platform prebuild package ships binaries for.
150
- *
151
- * Addons that split their prebuilds (`@qvac/tts-ggml` since 0.9.0, along with
152
- * `@qvac/asr-ggml` 0.5.0 and `@qvac/audiogen-ggml` 0.4.0) publish the host's
153
- * `.bare` in `@qvac/<addon>-<host>` (iOS flavours grouped as
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: [], platformPackages: [] }
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
- platformPackages.sort((a, b) => a.name.localeCompare(b.name))
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
- * Pure diff: per-platform prebuild packages whose addon is not in the
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, platformPackages } = discoverQvacAddonPackages(projectDir)
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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=link-workspace-inference.d.ts.map
@@ -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
- }