@qvac/sdk 0.22.0 → 0.24.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 (284) hide show
  1. package/NOTICE +194 -97
  2. package/README.md +29 -470
  3. package/dist/examples/asr/parakeet-sortformer.js +24 -14
  4. package/dist/examples/asr/parakeet-transcribepsy-filesystem.d.ts +2 -0
  5. package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +105 -0
  6. package/dist/examples/asr/parakeet-unified-coreml.js +14 -9
  7. package/dist/examples/asr/whispercpp-prompt.js +9 -5
  8. package/dist/examples/assess-model-fit.d.ts +7 -9
  9. package/dist/examples/assess-model-fit.js +22 -43
  10. package/dist/examples/calc-tokens.d.ts +2 -0
  11. package/dist/examples/calc-tokens.js +21 -0
  12. package/dist/examples/classification/classify-image.js +11 -5
  13. package/dist/examples/completion-stop-reason.d.ts +3 -3
  14. package/dist/examples/completion-stop-reason.js +4 -4
  15. package/dist/examples/diffusion-flux3-klein.d.ts +2 -0
  16. package/dist/examples/diffusion-flux3-klein.js +102 -0
  17. package/dist/examples/diffusion-img2vid-ltx.js +7 -14
  18. package/dist/examples/diffusion-moss-image.d.ts +2 -0
  19. package/dist/examples/diffusion-moss-image.js +126 -0
  20. package/dist/examples/diffusion-qwen-image-21.d.ts +2 -0
  21. package/dist/examples/diffusion-qwen-image-21.js +115 -0
  22. package/dist/examples/diffusion-txt2vid-ltx.js +7 -14
  23. package/dist/examples/embed-multimodal.d.ts +2 -0
  24. package/dist/examples/embed-multimodal.js +80 -0
  25. package/dist/examples/embed-p2p.js +2 -2
  26. package/dist/examples/finetune/llamacpp-finetune.js +9 -4
  27. package/dist/examples/image/megaloc.d.ts +2 -0
  28. package/dist/examples/image/megaloc.js +37 -0
  29. package/dist/examples/llamacpp-multimodal.js +21 -1
  30. package/dist/examples/mcp-websearch.js +1 -1
  31. package/dist/examples/plugins.js +1 -1
  32. package/dist/examples/rag/rag-hyperdb/pipeline.js +2 -2
  33. package/dist/examples/rag/rag-turbovec.js +2 -2
  34. package/dist/examples/rerank.d.ts +2 -0
  35. package/dist/examples/rerank.js +33 -0
  36. package/dist/examples/sessions.d.ts +17 -0
  37. package/dist/examples/sessions.js +63 -0
  38. package/dist/examples/tools/llamacpp-deferred-tools.js +12 -8
  39. package/dist/examples/tools/llamacpp-tools-auto-dialect.js +4 -3
  40. package/dist/examples/tools/llamacpp-tools-gemma4.js +3 -3
  41. package/dist/examples/tools/llamacpp-tools-qwen35.js +4 -3
  42. package/dist/scripts/check-resource-collectors-packaging.js +7 -6
  43. package/dist/scripts/contract/build-contract.d.ts +2 -1
  44. package/dist/scripts/contract/build-contract.js +13 -1
  45. package/dist/scripts/contract/constants-registry.d.ts +19 -0
  46. package/dist/scripts/contract/constants-registry.js +9 -2
  47. package/dist/scripts/contract/method-shapes.d.ts +5 -0
  48. package/dist/scripts/contract/method-shapes.js +5 -0
  49. package/dist/scripts/enforce-inference-versions.d.ts +1 -1
  50. package/dist/scripts/enforce-inference-versions.js +28 -18
  51. package/dist/scripts/generate-bare-kit-runtimes.js +101 -69
  52. package/dist/src/client/api/assess-model-fit.d.ts +17 -17
  53. package/dist/src/client/api/assess-model-fit.js +19 -32
  54. package/dist/src/client/api/audio-edit.d.ts +5 -3
  55. package/dist/src/client/api/audio-edit.js +7 -5
  56. package/dist/src/client/api/audio-gen-result.js +136 -47
  57. package/dist/src/client/api/audio-gen.d.ts +40 -3
  58. package/dist/src/client/api/audio-gen.js +42 -5
  59. package/dist/src/client/api/audio-understand.d.ts +2 -2
  60. package/dist/src/client/api/audio-understand.js +4 -4
  61. package/dist/src/client/api/batch-completion.js +4 -3
  62. package/dist/src/client/api/bci-transcribe.js +3 -3
  63. package/dist/src/client/api/calc-tokens.d.ts +33 -0
  64. package/dist/src/client/api/calc-tokens.js +44 -0
  65. package/dist/src/client/api/cancel.d.ts +2 -2
  66. package/dist/src/client/api/cancel.js +3 -3
  67. package/dist/src/client/api/classify.d.ts +12 -5
  68. package/dist/src/client/api/classify.js +18 -6
  69. package/dist/src/client/api/client-request-id.d.ts +0 -15
  70. package/dist/src/client/api/client-request-id.js +15 -12
  71. package/dist/src/client/api/completion-stream.d.ts +9 -1
  72. package/dist/src/client/api/completion-stream.js +14 -3
  73. package/dist/src/client/api/decide.d.ts +1 -1
  74. package/dist/src/client/api/decide.js +3 -3
  75. package/dist/src/client/api/delete-cache.d.ts +9 -2
  76. package/dist/src/client/api/delete-cache.js +14 -4
  77. package/dist/src/client/api/diffusion.d.ts +38 -5
  78. package/dist/src/client/api/diffusion.js +42 -7
  79. package/dist/src/client/api/download-asset.js +3 -3
  80. package/dist/src/client/api/embed.d.ts +82 -29
  81. package/dist/src/client/api/embed.js +66 -21
  82. package/dist/src/client/api/finetune.js +3 -3
  83. package/dist/src/client/api/get-loaded-model-info.js +1 -1
  84. package/dist/src/client/api/get-model-info.d.ts +2 -2
  85. package/dist/src/client/api/get-model-info.js +3 -3
  86. package/dist/src/client/api/get-system-resources.d.ts +2 -2
  87. package/dist/src/client/api/get-system-resources.js +3 -3
  88. package/dist/src/client/api/heartbeat.d.ts +3 -2
  89. package/dist/src/client/api/heartbeat.js +4 -3
  90. package/dist/src/client/api/index.d.ts +8 -6
  91. package/dist/src/client/api/index.js +6 -4
  92. package/dist/src/client/api/invoke-plugin.d.ts +8 -2
  93. package/dist/src/client/api/invoke-plugin.js +18 -3
  94. package/dist/src/client/api/load-model.js +9 -6
  95. package/dist/src/client/api/logging-stream.d.ts +11 -2
  96. package/dist/src/client/api/logging-stream.js +12 -3
  97. package/dist/src/client/api/ocr.d.ts +5 -3
  98. package/dist/src/client/api/ocr.js +45 -22
  99. package/dist/src/client/api/rag.d.ts +1 -1
  100. package/dist/src/client/api/rag.js +3 -3
  101. package/dist/src/client/api/registry.d.ts +19 -8
  102. package/dist/src/client/api/registry.js +43 -17
  103. package/dist/src/client/api/rerank.d.ts +22 -0
  104. package/dist/src/client/api/rerank.js +39 -0
  105. package/dist/src/client/api/resume.d.ts +2 -1
  106. package/dist/src/client/api/resume.js +3 -3
  107. package/dist/src/client/api/rpc-server.d.ts +4 -4
  108. package/dist/src/client/api/rpc-server.js +12 -12
  109. package/dist/src/client/api/state.d.ts +2 -2
  110. package/dist/src/client/api/state.js +3 -3
  111. package/dist/src/client/api/subscribe-logs.d.ts +2 -2
  112. package/dist/src/client/api/subscribe-logs.js +4 -3
  113. package/dist/src/client/api/suspend.d.ts +4 -2
  114. package/dist/src/client/api/suspend.js +5 -4
  115. package/dist/src/client/api/text-to-speech.d.ts +14 -5
  116. package/dist/src/client/api/text-to-speech.js +86 -32
  117. package/dist/src/client/api/transcribe.d.ts +7 -3
  118. package/dist/src/client/api/transcribe.js +9 -3
  119. package/dist/src/client/api/translate.js +2 -2
  120. package/dist/src/client/api/unload-model.d.ts +19 -7
  121. package/dist/src/client/api/unload-model.js +31 -13
  122. package/dist/src/client/api/upscale.d.ts +6 -3
  123. package/dist/src/client/api/upscale.js +10 -5
  124. package/dist/src/client/api/vector-index.d.ts +51 -17
  125. package/dist/src/client/api/vector-index.js +101 -49
  126. package/dist/src/client/api/video-request.d.ts +5 -5
  127. package/dist/src/client/api/video.d.ts +3 -2
  128. package/dist/src/client/api/video.js +6 -5
  129. package/dist/src/client/api/vla.d.ts +9 -5
  130. package/dist/src/client/api/vla.js +17 -8
  131. package/dist/src/client/api/world-result.js +2 -2
  132. package/dist/src/client/api/world.d.ts +6 -6
  133. package/dist/src/client/api/world.js +6 -6
  134. package/dist/src/client/init-hooks.d.ts +6 -4
  135. package/dist/src/client/init-hooks.js +12 -15
  136. package/dist/src/client/logging-stream-registry.d.ts +6 -3
  137. package/dist/src/client/logging-stream-registry.js +36 -14
  138. package/dist/src/client/plugins-factory.d.ts +1 -1
  139. package/dist/src/client/plugins-factory.js +1 -1
  140. package/dist/src/client/rpc/bundle-stamp.d.ts +29 -0
  141. package/dist/src/client/rpc/bundle-stamp.js +75 -0
  142. package/dist/src/client/rpc/expo-home-dir.d.ts +2 -0
  143. package/dist/src/client/rpc/expo-home-dir.js +4 -0
  144. package/dist/src/client/rpc/expo-rpc-client.js +192 -138
  145. package/dist/src/client/rpc/node-rpc-client.js +324 -426
  146. package/dist/src/client/rpc/pear-runtime.d.ts +12 -0
  147. package/dist/src/client/rpc/pear-runtime.js +12 -0
  148. package/dist/src/client/rpc/rpc-client.d.ts +6 -4
  149. package/dist/src/client/rpc/rpc-client.js +168 -31
  150. package/dist/src/client/rpc/rpc-error.js +24 -2
  151. package/dist/src/client/rpc/unbundled-harness.d.ts +16 -0
  152. package/dist/src/client/rpc/unbundled-harness.js +27 -0
  153. package/dist/src/client/rpc/worker-failure.d.ts +27 -0
  154. package/dist/src/client/rpc/worker-failure.js +61 -0
  155. package/dist/src/client/session-registry.d.ts +75 -0
  156. package/dist/src/client/session-registry.js +149 -0
  157. package/dist/src/client/session.d.ts +125 -0
  158. package/dist/src/client/session.js +148 -0
  159. package/dist/src/commands/bundle/addons.d.ts +14 -0
  160. package/dist/src/commands/bundle/addons.js +65 -0
  161. package/dist/src/commands/bundle/constants.js +2 -0
  162. package/dist/src/commands/bundle/entry-gen.d.ts +1 -5
  163. package/dist/src/commands/bundle/entry-gen.js +18 -51
  164. package/dist/src/commands/bundle/index.d.ts +60 -14
  165. package/dist/src/commands/bundle/index.js +350 -126
  166. package/dist/src/commands/bundle/link.d.ts +58 -0
  167. package/dist/src/commands/bundle/link.js +135 -0
  168. package/dist/src/commands/bundle/node-support.d.ts +13 -0
  169. package/dist/src/commands/bundle/node-support.js +23 -0
  170. package/dist/src/commands/bundle/plugins.js +1 -1
  171. package/dist/src/commands/bundle/read-bundle.d.ts +9 -0
  172. package/dist/src/commands/bundle/read-bundle.js +27 -0
  173. package/dist/src/commands/bundle/resolve-sdk-import.d.ts +6 -0
  174. package/dist/src/commands/bundle/resolve-sdk-import.js +24 -28
  175. package/dist/src/commands/bundle/scratch.d.ts +35 -0
  176. package/dist/src/commands/bundle/scratch.js +178 -0
  177. package/dist/src/commands/bundle/targets.d.ts +14 -0
  178. package/dist/src/commands/bundle/targets.js +37 -0
  179. package/dist/src/commands/host-prebuilds/index.d.ts +8 -7
  180. package/dist/src/commands/host-prebuilds/index.js +13 -11
  181. package/dist/src/commands/index.d.ts +13 -12
  182. package/dist/src/commands/index.js +7 -7
  183. package/dist/src/commands/verify/abi.d.ts +21 -15
  184. package/dist/src/commands/verify/abi.js +12 -80
  185. package/dist/src/commands/verify/bare-kit-runtime.d.ts +20 -22
  186. package/dist/src/commands/verify/bare-kit-runtime.js +102 -150
  187. package/dist/src/commands/verify/bare-kit-runtimes.d.ts +10 -9
  188. package/dist/src/commands/verify/bare-kit-runtimes.js +21 -21
  189. package/dist/src/commands/verify/bundle-source.d.ts +1 -1
  190. package/dist/src/commands/verify/bundle-source.js +27 -23
  191. package/dist/src/commands/verify/engines-advice.d.ts +6 -12
  192. package/dist/src/commands/verify/engines-advice.js +9 -56
  193. package/dist/src/commands/verify/index.d.ts +34 -33
  194. package/dist/src/commands/verify/index.js +96 -204
  195. package/dist/src/commands/verify/node-modules-source.d.ts +1 -1
  196. package/dist/src/commands/verify/node-modules-source.js +1 -1
  197. package/dist/src/commands/verify/prebuilds.d.ts +4 -6
  198. package/dist/src/commands/verify/prebuilds.js +3 -4
  199. package/dist/src/commands/verify/resource-collectors.d.ts +0 -6
  200. package/dist/src/commands/verify/resource-collectors.js +3 -52
  201. package/dist/src/commands/verify/sidecar-runtime.d.ts +6 -0
  202. package/dist/src/commands/verify/sidecar-runtime.js +51 -0
  203. package/dist/src/expo/plugins/get-project-root.d.ts +1 -1
  204. package/dist/src/expo/plugins/withAndroidArchitecture.d.ts +1 -1
  205. package/dist/src/expo/plugins/withAndroidNdkVersion.d.ts +1 -1
  206. package/dist/src/expo/plugins/withAndroidNdkVersion.js +16 -10
  207. package/dist/src/expo/plugins/withBareKit.d.ts +59 -0
  208. package/dist/src/expo/plugins/withBareKit.js +204 -0
  209. package/dist/src/expo/plugins/withDeviceInfo.d.ts +1 -1
  210. package/dist/src/expo/plugins/withDeviceInfo.js +19 -5
  211. package/dist/src/expo/plugins/withMobileBundle.d.ts +5 -12
  212. package/dist/src/expo/plugins/withMobileBundle.js +38 -59
  213. package/dist/src/expo/plugins/withOpenCL.d.ts +1 -1
  214. package/dist/src/expo/plugins/withQvacSDK.d.ts +2 -1
  215. package/dist/src/expo/plugins/withQvacSDK.js +3 -0
  216. package/dist/src/index.d.ts +6 -5
  217. package/dist/src/index.js +10 -14
  218. package/dist/src/logging/addon.d.ts +1 -1
  219. package/dist/src/logging/base-logger.js +1 -1
  220. package/dist/src/logging/utils.js +11 -3
  221. package/dist/src/plugin-ids.d.ts +3 -1
  222. package/dist/src/plugin-ids.js +4 -0
  223. package/dist/src/schemas/public.d.ts +1 -1
  224. package/dist/src/schemas/public.js +1 -1
  225. package/dist/src/schemas/sdk-errors-client.d.ts +5 -6
  226. package/dist/src/schemas/sdk-errors-client.js +30 -36
  227. package/dist/src/schemas/sdk-errors-server.d.ts +12 -1
  228. package/dist/src/schemas/sdk-errors-server.js +65 -2
  229. package/dist/src/server/rpc/rpc-utils.d.ts +26 -0
  230. package/dist/src/server/rpc/rpc-utils.js +41 -0
  231. package/dist/src/utils/aggregate-events.d.ts +1 -1
  232. package/dist/src/utils/aggregate-events.js +2 -2
  233. package/dist/src/utils/errors-client.d.ts +37 -29
  234. package/dist/src/utils/errors-client.js +50 -41
  235. package/dist/src/utils/errors-server.d.ts +65 -1
  236. package/dist/src/utils/errors-server.js +122 -1
  237. package/dist/src/utils/mcp-adapter.d.ts +1 -1
  238. package/dist/src/utils/mcp-adapter.js +1 -1
  239. package/dist/src/utils/tool-helpers.js +1 -1
  240. package/dist/src/utils/withTimeout.js +34 -17
  241. package/dist/src/worker/handle-request.js +26 -21
  242. package/dist/src/worker/handler-utils.d.ts +2 -6
  243. package/dist/src/worker/handler-utils.js +2 -20
  244. package/dist/src/worker/index.d.ts +2 -4
  245. package/dist/src/worker/index.js +24 -34
  246. package/dist/src/worker/plugins/ggml-image-embedding.d.ts +2 -0
  247. package/dist/src/worker/plugins/ggml-image-embedding.js +1 -0
  248. package/dist/src/worker/plugins/llamacpp-rerank.d.ts +2 -0
  249. package/dist/src/worker/plugins/llamacpp-rerank.js +1 -0
  250. package/dist/src/worker/shim.d.ts +4 -0
  251. package/dist/src/worker/shim.js +7 -0
  252. package/dist/src/worker/start.d.ts +9 -0
  253. package/dist/src/worker/start.js +16 -0
  254. package/dist/src/worker/unbundled-shim.d.ts +2 -0
  255. package/dist/src/worker/unbundled-shim.js +4 -0
  256. package/docs/system-resources-support-matrix.md +27 -19
  257. package/package.json +91 -74
  258. package/src/electron-forge/index.cjs +65 -91
  259. package/dist/examples/model-fit-ui/server.d.ts +0 -24
  260. package/dist/examples/model-fit-ui/server.js +0 -221
  261. package/dist/src/client/rpc/ensure-worker-ready.d.ts +0 -9
  262. package/dist/src/client/rpc/ensure-worker-ready.js +0 -17
  263. package/dist/src/client/rpc/init-timeout.d.ts +0 -26
  264. package/dist/src/client/rpc/init-timeout.js +0 -25
  265. package/dist/src/client/rpc/worker-startup-error.d.ts +0 -12
  266. package/dist/src/client/rpc/worker-startup-error.js +0 -13
  267. package/dist/src/commands/bundle/bare-pack.d.ts +0 -21
  268. package/dist/src/commands/bundle/bare-pack.js +0 -77
  269. package/dist/src/commands/bundle/manifest.d.ts +0 -25
  270. package/dist/src/commands/bundle/manifest.js +0 -192
  271. package/dist/src/expo/plugins/link-addons.d.ts +0 -18
  272. package/dist/src/expo/plugins/link-addons.js +0 -65
  273. package/dist/src/pear/pre.d.ts +0 -21
  274. package/dist/src/pear/pre.js +0 -448
  275. package/dist/src/server/env.d.ts +0 -22
  276. package/dist/src/server/env.js +0 -59
  277. package/dist/src/server/utils/qvac-paths.d.ts +0 -2
  278. package/dist/src/server/utils/qvac-paths.js +0 -5
  279. package/dist/src/server/utils/worker-lock.d.ts +0 -3
  280. package/dist/src/server/utils/worker-lock.js +0 -67
  281. package/dist/src/worker/create-server.d.ts +0 -8
  282. package/dist/src/worker/create-server.js +0 -51
  283. package/dist/src/worker/lifecycle.d.ts +0 -23
  284. package/dist/src/worker/lifecycle.js +0 -149
