@qvac/sdk 0.20.0 → 0.21.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 (104) hide show
  1. package/NOTICE +134 -66
  2. package/README.md +39 -3
  3. package/dist/examples/advisory-model-fit.d.ts +17 -16
  4. package/dist/examples/advisory-model-fit.js +18 -18
  5. package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +3 -3
  6. package/dist/examples/asr/parakeet-unified-coreml.d.ts +2 -0
  7. package/dist/examples/asr/parakeet-unified-coreml.js +113 -0
  8. package/dist/examples/assess-model-fit.js +9 -4
  9. package/dist/examples/model-fit-ui/server.js +5 -2
  10. package/dist/examples/rpc-inference.d.ts +2 -0
  11. package/dist/examples/rpc-inference.js +51 -0
  12. package/dist/examples/rpc-server.d.ts +2 -0
  13. package/dist/examples/rpc-server.js +32 -0
  14. package/dist/examples/tools/llamacpp-deferred-tools.d.ts +2 -0
  15. package/dist/examples/tools/llamacpp-deferred-tools.js +77 -0
  16. package/dist/examples/tts/audio8.js +4 -0
  17. package/dist/examples/tts/moss-dialogue.d.ts +2 -0
  18. package/dist/examples/tts/moss-dialogue.js +63 -0
  19. package/dist/examples/tts/moss.d.ts +2 -0
  20. package/dist/examples/tts/moss.js +71 -0
  21. package/dist/scripts/contract/build-contract.d.ts +2 -1
  22. package/dist/scripts/contract/build-contract.js +4 -1
  23. package/dist/scripts/contract/build-numeric-constants.d.ts +15 -0
  24. package/dist/scripts/contract/build-numeric-constants.js +13 -0
  25. package/dist/scripts/contract/method-shapes.d.ts +3 -0
  26. package/dist/scripts/contract/method-shapes.js +3 -0
  27. package/dist/scripts/enforce-inference-versions.d.ts +18 -0
  28. package/dist/scripts/enforce-inference-versions.js +158 -0
  29. package/dist/scripts/generate-bare-kit-runtimes.d.ts +2 -0
  30. package/dist/scripts/generate-bare-kit-runtimes.js +106 -0
  31. package/dist/src/client/api/assess-model-fit.d.ts +11 -5
  32. package/dist/src/client/api/assess-model-fit.js +30 -8
  33. package/dist/src/client/api/bci-transcribe.d.ts +4 -1
  34. package/dist/src/client/api/get-system-resources.d.ts +8 -0
  35. package/dist/src/client/api/get-system-resources.js +8 -0
  36. package/dist/src/client/api/index.d.ts +1 -0
  37. package/dist/src/client/api/index.js +1 -0
  38. package/dist/src/client/api/rpc-server.d.ts +20 -0
  39. package/dist/src/client/api/rpc-server.js +45 -0
  40. package/dist/src/client/api/text-to-speech.d.ts +9 -0
  41. package/dist/src/client/api/text-to-speech.js +9 -0
  42. package/dist/src/client/api/transcribe.d.ts +21 -15
  43. package/dist/src/client/api/transcribe.js +65 -20
  44. package/dist/src/client/rpc/rpc-error.js +11 -7
  45. package/dist/src/commands/bundle/entry-gen.d.ts +2 -2
  46. package/dist/src/commands/bundle/entry-gen.js +8 -4
  47. package/dist/src/commands/bundle/index.d.ts +20 -0
  48. package/dist/src/commands/bundle/index.js +88 -12
  49. package/dist/src/commands/bundle/plugins.js +1 -1
  50. package/dist/src/commands/command-logger.d.ts +6 -0
  51. package/dist/src/commands/command-logger.js +12 -0
  52. package/dist/src/commands/host-prebuilds/index.d.ts +71 -0
  53. package/dist/src/commands/host-prebuilds/index.js +227 -0
  54. package/dist/src/commands/host-prebuilds/package-manager.d.ts +54 -0
  55. package/dist/src/commands/host-prebuilds/package-manager.js +278 -0
  56. package/dist/src/commands/index.d.ts +10 -1
  57. package/dist/src/commands/index.js +6 -0
  58. package/dist/src/commands/verify/abi.d.ts +22 -2
  59. package/dist/src/commands/verify/abi.js +49 -27
  60. package/dist/src/commands/verify/addon-source.d.ts +22 -0
  61. package/dist/src/commands/verify/addon-source.js +69 -3
  62. package/dist/src/commands/verify/bare-kit-runtime.d.ts +38 -0
  63. package/dist/src/commands/verify/bare-kit-runtime.js +201 -0
  64. package/dist/src/commands/verify/bare-kit-runtimes.d.ts +12 -0
  65. package/dist/src/commands/verify/bare-kit-runtimes.js +108 -0
  66. package/dist/src/commands/verify/bundle-source.js +16 -15
  67. package/dist/src/commands/verify/engines-advice.d.ts +73 -0
  68. package/dist/src/commands/verify/engines-advice.js +271 -0
  69. package/dist/src/commands/verify/index.d.ts +22 -0
  70. package/dist/src/commands/verify/index.js +151 -13
  71. package/dist/src/commands/verify/node-modules-source.js +43 -39
  72. package/dist/src/commands/verify/prebuilds.d.ts +19 -0
  73. package/dist/src/commands/verify/prebuilds.js +52 -13
  74. package/dist/src/expo/plugins/index.d.ts +2 -0
  75. package/dist/src/expo/plugins/withMobileBundle.d.ts +15 -5
  76. package/dist/src/expo/plugins/withMobileBundle.js +68 -42
  77. package/dist/src/expo/plugins/withQvacSDK.d.ts +7 -1
  78. package/dist/src/expo/plugins/withQvacSDK.js +6 -3
  79. package/dist/src/index.d.ts +5 -2
  80. package/dist/src/index.js +4 -2
  81. package/dist/src/schemas/sdk-errors-client.d.ts +2 -0
  82. package/dist/src/schemas/sdk-errors-client.js +16 -0
  83. package/dist/src/schemas/sdk-errors-server.d.ts +1 -0
  84. package/dist/src/schemas/sdk-errors-server.js +5 -0
  85. package/dist/src/utils/errors-client.d.ts +15 -0
  86. package/dist/src/utils/errors-client.js +26 -0
  87. package/dist/src/utils/errors-server.d.ts +1 -0
  88. package/dist/src/utils/errors-server.js +1 -0
  89. package/dist/src/utils/mcp-adapter.js +7 -1
  90. package/dist/src/utils/tool-helpers.d.ts +4 -0
  91. package/dist/src/utils/tool-helpers.js +2 -0
  92. package/dist/src/worker/ggml-rpc-server-provider.d.ts +2 -0
  93. package/dist/src/worker/ggml-rpc-server-provider.js +1 -0
  94. package/dist/src/worker/rpc-server-provider.d.ts +3 -0
  95. package/dist/src/worker/rpc-server-provider.js +1 -0
  96. package/package.json +31 -27
  97. package/dist/scripts/enforce-inference-peer-dependencies.d.ts +0 -2
  98. package/dist/scripts/enforce-inference-peer-dependencies.js +0 -39
  99. package/dist/src/deprecate.d.ts +0 -2
  100. package/dist/src/deprecate.js +0 -9
  101. package/dist/src/worker/legacy-worker-entry.d.ts +0 -2
  102. package/dist/src/worker/legacy-worker-entry.js +0 -3
  103. package/dist/src/worker/worker-core.d.ts +0 -7
  104. package/dist/src/worker/worker-core.js +0 -8
