@qvac/sdk 0.23.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 (239) hide show
  1. package/NOTICE +115 -58
  2. package/README.md +10 -13
  3. package/dist/examples/asr/parakeet-sortformer.js +24 -14
  4. package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +40 -11
  5. package/dist/examples/asr/parakeet-unified-coreml.js +14 -9
  6. package/dist/examples/asr/whispercpp-prompt.js +9 -5
  7. package/dist/examples/assess-model-fit.d.ts +7 -9
  8. package/dist/examples/assess-model-fit.js +22 -43
  9. package/dist/examples/calc-tokens.d.ts +2 -0
  10. package/dist/examples/calc-tokens.js +21 -0
  11. package/dist/examples/classification/classify-image.js +11 -5
  12. package/dist/examples/completion-stop-reason.d.ts +3 -3
  13. package/dist/examples/completion-stop-reason.js +4 -4
  14. package/dist/examples/diffusion-flux3-klein.d.ts +2 -0
  15. package/dist/examples/diffusion-flux3-klein.js +102 -0
  16. package/dist/examples/diffusion-moss-image.d.ts +2 -0
  17. package/dist/examples/diffusion-moss-image.js +126 -0
  18. package/dist/examples/diffusion-qwen-image-21.js +15 -4
  19. package/dist/examples/embed-multimodal.d.ts +2 -0
  20. package/dist/examples/embed-multimodal.js +80 -0
  21. package/dist/examples/embed-p2p.js +2 -2
  22. package/dist/examples/image/megaloc.d.ts +2 -0
  23. package/dist/examples/image/megaloc.js +37 -0
  24. package/dist/examples/llamacpp-multimodal.js +18 -0
  25. package/dist/examples/rag/rag-hyperdb/pipeline.js +2 -2
  26. package/dist/examples/rag/rag-turbovec.js +2 -2
  27. package/dist/examples/sessions.d.ts +17 -0
  28. package/dist/examples/sessions.js +63 -0
  29. package/dist/examples/tools/llamacpp-deferred-tools.js +8 -4
  30. package/dist/scripts/check-resource-collectors-packaging.js +7 -6
  31. package/dist/scripts/contract/build-contract.d.ts +2 -1
  32. package/dist/scripts/contract/build-contract.js +13 -1
  33. package/dist/scripts/contract/constants-registry.d.ts +17 -0
  34. package/dist/scripts/contract/constants-registry.js +8 -2
  35. package/dist/scripts/contract/method-shapes.d.ts +4 -0
  36. package/dist/scripts/contract/method-shapes.js +4 -0
  37. package/dist/scripts/enforce-inference-versions.d.ts +1 -1
  38. package/dist/scripts/enforce-inference-versions.js +28 -18
  39. package/dist/scripts/generate-bare-kit-runtimes.js +101 -69
  40. package/dist/src/client/api/assess-model-fit.d.ts +17 -17
  41. package/dist/src/client/api/assess-model-fit.js +18 -31
  42. package/dist/src/client/api/audio-edit.d.ts +5 -3
  43. package/dist/src/client/api/audio-edit.js +5 -3
  44. package/dist/src/client/api/audio-gen-result.js +134 -45
  45. package/dist/src/client/api/audio-gen.d.ts +40 -3
  46. package/dist/src/client/api/audio-gen.js +40 -3
  47. package/dist/src/client/api/audio-understand.d.ts +2 -2
  48. package/dist/src/client/api/audio-understand.js +2 -2
  49. package/dist/src/client/api/batch-completion.js +2 -1
  50. package/dist/src/client/api/calc-tokens.d.ts +33 -0
  51. package/dist/src/client/api/calc-tokens.js +44 -0
  52. package/dist/src/client/api/cancel.d.ts +2 -2
  53. package/dist/src/client/api/cancel.js +2 -2
  54. package/dist/src/client/api/classify.d.ts +12 -5
  55. package/dist/src/client/api/classify.js +17 -5
  56. package/dist/src/client/api/client-request-id.d.ts +0 -15
  57. package/dist/src/client/api/client-request-id.js +15 -12
  58. package/dist/src/client/api/completion-stream.d.ts +8 -1
  59. package/dist/src/client/api/completion-stream.js +10 -1
  60. package/dist/src/client/api/delete-cache.d.ts +9 -2
  61. package/dist/src/client/api/delete-cache.js +13 -3
  62. package/dist/src/client/api/diffusion.d.ts +20 -4
  63. package/dist/src/client/api/diffusion.js +23 -5
  64. package/dist/src/client/api/embed.d.ts +82 -29
  65. package/dist/src/client/api/embed.js +64 -19
  66. package/dist/src/client/api/get-model-info.d.ts +2 -2
  67. package/dist/src/client/api/get-model-info.js +2 -2
  68. package/dist/src/client/api/get-system-resources.d.ts +2 -2
  69. package/dist/src/client/api/get-system-resources.js +2 -2
  70. package/dist/src/client/api/heartbeat.d.ts +3 -2
  71. package/dist/src/client/api/heartbeat.js +3 -2
  72. package/dist/src/client/api/index.d.ts +4 -3
  73. package/dist/src/client/api/index.js +2 -1
  74. package/dist/src/client/api/invoke-plugin.d.ts +8 -2
  75. package/dist/src/client/api/invoke-plugin.js +17 -2
  76. package/dist/src/client/api/load-model.js +5 -2
  77. package/dist/src/client/api/ocr.d.ts +5 -3
  78. package/dist/src/client/api/ocr.js +44 -21
  79. package/dist/src/client/api/rag.d.ts +1 -1
  80. package/dist/src/client/api/rag.js +1 -1
  81. package/dist/src/client/api/registry.d.ts +17 -7
  82. package/dist/src/client/api/registry.js +37 -12
  83. package/dist/src/client/api/resume.d.ts +2 -1
  84. package/dist/src/client/api/resume.js +2 -2
  85. package/dist/src/client/api/rpc-server.d.ts +4 -4
  86. package/dist/src/client/api/rpc-server.js +10 -10
  87. package/dist/src/client/api/state.d.ts +2 -2
  88. package/dist/src/client/api/state.js +2 -2
  89. package/dist/src/client/api/subscribe-logs.d.ts +2 -2
  90. package/dist/src/client/api/subscribe-logs.js +2 -2
  91. package/dist/src/client/api/suspend.d.ts +4 -2
  92. package/dist/src/client/api/suspend.js +4 -3
  93. package/dist/src/client/api/text-to-speech.d.ts +14 -5
  94. package/dist/src/client/api/text-to-speech.js +83 -29
  95. package/dist/src/client/api/transcribe.d.ts +6 -2
  96. package/dist/src/client/api/transcribe.js +7 -1
  97. package/dist/src/client/api/unload-model.d.ts +19 -7
  98. package/dist/src/client/api/unload-model.js +29 -11
  99. package/dist/src/client/api/upscale.d.ts +6 -3
  100. package/dist/src/client/api/upscale.js +9 -4
  101. package/dist/src/client/api/vector-index.d.ts +50 -16
  102. package/dist/src/client/api/vector-index.js +100 -48
  103. package/dist/src/client/api/video-request.d.ts +5 -5
  104. package/dist/src/client/api/video.d.ts +3 -2
  105. package/dist/src/client/api/video.js +3 -2
  106. package/dist/src/client/api/vla.d.ts +9 -5
  107. package/dist/src/client/api/vla.js +17 -8
  108. package/dist/src/client/api/world.d.ts +5 -5
  109. package/dist/src/client/api/world.js +4 -4
  110. package/dist/src/client/init-hooks.d.ts +6 -4
  111. package/dist/src/client/init-hooks.js +12 -15
  112. package/dist/src/client/logging-stream-registry.d.ts +6 -3
  113. package/dist/src/client/logging-stream-registry.js +31 -12
  114. package/dist/src/client/rpc/bundle-stamp.d.ts +29 -0
  115. package/dist/src/client/rpc/bundle-stamp.js +75 -0
  116. package/dist/src/client/rpc/expo-home-dir.d.ts +2 -0
  117. package/dist/src/client/rpc/expo-home-dir.js +4 -0
  118. package/dist/src/client/rpc/expo-rpc-client.js +189 -135
  119. package/dist/src/client/rpc/node-rpc-client.js +322 -413
  120. package/dist/src/client/rpc/pear-runtime.d.ts +12 -0
  121. package/dist/src/client/rpc/pear-runtime.js +12 -0
  122. package/dist/src/client/rpc/rpc-client.d.ts +5 -4
  123. package/dist/src/client/rpc/rpc-client.js +126 -23
  124. package/dist/src/client/rpc/rpc-error.js +21 -2
  125. package/dist/src/client/rpc/unbundled-harness.d.ts +16 -0
  126. package/dist/src/client/rpc/unbundled-harness.js +27 -0
  127. package/dist/src/client/rpc/worker-failure.d.ts +27 -0
  128. package/dist/src/client/rpc/worker-failure.js +61 -0
  129. package/dist/src/client/session-registry.d.ts +75 -0
  130. package/dist/src/client/session-registry.js +149 -0
  131. package/dist/src/client/session.d.ts +125 -0
  132. package/dist/src/client/session.js +148 -0
  133. package/dist/src/commands/bundle/addons.d.ts +14 -0
  134. package/dist/src/commands/bundle/addons.js +65 -0
  135. package/dist/src/commands/bundle/constants.js +1 -0
  136. package/dist/src/commands/bundle/entry-gen.d.ts +1 -5
  137. package/dist/src/commands/bundle/entry-gen.js +17 -50
  138. package/dist/src/commands/bundle/index.d.ts +59 -13
  139. package/dist/src/commands/bundle/index.js +345 -121
  140. package/dist/src/commands/bundle/link.d.ts +58 -0
  141. package/dist/src/commands/bundle/link.js +135 -0
  142. package/dist/src/commands/bundle/node-support.d.ts +13 -0
  143. package/dist/src/commands/bundle/node-support.js +23 -0
  144. package/dist/src/commands/bundle/read-bundle.d.ts +9 -0
  145. package/dist/src/commands/bundle/read-bundle.js +27 -0
  146. package/dist/src/commands/bundle/resolve-sdk-import.d.ts +6 -0
  147. package/dist/src/commands/bundle/resolve-sdk-import.js +24 -28
  148. package/dist/src/commands/bundle/scratch.d.ts +35 -0
  149. package/dist/src/commands/bundle/scratch.js +178 -0
  150. package/dist/src/commands/bundle/targets.d.ts +14 -0
  151. package/dist/src/commands/bundle/targets.js +37 -0
  152. package/dist/src/commands/host-prebuilds/index.d.ts +5 -4
  153. package/dist/src/commands/host-prebuilds/index.js +9 -7
  154. package/dist/src/commands/index.d.ts +4 -3
  155. package/dist/src/commands/verify/abi.d.ts +20 -14
  156. package/dist/src/commands/verify/abi.js +11 -79
  157. package/dist/src/commands/verify/bare-kit-runtime.d.ts +20 -22
  158. package/dist/src/commands/verify/bare-kit-runtime.js +102 -150
  159. package/dist/src/commands/verify/bare-kit-runtimes.d.ts +10 -9
  160. package/dist/src/commands/verify/bare-kit-runtimes.js +21 -21
  161. package/dist/src/commands/verify/bundle-source.js +25 -21
  162. package/dist/src/commands/verify/engines-advice.d.ts +2 -8
  163. package/dist/src/commands/verify/engines-advice.js +7 -54
  164. package/dist/src/commands/verify/index.d.ts +30 -29
  165. package/dist/src/commands/verify/index.js +92 -200
  166. package/dist/src/commands/verify/prebuilds.d.ts +3 -5
  167. package/dist/src/commands/verify/prebuilds.js +1 -2
  168. package/dist/src/commands/verify/resource-collectors.d.ts +0 -6
  169. package/dist/src/commands/verify/resource-collectors.js +1 -50
  170. package/dist/src/commands/verify/sidecar-runtime.d.ts +6 -0
  171. package/dist/src/commands/verify/sidecar-runtime.js +51 -0
  172. package/dist/src/expo/plugins/withBareKit.d.ts +59 -0
  173. package/dist/src/expo/plugins/withBareKit.js +204 -0
  174. package/dist/src/expo/plugins/withMobileBundle.d.ts +4 -11
  175. package/dist/src/expo/plugins/withMobileBundle.js +36 -57
  176. package/dist/src/expo/plugins/withQvacSDK.d.ts +1 -0
  177. package/dist/src/expo/plugins/withQvacSDK.js +3 -0
  178. package/dist/src/index.d.ts +6 -5
  179. package/dist/src/index.js +10 -14
  180. package/dist/src/logging/utils.js +10 -2
  181. package/dist/src/plugin-ids.d.ts +2 -1
  182. package/dist/src/plugin-ids.js +2 -0
  183. package/dist/src/schemas/public.d.ts +1 -1
  184. package/dist/src/schemas/public.js +1 -1
  185. package/dist/src/schemas/sdk-errors-client.d.ts +5 -6
  186. package/dist/src/schemas/sdk-errors-client.js +30 -36
  187. package/dist/src/schemas/sdk-errors-server.d.ts +11 -1
  188. package/dist/src/schemas/sdk-errors-server.js +60 -2
  189. package/dist/src/server/rpc/rpc-utils.d.ts +25 -4
  190. package/dist/src/server/rpc/rpc-utils.js +39 -5
  191. package/dist/src/utils/errors-client.d.ts +37 -29
  192. package/dist/src/utils/errors-client.js +50 -41
  193. package/dist/src/utils/errors-server.d.ts +59 -1
  194. package/dist/src/utils/errors-server.js +110 -1
  195. package/dist/src/utils/withTimeout.js +34 -17
  196. package/dist/src/worker/handle-request.js +25 -22
  197. package/dist/src/worker/handler-utils.d.ts +2 -6
  198. package/dist/src/worker/handler-utils.js +2 -20
  199. package/dist/src/worker/index.d.ts +2 -4
  200. package/dist/src/worker/index.js +23 -35
  201. package/dist/src/worker/plugins/ggml-image-embedding.d.ts +2 -0
  202. package/dist/src/worker/plugins/ggml-image-embedding.js +1 -0
  203. package/dist/src/worker/shim.d.ts +4 -0
  204. package/dist/src/worker/shim.js +7 -0
  205. package/dist/src/worker/start.d.ts +9 -0
  206. package/dist/src/worker/start.js +16 -0
  207. package/dist/src/worker/unbundled-shim.d.ts +2 -0
  208. package/dist/src/worker/unbundled-shim.js +4 -0
  209. package/docs/system-resources-support-matrix.md +27 -19
  210. package/package.json +62 -51
  211. package/src/electron-forge/index.cjs +65 -91
  212. package/dist/examples/model-fit-ui/server.d.ts +0 -24
  213. package/dist/examples/model-fit-ui/server.js +0 -221
  214. package/dist/src/client/rpc/ensure-worker-ready.d.ts +0 -9
  215. package/dist/src/client/rpc/ensure-worker-ready.js +0 -17
  216. package/dist/src/client/rpc/init-timeout.d.ts +0 -26
  217. package/dist/src/client/rpc/init-timeout.js +0 -25
  218. package/dist/src/client/rpc/ipc-socket-path.d.ts +0 -11
  219. package/dist/src/client/rpc/ipc-socket-path.js +0 -30
  220. package/dist/src/client/rpc/worker-startup-error.d.ts +0 -12
  221. package/dist/src/client/rpc/worker-startup-error.js +0 -13
  222. package/dist/src/commands/bundle/bare-pack.d.ts +0 -21
  223. package/dist/src/commands/bundle/bare-pack.js +0 -77
  224. package/dist/src/commands/bundle/manifest.d.ts +0 -25
  225. package/dist/src/commands/bundle/manifest.js +0 -192
  226. package/dist/src/expo/plugins/link-addons.d.ts +0 -18
  227. package/dist/src/expo/plugins/link-addons.js +0 -65
  228. package/dist/src/pear/pre.d.ts +0 -21
  229. package/dist/src/pear/pre.js +0 -450
  230. package/dist/src/server/env.d.ts +0 -22
  231. package/dist/src/server/env.js +0 -59
  232. package/dist/src/server/utils/qvac-paths.d.ts +0 -2
  233. package/dist/src/server/utils/qvac-paths.js +0 -5
  234. package/dist/src/server/utils/worker-lock.d.ts +0 -3
  235. package/dist/src/server/utils/worker-lock.js +0 -67
  236. package/dist/src/worker/create-server.d.ts +0 -8
  237. package/dist/src/worker/create-server.js +0 -51
  238. package/dist/src/worker/lifecycle.d.ts +0 -23
  239. package/dist/src/worker/lifecycle.js +0 -149