@@ -1,33 +1,26 @@
1
1
  import configPlugins from '@expo/config-plugins';
2
2
  import * as fs from 'fs';
3
3
  import * as path from 'path';
4
- import { bundleSdk, verifyBundle, hasErrors, formatVerifyBundleResult } from '../../commands/index.js';
5
- import { createCommandLogger } from '../../commands/command-logger.js';
4
+ import { bundleSdk } from '../../commands/index.js';
5
+ import { discardStaged, replaceAll, scratchFolderFor } from '../../commands/bundle/scratch.js';
6
6
  import { CONFIG_CANDIDATES } from '../../client/config-loader/resolve-config.node.js';
7
- import { resolveSDKPackageDir } from './resolve-sdk-package-dir.js';
8
- import { getProjectRootFromMod } from './get-project-root.js';
9
- import { linkAddons } from './link-addons.js';
10
- import { BundleVerificationFailedError } from '../../utils/errors-client.js';
7
+ import { resolveSDKPackageDir } from '../../expo/plugins/resolve-sdk-package-dir.js';
8
+ import { getProjectRootFromMod } from '../../expo/plugins/get-project-root.js';
11
9
  const { withDangerousMod } = configPlugins;
12
10
  /** Modules to defer from mobile bundles (not available at bundle time) */