@@ -1,6 +1,6 @@
1
1
  import { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
- import { deduplicateAddons, readAddonPackageJson } from './addon-source.js';
3
+ import { createLimiter, deduplicateAddons, FS_CONCURRENCY, readAddonPackageJson } from './addon-source.js';
4
4
  export class InvalidNodeModulesSourceError extends Error {
5
5
  nodeModulesPath;
6
6
  constructor(nodeModulesPath, cause) {
@@ -14,63 +14,67 @@ export class InvalidNodeModulesSourceError extends Error {
14
14
  }
15
15
  export async function collectAddonsFromNodeModules(options) {
16
16
  const { nodeModulesRoot, diagnostics } = options;
17
+ const limit = createLimiter(FS_CONCURRENCY);
18
+ const results = await walkNodeModules(nodeModulesRoot, limit, true);
17
19
  const addons = [];
18
- await walkNodeModules(nodeModulesRoot, addons, diagnostics, true);
20
+ for (const result of results) {
21
+ if (result.record !== undefined && diagnostics !== undefined) {
22
+ diagnostics.packages.push(result.record);
23
+ }
24
+ if (result.isAddon && result.addon) {
25
+ addons.push(result.addon);
26
+ }
27
+ else if (result.invalid !== undefined && diagnostics !== undefined) {
28
+ diagnostics.invalidPackageJsons.push(result.invalid);
29
+ }
30
+ }
19
31
  return deduplicateAddons(addons);
20
32
  }
21
- async function walkNodeModules(nodeModulesDir, addons, diagnostics, isRoot) {
33
+ /**
34
+ * Directory reads run in parallel under `limit`; results are concatenated in
35
+ * directory-entry order so the output does not depend on I/O timing.
36
+ */
37
+ async function walkNodeModules(nodeModulesDir, limit, isRoot) {
22
38
  let entries;
23
39
  try {
24
- entries = await fsp.readdir(nodeModulesDir, { withFileTypes: true });
40
+ entries = await limit(() => fsp.readdir(nodeModulesDir, { withFileTypes: true }));
25
41
  }
26
42
  catch (error) {
27
43
  if (isRoot)
28
44
  throw new InvalidNodeModulesSourceError(nodeModulesDir, error);
29
- return;
30
- }
31
- for (const entry of entries) {
32
- if (entry.name.startsWith('.'))
33
- continue;
34
- if (!isPackageEntry(entry))
35
- continue;
36
- if (entry.name.startsWith('@')) {
37
- await walkScopeDirectory(path.join(nodeModulesDir, entry.name), addons, diagnostics);
38
- continue;
39
- }
40
- await visitPackageDirectory(path.join(nodeModulesDir, entry.name), entry.name, addons, diagnostics);
45
+ return [];
41
46
  }
47
+ const visits = entries
48
+ .filter((entry) => !entry.name.startsWith('.') && isPackageEntry(entry))
49
+ .map((entry) => entry.name.startsWith('@')
50
+ ? walkScopeDirectory(path.join(nodeModulesDir, entry.name), limit)
51
+ : visitPackageDirectory(path.join(nodeModulesDir, entry.name), entry.name, limit));
52
+ return (await Promise.all(visits)).flat();
42
53
  }
43
- async function walkScopeDirectory(scopeDir, addons, diagnostics) {
54
+ async function walkScopeDirectory(scopeDir, limit) {
44
55
  const scope = path.basename(scopeDir);
45
56
  let entries;
46
57
  try {
47
- entries = await fsp.readdir(scopeDir, { withFileTypes: true });
58
+ entries = await limit(() => fsp.readdir(scopeDir, { withFileTypes: true }));
48
59
  }
49
60
  catch {
50
- return;
51
- }
52
- for (const entry of entries) {
53
- if (entry.name.startsWith('.'))
54
- continue;
55
- if (!isPackageEntry(entry))
56
- continue;
57
- await visitPackageDirectory(path.join(scopeDir, entry.name), `${scope}/${entry.name}`, addons, diagnostics);
61
+ return [];
58
62
  }
63
+ const visits = entries
64
+ .filter((entry) => !entry.name.startsWith('.') && isPackageEntry(entry))
65
+ .map((entry) => visitPackageDirectory(path.join(scopeDir, entry.name), `${scope}/${entry.name}`, limit));
66
+ return (await Promise.all(visits)).flat();
59
67
  }
60
68
  function isPackageEntry(entry) {
61
69
  return entry.isDirectory() || entry.isSymbolicLink();
62
70
  }
63
- async function visitPackageDirectory(packageDir, packageName, addons, diagnostics) {
64
- const result = await readAddonPackageJson({
65
- packageJsonPath: path.join(packageDir, 'package.json'),
66
- expectedName: packageName
67
- });
68
- if (result.isAddon && result.addon) {
69
- addons.push(result.addon);
70
- }
71
- else if (result.invalid !== undefined && diagnostics !== undefined) {
72
- diagnostics.invalidPackageJsons.push(result.invalid);
73
- }
74
- const nestedNodeModules = path.join(packageDir, 'node_modules');
75
- await walkNodeModules(nestedNodeModules, addons, diagnostics, false);
71
+ async function visitPackageDirectory(packageDir, packageName, limit) {
72
+ const [result, nested] = await Promise.all([
73
+ limit(() => readAddonPackageJson({
74
+ packageJsonPath: path.join(packageDir, 'package.json'),
75
+ expectedName: packageName
76
+ })),
77
+ walkNodeModules(path.join(packageDir, 'node_modules'), limit, false)
78
+ ]);
79
+ return [result, ...nested];
76
80
  }
@@ -6,7 +6,20 @@ export interface MissingPrebuildIssue {
6
6
  host: string;
7
7
  message: string;
8
8
  packageRoot: string;
9
+ /**
10
+ * The per-platform package to declare for this mobile host, at the exact
11
+ * version it must be installed at. Set when the addon's `#host-addon` map
12
+ * names one and it is either not installed or installed at another version.
13
+ * Never set for desktop hosts, whose platform packages install as the
14
+ * addon's os/cpu-filtered optionalDependencies.
15
+ */
16
+ platformPackage?: PlatformPackagePin;
9
17
  }
18
+ export interface PlatformPackagePin {
19
+ name: string;
20
+ version: string;
21
+ }
22
+ export declare function isMobileHost(host: string): boolean;
10
23
  export interface CheckPrebuildsOptions {
11
24
  addon: NativeAddon;
12
25
  hosts: string[];
@@ -19,6 +32,12 @@ export interface CheckPrebuildsOptions {
19
32
  export interface PrebuildLocation {
20
33
  hostDir: string;
21
34
  platformPackage?: string;
35
+ /**
36
+ * The installed platform package's version when it differs from the
37
+ * addon's. Platform packages are version-locked to their addon, so a
38
+ * prebuild in a mismatched one does not count.
39
+ */
40
+ mismatchedVersion?: string;
22
41
  }
23
42
  /**
24
43
  * Directories to search for an addon's `<host>` prebuild, in precedence order:
@@ -2,6 +2,11 @@ import { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { formatAddonId } from './addon-source.js';
4
4
  import { HOST_ADDON_IMPORT, resolveAddonPlatformPackage } from '../../expo/plugins/patches/qvac-platform-addons.js';
5
+ /** Platforms no install host reports, so their platform packages must be declared. */
6
+ const MOBILE_PLATFORMS = new Set(['android', 'ios']);
7
+ export function isMobileHost(host) {
8
+ return MOBILE_PLATFORMS.has(host.split('-')[0] ?? '');
9
+ }
5
10
  const PREBUILDS_DIR = 'prebuilds';
6
11
  const PLATFORM_ADDON_DIR = 'addon';
7
12
  /**
@@ -26,10 +31,17 @@ export async function resolvePrebuildLocations(addon, host) {
26
31
  return locations;
27
32
  const platformRoot = await findInstalledPackage(await realPackageRoot(addon.packageRoot), platformPackage);
28
33
  if (platformRoot !== null) {
29
- locations.push({
34
+ const location = {
30
35
  hostDir: path.join(platformRoot, PLATFORM_ADDON_DIR, PREBUILDS_DIR, host),
31
36
  platformPackage
32
- });
37
+ };
38
+ const installedVersion = await readPackageVersion(platformRoot);
39
+ if (addon.version !== undefined &&
40
+ installedVersion !== undefined &&
41
+ installedVersion !== addon.version) {
42
+ location.mismatchedVersion = installedVersion;
43
+ }
44
+ locations.push(location);
33
45
  }
34
46
  return locations;
35
47
  }
@@ -60,42 +72,69 @@ export async function checkPrebuilds(options) {
60
72
  const locations = await resolvePrebuildLocations(addon, host);
61
73
  if (await anyLocationHasPrebuild(locations))
62
74
  continue;
63
- issues.push({
75
+ const platformPackage = await platformPackageForHost(addon, host);
76
+ const platformLocation = locations.find((location) => location.platformPackage !== undefined);
77
+ const issue = {
64
78
  code: 'missing-prebuild',
65
79
  level: 'error',
66
80
  addon: formatAddonId(addon),
67
81
  host,
68
82
  packageRoot: addon.packageRoot,
69
- message: await describeMissingPrebuild(addon, host, locations)
70
- });
83
+ message: describeMissingPrebuild(addon, host, locations, platformPackage, platformLocation)
84
+ };
85
+ const needsPin = isMobileHost(host) &&
86
+ (platformLocation === undefined || platformLocation.mismatchedVersion !== undefined);
87
+ if (platformPackage !== null && addon.version !== undefined && needsPin) {
88
+ issue.platformPackage = { name: platformPackage, version: addon.version };
89
+ }
90
+ issues.push(issue);
71
91
  }
72
92
  return issues;
73
93
  }
74
94
  async function anyLocationHasPrebuild(locations) {
75
95
  for (const location of locations) {
96
+ if (location.mismatchedVersion !== undefined)
97
+ continue;
76
98
  if ((await listBarePrebuildFiles(location.hostDir)).length > 0)
77
99
  return true;
78
100
  }
79
101
  return false;
80
102
  }
81
- async function describeMissingPrebuild(addon, host, locations) {
103
+ function describeMissingPrebuild(addon, host, locations, platformPackage, platformLocation) {
82
104
  const expected = locations.map((location) => path.join(location.hostDir, '*.bare'));
83
- const platformPackage = await platformPackageForHost(addon, host);
84
- const searchedPlatformPackage = locations.some((location) => location.platformPackage === platformPackage);
85
105
  return (`${formatAddonId(addon)} is missing a prebuild for ${host} ` +
86
106
  `(expected ${expected.join(' or ')}).` +
87
- missingPlatformPackageHint(addon, platformPackage, searchedPlatformPackage));
107
+ missingPlatformPackageHint(addon, platformPackage, platformLocation));
88
108
  }
89
- function missingPlatformPackageHint(addon, platformPackage, searchedPlatformPackage) {
90
- if (platformPackage === null || searchedPlatformPackage)
109
+ function missingPlatformPackageHint(addon, platformPackage, platformLocation) {
110
+ if (platformPackage === null)
91
111
  return '';
92
112
  const pin = addon.version === undefined ? platformPackage : `"${platformPackage}": "${addon.version}"`;
93
- return (` Add this exact dependency to package.json (same version as ${addon.name})` +
94
- ` and reinstall: ${pin}`);
113
+ if (platformLocation === undefined) {
114
+ return (` Add this exact dependency to package.json (same version as ${addon.name})` +
115
+ ` and reinstall: ${pin}`);
116
+ }
117
+ if (platformLocation.mismatchedVersion !== undefined) {
118
+ return (` ${platformPackage} ${platformLocation.mismatchedVersion} is installed, but it must be` +
119
+ ` the same version as ${addon.name}. Pin it in package.json and reinstall: ${pin}`);
120
+ }
121
+ return '';
95
122
  }
96
123
  async function platformPackageForHost(addon, host) {
97
124
  return resolveAddonPlatformPackage(addon.name, await readHostAddonMap(addon), host);
98
125
  }
126
+ async function readPackageVersion(packageRoot) {
127
+ try {
128
+ const parsed = JSON.parse(await fsp.readFile(path.join(packageRoot, 'package.json'), 'utf8'));
129
+ if (typeof parsed !== 'object' || parsed === null)
130
+ return undefined;
131
+ const version = parsed.version;
132
+ return typeof version === 'string' ? version : undefined;
133
+ }
134
+ catch {
135
+ return undefined;
136
+ }
137
+ }
99
138
  async function readHostAddonMap(addon) {
100
139
  try {
101
140
  const raw = await fsp.readFile(path.join(addon.packageRoot, 'package.json'), 'utf8');
@@ -4,6 +4,8 @@ export { default as withDeviceInfo } from './withDeviceInfo.js';
4
4
  export { default as withMobileBundle } from './withMobileBundle.js';
5
5
  export { default as withOpenCL } from './withOpenCL.js';
6
6
  export { default as withQvacSDK } from './withQvacSDK.js';
7
+ export type { QvacSDKPluginOptions } from './withQvacSDK.js';
8
+ export type { MobileBundleOptions } from './withMobileBundle.js';
7
9
  export { getProjectRootFromMod, getProjectRootFromBaseConfig } from './get-project-root.js';
8
10
  export { resolveSDKPackageDir, SDK_PACKAGE_NAMES } from './resolve-sdk-package-dir.js';
9
11
  export type { SDKPackageInfo } from './resolve-sdk-package-dir.js';
@@ -1,8 +1,9 @@
1
+ import configPlugins from '@expo/config-plugins';
1
2
  import type { ExpoConfig } from 'expo/config';
2
3
  /**
3
4
  * Desktop-only spawn path, deferred so bare-pack does not walk `bare-process`
4
- * -> `bare-posix` (no `android-arm64` prebuild). Mobile advisory uses
5
- * in-process `@qvac/model-fit` (`fitParams`), not this subprocess.
5
+ * -> `bare-posix` (no `android-arm64` prebuild). Mobile runs the engine fitter
6
+ * in process instead, so it never reaches this.
6
7
  */
7
8
  declare const MOBILE_UNSUPPORTED_MODULES: string[];
8
9
  type MobilePlatform = 'android' | 'ios';
@@ -13,13 +14,22 @@ type BareKitLinkerPaths = {
13
14
  android: string | null;
14
15
  ios: string | null;
15
16
  };
17
+ type MobileBundleOptions = {
18
+ /**
19
+ * Install the addon platform packages the bundle needs for the current
20
+ * build target with the app's package manager, pinned in package.json.
21
+ * Off by default: `expo prebuild` then fails and names each package to add.
22
+ */
23
+ installMissingPrebuilds?: boolean;
24
+ };
16
25
  /**
17
26
  * Expo plugin: bundle, verify, then copy the mobile worker bundle.
18
27
  *
19
28
  * Flow: bundleSdk -> verifyBundle -> copy to `<sdkPackageDir>/dist/worker.mobile.bundle.js`.
20
29
  * Uses `qvac.config.*` if present.
21
30
  */
22
- declare function withMobileBundle(config: ExpoConfig): ExpoConfig;
31
+ declare function withMobileBundle(config: ExpoConfig, options?: MobileBundleOptions): ExpoConfig;
32
+ declare function buildMobileBundle<T extends configPlugins.ExportedConfigWithProps<unknown>>(config: T, options: MobileBundleOptions): Promise<T>;
23
33
  declare function mobileHostsForPlatform(platform: string): string[];
24
34
  /** Runs the patched iOS linker after bundleSdk has written the current addons manifest. */
25
35
  declare function runIOSAddonLinker(linkerPath: string): Promise<void>;
@@ -28,7 +38,7 @@ declare function runIOSAddonLinker(linkerPath: string): Promise<void>;
28
38
  * the paths for each platform that was successfully patched.
29
39
  */
30
40
  declare function patchBareKitLinkers(projectRoot: string, qvacSdkPath: string): BareKitLinkerPaths;
31
- export { MOBILE_HOSTS, MOBILE_HOSTS_BY_PLATFORM, MOBILE_UNSUPPORTED_MODULES, mobileHostsForPlatform, patchBareKitLinkers, runIOSAddonLinker };
32
- export type { BareKitLinkerPaths, MobilePlatform };
41
+ export { MOBILE_HOSTS, MOBILE_HOSTS_BY_PLATFORM, MOBILE_UNSUPPORTED_MODULES, buildMobileBundle, mobileHostsForPlatform, patchBareKitLinkers, runIOSAddonLinker };
42
+ export type { BareKitLinkerPaths, MobileBundleOptions, MobilePlatform };
33
43
  export default withMobileBundle;
34
44
  //# sourceMappingURL=withMobileBundle.d.ts.map
@@ -4,6 +4,9 @@ import * as fs from 'fs';
4
4
  import * as path from 'path';
5
5
  import { execPath } from 'process';
6
6
  import { bundleSdk, verifyBundle, hasErrors, formatVerifyBundleResult } from '../../commands/index.js';
7
+ import { createCommandLogger } from '../../commands/command-logger.js';
8
+ import { installMissingHostPrebuilds } from '../../commands/host-prebuilds/index.js';
9
+ import { collectAddonsFromBundle } from '../../commands/verify/bundle-source.js';
7
10
  import { CONFIG_CANDIDATES } from '../../client/config-loader/resolve-config.node.js';
8
11
  import { resolveSDKPackageDir } from './resolve-sdk-package-dir.js';
9
12
  import { getProjectRootFromMod } from './get-project-root.js';
@@ -14,10 +17,10 @@ const { withDangerousMod } = configPlugins;
14
17
  const DEFERRED_MODULES = ['expo-file-system', 'react-native-bare-kit'];
15
18
  /**
16
19
  * Desktop-only spawn path, deferred so bare-pack does not walk `bare-process`
17
- * -> `bare-posix` (no `android-arm64` prebuild). Mobile advisory uses
18
- * in-process `@qvac/model-fit` (`fitParams`), not this subprocess.
20
+ * -> `bare-posix` (no `android-arm64` prebuild). Mobile runs the engine fitter
21
+ * in process instead, so it never reaches this.
19
22
  */
20
- const MOBILE_UNSUPPORTED_MODULES = ['bare-runtime/spawn', '@qvac/model-fit/process'];
23
+ const MOBILE_UNSUPPORTED_MODULES = ['bare-runtime/spawn'];
21
24
  const MOBILE_HOSTS_BY_PLATFORM = {
22
25
  android: ['android-arm64'],
23
26
  ios: ['ios-arm64', 'ios-arm64-simulator', 'ios-x64-simulator']
@@ -32,39 +35,64 @@ const MOBILE_HOSTS = [...MOBILE_HOSTS_BY_PLATFORM.android, ...MOBILE_HOSTS_BY_PL
32
35
  * Flow: bundleSdk -> verifyBundle -> copy to `<sdkPackageDir>/dist/worker.mobile.bundle.js`.
33
36
  * Uses `qvac.config.*` if present.
34
37
  */
35
- function withMobileBundle(config) {
36
- async function buildMobileBundle(config) {
37
- const projectRoot = getProjectRootFromMod(config);
38
- const sdkPackage = resolveSDKPackageDir(projectRoot);
39
- const outputPath = path.join(sdkPackage.dir, 'dist', 'worker.mobile.bundle.js');
40
- const configPath = findConfigFile(projectRoot);
41
- if (configPath) {
42
- console.log(`🕚 QVAC: Found ${path.basename(configPath)}, generating tree-shaken bundle...`);
43
- }
44
- else {
45
- console.log('🕚 QVAC: No config found, generating default bundle (all plugins)...');
46
- }
47
- const deferredModules = [
48
- ...DEFERRED_MODULES,
49
- ...MOBILE_UNSUPPORTED_MODULES,
50
- `${sdkPackage.name}/worker.mobile.bundle`
51
- ];
52
- // The bundle is one shared artifact both platforms import, so it is built
53
- // for every mobile host: a dual-platform `expo prebuild` runs this mod twice
54
- // and the second run would otherwise overwrite the first platform's bundle
55
- // with one that resolved the other platform's conditions.
56
- const linkerPaths = await runBundler(projectRoot, sdkPackage.dir, configPath, deferredModules, MOBILE_HOSTS);
57
- const generatedBundle = path.join(projectRoot, 'qvac', 'worker.bundle.js');
58
- await runVerifier(projectRoot, generatedBundle, configPath, mobileHostsForPlatform(config.modRequest.platform));
59
- fs.copyFileSync(generatedBundle, outputPath);
60
- if (config.modRequest.platform === 'ios' && linkerPaths.ios !== null) {
61
- await runIOSAddonLinker(linkerPaths.ios);
38
+ function withMobileBundle(config, options = {}) {
39
+ config = withDangerousMod(config, ['android', (mod) => buildMobileBundle(mod, options)]);
40
+ config = withDangerousMod(config, ['ios', (mod) => buildMobileBundle(mod, options)]);
41
+ return config;
42
+ }
43
+ async function buildMobileBundle(config, options) {
44
+ const projectRoot = getProjectRootFromMod(config);
45
+ const sdkPackage = resolveSDKPackageDir(projectRoot);
46
+ const outputPath = path.join(sdkPackage.dir, 'dist', 'worker.mobile.bundle.js');
47
+ const platformHosts = mobileHostsForPlatform(config.modRequest.platform);
48
+ const configPath = findConfigFile(projectRoot);
49
+ if (configPath) {
50
+ console.log(`🕚 QVAC: Found ${path.basename(configPath)}, generating tree-shaken bundle...`);
51
+ }
52
+ else {
53
+ console.log('🕚 QVAC: No config found, generating default bundle (all plugins)...');
54
+ }
55
+ const deferredModules = [
56
+ ...DEFERRED_MODULES,
57
+ ...MOBILE_UNSUPPORTED_MODULES,
58
+ `${sdkPackage.name}/worker.mobile.bundle`
59
+ ];
60
+ // The bundle is one shared artifact both platforms import, so it is built
61
+ // for every mobile host: a dual-platform `expo prebuild` runs this mod twice
62
+ // and the second run would otherwise overwrite the first platform's bundle
63
+ // with one that resolved the other platform's conditions.
64
+ const bundle = () => runBundler(projectRoot, sdkPackage.dir, configPath, deferredModules, MOBILE_HOSTS);
65
+ let linkerPaths = await bundle();
66
+ const generatedBundle = path.join(projectRoot, 'qvac', 'worker.bundle.js');
67
+ if (options.installMissingPrebuilds === true) {
68
+ // Take the addons from the bundle graph, which records where each linked
69
+ // addon really is; looking their names up in the project would miss the
70
+ // SDK's addons under pnpm or bun's isolated layout.
71
+ const { installed } = await installMissingHostPrebuilds({
72
+ projectRoot,
73
+ hosts: platformHosts,
74
+ addons: await collectAddonsFromBundle({
75
+ bundlePath: generatedBundle,
76
+ projectRoot,
77
+ hosts: platformHosts
78
+ }),
79
+ quiet: false,
80
+ logger: createCommandLogger({})
81
+ });
82
+ if (installed.length > 0) {
83
+ const names = installed.map((pkg) => `${pkg.name}@${pkg.version}`).join(', ');
84
+ console.log(`📦 QVAC: Installed addon platform packages: ${names}`);
85
+ // bare-pack resolved `#host-addon` to the addon's fallback module for
86
+ // hosts whose platform package was missing.
87
+ linkerPaths = await bundle();
62
88
  }
63
- console.log('🫡 QVAC: Mobile bundle generated and verified');
64
- return config;
65
89
  }
66
- config = withDangerousMod(config, ['android', buildMobileBundle]);
67
- config = withDangerousMod(config, ['ios', buildMobileBundle]);
90
+ await runVerifier(projectRoot, generatedBundle, configPath, platformHosts);
91
+ fs.copyFileSync(generatedBundle, outputPath);
92
+ if (config.modRequest.platform === 'ios' && linkerPaths.ios !== null) {
93
+ await runIOSAddonLinker(linkerPaths.ios);
94
+ }
95
+ console.log('🫡 QVAC: Mobile bundle generated and verified');
68
96
  return config;
69
97
  }
70
98
  function mobileHostsForPlatform(platform) {
@@ -84,16 +112,12 @@ function findConfigFile(projectRoot) {
84
112
  return null;
85
113
  }
86
114
  async function runVerifier(projectRoot, generatedBundle, configPath, hosts) {
87
- if (!configPath) {
88
- console.log('⚠️ QVAC: no qvac.config.* found — Bare runtime will be auto-detected ' +
89
- 'from node_modules (bare-runtime, then bare). Add qvac.config.json ' +
90
- 'with `bareRuntimeVersion` to pin ABI checks deterministically.');
91
- }
92
115
  const result = await verifyBundle({
93
116
  projectRoot,
94
117
  addonsSource: generatedBundle,
95
118
  hosts,
96
- ...(configPath ? { configPath } : {})
119
+ ...(configPath ? { configPath } : {}),
120
+ onProgress: (message) => console.log(`🕚 QVAC: ${message}`)
97
121
  });
98
122
  if (hasErrors(result)) {
99
123
  throw new BundleVerificationFailedError(generatedBundle, new Error(formatVerifyBundleResult(result)));
@@ -107,7 +131,9 @@ async function runBundler(projectRoot, qvacSdkPath, configPath, deferredModules,
107
131
  ...(configPath ? { configPath } : {}),
108
132
  hosts,
109
133
  defer: deferredModules,
110
- quiet: true
134
+ quiet: true,
135
+ // runVerifier checks engines.bare right after, with progress output.
136
+ checkEngines: false
111
137
  });
112
138
  return linkerPaths;
113
139
  }
@@ -179,5 +205,5 @@ function copyLinkerPatch(patchesDir, resolver, targetDir, patchName) {
179
205
  function compiledPlatformAddonResolver(qvacSdkPath) {
180
206
  return path.join(qvacSdkPath, 'dist', 'src', 'expo', 'plugins', 'patches', 'qvac-platform-addons.js');
181
207
  }
182
- export { MOBILE_HOSTS, MOBILE_HOSTS_BY_PLATFORM, MOBILE_UNSUPPORTED_MODULES, mobileHostsForPlatform, patchBareKitLinkers, runIOSAddonLinker };
208
+ export { MOBILE_HOSTS, MOBILE_HOSTS_BY_PLATFORM, MOBILE_UNSUPPORTED_MODULES, buildMobileBundle, mobileHostsForPlatform, patchBareKitLinkers, runIOSAddonLinker };
183
209
  export default withMobileBundle;
@@ -1,4 +1,6 @@
1
1
  import type { ExpoConfig } from 'expo/config';
2
+ import { type MobileBundleOptions } from './withMobileBundle.js';
3
+ type QvacSDKPluginOptions = MobileBundleOptions;
2
4
  /**
3
5
  * Main Qvac SDK Expo plugin that combines all necessary mobile configurations:
4
6
  * - Mobile worker bundle generation
@@ -7,7 +9,11 @@ import type { ExpoConfig } from 'expo/config';
7
9
  * - Android NDK version pinning in build.gradle
8
10
  * - Android architecture filtering (arm64-v8a only)
9
11
  * - OpenCL native library support for Android
12
+ *
13
+ * Options (`["@qvac/sdk/expo-plugin", { ... }]` in app.json) go to
14
+ * `withMobileBundle`.
10
15
  */
11
- declare function withQvacSDK(config: ExpoConfig): ExpoConfig;
16
+ declare function withQvacSDK(config: ExpoConfig, options?: QvacSDKPluginOptions): ExpoConfig;
17
+ export type { QvacSDKPluginOptions };
12
18
  export default withQvacSDK;
13
19
  //# sourceMappingURL=withQvacSDK.d.ts.map
@@ -2,7 +2,7 @@ import configPlugins from '@expo/config-plugins';
2
2
  import withAndroidArchitecture from './withAndroidArchitecture.js';
3
3
  import withAndroidNdkVersion from './withAndroidNdkVersion.js';
4
4
  import withDeviceInfo from './withDeviceInfo.js';
5
- import withMobileBundle from './withMobileBundle.js';
5
+ import withMobileBundle, {} from './withMobileBundle.js';
6
6
  import withOpenCL from './withOpenCL.js';
7
7
  const { withPlugins } = configPlugins;
8
8
  /**
@@ -13,10 +13,13 @@ const { withPlugins } = configPlugins;
13
13
  * - Android NDK version pinning in build.gradle
14
14
  * - Android architecture filtering (arm64-v8a only)
15
15
  * - OpenCL native library support for Android
16
+ *
17
+ * Options (`["@qvac/sdk/expo-plugin", { ... }]` in app.json) go to
18
+ * `withMobileBundle`.
16
19
  */
17
- function withQvacSDK(config) {
20
+ function withQvacSDK(config, options = {}) {
18
21
  return withPlugins(config, [
19
- withMobileBundle,
22
+ [withMobileBundle, options],
20
23
  withDeviceInfo,
21
24
  [
22
25
  'expo-build-properties',
@@ -1,7 +1,7 @@
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, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, type ServerLogHandler, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, classify, 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, 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, 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
3
  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 TranscribeStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, 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 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 AssessModelFitResult, type LoadedInstance, type CacheFileInfo, toolSchema, 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 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';
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 TranscribeStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, 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 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 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 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
5
  export { SDK_CLIENT_ERROR_CODES } from './schemas/sdk-errors-client.js';
6
6
  export { SDK_SERVER_ERROR_CODES } from './schemas/sdk-errors-server.js';
7
7
  export { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_AUDIOGEN, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin } from './plugin-ids.js';
@@ -17,4 +17,7 @@ export { getLogger, SDK_LOG_ID, SDK_ALL_LOG_ID } from './logging/index.js';
17
17
  export type { Logger, LogTransport, LoggerOptions } from './logging/index.js';
18
18
  export { profiler, attachBackendDiagnostics } from '@qvac/inference/surface';
19
19
  export type { ProfilerRuntimeOptions, ProfilerExport, ProfilingEvent, ProfilerGPUResourceGauge, ProfilerResourceGauge } from '@qvac/inference/surface';
20
+ export type { StartRpcServerOptions, StopRpcServerOptions, DiscoverRpcServersOptions, RpcServerInfo, RpcServerCandidate } from '@qvac/inference/surface';
21
+ export { RpcServerOperationError } from './utils/errors-server.js';
22
+ export { getRpcDeviceMap, type RpcDeviceMapping, type RpcDevice } from '@qvac/inference/surface';
20
23
  //# sourceMappingURL=index.d.ts.map
package/dist/src/index.js CHANGED
@@ -1,8 +1,8 @@
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, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, ocr, invokePlugin, invokePluginStream, diffusion, classify, 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, 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, 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
4
  export { plugins } from './client/plugins-factory.js';
5
- export { VERBOSITY, 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, 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';
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
6
  // SDK-owned error-code objects: `SDK_CLIENT_ERROR_CODES` holds transport/client
7
7
  // codes absent from @qvac/inference, and `SDK_SERVER_ERROR_CODES` carries the
8
8
  // client-side error definitions (`addCodes` message registry) that
@@ -61,3 +61,5 @@ export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError
61
61
  export { getLogger, SDK_LOG_ID, SDK_ALL_LOG_ID } from './logging/index.js';
62
62
  // Profiler exports
63
63
  export { profiler, attachBackendDiagnostics } from '@qvac/inference/surface';
64
+ export { RpcServerOperationError } from './utils/errors-server.js';
65
+ export { getRpcDeviceMap } from '@qvac/inference/surface';
@@ -34,6 +34,8 @@ export declare const SDK_CLIENT_ERROR_CODES: {
34
34
  readonly INVALID_PLUGIN_SPECIFIER: 50612;
35
35
  readonly BARE_IMPORTS_MAP_NOT_FOUND: 50613;
36
36
  readonly BARE_RUNTIME_BINARY_NOT_FOUND: 50614;
37
+ readonly HOST_PREBUILDS_INSTALL_REFUSED: 50615;
38
+ readonly HOST_PREBUILDS_INSTALL_FAILED: 50616;
37
39
  readonly PROFILER_INVALID_CAPACITY: 50800;
38
40
  };
39
41
  declare const clientErrorDefinitions: ErrorCodesMap;
@@ -40,6 +40,8 @@ export const SDK_CLIENT_ERROR_CODES = {
40
40
  INVALID_PLUGIN_SPECIFIER: 50612,
41
41
  BARE_IMPORTS_MAP_NOT_FOUND: 50613,
42
42
  BARE_RUNTIME_BINARY_NOT_FOUND: 50614,
43
+ HOST_PREBUILDS_INSTALL_REFUSED: 50615,
44
+ HOST_PREBUILDS_INSTALL_FAILED: 50616,
43
45
  // Profiler Errors (50,800-50,899)
44
46
  PROFILER_INVALID_CAPACITY: 50800
45
47
  };
@@ -181,6 +183,20 @@ const clientErrorDefinitions = {
181
183
  name: 'BARE_RUNTIME_BINARY_NOT_FOUND',
182
184
  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`
183
185
  },
186
+ [SDK_CLIENT_ERROR_CODES.HOST_PREBUILDS_INSTALL_REFUSED]: {
187
+ name: 'HOST_PREBUILDS_INSTALL_REFUSED',
188
+ message: (reason, dependencies) => `Cannot install the addon platform packages automatically: ${reason}.` +
189
+ (dependencies
190
+ ? `\n\n Add them to the dependencies in package.json, pinned to these exact versions, and reinstall:\n${dependencies}`
191
+ : '')
192
+ },
193
+ [SDK_CLIENT_ERROR_CODES.HOST_PREBUILDS_INSTALL_FAILED]: {
194
+ name: 'HOST_PREBUILDS_INSTALL_FAILED',
195
+ message: (details, dependencies) => `Installing the addon platform packages failed: ${details}` +
196
+ (dependencies
197
+ ? `\n\n Fix the error, or add them to the dependencies in package.json, pinned to these exact versions, and reinstall:\n${dependencies}`
198
+ : '')
199
+ },
184
200
  // Profiler Errors (50,800-50,899)
185
201
  [SDK_CLIENT_ERROR_CODES.PROFILER_INVALID_CAPACITY]: {
186
202
  name: 'PROFILER_INVALID_CAPACITY',
@@ -15,6 +15,7 @@ export declare const SDK_SERVER_ERROR_CODES: {
15
15
  readonly TTS_REFERENCE_AUDIO_REQUIRED: 52209;
16
16
  readonly LEGACY_PARAKEET_MODEL_DEPRECATED: 52210;
17
17
  readonly LEGACY_TTS_MODEL_DEPRECATED: 52211;
18
+ readonly RPC_SERVER_OPERATION_FAILED: 52423;
18
19
  readonly MODEL_UNLOAD_FAILED: 52400;
19
20
  readonly EMBED_FAILED: 52401;
20
21
  readonly EMBED_NO_EMBEDDINGS: 52402;