@@ -1,10 +1,17 @@
1
- import { promises as fsp } from 'node:fs';
2
1
  import path from 'node:path';
3
2
  import { DEFAULT_HOSTS } from '../../commands/bundle/constants.js';
4
- import { buildNestedPathIndex, extractBarePackHeader, extractPackedString } from '../../commands/bundle/manifest.js';
3
+ import { buildNestedPathIndex } from '../../commands/bundle/addons.js';
4
+ import { bundleRoot, readBundle } from '../../commands/bundle/read-bundle.js';
5
5
  import { createLimiter, deduplicateAddons, FS_CONCURRENCY, readAddonPackageJson } from '../../commands/verify/addon-source.js';
6
6
  /** bare-pack resolves a linked native addon to this prefix instead of a module path. */
7
7
  const LINKED_PREFIX = 'linked:';
8
+ /**
9
+ * Condition naming the addon a `require.addon()` specifier loads. An offloading
10
+ * target such as bare-stow's `bare-sidecar` points it at the binary beside the
11
+ * bundle (`/../index.bundle.d/...`), or at `deferred:` when the package keeps no
12
+ * binary of its own, as split addons do.
13
+ */
14
+ const ADDON_KEY = 'addon';
8
15
  /** Reserved resolution key naming the package.json that owns a module. */