13
11
  const DEFERRED_MODULES = ['expo-file-system', 'react-native-bare-kit'];
14
- /**
15
- * Desktop-only spawn path, deferred so bare-pack does not walk `bare-process`
16
- * -> `bare-posix` (no `android-arm64` prebuild). Mobile runs the engine fitter
17
- * in process instead, so it never reaches this.
18
- */
19
- const MOBILE_UNSUPPORTED_MODULES = ['bare-runtime/spawn'];
20
12
  const MOBILE_HOSTS_BY_PLATFORM = {
21
13
  android: ['android-arm64'],
22
14
  ios: ['ios-arm64', 'ios-arm64-simulator', 'ios-x64-simulator']
23
15
  };
24
16
  /** Every mobile host, in platform order. The bundle covers all of them. */
25
17
  const MOBILE_HOSTS = [...MOBILE_HOSTS_BY_PLATFORM.android, ...MOBILE_HOSTS_BY_PLATFORM.ios];
18
+ /** The generated harness and its bundle, served as `@qvac/sdk/worker.mobile`. */
19
+ const WORKER_MOBILE_FILES = ['index.js', 'index.d.ts', 'index.bundle.mjs'];
26
20
  /**
27
- * Expo plugin: bundles the worker for every mobile host, verifies it for the
28
- * platform being prebuilt, copies it to `<sdkPackageDir>/dist/worker.mobile.bundle.js`,
29
- * and links the native addons it loads into react-native-bare-kit. Uses
30
- * `qvac.config.*` if present.
21
+ * Expo plugin: bundle and verify the worker, write Bare Kit and the native
22
+ * addons for the platform being built, then copy the worker into the SDK.
23
+ * Uses `qvac.config.*` if present.
31
24
  */