9
16
  const PACKAGE_KEY = '#package';
10
17
  /** Export conditions that name a platform. */
@@ -19,43 +26,34 @@ export class InvalidBundleSourceError extends Error {
19
26
  const reason = cause instanceof Error ? cause.message : String(cause);
20
27
  super(`Bundle at ${bundlePath} could not be parsed as a bare-pack bundle.\n\n` +
21
28
  ` Reason: ${reason}\n\n` +
22
- ' Make sure the path points to a worker.bundle.js generated by bundleSdk.');
29
+ ' Make sure the path points to a bundle generated by bundleSdk.');
23
30
  this.name = 'InvalidBundleSourceError';
24
31
  this.bundlePath = bundlePath;
25
32
  }
26
33
  }
27
34
  export async function collectAddonsFromBundle(options) {
28
35
  const { bundlePath, projectRoot, hosts, diagnostics } = options;
29
- let bundleText;
30
- try {
31
- bundleText = await fsp.readFile(bundlePath, 'utf8');
32
- }
33
- catch (error) {
34
- throw new InvalidBundleSourceError(bundlePath, error);
35
- }
36
- let resolutions;
37
- let main;
38
- let imports;
36
+ let bundle;
39
37
  try {
40
- const packed = extractPackedString(bundleText);
41
- const header = extractBarePackHeader(packed);
42
- resolutions = header.resolutions ?? {};
43
- main = header.main;
44
- imports = header.imports ?? {};
38
+ bundle = await readBundle(bundlePath);
45
39
  }
46
40
  catch (error) {
47
41
  throw new InvalidBundleSourceError(bundlePath, error);
48
42
  }
43
+ const resolutions = bundle.resolutions;
44
+ const main = bundle.main ?? undefined;
45
+ const imports = bundle.imports;
49
46
  if (diagnostics !== undefined && Object.keys(resolutions).length === 0) {
50
47
  diagnostics.emptyResolutions = true;
51
48
  }
52
- const pathsByPackage = buildNestedPathIndex(resolutions, projectRoot);
49
+ const root = bundleRoot(main, projectRoot);
50
+ const pathsByPackage = buildNestedPathIndex(resolutions, root);
53
51
  const analysed = analyseLinkedHosts({
54
52
  resolutions,
55
53
  main,
56
54
  imports,
57
55
  hosts: hosts ?? [],
58
- projectRoot,
56
+ projectRoot: root,
59
57
  pathsByPackage
60
58
  });
61
59
  const limit = createLimiter(FS_CONCURRENCY);
@@ -99,7 +97,7 @@ function analyseLinkedHosts(options) {
99
97
  /**
100
98
  * Which of `hosts` link each package's addon, keyed by the owning package.json.
101
99
  * A host counts only when the bundle both reaches a module of that package on
102
- * its platform *and* resolves a `linked:` addon there.
100
+ * its platform *and* resolves an addon there, `linked:` or through `addon`.
103
101
  *
104
102
  * Both halves are needed because bare-pack emits two graph shapes: for a single
105
103
  * host it resolves conditions eagerly, dropping the binding module of a package
@@ -159,6 +157,12 @@ function linkedOwnersOn(resolutions, main, platform, projectRoot) {
159
157
  for (const [specifier, target] of Object.entries(edges)) {
160
158
  if (specifier === PACKAGE_KEY)
161
159
  continue;
160
+ const addon = asRecord(target)?.[ADDON_KEY];
161
+ if (addon !== undefined) {
162
+ if (targetsOn(addon, platform).length > 0)
163
+ linksAddon = true;
164
+ continue;
165
+ }
162
166
  for (const resolved of targetsOn(target, platform)) {
163
167
  if (resolved.startsWith(LINKED_PREFIX))
164
168
  linksAddon = true;
@@ -25,18 +25,12 @@ export interface EnginesOverride {
25
25
  lookupSkipped?: boolean;
26
26
  lookupError?: string;
27
27
  }
28
- export interface EnginesUpgrade {
29
- packageName: string;
30
- from: string;
31
- to: string;
32
- bare: string;
33
- }
28
+ /** How to fix the packages that fail one phone platform's runtime. */
34
29
  export interface EnginesAdvice {
35
30
  hosts: string[];
36
31
  runtime: BareRuntime;
32
+ /** Lowest Bare that satisfies every failing engines.bare. */
37
33
  requiredBare: string;
38
- upgrade: EnginesUpgrade | null;
39
- upgradeHint: string;
40
34
  overrides: EnginesOverride[];
41
35
  packageManager: PackageManagerName | null;
42
36
  }
@@ -1,8 +1,7 @@
1
1
  import semver from 'semver';
2
2
  import { detectPackageManager } from '../../commands/host-prebuilds/package-manager.js';
3
3
  import { formatRuntimeSource } from '../../commands/verify/abi.js';
4
- import { findReactNativeBareKitUpgrade, NETWORK_TIMEOUT_MS, REACT_NATIVE_BARE_KIT } from '../../commands/verify/bare-kit-runtime.js';
5
- import { REACT_NATIVE_BARE_KIT_RUNTIMES } from '../../commands/verify/bare-kit-runtimes.js';
4
+ import { NETWORK_TIMEOUT_MS } from '../../commands/verify/bare-kit-runtime.js';
6
5
  const REGISTRY_URL = 'https://registry.npmjs.org';
7
6
  /** The registry's abbreviated metadata lists `engines` per version at a fraction of the full size. */
8
7
  const ABBREVIATED_METADATA_TYPE = 'application/vnd.npm.install-v1+json';
@@ -122,48 +121,6 @@ function requiredBareVersion(ranges) {
122
121
  }
123
122
  return required ?? 'unknown';
124
123
  }
125
- function newestTableEntry() {
126
- const versions = Object.keys(REACT_NATIVE_BARE_KIT_RUNTIMES).sort(semver.rcompare);
127
- const newest = versions[0];
128
- return newest === undefined
129
- ? null
130
- : { version: newest, ...REACT_NATIVE_BARE_KIT_RUNTIMES[newest] };
131
- }
132
- function buildUpgrade(runtime, ranges, requiredBare) {
133
- if (runtime.source === 'react-native-bare-kit' && runtime.packageVersion !== undefined) {
134
- const target = findReactNativeBareKitUpgrade(runtime.packageVersion, ranges);
135
- if (target !== null) {
136
- return {
137
- upgrade: {
138
- packageName: REACT_NATIVE_BARE_KIT,
139
- from: runtime.packageVersion,
140
- to: target.version,
141
- bare: target.bare
142
- },
143
- upgradeHint: `Upgrade ${REACT_NATIVE_BARE_KIT} to ${target.version} or newer ` +
144
- `(embeds bare-kit ${target.bareKit}, Bare ${target.bare}).`
145
- };
146
- }
147
- const newest = newestTableEntry();
148
- return {
149
- upgrade: null,
150
- upgradeHint: `No ${REACT_NATIVE_BARE_KIT} release in the built-in table embeds Bare ${requiredBare} or newer` +
151
- (newest === null
152
- ? '.'
153
- : `; the newest known, ${newest.version}, embeds Bare ${newest.bare}. Check for a newer release.`)
154
- };
155
- }
156
- if (runtime.source === 'bare-runtime' || runtime.source === 'bare') {
157
- return {
158
- upgrade: null,
159
- upgradeHint: `Upgrade ${runtime.source} to ${requiredBare} or newer.`
160
- };
161
- }
162
- return {
163
- upgrade: null,
164
- upgradeHint: `The runtime version comes from ${runtime.source}; raise it to ${requiredBare} or newer if the target runtime allows it.`
165
- };
166
- }
167
124
  export async function buildEnginesAdvice(options) {
168
125
  const { projectRoot, hosts, runtime, failures, packages, network = true, onProgress, fetchPackageMetadata: fetchOne = fetchPackageMetadata } = options;
169
126
  const grouped = groupFailures(failures);
@@ -215,7 +172,6 @@ export async function buildEnginesAdvice(options) {
215
172
  hosts,
216
173
  runtime,
217
174
  requiredBare,
218
- ...buildUpgrade(runtime, allRanges, requiredBare),
219
175
  overrides,
220
176
  packageManager
221
177
  };
@@ -230,13 +186,12 @@ export function formatEnginesAdvice(advice) {
230
186
  const lines = [
231
187
  ` Fix for ${advice.hosts.join(', ')}:`,
232
188
  ` Runtime: Bare ${advice.runtime.version} (from ${formatRuntimeSource(advice.runtime)})`,
233
- ...advice.overrides.map((override) => ` Requires: ${override.name}@${override.installedVersions.join(', ') || 'unknown'} needs Bare ${override.enginesBare.join(' and ')}`),
234
- ` Option 1: ${advice.upgradeHint}`
189
+ ...advice.overrides.map((override) => ` Requires: ${override.name}@${override.installedVersions.join(', ') || 'unknown'} needs Bare ${override.enginesBare.join(' and ')}`)
235
190
  ];
236
191
  for (const override of advice.overrides) {
237
192
  const installed = override.installedVersions.join(', ') || 'unknown';
238
193
  if (override.lookupSkipped === true) {
239
- lines.push(` Option 2 (${override.name}): pin an older release; run again with network lookups ` +
194
+ lines.push(` Override (${override.name}): pin an older release; run again with network lookups ` +
240
195
  'enabled (without --offline) to find one that runs on this Bare.');
241
196
  continue;
242
197
  }
@@ -244,16 +199,14 @@ export function formatEnginesAdvice(advice) {
244
199
  const acceptedBy = override.parents.length === 0
245
200
  ? ` on the ${installed} release line`
246
201
  : ` that ${override.parents.map((p) => `${p.name} (${p.range})`).join(', ')} accept${override.parents.length === 1 ? 's' : ''}`;
247
- lines.push(` Option 2 (${override.name}): no release that runs on Bare ${advice.runtime.version}${acceptedBy} was found` +
248
- (override.lookupError === undefined
249
- ? '; upgrade the runtime.'
250
- : ` (${override.lookupError}).`));
202
+ lines.push(` Override (${override.name}): no release that runs on Bare ${advice.runtime.version}${acceptedBy} was found` +
203
+ (override.lookupError === undefined ? '.' : ` (${override.lookupError}).`));
251
204
  continue;
252
205
  }
253
206
  const field = advice.packageManager === null
254
207
  ? '"overrides" (npm/bun), "pnpm.overrides" or "resolutions" (yarn)'
255
208
  : MANIFEST_FIELD[advice.packageManager];
256
- lines.push(` Option 2 (${override.name}): pin ${installed} -> ${override.version} with ${field} in your app's package.json:`);
209
+ lines.push(` Override (${override.name}): pin ${installed} -> ${override.version} with ${field} in your app's package.json:`);
257
210
  for (const line of (override.snippet ?? '').split('\n'))
258
211
  lines.push(` ${line}`);
259
212
  const rejected = override.parents.filter((parent) => !parent.satisfied);
@@ -266,6 +219,6 @@ export function formatEnginesAdvice(advice) {
266
219
  lines.push(' bun applies overrides to every copy in the tree.');
267
220
  }
268
221
  }
269
- lines.push('');
222
+ lines.push(` Or: use an @qvac/sdk release whose bare-stow pins a Bare Kit with Bare ${advice.requiredBare} or newer.`, '');
270
223
  return lines;
271
224
  }
@@ -1,27 +1,40 @@
1
1
  import { type AddonSourceKind, type NativeAddon } from '../../commands/verify/addon-source.js';
2
2
  import { type MissingPrebuildIssue } from '../../commands/verify/prebuilds.js';
3
3
  import { type AbiIssue, type BareRuntimeResolution } from '../../commands/verify/abi.js';
4
- import { type FetchText, type ProgressFn } from '../../commands/verify/bare-kit-runtime.js';
4
+ import { type BareKitPlatform, type FetchText, type ProgressFn } from '../../commands/verify/bare-kit-runtime.js';
5
5
  import { type EnginesAdvice, type FetchPackageMetadata } from '../../commands/verify/engines-advice.js';
6
+ import { type BundleTarget } from '../../commands/bundle/targets.js';
7
+ export type DesktopRuntime = 'bare-sidecar' | 'pear-runtime' | 'bare-kit-kotlin';
8
+ /** The Bare that each target runs a bundle on for desktop hosts. */
9
+ export declare const DESKTOP_RUNTIMES: Record<BundleTarget, DesktopRuntime>;
6
10
  export interface VerifyBundleOptions {
7
11
  projectRoot: string;
8
12
  addonsSource: string;
9
13
  hosts: string[];
10
- bareRuntimeVersion?: string;
11
- configPath?: string;
12
14
  /**
13
- * Allow GitHub and npm registry requests: GitHub for a react-native-bare-kit
14
- * release newer than the built-in table, the registry only after a mismatch
15
- * is found, to suggest an override. Defaults to true.
15
+ * The Bare that desktop hosts run: the project's bare-sidecar; the
16
+ * bare-sidecar that pear-runtime resolves, for a `pear-runtime` bundle; or
17
+ * bare-kit-kotlin as pinned by bare-stow, for a `bare-kit` bundle on the JVM.
18
+ * Defaults to the one for the target recorded in the harness `package.json`
19
+ * next to a bundle, else the project's bare-sidecar.
20
+ */
21
+ desktopRuntime?: DesktopRuntime;
22
+ /**
23
+ * Allow GitHub and npm registry requests: GitHub for a Bare Kit binding or
24
+ * bare-kit release missing from the built-in tables, the registry only after
25
+ * a mismatch is found, to suggest an override. Defaults to true.
16
26
  */
17
27
  network?: boolean;
18
28
  /** Called before any step that waits on the network. */
19
29
  onProgress?: ProgressFn;
20
- /** Test seams for the network lookups. */
30
+ /** Test seams for the bare-stow whose Bare Kit pins are read, and the network lookups. */
31
+ bareStowDir?: string;
21
32
  fetchText?: FetchText;
22
33
  fetchPackageMetadata?: FetchPackageMetadata;
23
34
  }
24
- export interface RuntimeGroup {
35
+ /** The Bare a platform runs, and the checked hosts on that platform. */
36
+ export interface PlatformRuntime {
37
+ platform: BareKitPlatform | 'desktop';
25
38
  hosts: string[];
26
39
  resolution: BareRuntimeResolution;
27
40
  }
@@ -31,20 +44,6 @@ export interface InvalidSourceIssue {
31
44
  message: string;
32
45
  addonsSource: string;
33
46
  }
34
- export interface InvalidRuntimeVersionIssue {
35
- code: 'invalid-runtime-version';
36
- level: 'error';
37
- message: string;
38
- providedValue: string;
39
- source: 'flag' | 'config';
40
- }
41
- export interface ConfigLoadFailedIssue {
42
- code: 'config-load-failed';
43
- level: 'warning';
44
- message: string;
45
- configPath: string;
46
- reason: string;
47
- }
48
47
  export interface InvalidPackageJsonIssue {
49
48
  code: 'invalid-package-json';
50
49
  level: 'warning';
@@ -59,20 +58,22 @@ export interface EmptyBundleResolutionsIssue {
59
58
  message: string;
60
59
  bundlePath: string;
61
60
  }
62
- export type VerifyBundleIssue = MissingPrebuildIssue | AbiIssue | InvalidSourceIssue | InvalidRuntimeVersionIssue | ConfigLoadFailedIssue | InvalidPackageJsonIssue | EmptyBundleResolutionsIssue;
61
+ export type VerifyBundleIssue = MissingPrebuildIssue | AbiIssue | InvalidSourceIssue | InvalidPackageJsonIssue | EmptyBundleResolutionsIssue;
63
62
  export interface VerifyBundleResult {
64
63
  addonsSource: string;
65
64
  resolvedAddonsSource: string;
66
65
  sourceKind: AddonSourceKind | null;
67
66
  hosts: string[];
68
- /** Runtime of the first entry in `runtimes`: the mobile one when any host is mobile. */
69
- runtime: BareRuntimeResolution | null;
70
- /** Mobile and desktop hosts run different Bare builds, so each is resolved separately. */
71
- runtimes?: RuntimeGroup[];
67
+ /**
68
+ * Bare runtime of each platform among the hosts, which ABI and engines.bare
69
+ * are checked against: Bare Kit's on phones, and on desktop the one
70
+ * `desktopRuntime` names.
71
+ */
72
+ runtimes: PlatformRuntime[];
72
73
  addons: NativeAddon[];
73
74
  issues: VerifyBundleIssue[];
74
- /** How to fix each runtime that fails an engines.bare range. */
75
- advice?: EnginesAdvice[];
75
+ /** How to fix packages that fail a phone platform's engines.bare check, one entry per platform. */
76
+ advice: EnginesAdvice[];
76
77
  }
77
78
  export declare function verifyBundle(options: VerifyBundleOptions): Promise<VerifyBundleResult>;
78
79
  export declare function hasErrors(result: VerifyBundleResult): boolean;