32
25
  function withMobileBundle(config, options = {}) {
33
26
  config = withDangerousMod(config, ['android', (mod) => buildMobileBundle(mod, options)]);
@@ -37,7 +30,6 @@ function withMobileBundle(config, options = {}) {
37
30
  async function buildMobileBundle(config, options) {
38
31
  const projectRoot = getProjectRootFromMod(config);
39
32
  const sdkPackage = resolveSDKPackageDir(projectRoot);
40
- const outputPath = path.join(sdkPackage.dir, 'dist', 'worker.mobile.bundle.js');
41
33
  const platformHosts = mobileHostsForPlatform(config.modRequest.platform);
42
34
  const configPath = findConfigFile(projectRoot);
43
35
  if (configPath) {
@@ -46,26 +38,28 @@ async function buildMobileBundle(config, options) {
46
38
  else {
47
39
  console.log('🕚 QVAC: No config found, generating default bundle (all plugins)...');
48
40
  }
49
- const deferredModules = [
50
- ...DEFERRED_MODULES,
51
- ...MOBILE_UNSUPPORTED_MODULES,
52
- `${sdkPackage.name}/worker.mobile.bundle`
53
- ];
41
+ const deferredModules = [...DEFERRED_MODULES, `${sdkPackage.name}/worker.mobile`];
54
42
  // The bundle is one shared artifact both platforms import, so it is built
55
43
  // for every mobile host: a dual-platform `expo prebuild` runs this mod twice
56
44
  // and the second run would otherwise overwrite the first platform's bundle
57
45
  // with one that resolved the other platform's conditions.
58
- const entryPath = await runBundler(projectRoot, sdkPackage.dir, configPath, deferredModules, MOBILE_HOSTS, options.installMissingPrebuilds === true);
59
- const generatedBundle = path.join(projectRoot, 'qvac', 'worker.bundle.js');
60
- await runVerifier(projectRoot, generatedBundle, configPath, platformHosts);
61
- fs.copyFileSync(generatedBundle, outputPath);
62
- const linked = await linkAddons({
46
+ const result = await bundleSdk({
63
47
  projectRoot,
64
- entryPath,
65
- hosts: platformHosts,
66
- logger: createCommandLogger({})
48
+ sdkPath: sdkPackage.dir,
49
+ ...(configPath ? { configPath } : {}),
50
+ target: 'react-native',
51
+ hosts: MOBILE_HOSTS,
52
+ defer: deferredModules,
53
+ quiet: true,
54
+ installMissingPrebuilds: options.installMissingPrebuilds === true,
55
+ link: platformHosts
67
56
  });
68
- console.log(`🔗 QVAC: Linked ${linked.length} native addon files for ${platformHosts.join(', ')}`);
57
+ if (result.installedPrebuilds.length > 0) {
58
+ const names = result.installedPrebuilds.map((pkg) => `${pkg.name}@${pkg.version}`).join(', ');
59
+ console.log(`📦 QVAC: Installed addon platform packages: ${names}`);
60
+ }
61
+ console.log(`🔗 QVAC: Linked ${result.linked.length} native addon files for ${platformHosts.join(', ')}`);
62
+ await copyWorker(result.outputDir, path.join(sdkPackage.dir, 'dist', 'worker-mobile'));
69
63
  console.log('🫡 QVAC: Mobile bundle generated, verified and linked');
70
64
  return config;
71
65
  }
@@ -85,35 +79,20 @@ function findConfigFile(projectRoot) {
85
79
  }
86
80
  return null;
87
81
  }
88
- async function runVerifier(projectRoot, generatedBundle, configPath, hosts) {
89
- const result = await verifyBundle({
90
- projectRoot,
91
- addonsSource: generatedBundle,
92
- hosts,
93
- ...(configPath ? { configPath } : {}),
94
- onProgress: (message) => console.log(`🕚 QVAC: ${message}`)
95
- });
96
- if (hasErrors(result)) {
97
- throw new BundleVerificationFailedError(generatedBundle, new Error(formatVerifyBundleResult(result)));
82
+ /** Copies the worker into `outDir`, which keeps its previous files until every copy is done. */
83
+ async function copyWorker(workerDir, outDir) {
84
+ const scratch = await scratchFolderFor(outDir);
85
+ const staged = [{ dir: outDir, next: scratch }];
86
+ try {
87
+ fs.mkdirSync(scratch, { recursive: true });
88
+ for (const file of WORKER_MOBILE_FILES) {
89
+ fs.copyFileSync(path.join(workerDir, file), path.join(scratch, file));
90
+ }
91
+ await replaceAll(staged);
98
92
  }
99
- }
100
- async function runBundler(projectRoot, qvacSdkPath, configPath, deferredModules, hosts, installMissingPrebuilds) {
101
- const result = await bundleSdk({
102
- projectRoot,
103
- sdkPath: qvacSdkPath,
104
- ...(configPath ? { configPath } : {}),
105
- hosts,
106
- defer: deferredModules,
107
- quiet: true,
108
- installMissingPrebuilds,
109
- // runVerifier checks engines.bare right after, with progress output.
110
- checkEngines: false
111
- });
112
- if (result.installedPrebuilds.length > 0) {
113
- const names = result.installedPrebuilds.map((pkg) => `${pkg.name}@${pkg.version}`).join(', ');
114
- console.log(`📦 QVAC: Installed addon platform packages: ${names}`);
93
+ finally {
94
+ await discardStaged(staged);
115
95
  }
116
- return result.entryPaths.worker;
117
96
  }
118
- export { MOBILE_HOSTS, MOBILE_HOSTS_BY_PLATFORM, MOBILE_UNSUPPORTED_MODULES, buildMobileBundle, mobileHostsForPlatform };
97
+ export { MOBILE_HOSTS, MOBILE_HOSTS_BY_PLATFORM, buildMobileBundle, mobileHostsForPlatform };
119
98
  export default withMobileBundle;
@@ -1,4 +1,4 @@
1
- import type { ExpoConfig } from 'expo/config/index.js';
1
+ import type { ExpoConfig } from 'expo/config';
2
2
  /**
3
3
  * Plugin to add OpenCL native library support to Android build
4
4
  * This plugin was written by the most helpful folk in the QVAC team: Luis Moromisato.
@@ -1,9 +1,10 @@
1
- import type { ExpoConfig } from 'expo/config/index.js';
1
+ import type { ExpoConfig } from 'expo/config';
2
2
  import { type MobileBundleOptions } from './withMobileBundle.js';
3
3
  type QvacSDKPluginOptions = MobileBundleOptions;
4
4
  /**
5
5
  * Main Qvac SDK Expo plugin that combines all necessary mobile configurations:
6
6
  * - Mobile worker bundle generation
7
+ * - Bare Kit and the native addons as a Gradle module and a Swift package
7
8
  * - Device info stubbing when expo-device is not installed
8
9
  * - Android build properties (minSdkVersion, NDK, proguard)
9
10
  * - Android NDK version pinning in build.gradle
@@ -1,6 +1,7 @@
1
1
  import configPlugins from '@expo/config-plugins';
2
2
  import withAndroidArchitecture from './withAndroidArchitecture.js';
3
3
  import withAndroidNdkVersion from './withAndroidNdkVersion.js';
4
+ import withBareKit from './withBareKit.js';
4
5
  import withDeviceInfo from './withDeviceInfo.js';
5
6
  import withMobileBundle, {} from './withMobileBundle.js';
6
7
  import withOpenCL from './withOpenCL.js';
@@ -8,6 +9,7 @@ const { withPlugins } = configPlugins;
8
9
  /**
9
10
  * Main Qvac SDK Expo plugin that combines all necessary mobile configurations:
10
11
  * - Mobile worker bundle generation
12
+ * - Bare Kit and the native addons as a Gradle module and a Swift package
11
13
  * - Device info stubbing when expo-device is not installed
12
14
  * - Android build properties (minSdkVersion, NDK, proguard)
13
15
  * - Android NDK version pinning in build.gradle
@@ -20,6 +22,7 @@ const { withPlugins } = configPlugins;
20
22
  function withQvacSDK(config, options = {}) {
21
23
  return withPlugins(config, [
22
24
  [withMobileBundle, options],
25
+ withBareKit,
23
26
  withDeviceInfo,
24
27
  [
25
28
  'expo-build-properties',
@@ -1,18 +1,19 @@
1
- export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, createVectorIndex, loadVectorIndex, type VectorIndex, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, startRpcServer, stopRpcServer, discoverRpcServers, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, type ServerLogHandler, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, classify, decide, video, type VideoProgressTick, upscale, worldCreateScene, worldStep, type WorldStepResult, type WorldStepProgressTick, type WorldSceneResult, type WorldSceneResultWithPack, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, audioGen, audioEdit, audioUnderstand, type FinetuneHandle } from './client/api/index.js';
1
+ export { batchCompletion, completion, deleteCache, calcTokens, type CalcTokensClientParams, loadModel, downloadAsset, heartbeat, unloadModel, type UnloadModelResult, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, embedBatch, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, createVectorIndex, loadVectorIndex, type VectorIndex, type VectorIndexOperation, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, startRpcServer, stopRpcServer, discoverRpcServers, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, type ServerLogHandler, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, classify, decide, rerank, video, type VideoProgressTick, upscale, worldCreateScene, worldStep, type WorldStepResult, type WorldStepProgressTick, type WorldSceneResult, type WorldSceneResultWithPack, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, audioGen, audioEdit, audioUnderstand, type FinetuneHandle } from './client/api/index.js';
2
2
  export { close } from './client/index.js';
3
+ export { openSession, type QvacSession, type OpenSessionOptions } from './client/session.js';
3
4
  export { plugins } from './client/plugins-factory.js';
4
- 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 BatchCompletionEvent, type BatchCompletionResult, type BatchCompletionRun, type BatchPrompt, type EmbedStats, type DecideParams, type DecisionState, type DecisionQuestion, type DecisionAnswer, type DecisionResult, type DecisionResponse, type DecisionConfig, type TranscribeStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type TranscribeSpeakerSegment, ASR_BACKEND_IDS, type AsrBackendId, type BciConfig, type BciTranscribeClientParams, type BciTranscribeStreamClientParams, type BciTranscribeStreamSession, type BciTranscribeStreamMetadataSession, type BciStreamOpts, type NeuralInput, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, type TtsClientParamsInput, type TextToSpeechStreamResult, type TtsSentenceChunkUpdate, type TtsResponse, type TtsStats, TTS_ENGINES, type TtsEngine, TTS_PARLER_EMOTIONS, type TtsParlerEmotion, type TtsParlerLoadConfig, type TtsParlerRuntimeConfig, TTS_PACES, TTS_SENTENCE_DELIMITER_PRESETS, type TtsSentenceDelimiterPreset, TTS_CHATTERBOX_LANGUAGES, type TtsChatterboxLanguage, type TtsChatterboxLoadConfig, type TtsChatterboxRuntimeConfig, TTS_SUPERTONIC_LANGUAGES, type TtsSupertonicLanguage, type TtsSupertonicLoadConfig, type TtsSupertonicRuntimeConfig, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, type TtsPace, type TtsCosyvoice3Emotion, type TtsCosyvoice3Instruct, type TtsCosyvoice3LoadConfig, type TtsCosyvoice3RuntimeConfig, type TtsAudio8LoadConfig, type TtsAudio8RuntimeConfig, type TtsMossLoadConfig, type TtsMossSoundEffectLoadConfig, type TtsMossSpeechLoadConfig, type TtsMossSoundEffectRuntimeConfig, type TtsMossSpeechRuntimeConfig, type TtsMossRuntimeConfig, 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, RAG_ERROR_CODES, VectorIndexStorage, DEFAULT_VECTOR_INDEX_STORAGE, type VectorId, type VectorIndexHit, type CreateVectorIndexParams, type LoadVectorIndexParams, type VectorIndexAddParams, type VectorIndexIdsParams, type VectorIndexSearchParams, type VectorIndexWriteParams, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type GetSystemResourcesInput, type ResourceScope, type ResourceProvenance, type ResourceMetric, type GraphicsDriver, type GraphicsDriverCapabilities, type BackendProbeResult, type BackendDevice, type BackendDriver, type BackendFallback, type InferenceBackendDiagnostics, type CPUResourceCapabilities, type GPUResourceCapabilities, type SystemResourceCapabilities, type GPUResourceSample, type SystemResourceSample, type SystemResources, type AssessModelFitInput, type TranscriptionFitWorkload, type TtsFitWorkload, type AssessModelFitResult, type LoadedInstance, type CacheFileInfo, toolSchema, TOOL_SEARCH_NAME, buildToolSearchTool, executeToolSearch, loadedToolNames, searchDeferredTools, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type ClassifyClientParams, type ClassificationResult, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_TRACKS, AUDIOGEN_INPUT_SAMPLE_RATE, AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_MAX_SECONDS, AUDIOGEN_MAX_AUDIO_CODES, AUDIOGEN_EDIT_OPERATIONS, AUDIOGEN_REPAINT_MODES, type AudioGenEngine, type AudioGenTaskType, type AudioGenTrack, type AudioGenAudioInput, type AudioGenClientParams, type AudioGenConfig, type AudioGenRuntimeConfig, type AudioGenProgress, type AudioGenAudio, type AudioGenStats, type AudioGenGenerationMetadata, type AudioGenResult, type AudioGenStreamResponse, type AudioGenEditOperationType, type AudioGenRepaintMode, type AudioEditPrompt, type AudioEditFlowEditOperation, type AudioEditRepaintOperation, type AudioEditOperation, type AudioEditClientParams, type AudioEditStreamResponse, type AudioUnderstandClientParams, type AudioUnderstandResponse, type AudioGenUnderstandResult, type AudioUnderstandResult, type VideoClientParams, type VideoStreamResponse, type VideoStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, type WalkKey, type WalkKeysInput, type WorldStepClientParams, type WorldStepStreamResponse, type WorldStepStats, type WorldSceneClientParams, type WorldSceneStreamResponse, type WorldSceneStats, type VlaConfig, type VlaClientRunParams, type VlaClientRunResult, type VlaEmbodimentSelection, type VlaEmbodimentSelector, type VlaHparams, type VlaStats, definePlugin, defineHandler, defineDuplexHandler, PluginDefinitionInvalidError, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult } from '@qvac/inference/surface';
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 CalcTokensParams, type BatchCompletionEvent, type BatchCompletionResult, type BatchCompletionRun, type BatchPrompt, type EmbedStats, type EmbedInput, type EmbedInputPart, type EmbedMediaSource, type EmbedLegacyParams as EmbedParams, type EmbedClientParams, type EmbedClientInput, type EmbedBatchClientParams as EmbedBatchParams, type EmbedBatchClientParams, type ImageEmbeddingConfig, type ImageEmbeddingStats, type DecideParams, type DecisionState, type DecisionQuestion, type DecisionAnswer, type DecisionResult, type DecisionResponse, type DecisionConfig, type RerankParams, type RerankScores, type RerankConfig, type TranscribeStats, VERBOSITY, type Attachment, type HistoryContent, type HistoryContentPart, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type TranscribeSpeakerSegment, type TranscribeToken, ASR_BACKEND_IDS, type AsrBackendId, type BciConfig, type BciTranscribeClientParams, type BciTranscribeStreamClientParams, type BciTranscribeStreamSession, type BciTranscribeStreamMetadataSession, type BciStreamOpts, type NeuralInput, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, type TtsClientParamsInput, type TextToSpeechStreamResult, type TtsSentenceChunkUpdate, type TtsResponse, type TtsStats, TTS_ENGINES, type TtsEngine, TTS_PARLER_EMOTIONS, type TtsParlerEmotion, type TtsParlerLoadConfig, type TtsParlerRuntimeConfig, TTS_PACES, TTS_SENTENCE_DELIMITER_PRESETS, type TtsSentenceDelimiterPreset, TTS_CHATTERBOX_LANGUAGES, type TtsChatterboxLanguage, type TtsChatterboxLoadConfig, type TtsChatterboxRuntimeConfig, TTS_SUPERTONIC_LANGUAGES, type TtsSupertonicLanguage, type TtsSupertonicLoadConfig, type TtsSupertonicRuntimeConfig, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, TTS_PARLER_COREML_COMPUTE_UNITS, TTS_LAVASR_COREML_COMPUTE_UNITS, TTS_SUPERTONIC_PRECISIONS, type TtsPace, type TtsCosyvoice3Emotion, type TtsCosyvoice3Instruct, type TtsCosyvoice3LoadConfig, type TtsCosyvoice3RuntimeConfig, type TtsAudio8LoadConfig, type TtsAudio8RuntimeConfig, type TtsMossLoadConfig, type TtsMossSoundEffectLoadConfig, type TtsMossSpeechLoadConfig, type TtsMossSoundEffectRuntimeConfig, type TtsMossSpeechRuntimeConfig, type TtsMossRuntimeConfig, 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, RAG_ERROR_CODES, VectorIndexStorage, DEFAULT_VECTOR_INDEX_STORAGE, type VectorId, type VectorIndexHit, type CreateVectorIndexParams, type LoadVectorIndexParams, type VectorIndexAddParams, type VectorIndexIdsParams, type VectorIndexSearchParams, type VectorIndexSetStagedSearchParams, type VectorIndexWriteParams, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type GetSystemResourcesInput, type ResourceScope, type ResourceProvenance, type ResourceMetric, type GraphicsDriver, type GraphicsDriverCapabilities, type BackendProbeResult, type BackendDevice, type BackendDriver, type BackendFallback, type InferenceBackendDiagnostics, type CPUResourceCapabilities, type GPUResourceCapabilities, type SystemResourceCapabilities, type GPUResourceSample, type SystemResourceSample, type SystemResources, type AssessModelFitInput, type TranscriptionFitWorkload, type TtsFitWorkload, type AssessModelFitResult, type ModelFitVerdict, type ModelFitModelResult, type ModelFitDevice, type ModelFitStats, type LlamaFitStats, type ModelFitPool, type ModelFitProbe, type LoadedInstance, type CacheFileInfo, toolSchema, TOOL_SEARCH_NAME, buildToolSearchTool, executeToolSearch, loadedToolNames, searchDeferredTools, resolveToolSearchSource, type ToolSearchOptions, type ToolSearchSource, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type ClassifyClientParams, type ClassificationResult, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_TRACKS, AUDIOGEN_INPUT_SAMPLE_RATE, AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_MAX_SECONDS, AUDIOGEN_MAX_AUDIO_CODES, AUDIOGEN_EDIT_OPERATIONS, AUDIOGEN_REPAINT_MODES, AUDIOGEN_OUTPUT_FORMATS, AUDIOGEN_MINIMAX_COREML_COMPUTE_UNITS, type AudioGenEngine, type AudioGenTaskType, type AudioGenTrack, type AudioGenAudioInput, type AudioGenClientParams, type AudioGenConfig, type AudioGenRuntimeConfig, type AudioGenProgress, type AudioGenAudio, type AudioGenEncodedAudio, type AudioGenOutputFormat, type AudioGenMinimaxCoremlComputeUnits, type AudioGenStats, type AudioGenGenerationMetadata, type AudioGenResult, type AudioGenStreamResponse, type AudioGenEditOperationType, type AudioGenRepaintMode, type AudioEditPrompt, type AudioEditFlowEditOperation, type AudioEditRepaintOperation, type AudioEditOperation, type AudioEditClientParams, type AudioEditStreamResponse, type AudioUnderstandClientParams, type AudioUnderstandResponse, type AudioGenUnderstandResult, type AudioUnderstandResult, type VideoClientParams, type VideoStreamResponse, type VideoStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, type WalkKey, type WalkKeysInput, type WorldStepClientParams, type WorldStepStreamResponse, type WorldStepStats, type WorldSceneClientParams, type WorldSceneStreamResponse, type WorldSceneStats, type VlaConfig, type VlaClientRunParams, type VlaClientRunResult, type VlaEmbodimentSelection, type VlaEmbodimentSelector, type VlaHparams, type VlaStats, definePlugin, defineHandler, defineDuplexHandler, requestParent, type PluginHandlerContext, PluginDefinitionInvalidError, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult } from '@qvac/inference/surface';
5
6
  export { SDK_CLIENT_ERROR_CODES } from './schemas/sdk-errors-client.js';
6
7
  export { SDK_SERVER_ERROR_CODES } from './schemas/sdk-errors-server.js';
7
- export { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_DECISION, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_MOSS_TRANSCRIBE, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_AUDIOGEN, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin } from './plugin-ids.js';
8
+ export { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_IMAGE_EMBEDDING, PLUGIN_DECISION, PLUGIN_RERANK, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_MOSS_TRANSCRIBE, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_AUDIOGEN, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin } from './plugin-ids.js';
8
9
  export { type ToolInput, type ToolHandler } from './utils/tool-helpers.js';
9
10
  export { MODEL_TYPES, ModelType } from '@qvac/inference/surface';
10
11
  export * from '@qvac/inference/models';
11
12
  export { SUPPORTED_AUDIO_FORMATS } from '@qvac/inference/surface';
12
13
  export { InferenceCancelledError } from './utils/errors-server.js';
13
14
  export type { InferenceCancelledPartial } from './utils/errors-server.js';
14
- export { ContextOverflowError, type ContextOverflowErrorSizes, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, TranslationFailedError } from './utils/errors-server.js';
15
- export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, WorkerStartupError, RequestValidationFailedError, StreamEndedError, TextToSpeechStreamFailedError } from './utils/errors-client.js';
15
+ export { ContextOverflowError, type ContextOverflowErrorSizes, ModelRegistryModelNotFoundError, ModelRegistryBusyError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, TranslationFailedError, AudioEncodeFailedError, InvalidSeedFromParamsError, KvCacheSeedSourceNotFoundError, KvCacheSeedSharingDisabledError, SessionIdConflictError, SessionNotOpenError, ModelLeasedError, ModelReconfiguredError, OwnerOnlyError, RAGWorkspaceBusyError } from './utils/errors-server.js';
16
+ export { WorkerCrashedError, WorkerShutdownError, WorkerStartupError, RequestValidationFailedError, StreamEndedError, TextToSpeechStreamFailedError, SessionInvalidatedError, ModelHandleInvalidatedError } from './utils/errors-client.js';
16
17
  export { getLogger, SDK_LOG_ID, SDK_ALL_LOG_ID } from './logging/index.js';
17
18
  export type { Logger, LogTransport, LoggerOptions } from './logging/index.js';
18
19
  export { profiler, attachBackendDiagnostics } from '@qvac/inference/surface';
package/dist/src/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  // Public API exports only
2
- export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, createVectorIndex, loadVectorIndex, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, startRpcServer, stopRpcServer, discoverRpcServers, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, ocr, invokePlugin, invokePluginStream, diffusion, classify, decide, video, upscale, worldCreateScene, worldStep, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, audioGen, audioEdit, audioUnderstand } from './client/api/index.js';
2
+ export { batchCompletion, completion, deleteCache, calcTokens, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, embedBatch, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, createVectorIndex, loadVectorIndex, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, startRpcServer, stopRpcServer, discoverRpcServers, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, ocr, invokePlugin, invokePluginStream, diffusion, classify, decide, rerank, video, upscale, worldCreateScene, worldStep, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, audioGen, audioEdit, audioUnderstand } from './client/api/index.js';
3
3
  export { close } from './client/index.js';
4
+ export { openSession } from './client/session.js';
4
5
  export { plugins } from './client/plugins-factory.js';
5
- export { VERBOSITY, ASR_BACKEND_IDS, TTS_ENGINES, TTS_PARLER_EMOTIONS, TTS_PACES, TTS_SENTENCE_DELIMITER_PRESETS, TTS_CHATTERBOX_LANGUAGES, TTS_SUPERTONIC_LANGUAGES, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, RAG_ERROR_CODES, VectorIndexStorage, DEFAULT_VECTOR_INDEX_STORAGE, toolSchema, TOOL_SEARCH_NAME, buildToolSearchTool, executeToolSearch, loadedToolNames, searchDeferredTools, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_TRACKS, AUDIOGEN_INPUT_SAMPLE_RATE, AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_MAX_SECONDS, AUDIOGEN_MAX_AUDIO_CODES, AUDIOGEN_EDIT_OPERATIONS, AUDIOGEN_REPAINT_MODES, definePlugin, defineHandler, defineDuplexHandler, PluginDefinitionInvalidError } from '@qvac/inference/surface';
6
+ export { VERBOSITY, ASR_BACKEND_IDS, TTS_ENGINES, TTS_PARLER_EMOTIONS, TTS_PACES, TTS_SENTENCE_DELIMITER_PRESETS, TTS_CHATTERBOX_LANGUAGES, TTS_SUPERTONIC_LANGUAGES, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, TTS_PARLER_COREML_COMPUTE_UNITS, TTS_LAVASR_COREML_COMPUTE_UNITS, TTS_SUPERTONIC_PRECISIONS, RAG_ERROR_CODES, VectorIndexStorage, DEFAULT_VECTOR_INDEX_STORAGE, toolSchema, TOOL_SEARCH_NAME, buildToolSearchTool, executeToolSearch, loadedToolNames, searchDeferredTools, resolveToolSearchSource, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_TRACKS, AUDIOGEN_INPUT_SAMPLE_RATE, AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_MAX_SECONDS, AUDIOGEN_MAX_AUDIO_CODES, AUDIOGEN_EDIT_OPERATIONS, AUDIOGEN_REPAINT_MODES, AUDIOGEN_OUTPUT_FORMATS, AUDIOGEN_MINIMAX_COREML_COMPUTE_UNITS, definePlugin, defineHandler, defineDuplexHandler, requestParent, PluginDefinitionInvalidError } from '@qvac/inference/surface';
6
7
  // SDK-owned error-code objects: `SDK_CLIENT_ERROR_CODES` holds transport/client
7
8
  // codes absent from @qvac/inference, and `SDK_SERVER_ERROR_CODES` carries the
8
9
  // client-side error definitions (`addCodes` message registry) that
@@ -10,7 +11,7 @@ export { VERBOSITY, ASR_BACKEND_IDS, TTS_ENGINES, TTS_PARLER_EMOTIONS, TTS_PACES
10
11
  export { SDK_CLIENT_ERROR_CODES } from './schemas/sdk-errors-client.js';
11
12
  export { SDK_SERVER_ERROR_CODES } from './schemas/sdk-errors-server.js';
12
13
  // Built-in plugin ids under the public @qvac/sdk name (see `@/plugin-ids`).
13
- export { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_DECISION, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_MOSS_TRANSCRIBE, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_AUDIOGEN, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS } from './plugin-ids.js';
14
+ export { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_IMAGE_EMBEDDING, PLUGIN_DECISION, PLUGIN_RERANK, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_MOSS_TRANSCRIBE, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_AUDIOGEN, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS } from './plugin-ids.js';
14
15
  export {} from './utils/tool-helpers.js';
15
16
  // Model types - canonical naming with backward-compatible aliases
16
17
  export { MODEL_TYPES, ModelType } from '@qvac/inference/surface';
@@ -37,18 +38,13 @@ export { SUPPORTED_AUDIO_FORMATS } from '@qvac/inference/surface';
37
38
  // `err instanceof <Class>` works on the consumer side, not just on
38
39
  // the worker side.
39
40
  export { InferenceCancelledError } from './utils/errors-server.js';
40
- export { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, TranslationFailedError } from './utils/errors-server.js';
41
+ export { ContextOverflowError, ModelRegistryModelNotFoundError, ModelRegistryBusyError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, TranslationFailedError, AudioEncodeFailedError, InvalidSeedFromParamsError, KvCacheSeedSourceNotFoundError, KvCacheSeedSharingDisabledError, SessionIdConflictError, SessionNotOpenError, ModelLeasedError, ModelReconfiguredError, OwnerOnlyError, RAGWorkspaceBusyError } from './utils/errors-server.js';
41
42
  // `WorkerCrashedError` and `WorkerShutdownError` are thrown by the
42
43
  // rpc-client life-signal race when the bare worker exits unexpectedly
43
- // or close()/process-exit teardown runs while a caller is in flight.
44
- // `WorkerStartupError` is the pre-handshake counterpart: it is never thrown
45
- // directly, it is the `cause` of `RPCInitTimeoutError`, and it carries
46
- // `workerExited` / `exitCode` / `exitSignal` / `stderrTail` so a host can tell a
47
- // crashed worker from a slow one without parsing the message.
48
- // `BareRuntimeBinaryNotFoundError` is thrown when the worker fails to
49
- // spawn because the platform's `bare-runtime-<platform>-<arch>` package is
50
- // missing (common under pnpm). Exported so consumers can pattern-match with
51
- // `instanceof`.
44
+ // or close() runs while a caller is in flight.
45
+ // `WorkerStartupError` is thrown when the worker fails to start; its `cause` is
46
+ // the worker's own error, and it carries the exit code or signal of a worker
47
+ // process that exited and whether `rpcInitTimeoutMs` ran out.
52
48
  // `StreamEndedError` is raised by the streaming result helpers (upscale, world)
53
49
  // when the RPC stream closes without a terminal `done` frame. Exported for the
54
50
  // same reason as the rest of this block: matching on it requires the class.
@@ -56,7 +52,7 @@ export { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, Req
56
52
  // invalid stream/sentenceStream combination, and what the duplex TTS session
57
53
  // throws on a write after end — its own JSDoc named it long before it was
58
54
  // exported.
59
- export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, WorkerStartupError, RequestValidationFailedError, StreamEndedError, TextToSpeechStreamFailedError } from './utils/errors-client.js';
55
+ export { WorkerCrashedError, WorkerShutdownError, WorkerStartupError, RequestValidationFailedError, StreamEndedError, TextToSpeechStreamFailedError, SessionInvalidatedError, ModelHandleInvalidatedError } from './utils/errors-client.js';
60
56
  // Logging exports
61
57
  export { getLogger, SDK_LOG_ID, SDK_ALL_LOG_ID } from './logging/index.js';
62
58
  // Profiler exports
@@ -1,4 +1,4 @@
1
- import type { Logger } from './index.js';
1
+ import type { Logger } from '../logging/index.js';
2
2
  export declare function registerAddonLogger(modelId: string, namespace: string, logger: Logger): void;
3
3
  export declare function unregisterAddonLogger(modelId: string): void;
4
4
  export declare function createAddonLoggerCallback(namespace: string): (priority: number, message: string) => void;
@@ -1,5 +1,5 @@
1
1
  import QvacLogger, {} from '@qvac/logging';
2
- import { LOG_LEVELS } from '@qvac/logging/constants.js';
2
+ import { LOG_LEVELS } from '@qvac/logging/constants';
3
3
  import { isLevelEnabled, formatArg } from './utils.js';
4
4
  import { registerLogger } from './registry.js';
5
5
  export function createBaseLogger(namespace, options, extensions) {
@@ -1,4 +1,4 @@
1
- import { LEVEL_PRIORITIES, LOG_LEVELS } from '@qvac/logging/constants.js';
1
+ import { LEVEL_PRIORITIES, LOG_LEVELS } from '@qvac/logging/constants';
2
2
  import stringify from 'fast-safe-stringify';
3
3
  export function isLevelEnabled(messageLevel, currentLevel) {
4
4
  // "off" suppresses every emission (console, streams, and transports alike),
@@ -65,13 +65,21 @@ export function summarizeRequest(request) {
65
65
  summary['image'] = `[${img.type}: ${img.value.length} bytes]`;
66
66
  return summary;
67
67
  }
68
- if (request.type === 'embed') {
68
+ if (request.type === 'embed' || request.type === 'embedBatch') {
69
+ if (request.input !== undefined) {
70
+ summary['input'] = '[1 embedding input]';
71
+ return summary;
72
+ }
73
+ if (request.inputs !== undefined) {
74
+ summary['inputs'] = `[${request.inputs.length} embedding inputs]`;
75
+ return summary;
76
+ }
69
77
  const text = request['text'];
70
78
  if (Array.isArray(text)) {
71
79
  const totalLen = text.reduce((sum, t) => sum + t.length, 0);
72
80
  summary['text'] = `[${text.length} items, ${totalLen} chars]`;
73
81
  }
74
- else if (text.length > 200) {
82
+ else if (text !== undefined && text.length > 200) {
75
83
  summary['text'] = `[${text.length} chars]`;
76
84
  }
77
85
  else {
@@ -1,5 +1,7 @@
1
1
  export declare const PLUGIN_LLM: "@qvac/sdk/llamacpp-completion/plugin";
2
2
  export declare const PLUGIN_DECISION: "@qvac/sdk/llamacpp-decision/plugin";
3
+ export declare const PLUGIN_RERANK: "@qvac/sdk/llamacpp-rerank/plugin";
4
+ export declare const PLUGIN_IMAGE_EMBEDDING: "@qvac/sdk/ggml-image-embedding/plugin";
3
5
  export declare const PLUGIN_EMBEDDING: "@qvac/sdk/llamacpp-embedding/plugin";
4
6
  export declare const PLUGIN_WHISPER: "@qvac/sdk/whispercpp-transcription/plugin";
5
7
  export declare const PLUGIN_BCI: "@qvac/sdk/bci-whispercpp-transcription/plugin";
@@ -11,6 +13,6 @@ export declare const PLUGIN_DIFFUSION: "@qvac/sdk/sdcpp-generation/plugin";
11
13
  export declare const PLUGIN_AUDIOGEN: "@qvac/sdk/audiogen-ggml/plugin";
12
14
  export declare const PLUGIN_VLA: "@qvac/sdk/ggml-vla/plugin";
13
15
  export declare const PLUGIN_CLASSIFICATION: "@qvac/sdk/ggml-classification/plugin";
14
- export declare const SDK_DEFAULT_PLUGINS: readonly ["@qvac/sdk/llamacpp-completion/plugin", "@qvac/sdk/llamacpp-embedding/plugin", "@qvac/sdk/llamacpp-decision/plugin", "@qvac/sdk/whispercpp-transcription/plugin", "@qvac/sdk/bci-whispercpp-transcription/plugin", "@qvac/sdk/parakeet-transcription/plugin", "@qvac/sdk/moss-transcribe/plugin", "@qvac/sdk/nmtcpp-translation/plugin", "@qvac/sdk/tts-ggml/plugin", "@qvac/sdk/ggml-ocr/plugin", "@qvac/sdk/sdcpp-generation/plugin", "@qvac/sdk/audiogen-ggml/plugin", "@qvac/sdk/ggml-vla/plugin", "@qvac/sdk/ggml-classification/plugin"];
16
+ export declare const SDK_DEFAULT_PLUGINS: readonly ["@qvac/sdk/llamacpp-completion/plugin", "@qvac/sdk/llamacpp-embedding/plugin", "@qvac/sdk/ggml-image-embedding/plugin", "@qvac/sdk/llamacpp-decision/plugin", "@qvac/sdk/llamacpp-rerank/plugin", "@qvac/sdk/whispercpp-transcription/plugin", "@qvac/sdk/bci-whispercpp-transcription/plugin", "@qvac/sdk/parakeet-transcription/plugin", "@qvac/sdk/moss-transcribe/plugin", "@qvac/sdk/nmtcpp-translation/plugin", "@qvac/sdk/tts-ggml/plugin", "@qvac/sdk/ggml-ocr/plugin", "@qvac/sdk/sdcpp-generation/plugin", "@qvac/sdk/audiogen-ggml/plugin", "@qvac/sdk/ggml-vla/plugin", "@qvac/sdk/ggml-classification/plugin"];
15
17
  export type BuiltinPlugin = (typeof SDK_DEFAULT_PLUGINS)[number];
16
18
  //# sourceMappingURL=plugin-ids.d.ts.map
@@ -1,6 +1,8 @@
1
1
  // Built-in plugin ids under the public @qvac/sdk name.
2
2
  export const PLUGIN_LLM = '@qvac/sdk/llamacpp-completion/plugin';
3
3
  export const PLUGIN_DECISION = '@qvac/sdk/llamacpp-decision/plugin';
4
+ export const PLUGIN_RERANK = '@qvac/sdk/llamacpp-rerank/plugin';
5
+ export const PLUGIN_IMAGE_EMBEDDING = '@qvac/sdk/ggml-image-embedding/plugin';
4
6
  export const PLUGIN_EMBEDDING = '@qvac/sdk/llamacpp-embedding/plugin';
5
7
  export const PLUGIN_WHISPER = '@qvac/sdk/whispercpp-transcription/plugin';
6
8
  export const PLUGIN_BCI = '@qvac/sdk/bci-whispercpp-transcription/plugin';
@@ -16,7 +18,9 @@ export const PLUGIN_CLASSIFICATION = '@qvac/sdk/ggml-classification/plugin';
16
18
  export const SDK_DEFAULT_PLUGINS = [
17
19
  PLUGIN_LLM,
18
20
  PLUGIN_EMBEDDING,
21
+ PLUGIN_IMAGE_EMBEDDING,
19
22
  PLUGIN_DECISION,
23
+ PLUGIN_RERANK,
20
24
  PLUGIN_WHISPER,
21
25
  PLUGIN_BCI,
22
26
  PLUGIN_PARAKEET,
@@ -1,4 +1,4 @@
1
- export { llmConfigBaseSchema as llamacppCompletionConfigSchema, embedConfigBaseSchema as llamacppEmbeddingConfigSchema, decisionConfigBaseSchema as llamacppDecisionConfigSchema, modelSrcInputSchema as modelSourceSchema, type LlmConfigInput as LlamacppCompletionConfig, type EmbedConfigInput as LlamacppEmbeddingConfig, type DecisionConfigInput as LlamacppDecisionConfig, type ModelSrcInput as ModelSource } from '@qvac/inference/surface';
1
+ export { llmConfigBaseSchema as llamacppCompletionConfigSchema, embedConfigBaseSchema as llamacppEmbeddingConfigSchema, decisionConfigBaseSchema as llamacppDecisionConfigSchema, rerankConfigBaseSchema as llamacppRerankConfigSchema, imageEmbeddingConfigSchema as ggmlImageEmbeddingConfigSchema, type ImageEmbeddingConfig as GgmlImageEmbeddingConfig, modelSrcInputSchema as modelSourceSchema, type LlmConfigInput as LlamacppCompletionConfig, type EmbedConfigInput as LlamacppEmbeddingConfig, type DecisionConfigInput as LlamacppDecisionConfig, type RerankConfigInput as LlamacppRerankConfig, type ModelSrcInput as ModelSource } from '@qvac/inference/surface';
2
2
  export { configSchemaForModelType, MODEL_CONFIG_SCHEMA_BY_TYPE } from '@qvac/inference/surface';
3
3
  export { modelFitPolicySchema, type ModelFitPolicy } from '@qvac/inference/surface';
4
4
  //# sourceMappingURL=public.d.ts.map
@@ -2,7 +2,7 @@
2
2
  // (aliased from @qvac/inference's schemas) so consumers such as the CLI can import
3
3
  // a model's `modelConfig` schema and read its field descriptions without depending
4
4
  // on internal identifiers.
5
- export { llmConfigBaseSchema as llamacppCompletionConfigSchema, embedConfigBaseSchema as llamacppEmbeddingConfigSchema, decisionConfigBaseSchema as llamacppDecisionConfigSchema, modelSrcInputSchema as modelSourceSchema } from '@qvac/inference/surface';
5
+ export { llmConfigBaseSchema as llamacppCompletionConfigSchema, embedConfigBaseSchema as llamacppEmbeddingConfigSchema, decisionConfigBaseSchema as llamacppDecisionConfigSchema, rerankConfigBaseSchema as llamacppRerankConfigSchema, imageEmbeddingConfigSchema as ggmlImageEmbeddingConfigSchema, modelSrcInputSchema as modelSourceSchema } from '@qvac/inference/surface';
6
6
  // Resolve any model's `modelConfig` schema by model type (canonical, alias, or
7
7
  // engine string) and read its field descriptions — the map is the single source
8
8
  // of truth, so a newly added model type is available here automatically. Lets
@@ -15,30 +15,29 @@ export declare const SDK_CLIENT_ERROR_CODES: {
15
15
  readonly RPC_REQUEST_NOT_SENT: 50201;
16
16
  readonly RPC_RESPONSE_STREAM_NOT_CREATED: 50202;
17
17
  readonly RPC_CONNECTION_FAILED: 50203;
18
- readonly RPC_INIT_TIMEOUT: 50204;
19
18
  readonly WORKER_CRASHED: 50205;
20
19
  readonly WORKER_SHUTDOWN: 50206;
21
20
  readonly WORKER_STARTUP_FAILED: 50207;
21
+ readonly SESSION_INVALIDATED: 50208;
22
+ readonly MODEL_HANDLE_INVALIDATED: 50209;
22
23
  readonly SDK_NOT_FOUND_IN_NODE_MODULES: 50600;
23
24
  readonly WORKER_FILE_NOT_FOUND: 50601;
24
25
  readonly CONFIG_FILE_NOT_FOUND: 50602;
25
26
  readonly CONFIG_FILE_INVALID: 50603;
26
27
  readonly CONFIG_FILE_PARSE_FAILED: 50604;
27
28
  readonly CONFIG_VALIDATION_FAILED: 50605;
28
- readonly PEAR_WORKER_ENTRY_REQUIRED: 50606;
29
29
  readonly MULTIPLE_SDK_INSTALLATIONS: 50607;
30
- readonly WORKER_PLUGINS_NOT_REGISTERED: 50608;
31
30
  readonly BUNDLE_VERIFICATION_FAILED: 50609;
32
- readonly BARE_PACK_NOT_INSTALLED: 50610;
33
- readonly BARE_PACK_ERROR: 50611;
34
31
  readonly INVALID_PLUGIN_SPECIFIER: 50612;
35
32
  readonly BARE_IMPORTS_MAP_NOT_FOUND: 50613;
36
- readonly BARE_RUNTIME_BINARY_NOT_FOUND: 50614;
37
33
  readonly HOST_PREBUILDS_INSTALL_REFUSED: 50615;
38
34
  readonly HOST_PREBUILDS_INSTALL_FAILED: 50616;
39
35
  readonly ADDON_LINK_FAILED: 50617;
40
36
  readonly BARE_PACK_NODE_UNSUPPORTED: 50618;
41
37
  readonly HOST_PREBUILDS_MISSING: 50619;
38
+ readonly REACT_NATIVE_BARE_KIT_UNSUPPORTED: 50620;
39
+ readonly BUNDLE_FAILED: 50621;
40
+ readonly BUNDLE_TARGET_NOT_INSTALLED: 50622;
42
41
  readonly PROFILER_INVALID_CAPACITY: 50800;
43
42
  };
44
43
  declare const clientErrorDefinitions: ErrorCodesMap;
@@ -20,10 +20,11 @@ export const SDK_CLIENT_ERROR_CODES = {
20
20
  RPC_REQUEST_NOT_SENT: 50201,
21
21
  RPC_RESPONSE_STREAM_NOT_CREATED: 50202,
22
22
  RPC_CONNECTION_FAILED: 50203,
23
- RPC_INIT_TIMEOUT: 50204,
24
23
  WORKER_CRASHED: 50205,
25
24
  WORKER_SHUTDOWN: 50206,
26
25
  WORKER_STARTUP_FAILED: 50207,
26
+ SESSION_INVALIDATED: 50208,
27
+ MODEL_HANDLE_INVALIDATED: 50209,
27
28
  // Build/Bundle Errors (50,600-50,799)
28
29
  SDK_NOT_FOUND_IN_NODE_MODULES: 50600,
29
30
  WORKER_FILE_NOT_FOUND: 50601,
@@ -31,20 +32,18 @@ export const SDK_CLIENT_ERROR_CODES = {
31
32
  CONFIG_FILE_INVALID: 50603,
32
33
  CONFIG_FILE_PARSE_FAILED: 50604,
33
34
  CONFIG_VALIDATION_FAILED: 50605,
34
- PEAR_WORKER_ENTRY_REQUIRED: 50606,
35
35
  MULTIPLE_SDK_INSTALLATIONS: 50607,
36
- WORKER_PLUGINS_NOT_REGISTERED: 50608,
37
36
  BUNDLE_VERIFICATION_FAILED: 50609,
38
- BARE_PACK_NOT_INSTALLED: 50610,
39
- BARE_PACK_ERROR: 50611,
40
37
  INVALID_PLUGIN_SPECIFIER: 50612,
41
38
  BARE_IMPORTS_MAP_NOT_FOUND: 50613,
42
- BARE_RUNTIME_BINARY_NOT_FOUND: 50614,
43
39
  HOST_PREBUILDS_INSTALL_REFUSED: 50615,
44
40
  HOST_PREBUILDS_INSTALL_FAILED: 50616,
45
41
  ADDON_LINK_FAILED: 50617,
46
42
  BARE_PACK_NODE_UNSUPPORTED: 50618,
47
43
  HOST_PREBUILDS_MISSING: 50619,
44
+ REACT_NATIVE_BARE_KIT_UNSUPPORTED: 50620,
45
+ BUNDLE_FAILED: 50621,
46
+ BUNDLE_TARGET_NOT_INSTALLED: 50622,
48
47
  // Profiler Errors (50,800-50,899)
49
48
  PROFILER_INVALID_CAPACITY: 50800
50
49
  };
@@ -107,10 +106,6 @@ const clientErrorDefinitions = {
107
106
  name: 'RPC_CONNECTION_FAILED',
108
107
  message: (details) => `RPC connection failed: ${details}`
109
108
  },
110
- [SDK_CLIENT_ERROR_CODES.RPC_INIT_TIMEOUT]: {
111
- name: 'RPC_INIT_TIMEOUT',
112
- message: (timeoutMs) => `RPC initialization timed out after ${timeoutMs}ms — the worker process may have failed to start`
113
- },
114
109
  [SDK_CLIENT_ERROR_CODES.WORKER_CRASHED]: {
115
110
  name: 'WORKER_CRASHED',
116
111
  message: (code, signal) => `Bare worker exited mid-request (code=${code}, signal=${signal}) — in-flight calls were aborted`
@@ -119,11 +114,17 @@ const clientErrorDefinitions = {
119
114
  name: 'WORKER_SHUTDOWN',
120
115
  message: () => `SDK is shutting down — in-flight RPC call aborted`
121
116
  },
117
+ [SDK_CLIENT_ERROR_CODES.SESSION_INVALIDATED]: {
118
+ name: 'SESSION_INVALIDATED',
119
+ message: (sessionId, reason) => `Session "${sessionId}" is no longer usable (${reason}); open a new session`
120
+ },
121
+ [SDK_CLIENT_ERROR_CODES.MODEL_HANDLE_INVALIDATED]: {
122
+ name: 'MODEL_HANDLE_INVALIDATED',
123
+ message: (modelId, sessionId) => `Model "${modelId}" is no longer loaded: the runtime or session that held it ("${sessionId}") is gone; load it again`
124
+ },
122
125
  [SDK_CLIENT_ERROR_CODES.WORKER_STARTUP_FAILED]: {
123
126
  name: 'WORKER_STARTUP_FAILED',
124
- // `details` is the full sentence; `stderrTail` is appended under a
125
- // `Worker stderr:` header when non-empty.
126
- message: (details, stderrTail) => stderrTail ? `${details}\n\nWorker stderr:\n${stderrTail}` : details
127
+ message: (details) => details
127
128
  },
128
129
  // Build/Bundle Errors (50,600-50,799)
129
130
  [SDK_CLIENT_ERROR_CODES.SDK_NOT_FOUND_IN_NODE_MODULES]: {
@@ -154,29 +155,17 @@ const clientErrorDefinitions = {
154
155
  name: 'MULTIPLE_SDK_INSTALLATIONS',
155
156
  message: (packages) => `Multiple QVAC SDK installations found: ${packages}. Remove all but one to avoid conflicts.`
156
157
  },
157
- [SDK_CLIENT_ERROR_CODES.PEAR_WORKER_ENTRY_REQUIRED]: {
158
- name: 'PEAR_WORKER_ENTRY_REQUIRED',
159
- message: (workerEntry) => `No plugins registered. Pear apps must spawn ${workerEntry} as the worker entry. Run \`npx qvac bundle sdk\` to generate it, then spawn the generated file instead of your worker directly.`
160
- },
161
- [SDK_CLIENT_ERROR_CODES.WORKER_PLUGINS_NOT_REGISTERED]: {
162
- name: 'WORKER_PLUGINS_NOT_REGISTERED',
163
- message: () => 'No plugins registered in the worker. For in-process Bare use `@qvac/inference` and register plugins with `plugins([...])` (or `registerPlugin(...)`). See https://docs.qvac.tether.io/configuration/plugins#runtime-registration-on-bare'
164
- },
165
158
  [SDK_CLIENT_ERROR_CODES.BUNDLE_VERIFICATION_FAILED]: {
166
159
  name: 'BUNDLE_VERIFICATION_FAILED',
167
- message: (bundlePath) => `qvac verify bundle reported error-level issues for ${bundlePath}. See the CLI output above for the failing addons/hosts; resolve them before shipping.`
160
+ message: (bundlePath) => `Native addon verification failed for ${bundlePath}. The cause lists the failing addons and hosts; resolve them before shipping.`
168
161
  },
169
- [SDK_CLIENT_ERROR_CODES.BARE_PACK_NOT_INSTALLED]: {
170
- name: 'BARE_PACK_NOT_INSTALLED',
171
- message: 'bare-pack binary not found. Install bare-pack as a peer dependency: npm install bare-pack'
172
- },
173
- [SDK_CLIENT_ERROR_CODES.BARE_PACK_ERROR]: {
174
- name: 'BARE_PACK_ERROR',
175
- message: (exitCode, entryPath, outputPath) => `bare-pack exited with code ${exitCode}\n\n Entry file: ${entryPath}\n Output file: ${outputPath}\n\n Run bare-pack manually for more details.`
162
+ [SDK_CLIENT_ERROR_CODES.BUNDLE_FAILED]: {
163
+ name: 'BUNDLE_FAILED',
164
+ message: (entryPath, reason) => `Bundling the worker failed\n\n Entry file: ${entryPath}\n Reason: ${reason}`
176
165
  },
177
166
  [SDK_CLIENT_ERROR_CODES.BARE_PACK_NODE_UNSUPPORTED]: {
178
167
  name: 'BARE_PACK_NODE_UNSUPPORTED',
179
- message: (nodeVersion, requiredRange) => `bare-pack needs Node ${requiredRange}; found Node v${nodeVersion}. Upgrade Node and run the bundle again.`
168
+ message: (nodeVersion, requiredRange) => `Bundling needs Node ${requiredRange}; found Node v${nodeVersion}. Upgrade Node and run the bundle again.`
180
169
  },
181
170
  [SDK_CLIENT_ERROR_CODES.INVALID_PLUGIN_SPECIFIER]: {
182
171
  name: 'INVALID_PLUGIN_SPECIFIER',
@@ -186,10 +175,6 @@ const clientErrorDefinitions = {
186
175
  name: 'BARE_IMPORTS_MAP_NOT_FOUND',
187
176
  message: (sdkName, expectedPath) => `bare-imports.json not found.\n\n Expected at: ${expectedPath}\n\n Make sure ${sdkName} is installed in your project.`
188
177
  },
189
- [SDK_CLIENT_ERROR_CODES.BARE_RUNTIME_BINARY_NOT_FOUND]: {
190
- name: 'BARE_RUNTIME_BINARY_NOT_FOUND',
191
- message: (platform, arch) => `Could not load the Bare runtime binary for ${platform}-${arch}. The platform package "bare-runtime-${platform}-${arch}" (or one of its dependencies) is missing from node_modules — commonly seen with pnpm, which does not always install nested optional dependencies. Fix it by installing the platform package directly (e.g. \`pnpm add bare-runtime-${platform}-${arch}\`) or by installing with npm or bun. See https://github.com/tetherto/qvac/issues/1492`
192
- },
193
178
  [SDK_CLIENT_ERROR_CODES.HOST_PREBUILDS_INSTALL_REFUSED]: {
194
179
  name: 'HOST_PREBUILDS_INSTALL_REFUSED',
195
180
  message: (reason, dependencies) => `Cannot install the addon platform packages automatically: ${reason}.` +
@@ -210,8 +195,17 @@ const clientErrorDefinitions = {
210
195
  },
211
196
  [SDK_CLIENT_ERROR_CODES.HOST_PREBUILDS_MISSING]: {
212
197
  name: 'HOST_PREBUILDS_MISSING',
213
- message: (dependencies) => "Bundling failed: split addons resolve their native code through `#host-addon`, which needs each mobile host's platform package installed." +
214
- `\n\n Add them to the dependencies in package.json, pinned to these exact versions, and reinstall (or bundle with installMissingPrebuilds):\n${dependencies}`
198
+ message: (dependencies) => "Bundling failed: split addons resolve their native code through `#host-addon`, which needs each host's platform package installed." +
199
+ `\n\n Add them to the dependencies in package.json, pinned to these exact versions, and reinstall. installMissingPrebuilds does this for phone hosts; npm installs another desktop host's package only with --force:\n${dependencies}`
200
+ },
201
+ [SDK_CLIENT_ERROR_CODES.REACT_NATIVE_BARE_KIT_UNSUPPORTED]: {
202
+ name: 'REACT_NATIVE_BARE_KIT_UNSUPPORTED',
203
+ message: (installedVersion, requiredRange) => `The react-native worker bundle needs react-native-bare-kit ${requiredRange}; found ${installedVersion}. ` +
204
+ 'Upgrade react-native-bare-kit and run the bundle again.'
205
+ },
206
+ [SDK_CLIENT_ERROR_CODES.BUNDLE_TARGET_NOT_INSTALLED]: {
207
+ name: 'BUNDLE_TARGET_NOT_INSTALLED',
208
+ message: (target, packageName) => `The ${target} target needs ${packageName}, which the project does not have. Install it and run the bundle again.`
215
209
  },
216
210
  // Profiler Errors (50,800-50,899)
217
211
  [SDK_CLIENT_ERROR_CODES.PROFILER_INVALID_CAPACITY]: {